diff --git a/DEPS b/DEPS index 2435834..f9fcd260d 100644 --- a/DEPS +++ b/DEPS
@@ -297,15 +297,15 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': 'f2ac3b9728f770efb53c34aeca7da6527d36f311', + 'skia_revision': '3901abed003450c20001e6b7538408e484ed7aa9', # 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': '13f3751b987e0fd310cd189123dd86a51212f4bf', + 'v8_revision': '67b99da37770bf0286bf77349e1435d73ae6ae6e', # 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': 'c9360ccbd34aecc458cd13091e28243cf74f9c50', + 'angle_revision': '58392791220067b2114a8c643f39a48420404d98', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -324,7 +324,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Fuchsia sdk # and whatever else without interference from each other. - 'fuchsia_version': 'version:9.20220811.0.1', + 'fuchsia_version': 'version:9.20220811.2.1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling google-toolbox-for-mac # and whatever else without interference from each other. @@ -376,7 +376,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': '73e0b22136d49fb160117916edb829c6a606931d', + 'devtools_frontend_revision': '2b720e0e927ef45c6866215d9edd8e7f3a0fe3b1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -412,7 +412,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': 'bf0707d1389bc80a9cf0666f67224d258650a6a8', + 'dawn_revision': '4acf608cf2268dc894480bc8d125098e944e553c', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -792,7 +792,7 @@ }, 'src/ios/third_party/material_components_ios/src': { - 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '3180c15e869aa3ae1e1eaea4cf5e7477ead2044b', + 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '7dcbd43bd997f34b36e5bb7d4b8b008887751874', 'condition': 'checkout_ios', }, @@ -1102,7 +1102,7 @@ Var('boringssl_git') + '/boringssl.git' + '@' + Var('boringssl_revision'), 'src/third_party/breakpad/breakpad': - Var('chromium_git') + '/breakpad/breakpad.git' + '@' + 'afc8daa2de3d9ef5da015ceb5e7436ed8adb5f47', + Var('chromium_git') + '/breakpad/breakpad.git' + '@' + 'a7a8b9c3002dc4027708f6a644496496877a4b62', 'src/third_party/byte_buddy': { 'packages': [ @@ -1174,7 +1174,7 @@ # For Linux and Chromium OS. 'src/third_party/cros_system_api': { - 'url': Var('chromium_git') + '/chromiumos/platform2/system_api.git' + '@' + 'e6cbdf1d50a8255dff8e787867dab3a2f95dd1c6', + 'url': Var('chromium_git') + '/chromiumos/platform2/system_api.git' + '@' + '3befa16e0af013bceb5c37a7d7e72e1a610a3206', 'condition': 'checkout_linux', }, @@ -1693,7 +1693,7 @@ 'dep_type': 'cipd', }, - 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@476824373c1963ca293213cddd13f6a839390491', + 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@24f4cdea6d0de6c92975421af3865acdafff3641', 'src/third_party/vulkan_memory_allocator': Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git' + '@' + 'ebe84bec02c041d28f902da0214bf442743fc907', @@ -1729,7 +1729,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '44e4c8770158c505b03ee7feafa4859d083b0912', 'src/third_party/webgpu-cts/src': - Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '2fe73f07ac85b224b717d653a8f0070e8c692dab', + Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '147d1666949c757bc00c3e2c4b487e44d70eaa42', 'src/third_party/webrtc': Var('webrtc_git') + '/src.git' + '@' + 'b787e26369eb8ed417e7a80a4fbe82847980f32a', @@ -1772,7 +1772,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/windows-amd64', - 'version': 'rV5hj2Xykfze-wY9ozIelEOoVLxjUV7rPUMxnRrlh80C', + 'version': '58nNno6pNLLSJaZknYmuijuo5gy2tfRBKNI1iCldDlcC', }, ], 'dep_type': 'cipd', @@ -1783,7 +1783,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/mac-amd64', - 'version': 'Gd1BbosIHwOaX5zOlcEpL3_dE4fNnH3ZavJaYPSbIaEC', + 'version': 'yE_XL6pbQ8M0WuI236ObRlkSxu0XMdWs_AnUeo21wa8C', }, ], 'dep_type': 'cipd', @@ -1794,7 +1794,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/mac-arm64', - 'version': 'xjfviFgm_MjrBG13x_JywIF9-wkn8wCyBm7yZVx-V10C', + 'version': 'l46gUmkc-2-OsEMo-oEbpXiBAYg48KtXbtF1lyBh0u8C', }, ], 'dep_type': 'cipd', @@ -1805,7 +1805,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@cce874eebdb4e4f669f662c3f448102c6075ab87', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@2e7678c247fbf1f43fb044d7b980a111810c2ccb', 'condition': 'checkout_src_internal', },
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index d6d170d..22a6de9 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py
@@ -2218,8 +2218,12 @@ results = [] if errors: + # Give warnings instead of errors on presubmit --all and presubmit + # --files. + message_type = (output_api.PresubmitNotifyResult if input_api.no_diffs + else output_api.PresubmitError) results.append( - output_api.PresubmitError( + message_type( 'Trademarked images should not be added to the public repo. ' 'See crbug.com/944754', errors)) return results
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index ed2d7b8..78e1886 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -3918,6 +3918,18 @@ <message name="IDS_PRIVACY_NOTIFICATION_TITLE_MIC" desc="Title for a notification shown when an app is using the microphone."> Microphone in use </message> + <message name="IDS_PRIVACY_NOTIFICATION_MESSAGE_DEFAULT_APP_NAME" desc="A default value for app name in the message label for a notification shown when an app is using the camera/microphone. This is used when no app name is detected and we need to use a default value"> + An app + </message> + <message name="IDS_PRIVACY_NOTIFICATION_MESSAGE_CAMERA_AND_MIC" desc="Message label for a notification shown when an app is using the camera and the microphone."> + <ph name="APP_NAME">$1<ex>Google meet</ex></ph> is currently using your camera and microphone + </message> + <message name="IDS_PRIVACY_NOTIFICATION_MESSAGE_CAMERA" desc="Message label for a notification shown when an app is using the camera."> + <ph name="APP_NAME">$1<ex>Google meet</ex></ph> is currently using your camera + </message> + <message name="IDS_PRIVACY_NOTIFICATION_MESSAGE_MIC" desc="Message label for a notification shown when an app is using the microphone."> + <ph name="APP_NAME">$1<ex>Google meet</ex></ph> is currently using your microphone + </message> <!-- Strings for microphone mute switch notification --> <message name="IDS_MICROPHONE_MUTED_NOTIFICATION_TITLE" desc="Title for a notification shown to the users when an app tries to use the microphone while the microphone is muted.i Similar to IDS_MICROPHONE_MUTED_NOTIFICATION_TITLE_WITH_APP_NAME, except this message contains a generic app name string. Used when the name of the app that's using the microphone cannot be determined.">
diff --git a/ash/ash_strings_grd/IDS_PRIVACY_NOTIFICATION_MESSAGE_CAMERA.png.sha1 b/ash/ash_strings_grd/IDS_PRIVACY_NOTIFICATION_MESSAGE_CAMERA.png.sha1 new file mode 100644 index 0000000..715ac7d --- /dev/null +++ b/ash/ash_strings_grd/IDS_PRIVACY_NOTIFICATION_MESSAGE_CAMERA.png.sha1
@@ -0,0 +1 @@ +bfce600ac28b2dc9009fe5a7ea5e8e2251f8b782 \ No newline at end of file
diff --git a/ash/ash_strings_grd/IDS_PRIVACY_NOTIFICATION_MESSAGE_CAMERA_AND_MIC.png.sha1 b/ash/ash_strings_grd/IDS_PRIVACY_NOTIFICATION_MESSAGE_CAMERA_AND_MIC.png.sha1 new file mode 100644 index 0000000..78ebaf19 --- /dev/null +++ b/ash/ash_strings_grd/IDS_PRIVACY_NOTIFICATION_MESSAGE_CAMERA_AND_MIC.png.sha1
@@ -0,0 +1 @@ +f36a9f365ff1aee48b5123904b9b651a05e443b4 \ No newline at end of file
diff --git a/ash/ash_strings_grd/IDS_PRIVACY_NOTIFICATION_MESSAGE_DEFAULT_APP_NAME.png.sha1 b/ash/ash_strings_grd/IDS_PRIVACY_NOTIFICATION_MESSAGE_DEFAULT_APP_NAME.png.sha1 new file mode 100644 index 0000000..d5aa7555 --- /dev/null +++ b/ash/ash_strings_grd/IDS_PRIVACY_NOTIFICATION_MESSAGE_DEFAULT_APP_NAME.png.sha1
@@ -0,0 +1 @@ +f14a36a2a977cb81ad6cf1e76f5687f4fc498187 \ No newline at end of file
diff --git a/ash/ash_strings_grd/IDS_PRIVACY_NOTIFICATION_MESSAGE_MIC.png.sha1 b/ash/ash_strings_grd/IDS_PRIVACY_NOTIFICATION_MESSAGE_MIC.png.sha1 new file mode 100644 index 0000000..f91fefe --- /dev/null +++ b/ash/ash_strings_grd/IDS_PRIVACY_NOTIFICATION_MESSAGE_MIC.png.sha1
@@ -0,0 +1 @@ +75cce1456a87ff61ca9c45f9eaff537bc02337f0 \ No newline at end of file
diff --git a/ash/capture_mode/capture_mode_session_focus_cycler.cc b/ash/capture_mode/capture_mode_session_focus_cycler.cc index 2ffdaff..9614c566 100644 --- a/ash/capture_mode/capture_mode_session_focus_cycler.cc +++ b/ash/capture_mode/capture_mode_session_focus_cycler.cc
@@ -546,6 +546,24 @@ } void CaptureModeSessionFocusCycler::OnWidgetClosing(views::Widget* widget) { + OnWidgetDestroying(widget); +} + +void CaptureModeSessionFocusCycler::OnWidgetDestroying(views::Widget* widget) { + // Note that we implement both `OnWidgetClosing()` and `OnWidgetDestroying()`. + // - `OnWidgetClosing()` is called synchronously when either `Close()` or + // `CloseNow()` are called on the widget. + // - `OnWidgetDestroying()` is called: + // - Synchronously if `CloseNow()` is used. + // - Asynchronously if `Close()` is used. + // - However, `OnWidgetClosing()` may never get called at all if the native + // window of the widget gets deleted without calling either `Close()` or + // `CloseNow()`. See https://crbug.com/1350743. + // Implementing both let's us handle the closing synchronously via + // `OnWidgetClosing()`, and avoid any crashes or UAFs if it was never called. + if (!settings_menu_widget_observeration_.IsObserving()) + return; + settings_menu_opened_with_keyboard_nav_ = false; settings_menu_widget_observeration_.Reset();
diff --git a/ash/capture_mode/capture_mode_session_focus_cycler.h b/ash/capture_mode/capture_mode_session_focus_cycler.h index a26e475f..cf3e60eb 100644 --- a/ash/capture_mode/capture_mode_session_focus_cycler.h +++ b/ash/capture_mode/capture_mode_session_focus_cycler.h
@@ -186,6 +186,7 @@ // views::WidgetObserver: void OnWidgetClosing(views::Widget* widget) override; + void OnWidgetDestroying(views::Widget* widget) override; private: friend class CaptureModeSessionTestApi;
diff --git a/ash/capture_mode/capture_mode_unittests.cc b/ash/capture_mode/capture_mode_unittests.cc index 525dc9f..7a7ed36bf 100644 --- a/ash/capture_mode/capture_mode_unittests.cc +++ b/ash/capture_mode/capture_mode_unittests.cc
@@ -4126,6 +4126,19 @@ } } +// A regression test for a UAF issue reported at https://crbug.com/1350743, in +// which if a the native widget of the settings menu gets deleted without +// calling `Close()` or `CloseNow()` on the widget, we get a UAF. This can +// happen when all the windows in the window tree hierarchy gets deleted e.g. +// when shutting down. +TEST_F(CaptureModeTest, SettingsMenuWidgetDestruction) { + CaptureModeTestApi().StartForFullscreen(true); + ClickOnView(GetSettingsButton(), GetEventGenerator()); + auto* widget = GetCaptureModeSettingsWidget(); + ASSERT_TRUE(widget); + delete widget->GetNativeWindow(); +} + // A test class that uses a mock time task environment. class CaptureModeMockTimeTest : public CaptureModeTest { public:
diff --git a/ash/components/disks/disk_mount_manager.cc b/ash/components/disks/disk_mount_manager.cc index 8033b79..8bcb064 100644 --- a/ash/components/disks/disk_mount_manager.cc +++ b/ash/components/disks/disk_mount_manager.cc
@@ -524,6 +524,11 @@ } } + // CrosDisksClient::Observer override. + void OnMountProgress(const MountEntry& entry) override { + VLOG(1) << "OnMountProgress: " << entry; + } + // Callback for UnmountPath. void OnUnmountPath(UnmountPathCallback callback, const std::string& mount_path,
diff --git a/ash/components/disks/disk_mount_manager.h b/ash/components/disks/disk_mount_manager.h index 5623bb3d..678eae91 100644 --- a/ash/components/disks/disk_mount_manager.h +++ b/ash/components/disks/disk_mount_manager.h
@@ -74,8 +74,8 @@ typedef std::map<std::string, std::unique_ptr<Disk>> DiskMap; - // A struct to store information about mount point. - struct MountPointInfo { + // Information about a mount point. + struct MountPoint { // Device's path. std::string source_path; // Mounted path. @@ -85,16 +85,19 @@ // Condition of mount. MountCondition mount_condition; - MountPointInfo(const std::string& source, - const std::string& mount, - const MountType type, - MountCondition condition) + MountPoint(const std::string& source, + const std::string& mount, + const MountType type, + MountCondition condition = MOUNT_CONDITION_NONE) : source_path(source), mount_path(mount), mount_type(type), mount_condition(condition) {} }; + // TODO Remove once the transition to plain MountPoint is finished. + using MountPointInfo = MountPoint; + // MountPointMap key is mount_path. typedef std::map<std::string, MountPointInfo> MountPointMap;
diff --git a/ash/style/ash_color_mixer.cc b/ash/style/ash_color_mixer.cc index 479a080..be75de76 100644 --- a/ash/style/ash_color_mixer.cc +++ b/ash/style/ash_color_mixer.cc
@@ -379,6 +379,10 @@ void AddAshColorMixer(ui::ColorProvider* provider, const ui::ColorProviderManager::Key& key) { ui::ColorMixer& mixer = provider->AddMixer(); + bool dark_mode = + features::IsDarkLightModeEnabled() + ? key.color_mode == ui::ColorProviderManager::ColorMode::kDark + : DarkLightModeControllerImpl::Get()->IsDarkModeEnabled(); AddShieldAndBaseColors(mixer, key); AddControlsColors(mixer, key); @@ -391,6 +395,16 @@ mixer[ui::kColorAshActionLabelFocusRingHover] = ui::SetAlpha(cros_tokens::kColorPrimaryDark, 0x60); + // TODO(crbug/1350671): Use cros token for + // kPrivacyIndicatorsBackgroundColor instead of constant values. + if (dark_mode) { + mixer[ui::kColorAshPrivacyIndicatorsBackground] = { + SkColorSetRGB(0x37, 0xBE, 0x5F)}; + } else { + mixer[ui::kColorAshPrivacyIndicatorsBackground] = { + SkColorSetRGB(0x14, 0x6C, 0x2E)}; + } + mixer[ui::kColorAshAppListFocusRingNoKeyboard] = {SK_AlphaTRANSPARENT}; mixer[ui::kColorAshAppListSeparatorLight] = { ui::kColorAshSystemUIMenuSeparator};
diff --git a/ash/system/message_center/ash_notification_view.cc b/ash/system/message_center/ash_notification_view.cc index 32900dac..60b9156 100644 --- a/ash/system/message_center/ash_notification_view.cc +++ b/ash/system/message_center/ash_notification_view.cc
@@ -34,6 +34,7 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/color/color_id.h" +#include "ui/color/color_provider.h" #include "ui/compositor/animation_throughput_reporter.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animator.h" @@ -1485,10 +1486,21 @@ if (!notification) return default_color; + auto color_id = notification->accent_color_id(); absl::optional<SkColor> accent_color = notification->accent_color(); - if (!accent_color.has_value()) + + if ((!color_id || !GetWidget()) && !accent_color.has_value()) return default_color; + SkColor fg_color; + // ColorProvider needs widget to be created. + if (color_id && GetWidget()) { + fg_color = GetColorProvider()->GetColor(color_id.value()); + } else { + fg_color = accent_color.value(); + } + + // TODO(crbug/1351205): move color calculation logic to color mixer. // TODO(crbug/1294459): re-evaluate contrast, maybe increase or use fixed HSL float minContrastRatio = DarkLightModeControllerImpl::Get()->IsDarkModeEnabled() @@ -1499,7 +1511,7 @@ SkColor bg_color = AshColorProvider::Get()->GetBaseLayerColor( AshColorProvider::BaseLayerType::kOpaque); return color_utils::BlendForMinContrast( - *accent_color, bg_color, + fg_color, bg_color, /*high_contrast_foreground=*/absl::nullopt, minContrastRatio) .color; }
diff --git a/ash/system/privacy/privacy_indicators_controller.cc b/ash/system/privacy/privacy_indicators_controller.cc index 7812ad454..2f84881 100644 --- a/ash/system/privacy/privacy_indicators_controller.cc +++ b/ash/system/privacy/privacy_indicators_controller.cc
@@ -21,9 +21,11 @@ const char kPrivacyIndicatorsNotifierId[] = "ash.privacy-indicators"; } // namespace -void ModifyPrivacyIndicatorsNotification(const std::string& app_id, - bool camera_is_used, - bool microphone_is_used) { +void ModifyPrivacyIndicatorsNotification( + const std::string& app_id, + absl::optional<std::u16string> app_name, + bool camera_is_used, + bool microphone_is_used) { auto* message_center = message_center::MessageCenter::Get(); std::string id = kPrivacyIndicatorsNotificationIdPrefix + app_id; bool notification_exist = message_center->FindVisibleNotificationById(id); @@ -34,14 +36,23 @@ return; } + std::u16string app_name_str = app_name.value_or(l10n_util::GetStringUTF16( + IDS_PRIVACY_NOTIFICATION_MESSAGE_DEFAULT_APP_NAME)); std::u16string title; + std::u16string message; if (camera_is_used && microphone_is_used) { title = l10n_util::GetStringUTF16( IDS_PRIVACY_NOTIFICATION_TITLE_CAMERA_AND_MIC); + message = l10n_util::GetStringFUTF16( + IDS_PRIVACY_NOTIFICATION_MESSAGE_CAMERA_AND_MIC, app_name_str); } else if (camera_is_used) { title = l10n_util::GetStringUTF16(IDS_PRIVACY_NOTIFICATION_TITLE_CAMERA); + message = l10n_util::GetStringFUTF16( + IDS_PRIVACY_NOTIFICATION_MESSAGE_CAMERA, app_name_str); } else { title = l10n_util::GetStringUTF16(IDS_PRIVACY_NOTIFICATION_TITLE_MIC); + message = l10n_util::GetStringFUTF16(IDS_PRIVACY_NOTIFICATION_MESSAGE_MIC, + app_name_str); } message_center::RichNotificationData optional_fields; @@ -51,7 +62,7 @@ auto notification = CreateSystemNotification( message_center::NotificationType::NOTIFICATION_TYPE_SIMPLE, id, title, - std::u16string(), + message, /*display_source=*/std::u16string(), /*origin_url=*/GURL(), message_center::NotifierId(message_center::NotifierType::SYSTEM_COMPONENT, @@ -61,6 +72,8 @@ /*delegate=*/nullptr, kImeMenuMicrophoneIcon, message_center::SystemNotificationWarningLevel::NORMAL); + notification->set_accent_color_id(ui::kColorAshPrivacyIndicatorsBackground); + if (notification_exist) { message_center->UpdateNotification(id, std::move(notification)); return;
diff --git a/ash/system/privacy/privacy_indicators_controller.h b/ash/system/privacy/privacy_indicators_controller.h index c3e606f5..ab783095 100644 --- a/ash/system/privacy/privacy_indicators_controller.h +++ b/ash/system/privacy/privacy_indicators_controller.h
@@ -8,14 +8,17 @@ #include <string> #include "ash/ash_export.h" +#include "third_party/abseil-cpp/absl/types/optional.h" namespace ash { // Add, update, or remove the privacy notification associated with the given // `app_id`. -void ASH_EXPORT ModifyPrivacyIndicatorsNotification(const std::string& app_id, - bool camera_is_used, - bool microphone_is_used); +void ASH_EXPORT +ModifyPrivacyIndicatorsNotification(const std::string& app_id, + absl::optional<std::u16string> app_name, + bool camera_is_used, + bool microphone_is_used); } // namespace ash
diff --git a/ash/webui/diagnostics_ui/resources/BUILD.gn b/ash/webui/diagnostics_ui/resources/BUILD.gn index 71f2ad0..71c334792 100644 --- a/ash/webui/diagnostics_ui/resources/BUILD.gn +++ b/ash/webui/diagnostics_ui/resources/BUILD.gn
@@ -252,7 +252,7 @@ deps = [ "//ash/webui/common/resources:keyboard_diagram", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", ] }
diff --git a/ash/webui/diagnostics_ui/resources/keyboard_tester.js b/ash/webui/diagnostics_ui/resources/keyboard_tester.js index 5b0e666..3e731ef 100644 --- a/ash/webui/diagnostics_ui/resources/keyboard_tester.js +++ b/ash/webui/diagnostics_ui/resources/keyboard_tester.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_toast/cr_toast.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
diff --git a/ash/webui/firmware_update_ui/resources/firmware_confirmation_dialog.js b/ash/webui/firmware_update_ui/resources/firmware_confirmation_dialog.js index 1f66edd..1cca3b15 100644 --- a/ash/webui/firmware_update_ui/resources/firmware_confirmation_dialog.js +++ b/ash/webui/firmware_update_ui/resources/firmware_confirmation_dialog.js
@@ -9,7 +9,7 @@ import './firmware_shared_fonts.js'; import './strings.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {FirmwareUpdate} from './firmware_update_types.js';
diff --git a/ash/webui/firmware_update_ui/resources/firmware_update_dialog.js b/ash/webui/firmware_update_ui/resources/firmware_update_dialog.js index 53d888d7..4fd0b6a 100644 --- a/ash/webui/firmware_update_ui/resources/firmware_update_dialog.js +++ b/ash/webui/firmware_update_ui/resources/firmware_update_dialog.js
@@ -11,7 +11,7 @@ import './mojom/firmware_update.mojom-lite.js'; import './strings.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/paper-progress/paper-progress.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/ash/webui/multidevice_debug/proximity_auth_webui_handler.cc b/ash/webui/multidevice_debug/proximity_auth_webui_handler.cc index f1fd9c5..953a178 100644 --- a/ash/webui/multidevice_debug/proximity_auth_webui_handler.cc +++ b/ash/webui/multidevice_debug/proximity_auth_webui_handler.cc
@@ -79,18 +79,16 @@ // Converts |log_message| to a raw dictionary value used as a JSON argument to // JavaScript functions. -std::unique_ptr<base::DictionaryValue> LogMessageToDictionary( +base::Value::Dict LogMessageToDictionary( const multidevice::LogBuffer::LogMessage& log_message) { - std::unique_ptr<base::DictionaryValue> dictionary( - new base::DictionaryValue()); - dictionary->SetStringKey(kLogMessageTextKey, log_message.text); - dictionary->SetStringKey( - kLogMessageTimeKey, - base::TimeFormatTimeOfDayWithMilliseconds(log_message.time)); - dictionary->SetStringKey(kLogMessageFileKey, log_message.file); - dictionary->SetIntKey(kLogMessageLineKey, log_message.line); - dictionary->SetIntKey(kLogMessageSeverityKey, - static_cast<int>(log_message.severity)); + base::Value::Dict dictionary; + dictionary.Set(kLogMessageTextKey, log_message.text); + dictionary.Set(kLogMessageTimeKey, + base::TimeFormatTimeOfDayWithMilliseconds(log_message.time)); + dictionary.Set(kLogMessageFileKey, log_message.file); + dictionary.Set(kLogMessageLineKey, log_message.line); + dictionary.Set(kLogMessageSeverityKey, + static_cast<int>(log_message.severity)); return dictionary; } @@ -104,19 +102,15 @@ const char kExternalDeviceFeatureStates[] = "featureStates"; // Creates a SyncState JSON object that can be passed to the WebUI. -std::unique_ptr<base::DictionaryValue> CreateSyncStateDictionary( - double last_success_time, - double next_refresh_time, - bool is_recovering_from_failure, - bool is_enrollment_in_progress) { - std::unique_ptr<base::DictionaryValue> sync_state( - new base::DictionaryValue()); - sync_state->SetDoubleKey(kSyncStateLastSuccessTime, last_success_time); - sync_state->SetDoubleKey(kSyncStateNextRefreshTime, next_refresh_time); - sync_state->SetBoolKey(kSyncStateRecoveringFromFailure, - is_recovering_from_failure); - sync_state->SetBoolKey(kSyncStateOperationInProgress, - is_enrollment_in_progress); +base::Value::Dict CreateSyncStateDictionary(double last_success_time, + double next_refresh_time, + bool is_recovering_from_failure, + bool is_enrollment_in_progress) { + base::Value::Dict sync_state; + sync_state.Set(kSyncStateLastSuccessTime, last_success_time); + sync_state.Set(kSyncStateNextRefreshTime, next_refresh_time); + sync_state.Set(kSyncStateRecoveringFromFailure, is_recovering_from_failure); + sync_state.Set(kSyncStateOperationInProgress, is_enrollment_in_progress); return sync_state; } @@ -191,10 +185,8 @@ void ProximityAuthWebUIHandler::OnLogMessageAdded( const multidevice::LogBuffer::LogMessage& log_message) { - std::unique_ptr<base::DictionaryValue> dictionary = - LogMessageToDictionary(log_message); web_ui()->CallJavascriptFunctionUnsafe("LogBufferInterface.onLogMessageAdded", - *dictionary); + LogMessageToDictionary(log_message)); } void ProximityAuthWebUIHandler::OnLogBufferCleared() { @@ -230,10 +222,9 @@ } void ProximityAuthWebUIHandler::GetLogMessages(const base::Value::List& args) { - base::ListValue json_logs; + base::Value::List json_logs; for (const auto& log : *multidevice::LogBuffer::GetInstance()->logs()) { - json_logs.Append( - base::Value::FromUniquePtrValue(LogMessageToDictionary(log))); + json_logs.Append(LogMessageToDictionary(log)); } web_ui()->CallJavascriptFunctionUnsafe("LogBufferInterface.onGotLogMessages", json_logs); @@ -266,8 +257,7 @@ weak_ptr_factory_.GetWeakPtr())); } -std::unique_ptr<base::Value> -ProximityAuthWebUIHandler::GetTruncatedLocalDeviceId() { +base::Value ProximityAuthWebUIHandler::GetTruncatedLocalDeviceId() { absl::optional<multidevice::RemoteDeviceRef> local_device_metadata = device_sync_client_->GetLocalDeviceMetadata(); @@ -276,16 +266,14 @@ ? local_device_metadata->GetTruncatedDeviceIdForLogs() : "Missing Device ID"; - return std::make_unique<base::Value>(device_id); + return base::Value(device_id); } -std::unique_ptr<base::ListValue> -ProximityAuthWebUIHandler::GetRemoteDevicesList() { - std::unique_ptr<base::ListValue> devices_list_value(new base::ListValue()); +base::Value::List ProximityAuthWebUIHandler::GetRemoteDevicesList() { + base::Value::List devices_list_value; for (const auto& remote_device : device_sync_client_->GetSyncedDevices()) { - devices_list_value->Append( - base::Value(RemoteDeviceToDictionary(remote_device))); + devices_list_value.Append(RemoteDeviceToDictionary(remote_device)); } return devices_list_value; @@ -387,47 +375,47 @@ void ProximityAuthWebUIHandler::NotifyOnEnrollmentFinished( bool success, - std::unique_ptr<base::DictionaryValue> enrollment_state) { + base::Value::Dict enrollment_state) { PA_LOG(VERBOSE) << "Enrollment attempt completed with success=" << success << ":\n" - << *enrollment_state; + << enrollment_state; web_ui()->CallJavascriptFunctionUnsafe( - "LocalStateInterface.onEnrollmentStateChanged", *enrollment_state); + "LocalStateInterface.onEnrollmentStateChanged", enrollment_state); } void ProximityAuthWebUIHandler::NotifyOnSyncFinished( bool was_sync_successful, bool changed, - std::unique_ptr<base::DictionaryValue> device_sync_state) { + base::Value::Dict device_sync_state) { PA_LOG(VERBOSE) << "Device sync completed with result=" << was_sync_successful << ":\n" - << *device_sync_state; + << device_sync_state; web_ui()->CallJavascriptFunctionUnsafe( - "LocalStateInterface.onDeviceSyncStateChanged", *device_sync_state); + "LocalStateInterface.onDeviceSyncStateChanged", device_sync_state); if (changed) { - std::unique_ptr<base::ListValue> synced_devices = GetRemoteDevicesList(); + base::Value::List synced_devices = GetRemoteDevicesList(); PA_LOG(VERBOSE) << "New unlock keys obtained after device sync:\n" - << *synced_devices; + << synced_devices; web_ui()->CallJavascriptFunctionUnsafe( - "LocalStateInterface.onRemoteDevicesChanged", *synced_devices); + "LocalStateInterface.onRemoteDevicesChanged", synced_devices); } } void ProximityAuthWebUIHandler::NotifyGotLocalState( - std::unique_ptr<base::Value> truncated_local_device_id, - std::unique_ptr<base::DictionaryValue> enrollment_state, - std::unique_ptr<base::DictionaryValue> device_sync_state, - std::unique_ptr<base::ListValue> synced_devices) { + base::Value truncated_local_device_id, + base::Value::Dict enrollment_state, + base::Value::Dict device_sync_state, + base::Value::List synced_devices) { PA_LOG(VERBOSE) << "==== Got Local State ====\n" - << "Device ID (truncated): " << *truncated_local_device_id + << "Device ID (truncated): " << truncated_local_device_id << "\nEnrollment State: \n" - << *enrollment_state << "Device Sync State: \n" - << *device_sync_state << "Synced devices: \n" - << *synced_devices; + << enrollment_state << "Device Sync State: \n" + << device_sync_state << "Synced devices: \n" + << synced_devices; web_ui()->CallJavascriptFunctionUnsafe( - "LocalStateInterface.onGotLocalState", *truncated_local_device_id, - *enrollment_state, *device_sync_state, *synced_devices); + "LocalStateInterface.onGotLocalState", truncated_local_device_id, + enrollment_state, device_sync_state, synced_devices); } } // namespace multidevice
diff --git a/ash/webui/multidevice_debug/proximity_auth_webui_handler.h b/ash/webui/multidevice_debug/proximity_auth_webui_handler.h index c37c024a..42ab460 100644 --- a/ash/webui/multidevice_debug/proximity_auth_webui_handler.h +++ b/ash/webui/multidevice_debug/proximity_auth_webui_handler.h
@@ -63,21 +63,18 @@ device_sync::mojom::NetworkRequestResult result_code); void OnGetDebugInfo(device_sync::mojom::DebugInfoPtr debug_info_ptr); - void NotifyOnEnrollmentFinished( - bool success, - std::unique_ptr<base::DictionaryValue> enrollment_state); - void NotifyOnSyncFinished( - bool was_sync_successful, - bool changed, - std::unique_ptr<base::DictionaryValue> device_sync_state); - void NotifyGotLocalState( - std::unique_ptr<base::Value> truncated_local_device_id, - std::unique_ptr<base::DictionaryValue> enrollment_state, - std::unique_ptr<base::DictionaryValue> device_sync_state, - std::unique_ptr<base::ListValue> synced_devices); + void NotifyOnEnrollmentFinished(bool success, + base::Value::Dict enrollment_state); + void NotifyOnSyncFinished(bool was_sync_successful, + bool changed, + base::Value::Dict device_sync_state); + void NotifyGotLocalState(base::Value truncated_local_device_id, + base::Value::Dict enrollment_state, + base::Value::Dict device_sync_state, + base::Value::List synced_devices); - std::unique_ptr<base::Value> GetTruncatedLocalDeviceId(); - std::unique_ptr<base::ListValue> GetRemoteDevicesList(); + base::Value GetTruncatedLocalDeviceId(); + base::Value::List GetRemoteDevicesList(); // The delegate used to fetch dependencies. Must outlive this instance. device_sync::DeviceSyncClient* device_sync_client_;
diff --git a/ash/webui/os_feedback_ui/resources/file_attachment.js b/ash/webui/os_feedback_ui/resources/file_attachment.js index bffed1b..4062d70d4 100644 --- a/ash/webui/os_feedback_ui/resources/file_attachment.js +++ b/ash/webui/os_feedback_ui/resources/file_attachment.js
@@ -7,7 +7,7 @@ import 'chrome://resources/cr_elements/cr_toast/cr_toast.js'; import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import {stringToMojoString16} from 'chrome://resources/ash/common/mojo_utils.js';
diff --git a/ash/webui/os_feedback_ui/resources/share_data_page.js b/ash/webui/os_feedback_ui/resources/share_data_page.js index 822dc74..90c48d1 100644 --- a/ash/webui/os_feedback_ui/resources/share_data_page.js +++ b/ash/webui/os_feedback_ui/resources/share_data_page.js
@@ -5,7 +5,7 @@ import './os_feedback_shared_css.js'; import './file_attachment.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; import 'chrome://resources/cr_elements/policy/cr_tooltip_icon.m.js';
diff --git a/ash/webui/personalization_app/resources/js/ambient/art_album_dialog_element.ts b/ash/webui/personalization_app/resources/js/ambient/art_album_dialog_element.ts index 9e0c579..28a625c3 100644 --- a/ash/webui/personalization_app/resources/js/ambient/art_album_dialog_element.ts +++ b/ash/webui/personalization_app/resources/js/ambient/art_album_dialog_element.ts
@@ -6,7 +6,7 @@ * @fileoverview The element for displaying information for art albums. */ -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {WithPersonalizationStore} from '../personalization_store.js';
diff --git a/ash/webui/personalization_app/resources/js/user/avatar_camera_element.ts b/ash/webui/personalization_app/resources/js/user/avatar_camera_element.ts index b58ec62..be054e04 100644 --- a/ash/webui/personalization_app/resources/js/user/avatar_camera_element.ts +++ b/ash/webui/personalization_app/resources/js/user/avatar_camera_element.ts
@@ -8,11 +8,11 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/paper-spinner/paper-spinner-lite.js'; import '../../css/cros_button_style.css.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assertInstanceof, assertNotReached} from 'chrome://resources/js/assert_ts.js'; import {afterNextRender} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/ash/webui/print_management/resources/BUILD.gn b/ash/webui/print_management/resources/BUILD.gn index d4ac90c..9beced6 100644 --- a/ash/webui/print_management/resources/BUILD.gn +++ b/ash/webui/print_management/resources/BUILD.gn
@@ -56,7 +56,7 @@ ":mojo_interface_provider", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", ] }
diff --git a/ash/webui/print_management/resources/print_job_clear_history_dialog.js b/ash/webui/print_management/resources/print_job_clear_history_dialog.js index 08ce54a2..05573bc 100644 --- a/ash/webui/print_management/resources/print_job_clear_history_dialog.js +++ b/ash/webui/print_management/resources/print_job_clear_history_dialog.js
@@ -3,7 +3,7 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/mojo/mojo/public/mojom/base/big_buffer.mojom-lite.js'; import 'chrome://resources/mojo/mojo/public/mojom/base/string16.mojom-lite.js'; import 'chrome://resources/mojo/mojo/public/mojom/base/time.mojom-lite.js';
diff --git a/ash/webui/scanning/resources/scan_preview.js b/ash/webui/scanning/resources/scan_preview.js index 40f480ce..aaaffb8 100644 --- a/ash/webui/scanning/resources/scan_preview.js +++ b/ash/webui/scanning/resources/scan_preview.js
@@ -6,7 +6,7 @@ import './action_toolbar.js'; import './scanning_fonts_css.js'; import './scanning_shared_css.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/iron-media-query/iron-media-query.js'; import 'chrome://resources/polymer/v3_0/paper-progress/paper-progress.js';
diff --git a/ash/webui/scanning/resources/scanning_app.js b/ash/webui/scanning/resources/scanning_app.js index 6e589d9..09937fa 100644 --- a/ash/webui/scanning/resources/scanning_app.js +++ b/ash/webui/scanning/resources/scanning_app.js
@@ -3,7 +3,7 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_toast/cr_toast.js'; import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js';
diff --git a/ash/webui/shimless_rma/resources/BUILD.gn b/ash/webui/shimless_rma/resources/BUILD.gn index f4335c94..4041a61 100644 --- a/ash/webui/shimless_rma/resources/BUILD.gn +++ b/ash/webui/shimless_rma/resources/BUILD.gn
@@ -299,7 +299,7 @@ "//ui/webui/resources/cr_components/chromeos/network:network_list.m", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo.m", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:util.m", @@ -439,7 +439,7 @@ ":shimless_rma_types", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", ] } @@ -450,7 +450,7 @@ ":mojo_interface_provider", ":shimless_rma_types", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", ] } @@ -461,7 +461,7 @@ ":shimless_rma_types", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", ] } @@ -471,7 +471,7 @@ ":mojo_interface_provider", ":shimless_rma_types", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", ] }
diff --git a/ash/webui/shimless_rma/resources/critical_error_page.js b/ash/webui/shimless_rma/resources/critical_error_page.js index d85ae71..e0b4d869 100644 --- a/ash/webui/shimless_rma/resources/critical_error_page.js +++ b/ash/webui/shimless_rma/resources/critical_error_page.js
@@ -4,7 +4,7 @@ import './base_page.js'; import './shimless_rma_shared_css.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js';
diff --git a/ash/webui/shimless_rma/resources/hardware_error_page.js b/ash/webui/shimless_rma/resources/hardware_error_page.js index 87757f7e..9ab45f9 100644 --- a/ash/webui/shimless_rma/resources/hardware_error_page.js +++ b/ash/webui/shimless_rma/resources/hardware_error_page.js
@@ -4,7 +4,7 @@ import './base_page.js'; import './shimless_rma_shared_css.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js';
diff --git a/ash/webui/shimless_rma/resources/onboarding_enter_rsu_wp_disable_code_page.js b/ash/webui/shimless_rma/resources/onboarding_enter_rsu_wp_disable_code_page.js index c8b574c..16effcb 100644 --- a/ash/webui/shimless_rma/resources/onboarding_enter_rsu_wp_disable_code_page.js +++ b/ash/webui/shimless_rma/resources/onboarding_enter_rsu_wp_disable_code_page.js
@@ -5,7 +5,7 @@ import './shimless_rma_fonts_css.js'; import './shimless_rma_shared_css.js'; import './base_page.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js';
diff --git a/ash/webui/shimless_rma/resources/onboarding_network_page.js b/ash/webui/shimless_rma/resources/onboarding_network_page.js index fba34d4..205b823 100644 --- a/ash/webui/shimless_rma/resources/onboarding_network_page.js +++ b/ash/webui/shimless_rma/resources/onboarding_network_page.js
@@ -9,7 +9,7 @@ import 'chrome://resources/cr_components/chromeos/network/network_config.m.js'; import 'chrome://resources/cr_components/chromeos/network/network_list.m.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
diff --git a/ash/webui/shimless_rma/resources/wrapup_repair_complete_page.js b/ash/webui/shimless_rma/resources/wrapup_repair_complete_page.js index 608deb7..5c108b0 100644 --- a/ash/webui/shimless_rma/resources/wrapup_repair_complete_page.js +++ b/ash/webui/shimless_rma/resources/wrapup_repair_complete_page.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/polymer/v3_0/paper-tooltip/paper-tooltip.js'; import './base_page.js';
diff --git a/ash/webui/shortcut_customization_ui/resources/BUILD.gn b/ash/webui/shortcut_customization_ui/resources/BUILD.gn index e5a213f..1232964 100644 --- a/ash/webui/shortcut_customization_ui/resources/BUILD.gn +++ b/ash/webui/shortcut_customization_ui/resources/BUILD.gn
@@ -73,7 +73,7 @@ ":accelerator_view", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", ] }
diff --git a/ash/webui/shortcut_customization_ui/resources/accelerator_edit_dialog.js b/ash/webui/shortcut_customization_ui/resources/accelerator_edit_dialog.js index 14ac764..2ad0c25d 100644 --- a/ash/webui/shortcut_customization_ui/resources/accelerator_edit_dialog.js +++ b/ash/webui/shortcut_customization_ui/resources/accelerator_edit_dialog.js
@@ -5,7 +5,7 @@ import './accelerator_edit_view.js'; import './shortcut_customization_shared_css.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {flush, html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/ash/wm/desks/desks_controller.cc b/ash/wm/desks/desks_controller.cc index 7f0e1515..2d792586 100644 --- a/ash/wm/desks/desks_controller.cc +++ b/ash/wm/desks/desks_controller.cc
@@ -526,10 +526,14 @@ /*set_by_user=*/false); } - auto* shell = Shell::Get(); - shell->accessibility_controller()->TriggerAccessibilityAlertWithMessage( - l10n_util::GetStringFUTF8(IDS_ASH_VIRTUAL_DESKS_ALERT_NEW_DESK_CREATED, - base::NumberToString16(desks_.size()))); + // Don't trigger an a11y alert when the source is kLaunchTemplate because + // CreateNewDeskForTemplate will trigger an alert instead. + if (source != DesksCreationRemovalSource::kLaunchTemplate) { + auto* shell = Shell::Get(); + shell->accessibility_controller()->TriggerAccessibilityAlertWithMessage( + l10n_util::GetStringFUTF8(IDS_ASH_VIRTUAL_DESKS_ALERT_NEW_DESK_CREATED, + base::NumberToString16(desks_.size()))); + } for (auto& observer : observers_) observer.OnDeskAdded(new_desk); @@ -552,10 +556,11 @@ auto* overview_controller = Shell::Get()->overview_controller(); const bool in_overview = overview_controller->InOverviewSession(); - if (!in_overview && active_desk_ == desk) { - // When removing the active desk outside of overview, we trigger the remove - // desk animation. We will activate the desk to its left if any, otherwise, - // we activate one on the right. + if (!in_overview && active_desk_ == desk && + source != DesksCreationRemovalSource::kSaveAndRecall) { + // When removing the active desk outside of overview (and the source is not + // Save & Recall), we trigger the remove desk animation. We will activate + // the desk to its left if any, otherwise, we activate one on the right. const int current_desk_index = GetDeskIndex(active_desk_); const int target_desk_index = current_desk_index + ((current_desk_index > 0) ? -1 : 1); @@ -1076,6 +1081,10 @@ if (!desk_name.empty()) { desk->SetName(desk_name, /*set_by_user=*/true); + Shell::Get() + ->accessibility_controller() + ->TriggerAccessibilityAlertWithMessage(l10n_util::GetStringFUTF8( + IDS_ASH_VIRTUAL_DESKS_ALERT_NEW_DESK_CREATED, desk_name)); } // Force update user prefs because `SetName()` does not trigger it. desks_restore_util::UpdatePrimaryUserDeskNamesPrefs();
diff --git a/ash/wm/desks/templates/saved_desk_presenter.cc b/ash/wm/desks/templates/saved_desk_presenter.cc index 3f6d335f..b06bbbb 100644 --- a/ash/wm/desks/templates/saved_desk_presenter.cc +++ b/ash/wm/desks/templates/saved_desk_presenter.cc
@@ -22,15 +22,20 @@ #include "ash/wm/desks/templates/saved_desk_metrics_util.h" #include "ash/wm/desks/templates/saved_desk_name_view.h" #include "ash/wm/desks/zero_state_button.h" +#include "ash/wm/mru_window_tracker.h" #include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_grid.h" #include "ash/wm/overview/overview_session.h" #include "base/bind.h" +#include "base/containers/cxx20_erase_vector.h" #include "base/i18n/number_formatting.h" +#include "base/scoped_multi_source_observation.h" +#include "base/time/default_tick_clock.h" #include "base/time/time.h" #include "components/desks_storage/core/desk_template_util.h" #include "third_party/re2/src/re2/re2.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/wm/core/window_util.h" namespace ash { @@ -56,6 +61,210 @@ return desk_model; } +// The WindowCloseObserver helper is used in the Save & Recall save flow. When +// the user saves a desk, we will try to close all windows on that desk, and +// then finally remove the desk. This is an asynchronous task that may trigger +// confirmation dialogs to pop up. +// +// The flow is as follows: +// 1. The user initiates Save & Recall by clicking the save button. +// 2. Windows are enumerated and saved to a saved desk definition. +// 3. We start a `WindowCloseObserver` and call `Close()` on all windows. +// The observer then deals with three different cases: +// a. All windows close automatically. +// b. A confirmation dialog appears and the user decides to close the window. +// c. A confirmation dialog appears and the user decides to keep the window. +// +// For cases a & b, we remove the desk and transition the user into the saved +// desk library. For case c, we leave the desk alone. Also note that for cases b +// & c, the confirmation dialog will take the user out of overview mode. + +class WindowCloseObserver; + +// This is a global raw pointer since the lifetime of the watcher cannot be tied +// to the presenter. The presenter's lifetime is indirectly tied to the overview +// session, and the watcher must survive going out of overview mode. +WindowCloseObserver* g_window_close_observer = nullptr; + +class WindowCloseObserver : public aura::WindowObserver { + public: + WindowCloseObserver(aura::Window* root_window, + const base::GUID& saved_desk_guid, + const std::u16string& saved_desk_name, + const std::vector<aura::Window*>& windows) + : root_window_(root_window), + saved_desk_guid_(saved_desk_guid), + saved_desk_name_(saved_desk_name) { + DCHECK(g_window_close_observer == nullptr); + + auto* desks_controller = DesksController::Get(); + desk_to_remove_ = desks_controller->active_desk(); + + // Observe the windows that we are going to close. + for (aura::Window* window : windows) + window_observer_.AddObservation(window); + + OverviewController* overview_controller = + Shell::Get()->overview_controller(); + if (OverviewSession* overview_session = + overview_controller->overview_session()) { + overview_session->set_allow_empty_desk_without_exiting(true); + } + + system_modal_container_ = Shell::Get()->GetContainer( + root_window, kShellWindowId_SystemModalContainer); + window_observer_.AddObservation(system_modal_container_); + } + + ~WindowCloseObserver() override { + OverviewController* overview_controller = + Shell::Get()->overview_controller(); + if (OverviewSession* overview_session = + overview_controller->overview_session()) { + overview_session->set_allow_empty_desk_without_exiting(false); + } + g_window_close_observer = nullptr; + } + + void SetModalDialogCallbackForTesting(base::OnceClosure closure) { + modal_dialog_closure_for_testing_ = std::move(closure); + } + + void FireWindowWatcherTimerForTesting() { + DCHECK(auto_transition_timer_.IsRunning()); + auto_transition_timer_.FireNow(); + } + + private: + // aura::WindowObserver: + void OnWindowAdded(aura::Window* new_window) override { + if (new_window->parent() != system_modal_container_) + return; + + if (modal_dialog_closure_for_testing_) + std::move(modal_dialog_closure_for_testing_).Run(); + + modal_dialog_showed_ = true; + } + + void OnWindowRemoved(aura::Window* removed_window) override { + if (!modal_dialog_showed_ || !system_modal_container_->children().empty()) + return; + + // The last modal dialog has been dismissed. At this point we don't know if + // the user has dismissed the windows or decided to keep them. We will now + // allow a short time for windows to close. If, after this time, windows + // have not been closed, we'll proceed to the library but leave the desk. + // + // If all windows *do* close before the timer hits, then this will be picked + // up by `OnWindowDestroyed` and we will show the saved desk library. + if (!auto_transition_timer_.IsRunning()) { + auto_transition_timer_.Start( + FROM_HERE, base::Seconds(1), this, + &WindowCloseObserver::ShowLibraryWithoutRemovingDesk); + } + } + + void OnWindowDestroyed(aura::Window* window) override { + window_observer_.RemoveObservation(window); + + // In the unexpected case that the system modal container is destroyed, we + // will bail. + if (window == system_modal_container_) { + Terminate(); + return; + } + + // The observer is used for the windows on the desk that we are closing, as + // well as the system modal container. When there's only one window left + // (the system modal container) in the observing set, we're done. + if (window_observer_.GetSourcesCount() == 1) { + // We're ready to transition into the saved desk library and highlight the + // item. After this has been done, we'll remove ourselves. + ShowLibrary(/*remove_desk=*/true); + Terminate(); + } + } + + void ShowLibraryWithoutRemovingDesk() { + ShowLibrary(/*remove_desk=*/false); + Terminate(); + } + + void ShowLibrary(bool remove_desk) { + OverviewController* overview_controller = + Shell::Get()->overview_controller(); + OverviewSession* overview_session = overview_controller->overview_session(); + if (!overview_session) { + if (!overview_controller->StartOverview( + OverviewStartAction::kOverviewButton, + OverviewEnterExitType::kImmediateEnterWithoutFocus)) { + // If for whatever reason we didn't enter overview mode, bail. + return; + } + + overview_session = overview_controller->overview_session(); + DCHECK(overview_session); + } + + // Show the library, this should highlight the newly saved item. + OverviewGrid* overview_grid = + overview_session->GetGridWithRootWindow(root_window_); + overview_session->ShowDesksTemplatesGrids( + overview_grid->desks_bar_view()->IsZeroState(), saved_desk_guid_, + saved_desk_name_, root_window_); + + // Remove the current desk, this will be done without animation. + if (remove_desk) { + auto* desks_controller = DesksController::Get(); + if (DeskExists(desks_controller, desk_to_remove_)) { + if (!desks_controller->CanRemoveDesks()) + desks_controller->NewDesk(DesksCreationRemovalSource::kSaveAndRecall); + + desks_controller->RemoveDesk(desk_to_remove_, + DesksCreationRemovalSource::kSaveAndRecall, + DeskCloseType::kCloseAllWindows); + } + } + } + + bool DeskExists(DesksController* desks_controller, const Desk* desk) { + return base::Contains( + desks_controller->desks(), desk, + [](const std::unique_ptr<Desk>& desk) { return desk.get(); }); + } + + void Terminate() { delete this; } + + aura::Window* root_window_; + + aura::Window* system_modal_container_ = nullptr; + + // Tracks whether a modal "confirm close" dialog has been showed. + bool modal_dialog_showed_ = false; + + // Used to automatically transition the user to the library after a modal + // dialog has been dismissed. + base::OneShotTimer auto_transition_timer_{ + base::DefaultTickClock::GetInstance()}; + + // The desk that the user has saved and that we will remove once windows have + // been removed. + const Desk* desk_to_remove_ = nullptr; + + // GUID and name of the saved desk. + const base::GUID saved_desk_guid_; + const std::u16string saved_desk_name_; + + // Used by unit tests to wait for modal dialogs. + base::OnceClosure modal_dialog_closure_for_testing_; + + // Used to watch windows on the desk to remove, as well as the system modal + // container. + base::ScopedMultiSourceObservation<aura::Window, aura::WindowObserver> + window_observer_{this}; +}; + } // namespace SavedDeskPresenter::SavedDeskPresenter(OverviewSession* overview_session) @@ -436,7 +645,7 @@ if (on_update_ui_closure_for_testing_) std::move(on_update_ui_closure_for_testing_).Run(); - } else { + } else if (desk_template->type() != DeskTemplateType::kSaveAndRecall) { // This will update the templates button and save as desks button too. This // will call `GetAllEntries`. overview_session_->ShowDesksTemplatesGrids( @@ -445,27 +654,37 @@ if (!was_update) { const auto saved_desk_type = desk_template->type(); - if (saved_desk_type == DeskTemplateType::kSaveAndRecall) { - // We have successfully created a *new* desk template for Save & Recall, - // so we are now going to close all the windows on the active desk and - // also remove the desk. - auto* desks_controller = DesksController::Get(); - auto* active_desk = desks_controller->active_desk(); - - // If this is the only desk, we have to create a new desk before we can - // remove the current one. - if (!desks_controller->CanRemoveDesks()) - desks_controller->NewDesk(DesksCreationRemovalSource::kSaveAndRecall); - - desks_controller->RemoveDesk(active_desk, - DesksCreationRemovalSource::kSaveAndRecall, - DeskCloseType::kCloseAllWindows); - } - RecordNewSavedDeskHistogram(saved_desk_type); RecordUserSavedDeskCountHistogram(saved_desk_type, GetEntryCount(saved_desk_type), GetMaxEntryCount(saved_desk_type)); + + if (saved_desk_type == DeskTemplateType::kSaveAndRecall) { + std::vector<aura::Window*> windows = + Shell::Get()->mru_window_tracker()->BuildMruWindowList(kActiveDesk); + + // Get rid of transient windows. + base::EraseIf(windows, [](aura::Window* window) { + return wm::GetTransientParent(window) != nullptr; + }); + + // Start observing current windows. + if (g_window_close_observer) + delete g_window_close_observer; + g_window_close_observer = new WindowCloseObserver( + root_window, desk_template->uuid(), saved_desk_name, windows); + + // Go through windows and attempt to close them. + for (aura::Window* window : windows) { + if (views::Widget* widget = + views::Widget::GetWidgetForNativeView(window)) { + widget->Close(); + } + } + + if (on_update_ui_closure_for_testing_) + std::move(on_update_ui_closure_for_testing_).Run(); + } } // Note we do not run `on_update_ui_closure_for_testing` here as we want to @@ -527,4 +746,18 @@ return base::UTF8ToUTF16(duplicate_name); } +// static +void SavedDeskPresenter::SetModalDialogCallbackForTesting( + base::OnceClosure closure) { + DCHECK(g_window_close_observer); + g_window_close_observer->SetModalDialogCallbackForTesting( // IN-TEST + std::move(closure)); +} + +// static +void SavedDeskPresenter::FireWindowWatcherTimerForTesting() { + DCHECK(g_window_close_observer); + g_window_close_observer->FireWindowWatcherTimerForTesting(); // IN-TEST +} + } // namespace ash
diff --git a/ash/wm/desks/templates/saved_desk_presenter.h b/ash/wm/desks/templates/saved_desk_presenter.h index 4ec169e8..902da4f 100644 --- a/ash/wm/desks/templates/saved_desk_presenter.h +++ b/ash/wm/desks/templates/saved_desk_presenter.h
@@ -146,6 +146,11 @@ std::u16string AppendDuplicateNumberToDuplicateName( const std::u16string& duplicate_name_u16); + // Sets `closure` to be invoked when Save & Recall triggers a modal dialog. + static void SetModalDialogCallbackForTesting(base::OnceClosure closure); + // Immediately fires the window watcher auto transition timer. + static void FireWindowWatcherTimerForTesting(); + // Pointer to the session which owns `this`. OverviewSession* const overview_session_;
diff --git a/ash/wm/desks/templates/saved_desk_test_util.cc b/ash/wm/desks/templates/saved_desk_test_util.cc index b002b9e..62202e3 100644 --- a/ash/wm/desks/templates/saved_desk_test_util.cc +++ b/ash/wm/desks/templates/saved_desk_test_util.cc
@@ -79,6 +79,18 @@ SavedDeskPresenterTestApi::~SavedDeskPresenterTestApi() = default; +// static +void SavedDeskPresenterTestApi::WaitForSaveAndRecallBlockingDialog() { + base::RunLoop loop; + SavedDeskPresenter::SetModalDialogCallbackForTesting(loop.QuitClosure()); + loop.Run(); +} + +// static +void SavedDeskPresenterTestApi::FireWindowWatcherTimer() { + SavedDeskPresenter::FireWindowWatcherTimerForTesting(); +} + void SavedDeskPresenterTestApi::SetOnUpdateUiClosure( base::OnceClosure closure) { DCHECK(!presenter_->on_update_ui_closure_for_testing_); @@ -199,6 +211,11 @@ return overview_grid->GetSaveDeskAsTemplateButton(); } +views::Button* GetSaveDeskForLaterButton() { + const auto* overview_grid = GetPrimaryOverviewGrid(); + return overview_grid ? overview_grid->GetSaveDeskForLaterButton() : nullptr; +} + views::Button* GetTemplateItemButton(int index) { auto* item = GetItemViewFromTemplatesGrid(index); return item ? static_cast<views::Button*>(item) : nullptr;
diff --git a/ash/wm/desks/templates/saved_desk_test_util.h b/ash/wm/desks/templates/saved_desk_test_util.h index c262711..e770ee96 100644 --- a/ash/wm/desks/templates/saved_desk_test_util.h +++ b/ash/wm/desks/templates/saved_desk_test_util.h
@@ -43,6 +43,14 @@ delete; ~SavedDeskPresenterTestApi(); + // When Save & Recall closes windows, they might object and present a blocking + // dialog. This function waits until that dialog is detected. + static void WaitForSaveAndRecallBlockingDialog(); + + // Fire window watcher's timer to automatically transition into the saved desk + // library. This will DCHECK if the timer is not active. + static void FireWindowWatcherTimer(); + void SetOnUpdateUiClosure(base::OnceClosure closure); // If there are outstanding operations on the desk model, this blocks until @@ -163,6 +171,7 @@ views::Button* GetZeroStateDesksTemplatesButton(); views::Button* GetExpandedStateDesksTemplatesButton(); views::Button* GetSaveDeskAsTemplateButton(); +views::Button* GetSaveDeskForLaterButton(); views::Button* GetTemplateItemButton(int index); views::Button* GetTemplateItemDeleteButton(int index); views::Button* GetSavedDeskDialogAcceptButton();
diff --git a/ash/wm/desks/templates/saved_desk_unittest.cc b/ash/wm/desks/templates/saved_desk_unittest.cc index 91a0548..c4ae226 100644 --- a/ash/wm/desks/templates/saved_desk_unittest.cc +++ b/ash/wm/desks/templates/saved_desk_unittest.cc
@@ -395,6 +395,8 @@ GetOverviewGridForRoot(root)->IsSaveDeskForLaterButtonVisible()); ClickOnView(save_desk_button); WaitForDesksTemplatesUI(); + WaitForDesksTemplatesUI(); + // Clicking the save desk button selects the newly saved desk's name // field. We can press enter or escape or click to select out of it. SendKey(ui::VKEY_RETURN); @@ -1207,8 +1209,10 @@ ui::ScopedAnimationDurationScaleMode animation_scale( ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); - auto test_window = CreateAppWindow(); - ASSERT_FALSE(WindowState::Get(test_window.get())->IsMaximized()); + // Release the window since it will be automatically destroyed when the desk + // is saved. + auto* test_window = CreateAppWindow().release(); + ASSERT_FALSE(WindowState::Get(test_window)->IsMaximized()); aura::Window* root_window = Shell::GetPrimaryRootWindow(); @@ -1233,6 +1237,7 @@ auto* save_for_later_button = GetSaveDeskForLaterButtonForRoot(root_window); ClickOnView(save_for_later_button); WaitForDesksTemplatesUI(); + WaitForDesksTemplatesUI(); EXPECT_TRUE(GetOverviewGridList()[0]->IsShowingDesksTemplatesGrid()); } @@ -4109,6 +4114,7 @@ GetSaveDeskForLaterButtonForRoot(Shell::Get()->GetPrimaryRootWindow()); ClickOnView(save_desk_button); WaitForDesksTemplatesUI(); + WaitForDesksTemplatesUI(); // The newly saved desk item should be fully visible. SavedDeskItemView* item_view = GetItemViewFromTemplatesGrid(6); @@ -4324,7 +4330,8 @@ ToggleOverview(); ClickOnView( GetSaveDeskForLaterButtonForRoot(Shell::Get()->GetPrimaryRootWindow())); - WaitForDesksTemplatesUI(); + for (int i = 0; i != 3; ++i) + WaitForDesksTemplatesUI(); // Expect that the last added template item name view has focus, and verify // that we have a saved desk with the expected `name`.
diff --git a/ash/wm/overview/overview_session.cc b/ash/wm/overview/overview_session.cc index 75e4e49c..839e7852 100644 --- a/ash/wm/overview/overview_session.cc +++ b/ash/wm/overview/overview_session.cc
@@ -221,7 +221,9 @@ // Do not animate if there is any window that is being dragged in the // grid. - if (enter_exit_overview_type_ == OverviewEnterExitType::kImmediateEnter) { + if (enter_exit_overview_type_ == OverviewEnterExitType::kImmediateEnter || + enter_exit_overview_type_ == + OverviewEnterExitType::kImmediateEnterWithoutFocus) { overview_grid->PositionWindows(/*animate=*/false); } else { // Exit only types should not appear here: @@ -368,7 +370,7 @@ if (SplitViewController::Get(Shell::GetPrimaryRootWindow()) ->InTabletSplitViewMode()) { UpdateNoWindowsWidgetOnEachGrid(); - } else { + } else if (!allow_empty_desk_without_exiting_) { EndOverview(OverviewEndAction::kLastWindowRemoved); } } @@ -523,6 +525,9 @@ if (!grid || grid->GetOverviewItemContaining(window)) return; + if (IsShowingDesksTemplatesGrid()) + animate = false; + grid->AppendItem(window, reposition, animate, /*use_spawn_animation=*/true); OnItemAdded(window); } @@ -1031,9 +1036,10 @@ grid->ShowDesksTemplatesGrid(was_zero_state); // Only ask for all entries if it is the first time creating the grid widgets. // Otherwise, add or update the entries one at a time. - if (created_grid_widgets) + if (created_grid_widgets) { saved_desk_presenter_->GetAllEntries(item_to_focus, saved_desk_name, root_window); + } UpdateNoWindowsWidgetOnEachGrid(); UpdateAccessibilityFocus();
diff --git a/ash/wm/overview/overview_session.h b/ash/wm/overview/overview_session.h index 68baf25..b766cdb 100644 --- a/ash/wm/overview/overview_session.h +++ b/ash/wm/overview/overview_session.h
@@ -386,6 +386,10 @@ auto_add_windows_enabled_ = enabled; } + void set_allow_empty_desk_without_exiting(bool enabled) { + allow_empty_desk_without_exiting_ = enabled; + } + private: friend class DesksAcceleratorsTest; friend class OverviewTestBase; @@ -501,6 +505,10 @@ // the overview session. bool auto_add_windows_enabled_ = true; + // When true, the overview session is not exited when the last window is + // removed. + bool allow_empty_desk_without_exiting_ = false; + base::ScopedObservation<TabletModeController, TabletModeObserver> tablet_mode_observation_{this};
diff --git a/ash/wm/overview/overview_types.h b/ash/wm/overview/overview_types.h index 90b7e700..31cfe3d8 100644 --- a/ash/wm/overview/overview_types.h +++ b/ash/wm/overview/overview_types.h
@@ -66,6 +66,12 @@ // button tray. It's also used to address https://crbug.com/1027179. This // should not be used for exiting overview mode. kImmediateEnter, + // Used when it's desired to enter overview mode immediately without + // animations. Additionally, the overview controller will not automatically + // move focus over to the overview focus widget (which is something that + // happens on a timer with `kImmediateEnter`). Behaves otherwise like + // `kImmediateEnter`. + kImmediateEnterWithoutFocus, // Used only when it's desired to exit overview mode immediately without // animations. This is used when performing the desk switch animation when // the source desk is in overview mode, while the target desk is not.
diff --git a/ash/wm/overview/overview_utils.cc b/ash/wm/overview/overview_utils.cc index a057347b9..6039dc5b 100644 --- a/ash/wm/overview/overview_utils.cc +++ b/ash/wm/overview/overview_utils.cc
@@ -60,6 +60,7 @@ // Never animate when doing app dragging or when immediately exiting. const auto enter_exit_type = overview_session->enter_exit_overview_type(); if (enter_exit_type == OverviewEnterExitType::kImmediateEnter || + enter_exit_type == OverviewEnterExitType::kImmediateEnterWithoutFocus || enter_exit_type == OverviewEnterExitType::kImmediateExit) { return false; } @@ -248,8 +249,10 @@ Shell::Get()->overview_controller()->overview_session(); const bool hotseat_will_extend = overview_session && - overview_session->enter_exit_overview_type() == - OverviewEnterExitType::kImmediateEnter && + (overview_session->enter_exit_overview_type() == + OverviewEnterExitType::kImmediateEnter || + overview_session->enter_exit_overview_type() == + OverviewEnterExitType::kImmediateEnterWithoutFocus) && !split_view_controller->InSplitViewMode(); if (hotseat_extended || hotseat_will_extend) { // Use the default hotseat size here to avoid the possible re-layout
diff --git a/base/logging.cc b/base/logging.cc index 412084c..e69cad5 100644 --- a/base/logging.cc +++ b/base/logging.cc
@@ -485,7 +485,13 @@ const char* message_without_prefix) { // Only log last path component. if (file) { - const char* slash = strrchr(file, '/'); + const char* slash = strrchr(file, +#if BUILDFLAG(IS_WIN) + '\\' +#else + '/' +#endif // BUILDFLAG(IS_WIN) + ); if (slash) { file = slash + 1; }
diff --git a/base/logging_unittest.cc b/base/logging_unittest.cc index 985216c..50b8c02 100644 --- a/base/logging_unittest.cc +++ b/base/logging_unittest.cc
@@ -910,7 +910,13 @@ LogMessage("file.cc", 42, LOGGING_ERROR).BuildCrashString()); // BuildCrashString() should strip path/to/file prefix. - LogMessage msg("../foo/bar/file.cc", 42, LOGGING_ERROR); + LogMessage msg( +#if BUILDFLAG(IS_WIN) + "..\\foo\\bar\\file.cc", +#else + "../foo/bar/file.cc", +#endif // BUILDFLAG(IS_WIN) + 42, LOGGING_ERROR); msg.stream() << "Hello"; EXPECT_EQ("file.cc:42: Hello", msg.BuildCrashString()); }
diff --git a/chrome/VERSION b/chrome/VERSION index 187da01..9777d5c 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=106 MINOR=0 -BUILD=5235 +BUILD=5236 PATCH=0
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/flags/ChromeCachedFlags.java b/chrome/android/java/src/org/chromium/chrome/browser/app/flags/ChromeCachedFlags.java index 5764dde9..eccfdfe 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/app/flags/ChromeCachedFlags.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/flags/ChromeCachedFlags.java
@@ -131,6 +131,7 @@ { add(BrandingController.BRANDING_CADENCE_MS); add(BrandingController.MAX_BLANK_TOOLBAR_TIMEOUT_MS); + add(BrandingController.USE_TEMPORARY_STORAGE); add(ChimeFeatures.ALWAYS_REGISTER); add(StartSurfaceConfiguration.BEHAVIOURAL_TARGETING); add(ConditionalTabStripUtils.CONDITIONAL_TAB_STRIP_INFOBAR_LIMIT);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingChecker.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingChecker.java index 137b740c..186bee4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingChecker.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingChecker.java
@@ -14,6 +14,7 @@ import org.chromium.base.Callback; import org.chromium.base.PackageUtils; import org.chromium.base.TimeUtils; +import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.task.AsyncTask; /** @@ -82,15 +83,19 @@ @WorkerThread @Override protected @Nullable @BrandingDecision Integer doInBackground() { + @BrandingDecision + Integer brandingDecision = null; long startTime = TimeUtils.currentTimeMillis(); mIsPackageValid = PackageUtils.isPackageInstalled(mContext, mPackageName); - if (!mIsPackageValid || isCancelled()) { - return null; + if (mIsPackageValid) { + long timeLastBranding = mStorage.get(mPackageName); + brandingDecision = makeBrandingDecisionFromLaunchTime(startTime, timeLastBranding); } - long timeLastBranding = mStorage.get(mPackageName); - @BrandingDecision - int brandingDecision = makeBrandingDecisionFromLaunchTime(startTime, timeLastBranding); + RecordHistogram.recordTimesHistogram("CustomTabs.Branding.BrandingCheckDuration", + TimeUtils.currentTimeMillis() - startTime); + RecordHistogram.recordBooleanHistogram( + "CustomTabs.Branding.IsPackageNameValid", mIsPackageValid); return brandingDecision; } @@ -131,5 +136,10 @@ && mIsPackageValid) { mStorage.put(mPackageName, taskFinishedTime); } + + RecordHistogram.recordEnumeratedHistogram("CustomTabs.Branding.BrandingDecision", + brandingDecision, BrandingDecision.NUM_ENTRIES); + RecordHistogram.recordBooleanHistogram( + "CustomTabs.Branding.BrandingCheckCanceled", isCancelled()); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingController.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingController.java index 8dbcce8..4f9f6ac 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingController.java
@@ -18,6 +18,7 @@ import org.chromium.base.task.PostTask; import org.chromium.base.task.TaskTraits; import org.chromium.chrome.R; +import org.chromium.chrome.browser.flags.BooleanCachedFieldTrialParameter; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.IntCachedFieldTrialParameter; import org.chromium.content_public.browser.UiThreadTaskTraits; @@ -31,9 +32,9 @@ public class BrandingController { private static final String PARAM_BRANDING_CADENCE_NAME = "branding_cadence"; private static final String PARAM_MAX_BLANK_TOOLBAR_TIMEOUT_MS = "max_blank_toolbar_timeout"; + private static final String PARAM_USE_TEMPORARY_STORAGE = "use_temporary_storage"; private static final int DEFAULT_BRANDING_CADENCE_MS = (int) TimeUnit.HOURS.toMillis(1); private static final int DEFAULT_MAX_BLANK_TOOLBAR_TIMEOUT_MS = 500; - /** * The maximum time allowed from CCT Toolbar initialized until it should show the URL and title. */ @@ -53,6 +54,14 @@ public static final IntCachedFieldTrialParameter BRANDING_CADENCE_MS = new IntCachedFieldTrialParameter(ChromeFeatureList.CCT_BRAND_TRANSPARENCY, PARAM_BRANDING_CADENCE_NAME, DEFAULT_BRANDING_CADENCE_MS); + /** + * Use temporary storage for branding launch time. The launch time will not persists to the + * shared pref, but instead only lasts as long as Chrome is alive. This param is added for + * easier manual testing and should not be used for official channels. + */ + public static final BooleanCachedFieldTrialParameter USE_TEMPORARY_STORAGE = + new BooleanCachedFieldTrialParameter( + ChromeFeatureList.CCT_BRAND_TRANSPARENCY, PARAM_USE_TEMPORARY_STORAGE, false); private final CallbackController mCallbackController = new CallbackController(); private final @BrandingDecision OneshotSupplierImpl<Integer> mBrandingDecision = @@ -90,9 +99,12 @@ mToolbarBrandingDelegate = delegate; // Start the task to timeout the branding check. If mBrandingChecker already finished, - // canceling the task does nothing. + // canceling the task does nothing. Does not interrupt if the task is running, since the + // BrandingChecker#doInBackground will collect metrics at the end. PostTask.postDelayedTask(UiThreadTaskTraits.USER_VISIBLE, - () -> mBrandingChecker.cancel(true), MAX_BLANK_TOOLBAR_TIMEOUT_MS.getValue()); + () + -> mBrandingChecker.cancel(/*mayInterruptIfRunning*/ false), + MAX_BLANK_TOOLBAR_TIMEOUT_MS.getValue()); // Set location bar to empty as controller is waiting for mBrandingDecision. // This should not cause any UI jank even if a decision is made immediately, as
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingDecision.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingDecision.java index 1b6d509..a70f65d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingDecision.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingDecision.java
@@ -11,11 +11,17 @@ /** * Class used to indicate what branding decision needs to make for the embedded app. + * + * This is used for histograms and should therefore be treated as append-only. + * See CustomTabsBrandingDecision in tools/metrics/histograms/enums.xml. */ @Retention(RetentionPolicy.SOURCE) -@IntDef({BrandingDecision.NONE, BrandingDecision.TOOLBAR, BrandingDecision.TOAST}) +@IntDef({BrandingDecision.NONE, BrandingDecision.TOOLBAR, BrandingDecision.TOAST, + BrandingDecision.NUM_ENTRIES}) @interface BrandingDecision { - int NONE = 1; - int TOOLBAR = 2; - int TOAST = 3; + int NONE = 0; + int TOOLBAR = 1; + int TOAST = 2; + + int NUM_ENTRIES = 3; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/SharedPreferencesBrandingTimeStorage.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/SharedPreferencesBrandingTimeStorage.java index 9ae6a73..035b874 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/SharedPreferencesBrandingTimeStorage.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/branding/SharedPreferencesBrandingTimeStorage.java
@@ -29,7 +29,11 @@ /** Shared pref that must be read / write on background thread. */ private SharedPreferences mSharedPref; - private SharedPreferencesBrandingTimeStorage() {} + private SharedPreferencesBrandingTimeStorage() { + if (BrandingController.USE_TEMPORARY_STORAGE.getValue()) { + resetSharedPref(); + } + } static SharedPreferencesBrandingTimeStorage getInstance() { if (sInstance == null) { @@ -38,6 +42,11 @@ return sInstance; } + @VisibleForTesting + static void resetInstanceForTesting() { + sInstance = null; + } + @WorkerThread @Override public long get(String packageName) { @@ -54,9 +63,8 @@ } @VisibleForTesting - public void resetForTesting() { - assert mSharedPref != null : "Should only be used when Shared pref is stored already."; - mSharedPref.edit().clear().apply(); + public void resetSharedPref() { + getSharedPref().edit().clear().apply(); } private String hash(String packageName) {
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingCheckerUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingCheckerUnitTest.java index 0f15a42..9c58f46 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingCheckerUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingCheckerUnitTest.java
@@ -30,6 +30,8 @@ import org.chromium.base.ContextUtils; import org.chromium.base.FakeTimeTestRule; import org.chromium.base.TimeUtils; +import org.chromium.base.metrics.RecordHistogram; +import org.chromium.base.metrics.UmaRecorderHolder; import org.chromium.base.task.AsyncTask; import org.chromium.base.task.TaskTraits; import org.chromium.base.task.test.ShadowPostTask; @@ -89,6 +91,7 @@ @After public void tearDown() { mFakeTimeRule.resetTimes(); + UmaRecorderHolder.resetForTesting(); ShadowPackageManager.reset(); ShadowSystemClock.reset(); ShadowPausedAsyncTask.reset(); @@ -108,6 +111,9 @@ BrandingDecision.TOOLBAR, callbackDelegate.getBrandingDecision()); assertEquals("Show branding time is different.", showBrandingTime, mStorage.get(PACKAGE_1)); + + assertHistogramRecorded(/*decision*/ BrandingDecision.TOOLBAR, /*isPackageValid*/ true, + /*isTaskCanceled*/ false); } @Test @@ -122,6 +128,9 @@ BrandingDecision.TOAST, callbackDelegate.getBrandingDecision()); assertEquals("Show branding time is different.", showBrandingTime, mStorage.get(NEW_APPLICATION)); + + assertHistogramRecorded(/*decision*/ BrandingDecision.TOAST, /*isPackageValid*/ true, + /*isTaskCanceled*/ false); } @Test @@ -143,6 +152,9 @@ assertEquals("Branding check canceled, BrandingDecision should be the test default. ", BrandingDecision.TOAST, callbackDelegate.getBrandingDecision()); assertEquals("Show branding time is different.", showBrandingTime, mStorage.get(PACKAGE_1)); + + assertHistogramRecorded(/*decision*/ BrandingDecision.TOAST, /*isPackageValid*/ true, + /*isTaskCanceled*/ true); } @Test @@ -156,6 +168,9 @@ BrandingDecision.TOAST, callbackDelegate.getBrandingDecision()); assertEquals("Branding time should not record for invalid package.", -1, mStorage.get(INVALID_PACKAGE)); + + assertHistogramRecorded(/*decision*/ BrandingDecision.TOAST, /*isPackageValid*/ false, + /*isTaskCanceled*/ false); } @Test @@ -202,6 +217,26 @@ mFakeTimeRule.advanceMillis(increments); } + private void assertHistogramRecorded( + @BrandingDecision int decision, boolean isPackageValid, boolean isCanceled) { + assertHistogramSampleRecorded( + "CustomTabs.Branding.BrandingCheckCanceled", isCanceled ? 1 : 0); + assertHistogramSampleRecorded("CustomTabs.Branding.BrandingDecision", decision); + assertHistogramSampleRecorded( + "CustomTabs.Branding.IsPackageNameValid", isPackageValid ? 1 : 0); + + assertEquals("<CustomTabs.Branding.BrandingCheckDuration> not recorded.", 1, + RecordHistogram.getHistogramTotalCountForTesting( + "CustomTabs.Branding.BrandingCheckDuration")); + } + + private void assertHistogramSampleRecorded(String name, int sample) { + assertEquals("<" + name + "> not recorded.", 1, + RecordHistogram.getHistogramTotalCountForTesting(name)); + assertEquals("<" + name + "> sample <" + sample + "> count is different.", 1, + RecordHistogram.getHistogramValueCountForTesting(name, sample)); + } + private static class CallbackDelegate extends CallbackHelper { private @BrandingDecision int mBrandingDecision;
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingControllerUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingControllerUnitTest.java index 27b8937..3d5a9ba 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingControllerUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/branding/BrandingControllerUnitTest.java
@@ -78,12 +78,13 @@ BrandingController.BRANDING_CADENCE_MS.setForTesting(TEST_BRANDING_CADENCE); BrandingController.MAX_BLANK_TOOLBAR_TIMEOUT_MS.setForTesting( TEST_MAX_TOOLBAR_BLANK_TIMEOUT); + BrandingController.USE_TEMPORARY_STORAGE.setForTesting(false); } @After public void tearDown() { mFakeTimeTestRule.resetTimes(); - SharedPreferencesBrandingTimeStorage.getInstance().resetForTesting(); + SharedPreferencesBrandingTimeStorage.getInstance().resetSharedPref(); ShadowPostTask.reset(); ShadowSystemClock.reset(); ShadowToast.reset(); @@ -180,6 +181,38 @@ "Toast duration is different.", 800, ShadowToast.getLatestToast().getDuration()); } + @Test + public void testInMemoryStorage() { + BrandingController.USE_TEMPORARY_STORAGE.setForTesting(true); + + new BrandingCheckTester() + .newBrandingController() + .idleMainLooper() + .onToolbarInitialized() + .assertBrandingDecisionMade(BrandingDecision.TOAST) + .assertShownBrandingLocationBar(false) + .advanceMills(TEST_BRANDING_CADENCE - 1) + .newBrandingController() + .idleMainLooper() + .onToolbarInitialized() + .assertBrandingDecisionMade(BrandingDecision.NONE) + // Advance one more bit so branding will show again with toolbar. + .advanceMills(1) + .newBrandingController() + .idleMainLooper() + .onToolbarInitialized() + .assertBrandingDecisionMade(BrandingDecision.TOOLBAR); + + SharedPreferencesBrandingTimeStorage.resetInstanceForTesting(); + + // After reset storage instance, decision should be in use again. + new BrandingCheckTester() + .newBrandingController() + .idleMainLooper() + .onToolbarInitialized() + .assertBrandingDecisionMade(BrandingDecision.TOAST); + } + class BrandingCheckTester { public BrandingCheckTester newBrandingController() { Context context = ContextUtils.getApplicationContext();
diff --git a/chrome/app/extensions_strings.grdp b/chrome/app/extensions_strings.grdp index c7e0cd2..7de06a2 100644 --- a/chrome/app/extensions_strings.grdp +++ b/chrome/app/extensions_strings.grdp
@@ -310,6 +310,9 @@ <message name="IDS_EXTENSIONS_ITEM_SOURCE" desc="The label above an extension's source, which indicates where the extension came from (webstore, third-party, local disk, etc)."> Source </message> + <message name="IDS_EXTENSIONS_ITEM_SOURCE_INSTALLED_BY_DEFAULT" desc="The text to indicate that an extension has been added by default for the user's profile."> + Installed by default + </message> <message name="IDS_EXTENSIONS_ITEM_SOURCE_POLICY" desc="The text to indicate that an extension has been added by enterprise policy."> Added by policy </message>
diff --git a/chrome/app/extensions_strings_grdp/IDS_EXTENSIONS_ITEM_SOURCE_INSTALLED_BY_DEFAULT.png.sha1 b/chrome/app/extensions_strings_grdp/IDS_EXTENSIONS_ITEM_SOURCE_INSTALLED_BY_DEFAULT.png.sha1 new file mode 100644 index 0000000..d5da74c --- /dev/null +++ b/chrome/app/extensions_strings_grdp/IDS_EXTENSIONS_ITEM_SOURCE_INSTALLED_BY_DEFAULT.png.sha1
@@ -0,0 +1 @@ +008f98f296541dd820ca71e6392c4a50402783ad \ No newline at end of file
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 0da4658..7ac6571 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -162,6 +162,7 @@ #include "content/public/common/content_switches.h" #include "device/base/features.h" #include "device/bluetooth/bluez/bluez_features.h" +#include "device/bluetooth/chromeos_platform_features.h" #include "device/bluetooth/floss/floss_features.h" #include "device/fido/features.h" #include "device/gamepad/public/cpp/gamepad_features.h" @@ -445,6 +446,15 @@ {"Use Denylist", kCCTResizablePolicyParamUseDenylist, std::size(kCCTResizablePolicyParamUseDenylist), nullptr}}; +const FeatureEntry::FeatureParam kCCTBrandingTestFriendly[] = { + {"use_temporary_storage", "true"}, + {"branding_cadence", "10000"} // 10 seconds +}; + +const FeatureEntry::FeatureVariation kCctBrandTransparencyVariations[] = { + {"Test friendly mode", kCCTBrandingTestFriendly, + std::size(kCCTBrandingTestFriendly), nullptr}}; + const FeatureEntry::Choice kReaderModeHeuristicsChoices[] = { {flags_ui::kGenericExperimentChoiceDefault, "", ""}, {flag_descriptions::kReaderModeHeuristicsMarkup, @@ -3612,6 +3622,9 @@ {"bluetooth-wbs-dogfood", flag_descriptions::kBluetoothWbsDogfoodName, flag_descriptions::kBluetoothWbsDogfoodDescription, kOsCrOS, FEATURE_VALUE_TYPE(chromeos::features::kBluetoothWbsDogfood)}, + {"bluetooth-coredump", flag_descriptions::kBluetoothCoredumpName, + flag_descriptions::kBluetoothCoredumpDescription, kOsCrOS, + FEATURE_VALUE_TYPE(chromeos::bluetooth::features::kBluetoothCoredump)}, {"bluetooth-use-floss", flag_descriptions::kBluetoothUseFlossName, flag_descriptions::kBluetoothUseFlossDescription, kOsCrOS, FEATURE_VALUE_TYPE(floss::features::kFlossEnabled)}, @@ -6097,7 +6110,9 @@ #if BUILDFLAG(IS_ANDROID) {"cct-brand-transparency", flag_descriptions::kCCTBrandTransparencyName, flag_descriptions::kCCTBrandTransparencyDescription, kOsAndroid, - FEATURE_VALUE_TYPE(chrome::android::kCCTBrandTransparency)}, + FEATURE_WITH_PARAMS_VALUE_TYPE(chrome::android::kCCTBrandTransparency, + kCctBrandTransparencyVariations, + "CCTBrandTransparency")}, #endif #if BUILDFLAG(IS_CHROMEOS)
diff --git a/chrome/browser/apps/app_discovery_service/app_discovery_service.h b/chrome/browser/apps/app_discovery_service/app_discovery_service.h index dfc1acb49..4fff418 100644 --- a/chrome/browser/apps/app_discovery_service/app_discovery_service.h +++ b/chrome/browser/apps/app_discovery_service/app_discovery_service.h
@@ -42,10 +42,11 @@ // Queries for an app's icon, identified by |app_id|. // |callback| is called when a response to the request is ready. - void GetIcon(const std::string& app_id, - int32_t size_hint_in_dip, - ResultType result_type, - GetIconCallback callback); + // Virtual for testing. + virtual void GetIcon(const std::string& app_id, + int32_t size_hint_in_dip, + ResultType result_type, + GetIconCallback callback); private: std::unique_ptr<AppFetcherManager> app_fetcher_manager_;
diff --git a/chrome/browser/apps/app_service/app_service_proxy_ash.cc b/chrome/browser/apps/app_service/app_service_proxy_ash.cc index 8c609881..b8449e760e 100644 --- a/chrome/browser/apps/app_service/app_service_proxy_ash.cc +++ b/chrome/browser/apps/app_service/app_service_proxy_ash.cc
@@ -32,7 +32,6 @@ #include "components/services/app_service/app_service_mojom_impl.h" #include "components/services/app_service/public/cpp/app_capability_access_cache_wrapper.h" #include "components/services/app_service/public/cpp/app_registry_cache_wrapper.h" -#include "components/services/app_service/public/cpp/app_types.h" #include "components/services/app_service/public/cpp/features.h" #include "components/services/app_service/public/cpp/preferred_apps_impl.h" #include "components/services/app_service/public/cpp/preferred_apps_list.h" @@ -172,11 +171,19 @@ } } +void AppServiceProxyAsh::Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + gfx::NativeWindow parent_window) { + UninstallImpl(app_id, uninstall_source, parent_window, base::DoNothing()); +} + void AppServiceProxyAsh::Uninstall( const std::string& app_id, apps::mojom::UninstallSource uninstall_source, gfx::NativeWindow parent_window) { - UninstallImpl(app_id, uninstall_source, parent_window, base::DoNothing()); + UninstallImpl(app_id, + ConvertMojomUninstallSourceToUninstallSource(uninstall_source), + parent_window, base::DoNothing()); } void AppServiceProxyAsh::OnApps(std::vector<AppPtr> deltas, @@ -295,7 +302,7 @@ const std::string& app_id, gfx::NativeWindow parent_window, OnUninstallForTestingCallback callback) { - UninstallImpl(app_id, apps::mojom::UninstallSource::kUnknown, parent_window, + UninstallImpl(app_id, UninstallSource::kUnknown, parent_window, std::move(callback)); } @@ -323,11 +330,10 @@ } } -void AppServiceProxyAsh::UninstallImpl( - const std::string& app_id, - apps::mojom::UninstallSource uninstall_source, - gfx::NativeWindow parent_window, - OnUninstallForTestingCallback callback) { +void AppServiceProxyAsh::UninstallImpl(const std::string& app_id, + UninstallSource uninstall_source, + gfx::NativeWindow parent_window, + OnUninstallForTestingCallback callback) { if (!app_service_.is_connected()) { if (!callback.is_null()) { std::move(callback).Run(false); @@ -369,7 +375,7 @@ void AppServiceProxyAsh::OnUninstallDialogClosed( apps::AppType app_type, const std::string& app_id, - apps::mojom::UninstallSource uninstall_source, + UninstallSource uninstall_source, bool uninstall, bool clear_site_data, bool report_abuse, @@ -377,8 +383,17 @@ if (uninstall) { app_registry_cache_.ForOneApp(app_id, RecordAppBounce); - app_service_->Uninstall(ConvertAppTypeToMojomAppType(app_type), app_id, - uninstall_source, clear_site_data, report_abuse); + if (base::FeatureList::IsEnabled(apps::kAppServiceUninstallWithoutMojom)) { + auto* publisher = GetPublisher(app_type); + DCHECK(publisher); + publisher->Uninstall(app_id, uninstall_source, + /*clear_site_data=*/false, /*report_abuse=*/false); + } else { + app_service_->Uninstall( + ConvertAppTypeToMojomAppType(app_type), app_id, + ConvertUninstallSourceToMojomUninstallSource(uninstall_source), + clear_site_data, report_abuse); + } PerformPostUninstallTasks(app_type, app_id, uninstall_source); } @@ -588,7 +603,7 @@ void AppServiceProxyAsh::PerformPostUninstallTasks( apps::AppType app_type, const std::string& app_id, - apps::mojom::UninstallSource uninstall_source) { + UninstallSource uninstall_source) { if (app_platform_metrics_service_ && app_platform_metrics_service_->AppPlatformMetrics()) { app_platform_metrics_service_->AppPlatformMetrics()->RecordAppUninstallUkm(
diff --git a/chrome/browser/apps/app_service/app_service_proxy_ash.h b/chrome/browser/apps/app_service/app_service_proxy_ash.h index 65f139d..66f971a 100644 --- a/chrome/browser/apps/app_service/app_service_proxy_ash.h +++ b/chrome/browser/apps/app_service/app_service_proxy_ash.h
@@ -21,6 +21,7 @@ #include "chrome/browser/ash/crosapi/browser_manager.h" #include "components/services/app_service/public/cpp/app_launch_util.h" #include "components/services/app_service/public/cpp/app_registry_cache.h" +#include "components/services/app_service/public/cpp/app_types.h" #include "components/services/app_service/public/cpp/icon_types.h" #include "components/services/app_service/public/cpp/instance_registry.h" #include "components/services/app_service/public/cpp/preferred_app.h" @@ -82,6 +83,9 @@ // apps::AppServiceProxyBase overrides: void Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + gfx::NativeWindow parent_window) override; + void Uninstall(const std::string& app_id, apps::mojom::UninstallSource uninstall_source, gfx::NativeWindow parent_window) override; void OnApps(std::vector<AppPtr> deltas, @@ -148,7 +152,7 @@ OnPauseDialogClosedCallback pause_callback); void UninstallImpl(const std::string& app_id, - apps::mojom::UninstallSource uninstall_source, + UninstallSource uninstall_source, gfx::NativeWindow parent_window, OnUninstallForTestingCallback callback); @@ -161,7 +165,7 @@ // |uninstall_dialogs_|. void OnUninstallDialogClosed(apps::AppType app_type, const std::string& app_id, - apps::mojom::UninstallSource uninstall_source, + UninstallSource uninstall_source, bool uninstall, bool clear_site_data, bool report_abuse, @@ -207,10 +211,9 @@ void InitAppPlatformMetrics(); - void PerformPostUninstallTasks( - apps::AppType app_type, - const std::string& app_id, - apps::mojom::UninstallSource uninstall_source) override; + void PerformPostUninstallTasks(apps::AppType app_type, + const std::string& app_id, + UninstallSource uninstall_source) override; // apps::InstanceRegistry::Observer overrides. void OnInstanceUpdate(const apps::InstanceUpdate& update) override;
diff --git a/chrome/browser/apps/app_service/app_service_proxy_base.cc b/chrome/browser/apps/app_service/app_service_proxy_base.cc index 25bafa7..e516ebf 100644 --- a/chrome/browser/apps/app_service/app_service_proxy_base.cc +++ b/chrome/browser/apps/app_service/app_service_proxy_base.cc
@@ -563,6 +563,20 @@ } } +void AppServiceProxyBase::UninstallSilently(const std::string& app_id, + UninstallSource uninstall_source) { + if (app_service_.is_connected()) { + auto app_type = app_registry_cache_.GetAppType(app_id); + auto* publisher = GetPublisher(app_type); + if (!publisher) { + return; + } + publisher->Uninstall(app_id, uninstall_source, + /*clear_site_data=*/false, /*report_abuse=*/false); + PerformPostUninstallTasks(app_type, app_id, uninstall_source); + } +} + void AppServiceProxyBase::UninstallSilently( const std::string& app_id, apps::mojom::UninstallSource uninstall_source) { @@ -571,7 +585,9 @@ app_service_->Uninstall(ConvertAppTypeToMojomAppType(app_type), app_id, uninstall_source, /*clear_site_data=*/false, /*report_abuse=*/false); - PerformPostUninstallTasks(app_type, app_id, uninstall_source); + PerformPostUninstallTasks( + app_type, app_id, + ConvertMojomUninstallSourceToUninstallSource(uninstall_source)); } } @@ -1005,7 +1021,7 @@ void AppServiceProxyBase::PerformPostUninstallTasks( apps::AppType app_type, const std::string& app_id, - apps::mojom::UninstallSource uninstall_source) {} + UninstallSource uninstall_source) {} void AppServiceProxyBase::OnLaunched(LaunchCallback callback, LaunchResult&& launch_result) {
diff --git a/chrome/browser/apps/app_service/app_service_proxy_base.h b/chrome/browser/apps/app_service/app_service_proxy_base.h index 7522d04..219e1ad 100644 --- a/chrome/browser/apps/app_service/app_service_proxy_base.h +++ b/chrome/browser/apps/app_service/app_service_proxy_base.h
@@ -222,12 +222,21 @@ // the uninstall dialog will be created as a modal dialog anchored at // |parent_window|. Otherwise, the browser window will be used as the anchor. virtual void Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + gfx::NativeWindow parent_window) = 0; + // TODO(crbug.com/1253250): Will be removed soon. Please use the non mojom + // interface. + virtual void Uninstall(const std::string& app_id, apps::mojom::UninstallSource uninstall_source, gfx::NativeWindow parent_window) = 0; // Uninstalls an app for the given |app_id| without prompting the user to // confirm. void UninstallSilently(const std::string& app_id, + UninstallSource uninstall_source); + // TODO(crbug.com/1253250): Will be removed soon. Please use the non mojom + // interface. + void UninstallSilently(const std::string& app_id, apps::mojom::UninstallSource uninstall_source); // Stops the current running app for the given |app_id|. @@ -425,10 +434,9 @@ apps::LaunchSource launch_source, apps::LaunchContainer container); - virtual void PerformPostUninstallTasks( - apps::AppType app_type, - const std::string& app_id, - apps::mojom::UninstallSource uninstall_source); + virtual void PerformPostUninstallTasks(apps::AppType app_type, + const std::string& app_id, + UninstallSource uninstall_source); virtual void OnLaunched(LaunchCallback callback, LaunchResult&& launch_result);
diff --git a/chrome/browser/apps/app_service/app_service_proxy_desktop.cc b/chrome/browser/apps/app_service/app_service_proxy_desktop.cc index 615bdb5..3e54ac9 100644 --- a/chrome/browser/apps/app_service/app_service_proxy_desktop.cc +++ b/chrome/browser/apps/app_service/app_service_proxy_desktop.cc
@@ -32,6 +32,17 @@ } void AppServiceProxy::Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + gfx::NativeWindow parent_window) { + // On non-ChromeOS, publishers run the remove dialog. + auto app_type = app_registry_cache_.GetAppType(app_id); + if (app_type == apps::AppType::kWeb) { + web_app::UninstallImpl(web_app::WebAppProvider::GetForWebApps(profile_), + app_id, uninstall_source, parent_window); + } +} + +void AppServiceProxy::Uninstall(const std::string& app_id, apps::mojom::UninstallSource uninstall_source, gfx::NativeWindow parent_window) { // On non-ChromeOS, publishers run the remove dialog.
diff --git a/chrome/browser/apps/app_service/app_service_proxy_desktop.h b/chrome/browser/apps/app_service/app_service_proxy_desktop.h index 152f716..5c97ddd4 100644 --- a/chrome/browser/apps/app_service/app_service_proxy_desktop.h +++ b/chrome/browser/apps/app_service/app_service_proxy_desktop.h
@@ -37,6 +37,9 @@ // apps::AppServiceProxyBase overrides: void Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + gfx::NativeWindow parent_window) override; + void Uninstall(const std::string& app_id, apps::mojom::UninstallSource uninstall_source, gfx::NativeWindow parent_window) override; void FlushMojoCallsForTesting() override;
diff --git a/chrome/browser/apps/app_service/app_service_proxy_lacros.cc b/chrome/browser/apps/app_service/app_service_proxy_lacros.cc index 9333fad..b13937b 100644 --- a/chrome/browser/apps/app_service/app_service_proxy_lacros.cc +++ b/chrome/browser/apps/app_service/app_service_proxy_lacros.cc
@@ -293,25 +293,31 @@ NOTIMPLEMENTED(); } -void AppServiceProxyLacros::Uninstall( - const std::string& app_id, - apps::mojom::UninstallSource uninstall_source, - gfx::NativeWindow parent_window) { +void AppServiceProxyLacros::Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + gfx::NativeWindow parent_window) { // On non-ChromeOS, publishers run the remove dialog. auto app_type = app_registry_cache_.GetAppType(app_id); if (app_type == AppType::kWeb) { - web_app::UninstallImpl( - web_app::WebAppProvider::GetForWebApps(profile_), app_id, - ConvertMojomUninstallSourceToUninstallSource(uninstall_source), - parent_window); + web_app::UninstallImpl(web_app::WebAppProvider::GetForWebApps(profile_), + app_id, uninstall_source, parent_window); } else { NOTIMPLEMENTED(); } } +void AppServiceProxyLacros::Uninstall( + const std::string& app_id, + apps::mojom::UninstallSource uninstall_source, + gfx::NativeWindow parent_window) { + Uninstall(app_id, + ConvertMojomUninstallSourceToUninstallSource(uninstall_source), + parent_window); +} + void AppServiceProxyLacros::UninstallSilently( const std::string& app_id, - apps::mojom::UninstallSource uninstall_source) { + UninstallSource uninstall_source) { if (!remote_crosapi_app_service_proxy_) { return; } @@ -325,7 +331,14 @@ return; } - remote_crosapi_app_service_proxy_->UninstallSilently( + remote_crosapi_app_service_proxy_->UninstallSilently(app_id, + uninstall_source); +} + +void AppServiceProxyLacros::UninstallSilently( + const std::string& app_id, + apps::mojom::UninstallSource uninstall_source) { + UninstallSilently( app_id, ConvertMojomUninstallSourceToUninstallSource(uninstall_source)); }
diff --git a/chrome/browser/apps/app_service/app_service_proxy_lacros.h b/chrome/browser/apps/app_service/app_service_proxy_lacros.h index a0c9148d..1e657fd 100644 --- a/chrome/browser/apps/app_service/app_service_proxy_lacros.h +++ b/chrome/browser/apps/app_service/app_service_proxy_lacros.h
@@ -192,12 +192,21 @@ // the uninstall dialog will be created as a modal dialog anchored at // |parent_window|. Otherwise, the browser window will be used as the anchor. void Uninstall(const std::string& app_id, + UninstallSource uninstall_source, + gfx::NativeWindow parent_window); + // TODO(crbug.com/1253250): Will be removed soon. Please use the non mojom + // interface. + void Uninstall(const std::string& app_id, apps::mojom::UninstallSource uninstall_source, gfx::NativeWindow parent_window); // Uninstalls an app for the given |app_id| without prompting the user to // confirm. void UninstallSilently(const std::string& app_id, + UninstallSource uninstall_source); + // TODO(crbug.com/1253250): Will be removed soon. Please use the non mojom + // interface. + void UninstallSilently(const std::string& app_id, apps::mojom::UninstallSource uninstall_source); // Stops the current running app for the given |app_id|.
diff --git a/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc b/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc index 32afd2c..e6e5d547 100644 --- a/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc +++ b/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc
@@ -670,7 +670,7 @@ void AppPlatformMetrics::RecordAppUninstallUkm( AppType app_type, const std::string& app_id, - apps::mojom::UninstallSource uninstall_source) { + UninstallSource uninstall_source) { AppTypeName app_type_name = GetAppTypeName( profile_, app_type, app_id, apps::LaunchContainer::kLaunchContainerNone);
diff --git a/chrome/browser/apps/app_service/metrics/app_platform_metrics.h b/chrome/browser/apps/app_service/metrics/app_platform_metrics.h index 59ff745..c4e220bc 100644 --- a/chrome/browser/apps/app_service/metrics/app_platform_metrics.h +++ b/chrome/browser/apps/app_service/metrics/app_platform_metrics.h
@@ -90,10 +90,9 @@ apps::LaunchSource launch_source) {} // Invoked when app uninstall metrics are being reported. - virtual void OnAppUninstalled( - const std::string& app_id, - AppType app_type, - apps::mojom::UninstallSource app_uninstall_source) {} + virtual void OnAppUninstalled(const std::string& app_id, + AppType app_type, + UninstallSource app_uninstall_source) {} // Invoked when app usage metrics are being recorded (every 5 mins). virtual void OnAppUsage(const std::string& app_id, @@ -172,7 +171,7 @@ // Records UKM when uninstalling an app. void RecordAppUninstallUkm(AppType app_type, const std::string& app_id, - apps::mojom::UninstallSource uninstall_source); + UninstallSource uninstall_source); void AddObserver(Observer* observer);
diff --git a/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc b/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc index ca3965be..def36c3 100644 --- a/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc +++ b/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc
@@ -110,7 +110,7 @@ OnAppUninstalled, (const std::string& app_id, AppType app_type, - apps::mojom::UninstallSource app_uninstall_source), + UninstallSource app_uninstall_source), (override)); MOCK_METHOD(void, @@ -903,7 +903,7 @@ void VerifyAppsUninstallUkm(const std::string& app_info, AppTypeName app_type_name, - apps::mojom::UninstallSource uninstall_source) { + UninstallSource uninstall_source) { const auto entries = test_ukm_recorder()->GetEntriesByName("ChromeOSApp.UninstallApp"); int count = 0; @@ -2286,21 +2286,21 @@ proxy->UninstallSilently( /*app_id=*/"a", apps::mojom::UninstallSource::kAppList); VerifyAppsUninstallUkm("app://com.google.A", AppTypeName::kArc, - apps::mojom::UninstallSource::kAppList); + UninstallSource::kAppList); proxy->UninstallSilently( /*app_id=*/MuxId(profile(), kChromeAppId), apps::mojom::UninstallSource::kAppList); VerifyAppsUninstallUkm("app://" + std::string(kChromeAppId), AppTypeName::kStandaloneBrowserChromeApp, - apps::mojom::UninstallSource::kAppList); + UninstallSource::kAppList); proxy->UninstallSilently( /*app_id=*/MuxId(profile(), kExtensionId), apps::mojom::UninstallSource::kAppList); VerifyAppsUninstallUkm("app://" + std::string(kExtensionId), AppTypeName::kStandaloneBrowserExtension, - apps::mojom::UninstallSource::kAppList); + UninstallSource::kAppList); } INSTANTIATE_TEST_SUITE_P(All, @@ -2872,9 +2872,8 @@ TEST_P(AppPlatformMetricsObserverTest, ShouldNotifyObserverOnAppUninstall) { // Uninstall a pre-installed app and verify the observer is notified. const std::string& app_id = "a"; - EXPECT_CALL(observer_, - OnAppUninstalled(app_id, AppType::kArc, - apps::mojom::UninstallSource::kAppList)) + EXPECT_CALL(observer_, OnAppUninstalled(app_id, AppType::kArc, + UninstallSource::kAppList)) .Times(1); auto* const proxy = AppServiceProxyFactory::GetForProfile(profile()); @@ -2912,9 +2911,8 @@ // Uninstall a pre-installed app and verify the unregistered observer // is not notified. const std::string& app_id = "a"; - EXPECT_CALL(observer_, - OnAppUninstalled(app_id, AppType::kArc, - apps::mojom::UninstallSource::kAppList)) + EXPECT_CALL(observer_, OnAppUninstalled(app_id, AppType::kArc, + UninstallSource::kAppList)) .Times(0); proxy->UninstallSilently(app_id, apps::mojom::UninstallSource::kAppList); task_environment_.RunUntilIdle();
diff --git a/chrome/browser/ash/accessibility/dictation_browsertest.cc b/chrome/browser/ash/accessibility/dictation_browsertest.cc index 36413881..9042b879f 100644 --- a/chrome/browser/ash/accessibility/dictation_browsertest.cc +++ b/chrome/browser/ash/accessibility/dictation_browsertest.cc
@@ -607,7 +607,9 @@ EXPECT_EQ("Vega is a star", GetTextAreaValue()); } -IN_PROC_BROWSER_TEST_P(DictationTest, UserEndsDictationWhenChromeVoxEnabled) { +// TODO(crbug.com/1352312): Flaky. +IN_PROC_BROWSER_TEST_P(DictationTest, + DISABLED_UserEndsDictationWhenChromeVoxEnabled) { EnableChromeVox(); EXPECT_TRUE(GetManager()->IsSpokenFeedbackEnabled()); InstallMockInputContextHandler();
diff --git a/chrome/browser/ash/file_manager/file_manager_string_util.cc b/chrome/browser/ash/file_manager/file_manager_string_util.cc index 7120a3c..5295aac 100644 --- a/chrome/browser/ash/file_manager/file_manager_string_util.cc +++ b/chrome/browser/ash/file_manager/file_manager_string_util.cc
@@ -158,6 +158,8 @@ IDS_FILE_BROWSER_DRIVE_SHARED_WITH_ME_COLLECTION_LABEL); SET_STRING("DRIVE_INDIVIDUAL_QUOTA_LOW", IDS_FILE_BROWSER_DRIVE_INDIVIDUAL_QUOTA_LOW); + SET_STRING("DRIVE_WARNING_QUOTA_OVER", + IDS_FILE_BROWSER_DRIVE_WARNING_QUOTA_OVER); SET_STRING("DRIVE_INDIVIDUAL_QUOTA_OVER", IDS_FILE_BROWSER_DRIVE_INDIVIDUAL_QUOTA_OVER); SET_STRING("DRIVE_ORGANIZATION_QUOTA_OVER",
diff --git a/chrome/browser/ash/fusebox/fusebox_server.cc b/chrome/browser/ash/fusebox/fusebox_server.cc index 2839b69..45dfa787 100644 --- a/chrome/browser/ash/fusebox/fusebox_server.cc +++ b/chrome/browser/ash/fusebox/fusebox_server.cc
@@ -37,11 +37,11 @@ const std::string& s) { size_t i = s.find('/'); if (i == std::string::npos) { - return std::make_pair(s, false); + i = s.size(); } auto iter = prefix_map.find(s.substr(0, i)); if (iter == prefix_map.end()) { - return std::make_pair(s, false); + return std::make_pair("", false); } return std::make_pair(base::StrCat({iter->second.fs_url_prefix, s.substr(i)}), iter->second.read_only); @@ -122,6 +122,10 @@ break; case ResultType::NOT_A_MONIKER_FS_URL: { auto resolved = ResolvePrefixMap(prefix_map, fs_url_as_string); + if (resolved.first.empty()) { + LOG(ERROR) << "Unresolvable Prefix"; + return ParseResult(base::File::Error::FILE_ERROR_NOT_FOUND); + } read_only = resolved.second; fs_url = fs_context->CrackURLInFirstPartyContext(GURL(resolved.first)); if (!fs_url.is_valid()) {
diff --git a/chrome/browser/ash/input_method/assistive_window_controller.cc b/chrome/browser/ash/input_method/assistive_window_controller.cc index 30f7e45..13eec891 100644 --- a/chrome/browser/ash/input_method/assistive_window_controller.cc +++ b/chrome/browser/ash/input_method/assistive_window_controller.cc
@@ -23,8 +23,6 @@ namespace ash { namespace input_method { -constexpr base::TimeDelta kShowSuggestionDelayMs = base::Milliseconds(5); - namespace { gfx::NativeView GetParentView() { gfx::NativeView parent = nullptr; @@ -47,7 +45,6 @@ : delegate_(delegate), accessibility_view_(accessibility_view) {} AssistiveWindowController::~AssistiveWindowController() { - ClearPendingSuggestionTimer(); if (suggestion_window_view_ && suggestion_window_view_->GetWidget()) suggestion_window_view_->GetWidget()->RemoveObserver(this); if (undo_window_ && undo_window_->GetWidget()) @@ -104,7 +101,6 @@ } void AssistiveWindowController::OnWidgetDestroying(views::Widget* widget) { - ClearPendingSuggestionTimer(); if (suggestion_window_view_ && widget == suggestion_window_view_->GetWidget()) { widget->RemoveObserver(this); @@ -147,7 +143,6 @@ void AssistiveWindowController::HideSuggestion() { suggestion_text_ = base::EmptyString16(); confirmed_length_ = 0; - ClearPendingSuggestionTimer(); if (suggestion_window_view_) suggestion_window_view_->GetWidget()->Close(); if (grammar_suggestion_window_) @@ -155,17 +150,17 @@ } void AssistiveWindowController::SetBounds(const Bounds& bounds) { - if (bounds == bounds_) - return; - bounds_ = bounds; - if (suggestion_window_view_) - suggestion_window_view_->SetAnchorRect(bounds_.caret); - if (grammar_suggestion_window_) + // Sets suggestion_window_view_'s bounds here for most up-to-date cursor + // position. This is different from UndoWindow because UndoWindow gets cursors + // position before showing. + // TODO(crbug/1112982): Investigate getting bounds to suggester before sending + // show suggestion request. + if (suggestion_window_view_) { + suggestion_window_view_->SetAnchorRect(bounds.caret); + } + if (grammar_suggestion_window_) { grammar_suggestion_window_->SetBounds(bounds_.caret); - if (pending_suggestion_timer_ && pending_suggestion_timer_->IsRunning()) { - pending_suggestion_timer_->FireNow(); - pending_suggestion_timer_ = nullptr; } } @@ -177,18 +172,13 @@ void AssistiveWindowController::ShowSuggestion( const ui::ime::SuggestionDetails& details) { + if (!suggestion_window_view_) + // Since there is only one suggestion text in ShowSuggestion, we default to + // vertical layout. + InitSuggestionWindow(ui::ime::SuggestionWindowView::Orientation::kVertical); suggestion_text_ = details.text; confirmed_length_ = details.confirmed_length; - // Delay the showing of a completion suggestion. This is required to solve - // b/241321719, where we receive a ShowSuggestion call prior to a - // corresponding SetBounds call. Delaying allows any relevant SetBounds calls - // to be received before we show the suggestion to the user. - ClearPendingSuggestionTimer(); - pending_suggestion_timer_ = std::make_unique<base::OneShotTimer>(); - pending_suggestion_timer_->Start( - FROM_HERE, kShowSuggestionDelayMs, - base::BindOnce(&AssistiveWindowController::DisplayCompletionSuggestion, - weak_ptr_factory_.GetWeakPtr(), details)); + suggestion_window_view_->Show(details); } void AssistiveWindowController::SetButtonHighlighted( @@ -256,11 +246,6 @@ void AssistiveWindowController::SetAssistiveWindowProperties( const AssistiveWindowProperties& window) { window_ = window; - - // Make sure any pending timers are cleared before we attempt to show, or - // update, another assistive window. - ClearPendingSuggestionTimer(); - switch (window.type) { case ui::ime::AssistiveWindowType::kUndoWindow: if (!undo_window_) @@ -307,22 +292,6 @@ Announce(window.announce_string); } -void AssistiveWindowController::DisplayCompletionSuggestion( - const ui::ime::SuggestionDetails& details) { - if (!suggestion_window_view_) - InitSuggestionWindow(ui::ime::SuggestionWindowView::Orientation::kVertical); - suggestion_window_view_->SetAnchorRect(bounds_.caret); - suggestion_window_view_->Show(details); -} - -void AssistiveWindowController::ClearPendingSuggestionTimer() { - if (pending_suggestion_timer_) { - if (pending_suggestion_timer_->IsRunning()) - pending_suggestion_timer_->Stop(); - pending_suggestion_timer_ = nullptr; - } -} - void AssistiveWindowController::AssistiveWindowButtonClicked( const ui::ime::AssistiveWindowButton& button) const { delegate_->AssistiveWindowButtonClicked(button);
diff --git a/chrome/browser/ash/input_method/assistive_window_controller.h b/chrome/browser/ash/input_method/assistive_window_controller.h index 3ca03a09..c996b53e 100644 --- a/chrome/browser/ash/input_method/assistive_window_controller.h +++ b/chrome/browser/ash/input_method/assistive_window_controller.h
@@ -6,10 +6,7 @@ #define CHROME_BROWSER_ASH_INPUT_METHOD_ASSISTIVE_WINDOW_CONTROLLER_H_ #include <memory> -#include <optional> -#include "base/memory/weak_ptr.h" -#include "base/timer/timer.h" #include "chrome/browser/ash/input_method/assistive_window_properties.h" #include "chrome/browser/ash/input_method/ui/assistive_accessibility_view.h" #include "chrome/browser/ash/input_method/ui/assistive_delegate.h" @@ -76,8 +73,6 @@ void InitUndoWindow(); void InitGrammarSuggestionWindow(); void InitAccessibilityView(); - void DisplayCompletionSuggestion(const ui::ime::SuggestionDetails& details); - void ClearPendingSuggestionTimer(); const AssistiveWindowControllerDelegate* delegate_; AssistiveWindowProperties window_; @@ -88,9 +83,6 @@ std::u16string suggestion_text_; size_t confirmed_length_ = 0; Bounds bounds_; - std::unique_ptr<base::OneShotTimer> pending_suggestion_timer_; - - base::WeakPtrFactory<AssistiveWindowController> weak_ptr_factory_{this}; }; } // namespace input_method
diff --git a/chrome/browser/ash/input_method/assistive_window_controller_unittest.cc b/chrome/browser/ash/input_method/assistive_window_controller_unittest.cc index df255fef..9077f9b1 100644 --- a/chrome/browser/ash/input_method/assistive_window_controller_unittest.cc +++ b/chrome/browser/ash/input_method/assistive_window_controller_unittest.cc
@@ -16,7 +16,6 @@ #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/test/base/chrome_ash_test_base.h" #include "chrome/test/base/testing_profile.h" -#include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/window.h" #include "ui/base/ime/ash/ime_assistive_window_handler_interface.h" @@ -32,8 +31,6 @@ namespace ash { namespace input_method { -constexpr size_t kShowSuggestionDelayMs = 5; - class MockDelegate : public AssistiveWindowControllerDelegate { public: ~MockDelegate() override = default; @@ -56,10 +53,7 @@ class AssistiveWindowControllerTest : public ChromeAshTestBase { protected: - AssistiveWindowControllerTest() - : ChromeAshTestBase(std::make_unique<content::BrowserTaskEnvironment>( - base::test::TaskEnvironment::TimeSource::MOCK_TIME)) {} - + AssistiveWindowControllerTest() = default; ~AssistiveWindowControllerTest() override = default; void SetUp() override { @@ -111,11 +105,6 @@ /*disabled_features=*/{}); } - void WaitForSuggestionWindowDelay() { - task_environment()->FastForwardBy( - base::Milliseconds(kShowSuggestionDelayMs + 1)); - } - base::test::ScopedFeatureList feature_list_; std::unique_ptr<AssistiveWindowController> controller_; std::unique_ptr<MockDelegate> delegate_ = std::make_unique<MockDelegate>(); @@ -126,42 +115,10 @@ std::unique_ptr<TestAccessibilityView> accessibility_view_; }; -TEST_F(AssistiveWindowControllerTest, ShowSuggestionDelaysWindowDisplay) { - ui::ime::SuggestionDetails details; - details.text = u"asdf"; - details.confirmed_length = 3; - - controller_->ShowSuggestion(details); - ui::ime::SuggestionWindowView* window_before_delay = - controller_->GetSuggestionWindowViewForTesting(); - WaitForSuggestionWindowDelay(); - ui::ime::SuggestionWindowView* window_after_delay = - controller_->GetSuggestionWindowViewForTesting(); - - EXPECT_EQ(window_before_delay, nullptr); - EXPECT_NE(window_after_delay, nullptr); -} - -TEST_F(AssistiveWindowControllerTest, - SetBoundsAfterShowSuggestionCancelsDelay) { - ui::ime::SuggestionDetails details; - details.text = u"asdf"; - details.confirmed_length = 3; - gfx::Rect caret_bounds(0, 0, 100, 100); - - controller_->ShowSuggestion(details); - controller_->SetBounds(Bounds{.caret = caret_bounds}); - ui::ime::SuggestionWindowView* suggestion_window_view = - controller_->GetSuggestionWindowViewForTesting(); - - EXPECT_NE(suggestion_window_view, nullptr); -} - TEST_F(AssistiveWindowControllerTest, ShowSuggestionSetsConfirmedLength) { ui::ime::SuggestionDetails details; details.text = u"asdf"; details.confirmed_length = 3; - controller_->ShowSuggestion(details); EXPECT_EQ(controller_->GetConfirmedLength(), 3u); @@ -171,18 +128,16 @@ ui::ime::SuggestionDetails details; details.text = suggestion_; details.confirmed_length = 0; - controller_->ShowSuggestion(details); - WaitForSuggestionWindowDelay(); ui::ime::SuggestionWindowView* suggestion_view = controller_->GetSuggestionWindowViewForTesting(); - ASSERT_NE(suggestion_view, nullptr); gfx::Rect current_bounds = suggestion_view->GetAnchorRect(); gfx::Rect caret_bounds(0, 0, 100, 100); Bounds bounds; bounds.caret = caret_bounds; controller_->SetBounds(bounds); + EXPECT_NE(suggestion_view->GetAnchorRect(), current_bounds); EXPECT_EQ(suggestion_view->GetAnchorRect(), caret_bounds); } @@ -191,18 +146,16 @@ ui::ime::SuggestionDetails details; details.text = suggestion_; details.confirmed_length = 1; - controller_->ShowSuggestion(details); - WaitForSuggestionWindowDelay(); ui::ime::SuggestionWindowView* suggestion_view = controller_->GetSuggestionWindowViewForTesting(); - ASSERT_NE(suggestion_view, nullptr); gfx::Rect current_bounds = suggestion_view->GetAnchorRect(); gfx::Rect caret_bounds(0, 0, 100, 100); Bounds bounds; bounds.caret = caret_bounds; controller_->SetBounds(bounds); + EXPECT_NE(suggestion_view->GetAnchorRect(), current_bounds); EXPECT_EQ(suggestion_view->GetAnchorRect(), caret_bounds); } @@ -211,13 +164,10 @@ ui::ime::SuggestionDetails details; details.text = suggestion_; details.confirmed_length = 0; - controller_->ShowSuggestion(details); - WaitForSuggestionWindowDelay(); ui::ime::SuggestionWindowView* suggestion_view = controller_->GetSuggestionWindowViewForTesting(); - ASSERT_NE(suggestion_view, nullptr); gfx::Rect current_bounds = suggestion_view->GetAnchorRect(); gfx::Rect caret_bounds_after_one_key(current_bounds.width() + 1, current_bounds.height()); @@ -244,9 +194,7 @@ ui::ime::SuggestionDetails details; details.text = suggestion_; details.confirmed_length = 1; - controller_->ShowSuggestion(details); - WaitForSuggestionWindowDelay(); gfx::Rect current_bounds = controller_->GetSuggestionWindowViewForTesting()->GetAnchorRect();
diff --git a/chrome/browser/ash/input_method/autocorrect_manager.cc b/chrome/browser/ash/input_method/autocorrect_manager.cc index a2ef537..29037bc4 100644 --- a/chrome/browser/ash/input_method/autocorrect_manager.cc +++ b/chrome/browser/ash/input_method/autocorrect_manager.cc
@@ -70,8 +70,10 @@ // TODO(crbug/1111135): record metric (coverage) ui::IMEInputContextHandlerInterface* input_context = ui::IMEBridge::Get()->GetInputContextHandler(); - if (!input_context) + if (!input_context) { + AcceptOrClearPendingAutocorrect(); return; + } in_diacritical_autocorrect_session_ = IsCurrentInputMethodExperimentalMultilingual() && @@ -80,12 +82,18 @@ original_text_ = original_text; key_presses_until_underline_hide_ = kKeysUntilUnderlineHides; - if (!input_context->GetAutocorrectRange().is_empty()) { - input_context->SetAutocorrectRange(gfx::Range()); // clear underline - LogAssistiveAutocorrectAction(AutocorrectActions::kUserAcceptedAutocorrect); + + if (autocorrect_pending_) { + AcceptOrClearPendingAutocorrect(); } input_context->SetAutocorrectRange(autocorrect_range); // show underline + + if (autocorrect_range.is_empty()) { + return; + } + + autocorrect_pending_ = true; LogAssistiveAutocorrectAction(AutocorrectActions::kUnderlined); RecordAssistiveCoverage(AssistiveType::kAutocorrectUnderlined); autocorrect_time_ = base::TimeTicks::Now(); @@ -93,6 +101,8 @@ void AutocorrectManager::LogAssistiveAutocorrectAction( AutocorrectActions action) { + // TODO(b/161490813): Add a new metric to measure the impact of new changes. + // The new metric should have separate buckets for vk and pk. base::UmaHistogramEnumeration("InputMethod.Assistive.Autocorrect.Actions", action); @@ -115,7 +125,7 @@ } bool AutocorrectManager::OnKeyEvent(const ui::KeyEvent& event) { - if (event.type() != ui::ET_KEY_PRESSED) { + if (!autocorrect_pending_ || event.type() != ui::ET_KEY_PRESSED) { return false; } if (event.code() == ui::DomCode::ARROW_UP && window_visible_) { @@ -131,18 +141,18 @@ --key_presses_until_underline_hide_; } + // TODO(b/161490813): Move the logic to OnSurroundingTextChanged. + // There are issues with the current logic: + // 1. This logic does not clear autocorrect for VK as OnKeyEvent is only + // called for PK key presses. + // 2. It causes a difference between the behaviour of Autocorrect for VK + // and PK. + // 3. If a user changes the autocorrect suggestion and clears it, the logic + // will not count the "cleared" metric unless the user adds a few more + // characters. Meanwhile, other logics such as undo or OnFocus might + // process the pending autocorrect and make measurements inaccurate. if (key_presses_until_underline_hide_ == 0) { - ui::IMEInputContextHandlerInterface* input_context = - ui::IMEBridge::Get()->GetInputContextHandler(); - - if (input_context && !input_context->GetAutocorrectRange().is_empty()) { - input_context->SetAutocorrectRange(gfx::Range()); // clear underline - LogAssistiveAutocorrectAction( - AutocorrectActions::kUserAcceptedAutocorrect); - } else { - LogAssistiveAutocorrectAction( - AutocorrectActions::kUserActionClearedUnderline); - } + AcceptOrClearPendingAutocorrect(); } return false; } @@ -150,6 +160,9 @@ void AutocorrectManager::OnSurroundingTextChanged(const std::u16string& text, const int cursor_pos, const int anchor_pos) { + if (!autocorrect_pending_) { + return; + } std::string error; ui::IMEInputContextHandlerInterface* input_context = ui::IMEBridge::Get()->GetInputContextHandler(); @@ -157,14 +170,14 @@ const uint32_t cursor_pos_unsigned = base::checked_cast<uint32_t>(cursor_pos); if (!range.is_empty() && (cursor_pos_unsigned + kDistanceUntilUnderlineHides < range.start() || - cursor_pos_unsigned - kDistanceUntilUnderlineHides > range.end())) { - input_context->SetAutocorrectRange(gfx::Range()); // clear underline - LogAssistiveAutocorrectAction(AutocorrectActions::kUserAcceptedAutocorrect); + cursor_pos_unsigned > range.end() + kDistanceUntilUnderlineHides)) { + AcceptOrClearPendingAutocorrect(); } - // Explaination of checks: + // Explanation of checks: // 1) Check there is an autocorrect range // 2) Check cursor is in range - // 3) Ensure there is no selection (selection UI clashes with autocorrect UI). + // 3) Ensure there is no selection (selection UI clashes with autocorrect + // UI). if (!range.is_empty() && cursor_pos_unsigned >= range.start() && cursor_pos_unsigned <= range.end() && cursor_pos == anchor_pos) { ShowUndoWindow(range, text); @@ -181,10 +194,11 @@ base::Unretained(this))); } - if (key_presses_until_underline_hide_ > 0) { + if (autocorrect_pending_) { // TODO(b/149796494): move this to onblur() LogAssistiveAutocorrectAction( AutocorrectActions::kUserExitedTextFieldWithUnderline); + autocorrect_pending_ = false; key_presses_until_underline_hide_ = -1; } context_id_ = context_id; @@ -225,6 +239,7 @@ ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); } + autocorrect_pending_ = false; LogAssistiveAutocorrectAction(AutocorrectActions::kReverted); RecordAssistiveCoverage(AssistiveType::kAutocorrectReverted); RecordAssistiveSuccess(AssistiveType::kAutocorrectReverted); @@ -287,6 +302,29 @@ button_highlighted_ = true; } +void AutocorrectManager::AcceptOrClearPendingAutocorrect() { + if (!autocorrect_pending_) { + return; + } + + // TODO(b/161490813): Record delay metric. + ui::IMEInputContextHandlerInterface* input_context = + ui::IMEBridge::Get()->GetInputContextHandler(); + + // Non-empty autocorrect range means that the user has not modified + // autocorrect suggestion to invalidate it. So, it is considered as accepted. + if (input_context && !input_context->GetAutocorrectRange().is_empty()) { + input_context->SetAutocorrectRange(gfx::Range()); // clear underline + LogAssistiveAutocorrectAction( + AutocorrectActions::kUserAcceptedAutocorrect); + } else { + LogAssistiveAutocorrectAction( + AutocorrectActions::kUserActionClearedUnderline); + } + HideUndoWindow(); + autocorrect_pending_ = false; +} + void AutocorrectManager::OnTextFieldContextualInfoChanged( const TextFieldContextualInfo& info) { disabled_by_rule_ =
diff --git a/chrome/browser/ash/input_method/autocorrect_manager.h b/chrome/browser/ash/input_method/autocorrect_manager.h index f24e4ef..c848739 100644 --- a/chrome/browser/ash/input_method/autocorrect_manager.h +++ b/chrome/browser/ash/input_method/autocorrect_manager.h
@@ -77,6 +77,15 @@ void OnTextFieldContextualInfoChanged(const TextFieldContextualInfo& info); + // Forces to accept or clear a pending autocorrect suggestion if any. If the + // autocorrect range is empty, it means the user interacted with the + // pending autocorrect suggestion and made it invalid, so it considers + // the autocorrect suggestion as "cleared". Otherwise, it considers the + // autocorrect suggestion as "accepted". For the both cases, relevant + // metrics are recorded, state variables are reset and autocorrect range is + // set to empty. + void AcceptOrClearPendingAutocorrect(); + // Hides undo window if there is any visible. void HideUndoWindow(); @@ -95,6 +104,11 @@ bool button_highlighted_ = false; base::TimeTicks autocorrect_time_; + // Stores the state where there is a pending/unprocessed autocorrect + // suggestion. The state is kept to avoid issue where InputContext returns + // stale autocorrect range. + bool autocorrect_pending_ = false; + DiacriticsInsensitiveStringComparator diacritics_insensitive_string_comparator_; bool in_diacritical_autocorrect_session_ = false;
diff --git a/chrome/browser/ash/input_method/autocorrect_manager_unittest.cc b/chrome/browser/ash/input_method/autocorrect_manager_unittest.cc index f369124f..9dadac889 100644 --- a/chrome/browser/ash/input_method/autocorrect_manager_unittest.cc +++ b/chrome/browser/ash/input_method/autocorrect_manager_unittest.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ash/input_method/autocorrect_manager.h" #include "base/test/metrics/histogram_tester.h" +#include "chrome/browser/ash/input_method/suggestion_enums.h" #include "chrome/browser/ash/input_method/ui/suggestion_details.h" #include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h" #include "chrome/grit/generated_resources.h" @@ -25,6 +26,93 @@ using ::testing::_; +constexpr char kCoverageHistogramName[] = "InputMethod.Assistive.Coverage"; +constexpr char kSuccessHistogramName[] = "InputMethod.Assistive.Success"; +constexpr char kDelayHistogramName[] = + "InputMethod.Assistive.Autocorrect.Delay"; +constexpr char kAutocorrectActionHistogramName[] = + "InputMethod.Assistive.Autocorrect.Actions"; +constexpr char kVKAutocorrectActionHistogramName[] = + "InputMethod.Assistive.Autocorrect.Actions.VK"; + +// A helper for testing autocorrect histograms. There are redundant metrics +// for each autocorrect action and the helper ensures that all the relevant +// metrics for one action are updated properly. +void ExpectAutocorrectHistograms(const base::HistogramTester& histogram_tester, + bool visible_vk, + int window_shown, + int underlined, + int reverted, + int accepted, + int cleared_underline) { + // Window shown metrics. + histogram_tester.ExpectBucketCount(kCoverageHistogramName, + AssistiveType::kAutocorrectWindowShown, + window_shown); + histogram_tester.ExpectBucketCount(kAutocorrectActionHistogramName, + AutocorrectActions::kWindowShown, + window_shown); + if (visible_vk) { + histogram_tester.ExpectBucketCount(kVKAutocorrectActionHistogramName, + AutocorrectActions::kWindowShown, + window_shown); + } + + // Underlined metrics. + histogram_tester.ExpectBucketCount(kCoverageHistogramName, + AssistiveType::kAutocorrectUnderlined, + underlined); + histogram_tester.ExpectBucketCount(kAutocorrectActionHistogramName, + AutocorrectActions::kUnderlined, + underlined); + if (visible_vk) { + histogram_tester.ExpectBucketCount(kVKAutocorrectActionHistogramName, + AutocorrectActions::kUnderlined, + underlined); + } + + // Revert metrics. + histogram_tester.ExpectBucketCount( + kCoverageHistogramName, AssistiveType::kAutocorrectReverted, reverted); + histogram_tester.ExpectBucketCount( + kSuccessHistogramName, AssistiveType::kAutocorrectReverted, reverted); + histogram_tester.ExpectBucketCount(kAutocorrectActionHistogramName, + AutocorrectActions::kReverted, reverted); + histogram_tester.ExpectTotalCount(kDelayHistogramName, reverted); + if (visible_vk) { + histogram_tester.ExpectBucketCount(kVKAutocorrectActionHistogramName, + AutocorrectActions::kReverted, reverted); + } + + // Accept metrics. + histogram_tester.ExpectBucketCount( + kAutocorrectActionHistogramName, + AutocorrectActions::kUserAcceptedAutocorrect, accepted); + if (visible_vk) { + histogram_tester.ExpectBucketCount( + kVKAutocorrectActionHistogramName, + AutocorrectActions::kUserAcceptedAutocorrect, accepted); + } + + // Clear underline metrics. + histogram_tester.ExpectBucketCount( + kAutocorrectActionHistogramName, + AutocorrectActions::kUserActionClearedUnderline, cleared_underline); + + const int total_actions = + window_shown + underlined + reverted + accepted + cleared_underline; + const int total_coverage = window_shown + underlined + reverted; + + // Count total bucket to test side-effects and make the helper robust against + // future changes of the metric buckets. + histogram_tester.ExpectTotalCount(kCoverageHistogramName, total_coverage); + histogram_tester.ExpectTotalCount(kSuccessHistogramName, reverted); + histogram_tester.ExpectTotalCount(kAutocorrectActionHistogramName, + total_actions); + histogram_tester.ExpectTotalCount(kVKAutocorrectActionHistogramName, + visible_vk ? total_actions : 0); +} + // A helper to create properties for hidden undo window. AssistiveWindowProperties CreateHiddenUndoWindowProperties() { AssistiveWindowProperties window_properties; @@ -40,9 +128,9 @@ AssistiveWindowProperties window_properties; window_properties.type = ui::ime::AssistiveWindowType::kUndoWindow; window_properties.visible = true; - window_properties.announce_string = l10n_util::GetStringFUTF16( - IDS_SUGGESTION_AUTOCORRECT_UNDO_WINDOW_SHOWN, original_text, - autocorrected_text); + window_properties.announce_string = + l10n_util::GetStringFUTF16(IDS_SUGGESTION_AUTOCORRECT_UNDO_WINDOW_SHOWN, + original_text, autocorrected_text); return window_properties; } @@ -99,152 +187,495 @@ MOCK_METHOD(void, Announce, (const std::u16string& text), (override)); }; -TEST(AutocorrectManagerTest, HandleAutocorrectSetsAutocorrectRange) { - ui::MockIMEInputContextHandler mock_ime_input_context_handler; - ui::IMEBridge::Get()->SetInputContextHandler(&mock_ime_input_context_handler); - MockSuggestionHandler mock_suggestion_handler; - AutocorrectManager manager(&mock_suggestion_handler); +class AutocorrectManagerTest : public testing::Test { + protected: + AutocorrectManagerTest() : manager_(&mock_suggestion_handler_) { + ui::IMEBridge::Get()->SetInputContextHandler( + &mock_ime_input_context_handler_); + keyboard_client_ = ChromeKeyboardControllerClient::CreateForTest(); + keyboard_client_->set_keyboard_visible_for_test(false); + } - manager.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + ui::MockIMEInputContextHandler mock_ime_input_context_handler_; + ::testing::StrictMock<MockSuggestionHandler> mock_suggestion_handler_; + AutocorrectManager manager_; + std::unique_ptr<ChromeKeyboardControllerClient> keyboard_client_; + base::HistogramTester histogram_tester_; +}; - EXPECT_EQ(mock_ime_input_context_handler.GetAutocorrectRange(), +TEST_F(AutocorrectManagerTest, + HandleAutocorrectSetsRangeWhenNoPendingAutocorrectExists) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + EXPECT_EQ(mock_ime_input_context_handler_.GetAutocorrectRange(), gfx::Range(0, 3)); } -TEST(AutocorrectManagerTest, OnKeyEventHidesUnderlineAfterEnoughKeyPresses) { - ui::MockIMEInputContextHandler mock_ime_input_context_handler; - ui::IMEBridge::Get()->SetInputContextHandler(&mock_ime_input_context_handler); - MockSuggestionHandler mock_suggestion_handler; - AutocorrectManager manager(&mock_suggestion_handler); - manager.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); - - const auto key_event = - CreateKeyEvent(ui::DomKey::FromCharacter('a'), ui::DomCode::US_A); - EXPECT_FALSE(manager.OnKeyEvent(key_event)); - EXPECT_FALSE(manager.OnKeyEvent(key_event)); - EXPECT_FALSE(manager.OnKeyEvent(key_event)); - EXPECT_FALSE(manager.OnKeyEvent(key_event)); - EXPECT_FALSE(manager.OnKeyEvent(key_event)); - - EXPECT_TRUE(mock_ime_input_context_handler.GetAutocorrectRange().is_empty()); +TEST_F(AutocorrectManagerTest, + HandleAutocorrectSetsRangeWhenPendingAutocorrectExists) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + manager_.HandleAutocorrect(gfx::Range(4, 7), u"cn", u"can"); + EXPECT_EQ(mock_ime_input_context_handler_.GetAutocorrectRange(), + gfx::Range(4, 7)); } -TEST(AutocorrectManagerTest, MovingCursorInsideRangeShowsAssistiveWindow) { - ui::MockIMEInputContextHandler mock_ime_input_context_handler; - ui::IMEBridge::Get()->SetInputContextHandler(&mock_ime_input_context_handler); - ::testing::StrictMock<MockSuggestionHandler> mock_suggestion_handler; - AutocorrectManager manager(&mock_suggestion_handler); - manager.OnSurroundingTextChanged(u"the ", /*cursor_pos=*/4, - /*anchor_pos=*/4); - manager.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); +TEST_F(AutocorrectManagerTest, + HandleAutocorrectDoesNotSetRangeWhenInputContextIsNull) { + ui::IMEBridge::Get()->SetInputContextHandler(nullptr); + manager_.HandleAutocorrect(gfx::Range(0, 3), u"cn", u"can"); + EXPECT_EQ(mock_ime_input_context_handler_.GetAutocorrectRange(), + gfx::Range()); +} + +TEST_F(AutocorrectManagerTest, + HandleAutocorrectClearsRangeWithEmptyInputRange) { + mock_ime_input_context_handler_.SetAutocorrectRange(gfx::Range(3, 7)); + manager_.HandleAutocorrect(gfx::Range(), u"", u""); + EXPECT_EQ(mock_ime_input_context_handler_.GetAutocorrectRange(), + gfx::Range()); +} + +TEST_F(AutocorrectManagerTest, FewKeyPressesDoesNotClearAutocorrectRange) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + const ui::KeyEvent key_event = + CreateKeyEvent(ui::DomKey::FromCharacter('a'), ui::DomCode::US_A); + EXPECT_FALSE(manager_.OnKeyEvent(key_event)); + EXPECT_FALSE(manager_.OnKeyEvent(key_event)); + EXPECT_FALSE(manager_.OnKeyEvent(key_event)); + + EXPECT_TRUE( + !mock_ime_input_context_handler_.GetAutocorrectRange().is_empty()); +} + +TEST_F(AutocorrectManagerTest, EnoughKeyPressesClearsAutcorrectRange) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + const ui::KeyEvent key_event = + CreateKeyEvent(ui::DomKey::FromCharacter('a'), ui::DomCode::US_A); + EXPECT_FALSE(manager_.OnKeyEvent(key_event)); + EXPECT_FALSE(manager_.OnKeyEvent(key_event)); + EXPECT_FALSE(manager_.OnKeyEvent(key_event)); + EXPECT_FALSE(manager_.OnKeyEvent(key_event)); + + EXPECT_TRUE(mock_ime_input_context_handler_.GetAutocorrectRange().is_empty()); +} + +TEST_F(AutocorrectManagerTest, MovingCursorInsideRangeShowsAssistiveWindow) { + manager_.OnSurroundingTextChanged(u"the ", /*cursor_pos=*/4, + /*anchor_pos=*/4); + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); AssistiveWindowProperties properties = CreateVisibleUndoWindowProperties(u"teh", u"the"); - EXPECT_CALL(mock_suggestion_handler, + EXPECT_CALL(mock_suggestion_handler_, SetAssistiveWindowProperties(_, properties, _)); - manager.OnSurroundingTextChanged(u"the ", /*cursor_pos=*/1, - /*anchor_pos=*/1); + manager_.OnSurroundingTextChanged(u"the ", /*cursor_pos=*/1, + /*anchor_pos=*/1); } -TEST(AutocorrectManagerTest, MovingCursorOutsideRangeHidesAssistiveWindow) { - ui::MockIMEInputContextHandler mock_ime_input_context_handler; - ui::IMEBridge::Get()->SetInputContextHandler(&mock_ime_input_context_handler); - ::testing::StrictMock<MockSuggestionHandler> mock_suggestion_handler; - AutocorrectManager manager(&mock_suggestion_handler); - manager.OnSurroundingTextChanged(u"the ", /*cursor_pos=*/4, - /*anchor_pos=*/4); - manager.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); +TEST_F(AutocorrectManagerTest, MovingCursorOutsideRangeHidesAssistiveWindow) { + manager_.OnSurroundingTextChanged(u"the ", /*cursor_pos=*/4, + /*anchor_pos=*/4); + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); { ::testing::InSequence seq; AssistiveWindowProperties shown_properties = CreateVisibleUndoWindowProperties(u"teh", u"the"); - EXPECT_CALL(mock_suggestion_handler, + EXPECT_CALL(mock_suggestion_handler_, SetAssistiveWindowProperties(_, shown_properties, _)); AssistiveWindowProperties hidden_properties = CreateHiddenUndoWindowProperties(); - EXPECT_CALL(mock_suggestion_handler, + EXPECT_CALL(mock_suggestion_handler_, SetAssistiveWindowProperties(_, hidden_properties, _)); } - manager.OnSurroundingTextChanged(u"the ", /*cursor_pos=*/1, - /*anchor_pos=*/1); - manager.OnSurroundingTextChanged(u"the ", /*cursor_pos=*/4, - /*anchor_pos=*/4); + manager_.OnSurroundingTextChanged(u"the ", /*cursor_pos=*/1, + /*anchor_pos=*/1); + manager_.OnSurroundingTextChanged(u"the ", /*cursor_pos=*/4, + /*anchor_pos=*/4); } -TEST(AutocorrectManagerTest, UndoAutocorrectSingleWordInComposition) { +TEST_F(AutocorrectManagerTest, UndoAutocorrectSingleWordInComposition) { ui::FakeTextInputClient fake_text_input_client(ui::TEXT_INPUT_TYPE_TEXT); ui::InputMethodAsh ime(nullptr); ui::IMEBridge::Get()->SetInputContextHandler(&ime); ime.SetFocusedTextInputClient(&fake_text_input_client); - ::testing::NiceMock<MockSuggestionHandler> mock_suggestion_handler; - AutocorrectManager manager(&mock_suggestion_handler); - manager.OnSurroundingTextChanged(u"the ", /*cursor_pos=*/4, - /*anchor_pos=*/4); - manager.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + manager_.OnSurroundingTextChanged(u"the ", /*cursor_pos=*/4, + /*anchor_pos=*/4); + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); // Move cursor to the middle of 'the' and bring the text into composition. fake_text_input_client.SetTextAndSelection(u"the ", gfx::Range(2)); ime.SetComposingRange(0, 3, {}); - manager.UndoAutocorrect(); + manager_.UndoAutocorrect(); EXPECT_EQ(fake_text_input_client.text(), u"teh "); } -TEST(AutocorrectManagerTest, UndoAutocorrectMultipleWordInComposition) { +TEST_F(AutocorrectManagerTest, UndoAutocorrectMultipleWordInComposition) { ui::FakeTextInputClient fake_text_input_client(ui::TEXT_INPUT_TYPE_TEXT); ui::InputMethodAsh ime(nullptr); ui::IMEBridge::Get()->SetInputContextHandler(&ime); ime.SetFocusedTextInputClient(&fake_text_input_client); - ::testing::NiceMock<MockSuggestionHandler> mock_suggestion_handler; - AutocorrectManager manager(&mock_suggestion_handler); - manager.OnSurroundingTextChanged(u"hello world ", /*cursor_pos=*/12, - /*anchor_pos=*/12); - manager.HandleAutocorrect(gfx::Range(0, 11), u"helloworld", u"hello world"); + manager_.OnSurroundingTextChanged(u"hello world ", /*cursor_pos=*/12, + /*anchor_pos=*/12); + manager_.HandleAutocorrect(gfx::Range(0, 11), u"helloworld", u"hello world"); // Move cursor to the middle of 'hello' and bring the word into composition. fake_text_input_client.SetTextAndSelection(u"hello world ", gfx::Range(2)); ime.SetComposingRange(0, 5, {}); - manager.UndoAutocorrect(); + manager_.UndoAutocorrect(); EXPECT_EQ(fake_text_input_client.text(), u"helloworld "); } -TEST(AutocorrectManagerTest, RecordVirtualKeyboardMetricsWhenVisible) { - ui::MockIMEInputContextHandler mock_ime_input_context_handler; - ui::IMEBridge::Get()->SetInputContextHandler(&mock_ime_input_context_handler); - ::testing::StrictMock<MockSuggestionHandler> mock_suggestion_handler; - AutocorrectManager manager(&mock_suggestion_handler); - auto keyboard_client = ChromeKeyboardControllerClient::CreateForTest(); - keyboard_client->set_keyboard_visible_for_test(true); - base::HistogramTester histogram_tester; - manager.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); - histogram_tester.ExpectUniqueSample( - "InputMethod.Assistive.Autocorrect.Actions.VK", - 1 /*AutocorrectActions::kUnderlined*/, 1); +TEST_F(AutocorrectManagerTest, MovingCursorFarAfterRangeAcceptsAutocorrect) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + manager_.OnSurroundingTextChanged(u"the abc", 7, 7); + EXPECT_EQ(mock_ime_input_context_handler_.GetAutocorrectRange(), + gfx::Range()); } -TEST(AutocorrectManagerTest, - DoesNotRecordVirtualKeyboardMetricsWhenNotVisible) { - ui::MockIMEInputContextHandler mock_ime_input_context_handler; - ui::IMEBridge::Get()->SetInputContextHandler(&mock_ime_input_context_handler); - ::testing::StrictMock<MockSuggestionHandler> mock_suggestion_handler; - AutocorrectManager manager(&mock_suggestion_handler); - auto keyboard_client = ChromeKeyboardControllerClient::CreateForTest(); - keyboard_client->set_keyboard_visible_for_test(false); - base::HistogramTester histogram_tester; - manager.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); - histogram_tester.ExpectUniqueSample( - "InputMethod.Assistive.Autocorrect.Actions.VK", - 1 /*AutocorrectActions::kUnderlined*/, 0); +TEST_F(AutocorrectManagerTest, MovingCursorFarBeforeRangeAcceptsAutocorrect) { + manager_.HandleAutocorrect(gfx::Range(4, 7), u"teh", u"the"); + + manager_.OnSurroundingTextChanged(u"abc the", 0, 0); + EXPECT_EQ(mock_ime_input_context_handler_.GetAutocorrectRange(), + gfx::Range()); +} + +TEST_F(AutocorrectManagerTest, + MovingCursorCloseToRangeDoesNotClearAutocorrect) { + manager_.HandleAutocorrect(gfx::Range(4, 7), u"teh", u"the"); + + manager_.OnSurroundingTextChanged(u"abc the def", 1, 1); + EXPECT_EQ(mock_ime_input_context_handler_.GetAutocorrectRange(), + gfx::Range(4, 7)); + manager_.OnSurroundingTextChanged(u"abc the def", 10, 10); + EXPECT_EQ(mock_ime_input_context_handler_.GetAutocorrectRange(), + gfx::Range(4, 7)); +} + +TEST_F(AutocorrectManagerTest, + MovingCursorFarAfterRangeRecordsMetricsWhenAcceptingAutocorrect) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + manager_.OnSurroundingTextChanged(u"the abc", 7, 7); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/1, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, + MovingCursorFarBeforeRangeRecordsMetricsWhenAcceptingAutocorrect) { + manager_.HandleAutocorrect(gfx::Range(4, 7), u"teh", u"the"); + manager_.OnSurroundingTextChanged(u"abc the", 0, 0); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/1, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, + MovingCursorCloseToRangeDoesNotRecordMetricsForPendingAutocorrect) { + manager_.HandleAutocorrect(gfx::Range(4, 7), u"teh", u"the"); + + manager_.OnSurroundingTextChanged(u"abc the def", 1, 1); + manager_.OnSurroundingTextChanged(u"abc the def", 10, 10); + manager_.OnSurroundingTextChanged(u"abc the def", 3, 3); + manager_.OnSurroundingTextChanged(u"abc the def", 8, 8); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/0, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, + MovingCursorToRangeStartRecordsMetricsForShownUndoWindow) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + // This suppresses strict mock. + EXPECT_CALL(mock_suggestion_handler_, SetAssistiveWindowProperties(_, _, _)); + + manager_.OnSurroundingTextChanged(u"the", 0, 0); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/1, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/0, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, + MovingCursorToRangeEndRecordsMetricsForShownUndoWindow) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + // This suppresses strict mock. + EXPECT_CALL(mock_suggestion_handler_, SetAssistiveWindowProperties(_, _, _)); + + // Moving cursor inside the range does not increase window_shown. + manager_.OnSurroundingTextChanged(u"the", 3, 3); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/1, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/0, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, + KeepingCursorInsideRangeRecordsMetricsForShownUndoWindowOnce) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + // This suppresses strict mock. + EXPECT_CALL(mock_suggestion_handler_, SetAssistiveWindowProperties(_, _, _)); + + manager_.OnSurroundingTextChanged(u"the", 0, 0); + manager_.OnSurroundingTextChanged(u"the", 3, 3); + manager_.OnSurroundingTextChanged(u"the", 2, 2); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/1, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/0, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, + MovingCursorOutThenInsideRangeRecordsMetricsForShownUndoWindowTwice) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + // The function is called two times for show and one time for hide. + // This suppresses strict mock. + EXPECT_CALL(mock_suggestion_handler_, SetAssistiveWindowProperties(_, _, _)) + .Times(3); + + // Moving cursor first inside range, then outside the range and then again + // back to the range increments the metric for shown window twice. + manager_.OnSurroundingTextChanged(u"the", 1, 1); + manager_.OnSurroundingTextChanged(u"the ", 4, 4); + manager_.OnSurroundingTextChanged(u"the", 3, 3); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/2, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/0, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, KeyPressRecordsMetricsWhenAcceptingAutocorrect) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + const ui::KeyEvent key_event = + CreateKeyEvent(ui::DomKey::FromCharacter('a'), ui::DomCode::US_A); + manager_.OnKeyEvent(key_event); + manager_.OnKeyEvent(key_event); + manager_.OnKeyEvent(key_event); + manager_.OnKeyEvent(key_event); + + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/1, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, KeyPressRecordsMetricsWhenClearingAutocorrect) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + mock_ime_input_context_handler_.SetAutocorrectRange(gfx::Range()); + + const ui::KeyEvent key_event = + CreateKeyEvent(ui::DomKey::FromCharacter('a'), ui::DomCode::US_A); + // TODO(b/161490813): Remove extra calls after fixing OnKeyEvent logic. + // Currently, OnKeyEvent waits for four keys before updating metrics for + // cleared range. + manager_.OnKeyEvent(key_event); + manager_.OnKeyEvent(key_event); + manager_.OnKeyEvent(key_event); + manager_.OnKeyEvent(key_event); + + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/0, + /*cleared_underline=*/1); +} + +TEST_F(AutocorrectManagerTest, + KeyPressDoesNotRecordMetricsWhenAutocorrectIsStillPending) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + const ui::KeyEvent key_event = + CreateKeyEvent(ui::DomKey::FromCharacter('a'), ui::DomCode::US_A); + + manager_.OnKeyEvent(key_event); + manager_.OnKeyEvent(key_event); + manager_.OnKeyEvent(key_event); + + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/0, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, HandleAutocorrectRecordsMetricsWhenVkIsVisible) { + keyboard_client_->set_keyboard_visible_for_test(true); + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/true, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/0, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, + HandleAutocorrectRecordsMetricsWhenNoPendingAutocorrectExists) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/0, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, + HandleAutocorrectRecordsMetricsWhenAcceptingPendingAutocorrect) { + // Create a pending autocorrect range. + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + // Create a new autocorrect range. + manager_.HandleAutocorrect(gfx::Range(4, 7), u"cn", u"can"); + + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/2, + /*reverted=*/0, /*accepted=*/1, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, + HandleAutocorrectRecordsMetricsWhenClearingPendingAutocorrect) { + // Create a pending autocorrect range. + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + // Clear the previous autocorrect range. + mock_ime_input_context_handler_.SetAutocorrectRange(gfx::Range()); + + // Handle a new range. + manager_.HandleAutocorrect(gfx::Range(4, 7), u"cn", u"can"); + + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/2, + /*reverted=*/0, /*accepted=*/0, + /*cleared_underline=*/1); +} + +TEST_F(AutocorrectManagerTest, + HandleAutocorrectRecordsMetricsCorrectlyForNullInputContext) { + // Create a pending autocorrect range. + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + // Make Input context null. + ui::IMEBridge::Get()->SetInputContextHandler(nullptr); + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + // The pending range must be counted as cleared, but `underlined` metric must + // not be incremented with the empty input context. + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/0, + /*cleared_underline=*/1); + + // When there is no pending autocorrect range, nothing is incremented. + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/0, + /*cleared_underline=*/1); +} + +TEST_F(AutocorrectManagerTest, + HandleAutocorrectRecordsMetricsForEmptyInputAndNoPendingRange) { + // Empty input range does not change autocorrect range. + manager_.HandleAutocorrect(gfx::Range(), u"", u""); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/0, + /*reverted=*/0, /*accepted=*/0, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, + HandleAutocorrectRecordsMetricsForEmptyInputAndPendingRange) { + // When there is a pending autocorrect, empty input range makes the pending + // to be counted as accepted. + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + manager_.HandleAutocorrect(gfx::Range(), u"", u""); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/1, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, + HandleAutocorrectRecordsMetricsForEmptyInputAndClearedPending) { + // When there is a pending autocorrect, but cleared beforehand, + // empty input range makes the pending to be counted as cleared. + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + mock_ime_input_context_handler_.SetAutocorrectRange(gfx::Range()); + manager_.HandleAutocorrect(gfx::Range(), u"", u""); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/0, + /*cleared_underline=*/1); +} + +TEST_F(AutocorrectManagerTest, + KeyPressDoesNotRecordMetricsForStaleAutocorrectRange) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + // Press enough keys to be on the boundary of accepting autocorrect + // with key presses. + const ui::KeyEvent key_event = + CreateKeyEvent(ui::DomKey::FromCharacter('a'), ui::DomCode::US_A); + manager_.OnKeyEvent(key_event); + manager_.OnKeyEvent(key_event); + manager_.OnKeyEvent(key_event); + + // Accept autocorrect implicitly. + manager_.OnSurroundingTextChanged(u"the abc", 7, 7); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/1, + /*cleared_underline=*/0); + + // Set stale autocorrect range. + mock_ime_input_context_handler_.SetAutocorrectRange(gfx::Range(0, 3)); + + // Trigger the logic for implicitly accepting autocorrect by keypress + // and ensure duplicate count is not happening. + manager_.OnKeyEvent(key_event); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/1, + /*cleared_underline=*/0); +} + +TEST_F(AutocorrectManagerTest, + AutocorrectHandlerDoesNotRecordMetricsForStaleAutocorrectRange) { + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + + // Accept autocorrect implicitly. + manager_.OnSurroundingTextChanged(u"the abc", 7, 7); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/1, + /*reverted=*/0, /*accepted=*/1, + /*cleared_underline=*/0); + + // Set stale autocorrect range. + mock_ime_input_context_handler_.SetAutocorrectRange(gfx::Range(0, 3)); + + // Handle a new autocorrect and ensure the metric is not increase twice. + manager_.HandleAutocorrect(gfx::Range(0, 3), u"teh", u"the"); + ExpectAutocorrectHistograms(histogram_tester_, /*visible_vk=*/false, + /*window_shown=*/0, /*underlined=*/2, + /*reverted=*/0, /*accepted=*/1, + /*cleared_underline=*/0); } } // namespace
diff --git a/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc b/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc index e82ba577..8602cf4 100644 --- a/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc +++ b/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc
@@ -112,7 +112,7 @@ const test::UIPath kArcTosBackButton = {kArcTosId, "arcTosBackButton"}; const test::UIPath kArcTosNextButton = {kArcTosId, "arcTosNextButton"}; -const test::UIPath kCCAcceptButton = {kConsolidatedConsentId, "acceptButton"}; +const test::UIPath kCCLoadedDialog = {kConsolidatedConsentId, "loadedDialog"}; const test::UIPath kCCArcTosLink = {kConsolidatedConsentId, "arcTosLink"}; const test::UIPath kCCBackButton = {kConsolidatedConsentId, "backButton"}; @@ -316,12 +316,11 @@ } void WaitForConsolidatedConsentScreen() { - test::WaitForConsolidatedConsentScreen(); + OobeScreenWaiter(ConsolidatedConsentScreenView::kScreenId).Wait(); + test::OobeJS().CreateVisibilityWaiter(true, kCCLoadedDialog)->Wait(); // Make sure that ARC ToS link is visible. test::OobeJS().ExpectVisiblePath(kCCArcTosLink); - test::OobeJS().CreateVisibilityWaiter(true, kCCAcceptButton)->Wait(); - test::OobeJS().ExpectVisiblePath(kCCAcceptButton); } void AcceptArcTos() { @@ -489,14 +488,9 @@ IsConfirmationDialogHidden(); } -// TODO(crbug.com/1150349): Flaky on ChromeOS ASAN. -#if defined(ADDRESS_SANITIZER) -#define MAYBE_OnlineSetupFlowSuccess DISABLED_OnlineSetupFlowSuccess -#else -#define MAYBE_OnlineSetupFlowSuccess OnlineSetupFlowSuccess -#endif +// TODO(crbug.com/1341234): flaky. IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, - MAYBE_OnlineSetupFlowSuccess) { + DISABLED_OnlineSetupFlowSuccess) { // Simulate successful online setup. enrollment_helper_.ExpectEnrollmentMode( policy::EnrollmentConfig::MODE_ATTESTATION);
diff --git a/chrome/browser/autofill/form_structure_browsertest.cc b/chrome/browser/autofill/form_structure_browsertest.cc index 9c385fb..fe2d064f 100644 --- a/chrome/browser/autofill/form_structure_browsertest.cc +++ b/chrome/browser/autofill/form_structure_browsertest.cc
@@ -228,7 +228,9 @@ // TODO(crbug.com/1113970): Remove once launched. features::kAutofillSectionUponRedundantNameInfo, // TODO(crbug.com/1335549): Remove once launched. - features::kAutofillParseIBANFields}, + features::kAutofillParseIBANFields, + // TODO(crbug.com/1341387): Remove once launched. + features::kAutofillParseVcnCardOnFileStandaloneCvcFields}, // Disabled {}); }
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc index 333789dc1..c981563 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
@@ -1131,8 +1131,11 @@ nullable_filter.is_null() || nullable_filter.Run(search_url); } - if (should_clear_zero_suggest_and_session_token) + if (should_clear_zero_suggest_and_session_token) { prefs->SetString(omnibox::kZeroSuggestCachedResults, std::string()); + prefs->SetDict(omnibox::kZeroSuggestCachedResultsWithURL, + base::Value::Dict()); + } // |search_prefetch_service| is null if |profile_| is off the record. auto* search_prefetch_service =
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc index 879eeb4e..f7f95a3 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc
@@ -2066,14 +2066,18 @@ TEST_F(ChromeBrowsingDataRemoverDelegateTest, ZeroSuggestCacheClear) { PrefService* prefs = GetProfile()->GetPrefs(); + omnibox::SetUserPreferenceForZeroSuggestCachedResponse( + prefs, "https://google.com/search?q=chrome", R"(["", ["foo", "bar"]])"); prefs->SetString(omnibox::kZeroSuggestCachedResults, - "[\"\", [\"foo\", \"bar\"]]"); + R"(["", ["foo", "bar"]])"); BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), content::BrowsingDataRemover::DATA_TYPE_COOKIES, false); // Expect the prefs to be cleared when cookies are removed. EXPECT_TRUE(prefs->GetString(omnibox::kZeroSuggestCachedResults).empty()); + EXPECT_TRUE( + prefs->GetValueDict(omnibox::kZeroSuggestCachedResultsWithURL).empty()); EXPECT_EQ(content::BrowsingDataRemover::DATA_TYPE_COOKIES, GetRemovalMask()); EXPECT_EQ(content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB, GetOriginTypeMask());
diff --git a/chrome/browser/domain_reliability/browsertest.cc b/chrome/browser/domain_reliability/browsertest.cc index 365238d7..23ef287c 100644 --- a/chrome/browser/domain_reliability/browsertest.cc +++ b/chrome/browser/domain_reliability/browsertest.cc
@@ -145,8 +145,8 @@ { mojo::ScopedAllowSyncCallForTesting allow_sync_call; - GetNetworkContext()->AddDomainReliabilityContextForTesting( - test_server()->base_url().DeprecatedGetOriginAsURL(), upload_url); + GetNetworkContext()->AddDomainReliabilityContextForTesting( // IN-TEST + test_server()->GetOrigin(), upload_url); } // Trigger an error. @@ -189,8 +189,8 @@ GURL upload_url = test_server()->GetURL("/hung"); { mojo::ScopedAllowSyncCallForTesting allow_sync_call; - GetNetworkContext()->AddDomainReliabilityContextForTesting( - GURL("https://localhost/"), upload_url); + GetNetworkContext()->AddDomainReliabilityContextForTesting( // IN-TEST + url::Origin::Create(GURL("https://localhost/")), upload_url); } ASSERT_TRUE( @@ -215,8 +215,8 @@ GURL hung_url = test_server()->GetURL("/hung"); { mojo::ScopedAllowSyncCallForTesting allow_sync_call; - GetNetworkContext()->AddDomainReliabilityContextForTesting(hung_url, - hung_url); + GetNetworkContext()->AddDomainReliabilityContextForTesting( // IN-TEST + url::Origin::Create(hung_url), hung_url); } // Use a SimpleURLLoader so we can leak the mojo pipe, ensuring that URLLoader
diff --git a/chrome/browser/downgrade/snapshot_file_collector.cc b/chrome/browser/downgrade/snapshot_file_collector.cc index 6965a0f..40ca190 100644 --- a/chrome/browser/downgrade/snapshot_file_collector.cc +++ b/chrome/browser/downgrade/snapshot_file_collector.cc
@@ -55,11 +55,12 @@ // Returns a list of items to snapshot that should be under a profile directory. std::vector<SnapshotItemDetails> CollectProfileItems() { // Data mask to delete the pref files if any of the following types is - // deleted. When cookies are deleted, the kZeroSuggestCachedResults pref has - // to be reset. When history and isolated origins are deleted, the - // kPrefLastLaunchTime and kUserTriggeredIsolatedOrigins prefs have to be - // reset. When data type content is deleted, blocklisted sites are deleted - // from the translation prefs. + // deleted. When cookies are deleted, the kZeroSuggestCachedResults and + // kZeroSuggestCachedResultsWithURL prefs have to be reset. When history and + // isolated origins are deleted, the kPrefLastLaunchTime and + // kUserTriggeredIsolatedOrigins prefs have to be reset. When data type + // content is deleted, blocklisted sites are deleted from the translation + // prefs. uint64_t pref_data_type = content::BrowsingDataRemover::DATA_TYPE_COOKIES | chrome_browsing_data_remover::DATA_TYPE_ISOLATED_ORIGINS |
diff --git a/chrome/browser/download/bubble/download_bubble_prefs.cc b/chrome/browser/download/bubble/download_bubble_prefs.cc index e90d611..63d10aa6 100644 --- a/chrome/browser/download/bubble/download_bubble_prefs.cc +++ b/chrome/browser/download/bubble/download_bubble_prefs.cc
@@ -51,6 +51,15 @@ ->IsDownloadUiEnabled(); } +bool ShouldShowDetailsAutomatically(Profile* profile) { + // Do not show details automatically if this download is observed by at least + // one extension. This is to avoid conflicts between the download bubble and + // the extension bubble. + return !DownloadCoreServiceFactory::GetForBrowserContext( + profile->GetOriginalProfile()) + ->IsDownloadObservedByExtension(); +} + bool IsDownloadConnectorEnabled(Profile* profile) { auto* connector_service = enterprise_connectors::ConnectorsServiceFactory::GetForBrowserContext(
diff --git a/chrome/browser/download/bubble/download_bubble_prefs.h b/chrome/browser/download/bubble/download_bubble_prefs.h index 923bf5f..7ec88fa 100644 --- a/chrome/browser/download/bubble/download_bubble_prefs.h +++ b/chrome/browser/download/bubble/download_bubble_prefs.h
@@ -18,6 +18,10 @@ // Called when deciding whether to show or hide the bubble. bool ShouldShowDownloadBubble(Profile* profile); +// Called when deciding whehther to pop up the bubble automatically when a +// download has started or completed. +bool ShouldShowDetailsAutomatically(Profile* profile); + bool IsDownloadConnectorEnabled(Profile* profile); } // namespace download
diff --git a/chrome/browser/download/bubble/download_display_controller.cc b/chrome/browser/download/bubble/download_display_controller.cc index 8de8a39..4271612 100644 --- a/chrome/browser/download/bubble/download_display_controller.cc +++ b/chrome/browser/download/bubble/download_display_controller.cc
@@ -106,7 +106,7 @@ GURL(), EXCLUSIVE_ACCESS_BUBBLE_TYPE_DOWNLOAD_STARTED, ExclusiveAccessBubbleHideCallback(), /*force_update=*/false); - } else { + } else if (download::ShouldShowDetailsAutomatically(browser_->profile())) { display_->ShowDetails(); } } @@ -122,7 +122,8 @@ if (show_details_if_done) { if (browser_->window()->IsFullscreen()) { download_completed_while_fullscreen_ = true; - } else { + } else if (download::ShouldShowDetailsAutomatically( + browser_->profile())) { display_->ShowDetails(); } } @@ -195,7 +196,8 @@ bubble_controller_->GetAllItemsToDisplay(); UpdateToolbarButtonState(all_models); int in_progress_count = InProgressDownloadCount(all_models); - if (in_progress_count > 0) { + if (in_progress_count > 0 && + download::ShouldShowDetailsAutomatically(browser_->profile())) { display_->ShowDetails(); } }
diff --git a/chrome/browser/download/download_core_service.h b/chrome/browser/download/download_core_service.h index 79c2065..59ceb6b 100644 --- a/chrome/browser/download/download_core_service.h +++ b/chrome/browser/download/download_core_service.h
@@ -77,6 +77,10 @@ // Returns false if at least one extension has disabled the UI, true // otherwise. virtual bool IsDownloadUiEnabled() = 0; + + // Returns true if at least one extension is observing download events, false + // otherwise. + virtual bool IsDownloadObservedByExtension() = 0; }; #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CORE_SERVICE_H_
diff --git a/chrome/browser/download/download_core_service_impl.cc b/chrome/browser/download/download_core_service_impl.cc index 5cbb8bb6..11c2135 100644 --- a/chrome/browser/download/download_core_service_impl.cc +++ b/chrome/browser/download/download_core_service_impl.cc
@@ -157,6 +157,15 @@ #endif } +bool DownloadCoreServiceImpl::IsDownloadObservedByExtension() { +#if BUILDFLAG(IS_ANDROID) + return false; +#else + return extension_event_router_ && + extension_event_router_->IsDownloadObservedByExtension(); +#endif +} + void DownloadCoreServiceImpl::Shutdown() { if (download_manager_created_) { // Normally the DownloadManager would be shutdown later, after the Profile
diff --git a/chrome/browser/download/download_core_service_impl.h b/chrome/browser/download/download_core_service_impl.h index 46214d6..8456a98 100644 --- a/chrome/browser/download/download_core_service_impl.h +++ b/chrome/browser/download/download_core_service_impl.h
@@ -53,6 +53,7 @@ void SetDownloadManagerDelegateForTesting( std::unique_ptr<ChromeDownloadManagerDelegate> delegate) override; bool IsDownloadUiEnabled() override; + bool IsDownloadObservedByExtension() override; void SetDownloadHistoryForTesting( std::unique_ptr<DownloadHistory> download_history) override;
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc index 29b36ca16..4003cca 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -2418,6 +2418,66 @@ site_group_list))); } +DeveloperPrivateGetMatchingExtensionsForSiteFunction:: + DeveloperPrivateGetMatchingExtensionsForSiteFunction() = default; +DeveloperPrivateGetMatchingExtensionsForSiteFunction:: + ~DeveloperPrivateGetMatchingExtensionsForSiteFunction() = default; + +ExtensionFunction::ResponseAction +DeveloperPrivateGetMatchingExtensionsForSiteFunction::Run() { + std::unique_ptr<developer::GetMatchingExtensionsForSite::Params> params( + developer::GetMatchingExtensionsForSite::Params::Create(args())); + EXTENSION_FUNCTION_VALIDATE(params); + + URLPattern parsed_site(Extension::kValidHostPermissionSchemes); + if (parsed_site.Parse(params->site) != URLPattern::ParseResult::kSuccess) + return RespondNow(Error("Invalid site: " + params->site)); + + std::vector<developer::MatchingExtensionInfo> matching_extensions; + URLPatternSet site_pattern({parsed_site}); + std::unique_ptr<ExtensionSet> all_extensions = + ExtensionRegistry::Get(browser_context()) + ->GenerateInstalledExtensionsSet(); + for (const auto& extension : *all_extensions) { + const URLPatternSet& extension_withheld_sites = + extension->permissions_data()->withheld_permissions().effective_hosts(); + const URLPatternSet granted_intersection = + URLPatternSet::CreateIntersection( + site_pattern, + extension->permissions_data()->GetEffectiveHostPermissions(), + URLPatternSet::IntersectionBehavior::kDetailed); + const URLPatternSet withheld_intersection = + URLPatternSet::CreateIntersection( + site_pattern, extension_withheld_sites, + URLPatternSet::IntersectionBehavior::kDetailed); + + if (granted_intersection.is_empty() && withheld_intersection.is_empty()) + continue; + + // By default, return ON_CLICK if the extension has requested but does not + // have access to any sites that match `site_pattern`. + developer::HostAccess host_access = developer::HOST_ACCESS_ON_CLICK; + + // If the extension has access to at least one site that matches + // `site_pattern`, return ON_ALL_SITES or ON_SPECIFIC_SITES depending on + // if the extension has any withheld sites. + if (!granted_intersection.is_empty()) { + host_access = extension_withheld_sites.is_empty() + ? developer::HOST_ACCESS_ON_ALL_SITES + : developer::HOST_ACCESS_ON_SPECIFIC_SITES; + } + + developer::MatchingExtensionInfo matching_info; + matching_info.site_access = host_access; + matching_info.id = extension->id(); + matching_extensions.push_back(std::move(matching_info)); + } + + return RespondNow( + ArgumentList(developer::GetMatchingExtensionsForSite::Results::Create( + matching_extensions))); +} + } // namespace api } // namespace extensions
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.h b/chrome/browser/extensions/api/developer_private/developer_private_api.h index 23ca25d..4b97110 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.h +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.h
@@ -937,6 +937,24 @@ ResponseAction Run() override; }; +class DeveloperPrivateGetMatchingExtensionsForSiteFunction + : public DeveloperPrivateAPIFunction { + public: + DECLARE_EXTENSION_FUNCTION("developerPrivate.getMatchingExtensionsForSite", + DEVELOPERPRIVATE_GETMATCHINGEXTENSIONSFORSITE) + DeveloperPrivateGetMatchingExtensionsForSiteFunction(); + + DeveloperPrivateGetMatchingExtensionsForSiteFunction( + const DeveloperPrivateGetMatchingExtensionsForSiteFunction&) = delete; + DeveloperPrivateGetMatchingExtensionsForSiteFunction& operator=( + const DeveloperPrivateGetMatchingExtensionsForSiteFunction&) = delete; + + private: + ~DeveloperPrivateGetMatchingExtensionsForSiteFunction() override; + + ResponseAction Run() override; +}; + } // namespace api } // namespace extensions
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc index 1682f4e..11a86875 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
@@ -186,6 +186,37 @@ } } +void GetMatchingExtensionsForSite( + Profile* profile, + const std::string& site, + std::vector<api::developer_private::MatchingExtensionInfo>* infos) { + scoped_refptr<ExtensionFunction> function = base::MakeRefCounted< + api::DeveloperPrivateGetMatchingExtensionsForSiteFunction>(); + EXPECT_TRUE(api_test_utils::RunFunction( + function.get(), base::StringPrintf(R"(["%s"])", site.c_str()), profile)) + << function->GetError(); + const base::Value::List* results = function->GetResultList(); + ASSERT_EQ(1u, results->size()); + ASSERT_TRUE((*results)[0].is_list()); + + infos->clear(); + for (const auto& value : (*results)[0].GetList()) { + infos->push_back(std::move( + *api::developer_private::MatchingExtensionInfo::FromValue(value))); + } +} + +auto MatchMatchingExtensionInfo( + const std::string& extension_id, + const api::developer_private::HostAccess& host_access) { + return testing::AllOf( + testing::Field(&api::developer_private::MatchingExtensionInfo::id, + extension_id), + testing::Field( + &api::developer_private::MatchingExtensionInfo::site_access, + host_access)); +} + } // namespace class DeveloperPrivateApiUnitTest : public ExtensionServiceTestWithInstall { @@ -2203,6 +2234,88 @@ }])"); } +TEST_F(DeveloperPrivateApiUnitTest, + DeveloperPrivateGetMatchingExtensionsForSite) { + namespace developer = api::developer_private; + + scoped_refptr<const Extension> extension_1 = + ExtensionBuilder("test").AddPermission("*://mail.google.com/").Build(); + + scoped_refptr<const Extension> extension_2 = + ExtensionBuilder("test_2") + .AddPermission("*://images.google.com/") + .Build(); + AddExtensionAndGrantPermissions(profile(), service(), *extension_1); + AddExtensionAndGrantPermissions(profile(), service(), *extension_2); + + std::vector<developer::MatchingExtensionInfo> infos; + GetMatchingExtensionsForSite(profile(), "http://none.com/", &infos); + EXPECT_TRUE(infos.empty()); + + GetMatchingExtensionsForSite(profile(), "http://images.google.com/", &infos); + + // "http://images.google.com/" should only match with `extension_2`. + EXPECT_THAT(infos, testing::UnorderedElementsAre(MatchMatchingExtensionInfo( + extension_2->id(), + developer::HostAccess::HOST_ACCESS_ON_ALL_SITES))); + + service()->DisableExtension(extension_2->id(), + disable_reason::DISABLE_USER_ACTION); + GetMatchingExtensionsForSite(profile(), "*://*.google.com/", &infos); + + // "*://*.google.com/" should only match with both `extension_1` and + // `extension_2`. + EXPECT_THAT(infos, testing::UnorderedElementsAre( + MatchMatchingExtensionInfo( + extension_1->id(), + developer::HostAccess::HOST_ACCESS_ON_ALL_SITES), + MatchMatchingExtensionInfo( + extension_2->id(), + developer::HostAccess::HOST_ACCESS_ON_ALL_SITES))); +} + +// Test that the host access returned by GetMatchingExtensionsForSite reflects +// whether the extension has access to the queried site, or has withheld sites +// in general. +TEST_F(DeveloperPrivateApiUnitTest, + DeveloperPrivateGetMatchingExtensionsForSite_RuntimeGrantedHostAccess) { + namespace developer = api::developer_private; + + scoped_refptr<const Extension> extension = + ExtensionBuilder("test").AddPermission("<all_urls>").Build(); + AddExtensionAndGrantPermissions(profile(), service(), *extension); + + std::vector<developer::MatchingExtensionInfo> infos; + GetMatchingExtensionsForSite(profile(), "http://example.com/", &infos); + + EXPECT_THAT(infos, testing::UnorderedElementsAre(MatchMatchingExtensionInfo( + extension->id(), + developer::HostAccess::HOST_ACCESS_ON_ALL_SITES))); + + ScriptingPermissionsModifier modifier(profile(), extension.get()); + EXPECT_FALSE(modifier.HasWithheldHostPermissions()); + modifier.SetWithholdHostPermissions(true); + + GetMatchingExtensionsForSite(profile(), "http://example.com/", &infos); + EXPECT_THAT(infos, testing::UnorderedElementsAre(MatchMatchingExtensionInfo( + extension->id(), + developer::HostAccess::HOST_ACCESS_ON_CLICK))); + + RunAddHostPermission(profile(), *extension, "*://*.google.com/*", + /*should_succeed=*/true, nullptr); + + GetMatchingExtensionsForSite(profile(), "http://google.com/", &infos); + EXPECT_THAT(infos, + testing::UnorderedElementsAre(MatchMatchingExtensionInfo( + extension->id(), + developer::HostAccess::HOST_ACCESS_ON_SPECIFIC_SITES))); + + GetMatchingExtensionsForSite(profile(), "http://example.com/", &infos); + EXPECT_THAT(infos, testing::UnorderedElementsAre(MatchMatchingExtensionInfo( + extension->id(), + developer::HostAccess::HOST_ACCESS_ON_CLICK))); +} + class DeveloperPrivateApiAllowlistUnitTest : public DeveloperPrivateApiUnitTest { public:
diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc index 3f636ad..ac0befd 100644 --- a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc +++ b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc
@@ -652,13 +652,18 @@ } // Location. + bool updates_from_web_store = + extension_management->UpdatesFromWebstore(extension); if (extension.location() == mojom::ManifestLocation::kInternal && - extension_management->UpdatesFromWebstore(extension)) { + updates_from_web_store) { info->location = developer::LOCATION_FROM_STORE; } else if (Manifest::IsUnpackedLocation(extension.location())) { info->location = developer::LOCATION_UNPACKED; + } else if (extension.was_installed_by_default() && + !extension.was_installed_by_oem() && updates_from_web_store) { + info->location = developer::LOCATION_INSTALLED_BY_DEFAULT; } else if (Manifest::IsExternalLocation(extension.location()) && - extension_management->UpdatesFromWebstore(extension)) { + updates_from_web_store) { info->location = developer::LOCATION_THIRD_PARTY; } else { info->location = developer::LOCATION_UNKNOWN;
diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc b/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc index 7b10f05..68ed5f2 100644 --- a/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc +++ b/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc
@@ -379,6 +379,63 @@ EXPECT_FALSE(info->path); } +// Tests that the correct location field is returned for an extension that's +// installed by default. +TEST_F(ExtensionInfoGeneratorUnitTest, ExtensionInfoInstalledByDefault) { + profile()->GetPrefs()->SetBoolean(prefs::kExtensionsUIDeveloperMode, true); + + std::unique_ptr<base::DictionaryValue> manifest = + DictionaryBuilder() + .Set("name", "installed by default") + .Set("version", "1.2") + .Set("manifest_version", 3) + .Set("update_url", "https://clients2.google.com/service/update2/crx") + .Build(); + + scoped_refptr<const Extension> extension = + ExtensionBuilder() + .SetManifest(std::move(manifest)) + .SetLocation(ManifestLocation::kExternalPref) + .SetPath(data_dir()) + .SetID(crx_file::id_util::GenerateId("alpha")) + .AddFlags(Extension::WAS_INSTALLED_BY_DEFAULT) + .Build(); + service()->AddExtension(extension.get()); + + std::unique_ptr<api::developer_private::ExtensionInfo> info = + GenerateExtensionInfo(extension->id()); + EXPECT_EQ(info->location, developer::LOCATION_INSTALLED_BY_DEFAULT); +} + +// Tests that the correct location field is returned for an extension that's +// installed by the OEM. +TEST_F(ExtensionInfoGeneratorUnitTest, ExtensionInfoInstalledByOem) { + profile()->GetPrefs()->SetBoolean(prefs::kExtensionsUIDeveloperMode, true); + + std::unique_ptr<base::DictionaryValue> manifest = + DictionaryBuilder() + .Set("name", "installed by OEM") + .Set("version", "1.2") + .Set("manifest_version", 3) + .Set("update_url", "https://clients2.google.com/service/update2/crx") + .Build(); + + scoped_refptr<const Extension> extension = + ExtensionBuilder() + .SetManifest(std::move(manifest)) + .SetLocation(ManifestLocation::kExternalPref) + .SetPath(data_dir()) + .SetID(crx_file::id_util::GenerateId("alpha")) + .AddFlags(Extension::WAS_INSTALLED_BY_DEFAULT | + Extension::WAS_INSTALLED_BY_OEM) + .Build(); + service()->AddExtension(extension.get()); + + std::unique_ptr<api::developer_private::ExtensionInfo> info = + GenerateExtensionInfo(extension->id()); + EXPECT_EQ(info->location, developer::LOCATION_THIRD_PARTY); +} + // Test three generated json outputs. TEST_F(ExtensionInfoGeneratorUnitTest, GenerateExtensionsJSONData) { // Test Extension1
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc index ff80caea..1d58b5ad 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -1696,6 +1696,11 @@ return ui_disabling_extensions_.empty(); } +bool ExtensionDownloadsEventRouter::IsDownloadObservedByExtension() const { + EventRouter* router = EventRouter::Get(profile_); + return router && router->HasEventListener(downloads::OnChanged::kEventName); +} + // The method by which extensions hook into the filename determination process // is based on the method by which the omnibox API allows extensions to hook // into the omnibox autocompletion process. Extensions that wish to play a part
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.h b/chrome/browser/extensions/api/downloads/downloads_api.h index e47ffbf..3aef44c 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api.h +++ b/chrome/browser/extensions/api/downloads/downloads_api.h
@@ -393,6 +393,8 @@ void SetUiEnabled(const extensions::Extension* extension, bool enabled); bool IsUiEnabled() const; + bool IsDownloadObservedByExtension() const; + // Called by ChromeDownloadManagerDelegate during the filename determination // process, allows extensions to change the item's target filename. If no // extension wants to change the target filename, then |filename_changed| will
diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc index d0a98fce..8c94fbb 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
@@ -4762,13 +4762,12 @@ feature_list_.InitAndEnableFeature(safe_browsing::kDownloadBubble); } - bool IsDownloadToolbarButtonShowing() { + DownloadDisplay* GetDownloadToolbarButton() { return current_browser() ->window() ->GetDownloadBubbleUIController() ->GetDownloadDisplayController() - ->download_display_for_testing() - ->IsShowing(); + ->download_display_for_testing(); } private: @@ -4784,15 +4783,15 @@ EXPECT_TRUE(RunFunction(new DownloadsSetUiOptionsFunction(), R"([{"enabled": true}])")); - EXPECT_TRUE(IsDownloadToolbarButtonShowing()); + EXPECT_TRUE(GetDownloadToolbarButton()->IsShowing()); EXPECT_TRUE(RunFunction(new DownloadsSetUiOptionsFunction(), R"([{"enabled": false}])")); - EXPECT_FALSE(IsDownloadToolbarButtonShowing()); + EXPECT_FALSE(GetDownloadToolbarButton()->IsShowing()); items[0]->Cancel(true); // Remain hidden on download updates. - EXPECT_FALSE(IsDownloadToolbarButtonShowing()); + EXPECT_FALSE(GetDownloadToolbarButton()->IsShowing()); } IN_PROC_BROWSER_TEST_F( @@ -4804,7 +4803,33 @@ DownloadManager::DownloadVector items; CreateTwoDownloads(&items); ScopedItemVectorCanceller delete_items(&items); - EXPECT_FALSE(IsDownloadToolbarButtonShowing()); + EXPECT_FALSE(GetDownloadToolbarButton()->IsShowing()); +} + +IN_PROC_BROWSER_TEST_F( + DownloadExtensionBubbleEnabledTest, + DownloadExtensionBubbleEnabledTest_SetUiOptionsShowDetails) { + LoadExtension("downloads_split"); + DownloadManager::DownloadVector items; + CreateTwoDownloads(&items); + ScopedItemVectorCanceller delete_items(&items); + + EXPECT_TRUE(GetDownloadToolbarButton()->IsShowing()); + // Details are not shown because the download item is observed by an + // extension. + EXPECT_FALSE(GetDownloadToolbarButton()->IsShowingDetails()); + + items[0]->Cancel(true); + EXPECT_TRUE(GetDownloadToolbarButton()->IsShowing()); + // Details are not shown because the download item is observed by an + // extension. + EXPECT_FALSE(GetDownloadToolbarButton()->IsShowingDetails()); + + DisableExtension(GetExtensionId()); + items[1]->Cancel(true); + EXPECT_TRUE(GetDownloadToolbarButton()->IsShowing()); + // Details are shown because the extension is disabled. + EXPECT_TRUE(GetDownloadToolbarButton()->IsShowingDetails()); } IN_PROC_BROWSER_TEST_F( @@ -4816,18 +4841,18 @@ DownloadManager::DownloadVector items; CreateTwoDownloads(&items); ScopedItemVectorCanceller delete_items(&items); - EXPECT_FALSE(IsDownloadToolbarButtonShowing()); + EXPECT_FALSE(GetDownloadToolbarButton()->IsShowing()); GoOffTheRecord(); - EXPECT_FALSE(IsDownloadToolbarButtonShowing()); + EXPECT_FALSE(GetDownloadToolbarButton()->IsShowing()); EXPECT_TRUE(RunFunction(new DownloadsSetUiOptionsFunction(), R"([{"enabled": true}])")); items[0]->Cancel(true); - EXPECT_TRUE(IsDownloadToolbarButtonShowing()); + EXPECT_TRUE(GetDownloadToolbarButton()->IsShowing()); GoOnTheRecord(); - EXPECT_TRUE(IsDownloadToolbarButtonShowing()); + EXPECT_TRUE(GetDownloadToolbarButton()->IsShowing()); } IN_PROC_BROWSER_TEST_F( @@ -4839,7 +4864,7 @@ DownloadManager::DownloadVector items; CreateTwoDownloads(&items); ScopedItemVectorCanceller delete_items(&items); - EXPECT_FALSE(IsDownloadToolbarButtonShowing()); + EXPECT_FALSE(GetDownloadToolbarButton()->IsShowing()); LoadSecondExtension("downloads_spanning"); // Returns error because the first extension has disabled the UI. @@ -4855,11 +4880,11 @@ DisableExtension(GetExtensionId()); items[0]->Pause(); // The UI keeps disabled because the second extension has set it to disabled. - EXPECT_FALSE(IsDownloadToolbarButtonShowing()); + EXPECT_FALSE(GetDownloadToolbarButton()->IsShowing()); DisableExtension(GetSecondExtensionId()); items[0]->Cancel(true); - EXPECT_TRUE(IsDownloadToolbarButtonShowing()); + EXPECT_TRUE(GetDownloadToolbarButton()->IsShowing()); } #endif // !BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc b/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc index 2fe215d..5d11cff 100644 --- a/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc +++ b/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc
@@ -243,17 +243,20 @@ } void SetupTestCACerts() { - net::TestRootCerts* root_certs = net::TestRootCerts::GetInstance(); // "root.pem" is the issuer of the "l1_leaf.pem" and (transitively) // "l1_leaf.pem" certs which are loaded on the JS side. Generated by // create_test_certs.sh . - root_certs->AddFromFile(extension_path().AppendASCII("root.pem")); + scoped_refptr<net::X509Certificate> root = + net::ImportCertFromFile(extension_path().AppendASCII("root.pem")); + ASSERT_TRUE(root); + scoped_test_root_.Reset({root}); } const bool key_permission_policy_; const UserClientCertSlot user_client_cert_slot_; crypto::ScopedTestNSSDB user_private_slot_db_; const ContextType context_type_; + net::ScopedTestRoot scoped_test_root_; }; class TestSelectDelegate
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 4ae2e3f..e54012eec 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -132,8 +132,8 @@ }, { "name": "allow-repeated-updates", - "owners": [ "vyshu", "chromeos-core-services@google.com" ], - "expiry_milestone": 92 + "owners": [ "kimjae", "chromeos-core-services@google.com" ], + "expiry_milestone": 112 }, { "name": "allow-scroll-settings", @@ -659,6 +659,11 @@ "expiry_milestone": 110 }, { + "name": "bluetooth-coredump", + "owners": ["mmandlik", "chromeos-bt-team@google.com"], + "expiry_milestone": 111 + }, + { "name": "bluetooth-fix-a2dp-packet-size", "owners": [ "michaelfsun", "chromeos-bluetooth@google.com" ], "expiry_milestone": 86 @@ -1075,11 +1080,6 @@ "expiry_milestone": 107 }, { - "name": "credential-provider-extension-promo", - "owners": ["ginnyhuang","bling-flags@google.com"], - "expiry_milestone": 100 - }, - { "name": "cros-labs-float-window", "owners": [ "shidi", "afakhry" ], "expiry_milestone": 110 @@ -2096,11 +2096,6 @@ "expiry_milestone": 101 }, { - "name": "enable-discover-feed-shorter-cache", - "owners": [ "edchin", "adamta", "sczs" ], - "expiry_milestone": 106 - }, - { "name": "enable-discover-feed-static-resource-serving", "owners": [ "adamta", "sczs" ], "expiry_milestone": 106 @@ -2744,7 +2739,7 @@ { "name": "enable-reader-mode", "owners": [ "katie", "//ui/accessibility/OWNERS" ], - "expiry_milestone": 104 + "expiry_milestone": 112 }, { "name": "enable-reader-mode-in-cct", @@ -2819,11 +2814,6 @@ "expiry_milestone": 115 }, { - "name": "enable-shortened-password-auto-fill-instruction", - "owners": ["ginnyhuang","bling-flags@google.com"], - "expiry_milestone": 101 - }, - { "name": "enable-show-autofill-signatures", "owners": [ "kolos" ], // Used for debugging and QA by the autofill team for the indefinite future. @@ -5005,7 +4995,7 @@ // TODO(b/172341945): Fix this asap. "name": "overscroll-history-navigation", "owners": [ "mohsen", "jinsukkim" ], - "expiry_milestone": 105 + "expiry_milestone": 118 }, { // Suggests the Ozone platform to use (desktop Linux only). Can be set on
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 2381b58..2e8460d 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -4600,6 +4600,12 @@ "or fully launched. Only on the few models that Bluetooth WBS is " "still stablizing this flag will take effect."; +const char kBluetoothCoredumpName[] = "Enable Bluetooth Device Coredump"; +const char kBluetoothCoredumpDescription[] = + "Enable Bluetooth coredump collection if supported. Please note that " + "coredumps are only collected when hardware exceptions occur and are " + "used for debugging such exceptions."; + const char kBluetoothUseFlossName[] = "Use Floss instead of BlueZ"; const char kBluetoothUseFlossDescription[] = "Enables using Floss (also known as Fluoride, Android's Bluetooth stack) "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 0b25f85f..6e6a6b0 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -2633,6 +2633,9 @@ extern const char kBluetoothWbsDogfoodName[]; extern const char kBluetoothWbsDogfoodDescription[]; +extern const char kBluetoothCoredumpName[]; +extern const char kBluetoothCoredumpDescription[]; + extern const char kBluetoothUseFlossName[]; extern const char kBluetoothUseFlossDescription[];
diff --git a/chrome/browser/lookalikes/lookalike_url_navigation_throttle_browsertest.cc b/chrome/browser/lookalikes/lookalike_url_navigation_throttle_browsertest.cc index cd20146..73ff7eb06 100644 --- a/chrome/browser/lookalikes/lookalike_url_navigation_throttle_browsertest.cc +++ b/chrome/browser/lookalikes/lookalike_url_navigation_throttle_browsertest.cc
@@ -49,6 +49,7 @@ #include "content/public/test/test_navigation_observer.h" #include "content/public/test/url_loader_interceptor.h" #include "net/cert/mock_cert_verifier.h" +#include "net/cert/test_root_certs.h" #include "net/dns/mock_host_resolver.h" #include "net/test/cert_test_util.h" #include "net/test/embedded_test_server/http_request.h" @@ -1620,7 +1621,7 @@ : public LookalikeUrlNavigationThrottleBrowserTest { public: LookalikeUrlNavigationThrottleSignedExchangeBrowserTest() { - net::EmbeddedTestServer::RegisterTestCerts(); + scoped_test_root_ = net::EmbeddedTestServer::RegisterTestCerts(); } void SetUpCommandLine(base::CommandLine* command_line) override { @@ -1705,6 +1706,7 @@ it->second; } + net::ScopedTestRoot scoped_test_root_; std::map<GURL, std::string> url_accept_header_map_; };
diff --git a/chrome/browser/preloading/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc b/chrome/browser/preloading/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc index 50bece8..c321d09 100644 --- a/chrome/browser/preloading/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc +++ b/chrome/browser/preloading/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc
@@ -2607,7 +2607,7 @@ { mojo::ScopedAllowSyncCallForTesting allow_sync_call; GetNormalNetworkContext()->AddDomainReliabilityContextForTesting( - https_report_server.GetURL("a.test", "/").DeprecatedGetOriginAsURL(), + https_report_server.GetOrigin("a.test"), https_report_server.GetURL("a.test", "/domainreliabilty-upload")); }
diff --git a/chrome/browser/preloading/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.cc b/chrome/browser/preloading/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.cc index 4497233..193cfd3b 100644 --- a/chrome/browser/preloading/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.cc +++ b/chrome/browser/preloading/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.cc
@@ -32,7 +32,7 @@ } void PrefetchProxyNetworkContextClient::OnCanSendDomainReliabilityUpload( - const GURL& origin, + const url::Origin& origin, OnCanSendDomainReliabilityUploadCallback callback) { std::move(callback).Run(false); }
diff --git a/chrome/browser/preloading/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.h b/chrome/browser/preloading/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.h index a9582aa..5165fde18 100644 --- a/chrome/browser/preloading/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.h +++ b/chrome/browser/preloading/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.h
@@ -29,7 +29,7 @@ const std::vector<url::Origin>& origins, OnCanSendReportingReportsCallback callback) override; void OnCanSendDomainReliabilityUpload( - const GURL& origin, + const url::Origin& origin, OnCanSendDomainReliabilityUploadCallback callback) override; #if BUILDFLAG(IS_ANDROID) void OnGenerateHttpNegotiateAuthToken(
diff --git a/chrome/browser/resources/access_code_cast/access_code_cast.ts b/chrome/browser/resources/access_code_cast/access_code_cast.ts index 421cb18..8f91b7a 100644 --- a/chrome/browser/resources/access_code_cast/access_code_cast.ts +++ b/chrome/browser/resources/access_code_cast/access_code_cast.ts
@@ -5,13 +5,13 @@ import './passcode_input/passcode_input.js'; import './error_message/error_message.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {isWindows} from 'chrome://resources/js/cr.m.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
diff --git a/chrome/browser/resources/app_settings/app.ts b/chrome/browser/resources/app_settings/app.ts index 8b3d4ad..13c2354b 100644 --- a/chrome/browser/resources/app_settings/app.ts +++ b/chrome/browser/resources/app_settings/app.ts
@@ -3,7 +3,7 @@ // found in the LICENSE file. import './strings.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_toolbar/cr_toolbar.js'; import 'chrome://resources/cr_components/app_management/app_management_shared_style.css.js'; import 'chrome://resources/cr_components/app_management/file_handling_item.js';
diff --git a/chrome/browser/resources/bookmarks/command_manager.ts b/chrome/browser/resources/bookmarks/command_manager.ts index 58899c9..cc0e3e4e 100644 --- a/chrome/browser/resources/bookmarks/command_manager.ts +++ b/chrome/browser/resources/bookmarks/command_manager.ts
@@ -7,7 +7,7 @@ * shortcuts. */ import 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; @@ -18,7 +18,7 @@ import './edit_dialog.js'; import {CrActionMenuElement} from 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrLazyRenderElement} from 'chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.js'; import {getToastManager} from 'chrome://resources/cr_elements/cr_toast/cr_toast_manager.js'; import {assert, assertNotReached} from 'chrome://resources/js/assert_ts.js';
diff --git a/chrome/browser/resources/bookmarks/dialog_focus_manager.ts b/chrome/browser/resources/bookmarks/dialog_focus_manager.ts index 89f64dc..0b1b22a 100644 --- a/chrome/browser/resources/bookmarks/dialog_focus_manager.ts +++ b/chrome/browser/resources/bookmarks/dialog_focus_manager.ts
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; /**
diff --git a/chrome/browser/resources/bookmarks/edit_dialog.ts b/chrome/browser/resources/bookmarks/edit_dialog.ts index a790354..4bb6048f 100644 --- a/chrome/browser/resources/bookmarks/edit_dialog.ts +++ b/chrome/browser/resources/bookmarks/edit_dialog.ts
@@ -3,12 +3,12 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import './strings.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/accessibility_common/background.html b/chrome/browser/resources/chromeos/accessibility/accessibility_common/background.html index a7f2d9ba..8bad794 100644 --- a/chrome/browser/resources/chromeos/accessibility/accessibility_common/background.html +++ b/chrome/browser/resources/chromeos/accessibility/accessibility_common/background.html
@@ -3,7 +3,6 @@ <script src="/common/closure_shim.js"></script> <script src="/common/event_handler.js"></script> <script src="/common/constants.js"></script> -<script src="/common/automation_predicate.js"></script> <!-- Module entry point. --> <script type="module" src="accessibility_common_loader.js"></script>
diff --git a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/focus_handler.js b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/focus_handler.js index 3669fa2ec..8c457b1 100644 --- a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/focus_handler.js +++ b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/focus_handler.js
@@ -6,6 +6,7 @@ const AutomationEvent = chrome.automation.AutomationEvent; const EventType = chrome.automation.EventType; +import {AutomationPredicate} from '../../common/automation_predicate.js'; export class FocusHandler { constructor() { /** @private {boolean} */
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/BUILD.gn b/chrome/browser/resources/chromeos/accessibility/chromevox/BUILD.gn index 16032ed5..1346668 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/BUILD.gn +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/BUILD.gn
@@ -19,13 +19,10 @@ # # These files all use older Closure provide/require support for dependency management and will be transitioned to ES6 modules (see below). chromevox_modules = [ - "../common/automation_predicate.js", "../common/constants.js", "background/braille/cursor_dots.js", "background/braille/pan_strategy.js", - "common/abstract_earcons.js", "common/extension_bridge.js", - "common/panel_menu_data.js", "injected/api_implementation.js", "injected/extension_bridge.js", "injected/loader.js", @@ -36,6 +33,7 @@ # ES6 modules. chromevox_es6_modules = [ + "../common/automation_predicate.js", "../common/automation_util.js", "../common/cursors/cursor.js", "../common/cursors/range.js", @@ -112,6 +110,7 @@ "background/smart_sticky_mode.js", "background/tts_background.js", "background/user_action_monitor.js", + "common/abstract_earcons.js", "common/abstract_tts.js", "common/background_bridge.js", "common/braille/braille_command_data.js", @@ -136,6 +135,7 @@ "common/msgs.js", "common/panel_bridge.js", "common/panel_command.js", + "common/panel_menu_data.js", "common/spannable.js", "common/tree_dumper.js", "common/tts_base.js", @@ -399,7 +399,6 @@ "background/braille/liblouis.js", "background/editing/editable_text_base.js", "background/phonetic_data.js", - "common/abstract_earcons.js", "common/key_sequence.js", "common/msgs.js", "common/spannable.js",
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/auto_scroll_handler.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/auto_scroll_handler.js index 7637b20e..7e86c47b 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/auto_scroll_handler.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/auto_scroll_handler.js
@@ -5,6 +5,7 @@ /** * @fileoverview Handles auto scrolling on navigation. */ +import {AutomationPredicate} from '../../common/automation_predicate.js'; import {AutomationUtil} from '../../common/automation_util.js'; import {CursorUnit} from '../../common/cursors/cursor.js'; import {CursorRange} from '../../common/cursors/range.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background.js index 791ba86e..399c8d5 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background.js
@@ -2,9 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {AutomationPredicate} from '../../common/automation_predicate.js'; import {AutomationUtil} from '../../common/automation_util.js'; import {CursorRange} from '../../common/cursors/range.js'; import {InstanceChecker} from '../../common/instance_checker.js'; +import {AbstractEarcons} from '../common/abstract_earcons.js'; import {ExtensionBridge} from '../common/extension_bridge.js'; import {LocaleOutputHelper} from '../common/locale_output_helper.js'; import {Msgs} from '../common/msgs.js';
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 32c57c5e..1e123ef9 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js
@@ -60,6 +60,8 @@ '/chromevox/common/braille/braille_key_types.js'); await importModule('KeyCode', '/common/key_code.js'); await importModule('QueueMode', '/chromevox/common/tts_interface.js'); + await importModule( + 'AutomationPredicate', '/common/automation_predicate.js'); window.doGesture = this.doGesture; window.simulateHitTestResult = this.simulateHitTestResult;
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/braille/braille_command_handler.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/braille/braille_command_handler.js index 53c8ce1..b8a75c7f 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/braille/braille_command_handler.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/braille/braille_command_handler.js
@@ -5,6 +5,7 @@ /** * @fileoverview ChromeVox braille commands. */ +import {AutomationPredicate} from '../../../common/automation_predicate.js'; import {EventGenerator} from '../../../common/event_generator.js'; import {KeyCode} from '../../../common/key_code.js'; import {BrailleCommandData} from '../../common/braille/braille_command_data.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/chromevox.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/chromevox.js index 7483a30..f232e941 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/chromevox.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/chromevox.js
@@ -6,6 +6,7 @@ * @fileoverview Defines a global object. */ +import {AbstractEarcons} from '../common/abstract_earcons.js'; import {BrailleInterface} from '../common/braille/braille_interface.js'; import {TtsInterface} from '../common/tts_interface.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/classic_background.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/classic_background.js index 78c97e3e..2ba507aa 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/classic_background.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/classic_background.js
@@ -5,6 +5,7 @@ /** * @fileoverview Script that runs on the background page. */ +import {AbstractEarcons} from '../common/abstract_earcons.js'; import {AbstractTts} from '../common/abstract_tts.js'; import {NavBraille} from '../common/braille/nav_braille.js'; import {BridgeConstants} from '../common/bridge_constants.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/command_handler.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/command_handler.js index a09aa36b..89b5238 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/command_handler.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/command_handler.js
@@ -5,11 +5,13 @@ /** * @fileoverview ChromeVox commands. */ +import {AutomationPredicate} from '../../common/automation_predicate.js'; import {AutomationUtil} from '../../common/automation_util.js'; import {Cursor, CursorUnit} from '../../common/cursors/cursor.js'; import {CursorRange} from '../../common/cursors/range.js'; import {EventGenerator} from '../../common/event_generator.js'; import {KeyCode} from '../../common/key_code.js'; +import {Earcon} from '../common/abstract_earcons.js'; import {AbstractTts} from '../common/abstract_tts.js'; import {NavBraille} from '../common/braille/nav_braille.js'; import {BridgeConstants} from '../common/bridge_constants.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/desktop_automation_handler.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/desktop_automation_handler.js index bf97270..9a7bd73 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/desktop_automation_handler.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/desktop_automation_handler.js
@@ -5,6 +5,7 @@ /** * @fileoverview Handles automation from a desktop automation node. */ +import {AutomationPredicate} from '../../common/automation_predicate.js'; import {AutomationUtil} from '../../common/automation_util.js'; import {WrappingCursor} from '../../common/cursors/cursor.js'; import {CursorRange} from '../../common/cursors/range.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/earcon_engine.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/earcon_engine.js index f4db5a9..1d421a48 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/earcon_engine.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/earcon_engine.js
@@ -8,6 +8,8 @@ * rest of the code. */ +import {Earcon} from '../common/abstract_earcons.js'; + /** * EarconEngine generates ChromeVox's earcons using the web audio API. */
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/earcons.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/earcons.js index 72a7f29b..68eff74f 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/earcons.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/earcons.js
@@ -7,6 +7,7 @@ * auditory cues. */ +import {AbstractEarcons, Earcon} from '../common/abstract_earcons.js'; import {LogType} from '../common/log_types.js'; import {ChromeVoxState} from './chromevox_state.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editable_line.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editable_line.js index e7c0e8a..32b07f6 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editable_line.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editable_line.js
@@ -8,6 +8,7 @@ * (e.g. start/end offsets) get saved. Line: nodes/offsets at the beginning/end * of a line get saved. */ +import {AutomationPredicate} from '../../../common/automation_predicate.js'; import {AutomationUtil} from '../../../common/automation_util.js'; import {Cursor, CURSOR_NODE_INDEX, CursorMovement, CursorUnit} from '../../../common/cursors/cursor.js'; import {CursorRange} from '../../../common/cursors/range.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing.js index 3a93c30..6709406 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing.js
@@ -6,6 +6,7 @@ * @fileoverview Processes events related to editing text and emits the * appropriate spoken and braille feedback. */ +import {AutomationPredicate} from '../../../common/automation_predicate.js'; import {AutomationUtil} from '../../../common/automation_util.js'; import {Cursor, CursorMovement, CursorUnit} from '../../../common/cursors/cursor.js'; import {CursorRange} from '../../../common/cursors/range.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/intent_handler.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/intent_handler.js index 5510ff25..1ca91c5 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/intent_handler.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/intent_handler.js
@@ -6,6 +6,7 @@ * @fileoverview Handles automation intents for speech feedback. * Braille is *not* handled in this module. */ +import {AutomationPredicate} from '../../../common/automation_predicate.js'; import {AutomationUtil} from '../../../common/automation_util.js'; import {CursorRange} from '../../../common/cursors/range.js'; import {Output} from '../output/output.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/gesture_command_handler.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/gesture_command_handler.js index 7411ca7..a77e2d4f 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/gesture_command_handler.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/gesture_command_handler.js
@@ -5,6 +5,7 @@ /** * @fileoverview Handles gesture-based commands. */ +import {AutomationPredicate} from '../../common/automation_predicate.js'; import {EventGenerator} from '../../common/event_generator.js'; import {BridgeConstants} from '../common/bridge_constants.js'; import {BridgeHelper} from '../common/bridge_helper.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/loader.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/loader.js index 91b2bee..7648f0a 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/loader.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/loader.js
@@ -5,14 +5,7 @@ /** * @fileoverview Loader for the background page. */ - -goog.require('AbstractEarcons'); -goog.require('AutomationPredicate'); goog.require('JaPhoneticData'); -goog.require('PanelNodeMenuData'); -goog.require('PanelTabMenuItemData'); goog.require('constants'); goog.require('goog.i18n.MessageFormat'); - -goog.require('ALL_NODE_MENU_DATA');
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/math_handler.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/math_handler.js index b2dcc1f..4a4fc22 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/math_handler.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/math_handler.js
@@ -5,6 +5,7 @@ /** * @fileoverview Handles math output and exploration. */ +import {AutomationPredicate} from '../../common/automation_predicate.js'; import {CursorRange} from '../../common/cursors/range.js'; import {Msgs} from '../common/msgs.js'; import {QueueMode} from '../common/tts_interface.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output.js index cbd2fad..13241f6b 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output.js
@@ -5,6 +5,7 @@ /** * @fileoverview Provides output services for ChromeVox. */ +import {AutomationPredicate} from '../../../common/automation_predicate.js'; import {AutomationUtil} from '../../../common/automation_util.js'; import {Cursor, CURSOR_NODE_INDEX} from '../../../common/cursors/cursor.js'; import {CursorRange} from '../../../common/cursors/range.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output_ancestry_info.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output_ancestry_info.js index 1a3a9b3..ab10941 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output_ancestry_info.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output_ancestry_info.js
@@ -6,6 +6,7 @@ * @fileoverview Provides a class which computes various types of ancestor * chains given the current node. */ +import {AutomationPredicate} from '../../../common/automation_predicate.js'; import {AutomationUtil} from '../../../common/automation_util.js'; import {OutputRoleInfo} from './output_role_info.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output_test.js index 037643e0..aa39596 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output_test.js
@@ -111,6 +111,8 @@ await importModule('Msgs', '/chromevox/common/msgs.js'); await importModule('AutomationUtil', '/common/automation_util.js'); await importModule('TtsCategory', '/chromevox/common/tts_interface.js'); + await importModule( + 'AutomationPredicate', '/common/automation_predicate.js'); window.Dir = AutomationUtil.Dir; this.forceContextualLastOutput();
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output_types.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output_types.js index 5321c25e6..1fe7924 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output_types.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output_types.js
@@ -6,6 +6,7 @@ * @fileoverview Definitions of all types related to output. */ +import {Earcon} from '../../common/abstract_earcons.js'; import {ChromeVox} from '../chromevox.js'; /**
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/page_load_sound_handler.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/page_load_sound_handler.js index ea5a6b2..93d0179 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/page_load_sound_handler.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/page_load_sound_handler.js
@@ -6,6 +6,7 @@ * @fileoverview Handles page loading sounds based on automation events. */ import {AutomationUtil} from '../../common/automation_util.js'; +import {Earcon} from '../common/abstract_earcons.js'; import {ChromeVoxEvent} from '../common/custom_automation_event.js'; import {BaseAutomationHandler} from './base_automation_handler.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/i_search.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/i_search.js index ce3d9894..14f0042 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/i_search.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/i_search.js
@@ -5,6 +5,7 @@ /** * @fileoverview The logic behind incremental search. */ +import {AutomationPredicate} from '../../../common/automation_predicate.js'; import {AutomationUtil} from '../../../common/automation_util.js'; import {Cursor} from '../../../common/cursors/cursor.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_background.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_background.js index 4ff56d5..c9f96129f 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_background.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_background.js
@@ -7,9 +7,11 @@ * the background context. */ import {CursorRange} from '../../../common/cursors/range.js'; +import {Earcon} from '../../common/abstract_earcons.js'; import {BridgeConstants} from '../../common/bridge_constants.js'; import {BridgeHelper} from '../../common/bridge_helper.js'; import {PanelBridge} from '../../common/panel_bridge.js'; +import {ALL_PANEL_MENU_NODE_DATA} from '../../common/panel_menu_data.js'; import {QueueMode} from '../../common/tts_interface.js'; import {ChromeVox} from '../chromevox.js'; import {ChromeVoxState, ChromeVoxStateObserver} from '../chromevox_state.js'; @@ -109,7 +111,7 @@ if (!this.savedNode_) { return; } - for (const data of ALL_NODE_MENU_DATA) { + for (const data of ALL_PANEL_MENU_NODE_DATA) { const isActivatedMenu = opt_activateMenuTitleId === data.titleId; const menuBackground = new PanelNodeMenuBackground(data, this.savedNode_, isActivatedMenu);
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_node_menu_background.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_node_menu_background.js index 7b37601..a3f46ae 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_node_menu_background.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_node_menu_background.js
@@ -6,11 +6,13 @@ * @fileoverview Calculates the menu items for the node menus in the ChromeVox * panel. */ +import {AutomationPredicate} from '../../../common/automation_predicate.js'; import {AutomationUtil} from '../../../common/automation_util.js'; import {CursorRange} from '../../../common/cursors/range.js'; import {AutomationTreeWalker} from '../../../common/tree_walker.js'; import {Msgs} from '../../common/msgs.js'; import {PanelBridge} from '../../common/panel_bridge.js'; +import {PanelNodeMenuData, PanelNodeMenuId, PanelNodeMenuItemData} from '../../common/panel_menu_data.js'; import {ChromeVoxState} from '../chromevox_state.js'; import {Output} from '../output/output.js'; import {OutputEventType} from '../output/output_types.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_node_menu_background_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_node_menu_background_test.js index 17945a3a..51331065 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_node_menu_background_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_node_menu_background_test.js
@@ -28,6 +28,9 @@ await importModule( 'PanelNodeMenuBackground', '/chromevox/background/panel/panel_node_menu_background.js'); + await importModule( + ['PanelNodeMenuId', 'ALL_PANEL_MENU_NODE_DATA'], + '/chromevox/common/panel_menu_data.js'); } assertMenuItemIndicatesNoNodesFound(item) { @@ -53,7 +56,7 @@ } assertMenusHaveNoNodesFoundExcept(id) { - for (const menu of ALL_NODE_MENU_DATA) { + for (const menu of ALL_PANEL_MENU_NODE_DATA) { if (menu.menuId === id) { continue; } @@ -162,7 +165,7 @@ // Expect that one element is added per menu, specifying that no nodes // of that type are found. - assertEquals(ALL_NODE_MENU_DATA.length, PanelBridge.calls.length); + assertEquals(ALL_PANEL_MENU_NODE_DATA.length, PanelBridge.calls.length); // Assert all menus have a no nodes found element. this.assertMenusHaveNoNodesFoundExcept(null); }); @@ -174,7 +177,8 @@ // Check that there are the correct number of calls (one for each menu, // plus two extra for the additional headings found, plus six for the // additional system elements). - assertEquals(ALL_NODE_MENU_DATA.length + 2 + 6, PanelBridge.calls.length); + assertEquals( + ALL_PANEL_MENU_NODE_DATA.length + 2 + 6, PanelBridge.calls.length); // Expect that the three items are added to the headings menu const headingItems = PanelBridge.calls.filter(this.isHeading); @@ -194,7 +198,8 @@ // Check that there are the correct number of calls (one for each menu, // plus seven extra for the additional landmarks found). - assertEquals(ALL_NODE_MENU_DATA.length + 7, PanelBridge.calls.length); + assertEquals( + ALL_PANEL_MENU_NODE_DATA.length + 7, PanelBridge.calls.length); // Verify that eight items were added to the landmarks menu. const landmarkItems = PanelBridge.calls.filter(this.isLandmark); @@ -218,7 +223,7 @@ // Check that there are the correct number of calls (one for each menu, plus // three extra for the additional links found). - assertEquals(ALL_NODE_MENU_DATA.length + 3, PanelBridge.calls.length); + assertEquals(ALL_PANEL_MENU_NODE_DATA.length + 3, PanelBridge.calls.length); // Verify that four items were added to the links menu. const linkItems = PanelBridge.calls.filter(this.isLink); @@ -240,7 +245,8 @@ // Check that there are the correct number of calls (one for each menu, // plus five extra for the additional form controls found, plus seven for // the system elements). - assertEquals(ALL_NODE_MENU_DATA.length + 5 + 7, PanelBridge.calls.length); + assertEquals( + ALL_PANEL_MENU_NODE_DATA.length + 5 + 7, PanelBridge.calls.length); // Verify that all of the items were added to the form controls menu. const formItems = PanelBridge.calls.filter(this.isFormControl); @@ -262,7 +268,7 @@ // Check that there are the correct number of calls (one for each menu, // plus one extra for the additional links found). - assertEquals(ALL_NODE_MENU_DATA.length + 1, PanelBridge.calls.length); + assertEquals(ALL_PANEL_MENU_NODE_DATA.length + 1, PanelBridge.calls.length); // Verify that two items were added to the tables menu. const tableItems = PanelBridge.calls.filter(this.isTable); @@ -280,7 +286,7 @@ this.createAllNodeMenuBackgrounds(); // Check that there are the correct number of calls (one for each menu). - assertEquals(ALL_NODE_MENU_DATA.length, PanelBridge.calls.length); + assertEquals(ALL_PANEL_MENU_NODE_DATA.length, PanelBridge.calls.length); // Check that each item was added to the correct menu. const formItem = PanelBridge.calls.find(this.isFormControl);
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_tab_menu_background.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_tab_menu_background.js index 0620f11b..f4fe9a3 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_tab_menu_background.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/panel/panel_tab_menu_background.js
@@ -8,6 +8,7 @@ */ import {Msgs} from '../../common/msgs.js'; +import {PanelTabMenuItemData} from '../../common/panel_menu_data.js'; export class PanelTabMenuBackground { /**
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/pointer_handler.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/pointer_handler.js index 030710b..a8f985c 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/pointer_handler.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/pointer_handler.js
@@ -6,7 +6,9 @@ * @fileoverview ChromeVox pointer handler. A pointer, in this context, is * either user touch or mouse input. */ +import {AutomationPredicate} from '../../common/automation_predicate.js'; import {EventGenerator} from '../../common/event_generator.js'; +import {Earcon} from '../common/abstract_earcons.js'; import {CustomAutomationEvent} from '../common/custom_automation_event.js'; import {QueueMode} from '../common/tts_interface.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/range_automation_handler.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/range_automation_handler.js index 022ced15..344aa28 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/range_automation_handler.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/range_automation_handler.js
@@ -5,6 +5,7 @@ /** * @fileoverview Handles automation from ChromeVox's current range. */ +import {AutomationPredicate} from '../../common/automation_predicate.js'; import {AutomationUtil} from '../../common/automation_util.js'; import {CursorRange} from '../../common/cursors/range.js'; import {ChromeVoxEvent, CustomAutomationEvent} from '../common/custom_automation_event.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/smart_sticky_mode.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/smart_sticky_mode.js index a6bbee2..fb9bf36 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/smart_sticky_mode.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/smart_sticky_mode.js
@@ -9,6 +9,7 @@ */ import {AutomationUtil} from '../../common/automation_util.js'; import {CursorRange} from '../../common/cursors/range.js'; +import {Earcon} from '../common/abstract_earcons.js'; import {ChromeVox} from './chromevox.js'; import {ChromeVoxState, ChromeVoxStateObserver} from './chromevox_state.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/common/abstract_earcons.js b/chrome/browser/resources/chromeos/accessibility/chromevox/common/abstract_earcons.js index 3d40883..cec4d3f 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/common/abstract_earcons.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/common/abstract_earcons.js
@@ -9,16 +9,11 @@ * */ -goog.provide('AbstractEarcons'); -goog.provide('Earcon'); -goog.provide('EarconDescription'); - - /** * Earcon names. * @enum {string} */ -Earcon = { +export const Earcon = { ALERT_MODAL: 'alert_modal', ALERT_NONMODAL: 'alert_nonmodal', BUTTON: 'button', @@ -59,7 +54,7 @@ * used to generate tutorial content. * @type {Object<string, string>} */ -const EarconDescription = { +export const EarconDescription = { alert_modal: 'alert_modal_earcon_description', alert_nonmodal: 'alert_nonmodal_earcon_description', button: 'button_earcon_description', @@ -76,7 +71,7 @@ }; -AbstractEarcons = class { +export class AbstractEarcons { constructor() {} /** @@ -116,4 +111,4 @@ set enabled(value) { localStorage['earcons'] = value; } -}; +}
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/common/background_bridge.js b/chrome/browser/resources/chromeos/accessibility/chromevox/common/background_bridge.js index f43a5f6..e6612b7 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/common/background_bridge.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/common/background_bridge.js
@@ -9,7 +9,8 @@ import {BridgeConstants} from './bridge_constants.js'; import {BridgeHelper} from './bridge_helper.js'; -import {SerializableLog} from './log_types.js'; +import {BaseLog, SerializableLog} from './log_types.js'; +import {PanelTabMenuItemData} from './panel_menu_data.js'; export const BackgroundBridge = {};
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/common/panel_bridge.js b/chrome/browser/resources/chromeos/accessibility/chromevox/common/panel_bridge.js index 40d6ded..5bbc2b4b 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/common/panel_bridge.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/common/panel_bridge.js
@@ -9,6 +9,7 @@ import {BridgeConstants} from './bridge_constants.js'; import {BridgeHelper} from './bridge_helper.js'; +import {PanelNodeMenuItemData} from './panel_menu_data.js'; export class PanelBridge { /**
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/common/panel_menu_data.js b/chrome/browser/resources/chromeos/accessibility/chromevox/common/panel_menu_data.js index 47488d7..569d800 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/common/panel_menu_data.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/common/panel_menu_data.js
@@ -7,16 +7,10 @@ * the background context to the panel context. */ -goog.provide('PanelNodeMenuData'); -goog.provide('PanelNodeMenuId'); -goog.provide('PanelNodeMenuItemData'); -goog.provide('PanelTabMenuItemData'); -goog.provide('ALL_NODE_MENU_DATA'); - -goog.require('AutomationPredicate'); +import {AutomationPredicate} from '../../common/automation_predicate.js'; /** @enum {number} */ -PanelNodeMenuId = { +export const PanelNodeMenuId = { HEADING: 1, LANDMARK: 2, LINK: 3, @@ -31,7 +25,7 @@ * predicate: !AutomationPredicate.Unary * }} */ -let PanelNodeMenuData; +export let PanelNodeMenuData; /** * @typedef {{ @@ -41,12 +35,12 @@ * menuId: !PanelNodeMenuId * }} */ -let PanelNodeMenuItemData; +export let PanelNodeMenuItemData; /** @typedef {{title: string, windowId: number, tabId: number}} */ -PanelTabMenuItemData; +export let PanelTabMenuItemData; -ALL_NODE_MENU_DATA = [ +export const ALL_PANEL_MENU_NODE_DATA = [ { menuId: PanelNodeMenuId.HEADING, titleId: 'role_heading',
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/learn_mode/kbexplorer_loader.js b/chrome/browser/resources/chromeos/accessibility/chromevox/learn_mode/kbexplorer_loader.js index 0d35e3d..ae476ab 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/learn_mode/kbexplorer_loader.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/learn_mode/kbexplorer_loader.js
@@ -5,7 +5,4 @@ /** * @fileoverview Description of this file. */ - -goog.require('AbstractEarcons'); - goog.require('constants');
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/options/options_loader.js b/chrome/browser/resources/chromeos/accessibility/chromevox/options/options_loader.js index a4a9f6b..ed19e694 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/options/options_loader.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/options/options_loader.js
@@ -6,7 +6,6 @@ * @fileoverview Loads the options script. */ -goog.require('AbstractEarcons'); goog.require('BluetoothBrailleDisplayListener'); goog.require('BluetoothBrailleDisplayManager');
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel.js b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel.js index 762459d..fa349ea 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel.js
@@ -19,6 +19,7 @@ import {LocaleOutputHelper} from '../common/locale_output_helper.js'; import {Msgs} from '../common/msgs.js'; import {PanelCommand, PanelCommandType} from '../common/panel_command.js'; +import {ALL_PANEL_MENU_NODE_DATA, PanelNodeMenuData, PanelNodeMenuId, PanelNodeMenuItemData} from '../common/panel_menu_data.js'; import {QueueMode} from '../common/tts_interface.js'; import {ISearchUI} from './i_search_ui.js'; @@ -494,7 +495,7 @@ Panel.onClose(); }); - for (const menuData of ALL_NODE_MENU_DATA) { + for (const menuData of ALL_PANEL_MENU_NODE_DATA) { Panel.addNodeMenu(menuData); } await BackgroundBridge.PanelBackground.createAllNodeMenuBackgrounds(
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_loader.js b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_loader.js index 217d17f..d20fc23 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_loader.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_loader.js
@@ -6,12 +6,5 @@ * @fileoverview Loads the panel script. */ -goog.require('AutomationPredicate'); -goog.require('EarconDescription'); -goog.require('PanelNodeMenuData'); -goog.require('PanelNodeMenuItemData'); - goog.require('constants'); goog.require('goog.i18n.MessageFormat'); - -goog.require('ALL_NODE_MENU_DATA');
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_menu.js b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_menu.js index 5d592d2..edc2e408 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_menu.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_menu.js
@@ -7,6 +7,7 @@ */ import {BackgroundBridge} from '../common/background_bridge.js'; import {Msgs} from '../common/msgs.js'; +import {PanelNodeMenuItemData} from '../common/panel_menu_data.js'; import {PanelMenuItem} from './panel_menu_item.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/testing/chromevox_e2e_test_base.js b/chrome/browser/resources/chromeos/accessibility/chromevox/testing/chromevox_e2e_test_base.js index f5a1ac2e..e4e6b262 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/testing/chromevox_e2e_test_base.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/testing/chromevox_e2e_test_base.js
@@ -52,6 +52,8 @@ 'NavBraille', '/chromevox/common/braille/nav_braille.js'); await importModule( ['QueueMode', 'TtsInterface'], '/chromevox/common/tts_interface.js'); + await importModule( + ['AbstractEarcons', 'Earcon'], '/chromevox/common/abstract_earcons.js'); } };
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/testing/mock_feedback_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/testing/mock_feedback_test.js index 02f165a..d97a98a0 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/testing/mock_feedback_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/testing/mock_feedback_test.js
@@ -37,6 +37,8 @@ await importModule('Spannable', '/chromevox/common/spannable.js'); await importModule( ['QueueMode', 'TtsInterface'], '/chromevox/common/tts_interface.js'); + await importModule( + ['AbstractEarcons', 'Earcon'], '/chromevox/common/abstract_earcons.js'); } /** @override */ @@ -49,7 +51,6 @@ MockFeedbackUnitTest.prototype.extraLibraries = [ '../../common/testing/assert_additions.js', '../testing/fake_dom.js', // Must come before other files - '../common/abstract_earcons.js', 'mock_feedback.js', ];
diff --git a/chrome/browser/resources/chromeos/accessibility/common/automation_predicate.js b/chrome/browser/resources/chromeos/accessibility/common/automation_predicate.js index 248ec83..32e8f21 100644 --- a/chrome/browser/resources/chromeos/accessibility/common/automation_predicate.js +++ b/chrome/browser/resources/chromeos/accessibility/common/automation_predicate.js
@@ -6,17 +6,9 @@ * @fileoverview ChromeVox predicates for the automation extension API. */ -goog.provide('AutomationPredicate'); -goog.provide('AutomationPredicate.Binary'); -goog.provide('AutomationPredicate.Unary'); - -goog.require('constants'); - -goog.scope(function() { const AutomationNode = chrome.automation.AutomationNode; const InvalidState = chrome.automation.InvalidState; const MarkerType = chrome.automation.MarkerType; -const Dir = constants.Dir; const Restriction = chrome.automation.Restriction; const Role = chrome.automation.RoleType; const State = chrome.automation.StateType; @@ -110,7 +102,7 @@ return true; }; -AutomationPredicate = class { +export class AutomationPredicate { constructor() {} /** @@ -620,7 +612,7 @@ * Returns a predicate that will match against the directed next cell taking * into account the current ancestor cell's position in the table. * @param {AutomationNode} start - * @param {{dir: (Dir|undefined), + * @param {{dir: (constants.Dir|undefined), * row: (boolean|undefined), * col: (boolean|undefined)}} opts * |dir|, specifies direction for |row or/and |col| movement by one cell. @@ -635,7 +627,7 @@ throw new Error('You must set either row or col to true'); } - const dir = opts.dir || Dir.FORWARD; + const dir = opts.dir || constants.Dir.FORWARD; // Compute the row/col index defaulting to 0. let rowIndex = 0; @@ -663,7 +655,7 @@ throw 'Unsupported option.'; } - if (dir === Dir.FORWARD) { + if (dir === constants.Dir.FORWARD) { return function(node) { return AutomationPredicate.cellLike(node) && node.tableCellColumnIndex === colIndex && @@ -680,10 +672,10 @@ // Adjust for the next/previous row/col. if (opts.row) { - rowIndex = dir === Dir.FORWARD ? rowIndex + 1 : rowIndex - 1; + rowIndex = dir === constants.Dir.FORWARD ? rowIndex + 1 : rowIndex - 1; } if (opts.col) { - colIndex = dir === Dir.FORWARD ? colIndex + 1 : colIndex - 1; + colIndex = dir === constants.Dir.FORWARD ? colIndex + 1 : colIndex - 1; } return function(node) { @@ -814,7 +806,7 @@ return AutomationPredicate.listLike(autoNode) && (autoNode !== avoidNode); }; } -}; +} /** * @typedef {function(!AutomationNode) : boolean} @@ -991,5 +983,3 @@ Role.LINE_BREAK, Role.LIST_MARKER, ]); - -}); // goog.scope
diff --git a/chrome/browser/resources/chromeos/accessibility/common/automation_predicate_test.js b/chrome/browser/resources/chromeos/accessibility/common/automation_predicate_test.js index f4747de..513947c 100644 --- a/chrome/browser/resources/chromeos/accessibility/common/automation_predicate_test.js +++ b/chrome/browser/resources/chromeos/accessibility/common/automation_predicate_test.js
@@ -5,7 +5,14 @@ GEN_INCLUDE(['../select_to_speak/select_to_speak_e2e_test_base.js']); /** Test fixture for automation_predicate.js. */ -AutomationPredicateTest = class extends SelectToSpeakE2ETest {}; +AutomationPredicateTest = class extends SelectToSpeakE2ETest { + /**@override */ + async setUpDeferred() { + await super.setUpDeferred(); + await importModule( + 'AutomationPredicate', '/common/automation_predicate.js'); + } +}; AX_TEST_F('AutomationPredicateTest', 'EquivalentRoles', async function() { const site = `
diff --git a/chrome/browser/resources/chromeos/accessibility/common/automation_util.js b/chrome/browser/resources/chromeos/accessibility/common/automation_util.js index da781b2..c10a4ee0 100644 --- a/chrome/browser/resources/chromeos/accessibility/common/automation_util.js +++ b/chrome/browser/resources/chromeos/accessibility/common/automation_util.js
@@ -6,6 +6,7 @@ * @fileoverview ChromeVox utilities for the automation extension API. */ +import {AutomationPredicate} from './automation_predicate.js'; import {AutomationTreeWalker, AutomationTreeWalkerRestriction} from './tree_walker.js'; const AutomationNode = chrome.automation.AutomationNode;
diff --git a/chrome/browser/resources/chromeos/accessibility/common/cursors/cursor.js b/chrome/browser/resources/chromeos/accessibility/common/cursors/cursor.js index 1e60fcdf..a06eff62 100644 --- a/chrome/browser/resources/chromeos/accessibility/common/cursors/cursor.js +++ b/chrome/browser/resources/chromeos/accessibility/common/cursors/cursor.js
@@ -7,15 +7,17 @@ * the automation tree. */ +import {AutomationPredicate} from '../automation_predicate.js'; +import {AutomationUtil} from '../automation_util.js'; +import {StringUtil} from '../string_util.js'; + +import {AncestryRecoveryStrategy, RecoveryStrategy} from './recovery_strategy.js'; + const AutomationNode = chrome.automation.AutomationNode; const Dir = constants.Dir; const RoleType = chrome.automation.RoleType; const StateType = chrome.automation.StateType; -import {StringUtil} from '../string_util.js'; -import {AutomationUtil} from '../automation_util.js'; -import {RecoveryStrategy, AncestryRecoveryStrategy} from './recovery_strategy.js'; - /** * The special index that represents a cursor pointing to a node without * pointing to any part of its accessible text.
diff --git a/chrome/browser/resources/chromeos/accessibility/common/cursors/cursors_test.js b/chrome/browser/resources/chromeos/accessibility/common/cursors/cursors_test.js index c1f50e1c..17652c5 100644 --- a/chrome/browser/resources/chromeos/accessibility/common/cursors/cursors_test.js +++ b/chrome/browser/resources/chromeos/accessibility/common/cursors/cursors_test.js
@@ -42,6 +42,8 @@ '/common/cursors/cursor.js'); await importModule('AutomationUtil', '/common/automation_util.js'); + await importModule( + 'AutomationPredicate', '/common/automation_predicate.js'); // Various aliases window.CHARACTER = CursorUnit.CHARACTER; window.WORD = CursorUnit.WORD;
diff --git a/chrome/browser/resources/chromeos/accessibility/common/cursors/range.js b/chrome/browser/resources/chromeos/accessibility/common/cursors/range.js index 038c559..41eaac3 100644 --- a/chrome/browser/resources/chromeos/accessibility/common/cursors/range.js +++ b/chrome/browser/resources/chromeos/accessibility/common/cursors/range.js
@@ -7,6 +7,7 @@ * the automation tree. */ +import {AutomationPredicate} from '../automation_predicate.js'; import {AutomationUtil} from '../automation_util.js'; import {Cursor, CURSOR_NODE_INDEX, CursorMovement, CursorUnit, WrappingCursor} from './cursor.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/common/tree_walker.js b/chrome/browser/resources/chromeos/accessibility/common/tree_walker.js index dbe1992..cb63464 100644 --- a/chrome/browser/resources/chromeos/accessibility/common/tree_walker.js +++ b/chrome/browser/resources/chromeos/accessibility/common/tree_walker.js
@@ -6,6 +6,8 @@ * @fileoverview A tree walker over the automation tree. */ +import {AutomationPredicate} from './automation_predicate.js'; + /** * Defined phases of traversal from the initial node passed to an * AutomationTreeWalker instance.
diff --git a/chrome/browser/resources/chromeos/accessibility/common/tutorial/chromevox_tutorial.js b/chrome/browser/resources/chromeos/accessibility/common/tutorial/chromevox_tutorial.js index dd192367d..49b5dcf 100644 --- a/chrome/browser/resources/chromeos/accessibility/common/tutorial/chromevox_tutorial.js +++ b/chrome/browser/resources/chromeos/accessibility/common/tutorial/chromevox_tutorial.js
@@ -9,6 +9,7 @@ import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {EarconDescription} from '../../../chromevox/common/abstract_earcons.js'; import {QueueMode} from '../../../chromevox/common/tts_interface.js'; import {Curriculum, InteractionMedium, LessonData, MainMenuButtonData, Screen} from './constants.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/common/tutorial/tutorial_lesson.js b/chrome/browser/resources/chromeos/accessibility/common/tutorial/tutorial_lesson.js index 02385ad..080c0693 100644 --- a/chrome/browser/resources/chromeos/accessibility/common/tutorial/tutorial_lesson.js +++ b/chrome/browser/resources/chromeos/accessibility/common/tutorial/tutorial_lesson.js
@@ -8,7 +8,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/md_select_css.m.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/select_to_speak/background.html b/chrome/browser/resources/chromeos/accessibility/select_to_speak/background.html index e35eca5..b93c1d7 100644 --- a/chrome/browser/resources/chromeos/accessibility/select_to_speak/background.html +++ b/chrome/browser/resources/chromeos/accessibility/select_to_speak/background.html
@@ -1,7 +1,6 @@ <!-- Global scripts. --> <script src="/common/closure_shim.js"></script> <script src="/common/constants.js"></script> -<script src="/common/automation_predicate.js"></script> <!-- Module entrypoint. --> <script type="module" src="/select_to_speak/select_to_speak_main.js"></script>
diff --git a/chrome/browser/resources/chromeos/accessibility/select_to_speak/node_utils.js b/chrome/browser/resources/chromeos/accessibility/select_to_speak/node_utils.js index 0cb9b069..16614ee 100644 --- a/chrome/browser/resources/chromeos/accessibility/select_to_speak/node_utils.js +++ b/chrome/browser/resources/chromeos/accessibility/select_to_speak/node_utils.js
@@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {AutomationPredicate} from '../common/automation_predicate.js'; import {AutomationUtil} from '../common/automation_util.js'; import {RectUtil} from '../common/rect_util.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak.js b/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak.js index fe4abaa..c2a49516 100644 --- a/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak.js +++ b/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak.js
@@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {AutomationPredicate} from '../common/automation_predicate.js'; import {AutomationUtil} from '../common/automation_util.js'; import {InputHandler} from './input_handler.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/switch_access/background.html b/chrome/browser/resources/chromeos/accessibility/switch_access/background.html index edc08481..4d39a54f 100644 --- a/chrome/browser/resources/chromeos/accessibility/switch_access/background.html +++ b/chrome/browser/resources/chromeos/accessibility/switch_access/background.html
@@ -1,7 +1,6 @@ <!-- Global scripts. --> <script src="/common/closure_shim.js"></script> <script src="/common/constants.js"></script> -<script src="/common/automation_predicate.js"></script> <script src="/common/event_handler.js"></script> <script src="/common/repeated_event_handler.js"></script> <script src="/common/repeated_tree_change_handler.js"></script>
diff --git a/chrome/browser/resources/chromeos/accessibility/switch_access/nodes/combo_box_node.js b/chrome/browser/resources/chromeos/accessibility/switch_access/nodes/combo_box_node.js index 4926ea2..4498456 100644 --- a/chrome/browser/resources/chromeos/accessibility/switch_access/nodes/combo_box_node.js +++ b/chrome/browser/resources/chromeos/accessibility/switch_access/nodes/combo_box_node.js
@@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {AutomationPredicate} from '../../common/automation_predicate.js'; import {EventGenerator} from '../../common/event_generator.js'; import {KeyCode} from '../../common/key_code.js'; import {Navigator} from '../navigator.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/switch_access/switch_access_predicate.js b/chrome/browser/resources/chromeos/accessibility/switch_access/switch_access_predicate.js index c13e79b..4dff1845 100644 --- a/chrome/browser/resources/chromeos/accessibility/switch_access/switch_access_predicate.js +++ b/chrome/browser/resources/chromeos/accessibility/switch_access/switch_access_predicate.js
@@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {AutomationPredicate} from '../common/automation_predicate.js'; import {RectUtil} from '../common/rect_util.js'; import {AutomationTreeWalkerRestriction} from '../common/tree_walker.js';
diff --git a/chrome/browser/resources/chromeos/assistant_optin/BUILD.gn b/chrome/browser/resources/chromeos/assistant_optin/BUILD.gn index 0eedea57..23e802fd 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/BUILD.gn +++ b/chrome/browser/resources/chromeos/assistant_optin/BUILD.gn
@@ -251,6 +251,7 @@ html_file = "assistant_value_prop.html" html_type = "dom-module" auto_imports = assistant_auto_imports + migrated_imports = assistant_migrated_imports namespace_rewrites = assistant_namespace_rewrites }
diff --git a/chrome/browser/resources/chromeos/assistant_optin/modulization_utils.gni b/chrome/browser/resources/chromeos/assistant_optin/modulization_utils.gni index d45686b2..0dc473fc 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/modulization_utils.gni +++ b/chrome/browser/resources/chromeos/assistant_optin/modulization_utils.gni
@@ -24,3 +24,6 @@ "Polymer.mixinBehaviors|mixinBehaviors", "Polymer.Element|PolymerElement", ] + +assistant_migrated_imports = + [ "ui/webui/resources/cr_elements/cr_dialog/cr_dialog.html" ]
diff --git a/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_dialog.ts b/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_dialog.ts index 71b5dc1c..dcef32c 100644 --- a/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_dialog.ts +++ b/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_dialog.ts
@@ -4,7 +4,7 @@ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {BrowserProxy} from './browser_proxy.js'; import {getTemplate} from './cloud_upload_dialog.html.js';
diff --git a/chrome/browser/resources/chromeos/emulator/audio_settings.js b/chrome/browser/resources/chromeos/emulator/audio_settings.js index 8fe8225..7c53212 100644 --- a/chrome/browser/resources/chromeos/emulator/audio_settings.js +++ b/chrome/browser/resources/chromeos/emulator/audio_settings.js
@@ -4,7 +4,7 @@ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/cr_radio_button/cr_radio_button.m.js';
diff --git a/chrome/browser/resources/chromeos/emulator/bluetooth_settings.js b/chrome/browser/resources/chromeos/emulator/bluetooth_settings.js index 7a60df1..6124c5a 100644 --- a/chrome/browser/resources/chromeos/emulator/bluetooth_settings.js +++ b/chrome/browser/resources/chromeos/emulator/bluetooth_settings.js
@@ -4,7 +4,7 @@ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/cr_radio_button/cr_radio_button.m.js';
diff --git a/chrome/browser/resources/chromeos/internet_config_dialog/BUILD.gn b/chrome/browser/resources/chromeos/internet_config_dialog/BUILD.gn index 7fd938b3..28b38d5 100644 --- a/chrome/browser/resources/chromeos/internet_config_dialog/BUILD.gn +++ b/chrome/browser/resources/chromeos/internet_config_dialog/BUILD.gn
@@ -70,7 +70,7 @@ "//ui/webui/resources/cr_components/chromeos/network:cr_policy_network_behavior_mojo.m", "//ui/webui/resources/cr_components/chromeos/network:network_config.m", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:i18n_behavior.m", ]
diff --git a/chrome/browser/resources/chromeos/internet_config_dialog/internet_config_dialog.js b/chrome/browser/resources/chromeos/internet_config_dialog/internet_config_dialog.js index 109804f..fff7d53 100644 --- a/chrome/browser/resources/chromeos/internet_config_dialog/internet_config_dialog.js +++ b/chrome/browser/resources/chromeos/internet_config_dialog/internet_config_dialog.js
@@ -6,7 +6,7 @@ import 'chrome://resources/cr_components/chromeos/network/network_icon.m.js'; import 'chrome://resources/cr_components/chromeos/network/network_shared_css.m.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_page_host_style.css.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import './strings.m.js';
diff --git a/chrome/browser/resources/chromeos/login/components/dialogs/BUILD.gn b/chrome/browser/resources/chromeos/login/components/dialogs/BUILD.gn index 5ba46c9..371e72f7 100644 --- a/chrome/browser/resources/chromeos/login/components/dialogs/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/components/dialogs/BUILD.gn
@@ -66,7 +66,7 @@ "../behaviors:oobe_i18n_behavior.m", "../buttons:oobe_text_button.m", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:cr.m", ] extra_deps = [ ":oobe_modal_dialog_module" ] @@ -102,4 +102,5 @@ html_file = "oobe_modal_dialog.html" html_type = "dom-module" auto_imports = oobe_auto_imports + migrated_imports = oobe_migrated_imports }
diff --git a/chrome/browser/resources/chromeos/login/oobe_auto_imports.gni b/chrome/browser/resources/chromeos/login/oobe_auto_imports.gni index 2ecd44dc..19a922ec 100644 --- a/chrome/browser/resources/chromeos/login/oobe_auto_imports.gni +++ b/chrome/browser/resources/chromeos/login/oobe_auto_imports.gni
@@ -93,6 +93,7 @@ oobe_migrated_imports = [ "ui/webui/resources/cr_elements/cr_checkbox/cr_checkbox.html", + "ui/webui/resources/cr_elements/cr_dialog/cr_dialog.html", "ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.html", "ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_icon.html", "ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.html",
diff --git a/chrome/browser/resources/chromeos/login/screens/login/BUILD.gn b/chrome/browser/resources/chromeos/login/screens/login/BUILD.gn index 3f2cc5fb1..466108a1 100644 --- a/chrome/browser/resources/chromeos/login/screens/login/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/screens/login/BUILD.gn
@@ -193,6 +193,7 @@ html_file = "offline_login.html" html_type = "dom-module" auto_imports = oobe_auto_imports + migrated_imports = oobe_migrated_imports namespace_rewrites = oobe_namespace_rewrites }
diff --git a/chrome/browser/resources/chromeos/password_change/BUILD.gn b/chrome/browser/resources/chromeos/password_change/BUILD.gn index 9b2678b3..79f3c5c9 100644 --- a/chrome/browser/resources/chromeos/password_change/BUILD.gn +++ b/chrome/browser/resources/chromeos/password_change/BUILD.gn
@@ -19,7 +19,7 @@ "//ui/webui/resources/cr_components/chromeos/network:network_select.m", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo.m", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data.m", ]
diff --git a/chrome/browser/resources/chromeos/password_change/confirm_password_change.js b/chrome/browser/resources/chromeos/password_change/confirm_password_change.js index cc596fc..f1ab863 100644 --- a/chrome/browser/resources/chromeos/password_change/confirm_password_change.js +++ b/chrome/browser/resources/chromeos/password_change/confirm_password_change.js
@@ -22,7 +22,7 @@ import {WebUIListenerBehavior} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import 'chrome://confirm-password-change/strings.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import 'chrome://resources/polymer/v3_0/paper-spinner/paper-spinner-lite.js';
diff --git a/chrome/browser/resources/chromeos/password_change/lock_screen_network.js b/chrome/browser/resources/chromeos/password_change/lock_screen_network.js index 4cbe169..3a697c8 100644 --- a/chrome/browser/resources/chromeos/password_change/lock_screen_network.js +++ b/chrome/browser/resources/chromeos/password_change/lock_screen_network.js
@@ -7,7 +7,7 @@ * Polymer element lock screen network selection UI. */ -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/cr_components/chromeos/network/network_select.m.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js';
diff --git a/chrome/browser/resources/chromeos/password_change/lock_screen_reauth.js b/chrome/browser/resources/chromeos/password_change/lock_screen_reauth.js index aaf58a8..ca51d3a 100644 --- a/chrome/browser/resources/chromeos/password_change/lock_screen_reauth.js +++ b/chrome/browser/resources/chromeos/password_change/lock_screen_reauth.js
@@ -12,7 +12,7 @@ import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js';
diff --git a/chrome/browser/resources/chromeos/password_change/password_change.js b/chrome/browser/resources/chromeos/password_change/password_change.js index 34255b28d..b3e3576 100644 --- a/chrome/browser/resources/chromeos/password_change/password_change.js +++ b/chrome/browser/resources/chromeos/password_change/password_change.js
@@ -10,7 +10,7 @@ import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js'; import {Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import 'chrome://password-change/strings.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/icons.m.js'; Polymer({
diff --git a/chrome/browser/resources/chromeos/password_change/urgent_password_expiry_notification_app.js b/chrome/browser/resources/chromeos/password_change/urgent_password_expiry_notification_app.js index 2a7b86f..f469fca 100644 --- a/chrome/browser/resources/chromeos/password_change/urgent_password_expiry_notification_app.js +++ b/chrome/browser/resources/chromeos/password_change/urgent_password_expiry_notification_app.js
@@ -10,7 +10,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
diff --git a/chrome/browser/resources/chromeos/set_time_dialog/BUILD.gn b/chrome/browser/resources/chromeos/set_time_dialog/BUILD.gn index 903c51b..33e241a 100644 --- a/chrome/browser/resources/chromeos/set_time_dialog/BUILD.gn +++ b/chrome/browser/resources/chromeos/set_time_dialog/BUILD.gn
@@ -16,7 +16,7 @@ js_library("set_time_dialog") { deps = [ ":set_time_browser_proxy", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:cr.m", "//ui/webui/resources/js:load_time_data.m",
diff --git a/chrome/browser/resources/chromeos/set_time_dialog/set_time_dialog.js b/chrome/browser/resources/chromeos/set_time_dialog/set_time_dialog.js index ca42859..38d4115 100644 --- a/chrome/browser/resources/chromeos/set_time_dialog/set_time_dialog.js +++ b/chrome/browser/resources/chromeos/set_time_dialog/set_time_dialog.js
@@ -13,7 +13,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_page_host_style.css.js'; import 'chrome://resources/cr_elements/md_select_css.m.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js';
diff --git a/chrome/browser/resources/chromeos/smb_shares/BUILD.gn b/chrome/browser/resources/chromeos/smb_shares/BUILD.gn index 01d43fc..4b896e19 100644 --- a/chrome/browser/resources/chromeos/smb_shares/BUILD.gn +++ b/chrome/browser/resources/chromeos/smb_shares/BUILD.gn
@@ -23,7 +23,7 @@ js_library("smb_credentials_dialog") { deps = [ "//ui/webui/resources/cr_components/chromeos/smb_shares:smb_browser_proxy", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/cr_elements/cr_input:cr_input.m", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:cr.m",
diff --git a/chrome/browser/resources/chromeos/smb_shares/smb_credentials_dialog.js b/chrome/browser/resources/chromeos/smb_shares/smb_credentials_dialog.js index f12c32b..8107901 100644 --- a/chrome/browser/resources/chromeos/smb_shares/smb_credentials_dialog.js +++ b/chrome/browser/resources/chromeos/smb_shares/smb_credentials_dialog.js
@@ -3,7 +3,7 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import './strings.m.js';
diff --git a/chrome/browser/resources/extensions/install_warnings_dialog.ts b/chrome/browser/resources/extensions/install_warnings_dialog.ts index 8f6837a9..09ef1350 100644 --- a/chrome/browser/resources/extensions/install_warnings_dialog.ts +++ b/chrome/browser/resources/extensions/install_warnings_dialog.ts
@@ -3,12 +3,12 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import 'chrome://resources/polymer/v3_0/paper-styles/color.js'; import './code_section.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getTemplate} from './install_warnings_dialog.html.js';
diff --git a/chrome/browser/resources/extensions/item.ts b/chrome/browser/resources/extensions/item.ts index 28f3bf8..60533011 100644 --- a/chrome/browser/resources/extensions/item.ts +++ b/chrome/browser/resources/extensions/item.ts
@@ -266,6 +266,7 @@ case SourceType.UNPACKED: return 'extensions-icons:unpacked'; case SourceType.WEBSTORE: + case SourceType.INSTALLED_BY_DEFAULT: return ''; default: assertNotReached();
diff --git a/chrome/browser/resources/extensions/item_util.ts b/chrome/browser/resources/extensions/item_util.ts index 05a73e4..e93af1d 100644 --- a/chrome/browser/resources/extensions/item_util.ts +++ b/chrome/browser/resources/extensions/item_util.ts
@@ -12,6 +12,7 @@ POLICY = 'policy', SIDELOADED = 'sideloaded', UNPACKED = 'unpacked', + INSTALLED_BY_DEFAULT = 'installed-by-default', UNKNOWN = 'unknown', } @@ -93,6 +94,8 @@ return SourceType.UNKNOWN; case chrome.developerPrivate.Location.FROM_STORE: return SourceType.WEBSTORE; + case chrome.developerPrivate.Location.INSTALLED_BY_DEFAULT: + return SourceType.INSTALLED_BY_DEFAULT; default: assertNotReached(item.location); } @@ -108,6 +111,8 @@ return loadTimeData.getString('itemSourceUnpacked'); case SourceType.WEBSTORE: return loadTimeData.getString('itemSourceWebstore'); + case SourceType.INSTALLED_BY_DEFAULT: + return loadTimeData.getString('itemSourceInstalledByDefault'); case SourceType.UNKNOWN: // Nothing to return. Calling code should use // chrome.developerPrivate.ExtensionInfo's |locationText| instead.
diff --git a/chrome/browser/resources/extensions/kiosk_dialog.ts b/chrome/browser/resources/extensions/kiosk_dialog.ts index 0e39489..6d285a8 100644 --- a/chrome/browser/resources/extensions/kiosk_dialog.ts +++ b/chrome/browser/resources/extensions/kiosk_dialog.ts
@@ -4,7 +4,7 @@ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; import 'chrome://resources/cr_elements/cr_icons_css.m.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; @@ -12,7 +12,7 @@ import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import {CrCheckboxElement} from 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {WebUIListenerMixin} from 'chrome://resources/js/web_ui_listener_mixin.js';
diff --git a/chrome/browser/resources/extensions/load_error.ts b/chrome/browser/resources/extensions/load_error.ts index 2fdf78e8..0b4bae8 100644 --- a/chrome/browser/resources/extensions/load_error.ts +++ b/chrome/browser/resources/extensions/load_error.ts
@@ -3,13 +3,13 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import 'chrome://resources/polymer/v3_0/paper-spinner/paper-spinner-lite.js'; import './code_section.js'; import './strings.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/extensions/options_dialog.ts b/chrome/browser/resources/extensions/options_dialog.ts index 14d78ad..dcb81911 100644 --- a/chrome/browser/resources/extensions/options_dialog.ts +++ b/chrome/browser/resources/extensions/options_dialog.ts
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {EventTracker} from 'chrome://resources/js/event_tracker.m.js'; import {Debouncer, PolymerElement, timeOut} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/extensions/pack_dialog.ts b/chrome/browser/resources/extensions/pack_dialog.ts index acb1c590a..558d840 100644 --- a/chrome/browser/resources/extensions/pack_dialog.ts +++ b/chrome/browser/resources/extensions/pack_dialog.ts
@@ -3,14 +3,14 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import './pack_dialog_alert.js'; import './strings.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getTemplate} from './pack_dialog.html.js';
diff --git a/chrome/browser/resources/extensions/pack_dialog_alert.ts b/chrome/browser/resources/extensions/pack_dialog_alert.ts index c0b0139..c81beeb 100644 --- a/chrome/browser/resources/extensions/pack_dialog_alert.ts +++ b/chrome/browser/resources/extensions/pack_dialog_alert.ts
@@ -3,10 +3,10 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert, assertNotReached} from 'chrome://resources/js/assert_ts.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/extensions/restricted_sites_dialog.ts b/chrome/browser/resources/extensions/restricted_sites_dialog.ts index fc8d8eb..d5462e3cc 100644 --- a/chrome/browser/resources/extensions/restricted_sites_dialog.ts +++ b/chrome/browser/resources/extensions/restricted_sites_dialog.ts
@@ -3,14 +3,14 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import './strings.m.js'; import './shared_style.css.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/extensions/runtime_host_permissions.ts b/chrome/browser/resources/extensions/runtime_host_permissions.ts index 0a2348b2c..4ce6a29 100644 --- a/chrome/browser/resources/extensions/runtime_host_permissions.ts +++ b/chrome/browser/resources/extensions/runtime_host_permissions.ts
@@ -4,7 +4,7 @@ import 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; import 'chrome://resources/cr_elements/cr_radio_group/cr_radio_group.js'; import 'chrome://resources/cr_elements/cr_radio_button/cr_radio_button.m.js'; @@ -20,7 +20,7 @@ import './strings.m.js'; import {CrActionMenuElement} from 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {focusWithoutInk} from 'chrome://resources/js/cr/ui/focus_without_ink.m.js'; import {DomRepeatEvent, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/extensions/runtime_hosts_dialog.ts b/chrome/browser/resources/extensions/runtime_hosts_dialog.ts index 9231097..c59d265 100644 --- a/chrome/browser/resources/extensions/runtime_hosts_dialog.ts +++ b/chrome/browser/resources/extensions/runtime_hosts_dialog.ts
@@ -3,7 +3,7 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; @@ -12,7 +12,7 @@ import './shared_vars.css.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
diff --git a/chrome/browser/resources/extensions/site_permissions_edit_permissions_dialog.ts b/chrome/browser/resources/extensions/site_permissions_edit_permissions_dialog.ts index 3f69da0..84bd97c 100644 --- a/chrome/browser/resources/extensions/site_permissions_edit_permissions_dialog.ts +++ b/chrome/browser/resources/extensions/site_permissions_edit_permissions_dialog.ts
@@ -3,14 +3,14 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_radio_button/cr_radio_button.m.js'; import 'chrome://resources/cr_elements/cr_radio_group/cr_radio_group.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import './strings.m.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/extensions/site_permissions_edit_url_dialog.ts b/chrome/browser/resources/extensions/site_permissions_edit_url_dialog.ts index 9e0f3dc..6a6fa83 100644 --- a/chrome/browser/resources/extensions/site_permissions_edit_url_dialog.ts +++ b/chrome/browser/resources/extensions/site_permissions_edit_url_dialog.ts
@@ -3,13 +3,13 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import './strings.m.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/history/history.ts b/chrome/browser/resources/history/history.ts index ddc12a6..7f32e05 100644 --- a/chrome/browser/resources/history/history.ts +++ b/chrome/browser/resources/history/history.ts
@@ -8,7 +8,7 @@ export {ClusterAction, PageCallbackRouter, PageHandlerRemote, RelatedSearchAction, VisitAction, VisitType} from 'chrome://resources/cr_components/history_clusters/history_clusters.mojom-webui.js'; export {MetricsProxy, MetricsProxyImpl} from 'chrome://resources/cr_components/history_clusters/metrics_proxy.js'; export {CrActionMenuElement} from 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js'; -export {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +export {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; export {ensureLazyLoaded, HistoryAppElement, listenForPrivilegedLinkClicks} from './app.js'; export {BrowserService, BrowserServiceImpl, QueryResult, RemoveVisitsRequest} from './browser_service.js'; export {HistoryPageViewHistogram, SYNCED_TABS_HISTOGRAM_NAME, SyncedTabsHistogram} from './constants.js';
diff --git a/chrome/browser/resources/history/history_list.ts b/chrome/browser/resources/history/history_list.ts index 246fcb2..e6789866c 100644 --- a/chrome/browser/resources/history/history_list.ts +++ b/chrome/browser/resources/history/history_list.ts
@@ -11,7 +11,7 @@ import {getInstance as getAnnouncerInstance} from 'chrome://resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer.js'; import {CrActionMenuElement} from 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrLazyRenderElement} from 'chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js';
diff --git a/chrome/browser/resources/history/lazy_load.ts b/chrome/browser/resources/history/lazy_load.ts index 5475200a..bb3a7ba 100644 --- a/chrome/browser/resources/history/lazy_load.ts +++ b/chrome/browser/resources/history/lazy_load.ts
@@ -6,7 +6,7 @@ import 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_drawer/cr_drawer.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; import 'chrome://resources/cr_elements/cr_toolbar/cr_toolbar_selection_overlay.js';
diff --git a/chrome/browser/resources/media_router/cast_feedback/cast_feedback_ui.ts b/chrome/browser/resources/media_router/cast_feedback/cast_feedback_ui.ts index cba1eec..1b26551c 100644 --- a/chrome/browser/resources/media_router/cast_feedback/cast_feedback_ui.ts +++ b/chrome/browser/resources/media_router/cast_feedback/cast_feedback_ui.ts
@@ -5,14 +5,14 @@ import './strings.m.js'; import '//resources/cr_elements/cr_button/cr_button.m.js'; import '//resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import '//resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import '//resources/cr_elements/cr_dialog/cr_dialog.js'; import '//resources/cr_elements/cr_input/cr_input.m.js'; import '//resources/cr_elements/cr_radio_button/cr_radio_button.m.js'; import '//resources/cr_elements/cr_radio_group/cr_radio_group.js'; import '//resources/cr_elements/shared_style_css.m.js'; import '//resources/cr_elements/shared_vars_css.m.js'; -import {CrDialogElement} from '//resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from '//resources/cr_elements/cr_dialog/cr_dialog.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/new_tab_page/customize_dialog.ts b/chrome/browser/resources/new_tab_page/customize_dialog.ts index c437e40..fbf21a34 100644 --- a/chrome/browser/resources/new_tab_page/customize_dialog.ts +++ b/chrome/browser/resources/new_tab_page/customize_dialog.ts
@@ -3,7 +3,7 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_toggle/cr_toggle.m.js'; import 'chrome://resources/cr_elements/hidden_style_css.m.js'; import 'chrome://resources/polymer/v3_0/iron-pages/iron-pages.js'; @@ -14,7 +14,7 @@ import './customize_modules.js'; import {CustomizeThemesElement} from 'chrome://resources/cr_components/customize_themes/customize_themes.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrToggleElement} from 'chrome://resources/cr_elements/cr_toggle/cr_toggle.m.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/new_tab_page/doodle_share_dialog.ts b/chrome/browser/resources/new_tab_page/doodle_share_dialog.ts index 2709b18..a4bf306 100644 --- a/chrome/browser/resources/new_tab_page/doodle_share_dialog.ts +++ b/chrome/browser/resources/new_tab_page/doodle_share_dialog.ts
@@ -3,11 +3,11 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {Url} from 'chrome://resources/mojo/url/mojom/url.mojom-webui.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/new_tab_page/modules/cart/discount_consent_dialog.ts b/chrome/browser/resources/new_tab_page/modules/cart/discount_consent_dialog.ts index da06b8a..88a0b03 100644 --- a/chrome/browser/resources/new_tab_page/modules/cart/discount_consent_dialog.ts +++ b/chrome/browser/resources/new_tab_page/modules/cart/discount_consent_dialog.ts
@@ -3,10 +3,10 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getTemplate} from './discount_consent_dialog.html.js';
diff --git a/chrome/browser/resources/new_tab_page/modules/info_dialog.ts b/chrome/browser/resources/new_tab_page/modules/info_dialog.ts index 8cf5daf..d77ac85 100644 --- a/chrome/browser/resources/new_tab_page/modules/info_dialog.ts +++ b/chrome/browser/resources/new_tab_page/modules/info_dialog.ts
@@ -3,9 +3,9 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getTemplate} from './info_dialog.html.js';
diff --git a/chrome/browser/resources/pdf/elements/viewer-annotations-mode-dialog.ts b/chrome/browser/resources/pdf/elements/viewer-annotations-mode-dialog.ts index fd56a01f..4e228ea 100644 --- a/chrome/browser/resources/pdf/elements/viewer-annotations-mode-dialog.ts +++ b/chrome/browser/resources/pdf/elements/viewer-annotations-mode-dialog.ts
@@ -3,11 +3,11 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getTemplate} from './viewer-annotations-mode-dialog.html.js';
diff --git a/chrome/browser/resources/pdf/elements/viewer-error-dialog.ts b/chrome/browser/resources/pdf/elements/viewer-error-dialog.ts index 9e0d398..8bd064e 100644 --- a/chrome/browser/resources/pdf/elements/viewer-error-dialog.ts +++ b/chrome/browser/resources/pdf/elements/viewer-error-dialog.ts
@@ -3,7 +3,7 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/hidden_style_css.m.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/pdf/elements/viewer-password-dialog.ts b/chrome/browser/resources/pdf/elements/viewer-password-dialog.ts index f7297e07..b57aa0a 100644 --- a/chrome/browser/resources/pdf/elements/viewer-password-dialog.ts +++ b/chrome/browser/resources/pdf/elements/viewer-password-dialog.ts
@@ -3,13 +3,13 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getTemplate} from './viewer-password-dialog.html.js';
diff --git a/chrome/browser/resources/pdf/elements/viewer-properties-dialog.ts b/chrome/browser/resources/pdf/elements/viewer-properties-dialog.ts index 78936c3..084d34c6 100644 --- a/chrome/browser/resources/pdf/elements/viewer-properties-dialog.ts +++ b/chrome/browser/resources/pdf/elements/viewer-properties-dialog.ts
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {DocumentMetadata} from '../constants.js';
diff --git a/chrome/browser/resources/print_preview/ui/advanced_settings_dialog.ts b/chrome/browser/resources/print_preview/ui/advanced_settings_dialog.ts index ea1b1efe..294886788 100644 --- a/chrome/browser/resources/print_preview/ui/advanced_settings_dialog.ts +++ b/chrome/browser/resources/print_preview/ui/advanced_settings_dialog.ts
@@ -3,7 +3,7 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/hidden_style_css.m.js'; import './advanced_settings_item.js'; import './print_preview_search_box.js'; @@ -11,7 +11,7 @@ import './print_preview_vars.css.js'; import '../strings.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {removeHighlights} from 'chrome://resources/js/search_highlight_utils.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/print_preview/ui/app.ts b/chrome/browser/resources/print_preview/ui/app.ts index a719848..478ee7f2 100644 --- a/chrome/browser/resources/print_preview/ui/app.ts +++ b/chrome/browser/resources/print_preview/ui/app.ts
@@ -8,7 +8,7 @@ import '../data/document_info.js'; import './sidebar.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {isMac, isWindows} from 'chrome://resources/js/cr.m.js'; import {FocusOutlineManager} from 'chrome://resources/js/cr/ui/focus_outline_manager.m.js'; import {EventTracker} from 'chrome://resources/js/event_tracker.m.js';
diff --git a/chrome/browser/resources/print_preview/ui/destination_dialog.ts b/chrome/browser/resources/print_preview/ui/destination_dialog.ts index 7487f40..4895dada 100644 --- a/chrome/browser/resources/print_preview/ui/destination_dialog.ts +++ b/chrome/browser/resources/print_preview/ui/destination_dialog.ts
@@ -3,7 +3,7 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/hidden_style_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import 'chrome://resources/cr_elements/icons.m.js'; @@ -18,7 +18,7 @@ import './throbber.css.js'; import './destination_list_item.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {EventTracker} from 'chrome://resources/js/event_tracker.m.js'; import {ListPropertyUpdateMixin} from 'chrome://resources/js/list_property_update_mixin.js';
diff --git a/chrome/browser/resources/print_preview/ui/destination_dialog_cros.ts b/chrome/browser/resources/print_preview/ui/destination_dialog_cros.ts index 9e709f1..65b7f7b 100644 --- a/chrome/browser/resources/print_preview/ui/destination_dialog_cros.ts +++ b/chrome/browser/resources/print_preview/ui/destination_dialog_cros.ts
@@ -3,7 +3,7 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_searchable_drop_down/cr_searchable_drop_down.js'; import 'chrome://resources/cr_elements/hidden_style_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; @@ -20,7 +20,7 @@ import './throbber.css.js'; import './destination_list_item_cros.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {EventTracker} from 'chrome://resources/js/event_tracker.m.js'; import {ListPropertyUpdateMixin} from 'chrome://resources/js/list_property_update_mixin.js';
diff --git a/chrome/browser/resources/print_preview/ui/provisional_destination_resolver.ts b/chrome/browser/resources/print_preview/ui/provisional_destination_resolver.ts index 20d5c5e..1d14eaf 100644 --- a/chrome/browser/resources/print_preview/ui/provisional_destination_resolver.ts +++ b/chrome/browser/resources/print_preview/ui/provisional_destination_resolver.ts
@@ -3,7 +3,7 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/hidden_style_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import './print_preview_shared.css.js'; @@ -11,7 +11,7 @@ import '../strings.m.js'; import './throbber.css.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {PromiseResolver} from 'chrome://resources/js/promise_resolver.m.js';
diff --git a/chrome/browser/resources/settings/autofill_page/address_edit_dialog.ts b/chrome/browser/resources/settings/autofill_page/address_edit_dialog.ts index ac77926ed..74f15d9 100644 --- a/chrome/browser/resources/settings/autofill_page/address_edit_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/address_edit_dialog.ts
@@ -7,7 +7,7 @@ * address. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; @@ -17,7 +17,7 @@ import '../controls/settings_textarea.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {assertNotReached} from 'chrome://resources/js/assert_ts.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js';
diff --git a/chrome/browser/resources/settings/autofill_page/address_remove_confirmation_dialog.ts b/chrome/browser/resources/settings/autofill_page/address_remove_confirmation_dialog.ts index 7eedbf88..dcb84b381 100644 --- a/chrome/browser/resources/settings/autofill_page/address_remove_confirmation_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/address_remove_confirmation_dialog.ts
@@ -7,9 +7,9 @@ * removing a saved address. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getTemplate} from './address_remove_confirmation_dialog.html.js';
diff --git a/chrome/browser/resources/settings/autofill_page/credit_card_edit_dialog.ts b/chrome/browser/resources/settings/autofill_page/credit_card_edit_dialog.ts index 7682fb9..70dd7bfb 100644 --- a/chrome/browser/resources/settings/autofill_page/credit_card_edit_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/credit_card_edit_dialog.ts
@@ -8,7 +8,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; @@ -18,7 +18,7 @@ import '../i18n_setup.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {microTask, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/autofill_page/passkeys_subpage.ts b/chrome/browser/resources/settings/autofill_page/passkeys_subpage.ts index 3838cac..7ee10ac 100644 --- a/chrome/browser/resources/settings/autofill_page/passkeys_subpage.ts +++ b/chrome/browser/resources/settings/autofill_page/passkeys_subpage.ts
@@ -8,14 +8,14 @@ */ import '../settings_shared.css.js'; import 'chrome://resources/cr_elements/icons.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import 'chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.js'; import '../site_favicon.js'; import {AnchorAlignment} from 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrLazyRenderElement} from 'chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/autofill_page/password_check_edit_disclaimer_dialog.ts b/chrome/browser/resources/settings/autofill_page/password_check_edit_disclaimer_dialog.ts index 26185f6f..5ff8de68 100644 --- a/chrome/browser/resources/settings/autofill_page/password_check_edit_disclaimer_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/password_check_edit_disclaimer_dialog.ts
@@ -3,10 +3,10 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getTemplate} from './password_check_edit_disclaimer_dialog.html.js';
diff --git a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.ts b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.ts index 3624a8b..c6239e68 100644 --- a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.ts
@@ -8,7 +8,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/cr_icons_css.m.js'; @@ -19,7 +19,7 @@ import './passwords_shared.css.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {assert, assertNotReached} from 'chrome://resources/js/assert_ts.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js';
diff --git a/chrome/browser/resources/settings/autofill_page/password_move_multiple_passwords_to_account_dialog.ts b/chrome/browser/resources/settings/autofill_page/password_move_multiple_passwords_to_account_dialog.ts index 2e832a6..818a4b53 100644 --- a/chrome/browser/resources/settings/autofill_page/password_move_multiple_passwords_to_account_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/password_move_multiple_passwords_to_account_dialog.ts
@@ -12,9 +12,9 @@ import './password_list_item.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {PasswordManagerImpl} from './password_manager_proxy.js';
diff --git a/chrome/browser/resources/settings/autofill_page/password_move_to_account_dialog.ts b/chrome/browser/resources/settings/autofill_page/password_move_to_account_dialog.ts index 414cba5..fd2c1c5 100644 --- a/chrome/browser/resources/settings/autofill_page/password_move_to_account_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/password_move_to_account_dialog.ts
@@ -8,13 +8,13 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import './avatar_icon.js'; import '../site_favicon.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/autofill_page/password_remove_confirmation_dialog.ts b/chrome/browser/resources/settings/autofill_page/password_remove_confirmation_dialog.ts index 806cd36..43949e3 100644 --- a/chrome/browser/resources/settings/autofill_page/password_remove_confirmation_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/password_remove_confirmation_dialog.ts
@@ -3,11 +3,11 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../i18n_setup.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/autofill_page/password_remove_dialog.ts b/chrome/browser/resources/settings/autofill_page/password_remove_dialog.ts index e5b2ef7b..3f04eb0 100644 --- a/chrome/browser/resources/settings/autofill_page/password_remove_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/password_remove_dialog.ts
@@ -12,12 +12,12 @@ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import './avatar_icon.js'; import {CrCheckboxElement} from 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.ts b/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.ts index 6f7c0e2..ec1542a 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.ts
@@ -8,7 +8,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js'; import 'chrome://resources/polymer/v3_0/paper-progress/paper-progress.js';
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.ts b/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.ts index 6e0272e..6aa5ac2 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.ts
@@ -8,12 +8,12 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import '../settings_shared.css.js'; import '../site_favicon.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert, assertNotReached} from 'chrome://resources/js/assert_ts.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {PluralStringProxyImpl} from 'chrome://resources/js/plural_string_proxy.js';
diff --git a/chrome/browser/resources/settings/autofill_page/virtual_card_unenroll_dialog.ts b/chrome/browser/resources/settings/autofill_page/virtual_card_unenroll_dialog.ts index f5d387b3..857b0db6 100644 --- a/chrome/browser/resources/settings/autofill_page/virtual_card_unenroll_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/virtual_card_unenroll_dialog.ts
@@ -10,12 +10,12 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import '../settings_shared.css.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getTemplate} from './virtual_card_unenroll_dialog.html.js';
diff --git a/chrome/browser/resources/settings/chromeos/ambient_mode_page/art_album_dialog.js b/chrome/browser/resources/settings/chromeos/ambient_mode_page/art_album_dialog.js index 827a0e2..49b68b8a 100644 --- a/chrome/browser/resources/settings/chromeos/ambient_mode_page/art_album_dialog.js +++ b/chrome/browser/resources/settings/chromeos/ambient_mode_page/art_album_dialog.js
@@ -7,7 +7,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../../settings_shared.css.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/crostini_page/BUILD.gn index 3b9c18d..15ae07d 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/crostini_page/BUILD.gn
@@ -51,7 +51,7 @@ ":crostini_browser_proxy", "..:metrics_recorder", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", ] } @@ -78,7 +78,7 @@ ":crostini_browser_proxy", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", ] @@ -90,7 +90,7 @@ deps = [ ":crostini_browser_proxy", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", ] @@ -117,7 +117,7 @@ ":crostini_browser_proxy", "../guest_os:guest_os_browser_proxy", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", ] } @@ -174,7 +174,7 @@ "../guest_os:guest_os_browser_proxy", "../guest_os:guest_os_container_select", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/cr_elements/cr_input:cr_input.m", "//ui/webui/resources/js:cr.m", "//ui/webui/resources/js:i18n_behavior.m",
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_arc_adb_confirmation_dialog.js b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_arc_adb_confirmation_dialog.js index 0af1b19..b6ad4d2 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_arc_adb_confirmation_dialog.js +++ b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_arc_adb_confirmation_dialog.js
@@ -8,7 +8,7 @@ * reboot will happens. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../../settings_shared.css.js'; import {assertNotReached} from 'chrome://resources/js/assert.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_confirmation_dialog.js b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_confirmation_dialog.js index 03a61e2..410b50a 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_confirmation_dialog.js +++ b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_confirmation_dialog.js
@@ -13,7 +13,7 @@ * - The dialog shows itself automatically when it is attached. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../../settings_shared.css.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_disk_resize_confirmation_dialog.js b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_disk_resize_confirmation_dialog.js index 787b9014..773af41 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_disk_resize_confirmation_dialog.js +++ b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_disk_resize_confirmation_dialog.js
@@ -8,7 +8,7 @@ * By clicking 'Reserve size', the user agrees to start the operation. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../../settings_shared.css.js'; import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_disk_resize_dialog.js b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_disk_resize_dialog.js index f5160b3..fba455b 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_disk_resize_dialog.js +++ b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_disk_resize_dialog.js
@@ -8,7 +8,7 @@ * resizing their disk or converting it from sparse to preallocated. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import '../../settings_shared.css.js';
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_extra_containers_create_dialog.js b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_extra_containers_create_dialog.js index f29c8ba..bd1887c 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_extra_containers_create_dialog.js +++ b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_extra_containers_create_dialog.js
@@ -8,7 +8,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/md_select_css.m.js'; import '../../settings_shared.css.js';
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_import_confirmation_dialog.js b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_import_confirmation_dialog.js index 4d5153b..22c7135 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_import_confirmation_dialog.js +++ b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_import_confirmation_dialog.js
@@ -8,7 +8,7 @@ * By clicking 'Continue', the user agrees to start the import. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../../settings_shared.css.js'; import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_port_forwarding_add_port_dialog.js b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_port_forwarding_add_port_dialog.js index 319c50e..f7475a0 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_port_forwarding_add_port_dialog.js +++ b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_port_forwarding_add_port_dialog.js
@@ -9,7 +9,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/md_select_css.m.js'; import '../../settings_shared.css.js';
diff --git a/chrome/browser/resources/settings/chromeos/device_page/display_overscan_dialog.js b/chrome/browser/resources/settings/chromeos/device_page/display_overscan_dialog.js index 6f487f61..89cd2337 100644 --- a/chrome/browser/resources/settings/chromeos/device_page/display_overscan_dialog.js +++ b/chrome/browser/resources/settings/chromeos/device_page/display_overscan_dialog.js
@@ -9,7 +9,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn index 5d1d939..90bc91c 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn
@@ -40,7 +40,7 @@ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_components/chromeos/cellular_setup:cellular_setup.m", "//ui/webui/resources/cr_components/chromeos/cellular_setup:cellular_setup_delegate.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", ] } @@ -56,7 +56,7 @@ "//ui/webui/resources/cr_components/chromeos/network:network_config.m", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo.m", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:util.m", ] @@ -243,7 +243,7 @@ "//ui/webui/resources/cr_components/chromeos/network:cr_policy_network_indicator_mojo.m", "//ui/webui/resources/cr_components/chromeos/network:network_proxy.m", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", ] externs_list = [ "../settings_controls_types.js" ] @@ -287,7 +287,7 @@ "//ui/webui/resources/cr_components/chromeos/network:network_icon.m", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo.m", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", ] } @@ -334,7 +334,7 @@ deps = [ "//third_party/polymer/v3_0/components-chromium/paper-spinner:paper-spinner-lite", "//ui/webui/resources/cr_components/chromeos/cellular_setup:esim_manager_utils.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/cr_elements/cr_input:cr_input.m", "//ui/webui/resources/js:i18n_behavior.m", ] @@ -343,7 +343,7 @@ js_library("esim_rename_dialog") { deps = [ "//ui/webui/resources/cr_components/chromeos/cellular_setup:esim_manager_utils.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/cr_elements/cr_input:cr_input.m", "//ui/webui/resources/js:i18n_behavior.m", ] @@ -356,7 +356,7 @@ "//chrome/browser/resources/settings/chromeos:route_observer_behavior", "//ui/webui/resources/cr_components/chromeos/cellular_setup:esim_manager_utils.m", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/cr_elements/cr_input:cr_input.m", "//ui/webui/resources/js:i18n_behavior.m", ]
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/cellular_setup_dialog.js b/chrome/browser/resources/settings/chromeos/internet_page/cellular_setup_dialog.js index 8431515..8c2f435 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/cellular_setup_dialog.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/cellular_setup_dialog.js
@@ -7,7 +7,7 @@ * that is shared with OOBE in a dialog with OS Settings stylizations. */ import 'chrome://resources/cr_components/chromeos/cellular_setup/cellular_setup.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import '../../settings_shared.css.js';
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/esim_install_error_dialog.js b/chrome/browser/resources/settings/chromeos/internet_page/esim_install_error_dialog.js index 2d76b6b..43f5ae7 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/esim_install_error_dialog.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/esim_install_error_dialog.js
@@ -7,7 +7,7 @@ * profile, such as requiring a confirmation code. */ -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js';
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/esim_remove_profile_dialog.js b/chrome/browser/resources/settings/chromeos/internet_page/esim_remove_profile_dialog.js index 6ca4c78..8deb86f 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/esim_remove_profile_dialog.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/esim_remove_profile_dialog.js
@@ -7,7 +7,7 @@ */ import 'chrome://resources/cr_components/chromeos/cellular_setup/cellular_setup_icons.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {getESimProfile} from 'chrome://resources/cr_components/chromeos/cellular_setup/esim_manager_utils.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/esim_rename_dialog.js b/chrome/browser/resources/settings/chromeos/internet_page/esim_rename_dialog.js index b1d358f9..19fba0ae 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/esim_rename_dialog.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/esim_rename_dialog.js
@@ -7,7 +7,7 @@ */ import 'chrome://resources/cr_components/chromeos/cellular_setup/cellular_setup_icons.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js';
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/internet_config.js b/chrome/browser/resources/settings/chromeos/internet_page/internet_config.js index be9c309..cee5cf5c7 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/internet_config.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/internet_config.js
@@ -8,7 +8,7 @@ */ import 'chrome://resources/cr_components/chromeos/network/network_config.m.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js'; import './internet_shared_css.js';
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/network_proxy_section.js b/chrome/browser/resources/settings/chromeos/internet_page/network_proxy_section.js index 141bc78..7ce6c8b0 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/network_proxy_section.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/network_proxy_section.js
@@ -11,7 +11,7 @@ import 'chrome://resources/cr_components/chromeos/network/cr_policy_network_indicator_mojo.m.js'; import 'chrome://resources/cr_components/chromeos/network/network_proxy.m.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/hidden_style_css.m.js'; import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js'; import '../../controls/extension_controlled_indicator.js';
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/tether_connection_dialog.js b/chrome/browser/resources/settings/chromeos/internet_page/tether_connection_dialog.js index 0658046..654b071 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/tether_connection_dialog.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/tether_connection_dialog.js
@@ -4,7 +4,7 @@ import 'chrome://resources/cr_components/chromeos/network/network_icon.m.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import 'chrome://resources/mojo/chromeos/services/network_config/public/mojom/cros_network_config.mojom-lite.js'; import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js';
diff --git a/chrome/browser/resources/settings/chromeos/kerberos_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/kerberos_page/BUILD.gn index 766f682..120b53d 100644 --- a/chrome/browser/resources/settings/chromeos/kerberos_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/kerberos_page/BUILD.gn
@@ -50,7 +50,7 @@ ":kerberos_accounts_browser_proxy", "..:metrics_recorder", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/cr_elements/cr_input:cr_input.m", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:cr.m",
diff --git a/chrome/browser/resources/settings/chromeos/kerberos_page/kerberos_add_account_dialog.js b/chrome/browser/resources/settings/chromeos/kerberos_page/kerberos_add_account_dialog.js index e40ac96..6ce06e7 100644 --- a/chrome/browser/resources/settings/chromeos/kerberos_page/kerberos_add_account_dialog.js +++ b/chrome/browser/resources/settings/chromeos/kerberos_page/kerberos_add_account_dialog.js
@@ -9,7 +9,7 @@ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/cr_elements/policy/cr_policy_indicator.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_notification_access_setup_dialog.js b/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_notification_access_setup_dialog.js index fb8fa90..7360119 100644 --- a/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_notification_access_setup_dialog.js +++ b/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_notification_access_setup_dialog.js
@@ -10,7 +10,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import 'chrome://resources/cr_components/localized_link/localized_link.js';
diff --git a/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_permissions_setup_dialog.js b/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_permissions_setup_dialog.js index f4ad5e29..56a45f47 100644 --- a/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_permissions_setup_dialog.js +++ b/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_permissions_setup_dialog.js
@@ -11,7 +11,7 @@ import 'chrome://resources/cr_components/localized_link/localized_link.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
diff --git a/chrome/browser/resources/settings/chromeos/nearby_share_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/nearby_share_page/BUILD.gn index 9e2a542..910cb4f6 100644 --- a/chrome/browser/resources/settings/chromeos/nearby_share_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/nearby_share_page/BUILD.gn
@@ -41,7 +41,7 @@ "//chrome/browser/resources/nearby_share/shared:nearby_contact_visibility", "//chrome/browser/resources/nearby_share/shared:nearby_share_settings_behavior", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", ] } @@ -51,7 +51,7 @@ "//chrome/browser/resources/nearby_share/shared:nearby_share_settings", "//chrome/browser/resources/nearby_share/shared:nearby_share_settings_behavior", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/cr_elements/cr_radio_button:cr_radio_button.m", "//ui/webui/resources/cr_elements/cr_radio_group:cr_radio_group", "//ui/webui/resources/js:i18n_behavior.m", @@ -62,7 +62,7 @@ deps = [ "//chrome/browser/resources/nearby_share/shared:nearby_share_settings_behavior", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/cr_elements/cr_input:cr_input.m", "//ui/webui/resources/js:i18n_behavior.m", ] @@ -86,7 +86,7 @@ "//chrome/browser/resources/nearby_share/shared:nearby_share_settings_behavior", "//chrome/browser/resources/nearby_share/shared:nearby_visibility_page", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data", @@ -102,7 +102,7 @@ "//chrome/browser/resources/nearby_share/shared:nearby_share_settings_behavior", "//chrome/browser/ui/webui/nearby_share:mojom_js_library_for_compile", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", ] }
diff --git a/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_contact_visibility_dialog.js b/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_contact_visibility_dialog.js index 56da10a..48c21ec 100644 --- a/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_contact_visibility_dialog.js +++ b/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_contact_visibility_dialog.js
@@ -9,7 +9,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../../shared/nearby_onboarding_page.js'; import '../../shared/nearby_visibility_page.js';
diff --git a/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_data_usage_dialog.js b/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_data_usage_dialog.js index c51300ce..cda61206d 100644 --- a/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_data_usage_dialog.js +++ b/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_data_usage_dialog.js
@@ -9,7 +9,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_radio_button/cr_radio_button.m.js'; import 'chrome://resources/cr_elements/cr_radio_group/cr_radio_group.js';
diff --git a/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_device_name_dialog.js b/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_device_name_dialog.js index e79c9b6..d294284 100644 --- a/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_device_name_dialog.js +++ b/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_device_name_dialog.js
@@ -9,7 +9,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_receive_dialog.js b/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_receive_dialog.js index 9e277437..aa0292a 100644 --- a/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_receive_dialog.js +++ b/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_receive_dialog.js
@@ -20,7 +20,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../../prefs/prefs.js'; import '../../shared/nearby_onboarding_one_page.js'; import '../../shared/nearby_onboarding_page.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_a11y_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_a11y_page/BUILD.gn index 7ed5d4e..870f101 100644 --- a/chrome/browser/resources/settings/chromeos/os_a11y_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_a11y_page/BUILD.gn
@@ -47,7 +47,7 @@ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements:cr_scrollable_behavior.m", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", @@ -188,7 +188,7 @@ "//chrome/browser/resources/settings/chromeos:prefs_behavior", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", @@ -200,7 +200,7 @@ ":switch_access_constants", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", @@ -219,7 +219,7 @@ "//chrome/browser/resources/settings/chromeos:prefs_behavior", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", @@ -232,7 +232,7 @@ deps = [ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:i18n_behavior.m", ] }
diff --git a/chrome/browser/resources/settings/chromeos/os_a11y_page/change_dictation_locale_dialog.js b/chrome/browser/resources/settings/chromeos/os_a11y_page/change_dictation_locale_dialog.js index bbaafa8..ae1623f 100644 --- a/chrome/browser/resources/settings/chromeos/os_a11y_page/change_dictation_locale_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_a11y_page/change_dictation_locale_dialog.js
@@ -8,7 +8,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_scrollable_behavior.m.js'; import 'chrome://resources/cr_elements/cr_search_field/cr_search_field.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_action_assignment_dialog.js b/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_action_assignment_dialog.js index 210129cf..fb32dbb 100644 --- a/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_action_assignment_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_action_assignment_dialog.js
@@ -10,7 +10,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_action_assignment_pane.js b/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_action_assignment_pane.js index b5f43c5..2625330 100644 --- a/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_action_assignment_pane.js +++ b/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_action_assignment_pane.js
@@ -10,7 +10,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import '../os_icons.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_setup_guide_dialog.js b/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_setup_guide_dialog.js index abde114..2f86d77 100644 --- a/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_setup_guide_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_setup_guide_dialog.js
@@ -8,7 +8,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import '../../controls/settings_slider.js'; import '../os_icons.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_setup_guide_warning_dialog.js b/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_setup_guide_warning_dialog.js index 40880ef..eee4425 100644 --- a/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_setup_guide_warning_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_setup_guide_warning_dialog.js
@@ -8,7 +8,7 @@ * existing switches. By clicking 'Continue', the user acknowledges that. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../../settings_shared.css.js'; import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_about_page/channel_switcher_dialog.ts b/chrome/browser/resources/settings/chromeos/os_about_page/channel_switcher_dialog.ts index aa43efc..a8222db 100644 --- a/chrome/browser/resources/settings/chromeos/os_about_page/channel_switcher_dialog.ts +++ b/chrome/browser/resources/settings/chromeos/os_about_page/channel_switcher_dialog.ts
@@ -10,13 +10,13 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_radio_button/cr_radio_button.m.js'; import 'chrome://resources/cr_elements/cr_radio_group/cr_radio_group.js'; import 'chrome://resources/polymer/v3_0/iron-selector/iron-selector.js'; import '../../settings_shared.css.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {IronSelectorElement} from 'chrome://resources/polymer/v3_0/iron-selector/iron-selector.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_about_page/consumer_auto_update_toggle_dialog.ts b/chrome/browser/resources/settings/chromeos/os_about_page/consumer_auto_update_toggle_dialog.ts index 85a729b..b9711d2 100644 --- a/chrome/browser/resources/settings/chromeos/os_about_page/consumer_auto_update_toggle_dialog.ts +++ b/chrome/browser/resources/settings/chromeos/os_about_page/consumer_auto_update_toggle_dialog.ts
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getTemplate} from './consumer_auto_update_toggle_dialog.html.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_about_page/edit_hostname_dialog.ts b/chrome/browser/resources/settings/chromeos/os_about_page/edit_hostname_dialog.ts index d0ff186..5fa2d03 100644 --- a/chrome/browser/resources/settings/chromeos/os_about_page/edit_hostname_dialog.ts +++ b/chrome/browser/resources/settings/chromeos/os_about_page/edit_hostname_dialog.ts
@@ -7,14 +7,14 @@ * user to edit the device hostname. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/cr_radio_button/cr_radio_button.m.js'; import 'chrome://resources/cr_elements/cr_radio_group/cr_radio_group.js'; import 'chrome://resources/polymer/v3_0/iron-selector/iron-selector.js'; import '../../settings_shared.css.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin, I18nMixinInterface} from 'chrome://resources/js/i18n_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_about_page/update_warning_dialog.ts b/chrome/browser/resources/settings/chromeos/os_about_page/update_warning_dialog.ts index c2fe99ab..7616f20 100644 --- a/chrome/browser/resources/settings/chromeos/os_about_page/update_warning_dialog.ts +++ b/chrome/browser/resources/settings/chromeos/os_about_page/update_warning_dialog.ts
@@ -8,10 +8,10 @@ * agrees to download update using mobile data. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../../settings_shared.css.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin, I18nMixinInterface} from 'chrome://resources/js/i18n_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/android_apps_subpage.js b/chrome/browser/resources/settings/chromeos/os_apps_page/android_apps_subpage.js index 057ddb5..b8063f77 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/android_apps_subpage.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/android_apps_subpage.js
@@ -8,7 +8,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_link_row/cr_link_row.js'; import '../../settings_shared.css.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn index 5ce48ec..f6afb557 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn
@@ -227,7 +227,7 @@ js_library("supported_links_overlapping_apps_dialog") { deps = [ ":store_client", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:i18n_behavior.m", ] @@ -239,7 +239,7 @@ ":browser_proxy", ":store_client", "//third_party/polymer/v3_0/components-chromium/iron-list:iron-list", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", ] }
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_dialog.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_dialog.js index d88096e..eb402f8 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_dialog.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_overlapping_apps_dialog.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_overlapping_apps_dialog.js index 5385c497..d21b94d5 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_overlapping_apps_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_overlapping_apps_dialog.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert.m.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/BUILD.gn index c5db97e..60994086 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/BUILD.gn
@@ -162,21 +162,21 @@ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_components/chromeos/bluetooth:bluetooth_metrics_utils", "//ui/webui/resources/cr_components/chromeos/bluetooth:bluetooth_pairing_ui", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", ] } js_library("os_remove_saved_device_dialog") { deps = [ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", ] } js_library("os_bluetooth_forget_device_dialog") { deps = [ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", ] }
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_languages_page/BUILD.gn index 8b7d7fa..2aa300c 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/BUILD.gn
@@ -90,7 +90,7 @@ "//ui/webui/resources/cr_elements:find_shortcut_behavior", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", "//ui/webui/resources/cr_elements/cr_checkbox:cr_checkbox", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", ] externs_list = [ "//ui/webui/resources/cr_elements/cr_search_field/cr_search_field_externs.js" ] }
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/add_items_dialog.js b/chrome/browser/resources/settings/chromeos/os_languages_page/add_items_dialog.js index 7abf496..390a93ad 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/add_items_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/add_items_dialog.js
@@ -9,7 +9,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_search_field/cr_search_field.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js'; import 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; import './cr_checkbox_with_policy.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/change_device_language_dialog.js b/chrome/browser/resources/settings/chromeos/os_languages_page/change_device_language_dialog.js index 9bf8d60c..3718a25 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/change_device_language_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/change_device_language_dialog.js
@@ -8,7 +8,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_search_field/cr_search_field.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js'; import 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; import 'chrome://resources/polymer/v3_0/paper-ripple/paper-ripple.js'; @@ -178,12 +178,14 @@ assert(this.selectedLanguage_); const languageCode = this.selectedLanguage_.code; this.languageHelper.setProspectiveUILanguage(languageCode); - // If the language isn't enabled yet, it should be added and moved to top. - // If it's already present, we don't do anything. + // If the language isn't enabled yet, it should be added. if (!this.languageHelper.isLanguageEnabled(languageCode)) { this.languageHelper.enableLanguage(languageCode); - this.languageHelper.moveLanguageToFront(languageCode); } + // The new language should always be moved to the top, as users get confused + // that websites are displaying in a different language: + // https://crbug.com/1330209 + this.languageHelper.moveLanguageToFront(languageCode); recordSettingChange(); LanguagesMetricsProxyImpl.getInstance().recordInteraction( LanguagesPageInteraction.RESTART);
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn index d740ee4..ad9fa64 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn
@@ -211,7 +211,7 @@ js_library("users_add_user_dialog") { deps = [ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:i18n_behavior.m", ]
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/pin_autosubmit_dialog.js b/chrome/browser/resources/settings/chromeos/os_people_page/pin_autosubmit_dialog.js index b1815697..8912f28 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/pin_autosubmit_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_people_page/pin_autosubmit_dialog.js
@@ -12,7 +12,7 @@ import 'chrome://resources/cr_components/chromeos/quick_unlock/setup_pin_keyboard.m.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/js/assert.m.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import '../../settings_shared.css.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/setup_fingerprint_dialog.js b/chrome/browser/resources/settings/chromeos/os_people_page/setup_fingerprint_dialog.js index c32770d8..65abf5fd 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/setup_fingerprint_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_people_page/setup_fingerprint_dialog.js
@@ -5,7 +5,7 @@ import 'chrome://resources/cr_elements/cr_lottie/cr_lottie.m.js'; import 'chrome://resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../../settings_shared.css.js'; import {assertNotReached} from 'chrome://resources/js/assert.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/setup_pin_dialog.js b/chrome/browser/resources/settings/chromeos/os_people_page/setup_pin_dialog.js index 6549a398..021ff23 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/setup_pin_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_people_page/setup_pin_dialog.js
@@ -13,7 +13,7 @@ import 'chrome://resources/cr_components/chromeos/quick_unlock/setup_pin_keyboard.m.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../../settings_shared.css.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/users_add_user_dialog.js b/chrome/browser/resources/settings/chromeos/os_people_page/users_add_user_dialog.js index f3a4669..79c5c47 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/users_add_user_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_people_page/users_add_user_dialog.js
@@ -9,7 +9,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import '../../settings_shared.css.js'; import '../../settings_vars.css.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_printing_page/cups_add_printer_dialog.js b/chrome/browser/resources/settings/chromeos/os_printing_page/cups_add_printer_dialog.js index e6c7d81d..dc5cc33 100644 --- a/chrome/browser/resources/settings/chromeos/os_printing_page/cups_add_printer_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_printing_page/cups_add_printer_dialog.js
@@ -6,7 +6,7 @@ * @fileoverview 'add-printer-dialog' is the template of the Add Printer * dialog. */ -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import './cups_printer_shared_css.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_privacy_page/os_privacy_page.js b/chrome/browser/resources/settings/chromeos/os_privacy_page/os_privacy_page.js index 5d68d4a..0e8f65be 100644 --- a/chrome/browser/resources/settings/chromeos/os_privacy_page/os_privacy_page.js +++ b/chrome/browser/resources/settings/chromeos/os_privacy_page/os_privacy_page.js
@@ -9,7 +9,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_link_row/cr_link_row.js'; import 'chrome://resources/polymer/v3_0/paper-spinner/paper-spinner-lite.js'; import './peripheral_data_access_protection_dialog.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_privacy_page/peripheral_data_access_protection_dialog.js b/chrome/browser/resources/settings/chromeos/os_privacy_page/peripheral_data_access_protection_dialog.js index da07fa0..78ed167 100644 --- a/chrome/browser/resources/settings/chromeos/os_privacy_page/peripheral_data_access_protection_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_privacy_page/peripheral_data_access_protection_dialog.js
@@ -8,7 +8,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/paper-progress/paper-progress.js'; import '../../settings_shared.css.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_reset_page/os_powerwash_dialog.js b/chrome/browser/resources/settings/chromeos/os_reset_page/os_powerwash_dialog.js index 12fa7c8..0d9217c1 100644 --- a/chrome/browser/resources/settings/chromeos/os_reset_page/os_powerwash_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_reset_page/os_powerwash_dialog.js
@@ -9,7 +9,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; import 'chrome://resources/cr_components/localized_link/localized_link.js'; import '../../settings_shared.css.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_search_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_search_page/BUILD.gn index 0f7f6bc1..f7f1d54 100644 --- a/chrome/browser/resources/settings/chromeos/os_search_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_search_page/BUILD.gn
@@ -40,7 +40,7 @@ "//chrome/browser/resources/settings/chromeos/os_search_page:search_engines_browser_proxy", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:cr.m", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data.m",
diff --git a/chrome/browser/resources/settings/chromeos/os_search_page/os_search_selection_dialog.js b/chrome/browser/resources/settings/chromeos/os_search_page/os_search_selection_dialog.js index 8f0e0d0..69c4bb0 100644 --- a/chrome/browser/resources/settings/chromeos/os_search_page/os_search_selection_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_search_page/os_search_selection_dialog.js
@@ -7,7 +7,7 @@ * the preferred search engine. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/md_select_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import '../../settings_shared.css.js';
diff --git a/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.ts b/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.ts index d8bc44d5..7dd4dbd 100644 --- a/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.ts +++ b/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.ts
@@ -8,7 +8,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_tabs/cr_tabs.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import 'chrome://resources/polymer/v3_0/iron-pages/iron-pages.js'; @@ -21,7 +21,7 @@ import '../settings_shared.css.js'; import {getInstance as getAnnouncerInstance} from 'chrome://resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {I18nMixin, I18nMixinInterface} from 'chrome://resources/js/i18n_mixin.js'; import {WebUIListenerMixin, WebUIListenerMixinInterface} from 'chrome://resources/js/web_ui_listener_mixin.js';
diff --git a/chrome/browser/resources/settings/clear_browsing_data_dialog/history_deletion_dialog.ts b/chrome/browser/resources/settings/clear_browsing_data_dialog/history_deletion_dialog.ts index 2da47bda..3828757 100644 --- a/chrome/browser/resources/settings/clear_browsing_data_dialog/history_deletion_dialog.ts +++ b/chrome/browser/resources/settings/clear_browsing_data_dialog/history_deletion_dialog.ts
@@ -9,10 +9,10 @@ * of browsing history in their account. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../settings_shared.css.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getTemplate} from './history_deletion_dialog.html.js';
diff --git a/chrome/browser/resources/settings/clear_browsing_data_dialog/passwords_deletion_dialog.ts b/chrome/browser/resources/settings/clear_browsing_data_dialog/passwords_deletion_dialog.ts index 95395b1..8ea355c 100644 --- a/chrome/browser/resources/settings/clear_browsing_data_dialog/passwords_deletion_dialog.ts +++ b/chrome/browser/resources/settings/clear_browsing_data_dialog/passwords_deletion_dialog.ts
@@ -9,10 +9,10 @@ * successfully. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../settings_shared.css.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getTemplate} from './passwords_deletion_dialog.html.js';
diff --git a/chrome/browser/resources/settings/controls/password_prompt_dialog.ts b/chrome/browser/resources/settings/controls/password_prompt_dialog.ts index 504c31059..e9978991 100644 --- a/chrome/browser/resources/settings/controls/password_prompt_dialog.ts +++ b/chrome/browser/resources/settings/controls/password_prompt_dialog.ts
@@ -20,12 +20,12 @@ */ import '//resources/cr_elements/cr_button/cr_button.m.js'; -import '//resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import '//resources/cr_elements/cr_dialog/cr_dialog.js'; import '//resources/cr_elements/cr_input/cr_input.m.js'; import '//resources/cr_elements/shared_style_css.m.js'; import '../settings_shared.css.js'; -import {CrDialogElement} from '//resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from '//resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from '//resources/cr_elements/cr_input/cr_input.m.js'; import {PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/languages_page/add_languages_dialog.ts b/chrome/browser/resources/settings/languages_page/add_languages_dialog.ts index 3684324..6be6124 100644 --- a/chrome/browser/resources/settings/languages_page/add_languages_dialog.ts +++ b/chrome/browser/resources/settings/languages_page/add_languages_dialog.ts
@@ -8,14 +8,14 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_search_field/cr_search_field.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; import '../settings_shared.css.js'; import {CrCheckboxElement} from 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrScrollableBehavior} from 'chrome://resources/cr_elements/cr_scrollable_behavior.m.js'; import {CrSearchFieldElement} from 'chrome://resources/cr_elements/cr_search_field/cr_search_field.js'; import {FindShortcutMixin, FindShortcutMixinInterface} from 'chrome://resources/cr_elements/find_shortcut_mixin.js';
diff --git a/chrome/browser/resources/settings/lazy_load.ts b/chrome/browser/resources/settings/lazy_load.ts index aa0f0b84..28464cc 100644 --- a/chrome/browser/resources/settings/lazy_load.ts +++ b/chrome/browser/resources/settings/lazy_load.ts
@@ -70,7 +70,7 @@ // </if> export {CrCheckboxElement} from 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -export {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +export {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; export {CrIconButtonElement} from 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; export {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; export {CrSliderElement} from 'chrome://resources/cr_elements/cr_slider/cr_slider.js';
diff --git a/chrome/browser/resources/settings/on_startup_page/startup_url_dialog.ts b/chrome/browser/resources/settings/on_startup_page/startup_url_dialog.ts index e7512fa..75d86e7 100644 --- a/chrome/browser/resources/settings/on_startup_page/startup_url_dialog.ts +++ b/chrome/browser/resources/settings/on_startup_page/startup_url_dialog.ts
@@ -3,12 +3,12 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import '../settings_shared.css.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/people_page/import_data_dialog.ts b/chrome/browser/resources/settings/people_page/import_data_dialog.ts index 64cfbfd..2d8b89d 100644 --- a/chrome/browser/resources/settings/people_page/import_data_dialog.ts +++ b/chrome/browser/resources/settings/people_page/import_data_dialog.ts
@@ -7,7 +7,7 @@ * bookmarks and other data from other sources. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/md_select_css.m.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import 'chrome://resources/polymer/v3_0/paper-spinner/paper-spinner-lite.js'; @@ -18,7 +18,7 @@ import '../i18n_setup.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {WebUIListenerMixin} from 'chrome://resources/js/web_ui_listener_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/people_page/signout_dialog.ts b/chrome/browser/resources/settings/people_page/signout_dialog.ts index b327b16..78ed8fdb 100644 --- a/chrome/browser/resources/settings/people_page/signout_dialog.ts +++ b/chrome/browser/resources/settings/people_page/signout_dialog.ts
@@ -8,7 +8,7 @@ */ import '//resources/cr_elements/cr_button/cr_button.m.js'; import '//resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import '//resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import '//resources/cr_elements/cr_dialog/cr_dialog.js'; import '//resources/cr_elements/cr_expand_button/cr_expand_button.js'; import '//resources/cr_elements/shared_style_css.m.js'; import '//resources/cr_elements/shared_vars_css.m.js'; @@ -16,7 +16,7 @@ import '//resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js'; import '../settings_shared.css.js'; -import {CrDialogElement} from '//resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from '//resources/cr_elements/cr_dialog/cr_dialog.js'; import {WebUIListenerMixin} from '//resources/js/web_ui_listener_mixin.js'; import {microTask, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/people_page/sync_page.ts b/chrome/browser/resources/settings/people_page/sync_page.ts index ad7f435..324fb39 100644 --- a/chrome/browser/resources/settings/people_page/sync_page.ts +++ b/chrome/browser/resources/settings/people_page/sync_page.ts
@@ -4,7 +4,7 @@ import '//resources/js/util.m.js'; import '//resources/cr_elements/cr_button/cr_button.m.js'; -import '//resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import '//resources/cr_elements/cr_dialog/cr_dialog.js'; import '//resources/cr_elements/cr_input/cr_input.m.js'; import '//resources/cr_elements/cr_link_row/cr_link_row.js'; import '//resources/cr_elements/icons.m.js'; @@ -24,7 +24,7 @@ // </if> -import {CrDialogElement} from '//resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from '//resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from '//resources/cr_elements/cr_input/cr_input.m.js'; import {assert, assertNotReached} from '//resources/js/assert_ts.js'; import {focusWithoutInk} from '//resources/js/cr/ui/focus_without_ink.m.js';
diff --git a/chrome/browser/resources/settings/privacy_page/disable_safebrowsing_dialog.ts b/chrome/browser/resources/settings/privacy_page/disable_safebrowsing_dialog.ts index e648813..cade595 100644 --- a/chrome/browser/resources/settings/privacy_page/disable_safebrowsing_dialog.ts +++ b/chrome/browser/resources/settings/privacy_page/disable_safebrowsing_dialog.ts
@@ -7,10 +7,10 @@ * 'disable-safebrowsing-dialog' makes sure users want to disable safebrowsing. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getTemplate} from './disable_safebrowsing_dialog.html.js';
diff --git a/chrome/browser/resources/settings/privacy_page/do_not_track_toggle.ts b/chrome/browser/resources/settings/privacy_page/do_not_track_toggle.ts index 1baf13b..429c742 100644 --- a/chrome/browser/resources/settings/privacy_page/do_not_track_toggle.ts +++ b/chrome/browser/resources/settings/privacy_page/do_not_track_toggle.ts
@@ -3,7 +3,7 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import '../settings_shared.css.js'; import '../controls/settings_toggle_button.js';
diff --git a/chrome/browser/resources/settings/privacy_page/security_keys_bio_enroll_dialog.ts b/chrome/browser/resources/settings/privacy_page/security_keys_bio_enroll_dialog.ts index 2687b7a..f63f7ad 100644 --- a/chrome/browser/resources/settings/privacy_page/security_keys_bio_enroll_dialog.ts +++ b/chrome/browser/resources/settings/privacy_page/security_keys_bio_enroll_dialog.ts
@@ -9,7 +9,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; @@ -23,7 +23,7 @@ import {getInstance as getAnnouncerInstance} from 'chrome://resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrFingerprintProgressArcElement} from 'chrome://resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {assert, assertNotReached} from 'chrome://resources/js/assert_ts.js';
diff --git a/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.ts b/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.ts index c223a2e..ef9bf21 100644 --- a/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.ts +++ b/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.ts
@@ -9,7 +9,7 @@ import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; import 'chrome://resources/polymer/v3_0/iron-pages/iron-pages.js'; import 'chrome://resources/polymer/v3_0/paper-spinner/paper-spinner-lite.js'; @@ -19,7 +19,7 @@ import './security_keys_pin_field.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrIconButtonElement} from 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {assert, assertNotReached} from 'chrome://resources/js/assert_ts.js';
diff --git a/chrome/browser/resources/settings/privacy_page/security_keys_phones_dialog.ts b/chrome/browser/resources/settings/privacy_page/security_keys_phones_dialog.ts index 6c0c79d..8c369004 100644 --- a/chrome/browser/resources/settings/privacy_page/security_keys_phones_dialog.ts +++ b/chrome/browser/resources/settings/privacy_page/security_keys_phones_dialog.ts
@@ -7,11 +7,11 @@ for use as a security key. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/privacy_page/security_keys_reset_dialog.ts b/chrome/browser/resources/settings/privacy_page/security_keys_reset_dialog.ts index bb543c4..d1453975 100644 --- a/chrome/browser/resources/settings/privacy_page/security_keys_reset_dialog.ts +++ b/chrome/browser/resources/settings/privacy_page/security_keys_reset_dialog.ts
@@ -8,13 +8,13 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/iron-pages/iron-pages.js'; import 'chrome://resources/polymer/v3_0/paper-spinner/paper-spinner-lite.js'; import '../settings_shared.css.js'; import '../i18n_setup.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.ts b/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.ts index b24d6401..87c947bab 100644 --- a/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.ts +++ b/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.ts
@@ -8,7 +8,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; import 'chrome://resources/cr_elements/cr_icons_css.m.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; @@ -18,7 +18,7 @@ import '../i18n_setup.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {PluralStringProxyImpl} from 'chrome://resources/js/plural_string_proxy.js';
diff --git a/chrome/browser/resources/settings/relaunch_confirmation_dialog.ts b/chrome/browser/resources/settings/relaunch_confirmation_dialog.ts index 41b82ae6..789ac90c 100644 --- a/chrome/browser/resources/settings/relaunch_confirmation_dialog.ts +++ b/chrome/browser/resources/settings/relaunch_confirmation_dialog.ts
@@ -3,10 +3,10 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assertNotReached} from 'chrome://resources/js/assert_ts.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/reset_page/reset_profile_banner.ts b/chrome/browser/resources/settings/reset_page/reset_profile_banner.ts index 7324e97..a578f0d 100644 --- a/chrome/browser/resources/settings/reset_page/reset_profile_banner.ts +++ b/chrome/browser/resources/settings/reset_page/reset_profile_banner.ts
@@ -8,9 +8,9 @@ * clear profile settings. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {routes} from '../route.js';
diff --git a/chrome/browser/resources/settings/reset_page/reset_profile_dialog.ts b/chrome/browser/resources/settings/reset_page/reset_profile_dialog.ts index 8357b05..7848d7ba 100644 --- a/chrome/browser/resources/settings/reset_page/reset_profile_dialog.ts +++ b/chrome/browser/resources/settings/reset_page/reset_profile_dialog.ts
@@ -12,7 +12,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/js/action_link.js'; import 'chrome://resources/cr_elements/action_link_css.m.js'; import 'chrome://resources/polymer/v3_0/paper-spinner/paper-spinner-lite.js'; @@ -20,7 +20,7 @@ import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import {CrCheckboxElement} from 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {PaperSpinnerLiteElement} from 'chrome://resources/polymer/v3_0/paper-spinner/paper-spinner-lite.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/search_engines_page/search_engine_delete_confirmation_dialog.ts b/chrome/browser/resources/settings/search_engines_page/search_engine_delete_confirmation_dialog.ts index 95b514f6..5d0f2ca 100644 --- a/chrome/browser/resources/settings/search_engines_page/search_engine_delete_confirmation_dialog.ts +++ b/chrome/browser/resources/settings/search_engines_page/search_engine_delete_confirmation_dialog.ts
@@ -7,10 +7,10 @@ * component for confirming that the user wants to delete a search engine. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {WebUIListenerMixin} from 'chrome://resources/js/web_ui_listener_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/search_engines_page/search_engine_edit_dialog.ts b/chrome/browser/resources/settings/search_engines_page/search_engine_edit_dialog.ts index fdcf18b..bb830cd 100644 --- a/chrome/browser/resources/settings/search_engines_page/search_engine_edit_dialog.ts +++ b/chrome/browser/resources/settings/search_engines_page/search_engine_edit_dialog.ts
@@ -7,11 +7,11 @@ * or editing a search engine entry. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {WebUIListenerMixin} from 'chrome://resources/js/web_ui_listener_mixin.js'; import {microTask, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/site_settings/add_site_dialog.ts b/chrome/browser/resources/settings/site_settings/add_site_dialog.ts index 93114f8..c01469fa 100644 --- a/chrome/browser/resources/settings/site_settings/add_site_dialog.ts +++ b/chrome/browser/resources/settings/site_settings/add_site_dialog.ts
@@ -9,13 +9,13 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import '../settings_shared.css.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import {CrCheckboxElement} from 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/site_settings/all_sites.ts b/chrome/browser/resources/settings/site_settings/all_sites.ts index b38bb98b..3ffd88ce 100644 --- a/chrome/browser/resources/settings/site_settings/all_sites.ts +++ b/chrome/browser/resources/settings/site_settings/all_sites.ts
@@ -8,7 +8,7 @@ * Site Settings. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.js'; import 'chrome://resources/cr_elements/cr_search_field/cr_search_field.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; @@ -21,7 +21,7 @@ import './site_entry.js'; import {CrActionMenuElement} from 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrLazyRenderElement} from 'chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {I18nMixin, I18nMixinInterface} from 'chrome://resources/js/i18n_mixin.js';
diff --git a/chrome/browser/resources/settings/site_settings/edit_exception_dialog.ts b/chrome/browser/resources/settings/site_settings/edit_exception_dialog.ts index 2fc7a46..75b6db51 100644 --- a/chrome/browser/resources/settings/site_settings/edit_exception_dialog.ts +++ b/chrome/browser/resources/settings/site_settings/edit_exception_dialog.ts
@@ -7,11 +7,11 @@ * site exception entry. */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {SITE_EXCEPTION_WILDCARD} from './constants.js';
diff --git a/chrome/browser/resources/settings/site_settings/site_data.ts b/chrome/browser/resources/settings/site_settings/site_data.ts index 95c0dd4..733609f4 100644 --- a/chrome/browser/resources/settings/site_settings/site_data.ts +++ b/chrome/browser/resources/settings/site_settings/site_data.ts
@@ -8,7 +8,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_search_field/cr_search_field.js'; import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; @@ -18,7 +18,7 @@ import '../settings_shared.css.js'; import './site_data_entry.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {focusWithoutInk} from 'chrome://resources/js/cr/ui/focus_without_ink.m.js'; import {ListPropertyUpdateMixin} from 'chrome://resources/js/list_property_update_mixin.js';
diff --git a/chrome/browser/resources/settings/site_settings/site_details.ts b/chrome/browser/resources/settings/site_settings/site_details.ts index 950f2aa5..9da7a87 100644 --- a/chrome/browser/resources/settings/site_settings/site_details.ts +++ b/chrome/browser/resources/settings/site_settings/site_details.ts
@@ -9,7 +9,7 @@ */ import 'chrome://resources/js/action_link.js'; import 'chrome://resources/cr_elements/action_link_css.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; import 'chrome://resources/cr_elements/cr_link_row/cr_link_row.js'; @@ -23,7 +23,7 @@ import './clear_storage_dialog_shared.css.js'; import './site_details_permission.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {focusWithoutInk} from 'chrome://resources/js/cr/ui/focus_without_ink.m.js'; import {I18nMixin, I18nMixinInterface} from 'chrome://resources/js/i18n_mixin.js';
diff --git a/chrome/browser/resources/signin/profile_picker/profile_card_menu.ts b/chrome/browser/resources/signin/profile_picker/profile_card_menu.ts index 8bea43a..31295b21 100644 --- a/chrome/browser/resources/signin/profile_picker/profile_card_menu.ts +++ b/chrome/browser/resources/signin/profile_picker/profile_card_menu.ts
@@ -5,14 +5,14 @@ import 'chrome://resources/cr_elements/action_link_css.m.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; import 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/hidden_style_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import 'chrome://resources/js/action_link.js'; import './profile_picker_shared.css.js'; import {CrActionMenuElement} from 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assertNotReached} from 'chrome://resources/js/assert.m.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; // <if expr="chromeos_lacros">
diff --git a/chrome/browser/resources/signin/profile_picker/profile_creation_flow/local_profile_customization.ts b/chrome/browser/resources/signin/profile_picker/profile_creation_flow/local_profile_customization.ts index ed3a417..bd87eb6 100644 --- a/chrome/browser/resources/signin/profile_picker/profile_creation_flow/local_profile_customization.ts +++ b/chrome/browser/resources/signin/profile_picker/profile_creation_flow/local_profile_customization.ts
@@ -4,7 +4,7 @@ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js'; @@ -17,7 +17,7 @@ import {Theme, ThemeInfo, ThemeType} from 'chrome://resources/cr_components/customize_themes/customize_themes.mojom-webui.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {AvatarIcon} from 'chrome://resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js';
diff --git a/chrome/browser/resources/webui_gallery/demos/cr_dialog_demo_component.ts b/chrome/browser/resources/webui_gallery/demos/cr_dialog_demo_component.ts index f4161d4..a14d7ad 100644 --- a/chrome/browser/resources/webui_gallery/demos/cr_dialog_demo_component.ts +++ b/chrome/browser/resources/webui_gallery/demos/cr_dialog_demo_component.ts
@@ -3,13 +3,13 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import {PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {getTemplate} from './cr_dialog_demo_component.html.js';
diff --git a/chrome/browser/segmentation_platform/segmentation_platform_config.cc b/chrome/browser/segmentation_platform/segmentation_platform_config.cc index 33e198d..1f46c56 100644 --- a/chrome/browser/segmentation_platform/segmentation_platform_config.cc +++ b/chrome/browser/segmentation_platform/segmentation_platform_config.cc
@@ -72,11 +72,10 @@ constexpr int kQueryTilesDefaultUnknownTTLDays = 7; #endif // BUILDFLAG(IS_ANDROID) -#define SEGMENT_ID_ENTRY(segment) \ - { \ - segment, Config::SegmentMetadata { \ - stats::OptimizationTargetToHistogramVariant(segment) \ - } \ +#define SEGMENT_ID_ENTRY(segment) \ + { \ + segment, std::make_unique<Config::SegmentMetadata>( \ + stats::OptimizationTargetToHistogramVariant(segment)) \ } #if BUILDFLAG(IS_ANDROID) @@ -93,11 +92,12 @@ // Do not set unknown TTL so that the platform ignores unknown results. // A hardcoded list of segment IDs known to the segmentation platform. - config->segments = { - SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB), - SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_SHARE), - SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_VOICE), - }; + config->segments.insert( + SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB)); + config->segments.insert( + SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_SHARE)); + config->segments.insert( + SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_VOICE)); return config; } @@ -108,9 +108,8 @@ config->segmentation_key = kDummySegmentationKey; config->segmentation_uma_name = stats::SegmentationKeyToUmaName(config->segmentation_key); - config->segments = { - SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_DUMMY), - }; + config->segments.insert( + SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_DUMMY)); config->segment_selection_ttl = base::Days(kDummyFeatureSelectionTTLDays); config->unknown_selection_ttl = base::Days(kDummyFeatureSelectionTTLDays); return config; @@ -131,10 +130,8 @@ config->segmentation_key = kChromeStartAndroidSegmentationKey; config->segmentation_uma_name = stats::SegmentationKeyToUmaName(config->segmentation_key); - config->segments = { - SEGMENT_ID_ENTRY( - SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_CHROME_START_ANDROID), - }; + config->segments.insert(SEGMENT_ID_ENTRY( + SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_CHROME_START_ANDROID)); int segment_selection_ttl_days = base::GetFieldTrialParamByFeatureAsInt( chrome::android::kStartSurfaceAndroid, "segment_selection_ttl_days", @@ -162,9 +159,8 @@ config->segmentation_key = kQueryTilesSegmentationKey; config->segmentation_uma_name = stats::SegmentationKeyToUmaName(config->segmentation_key); - config->segments = { - SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_QUERY_TILES), - }; + config->segments.insert(SEGMENT_ID_ENTRY( + SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_QUERY_TILES)); int segment_selection_ttl_days = base::GetFieldTrialParamByFeatureAsInt( query_tiles::features::kQueryTilesSegmentation, @@ -241,11 +237,8 @@ config->segmentation_key = kChromeLowUserEngagementSegmentationKey; config->segmentation_uma_name = stats::SegmentationKeyToUmaName(config->segmentation_key); - config->segments = { - SEGMENT_ID_ENTRY( - SegmentId:: - OPTIMIZATION_TARGET_SEGMENTATION_CHROME_LOW_USER_ENGAGEMENT), - }; + config->segments.insert(SEGMENT_ID_ENTRY( + SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_CHROME_LOW_USER_ENGAGEMENT)); #if BUILDFLAG(IS_ANDROID) int segment_selection_ttl_days = base::GetFieldTrialParamByFeatureAsInt( @@ -267,9 +260,8 @@ config->segmentation_key = kFeedUserSegmentationKey; config->segmentation_uma_name = stats::SegmentationKeyToUmaName(config->segmentation_key); - config->segments = { - SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_FEED_USER), - }; + config->segments.insert( + SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_FEED_USER)); config->segment_selection_ttl = base::Days(base::GetFieldTrialParamByFeatureAsInt( features::kSegmentationPlatformFeedSegmentFeature,
diff --git a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.cc b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.cc index c431195..bc9941a 100644 --- a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.cc +++ b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.cc
@@ -147,10 +147,10 @@ ZeroStateDriveProvider::ZeroStateDriveProvider( Profile* profile, SearchController* search_controller, + drive::DriveIntegrationService* drive_service, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) : profile_(profile), - drive_service_( - drive::DriveIntegrationServiceFactory::GetForProfile(profile)), + drive_service_(drive_service), session_manager_(session_manager::SessionManager::Get()), construction_time_(base::Time::Now()), item_suggest_cache_(
diff --git a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.h b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.h index 3b7a026..b92ceb92 100644 --- a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.h +++ b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.h
@@ -36,6 +36,7 @@ ZeroStateDriveProvider( Profile* profile, SearchController* search_controller, + drive::DriveIntegrationService* drive_service, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory); ~ZeroStateDriveProvider() override;
diff --git a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider_unittest.cc b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider_unittest.cc index 5c69d3f..c082417 100644 --- a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider_unittest.cc +++ b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider_unittest.cc
@@ -27,8 +27,10 @@ protected: void SetUp() override { profile_ = std::make_unique<TestingProfile>(); - provider_ = std::make_unique<ZeroStateDriveProvider>(profile_.get(), - nullptr, nullptr); + provider_ = std::make_unique<ZeroStateDriveProvider>( + profile_.get(), nullptr, + drive::DriveIntegrationServiceFactory::GetForProfile(profile_.get()), + nullptr); session_manager_ = std::make_unique<session_manager::SessionManager>(); provider_->set_session_manager_for_testing(session_manager_.get()); }
diff --git a/chrome/browser/ui/app_list/search/games/game_result.cc b/chrome/browser/ui/app_list/search/games/game_result.cc index c1543efa..aefee10 100644 --- a/chrome/browser/ui/app_list/search/games/game_result.cc +++ b/chrome/browser/ui/app_list/search/games/game_result.cc
@@ -162,26 +162,28 @@ return; } + // All icons must be circles and set on a white background. The white + // background will only affect images with transparent backgrounds. + gfx::ImageSkia icon; if (is_icon_masking_allowed_) { - // TODO(crbug.com/1305880): Check that this is set in unit tests. This - // relies on the AppDiscoveryService. - SetIcon(IconInfo(image, GetAppIconDimension(), IconShape::kCircle)); - return; + // Create a circle that is large enough to cover the image. Images are + // expected to be squares of an even dimension. + const int radius = std::max(image.height(), image.width()) / 2; + icon = gfx::ImageSkiaOperations::CreateImageWithCircleBackground( + radius, SK_ColorWHITE, image); + } else { + // If icon masking is not allowed, resize the image to fit. + const int radius = dimension_ / 2; + const int size = MaxSquareLengthForRadius(radius); + const gfx::ImageSkia resized_image = + gfx::ImageSkiaOperations::CreateResizedImage( + image, skia::ImageOperations::ResizeMethod::RESIZE_GOOD, + gfx::Size(size, size)); + + icon = gfx::ImageSkiaOperations::CreateImageWithCircleBackground( + radius, SK_ColorWHITE, resized_image); } - - // Resize and set the provided image into a white circle. - const int radius = dimension_ / 2; - const int size = MaxSquareLengthForRadius(radius); - const gfx::ImageSkia resized_image = - gfx::ImageSkiaOperations::CreateResizedImage( - image, skia::ImageOperations::ResizeMethod::RESIZE_GOOD, - gfx::Size(size, size)); - - const gfx::ImageSkia icon = - gfx::ImageSkiaOperations::CreateImageWithCircleBackground( - radius, SK_ColorWHITE, resized_image); - - SetIcon(IconInfo(icon, GetAppIconDimension())); + SetIcon(IconInfo(icon, GetAppIconDimension(), IconShape::kCircle)); } void GameResult::SetGenericIcon() {
diff --git a/chrome/browser/ui/app_list/search/games/game_result_unittest.cc b/chrome/browser/ui/app_list/search/games/game_result_unittest.cc index db7fbe440..81e0b7cd 100644 --- a/chrome/browser/ui/app_list/search/games/game_result_unittest.cc +++ b/chrome/browser/ui/app_list/search/games/game_result_unittest.cc
@@ -4,14 +4,11 @@ #include "chrome/browser/ui/app_list/search/games/game_result.h" -#include "ash/strings/grit/ash_strings.h" -#include "base/files/file_path.h" -#include "base/strings/strcat.h" #include "chrome/browser/apps/app_discovery_service/app_discovery_service.h" -#include "chrome/browser/apps/app_discovery_service/app_discovery_service_factory.h" #include "chrome/browser/apps/app_discovery_service/game_extras.h" #include "chrome/browser/apps/app_discovery_service/result.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/app_list/search/common/icon_constants.h" #include "chrome/browser/ui/app_list/search/common/search_result_util.h" #include "chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h" #include "chrome/test/base/testing_profile.h" @@ -19,40 +16,110 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h" -#include "ui/base/l10n/l10n_util.h" -#include "url/gurl.h" +#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image_skia_operations.h" +#include "ui/gfx/skia_util.h" namespace app_list { +namespace { -class GameResultTest : public testing::Test { +// Creates a 50x50 yellow test icon. +gfx::ImageSkia GetTestIcon() { + SkBitmap bitmap; + bitmap.allocN32Pixels(50, 50); + bitmap.eraseColor(SK_ColorYELLOW); + return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); +} + +// Creates the resized non-maskable variant of the test icon, which is a 22x22 +// yellow square inside a 32x32 circle. +gfx::ImageSkia GetExpectedNonMaskableIcon() { + SkBitmap bitmap; + bitmap.allocN32Pixels(22, 22); + bitmap.eraseColor(SK_ColorYELLOW); + return gfx::ImageSkiaOperations::CreateImageWithCircleBackground( + /*radius=*/16, SK_ColorWHITE, gfx::ImageSkia::CreateFrom1xBitmap(bitmap)); +} + +// A mock app discovery service that can produce fake icons. +class TestAppDiscoveryService : public apps::AppDiscoveryService { public: - GameResultTest() { profile_ = std::make_unique<TestingProfile>(); } + explicit TestAppDiscoveryService(Profile* profile) + : apps::AppDiscoveryService(profile) {} + ~TestAppDiscoveryService() override = default; + TestAppDiscoveryService(const TestAppDiscoveryService&) = delete; + TestAppDiscoveryService& operator=(const TestAppDiscoveryService&) = delete; - ~GameResultTest() override = default; - - content::BrowserTaskEnvironment task_environment_; - test::TestAppListControllerDelegate list_controller_; - std::unique_ptr<Profile> profile_; + void GetIcon(const std::string& app_id, + int32_t size_hint_in_dip, + apps::ResultType result_type, + apps::GetIconCallback callback) override { + std::move(callback).Run(GetTestIcon(), apps::DiscoveryError::kSuccess); + } }; -TEST_F(GameResultTest, Basic) { - auto* app_discovery_service = - apps::AppDiscoveryServiceFactory::GetForProfile(profile_.get()); - - apps::Result apps_result( +apps::Result MakeAppsResult(bool masking_allowed) { + return apps::Result( apps::AppSource::kGames, "12345", u"Title", std::make_unique<apps::GameExtras>( absl::make_optional(std::vector<std::u16string>({u"A", u"B", u"C"})), u"SourceName", u"TestGamePublisher", - base::FilePath("/icons/test.png"), - /*is_icon_masking_allowed=*/false, GURL("https://game.com/game"))); + base::FilePath("/icons/test.png"), masking_allowed, + GURL("https://game.com/game"))); +} - GameResult result(profile_.get(), &list_controller_, app_discovery_service, - apps_result, 0.6, u"SomeGame"); +} // namespace + +class GameResultTest : public testing::Test { + public: + GameResultTest() { + profile_ = std::make_unique<TestingProfile>(); + app_discovery_service_ = + std::make_unique<TestAppDiscoveryService>(profile_.get()); + } + + ~GameResultTest() override = default; + + content::BrowserTaskEnvironment task_environment_; + std::unique_ptr<Profile> profile_; + test::TestAppListControllerDelegate list_controller_; + std::unique_ptr<TestAppDiscoveryService> app_discovery_service_; +}; + +TEST_F(GameResultTest, Basic) { + apps::Result apps_result = MakeAppsResult(/*masking_allowed=*/false); + GameResult result(profile_.get(), &list_controller_, + app_discovery_service_.get(), apps_result, 0.6, + u"SomeGame"); EXPECT_EQ(result.title(), u"Title"); EXPECT_EQ(StringFromTextVector(result.details_text_vector()), u"SourceName"); EXPECT_EQ(result.accessible_name(), u"Title, SourceName"); } +TEST_F(GameResultTest, Icons) { + apps::Result maskable_app = MakeAppsResult(/*masking_allowed=*/true); + GameResult maskable_result(profile_.get(), &list_controller_, + app_discovery_service_.get(), maskable_app, 0.6, + u"SomeGame"); + + EXPECT_EQ(maskable_result.icon().dimension, GetAppIconDimension()); + EXPECT_EQ(maskable_result.icon().shape, ash::SearchResultIconShape::kCircle); + // The maskable icon should not be modified from its original form. + EXPECT_TRUE(gfx::BitmapsAreEqual(*maskable_result.icon().icon.bitmap(), + *GetTestIcon().bitmap())); + + apps::Result non_maskable_app = MakeAppsResult(/*masking_allowed=*/false); + GameResult non_maskable_result(profile_.get(), &list_controller_, + app_discovery_service_.get(), non_maskable_app, + 0.6, u"SomeGame"); + + EXPECT_EQ(non_maskable_result.icon().dimension, GetAppIconDimension()); + EXPECT_EQ(non_maskable_result.icon().shape, + ash::SearchResultIconShape::kCircle); + // The non-maskable icon must be resized and placed on a white circle. + EXPECT_TRUE(gfx::BitmapsAreEqual(*non_maskable_result.icon().icon.bitmap(), + *GetExpectedNonMaskableIcon().bitmap())); +} + } // namespace app_list
diff --git a/chrome/browser/ui/app_list/search/search_controller_factory.cc b/chrome/browser/ui/app_list/search/search_controller_factory.cc index 78cb7b3..762f52e6 100644 --- a/chrome/browser/ui/app_list/search/search_controller_factory.cc +++ b/chrome/browser/ui/app_list/search/search_controller_factory.cc
@@ -17,6 +17,7 @@ #include "build/build_config.h" #include "chrome/browser/ash/arc/arc_util.h" #include "chrome/browser/ash/crosapi/crosapi_manager.h" +#include "chrome/browser/ash/drive/drive_integration_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/search/app_search_provider.h" #include "chrome/browser/ui/app_list/search/arc/arc_app_shortcuts_search_provider.h" @@ -162,11 +163,13 @@ std::make_unique<ZeroStateFileProvider>(profile)); size_t drive_zero_state_group_id = controller->AddGroup(kMaxZeroStateDriveResults); - controller->AddProvider(drive_zero_state_group_id, - std::make_unique<ZeroStateDriveProvider>( - profile, controller.get(), - profile->GetDefaultStoragePartition() - ->GetURLLoaderFactoryForBrowserProcess())); + controller->AddProvider( + drive_zero_state_group_id, + std::make_unique<ZeroStateDriveProvider>( + profile, controller.get(), + drive::DriveIntegrationServiceFactory::GetForProfile(profile), + profile->GetDefaultStoragePartition() + ->GetURLLoaderFactoryForBrowserProcess())); } if (app_list_features::IsLauncherSettingsSearchEnabled()) {
diff --git a/chrome/browser/ui/ash/app_access_notifier.cc b/chrome/browser/ui/ash/app_access_notifier.cc index 1b805584..5e7c99a 100644 --- a/chrome/browser/ui/ash/app_access_notifier.cc +++ b/chrome/browser/ui/ash/app_access_notifier.cc
@@ -96,7 +96,7 @@ // in that case instead of using DCHECK(). if (!reg_cache || !cap_cache) return absl::nullopt; - return GetAppAccessingMicrophone(cap_cache, reg_cache); + return GetMostRecentAppAccessingMicrophone(cap_cache, reg_cache); } void AppAccessNotifier::OnCapabilityAccessUpdate( @@ -108,8 +108,11 @@ bool camera_is_used = update.Camera() == apps::mojom::OptionalBool::kTrue; if (ash::features::IsPrivacyIndicatorsEnabled()) { - ash::ModifyPrivacyIndicatorsNotification(update.AppId(), camera_is_used, - microphone_is_used); + auto app_id = update.AppId(); + ash::ModifyPrivacyIndicatorsNotification( + app_id, + GetAppShortNameFromAppId(app_id, GetActiveUserAppRegistryCache()), + camera_is_used, microphone_is_used); } if (microphone_is_used) { @@ -147,6 +150,21 @@ CheckActiveUserChanged(); } +// static +absl::optional<std::u16string> AppAccessNotifier::GetAppShortNameFromAppId( + std::string app_id, + apps::AppRegistryCache* registry_cache) { + absl::optional<std::u16string> name; + if (!registry_cache) + return name; + + registry_cache->ForEachApp([&app_id, &name](const apps::AppUpdate& update) { + if (update.AppId() == app_id) + name = base::UTF8ToUTF16(update.ShortName()); + }); + return name; +} + AccountId AppAccessNotifier::GetActiveUserAccountId() { auto* manager = user_manager::UserManager::Get(); const user_manager::User* active_user = manager->GetActiveUser(); @@ -178,7 +196,8 @@ return GetAppCapabilityAccessCache(GetActiveUserAccountId()); } -absl::optional<std::u16string> AppAccessNotifier::GetAppAccessingMicrophone( +absl::optional<std::u16string> +AppAccessNotifier::GetMostRecentAppAccessingMicrophone( apps::AppCapabilityAccessCache* capability_cache, apps::AppRegistryCache* registry_cache) { if (mic_using_app_ids[active_user_account_id_].empty())
diff --git a/chrome/browser/ui/ash/app_access_notifier.h b/chrome/browser/ui/ash/app_access_notifier.h index 09c0cdd0..639b49a5 100644 --- a/chrome/browser/ui/ash/app_access_notifier.h +++ b/chrome/browser/ui/ash/app_access_notifier.h
@@ -44,12 +44,6 @@ // ash::MicrophoneMuteNotificationDelegate absl::optional<std::u16string> GetAppAccessingMicrophone() override; - // Returns the "short name" of the registered app to most recently attempt to - // access the microphone, or an empty (optional) string if none exists. - absl::optional<std::u16string> GetAppAccessingMicrophone( - apps::AppCapabilityAccessCache* capability_cache, - apps::AppRegistryCache* registry_cache); - // apps::AppCapabilityAccessCache::Observer void OnCapabilityAccessUpdate( const apps::CapabilityAccessUpdate& update) override; @@ -62,6 +56,11 @@ // user_manager::UserManager::UserSessionStateObserver void ActiveUserChanged(user_manager::User* active_user) override; + // Get the app short name of the app with `app_id`. + static absl::optional<std::u16string> GetAppShortNameFromAppId( + std::string app_id, + apps::AppRegistryCache* registry_cache); + protected: // Returns the active user's account ID if we have an active user, an empty // account ID otherwise. @@ -73,10 +72,19 @@ void CheckActiveUserChanged(); private: + friend class AppAccessNotifierTest; + // Returns the AppCapabilityAccessCache associated with the active user's // account ID. apps::AppCapabilityAccessCache* GetActiveUserAppCapabilityAccessCache(); + // Returns the "short name" of the registered app to most recently attempt to + // access the microphone, or an empty (optional) string if none exists. Used + // for the microphone mute notification. + absl::optional<std::u16string> GetMostRecentAppAccessingMicrophone( + apps::AppCapabilityAccessCache* capability_cache, + apps::AppRegistryCache* registry_cache); + // List of IDs of apps that have attempted to use the microphone, in order of // most-recently-launched. using MruAppIdList = std::list<std::string>;
diff --git a/chrome/browser/ui/ash/app_access_notifier_unittest.cc b/chrome/browser/ui/ash/app_access_notifier_unittest.cc index 25d9e0e..7967ae1 100644 --- a/chrome/browser/ui/ash/app_access_notifier_unittest.cc +++ b/chrome/browser/ui/ash/app_access_notifier_unittest.cc
@@ -110,8 +110,8 @@ account_id_primary_user_) ? ®istry_cache_primary_user_ : ®istry_cache_secondary_user_; - return microphone_mute_notification_delegate_->GetAppAccessingMicrophone( - cap_cache, reg_cache); + return microphone_mute_notification_delegate_ + ->GetMostRecentAppAccessingMicrophone(cap_cache, reg_cache); } static apps::AppPtr MakeApp(const std::string app_id, const char* name) { @@ -395,3 +395,13 @@ EXPECT_TRUE(message_center::MessageCenter::Get()->FindNotificationById( kPrivacyIndicatorsNotificationIdPrefix + id1)); } + +TEST_P(AppAccessNotifierTest, GetShortNameFromAppId) { + // Test that GetAppShortNameFromAppId works properly. + const std::string id = "test_app_id"; + LaunchAppUsingCameraOrMicrophone(id, "test_app_name", /*use_camera=*/false, + /*use_microphone=*/true); + EXPECT_EQ(AppAccessNotifier::GetAppShortNameFromAppId( + id, ®istry_cache_primary_user_), + u"test_app_name"); +}
diff --git a/chrome/browser/ui/ash/desks/desks_client_browsertest.cc b/chrome/browser/ui/ash/desks/desks_client_browsertest.cc index 644e114..8ec5dd1 100644 --- a/chrome/browser/ui/ash/desks/desks_client_browsertest.cc +++ b/chrome/browser/ui/ash/desks/desks_client_browsertest.cc
@@ -22,8 +22,10 @@ #include "ash/wm/desks/desks_controller.h" #include "ash/wm/desks/desks_test_util.h" #include "ash/wm/desks/templates/saved_desk_metrics_util.h" +#include "ash/wm/desks/templates/saved_desk_presenter.h" #include "ash/wm/desks/templates/saved_desk_test_util.h" #include "ash/wm/desks/templates/saved_desk_util.h" +#include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_grid.h" #include "ash/wm/overview/overview_session.h" #include "ash/wm/overview/overview_test_util.h" @@ -286,6 +288,12 @@ ClickSaveDeskAsTemplateButton(/*wait_for_ui=*/true); } +void ClickSaveDeskForLaterButton() { + views::Button* save_desk_for_later_button = ash::GetSaveDeskForLaterButton(); + DCHECK(save_desk_for_later_button); + ClickButton(save_desk_for_later_button); +} + void ClickZeroStateTemplatesButton() { views::Button* zero_state_templates_button = ash::GetZeroStateDesksTemplatesButton(); @@ -477,6 +485,28 @@ : web_app::LaunchWebAppBrowserAndWait(profile(), app_id); } + // This navigates the browser to a page that will show a close confirmation + // dialog when closed. + void SetupBrowserToConfirmClose(Browser* browser) { + std::string page_that_requires_close_confirmation = + "<html><head>" + "<script>window.onbeforeunload = function() { return \"x\"; };</script>" + "</head><body></body></html>"; + + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser, + GURL("data:text/html, " + page_that_requires_close_confirmation))); + + // Note that the `onbeforeunload` handler will not run for a page that + // hasn't been interacted with. To meet that requirement, we'll click on the + // page. + aura::Window* window = browser->window()->GetNativeWindow(); + ui::test::EventGenerator event_generator(window->GetRootWindow()); + event_generator.MoveMouseToInHost( + window->GetBoundsInScreen().CenterPoint()); + event_generator.ClickLeftButton(); + } + // extensions::PlatformAppBrowserTest: void SetUpOnMainThread() override { ::full_restore::SetActiveProfilePath(profile()->GetPath()); @@ -2344,6 +2374,9 @@ ClickButton(save_desk_button); ash::WaitForDesksTemplatesUI(); + // Wait for the browser to close. + ui_test_utils::WaitForBrowserToClose(); + // Verify that we're back to one desk. EXPECT_EQ(1ul, desks.size()); } @@ -2575,6 +2608,63 @@ ash::WaitForOverviewExitAnimation(); } +using SaveAndRecallBrowserTest = DesksTemplatesClientTest; + +IN_PROC_BROWSER_TEST_F(SaveAndRecallBrowserTest, + SystemUIBlockingDialogAccepted) { + SetupBrowserToConfirmClose(browser()); + + // We'll now save the desk as Save & Recall. After saving desks, this + // operation will try to automatically close windows. + + ash::ToggleOverview(); + ash::WaitForOverviewEnterAnimation(); + ClickSaveDeskForLaterButton(); + ash::WaitForDesksTemplatesUI(); + + ash::SavedDeskPresenterTestApi::WaitForSaveAndRecallBlockingDialog(); + EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); + + // Send a key to OK the close dialog. + ash::SendKey(ui::VKEY_RETURN); + content::RunAllTasksUntilIdle(); + + EXPECT_EQ(0u, chrome::GetTotalBrowserCount()); + + // Verify that we are in the library and that there's one saved desk. + auto* overview_grid = ash::GetOverviewSession()->GetGridWithRootWindow( + ash::Shell::GetPrimaryRootWindow()); + ASSERT_TRUE(overview_grid); + EXPECT_TRUE(overview_grid->IsShowingDesksTemplatesGrid()); + + std::vector<const ash::DeskTemplate*> templates = GetAllEntries(); + EXPECT_EQ(1u, templates.size()); +} + +IN_PROC_BROWSER_TEST_F(SaveAndRecallBrowserTest, + SystemUIBlockingDialogRejected) { + SetupBrowserToConfirmClose(browser()); + + ash::ToggleOverview(); + ash::WaitForOverviewEnterAnimation(); + ClickSaveDeskForLaterButton(); + ash::WaitForDesksTemplatesUI(); + + ash::SavedDeskPresenterTestApi::WaitForSaveAndRecallBlockingDialog(); + EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); + + // Send escape to cancel the dialog (keep the browser running). + ash::SendKey(ui::VKEY_ESCAPE); + content::RunAllTasksUntilIdle(); + + ash::SavedDeskPresenterTestApi::FireWindowWatcherTimer(); + + EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); + + // We should be in overview mode. + ASSERT_TRUE(ash::Shell::Get()->overview_controller()->overview_session()); +} + class DesksTemplatesClientArcTest : public InProcessBrowserTest { public: DesksTemplatesClientArcTest() {
diff --git a/chrome/browser/ui/browser_close_unittest.cc b/chrome/browser/ui/browser_close_unittest.cc index cb429a4..cd4b85a2 100644 --- a/chrome/browser/ui/browser_close_unittest.cc +++ b/chrome/browser/ui/browser_close_unittest.cc
@@ -76,6 +76,8 @@ bool IsDownloadUiEnabled() override { return true; } + bool IsDownloadObservedByExtension() override { return false; } + // KeyedService void Shutdown() override {}
diff --git a/chrome/browser/ui/extensions/extension_action_view_controller.cc b/chrome/browser/ui/extensions/extension_action_view_controller.cc index 9bee2af4..26c9b598 100644 --- a/chrome/browser/ui/extensions/extension_action_view_controller.cc +++ b/chrome/browser/ui/extensions/extension_action_view_controller.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/check_op.h" +#include "base/feature_list.h" #include "base/memory/ptr_util.h" #include "base/metrics/histogram_functions.h" #include "base/strings/strcat.h" @@ -37,6 +38,7 @@ #include "extensions/browser/extension_registry.h" #include "extensions/common/api/extension_action/action_info.h" #include "extensions/common/extension.h" +#include "extensions/common/extension_features.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/permissions/api_permission.h" #include "ui/base/l10n/l10n_util.h" @@ -514,6 +516,11 @@ !action_is_visible; image_source->set_grayscale(grayscale); + if (base::FeatureList::IsEnabled( + extensions_features::kExtensionsMenuAccessControl)) { + return image_source; + } + bool was_blocked = extensions::SitePermissionsHelper(browser_->profile()) .HasBeenBlocked(*extension(), web_contents); image_source->set_paint_blocked_actions_decoration(was_blocked);
diff --git a/chrome/browser/ui/extensions/icon_with_badge_image_source.h b/chrome/browser/ui/extensions/icon_with_badge_image_source.h index c27ce4b..033c166 100644 --- a/chrome/browser/ui/extensions/icon_with_badge_image_source.h +++ b/chrome/browser/ui/extensions/icon_with_badge_image_source.h
@@ -105,6 +105,8 @@ // Whether or not to paint a decoration to indicate that the extension has // had actions blocked. + // TODO(crbug.com/1352298): Remove once kExtensionsMenuAccessControl is rolled + // out. bool paint_blocked_actions_decoration_ = false; };
diff --git a/chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc b/chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc index b03ff349..b1ae2405 100644 --- a/chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc +++ b/chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc
@@ -159,12 +159,9 @@ } #if BUILDFLAG(GOOGLE_CHROME_BRANDING) -// "Report an issue" should be present for normal profiles but not for +// "Report an issue" should be present for normal profiles as well as for // incognito. -// -// Disabled <https://crbug.com/1351616>. -TEST_F(MediaRouterContextualMenuUnitTest, - DISABLED_EnableAndDisableReportIssue) { +TEST_F(MediaRouterContextualMenuUnitTest, EnableAndDisableReportIssue) { MediaRouterContextualMenu menu(browser(), kShownByPolicy, &observer_); EXPECT_TRUE( menu.CreateMenuModel() @@ -178,7 +175,7 @@ MediaRouterContextualMenu incognito_menu(incognito_browser.get(), kShownByPolicy, &observer_); - EXPECT_FALSE( + EXPECT_TRUE( incognito_menu.CreateMenuModel() ->GetIndexOfCommandId(IDC_MEDIA_TOOLBAR_CONTEXT_REPORT_CAST_ISSUE) .has_value());
diff --git a/chrome/browser/ui/views/extensions/extensions_toolbar_controls.cc b/chrome/browser/ui/views/extensions/extensions_toolbar_controls.cc index 440a7cf..619918a 100644 --- a/chrome/browser/ui/views/extensions/extensions_toolbar_controls.cc +++ b/chrome/browser/ui/views/extensions/extensions_toolbar_controls.cc
@@ -9,7 +9,6 @@ #include "chrome/browser/ui/color/chrome_color_id.h" #include "chrome/browser/ui/extensions/extension_action_view_controller.h" #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" -#include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/extensions/extensions_request_access_button.h" #include "chrome/browser/ui/views/extensions/extensions_toolbar_button.h" #include "content/public/browser/web_contents.h" @@ -28,11 +27,6 @@ request_access_button_->SetVisible(false); // TODO(emiliapaz): Consider changing AddMainItem() to receive a unique_ptr. AddMainItem(extensions_button.release()); - - const int radius = ChromeLayoutProvider::Get()->GetCornerRadiusMetric( - views::Emphasis::kMaximum, extensions_button_->GetPreferredSize()); - SetBackground(views::CreateThemedRoundedRectBackground( - kColorExtensionsToolbarControlsBackground, radius)); } ExtensionsToolbarControls::~ExtensionsToolbarControls() = default; @@ -46,6 +40,16 @@ UpdateSiteAccessButton(actions, current_web_contents); UpdateRequestAccessButton(actions, site_setting, current_web_contents); + // Display background only when multiple buttons are visible. Since + // the extensions button is always visible, check if any of the other + // buttons is too. + SetBackground(site_access_button_->GetVisible() || + request_access_button_->GetVisible() + ? views::CreateThemedRoundedRectBackground( + kColorExtensionsToolbarControlsBackground, + extensions_button_->GetPreferredSize().height()) + : nullptr); + // Resets the layout since layout animation does not handle host view // visibility changing. This should be called after any visibility changes. GetAnimatingLayoutManager()->ResetLayout();
diff --git a/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc b/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc index e5fc2aa..ed7ea9ec 100644 --- a/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc +++ b/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc
@@ -44,8 +44,6 @@ #include "ui/gfx/text_utils.h" #include "ui/gfx/vector_icon_types.h" #include "ui/native_theme/native_theme.h" -#include "ui/views/accessibility/ax_virtual_view.h" -#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/controls/button/image_button.h" #include "ui/views/controls/button/image_button_factory.h" #include "ui/views/controls/button/md_text_button.h" @@ -281,8 +279,6 @@ void ZoomBubbleView::Refresh() { UpdateZoomPercent(); - zoom_level_alert_->GetCustomData().SetName(GetAccessibleWindowTitle()); - zoom_level_alert_->NotifyAccessibilityEvent(ax::mojom::Event::kAlert); StartTimerIfNecessary(); } @@ -451,11 +447,6 @@ l10n_util::GetStringUTF16(IDS_ACCNAME_ZOOM_SET_DEFAULT)); reset_button_ = AddChildView(std::move(reset_button)); - auto zoom_level_alert = std::make_unique<views::AXVirtualView>(); - zoom_level_alert->GetCustomData().role = ax::mojom::Role::kAlert; - zoom_level_alert_ = zoom_level_alert.get(); - GetViewAccessibility().AddVirtualChildView(std::move(zoom_level_alert)); - UpdateZoomPercent(); StartTimerIfNecessary(); } @@ -535,6 +526,7 @@ void ZoomBubbleView::UpdateZoomPercent() { label_->SetText(base::FormatPercent( zoom::ZoomController::FromWebContents(web_contents())->GetZoomPercent())); + label_->SetAccessibleName(GetAccessibleWindowTitle()); // Disable buttons at min, max and default auto* zoom_controller = zoom::ZoomController::FromWebContents(web_contents());
diff --git a/chrome/browser/ui/views/location_bar/zoom_bubble_view.h b/chrome/browser/ui/views/location_bar/zoom_bubble_view.h index 749c4ae..071df93 100644 --- a/chrome/browser/ui/views/location_bar/zoom_bubble_view.h +++ b/chrome/browser/ui/views/location_bar/zoom_bubble_view.h
@@ -25,7 +25,6 @@ } namespace views { -class AXVirtualView; class Button; class ImageButton; } // namespace views @@ -168,9 +167,6 @@ raw_ptr<views::Button> zoom_in_button_ = nullptr; raw_ptr<views::Button> reset_button_ = nullptr; - // Virtual view used to announce zoom level changes. - raw_ptr<views::AXVirtualView> zoom_level_alert_ = nullptr; - // Whether the currently displayed bubble will automatically close. bool auto_close_;
diff --git a/chrome/browser/ui/web_applications/web_app_browser_controller.cc b/chrome/browser/ui/web_applications/web_app_browser_controller.cc index f636988..189a0901 100644 --- a/chrome/browser/ui/web_applications/web_app_browser_controller.cc +++ b/chrome/browser/ui/web_applications/web_app_browser_controller.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ui/web_applications/web_app_browser_controller.h" #include "base/callback_helpers.h" +#include "base/containers/flat_set.h" #include "base/memory/raw_ptr.h" #include "base/strings/strcat.h" #include "base/strings/string_util.h" @@ -22,10 +23,12 @@ #include "chrome/browser/ui/web_applications/web_app_launch_utils.h" #include "chrome/browser/ui/web_applications/web_app_ui_manager_impl.h" #include "chrome/browser/web_applications/commands/callback_command.h" +#include "chrome/browser/web_applications/locks/app_lock.h" #include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_app_helpers.h" #include "chrome/browser/web_applications/web_app_icon_manager.h" +#include "chrome/browser/web_applications/web_app_id.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_sync_bridge.h" #include "chrome/browser/web_applications/web_app_tab_helper.h" @@ -190,7 +193,7 @@ // base::Unretained is safe as the command manager won't execute the command // if the provider no longer exists. provider_.command_manager().ScheduleCommand(std::make_unique<CallbackCommand>( - WebAppCommandLock::CreateForAppLock({app_id()}), + std::make_unique<AppLock, base::flat_set<AppId>>({app_id()}), base::BindOnce(&WebAppSyncBridge::SetAlwaysShowToolbarInFullscreen, base::Unretained(&provider_.sync_bridge()), app_id(), !registrar().AlwaysShowToolbarInFullscreen(app_id()))));
diff --git a/chrome/browser/ui/webui/extensions/extensions_ui.cc b/chrome/browser/ui/webui/extensions/extensions_ui.cc index 2a07f68e..4c3f9b2 100644 --- a/chrome/browser/ui/webui/extensions/extensions_ui.cc +++ b/chrome/browser/ui/webui/extensions/extensions_ui.cc
@@ -207,6 +207,8 @@ {"itemSiteAccessAddHost", IDS_EXTENSIONS_ITEM_SITE_ACCESS_ADD_HOST}, {"itemSiteAccessEmpty", IDS_EXTENSIONS_ITEM_SITE_ACCESS_EMPTY}, {"itemSource", IDS_EXTENSIONS_ITEM_SOURCE}, + {"itemSourceInstalledByDefault", + IDS_EXTENSIONS_ITEM_SOURCE_INSTALLED_BY_DEFAULT}, {"itemSourcePolicy", IDS_EXTENSIONS_ITEM_SOURCE_POLICY}, {"itemSourceSideloaded", IDS_EXTENSIONS_ITEM_SOURCE_SIDELOADED}, {"itemSourceUnpacked", IDS_EXTENSIONS_ITEM_SOURCE_UNPACKED},
diff --git a/chrome/browser/web_applications/BUILD.gn b/chrome/browser/web_applications/BUILD.gn index 3dd847a2..4b7e3efb 100644 --- a/chrome/browser/web_applications/BUILD.gn +++ b/chrome/browser/web_applications/BUILD.gn
@@ -55,6 +55,20 @@ "install_bounce_metric.h", "isolation_prefs_utils.cc", "isolation_prefs_utils.h", + "locks/app_lock.cc", + "locks/app_lock.h", + "locks/full_system_lock.cc", + "locks/full_system_lock.h", + "locks/lock.cc", + "locks/lock.h", + "locks/noop_lock.cc", + "locks/noop_lock.h", + "locks/shared_web_contents_lock.cc", + "locks/shared_web_contents_lock.h", + "locks/shared_web_contents_with_app_lock.cc", + "locks/shared_web_contents_with_app_lock.h", + "locks/web_app_lock_manager.cc", + "locks/web_app_lock_manager.h", "manifest_update_manager.cc", "manifest_update_manager.h", "manifest_update_task.cc",
diff --git a/chrome/browser/web_applications/commands/callback_command.cc b/chrome/browser/web_applications/commands/callback_command.cc index 5970f99c..46f5b5809 100644 --- a/chrome/browser/web_applications/commands/callback_command.cc +++ b/chrome/browser/web_applications/commands/callback_command.cc
@@ -4,14 +4,20 @@ #include "chrome/browser/web_applications/commands/callback_command.h" +#include <memory> +#include <utility> + +#include "base/callback.h" #include "base/strings/stringprintf.h" -#include "chrome/browser/web_applications/web_app_command_manager.h" +#include "chrome/browser/web_applications/locks/lock.h" namespace web_app { -CallbackCommand::CallbackCommand(WebAppCommandLock command_lock, +CallbackCommand::CallbackCommand(std::unique_ptr<Lock> lock, base::OnceClosure callback) - : WebAppCommand(std::move(command_lock)), callback_(std::move(callback)) {} + : lock_(std::move(lock)), callback_(std::move(callback)) { + DCHECK(lock_); +} CallbackCommand::~CallbackCommand() = default; @@ -20,6 +26,10 @@ base::BindOnce(std::move(callback_))); } +Lock& CallbackCommand::lock() const { + return *lock_; +} + base::Value CallbackCommand::ToDebugValue() const { return base::Value(base::StringPrintf("CallbackCommand %d", id())); }
diff --git a/chrome/browser/web_applications/commands/callback_command.h b/chrome/browser/web_applications/commands/callback_command.h index 8eea695..0af6397 100644 --- a/chrome/browser/web_applications/commands/callback_command.h +++ b/chrome/browser/web_applications/commands/callback_command.h
@@ -5,26 +5,32 @@ #ifndef CHROME_BROWSER_WEB_APPLICATIONS_COMMANDS_CALLBACK_COMMAND_H_ #define CHROME_BROWSER_WEB_APPLICATIONS_COMMANDS_CALLBACK_COMMAND_H_ +#include "base/callback.h" #include "chrome/browser/web_applications/commands/web_app_command.h" namespace web_app { +class Lock; + // CallbackCommand simply runs the callback being passed. This is handy for // small operations to web app system to avoid defining a new command class but // still providing isolation for the work done in the callback. class CallbackCommand : public WebAppCommand { public: - CallbackCommand(WebAppCommandLock command_lock, base::OnceClosure callback); + CallbackCommand(std::unique_ptr<Lock> lock, base::OnceClosure callback); ~CallbackCommand() override; void Start() override; - void OnSyncSourceRemoved() override {} + Lock& lock() const override; - void OnShutdown() override {} base::Value ToDebugValue() const override; + void OnSyncSourceRemoved() override {} + void OnShutdown() override {} + private: + std::unique_ptr<Lock> lock_; base::OnceClosure callback_; };
diff --git a/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.cc b/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.cc index 7cc19e5..7aa38bef 100644 --- a/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.cc +++ b/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.cc
@@ -14,6 +14,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/web_applications/commands/web_app_command.h" #include "chrome/browser/web_applications/commands/web_app_install_command.h" +#include "chrome/browser/web_applications/locks/noop_lock.h" #include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_data_retriever.h" #include "chrome/browser/web_applications/web_app_helpers.h" @@ -32,7 +33,7 @@ bool bypass_service_worker_check, WebAppInstallDialogCallback dialog_callback, OnceInstallCallback callback) - : WebAppCommand(WebAppCommandLock::CreateForNoOpLock()), + : lock_(std::make_unique<NoopLock>()), install_finalizer_(install_finalizer), registrar_(registrar), install_surface_(install_surface), @@ -52,7 +53,7 @@ OnceInstallCallback callback, bool use_fallback, WebAppInstallFlow flow) - : WebAppCommand(WebAppCommandLock::CreateForNoOpLock()), + : lock_(std::make_unique<NoopLock>()), install_finalizer_(install_finalizer), registrar_(registrar), install_surface_(install_surface), @@ -66,6 +67,10 @@ FetchManifestAndInstallCommand::~FetchManifestAndInstallCommand() = default; +Lock& FetchManifestAndInstallCommand::lock() const { + return *lock_; +} + void FetchManifestAndInstallCommand::Start() { if (IsWebContentsDestroyed()) { Abort(webapps::InstallResultCode::kWebContentsDestroyed);
diff --git a/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.h b/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.h index a765c86..555f6dd 100644 --- a/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.h +++ b/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.h
@@ -23,6 +23,7 @@ namespace web_app { +class NoopLock; class WebAppDataRetriever; class WebAppInstallFinalizer; class WebAppRegistrar; @@ -59,6 +60,8 @@ ~FetchManifestAndInstallCommand() override; + Lock& lock() const override; + void Start() override; void OnSyncSourceRemoved() override; void OnShutdown() override; @@ -81,6 +84,8 @@ bool is_installable); void LogInstallInfo(); + std::unique_ptr<NoopLock> lock_; + raw_ptr<WebAppInstallFinalizer> install_finalizer_; raw_ptr<WebAppRegistrar> registrar_; webapps::WebappInstallSource install_surface_;
diff --git a/chrome/browser/web_applications/commands/install_from_info_command.cc b/chrome/browser/web_applications/commands/install_from_info_command.cc index 49dcdc3..a61c358 100644 --- a/chrome/browser/web_applications/commands/install_from_info_command.cc +++ b/chrome/browser/web_applications/commands/install_from_info_command.cc
@@ -4,11 +4,14 @@ #include "chrome/browser/web_applications/commands/install_from_info_command.h" +#include <memory> #include <utility> #include "base/bind.h" +#include "base/containers/flat_set.h" #include "base/memory/weak_ptr.h" #include "base/strings/stringprintf.h" +#include "chrome/browser/web_applications/locks/app_lock.h" #include "chrome/browser/web_applications/os_integration/os_integration_manager.h" #include "chrome/browser/web_applications/web_app_helpers.h" #include "chrome/browser/web_applications/web_app_id.h" @@ -25,7 +28,7 @@ bool overwrite_existing_manifest_fields, webapps::WebappInstallSource install_surface, OnceInstallCallback install_callback) - : WebAppCommand(WebAppCommandLock::CreateForAppLock( + : lock_(std::make_unique<AppLock, base::flat_set<AppId>>( {GenerateAppId(install_info->manifest_id, install_info->start_url)})), app_id_( GenerateAppId(install_info->manifest_id, install_info->start_url)), @@ -42,7 +45,7 @@ webapps::WebappInstallSource install_surface, OnceInstallCallback install_callback, const WebAppInstallParams& install_params) - : WebAppCommand(WebAppCommandLock::CreateForAppLock( + : lock_(std::make_unique<AppLock, base::flat_set<AppId>>( {GenerateAppId(install_info->manifest_id, install_info->start_url)})), app_id_( GenerateAppId(install_info->manifest_id, install_info->start_url)), @@ -61,6 +64,10 @@ } InstallFromInfoCommand::~InstallFromInfoCommand() = default; +Lock& InstallFromInfoCommand::lock() const { + return *lock_; +} + void InstallFromInfoCommand::Start() { PopulateProductIcons(install_info_.get(), /*icons_map=*/nullptr);
diff --git a/chrome/browser/web_applications/commands/install_from_info_command.h b/chrome/browser/web_applications/commands/install_from_info_command.h index 0c1b0eacd..6f208925 100644 --- a/chrome/browser/web_applications/commands/install_from_info_command.h +++ b/chrome/browser/web_applications/commands/install_from_info_command.h
@@ -20,6 +20,7 @@ namespace web_app { +class AppLock; class WebAppInstallFinalizer; // Starts a web app installation process using prefilled @@ -52,6 +53,8 @@ ~InstallFromInfoCommand() override; + Lock& lock() const override; + void Start() override; void OnSyncSourceRemoved() override; void OnShutdown() override; @@ -65,6 +68,7 @@ webapps::InstallResultCode code, OsHooksErrors os_hooks_errors); + std::unique_ptr<AppLock> lock_; AppId app_id_; std::unique_ptr<WebAppInstallInfo> install_info_; raw_ptr<WebAppInstallFinalizer> install_finalizer_;
diff --git a/chrome/browser/web_applications/commands/install_from_sync_command.cc b/chrome/browser/web_applications/commands/install_from_sync_command.cc index c31eae9..0af2ddf8 100644 --- a/chrome/browser/web_applications/commands/install_from_sync_command.cc +++ b/chrome/browser/web_applications/commands/install_from_sync_command.cc
@@ -7,14 +7,16 @@ #include <memory> #include <utility> -#include "base/callback_helpers.h" +#include "base/containers/flat_set.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/web_applications/commands/web_app_command.h" #include "chrome/browser/web_applications/install_bounce_metric.h" +#include "chrome/browser/web_applications/locks/shared_web_contents_with_app_lock.h" #include "chrome/browser/web_applications/web_app_command_manager.h" +#include "chrome/browser/web_applications/web_app_data_retriever.h" #include "chrome/browser/web_applications/web_app_helpers.h" #include "chrome/browser/web_applications/web_app_install_info.h" #include "chrome/browser/web_applications/web_app_install_utils.h" @@ -22,7 +24,6 @@ #include "components/webapps/browser/install_result_code.h" #include "components/webapps/browser/installable/installable_metrics.h" #include "content/public/browser/web_contents.h" -#include "net/http/http_status_code.h" namespace web_app { @@ -78,8 +79,9 @@ std::unique_ptr<WebAppDataRetriever> data_retriever, const Params& params, OnceInstallCallback install_callback) - : WebAppCommand( - WebAppCommandLock::CreateForAppAndWebContentsLock({params.app_id})), + : lock_( + std::make_unique<SharedWebContentsWithAppLock, base::flat_set<AppId>>( + {params.app_id})), url_loader_(url_loader), profile_(profile), finalizer_(finalizer), @@ -127,6 +129,10 @@ webapps::InstallResultCode::kHaltedBySyncUninstall); } +Lock& InstallFromSyncCommand::lock() const { + return *lock_; +} + void InstallFromSyncCommand::Start() { url_loader_->LoadUrl( params_.start_url, shared_web_contents(),
diff --git a/chrome/browser/web_applications/commands/install_from_sync_command.h b/chrome/browser/web_applications/commands/install_from_sync_command.h index c50ad00..d13cbb7a 100644 --- a/chrome/browser/web_applications/commands/install_from_sync_command.h +++ b/chrome/browser/web_applications/commands/install_from_sync_command.h
@@ -13,22 +13,25 @@ #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/web_applications/commands/web_app_command.h" +#include "chrome/browser/web_applications/os_integration/os_integration_manager.h" #include "chrome/browser/web_applications/user_display_mode.h" #include "chrome/browser/web_applications/web_app_constants.h" -#include "chrome/browser/web_applications/web_app_data_retriever.h" -#include "chrome/browser/web_applications/web_app_install_finalizer.h" -#include "chrome/browser/web_applications/web_app_install_info.h" #include "chrome/browser/web_applications/web_app_install_params.h" #include "chrome/browser/web_applications/web_app_logging.h" -#include "chrome/browser/web_applications/web_app_registrar.h" -#include "chrome/browser/web_applications/web_app_url_loader.h" #include "third_party/skia/include/core/SkColor.h" #include "url/gurl.h" class Profile; +struct WebAppInstallInfo; namespace web_app { +enum class WebAppUrlLoaderResult; +class SharedWebContentsWithAppLock; +class WebAppInstallFinalizer; +class WebAppDataRetriever; +class WebAppRegistrar; + class InstallFromSyncCommand : public WebAppCommand { public: struct Params { @@ -65,6 +68,8 @@ OnceInstallCallback install_callback); ~InstallFromSyncCommand() override; + Lock& lock() const override; + base::Value ToDebugValue() const override; void OnSyncSourceRemoved() override; @@ -77,7 +82,7 @@ base::OnceCallback<void(webapps::InstallResultCode code)> callback); private: - void OnWebAppUrlLoadedGetWebAppInstallInfo(WebAppUrlLoader::Result result); + void OnWebAppUrlLoadedGetWebAppInstallInfo(WebAppUrlLoaderResult result); void OnGetWebAppInstallInfo(std::unique_ptr<WebAppInstallInfo> web_app_info); @@ -104,6 +109,7 @@ void ReportResultAndDestroy(const AppId& app_id, webapps::InstallResultCode code); + std::unique_ptr<SharedWebContentsWithAppLock> lock_; const base::raw_ptr<WebAppUrlLoader> url_loader_; const base::raw_ptr<Profile> profile_; const base::raw_ptr<WebAppInstallFinalizer> finalizer_;
diff --git a/chrome/browser/web_applications/commands/install_from_sync_command_browsertest.cc b/chrome/browser/web_applications/commands/install_from_sync_command_browsertest.cc index d950cd0..f2f06d9 100644 --- a/chrome/browser/web_applications/commands/install_from_sync_command_browsertest.cc +++ b/chrome/browser/web_applications/commands/install_from_sync_command_browsertest.cc
@@ -9,6 +9,7 @@ #include "chrome/browser/web_applications/test/web_app_icon_test_utils.h" #include "chrome/browser/web_applications/user_display_mode.h" #include "chrome/browser/web_applications/web_app_command_manager.h" +#include "chrome/browser/web_applications/web_app_data_retriever.h" #include "chrome/browser/web_applications/web_app_helpers.h" #include "chrome/browser/web_applications/web_app_install_info.h" #include "chrome/browser/web_applications/web_app_provider.h"
diff --git a/chrome/browser/web_applications/commands/install_isolated_app_command.cc b/chrome/browser/web_applications/commands/install_isolated_app_command.cc index f549515a..28d9ff83 100644 --- a/chrome/browser/web_applications/commands/install_isolated_app_command.cc +++ b/chrome/browser/web_applications/commands/install_isolated_app_command.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/web_applications/commands/install_isolated_app_command.h" +#include <memory> #include <string> #include <utility> @@ -17,6 +18,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/web_applications/commands/web_app_command.h" +#include "chrome/browser/web_applications/locks/shared_web_contents_with_app_lock.h" #include "chrome/browser/web_applications/web_app_data_retriever.h" #include "chrome/browser/web_applications/web_app_id.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" @@ -53,7 +55,7 @@ WebAppUrlLoader& url_loader, WebAppInstallFinalizer& install_finalizer, base::OnceCallback<void(InstallIsolatedAppCommandResult)> callback) - : WebAppCommand(WebAppCommandLock::CreateForAppAndWebContentsLock( + : lock_(std::make_unique<SharedWebContentsWithAppLock>( base::flat_set<AppId>{"some random app id"})), url_(url), url_loader_(url_loader), @@ -79,6 +81,10 @@ DCHECK(callback_.is_null()); } +Lock& InstallIsolatedAppCommand::lock() const { + return *lock_; +} + void InstallIsolatedAppCommand::Start() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/chrome/browser/web_applications/commands/install_isolated_app_command.h b/chrome/browser/web_applications/commands/install_isolated_app_command.h index d7f49cb..54440ec 100644 --- a/chrome/browser/web_applications/commands/install_isolated_app_command.h +++ b/chrome/browser/web_applications/commands/install_isolated_app_command.h
@@ -7,7 +7,7 @@ #include <string> -#include "base/callback_forward.h" +#include "base/callback.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "base/strings/string_piece_forward.h" @@ -20,6 +20,8 @@ class GURL; namespace web_app { + +class SharedWebContentsWithAppLock; class WebAppDataRetriever; class WebAppInstallFinalizer; class WebAppUrlLoader; @@ -43,6 +45,8 @@ base::OnceCallback<void(InstallIsolatedAppCommandResult)> callback); ~InstallIsolatedAppCommand() override; + Lock& lock() const override; + base::Value ToDebugValue() const override; void Start() override; @@ -75,6 +79,8 @@ SEQUENCE_CHECKER(sequence_checker_); + std::unique_ptr<SharedWebContentsWithAppLock> lock_; + std::string url_; WebAppUrlLoader& url_loader_;
diff --git a/chrome/browser/web_applications/commands/install_web_app_with_params_command.cc b/chrome/browser/web_applications/commands/install_web_app_with_params_command.cc index 9d74a001..61f3547 100644 --- a/chrome/browser/web_applications/commands/install_web_app_with_params_command.cc +++ b/chrome/browser/web_applications/commands/install_web_app_with_params_command.cc
@@ -4,17 +4,17 @@ #include "chrome/browser/web_applications/commands/install_web_app_with_params_command.h" +#include <memory> #include <utility> #include "base/bind.h" -#include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/web_applications/commands/web_app_command.h" #include "chrome/browser/web_applications/commands/web_app_install_command.h" +#include "chrome/browser/web_applications/locks/noop_lock.h" #include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_helpers.h" -#include "chrome/browser/web_applications/web_app_install_task.h" #include "chrome/browser/web_applications/web_app_install_utils.h" #include "content/public/browser/web_contents.h" @@ -28,7 +28,7 @@ WebAppRegistrar* registrar, OnceInstallCallback callback, std::unique_ptr<WebAppDataRetriever> data_retriever) - : WebAppCommand(WebAppCommandLock::CreateForNoOpLock()), + : lock_(std::make_unique<NoopLock>()), web_contents_(contents), install_params_(install_params), install_surface_(install_surface), @@ -39,6 +39,10 @@ InstallWebAppWithParamsCommand::~InstallWebAppWithParamsCommand() = default; +Lock& InstallWebAppWithParamsCommand::lock() const { + return *lock_; +} + void InstallWebAppWithParamsCommand::Start() { if (!web_contents_ || web_contents_->IsBeingDestroyed()) { Abort(webapps::InstallResultCode::kWebContentsDestroyed);
diff --git a/chrome/browser/web_applications/commands/install_web_app_with_params_command.h b/chrome/browser/web_applications/commands/install_web_app_with_params_command.h index 5f2686ed..e92ab45 100644 --- a/chrome/browser/web_applications/commands/install_web_app_with_params_command.h +++ b/chrome/browser/web_applications/commands/install_web_app_with_params_command.h
@@ -21,6 +21,7 @@ namespace web_app { +class NoopLock; class WebAppDataRetriever; class WebAppInstallFinalizer; class WebAppRegistrar; @@ -38,6 +39,8 @@ std::unique_ptr<WebAppDataRetriever> data_retriever); ~InstallWebAppWithParamsCommand() override; + Lock& lock() const override; + void Start() override; void OnSyncSourceRemoved() override; void OnShutdown() override; @@ -54,6 +57,7 @@ bool valid_manifest_for_web_app, bool is_installable); + std::unique_ptr<NoopLock> lock_; base::WeakPtr<content::WebContents> web_contents_; WebAppInstallParams install_params_; webapps::WebappInstallSource install_surface_;
diff --git a/chrome/browser/web_applications/commands/run_on_os_login_command.cc b/chrome/browser/web_applications/commands/run_on_os_login_command.cc index bcd7b9a..09ce59c 100644 --- a/chrome/browser/web_applications/commands/run_on_os_login_command.cc +++ b/chrome/browser/web_applications/commands/run_on_os_login_command.cc
@@ -4,16 +4,17 @@ #include "chrome/browser/web_applications/commands/run_on_os_login_command.h" +#include <initializer_list> #include <memory> #include <string> #include "base/callback_forward.h" +#include "base/containers/flat_set.h" #include "base/memory/ptr_util.h" #include "base/metrics/histogram_functions.h" #include "chrome/browser/web_applications/commands/web_app_command.h" +#include "chrome/browser/web_applications/locks/app_lock.h" #include "chrome/browser/web_applications/os_integration/os_integration_manager.h" -#include "chrome/browser/web_applications/web_app_command_manager.h" -#include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/browser/web_applications/web_app_registry_update.h" #include "chrome/browser/web_applications/web_app_sync_bridge.h" @@ -61,7 +62,7 @@ absl::optional<RunOnOsLoginMode> login_mode, RunOnOsLoginAction set_or_sync_mode, base::OnceClosure callback) - : WebAppCommand(WebAppCommandLock::CreateForAppLock({app_id})), + : lock_(std::make_unique<AppLock, base::flat_set<AppId>>({app_id})), app_id_(app_id), registrar_(registrar), os_integration_manager_(os_integration_manager), @@ -72,6 +73,10 @@ RunOnOsLoginCommand::~RunOnOsLoginCommand() = default; +Lock& RunOnOsLoginCommand::lock() const { + return *lock_; +} + void RunOnOsLoginCommand::Start() { switch (set_or_sync_mode_) { case RunOnOsLoginAction::kSetModeInDBAndOS:
diff --git a/chrome/browser/web_applications/commands/run_on_os_login_command.h b/chrome/browser/web_applications/commands/run_on_os_login_command.h index 4512ab9a..d1b8673 100644 --- a/chrome/browser/web_applications/commands/run_on_os_login_command.h +++ b/chrome/browser/web_applications/commands/run_on_os_login_command.h
@@ -16,6 +16,7 @@ namespace web_app { +class AppLock; class WebAppRegistrar; class OsIntegrationManager; class WebAppSyncBridge; @@ -54,6 +55,9 @@ const AppId& app_id, base::OnceClosure callback); ~RunOnOsLoginCommand() override; + + Lock& lock() const override; + void Start() override; void OnSyncSourceRemoved() override{}; void OnShutdown() override; @@ -82,6 +86,7 @@ void RecordCompletionState( RunOnOsLoginCommandCompletionState completion_state); + std::unique_ptr<AppLock> lock_; AppId app_id_; base::raw_ptr<WebAppRegistrar> registrar_; base::raw_ptr<OsIntegrationManager> os_integration_manager_;
diff --git a/chrome/browser/web_applications/commands/sub_app_install_command.cc b/chrome/browser/web_applications/commands/sub_app_install_command.cc index 3fba05c..945e028 100644 --- a/chrome/browser/web_applications/commands/sub_app_install_command.cc +++ b/chrome/browser/web_applications/commands/sub_app_install_command.cc
@@ -3,7 +3,20 @@ // found in the LICENSE file. #include "chrome/browser/web_applications/commands/sub_app_install_command.h" + +#include <memory> + +#include "base/callback.h" +#include "base/ranges/algorithm.h" +#include "chrome/browser/web_applications/locks/app_lock.h" #include "chrome/browser/web_applications/web_app_helpers.h" +#include "chrome/browser/web_applications/web_app_id.h" +#include "chrome/browser/web_applications/web_app_install_info.h" +#include "chrome/browser/web_applications/web_app_install_manager.h" +#include "chrome/browser/web_applications/web_app_registrar.h" +#include "third_party/blink/public/mojom/subapps/sub_apps_service.mojom-shared.h" + +namespace web_app { static blink::mojom::SubAppsServiceAddResultCode InstallResultCodeToMojo( webapps::InstallResultCode install_result_code) { @@ -42,14 +55,13 @@ } SubAppInstallCommand::SubAppInstallCommand( - web_app::WebAppInstallManager* install_manager, - web_app::WebAppRegistrar* registrar, - web_app::AppId& parent_app_id, - std::vector<std::pair<web_app::UnhashedAppId, GURL>> sub_apps, - base::flat_set<web_app::AppId> app_ids_for_lock, + WebAppInstallManager* install_manager, + WebAppRegistrar* registrar, + AppId& parent_app_id, + std::vector<std::pair<UnhashedAppId, GURL>> sub_apps, + base::flat_set<AppId> app_ids_for_lock, base::OnceCallback<void(AppInstallResults)> callback) - : WebAppCommand{web_app::WebAppCommandLock::CreateForAppLock( - app_ids_for_lock)}, + : lock_(std::make_unique<AppLock>(app_ids_for_lock)), install_manager_{install_manager}, registrar_{registrar}, requested_installs_{std::move(sub_apps)}, @@ -58,6 +70,10 @@ SubAppInstallCommand::~SubAppInstallCommand() = default; +Lock& SubAppInstallCommand::lock() const { + return *lock_; +} + void SubAppInstallCommand::Start() { DCHECK(state_ == State::kNotStarted); @@ -72,14 +88,14 @@ blink::mojom::SubAppsServiceAddResultCode::kParentAppUninstalled}; }); SignalCompletionAndSelfDestruct( - web_app::CommandResult::kFailure, + CommandResult::kFailure, base::BindOnce(std::move(install_callback_), results_)); return; } if (requested_installs_.empty()) { SignalCompletionAndSelfDestruct( - web_app::CommandResult::kSuccess, + CommandResult::kSuccess, base::BindOnce(std::move(install_callback_), results_)); return; } @@ -98,17 +114,16 @@ void SubAppInstallCommand::StartNextInstall() { DCHECK(!requested_installs_.empty()); - std::pair<web_app::UnhashedAppId, GURL> install_info = + std::pair<UnhashedAppId, GURL> install_info = std::move(requested_installs_.back()); - const web_app::UnhashedAppId& unhashed_app_id = install_info.first; + const UnhashedAppId& unhashed_app_id = install_info.first; GURL install_url = install_info.second; requested_installs_.pop_back(); // TODO(https://crbug.com/1327963): Update to use WebAppCommand version of // WebAppInstallManager::InstallSubApp once implemented. install_manager_->InstallSubApp( - parent_app_id_, install_url, - web_app::GenerateAppIdFromUnhashed(unhashed_app_id), + parent_app_id_, install_url, GenerateAppIdFromUnhashed(unhashed_app_id), base::BindOnce(&SubAppInstallCommand::OnDialogRequested, weak_ptr_factory_.GetWeakPtr(), unhashed_app_id), base::BindOnce(&SubAppInstallCommand::OnInstalled, @@ -116,10 +131,10 @@ } void SubAppInstallCommand::OnDialogRequested( - const web_app::UnhashedAppId& unhashed_app_id, + const UnhashedAppId& unhashed_app_id, content::WebContents* initiator_web_contents, std::unique_ptr<WebAppInstallInfo> web_app_info, - web_app::WebAppInstallationAcceptanceCallback acceptance_callback) { + WebAppInstallationAcceptanceCallback acceptance_callback) { acceptance_callbacks_.emplace_back(unhashed_app_id, std::move(web_app_info), std::move(acceptance_callback)); @@ -137,7 +152,7 @@ if (acceptance_callbacks_.empty()) { SignalCompletionAndSelfDestruct( - web_app::CommandResult::kFailure, + CommandResult::kFailure, base::BindOnce(std::move(install_callback_), results_)); return; } @@ -152,10 +167,9 @@ acceptance_callbacks_.clear(); } -void SubAppInstallCommand::OnInstalled( - const web_app::UnhashedAppId& unhashed_app_id, - const web_app::AppId& app_id, - webapps::InstallResultCode result) { +void SubAppInstallCommand::OnInstalled(const UnhashedAppId& unhashed_app_id, + const AppId& app_id, + webapps::InstallResultCode result) { AddResultAndRemoveFromPendingInstalls(unhashed_app_id, result); // In case an installation returns with a failure before running the dialog @@ -176,14 +190,16 @@ } SignalCompletionAndSelfDestruct( - web_app::CommandResult::kSuccess, + CommandResult::kSuccess, base::BindOnce(std::move(install_callback_), results_)); } void SubAppInstallCommand::AddResultAndRemoveFromPendingInstalls( - const web_app::UnhashedAppId& unhashed_app_id, + const UnhashedAppId& unhashed_app_id, webapps::InstallResultCode result) { std::pair result_pair(unhashed_app_id, InstallResultCodeToMojo(result)); results_.emplace_back(result_pair); pending_installs_.erase(unhashed_app_id); } + +} // namespace web_app
diff --git a/chrome/browser/web_applications/commands/sub_app_install_command.h b/chrome/browser/web_applications/commands/sub_app_install_command.h index 1faadcf7..8124b48f 100644 --- a/chrome/browser/web_applications/commands/sub_app_install_command.h +++ b/chrome/browser/web_applications/commands/sub_app_install_command.h
@@ -5,31 +5,49 @@ #ifndef CHROME_BROWSER_WEB_APPLICATIONS_COMMANDS_SUB_APP_INSTALL_COMMAND_H_ #define CHROME_BROWSER_WEB_APPLICATIONS_COMMANDS_SUB_APP_INSTALL_COMMAND_H_ -#include "base/callback_forward.h" +#include <string> + +#include "base/callback.h" #include "base/memory/raw_ptr.h" +#include "base/memory/weak_ptr.h" #include "chrome/browser/web_applications/commands/web_app_command.h" +#include "chrome/browser/web_applications/locks/lock.h" #include "chrome/browser/web_applications/web_app_id.h" -#include "chrome/browser/web_applications/web_app_install_info.h" -#include "chrome/browser/web_applications/web_app_install_manager.h" +#include "chrome/browser/web_applications/web_app_install_params.h" #include "components/webapps/browser/install_result_code.h" -#include "content/public/browser/web_contents.h" #include "third_party/blink/public/mojom/subapps/sub_apps_service.mojom-shared.h" +#include "third_party/skia/include/core/SkBitmap.h" +#include "url/gurl.h" -using AppInstallResults = std::vector< - std::pair<web_app::AppId, blink::mojom::SubAppsServiceAddResultCode>>; +struct WebAppInstallInfo; -class SubAppInstallCommand : public web_app::WebAppCommand { +namespace content { +class WebContents; +} + +namespace web_app { + +class AppLock; +class WebAppInstallManager; +class WebAppRegistrar; + +using AppInstallResults = + std::vector<std::pair<AppId, blink::mojom::SubAppsServiceAddResultCode>>; + +class SubAppInstallCommand : public WebAppCommand { public: - SubAppInstallCommand( - web_app::WebAppInstallManager* install_manager, - web_app::WebAppRegistrar* registrar, - web_app::AppId& parent_app_id, - std::vector<std::pair<web_app::UnhashedAppId, GURL>> sub_apps, - base::flat_set<web_app::AppId> app_ids_for_lock, - base::OnceCallback<void(AppInstallResults)> callback); + SubAppInstallCommand(WebAppInstallManager* install_manager, + WebAppRegistrar* registrar, + AppId& parent_app_id, + std::vector<std::pair<UnhashedAppId, GURL>> sub_apps, + base::flat_set<AppId> app_ids_for_lock, + base::OnceCallback<void(AppInstallResults)> callback); ~SubAppInstallCommand() override; SubAppInstallCommand(const SubAppInstallCommand&) = delete; SubAppInstallCommand& operator=(const SubAppInstallCommand&) = delete; + + Lock& lock() const override; + base::Value ToDebugValue() const override; protected: @@ -47,34 +65,35 @@ void StartNextInstall(); void OnDialogRequested( - const web_app::UnhashedAppId& app_id, + const UnhashedAppId& app_id, content::WebContents* initiator_web_contents, std::unique_ptr<WebAppInstallInfo> web_app_info, - web_app::WebAppInstallationAcceptanceCallback acceptance_callback); + WebAppInstallationAcceptanceCallback acceptance_callback); void MaybeShowDialog(); - void OnInstalled(const web_app::UnhashedAppId& unhashed_app_id, - const web_app::AppId& app_id, + void OnInstalled(const UnhashedAppId& unhashed_app_id, + const AppId& app_id, webapps::InstallResultCode result); void MaybeFinishCommand(); void AddResultAndRemoveFromPendingInstalls( - const web_app::UnhashedAppId& unhashed_app_id, + const UnhashedAppId& unhashed_app_id, webapps::InstallResultCode result); - raw_ptr<web_app::WebAppInstallManager> install_manager_; - raw_ptr<web_app::WebAppRegistrar> registrar_; - std::vector<std::pair<web_app::UnhashedAppId, GURL>> requested_installs_; - std::set<web_app::UnhashedAppId> pending_installs_; + std::unique_ptr<AppLock> lock_; + raw_ptr<WebAppInstallManager> install_manager_; + raw_ptr<WebAppRegistrar> registrar_; + std::vector<std::pair<UnhashedAppId, GURL>> requested_installs_; + std::set<UnhashedAppId> pending_installs_; size_t num_pending_dialog_callbacks_ = 0; AppInstallResults results_; - const web_app::AppId parent_app_id_; + const AppId parent_app_id_; base::OnceCallback<void(AppInstallResults)> install_callback_; std::vector< - std::tuple<web_app::UnhashedAppId, + std::tuple<UnhashedAppId, std::unique_ptr<WebAppInstallInfo>, base::OnceCallback<void(bool user_accepted, std::unique_ptr<WebAppInstallInfo>)>>> @@ -83,4 +102,6 @@ base::WeakPtrFactory<SubAppInstallCommand> weak_ptr_factory_{this}; }; +} // namespace web_app + #endif // CHROME_BROWSER_WEB_APPLICATIONS_COMMANDS_SUB_APP_INSTALL_COMMAND_H_
diff --git a/chrome/browser/web_applications/commands/web_app_command.cc b/chrome/browser/web_applications/commands/web_app_command.cc index 4fc4da7..9d2ec9fd 100644 --- a/chrome/browser/web_applications/commands/web_app_command.cc +++ b/chrome/browser/web_applications/commands/web_app_command.cc
@@ -11,141 +11,7 @@ namespace web_app { -namespace { -// Creates a `LeveledLockRange` that only includes the provided string `key` -content::LeveledLockRange StringToLockRange(std::string key) { - return content::LeveledLockRange{key, key + static_cast<char>(0)}; -} - -enum KeysOnStaticLevel { - kFullSystem = 0, - kBackgroundWebContents = 1, - kNoOp = 2, -}; - -} // namespace - -WebAppCommandLock::WebAppCommandLock(base::flat_set<AppId> app_ids, - LockType lock_type, - LockRequestSet lock_requests) - : app_ids_(std::move(app_ids)), - lock_type_(lock_type), - lock_requests_(std::move(lock_requests)) {} - -WebAppCommandLock::WebAppCommandLock(WebAppCommandLock&&) = default; -WebAppCommandLock& WebAppCommandLock::operator=(WebAppCommandLock&&) = default; - -WebAppCommandLock::~WebAppCommandLock() = default; - -// static -WebAppCommandLock WebAppCommandLock::CreateForFullSystemLock() { - LockRequestSet lock_requests = { - content::LeveledLockManager::LeveledLockRequest( - static_cast<int>(LockLevel::kStatic), - StringToLockRange( - base::NumberToString(KeysOnStaticLevel::kFullSystem)), - content::LeveledLockManager::LockType::kExclusive)}; - return WebAppCommandLock({}, LockType::kFullSystem, std::move(lock_requests)); -} - -// static -WebAppCommandLock WebAppCommandLock::CreateForBackgroundWebContentsLock() { - LockRequestSet lock_requests = { - GetSharedWebContentsLock(), - content::LeveledLockManager::LeveledLockRequest( - static_cast<int>(LockLevel::kStatic), - StringToLockRange( - base::NumberToString(KeysOnStaticLevel::kFullSystem)), - content::LeveledLockManager::LockType::kShared)}; - return WebAppCommandLock({}, LockType::kBackgroundWebContents, - std::move(lock_requests)); -} - -// static -WebAppCommandLock WebAppCommandLock::CreateForAppLock( - base::flat_set<AppId> app_ids) { - LockRequestSet lock_requests; - lock_requests.emplace( - static_cast<int>(LockLevel::kStatic), - StringToLockRange(base::NumberToString(KeysOnStaticLevel::kFullSystem)), - content::LeveledLockManager::LockType::kShared); - - for (const auto& app_id : app_ids) { - lock_requests.emplace(static_cast<int>(LockLevel::kApp), - StringToLockRange(app_id), - content::LeveledLockManager::LockType::kExclusive); - } - return WebAppCommandLock(app_ids, LockType::kApp, std::move(lock_requests)); -} - -// static -WebAppCommandLock WebAppCommandLock::CreateForAppAndWebContentsLock( - base::flat_set<AppId> app_ids) { - LockRequestSet lock_requests = { - GetSharedWebContentsLock(), - content::LeveledLockManager::LeveledLockRequest( - static_cast<int>(LockLevel::kStatic), - StringToLockRange( - base::NumberToString(KeysOnStaticLevel::kFullSystem)), - content::LeveledLockManager::LockType::kShared)}; - for (const auto& app_id : app_ids) { - lock_requests.emplace(static_cast<int>(LockLevel::kApp), - StringToLockRange(app_id), - content::LeveledLockManager::LockType::kExclusive); - } - return WebAppCommandLock(app_ids, LockType::kAppAndWebContents, - std::move(lock_requests)); -} - -// static -WebAppCommandLock WebAppCommandLock::CreateForNoOpLock() { - LockRequestSet lock_requests; - lock_requests.emplace( - static_cast<int>(LockLevel::kStatic), - StringToLockRange(base::NumberToString(KeysOnStaticLevel::kNoOp)), - content::LeveledLockManager::LockType::kShared); - return WebAppCommandLock({}, LockType::kNoOp, std::move(lock_requests)); -} - -bool WebAppCommandLock::IsAppLocked(const AppId& app_id) const { - switch (lock_type_) { - case LockType::kFullSystem: - return true; - case LockType::kBackgroundWebContents: - return false; - case LockType::kAppAndWebContents: - return app_ids_.contains(app_id); - case LockType::kApp: - return app_ids_.contains(app_id); - case LockType::kNoOp: - return false; - } -} - -bool WebAppCommandLock::IncludesSharedWebContents() const { - switch (lock_type_) { - case LockType::kBackgroundWebContents: - case LockType::kAppAndWebContents: - return true; - case LockType::kFullSystem: - case LockType::kApp: - case LockType::kNoOp: - return false; - } -} - -// static -content::LeveledLockManager::LeveledLockRequest -WebAppCommandLock::GetSharedWebContentsLock() { - return content::LeveledLockManager::LeveledLockRequest( - {static_cast<int>(LockLevel::kStatic), - StringToLockRange( - base::NumberToString(KeysOnStaticLevel::kBackgroundWebContents)), - content::LeveledLockManager::LockType::kExclusive}); -} - -WebAppCommand::WebAppCommand(WebAppCommandLock command_lock) - : command_lock_(std::move(command_lock)) { +WebAppCommand::WebAppCommand() { DETACH_FROM_SEQUENCE(command_sequence_checker_); // We don't have an easy way to enforce construction of class on the // WebAppProvider sequence without requiring a UI thread in unittests, so just
diff --git a/chrome/browser/web_applications/commands/web_app_command.h b/chrome/browser/web_applications/commands/web_app_command.h index 9e5cbf8..e1c1a449 100644 --- a/chrome/browser/web_applications/commands/web_app_command.h +++ b/chrome/browser/web_applications/commands/web_app_command.h
@@ -10,10 +10,7 @@ #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "base/values.h" -#include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_app_id.h" -#include "components/services/storage/indexed_db/locks/disjoint_range_lock_manager.h" -#include "components/services/storage/indexed_db/locks/leveled_lock_manager.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace content { @@ -22,85 +19,9 @@ namespace web_app { +class Lock; class WebAppCommandManager; -class WebAppCommandLock { - public: - using LockRequestSet = - base::flat_set<content::DisjointRangeLockManager::LeveledLockRequest>; - - WebAppCommandLock(WebAppCommandLock&&); - WebAppCommandLock& operator=(WebAppCommandLock&&); - - WebAppCommandLock(const WebAppCommandLock&) = delete; - WebAppCommandLock& operator=(const WebAppCommandLock&) = delete; - - ~WebAppCommandLock(); - - // Creates a lock that guarantees isolation against all commands. - // This makes sure that all commands are finished before this command is - // started, and no command will be started during execution of the command. - static WebAppCommandLock CreateForFullSystemLock(); - - // Creates a lock that guarantees isolation against all - // commands that also use this lock type. Background web app installations can - // use this lock to run tasks sequentially that loads a `WebContents` in the - // background to avoid adding too much load to the system. - static WebAppCommandLock CreateForBackgroundWebContentsLock(); - - // Creates a lock that guarantees isolation against all commands that has lock - // on any of the `app_ids`. - static WebAppCommandLock CreateForAppLock(base::flat_set<AppId> app_ids); - - // Creates a lock that guarantees isolation against all commands that has lock - // on any of the `app_ids` and also grants access to the shared web contents. - static WebAppCommandLock CreateForAppAndWebContentsLock( - base::flat_set<AppId> app_ids); - - // Creates a no-op lock that doesn't lock on anything. This is useful to - // create commands that doesn't need isolation protection but would like to be - // managed by WebAppCommandManager for consistent lifecycle management. - static WebAppCommandLock CreateForNoOpLock(); - - const LockRequestSet& GetLockRequests() const { return lock_requests_; } - - bool IsAppLocked(const AppId& app_id) const; - - bool IncludesSharedWebContents() const; - - const base::flat_set<AppId>& app_ids() const { return app_ids_; } - - friend class WebAppCommandManager; - - private: - enum class LockType { - kFullSystem, - kApp, - kAppAndWebContents, - kBackgroundWebContents, - kNoOp, - }; - - explicit WebAppCommandLock(base::flat_set<AppId> app_ids, - LockType lock_type, - LockRequestSet lock_requests); - - // Exposed for usage in the WebAppCommandManager to determine if the shared - // web contents can be destroyed. - static content::LeveledLockManager::LeveledLockRequest - GetSharedWebContentsLock(); - - enum class LockLevel { - kStatic = 0, - kApp = 1, - kMaxValue = kApp, - }; - - base::flat_set<AppId> app_ids_{}; - LockType lock_type_; - LockRequestSet lock_requests_{}; -}; - enum class CommandResult { kSuccess, kFailure, kShutdown }; // Each command has a queue id, which is either an `AppId` corresponding to a @@ -130,28 +51,29 @@ class WebAppCommand { public: using Id = int; - explicit WebAppCommand(WebAppCommandLock command_lock); + WebAppCommand(); virtual ~WebAppCommand(); - // Unique id generated for this command. Currently only used for debug values. - Id id() const { return id_; } - - // The command lock that contains isolation information. - const WebAppCommandLock& lock() const { return command_lock_; } - // Returns if the command has been started yet. bool IsStarted() const { return command_manager_ != nullptr; } - // Returns the pre-existing web contents the installation was - // initiated with. Only implements this when the command is used for - // installation and uses a pre-existing web contents. - virtual content::WebContents* GetInstallingWebContents(); + // Unique id generated for this command. Currently only used for debug values. + Id id() const { return id_; } // Returns a debug value to log the state of the command. Used in // chrome://web-app-internals. virtual base::Value ToDebugValue() const = 0; protected: + // The command lock that contains isolation information. Mutable so the + // command manager can use it with `WebAppLockManager::AcquireLock`. + virtual Lock& lock() const = 0; + + // Returns the pre-existing web contents the installation was + // initiated with. Only implements this when the command is used for + // installation and uses a pre-existing web contents. + virtual content::WebContents* GetInstallingWebContents(); + // Triggered by the WebAppCommandManager. Signals that this command can // start its operations. When this command is complete, it should call // `SignalCompletionAndSelfDestruct` to signal it's completion and destruct @@ -207,7 +129,6 @@ base::WeakPtr<WebAppCommand> AsWeakPtr(); Id id_; - WebAppCommandLock command_lock_; raw_ptr<WebAppCommandManager> command_manager_ = nullptr; // Because this is owned by the command manager, it will always outlive this // object. Thus a raw pointer is save. @@ -218,5 +139,7 @@ base::WeakPtrFactory<WebAppCommand> weak_factory_{this}; }; + } // namespace web_app + #endif // CHROME_BROWSER_WEB_APPLICATIONS_COMMANDS_WEB_APP_COMMAND_H_
diff --git a/chrome/browser/web_applications/commands/web_app_install_command.cc b/chrome/browser/web_applications/commands/web_app_install_command.cc index 3a2352d..6f859f6 100644 --- a/chrome/browser/web_applications/commands/web_app_install_command.cc +++ b/chrome/browser/web_applications/commands/web_app_install_command.cc
@@ -4,14 +4,17 @@ #include "chrome/browser/web_applications/commands/web_app_install_command.h" +#include <memory> #include <utility> #include "base/bind.h" +#include "base/containers/flat_set.h" #include "base/feature_list.h" #include "base/metrics/histogram_macros.h" #include "base/strings/stringprintf.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/web_applications/install_bounce_metric.h" +#include "chrome/browser/web_applications/locks/app_lock.h" #include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_data_retriever.h" #include "chrome/browser/web_applications/web_app_id.h" @@ -139,7 +142,7 @@ const GURL& manifest_url, WebAppInstallFlow flow, absl::optional<WebAppInstallParams> install_params) - : WebAppCommand(WebAppCommandLock::CreateForAppLock({app_id})), + : lock_(std::make_unique<AppLock, base::flat_set<AppId>>({app_id})), profile_(profile), install_finalizer_(install_finalizer), data_retriever_(std::move(data_retriever)), @@ -169,6 +172,10 @@ WebAppInstallCommand::~WebAppInstallCommand() = default; +Lock& WebAppInstallCommand::lock() const { + return *lock_; +} + void WebAppInstallCommand::Start() { // This metric is recorded regardless of the installation result. if (webapps::InstallableMetrics::IsReportableInstallSource(
diff --git a/chrome/browser/web_applications/commands/web_app_install_command.h b/chrome/browser/web_applications/commands/web_app_install_command.h index 5c97f56b..2101924 100644 --- a/chrome/browser/web_applications/commands/web_app_install_command.h +++ b/chrome/browser/web_applications/commands/web_app_install_command.h
@@ -9,14 +9,19 @@ #include "base/memory/weak_ptr.h" #include "base/values.h" +#include "build/buildflag.h" #include "chrome/browser/web_applications/commands/web_app_command.h" +#include "chrome/browser/web_applications/os_integration/os_integration_manager.h" #include "chrome/browser/web_applications/web_app_id.h" #include "chrome/browser/web_applications/web_app_install_params.h" -#include "chrome/browser/web_applications/web_app_install_task.h" #include "chrome/browser/web_applications/web_app_logging.h" #include "components/webapps/browser/installable/installable_metrics.h" #include "third_party/blink/public/mojom/manifest/manifest.mojom-forward.h" +#if BUILDFLAG(IS_CHROMEOS_LACROS) +#include "chromeos/crosapi/mojom/arc.mojom.h" +#endif + class Profile; namespace content { @@ -25,6 +30,7 @@ namespace web_app { +class AppLock; class WebAppDataRetriever; class WebAppInstallFinalizer; class WebAppRegistrar; @@ -52,6 +58,8 @@ absl::optional<WebAppInstallParams> install_params = absl::nullopt); ~WebAppInstallCommand() override; + Lock& lock() const override; + void Start() override; void OnSyncSourceRemoved() override; void OnShutdown() override; @@ -106,6 +114,7 @@ webapps::InstallResultCode code, OsHooksErrors os_hooks_errors); + std::unique_ptr<AppLock> lock_; Profile* profile_; WebAppInstallFinalizer* install_finalizer_; std::unique_ptr<WebAppDataRetriever> data_retriever_;
diff --git a/chrome/browser/web_applications/commands/web_app_uninstall_command.cc b/chrome/browser/web_applications/commands/web_app_uninstall_command.cc index 3d001ff..de8bdf1 100644 --- a/chrome/browser/web_applications/commands/web_app_uninstall_command.cc +++ b/chrome/browser/web_applications/commands/web_app_uninstall_command.cc
@@ -4,17 +4,17 @@ #include "chrome/browser/web_applications/commands/web_app_uninstall_command.h" +#include <memory> #include <utility> #include "base/bind.h" -#include "base/feature_list.h" -#include "base/logging.h" +#include "base/containers/flat_set.h" #include "base/metrics/histogram_functions.h" #include "base/strings/stringprintf.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/web_applications/isolation_prefs_utils.h" +#include "chrome/browser/web_applications/locks/app_lock.h" #include "chrome/browser/web_applications/web_app.h" -#include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_icon_manager.h" #include "chrome/browser/web_applications/web_app_id.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" @@ -25,7 +25,6 @@ #include "chrome/browser/web_applications/web_app_translation_manager.h" #include "components/webapps/browser/installable/installable_metrics.h" #include "components/webapps/browser/uninstall_result_code.h" -#include "third_party/abseil-cpp/absl/types/optional.h" namespace web_app { @@ -42,7 +41,7 @@ WebAppTranslationManager* translation_manager, webapps::WebappUninstallSource source, UninstallWebAppCallback callback) - : WebAppCommand(WebAppCommandLock::CreateForAppLock({app_id})), + : lock_(std::make_unique<AppLock, base::flat_set<AppId>>({app_id})), app_id_(app_id), app_origin_(app_origin), source_(source), @@ -58,6 +57,10 @@ WebAppUninstallCommand::~WebAppUninstallCommand() = default; +Lock& WebAppUninstallCommand::lock() const { + return *lock_; +} + void WebAppUninstallCommand::Start() { if (!registrar_->GetAppById(app_id_)) { Abort(webapps::UninstallResultCode::kNoAppToUninstall);
diff --git a/chrome/browser/web_applications/commands/web_app_uninstall_command.h b/chrome/browser/web_applications/commands/web_app_uninstall_command.h index 3c53d086..7760b09 100644 --- a/chrome/browser/web_applications/commands/web_app_uninstall_command.h +++ b/chrome/browser/web_applications/commands/web_app_uninstall_command.h
@@ -23,6 +23,7 @@ namespace web_app { +class AppLock; class OsIntegrationManager; class WebAppIconManager; class WebAppInstallManager; @@ -51,6 +52,8 @@ UninstallWebAppCallback callback); ~WebAppUninstallCommand() override; + Lock& lock() const override; + void Start() override; void OnSyncSourceRemoved() override; void OnShutdown() override; @@ -71,6 +74,7 @@ kDone = 2, } state_ = State::kNotStarted; + std::unique_ptr<AppLock> lock_; AppId app_id_; url::Origin app_origin_; webapps::WebappUninstallSource source_;
diff --git a/chrome/browser/web_applications/locks/app_lock.cc b/chrome/browser/web_applications/locks/app_lock.cc new file mode 100644 index 0000000..2fa58ed1 --- /dev/null +++ b/chrome/browser/web_applications/locks/app_lock.cc
@@ -0,0 +1,15 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/web_applications/locks/app_lock.h" + +#include "chrome/browser/web_applications/locks/lock.h" + +namespace web_app { + +AppLock::AppLock(base::flat_set<AppId> app_ids) + : Lock(std::move(app_ids), Lock::Type::kApp) {} +AppLock::~AppLock() = default; + +} // namespace web_app
diff --git a/chrome/browser/web_applications/locks/app_lock.h b/chrome/browser/web_applications/locks/app_lock.h new file mode 100644 index 0000000..b298dde --- /dev/null +++ b/chrome/browser/web_applications/locks/app_lock.h
@@ -0,0 +1,28 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_APP_LOCK_H_ +#define CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_APP_LOCK_H_ + +#include "base/containers/flat_set.h" +#include "chrome/browser/web_applications/locks/lock.h" +#include "chrome/browser/web_applications/web_app_id.h" + +namespace web_app { + +// This locks the given app ids in the WebAppProvider system. +// +// Locks can be acquired by using the `WebAppLockManager`. The lock is acquired +// when the callback given to the WebAppLockManager is called. Destruction of +// this class will release the lock or cancel the lock request if it is not +// acquired yet. +class AppLock : public Lock { + public: + explicit AppLock(base::flat_set<AppId> app_ids); + ~AppLock(); +}; + +} // namespace web_app + +#endif // CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_APP_LOCK_H_
diff --git a/chrome/browser/web_applications/locks/full_system_lock.cc b/chrome/browser/web_applications/locks/full_system_lock.cc new file mode 100644 index 0000000..e53c50f3 --- /dev/null +++ b/chrome/browser/web_applications/locks/full_system_lock.cc
@@ -0,0 +1,14 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/web_applications/locks/full_system_lock.h" + +#include "chrome/browser/web_applications/locks/lock.h" + +namespace web_app { + +FullSystemLock::FullSystemLock() : Lock({}, Lock::Type::kFullSystem) {} +FullSystemLock::~FullSystemLock() = default; + +} // namespace web_app
diff --git a/chrome/browser/web_applications/locks/full_system_lock.h b/chrome/browser/web_applications/locks/full_system_lock.h new file mode 100644 index 0000000..0195504 --- /dev/null +++ b/chrome/browser/web_applications/locks/full_system_lock.h
@@ -0,0 +1,27 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_FULL_SYSTEM_LOCK_H_ +#define CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_FULL_SYSTEM_LOCK_H_ + +#include "chrome/browser/web_applications/locks/lock.h" + +namespace web_app { + +// This locks the whole system. No other locks can be held when this lock is +// acquired. +// +// Locks can be acquired by using the `WebAppLockManager`. The lock is acquired +// when the callback given to the WebAppLockManager is called. Destruction of +// this class will release the lock or cancel the lock request if it is not +// acquired yet. +class FullSystemLock : public Lock { + public: + FullSystemLock(); + ~FullSystemLock(); +}; + +} // namespace web_app + +#endif // CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_FULL_SYSTEM_LOCK_H_
diff --git a/chrome/browser/web_applications/locks/lock.cc b/chrome/browser/web_applications/locks/lock.cc new file mode 100644 index 0000000..a072fc7 --- /dev/null +++ b/chrome/browser/web_applications/locks/lock.cc
@@ -0,0 +1,27 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/web_applications/locks/lock.h" + +#include "components/services/storage/indexed_db/locks/leveled_lock_manager.h" + +namespace web_app { + +Lock::Lock(base::flat_set<AppId> app_ids, Lock::Type type) + : app_ids_(std::move(app_ids)), type_(type) {} +Lock::~Lock() = default; + +bool Lock::IncludesSharedWebContents() const { + switch (type_) { + case Type::kNoOp: + case Type::kFullSystem: + case Type::kApp: + return false; + case Type::kBackgroundWebContents: + case Type::kAppAndWebContents: + return true; + } +} + +} // namespace web_app
diff --git a/chrome/browser/web_applications/locks/lock.h b/chrome/browser/web_applications/locks/lock.h new file mode 100644 index 0000000..fdafc0f0 --- /dev/null +++ b/chrome/browser/web_applications/locks/lock.h
@@ -0,0 +1,74 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_LOCK_H_ +#define CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_LOCK_H_ + +#include <memory> + +#include "base/containers/flat_set.h" +#include "base/memory/weak_ptr.h" +#include "chrome/browser/web_applications/web_app_id.h" + +namespace content { +struct LeveledLockHolder; +} + +namespace web_app { + +// Represents a lock in the WebAppProvider system. Locks can be acquired by +// creating one of the subclasses of this class, and using the +// `WebAppLockManager` to acquire the lock. The lock is acquired when the +// callback given to the WebAppLockManager is called. Destruction of this class +// will release the lock or cancel the lock request if it is not acquired yet. +class Lock { + public: + enum class Type { + kNoOp, + kBackgroundWebContents, + kApp, + kAppAndWebContents, + kFullSystem, + }; + + Lock(Lock&&); + Lock& operator=(Lock&&); + + Lock(const Lock&) = delete; + Lock& operator=(const Lock&) = delete; + + ~Lock(); + + Type type() const { return type_; } + + const base::flat_set<AppId>& app_ids() const { return app_ids_; } + + // Shortcut methods looking at the `type()`. Returns if this lock includes an + // exclusive lock on the shared web contents. + bool IncludesSharedWebContents() const; + + bool HasLockBeenRequested() const { return !!holder_.get(); } + + protected: + explicit Lock(base::flat_set<AppId> app_ids, Type type); + + private: + friend class WebAppLockManager; + + enum class LockLevel { + kStatic = 0, + kApp = 1, + kMaxValue = kApp, + }; + + std::unique_ptr<content::LeveledLockHolder> holder_; + const base::flat_set<AppId> app_ids_{}; + const Type type_; + + base::WeakPtrFactory<Lock> weak_factory_{this}; +}; + +} // namespace web_app + +#endif // CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_LOCK_H_
diff --git a/chrome/browser/web_applications/locks/noop_lock.cc b/chrome/browser/web_applications/locks/noop_lock.cc new file mode 100644 index 0000000..f9de2c23 --- /dev/null +++ b/chrome/browser/web_applications/locks/noop_lock.cc
@@ -0,0 +1,14 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/web_applications/locks/noop_lock.h" + +#include "chrome/browser/web_applications/locks/lock.h" + +namespace web_app { + +NoopLock::NoopLock() : Lock({}, Lock::Type::kNoOp) {} +NoopLock::~NoopLock() = default; + +} // namespace web_app
diff --git a/chrome/browser/web_applications/locks/noop_lock.h b/chrome/browser/web_applications/locks/noop_lock.h new file mode 100644 index 0000000..42edb22 --- /dev/null +++ b/chrome/browser/web_applications/locks/noop_lock.h
@@ -0,0 +1,27 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_NOOP_LOCK_H_ +#define CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_NOOP_LOCK_H_ + +#include "chrome/browser/web_applications/locks/lock.h" + +namespace web_app { + +// This lock essentially doesn't lock anything in the system. However, if a +// `FullSystemLock` is used, then that will block the acquisition of this lock. +// +// Locks can be acquired by using the `WebAppLockManager`. The lock is acquired +// when the callback given to the WebAppLockManager is called. Destruction of +// this class will release the lock or cancel the lock request if it is not +// acquired yet. +class NoopLock : public Lock { + public: + NoopLock(); + ~NoopLock(); +}; + +} // namespace web_app + +#endif // CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_NOOP_LOCK_H_
diff --git a/chrome/browser/web_applications/locks/shared_web_contents_lock.cc b/chrome/browser/web_applications/locks/shared_web_contents_lock.cc new file mode 100644 index 0000000..f7200e22 --- /dev/null +++ b/chrome/browser/web_applications/locks/shared_web_contents_lock.cc
@@ -0,0 +1,15 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/web_applications/locks/shared_web_contents_lock.h" + +#include "chrome/browser/web_applications/locks/lock.h" + +namespace web_app { + +SharedWebContentsLock::SharedWebContentsLock() + : Lock({}, Lock::Type::kBackgroundWebContents) {} +SharedWebContentsLock::~SharedWebContentsLock() = default; + +} // namespace web_app
diff --git a/chrome/browser/web_applications/locks/shared_web_contents_lock.h b/chrome/browser/web_applications/locks/shared_web_contents_lock.h new file mode 100644 index 0000000..5aef125 --- /dev/null +++ b/chrome/browser/web_applications/locks/shared_web_contents_lock.h
@@ -0,0 +1,28 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_SHARED_WEB_CONTENTS_LOCK_H_ +#define CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_SHARED_WEB_CONTENTS_LOCK_H_ + +#include "chrome/browser/web_applications/locks/lock.h" + +namespace web_app { + +// This locks the background shared web contents that is used by the +// WebAppProvider system to do operations in the background that require a web +// contents, like install web apps and fetch data. +// +// Locks can be acquired by using the `WebAppLockManager`. The lock is acquired +// when the callback given to the WebAppLockManager is called. Destruction of +// this class will release the lock or cancel the lock request if it is not +// acquired yet. +class SharedWebContentsLock : public Lock { + public: + SharedWebContentsLock(); + ~SharedWebContentsLock(); +}; + +} // namespace web_app + +#endif // CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_SHARED_WEB_CONTENTS_LOCK_H_
diff --git a/chrome/browser/web_applications/locks/shared_web_contents_with_app_lock.cc b/chrome/browser/web_applications/locks/shared_web_contents_with_app_lock.cc new file mode 100644 index 0000000..d2e481b --- /dev/null +++ b/chrome/browser/web_applications/locks/shared_web_contents_with_app_lock.cc
@@ -0,0 +1,16 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/web_applications/locks/shared_web_contents_with_app_lock.h" + +#include "chrome/browser/web_applications/locks/lock.h" + +namespace web_app { + +SharedWebContentsWithAppLock::SharedWebContentsWithAppLock( + base::flat_set<AppId> app_ids) + : Lock(std::move(app_ids), Lock::Type::kAppAndWebContents) {} +SharedWebContentsWithAppLock::~SharedWebContentsWithAppLock() = default; + +} // namespace web_app
diff --git a/chrome/browser/web_applications/locks/shared_web_contents_with_app_lock.h b/chrome/browser/web_applications/locks/shared_web_contents_with_app_lock.h new file mode 100644 index 0000000..6716893b --- /dev/null +++ b/chrome/browser/web_applications/locks/shared_web_contents_with_app_lock.h
@@ -0,0 +1,31 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_SHARED_WEB_CONTENTS_WITH_APP_LOCK_H_ +#define CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_SHARED_WEB_CONTENTS_WITH_APP_LOCK_H_ + +#include "base/containers/flat_set.h" +#include "chrome/browser/web_applications/locks/lock.h" +#include "chrome/browser/web_applications/web_app_id.h" + +namespace web_app { + +// This locks both the background shared web contents AND the given app ids. The +// background web contents is used by the WebAppProvider system to do operations +// in the background that require a web contents, like install web apps and +// fetch data. +// +// Locks can be acquired by using the `WebAppLockManager`. The lock is acquired +// when the callback given to the WebAppLockManager is called. Destruction of +// this class will release the lock or cancel the lock request if it is not +// acquired yet. +class SharedWebContentsWithAppLock : public Lock { + public: + explicit SharedWebContentsWithAppLock(base::flat_set<AppId> app_ids); + ~SharedWebContentsWithAppLock(); +}; + +} // namespace web_app + +#endif // CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_SHARED_WEB_CONTENTS_WITH_APP_LOCK_H_
diff --git a/chrome/browser/web_applications/locks/web_app_lock_manager.cc b/chrome/browser/web_applications/locks/web_app_lock_manager.cc new file mode 100644 index 0000000..62c60bd --- /dev/null +++ b/chrome/browser/web_applications/locks/web_app_lock_manager.cc
@@ -0,0 +1,129 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/web_applications/locks/web_app_lock_manager.h" + +#include "base/strings/string_number_conversions.h" +#include "chrome/browser/web_applications/locks/lock.h" +#include "chrome/browser/web_applications/locks/shared_web_contents_lock.h" +#include "chrome/browser/web_applications/locks/shared_web_contents_with_app_lock.h" +#include "chrome/browser/web_applications/web_app_id.h" +#include "components/services/storage/indexed_db/locks/leveled_lock_manager.h" +#include "components/services/storage/indexed_db/locks/leveled_lock_range.h" + +namespace web_app { + +namespace { +// Creates a `LeveledLockRange` that only includes the provided string `key` +content::LeveledLockRange StringToLockRange(std::string key) { + return content::LeveledLockRange{key, key + static_cast<char>(0)}; +} + +enum class LockLevel { + kStatic = 0, + kApp = 1, + kMaxValue = kApp, +}; + +enum KeysOnStaticLevel { + kFullSystem = 0, + kBackgroundWebContents = 1, + kNoOp = 2, +}; + +content::LeveledLockManager::LeveledLockRequest GetSystemLock( + content::LeveledLockManager::LockType type) { + return content::LeveledLockManager::LeveledLockRequest( + static_cast<int>(LockLevel::kStatic), + StringToLockRange(base::NumberToString(KeysOnStaticLevel::kFullSystem)), + type); +} + +content::LeveledLockManager::LeveledLockRequest GetSharedWebContentsLock() { + return content::LeveledLockManager::LeveledLockRequest( + {static_cast<int>(LockLevel::kStatic), + StringToLockRange( + base::NumberToString(KeysOnStaticLevel::kBackgroundWebContents)), + content::LeveledLockManager::LockType::kExclusive}); +} + +std::vector<content::LeveledLockManager::LeveledLockRequest> GetAppIdLocks( + const base::flat_set<AppId>& app_ids) { + std::vector<content::LeveledLockManager::LeveledLockRequest> lock_requests; + for (const AppId& app_id : app_ids) { + lock_requests.emplace_back( + static_cast<int>(LockLevel::kApp), StringToLockRange(app_id), + content::LeveledLockManager::LockType::kExclusive); + } + return lock_requests; +} + +std::vector<content::LeveledLockManager::LeveledLockRequest> +GetLockRequestsForLock(const Lock& lock) { + std::vector<content::LeveledLockManager::LeveledLockRequest> requests; + switch (lock.type()) { + case Lock::Type::kNoOp: + requests = { + GetSystemLock(content::LeveledLockManager::LockType::kShared)}; + break; + case Lock::Type::kApp: + requests = GetAppIdLocks(lock.app_ids()); + requests.push_back( + GetSystemLock(content::LeveledLockManager::LockType::kShared)); + break; + case Lock::Type::kAppAndWebContents: + requests = GetAppIdLocks(lock.app_ids()); + ABSL_FALLTHROUGH_INTENDED; + case Lock::Type::kBackgroundWebContents: + requests.push_back( + GetSystemLock(content::LeveledLockManager::LockType::kShared)); + requests.push_back(GetSharedWebContentsLock()); + break; + case Lock::Type::kFullSystem: + requests = { + GetSystemLock(content::LeveledLockManager::LockType::kExclusive)}; + break; + } + return requests; +} + +} // namespace + +WebAppLockManager::WebAppLockManager() = default; +WebAppLockManager::~WebAppLockManager() = default; + +bool WebAppLockManager::IsSharedWebContentsLockFree() { + return lock_manager_.TestLock(GetSharedWebContentsLock()) == + content::DisjointRangeLockManager::TestLockResult::kFree; +} + +void WebAppLockManager::AcquireLock(Lock& lock, + base::OnceClosure on_lock_acquired) { + CHECK(!lock.HasLockBeenRequested()) << "Cannot acquire a lock twice."; + std::vector<content::LeveledLockManager::LeveledLockRequest> requests = + GetLockRequestsForLock(lock); + lock.holder_ = std::make_unique<content::LeveledLockHolder>(); + bool success = + lock_manager_.AcquireLocks(std::move(requests), lock.holder_->AsWeakPtr(), + std::move(on_lock_acquired)); + DCHECK(success); +} + +std::unique_ptr<SharedWebContentsWithAppLock> +WebAppLockManager::UpgradeAndAcquireLock( + std::unique_ptr<SharedWebContentsLock> lock, + const base::flat_set<AppId>& app_ids, + base::OnceClosure on_lock_acquired) { + CHECK(lock->HasLockBeenRequested()); + std::unique_ptr<SharedWebContentsWithAppLock> result_lock = + std::make_unique<SharedWebContentsWithAppLock>(app_ids); + result_lock->holder_ = std::move(lock->holder_); + bool success = lock_manager_.AcquireLocks(GetAppIdLocks(app_ids), + result_lock->holder_->AsWeakPtr(), + std::move(on_lock_acquired)); + DCHECK(success); + return result_lock; +} + +} // namespace web_app
diff --git a/chrome/browser/web_applications/locks/web_app_lock_manager.h b/chrome/browser/web_applications/locks/web_app_lock_manager.h new file mode 100644 index 0000000..0849159 --- /dev/null +++ b/chrome/browser/web_applications/locks/web_app_lock_manager.h
@@ -0,0 +1,52 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_WEB_APP_LOCK_MANAGER_H_ +#define CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_WEB_APP_LOCK_MANAGER_H_ + +#include <memory> + +#include "base/callback_forward.h" +#include "base/containers/flat_set.h" +#include "chrome/browser/web_applications/web_app_id.h" +#include "components/services/storage/indexed_db/locks/disjoint_range_lock_manager.h" + +namespace web_app { + +class Lock; +class SharedWebContentsLock; +class SharedWebContentsWithAppLock; + +// This class handles acquiring and upgrading locks in the WebAppProvider +// system. +class WebAppLockManager { + public: + WebAppLockManager(); + ~WebAppLockManager(); + + // Returns if the lock for the shared web contents is free. This means no one + // is using the shared web contents. + bool IsSharedWebContentsLockFree(); + + // Acquires the lock for the given `lock`, calling `on_lock_acquired` when + // complete. This call will CHECK-fail if the lock has already been used in an + // `AcquireLock` call. The lock is considered released when the `lock` is + // destroyed. + void AcquireLock(Lock& lock, base::OnceClosure on_lock_acquired); + + // Upgrades the given lock to a new one, and will call `on_lock_acquired` on + // when the new lock has been acquired. This call will CHECK-fail if `lock` + // was not already used in a call to `AcquireLock`. + std::unique_ptr<SharedWebContentsWithAppLock> UpgradeAndAcquireLock( + std::unique_ptr<SharedWebContentsLock> lock, + const base::flat_set<AppId>& app_ids, + base::OnceClosure on_lock_acquired); + + private: + content::DisjointRangeLockManager lock_manager_{2}; +}; + +} // namespace web_app + +#endif // CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_WEB_APP_LOCK_MANAGER_H_
diff --git a/chrome/browser/web_applications/web_app_command_manager.cc b/chrome/browser/web_applications/web_app_command_manager.cc index 77fe3f1..00136466 100644 --- a/chrome/browser/web_applications/web_app_command_manager.cc +++ b/chrome/browser/web_applications/web_app_command_manager.cc
@@ -13,14 +13,13 @@ #include "base/containers/contains.h" #include "base/memory/weak_ptr.h" #include "base/run_loop.h" -#include "base/strings/strcat.h" #include "base/threading/sequenced_task_runner_handle.h" #include "chrome/browser/web_applications/commands/web_app_command.h" +#include "chrome/browser/web_applications/locks/lock.h" +#include "chrome/browser/web_applications/locks/web_app_lock_manager.h" #include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_app_install_task.h" #include "chrome/browser/web_applications/web_app_url_loader.h" -#include "components/services/storage/indexed_db/locks/disjoint_range_lock_manager.h" -#include "components/services/storage/indexed_db/locks/leveled_lock_manager.h" #include "content/public/browser/web_contents.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -52,14 +51,10 @@ } // namespace -WebAppCommandManager::CommandState::CommandState( - std::unique_ptr<WebAppCommand> command) - : command(std::move(command)) {} - -WebAppCommandManager::CommandState::~CommandState() = default; - WebAppCommandManager::WebAppCommandManager(Profile* profile) - : profile_(profile), url_loader_(std::make_unique<WebAppUrlLoader>()) {} + : profile_(profile), + url_loader_(std::make_unique<WebAppUrlLoader>()), + lock_manager_(std::make_unique<WebAppLockManager>()) {} WebAppCommandManager::~WebAppCommandManager() { // Make sure that unittests & browsertests correctly shut down the manager. // This ensures that all tests also cover shutdown. @@ -75,11 +70,9 @@ } DCHECK(!base::Contains(commands_, command->id())); auto command_id = command->id(); - auto command_state_it = - commands_.try_emplace(command_id, std::move(command)).first; - lock_manager_.AcquireLocks( - command_state_it->second.command->lock().GetLockRequests(), - command_state_it->second.lock_holder.AsWeakPtr(), + auto command_it = commands_.try_emplace(command_id, std::move(command)).first; + lock_manager_->AcquireLock( + command_it->second->lock(), base::BindOnce(&WebAppCommandManager::OnLockAcquired, weak_ptr_factory_.GetWeakPtr(), command_id)); } @@ -87,7 +80,6 @@ void WebAppCommandManager::OnLockAcquired(WebAppCommand::Id command_id) { if (is_in_shutdown_) return; - auto command_it = commands_.find(command_id); DCHECK(command_it != commands_.end()); // Start is called in a new task to avoid re-entry issues with started tasks @@ -97,8 +89,7 @@ base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&WebAppCommandManager::StartCommandOrPrepareForLoad, - weak_ptr_factory_.GetWeakPtr(), - command_it->second.command.get())); + weak_ptr_factory_.GetWeakPtr(), command_it->second.get())); } void WebAppCommandManager::StartCommandOrPrepareForLoad( @@ -107,8 +98,8 @@ return; #if DCHECK_IS_ON() DCHECK(command); - auto command_state_it = commands_.find(command->id()); - DCHECK(command_state_it != commands_.end()); + auto command_it = commands_.find(command->id()); + DCHECK(command_it != commands_.end()); DCHECK(!command->IsStarted()); #endif if (command->lock().IncludesSharedWebContents()) { @@ -160,11 +151,10 @@ // `CallSignalCompletionAndSelfDestruct` during `OnShutdown`, which removes // the command from the `commands_` map. std::vector<base::WeakPtr<WebAppCommand>> commands_to_shutdown; - for (const auto& [id, command_state] : commands_) { - DCHECK_CALLED_ON_VALID_SEQUENCE( - command_state.command->command_sequence_checker_); - if (command_state.command->IsStarted()) { - commands_to_shutdown.push_back(command_state.command->AsWeakPtr()); + for (const auto& [id, command] : commands_) { + DCHECK_CALLED_ON_VALID_SEQUENCE(command->command_sequence_checker_); + if (command->IsStarted()) { + commands_to_shutdown.push_back(command->AsWeakPtr()); } } for (const auto& command_ptr : commands_to_shutdown) { @@ -189,10 +179,10 @@ // and that command can be destroyed before we notify it. std::vector<base::WeakPtr<WebAppCommand>> commands_to_notify; for (const AppId& app_id : app_ids) { - for (const auto& [id, command_state] : commands_) { - if (command_state.command->lock().IsAppLocked(app_id)) { - if (command_state.command->IsStarted()) { - commands_to_notify.push_back(command_state.command->AsWeakPtr()); + for (const auto& [id, command] : commands_) { + if (base::Contains(command->lock().app_ids(), app_id)) { + if (command->IsStarted()) { + commands_to_notify.push_back(command->AsWeakPtr()); } } } @@ -211,9 +201,8 @@ } base::Value::List queued; - for (const auto& [id, command_state] : commands_) { - queued.Append( - ::web_app::CreateLogValue(*command_state.command, absl::nullopt)); + for (const auto& [id, command] : commands_) { + queued.Append(::web_app::CreateLogValue(*command, absl::nullopt)); } base::Value::Dict state; @@ -233,8 +222,8 @@ bool WebAppCommandManager::IsInstallingForWebContents( const content::WebContents* web_contents) const { - for (const auto& [id, command_state] : commands_) { - if (command_state.command->GetInstallingWebContents() == web_contents) { + for (const auto& [id, command] : commands_) { + if (command->GetInstallingWebContents() == web_contents) { return true; } } @@ -268,11 +257,8 @@ commands_.erase(command_it); if (shared_web_contents_) { - auto lock_free = - lock_manager_.TestLock(WebAppCommandLock::GetSharedWebContentsLock()); - DCHECK_NE(lock_free, - content::DisjointRangeLockManager::TestLockResult::kInvalid); - if (lock_free == content::DisjointRangeLockManager::TestLockResult::kFree) { + bool lock_free = lock_manager_->IsSharedWebContentsLockFree(); + if (lock_free) { AddValueToLog(base::Value("Destroying the shared web contents.")); shared_web_contents_.reset(); }
diff --git a/chrome/browser/web_applications/web_app_command_manager.h b/chrome/browser/web_applications/web_app_command_manager.h index bcd62331..a1f7093 100644 --- a/chrome/browser/web_applications/web_app_command_manager.h +++ b/chrome/browser/web_applications/web_app_command_manager.h
@@ -9,8 +9,6 @@ #include <map> #include <memory> -#include "base/containers/flat_map.h" -#include "base/containers/flat_set.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "base/run_loop.h" @@ -18,12 +16,7 @@ #include "base/types/pass_key.h" #include "base/values.h" #include "chrome/browser/web_applications/commands/web_app_command.h" -#include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_app_id.h" -#include "chrome/browser/web_applications/web_app_url_loader.h" -#include "components/services/storage/indexed_db/locks/disjoint_range_lock_manager.h" -#include "components/services/storage/indexed_db/locks/leveled_lock_manager.h" -#include "third_party/abseil-cpp/absl/types/optional.h" class Profile; @@ -34,6 +27,9 @@ namespace web_app { class WebAppInstallManager; +class WebAppLockManager; +class WebAppUrlLoader; +enum class WebAppUrlLoaderResult; // The command manager is used to schedule commands or callbacks to write & read // from the WebAppProvider system. To use, simply call `ScheduleCommand` to @@ -102,21 +98,13 @@ void StartCommandOrPrepareForLoad(WebAppCommand* command); void OnAboutBlankLoadedForCommandStart(WebAppCommand* command, - WebAppUrlLoader::Result result); + WebAppUrlLoaderResult result); content::WebContents* EnsureWebContentsCreated(); - struct CommandState { - explicit CommandState(std::unique_ptr<WebAppCommand> command); - ~CommandState(); - - std::unique_ptr<WebAppCommand> command; - content::LeveledLockHolder lock_holder; - }; - SEQUENCE_CHECKER(command_sequence_checker_); - std::map<WebAppCommand::Id, CommandState> commands_{}; + std::map<WebAppCommand::Id, std::unique_ptr<WebAppCommand>> commands_{}; raw_ptr<Profile> profile_; // TODO(https://crbug.com/1329934): Figure out better ownership of this. @@ -127,8 +115,7 @@ bool is_in_shutdown_ = false; std::deque<base::Value> command_debug_log_; - content::DisjointRangeLockManager lock_manager_{ - static_cast<int>(WebAppCommandLock::LockLevel::kMaxValue) + 1}; + std::unique_ptr<WebAppLockManager> lock_manager_; raw_ptr<WebAppInstallManager> install_manager_;
diff --git a/chrome/browser/web_applications/web_app_command_manager_unittest.cc b/chrome/browser/web_applications/web_app_command_manager_unittest.cc index c404473..e7edc1d 100644 --- a/chrome/browser/web_applications/web_app_command_manager_unittest.cc +++ b/chrome/browser/web_applications/web_app_command_manager_unittest.cc
@@ -11,15 +11,19 @@ #include "base/barrier_closure.h" #include "base/callback_forward.h" #include "base/callback_helpers.h" +#include "base/containers/flat_set.h" #include "base/memory/weak_ptr.h" #include "base/run_loop.h" #include "base/test/bind.h" #include "base/test/gmock_callback_support.h" #include "base/test/mock_callback.h" -#include "base/test/task_environment.h" #include "base/values.h" #include "chrome/browser/web_applications/commands/callback_command.h" #include "chrome/browser/web_applications/commands/web_app_command.h" +#include "chrome/browser/web_applications/locks/app_lock.h" +#include "chrome/browser/web_applications/locks/full_system_lock.h" +#include "chrome/browser/web_applications/locks/shared_web_contents_lock.h" +#include "chrome/browser/web_applications/locks/shared_web_contents_with_app_lock.h" #include "chrome/browser/web_applications/test/fake_web_app_provider.h" #include "chrome/browser/web_applications/test/test_web_app_url_loader.h" #include "chrome/browser/web_applications/test/web_app_test.h" @@ -39,13 +43,14 @@ class MockCommand : public WebAppCommand { public: - explicit MockCommand(WebAppCommandLock command_lock) - : WebAppCommand(std::move(command_lock)) {} + explicit MockCommand(std::unique_ptr<Lock> lock) : lock_(std::move(lock)) {} MOCK_METHOD(void, OnDestruction, ()); ~MockCommand() override { OnDestruction(); } + Lock& lock() const override { return *lock_; } + MOCK_METHOD(void, Start, (), (override)); MOCK_METHOD(void, OnSyncSourceRemoved, (), (override)); MOCK_METHOD(void, OnShutdown, (), (override)); @@ -68,12 +73,14 @@ } private: + std::unique_ptr<Lock> lock_; + base::WeakPtrFactory<MockCommand> weak_factory_{this}; }; class WebAppCommandManagerTest : public WebAppTest { public: - static const constexpr char kTestAppId[] = "test_app_id"; + static const constexpr char kTestAppId[] = "test_app_id_1"; static const constexpr char kTestAppId2[] = "test_app_id_2"; WebAppCommandManagerTest() = default; @@ -204,7 +211,7 @@ // Simple test of a command enqueued, starting, and completing. testing::StrictMock<base::MockCallback<base::OnceClosure>> mock_closure; auto mock_command = std::make_unique<::testing::StrictMock<MockCommand>>( - WebAppCommandLock::CreateForFullSystemLock()); + std::make_unique<FullSystemLock>()); base::WeakPtr<MockCommand> command_ptr = mock_command->AsWeakPtr(); manager().ScheduleCommand(std::move(mock_command)); @@ -228,7 +235,7 @@ // method. testing::StrictMock<base::MockCallback<base::OnceClosure>> mock_closure; auto command = std::make_unique<::testing::StrictMock<MockCommand>>( - WebAppCommandLock::CreateForFullSystemLock()); + std::make_unique<FullSystemLock>()); base::WeakPtr<MockCommand> command_ptr = command->AsWeakPtr(); manager().ScheduleCommand(std::move(command)); @@ -248,9 +255,9 @@ TEST_F(WebAppCommandManagerTest, TwoQueues) { auto command1 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForAppLock({kTestAppId})); + std::make_unique<AppLock, base::flat_set<AppId>>({kTestAppId})); auto command2 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForAppLock({kTestAppId2})); + std::make_unique<AppLock, base::flat_set<AppId>>({kTestAppId2})); base::WeakPtr<MockCommand> command1_ptr = command1->AsWeakPtr(); base::WeakPtr<MockCommand> command2_ptr = command2->AsWeakPtr(); @@ -261,9 +268,9 @@ TEST_F(WebAppCommandManagerTest, MixedQueueTypes) { auto command1 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForFullSystemLock()); + std::make_unique<FullSystemLock>()); auto command2 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForAppLock({kTestAppId})); + std::make_unique<AppLock, base::flat_set<AppId>>({kTestAppId})); base::WeakPtr<MockCommand> command1_ptr = command1->AsWeakPtr(); base::WeakPtr<MockCommand> command2_ptr = command2->AsWeakPtr(); @@ -273,9 +280,9 @@ CheckCommandsRunInOrder(command1_ptr, command2_ptr); command1 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForFullSystemLock()); + std::make_unique<FullSystemLock>()); command2 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForBackgroundWebContentsLock()); + std::make_unique<SharedWebContentsLock>()); command1_ptr = command1->AsWeakPtr(); command2_ptr = command2->AsWeakPtr(); @@ -290,9 +297,9 @@ url_loader()->AddPrepareForLoadResults({WebAppUrlLoader::Result::kUrlLoaded}); command1 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForAppLock({kTestAppId})); + std::make_unique<AppLock, base::flat_set<AppId>>({kTestAppId})); command2 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForBackgroundWebContentsLock()); + std::make_unique<SharedWebContentsLock>()); command1_ptr = command1->AsWeakPtr(); command2_ptr = command2->AsWeakPtr(); @@ -306,11 +313,11 @@ TEST_F(WebAppCommandManagerTest, SingleAppQueue) { auto command1 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForAppLock({kTestAppId})); + std::make_unique<AppLock, base::flat_set<AppId>>({kTestAppId})); base::WeakPtr<MockCommand> command1_ptr = command1->AsWeakPtr(); auto command2 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForAppLock({kTestAppId})); + std::make_unique<AppLock, base::flat_set<AppId>>({kTestAppId})); base::WeakPtr<MockCommand> command2_ptr = command2->AsWeakPtr(); manager().ScheduleCommand(std::move(command1)); @@ -320,11 +327,11 @@ TEST_F(WebAppCommandManagerTest, GlobalQueue) { auto command1 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForFullSystemLock()); + std::make_unique<FullSystemLock>()); base::WeakPtr<MockCommand> command1_ptr = command1->AsWeakPtr(); auto command2 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForFullSystemLock()); + std::make_unique<FullSystemLock>()); base::WeakPtr<MockCommand> command2_ptr = command2->AsWeakPtr(); manager().ScheduleCommand(std::move(command1)); @@ -334,11 +341,11 @@ TEST_F(WebAppCommandManagerTest, BackgroundWebContentsQueue) { auto command1 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForBackgroundWebContentsLock()); + std::make_unique<SharedWebContentsLock>()); base::WeakPtr<MockCommand> command1_ptr = command1->AsWeakPtr(); auto command2 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForBackgroundWebContentsLock()); + std::make_unique<SharedWebContentsLock>()); base::WeakPtr<MockCommand> command2_ptr = command2->AsWeakPtr(); url_loader()->AddPrepareForLoadResults({WebAppUrlLoader::Result::kUrlLoaded, @@ -350,7 +357,7 @@ TEST_F(WebAppCommandManagerTest, ShutdownPreStartCommand) { auto command = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForFullSystemLock()); + std::make_unique<FullSystemLock>()); base::WeakPtr<MockCommand> command_ptr = command->AsWeakPtr(); manager().ScheduleCommand(std::move(command)); EXPECT_CALL(*command_ptr, OnDestruction()).Times(1); @@ -360,7 +367,7 @@ TEST_F(WebAppCommandManagerTest, ShutdownStartedCommand) { testing::StrictMock<base::MockCallback<base::OnceClosure>> mock_closure; auto mock_command = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForFullSystemLock()); + std::make_unique<FullSystemLock>()); base::WeakPtr<MockCommand> command_ptr = mock_command->AsWeakPtr(); manager().ScheduleCommand(std::move(mock_command)); @@ -382,11 +389,11 @@ TEST_F(WebAppCommandManagerTest, ShutdownQueuedCommand) { auto command1 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForFullSystemLock()); + std::make_unique<FullSystemLock>()); base::WeakPtr<MockCommand> command1_ptr = command1->AsWeakPtr(); auto command2 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForFullSystemLock()); + std::make_unique<FullSystemLock>()); base::WeakPtr<MockCommand> command2_ptr = command2->AsWeakPtr(); manager().ScheduleCommand(std::move(command1)); @@ -404,7 +411,7 @@ TEST_F(WebAppCommandManagerTest, OnShutdownCallsCompleteAndDestruct) { testing::StrictMock<base::MockCallback<base::OnceClosure>> mock_closure; auto command = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForFullSystemLock()); + std::make_unique<FullSystemLock>()); base::WeakPtr<MockCommand> command_ptr = command->AsWeakPtr(); manager().ScheduleCommand(std::move(command)); { @@ -428,7 +435,7 @@ TEST_F(WebAppCommandManagerTest, NotifySyncCallsCompleteAndDestruct) { testing::StrictMock<base::MockCallback<base::OnceClosure>> mock_closure; auto command = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForAppLock({kTestAppId})); + std::make_unique<AppLock, base::flat_set<AppId>>({kTestAppId})); base::WeakPtr<MockCommand> command_ptr = command->AsWeakPtr(); manager().ScheduleCommand(std::move(command)); { @@ -464,18 +471,20 @@ }, app_id, barrier); manager().ScheduleCommand(std::make_unique<CallbackCommand>( - WebAppCommandLock::CreateForAppLock({app_id}), std::move(callback))); + std::make_unique<AppLock, base::flat_set<AppId>>({app_id}), + std::move(callback))); } loop.Run(); } TEST_F(WebAppCommandManagerTest, AppWithSharedWebContents) { - auto command1 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForAppAndWebContentsLock({kTestAppId})); - auto command2 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForAppLock({kTestAppId})); - auto command3 = std::make_unique<StrictMock<MockCommand>>( - WebAppCommandLock::CreateForBackgroundWebContentsLock()); + auto command1 = std::make_unique<MockCommand>( + std::make_unique<SharedWebContentsWithAppLock, base::flat_set<AppId>>( + {kTestAppId})); + auto command2 = std::make_unique<MockCommand>( + std::make_unique<AppLock, base::flat_set<AppId>>({kTestAppId})); + auto command3 = + std::make_unique<MockCommand>(std::make_unique<SharedWebContentsLock>()); base::WeakPtr<MockCommand> command1_ptr = command1->AsWeakPtr(); base::WeakPtr<MockCommand> command2_ptr = command2->AsWeakPtr(); base::WeakPtr<MockCommand> command3_ptr = command3->AsWeakPtr(); @@ -533,10 +542,11 @@ TEST_F(WebAppCommandManagerTest, ToDebugValue) { base::RunLoop loop; manager().ScheduleCommand(std::make_unique<CallbackCommand>( - WebAppCommandLock::CreateForAppLock({kTestAppId}), + std::make_unique<AppLock, base::flat_set<AppId>>({kTestAppId}), base::BindLambdaForTesting([&]() { loop.Quit(); }))); manager().ScheduleCommand(std::make_unique<CallbackCommand>( - WebAppCommandLock::CreateForAppLock({kTestAppId2}), base::DoNothing())); + std::make_unique<AppLock, base::flat_set<AppId>>({kTestAppId2}), + base::DoNothing())); loop.Run(); manager().ToDebugValue(); }
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 2edfc19d..a0055ba 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1660240770-a632af6c039f2ad4413e996af2f98bfc7f9434f2.profdata +chrome-linux-main-1660262319-df4d2aa61d0ecf909385d6a8319a74ef4a051909.profdata
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index 2d03ccd9..5475c767 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1660219080-a5810d2f27359bada7076a460c32c05eaf48902f.profdata +chrome-mac-arm-main-1660262319-6f26dea356e87174d81e0ff907331abc64d4a442.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 1a3409c..1e179ce0 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1660240770-77ae20bf4e2aad589798cef67e057a2c4c231c49.profdata +chrome-mac-main-1660262319-e3ca841e7fb617dfb9bf38e01aec01b793bb4263.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index b63ff69..f37fca7 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1660229884-9bd506015e7ee89f769e0301f1c300238928a0c9.profdata +chrome-win32-main-1660262319-2d6fb5df5e257782a18671b08771487af6b3c845.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 661bf81..671598c 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1660240770-0f7eb5b3d8c1500481b67b9d706ad42b10d14b1e.profdata +chrome-win64-main-1660251404-8fed9aa357653c106ce422227a3d84de2b09bef2.profdata
diff --git a/chrome/common/extensions/api/developer_private.idl b/chrome/common/extensions/api/developer_private.idl index 96ed48a0..9d9c922 100644 --- a/chrome/common/extensions/api/developer_private.idl +++ b/chrome/common/extensions/api/developer_private.idl
@@ -55,6 +55,7 @@ FROM_STORE, UNPACKED, THIRD_PARTY, + INSTALLED_BY_DEFAULT, // "Unknown" includes crx's installed from chrome://extensions. UNKNOWN }; @@ -403,6 +404,22 @@ SiteInfo[] sites; }; + dictionary MatchingExtensionInfo { + // The id of the matching extension. + DOMString id; + // Describes the extension's access to the queried site from + // getMatchingExtensionsForSite. Note that the meaning is different from the + // original enum: + // - ON_CLICK: The extension requested access to the site but its access is + // withheld. + // - ON_SPECIFIC_SITES: the extension is permitted to run on at least one + // site specified by the queried site but has its access withheld on at + // least one site in its host permissions. + // - ON_ALL_SITES: same as above except the extension has no withheld access + // to its specified sites. + HostAccess siteAccess; + }; + enum PackStatus { SUCCESS, ERROR, @@ -582,6 +599,8 @@ callback DragInstallInProgressCallback = void (DOMString loadGuid); callback UserSiteSettingsCallback = void (UserSiteSettings settings); callback UserAndExtensionSitesByEtldCallback = void (SiteGroup[] siteGroups); + callback GetMatchingExtensionsForSiteCallback = + void (MatchingExtensionInfo[] matchingExtensions); interface Functions { // Runs auto update for extensions and apps immediately. @@ -758,7 +777,7 @@ // Returns the user specified site settings (which origins can extensions // always/never run on) for the current profile. [supportsPromises] static void getUserSiteSettings( - optional UserSiteSettingsCallback callback); + UserSiteSettingsCallback callback); // Adds hosts to the set of user permitted or restricted sites. If any hosts // are in the other set than what's specified in `options`, then they are @@ -776,7 +795,13 @@ // Returns all hosts specified by user site settings, grouped by each host's // eTLD+1. [supportsPromises] static void getUserAndExtensionSitesByEtld( - optional UserAndExtensionSitesByEtldCallback callback); + UserAndExtensionSitesByEtldCallback callback); + + // Returns a list of extensions which have at least one matching site in + // common between its set of host permissions and `site`. + [supportsPromises] static void getMatchingExtensionsForSite( + DOMString site, + GetMatchingExtensionsForSiteCallback callback); [nocompile, deprecated="Use management.setEnabled"] static void enable(DOMString id,
diff --git a/chrome/test/base/devtools_listener.cc b/chrome/test/base/devtools_listener.cc index 65eab0b..0276520a 100644 --- a/chrome/test/base/devtools_listener.cc +++ b/chrome/test/base/devtools_listener.cc
@@ -221,7 +221,16 @@ std::string text; { base::Value::Dict* result = value_.FindDict("result"); - CHECK(result) << "Can't identify result from value: " << value_; + // TODO(crbug/1206082): In some cases the v8 isolate may clear out the + // script source during execution. This can lead to the Debugger seeing a + // scriptId during execution but when it comes time to retrieving the + // source can no longer find the ID. For now we simply ignore these, but + // we need to find a better way to handle this. + if (!result) { + LOG(ERROR) << "Can't find result from Debugger.getScriptSource: " + << value_; + return; + } std::string* text_ptr = result->FindString("scriptSource"); if (!text_ptr || text_ptr->empty()) { value_.clear();
diff --git a/chrome/test/data/webui/chromeos/firmware_update/BUILD.gn b/chrome/test/data/webui/chromeos/firmware_update/BUILD.gn index f3fa299..3c8fdeb6 100644 --- a/chrome/test/data/webui/chromeos/firmware_update/BUILD.gn +++ b/chrome/test/data/webui/chromeos/firmware_update/BUILD.gn
@@ -50,7 +50,7 @@ "//ash/webui/firmware_update_ui/resources:firmware_update_dialog", "//ash/webui/firmware_update_ui/resources:firmware_update_types", "//ash/webui/firmware_update_ui/resources:mojo_utils", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:load_time_data.m", ] externs_list = [ "$externs_path/mocha-2.5.js" ] @@ -70,7 +70,7 @@ "//ash/webui/firmware_update_ui/resources:mojo_utils", "//ash/webui/firmware_update_ui/resources:update_card", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/js:load_time_data.m", ] externs_list = [ "$externs_path/mocha-2.5.js" ]
diff --git a/chrome/test/data/webui/chromeos/firmware_update/firmware_update_test.js b/chrome/test/data/webui/chromeos/firmware_update/firmware_update_test.js index 341e064..a4adfc57c 100644 --- a/chrome/test/data/webui/chromeos/firmware_update/firmware_update_test.js +++ b/chrome/test/data/webui/chromeos/firmware_update/firmware_update_test.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {fakeFirmwareUpdates} from 'chrome://accessory-update/fake_data.js'; import {FakeUpdateController} from 'chrome://accessory-update/fake_update_controller.js';
diff --git a/chrome/test/data/webui/chromeos/shimless_rma/BUILD.gn b/chrome/test/data/webui/chromeos/shimless_rma/BUILD.gn index 110300b..5f9f8ff 100644 --- a/chrome/test/data/webui/chromeos/shimless_rma/BUILD.gn +++ b/chrome/test/data/webui/chromeos/shimless_rma/BUILD.gn
@@ -321,7 +321,7 @@ "//ash/webui/shimless_rma/resources:mojo_interface_provider", "//ash/webui/shimless_rma/resources:wrapup_repair_complete_page", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", ] externs_list = [ "$externs_path/mocha-2.5.js" ] }
diff --git a/chrome/test/data/webui/cr_components/most_visited_test.ts b/chrome/test/data/webui/cr_components/most_visited_test.ts index 1c8c1284..e3c0686 100644 --- a/chrome/test/data/webui/cr_components/most_visited_test.ts +++ b/chrome/test/data/webui/cr_components/most_visited_test.ts
@@ -9,7 +9,7 @@ import {MostVisitedPageCallbackRouter, MostVisitedPageHandlerRemote, MostVisitedTile} from 'chrome://resources/cr_components/most_visited/most_visited.mojom-webui.js'; import {MostVisitedWindowProxy} from 'chrome://resources/cr_components/most_visited/window_proxy.js'; import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {isMac} from 'chrome://resources/js/cr.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
diff --git a/chrome/test/data/webui/cr_elements/cr_dialog_test.ts b/chrome/test/data/webui/cr_elements/cr_dialog_test.ts index a5f0bc5..c7f2180 100644 --- a/chrome/test/data/webui/cr_elements/cr_dialog_test.ts +++ b/chrome/test/data/webui/cr_elements/cr_dialog_test.ts
@@ -3,10 +3,10 @@ // found in the LICENSE file. // clang-format off -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {keyDownOn, keyEventOn} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js';
diff --git a/chrome/test/data/webui/cr_elements/find_shortcut_behavior_test.ts b/chrome/test/data/webui/cr_elements/find_shortcut_behavior_test.ts index a990517..f8dc5cb 100644 --- a/chrome/test/data/webui/cr_elements/find_shortcut_behavior_test.ts +++ b/chrome/test/data/webui/cr_elements/find_shortcut_behavior_test.ts
@@ -3,7 +3,7 @@ // found in the LICENSE file. // clang-format off -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {FindShortcutBehavior, FindShortcutManager} from 'chrome://resources/cr_elements/find_shortcut_behavior.js'; import {assert} from 'chrome://resources/js/assert.m.js';
diff --git a/chrome/test/data/webui/cr_elements/find_shortcut_mixin_test.ts b/chrome/test/data/webui/cr_elements/find_shortcut_mixin_test.ts index 58525c4..1e8cb43 100644 --- a/chrome/test/data/webui/cr_elements/find_shortcut_mixin_test.ts +++ b/chrome/test/data/webui/cr_elements/find_shortcut_mixin_test.ts
@@ -3,7 +3,7 @@ // found in the LICENSE file. // clang-format off -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {FindShortcutManager, FindShortcutMixin} from 'chrome://resources/cr_elements/find_shortcut_mixin.js'; import {assert} from 'chrome://resources/js/assert.m.js';
diff --git a/chrome/test/data/webui/extensions/detail_view_test.ts b/chrome/test/data/webui/extensions/detail_view_test.ts index c189d0fa..5ea58ca 100644 --- a/chrome/test/data/webui/extensions/detail_view_test.ts +++ b/chrome/test/data/webui/extensions/detail_view_test.ts
@@ -252,6 +252,11 @@ assertEquals('Added by a third-party', item.$.source.textContent!.trim()); assertFalse(isChildVisible(item, '#load-path')); + item.set('data.location', 'INSTALLED_BY_DEFAULT'); + flush(); + assertEquals('Installed by default', item.$.source.textContent!.trim()); + assertFalse(isChildVisible(item, '#load-path')); + item.set('data.location', 'UNPACKED'); item.set('data.prettifiedPath', 'foo/bar/baz/'); flush();
diff --git a/chrome/test/data/webui/extensions/item_test.ts b/chrome/test/data/webui/extensions/item_test.ts index 5f53f08..10896bd 100644 --- a/chrome/test/data/webui/extensions/item_test.ts +++ b/chrome/test/data/webui/extensions/item_test.ts
@@ -333,6 +333,10 @@ assertTrue(isChildVisible(item, '#source-indicator')); assertEquals('extensions-icons:input', icon.icon); + item.set('data.location', 'INSTALLED_BY_DEFAULT'); + flush(); + assertFalse(isChildVisible(item, '#source-indicator')); + item.set('data.location', 'FROM_STORE'); item.set('data.controlledInfo', {text: 'policy'}); flush();
diff --git a/chrome/test/data/webui/new_tab_page/modules/cart/discount_consent_dialog_test.ts b/chrome/test/data/webui/new_tab_page/modules/cart/discount_consent_dialog_test.ts index e1043ee..3ddbbf3 100644 --- a/chrome/test/data/webui/new_tab_page/modules/cart/discount_consent_dialog_test.ts +++ b/chrome/test/data/webui/new_tab_page/modules/cart/discount_consent_dialog_test.ts
@@ -6,7 +6,7 @@ import 'chrome://webui-test/mojo_webui_test_support.js'; import {DiscountConsentDialog} from 'chrome://new-tab-page/lazy_load.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {pressAndReleaseKeyOn} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js'; import {assertEquals, assertTrue} from 'chrome://webui-test/chai_assert.js';
diff --git a/chrome/test/data/webui/settings/chromeos/os_languages_page_v2_tests.js b/chrome/test/data/webui/settings/chromeos/os_languages_page_v2_tests.js index bdfb5b1..718d354 100644 --- a/chrome/test/data/webui/settings/chromeos/os_languages_page_v2_tests.js +++ b/chrome/test/data/webui/settings/chromeos/os_languages_page_v2_tests.js
@@ -518,7 +518,7 @@ }); test( - 'setting device language does not move already enabled language to front', + 'setting device language moves already enabled language to front', async () => { languageHelper.setPrefValue( 'intl.accept_languages', 'en-US,sw,en-CA'); @@ -534,8 +534,8 @@ assertEquals( 'en-CA', await browserProxy.whenCalled('setProspectiveUILanguage')); - assertFalse(languageHelper.getPref('intl.accept_languages') - .value.startsWith('en-CA')); + assertTrue(languageHelper.getPref('intl.accept_languages') + .value.startsWith('en-CA')); }); // Test that searching languages works whether the displayed or native
diff --git a/chrome/updater/refresh_dm_policies_task.cc b/chrome/updater/refresh_dm_policies_task.cc index 536823c..0d610ae 100644 --- a/chrome/updater/refresh_dm_policies_task.cc +++ b/chrome/updater/refresh_dm_policies_task.cc
@@ -13,7 +13,6 @@ #include "base/memory/scoped_refptr.h" #include "base/sequence_checker.h" #include "base/task/bind_post_task.h" -#include "base/task/single_thread_task_runner.h" #include "base/task/thread_pool.h" #include "chrome/updater/configurator.h" #include "chrome/updater/device_management/dm_client.h" @@ -36,8 +35,14 @@ // `RefreshDMPoliciesTask::FetchPolicy` can block and therefore is running // under a task runner with `base::MayBlock()`. - base::ThreadPool::CreateSingleThreadTaskRunner( - {base::MayBlock()}, base::SingleThreadTaskRunnerThreadMode::DEDICATED) + []() { + constexpr base::TaskTraits KMayBlockTraits = {base::MayBlock()}; +#if BUILDFLAG(IS_WIN) + return base::ThreadPool::CreateCOMSTATaskRunner(KMayBlockTraits); +#else + return base::ThreadPool::CreateSequencedTaskRunner(KMayBlockTraits); +#endif + }() ->PostTask(FROM_HERE, base::BindOnce(&RefreshDMPoliciesTask::FetchPolicy, this, std::move(callback))); }
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index cf6557c..e317799b 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -15035.0.0 \ No newline at end of file +15040.0.0 \ No newline at end of file
diff --git a/chromeos/ash/components/dbus/cros_disks/cros_disks_client.cc b/chromeos/ash/components/dbus/cros_disks/cros_disks_client.cc index c141c55..6287f362 100644 --- a/chromeos/ash/components/dbus/cros_disks/cros_disks_client.cc +++ b/chromeos/ash/components/dbus/cros_disks/cros_disks_client.cc
@@ -17,15 +17,12 @@ #include "base/command_line.h" #include "base/containers/contains.h" #include "base/files/file_path.h" -#include "base/files/file_util.h" -#include "base/location.h" #include "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/observer_list.h" #include "base/strings/stringprintf.h" #include "base/system/sys_info.h" -#include "base/task/task_runner_util.h" #include "base/time/time.h" #include "base/values.h" #include "chromeos/ash/components/dbus/cros_disks/fake_cros_disks_client.h" @@ -134,19 +131,46 @@ } bool ReadMountEntryFromDbus(dbus::MessageReader* reader, MountEntry* entry) { + DCHECK(reader); + DCHECK(entry); + uint32_t error_code = 0; - std::string source_path; uint32_t mount_type = 0; - std::string mount_path; - if (!reader->PopUint32(&error_code) || !reader->PopString(&source_path) || - !reader->PopUint32(&mount_type) || !reader->PopString(&mount_path)) { + if (!reader->PopUint32(&error_code) || + !reader->PopString(&entry->source_path) || + !reader->PopUint32(&mount_type) || + !reader->PopString(&entry->mount_path)) { return false; } - *entry = - MountEntry{CrosDisksMountErrorToChromeMountError( - static_cast<cros_disks::MountErrorType>(error_code)), - std::move(source_path), static_cast<MountType>(mount_type), - std::move(mount_path)}; + + entry->error_code = CrosDisksMountErrorToChromeMountError( + static_cast<cros_disks::MountErrorType>(error_code)); + entry->mount_type = static_cast<MountType>(mount_type); + entry->progress_percent = 100; + + return true; +} + +bool ReadMountProgressFromDbus(dbus::MessageReader* reader, MountEntry* entry) { + DCHECK(reader); + DCHECK(entry); + + uint32_t progress_percent = 0; + uint32_t mount_type = 0; + if (!reader->PopUint32(&progress_percent) || + !reader->PopString(&entry->source_path) || + !reader->PopUint32(&mount_type) || + !reader->PopString(&entry->mount_path)) { + return false; + } + + if (!(progress_percent >= 0 && progress_percent <= 100)) + return false; + + entry->error_code = MountError::kInProgress; + entry->mount_type = static_cast<MountType>(mount_type); + entry->progress_percent = progress_percent; + return true; } @@ -162,8 +186,7 @@ // The CrosDisksClient implementation. class CrosDisksClientImpl : public CrosDisksClient { public: - CrosDisksClientImpl() : proxy_(nullptr) {} - + CrosDisksClientImpl() = default; CrosDisksClientImpl(const CrosDisksClientImpl&) = delete; CrosDisksClientImpl& operator=(const CrosDisksClientImpl&) = delete; @@ -335,6 +358,13 @@ weak_ptr_factory_.GetWeakPtr())); proxy_->ConnectToSignal( + cros_disks::kCrosDisksInterface, cros_disks::kMountProgress, + base::BindRepeating(&CrosDisksClientImpl::OnMountProgress, + weak_ptr_factory_.GetWeakPtr()), + base::BindOnce(&CrosDisksClientImpl::OnSignalConnected, + weak_ptr_factory_.GetWeakPtr())); + + proxy_->ConnectToSignal( cros_disks::kCrosDisksInterface, cros_disks::kFormatCompleted, base::BindRepeating(&CrosDisksClientImpl::OnFormatCompleted, weak_ptr_factory_.GetWeakPtr()), @@ -493,18 +523,33 @@ entry.error_code, MountError::kCount); // Flatten MountType and MountError into a single dimension. constexpr int kMaxMountErrors = 100; - static_assert(static_cast<int>(MountError::kCount) <= kMaxMountErrors, - "CrosDisksClient.MountErrorMountType histogram must be " - "updated."); - const int type_and_error = - (static_cast<int>(entry.mount_type) * kMaxMountErrors) + - static_cast<int>(entry.error_code); - base::UmaHistogramSparse("CrosDisksClient.MountErrorMountType", - type_and_error); - for (auto& observer : observer_list_) + static_assert( + static_cast<int>(MountError::kCount) <= kMaxMountErrors, + "CrosDisksClient.MountErrorMountType histogram must be updated"); + base::UmaHistogramSparse( + "CrosDisksClient.MountErrorMountType", + static_cast<int>(entry.mount_type) * kMaxMountErrors + + static_cast<int>(entry.error_code)); + + // Notify observers. + for (Observer& observer : observer_list_) observer.OnMountCompleted(entry); } + // Handles MountProgress signal and notifies observers. + void OnMountProgress(dbus::Signal* signal) { + dbus::MessageReader reader(signal); + MountEntry entry; + if (!ReadMountProgressFromDbus(&reader, &entry)) { + LOG(ERROR) << "Invalid signal: " << signal->ToString(); + return; + } + + // Notify observers. + for (Observer& observer : observer_list_) + observer.OnMountProgress(entry); + } + // Handles FormatCompleted signal and notifies observers. void OnFormatCompleted(dbus::Signal* signal) { dbus::MessageReader reader(signal); @@ -526,7 +571,7 @@ static_cast<FormatError>(error_code), FormatError::kCount); - for (auto& observer : observer_list_) { + for (Observer& observer : observer_list_) { observer.OnFormatCompleted(static_cast<FormatError>(error_code), device_path); } @@ -573,7 +618,7 @@ << "Connect to " << interface << " " << signal << " failed."; } - dbus::ObjectProxy* proxy_; + dbus::ObjectProxy* proxy_ = nullptr; base::ObserverList<Observer> observer_list_; @@ -589,41 +634,64 @@ namespace ash { +std::ostream& operator<<(std::ostream& out, const MountType type) { + switch (type) { +#define PRINT_TYPE(s) \ + case MountType::s: \ + return out << #s; + PRINT_TYPE(kInvalid) + PRINT_TYPE(kDevice) + PRINT_TYPE(kArchive) + PRINT_TYPE(kNetworkStorage) +#undef PRINT_TYPE + } + + return out << std::underlying_type_t<MountType>(type); +} + std::ostream& operator<<(std::ostream& out, const MountError error) { switch (error) { #define PRINT_ERROR(s) \ - case s: \ + case MountError::s: \ return out << #s; - PRINT_ERROR(MountError::kNone) - PRINT_ERROR(MountError::kUnknown) - PRINT_ERROR(MountError::kInternal) - PRINT_ERROR(MountError::kInvalidArgument) - PRINT_ERROR(MountError::kInvalidPath) - PRINT_ERROR(MountError::kPathAlreadyMounted) - PRINT_ERROR(MountError::kPathNotMounted) - PRINT_ERROR(MountError::kDirectoryCreationFailed) - PRINT_ERROR(MountError::kInvalidMountOptions) - PRINT_ERROR(MountError::kInvalidUnmountOptions) - PRINT_ERROR(MountError::kInsufficientPermissions) - PRINT_ERROR(MountError::kMountProgramNotFound) - PRINT_ERROR(MountError::kMountProgramFailed) - PRINT_ERROR(MountError::kInvalidDevicePath) - PRINT_ERROR(MountError::kUnknownFilesystem) - PRINT_ERROR(MountError::kUnsupportedFilesystem) - PRINT_ERROR(MountError::kInvalidArchive) - PRINT_ERROR(MountError::kNeedPassword) - PRINT_ERROR(MountError::kInProgress) - PRINT_ERROR(MountError::kCancelled) - PRINT_ERROR(MountError::kCount) + PRINT_ERROR(kNone) + PRINT_ERROR(kUnknown) + PRINT_ERROR(kInternal) + PRINT_ERROR(kInvalidArgument) + PRINT_ERROR(kInvalidPath) + PRINT_ERROR(kPathAlreadyMounted) + PRINT_ERROR(kPathNotMounted) + PRINT_ERROR(kDirectoryCreationFailed) + PRINT_ERROR(kInvalidMountOptions) + PRINT_ERROR(kInvalidUnmountOptions) + PRINT_ERROR(kInsufficientPermissions) + PRINT_ERROR(kMountProgramNotFound) + PRINT_ERROR(kMountProgramFailed) + PRINT_ERROR(kInvalidDevicePath) + PRINT_ERROR(kUnknownFilesystem) + PRINT_ERROR(kUnsupportedFilesystem) + PRINT_ERROR(kInvalidArchive) + PRINT_ERROR(kNeedPassword) + PRINT_ERROR(kInProgress) + PRINT_ERROR(kCancelled) + PRINT_ERROR(kCount) #undef PRINT_ERROR } - return out << "MOUNT_ERROR_" << std::underlying_type_t<MountError>(error); + return out << std::underlying_type_t<MountError>(error); } } // namespace ash namespace chromeos { + +std::ostream& operator<<(std::ostream& out, const MountEntry& entry) { + return out << "error_code = " << entry.error_code << ", source_path = '" + << entry.source_path << "', mount_type = " << entry.mount_type + << ", mount_path = '" << entry.mount_path + << "', progress_percent = " << entry.progress_percent; +} + //////////////////////////////////////////////////////////////////////////////// // DiskInfo
diff --git a/chromeos/ash/components/dbus/cros_disks/cros_disks_client.h b/chromeos/ash/components/dbus/cros_disks/cros_disks_client.h index 6fc80a3..11fe4009 100644 --- a/chromeos/ash/components/dbus/cros_disks/cros_disks_client.h +++ b/chromeos/ash/components/dbus/cros_disks/cros_disks_client.h
@@ -40,6 +40,10 @@ kNetworkStorage, }; +// Output operator for logging. +COMPONENT_EXPORT(ASH_DBUS_CROS_DISKS) +std::ostream& operator<<(std::ostream& out, MountType type); + // Type of device. enum class DeviceType { kUnknown, @@ -285,8 +289,13 @@ std::string source_path; MountType mount_type = MountType::kInvalid; std::string mount_path; + int progress_percent = 0; }; +// Output operator for logging. +COMPONENT_EXPORT(ASH_DBUS_CROS_DISKS) +std::ostream& operator<<(std::ostream& out, const MountEntry& entry); + // A class to make the actual DBus calls for cros-disks service. // This class only makes calls, result/error handling should be done // by callbacks. @@ -325,6 +334,9 @@ // Called when a MountCompleted signal is received. virtual void OnMountCompleted(const MountEntry& entry) = 0; + // Called when a MountProgress signal is received. + virtual void OnMountProgress(const MountEntry& entry) = 0; + // Called when a FormatCompleted signal is received. virtual void OnFormatCompleted(FormatError error_code, const std::string& device_path) = 0;
diff --git a/chromeos/ash/components/network/network_state.cc b/chromeos/ash/components/network/network_state.cc index 793fbe4c..1e1e82d 100644 --- a/chromeos/ash/components/network/network_state.cc +++ b/chromeos/ash/components/network/network_state.cc
@@ -652,11 +652,15 @@ if (connection_state_ == shill::kStateNoConnectivity) { shill_portal_state_ = PortalState::kNoInternet; } else if (connection_state_ == shill::kStateRedirectFound) { - shill_portal_state_ = status_code == net::HTTP_PROXY_AUTHENTICATION_REQUIRED - ? PortalState::kProxyAuthRequired - : PortalState::kPortal; + shill_portal_state_ = PortalState::kPortal; } else if (connection_state_ == shill::kStatePortalSuspected) { - shill_portal_state_ = PortalState::kPortalSuspected; + if (status_code == net::HTTP_PROXY_AUTHENTICATION_REQUIRED) { + // If Shill's portal detection HTTP probe returns a 407 response, Shill + // will treat that as a portal-suspected state. + shill_portal_state_ = PortalState::kProxyAuthRequired; + } else { + shill_portal_state_ = PortalState::kPortalSuspected; + } } else if (connection_state_ == shill::kStateOnline) { shill_portal_state_ = PortalState::kOnline; } else {
diff --git a/chromeos/ash/components/network/network_state.h b/chromeos/ash/components/network/network_state.h index b511d84d..324b012 100644 --- a/chromeos/ash/components/network/network_state.h +++ b/chromeos/ash/components/network/network_state.h
@@ -296,6 +296,8 @@ // true if |name_| changes. bool UpdateName(const base::Value& properties); + // Uses the Shill connection state and PortalDetectionFailedStatus to generate + // |shill_portal_state_|. void UpdateCaptivePortalState(const base::Value& properties); void SetVpnProvider(const std::string& id, const std::string& type);
diff --git a/chromeos/services/network_config/cros_network_config_unittest.cc b/chromeos/services/network_config/cros_network_config_unittest.cc index 76d7cd2..12dca40 100644 --- a/chromeos/services/network_config/cros_network_config_unittest.cc +++ b/chromeos/services/network_config/cros_network_config_unittest.cc
@@ -900,7 +900,7 @@ EXPECT_EQ(mojom::PortalState::kNoInternet, network->portal_state); helper()->ConfigureService( - R"({"GUID": "wifi1_guid", "Type": "wifi", "State": "redirect-found", + R"({"GUID": "wifi1_guid", "Type": "wifi", "State": "portal-suspected", "Strength": 90, "AutoConnect": true, "PortalDetectionFailedStatusCode": 407})"); network = GetNetworkState("wifi1_guid");
diff --git a/chromeos/tast_control.gni b/chromeos/tast_control.gni index 79f55a0..138fe19 100644 --- a/chromeos/tast_control.gni +++ b/chromeos/tast_control.gni
@@ -265,10 +265,6 @@ # https://crbug.com/1350880 "arc.PIPRoundedCornersUnderlay", - - # http://b/242172965 - "crostini.SSHFSMount.buster_stable", - "crostini.SSHFSMount.bullseye_stable", ] # To create filters to be used on specific builders add them like this:
diff --git a/components/autofill/core/browser/autofill_type.cc b/components/autofill/core/browser/autofill_type.cc index 9153d9a..fa7224e 100644 --- a/components/autofill/core/browser/autofill_type.cc +++ b/components/autofill/core/browser/autofill_type.cc
@@ -99,6 +99,7 @@ case MERCHANT_PROMO_CODE: case IBAN_VALUE: case UPI_VPA: + case CREDIT_CARD_STANDALONE_VERIFICATION_CODE: return FieldTypeGroup::kNoGroup; case MAX_VALID_FIELD_TYPE:
diff --git a/components/autofill/core/browser/field_types.cc b/components/autofill/core/browser/field_types.cc index 537ba0a..774e1e7 100644 --- a/components/autofill/core/browser/field_types.cc +++ b/components/autofill/core/browser/field_types.cc
@@ -96,6 +96,7 @@ case CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR: case CREDIT_CARD_TYPE: case CREDIT_CARD_VERIFICATION_CODE: + case CREDIT_CARD_STANDALONE_VERIFICATION_CODE: return true; case UPI_VPA: @@ -316,6 +317,8 @@ return "AMBIGUOUS_TYPE"; case IBAN_VALUE: return "IBAN_VALUE"; + case CREDIT_CARD_STANDALONE_VERIFICATION_CODE: + return "CREDIT_CARD_STANDALONE_VERIFICATION_CODE"; case MAX_VALID_FIELD_TYPE: return ""; }
diff --git a/components/autofill/core/browser/field_types.h b/components/autofill/core/browser/field_types.h index 16ff815..d424d24 100644 --- a/components/autofill/core/browser/field_types.h +++ b/components/autofill/core/browser/field_types.h
@@ -243,9 +243,12 @@ // banking and merchant websites used to make international transactions. // See https://en.wikipedia.org/wiki/International_Bank_Account_Number. IBAN_VALUE = 125, + + // Standalone card verification code (CVC). + CREDIT_CARD_STANDALONE_VERIFICATION_CODE = 126, // No new types can be added without a corresponding change to the Autofill // server. - MAX_VALID_FIELD_TYPE = 126, + MAX_VALID_FIELD_TYPE = 127, }; enum class FieldTypeGroup {
diff --git a/components/autofill/core/browser/field_types_unittest.cc b/components/autofill/core/browser/field_types_unittest.cc index 203faedd..c0b406b 100644 --- a/components/autofill/core/browser/field_types_unittest.cc +++ b/components/autofill/core/browser/field_types_unittest.cc
@@ -43,6 +43,7 @@ CREDIT_CARD_EXP_4_DIGIT_YEAR, CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, + CREDIT_CARD_STANDALONE_VERIFICATION_CODE, CREDIT_CARD_TYPE, CREDIT_CARD_VERIFICATION_CODE, COMPANY_NAME,
diff --git a/components/autofill/core/browser/form_parsing/form_field.cc b/components/autofill/core/browser/form_parsing/form_field.cc index e2ed3af3..f8e09570 100644 --- a/components/autofill/core/browser/form_parsing/form_field.cc +++ b/components/autofill/core/browser/form_parsing/form_field.cc
@@ -32,6 +32,7 @@ #include "components/autofill/core/browser/form_parsing/phone_field.h" #include "components/autofill/core/browser/form_parsing/price_field.h" #include "components/autofill/core/browser/form_parsing/search_field.h" +#include "components/autofill/core/browser/form_parsing/standalone_cvc_field.h" #include "components/autofill/core/browser/form_parsing/travel_field.h" #include "components/autofill/core/browser/form_processing/autocomplete_attribute_processing_util.h" #include "components/autofill/core/browser/form_structure.h" @@ -508,7 +509,8 @@ // static bool FormField::IsSingleFieldParseableType(ServerFieldType field_type) { - return field_type == MERCHANT_PROMO_CODE || field_type == IBAN_VALUE; + return field_type == MERCHANT_PROMO_CODE || field_type == IBAN_VALUE || + field_type == CREDIT_CARD_STANDALONE_VERIFICATION_CODE; } // static
diff --git a/components/autofill/core/browser/form_parsing/resources/legacy_regex_patterns.json b/components/autofill/core/browser/form_parsing/resources/legacy_regex_patterns.json index d03eae03..1e5fb27 100644 --- a/components/autofill/core/browser/form_parsing/resources/legacy_regex_patterns.json +++ b/components/autofill/core/browser/form_parsing/resources/legacy_regex_patterns.json
@@ -22,8 +22,8 @@ "positive_pattern": "street", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "de" : [ @@ -32,8 +32,8 @@ "positive_pattern": "stra(ss|ß)e", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "es" : [ @@ -42,8 +42,8 @@ "positive_pattern": "calle", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "ru" : [ @@ -52,8 +52,8 @@ "positive_pattern": "улица|название.?улицы", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "pt" : [ @@ -62,8 +62,8 @@ "positive_pattern": "rua|avenida|((?<!do |de )endereço)", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] } ] }, @@ -74,8 +74,8 @@ "positive_pattern": "apartment", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "es": [ @@ -84,8 +84,8 @@ "positive_pattern": "interior|número.*apartamento", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "de": [ @@ -94,8 +94,8 @@ "positive_pattern": "wohnung", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "ru": [ @@ -104,8 +104,8 @@ "positive_pattern": "квартир", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "it": [ @@ -114,8 +114,8 @@ "positive_pattern": "numero.*appartamento", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "fr": [ @@ -124,8 +124,8 @@ "positive_pattern": "numéro.*appartement", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ] }, @@ -136,8 +136,8 @@ "positive_pattern": "(house.?|street.?|^)(number|no\\.?$)", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "de": [ @@ -146,8 +146,8 @@ "positive_pattern": "(haus|^)(nummer|nr)", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "pt": [ @@ -156,8 +156,8 @@ "positive_pattern": "^\\*?.?número(.?\\*?$| da residência)", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "es": [ @@ -166,8 +166,8 @@ "positive_pattern": "n(u|ú)mero.*apartamento|exterior", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "ru": [ @@ -176,8 +176,8 @@ "positive_pattern": "дом|номер.?дома", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ] }, @@ -188,8 +188,8 @@ "positive_pattern": "attention|attn", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -200,8 +200,8 @@ "positive_pattern": "province|region|other", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "es": [ @@ -210,8 +210,8 @@ "positive_pattern": "provincia", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "pt": [ @@ -220,8 +220,8 @@ "positive_pattern": "bairro|suburb", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -232,8 +232,8 @@ "positive_pattern": "address.*nickname|address.*label", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "tr": [ @@ -242,8 +242,8 @@ "positive_pattern": "adres ([İi]sim|başlığı|adı)", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "pt": [ @@ -252,8 +252,8 @@ "positive_pattern": "identificação do endereço", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "id": [ @@ -262,8 +262,8 @@ "positive_pattern": "(label|judul|nama) alamat", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -274,8 +274,8 @@ "positive_pattern": "company|business|organization|organisation", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "de": [ @@ -284,8 +284,8 @@ "positive_pattern": "(?<!con)firma|firmenname", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "es": [ @@ -294,8 +294,8 @@ "positive_pattern": "empresa", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "fr": [ @@ -304,8 +304,8 @@ "positive_pattern": "societe|société", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "it": [ @@ -314,8 +314,8 @@ "positive_pattern": "ragione.?sociale", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ja": [ @@ -324,8 +324,8 @@ "positive_pattern": "会社", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ru": [ @@ -334,8 +334,8 @@ "positive_pattern": "название.?компании", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "zh-CN": [ @@ -344,8 +344,8 @@ "positive_pattern": "单位|公司", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "fa": [ @@ -354,8 +354,8 @@ "positive_pattern": "شرکت", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ko": [ @@ -364,8 +364,8 @@ "positive_pattern": "회사|직장", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "id": [ @@ -374,8 +374,8 @@ "positive_pattern": "(nama.?)?perusahaan", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -386,16 +386,16 @@ "positive_pattern": "^address$|address[_-]?line(one)?|address1|addr1|street|(?:shipping|billing)address$|house.?name", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] }, { "pattern_identifier": "en_address_line_1_label_preserving", "positive_pattern": "(^\\W*address)|(address\\W*$)|(?:shipping|billing|mailing|pick.?up|drop.?off|delivery|sender|postal|recipient|home|work|office|school|business|mail)[\\s\\-]+address|address\\s+(of|for|to|from)|street.*(house|building|apartment|floor)|(house|building|apartment|floor).*street", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "de": [ @@ -404,8 +404,8 @@ "positive_pattern": "strasse|straße", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "es": [ @@ -414,8 +414,8 @@ "positive_pattern": "direccion|dirección", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "fr": [ @@ -424,16 +424,16 @@ "positive_pattern": "adresse", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] }, { "pattern_identifier": "fr_address_line_1_label_preserving", "positive_pattern": "adresse", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "it": [ @@ -442,16 +442,16 @@ "positive_pattern": "indirizzo", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] }, { "pattern_identifier": "it_address_line_1_label_preserving", "positive_pattern": "indirizzo", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "ja": [ @@ -460,16 +460,16 @@ "positive_pattern": "^住所$|住所1", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] }, { "pattern_identifier": "ja_address_line_1_label_preserving", "positive_pattern": "住所", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "pt": [ @@ -478,8 +478,8 @@ "positive_pattern": "morada|((?<!do |de )endereço)", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "ru": [ @@ -488,16 +488,16 @@ "positive_pattern": "Адрес", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] }, { "pattern_identifier": "ru_address_line_1_label_preserving", "positive_pattern": "улиц.*(дом|корпус|квартир|этаж)|(дом|корпус|квартир|этаж).*улиц", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "zh-CN": [ @@ -506,8 +506,8 @@ "positive_pattern": "地址", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "tr": [ @@ -516,16 +516,16 @@ "positive_pattern": "(\\b|_)adres(?! tarifi)(\\b|_)", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] }, { "pattern_identifier": "tr_address_line_1_label_preserving", "positive_pattern": "(\\b|_)adres(?! tarifi)(\\b|_)|(sokak|cadde).*(apartman|bina|daire|mahalle)|(apartman|bina|daire|mahalle).*(sokak|cadde)", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "ko": [ @@ -534,8 +534,8 @@ "positive_pattern": "^주소.?$|주소.?1", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] } , { @@ -543,8 +543,8 @@ "positive_pattern": "주소", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL"], + "match_field_input_types": ["TEXT", "SEARCH"] } ], "id": [ @@ -553,8 +553,8 @@ "positive_pattern": "^alamat", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SEARCH"] } , { @@ -562,8 +562,8 @@ "positive_pattern": "^alamat", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0], - "match_field_input_types": [0, 7] + "match_field_attributes": ["LABEL"], + "match_field_input_types": ["TEXT", "SEARCH"] } ] }, @@ -574,16 +574,16 @@ "positive_pattern": "address[_-]?line(2|two)|address2|addr2|street|suite|unit", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] }, { "pattern_identifier": "en_address_line_2_label_preserving", "positive_pattern": "address|line", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL"], + "match_field_input_types": ["TEXT"] } ], "de": [ @@ -592,8 +592,8 @@ "positive_pattern": "adresszusatz|ergänzende.?angaben", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "es": [ @@ -602,8 +602,8 @@ "positive_pattern": "direccion2|colonia|adicional", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "fr": [ @@ -612,16 +612,16 @@ "positive_pattern": "addresssuppl|complementnom|appartement", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] }, { "pattern_identifier": "fr_address_line_2_label_preserving", "positive_pattern": "adresse", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL"], + "match_field_input_types": ["TEXT"] } ], "it": [ @@ -630,16 +630,16 @@ "positive_pattern": "indirizzo2", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] }, { "pattern_identifier": "it_address_line_2_label_preserving", "positive_pattern": "indirizzo", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL"], + "match_field_input_types": ["TEXT"] } ], "ja": [ @@ -648,8 +648,8 @@ "positive_pattern": "住所2", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "pt": [ @@ -658,8 +658,8 @@ "positive_pattern": "complemento|addrcomplement", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ru": [ @@ -668,8 +668,8 @@ "positive_pattern": "Улица", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "zh-CN": [ @@ -678,16 +678,16 @@ "positive_pattern": "地址2", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] }, { "pattern_identifier": "zh_address_line_2_label_preserving", "positive_pattern": "地址", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL"], + "match_field_input_types": ["TEXT"] } ], "ko": [ @@ -696,16 +696,16 @@ "positive_pattern": "주소.?2", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] }, { "pattern_identifier": "ko_address_line_2_label_preserving", "positive_pattern": "주소", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL"], + "match_field_input_types": ["TEXT"] } ] }, @@ -716,8 +716,8 @@ "positive_pattern": "address.*line[3-9]|address[3-9]|addr[3-9]|street|line[3-9]", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "es": [ @@ -726,8 +726,8 @@ "positive_pattern": "municipio", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "fr": [ @@ -736,8 +736,8 @@ "positive_pattern": "batiment|residence", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "it": [ @@ -746,8 +746,8 @@ "positive_pattern": "indirizzo[3-9]", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -758,8 +758,8 @@ "positive_pattern": "lookup", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -770,8 +770,8 @@ "positive_pattern": "country|countries", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "es": [ @@ -780,8 +780,8 @@ "positive_pattern": "país|pais", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "de": [ @@ -790,8 +790,8 @@ "positive_pattern": "(\\b|_)land(\\b|_)(?!.*(mark.*))", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "ja": [ @@ -800,8 +800,8 @@ "positive_pattern": "(?<!(入|出))国", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "zh-CN": [ @@ -810,8 +810,8 @@ "positive_pattern": "国家", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "ko": [ @@ -820,8 +820,8 @@ "positive_pattern": "국가|나라", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "tr": [ @@ -830,8 +830,8 @@ "positive_pattern": "(\\b|_)(ülke|ulce|ulke)(\\b|_)", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "fa": [ @@ -840,8 +840,8 @@ "positive_pattern": "کشور", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "id": [ @@ -850,8 +850,8 @@ "positive_pattern": "negara", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ] }, @@ -862,8 +862,8 @@ "positive_pattern": "location", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["SELECT", "SEARCH"] } ] }, @@ -875,8 +875,8 @@ "positive_score": 1.1, "negative_pattern": "\\.zip\\b", "negative_patterns_explainer": ".zip refers to a file extension. However, there are field billingAddress.zip", - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] }, { "pattern_identifier": "en_zip_code_preserving", @@ -884,8 +884,8 @@ "positive_score": 1.1, "negative_pattern": null, "negative_patterns_explainer": "", - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "de": [ @@ -894,8 +894,8 @@ "positive_pattern": "postleitzahl", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "es": [ @@ -904,8 +904,8 @@ "positive_pattern": "\\bcp\\b", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "fr": [ @@ -914,8 +914,8 @@ "positive_pattern": "\\bcdp\\b", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "it": [ @@ -924,8 +924,8 @@ "positive_pattern": "\\bcap\\b", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "ja": [ @@ -934,8 +934,8 @@ "positive_pattern": "郵便番号", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "pt": [ @@ -944,8 +944,8 @@ "positive_pattern": "codigo|codpos|\\bcep\\b", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "ru": [ @@ -954,8 +954,8 @@ "positive_pattern": "Почтовый.?Индекс", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "hi": [ @@ -964,8 +964,8 @@ "positive_pattern": "पिन.?कोड", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "ml": [ @@ -974,8 +974,8 @@ "positive_pattern": "പിന്കോഡ്", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "zh-CN": [ @@ -984,8 +984,8 @@ "positive_pattern": "邮政编码|邮编", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "zh-TW": [ @@ -994,8 +994,8 @@ "positive_pattern": "郵遞區號", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "tr": [ @@ -1004,8 +1004,8 @@ "positive_pattern": "(\\b|_)posta kodu(\\b|_)", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "ko": [ @@ -1014,8 +1014,8 @@ "positive_pattern": "우편.?번호", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "id": [ @@ -1024,8 +1024,8 @@ "positive_pattern": "kode.?pos", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ] }, @@ -1037,8 +1037,8 @@ "positive_score": 1.1, "negative_pattern": "\\.zip", "negative_patterns_explainer": ".zip refers to a file extension", - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "pt": [ @@ -1047,8 +1047,8 @@ "positive_pattern": "codpos2", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ] }, @@ -1059,8 +1059,8 @@ "positive_pattern": "neighbo(u)?rhood", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "pt": [ @@ -1069,8 +1069,8 @@ "positive_pattern": "bairro", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "tr": [ @@ -1079,8 +1079,8 @@ "positive_pattern": "mahalle|köy", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "id": [ @@ -1089,8 +1089,8 @@ "positive_pattern": "kecamatan", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ] }, @@ -1101,8 +1101,8 @@ "positive_pattern": "city|town|suburb", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "de": [ @@ -1111,8 +1111,8 @@ "positive_pattern": "\\bort\\b|stadt", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "es": [ @@ -1121,8 +1121,8 @@ "positive_pattern": "ciudad|provincia|localidad|poblacion", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "fr": [ @@ -1131,8 +1131,8 @@ "positive_pattern": "ville|commune", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "it": [ @@ -1141,8 +1141,8 @@ "positive_pattern": "localita", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "ja": [ @@ -1151,8 +1151,8 @@ "positive_pattern": "市区町村", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "pt": [ @@ -1161,8 +1161,8 @@ "positive_pattern": "cidade|município", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "ru": [ @@ -1171,8 +1171,8 @@ "positive_pattern": "Город|Насел(е|ё)нный.?пункт", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "zh-TW": [ @@ -1181,8 +1181,8 @@ "positive_pattern": "市|分區", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "fa": [ @@ -1191,8 +1191,8 @@ "positive_pattern": "شهر", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "hi": [ @@ -1201,8 +1201,8 @@ "positive_pattern": "शहर|ग्राम|गाँव", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "ml": [ @@ -1211,8 +1211,8 @@ "positive_pattern": "നഗരം|ഗ്രാമം", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "tr": [ @@ -1221,8 +1221,8 @@ "positive_pattern": "((\\b|_|\\*)([İii̇]l[cç]e(miz|niz)?)(\\b|_|\\*))", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "ko": [ @@ -1231,8 +1231,8 @@ "positive_pattern": "^시[^도·・]|시[·・]?군[·・]?구", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "id": [ @@ -1241,8 +1241,8 @@ "positive_pattern": "kota|kabupaten", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ] }, @@ -1253,8 +1253,8 @@ "positive_pattern": "(?<!(united|hist|history).?)state|county|region|province|county|principality", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "ja": [ @@ -1263,8 +1263,8 @@ "positive_pattern": "都道府県", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "pt": [ @@ -1273,8 +1273,8 @@ "positive_pattern": "estado|provincia", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "ru": [ @@ -1283,8 +1283,8 @@ "positive_pattern": "область", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "zh-TW": [ @@ -1293,8 +1293,8 @@ "positive_pattern": "省|地區", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "ml": [ @@ -1303,8 +1303,8 @@ "positive_pattern": "സംസ്ഥാനം", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "fa": [ @@ -1313,8 +1313,8 @@ "positive_pattern": "استان", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "hi": [ @@ -1323,8 +1323,8 @@ "positive_pattern": "राज्य", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "tr": [ @@ -1333,8 +1333,8 @@ "positive_pattern": "((\\b|_|\\*)(eyalet|[şs]ehir|[İii̇]l(imiz)?|kent)(\\b|_|\\*))", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "ko": [ @@ -1343,8 +1343,8 @@ "positive_pattern": "^시[·・]?도", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "id": [ @@ -1353,8 +1353,8 @@ "positive_pattern": "provinci", "positive_score": 1.1, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ] }, @@ -1365,8 +1365,8 @@ "positive_pattern": "^q$|search|query|qry", "positive_score": 0.8, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 4, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TEXT_AREA", "SEARCH"] } ], "de": [ @@ -1375,8 +1375,8 @@ "positive_pattern": "suche.*", "positive_score": 0.8, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 4, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TEXT_AREA", "SEARCH"] } ], "zh-CN": [ @@ -1385,8 +1385,8 @@ "positive_pattern": "搜索", "positive_score": 0.8, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 4, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TEXT_AREA", "SEARCH"] } ], "ja": [ @@ -1395,8 +1395,8 @@ "positive_pattern": "探す|検索", "positive_score": 0.8, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 4, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TEXT_AREA", "SEARCH"] } ], "fr": [ @@ -1405,8 +1405,8 @@ "positive_pattern": "recherch.*", "positive_score": 0.8, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 4, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TEXT_AREA", "SEARCH"] } ], "pt": [ @@ -1415,8 +1415,8 @@ "positive_pattern": "busca", "positive_score": 0.8, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 4, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TEXT_AREA", "SEARCH"] } ], "fa": [ @@ -1425,8 +1425,8 @@ "positive_pattern": "جستجو", "positive_score": 0.8, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 4, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TEXT_AREA", "SEARCH"] } ], "ru": [ @@ -1435,8 +1435,8 @@ "positive_pattern": "искать|найти|поиск", "positive_score": 0.8, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 4, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TEXT_AREA", "SEARCH"] } ] }, @@ -1447,8 +1447,8 @@ "positive_pattern": "\\bprice\\b|\\brate\\b|\\bcost\\b", "positive_score": 0.95, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 4, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "TEXT_AREA", "NUMBER", "SEARCH"] } ], "ar": [ @@ -1457,8 +1457,8 @@ "positive_pattern": "قیمة|سعر", "positive_score": 0.95, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 4, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "TEXT_AREA", "NUMBER", "SEARCH"] } ], "fa": [ @@ -1467,8 +1467,8 @@ "positive_pattern": "قیمت", "positive_score": 0.95, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 4, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "TEXT_AREA", "NUMBER", "SEARCH"] } ], "fr": [ @@ -1477,8 +1477,8 @@ "positive_pattern": "\\bprix\\b|\\bcoût\\b|\\bcout\\b|\\btarif\\b", "positive_score": 0.95, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 4, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "TEXT_AREA", "NUMBER", "SEARCH"] } ] }, @@ -1489,8 +1489,8 @@ "positive_pattern": "card.?(?:holder|owner)|name.*(\\b)?on(\\b)?.*card|(?:card|cc).?name|cc.?full.?name", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "de": [ @@ -1499,8 +1499,8 @@ "positive_pattern": "karteninhaber", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "es": [ @@ -1509,8 +1509,8 @@ "positive_pattern": "nombre.*tarjeta", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "fr": [ @@ -1519,8 +1519,8 @@ "positive_pattern": "nom.*carte", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "it": [ @@ -1529,8 +1529,8 @@ "positive_pattern": "nome.*cart", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ja": [ @@ -1539,8 +1539,8 @@ "positive_pattern": "名前", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ru": [ @@ -1549,8 +1549,8 @@ "positive_pattern": "Имя.*карты", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "zh-CN": [ @@ -1559,8 +1559,8 @@ "positive_pattern": "信用卡开户名|开户名|持卡人姓名|持卡人姓名", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "id": [ @@ -1569,8 +1569,8 @@ "positive_pattern": "nama.*kartu", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -1581,8 +1581,8 @@ "positive_pattern": "name", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -1593,8 +1593,8 @@ "positive_pattern": "(add)?(?:card|cc|acct).?(?:number|#|no|num|field|pan)", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 5, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "PASSWORD", "NUMBER"] } ], "de": [ @@ -1603,8 +1603,8 @@ "positive_pattern": "(?<!telefon|haus|person|fødsels|kunden)nummer", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 5, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "PASSWORD", "NUMBER"] } ], "ja": [ @@ -1613,8 +1613,8 @@ "positive_pattern": "カード番号", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 5, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "PASSWORD", "NUMBER"] } ], "ru": [ @@ -1623,8 +1623,8 @@ "positive_pattern": "Номер.*карты", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 5, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "PASSWORD", "NUMBER"] } ], "zh-CN": [ @@ -1633,8 +1633,8 @@ "positive_pattern": "信用卡号|信用卡号码", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 5, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "PASSWORD", "NUMBER"] } ], "zh-TW": [ @@ -1643,8 +1643,8 @@ "positive_pattern": "信用卡卡號", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 5, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "PASSWORD", "NUMBER"] } ], "ko": [ @@ -1653,8 +1653,8 @@ "positive_pattern": "카드", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 5, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "PASSWORD", "NUMBER"] } ], "es": [ @@ -1663,8 +1663,8 @@ "positive_pattern": "(numero|número|numéro)(?!.*(document|fono|phone|réservation))", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 5, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "PASSWORD", "NUMBER"] } ], "pt": [ @@ -1673,8 +1673,8 @@ "positive_pattern": "(numero|número|numéro)(?!.*(document|fono|phone|réservation))", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 5, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "PASSWORD", "NUMBER"] } ], "fr": [ @@ -1683,8 +1683,8 @@ "positive_pattern": "(numero|número|numéro)(?!.*(document|fono|phone|réservation))", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 5, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "PASSWORD", "NUMBER"] } ], "id": [ @@ -1693,8 +1693,8 @@ "positive_pattern": "no.*kartu", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 5, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "PASSWORD", "NUMBER"] } ] }, @@ -1705,8 +1705,8 @@ "positive_pattern": "verification|card.?identification|security.?code|card.?code|security.?value|security.?number|card.?pin|c-v-v|(cvn|cvv|cvc|csc|cvd|cid|ccv)(field)?|\\bcid\\b", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 5, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "PASSWORD", "NUMBER"] } ] }, @@ -1717,8 +1717,8 @@ "positive_pattern": "expir|exp.*mo|exp.*date|ccmonth|cardmonth|addmonth", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "de": [ @@ -1727,8 +1727,8 @@ "positive_pattern": "gueltig|gültig|monat", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "es": [ @@ -1737,8 +1737,8 @@ "positive_pattern": "fecha", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "fr": [ @@ -1747,8 +1747,8 @@ "positive_pattern": "date.*exp", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "it": [ @@ -1757,8 +1757,8 @@ "positive_pattern": "scadenza", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "ja": [ @@ -1767,8 +1767,8 @@ "positive_pattern": "有効期限", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "pt": [ @@ -1777,8 +1777,8 @@ "positive_pattern": "validade", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "ru": [ @@ -1787,8 +1787,8 @@ "positive_pattern": "Срок действия карты", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "zh-CN": [ @@ -1797,8 +1797,8 @@ "positive_pattern": "月", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "id": [ @@ -1807,8 +1807,8 @@ "positive_pattern": "masa berlaku|berlaku hingga", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ] }, @@ -1819,8 +1819,8 @@ "positive_pattern": "exp|^/|(add)?year", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "de": [ @@ -1829,8 +1829,8 @@ "positive_pattern": "ablaufdatum|gueltig|gültig|jahr", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "es": [ @@ -1839,8 +1839,8 @@ "positive_pattern": "fecha", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "it": [ @@ -1849,8 +1849,8 @@ "positive_pattern": "scadenza", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "ja": [ @@ -1859,8 +1859,8 @@ "positive_pattern": "有効期限", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "pt": [ @@ -1869,8 +1869,8 @@ "positive_pattern": "validade", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "ru": [ @@ -1879,8 +1879,8 @@ "positive_pattern": "Срок действия карты", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "zh-CN": [ @@ -1889,8 +1889,8 @@ "positive_pattern": "年|有效期", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "id": [ @@ -1899,8 +1899,8 @@ "positive_pattern": "masa berlaku|berlaku hingga", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ] }, @@ -1911,8 +1911,8 @@ "positive_pattern": "(?:exp.*date[^y\\n\\r]*|mm\\s*[-/]?\\s*)yy(?:[^y]|$)", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ] }, @@ -1923,8 +1923,8 @@ "positive_pattern": "(?:exp.*date[^y\\n\\r]*|mm\\s*[-/]?\\s*)yyyy(?:[^y]|$)", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ] }, @@ -1935,8 +1935,8 @@ "positive_pattern": "expir|exp.*date|^expfield$", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "de": [ @@ -1945,8 +1945,8 @@ "positive_pattern": "gueltig|gültig", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "es": [ @@ -1955,8 +1955,8 @@ "positive_pattern": "fecha", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "fr": [ @@ -1965,8 +1965,8 @@ "positive_pattern": "date.*exp", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "it": [ @@ -1975,8 +1975,8 @@ "positive_pattern": "scadenza", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "ja": [ @@ -1985,8 +1985,8 @@ "positive_pattern": "有効期限", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "pt": [ @@ -1995,8 +1995,8 @@ "positive_pattern": "validade", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ], "ru": [ @@ -2005,8 +2005,8 @@ "positive_pattern": "Срок действия карты", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ] }, @@ -2017,8 +2017,8 @@ "positive_pattern": "^mm$", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ] }, @@ -2029,8 +2029,8 @@ "positive_pattern": "^(yy|yyyy)$", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER", "SEARCH"] } ] }, @@ -2041,8 +2041,8 @@ "positive_pattern": "gift.?(card|cert)", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER", "SEARCH"] } ] }, @@ -2053,8 +2053,8 @@ "positive_pattern": "(?:visa|mastercard|discover|amex|american express).*gift.?card", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER", "SEARCH"] } ] }, @@ -2065,8 +2065,8 @@ "positive_pattern": "debit.*card", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER", "SEARCH"] } ] }, @@ -2077,8 +2077,8 @@ "positive_pattern": "day", "positive_score": 1.0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT"] } ] }, @@ -2089,8 +2089,8 @@ "positive_pattern": "e.?mail", "positive_score": 1.4, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 1] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "EMAIL"] } ], "fr": [ @@ -2099,8 +2099,8 @@ "positive_pattern": "courriel", "positive_score": 1.4, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 1] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "EMAIL"] } ], "es": [ @@ -2109,8 +2109,8 @@ "positive_pattern": "correo.*electr(o|ó)nico", "positive_score": 1.4, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 1] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "EMAIL"] } ], "ja": [ @@ -2119,8 +2119,8 @@ "positive_pattern": "メールアドレス", "positive_score": 1.4, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 1] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "EMAIL"] } ], "ru": [ @@ -2129,8 +2129,8 @@ "positive_pattern": "Электронн(ая|ой).?Почт(а|ы)", "positive_score": 1.4, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 1] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "EMAIL"] } ], "zh-CN": [ @@ -2139,8 +2139,8 @@ "positive_pattern": "邮件|邮箱|電子郵件", "positive_score": 1.4, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 1] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "EMAIL"] } ], "zh-TW": [ @@ -2149,8 +2149,8 @@ "positive_pattern": "電郵地址|電子信箱", "positive_score": 1.4, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 1] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "EMAIL"] } ], "ml": [ @@ -2159,8 +2159,8 @@ "positive_pattern": "ഇ-മെയില്|ഇലക്ട്രോണിക്.?മെയിൽ", "positive_score": 1.4, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 1] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "EMAIL"] } ], "fa": [ @@ -2169,8 +2169,8 @@ "positive_pattern": "ایمیل|پست.*الکترونیک", "positive_score": 1.4, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 1] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "EMAIL"] } ], "hi": [ @@ -2179,8 +2179,8 @@ "positive_pattern": "ईमेल|इलॅक्ट्रॉनिक.?मेल", "positive_score": 1.4, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 1] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "EMAIL"] } ], "tr": [ @@ -2189,8 +2189,8 @@ "positive_pattern": "(\\b|_)eposta(\\b|_)", "positive_score": 1.4, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 1] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "EMAIL"] } ], "ko": [ @@ -2199,8 +2199,8 @@ "positive_pattern": "(?:이메일|전자.?우편|[Ee]-?mail)(.?주소)?", "positive_score": 1.4, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 1] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "EMAIL"] } ] }, @@ -2211,8 +2211,8 @@ "positive_pattern": "user.?name|user.?id|nickname|maiden name|title|prefix|suffix|mail", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "de": [ @@ -2221,8 +2221,8 @@ "positive_pattern": "vollständiger.?name", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "zh-CN": [ @@ -2231,8 +2231,8 @@ "positive_pattern": "用户名", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ], "ko": [ @@ -2241,8 +2241,8 @@ "positive_pattern": "(?:사용자.?)?아이디|사용자.?ID", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 3, 7] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "SELECT", "SEARCH"] } ] }, @@ -2253,8 +2253,8 @@ "positive_pattern": "^name|full.?name|your.?name|customer.?name|bill.?name|ship.?name|name.*first.*last|firstandlastname|contact.?(name|person)", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "es": [ @@ -2263,8 +2263,8 @@ "positive_pattern": "nombre.*y.*apellidos", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "fr": [ @@ -2273,8 +2273,8 @@ "positive_pattern": "^nom(?![a-zA-Z])", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ja": [ @@ -2283,8 +2283,8 @@ "positive_pattern": "お名前|氏名", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "pt": [ @@ -2293,8 +2293,8 @@ "positive_pattern": "^nome", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "fa": [ @@ -2303,8 +2303,8 @@ "positive_pattern": "نام.*نام.*خانوادگی", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "zh-CN": [ @@ -2313,8 +2313,8 @@ "positive_pattern": "姓\\s*名", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ru": [ @@ -2323,8 +2323,8 @@ "positive_pattern": "контактное.?лицо", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "tr": [ @@ -2333,8 +2333,8 @@ "positive_pattern": "(\\b|_|\\*)ad[ı]? soyad[ı]?(\\b|_|\\*)", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ko": [ @@ -2343,8 +2343,8 @@ "positive_pattern": "성명", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "id": [ @@ -2353,8 +2353,8 @@ "positive_pattern": "nama.?(lengkap|penerima|kamu)", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -2365,8 +2365,8 @@ "positive_pattern": "^name", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "fr": [ @@ -2375,8 +2375,8 @@ "positive_pattern": "^nom", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "pt": [ @@ -2385,8 +2385,8 @@ "positive_pattern": "^nome", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -2397,8 +2397,8 @@ "positive_pattern": "first.*name|initials|fname|first$|given.*name", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "de": [ @@ -2407,8 +2407,8 @@ "positive_pattern": "vorname", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "es": [ @@ -2417,8 +2417,8 @@ "positive_pattern": "nombre", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "fr": [ @@ -2427,8 +2427,8 @@ "positive_pattern": "forename|prénom|prenom", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ja": [ @@ -2437,8 +2437,8 @@ "positive_pattern": "名", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "pt": [ @@ -2447,8 +2447,8 @@ "positive_pattern": "nome", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ru": [ @@ -2457,8 +2457,8 @@ "positive_pattern": "Имя", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "fa": [ @@ -2467,8 +2467,8 @@ "positive_pattern": "نام", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ko": [ @@ -2477,8 +2477,8 @@ "positive_pattern": "이름", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ml": [ @@ -2487,8 +2487,8 @@ "positive_pattern": "പേര്", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "tr": [ @@ -2497,8 +2497,8 @@ "positive_pattern": "(\\b|_|\\*)(isim|ad|ad(i|ı|iniz|ınız)?)(\\b|_|\\*)", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "hi": [ @@ -2507,8 +2507,8 @@ "positive_pattern": "नाम", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "id": [ @@ -2517,8 +2517,8 @@ "positive_pattern": "nama depan", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -2529,8 +2529,8 @@ "positive_pattern": "middle.*initial|m\\.i\\.|mi$|\\bmi\\b", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -2541,8 +2541,8 @@ "positive_pattern": "middle.*name|mname|middle$", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -2553,8 +2553,8 @@ "positive_pattern": "last.*name|lname|surname(?!\\d)|last$|secondname|family.*name", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "de": [ @@ -2563,8 +2563,8 @@ "positive_pattern": "nachname", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "es": [ @@ -2573,8 +2573,8 @@ "positive_pattern": "apellidos?", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "fr": [ @@ -2583,8 +2583,8 @@ "positive_pattern": "famille|^nom(?![a-zA-Z])", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "it": [ @@ -2593,8 +2593,8 @@ "positive_pattern": "cognome", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ja": [ @@ -2603,8 +2603,8 @@ "positive_pattern": "姓", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "pt": [ @@ -2613,8 +2613,8 @@ "positive_pattern": "apelidos|surename|sobrenome", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ru": [ @@ -2623,8 +2623,8 @@ "positive_pattern": "Фамилия", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "fa": [ @@ -2633,8 +2633,8 @@ "positive_pattern": "نام.*خانوادگی", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "hi": [ @@ -2643,8 +2643,8 @@ "positive_pattern": "उपनाम", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ml": [ @@ -2653,8 +2653,8 @@ "positive_pattern": "മറുപേര്", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "tr": [ @@ -2663,8 +2663,8 @@ "positive_pattern": "(\\b|_|\\*)(soyisim|soyad(i|ı|iniz|ınız)?)(\\b|_|\\*)", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ko": [ @@ -2673,8 +2673,8 @@ "positive_pattern": "\\b성(?:[^명]|\\b)", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "id": [ @@ -2683,8 +2683,8 @@ "positive_pattern": "nama belakang", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -2695,8 +2695,8 @@ "positive_pattern": "(primer.*apellido)|(apellido1)|(apellido.*paterno)|surname_?1|first(\\s|_)?surname", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -2707,8 +2707,8 @@ "positive_pattern": "(segund.*apellido)|(apellido2)|(apellido.*materno)|surname_?2|second(\\s|_)?surname", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -2719,8 +2719,8 @@ "positive_pattern": "^title:?$|(salutation(?! and given name))", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "de": [ @@ -2729,8 +2729,8 @@ "positive_pattern": "anrede|titel", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "es": [ @@ -2739,8 +2739,8 @@ "positive_pattern": "tratamiento|encabezamiento", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "it": [ @@ -2749,8 +2749,8 @@ "positive_pattern": "titolo", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "fr": [ @@ -2759,8 +2759,8 @@ "positive_pattern": "titre", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ru": [ @@ -2769,8 +2769,8 @@ "positive_pattern": "обращение|звание", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "el": [ @@ -2779,8 +2779,8 @@ "positive_pattern": "προσφώνηση", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "tr": [ @@ -2789,8 +2789,8 @@ "positive_pattern": "hitap", "positive_score": 0.9, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -2801,8 +2801,8 @@ "positive_pattern": "phone|mobile|contact.?number", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "de": [ @@ -2811,8 +2811,8 @@ "positive_pattern": "telefonnummer", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "es": [ @@ -2821,8 +2821,8 @@ "positive_pattern": "telefono|teléfono", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "fr": [ @@ -2831,8 +2831,8 @@ "positive_pattern": "telfixe", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "ja": [ @@ -2841,8 +2841,8 @@ "positive_pattern": "電話", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "pt": [ @@ -2851,8 +2851,8 @@ "positive_pattern": "telefone|telemovel", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "ru": [ @@ -2861,8 +2861,8 @@ "positive_pattern": "телефон", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "hi": [ @@ -2871,8 +2871,8 @@ "positive_pattern": "मोबाइल", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "tr": [ @@ -2881,8 +2881,8 @@ "positive_pattern": "(\\b|_|\\*)telefon(\\b|_|\\*)", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "zh-CN": [ @@ -2891,8 +2891,8 @@ "positive_pattern": "电话", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "ml": [ @@ -2901,8 +2901,8 @@ "positive_pattern": "മൊബൈല്", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "ko": [ @@ -2911,8 +2911,8 @@ "positive_pattern": "(?:전화|핸드폰|휴대폰|휴대전화)(?:.?번호)?", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "id": [ @@ -2921,8 +2921,8 @@ "positive_pattern": "telepon|ponsel|(nomor|no\\.?).?(hp|handphone)", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ] }, @@ -2933,8 +2933,8 @@ "positive_pattern": "^[^0-9+]*(?:\\+|00)\\s*([1-9]\\d{0,3})\\D*$", "positive_score": 1.3, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -2945,8 +2945,8 @@ "positive_pattern": "country.*code|ccode|_cc|phone.*code|user.*phone.*code", "positive_score": 1.3, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 3, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "SELECT", "NUMBER"] } ] }, @@ -2957,8 +2957,8 @@ "positive_pattern": "^\\($", "positive_score": 1.3, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ] }, @@ -2969,8 +2969,8 @@ "positive_pattern": "area.*code|acode|area", "positive_score": 1.3, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "ko": [ @@ -2979,8 +2979,8 @@ "positive_pattern": "지역.?번호", "positive_score": 1.3, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ] }, @@ -2991,8 +2991,8 @@ "positive_pattern": "^-$|^\\)$", "positive_score": 1.3, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ] }, @@ -3003,8 +3003,8 @@ "positive_pattern": "^-$", "positive_score": 1.3, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ] }, @@ -3015,8 +3015,8 @@ "positive_pattern": "prefix|exchange", "positive_score": 1.3, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "fr": [ @@ -3025,8 +3025,8 @@ "positive_pattern": "preselection", "positive_score": 1.3, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "pt": [ @@ -3035,8 +3035,8 @@ "positive_pattern": "ddd", "positive_score": 1.3, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ] }, @@ -3047,8 +3047,8 @@ "positive_pattern": "suffix", "positive_score": 1.3, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ] }, @@ -3059,8 +3059,8 @@ "positive_pattern": "\\bext|ext\\b|extension", "positive_score": 1.3, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ], "pt": [ @@ -3069,8 +3069,8 @@ "positive_pattern": "ramal", "positive_score": 1.3, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0, 2, 6] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT", "TELEPHONE", "NUMBER"] } ] }, @@ -3081,8 +3081,8 @@ "positive_pattern": "document.*number|passport", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "fr": [ @@ -3091,8 +3091,8 @@ "positive_pattern": "passeport", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "es": [ @@ -3101,8 +3101,8 @@ "positive_pattern": "numero.*documento|pasaporte", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ja": [ @@ -3111,8 +3111,8 @@ "positive_pattern": "書類", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -3123,8 +3123,8 @@ "positive_pattern": "point.*of.*entry|arrival", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "es": [ @@ -3133,8 +3133,8 @@ "positive_pattern": "punto.*internaci(o|ó)n|fecha.*llegada", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ja": [ @@ -3143,8 +3143,8 @@ "positive_pattern": "入国", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -3155,8 +3155,8 @@ "positive_pattern": "departure", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "es": [ @@ -3165,8 +3165,8 @@ "positive_pattern": "fecha.*salida|destino", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ja": [ @@ -3175,8 +3175,8 @@ "positive_pattern": "出国", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -3187,8 +3187,8 @@ "positive_pattern": "airline|flight", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "es": [ @@ -3197,8 +3197,8 @@ "positive_pattern": "aerol(i|í)nea|n(u|ú)mero.*vuelo", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ], "ja": [ @@ -3207,8 +3207,8 @@ "positive_pattern": "便名|航空会社", "positive_score": 1.2, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -3219,16 +3219,16 @@ "positive_pattern": "^[\\w.+-_]+@(\\w+\\.ifsc\\.npci|aadhaar\\.npci|mobile\\.npci|rupay\\.npci)$", "positive_score": 0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] }, { "pattern_identifier": "en_upi_virtual_payment_address_user@(bank_list)_preserving", "positive_pattern": "^[\\w.+-_]+@(airtel|airtelpaymentsbank|albk|allahabadbank|allbank|andb|apb|apl|axis|axisbank|axisgo|bandhan|barodampay|birla|boi|cbin|cboi|centralbank|cmsidfc|cnrb|csbcash|csbpay|cub|dbs|dcb|dcbbank|denabank|dlb|eazypay|equitas|ezeepay|fbl|federal|finobank|hdfcbank|hsbc|icici|idbi|idbibank|idfc|idfcbank|idfcnetc|ikwik|imobile|indbank|indianbank|indianbk|indus|iob|jkb|jsb|jsbp|karb|karurvysyabank|kaypay|kbl|kbl052|kmb|kmbl|kotak|kvb|kvbank|lime|lvb|lvbank|mahb|obc|okaxis|okbizaxis|okhdfcbank|okicici|oksbi|paytm|payzapp|pingpay|pnb|pockets|psb|purz|rajgovhdfcbank|rbl|sbi|sc|scb|scbl|scmobile|sib|srcb|synd|syndbank|syndicate|tjsb|tjsp|ubi|uboi|uco|unionbank|unionbankofindia|united|upi|utbi|vijayabank|vijb|vjb|ybl|yesbank|yesbankltd)$", "positive_score": 0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -3239,8 +3239,8 @@ "positive_pattern": "^[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{4}[0-9]{7}([a-zA-Z0-9]?){0,16}$", "positive_score": 0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -3251,8 +3251,8 @@ "positive_pattern": "^\\d{3,4}$", "positive_score": 0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -3263,8 +3263,8 @@ "positive_pattern": "^[2][0][1-9][0-9]$", "positive_score": 0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -3275,8 +3275,8 @@ "positive_pattern": "/search(/|((\\w*\\.\\w+)?$))", "positive_score": 0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -3287,8 +3287,8 @@ "positive_pattern": "ssn|social.?security.?(num(ber)?|#)*", "positive_score": 0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -3299,8 +3299,8 @@ "positive_pattern": "one.?time|sms.?(code|token|password|pwd|pass)", "positive_score": 0, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -3311,8 +3311,8 @@ "positive_pattern": "(promo(tion|tional)?|gift|discount|coupon)[-_. ]*code", "positive_score": 0.85, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }, @@ -3323,8 +3323,8 @@ "positive_pattern": "(\\biban(\\b|_)|international bank account number)", "positive_score": 0.975, "negative_pattern": null, - "match_field_attributes": [0, 1], - "match_field_input_types": [0] + "match_field_attributes": ["LABEL", "NAME"], + "match_field_input_types": ["TEXT"] } ] }
diff --git a/components/autofill/core/browser/form_parsing/standalone_cvc_field.cc b/components/autofill/core/browser/form_parsing/standalone_cvc_field.cc new file mode 100644 index 0000000..1110d613 --- /dev/null +++ b/components/autofill/core/browser/form_parsing/standalone_cvc_field.cc
@@ -0,0 +1,80 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/autofill/core/browser/form_parsing/standalone_cvc_field.h" + +#include "components/autofill/core/browser/autofill_field.h" +#include "components/autofill/core/browser/autofill_regex_constants.h" +#include "components/autofill/core/browser/autofill_regexes.h" +#include "components/autofill/core/browser/form_parsing/autofill_scanner.h" +#include "components/autofill/core/common/autofill_payments_features.h" + +namespace autofill { + +// static +std::unique_ptr<FormField> StandaloneCvcField::Parse( + AutofillScanner* scanner, + const LanguageCode& page_language, + PatternSource pattern_source, + LogManager* log_manager) { + if (!base::FeatureList::IsEnabled( + features::kAutofillParseVcnCardOnFileStandaloneCvcFields)) { + return nullptr; + } + + // Ignore gift card fields as both |kGiftCardRe| and |kCardCvcRe| matches + // "gift card pin" and "gift card code" but it should only match + // |kGiftCardRe|. + if (MatchGiftCard(scanner, log_manager, page_language, pattern_source)) { + return nullptr; + } + + AutofillField* field; + base::span<const MatchPatternRef> cvc_patterns = GetMatchPatterns( + CREDIT_CARD_VERIFICATION_CODE, page_language, pattern_source); + + // CVC fields can occur in many different field types so we check for each + const auto kMatchNumTelAndPwd = + kDefaultMatchParamsWith<MatchFieldType::kNumber, + MatchFieldType::kTelephone, + MatchFieldType::kPassword>; + if (ParseFieldSpecifics(scanner, kCardCvcRe, kMatchNumTelAndPwd, cvc_patterns, + &field, {log_manager, "kCardCvcRe(standalone)"})) { + return std::make_unique<StandaloneCvcField>(field); + } + + return nullptr; +} + +StandaloneCvcField::~StandaloneCvcField() = default; + +// static +bool StandaloneCvcField::MatchGiftCard(AutofillScanner* scanner, + LogManager* log_manager, + const LanguageCode& page_language, + PatternSource pattern_source) { + if (scanner->IsEnd()) + return false; + + const auto kMatchFieldType = kDefaultMatchParamsWith< + MatchFieldType::kNumber, MatchFieldType::kTelephone, + MatchFieldType::kSearch, MatchFieldType::kPassword>; + base::span<const MatchPatternRef> gift_card_patterns = + GetMatchPatterns("GIFT_CARD", page_language, pattern_source); + + return ParseFieldSpecifics(scanner, kGiftCardRe, kMatchFieldType, + gift_card_patterns, nullptr, + {log_manager, "kGiftCardRe"}); +} + +StandaloneCvcField::StandaloneCvcField(const AutofillField* field) + : field_(field) {} + +void StandaloneCvcField::AddClassifications( + FieldCandidatesMap& field_candidates) const { + AddClassification(field_, CREDIT_CARD_STANDALONE_VERIFICATION_CODE, + kBaseCreditCardParserScore, field_candidates); +} + +} // namespace autofill
diff --git a/components/autofill/core/browser/form_parsing/standalone_cvc_field.h b/components/autofill/core/browser/form_parsing/standalone_cvc_field.h new file mode 100644 index 0000000..d4b272f --- /dev/null +++ b/components/autofill/core/browser/form_parsing/standalone_cvc_field.h
@@ -0,0 +1,50 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_PARSING_STANDALONE_CVC_FIELD_H_ +#define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_PARSING_STANDALONE_CVC_FIELD_H_ + +#include <memory> + +#include "base/memory/raw_ptr.h" +#include "components/autofill/core/browser/form_parsing/form_field.h" +#include "components/autofill/core/common/language_code.h" + +namespace autofill { + +class AutofillField; +class AutofillScanner; +class LogManager; + +// A form field that accepts a standalone cvc. +class StandaloneCvcField : public FormField { + public: + static std::unique_ptr<FormField> Parse(AutofillScanner* scanner, + const LanguageCode& page_language, + PatternSource pattern_source, + LogManager* log_manager); + + explicit StandaloneCvcField(const AutofillField* field); + + ~StandaloneCvcField() override; + + StandaloneCvcField(const StandaloneCvcField&) = delete; + StandaloneCvcField& operator=(const StandaloneCvcField&) = delete; + + protected: + void AddClassifications(FieldCandidatesMap& field_candidates) const override; + + private: + raw_ptr<const AutofillField> field_; + + // static + static bool MatchGiftCard(AutofillScanner* scanner, + LogManager* log_manager, + const LanguageCode& page_language, + PatternSource pattern_source); +}; + +} // namespace autofill + +#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_PARSING_STANDALONE_CVC_FIELD_H_
diff --git a/components/autofill/core/browser/form_parsing/standalone_cvc_field_unittest.cc b/components/autofill/core/browser/form_parsing/standalone_cvc_field_unittest.cc new file mode 100644 index 0000000..604ccc6 --- /dev/null +++ b/components/autofill/core/browser/form_parsing/standalone_cvc_field_unittest.cc
@@ -0,0 +1,78 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/autofill/core/browser/form_parsing/standalone_cvc_field.h" + +#include "base/test/scoped_feature_list.h" +#include "components/autofill/core/browser/form_parsing/parsing_test_utils.h" +#include "components/autofill/core/common/autofill_payments_features.h" + +namespace autofill { + +class StandaloneCvcFieldTest + : public FormFieldTestBase, + public testing::TestWithParam<PatternProviderFeatureState> { + public: + StandaloneCvcFieldTest() : FormFieldTestBase(GetParam()) {} + StandaloneCvcFieldTest(const StandaloneCvcFieldTest&) = delete; + StandaloneCvcFieldTest& operator=(const StandaloneCvcFieldTest&) = delete; + + protected: + std::unique_ptr<FormField> Parse( + AutofillScanner* scanner, + const LanguageCode& page_language = LanguageCode("en")) override { + return StandaloneCvcField::Parse(scanner, page_language, + GetActivePatternSource(), + /*log_manager=*/nullptr); + } + + base::test::ScopedFeatureList scoped_feature_list_; +}; + +INSTANTIATE_TEST_SUITE_P( + StandaloneCvcFieldTest, + StandaloneCvcFieldTest, + ::testing::ValuesIn(PatternProviderFeatureState::All())); + +// Match standalone cvc. +TEST_P(StandaloneCvcFieldTest, ParseStandaloneCvc) { + scoped_feature_list_.InitAndEnableFeature( + features::kAutofillParseVcnCardOnFileStandaloneCvcFields); + + AddTextFormFieldData("cvc", "CVC:", CREDIT_CARD_STANDALONE_VERIFICATION_CODE); + + ClassifyAndVerify(ParseResult::PARSED); +} + +// Do not parse non cvc standalone fields. +TEST_P(StandaloneCvcFieldTest, ParseNonStandaloneCvc) { + scoped_feature_list_.InitAndEnableFeature( + features::kAutofillParseVcnCardOnFileStandaloneCvcFields); + + AddTextFormFieldData("other-field", "Other Field:", UNKNOWN_TYPE); + + ClassifyAndVerify(ParseResult::NOT_PARSED); +} + +// Do not parse when standalone cvc flag is disabled. +TEST_P(StandaloneCvcFieldTest, ParseStandaloneCvcFlagOff) { + scoped_feature_list_.InitAndDisableFeature( + features::kAutofillParseVcnCardOnFileStandaloneCvcFields); + + AddTextFormFieldData("cvc", "CVC:", CREDIT_CARD_STANDALONE_VERIFICATION_CODE); + + ClassifyAndVerify(ParseResult::NOT_PARSED); +} + +// Do not parse gift card as standalone cvc fields. +TEST_P(StandaloneCvcFieldTest, NotParseGiftCardAsStandaloneCvc) { + scoped_feature_list_.InitAndEnableFeature( + features::kAutofillParseVcnCardOnFileStandaloneCvcFields); + + AddTextFormFieldData("gift-card", "Gift Card Pin:", UNKNOWN_TYPE); + + ClassifyAndVerify(ParseResult::NOT_PARSED); +} + +} // namespace autofill
diff --git a/components/autofill/core/browser/form_parsing/transpile_regex_patterns.py b/components/autofill/core/browser/form_parsing/transpile_regex_patterns.py index ebcd89a..53e2d3a 100755 --- a/components/autofill/core/browser/form_parsing/transpile_regex_patterns.py +++ b/components/autofill/core/browser/form_parsing/transpile_regex_patterns.py
@@ -8,6 +8,7 @@ from collections import defaultdict import io import json +import re import sys # Generates a set of C++ constexpr constants to facilitate lookup of a set of @@ -36,11 +37,6 @@ # lookup pattern name -> language code -> span of MatchPatternRefs, but it's # significantly simpler. def generate_cpp_constants(id_to_name_to_lang_to_patterns): - # The enum constant of the MatchAttribute::kName. - kName = 1 - yield f'static_assert(MatchAttribute::kName == To<MatchAttribute,{kName}>());' - yield '' - # Stores a `key` in `dictionary` and assigns it a natural number. # # For example, after memoize("foo", d) and memoize("bar", d), @@ -64,17 +60,30 @@ def json_to_cpp_u16string_literal(json_string_literal): return 'u'+ json.dumps(json_string_literal or '') - # Maps a list of natural numbers to a DenseSet<MatchAttribute> expression. - def json_to_cpp_match_field_attributes(enum_values): - return f'DenseSet<MatchAttribute>{{' \ - f"{','.join(f'To<MatchAttribute,{i}>()' for i in enum_values)}" \ - f'}}' + # Maps a list of strings to a DenseSet containing these values. + # The strings represents constants in the format FOO_BAR. + # They're translated to the C++ constant kFooBar. + def json_to_cpp_dense_set(json_enum_values, cpp_enum_type): + # Converts FOO_BAR into kFooBar. + def json_to_cpp_constant_symbol(json): + assert json.isupper() + return f'{cpp_enum_type}::k' + re.sub( + r'(^|_)([a-z])', lambda matched: matched.group(2).upper(), + json.lower()) + cpp_enum_values = [json_to_cpp_constant_symbol(c) for c in json_enum_values] + return (f'DenseSet<{cpp_enum_type}>{{' + ','.join(cpp_enum_values) + f'}}') - # Maps a list of natural numbers to a DenseSet<MatchFieldType> expression. + # Maps a list of strings to a DenseSet<MatchAttribute> expression. + # The strings must be the names of MatchAttribute constants, e.g., NAME. + # They're mapped to C++ constants, e.g., kName. + def json_to_cpp_match_field_attributes(enum_values): + return json_to_cpp_dense_set(enum_values, 'MatchAttribute') + + # Maps a list of strings to a DenseSet<MatchFieldType> expression. + # The strings must be the names of MatchFieldType constants, e.g., TEXT_AREA. + # They're mapped to C++ constants, e.g., kTextArea. def json_to_cpp_match_field_input_types(enum_values): - return f'DenseSet<MatchFieldType>{{' \ - f"{','.join(f'To<MatchFieldType,{i}>()' for i in enum_values)}" \ - f'}}' + return json_to_cpp_dense_set(enum_values, 'MatchFieldType') # Maps a JSON object representing a pattern to a C++ MatchingPattern # expression. @@ -125,6 +134,27 @@ p.copy() for ps in lang_to_patterns.values() for p in ps ] + # Map legacy raw integer literals to the JSON constant string. + # TODO(crbug.com/1312026): Remove once src-internal has been rolled. + def normalize_match_field_attributes(json): + constants = ['LABEL', 'NAME'] + return [constants[c] if isinstance(c, int) else c for c in json] + def normalize_match_field_input_types(json): + constants = [ + 'TEXT', 'EMAIL', 'TELEPHONE', 'SELECT', 'TEXT_AREA', 'PASSWORD', + 'NUMBER', 'SEARCH' + ] + return [constants[c] if isinstance(c, int) else c for c in json] + for lang_to_patterns in name_to_lang_to_patterns.values(): + for patterns in lang_to_patterns.values(): + for p in patterns: + if 'match_field_attributes' in p: + p['match_field_attributes'] = normalize_match_field_attributes( + p['match_field_attributes']) + if 'match_field_input_types' in p: + p['match_field_input_types'] = normalize_match_field_input_types( + p['match_field_input_types']) + # Add the English patterns to all languages except for English itself and # the catch-all language ''. # @@ -136,7 +166,7 @@ if 'en' not in lang_to_patterns: continue def make_supplementary_pattern(p): - assert kName in p['match_field_attributes'] + assert "NAME" in p['match_field_attributes'] p = p.copy() p['supplementary'] = True return p @@ -145,7 +175,7 @@ patterns.extend( make_supplementary_pattern(p) for p in lang_to_patterns['en'] - if kName in p['match_field_attributes']) + if "NAME" in p['match_field_attributes']) # Populate the two maps: # - a map from C++ MatchingPattern expressions to their index. @@ -266,14 +296,6 @@ return MatchPatternRef(is_supplementary, index); } -// Converts an integer to the associated enum class constant. -template<typename Enum, int i> -constexpr Enum To() { - static_assert(0 <= i); - static_assert(static_cast<Enum>(i) <= Enum::kMaxValue); - return static_cast<Enum>(i); -} - // A pair of const char* used as keys in the `kPatternMap`. struct NameAndLanguage { using StringPiecePair = std::pair<base::StringPiece, base::StringPiece>;
diff --git a/components/autofill/core/browser/metrics/autofill_metrics.cc b/components/autofill/core/browser/metrics/autofill_metrics.cc index 3ff9abc7..0c7eca4 100644 --- a/components/autofill/core/browser/metrics/autofill_metrics.cc +++ b/components/autofill/core/browser/metrics/autofill_metrics.cc
@@ -377,6 +377,7 @@ case BIRTHDATE_4_DIGIT_YEAR: case IBAN_VALUE: case MAX_VALID_FIELD_TYPE: + case CREDIT_CARD_STANDALONE_VERIFICATION_CODE: NOTREACHED() << field_type << " type is not in that group."; group = GROUP_AMBIGUOUS; break;
diff --git a/components/autofill/core/browser/metrics/shadow_prediction_metrics_unittest.cc b/components/autofill/core/browser/metrics/shadow_prediction_metrics_unittest.cc index 0eb71ccb..f7f15c27 100644 --- a/components/autofill/core/browser/metrics/shadow_prediction_metrics_unittest.cc +++ b/components/autofill/core/browser/metrics/shadow_prediction_metrics_unittest.cc
@@ -96,7 +96,8 @@ // If this test fails after adding a type, update // `AutofillPredictionsComparisonResult` in tools/metrics/histograms/enums.xml // and set `last_known_type` to the last entry in the enum. - constexpr ServerFieldType last_known_type = IBAN_VALUE; + constexpr ServerFieldType last_known_type = + CREDIT_CARD_STANDALONE_VERIFICATION_CODE; int max_comparison = GetShadowPrediction(last_known_type, NAME_FIRST, {NAME_LAST});
diff --git a/components/desks_storage/core/local_desk_data_manager.cc b/components/desks_storage/core/local_desk_data_manager.cc index b527c6d8..b1d372f 100644 --- a/components/desks_storage/core/local_desk_data_manager.cc +++ b/components/desks_storage/core/local_desk_data_manager.cc
@@ -148,13 +148,16 @@ } auto entries = std::make_unique< std::map<base::GUID, std::unique_ptr<ash::DeskTemplate>>>(); + auto cache_status = std::make_unique<LocalDeskDataManager::CacheStatus>(); // Load the cache. task_runner_->PostTaskAndReply( FROM_HERE, base::BindOnce(&LocalDeskDataManager::EnsureCacheIsLoaded, - base::Unretained(this), entries.get()), + base::Unretained(this), user_data_dir_path, + cache_status.get(), entries.get()), base::BindOnce(&LocalDeskDataManager::MoveEntriesIntoCache, - weak_ptr_factory_.GetWeakPtr(), std::move(entries))); + weak_ptr_factory_.GetWeakPtr(), std::move(cache_status), + std::move(entries))); } LocalDeskDataManager::~LocalDeskDataManager() = default; @@ -426,32 +429,34 @@ } void LocalDeskDataManager::EnsureCacheIsLoaded( + const base::FilePath& user_data_dir_path, + CacheStatus* cache_status_ptr, std::map<base::GUID, std::unique_ptr<ash::DeskTemplate>>* entries_ptr) { - // Cache is already loaded. Do nothing. - if (cache_status_ == CacheStatus::kOk) - return; base::DirReaderPosix user_data_dir_reader( - user_data_dir_path_.AsUTF8Unsafe().c_str()); + user_data_dir_path.AsUTF8Unsafe().c_str()); base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, base::BlockingType::MAY_BLOCK); if (!user_data_dir_reader.IsValid()) { // User data directory path is invalid. This local storage cannot load any // templates from disk. - cache_status_ = CacheStatus::kInvalidPath; + *cache_status_ptr = CacheStatus::kInvalidPath; return; } // Set dir_reader to read from the `local_saved_desk_path_` directory. // check to make sure there is a `local_saved_desk_path_` directory. If not // create it. - bool dir_create_success = base::CreateDirectory(local_saved_desk_path_); + bool dir_create_success = base::CreateDirectory( + user_data_dir_path.AppendASCII(kSavedDeskDirectoryName)); base::DirReaderPosix dir_reader( - local_saved_desk_path_.AsUTF8Unsafe().c_str()); + user_data_dir_path.AppendASCII(kSavedDeskDirectoryName) + .AsUTF8Unsafe() + .c_str()); if (!dir_create_success || !dir_reader.IsValid()) { // Failed to find or create the `local_saved_desk_path_` directory path. // This local storage cannot load any entry of `type` from disk. - cache_status_ = CacheStatus::kInvalidPath; + *cache_status_ptr = CacheStatus::kInvalidPath; return; } @@ -467,7 +472,8 @@ } } - cache_status_ = CacheStatus::kOk; + *cache_status_ptr = CacheStatus::kOk; + return; } void LocalDeskDataManager::GetAllEntriesTask( @@ -611,9 +617,11 @@ std::unique_ptr<std::map<base::GUID, std::unique_ptr<ash::DeskTemplate>>> entries_ptr, DeskModel::DeleteEntryCallback callback) { + auto cache_status = std::make_unique<LocalDeskDataManager::CacheStatus>(); + *cache_status = CacheStatus::kOk; // Rollback deletes from the cache for the failed file deletes. if (*status_ptr == DeskModel::DeleteEntryStatus::kFailure) { - MoveEntriesIntoCache(std::move(entries_ptr)); + MoveEntriesIntoCache(std::move(cache_status), std::move(entries_ptr)); } std::move(callback).Run(*status_ptr); } @@ -636,8 +644,10 @@ } void LocalDeskDataManager::MoveEntriesIntoCache( + std::unique_ptr<CacheStatus> cache_status_ptr, std::unique_ptr<std::map<base::GUID, std::unique_ptr<ash::DeskTemplate>>> entries_ptr) { + cache_status_ = *cache_status_ptr; for (auto& [uuid, template_entry] : *entries_ptr) { if (template_entry) { saved_desks_list_[template_entry->type()][uuid] =
diff --git a/components/desks_storage/core/local_desk_data_manager.h b/components/desks_storage/core/local_desk_data_manager.h index d9ab73f..07c5d31f 100644 --- a/components/desks_storage/core/local_desk_data_manager.h +++ b/components/desks_storage/core/local_desk_data_manager.h
@@ -13,7 +13,9 @@ #include "base/guid.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" +#include "base/task/cancelable_task_tracker.h" #include "base/task/sequenced_task_runner_helpers.h" +#include "base/task/task_runner_util.h" #include "components/account_id/account_id.h" #include "components/desks_storage/core/desk_model.h" @@ -82,10 +84,12 @@ private: friend class ash::OverviewTestBase; - // Loads templates from `local_saved_desk_path_` into the + // Loads templates from `user_data_dir_path` into the // `saved_desks_list_`, based on the template's desk type, if the cache is not // loaded yet. void EnsureCacheIsLoaded( + const base::FilePath& user_data_dir_path, + CacheStatus* cache_status_ptr, std::map<base::GUID, std::unique_ptr<ash::DeskTemplate>>* entries_ptr); // Gets all entries from user's `local_saved_desk_path_`. @@ -144,6 +148,7 @@ // Wrapper method to load the read files into the `saved_desks_list_` cache. void MoveEntriesIntoCache( + std::unique_ptr<CacheStatus> cache_status_ptr, std::unique_ptr<std::map<base::GUID, std::unique_ptr<ash::DeskTemplate>>> entries_ptr);
diff --git a/components/domain_reliability/config.cc b/components/domain_reliability/config.cc index 482df02..69aa399 100644 --- a/components/domain_reliability/config.cc +++ b/components/domain_reliability/config.cc
@@ -19,10 +19,15 @@ return url->is_valid(); } -bool ConvertOrigin(const base::Value* value, GURL* url) { - return ConvertURL(value, url) && !url->has_username() && - !url->has_password() && url->SchemeIs(url::kHttpsScheme) && - url->path_piece() == "/" && !url->has_query() && !url->has_ref(); +bool ConvertOrigin(const base::Value* value, url::Origin* origin) { + GURL url; + if (ConvertURL(value, &url) && !url.has_username() && !url.has_password() && + url.SchemeIs(url::kHttpsScheme) && url.path_piece() == "/" && + !url.has_query() && !url.has_ref()) { + *origin = url::Origin::Create(url); + return true; + } + return false; } bool IsValidSampleRate(double p) { @@ -58,7 +63,7 @@ } bool DomainReliabilityConfig::IsValid() const { - if (!origin.is_valid() || collectors.empty() || + if (origin.opaque() || collectors.empty() || !IsValidSampleRate(success_sample_rate) || !IsValidSampleRate(failure_sample_rate)) { return false; @@ -79,7 +84,7 @@ // static void DomainReliabilityConfig::RegisterJSONConverter( base::JSONValueConverter<DomainReliabilityConfig>* converter) { - converter->RegisterCustomValueField<GURL>( + converter->RegisterCustomValueField<url::Origin>( "origin", &DomainReliabilityConfig::origin, &ConvertOrigin); converter->RegisterBoolField("include_subdomains", &DomainReliabilityConfig::include_subdomains);
diff --git a/components/domain_reliability/config.h b/components/domain_reliability/config.h index b9629927..7fae200 100644 --- a/components/domain_reliability/config.h +++ b/components/domain_reliability/config.h
@@ -13,6 +13,7 @@ #include "base/strings/string_piece.h" #include "components/domain_reliability/domain_reliability_export.h" #include "url/gurl.h" +#include "url/origin.h" namespace domain_reliability { @@ -40,9 +41,7 @@ static void RegisterJSONConverter( base::JSONValueConverter<DomainReliabilityConfig>* converter); - // TODO(chlily): Convert this to a url::Origin or just a domain name, since we - // don't use the other components. - GURL origin; + url::Origin origin; bool include_subdomains; // Each entry in |collectors| must have scheme https. std::vector<std::unique_ptr<GURL>> collectors;
diff --git a/components/domain_reliability/config_unittest.cc b/components/domain_reliability/config_unittest.cc index f434bb9..f39d4afb7 100644 --- a/components/domain_reliability/config_unittest.cc +++ b/components/domain_reliability/config_unittest.cc
@@ -15,7 +15,7 @@ std::unique_ptr<DomainReliabilityConfig> MakeBaseConfig() { DomainReliabilityConfig* config = new DomainReliabilityConfig(); - config->origin = GURL("https://example/"); + config->origin = url::Origin::Create(GURL("https://example/")); config->include_subdomains = false; config->collectors.push_back( std::make_unique<GURL>("https://example/upload")); @@ -42,7 +42,7 @@ EXPECT_TRUE(config->IsValid()); config = MakeSampleConfig(); - config->origin = GURL(); + config->origin = url::Origin(); EXPECT_FALSE(config->IsValid()); config = MakeSampleConfig(); @@ -79,7 +79,7 @@ DomainReliabilityConfig::FromJSON(config_json)); EXPECT_TRUE(config); - EXPECT_EQ("https://example/", config->origin.spec()); + EXPECT_EQ("https://example", config->origin.Serialize()); EXPECT_FALSE(config->include_subdomains); EXPECT_EQ(1u, config->collectors.size()); EXPECT_EQ(GURL("https://example/upload"), *config->collectors[0]);
diff --git a/components/domain_reliability/context.h b/components/domain_reliability/context.h index 6799743..df3fcb7d0 100644 --- a/components/domain_reliability/context.h +++ b/components/domain_reliability/context.h
@@ -43,7 +43,7 @@ static const int kMaxUploadDepthToSchedule; using UploadAllowedCallback = - base::RepeatingCallback<void(const GURL&, + base::RepeatingCallback<void(const url::Origin&, base::OnceCallback<void(bool)>)>; DomainReliabilityContext(
diff --git a/components/domain_reliability/context_manager.cc b/components/domain_reliability/context_manager.cc index 60500728..50576b47 100644 --- a/components/domain_reliability/context_manager.cc +++ b/components/domain_reliability/context_manager.cc
@@ -67,8 +67,7 @@ const base::RepeatingCallback<bool(const url::Origin&)>& origin_filter) { for (auto& context_entry : contexts_) { if (origin_filter.is_null() || - origin_filter.Run( - url::Origin::Create(context_entry.second->config().origin))) { + origin_filter.Run(context_entry.second->config().origin)) { context_entry.second->ClearBeacons(); } } @@ -93,7 +92,7 @@ } for (auto it = contexts_.begin(); it != contexts_.end();) { - if (origin_filter.Run(url::Origin::Create(it->second->config().origin))) { + if (origin_filter.Run(it->second->config().origin)) { it = contexts_.erase(it); continue; }
diff --git a/components/domain_reliability/context_unittest.cc b/components/domain_reliability/context_unittest.cc index c9cd3a2..489f658 100644 --- a/components/domain_reliability/context_unittest.cc +++ b/components/domain_reliability/context_unittest.cc
@@ -194,7 +194,7 @@ return beacons.empty(); } - const GURL& upload_allowed_origin() { return upload_allowed_origin_; } + const url::Origin& upload_allowed_origin() { return upload_allowed_origin_; } void CallUploadAllowedResultCallback(bool allowed) { DCHECK(!upload_allowed_result_callback_.is_null()); @@ -227,7 +227,7 @@ ++num_uploads_; } - void UploadAllowedCallback(const GURL& origin, + void UploadAllowedCallback(const url::Origin& origin, base::OnceCallback<void(bool)> callback) { upload_allowed_origin_ = origin; upload_allowed_result_callback_ = std::move(callback); @@ -243,7 +243,7 @@ net::NetworkIsolationKey upload_network_isolation_key_; DomainReliabilityUploader::UploadCallback upload_callback_; - GURL upload_allowed_origin_; + url::Origin upload_allowed_origin_; base::OnceCallback<void(bool)> upload_allowed_result_callback_; };
diff --git a/components/domain_reliability/google_configs.cc b/components/domain_reliability/google_configs.cc index bd78aa7..5076a4e 100644 --- a/components/domain_reliability/google_configs.cc +++ b/components/domain_reliability/google_configs.cc
@@ -533,14 +533,15 @@ bool include_subdomains = params.include_subdomains && !is_www; auto config = std::make_unique<DomainReliabilityConfig>(); - config->origin = GURL("https://" + hostname + "/"); + GURL url("https://" + hostname + "/"); + config->origin = url::Origin::Create(url); config->include_subdomains = include_subdomains; config->collectors.clear(); if (params.include_origin_specific_collector) { GURL::Replacements replacements; replacements.SetPathStr(kGoogleOriginSpecificCollectorPathString); config->collectors.push_back( - std::make_unique<GURL>(config->origin.ReplaceComponents(replacements))); + std::make_unique<GURL>(url.ReplaceComponents(replacements))); } for (const char* collector : kGoogleStandardCollectors) { config->collectors.push_back(std::make_unique<GURL>(collector));
diff --git a/components/domain_reliability/monitor_unittest.cc b/components/domain_reliability/monitor_unittest.cc index 7f3af66..b46f0801 100644 --- a/components/domain_reliability/monitor_unittest.cc +++ b/components/domain_reliability/monitor_unittest.cc
@@ -115,7 +115,7 @@ } const DomainReliabilityContext* CreateAndAddContextForOrigin( - const GURL& origin, + const url::Origin& origin, bool wildcard) { std::unique_ptr<DomainReliabilityConfig> config( MakeTestConfigWithOrigin(origin)); @@ -428,20 +428,22 @@ TEST_F(DomainReliabilityMonitorTest, ClearBeaconsWithFilter) { base::HistogramTester histograms; // Create two contexts, each with one beacon. - GURL origin1("http://example.com/"); - GURL origin2("http://example.org/"); + GURL url1("http://example.com/"); + GURL url2("http://example.org/"); + auto origin1 = url::Origin::Create(url1); + auto origin2 = url::Origin::Create(url2); const DomainReliabilityContext* context1 = CreateAndAddContextForOrigin(origin1, false); RequestInfo request = MakeRequestInfo(); - request.url = origin1; + request.url = url1; request.net_error = net::ERR_CONNECTION_RESET; OnRequestLegComplete(request); const DomainReliabilityContext* context2 = CreateAndAddContextForOrigin(origin2, false); request = MakeRequestInfo(); - request.url = origin2; + request.url = url2; request.net_error = net::ERR_CONNECTION_RESET; OnRequestLegComplete(request); @@ -451,7 +453,7 @@ const url::Origin& origin2) { return origin1 == origin2; }, - url::Origin::Create(origin1))); + origin1)); // Beacons for |context1| were cleared. Beacons for |context2| and // the contexts themselves were not. @@ -490,8 +492,8 @@ } TEST_F(DomainReliabilityMonitorTest, ClearContextsWithFilter) { - GURL origin1("http://example.com/"); - GURL origin2("http://example.org/"); + auto origin1 = url::Origin::Create(GURL("http://example.com/")); + auto origin2 = url::Origin::Create(GURL("http://example.org/")); CreateAndAddContextForOrigin(origin1, false); CreateAndAddContextForOrigin(origin2, false); @@ -505,15 +507,15 @@ [](const url::Origin& origin1, const url::Origin& origin2) { return origin1 == origin2; }, - url::Origin::Create(origin1))); + origin1)); // Only one of the contexts should have been deleted. EXPECT_EQ(1u, monitor_.contexts_size_for_testing()); } TEST_F(DomainReliabilityMonitorTest, WildcardMatchesSelf) { - const DomainReliabilityContext* context = - CreateAndAddContextForOrigin(GURL("https://wildcard/"), true); + const DomainReliabilityContext* context = CreateAndAddContextForOrigin( + url::Origin::Create(GURL("https://wildcard/")), true); RequestInfo request = MakeRequestInfo(); request.url = GURL("http://wildcard/"); @@ -524,8 +526,8 @@ } TEST_F(DomainReliabilityMonitorTest, WildcardMatchesSubdomain) { - const DomainReliabilityContext* context = - CreateAndAddContextForOrigin(GURL("https://wildcard/"), true); + const DomainReliabilityContext* context = CreateAndAddContextForOrigin( + url::Origin::Create(GURL("https://wildcard/")), true); RequestInfo request = MakeRequestInfo(); request.url = GURL("http://test.wildcard/"); @@ -536,8 +538,8 @@ } TEST_F(DomainReliabilityMonitorTest, WildcardDoesntMatchSubsubdomain) { - const DomainReliabilityContext* context = - CreateAndAddContextForOrigin(GURL("https://wildcard/"), true); + const DomainReliabilityContext* context = CreateAndAddContextForOrigin( + url::Origin::Create(GURL("https://wildcard/")), true); RequestInfo request = MakeRequestInfo(); request.url = GURL("http://test.test.wildcard/"); @@ -548,10 +550,10 @@ } TEST_F(DomainReliabilityMonitorTest, WildcardPrefersSelfToParentWildcard) { - const DomainReliabilityContext* context1 = - CreateAndAddContextForOrigin(GURL("https://test.wildcard/"), false); - const DomainReliabilityContext* context2 = - CreateAndAddContextForOrigin(GURL("https://wildcard/"), true); + const DomainReliabilityContext* context1 = CreateAndAddContextForOrigin( + url::Origin::Create(GURL("https://test.wildcard/")), false); + const DomainReliabilityContext* context2 = CreateAndAddContextForOrigin( + url::Origin::Create(GURL("https://wildcard/")), true); RequestInfo request = MakeRequestInfo(); request.url = GURL("http://test.wildcard/"); @@ -564,10 +566,10 @@ TEST_F(DomainReliabilityMonitorTest, WildcardPrefersSelfWildcardToParentWildcard) { - const DomainReliabilityContext* context1 = - CreateAndAddContextForOrigin(GURL("https://test.wildcard/"), true); - const DomainReliabilityContext* context2 = - CreateAndAddContextForOrigin(GURL("https://wildcard/"), true); + const DomainReliabilityContext* context1 = CreateAndAddContextForOrigin( + url::Origin::Create(GURL("https://test.wildcard/")), true); + const DomainReliabilityContext* context2 = CreateAndAddContextForOrigin( + url::Origin::Create(GURL("https://wildcard/")), true); RequestInfo request = MakeRequestInfo(); request.url = GURL("http://test.wildcard/"); @@ -593,7 +595,7 @@ ASSERT_TRUE(test_server.Start()); std::unique_ptr<DomainReliabilityConfig> config( - MakeTestConfigWithOrigin(test_server.base_url())); + MakeTestConfigWithOrigin(test_server.GetOrigin())); const DomainReliabilityContext* context = monitor_.AddContextForTesting(std::move(config));
diff --git a/components/domain_reliability/test_util.cc b/components/domain_reliability/test_util.cc index 0d738c9..1fbb0d9 100644 --- a/components/domain_reliability/test_util.cc +++ b/components/domain_reliability/test_util.cc
@@ -182,11 +182,12 @@ } std::unique_ptr<DomainReliabilityConfig> MakeTestConfig() { - return MakeTestConfigWithOrigin(GURL("https://example/")); + return MakeTestConfigWithOrigin( + url::Origin::Create(GURL("https://example/"))); } std::unique_ptr<DomainReliabilityConfig> MakeTestConfigWithOrigin( - const GURL& origin) { + const url::Origin& origin) { DomainReliabilityConfig* config = new DomainReliabilityConfig(); config->origin = origin; config->collectors.push_back(
diff --git a/components/domain_reliability/test_util.h b/components/domain_reliability/test_util.h index 770382d0..0ad6865 100644 --- a/components/domain_reliability/test_util.h +++ b/components/domain_reliability/test_util.h
@@ -147,7 +147,7 @@ std::unique_ptr<DomainReliabilityConfig> MakeTestConfig(); std::unique_ptr<DomainReliabilityConfig> MakeTestConfigWithOrigin( - const GURL& origin); + const url::Origin& origin); DomainReliabilityScheduler::Params MakeTestSchedulerParams(); } // namespace domain_reliability
diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc index 5afb07f2..86bdbf7e 100644 --- a/components/history/core/browser/history_backend.cc +++ b/components/history/core/browser/history_backend.cc
@@ -1775,7 +1775,7 @@ if (!db_) return base::Time::Min(); const auto clusters = - GetMostRecentClusters(base::Time::Min(), base::Time::Max(), 1, false); + GetMostRecentClusters(base::Time::Min(), base::Time::Max(), 1); return clusters.empty() ? base::Time::Min() : clusters[0] .GetMostRecentVisit() @@ -1796,30 +1796,26 @@ std::vector<Cluster> HistoryBackend::GetMostRecentClusters( base::Time inclusive_min_time, base::Time exclusive_max_time, - int max_clusters, - bool include_keywords) { + int max_clusters) { TRACE_EVENT0("browser", "HistoryBackend::GetMostRecentClusters"); if (!db_) return {}; const auto cluster_ids = db_->GetMostRecentClusterIds( inclusive_min_time, exclusive_max_time, max_clusters); std::vector<Cluster> clusters; - base::ranges::transform(cluster_ids, std::back_inserter(clusters), - [&](const auto& cluster_id) { - return GetCluster(cluster_id, include_keywords); - }); + base::ranges::transform( + cluster_ids, std::back_inserter(clusters), + [&](const auto& cluster_id) { return GetCluster(cluster_id); }); return clusters; } -Cluster HistoryBackend::GetCluster(int64_t cluster_id, bool include_keywords) { +Cluster HistoryBackend::GetCluster(int64_t cluster_id) { TRACE_EVENT0("browser", "HistoryBackend::GetCluster"); if (!db_) return {}; Cluster cluster = db_->GetCluster(cluster_id); cluster.visits = ToClusterVisits(db_->GetVisitIdsInCluster(cluster_id)); - if (include_keywords) - cluster.keyword_to_data_map = db_->GetClusterKeywords(cluster_id); return cluster; }
diff --git a/components/history/core/browser/history_backend.h b/components/history/core/browser/history_backend.h index c0c9920ea..68e61b6 100644 --- a/components/history/core/browser/history_backend.h +++ b/components/history/core/browser/history_backend.h
@@ -484,12 +484,10 @@ std::vector<Cluster> GetMostRecentClusters(base::Time inclusive_min_time, base::Time exclusive_max_time, - int max_clusters, - bool include_keywords = true); + int max_clusters); - // Get a `Cluster`. `keyword_to_data_map` isn't always useful, and it requires - // an extra SQL execution. It's only populated If `include_keywords` is true. - Cluster GetCluster(int64_t cluster_id, bool include_keywords = true); + // Get a `Cluster`. + Cluster GetCluster(int64_t cluster_id); // Finds the 1st visit in the redirect chain containing `visit`. // Unlike `GetRedirectsToSpecificVisit()`, this only considers actual
diff --git a/components/history/core/browser/history_backend_unittest.cc b/components/history/core/browser/history_backend_unittest.cc index ba81500f..7923bc0b 100644 --- a/components/history/core/browser/history_backend_unittest.cc +++ b/components/history/core/browser/history_backend_unittest.cc
@@ -3870,50 +3870,17 @@ // returned. ClusterVisit visit_3; visit_3.annotated_visit.visit_row.visit_id = 3; - - ClusterKeywordData keyword_data_1 = { - ClusterKeywordData::ClusterKeywordType::kEntityAlias, - .4, - {"entity1", "entity2"}}; - ClusterKeywordData keyword_data_2 = { - ClusterKeywordData::ClusterKeywordType::kEntityCategory, .6, {}}; - backend_->db_->AddClusters( - {{0, - {visit_1, visit_2, visit_3}, - {{u"keyword1", keyword_data_1}, {u"keyword2", keyword_data_2}}, - false, - u"label"}}); + {{0, {visit_1, visit_2, visit_3}, {}, false, u"label"}}); - auto cluster = backend_->GetCluster(1, true); + const auto cluster = backend_->GetCluster(1); VerifyCluster(cluster, {1, {2, 1}}); EXPECT_EQ(cluster.cluster_id, 1); EXPECT_EQ(cluster.label, u"label"); EXPECT_EQ(cluster.visits[1].url_for_display, u"url_for_display"); - EXPECT_EQ(cluster.keyword_to_data_map.size(), 2u); - EXPECT_EQ(cluster.keyword_to_data_map[u"keyword1"].type, - ClusterKeywordData::ClusterKeywordType::kEntityAlias); - EXPECT_EQ(cluster.keyword_to_data_map[u"keyword1"].score, .4f); - // Only the 1st keyword entity should be preserved. - EXPECT_THAT(cluster.keyword_to_data_map[u"keyword1"].entity_collections, - UnorderedElementsAre("entity1")); - EXPECT_EQ(cluster.keyword_to_data_map[u"keyword2"].type, - ClusterKeywordData::ClusterKeywordType::kEntityCategory); - EXPECT_EQ(cluster.keyword_to_data_map[u"keyword2"].score, .6f); - EXPECT_TRUE( - cluster.keyword_to_data_map[u"keyword2"].entity_collections.empty()); - - // Verify keywords are not returned, but other info is, when the - // `include_keywords` param is false. - cluster = backend_->GetCluster(1, false); - VerifyCluster(cluster, {1, {2, 1}}); - EXPECT_EQ(cluster.cluster_id, 1); - EXPECT_EQ(cluster.label, u"label"); - EXPECT_EQ(cluster.visits[1].url_for_display, u"url_for_display"); - EXPECT_TRUE(cluster.keyword_to_data_map.empty()); // Verify non-existent clusters aren't returned. - VerifyCluster(backend_->GetCluster(2, true), {0}); + VerifyCluster(backend_->GetCluster(2), {0}); } TEST_F(HistoryBackendTest, GetRedirectChainStart) {
diff --git a/components/history/core/browser/history_service.cc b/components/history/core/browser/history_service.cc index 930e844..9680c91 100644 --- a/components/history/core/browser/history_service.cc +++ b/components/history/core/browser/history_service.cc
@@ -317,8 +317,7 @@ return tracker->PostTaskAndReplyWithResult( backend_task_runner_.get(), FROM_HERE, base::BindOnce(&HistoryBackend::GetMostRecentClusters, history_backend_, - inclusive_min_time, exclusive_max_time, max_clusters, - /*include_keywords=*/true), + inclusive_min_time, exclusive_max_time, max_clusters), std::move(callback)); }
diff --git a/components/history/core/browser/history_types.h b/components/history/core/browser/history_types.h index b1fd3c9..658e50d 100644 --- a/components/history/core/browser/history_types.h +++ b/components/history/core/browser/history_types.h
@@ -991,6 +991,7 @@ std::vector<ClusterVisit> visits; // A map of keywords to additional data. + // TODO(manukh): Persist to db. base::flat_map<std::u16string, ClusterKeywordData> keyword_to_data_map; // Whether the cluster should be shown prominently on UI surfaces.
diff --git a/components/history/core/browser/visit_annotations_database.cc b/components/history/core/browser/visit_annotations_database.cc index e267eb5c..ff77a11 100644 --- a/components/history/core/browser/visit_annotations_database.cc +++ b/components/history/core/browser/visit_annotations_database.cc
@@ -200,17 +200,6 @@ if (!CreateClustersAndVisitsTableAndIndex()) return false; - // Represents the one-to-many relationship of `Cluster`s and - // `ClusterKeywordData`s. - if (!GetDB().Execute("CREATE TABLE IF NOT EXISTS cluster_keywords(" - "cluster_id INTEGER NOT NULL," - "keyword VARCHAR NOT NULL," - "type INTEGER NOT NULL," - "score NUMERIC NOT NULL," - "collections VARCHAR NOT NULL)")) { - return false; - } - return true; } @@ -428,11 +417,6 @@ "(cluster_id,visit_id,score,engagement_score,url_for_deduping," "normalized_url,url_for_display)" "VALUES(?,?,?,?,?,?,?)")); - sql::Statement cluster_keywords_statement( - GetDB().GetCachedStatement(SQL_FROM_HERE, - "INSERT INTO cluster_keywords" - "(cluster_id,keyword,type,score,collections)" - "VALUES(?,?,?,?,?)")); for (const auto& cluster : clusters) { if (cluster.visits.empty()) @@ -472,23 +456,6 @@ << "cluster_id = " << cluster_id << ", visit_id = " << visit_id; } }); - - // Insert each keyword into 'cluster_keywords'. - for (const auto& [keyword, keyword_data] : cluster.keyword_to_data_map) { - cluster_keywords_statement.Reset(true); - cluster_keywords_statement.BindInt64(0, cluster_id); - cluster_keywords_statement.BindString16(1, keyword); - cluster_keywords_statement.BindInt(2, keyword_data.type); - cluster_keywords_statement.BindDouble(3, keyword_data.score); - cluster_keywords_statement.BindString( - 4, keyword_data.entity_collections.empty() - ? "" - : keyword_data.entity_collections[0]); - if (!cluster_keywords_statement.Run()) { - DVLOG(0) << "Failed to execute 'cluster_keywords' insert statement: " - << "cluster_id = " << cluster_id << ", keyword = " << keyword; - } - } } } @@ -605,27 +572,6 @@ return 0; } -base::flat_map<std::u16string, ClusterKeywordData> -VisitAnnotationsDatabase::GetClusterKeywords(int64_t cluster_id) { - DCHECK_GT(cluster_id, 0); - sql::Statement statement( - GetDB().GetCachedStatement(SQL_FROM_HERE, - "SELECT keyword,type,score,collections " - "FROM cluster_keywords " - "WHERE cluster_id=?")); - statement.BindInt64(0, cluster_id); - - base::flat_map<std::u16string, ClusterKeywordData> keyword_data; - while (statement.Step()) { - keyword_data[statement.ColumnString16(0)] = { - static_cast<ClusterKeywordData::ClusterKeywordType>( - statement.ColumnInt(1)), - static_cast<float>(statement.ColumnDouble(2)), - DeserializeFromStringColumn(statement.ColumnString(3))}; - } - return keyword_data; -} - void VisitAnnotationsDatabase::DeleteClusters( const std::vector<int64_t>& cluster_ids) { if (cluster_ids.empty()) @@ -637,9 +583,6 @@ sql::Statement clusters_and_visits_statement(GetDB().GetCachedStatement( SQL_FROM_HERE, "DELETE FROM clusters_and_visits WHERE cluster_id=?")); - sql::Statement cluster_keywords_statement(GetDB().GetCachedStatement( - SQL_FROM_HERE, "DELETE FROM cluster_keywords WHERE cluster_id=?")); - for (auto cluster_id : cluster_ids) { clusters_statement.Reset(true); clusters_statement.BindInt64(0, cluster_id); @@ -654,13 +597,6 @@ DVLOG(0) << "Failed to execute clusters_and_visits delete statement: " << "cluster_id = " << cluster_id; } - - cluster_keywords_statement.Reset(true); - cluster_keywords_statement.BindInt64(0, cluster_id); - if (!cluster_keywords_statement.Run()) { - DVLOG(0) << "Failed to execute cluster_keywords delete statement: " - << "cluster_id = " << cluster_id; - } } }
diff --git a/components/history/core/browser/visit_annotations_database.h b/components/history/core/browser/visit_annotations_database.h index 471755c6..8a1a6464 100644 --- a/components/history/core/browser/visit_annotations_database.h +++ b/components/history/core/browser/visit_annotations_database.h
@@ -76,8 +76,7 @@ // entries for any `Cluster` that it failed to add. void AddClusters(const std::vector<Cluster>& clusters); - // Get a `Cluster`. Does not include the cluster's `visits` or - // `keyword_to_data_map`. + // Get a `Cluster`. Cluster GetCluster(int64_t cluster_id); // Get the most recent clusters within the constraints. The most recent visit @@ -96,10 +95,6 @@ // is not in a cluster.` int64_t GetClusterIdContainingVisit(VisitID visit_id); - // Return the keyword data associated with `cluster_id`. - base::flat_map<std::u16string, ClusterKeywordData> GetClusterKeywords( - int64_t cluster_id); - // Delete `Cluster`s from the table. void DeleteClusters(const std::vector<int64_t>& cluster_ids);
diff --git a/components/history/core/browser/visit_annotations_database_unittest.cc b/components/history/core/browser/visit_annotations_database_unittest.cc index 0c50330..a629ea7 100644 --- a/components/history/core/browser/visit_annotations_database_unittest.cc +++ b/components/history/core/browser/visit_annotations_database_unittest.cc
@@ -216,8 +216,7 @@ EXPECT_EQ(final.alternative_title, "New alternative title"); } -TEST_F(VisitAnnotationsDatabaseTest, - AddClusters_GetCluster_GetClusterVisit_GetClusterKeywords) { +TEST_F(VisitAnnotationsDatabaseTest, AddClusters_GetCluster_GetClusterVisit) { // Test `AddClusters()`. // Cluster without visits shouldn't be added. @@ -354,10 +353,7 @@ AddContextAnnotationsForVisit(1, {}); AddContentAnnotationsForVisit(2, {}); AddContextAnnotationsForVisit(2, {}); - auto cluster = CreateCluster({1, 2}); - cluster.keyword_to_data_map[u"keyword1"]; - cluster.keyword_to_data_map[u"keyword2"]; - AddClusters({cluster}); + AddCluster({1, 2}); VisitContentAnnotations got_content_annotations; VisitContextAnnotations got_context_annotations; @@ -366,11 +362,10 @@ EXPECT_TRUE(GetContextAnnotationsForVisit(1, &got_context_annotations)); EXPECT_TRUE(GetContentAnnotationsForVisit(2, &got_content_annotations)); EXPECT_TRUE(GetContextAnnotationsForVisit(2, &got_context_annotations)); - EXPECT_EQ(GetCluster(1).cluster_id, 1); EXPECT_THAT(GetVisitIdsInCluster(1), UnorderedElementsAre(1, 2)); EXPECT_EQ(GetClusterIdContainingVisit(1), 1); EXPECT_EQ(GetClusterIdContainingVisit(2), 1); - EXPECT_EQ(GetClusterKeywords(1).size(), 2u); + EXPECT_EQ(GetCluster(1).cluster_id, 1); // Delete 1 visit. Make sure the tables are updated, but the cluster remains. DeleteAnnotationsForVisit(1); @@ -378,11 +373,10 @@ EXPECT_FALSE(GetContextAnnotationsForVisit(1, &got_context_annotations)); EXPECT_TRUE(GetContentAnnotationsForVisit(2, &got_content_annotations)); EXPECT_TRUE(GetContextAnnotationsForVisit(2, &got_context_annotations)); - EXPECT_EQ(GetCluster(1).cluster_id, 1); EXPECT_THAT(GetVisitIdsInCluster(1), UnorderedElementsAre(2)); EXPECT_EQ(GetClusterIdContainingVisit(1), 0); EXPECT_EQ(GetClusterIdContainingVisit(2), 1); - EXPECT_EQ(GetClusterKeywords(1).size(), 2u); + EXPECT_EQ(GetCluster(1).cluster_id, 1); // Delete the 2nd visit. Make sure the cluster is removed. DeleteAnnotationsForVisit(2); @@ -390,56 +384,31 @@ EXPECT_FALSE(GetContextAnnotationsForVisit(1, &got_context_annotations)); EXPECT_FALSE(GetContentAnnotationsForVisit(2, &got_content_annotations)); EXPECT_FALSE(GetContextAnnotationsForVisit(2, &got_context_annotations)); - EXPECT_EQ(GetCluster(1).cluster_id, 0); EXPECT_TRUE(GetVisitIdsInCluster(1).empty()); EXPECT_EQ(GetClusterIdContainingVisit(1), 0); EXPECT_EQ(GetClusterIdContainingVisit(2), 0); - EXPECT_EQ(GetClusterKeywords(1).size(), 0u); + EXPECT_EQ(GetCluster(1).cluster_id, 0); } TEST_F(VisitAnnotationsDatabaseTest, AddClusters_DeleteClusters) { AddClusters(CreateClusters({{3, 2, 5}, {3, 2, 5}, {6}})); - auto cluster_with_keyword_data = CreateCluster({10}); - cluster_with_keyword_data.keyword_to_data_map[u"keyword1"]; - cluster_with_keyword_data.keyword_to_data_map[u"keyword2"]; - AddClusters({cluster_with_keyword_data}); - - EXPECT_EQ(GetCluster(1).cluster_id, 1); - EXPECT_EQ(GetCluster(2).cluster_id, 2); - EXPECT_EQ(GetCluster(3).cluster_id, 3); - EXPECT_EQ(GetCluster(4).cluster_id, 4); EXPECT_THAT(GetVisitIdsInCluster(1), ElementsAre(5, 3, 2)); EXPECT_THAT(GetVisitIdsInCluster(2), ElementsAre(5, 3, 2)); EXPECT_THAT(GetVisitIdsInCluster(3), ElementsAre(6)); - EXPECT_THAT(GetVisitIdsInCluster(4), ElementsAre(10)); - EXPECT_EQ(GetClusterKeywords(4).size(), 2u); DeleteClusters({}); - EXPECT_EQ(GetCluster(1).cluster_id, 1); - EXPECT_EQ(GetCluster(2).cluster_id, 2); - EXPECT_EQ(GetCluster(3).cluster_id, 3); - EXPECT_EQ(GetCluster(4).cluster_id, 4); EXPECT_THAT(GetVisitIdsInCluster(1), ElementsAre(5, 3, 2)); EXPECT_THAT(GetVisitIdsInCluster(2), ElementsAre(5, 3, 2)); EXPECT_THAT(GetVisitIdsInCluster(3), ElementsAre(6)); - EXPECT_THAT(GetVisitIdsInCluster(4), ElementsAre(10)); - EXPECT_EQ(GetClusterKeywords(4).size(), 2u); - DeleteClusters({1, 3, 4, 5}); + DeleteClusters({1, 3, 4}); - EXPECT_EQ(GetCluster(1).cluster_id, 0); - EXPECT_EQ(GetCluster(2).cluster_id, 2); - EXPECT_EQ(GetCluster(3).cluster_id, 0); - EXPECT_EQ(GetCluster(4).cluster_id, 0); - EXPECT_EQ(GetCluster(5).cluster_id, 0); EXPECT_THAT(GetVisitIdsInCluster(1), ElementsAre()); EXPECT_THAT(GetVisitIdsInCluster(2), ElementsAre(5, 3, 2)); EXPECT_THAT(GetVisitIdsInCluster(3), ElementsAre()); EXPECT_THAT(GetVisitIdsInCluster(4), ElementsAre()); - EXPECT_THAT(GetVisitIdsInCluster(5), ElementsAre()); - EXPECT_TRUE(GetClusterKeywords(4).empty()); } } // namespace history
diff --git a/components/ntp_snippets/category_rankers/click_based_category_ranker.cc b/components/ntp_snippets/category_rankers/click_based_category_ranker.cc index dbd6236..4db7c34 100644 --- a/components/ntp_snippets/category_rankers/click_based_category_ranker.cc +++ b/components/ntp_snippets/category_rankers/click_based_category_ranker.cc
@@ -330,13 +330,13 @@ namespace { -base::Time ParseLastDismissedDate(const base::DictionaryValue& value) { +base::Time ParseLastDismissedDate(const base::Value::Dict& value) { // We don't expect the last-dismissed value to be present in all cases (we // added this after the fact). - std::string serialized_value; + const std::string* serialized_value = value.FindString(kLastDismissedKey); int64_t parsed_value; - if (value.GetString(kLastDismissedKey, &serialized_value) && - base::StringToInt64(serialized_value, &parsed_value)) { + if (serialized_value && + base::StringToInt64(*serialized_value, &parsed_value)) { return DeserializeTime(parsed_value); } return base::Time(); @@ -354,19 +354,19 @@ } for (const base::Value& value : list) { - const base::DictionaryValue* dictionary; - if (!value.GetAsDictionary(&dictionary)) { + const base::Value::Dict* dictionary = value.GetIfDict(); + if (!dictionary) { LOG(DFATAL) << "Failed to parse category data from prefs param " << prefs::kClickBasedCategoryRankerOrderWithClicks << " into dictionary."; return false; } - absl::optional<int> category_id = dictionary->FindIntKey(kCategoryIdKey); + absl::optional<int> category_id = dictionary->FindInt(kCategoryIdKey); if (!category_id) { LOG(DFATAL) << "Dictionary does not have '" << kCategoryIdKey << "' key."; return false; } - absl::optional<int> clicks = dictionary->FindIntKey(kClicksKey); + absl::optional<int> clicks = dictionary->FindInt(kClicksKey); if (!clicks) { LOG(DFATAL) << "Dictionary does not have '" << kClicksKey << "' key."; return false;
diff --git a/components/ntp_snippets/remote/json_to_categories.cc b/components/ntp_snippets/remote/json_to_categories.cc index 65a57cd..461e5265 100644 --- a/components/ntp_snippets/remote/json_to_categories.cc +++ b/components/ntp_snippets/remote/json_to_categories.cc
@@ -16,14 +16,12 @@ // Creates suggestions from dictionary values in |list| and adds them to // |suggestions|. Returns true on success, false if anything went wrong. bool AddSuggestionsFromListValue(int remote_category_id, - const base::Value& list, + const base::Value::List& list, RemoteSuggestion::PtrVector* suggestions, const base::Time& fetch_time) { - DCHECK(list.is_list()); - - for (const base::Value& value : list.GetListDeprecated()) { - const base::DictionaryValue* dict = nullptr; - if (!value.GetAsDictionary(&dict)) { + for (const base::Value& value : list) { + const base::Value::Dict* dict = value.GetIfDict(); + if (!dict) { return false; } @@ -83,29 +81,30 @@ bool JsonToCategories(const base::Value& parsed, FetchedCategoriesVector* categories, const base::Time& fetch_time) { - const base::DictionaryValue* top_dict = nullptr; - if (!parsed.GetAsDictionary(&top_dict)) { + const base::Value::Dict* top_dict = parsed.GetIfDict(); + if (!top_dict) { return false; } - const base::ListValue* categories_value = nullptr; - if (!top_dict->GetList("categories", &categories_value)) { + const base::Value::List* categories_value = top_dict->FindList("categories"); + if (!categories_value) { return false; } - for (const base::Value& v : categories_value->GetListDeprecated()) { + for (const base::Value& v : *categories_value) { if (!v.is_dict()) return false; + const base::Value::Dict& d = v.GetDict(); - const std::string* utf8_title = v.FindStringKey("localizedTitle"); - int remote_category_id = v.FindIntKey("id").value_or(-1); + const std::string* utf8_title = d.FindString("localizedTitle"); + int remote_category_id = d.FindInt("id").value_or(-1); if (!utf8_title || remote_category_id <= 0) { return false; } RemoteSuggestion::PtrVector suggestions; - const base::Value* suggestions_list = v.FindListKey("suggestions"); + const base::Value::List* suggestions_list = d.FindList("suggestions"); // Absence of a list of suggestions is treated as an empty list, which // is permissible. if (suggestions_list && @@ -121,7 +120,7 @@ // TODO(tschumann): Right now, the backend does not yet populate this // field. Make it mandatory once the backends provide it. bool allow_fetching_more_results = - v.FindBoolKey("allowFetchingMoreResults").value_or(false); + d.FindBool("allowFetchingMoreResults").value_or(false); categories->push_back(FetchedCategory( category, BuildRemoteCategoryInfo(base::UTF8ToUTF16(*utf8_title), allow_fetching_more_results)));
diff --git a/components/ntp_snippets/remote/remote_suggestion.cc b/components/ntp_snippets/remote/remote_suggestion.cc index 8e9be08..c7981bc 100644 --- a/components/ntp_snippets/remote/remote_suggestion.cc +++ b/components/ntp_snippets/remote/remote_suggestion.cc
@@ -18,10 +18,10 @@ namespace { // dict.Get() specialization for base::Time values -bool GetTimeValue(const base::Value& dict, +bool GetTimeValue(const base::Value::Dict& dict, const std::string& key, base::Time* time) { - const std::string* time_value = dict.FindStringKey(key); + const std::string* time_value = dict.FindString(key); if (!time_value) { return false; } @@ -29,8 +29,10 @@ } // dict.Get() specialization for GURL values -bool GetURLValue(const base::Value& dict, const std::string& key, GURL* url) { - const std::string* spec = dict.FindStringKey(key); +bool GetURLValue(const base::Value::Dict& dict, + const std::string& key, + GURL* url) { + const std::string* spec = dict.FindString(key); if (!spec) { return false; } @@ -39,10 +41,10 @@ } // dict.Get() specialization for std::string values -bool GetStringValue(const base::Value& dict, +bool GetStringValue(const base::Value::Dict& dict, const std::string& key, std::string* str) { - const std::string* str_value = dict.FindStringKey(key); + const std::string* str_value = dict.FindString(key); if (!str_value) { return false; } @@ -76,15 +78,15 @@ // static std::unique_ptr<RemoteSuggestion> RemoteSuggestion::CreateFromContentSuggestionsDictionary( - const base::DictionaryValue& dict, + const base::Value::Dict& dict, int remote_category_id, const base::Time& fetch_date) { - const base::ListValue* ids; - if (!dict.GetList("ids", &ids)) { + const base::Value::List* ids = dict.FindList("ids"); + if (!ids) { return nullptr; } std::vector<std::string> parsed_ids; - for (const base::Value& value : ids->GetListDeprecated()) { + for (const base::Value& value : *ids) { if (!value.is_string()) { return nullptr; } @@ -113,7 +115,7 @@ // TODO(sfiera): also favicon URL. const base::Value* image_dominant_color_value = - dict.FindKey("imageDominantColor"); + dict.Find("imageDominantColor"); if (image_dominant_color_value) { // The field is defined as fixed32 in the proto (effectively 32 bits // unsigned int), however, JSON does not support unsigned types. As a result @@ -129,14 +131,14 @@ snippet->image_dominant_color_ = image_dominant_color; } - absl::optional<double> score = dict.FindDoubleKey("score"); + absl::optional<double> score = dict.FindDouble("score"); if (score) snippet->score_ = *score; - const base::DictionaryValue* notification_info = nullptr; - if (dict.GetDictionary("notificationInfo", ¬ification_info)) { + if (const base::Value::Dict* notification_info = + dict.FindDict("notificationInfo")) { absl::optional<bool> should_notify = - notification_info->FindBoolKey("shouldNotify"); + notification_info->FindBool("shouldNotify"); if (should_notify) { snippet->should_notify_ = should_notify.value(); if (snippet->should_notify_) {
diff --git a/components/ntp_snippets/remote/remote_suggestion.h b/components/ntp_snippets/remote/remote_suggestion.h index 25f53c2a..9defb89 100644 --- a/components/ntp_snippets/remote/remote_suggestion.h +++ b/components/ntp_snippets/remote/remote_suggestion.h
@@ -12,14 +12,11 @@ #include <vector> #include "base/time/time.h" +#include "base/values.h" #include "components/ntp_snippets/content_suggestion.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "url/gurl.h" -namespace base { -class DictionaryValue; -} // namespace base - namespace ntp_snippets { // Exposed for tests. @@ -41,7 +38,7 @@ // Suggestions. Returns a null pointer if the dictionary doesn't correspond to // a valid suggestion. static std::unique_ptr<RemoteSuggestion> - CreateFromContentSuggestionsDictionary(const base::DictionaryValue& dict, + CreateFromContentSuggestionsDictionary(const base::Value::Dict& dict, int remote_category_id, const base::Time& fetch_date);
diff --git a/components/ntp_snippets/remote/remote_suggestion_unittest.cc b/components/ntp_snippets/remote/remote_suggestion_unittest.cc index 50069d84..95a486b 100644 --- a/components/ntp_snippets/remote/remote_suggestion_unittest.cc +++ b/components/ntp_snippets/remote/remote_suggestion_unittest.cc
@@ -46,7 +46,7 @@ return proto; } -base::DictionaryValue TestSnippetJsonValue() { +base::Value::Dict TestSnippetJsonValue() { const char kJsonStr[] = R"( { "ids" : ["foo", "bar"], @@ -72,13 +72,11 @@ kJsonStr, base::JSON_PARSE_RFC); CHECK(json_parsed.has_value()) << "error_message: " << json_parsed.error().message; - auto dict = base::DictionaryValue::From( - std::make_unique<base::Value>(std::move(*json_parsed))); - return std::move(*dict); + return std::move(json_parsed->GetDict()); } TEST(RemoteSuggestionTest, FromContentSuggestionsDictionary) { - base::DictionaryValue snippet_dict = TestSnippetJsonValue(); + base::Value::Dict snippet_dict = TestSnippetJsonValue(); const base::Time fetch_date = DeserializeTime(1466634774L); std::unique_ptr<RemoteSuggestion> snippet = RemoteSuggestion::CreateFromContentSuggestionsDictionary( @@ -111,9 +109,9 @@ TEST(RemoteSuggestionTest, FromContentSuggestionsDictionaryWithoutImageOrSnippet) { - base::DictionaryValue snippet_dict = TestSnippetJsonValue(); - ASSERT_TRUE(snippet_dict.RemovePath("imageUrl")); - ASSERT_TRUE(snippet_dict.RemovePath("snippet")); + base::Value::Dict snippet_dict = TestSnippetJsonValue(); + ASSERT_TRUE(snippet_dict.Remove("imageUrl")); + ASSERT_TRUE(snippet_dict.Remove("snippet")); const base::Time fetch_date = DeserializeTime(1466634774L); std::unique_ptr<RemoteSuggestion> snippet = RemoteSuggestion::CreateFromContentSuggestionsDictionary( @@ -181,8 +179,8 @@ TEST(RemoteSuggestionTest, NotifcationInfoAllSpecified) { auto json = TestSnippetJsonValue(); - json.SetBoolPath("notificationInfo.shouldNotify", true); - json.SetStringPath("notificationInfo.deadline", "2016-06-30T13:01:37.000Z"); + json.SetByDottedPath("notificationInfo.shouldNotify", true); + json.SetByDottedPath("notificationInfo.deadline", "2016-06-30T13:01:37.000Z"); auto snippet = RemoteSuggestion::CreateFromContentSuggestionsDictionary( json, 0, base::Time()); EXPECT_TRUE(snippet->should_notify()); @@ -193,8 +191,8 @@ TEST(RemoteSuggestionTest, NotificationInfoDeadlineInvalid) { auto json = TestSnippetJsonValue(); - json.SetBoolPath("notificationInfo.shouldNotify", true); - json.SetStringPath("notificationInfo.deadline", "abcd"); + json.SetByDottedPath("notificationInfo.shouldNotify", true); + json.SetByDottedPath("notificationInfo.deadline", "abcd"); auto snippet = RemoteSuggestion::CreateFromContentSuggestionsDictionary( json, 0, base::Time()); EXPECT_TRUE(snippet->should_notify()); @@ -203,8 +201,8 @@ TEST(RemoteSuggestionTest, NotificationInfoDeadlineAbsent) { auto json = TestSnippetJsonValue(); - json.SetBoolPath("notificationInfo.shouldNotify", true); - json.RemovePath("notificationInfo.deadline"); + json.SetByDottedPath("notificationInfo.shouldNotify", true); + json.RemoveByDottedPath("notificationInfo.deadline"); auto snippet = RemoteSuggestion::CreateFromContentSuggestionsDictionary( json, 0, base::Time()); EXPECT_TRUE(snippet->should_notify()); @@ -213,7 +211,7 @@ TEST(RemoteSuggestionTest, NotificationInfoShouldNotifyInvalid) { auto json = TestSnippetJsonValue(); - json.SetStringPath("notificationInfo.shouldNotify", "non-bool"); + json.SetByDottedPath("notificationInfo.shouldNotify", "non-bool"); auto snippet = RemoteSuggestion::CreateFromContentSuggestionsDictionary( json, 0, base::Time()); EXPECT_FALSE(snippet->should_notify()); @@ -221,7 +219,7 @@ TEST(RemoteSuggestionTest, NotificationInfoAbsent) { auto json = TestSnippetJsonValue(); - json.SetBoolPath("notificationInfo.shouldNotify", false); + json.SetByDottedPath("notificationInfo.shouldNotify", false); auto snippet = RemoteSuggestion::CreateFromContentSuggestionsDictionary( json, 0, base::Time()); EXPECT_FALSE(snippet->should_notify()); @@ -229,7 +227,7 @@ TEST(RemoteSuggestionTest, ToContentSuggestionWithoutNotificationInfo) { auto json = TestSnippetJsonValue(); - json.RemovePath("notificationInfo"); + json.Remove("notificationInfo"); const base::Time fetch_date = DeserializeTime(1466634774L); auto snippet = RemoteSuggestion::CreateFromContentSuggestionsDictionary( json, 0, fetch_date); @@ -277,7 +275,7 @@ TEST(RemoteSuggestionTest, ToContentSuggestionWithContentTypeVideo) { auto json = TestSnippetJsonValue(); - json.SetStringKey("contentType", "VIDEO"); + json.Set("contentType", "VIDEO"); auto snippet = RemoteSuggestion::CreateFromContentSuggestionsDictionary( json, 0, base::Time()); ASSERT_THAT(snippet, NotNull()); @@ -289,7 +287,7 @@ TEST(RemoteSuggestionTest, ToContentSuggestionWithContentTypeUnknown) { auto json = TestSnippetJsonValue(); - json.SetStringKey("contentType", "UNKNOWN"); + json.Set("contentType", "UNKNOWN"); auto snippet = RemoteSuggestion::CreateFromContentSuggestionsDictionary( json, 0, base::Time()); ASSERT_THAT(snippet, NotNull()); @@ -314,7 +312,7 @@ auto json = TestSnippetJsonValue(); // JSON does not support unsigned types. As a result the value is parsed as // int if it fits and as double otherwise. - json.SetDoubleKey("imageDominantColor", 4289379276.); + json.Set("imageDominantColor", 4289379276.); auto snippet = RemoteSuggestion::CreateFromContentSuggestionsDictionary( json, 0, base::Time()); ASSERT_THAT(snippet, NotNull()); @@ -330,7 +328,7 @@ auto json = TestSnippetJsonValue(); // JSON does not support unsigned types. As a result the value is parsed as // int if it fits and as double otherwise. - json.SetIntKey("imageDominantColor", 16777216 /*=0x1000000*/); + json.Set("imageDominantColor", 16777216 /*=0x1000000*/); auto snippet = RemoteSuggestion::CreateFromContentSuggestionsDictionary( json, 0, base::Time()); ASSERT_THAT(snippet, NotNull()); @@ -344,7 +342,7 @@ TEST(RemoteSuggestionTest, ToContentSuggestionWithoutImageDominantColor) { auto json = TestSnippetJsonValue(); - json.RemovePath("imageDominantColor"); + json.Remove("imageDominantColor"); auto snippet = RemoteSuggestion::CreateFromContentSuggestionsDictionary( json, 0, base::Time()); ASSERT_THAT(snippet, NotNull());
diff --git a/components/omnibox/browser/omnibox_prefs.cc b/components/omnibox/browser/omnibox_prefs.cc index 31fb11e..8f442223 100644 --- a/components/omnibox/browser/omnibox_prefs.cc +++ b/components/omnibox/browser/omnibox_prefs.cc
@@ -42,9 +42,15 @@ // Boolean that specifies whether to always show full URLs in the omnibox. const char kPreventUrlElisionsInOmnibox[] = "omnibox.prevent_url_elisions"; -// A cache of zero suggest results using JSON serialized into a string. +// A cache of NTP zero suggest results using a JSON dictionary serialized into a +// string. const char kZeroSuggestCachedResults[] = "zerosuggest.cachedresults"; +// A cache of SRP/Web zero suggest results using a JSON dictionary serialized +// into a string keyed off the page URL. +const char kZeroSuggestCachedResultsWithURL[] = + "zerosuggest.cachedresults_with_url"; + void RegisterProfilePrefs(PrefRegistrySimple* registry) { registry->RegisterDictionaryPref(kSuggestionGroupVisibility); registry->RegisterBooleanPref( @@ -88,4 +94,25 @@ ->Add(suggestion_group_id); } +void SetUserPreferenceForZeroSuggestCachedResponse( + PrefService* prefs, + const std::string& page_url, + const std::string& response) { + DCHECK(prefs); + + DictionaryPrefUpdate update(prefs, kZeroSuggestCachedResultsWithURL); + update->SetStringKey(page_url, response); +} + +std::string GetUserPreferenceForZeroSuggestCachedResponse( + PrefService* prefs, + const std::string& page_url) { + DCHECK(prefs); + + const base::Value::Dict& dictionary = + prefs->GetValueDict(omnibox::kZeroSuggestCachedResultsWithURL); + auto* value_ptr = dictionary.FindString(page_url); + return (value_ptr ? *value_ptr : std::string()); +} + } // namespace omnibox
diff --git a/components/omnibox/browser/omnibox_prefs.h b/components/omnibox/browser/omnibox_prefs.h index e78c2cf..f10cbfd 100644 --- a/components/omnibox/browser/omnibox_prefs.h +++ b/components/omnibox/browser/omnibox_prefs.h
@@ -5,6 +5,8 @@ #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_PREFS_H_ #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_PREFS_H_ +#include <string> + class PrefRegistrySimple; class PrefService; @@ -37,6 +39,7 @@ extern const char kSuggestionGroupVisibility[]; extern const char kPreventUrlElisionsInOmnibox[]; extern const char kZeroSuggestCachedResults[]; +extern const char kZeroSuggestCachedResultsWithURL[]; void RegisterProfilePrefs(PrefRegistrySimple* registry); @@ -61,6 +64,18 @@ int suggestion_group_id, SuggestionGroupVisibility visibility); +// Updates the ZPS dictionary preference to cache the given |response| value +// using the |page_url| as the cache key. +void SetUserPreferenceForZeroSuggestCachedResponse(PrefService* prefs, + const std::string& page_url, + const std::string& response); + +// Returns the cached response from the ZPS dictionary preference associated +// with the given |page_url|. +std::string GetUserPreferenceForZeroSuggestCachedResponse( + PrefService* prefs, + const std::string& page_url); + } // namespace omnibox #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_PREFS_H_
diff --git a/components/omnibox/browser/zero_suggest_provider.cc b/components/omnibox/browser/zero_suggest_provider.cc index c8cace0..608905d 100644 --- a/components/omnibox/browser/zero_suggest_provider.cc +++ b/components/omnibox/browser/zero_suggest_provider.cc
@@ -195,6 +195,7 @@ bool is_prefetch, SearchSuggestionParser::Results* results) { DCHECK(results); + DCHECK_NE(ZeroSuggestProvider::ResultType::kNone, result_type); if (response_json.empty()) { return false; @@ -213,11 +214,17 @@ return false; } - // Store the valid response only if running the kRemoteNoURL variant. + // Update the relevant prefs in the cache, based on |result_type|. if (result_type == ZeroSuggestProvider::ResultType::kRemoteNoURL) { client->GetPrefs()->SetString(omnibox::kZeroSuggestCachedResults, response_json); LogEvent(Event::kRemoteResponseCached, result_type, is_prefetch); + } else if (base::FeatureList::IsEnabled( + omnibox::kZeroSuggestPrefetchingOnSRP) && + result_type == ZeroSuggestProvider::ResultType::kRemoteSendURL) { + omnibox::SetUserPreferenceForZeroSuggestCachedResponse( + client->GetPrefs(), input.current_url().spec(), response_json); + LogEvent(Event::kRemoteResponseCached, result_type, is_prefetch); } return true; @@ -233,14 +240,20 @@ ZeroSuggestProvider::ResultType result_type, SearchSuggestionParser::Results* results) { DCHECK(results); + DCHECK_NE(ZeroSuggestProvider::ResultType::kNone, result_type); - // Use the stored response only if running the kRemoteNoURL variant. - if (result_type != ZeroSuggestProvider::ResultType::kRemoteNoURL) { - return false; + std::string response_json; + + if (result_type == ZeroSuggestProvider::ResultType::kRemoteNoURL) { + response_json = + client->GetPrefs()->GetString(omnibox::kZeroSuggestCachedResults); + } else if (base::FeatureList::IsEnabled( + omnibox::kZeroSuggestPrefetchingOnSRP) && + result_type == ZeroSuggestProvider::ResultType::kRemoteSendURL) { + response_json = omnibox::GetUserPreferenceForZeroSuggestCachedResponse( + client->GetPrefs(), input.current_url().spec()); } - const std::string response_json = - client->GetPrefs()->GetString(omnibox::kZeroSuggestCachedResults); if (response_json.empty()) { return false; } @@ -364,6 +377,8 @@ void ZeroSuggestProvider::RegisterProfilePrefs(PrefRegistrySimple* registry) { registry->RegisterStringPref(omnibox::kZeroSuggestCachedResults, std::string()); + registry->RegisterDictionaryPref(omnibox::kZeroSuggestCachedResultsWithURL, + base::Value::Dict()); } void ZeroSuggestProvider::StartPrefetch(const AutocompleteInput& input) { @@ -472,11 +487,13 @@ void ZeroSuggestProvider::DeleteMatch(const AutocompleteMatch& match) { // Remove the deleted match from the cache, so it is not shown to the user // again. Since we cannot remove just one result, blow away the cache. - // Although the cache is currently only used for kRemoteNoURL, we have no - // easy way of checking the request type after-the-fact. It's safe though, to - // always clear the cache even if we are on a different request type. + // Even though we currently have no easy way of checking the request type + // after-the-fact, it's safe to always clear the cache even if we are on a + // different request type. client()->GetPrefs()->SetString(omnibox::kZeroSuggestCachedResults, std::string()); + client()->GetPrefs()->SetDict(omnibox::kZeroSuggestCachedResultsWithURL, + base::Value::Dict()); BaseSearchProvider::DeleteMatch(match); }
diff --git a/components/omnibox/browser/zero_suggest_provider_unittest.cc b/components/omnibox/browser/zero_suggest_provider_unittest.cc index 8f7e39ca..75ae7e6 100644 --- a/components/omnibox/browser/zero_suggest_provider_unittest.cc +++ b/components/omnibox/browser/zero_suggest_provider_unittest.cc
@@ -44,7 +44,9 @@ : template_url_service_(new TemplateURLService(nullptr, 0)), pref_service_(new TestingPrefServiceSimple()) { pref_service_->registry()->RegisterStringPref( - omnibox::kZeroSuggestCachedResults, ""); + omnibox::kZeroSuggestCachedResults, std::string()); + pref_service_->registry()->RegisterDictionaryPref( + omnibox::kZeroSuggestCachedResultsWithURL, base::Value::Dict()); } FakeAutocompleteProviderClient(const FakeAutocompleteProviderClient&) = delete; @@ -108,10 +110,13 @@ } GURL GetSuggestURL( - metrics::OmniboxEventProto::PageClassification page_classification) { + metrics::OmniboxEventProto::PageClassification page_classification, + OmniboxFocusType focus_type, + const std::string& page_url) { TemplateURLRef::SearchTermsArgs search_terms_args; search_terms_args.page_classification = page_classification; - search_terms_args.focus_type = OmniboxFocusType::ON_FOCUS; + search_terms_args.focus_type = focus_type; + search_terms_args.current_page_url = page_url; return RemoteSuggestionsService::EndpointUrl( search_terms_args, client_->GetTemplateURLService()); } @@ -157,8 +162,7 @@ AutocompleteInput PrefixInputForWeb() { std::string input_url = "https://example.com/"; - AutocompleteInput input(base::ASCIIToUTF16(input_url), - metrics::OmniboxEventProto::OTHER, + AutocompleteInput input(u"foobar", metrics::OmniboxEventProto::OTHER, TestSchemeClassifier()); input.set_current_url(GURL(input_url)); input.set_focus_type(OmniboxFocusType::DEFAULT); @@ -166,7 +170,7 @@ } AutocompleteInput OnFocusInputForSRP() { - std::string input_url = "https://example.com/"; + std::string input_url = "https://google.com/search?q=omnibox"; AutocompleteInput input(base::ASCIIToUTF16(input_url), metrics::OmniboxEventProto:: SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT, @@ -181,14 +185,23 @@ metrics::OmniboxEventProto:: SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT, TestSchemeClassifier()); - input.set_current_url(GURL("https://example.com/")); + input.set_current_url(GURL("https://google.com/search?q=omnibox")); + input.set_focus_type(OmniboxFocusType::DELETED_PERMANENT_TEXT); + return input; + } + + AutocompleteInput PrefetchingInputForSRP() { + std::string input_url = "https://google.com/search?q=omnibox"; + AutocompleteInput input(u"", metrics::OmniboxEventProto::SRP_ZPS_PREFETCH, + TestSchemeClassifier()); + input.set_current_url(GURL(input_url)); input.set_focus_type(OmniboxFocusType::DELETED_PERMANENT_TEXT); return input; } AutocompleteInput PrefixInputForSRP() { - std::string input_url = "https://example.com/"; - AutocompleteInput input(base::ASCIIToUTF16(input_url), + std::string input_url = "https://google.com/search?q=omnibox"; + AutocompleteInput input(u"foobar", metrics::OmniboxEventProto:: SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT, TestSchemeClassifier()); @@ -223,9 +236,14 @@ // Ensure the cache is empty. PrefService* prefs = client_->GetPrefs(); prefs->SetString(omnibox::kZeroSuggestCachedResults, ""); + prefs->SetDict(omnibox::kZeroSuggestCachedResultsWithURL, + base::Value::Dict()); scoped_feature_list_ = std::make_unique<base::test::ScopedFeatureList>(); - scoped_feature_list_->InitAndEnableFeature(omnibox::kZeroSuggestPrefetching); + scoped_feature_list_->InitWithFeatures( + /*enabled_features=*/{omnibox::kZeroSuggestPrefetching, + omnibox::kZeroSuggestPrefetchingOnSRP}, + /*disabled_features=*/{}); } void ZeroSuggestProviderTest::OnProviderUpdate( @@ -234,7 +252,7 @@ provider_did_notify_ = true; } -TEST_F(ZeroSuggestProviderTest, AllowZeroPrefixSuggestions_NTP) { +TEST_F(ZeroSuggestProviderTest, AllowZeroPrefixSuggestionsNTP) { AutocompleteInput onfocus_ntp_input = OnFocusInputForNTP(); EXPECT_CALL(*client_, IsAuthenticated()) @@ -267,8 +285,7 @@ } } -TEST_F(ZeroSuggestProviderTest, - AllowZeroPrefixSuggestions_ContextualWebAndSRP) { +TEST_F(ZeroSuggestProviderTest, AllowZeroPrefixSuggestionsContextualWebAndSRP) { AutocompleteInput prefix_web_input = PrefixInputForWeb(); AutocompleteInput prefix_srp_input = PrefixInputForSRP(); AutocompleteInput on_focus_web_input = OnFocusInputForWeb(); @@ -357,7 +374,7 @@ } } -TEST_F(ZeroSuggestProviderTest, AllowZeroPrefixSuggestions_RequestEligibility) { +TEST_F(ZeroSuggestProviderTest, AllowZeroPrefixSuggestionsRequestEligibility) { base::HistogramTester histogram_tester; // Enable on-focus for SRP. @@ -409,14 +426,14 @@ 5); } -TEST_F(ZeroSuggestProviderTest, ResultTypeToRun_NTP) { +TEST_F(ZeroSuggestProviderTest, ResultTypeToRunNTP) { AutocompleteInput onfocus_ntp_input = OnFocusInputForNTP(); EXPECT_EQ( ZeroSuggestProvider::ResultType::kRemoteNoURL, ZeroSuggestProvider::ResultTypeToRun(client_.get(), onfocus_ntp_input)); } -TEST_F(ZeroSuggestProviderTest, ResultTypeToRun_ContextualWeb) { +TEST_F(ZeroSuggestProviderTest, ResultTypeToRunContextualWeb) { AutocompleteInput on_focus_input = OnFocusInputForWeb(); AutocompleteInput on_clobber_input = OnClobberInputForWeb(); @@ -489,7 +506,7 @@ } } -TEST_F(ZeroSuggestProviderTest, ResultTypeToRun_SRP) { +TEST_F(ZeroSuggestProviderTest, ResultTypeToRunSRP) { AutocompleteInput on_focus_input = OnFocusInputForSRP(); AutocompleteInput on_clobber_input = OnClobberInputForSRP(); @@ -559,19 +576,20 @@ } } -TEST_F(ZeroSuggestProviderTest, StartStop) { +TEST_F(ZeroSuggestProviderTest, StartStopNTP) { EXPECT_CALL(*client_, IsAuthenticated()) .WillRepeatedly(testing::Return(true)); // Set up the pref to cache the response from the previous run. std::string json_response( - "[\"\",[\"search1\", \"search2\", \"search3\"]," - "[],[],{\"google:suggestrelevance\":[602, 601, 600]," - "\"google:verbatimrelevance\":1300}]"); + R"(["",["search1", "search2", "search3"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); PrefService* prefs = client_->GetPrefs(); prefs->SetString(omnibox::kZeroSuggestCachedResults, json_response); - GURL suggest_url = GetSuggestURL(metrics::OmniboxEventProto::NTP_REALBOX); + GURL suggest_url = GetSuggestURL(metrics::OmniboxEventProto::NTP_REALBOX, + OmniboxFocusType::ON_FOCUS, ""); // Make sure valid input starts the provider. AutocompleteInput input = OnFocusInputForNTP(); @@ -617,7 +635,72 @@ EXPECT_FALSE(provider_did_notify_); } -TEST_F(ZeroSuggestProviderTest, TestPsuggestZeroSuggestCachingFirstRun) { +TEST_F(ZeroSuggestProviderTest, StartStopSRP) { + EXPECT_CALL(*client_, IsAuthenticated()) + .WillRepeatedly(testing::Return(true)); + + // Enable on-clobber ZPS. + base::test::ScopedFeatureList features; + features.InitAndEnableFeature(omnibox::kClobberTriggersSRPZeroSuggest); + + // Set up the pref to cache the response from the previous run. + std::string json_response( + R"(["",["search1", "search2", "search3"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); + PrefService* prefs = client_->GetPrefs(); + AutocompleteInput input = OnClobberInputForSRP(); + omnibox::SetUserPreferenceForZeroSuggestCachedResponse( + prefs, input.current_url().spec(), json_response); + + GURL suggest_url = GetSuggestURL( + metrics::OmniboxEventProto::SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT, + OmniboxFocusType::DELETED_PERMANENT_TEXT, input.current_url().spec()); + + // Make sure valid input starts the provider. + provider_->Start(input, false); + EXPECT_FALSE(provider_->done()); + // Expect that matches got populated out of cache. + EXPECT_FALSE(provider_->matches().empty()); + // Expect that network request was sent. + EXPECT_TRUE(test_loader_factory()->IsPending(suggest_url.spec())); + // Expect the provider to not have notified the provider listener yet. + EXPECT_FALSE(provider_did_notify_); + + // Make sure valid input restarts the provider. + provider_->Start(input, false); + EXPECT_FALSE(provider_->done()); + // Expect that matches got populated out of cache. + EXPECT_FALSE(provider_->matches().empty()); + // Expect that network request was sent. + EXPECT_TRUE(test_loader_factory()->IsPending(suggest_url.spec())); + // Expect the provider to not have notified the provider listener yet. + EXPECT_FALSE(provider_did_notify_); + + // Make sure invalid input stops the provider. + AutocompleteInput prefix_input = PrefixInputForSRP(); + provider_->Start(prefix_input, false); + EXPECT_TRUE(provider_->done()); + // Expect that matches did not get populated out of cache. + EXPECT_TRUE(provider_->matches().empty()); + // Expect that network request was not sent. + EXPECT_FALSE(test_loader_factory()->IsPending(suggest_url.spec())); + // Expect the provider to not have notified the provider listener since the + // request was invalidated. + EXPECT_FALSE(provider_did_notify_); + + // Make sure valid input restarts the provider. + provider_->Start(input, false); + EXPECT_FALSE(provider_->done()); + // Expect that matches got populated out of cache. + EXPECT_FALSE(provider_->matches().empty()); + // Expect that network request was sent. + EXPECT_TRUE(test_loader_factory()->IsPending(suggest_url.spec())); + // Expect the provider to not have notified the provider listener yet. + EXPECT_FALSE(provider_did_notify_); +} + +TEST_F(ZeroSuggestProviderTest, TestPsuggestZeroSuggestCachingFirstRunNTP) { base::HistogramTester histogram_tester; EXPECT_CALL(*client_, IsAuthenticated()) @@ -630,12 +713,14 @@ EXPECT_TRUE(provider_->matches().empty()); - GURL suggest_url = GetSuggestURL(metrics::OmniboxEventProto::NTP_REALBOX); + GURL suggest_url = GetSuggestURL(metrics::OmniboxEventProto::NTP_REALBOX, + OmniboxFocusType::ON_FOCUS, ""); EXPECT_TRUE(test_loader_factory()->IsPending(suggest_url.spec())); - std::string json_response("[\"\",[\"search1\", \"search2\", \"search3\"]," - "[],[],{\"google:suggestrelevance\":[602, 601, 600]," - "\"google:verbatimrelevance\":1300}]"); + std::string json_response( + R"(["",["search1", "search2", "search3"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); test_loader_factory()->AddResponse(suggest_url.spec(), json_response); base::RunLoop().RunUntilIdle(); @@ -671,15 +756,85 @@ prefs->GetString(omnibox::kZeroSuggestCachedResults)); } +TEST_F(ZeroSuggestProviderTest, TestPsuggestZeroSuggestCachingFirstRunSRP) { + base::HistogramTester histogram_tester; + + EXPECT_CALL(*client_, IsAuthenticated()) + .WillRepeatedly(testing::Return(true)); + + // Enable on-clobber ZPS. + base::test::ScopedFeatureList features; + features.InitAndEnableFeature(omnibox::kClobberTriggersSRPZeroSuggest); + + AutocompleteInput input = OnClobberInputForSRP(); + provider_->Start(input, false); + ASSERT_EQ(ZeroSuggestProvider::ResultType::kRemoteSendURL, + provider_->GetResultTypeRunningForTesting()); + + EXPECT_TRUE(provider_->matches().empty()); + + GURL suggest_url = GetSuggestURL( + metrics::OmniboxEventProto::SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT, + OmniboxFocusType::DELETED_PERMANENT_TEXT, input.current_url().spec()); + EXPECT_TRUE(test_loader_factory()->IsPending(suggest_url.spec())); + + std::string json_response( + R"(["",["search1", "search2", "search3"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); + test_loader_factory()->AddResponse(suggest_url.spec(), json_response); + + base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(provider_->done()); + + // Expect correct histograms to have been logged. + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.NoURL.Prefetch", 0); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.NoURL.NonPrefetch", 0); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.URLBased.Prefetch", 0); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", 4); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", 1 /*REQUEST_SENT*/, + 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", + 3 /*REMOTE_RESPONSE_RECEIVED*/, 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", + 4 /*REMOTE_RESPONSE_CACHED*/, 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", + 5 /*REMOTE_RESPONSE_CONVERTED_TO_MATCHES*/, 1); + + // Expect the provider to have notified the provider listener. + EXPECT_TRUE(provider_did_notify_); + + EXPECT_EQ(3U, provider_->matches().size()); // 3 results, no verbatim match + PrefService* prefs = client_->GetPrefs(); + EXPECT_EQ(json_response, + omnibox::GetUserPreferenceForZeroSuggestCachedResponse( + prefs, input.current_url().spec())); +} + TEST_F(ZeroSuggestProviderTest, - TestPsuggestZeroSuggestWantAsynchronousMatchesFalse) { + TestPsuggestZeroSuggestOmitAsynchronousMatchesTrueNTP) { EXPECT_CALL(*client_, IsAuthenticated()) .WillRepeatedly(testing::Return(true)); AutocompleteInput input = OnFocusInputForNTP(); input.set_omit_asynchronous_matches(true); - GURL suggest_url = GetSuggestURL(metrics::OmniboxEventProto::NTP_REALBOX); + GURL suggest_url = GetSuggestURL(metrics::OmniboxEventProto::NTP_REALBOX, + OmniboxFocusType::ON_FOCUS, ""); + + // Ensure the cache is empty. + PrefService* prefs = client_->GetPrefs(); + prefs->SetString(omnibox::kZeroSuggestCachedResults, ""); + prefs->SetDict(omnibox::kZeroSuggestCachedResultsWithURL, + base::Value::Dict()); provider_->Start(input, false); ASSERT_EQ(ZeroSuggestProvider::ResultType::kRemoteNoURL, @@ -696,16 +851,54 @@ EXPECT_FALSE(provider_did_notify_); } -TEST_F(ZeroSuggestProviderTest, TestPsuggestZeroSuggestHasCachedResults) { +TEST_F(ZeroSuggestProviderTest, + TestPsuggestZeroSuggestOmitAsynchronousMatchesTrueSRP) { + EXPECT_CALL(*client_, IsAuthenticated()) + .WillRepeatedly(testing::Return(true)); + + // Enable on-clobber ZPS. + base::test::ScopedFeatureList features; + features.InitAndEnableFeature(omnibox::kClobberTriggersSRPZeroSuggest); + + AutocompleteInput input = OnClobberInputForSRP(); + input.set_omit_asynchronous_matches(true); + + GURL suggest_url = GetSuggestURL( + metrics::OmniboxEventProto::SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT, + OmniboxFocusType::DELETED_PERMANENT_TEXT, input.current_url().spec()); + + // Ensure the cache is empty. + PrefService* prefs = client_->GetPrefs(); + prefs->SetString(omnibox::kZeroSuggestCachedResults, ""); + prefs->SetDict(omnibox::kZeroSuggestCachedResultsWithURL, + base::Value::Dict()); + + provider_->Start(input, false); + ASSERT_EQ(ZeroSuggestProvider::ResultType::kRemoteSendURL, + provider_->GetResultTypeRunningForTesting()); + EXPECT_TRUE(provider_->done()); + EXPECT_TRUE(provider_->matches().empty()); + + // There should be no pending network requests, given that asynchronous logic + // has been explicitly disabled (`omit_asynchronous_matches_ == true`). + ASSERT_FALSE(test_loader_factory()->IsPending(suggest_url.spec())); + + // Expect the provider to not have notified the provider listener since the + // request was not sent. + EXPECT_FALSE(provider_did_notify_); +} + +TEST_F(ZeroSuggestProviderTest, TestPsuggestZeroSuggestHasCachedResultsNTP) { base::HistogramTester histogram_tester; EXPECT_CALL(*client_, IsAuthenticated()) .WillRepeatedly(testing::Return(true)); // Set up the pref to cache the response from the previous run. - std::string json_response("[\"\",[\"search1\", \"search2\", \"search3\"]," - "[],[],{\"google:suggestrelevance\":[602, 601, 600]," - "\"google:verbatimrelevance\":1300}]"); + std::string json_response( + R"(["",["search1", "search2", "search3"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); PrefService* prefs = client_->GetPrefs(); prefs->SetString(omnibox::kZeroSuggestCachedResults, json_response); @@ -720,12 +913,13 @@ EXPECT_EQ(u"search2", provider_->matches()[1].contents); EXPECT_EQ(u"search3", provider_->matches()[2].contents); - GURL suggest_url = GetSuggestURL(metrics::OmniboxEventProto::NTP_REALBOX); + GURL suggest_url = GetSuggestURL(metrics::OmniboxEventProto::NTP_REALBOX, + OmniboxFocusType::ON_FOCUS, ""); EXPECT_TRUE(test_loader_factory()->IsPending(suggest_url.spec())); std::string json_response2( - "[\"\",[\"search4\", \"search5\", \"search6\"]," - "[],[],{\"google:suggestrelevance\":[602, 601, 600]," - "\"google:verbatimrelevance\":1300}]"); + R"(["",["search4", "search5", "search6"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); test_loader_factory()->AddResponse(suggest_url.spec(), json_response2); base::RunLoop().RunUntilIdle(); @@ -767,16 +961,99 @@ prefs->GetString(omnibox::kZeroSuggestCachedResults)); } -TEST_F(ZeroSuggestProviderTest, TestPsuggestZeroSuggestReceivedEmptyResults) { +TEST_F(ZeroSuggestProviderTest, TestPsuggestZeroSuggestHasCachedResultsSRP) { + base::HistogramTester histogram_tester; + + EXPECT_CALL(*client_, IsAuthenticated()) + .WillRepeatedly(testing::Return(true)); + + // Enable on-clobber ZPS. + base::test::ScopedFeatureList features; + features.InitAndEnableFeature(omnibox::kClobberTriggersSRPZeroSuggest); + + // Set up the pref to cache the response from the previous run. + std::string json_response( + R"(["",["search1", "search2", "search3"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); + PrefService* prefs = client_->GetPrefs(); + AutocompleteInput input = OnClobberInputForSRP(); + omnibox::SetUserPreferenceForZeroSuggestCachedResponse( + prefs, input.current_url().spec(), json_response); + + provider_->Start(input, false); + ASSERT_EQ(ZeroSuggestProvider::ResultType::kRemoteSendURL, + provider_->GetResultTypeRunningForTesting()); + + // Expect that matches get populated synchronously out of the cache. + ASSERT_EQ(3U, provider_->matches().size()); // 3 results, no verbatim match + EXPECT_EQ(u"search1", provider_->matches()[0].contents); + EXPECT_EQ(u"search2", provider_->matches()[1].contents); + EXPECT_EQ(u"search3", provider_->matches()[2].contents); + + GURL suggest_url = GetSuggestURL( + metrics::OmniboxEventProto::SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT, + OmniboxFocusType::DELETED_PERMANENT_TEXT, input.current_url().spec()); + EXPECT_TRUE(test_loader_factory()->IsPending(suggest_url.spec())); + std::string json_response2( + R"(["",["search4", "search5", "search6"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); + test_loader_factory()->AddResponse(suggest_url.spec(), json_response2); + + base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(provider_->done()); + + // Expect the provider to not have notified the provider listener when using + // the cached response. + EXPECT_FALSE(provider_did_notify_); + + // Expect correct histograms to have been logged. + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.NoURL.Prefetch", 0); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.NoURL.NonPrefetch", 0); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.URLBased.Prefetch", 0); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", 4); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", + 0 /*CACHED_RESPONSE_CONVERTED_TO_MATCHES*/, 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", 1 /*REQUEST_SENT*/, + 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", + 3 /*REMOTE_RESPONSE_RECEIVED*/, 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", + 4 /*REMOTE_RESPONSE_CACHED*/, 1); + + // Expect the same results after the response has been handled. + ASSERT_EQ(3U, provider_->matches().size()); // 3 results, no verbatim match + EXPECT_EQ(u"search1", provider_->matches()[0].contents); + EXPECT_EQ(u"search2", provider_->matches()[1].contents); + EXPECT_EQ(u"search3", provider_->matches()[2].contents); + + // Expect the new results to have been stored. + EXPECT_EQ(json_response2, + omnibox::GetUserPreferenceForZeroSuggestCachedResponse( + prefs, input.current_url().spec())); +} + +TEST_F(ZeroSuggestProviderTest, + TestPsuggestZeroSuggestReceivedEmptyResultsNTP) { base::HistogramTester histogram_tester; EXPECT_CALL(*client_, IsAuthenticated()) .WillRepeatedly(testing::Return(true)); // Set up the pref to cache the response from the previous run. - std::string json_response("[\"\",[\"search1\", \"search2\", \"search3\"]," - "[],[],{\"google:suggestrelevance\":[602, 601, 600]," - "\"google:verbatimrelevance\":1300}]"); + std::string json_response( + R"(["",["search1", "search2", "search3"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); PrefService* prefs = client_->GetPrefs(); prefs->SetString(omnibox::kZeroSuggestCachedResults, json_response); @@ -791,9 +1068,10 @@ EXPECT_EQ(u"search2", provider_->matches()[1].contents); EXPECT_EQ(u"search3", provider_->matches()[2].contents); - GURL suggest_url = GetSuggestURL(metrics::OmniboxEventProto::NTP_REALBOX); + GURL suggest_url = GetSuggestURL(metrics::OmniboxEventProto::NTP_REALBOX, + OmniboxFocusType::ON_FOCUS, ""); EXPECT_TRUE(test_loader_factory()->IsPending(suggest_url.spec())); - std::string empty_response("[\"\",[],[],[],{}]"); + std::string empty_response(R"(["",[],[],[],{}])"); test_loader_factory()->AddResponse(suggest_url.spec(), empty_response); base::RunLoop().RunUntilIdle(); @@ -834,15 +1112,93 @@ prefs->GetString(omnibox::kZeroSuggestCachedResults)); } +TEST_F(ZeroSuggestProviderTest, + TestPsuggestZeroSuggestReceivedEmptyResultsSRP) { + base::HistogramTester histogram_tester; + + EXPECT_CALL(*client_, IsAuthenticated()) + .WillRepeatedly(testing::Return(true)); + + // Enable on-clobber ZPS. + base::test::ScopedFeatureList features; + features.InitAndEnableFeature(omnibox::kClobberTriggersSRPZeroSuggest); + + // Set up the pref to cache the response from the previous run. + std::string json_response( + R"(["",["search1", "search2", "search3"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); + PrefService* prefs = client_->GetPrefs(); + AutocompleteInput input = OnClobberInputForSRP(); + omnibox::SetUserPreferenceForZeroSuggestCachedResponse( + prefs, input.current_url().spec(), json_response); + + provider_->Start(input, false); + ASSERT_EQ(ZeroSuggestProvider::ResultType::kRemoteSendURL, + provider_->GetResultTypeRunningForTesting()); + + // Expect that matches get populated synchronously out of the cache. + ASSERT_EQ(3U, provider_->matches().size()); // 3 results, no verbatim match + EXPECT_EQ(u"search1", provider_->matches()[0].contents); + EXPECT_EQ(u"search2", provider_->matches()[1].contents); + EXPECT_EQ(u"search3", provider_->matches()[2].contents); + + GURL suggest_url = GetSuggestURL( + metrics::OmniboxEventProto::SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT, + OmniboxFocusType::DELETED_PERMANENT_TEXT, input.current_url().spec()); + EXPECT_TRUE(test_loader_factory()->IsPending(suggest_url.spec())); + std::string empty_response(R"(["",[],[],[],{}])"); + test_loader_factory()->AddResponse(suggest_url.spec(), empty_response); + + base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(provider_->done()); + + // Expect correct histograms to have been logged. + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.NoURL.Prefetch", 0); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.NoURL.NonPrefetch", 0); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.URLBased.Prefetch", 0); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", 5); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", + 0 /*CACHED_RESPONSE_CONVERTED_TO_MATCHES*/, 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", 1 /*REQUEST_SENT*/, + 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", + 3 /*REMOTE_RESPONSE_RECEIVED*/, 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", + 4 /*REMOTE_RESPONSE_CACHED*/, 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", + 5 /*REMOTE_RESPONSE_CONVERTED_TO_MATCHES*/, 1); + + // Expect the provider to have notified the provider listener. + EXPECT_TRUE(provider_did_notify_); + + // Expect that the matches have been cleared. + ASSERT_TRUE(provider_->matches().empty()); + + // Expect the new results to have been stored. + EXPECT_EQ(empty_response, + omnibox::GetUserPreferenceForZeroSuggestCachedResponse( + prefs, input.current_url().spec())); +} + TEST_F(ZeroSuggestProviderTest, TestPsuggestZeroSuggestPrefetchThenNTPOnFocus) { EXPECT_CALL(*client_, IsAuthenticated()) .WillRepeatedly(testing::Return(true)); // Set up the pref to cache the response from the previous run. std::string json_response( - "[\"\",[\"search1\", \"search2\", \"search3\"]," - "[],[],{\"google:suggestrelevance\":[602, 601, 600]," - "\"google:verbatimrelevance\":1300}]"); + R"(["",["search1", "search2", "search3"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); PrefService* prefs = client_->GetPrefs(); prefs->SetString(omnibox::kZeroSuggestCachedResults, json_response); @@ -858,12 +1214,13 @@ ASSERT_EQ(0U, provider_->matches().size()); GURL suggest_url = - GetSuggestURL(metrics::OmniboxEventProto::NTP_ZPS_PREFETCH); + GetSuggestURL(metrics::OmniboxEventProto::NTP_ZPS_PREFETCH, + OmniboxFocusType::ON_FOCUS, ""); EXPECT_TRUE(test_loader_factory()->IsPending(suggest_url.spec())); std::string json_response2( - "[\"\",[\"search4\", \"search5\", \"search6\"]," - "[],[],{\"google:suggestrelevance\":[602, 601, 600]," - "\"google:verbatimrelevance\":1300}]"); + R"(["",["search4", "search5", "search6"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); test_loader_factory()->AddResponse(suggest_url.spec(), json_response2); base::RunLoop().RunUntilIdle(); @@ -892,7 +1249,7 @@ EXPECT_FALSE(provider_did_notify_); // Expect the same empty results after the response has been handled. - ASSERT_EQ(0U, provider_->matches().size()); // 3 results, no verbatim match + ASSERT_EQ(0U, provider_->matches().size()); // Expect the new response to have been stored in the pref. EXPECT_EQ(json_response2, @@ -914,12 +1271,13 @@ EXPECT_EQ(u"search5", provider_->matches()[1].contents); EXPECT_EQ(u"search6", provider_->matches()[2].contents); - GURL suggest_url = GetSuggestURL(metrics::OmniboxEventProto::NTP_REALBOX); + GURL suggest_url = GetSuggestURL(metrics::OmniboxEventProto::NTP_REALBOX, + OmniboxFocusType::ON_FOCUS, ""); EXPECT_TRUE(test_loader_factory()->IsPending(suggest_url.spec())); std::string json_response3( - "[\"\",[\"search7\", \"search8\", \"search9\"]," - "[],[],{\"google:suggestrelevance\":[602, 601, 600]," - "\"google:verbatimrelevance\":1300}]"); + R"(["",["search7", "search8", "search9"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); test_loader_factory()->AddResponse(suggest_url.spec(), json_response3); base::RunLoop().RunUntilIdle(); @@ -961,3 +1319,144 @@ prefs->GetString(omnibox::kZeroSuggestCachedResults)); } } + +TEST_F(ZeroSuggestProviderTest, + TestPsuggestZeroSuggestPrefetchThenSRPOnClobber) { + EXPECT_CALL(*client_, IsAuthenticated()) + .WillRepeatedly(testing::Return(true)); + + // Enable on-clobber ZPS. + base::test::ScopedFeatureList features; + features.InitAndEnableFeature(omnibox::kClobberTriggersSRPZeroSuggest); + + // Set up the pref to cache the response from the previous run. + std::string json_response( + R"(["",["search1", "search2", "search3"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); + PrefService* prefs = client_->GetPrefs(); + AutocompleteInput input = PrefetchingInputForSRP(); + omnibox::SetUserPreferenceForZeroSuggestCachedResponse( + prefs, input.current_url().spec(), json_response); + + { + base::HistogramTester histogram_tester; + + // Start a prefetch request. + provider_->StartPrefetch(input); + EXPECT_TRUE(provider_->done()); + + // Expect the results to be empty. + ASSERT_EQ(0U, provider_->matches().size()); + + GURL suggest_url = GetSuggestURL( + metrics::OmniboxEventProto::SRP_ZPS_PREFETCH, + OmniboxFocusType::DELETED_PERMANENT_TEXT, input.current_url().spec()); + EXPECT_TRUE(test_loader_factory()->IsPending(suggest_url.spec())); + std::string json_response2( + R"(["",["search4", "search5", "search6"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); + test_loader_factory()->AddResponse(suggest_url.spec(), json_response2); + + base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(provider_->done()); + + // Expect correct histograms to have been logged. + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.NoURL.NonPrefetch", 0); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.NoURL.Prefetch", 0); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.URLBased.Prefetch", 3); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", 0); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.Prefetch", 1 /*REQUEST_SENT*/, 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.Prefetch", + 3 /*REMOTE_RESPONSE_RECEIVED*/, 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.Prefetch", + 4 /*REMOTE_RESPONSE_CACHED*/, 1); + + // Expect the provider to not have notified the provider listener since the + // matches were not updated. + EXPECT_FALSE(provider_did_notify_); + + // Expect the same empty results after the response has been handled. + ASSERT_EQ(0U, provider_->matches().size()); + + // Expect the new response to have been stored in the pref. + EXPECT_EQ(json_response2, + omnibox::GetUserPreferenceForZeroSuggestCachedResponse( + prefs, input.current_url().spec())); + } + { + base::HistogramTester histogram_tester; + + // Start a non-prefetch request. + AutocompleteInput input = OnClobberInputForSRP(); + provider_->Start(input, false); + EXPECT_FALSE(provider_->done()); + ASSERT_EQ(ZeroSuggestProvider::ResultType::kRemoteSendURL, + provider_->GetResultTypeRunningForTesting()); + + // Expect the results from the cached response. + ASSERT_EQ(3U, provider_->matches().size()); // 3 results, no verbatim match + EXPECT_EQ(u"search4", provider_->matches()[0].contents); + EXPECT_EQ(u"search5", provider_->matches()[1].contents); + EXPECT_EQ(u"search6", provider_->matches()[2].contents); + + GURL suggest_url = GetSuggestURL( + metrics::OmniboxEventProto:: + SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT, + OmniboxFocusType::DELETED_PERMANENT_TEXT, input.current_url().spec()); + EXPECT_TRUE(test_loader_factory()->IsPending(suggest_url.spec())); + std::string json_response3( + R"(["",["search7", "search8", "search9"],)" + R"([],[],{"google:suggestrelevance":[602, 601, 600],)" + R"("google:verbatimrelevance":1300}])"); + test_loader_factory()->AddResponse(suggest_url.spec(), json_response3); + + base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(provider_->done()); + + // Expect correct histograms to have been logged. + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.NoURL.Prefetch", 0); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.NoURL.NonPrefetch", 0); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.URLBased.Prefetch", 0); + histogram_tester.ExpectTotalCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", 4); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", + 0 /*CACHED_RESPONSE_CONVERTED_TO_MATCHES*/, 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", 1 /*REQUEST_SENT*/, + 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", + 3 /*REMOTE_RESPONSE_RECEIVED*/, 1); + histogram_tester.ExpectBucketCount( + "Omnibox.ZeroSuggestProvider.URLBased.NonPrefetch", + 4 /*REMOTE_RESPONSE_CACHED*/, 1); + + // Expect the provider to not have notified the provider listener since the + // matches were not updated. + EXPECT_FALSE(provider_did_notify_); + + // Expect the same results after the response has been handled. + ASSERT_EQ(3U, provider_->matches().size()); // 3 results, no verbatim match + EXPECT_EQ(u"search4", provider_->matches()[0].contents); + EXPECT_EQ(u"search5", provider_->matches()[1].contents); + EXPECT_EQ(u"search6", provider_->matches()[2].contents); + + // Expect the new response to have been stored in the pref. + EXPECT_EQ(json_response3, + omnibox::GetUserPreferenceForZeroSuggestCachedResponse( + prefs, input.current_url().spec())); + } +}
diff --git a/components/reporting/OWNERS b/components/reporting/OWNERS index adaf75c..3b729b5 100644 --- a/components/reporting/OWNERS +++ b/components/reporting/OWNERS
@@ -6,3 +6,4 @@ scmoreno@google.com vshenvi@google.com xuhong@chromium.org +# Buganizer component: Chrome OS Server Projects > Enterprise Management > Reporting \ No newline at end of file
diff --git a/components/segmentation_platform/internal/config_parser.cc b/components/segmentation_platform/internal/config_parser.cc index 5f8b934c..b6f8f33 100644 --- a/components/segmentation_platform/internal/config_parser.cc +++ b/components/segmentation_platform/internal/config_parser.cc
@@ -64,7 +64,8 @@ } config->segments.insert( - {static_cast<proto::SegmentId>(segment), {*segment_uma_name}}); + {static_cast<proto::SegmentId>(segment), + std::make_unique<Config::SegmentMetadata>(*segment_uma_name)}); } return config;
diff --git a/components/segmentation_platform/internal/config_parser_unittest.cc b/components/segmentation_platform/internal/config_parser_unittest.cc index 2fbec70..efd64a7 100644 --- a/components/segmentation_platform/internal/config_parser_unittest.cc +++ b/components/segmentation_platform/internal/config_parser_unittest.cc
@@ -3,12 +3,18 @@ // found in the LICENSE file. #include "components/segmentation_platform/internal/config_parser.h" +#include <memory> #include "components/segmentation_platform/public/config.h" #include "testing/gtest/include/gtest/gtest.h" namespace segmentation_platform { +bool operator==(const std::unique_ptr<Config::SegmentMetadata>& a, + const std::unique_ptr<Config::SegmentMetadata>& b) { + return *a == *b; +} + TEST(ConfigParserTest, ParseInvalidConfig) { constexpr char kInvalidJson[] = R"({"segmentation_key":"test_key, "uma_name":})"; @@ -33,14 +39,18 @@ ASSERT_TRUE(config1); EXPECT_EQ(config1->segmentation_key, "test_key"); EXPECT_EQ(config1->segmentation_uma_name, "TestKey"); - std::unordered_map<proto::SegmentId, Config::SegmentMetadata> expected1{ + base::flat_map<proto::SegmentId, std::unique_ptr<Config::SegmentMetadata>> + expected1; + expected1.insert( {proto::SegmentId::OPTIMIZATION_TARGET_MODEL_VALIDATION, - Config::SegmentMetadata{"HighEngagement"}}, + std::make_unique<Config::SegmentMetadata>("HighEngagement")}); + expected1.insert( {proto::SegmentId:: OPTIMIZATION_TARGET_NOTIFICATION_PERMISSION_PREDICTIONS, - Config::SegmentMetadata{"MediumEngagement"}}, + std::make_unique<Config::SegmentMetadata>("MediumEngagement")}); + expected1.insert( {proto::SegmentId::OPTIMIZATION_TARGET_LANGUAGE_DETECTION, - Config::SegmentMetadata{"LowEngagement"}}}; + std::make_unique<Config::SegmentMetadata>("LowEngagement")}); EXPECT_EQ(config1->segments, expected1); EXPECT_EQ(config1->segment_selection_ttl, base::Days(10)); EXPECT_EQ(config1->unknown_selection_ttl, base::Days(0)); @@ -58,10 +68,11 @@ ASSERT_TRUE(config2); EXPECT_EQ(config2->segmentation_key, "test_key"); EXPECT_EQ(config2->segmentation_uma_name, "TestKey"); - std::unordered_map<proto::SegmentId, Config::SegmentMetadata> expected2{ - {proto::SegmentId:: - OPTIMIZATION_TARGET_NOTIFICATION_PERMISSION_PREDICTIONS, - Config::SegmentMetadata{"FeedUser"}}}; + base::flat_map<proto::SegmentId, std::unique_ptr<Config::SegmentMetadata>> + expected2; + expected2.insert({proto::SegmentId:: + OPTIMIZATION_TARGET_NOTIFICATION_PERMISSION_PREDICTIONS, + std::make_unique<Config::SegmentMetadata>("FeedUser")}); EXPECT_EQ(config2->segments, expected2); EXPECT_EQ(config2->segment_selection_ttl, base::Days(10)); EXPECT_EQ(config2->unknown_selection_ttl, base::Days(14));
diff --git a/components/segmentation_platform/internal/data_collection/training_data_collector_impl_unittest.cc b/components/segmentation_platform/internal/data_collection/training_data_collector_impl_unittest.cc index 6b9a165..3e6c455 100644 --- a/components/segmentation_platform/internal/data_collection/training_data_collector_impl_unittest.cc +++ b/components/segmentation_platform/internal/data_collection/training_data_collector_impl_unittest.cc
@@ -87,9 +87,10 @@ configs_[0]->segmentation_key = kSegmentationKey; configs_[0]->segments.insert( {SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB, - {"UmaNameNewTab"}}); + std::make_unique<Config::SegmentMetadata>("UmaNameNewTab")}); configs_[0]->segments.insert( - {SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_SHARE, {"UmaNameShare"}}); + {SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_SHARE, + std::make_unique<Config::SegmentMetadata>("UmaNameShare")}); SegmentationResultPrefs result_prefs(&prefs_); SelectedSegment selected_segment(
diff --git a/components/segmentation_platform/internal/segmentation_platform_service_test_base.cc b/components/segmentation_platform/internal/segmentation_platform_service_test_base.cc index e425c96..2ebe0d2 100644 --- a/components/segmentation_platform/internal/segmentation_platform_service_test_base.cc +++ b/components/segmentation_platform/internal/segmentation_platform_service_test_base.cc
@@ -21,11 +21,10 @@ namespace { -#define SEGMENT_ID_ENTRY(segment) \ - { \ - segment, Config::SegmentMetadata { \ - stats::OptimizationTargetToHistogramVariant(segment) \ - } \ +#define SEGMENT_ID_ENTRY(segment) \ + { \ + segment, std::make_unique<Config::SegmentMetadata>( \ + stats::OptimizationTargetToHistogramVariant(segment)) \ } class MockFieldTrialRegister : public FieldTrialRegister { @@ -45,26 +44,28 @@ std::unique_ptr<Config> config = std::make_unique<Config>(); config->segmentation_key = kTestSegmentationKey1; config->segment_selection_ttl = base::Days(28); - config->segments = { - SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB), - SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_SHARE)}; + config->segments.insert( + SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB)); + config->segments.insert( + SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_SHARE)); configs.push_back(std::move(config)); } { std::unique_ptr<Config> config = std::make_unique<Config>(); config->segmentation_key = kTestSegmentationKey2; config->segment_selection_ttl = base::Days(10); - config->segments = { - SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_SHARE), - SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_VOICE)}; + config->segments.insert( + SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_SHARE)); + config->segments.insert( + SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_VOICE)); configs.push_back(std::move(config)); } { std::unique_ptr<Config> config = std::make_unique<Config>(); config->segmentation_key = kTestSegmentationKey3; config->segment_selection_ttl = base::Days(14); - config->segments = { - SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB)}; + config->segments.insert( + SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB)); configs.push_back(std::move(config)); } {
diff --git a/components/segmentation_platform/internal/selection/segment_selector_unittest.cc b/components/segmentation_platform/internal/selection/segment_selector_unittest.cc index b7427cff..357ad744 100644 --- a/components/segmentation_platform/internal/selection/segment_selector_unittest.cc +++ b/components/segmentation_platform/internal/selection/segment_selector_unittest.cc
@@ -7,7 +7,6 @@ #include "base/run_loop.h" #include "base/test/simple_test_clock.h" #include "base/test/task_environment.h" -#include "components/segmentation_platform/internal/constants.h" #include "components/segmentation_platform/internal/database/mock_signal_storage_config.h" #include "components/segmentation_platform/internal/database/segment_info_database.h" #include "components/segmentation_platform/internal/database/test_segment_info_database.h" @@ -33,11 +32,10 @@ namespace { -#define SEGMENT_ID_ENTRY(segment) \ - { \ - segment, Config::SegmentMetadata { \ - stats::OptimizationTargetToHistogramVariant(segment) \ - } \ +#define SEGMENT_ID_ENTRY(segment) \ + { \ + segment, std::make_unique<Config::SegmentMetadata>( \ + stats::OptimizationTargetToHistogramVariant(segment)) \ } class MockFieldTrialRegister : public FieldTrialRegister { @@ -58,9 +56,10 @@ config->segmentation_uma_name = "TestKey"; config->segment_selection_ttl = base::Days(28); config->unknown_selection_ttl = base::Days(14); - config->segments = { - SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB), - SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_SHARE)}; + config->segments.insert( + SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB)); + config->segments.insert( + SEGMENT_ID_ENTRY(SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_SHARE)); return config; } @@ -99,7 +98,7 @@ clock_.SetNow(base::Time::Now()); config_ = std::move(config); std::vector<proto::SegmentId> all_segments; - for (auto it : config_->segments) + for (const auto& it : config_->segments) all_segments.push_back(it.first); default_manager_ = std::make_unique<DefaultModelManager>(&provider_factory_, all_segments); @@ -332,8 +331,9 @@ TEST_F(SegmentSelectorTest, UnknownSegmentTtlExpiryForBooleanModel) { auto config = CreateTestConfig(); - config->segments = {SEGMENT_ID_ENTRY( - SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_CHROME_START_ANDROID)}; + config->segments.clear(); + config->segments.insert(SEGMENT_ID_ENTRY( + SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_CHROME_START_ANDROID)); SetUpWithConfig(std::move(config)); SegmentId segment_id =
diff --git a/components/segmentation_platform/internal/service_proxy_impl_unittest.cc b/components/segmentation_platform/internal/service_proxy_impl_unittest.cc index d4cd3c9..7a130a6a 100644 --- a/components/segmentation_platform/internal/service_proxy_impl_unittest.cc +++ b/components/segmentation_platform/internal/service_proxy_impl_unittest.cc
@@ -43,7 +43,8 @@ info.set_segment_id(segment_id); db_entries->insert( std::make_pair(base::NumberToString(static_cast<int>(segment_id)), info)); - config->segments.insert({segment_id, {"UmaName"}}); + config->segments.insert( + {segment_id, std::make_unique<Config::SegmentMetadata>("UmaName")}); return info; }
diff --git a/components/segmentation_platform/public/config.cc b/components/segmentation_platform/public/config.cc index 303b1f1..eeceafa 100644 --- a/components/segmentation_platform/public/config.cc +++ b/components/segmentation_platform/public/config.cc
@@ -3,11 +3,25 @@ // found in the LICENSE file. #include "components/segmentation_platform/public/config.h" +#include <memory> #include "base/strings/strcat.h" +#include "components/segmentation_platform/public/model_provider.h" namespace segmentation_platform { +Config::SegmentMetadata::SegmentMetadata(const std::string& uma_name) + : uma_name(uma_name) {} + +Config::SegmentMetadata::SegmentMetadata( + const std::string& uma_name, + std::unique_ptr<ModelProvider> default_model) + : uma_name(uma_name), default_provider(std::move(default_model)) {} + +Config::SegmentMetadata::SegmentMetadata(SegmentMetadata&& other) = default; + +Config::SegmentMetadata::~SegmentMetadata() = default; + bool Config::SegmentMetadata::operator==(const SegmentMetadata& other) const { return other.uma_name == uma_name; } @@ -26,7 +40,7 @@ if (it == segments.end()) { return "Other"; } - return it->second.uma_name; + return it->second->uma_name; } } // namespace segmentation_platform
diff --git a/components/segmentation_platform/public/config.h b/components/segmentation_platform/public/config.h index 849413c5..b52d1ad 100644 --- a/components/segmentation_platform/public/config.h +++ b/components/segmentation_platform/public/config.h
@@ -6,11 +6,11 @@ #define COMPONENTS_SEGMENTATION_PLATFORM_PUBLIC_CONFIG_H_ #include <string> -#include <unordered_map> #include "base/containers/flat_map.h" #include "base/time/time.h" #include "components/segmentation_platform/public/input_delegate.h" +#include "components/segmentation_platform/public/model_provider.h" #include "components/segmentation_platform/public/proto/model_metadata.pb.h" #include "components/segmentation_platform/public/proto/segmentation_platform.pb.h" #include "components/segmentation_platform/public/trigger.h" @@ -86,12 +86,25 @@ // List of segments needed to make a selection. struct SegmentMetadata { + explicit SegmentMetadata(const std::string& uma_name); + SegmentMetadata(const std::string& uma_name, + std::unique_ptr<ModelProvider> default_provider); + SegmentMetadata(SegmentMetadata&&); + + ~SegmentMetadata(); + + bool operator==(const SegmentMetadata& other) const; + // The name used for this segment in UMA filters. std::string uma_name; - bool operator==(const SegmentMetadata& other) const; + // The default model or score used when server provided model is + // unavailable. + // TODO(crbug.com/1346389): This field is unused and being migrated from + // ModelProviderFactory. + std::unique_ptr<ModelProvider> default_provider; }; - std::unordered_map<proto::SegmentId, SegmentMetadata> segments; + base::flat_map<proto::SegmentId, std::unique_ptr<SegmentMetadata>> segments; // The selection only supports returning results from on-demand model // executions instead of returning result from previous sessions. The
diff --git a/components/services/app_service/public/cpp/intent_util.cc b/components/services/app_service/public/cpp/intent_util.cc index 9bed98f1..7ef31e4 100644 --- a/components/services/app_service/public/cpp/intent_util.cc +++ b/components/services/app_service/public/cpp/intent_util.cc
@@ -761,9 +761,9 @@ } absl::optional<std::string> GetStringValueFromDict( - const base::DictionaryValue& dict, + const base::Value::Dict& dict, const std::string& key_name) { - const base::Value* value = dict.FindKey(key_name); + const base::Value* value = dict.Find(key_name); if (!value) return absl::nullopt; @@ -774,14 +774,14 @@ return *string_value; } -absl::optional<bool> GetBoolValueFromDict(const base::DictionaryValue& dict, +absl::optional<bool> GetBoolValueFromDict(const base::Value::Dict& dict, const std::string& key_name) { - return dict.FindBoolKey(key_name); + return dict.FindBool(key_name); } -absl::optional<GURL> GetGurlValueFromDict(const base::DictionaryValue& dict, +absl::optional<GURL> GetGurlValueFromDict(const base::Value::Dict& dict, const std::string& key_name) { - const std::string* url_spec = dict.FindStringKey(key_name); + const std::string* url_spec = dict.FindString(key_name); if (!url_spec) return absl::nullopt; @@ -792,15 +792,14 @@ return url; } -std::vector<apps::IntentFilePtr> GetFilesFromDict( - const base::DictionaryValue& dict, - const std::string& key_name) { - const base::Value* value = dict.FindListKey(key_name); - if (!value || !value->is_list() || value->GetListDeprecated().empty()) +std::vector<apps::IntentFilePtr> GetFilesFromDict(const base::Value::Dict& dict, + const std::string& key_name) { + const base::Value::List* value = dict.FindList(key_name); + if (!value || value->empty()) return std::vector<apps::IntentFilePtr>(); std::vector<apps::IntentFilePtr> files; - for (const auto& item : value->GetListDeprecated()) { + for (const auto& item : *value) { GURL url(item.GetString()); if (url.is_valid()) { files.push_back(std::make_unique<apps::IntentFile>(url)); @@ -809,29 +808,28 @@ return files; } -std::vector<std::string> GetCategoriesFromDict( - const base::DictionaryValue& dict, - const std::string& key_name) { - const base::Value* value = dict.FindListKey(key_name); - if (!value || !value->is_list() || value->GetListDeprecated().empty()) +std::vector<std::string> GetCategoriesFromDict(const base::Value::Dict& dict, + const std::string& key_name) { + const base::Value::List* value = dict.FindList(key_name); + if (!value || value->empty()) return std::vector<std::string>(); std::vector<std::string> categories; - for (const auto& item : value->GetListDeprecated()) + for (const auto& item : *value) categories.push_back(item.GetString()); return categories; } base::flat_map<std::string, std::string> GetExtrasFromDict( - const base::DictionaryValue& dict, + const base::Value::Dict& dict, const std::string& key_name) { - const base::Value* value = dict.FindDictKey(key_name); - if (!value || !value->is_dict()) + const base::Value::Dict* value = dict.FindDict(key_name); + if (!value) return base::flat_map<std::string, std::string>(); base::flat_map<std::string, std::string> extras; - for (auto pair : value->DictItems()) { + for (auto pair : *value) { if (pair.second.is_string()) extras[pair.first] = pair.second.GetString(); } @@ -840,8 +838,8 @@ } apps::IntentPtr ConvertValueToIntent(base::Value&& value) { - base::DictionaryValue* dict = nullptr; - if (!value.is_dict() || !value.GetAsDictionary(&dict)) + base::Value::Dict* dict = value.GetIfDict(); + if (!dict) return nullptr; auto action = GetStringValueFromDict(*dict, kActionKey);
diff --git a/components/update_client/persisted_data.cc b/components/update_client/persisted_data.cc index 6bb32bd..c0009e96 100644 --- a/components/update_client/persisted_data.cc +++ b/components/update_client/persisted_data.cc
@@ -82,6 +82,10 @@ return !result.empty() ? base::StringPrintf("{%s}", result.c_str()) : result; } +int PersistedData::GetInstallDate(const std::string& id) const { + return GetInt(id, "installdate", kDateUnknown); +} + std::string PersistedData::GetCohort(const std::string& id) const { return GetString(id, "cohort"); } @@ -101,8 +105,10 @@ if (!apps) apps = root->SetKey("apps", base::Value(base::Value::Type::DICTIONARY)); base::Value* app = apps->FindDictKey(id); - if (!app) + if (!app) { app = apps->SetKey(id, base::Value(base::Value::Type::DICTIONARY)); + app->SetIntKey("installdate", kDateFirstTime); + } return app; } @@ -117,6 +123,8 @@ base::Value* app_key = GetOrCreateAppKey(id, update.Get()); app_key->SetIntKey("dlrc", datenum); app_key->SetStringKey("pf", base::GenerateGUID()); + if (GetInstallDate(id) == kDateFirstTime) + app_key->SetIntKey("installdate", datenum); if (active_ids.find(id) != active_ids.end()) { app_key->SetIntKey("dla", datenum); }
diff --git a/components/update_client/persisted_data.h b/components/update_client/persisted_data.h index 0b05086..2373a3af 100644 --- a/components/update_client/persisted_data.h +++ b/components/update_client/persisted_data.h
@@ -77,6 +77,12 @@ // This is called only via update_client's RegisterUpdateClientPreferences. static void RegisterPrefs(PrefRegistrySimple* registry); + // Returns the install date for the specified |id|. + // "InstallDate" refers to the initial date that the given |id| was first + // installed on the machine. Date information is returned by the server. If + // "InstallDate" is not known, -2 is returned. + int GetInstallDate(const std::string& id) const; + // These functions return cohort data for the specified |id|. "Cohort" // indicates the membership of the client in any release channels components // have set up in a machine-readable format, while "CohortName" does so in a
diff --git a/components/update_client/persisted_data_unittest.cc b/components/update_client/persisted_data_unittest.cc index be1d39f..e0b6ad08 100644 --- a/components/update_client/persisted_data_unittest.cc +++ b/components/update_client/persisted_data_unittest.cc
@@ -26,12 +26,16 @@ EXPECT_EQ(-2, metadata->GetDaysSinceLastRollCall("someappid")); EXPECT_EQ(-2, metadata->GetDaysSinceLastActive("someappid")); EXPECT_EQ(-2, metadata->GetDaysSinceLastActive("someappid.withdot")); + EXPECT_EQ(-2, metadata->GetInstallDate("someappid")); + EXPECT_EQ(-2, metadata->GetInstallDate("someappid.withdot")); std::vector<std::string> items; items.push_back("someappid"); items.push_back("someappid.withdot"); test::SetDateLastData(metadata.get(), items, 3383); EXPECT_EQ(3383, metadata->GetDateLastRollCall("someappid")); EXPECT_EQ(3383, metadata->GetDateLastRollCall("someappid.withdot")); + EXPECT_EQ(3383, metadata->GetInstallDate("someappid")); + EXPECT_EQ(3383, metadata->GetInstallDate("someappid.withdot")); EXPECT_EQ(-2, metadata->GetDateLastActive("someappid")); EXPECT_EQ(-2, metadata->GetDateLastActive("someappid.withdot")); EXPECT_EQ(-2, metadata->GetDaysSinceLastRollCall("someappid")); @@ -44,6 +48,7 @@ EXPECT_FALSE(pf1.empty()); test::SetDateLastData(metadata.get(), items, 3386); EXPECT_EQ(3386, metadata->GetDateLastRollCall("someappid")); + EXPECT_EQ(3383, metadata->GetInstallDate("someappid")); EXPECT_EQ(-2, metadata->GetDateLastActive("someappid")); EXPECT_EQ(-2, metadata->GetDaysSinceLastRollCall("someappid")); EXPECT_EQ(-2, metadata->GetDaysSinceLastActive("someappid")); @@ -51,6 +56,8 @@ EXPECT_EQ(-2, metadata->GetDateLastActive("someotherappid")); EXPECT_EQ(-2, metadata->GetDaysSinceLastRollCall("someotherappid")); EXPECT_EQ(-2, metadata->GetDaysSinceLastActive("someotherappid")); + EXPECT_EQ(-2, metadata->GetInstallDate("someotherappid")); + const std::string pf2 = metadata->GetPingFreshness("someappid"); EXPECT_FALSE(pf2.empty()); // The following has a 1 / 2^128 chance of being flaky. @@ -75,6 +82,7 @@ EXPECT_EQ(-2, metadata->GetDateLastActive("someappid")); EXPECT_EQ(-2, metadata->GetDaysSinceLastRollCall("someappid")); EXPECT_EQ(-2, metadata->GetDaysSinceLastActive("someappid")); + EXPECT_EQ(-2, metadata->GetInstallDate("someappid")); std::vector<std::string> items; items.push_back("someappid"); test::SetDateLastData(metadata.get(), items, 3383); @@ -86,10 +94,12 @@ EXPECT_EQ(-2, metadata->GetDateLastActive("someappid")); EXPECT_EQ(-2, metadata->GetDaysSinceLastRollCall("someappid")); EXPECT_EQ(-2, metadata->GetDaysSinceLastActive("someappid")); + EXPECT_EQ(3383, metadata->GetInstallDate("someappid")); EXPECT_EQ(-2, metadata->GetDateLastRollCall("someotherappid")); EXPECT_EQ(-2, metadata->GetDateLastActive("someotherappid")); EXPECT_EQ(-2, metadata->GetDaysSinceLastRollCall("someotherappid")); EXPECT_EQ(-2, metadata->GetDaysSinceLastActive("someotherappid")); + EXPECT_EQ(-2, metadata->GetInstallDate("someotherappid")); } TEST(PersistedDataTest, SimpleCohort) { @@ -144,6 +154,7 @@ EXPECT_EQ(-2, metadata->GetDateLastRollCall(item)); EXPECT_EQ(-2, metadata->GetDaysSinceLastActive(item)); EXPECT_EQ(-2, metadata->GetDaysSinceLastRollCall(item)); + EXPECT_EQ(-2, metadata->GetInstallDate(item)); EXPECT_EQ(false, test::GetActiveBit(metadata.get(), item)); } @@ -152,6 +163,7 @@ EXPECT_EQ(false, test::GetActiveBit(metadata.get(), item)); EXPECT_EQ(-2, metadata->GetDateLastActive(item)); EXPECT_EQ(1234, metadata->GetDateLastRollCall(item)); + EXPECT_EQ(1234, metadata->GetInstallDate(item)); EXPECT_EQ(-2, metadata->GetDaysSinceLastActive(item)); EXPECT_EQ(-2, metadata->GetDaysSinceLastRollCall(item)); } @@ -189,6 +201,9 @@ EXPECT_EQ(6789, metadata->GetDateLastRollCall("id1")); EXPECT_EQ(6789, metadata->GetDateLastRollCall("id2")); EXPECT_EQ(6789, metadata->GetDateLastRollCall("id3")); + EXPECT_EQ(1234, metadata->GetInstallDate("id1")); + EXPECT_EQ(1234, metadata->GetInstallDate("id2")); + EXPECT_EQ(1234, metadata->GetInstallDate("id3")); } } // namespace update_client
diff --git a/components/update_client/ping_manager.cc b/components/update_client/ping_manager.cc index f220a97..f175154 100644 --- a/components/update_client/ping_manager.cc +++ b/components/update_client/ping_manager.cc
@@ -98,7 +98,8 @@ apps.push_back(MakeProtocolApp( component.id(), component.crx_component()->version, component.crx_component()->ap, component.crx_component()->brand, - config_->GetLang(), component.crx_component()->install_source, + config_->GetLang(), metadata.GetInstallDate(component.id()), + component.crx_component()->install_source, component.crx_component()->install_location, component.crx_component()->fingerprint, component.crx_component()->installer_attributes,
diff --git a/components/update_client/ping_manager_unittest.cc b/components/update_client/ping_manager_unittest.cc index f04c82bb..841a631 100644 --- a/components/update_client/ping_manager_unittest.cc +++ b/components/update_client/ping_manager_unittest.cc
@@ -184,6 +184,7 @@ EXPECT_EQ("ap1", app.FindKey("ap")->GetString()); EXPECT_EQ("BRND", app.FindKey("brand")->GetString()); EXPECT_EQ("fake_lang", app.FindKey("lang")->GetString()); + EXPECT_EQ(-1, app.FindKey("installdate")->GetInt()); EXPECT_EQ("1.0", app.FindKey("version")->GetString()); EXPECT_EQ("c1", app.FindKey("cohort")->GetString()); EXPECT_EQ("cn1", app.FindKey("cohortname")->GetString());
diff --git a/components/update_client/protocol_definition.h b/components/update_client/protocol_definition.h index c2e5dc53..5c69742 100644 --- a/components/update_client/protocol_definition.h +++ b/components/update_client/protocol_definition.h
@@ -13,6 +13,7 @@ #include "base/containers/flat_map.h" #include "base/values.h" #include "build/build_config.h" +#include "components/update_client/activity_data_service.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace update_client { @@ -125,6 +126,7 @@ base::flat_map<std::string, std::string> installer_attributes; std::string lang; std::string brand_code; + int install_date = kDateUnknown; std::string install_source; std::string install_location; std::string fingerprint;
diff --git a/components/update_client/protocol_serializer.cc b/components/update_client/protocol_serializer.cc index 408e99b..9e520a3f 100644 --- a/components/update_client/protocol_serializer.cc +++ b/components/update_client/protocol_serializer.cc
@@ -200,6 +200,7 @@ const std::string& ap, const std::string& brand_code, const std::string& lang, + const int install_date, const std::string& install_source, const std::string& install_location, const std::string& fingerprint, @@ -220,6 +221,7 @@ app.events = std::move(events); app.brand_code = FilterBrandCode(brand_code); app.lang = lang; + app.install_date = install_date; app.install_source = install_source; app.install_location = install_location; app.fingerprint = fingerprint;
diff --git a/components/update_client/protocol_serializer.h b/components/update_client/protocol_serializer.h index 2cc829e..08444ca 100644 --- a/components/update_client/protocol_serializer.h +++ b/components/update_client/protocol_serializer.h
@@ -52,6 +52,7 @@ const std::string& ap, const std::string& brand_code, const std::string& lang, + int install_date, const std::string& install_source, const std::string& install_location, const std::string& fingerprint,
diff --git a/components/update_client/protocol_serializer_json.cc b/components/update_client/protocol_serializer_json.cc index 866ab5d..545f5794 100644 --- a/components/update_client/protocol_serializer_json.cc +++ b/components/update_client/protocol_serializer_json.cc
@@ -12,6 +12,7 @@ #include "base/values.h" #include "build/branding_buildflags.h" #include "build/build_config.h" +#include "components/update_client/activity_data_service.h" namespace update_client { @@ -102,6 +103,8 @@ app_node.Set("brand", app.brand_code); if (!app.lang.empty()) app_node.Set("lang", app.lang); + if (app.install_date != kDateUnknown) + app_node.Set("installdate", app.install_date); if (!app.install_source.empty()) app_node.Set("installsource", app.install_source); if (!app.install_location.empty())
diff --git a/components/update_client/protocol_serializer_json_unittest.cc b/components/update_client/protocol_serializer_json_unittest.cc index 5dfa820..b211182 100644 --- a/components/update_client/protocol_serializer_json_unittest.cc +++ b/components/update_client/protocol_serializer_json_unittest.cc
@@ -49,7 +49,7 @@ std::vector<protocol_request::App> apps; apps.push_back(MakeProtocolApp( - "id1", base::Version("1.0"), "ap1", "BRND", "lang", "source1", + "id1", base::Version("1.0"), "ap1", "BRND", "lang", -1, "source1", "location1", "fp1", {{"attr1", "1"}, {"attr2", "2"}}, "c1", "ch1", "cn1", "test", {0, 1}, MakeProtocolUpdateCheck(true, "33.12", true, false), @@ -69,6 +69,7 @@ R"("data":\[{"index":"foobar_install_data_index","name":"install"}],)" R"("disabled":\[{"reason":0},{"reason":1}],"enabled":false,)" R"("event":\[{"a":1,"b":"2"},{"error":0}],)" + R"("installdate":-1,)" R"("installedby":"location1","installsource":"source1",)" R"("lang":"lang",)" R"("packages":{"package":\[{"fp":"fp1"}]},)" @@ -94,9 +95,9 @@ // Tests `sameversionupdate` presence with a minimal request for one app. std::vector<protocol_request::App> apps; apps.push_back(MakeProtocolApp( - "id1", base::Version("1.0"), "", "", "", "", "", "", {}, "", "", "", "", - {}, MakeProtocolUpdateCheck(false, "", false, true), {}, absl::nullopt, - absl::nullopt)); + "id1", base::Version("1.0"), "", "", "", -2, "", "", "", {}, "", "", "", + "", {}, MakeProtocolUpdateCheck(false, "", false, true), {}, + absl::nullopt, absl::nullopt)); const auto request = std::make_unique<ProtocolSerializerJSON>()->Serialize( MakeProtocolRequest(false, "{15160585-8ADE-4D3C-839B-1281A6035D1F}", "",
diff --git a/components/update_client/update_checker.cc b/components/update_client/update_checker.cc index 8b7c644..b2dec0f1 100644 --- a/components/update_client/update_checker.cc +++ b/components/update_client/update_checker.cc
@@ -23,6 +23,7 @@ #include "base/threading/thread_checker.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" +#include "components/update_client/activity_data_service.h" #include "components/update_client/component.h" #include "components/update_client/configurator.h" #include "components/update_client/persisted_data.h" @@ -187,11 +188,11 @@ apps.push_back(MakeProtocolApp( app_id, crx_component->version, crx_component->ap, crx_component->brand, - config_->GetLang(), install_source, crx_component->install_location, - crx_component->fingerprint, crx_component->installer_attributes, - metadata_->GetCohort(app_id), metadata_->GetCohortName(app_id), - metadata_->GetCohortHint(app_id), crx_component->channel, - crx_component->disabled_reasons, + config_->GetLang(), metadata_->GetInstallDate(app_id), install_source, + crx_component->install_location, crx_component->fingerprint, + crx_component->installer_attributes, metadata_->GetCohort(app_id), + metadata_->GetCohortName(app_id), metadata_->GetCohortHint(app_id), + crx_component->channel, crx_component->disabled_reasons, MakeProtocolUpdateCheck(!crx_component->updates_enabled, crx_component->target_version_prefix, crx_component->rollback_allowed,
diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm index e4246c8..e26ed62 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
@@ -212,7 +212,8 @@ withHostHelper:(RenderWidgetHostNSViewHostHelper*)hostHelper { self = [super initWithFrame:NSZeroRect]; if (self) { - self.allowedTouchTypes |= NSTouchTypeMaskDirect; + // Enable trackpad touches ("direct" touches are touchbar touches). + self.allowedTouchTypes |= NSTouchTypeMaskIndirect; _editCommandHelper = std::make_unique<RenderWidgetHostViewMacEditCommandHelper>();
diff --git a/content/browser/accessibility/browser_accessibility_manager.cc b/content/browser/accessibility/browser_accessibility_manager.cc index d2d270c..4b86011 100644 --- a/content/browser/accessibility/browser_accessibility_manager.cc +++ b/content/browser/accessibility/browser_accessibility_manager.cc
@@ -174,17 +174,17 @@ BrowserAccessibilityManager::BrowserAccessibilityManager( BrowserAccessibilityDelegate* delegate) - : WebContentsObserver(delegate + : AXPlatformTreeManager(ui::AXTreeIDUnknown(), + std::make_unique<ui::AXSerializableTree>()), + WebContentsObserver(delegate ? WebContents::FromRenderFrameHost( delegate->AccessibilityRenderFrameHost()) : nullptr), delegate_(delegate), user_is_navigating_away_(false), connected_to_parent_tree_node_(false), - ax_tree_id_(ui::AXTreeIDUnknown()), device_scale_factor_(1.0f), use_custom_device_scale_factor_for_testing_(false), - tree_(std::make_unique<ui::AXSerializableTree>()), event_generator_(ax_tree()) { tree_observation_.Observe(ax_tree()); } @@ -192,16 +192,16 @@ BrowserAccessibilityManager::BrowserAccessibilityManager( const ui::AXTreeUpdate& initial_tree, BrowserAccessibilityDelegate* delegate) - : WebContentsObserver(delegate + : AXPlatformTreeManager(ui::AXTreeIDUnknown(), + std::make_unique<ui::AXSerializableTree>()), + WebContentsObserver(delegate ? WebContents::FromRenderFrameHost( delegate->AccessibilityRenderFrameHost()) : nullptr), delegate_(delegate), user_is_navigating_away_(false), - ax_tree_id_(ui::AXTreeIDUnknown()), device_scale_factor_(1.0f), use_custom_device_scale_factor_for_testing_(false), - tree_(std::make_unique<ui::AXSerializableTree>()), event_generator_(ax_tree()) { tree_observation_.Observe(ax_tree()); Initialize(initial_tree); @@ -1709,7 +1709,7 @@ } ui::AXTreeID BrowserAccessibilityManager::GetTreeID() const { - return ax_tree_id(); + return ax_tree_id_; } ui::AXTreeID BrowserAccessibilityManager::GetParentTreeID() const { @@ -1717,11 +1717,11 @@ } ui::AXNode* BrowserAccessibilityManager::GetRootAsAXNode() const { - // tree_ is nullptr after destruction. + // ax_tree_ is nullptr after destruction. if (!ax_tree()) return nullptr; - // tree_->root() can be null during AXTreeObserver callbacks. + // ax_tree_->root() can be null during AXTreeObserver callbacks. return ax_tree()->root(); } @@ -1859,7 +1859,7 @@ ui::AXTreeUpdate BrowserAccessibilityManager::SnapshotAXTreeForTesting() { std::unique_ptr<ui::AXTreeSource<const ui::AXNode*>> tree_source( - tree_->CreateTreeSource()); + ax_serializable_tree()->CreateTreeSource()); ui::AXTreeSerializer<const ui::AXNode*> serializer(tree_source.get()); ui::AXTreeUpdate update; serializer.SerializeChanges(GetRootAsAXNode(), &update);
diff --git a/content/browser/accessibility/browser_accessibility_manager.h b/content/browser/accessibility/browser_accessibility_manager.h index bc6e77f..29a8cdbd 100644 --- a/content/browser/accessibility/browser_accessibility_manager.h +++ b/content/browser/accessibility/browser_accessibility_manager.h
@@ -139,8 +139,7 @@ // Manages a tree of BrowserAccessibility objects. class CONTENT_EXPORT BrowserAccessibilityManager - : public ui::AXTreeObserver, - public ui::AXPlatformTreeManager, + : public ui::AXPlatformTreeManager, public WebContentsObserver { public: // Creates the platform-specific BrowserAccessibilityManager. @@ -463,11 +462,11 @@ // measure while the flatland migration is in progress (fxbug.dev/90502). virtual void UpdateDeviceScaleFactor(); - // Accessors. - ui::AXTreeID ax_tree_id() const { return ax_tree_id_; } - float device_scale_factor() const; - ui::AXTree* ax_tree() const { return tree_.get(); } + + ui::AXSerializableTree* ax_serializable_tree() const { + return static_cast<ui::AXSerializableTree*>(ax_tree()); + } // AXTreeObserver implementation. void OnTreeDataChanged(ui::AXTree* tree, @@ -626,9 +625,6 @@ // once when this subtree is first connected. bool connected_to_parent_tree_node_; - // The global ID of this accessibility tree. - ui::AXTreeID ax_tree_id_; - // The device scale factor for the view associated with this frame, // cached each time there's any update to the accessibility tree. float device_scale_factor_; @@ -710,9 +706,6 @@ BrowserAccessibility* AXTreeHitTest( const gfx::Point& blink_screen_point) const; - // The underlying tree of accessibility objects. - std::unique_ptr<ui::AXSerializableTree> tree_; - ui::AXEventGenerator event_generator_; // Only used on the root node for AXTree hit testing as an alternative to
diff --git a/content/browser/client_hints/client_hints.cc b/content/browser/client_hints/client_hints.cc index 462f4634..b9cbfdb 100644 --- a/content/browser/client_hints/client_hints.cc +++ b/content/browser/client_hints/client_hints.cc
@@ -553,8 +553,8 @@ outermost_main_frame_origin = resource_origin; is_1p_origin = true; } else if (frame_tree_node->IsInFencedFrameTree()) { - permissions_policy = - blink::PermissionsPolicy::CreateForFencedFrame(resource_origin); + permissions_policy = blink::PermissionsPolicy::CreateForFencedFrame( + resource_origin, frame_tree_node->GetFencedFrameMode().value()); } else { RenderFrameHostImpl* outermost_main_frame = frame_tree_node->frame_tree() ->GetMainFrame()
diff --git a/content/browser/fenced_frame/fenced_frame.cc b/content/browser/fenced_frame/fenced_frame.cc index c489714..7469de96 100644 --- a/content/browser/fenced_frame/fenced_frame.cc +++ b/content/browser/fenced_frame/fenced_frame.cc
@@ -61,36 +61,7 @@ /*page_delegate=*/web_contents_, FrameTree::Type::kFencedFrame, devtools_frame_token)), - mode_(mode) { - scoped_refptr<SiteInstance> site_instance = - SiteInstanceImpl::CreateForFencedFrame( - owner_render_frame_host->GetSiteInstance()); - - // Set the mandatory sandbox flags from the beginning. - blink::FramePolicy frame_policy; - frame_policy.sandbox_flags = blink::kFencedFrameForcedSandboxFlags; - // Note that even though this is happening in response to an event in the - // renderer (i.e., the creation of a <fencedframe> element), we are still - // putting `renderer_initiated_creation` as false. This is because that - // parameter is only used when a renderer is creating a new window and has - // already created the main frame for the window, but wants the browser to - // refrain from showing the main frame until the renderer signals the browser - // via the mojom.LocalMainFrameHost.ShowCreatedWindow(). This flow does not - // apply for fenced frames, portals, and prerendered nested FrameTrees, hence - // the decision to mark it as false. - frame_tree_->Init(site_instance.get(), /*renderer_initiated_creation=*/false, - /*main_frame_name=*/"", /*opener_for_origin=*/nullptr, - frame_policy); - // Note that pending frame policy will be passed as `frame_policy` in - // `replication_state` in `mojom::CreateFrameParams`. - // See `RenderFrameHostImpl::CreateRenderFrame`. - frame_tree_->root()->SetPendingFramePolicy(frame_policy); - - // TODO(crbug.com/1199679): This should be moved to FrameTree::Init. - web_contents_->NotifySwappedFromRenderManager( - /*old_frame=*/nullptr, - frame_tree_->root()->render_manager()->current_frame_host()); -} + mode_(mode) {} FencedFrame::~FencedFrame() { DCHECK(frame_tree_); @@ -180,11 +151,42 @@ return web_contents_->LoadingTree(); } -RenderFrameProxyHost* FencedFrame::CreateProxyAndAttachToOuterFrameTree( +RenderFrameProxyHost* +FencedFrame::InitInnerFrameTreeAndReturnProxyToOuterFrameTree( blink::mojom::RemoteFrameInterfacesFromRendererPtr remote_frame_interfaces, const blink::RemoteFrameToken& frame_token) { DCHECK(remote_frame_interfaces); DCHECK(outer_delegate_frame_tree_node_); + + scoped_refptr<SiteInstance> site_instance = + SiteInstanceImpl::CreateForFencedFrame( + owner_render_frame_host_->GetSiteInstance()); + + // Set the mandatory sandbox flags from the beginning. + blink::FramePolicy frame_policy; + frame_policy.sandbox_flags = blink::kFencedFrameForcedSandboxFlags; + // Note that even though this is happening in response to an event in the + // renderer (i.e., the creation of a <fencedframe> element), we are still + // putting `renderer_initiated_creation` as false. This is because that + // parameter is only used when a renderer is creating a new window and has + // already created the main frame for the window, but wants the browser to + // refrain from showing the main frame until the renderer signals the browser + // via the mojom.LocalMainFrameHost.ShowCreatedWindow(). This flow does not + // apply for fenced frames, portals, and prerendered nested FrameTrees, hence + // the decision to mark it as false. + frame_tree_->Init(site_instance.get(), /*renderer_initiated_creation=*/false, + /*main_frame_name=*/"", /*opener_for_origin=*/nullptr, + frame_policy); + // Note that pending frame policy will be passed as `frame_policy` in + // `replication_state` in `mojom::CreateFrameParams`. + // See `RenderFrameHostImpl::CreateRenderFrame`. + frame_tree_->root()->SetPendingFramePolicy(frame_policy); + + // TODO(crbug.com/1199679): This should be moved to FrameTree::Init. + web_contents_->NotifySwappedFromRenderManager( + /*old_frame=*/nullptr, + frame_tree_->root()->render_manager()->current_frame_host()); + // Connect the outer delegate RenderFrameHost with the inner main // FrameTreeNode. This allows us to traverse from the outer delegate RFH // inward, to the inner fenced frame FrameTree.
diff --git a/content/browser/fenced_frame/fenced_frame.h b/content/browser/fenced_frame/fenced_frame.h index b8a6136..9d5b3a5 100644 --- a/content/browser/fenced_frame/fenced_frame.h +++ b/content/browser/fenced_frame/fenced_frame.h
@@ -49,7 +49,7 @@ // renderer. This creates a proxy representing the main frame of the inner // `FrameTree`, for use by the embedding RenderFrameHostImpl. // `remote_frame_interfaces` must not be null. - RenderFrameProxyHost* CreateProxyAndAttachToOuterFrameTree( + RenderFrameProxyHost* InitInnerFrameTreeAndReturnProxyToOuterFrameTree( blink::mojom::RemoteFrameInterfacesFromRendererPtr remote_frame_interfaces, const blink::RemoteFrameToken& frame_token); @@ -106,7 +106,7 @@ // frame FrameTree. It is a "dummy" child FrameTreeNode that `this` is // responsible for adding as a child of `owner_render_frame_host_`; it is // initially null, and only set in the constructor (indirectly via - // `CreateProxyAndAttachToOuterFrameTree()`). + // `InitInnerFrameTreeAndReturnProxyToOuterFrameTree()`). // Furthermore, the lifetime of `this` is directly tied to it (see // `OnFrameTreeNodeDestroyed()`). raw_ptr<FrameTreeNode> outer_delegate_frame_tree_node_ = nullptr;
diff --git a/content/browser/gpu/compositor_util.cc b/content/browser/gpu/compositor_util.cc index b2f76c804..00f29c3 100644 --- a/content/browser/gpu/compositor_util.cc +++ b/content/browser/gpu/compositor_util.cc
@@ -251,7 +251,7 @@ manager->IsGpuCompositingDisabledForHardwareGpu(); } - auto feature_status_dict = base::Value(base::Value::Type::DICTIONARY); + base::Value::Dict feature_status_dict; bool eof = false; for (size_t i = 0; !eof; ++i) { @@ -303,9 +303,9 @@ status += "_on"; } } - feature_status_dict.SetStringKey(gpu_feature_data.name, status); + feature_status_dict.Set(gpu_feature_data.name, status); } - return feature_status_dict; + return base::Value(std::move(feature_status_dict)); } base::Value GetProblemsImpl(GpuFeatureInfoType type) { @@ -326,7 +326,7 @@ manager->IsGpuCompositingDisabledForHardwareGpu(); } - auto problem_list = base::Value(base::Value::Type::LIST); + base::Value::List problem_list; if (!gpu_feature_info.applied_gpu_blocklist_entries.empty()) { std::unique_ptr<gpu::GpuBlocklist> blocklist(gpu::GpuBlocklist::Create()); blocklist->GetReasons(problem_list, "disabledFeatures", @@ -340,16 +340,15 @@ } if (gpu_access_blocked) { - auto problem = base::Value(base::Value::Type::DICTIONARY); - problem.SetStringKey("description", "GPU process was unable to boot: " + - gpu_access_blocked_reason); - problem.SetKey("crBugs", base::Value(base::Value::Type::LIST)); - auto disabled_features = base::Value(base::Value::Type::LIST); + base::Value::Dict problem; + problem.Set("description", + "GPU process was unable to boot: " + gpu_access_blocked_reason); + problem.Set("crBugs", base::Value::List()); + base::Value::List disabled_features; disabled_features.Append("all"); - problem.SetKey("affectedGpuSettings", std::move(disabled_features)); - problem.SetStringKey("tag", "disabledFeatures"); - problem_list.Insert(problem_list.GetListDeprecated().begin(), - std::move(problem)); + problem.Set("affectedGpuSettings", std::move(disabled_features)); + problem.Set("tag", "disabledFeatures"); + problem_list.Insert(problem_list.begin(), base::Value(std::move(problem))); } bool eof = false; @@ -358,19 +357,18 @@ gpu_feature_info, i, is_gpu_compositing_disabled, &eof); if (gpu_feature_data.disabled && gpu_feature_data.disabled_info.is_problem) { - auto problem = base::Value(base::Value::Type::DICTIONARY); - problem.SetStringKey("description", - gpu_feature_data.disabled_info.description); - problem.SetKey("crBugs", base::Value(base::Value::Type::LIST)); - auto disabled_features = base::Value(base::Value::Type::LIST); + base::Value::Dict problem; + problem.Set("description", gpu_feature_data.disabled_info.description); + problem.Set("crBugs", base::Value::List()); + base::Value::List disabled_features; disabled_features.Append(gpu_feature_data.name); - problem.SetKey("affectedGpuSettings", std::move(disabled_features)); - problem.SetStringKey("tag", "disabledFeatures"); - problem_list.Insert(problem_list.GetListDeprecated().begin(), - std::move(problem)); + problem.Set("affectedGpuSettings", std::move(disabled_features)); + problem.Set("tag", "disabledFeatures"); + problem_list.Insert(problem_list.begin(), + base::Value(std::move(problem))); } } - return problem_list; + return base::Value(std::move(problem_list)); } std::vector<std::string> GetDriverBugWorkaroundsImpl(GpuFeatureInfoType type) {
diff --git a/content/browser/network_context_client_base_impl.cc b/content/browser/network_context_client_base_impl.cc index b59031c..6e115639 100644 --- a/content/browser/network_context_client_base_impl.cc +++ b/content/browser/network_context_client_base_impl.cc
@@ -118,7 +118,7 @@ } void NetworkContextClientBase::OnCanSendDomainReliabilityUpload( - const GURL& origin, + const url::Origin& origin, OnCanSendDomainReliabilityUploadCallback callback) { std::move(callback).Run(false); }
diff --git a/content/browser/preloading/prefetch/prefetch_network_context_client.cc b/content/browser/preloading/prefetch/prefetch_network_context_client.cc index 6b256a4..f8b1b77 100644 --- a/content/browser/preloading/prefetch/prefetch_network_context_client.cc +++ b/content/browser/preloading/prefetch/prefetch_network_context_client.cc
@@ -32,7 +32,7 @@ } void PrefetchNetworkContextClient::OnCanSendDomainReliabilityUpload( - const GURL& origin, + const url::Origin& origin, OnCanSendDomainReliabilityUploadCallback callback) { std::move(callback).Run(false); }
diff --git a/content/browser/preloading/prefetch/prefetch_network_context_client.h b/content/browser/preloading/prefetch/prefetch_network_context_client.h index f1830ca6..6139cbdb 100644 --- a/content/browser/preloading/prefetch/prefetch_network_context_client.h +++ b/content/browser/preloading/prefetch/prefetch_network_context_client.h
@@ -31,7 +31,7 @@ const std::vector<url::Origin>& origins, OnCanSendReportingReportsCallback callback) override; void OnCanSendDomainReliabilityUpload( - const GURL& origin, + const url::Origin& origin, OnCanSendDomainReliabilityUploadCallback callback) override; #if BUILDFLAG(IS_ANDROID) void OnGenerateHttpNegotiateAuthToken(
diff --git a/content/browser/renderer_host/ancestor_throttle_browsertest.cc b/content/browser/renderer_host/ancestor_throttle_browsertest.cc index 53c61bf..4d1ef20 100644 --- a/content/browser/renderer_host/ancestor_throttle_browsertest.cc +++ b/content/browser/renderer_host/ancestor_throttle_browsertest.cc
@@ -202,9 +202,6 @@ } class AncestorThrottleSXGTest : public AncestorThrottleTest { - public: - AncestorThrottleSXGTest() { net::EmbeddedTestServer::RegisterTestCerts(); } - protected: void SetUpCommandLine(base::CommandLine* command_line) override { AncestorThrottleTest::SetUpCommandLine(command_line);
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index 5d4756ba..213e362 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc
@@ -144,6 +144,7 @@ #include "third_party/blink/public/common/client_hints/client_hints.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/common/fenced_frame/fenced_frame_utils.h" +#include "third_party/blink/public/common/frame/fenced_frame_permissions_policies.h" #include "third_party/blink/public/common/frame/fenced_frame_sandbox_flags.h" #include "third_party/blink/public/common/frame/frame_owner_element_type.h" #include "third_party/blink/public/common/navigation/navigation_params_mojom_traits.h" @@ -152,6 +153,7 @@ #include "third_party/blink/public/common/origin_trials/trial_token_result.h" #include "third_party/blink/public/common/origin_trials/trial_token_validator.h" #include "third_party/blink/public/common/permissions_policy/document_policy.h" +#include "third_party/blink/public/common/permissions_policy/policy_helper_public.h" #include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h" #include "third_party/blink/public/common/security/address_space_feature.h" #include "third_party/blink/public/common/user_agent/user_agent_metadata.h" @@ -3854,6 +3856,17 @@ return; } + if (render_frame_host_ && + !CheckPermissionsPoliciesForFencedFrames(GetOriginToCommit())) { + OnRequestFailedInternal( + network::URLLoaderCompletionStatus(net::ERR_ABORTED), + false /*skip_throttles*/, absl::nullopt /*error_page_content*/, + false /*collapse_frame*/); + // DO NOT ADD CODE after this. The previous call to + // OnRequestFailedInternal has destroyed the NavigationRequest. + return; + } + // Check if the navigation should be allowed to proceed. WillProcessResponse(); } @@ -7414,6 +7427,38 @@ return true; } +bool NavigationRequest::CheckPermissionsPoliciesForFencedFrames( + const url::Origin& origin) { + // These checks only apply to fenced frames. + if (!frame_tree_node_->IsFencedFrameRoot()) + return true; + + for (const blink::mojom::PermissionsPolicyFeature feature : + blink::kFencedFrameOpaqueAdsDefaultAllowedFeatures) { + // Only check if the feature is enabled for this origin if + // a policy was explicitly specified. + if (GetParentFrameOrOuterDocument() + ->permissions_policy() + ->GetAllowlistForFeatureIfExists(feature) && + !GetParentFrameOrOuterDocument() + ->permissions_policy() + ->IsFeatureEnabledForOrigin(feature, origin)) { + const blink::PermissionsPolicyFeatureToNameMap& feature_to_name_map = + blink::GetPermissionsPolicyFeatureToNameMap(); + const std::string feature_string( + (feature_to_name_map.find(feature))->second); + AddDeferredConsoleMessage( + blink::mojom::ConsoleMessageLevel::kError, + base::StringPrintf( + "Refused to frame '%s' as a fenced frame because permissions " + "policy '%s' is not allowed for the frame's origin.", + origin.Serialize().c_str(), feature_string.c_str())); + return false; + } + } + return true; +} + std::unique_ptr<PeakGpuMemoryTracker> NavigationRequest::TakePeakGpuMemoryTracker() { return std::move(loading_mem_tracker_);
diff --git a/content/browser/renderer_host/navigation_request.h b/content/browser/renderer_host/navigation_request.h index df8cd50..5c1f2d10 100644 --- a/content/browser/renderer_host/navigation_request.h +++ b/content/browser/renderer_host/navigation_request.h
@@ -1451,6 +1451,11 @@ // If they aren't, this returns false and emits a crash report. bool CoopCoepSanityCheck(); + // Checks if all of the permissions policies that a fenced frame requires to + // be enabled for its origin are enabled. If not, it logs a console message + // and returns false. + bool CheckPermissionsPoliciesForFencedFrames(const url::Origin&); + // Returns the user-agent override, or an empty string if one isn't set. std::string GetUserAgentOverride();
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index 3d9403c..53112913 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -771,8 +771,9 @@ if (frame->IsNestedWithinFencedFrame()) { // In Fenced Frames, all permission policy gated features must be disabled // for privacy reasons. - subframe_policy = - blink::PermissionsPolicy::CreateForFencedFrame(subframe_origin); + subframe_policy = blink::PermissionsPolicy::CreateForFencedFrame( + subframe_origin, + frame->frame_tree_node()->GetFencedFrameMode().value()); } else { // For main frame loads, the frame's permissions policy is determined // entirely by response headers, which are provided by the renderer. @@ -7697,7 +7698,7 @@ weak_ptr_factory_.GetSafeRef(), mode, devtools_frame_token)); FencedFrame* fenced_frame = fenced_frames_.back().get(); RenderFrameProxyHost* proxy_host = - fenced_frame->CreateProxyAndAttachToOuterFrameTree( + fenced_frame->InitInnerFrameTreeAndReturnProxyToOuterFrameTree( std::move(remote_frame_interfaces), frame_token); fenced_frame->Bind(std::move(pending_receiver)); @@ -10336,8 +10337,9 @@ if (IsNestedWithinFencedFrame()) { // In Fenced Frames, all permission policy gated features must be disabled // for privacy reasons. - permissions_policy_ = - blink::PermissionsPolicy::CreateForFencedFrame(last_committed_origin_); + permissions_policy_ = blink::PermissionsPolicy::CreateForFencedFrame( + last_committed_origin_, + frame_tree_node()->GetFencedFrameMode().value()); return; }
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index d2275a3..24bd386 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc
@@ -2050,17 +2050,16 @@ } void StoragePartitionImpl::OnCanSendDomainReliabilityUpload( - const GURL& origin, + const url::Origin& origin, OnCanSendDomainReliabilityUploadCallback callback) { DCHECK(initialized_); PermissionController* permission_controller = browser_context_->GetPermissionController(); - std::move(callback).Run(permission_controller - ->GetPermissionResultForOriginWithoutContext( - blink::PermissionType::BACKGROUND_SYNC, - url::Origin::Create(origin)) - .status == - blink::mojom::PermissionStatus::GRANTED); + std::move(callback).Run( + permission_controller + ->GetPermissionResultForOriginWithoutContext( + blink::PermissionType::BACKGROUND_SYNC, origin) + .status == blink::mojom::PermissionStatus::GRANTED); } void StoragePartitionImpl::OnClearSiteData(
diff --git a/content/browser/storage_partition_impl.h b/content/browser/storage_partition_impl.h index 4890af4d..7839dfd1 100644 --- a/content/browser/storage_partition_impl.h +++ b/content/browser/storage_partition_impl.h
@@ -292,7 +292,7 @@ const std::vector<url::Origin>& origins, OnCanSendReportingReportsCallback callback) override; void OnCanSendDomainReliabilityUpload( - const GURL& origin, + const url::Origin& origin, OnCanSendDomainReliabilityUploadCallback callback) override; #if BUILDFLAG(IS_ANDROID) void OnGenerateHttpNegotiateAuthToken(
diff --git a/content/browser/web_package/signed_exchange_request_handler_browsertest.cc b/content/browser/web_package/signed_exchange_request_handler_browsertest.cc index e5e19ee..519dc3a 100644 --- a/content/browser/web_package/signed_exchange_request_handler_browsertest.cc +++ b/content/browser/web_package/signed_exchange_request_handler_browsertest.cc
@@ -63,6 +63,7 @@ #include "net/cert/cert_verify_result.h" #include "net/cert/ct_policy_status.h" #include "net/cert/mock_cert_verifier.h" +#include "net/cert/test_root_certs.h" #include "net/dns/mock_host_resolver.h" #include "net/http/http_request_headers.h" #include "net/http/transport_security_state.h" @@ -169,10 +170,6 @@ : public CertVerifierBrowserTest { public: SignedExchangeRequestHandlerBrowserTestBase() { - // This installs "root_ca_cert.pem" from which our test certificates are - // created. (Needed for the tests that use real certificate, i.e. - // RealCertVerifier) - net::EmbeddedTestServer::RegisterTestCerts(); feature_list_.InitWithFeatures({features::kSignedHTTPExchange}, {}); } @@ -914,6 +911,10 @@ SignedExchangeRequestHandlerRealCertVerifierBrowserTest() { // Use "real" CertVerifier. disable_mock_cert_verifier(); + // This installs "root_ca_cert.pem" from which our test certificates are + // created. (Needed for the tests that use real certificate, i.e. + // RealCertVerifier) + scoped_test_root_ = net::EmbeddedTestServer::RegisterTestCerts(); } void SetUp() override { SignedExchangeHandler::SetShouldIgnoreCertValidityPeriodErrorForTesting( @@ -925,6 +926,9 @@ SignedExchangeHandler::SetShouldIgnoreCertValidityPeriodErrorForTesting( false); } + + private: + net::ScopedTestRoot scoped_test_root_; }; // If this fails with ERR_CERT_DATE_INVALID, try to regenerate test data
diff --git a/content/public/browser/network_context_client_base.h b/content/public/browser/network_context_client_base.h index 93000f7c..5c84169 100644 --- a/content/public/browser/network_context_client_base.h +++ b/content/public/browser/network_context_client_base.h
@@ -32,7 +32,7 @@ const std::vector<url::Origin>& origins, OnCanSendReportingReportsCallback callback) override; void OnCanSendDomainReliabilityUpload( - const GURL& origin, + const url::Origin& origin, OnCanSendDomainReliabilityUploadCallback callback) override; #if BUILDFLAG(IS_ANDROID) void OnGenerateHttpNegotiateAuthToken(
diff --git a/content/renderer/accessibility/render_accessibility_impl.cc b/content/renderer/accessibility/render_accessibility_impl.cc index 93478814..1f2b235 100644 --- a/content/renderer/accessibility/render_accessibility_impl.cc +++ b/content/renderer/accessibility/render_accessibility_impl.cc
@@ -829,7 +829,7 @@ // parts of the code as well, so we need to ensure the object still exists. // TODO(accessibility) Change this to CheckValidity() if there aren't crash // reports of illegal lifecycle changes from WebDisallowTransitionScope. - if (!obj.MaybeUpdateLayoutAndCheckValidity()) + if (obj.IsDetached() || !obj.MaybeUpdateLayoutAndCheckValidity()) continue; // Cannot serialize unincluded object.
diff --git a/content/renderer/v8_value_converter_impl_unittest.cc b/content/renderer/v8_value_converter_impl_unittest.cc index b62c2452..3984537 100644 --- a/content/renderer/v8_value_converter_impl_unittest.cc +++ b/content/renderer/v8_value_converter_impl_unittest.cc
@@ -1063,16 +1063,16 @@ // Expected depth is kMaxRecursionDepth in v8_value_converter_impl.cc. int kExpectedDepth = 100; - base::Value* current = value.get(); + const base::Value* current = value.get(); for (int i = 1; i < kExpectedDepth; ++i) { - base::DictionaryValue* current_as_object = nullptr; - ASSERT_TRUE(current->GetAsDictionary(¤t_as_object)) << i; - ASSERT_TRUE(current_as_object->Get(kKey, ¤t)) << i; + ASSERT_TRUE(current->is_dict()) << i; + const base::Value::Dict& current_as_object = current->GetDict(); + current = current_as_object.Find(kKey); + ASSERT_TRUE(current) << i; } // The leaf node shouldn't have any properties. - base::DictionaryValue empty; - EXPECT_EQ(empty, *current) << *current; + EXPECT_EQ(base::Value(base::Value::Dict()), *current) << *current; } TEST_F(V8ValueConverterImplTest, NegativeZero) {
diff --git a/content/test/test_render_frame_host.cc b/content/test/test_render_frame_host.cc index 92a55b2..c655ad21 100644 --- a/content/test/test_render_frame_host.cc +++ b/content/test/test_render_frame_host.cc
@@ -281,7 +281,7 @@ mojo::AssociatedRemote<blink::mojom::RemoteFrame> frame; std::ignore = frame.BindNewEndpointAndPassDedicatedReceiver(); remote_frame_interfaces->frame = frame.Unbind(); - fenced_frame->CreateProxyAndAttachToOuterFrameTree( + fenced_frame->InitInnerFrameTreeAndReturnProxyToOuterFrameTree( std::move(remote_frame_interfaces), blink::RemoteFrameToken()); return static_cast<TestRenderFrameHost*>(fenced_frame->GetInnerRoot()); }
diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn index 9299fef..62f940e0 100644 --- a/device/bluetooth/BUILD.gn +++ b/device/bluetooth/BUILD.gn
@@ -460,6 +460,8 @@ "chromeos/bluetooth_connection_logger.h", "chromeos/bluetooth_utils.cc", "chromeos/bluetooth_utils.h", + "chromeos_platform_features.cc", + "chromeos_platform_features.h", ] deps += [ "//services/data_decoder/public/mojom" ] if (is_chromeos_lacros) {
diff --git a/device/bluetooth/chromeos_platform_features.cc b/device/bluetooth/chromeos_platform_features.cc new file mode 100644 index 0000000..abfd77b4 --- /dev/null +++ b/device/bluetooth/chromeos_platform_features.cc
@@ -0,0 +1,12 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "device/bluetooth/chromeos_platform_features.h" + +namespace chromeos::bluetooth::features { + +const base::Feature kBluetoothCoredump{"BluetoothCoredump", + base::FEATURE_DISABLED_BY_DEFAULT}; + +} // namespace chromeos::bluetooth::features
diff --git a/device/bluetooth/chromeos_platform_features.h b/device/bluetooth/chromeos_platform_features.h new file mode 100644 index 0000000..03430e2e --- /dev/null +++ b/device/bluetooth/chromeos_platform_features.h
@@ -0,0 +1,18 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DEVICE_BLUETOOTH_CHROMEOS_PLATFORM_FEATURES_H_ +#define DEVICE_BLUETOOTH_CHROMEOS_PLATFORM_FEATURES_H_ + +#include "base/feature_list.h" +#include "device/bluetooth/bluetooth_export.h" + +namespace chromeos::bluetooth::features { + +// Enables/disables the bluetooth devcoredump feature +extern const DEVICE_BLUETOOTH_EXPORT base::Feature kBluetoothCoredump; + +} // namespace chromeos::bluetooth::features + +#endif // DEVICE_BLUETOOTH_CHROMEOS_PLATFORM_FEATURES_H_
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index bd3a93c..1a744d2d 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h
@@ -1758,6 +1758,7 @@ ACCESSIBILITY_PRIVATE_SILENCESPOKENFEEDBACK = 1695, AUTOTESTPRIVATE_SETALLOWEDPREF = 1696, PASSWORDSPRIVATE_REQUESTCREDENTIALDETAILS = 1697, + DEVELOPERPRIVATE_GETMATCHINGEXTENSIONSFORSITE = 1698, // Last entry: Add new entries above, then run: // tools/metrics/histograms/update_extension_histograms.py ENUM_BOUNDARY
diff --git a/extensions/renderer/api/automation/automation_ax_tree_wrapper.cc b/extensions/renderer/api/automation/automation_ax_tree_wrapper.cc index f61b7ef..564b7b3 100644 --- a/extensions/renderer/api/automation/automation_ax_tree_wrapper.cc +++ b/extensions/renderer/api/automation/automation_ax_tree_wrapper.cc
@@ -43,16 +43,18 @@ AutomationAXTreeWrapper::AutomationAXTreeWrapper( ui::AXTreeID tree_id, AutomationInternalCustomBindings* owner) - : tree_id_(tree_id), owner_(owner), event_generator_(&tree_) { - tree_.AddObserver(this); + : ui::AXTreeManager(tree_id, std::make_unique<ui::AXTree>()), + owner_(owner), + event_generator_(ax_tree()) { + ax_tree_->AddObserver(this); ui::AXTreeManagerMap::GetInstance().AddTreeManager(tree_id, this); } AutomationAXTreeWrapper::~AutomationAXTreeWrapper() { // Stop observing so we don't get a callback for every node being deleted. event_generator_.SetTree(nullptr); - tree_.RemoveObserver(this); - ui::AXTreeManagerMap::GetInstance().RemoveTreeManager(tree_id_); + ax_tree_->RemoveObserver(this); + ui::AXTreeManagerMap::GetInstance().RemoveTreeManager(ax_tree_id_); } // static @@ -78,7 +80,7 @@ std::map<ui::AXTreeID, AutomationAXTreeWrapper*>& child_tree_id_reverse_map = GetChildTreeIDReverseMap(); - const auto& child_tree_ids = tree_.GetAllChildTreeIds(); + const auto& child_tree_ids = ax_tree_->GetAllChildTreeIds(); // Invalidate any reverse child tree id mappings. Note that it is possible // there are no entries in this map for a given child tree to |this|, if this @@ -93,7 +95,7 @@ deleted_node_ids_.clear(); did_send_tree_change_during_unserialization_ = false; - if (!tree_.Unserialize(update)) { + if (!ax_tree_->Unserialize(update)) { static crash_reporter::CrashKeyString<4> crash_key( "ax-tree-wrapper-unserialize-failed"); crash_key.Set("yes"); @@ -102,18 +104,18 @@ } if (is_active_profile) { - owner_->SendNodesRemovedEvent(&tree_, deleted_node_ids_); + owner_->SendNodesRemovedEvent(ax_tree(), deleted_node_ids_); if (update.nodes.size() && did_send_tree_change_during_unserialization_) { owner_->SendTreeChangeEvent( - api::automation::TREE_CHANGE_TYPE_SUBTREEUPDATEEND, &tree_, - tree_.root()); + api::automation::TREE_CHANGE_TYPE_SUBTREEUPDATEEND, ax_tree(), + ax_tree_->root()); } } } // Refresh child tree id mappings. - for (const ui::AXTreeID& tree_id : tree_.GetAllChildTreeIds()) { + for (const ui::AXTreeID& tree_id : ax_tree_->GetAllChildTreeIds()) { DCHECK(!base::Contains(child_tree_id_reverse_map, tree_id)); child_tree_id_reverse_map.insert(std::make_pair(tree_id, this)); } @@ -134,15 +136,15 @@ // it. for (const auto& event : event_bundle.events) { if (event.event_type == ax::mojom::Event::kLoadComplete) { - tree_.language_detection_manager->DetectLanguages(); - tree_.language_detection_manager->LabelLanguages(); + ax_tree_->language_detection_manager->DetectLanguages(); + ax_tree_->language_detection_manager->LabelLanguages(); // After initial language detection, enable language detection for future // content updates in order to support dynamic content changes. // // If the LanguageDetectionDynamic feature flag is not enabled then this // is a no-op. - tree_.language_detection_manager->RegisterLanguageDetectionObserver(); + ax_tree_->language_detection_manager->RegisterLanguageDetectionObserver(); break; } @@ -189,20 +191,21 @@ } bool AutomationAXTreeWrapper::IsDesktopTree() const { - return tree_.root() ? tree_.root()->GetRole() == ax::mojom::Role::kDesktop - : false; + return ax_tree_->root() + ? ax_tree_->root()->GetRole() == ax::mojom::Role::kDesktop + : false; } bool AutomationAXTreeWrapper::HasDeviceScaleFactor() const { - return tree_.root() ? - // These are views-backed trees. - tree_.root()->GetRole() != ax::mojom::Role::kDesktop && - tree_.root()->GetRole() != ax::mojom::Role::kClient - : true; + return ax_tree_->root() ? + // These are views-backed trees. + ax_tree_->root()->GetRole() != ax::mojom::Role::kDesktop && + ax_tree_->root()->GetRole() != ax::mojom::Role::kClient + : true; } bool AutomationAXTreeWrapper::IsInFocusChain(int32_t node_id) { - if (tree()->data().focus_id != node_id) + if (ax_tree_->data().focus_id != node_id) return false; if (IsDesktopTree()) @@ -213,9 +216,9 @@ AutomationAXTreeWrapper* ancestor_tree = descendant_tree; bool found = true; while ((ancestor_tree = ancestor_tree->GetParentTree())) { - int32_t ancestor_tree_focus_id = ancestor_tree->tree()->data().focus_id; + int32_t ancestor_tree_focus_id = ancestor_tree->ax_tree()->data().focus_id; ui::AXNode* ancestor_tree_focused_node = - ancestor_tree->tree()->GetFromId(ancestor_tree_focus_id); + ancestor_tree->ax_tree()->GetFromId(ancestor_tree_focus_id); if (!ancestor_tree_focused_node) return false; @@ -234,7 +237,7 @@ ancestor_tree_focused_node->GetStringAttribute( ax::mojom::StringAttribute::kChildTreeId)) != descendant_tree_id && - ancestor_tree->tree()->data().focused_tree_id != + ancestor_tree->ax_tree()->data().focused_tree_id != descendant_tree_id) { // Surprisingly, an ancestor frame can "skip" a child frame to point to a // descendant granchild, so we have to scan upwards. @@ -258,11 +261,11 @@ } ui::AXTree::Selection AutomationAXTreeWrapper::GetUnignoredSelection() { - return tree()->GetUnignoredSelection(); + return ax_tree_->GetUnignoredSelection(); } ui::AXNode* AutomationAXTreeWrapper::GetUnignoredNodeFromId(int32_t id) { - ui::AXNode* node = tree_.GetFromId(id); + ui::AXNode* node = ax_tree_->GetFromId(id); return (node && !node->IsIgnored()) ? node : nullptr; } @@ -273,12 +276,12 @@ ui::AXNode* AutomationAXTreeWrapper::GetAccessibilityFocusedNode() { return accessibility_focused_id_ == ui::kInvalidAXNodeID ? nullptr - : tree_.GetFromId(accessibility_focused_id_); + : ax_tree_->GetFromId(accessibility_focused_id_); } AutomationAXTreeWrapper* AutomationAXTreeWrapper::GetParentTree() { // Explicit parent tree from this tree's data. - auto* ret = GetParentOfTreeId(tree()->data().tree_id); + auto* ret = GetParentOfTreeId(ax_tree_->data().tree_id); // If this tree has multiple roots, and no explicit parent tree, fallback to // any node with a parent tree node app id to find a parent tree. @@ -364,7 +367,7 @@ if (!wrapper) return nullptr; - return wrapper->tree()->GetFromId(it->second.second); + return wrapper->ax_tree()->GetFromId(it->second.second); } // static @@ -395,7 +398,7 @@ if (!wrapper) continue; - nodes.push_back(wrapper->tree()->GetFromId(app_node_info.node_id)); + nodes.push_back(wrapper->ax_tree()->GetFromId(app_node_info.node_id)); } return nodes; @@ -497,7 +500,7 @@ ui::AXTree* tree, bool root_changed, const std::vector<ui::AXTreeObserver::Change>& changes) { - DCHECK_EQ(&tree_, tree); + DCHECK_EQ(ax_tree(), tree); for (const auto& change : changes) { ui::AXNode* node = change.node; switch (change.type) { @@ -565,26 +568,26 @@ ui::AXNode* AutomationAXTreeWrapper::GetNodeFromTree( const ui::AXNodeID node_id) const { - return tree_.GetFromId(node_id); + return ax_tree_->GetFromId(node_id); } ui::AXTreeID AutomationAXTreeWrapper::GetTreeID() const { - return tree_id_; + return ax_tree_id_; } ui::AXTreeID AutomationAXTreeWrapper::GetParentTreeID() const { - AutomationAXTreeWrapper* parent_tree = GetParentOfTreeId(tree_id_); + AutomationAXTreeWrapper* parent_tree = GetParentOfTreeId(ax_tree_id_); return parent_tree ? parent_tree->GetTreeID() : ui::AXTreeIDUnknown(); } ui::AXNode* AutomationAXTreeWrapper::GetRootAsAXNode() const { - return tree_.root(); + return ax_tree_->root(); } ui::AXNode* AutomationAXTreeWrapper::GetParentNodeFromParentTreeAsAXNode() const { AutomationAXTreeWrapper* wrapper = const_cast<AutomationAXTreeWrapper*>(this); - return owner_->GetParent(tree_.root(), &wrapper, + return owner_->GetParent(ax_tree_->root(), &wrapper, /* should_use_app_id = */ true, /* requires_unignored = */ false); }
diff --git a/extensions/renderer/api/automation/automation_ax_tree_wrapper.h b/extensions/renderer/api/automation/automation_ax_tree_wrapper.h index 905b458..27337e4 100644 --- a/extensions/renderer/api/automation/automation_ax_tree_wrapper.h +++ b/extensions/renderer/api/automation/automation_ax_tree_wrapper.h
@@ -19,8 +19,7 @@ // A class that wraps one AXTree and all of the additional state // and helper methods needed to use it for the automation API. -class AutomationAXTreeWrapper : public ui::AXTreeObserver, - public ui::AXTreeManager { +class AutomationAXTreeWrapper : public ui::AXTreeManager { public: AutomationAXTreeWrapper(ui::AXTreeID tree_id, AutomationInternalCustomBindings* owner); @@ -48,7 +47,6 @@ const std::string& app_id, const AutomationInternalCustomBindings* owner); - ui::AXTree* tree() { return &tree_; } AutomationInternalCustomBindings* owner() { return owner_; } // Called by AutomationInternalCustomBindings::OnAccessibilityEvents on @@ -138,8 +136,6 @@ ui::AXNode* node, bool is_ignored_new_value) override; - ui::AXTreeID tree_id_; - ui::AXTree tree_; AutomationInternalCustomBindings* owner_; std::vector<int> deleted_node_ids_; std::vector<int> text_changed_node_ids_;
diff --git a/extensions/renderer/api/automation/automation_internal_custom_bindings.cc b/extensions/renderer/api/automation/automation_internal_custom_bindings.cc index 67a717ed..6cd3124b 100644 --- a/extensions/renderer/api/automation/automation_internal_custom_bindings.cc +++ b/extensions/renderer/api/automation/automation_internal_custom_bindings.cc
@@ -191,7 +191,7 @@ return; // The root can be null if this is called from an onTreeChange callback. - if (!tree_wrapper->tree()->root()) + if (!tree_wrapper->ax_tree()->root()) return; function_(isolate, args.GetReturnValue(), tree_wrapper); @@ -300,7 +300,7 @@ if (!node) return; - function_(isolate, args.GetReturnValue(), tree_wrapper->tree(), node, + function_(isolate, args.GetReturnValue(), tree_wrapper->ax_tree(), node, attribute); } @@ -644,11 +644,12 @@ // Bindings that take a Tree ID and return a property of the tree. - RouteTreeIDFunction("GetRootID", [](v8::Isolate* isolate, - v8::ReturnValue<v8::Value> result, - AutomationAXTreeWrapper* tree_wrapper) { - result.Set(v8::Integer::New(isolate, tree_wrapper->tree()->root()->id())); - }); + RouteTreeIDFunction( + "GetRootID", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, + AutomationAXTreeWrapper* tree_wrapper) { + result.Set( + v8::Integer::New(isolate, tree_wrapper->ax_tree()->root()->id())); + }); RouteTreeIDFunction( "GetPublicRoot", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, @@ -659,21 +660,21 @@ gin::DataObjectBuilder response(isolate); response.Set("treeId", tree_wrapper->GetTreeID().ToString()); - response.Set("nodeId", tree_wrapper->tree()->root()->id()); + response.Set("nodeId", tree_wrapper->ax_tree()->root()->id()); result.Set(response.Build()); }); RouteTreeIDFunction( "GetDocURL", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, AutomationAXTreeWrapper* tree_wrapper) { result.Set(v8::String::NewFromUtf8( - isolate, tree_wrapper->tree()->data().url.c_str()) + isolate, tree_wrapper->ax_tree()->data().url.c_str()) .ToLocalChecked()); }); RouteTreeIDFunction( "GetDocTitle", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, AutomationAXTreeWrapper* tree_wrapper) { result.Set(v8::String::NewFromUtf8( - isolate, tree_wrapper->tree()->data().title.c_str()) + isolate, tree_wrapper->ax_tree()->data().title.c_str()) .ToLocalChecked()); }); RouteTreeIDFunction( @@ -681,14 +682,14 @@ [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, AutomationAXTreeWrapper* tree_wrapper) { result.Set( - v8::Boolean::New(isolate, tree_wrapper->tree()->data().loaded)); + v8::Boolean::New(isolate, tree_wrapper->ax_tree()->data().loaded)); }); RouteTreeIDFunction( "GetDocLoadingProgress", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, AutomationAXTreeWrapper* tree_wrapper) { result.Set(v8::Number::New( - isolate, tree_wrapper->tree()->data().loading_progress)); + isolate, tree_wrapper->ax_tree()->data().loading_progress)); }); RouteTreeIDFunction( "GetIsSelectionBackward", @@ -701,7 +702,7 @@ return; result.Set(v8::Boolean::New( - isolate, tree_wrapper->tree()->data().sel_is_backward)); + isolate, tree_wrapper->ax_tree()->data().sel_is_backward)); }); RouteTreeIDFunction( "GetAnchorObjectID", @@ -1913,7 +1914,7 @@ AutomationAXTreeWrapper* tree_wrapper, AutomationAXTreeWrapper** out_tree_wrapper, ui::AXNode** out_node) { - int focus_id = tree_wrapper->tree()->data().focus_id; + int focus_id = tree_wrapper->ax_tree()->data().focus_id; ui::AXNode* focus = tree_wrapper->GetNodeFromTree(tree_wrapper->GetTreeID(), focus_id); if (!focus) @@ -1964,17 +1965,17 @@ // If |child_tree_wrapper| is a frame tree that indicates a focused frame, // jump to that frame if possible. ui::AXTreeID focused_tree_id = - child_tree_wrapper->tree()->data().focused_tree_id; + child_tree_wrapper->ax_tree()->data().focused_tree_id; if (focused_tree_id != ui::AXTreeIDUnknown() && !child_tree_wrapper->IsDesktopTree()) { AutomationAXTreeWrapper* focused_tree_wrapper = GetAutomationAXTreeWrapperFromTreeID( - child_tree_wrapper->tree()->data().focused_tree_id); + child_tree_wrapper->ax_tree()->data().focused_tree_id); if (focused_tree_wrapper) child_tree_wrapper = focused_tree_wrapper; } - int child_focus_id = child_tree_wrapper->tree()->data().focus_id; + int child_focus_id = child_tree_wrapper->ax_tree()->data().focus_id; ui::AXNode* child_focus = child_tree_wrapper->GetNodeFromTree( child_tree_wrapper->GetTreeID(), child_focus_id); if (!child_focus) @@ -2109,7 +2110,7 @@ AutomationAXTreeWrapper* walker = tree_wrapper; while (walker && walker != top_tree_wrapper) { top_tree_wrapper = walker; - GetParent(walker->tree()->root(), &walker); + GetParent(walker->ax_tree()->root(), &walker); } const bool focused = tree_wrapper->IsInFocusChain(node->id()); @@ -2145,7 +2146,7 @@ if (!tree_wrapper) return; - ui::AXNode* node = tree_wrapper->tree()->GetFromId(node_id); + ui::AXNode* node = tree_wrapper->ax_tree()->GetFromId(node_id); if (!node) return; @@ -2208,7 +2209,7 @@ AutomationAXTreeWrapper* parent_tree_wrapper = nullptr; ui::AXTreeID parent_tree_id = - (*in_out_tree_wrapper)->tree()->data().parent_tree_id; + (*in_out_tree_wrapper)->ax_tree()->data().parent_tree_id; if (parent_tree_id != ui::AXTreeIDUnknown()) { // If the tree specifies its parent tree ID, use that. That provides // some additional security guarantees, so a tree can't be "claimed" @@ -2225,7 +2226,7 @@ return nullptr; std::set<int32_t> host_node_ids = - parent_tree_wrapper->tree()->GetNodeIdsForChildTreeId( + parent_tree_wrapper->ax_tree()->GetNodeIdsForChildTreeId( (*in_out_tree_wrapper)->GetTreeID()); #if !defined(NDEBUG) @@ -2275,10 +2276,10 @@ AutomationAXTreeWrapper* child_tree_wrapper = GetAutomationAXTreeWrapperFromTreeID( ui::AXTreeID::FromString(child_tree_id_str)); - if (!child_tree_wrapper || !child_tree_wrapper->tree()->root()) + if (!child_tree_wrapper || !child_tree_wrapper->ax_tree()->root()) return std::vector<ui::AXNode*>(); - return {child_tree_wrapper->tree()->root()}; + return {child_tree_wrapper->ax_tree()->root()}; } ui::AXNode* AutomationInternalCustomBindings::GetNextInTreeOrder( @@ -2465,7 +2466,7 @@ } if (!tree_wrapper->OnAccessibilityEvents(event_bundle, is_active_profile)) { - DLOG(ERROR) << tree_wrapper->tree()->error(); + DLOG(ERROR) << tree_wrapper->ax_tree()->error(); base::Value::List args; args.Append(tree_id.ToString()); bindings_system_->DispatchEventInContext( @@ -2530,7 +2531,7 @@ &child_tree_id_str)) { ui::AXTreeID child_tree_id = ui::AXTreeID::FromString(child_tree_id_str); auto* tree_wrapper = GetAutomationAXTreeWrapperFromTreeID(child_tree_id); - if (!tree_wrapper || !tree_wrapper->tree()->data().loaded) + if (!tree_wrapper || !tree_wrapper->ax_tree()->data().loaded) SendChildTreeIDEvent(child_tree_id); } @@ -2733,7 +2734,7 @@ // chrome.automation.getDesktop has yet to be called, or if this platform // does not support Aura. new_wrapper = tree; - new_node = tree->tree()->GetFromId(raw_focus_target_id); + new_node = tree->ax_tree()->GetFromId(raw_focus_target_id); if (!new_node) return; } @@ -2948,13 +2949,13 @@ bool crossed_app_id = false; while (node) { - bounds = tree_wrapper->tree()->RelativeToTreeBounds( + bounds = tree_wrapper->ax_tree()->RelativeToTreeBounds( node, bounds, offscreen, clip_bounds, /* skip_container_offset = */ crossed_app_id); - bool should_use_app_id = tree_wrapper->tree()->root() == node; + bool should_use_app_id = tree_wrapper->ax_tree()->root() == node; AutomationAXTreeWrapper* previous_tree_wrapper = tree_wrapper; - ui::AXNode* parent_of_root = GetParent(tree_wrapper->tree()->root(), + ui::AXNode* parent_of_root = GetParent(tree_wrapper->ax_tree()->root(), &tree_wrapper, should_use_app_id); if (parent_of_root == node) break;
diff --git a/extensions/renderer/api/automation/automation_internal_custom_bindings_unittests.cc b/extensions/renderer/api/automation/automation_internal_custom_bindings_unittests.cc index 12b5ce5..1d6c99b 100644 --- a/extensions/renderer/api/automation/automation_internal_custom_bindings_unittests.cc +++ b/extensions/renderer/api/automation/automation_internal_custom_bindings_unittests.cc
@@ -392,7 +392,7 @@ AutomationAXTreeWrapper* wrapper_1 = GetTreeIDToTreeMap()[tree_1_id].get(); ASSERT_TRUE(wrapper_1); - ui::AXNode* wrapper1_button = wrapper_1->tree()->GetFromId(2); + ui::AXNode* wrapper1_button = wrapper_1->ax_tree()->GetFromId(2); ASSERT_TRUE(wrapper1_button); // The button in wrapper 1 is scaled by .5 (200 * .5). It's root is also @@ -481,7 +481,7 @@ AutomationAXTreeWrapper* wrapper_1 = GetTreeIDToTreeMap()[tree_1_id].get(); ASSERT_TRUE(wrapper_1); - ui::AXNode* wrapper1_button = wrapper_1->tree()->GetFromId(2); + ui::AXNode* wrapper1_button = wrapper_1->ax_tree()->GetFromId(2); ASSERT_TRUE(wrapper1_button); // The button in wrapper 1 is scaled by .5 (200 * .5). It's root is also @@ -490,7 +490,7 @@ EXPECT_EQ(gfx::Rect(50, 50, 100, 100), CallComputeGlobalNodeBounds(wrapper_1, wrapper1_button)); - ui::AXNode* wrapper1_root = wrapper_1->tree()->GetFromId(1); + ui::AXNode* wrapper1_root = wrapper_1->ax_tree()->GetFromId(1); ASSERT_TRUE(wrapper1_root); // Similar to the button, but not scaled. This does not cross an app id @@ -565,7 +565,7 @@ EXPECT_TRUE(wrapper_2->IsTreeIgnored()); // No longer invisible. - ui::AXNode* button = wrapper_0->tree()->GetFromId(2); + ui::AXNode* button = wrapper_0->ax_tree()->GetFromId(2); ui::AXNodeData data = button->TakeData(); data.RemoveState(ax::mojom::State::kInvisible); button->SetData(data); @@ -634,7 +634,7 @@ AutomationAXTreeWrapper* wrapper_0 = GetTreeIDToTreeMap()[tree_0_id].get(); ASSERT_TRUE(wrapper_0); - ui::AXNode* wrapper0_client = wrapper_0->tree()->GetFromId(3); + ui::AXNode* wrapper0_client = wrapper_0->ax_tree()->GetFromId(3); ASSERT_TRUE(wrapper0_client); std::vector<ui::AXNode*> child_roots = @@ -695,7 +695,7 @@ // Add a role change listener and do trigger the role change again. auto* wrapper = GetTreeIDToTreeMap()[tree_data.tree_id].get(); - auto* tree = wrapper->tree(); + auto* tree = wrapper->ax_tree(); // The button is id 2. wrapper->EventListenerAdded(api::automation::EVENT_TYPE_ROLECHANGED, tree->GetFromId(2));
diff --git a/gpu/command_buffer/service/sync_point_manager.h b/gpu/command_buffer/service/sync_point_manager.h index cae60b4a3..57a7d78d 100644 --- a/gpu/command_buffer/service/sync_point_manager.h +++ b/gpu/command_buffer/service/sync_point_manager.h
@@ -10,12 +10,13 @@ #include <functional> #include <memory> #include <queue> -#include <unordered_map> #include <vector> #include "base/atomic_sequence_num.h" #include "base/callback.h" #include "base/check.h" +#include "base/containers/flat_map.h" +#include "base/containers/queue.h" #include "base/memory/raw_ptr.h" #include "base/memory/ref_counted.h" #include "base/synchronization/condition_variable.h" @@ -143,7 +144,7 @@ // Queue of unprocessed order numbers. Order numbers are enqueued in // GenerateUnprocessedOrderNumber, and dequeued in // FinishProcessingOrderNumber. - std::queue<uint32_t> unprocessed_order_nums_; + base::queue<uint32_t> unprocessed_order_nums_; // In situations where we are waiting on fence syncs that do not exist, we // validate by making sure the order number does not pass the order number @@ -319,13 +320,11 @@ CommandBufferId command_buffer_id); private: - using ClientStateMap = std::unordered_map<CommandBufferId, - scoped_refptr<SyncPointClientState>, - CommandBufferId::Hasher>; + using ClientStateMap = + base::flat_map<CommandBufferId, scoped_refptr<SyncPointClientState>>; - using OrderDataMap = std::unordered_map<SequenceId, - scoped_refptr<SyncPointOrderData>, - SequenceId::Hasher>; + using OrderDataMap = + base::flat_map<SequenceId, scoped_refptr<SyncPointOrderData>>; scoped_refptr<SyncPointOrderData> GetSyncPointOrderData( SequenceId sequence_id);
diff --git a/gpu/config/gpu_control_list.cc b/gpu/config/gpu_control_list.cc index 630c745..16b217b 100644 --- a/gpu/config/gpu_control_list.cc +++ b/gpu/config/gpu_control_list.cc
@@ -662,9 +662,9 @@ return false; } -void GpuControlList::Entry::GetFeatureNames( - base::Value& feature_names, +base::Value::List GpuControlList::Entry::GetFeatureNames( const FeatureMap& feature_map) const { + base::Value::List feature_names; for (size_t ii = 0; ii < feature_size; ++ii) { auto iter = feature_map.find(features[ii]); DCHECK(iter != feature_map.end()); @@ -675,6 +675,7 @@ base::StringPrintf("disable(%s)", disabled_extensions[ii]); feature_names.Append(name); } + return feature_names; } GpuControlList::GpuControlList(const GpuControlListData& data) @@ -799,28 +800,27 @@ disabled_webgl_extensions.end()); } -void GpuControlList::GetReasons(base::Value& problem_list, +void GpuControlList::GetReasons(base::Value::List& problem_list, const std::string& tag, const std::vector<uint32_t>& entries) const { for (auto index : entries) { DCHECK_LT(index, entry_count_); const Entry& entry = entries_[index]; - auto problem = base::Value(base::Value::Type::DICTIONARY); + base::Value::Dict problem; - problem.SetStringKey("description", entry.description); + problem.Set("description", entry.description); - auto cr_bugs = base::Value(base::Value::Type::LIST); + base::Value::List cr_bugs; for (size_t jj = 0; jj < entry.cr_bug_size; ++jj) cr_bugs.Append( base::Int64ToValue(static_cast<int64_t>(entry.cr_bugs[jj]))); - problem.SetKey("crBugs", std::move(cr_bugs)); + problem.Set("crBugs", std::move(cr_bugs)); - auto features = base::Value(base::Value::Type::LIST); - entry.GetFeatureNames(features, feature_map_); - problem.SetKey("affectedGpuSettings", std::move(features)); + base::Value::List features = entry.GetFeatureNames(feature_map_); + problem.Set("affectedGpuSettings", std::move(features)); DCHECK(tag == "workarounds" || tag == "disabledFeatures"); - problem.SetStringKey("tag", tag); + problem.Set("tag", tag); problem_list.Append(std::move(problem)); }
diff --git a/gpu/config/gpu_control_list.h b/gpu/config/gpu_control_list.h index ccf84537..fc6bd81c 100644 --- a/gpu/config/gpu_control_list.h +++ b/gpu/config/gpu_control_list.h
@@ -241,8 +241,7 @@ // decision. It should only be checked if Contains() returns true. bool NeedsMoreInfo(const GPUInfo& gpu_info, bool consider_exceptions) const; - void GetFeatureNames(base::Value& feature_names, - const FeatureMap& feature_map) const; + base::Value::List GetFeatureNames(const FeatureMap& feature_map) const; // Logs a control list match for this rule in the list identified by // |control_list_logging_name|. @@ -288,7 +287,7 @@ // } // The use case is we compute the entries from GPU process and send them to // browser process, and call GetReasons() in browser process. - void GetReasons(base::Value& problem_list, + void GetReasons(base::Value::List& problem_list, const std::string& tag, const std::vector<uint32_t>& entries) const;
diff --git a/infra/config/generated/cq-builders.md b/infra/config/generated/cq-builders.md index 789de31..db99e0a 100644 --- a/infra/config/generated/cq-builders.md +++ b/infra/config/generated/cq-builders.md
@@ -510,7 +510,7 @@ * Experiment percentage: 5.0 * [linux-wayland-rel-reclient](https://ci.chromium.org/p/chromium/builders/try/linux-wayland-rel-reclient) ([definition](https://cs.chromium.org/search?q=+file:/try/.*\.star$+""linux-wayland-rel-reclient"")) ([matching builders](https://cs.chromium.org/search?q=+file:trybots.py+""linux-wayland-rel-reclient"")) - * Experiment percentage: 1.0 + * Experiment percentage: 5.0 * [mac12-arm64-rel](https://ci.chromium.org/p/chromium/builders/try/mac12-arm64-rel) ([definition](https://cs.chromium.org/search?q=+file:/try/.*\.star$+""mac12-arm64-rel"")) ([matching builders](https://cs.chromium.org/search?q=+file:trybots.py+""mac12-arm64-rel"")) * Experiment percentage: 100.0
diff --git a/infra/config/generated/luci/commit-queue.cfg b/infra/config/generated/luci/commit-queue.cfg index 0c506ca..77fee60 100644 --- a/infra/config/generated/luci/commit-queue.cfg +++ b/infra/config/generated/luci/commit-queue.cfg
@@ -3018,7 +3018,7 @@ } builders { name: "chromium/try/linux-wayland-rel-reclient" - experiment_percentage: 1 + experiment_percentage: 5 location_regexp: ".*" location_regexp_exclude: ".+/[+]/docs/.+" location_regexp_exclude: ".+/[+]/infra/config/.+"
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.linux.star b/infra/config/subprojects/chromium/try/tryserver.chromium.linux.star index 77c1318..ca2cc6b1 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.linux.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.linux.star
@@ -312,7 +312,7 @@ mirrors = builder_config.copy_from("linux-wayland-rel"), reclient_instance = reclient.instance.DEFAULT_UNTRUSTED, tryjob = try_.job( - experiment_percentage = 1, + experiment_percentage = 5, ), )
diff --git a/infra/orchestrator/BUILD.gn b/infra/orchestrator/BUILD.gn index 95265ed8..894360a 100644 --- a/infra/orchestrator/BUILD.gn +++ b/infra/orchestrator/BUILD.gn
@@ -75,4 +75,13 @@ python_library("process_perf_results_py") { pydeps_file = "//tools/perf/process_perf_results.pydeps" + + # Telemetry fails if catapult's vendored libs aren't present on the + # filesystem. But since process_perf_results.py doesn't ever import any of + # them, build/print_python_deps.py doesn't detect them. So to appease + # telemetry, just add the needed dirs directly. + data = [ + "//third_party/catapult/telemetry/third_party/", + "//third_party/catapult/third_party/six/", + ] }
diff --git a/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm b/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm index 99e31338..59c59d84 100644 --- a/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm +++ b/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm
@@ -483,6 +483,8 @@ IsRemoveDataMaskSet(mask, BrowsingDataRemoveMask::REMOVE_COOKIES)) { browser_state_->GetPrefs()->SetString(omnibox::kZeroSuggestCachedResults, std::string()); + browser_state_->GetPrefs()->SetDict( + omnibox::kZeroSuggestCachedResultsWithURL, base::Value::Dict()); } if (IsRemoveDataMaskSet(mask, BrowsingDataRemoveMask::REMOVE_DOWNLOADS)) {
diff --git a/ios/chrome/browser/flags/about_flags.mm b/ios/chrome/browser/flags/about_flags.mm index 3cbc6ea..be91af6 100644 --- a/ios/chrome/browser/flags/about_flags.mm +++ b/ios/chrome/browser/flags/about_flags.mm
@@ -860,10 +860,6 @@ FEATURE_WITH_PARAMS_VALUE_TYPE(kEnableFREDefaultBrowserPromoScreen, kFREDefaultBrowserPromoVariations, kIOSMICeAndDefaultBrowserTrialName)}, - {"enable-discover-feed-shorter-cache", - flag_descriptions::kEnableDiscoverFeedShorterCacheName, - flag_descriptions::kEnableDiscoverFeedShorterCacheDescription, - flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableDiscoverFeedShorterCache)}, {"shared-highlighting-amp", flag_descriptions::kIOSSharedHighlightingAmpName, flag_descriptions::kIOSSharedHighlightingAmpDescription, flags_ui::kOsIos, @@ -889,11 +885,6 @@ {"remove-extra-ntps", flag_descriptions::kRemoveExcessNTPsExperimentName, flag_descriptions::kRemoveExcessNTPsExperimentDescription, flags_ui::kOsIos, FEATURE_VALUE_TYPE(kRemoveExcessNTPs)}, - {"enable-shortened-password-auto-fill-instruction", - flag_descriptions::kEnableShortenedPasswordAutoFillInstructionName, - flag_descriptions::kEnableShortenedPasswordAutoFillInstructionDescription, - flags_ui::kOsIos, - FEATURE_VALUE_TYPE(kEnableShortenedPasswordAutoFillInstruction)}, {"enable-password-manager-branding-update", flag_descriptions::kIOSEnablePasswordManagerBrandingUpdateName, flag_descriptions::kIOSEnablePasswordManagerBrandingUpdateDescription,
diff --git a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc index ec03bc7f..274852f5 100644 --- a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc +++ b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc
@@ -273,11 +273,6 @@ const char kEnableDiscoverFeedGhostCardsDescription[] = "Show ghost cards when refreshing the discover feed."; -const char kEnableDiscoverFeedShorterCacheName[] = - "Enable discover feed shorter cache"; -const char kEnableDiscoverFeedShorterCacheDescription[] = - "Enable more ghost cards by using a shorter cache."; - const char kEnableDiscoverFeedStaticResourceServingName[] = "Enable discover feed static resource serving"; const char kEnableDiscoverFeedStaticResourceServingDescription[] = @@ -320,12 +315,6 @@ "Prototype to detect and highlight data with possible intent in a web " "page."; -const char kEnableShortenedPasswordAutoFillInstructionName[] = - "Enable shortened instructions to turn on Password AutoFill for Chrome"; -const char kEnableShortenedPasswordAutoFillInstructionDescription[] = - "When enabled, the instructions to turn on Password AutoFill will have " - "shorter steps and come with a button that links the user to iOS Settings."; - const char kEnableSuggestionsScrollingOnIPadName[] = "Enable omnibox suggestions scrolling on iPad"; const char kEnableSuggestionsScrollingOnIPadDescription[] =
diff --git a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h index 1f975ae..ef2995b4 100644 --- a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h +++ b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h
@@ -254,10 +254,6 @@ extern const char kEnableDiscoverFeedGhostCardsName[]; extern const char kEnableDiscoverFeedGhostCardsDescription[]; -// Title and description for the flag to shorten the cache. -extern const char kEnableDiscoverFeedShorterCacheName[]; -extern const char kEnableDiscoverFeedShorterCacheDescription[]; - // Title and description for the flag to enable the discover feed static // resource serving. extern const char kEnableDiscoverFeedStaticResourceServingName[]; @@ -285,11 +281,6 @@ extern const char kEnableFullscreenAPIName[]; extern const char kEnableFullscreenAPIDescription[]; -// Title and description for the flag to enable shorted password auto-fill -// instructions and button. -extern const char kEnableShortenedPasswordAutoFillInstructionName[]; -extern const char kEnableShortenedPasswordAutoFillInstructionDescription[]; - // Title and description for the flag to enable omnibox suggestions scrolling on // iPad. extern const char kEnableSuggestionsScrollingOnIPadName[];
diff --git a/ios/chrome/browser/promos_manager/BUILD.gn b/ios/chrome/browser/promos_manager/BUILD.gn index 4a26f629..cbd8e91 100644 --- a/ios/chrome/browser/promos_manager/BUILD.gn +++ b/ios/chrome/browser/promos_manager/BUILD.gn
@@ -23,6 +23,7 @@ "promos_manager_scene_agent.mm", ] deps = [ + "//base", "//ios/chrome/app/application_delegate:app_state_header", "//ios/chrome/browser/ui/main:observing_scene_agent", "//ios/chrome/browser/ui/main:scene_state_header",
diff --git a/ios/chrome/browser/promos_manager/promos_manager_scene_agent.mm b/ios/chrome/browser/promos_manager/promos_manager_scene_agent.mm index d72b835..2d4a46f 100644 --- a/ios/chrome/browser/promos_manager/promos_manager_scene_agent.mm +++ b/ios/chrome/browser/promos_manager/promos_manager_scene_agent.mm
@@ -4,14 +4,24 @@ #import "ios/chrome/browser/promos_manager/promos_manager_scene_agent.h" +#import "base/time/time.h" #import "ios/chrome/app/application_delegate/app_state.h" #import "ios/chrome/app/application_delegate/app_state_observer.h" +#import "ios/chrome/app/application_delegate/startup_information.h" #import "ios/chrome/browser/ui/main/scene_state.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +namespace { + +// If the previous app foregrounding occurred less than +// `kMinutesBetweenForegrounding` minutes ago, a promo won't be displayed. +constexpr int kMinutesBetweenForegrounding = 240; // (4 hours) (inclusive) + +} // namespace + @interface PromosManagerSceneAgent () <AppStateObserver> @end @@ -40,6 +50,21 @@ [self handlePromoDisplayIfUIAvailable]; } +#pragma mark - SceneStateObserver + +- (void)sceneStateDidDisableUI:(SceneState*)sceneState { + [self.sceneState.appState removeObserver:self]; + [self.sceneState removeObserver:self]; +} + +- (void)sceneState:(SceneState*)sceneState + transitionedToActivationLevel:(SceneActivationLevel)level { + // Monitor the scene activation level to consider showing a promo + // when the scene becomes active and in the foreground. In which case the + // scene is visible and interactable. + [self handlePromoDisplayIfUIAvailable]; +} + #pragma mark - Private // Handle the display of a promo if the scene UI is available to display one. @@ -62,29 +87,40 @@ if (self.sceneState.activationLevel < SceneActivationLevelForegroundActive) return NO; - // (3) There is no UI blocker. + // (3) At least `kMinutesBetweenForegrounding` have elapsed since the app was + // last foregrounded, if ever. + if (!self.sceneState.appState.lastTimeInForeground.is_null()) { + base::TimeDelta elapsedTimeSinceLastForeground = + base::TimeTicks::Now() - self.sceneState.appState.lastTimeInForeground; + + if (elapsedTimeSinceLastForeground.InMinutes() < + kMinutesBetweenForegrounding) + return NO; + } + + // (4) There is no UI blocker. if (self.sceneState.appState.currentUIBlocker) return NO; - // (4) The app isn't shutting down. + // (5) The app isn't shutting down. if (self.sceneState.appState.appIsTerminating) return NO; - // (5) There are no launch intents (external intents). + // (6) There are no launch intents (external intents). if (self.sceneState.startupHadExternalIntent) return NO; - // (6) The app isn't launching after a crash. + // (7) The app isn't launching after a crash. if (self.sceneState.appState.postCrashLaunch) return NO; // Additional, sensible checks to add to minimize user annoyance: - // (7) The user isn't currently signing in. + // (8) The user isn't currently signing in. if (self.sceneState.signinInProgress) return NO; - // (8) The user isn't currently looking at a modal overlay. + // (9) The user isn't currently looking at a modal overlay. if (self.sceneState.presentingModalOverlay) return NO;
diff --git a/ios/chrome/browser/segmentation_platform/segmentation_platform_config.mm b/ios/chrome/browser/segmentation_platform/segmentation_platform_config.mm index 08e4428..ab5899e 100644 --- a/ios/chrome/browser/segmentation_platform/segmentation_platform_config.mm +++ b/ios/chrome/browser/segmentation_platform/segmentation_platform_config.mm
@@ -39,7 +39,9 @@ SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_FEED_USER; std::string feed_segment_name = stats::OptimizationTargetToHistogramVariant(segment_id); - config->segments.insert({segment_id, Config::SegmentMetadata{feed_segment_name}}); + config->segments.insert( + {segment_id, + std::make_unique<Config::SegmentMetadata>(feed_segment_name)}); config->segment_selection_ttl = base::Days(base::GetFieldTrialParamByFeatureAsInt( features::kSegmentationPlatformFeedSegmentFeature,
diff --git a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm index b42e0a3..612efda 100644 --- a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm
@@ -3210,6 +3210,14 @@ NewTabPageTabHelper* NTPHelper = NewTabPageTabHelper::FromWebState(newWebState); if (NTPHelper && NTPHelper->IsActive()) { + // If a new web state is inserted, the user has opened a new NTP. Since we + // share the NTP coordinator across web states, the feed type could be + // different from default, so we reset it. + FeedType defaultFeedType = NTPHelper->DefaultFeedType(); + if (reason == ActiveWebStateChangeReason::Inserted && + self.ntpCoordinator.selectedFeed != defaultFeedType) { + [self.ntpCoordinator selectFeedType:defaultFeedType]; + } [self.ntpCoordinator ntpDidChangeVisibility:YES]; }
diff --git a/ios/chrome/browser/ui/ntp/feed_header_view_controller.h b/ios/chrome/browser/ui/ntp/feed_header_view_controller.h index 553ce44..b06bc58 100644 --- a/ios/chrome/browser/ui/ntp/feed_header_view_controller.h +++ b/ios/chrome/browser/ui/ntp/feed_header_view_controller.h
@@ -64,6 +64,9 @@ // Updates the header for when the Following Feed visibility has changed. - (void)updateForFollowingFeedVisibilityChanged; +// Updates the segmented control and sort button for the current feed type. +- (void)updateForSelectedFeed; + @end #endif // IOS_CHROME_BROWSER_UI_NTP_FEED_HEADER_VIEW_CONTROLLER_H_
diff --git a/ios/chrome/browser/ui/ntp/feed_header_view_controller.mm b/ios/chrome/browser/ui/ntp/feed_header_view_controller.mm index 94fa7eb..c892ca6 100644 --- a/ios/chrome/browser/ui/ntp/feed_header_view_controller.mm +++ b/ios/chrome/browser/ui/ntp/feed_header_view_controller.mm
@@ -286,6 +286,13 @@ [self applyHeaderConstraints]; } +- (void)updateForSelectedFeed { + FeedType selectedFeed = [self.feedControlDelegate selectedFeed]; + self.segmentedControl.selectedSegmentIndex = + static_cast<NSInteger>(selectedFeed); + self.sortButton.alpha = selectedFeed == FeedTypeDiscover ? 0 : 1; +} + #pragma mark - Setters // Sets `followingFeedSortType` and recreates the sort menu to assign the active
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.h b/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.h index 0015c71..2d2e5053 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.h +++ b/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.h
@@ -92,6 +92,9 @@ // Called when the given `feedType` has completed updates. - (void)handleFeedModelDidEndUpdates:(FeedType)feedType; +// Changes the selected feed on the NTP to be `feedType`. +- (void)selectFeedType:(FeedType)feedType; + @end #endif // IOS_CHROME_BROWSER_UI_NTP_NEW_TAB_PAGE_COORDINATOR_H_
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.mm b/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.mm index bb163a4..eefcdaf 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.mm +++ b/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.mm
@@ -595,6 +595,10 @@ } } +- (void)selectFeedType:(FeedType)feedType { + [self handleFeedSelected:feedType]; +} + - (void)ntpDidChangeVisibility:(BOOL)visible { if (!self.browser->GetBrowserState()->IsOffTheRecord()) { if (visible && self.started) { @@ -606,6 +610,10 @@ self.feedHeaderViewController.followingFeedSortType = (FollowingFeedSortType)self.prefService->GetInteger( prefs::kNTPFollowingFeedSortType); + // Update the header so that it's synced with the currently selected + // feed, which could have been changed when a new web state was + // inserted. + [self.feedHeaderViewController updateForSelectedFeed]; self.feedMetricsRecorder.feedControlDelegate = self; self.feedMetricsRecorder.followDelegate = self; }
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_feature.h b/ios/chrome/browser/ui/ntp/new_tab_page_feature.h index 3fda7bc..04690268 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_feature.h +++ b/ios/chrome/browser/ui/ntp/new_tab_page_feature.h
@@ -14,9 +14,6 @@ // Feature flag to show ghost cards when refreshing the discover feed. extern const base::Feature kDiscoverFeedGhostCardsEnabled; -// Feature flag to enable shorter cache so that more ghost cards appear. -extern const base::Feature kEnableDiscoverFeedShorterCache; - // Feature flag to enable static resource serving for the Discover feed. extern const base::Feature kEnableDiscoverFeedStaticResourceServing; @@ -57,9 +54,6 @@ // Whether the Discover feed content preview is shown in the context menu. bool IsDiscoverFeedPreviewEnabled(); -// Whether the Discover feed shorter cache is enabled. -bool IsDiscoverFeedShorterCacheEnabled(); - // Whether the NTP view hierarchy repair is enabled. bool IsNTPViewHierarchyRepairEnabled();
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_feature.mm b/ios/chrome/browser/ui/ntp/new_tab_page_feature.mm index b1bc99d..0518251 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_feature.mm +++ b/ios/chrome/browser/ui/ntp/new_tab_page_feature.mm
@@ -17,9 +17,6 @@ const base::Feature kDiscoverFeedGhostCardsEnabled{ "DiscoverFeedGhostCardsEnabled", base::FEATURE_DISABLED_BY_DEFAULT}; -const base::Feature kEnableDiscoverFeedShorterCache{ - "EnableDiscoverFeedShorterCache", base::FEATURE_DISABLED_BY_DEFAULT}; - const base::Feature kEnableDiscoverFeedDiscoFeedEndpoint{ "EnableDiscoFeedEndpoint", base::FEATURE_DISABLED_BY_DEFAULT}; @@ -53,10 +50,6 @@ return base::FeatureList::IsEnabled(kDiscoverFeedGhostCardsEnabled); } -bool IsDiscoverFeedShorterCacheEnabled() { - return base::FeatureList::IsEnabled(kEnableDiscoverFeedShorterCache); -} - bool IsNTPViewHierarchyRepairEnabled() { return base::FeatureList::IsEnabled(kNTPViewHierarchyRepair); }
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm b/ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm index 251fcd5..0771ab94 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm +++ b/ios/chrome/browser/ui/ntp/new_tab_page_view_controller.mm
@@ -165,6 +165,10 @@ } [self updateNTPLayout]; + + if (self.isFeedVisible) { + [self updateFeedInsetsForMinimumHeight]; + } } - (void)viewDidAppear:(BOOL)animated {
diff --git a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm index ef5a0fe..a58724b 100644 --- a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm
@@ -279,11 +279,11 @@ BOOL _settingsHasBeenDismissed; } -// The item related to the switch for the show suggestions setting. -@property(nonatomic, strong, readonly) TableViewSwitchItem* articlesForYouItem; -// The item related to the enterprise managed show suggestions setting. +// The item related to the switch for the show feed settings. +@property(nonatomic, strong, readonly) TableViewSwitchItem* feedSettingsItem; +// The item related to the enterprise managed show feed settings. @property(nonatomic, strong, readonly) - TableViewInfoButtonItem* managedArticlesForYouItem; + TableViewInfoButtonItem* managedFeedSettingsItem; @property(nonatomic, readonly, weak) id<ApplicationCommands, BrowserCommands, BrowsingDataCommands> @@ -303,8 +303,8 @@ @implementation SettingsTableViewController @synthesize dispatcher = _dispatcher; -@synthesize managedArticlesForYouItem = _managedArticlesForYouItem; -@synthesize articlesForYouItem = _articlesForYouItem; +@synthesize managedFeedSettingsItem = _managedFeedSettingsItem; +@synthesize feedSettingsItem = _feedSettingsItem; #pragma mark Initialization @@ -475,11 +475,11 @@ if (!IsFeedAblationEnabled()) { if ([_contentSuggestionPolicyEnabled value]) { - [model addItem:self.articlesForYouItem + [model addItem:self.feedSettingsItem toSectionWithIdentifier:SettingsSectionIdentifierAdvanced]; } else { - [model addItem:self.managedArticlesForYouItem + [model addItem:self.managedFeedSettingsItem toSectionWithIdentifier:SettingsSectionIdentifierAdvanced]; } } @@ -534,6 +534,19 @@ [self addPromoToSigninSection]; } +// Helper method to update the Discover Section cells when called. +- (void)updateDiscoverSection { + // Do not use self to access _managedFeedSettingsItem, as it is lazy loaded + // and will create a new item and the following will always be true. + if (_managedFeedSettingsItem) { + DCHECK(!_feedSettingsItem); + self.managedFeedSettingsItem.text = [self feedItemTitle]; + } else { + DCHECK(_feedSettingsItem); + self.feedSettingsItem.text = [self feedItemTitle]; + } +} + // Adds the identity promo to promote the sign-in or sync state. - (void)addPromoToSigninSection { TableViewItem* item = nil; @@ -1058,57 +1071,39 @@ return showMemoryDebugSwitchItem; } -- (TableViewSwitchItem*)articlesForYouItem { - if (!_articlesForYouItem) { - AuthenticationService* authService = - AuthenticationServiceFactory::GetForBrowserState( - _browser->GetBrowserState()); - BOOL isSignedIn = - authService->HasPrimaryIdentity(signin::ConsentLevel::kSignin); +- (TableViewSwitchItem*)feedSettingsItem { + if (!_feedSettingsItem) { + NSString* settingTitle = [self feedItemTitle]; - NSString* settingTitle = - (isSignedIn && IsWebChannelsEnabled()) - ? l10n_util::GetNSString(IDS_IOS_DISCOVER_AND_FOLLOWING_FEED_TITLE) - : l10n_util::GetNSString(IDS_IOS_DISCOVER_FEED_TITLE); - - _articlesForYouItem = + _feedSettingsItem = [self switchItemWithType:SettingsItemTypeArticlesForYou title:settingTitle iconImageName:kSettingsArticleSuggestionsImageName withDefaultsKey:nil accessibilityIdentifier:kSettingsArticleSuggestionsCellId]; - _articlesForYouItem.on = [_articlesEnabled value]; + _feedSettingsItem.on = [_articlesEnabled value]; } - return _articlesForYouItem; + return _feedSettingsItem; } -- (TableViewInfoButtonItem*)managedArticlesForYouItem { - if (!_managedArticlesForYouItem) { - AuthenticationService* authService = - AuthenticationServiceFactory::GetForBrowserState( - _browser->GetBrowserState()); - BOOL isSignedIn = - authService->HasPrimaryIdentity(signin::ConsentLevel::kSignin); +- (TableViewInfoButtonItem*)managedFeedSettingsItem { + if (!_managedFeedSettingsItem) { + NSString* settingTitle = [self feedItemTitle]; - NSString* settingTitle = - (isSignedIn && IsWebChannelsEnabled()) - ? l10n_util::GetNSString(IDS_IOS_DISCOVER_AND_FOLLOWING_FEED_TITLE) - : l10n_util::GetNSString(IDS_IOS_DISCOVER_FEED_TITLE); - - _managedArticlesForYouItem = [[TableViewInfoButtonItem alloc] + _managedFeedSettingsItem = [[TableViewInfoButtonItem alloc] initWithType:SettingsItemTypeManagedArticlesForYou]; - _managedArticlesForYouItem.image = + _managedFeedSettingsItem.image = [UIImage imageNamed:kSettingsArticleSuggestionsImageName]; - _managedArticlesForYouItem.text = settingTitle; - _managedArticlesForYouItem.statusText = + _managedFeedSettingsItem.text = settingTitle; + _managedFeedSettingsItem.statusText = l10n_util::GetNSString(IDS_IOS_SETTING_OFF); - _managedArticlesForYouItem.accessibilityIdentifier = + _managedFeedSettingsItem.accessibilityIdentifier = kSettingsArticleSuggestionsCellId; - _managedArticlesForYouItem.accessibilityHint = l10n_util::GetNSString( + _managedFeedSettingsItem.accessibilityHint = l10n_util::GetNSString( IDS_IOS_TOGGLE_SETTING_MANAGED_ACCESSIBILITY_HINT); } - return _managedArticlesForYouItem; + return _managedFeedSettingsItem; } #if BUILDFLAG(CHROMIUM_BRANDING) && !defined(NDEBUG) @@ -1780,6 +1775,18 @@ return base::SysUTF8ToNSString(*status); } +// Returns the appropriate text to update the title for the feed item. +- (NSString*)feedItemTitle { + AuthenticationService* authService = + AuthenticationServiceFactory::GetForBrowserState( + _browser->GetBrowserState()); + BOOL isSignedIn = + authService->HasPrimaryIdentity(signin::ConsentLevel::kSignin); + return (isSignedIn && IsWebChannelsEnabled()) + ? l10n_util::GetNSString(IDS_IOS_DISCOVER_AND_FOLLOWING_FEED_TITLE) + : l10n_util::GetNSString(IDS_IOS_DISCOVER_FEED_TITLE); +} + #pragma mark - SigninPresenter - (void)showSignin:(ShowSigninCommand*)command { @@ -1875,6 +1882,7 @@ - (void)onSyncStateChanged { [self updateSigninSection]; + [self updateDiscoverSection]; // The Identity section may be added or removed depending on sign-in is // allowed. Reload all sections in the model to account for the change. [self.tableView reloadData]; @@ -1913,32 +1921,33 @@ [self reconfigureCellsForItems:@[ _showMemoryDebugToolsItem ]]; } else if (observableBoolean == _allowChromeSigninPreference) { [self updateSigninSection]; + [self updateDiscoverSection]; // The Identity section may be added or removed depending on sign-in is // allowed. Reload all sections in the model to account for the change. [self.tableView reloadData]; } else if (observableBoolean == _articlesEnabled) { - self.articlesForYouItem.on = [_articlesEnabled value]; - [self reconfigureCellsForItems:@[ self.articlesForYouItem ]]; + self.feedSettingsItem.on = [_articlesEnabled value]; + [self reconfigureCellsForItems:@[ self.feedSettingsItem ]]; } else if (observableBoolean == _contentSuggestionPolicyEnabled) { NSIndexPath* itemIndexPath; NSInteger itemTypeToRemove; TableViewItem* itemToAdd; if ([_contentSuggestionPolicyEnabled value]) { - if (![self.tableViewModel hasItem:self.managedArticlesForYouItem]) { + if (![self.tableViewModel hasItem:self.managedFeedSettingsItem]) { return; } itemIndexPath = - [self.tableViewModel indexPathForItem:self.managedArticlesForYouItem]; + [self.tableViewModel indexPathForItem:self.managedFeedSettingsItem]; itemTypeToRemove = SettingsItemTypeManagedArticlesForYou; - itemToAdd = self.articlesForYouItem; + itemToAdd = self.feedSettingsItem; } else { - if (![self.tableViewModel hasItem:self.articlesForYouItem]) { + if (![self.tableViewModel hasItem:self.feedSettingsItem]) { return; } itemIndexPath = - [self.tableViewModel indexPathForItem:self.articlesForYouItem]; + [self.tableViewModel indexPathForItem:self.feedSettingsItem]; itemTypeToRemove = SettingsItemTypeArticlesForYou; - itemToAdd = self.managedArticlesForYouItem; + itemToAdd = self.managedFeedSettingsItem; } [self.tableViewModel removeItemWithType:itemTypeToRemove fromSectionWithIdentifier:SettingsSectionIdentifierAdvanced];
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 index 734dd9f..e6281a52 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -20887acf38309de5249655049eb7c9c4b1c0dca8 \ No newline at end of file +674f986aeb5f3167bda38521ab4b5b85e9126f8a \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 index 14560ab..129c038 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -d8af124231c0dd9147fd3033f0de9b434358b50f \ No newline at end of file +16e12b734378f80306ac5d0a34911308e67b166d \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 index eb359523..c57c1303 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -49d2aee4196a4daccebbc4861aa0a474bc43d18a \ No newline at end of file +801677c8222c456108336dee7e99725aeb462fcb \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 index d80d6899..adc71a7 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -0821aea2846e6cf5f95548c4ecca37c247a4c47e \ No newline at end of file +8d10c36bcd057470fb3081af0be31d629992ee73 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 index a9c143a..fb2de97 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -f9206e167ddf59d126179d4c404ac1771eff5a88 \ No newline at end of file +226f3c180a41af2f27835c7580e7e28385500be7 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 index c8716bd..a0aabfe 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -76fa068f145ce2c38dd3af5bb6172db180bfd38a \ No newline at end of file +f6de4eac18c171a12d3a43037802adfc9a7bd4fa \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 index f0f55bce..955d2eb 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -01f56972e9f8d47370c005f28a63896fbe7718a5 \ No newline at end of file +1562f88ea478a04891f0b3578524c44ef7361b6c \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 index d34a639..0f749e99 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -10f64930d76ea71d05cef46a5604a5893c7fd88c \ No newline at end of file +4ddc2ee0f3723982956f2f017c866727cb837da7 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 index 7b9550f..3ad1986e 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -928e4b7e3c62847e7cdf390cfd0a9475140f2c3a \ No newline at end of file +21671e748669e30a3bed4365a259903e8cc09cab \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 index 52712e1..7cde37e 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -4c2a7e8e8118b0d8595514ba02ace0e3998a4e3d \ No newline at end of file +b599268754090bd41d0e1fa9064acb26d9dcf962 \ No newline at end of file
diff --git a/mojo/core/run_all_core_unittests.cc b/mojo/core/run_all_core_unittests.cc index b6d995d..f23792c 100644 --- a/mojo/core/run_all_core_unittests.cc +++ b/mojo/core/run_all_core_unittests.cc
@@ -9,6 +9,7 @@ #include "base/files/file_util.h" #include "base/logging.h" #include "base/test/launcher/unit_test_launcher.h" +#include "base/test/scoped_feature_list.h" #include "base/test/test_suite.h" #include "build/build_config.h" #include "mojo/core/mojo_core_unittest.h" @@ -40,6 +41,7 @@ int main(int argc, char** argv) { base::TestSuite test_suite(argc, argv); + base::test::ScopedFeatureList feature_list; MojoInitializeFlags flags = MOJO_INITIALIZE_FLAG_NONE; const base::CommandLine& command_line = @@ -51,6 +53,10 @@ if (command_line.HasSwitch(switches::kMojoUseExplicitLibraryPath)) library_path = GetMojoCoreLibraryPath(); + feature_list.InitFromCommandLine( + command_line.GetSwitchValueASCII(switches::kEnableFeatures), + command_line.GetSwitchValueASCII(switches::kDisableFeatures)); + if (command_line.HasSwitch(switches::kMojoLoadBeforeInit)) { CHECK_EQ(MOJO_RESULT_OK, mojo::LoadCoreLibrary(library_path)); CHECK_EQ(MOJO_RESULT_OK, mojo::InitializeCoreLibrary(flags));
diff --git a/net/cert/test_root_certs.cc b/net/cert/test_root_certs.cc index dabb876..fd158a0 100644 --- a/net/cert/test_root_certs.cc +++ b/net/cert/test_root_certs.cc
@@ -7,10 +7,6 @@ #include <string> #include <utility> -#include "base/files/file_path.h" -#include "base/files/file_util.h" -#include "base/logging.h" -#include "base/threading/thread_restrictions.h" #include "net/cert/pki/cert_errors.h" #include "net/cert/x509_certificate.h" #include "net/cert/x509_util.h" @@ -25,17 +21,6 @@ base::LazyInstance<TestRootCerts>::Leaky g_test_root_certs = LAZY_INSTANCE_INITIALIZER; -CertificateList LoadCertificates(const base::FilePath& filename) { - std::string raw_cert; - if (!base::ReadFileToString(filename, &raw_cert)) { - LOG(ERROR) << "Can't load certificate " << filename.value(); - return CertificateList(); - } - - return X509Certificate::CreateCertificateListFromBytes( - base::as_bytes(base::make_span(raw_cert)), X509Certificate::FORMAT_AUTO); -} - } // namespace // static @@ -60,15 +45,6 @@ return AddImpl(certificate); } -bool TestRootCerts::AddFromFile(const base::FilePath& file) { - base::ThreadRestrictions::ScopedAllowIO allow_io_for_loading_test_certs; - CertificateList root_certs = LoadCertificates(file); - if (root_certs.empty() || root_certs.size() > 1) - return false; - - return Add(root_certs.front().get()); -} - void TestRootCerts::Clear() { ClearImpl(); test_trust_store_.Clear(); @@ -93,6 +69,17 @@ Reset(std::move(certs)); } +ScopedTestRoot::ScopedTestRoot(ScopedTestRoot&& other) { + *this = std::move(other); +} + +ScopedTestRoot& ScopedTestRoot::operator=(ScopedTestRoot&& other) { + CertificateList tmp_certs; + tmp_certs.swap(other.certs_); + Reset(std::move(tmp_certs)); + return *this; +} + ScopedTestRoot::~ScopedTestRoot() { Reset({}); }
diff --git a/net/cert/test_root_certs.h b/net/cert/test_root_certs.h index 4a3fd5a..c299b3c 100644 --- a/net/cert/test_root_certs.h +++ b/net/cert/test_root_certs.h
@@ -6,7 +6,6 @@ #define NET_CERT_TEST_ROOT_CERTS_H_ #include "base/lazy_instance.h" -#include "base/memory/ref_counted.h" #include "build/build_config.h" #include "net/base/net_export.h" #include "net/cert/pki/trust_store_in_memory.h" @@ -21,10 +20,6 @@ #include "base/mac/scoped_cftyperef.h" #endif -namespace base { -class FilePath; -} - namespace net { class X509Certificate; @@ -33,6 +28,9 @@ // TestRootCerts is a helper class for unit tests that is used to // artificially mark a certificate as trusted, independent of the local // machine configuration. +// +// Test roots can be added using the ScopedTestRoot class below. See the +// class documentation for usage and limitations. class NET_EXPORT TestRootCerts { public: // Obtains the Singleton instance to the trusted certificates. @@ -44,16 +42,6 @@ // Returns true if an instance exists, without forcing an initialization. static bool HasInstance(); - // Marks |certificate| as trusted in the effective trust store - // used by CertVerifier::Verify(). Returns false if the - // certificate could not be marked trusted. - bool Add(X509Certificate* certificate); - - // Reads a single certificate from |file| and marks it as trusted. Returns - // false if an error is encountered, such as being unable to read |file| - // or more than one certificate existing in |file|. - bool AddFromFile(const base::FilePath& file); - // Clears the trusted status of any certificates that were previously // marked trusted via Add(). void Clear(); @@ -81,10 +69,16 @@ private: friend struct base::LazyInstanceTraitsBase<TestRootCerts>; + friend class ScopedTestRoot; TestRootCerts(); ~TestRootCerts(); + // Marks |certificate| as trusted in the effective trust store + // used by CertVerifier::Verify(). Returns false if the + // certificate could not be marked trusted. + bool Add(X509Certificate* certificate); + // Performs platform-dependent operations. void Init(); bool AddImpl(X509Certificate* certificate); @@ -100,21 +94,27 @@ }; // Scoped helper for unittests to handle safely managing trusted roots. -class NET_EXPORT_PRIVATE ScopedTestRoot { +// +// Limitations: +// Multiple instances of ScopedTestRoot may be created at once, which will +// trust the union of the certs provided. However, when one of the +// ScopedTestRoot instances removes its trust, either by going out of scope, or +// by Reset() being called, *all* test root certs will be untrusted. (This +// limitation could be removed if a reason arises.) +class NET_EXPORT ScopedTestRoot { public: ScopedTestRoot(); - // Creates a ScopedTestRoot that sets |cert| as the single root in the - // TestRootCerts store (if there were existing roots they are - // cleared). + // Creates a ScopedTestRoot that adds |cert| to the TestRootCerts store. explicit ScopedTestRoot(X509Certificate* cert); - // Creates a ScopedTestRoot that sets |certs| as the only roots in the - // TestRootCerts store (if there were existing roots they are - // cleared). + // Creates a ScopedTestRoot that adds |certs| to the TestRootCerts store. explicit ScopedTestRoot(CertificateList certs); ScopedTestRoot(const ScopedTestRoot&) = delete; ScopedTestRoot& operator=(const ScopedTestRoot&) = delete; + ScopedTestRoot(ScopedTestRoot&& other); + ScopedTestRoot& operator=(ScopedTestRoot&& other); + ~ScopedTestRoot(); // Assigns |certs| to be the new test root certs. If |certs| is empty, undoes @@ -124,6 +124,9 @@ // cleared. void Reset(CertificateList certs); + // Returns true if this ScopedTestRoot has no certs assigned. + bool IsEmpty() const { return certs_.empty(); } + private: CertificateList certs_; };
diff --git a/net/cert/test_root_certs_unittest.cc b/net/cert/test_root_certs_unittest.cc index 36b1406..f430c590 100644 --- a/net/cert/test_root_certs_unittest.cc +++ b/net/cert/test_root_certs_unittest.cc
@@ -59,26 +59,10 @@ ASSERT_NE(static_cast<TestRootCerts*>(nullptr), test_roots); EXPECT_TRUE(test_roots->IsEmpty()); - EXPECT_TRUE(test_roots->Add(root_cert.get())); - EXPECT_FALSE(test_roots->IsEmpty()); - - test_roots->Clear(); - EXPECT_TRUE(test_roots->IsEmpty()); -} - -// Test basic functionality when adding directly from a file, which should -// behave the same as when adding from an existing certificate. -TEST(TestRootCertsTest, AddFromFile) { - TestRootCerts* test_roots = TestRootCerts::GetInstance(); - ASSERT_NE(static_cast<TestRootCerts*>(nullptr), test_roots); - EXPECT_TRUE(test_roots->IsEmpty()); - - base::FilePath cert_path = - GetTestCertsDirectory().AppendASCII(kRootCertificateFile); - EXPECT_TRUE(test_roots->AddFromFile(cert_path)); - EXPECT_FALSE(test_roots->IsEmpty()); - - test_roots->Clear(); + { + ScopedTestRoot scoped_root(root_cert.get()); + EXPECT_FALSE(test_roots->IsEmpty()); + } EXPECT_TRUE(test_roots->IsEmpty()); } @@ -109,8 +93,10 @@ EXPECT_NE(0u, bad_verify_result.cert_status & CERT_STATUS_AUTHORITY_INVALID); // Add the root certificate and mark it as trusted. - EXPECT_TRUE(test_roots->AddFromFile( - GetTestCertsDirectory().AppendASCII(kRootCertificateFile))); + scoped_refptr<X509Certificate> root_cert = + ImportCertFromFile(GetTestCertsDirectory(), kRootCertificateFile); + ASSERT_TRUE(root_cert); + ScopedTestRoot scoped_root(root_cert.get()); EXPECT_FALSE(test_roots->IsEmpty()); // Test that the certificate verification now succeeds, because the @@ -141,6 +127,91 @@ EXPECT_EQ(bad_verify_result.cert_status, restored_verify_result.cert_status); } +TEST(TestRootCertsTest, Moveable) { + TestRootCerts* test_roots = TestRootCerts::GetInstance(); + ASSERT_NE(static_cast<TestRootCerts*>(nullptr), test_roots); + EXPECT_TRUE(test_roots->IsEmpty()); + + scoped_refptr<X509Certificate> test_cert = + ImportCertFromFile(GetTestCertsDirectory(), kGoodCertificateFile); + ASSERT_NE(static_cast<X509Certificate*>(nullptr), test_cert.get()); + + int flags = 0; + CertVerifyResult bad_verify_result; + int bad_status; + scoped_refptr<CertVerifyProc> verify_proc(CreateCertVerifyProc()); + { + // Empty ScopedTestRoot at outer scope has no effect. + ScopedTestRoot scoped_root_outer; + EXPECT_TRUE(test_roots->IsEmpty()); + + // Test that the good certificate fails verification, because the root + // certificate should not yet be trusted. + bad_status = verify_proc->Verify( + test_cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), + /*sct_list=*/std::string(), flags, net::CRLSet::BuiltinCRLSet().get(), + CertificateList(), &bad_verify_result, NetLogWithSource()); + EXPECT_NE(OK, bad_status); + EXPECT_NE(0u, + bad_verify_result.cert_status & CERT_STATUS_AUTHORITY_INVALID); + + { + // Add the root certificate and mark it as trusted. + scoped_refptr<X509Certificate> root_cert = + ImportCertFromFile(GetTestCertsDirectory(), kRootCertificateFile); + ASSERT_TRUE(root_cert); + ScopedTestRoot scoped_root_inner(root_cert.get()); + EXPECT_FALSE(test_roots->IsEmpty()); + + // Test that the certificate verification now succeeds, because the + // TestRootCerts is successfully imbuing trust. + CertVerifyResult good_verify_result; + int good_status = verify_proc->Verify( + test_cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), + /*sct_list=*/std::string(), flags, CRLSet::BuiltinCRLSet().get(), + CertificateList(), &good_verify_result, NetLogWithSource()); + EXPECT_THAT(good_status, IsOk()); + EXPECT_EQ(0u, good_verify_result.cert_status); + + EXPECT_FALSE(scoped_root_inner.IsEmpty()); + EXPECT_TRUE(scoped_root_outer.IsEmpty()); + // Move from inner scoped root to outer + scoped_root_outer = std::move(scoped_root_inner); + EXPECT_FALSE(test_roots->IsEmpty()); + EXPECT_FALSE(scoped_root_outer.IsEmpty()); + } + // After inner scoper was freed, test root is still trusted since ownership + // was moved to the outer scoper. + EXPECT_FALSE(test_roots->IsEmpty()); + EXPECT_FALSE(scoped_root_outer.IsEmpty()); + + // Test that the certificate verification still succeeds, because the + // TestRootCerts is successfully imbuing trust. + CertVerifyResult good_verify_result; + int good_status = verify_proc->Verify( + test_cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), + /*sct_list=*/std::string(), flags, CRLSet::BuiltinCRLSet().get(), + CertificateList(), &good_verify_result, NetLogWithSource()); + EXPECT_THAT(good_status, IsOk()); + EXPECT_EQ(0u, good_verify_result.cert_status); + } + EXPECT_TRUE(test_roots->IsEmpty()); + + // Ensure that when the TestRootCerts is cleared, the trust settings + // revert to their original state, and don't linger. If trust status + // lingers, it will likely break other tests in net_unittests. + CertVerifyResult restored_verify_result; + int restored_status = verify_proc->Verify( + test_cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), + /*sct_list=*/std::string(), flags, CRLSet::BuiltinCRLSet().get(), + CertificateList(), &restored_verify_result, NetLogWithSource()); + EXPECT_NE(OK, restored_status); + EXPECT_NE(0u, + restored_verify_result.cert_status & CERT_STATUS_AUTHORITY_INVALID); + EXPECT_EQ(bad_status, restored_status); + EXPECT_EQ(bad_verify_result.cert_status, restored_verify_result.cert_status); +} + // TODO(rsleevi): Add tests for revocation checking via CRLs, ensuring that // TestRootCerts properly injects itself into the validation process. See // http://crbug.com/63958
diff --git a/net/test/embedded_test_server/embedded_test_server.cc b/net/test/embedded_test_server/embedded_test_server.cc index f0494ed..ed5b06c 100644 --- a/net/test/embedded_test_server/embedded_test_server.cc +++ b/net/test/embedded_test_server/embedded_test_server.cc
@@ -35,7 +35,6 @@ #include "net/base/net_errors.h" #include "net/base/port_util.h" #include "net/cert/pki/extended_key_usage.h" -#include "net/cert/test_root_certs.h" #include "net/log/net_log_source.h" #include "net/socket/next_proto.h" #include "net/socket/ssl_server_socket.h" @@ -284,7 +283,7 @@ if (!is_using_ssl_) return; - RegisterTestCerts(); + scoped_test_root_ = RegisterTestCerts(); } EmbeddedTestServer::~EmbeddedTestServer() { @@ -299,12 +298,12 @@ } } -void EmbeddedTestServer::RegisterTestCerts() { +ScopedTestRoot EmbeddedTestServer::RegisterTestCerts() { base::ScopedAllowBlockingForTesting allow_blocking; - TestRootCerts* root_certs = TestRootCerts::GetInstance(); - bool added_root_certs = root_certs->AddFromFile(GetRootCertPemPath()); - DCHECK(added_root_certs) - << "Failed to install root cert from EmbeddedTestServer"; + auto root = ImportCertFromFile(GetRootCertPemPath()); + if (!root) + return ScopedTestRoot(); + return ScopedTestRoot(root.get()); } void EmbeddedTestServer::SetConnectionListener(
diff --git a/net/test/embedded_test_server/embedded_test_server.h b/net/test/embedded_test_server/embedded_test_server.h index 7716d2be..218eb68 100644 --- a/net/test/embedded_test_server/embedded_test_server.h +++ b/net/test/embedded_test_server/embedded_test_server.h
@@ -24,6 +24,7 @@ #include "net/base/host_port_pair.h" #include "net/base/ip_endpoint.h" #include "net/cert/ocsp_revocation_status.h" +#include "net/cert/test_root_certs.h" #include "net/cert/x509_certificate.h" #include "net/socket/ssl_server_socket.h" #include "net/socket/stream_socket.h" @@ -347,7 +348,7 @@ // Registers the EmbeddedTestServer's certs for the current process. See // constructor documentation for more information. - static void RegisterTestCerts(); + [[nodiscard]] static ScopedTestRoot RegisterTestCerts(); // Sets a connection listener, that would be notified when various connection // events happen. May only be called before the server is started. Caller @@ -586,6 +587,7 @@ base::ThreadChecker thread_checker_; + ScopedTestRoot scoped_test_root_; net::SSLServerConfig ssl_config_; ServerCertificate cert_ = CERT_OK; ServerCertificateConfig cert_config_;
diff --git a/net/test/spawned_test_server/base_test_server.cc b/net/test/spawned_test_server/base_test_server.cc index ceb3eefc..83a35eda 100644 --- a/net/test/spawned_test_server/base_test_server.cc +++ b/net/test/spawned_test_server/base_test_server.cc
@@ -24,10 +24,10 @@ #include "net/base/net_errors.h" #include "net/base/network_isolation_key.h" #include "net/base/port_util.h" -#include "net/cert/test_root_certs.h" #include "net/cert/x509_certificate.h" #include "net/dns/public/dns_query_type.h" #include "net/log/net_log_with_source.h" +#include "net/test/cert_test_util.h" #include "net/test/test_data_directory.h" #include "url/gurl.h" @@ -68,12 +68,6 @@ return true; } -bool RegisterRootCertsInternal(const base::FilePath& file_path) { - TestRootCerts* root_certs = TestRootCerts::GetInstance(); - return root_certs->AddFromFile(file_path.AppendASCII("ocsp-test-root.pem")) && - root_certs->AddFromFile(file_path.AppendASCII("root_ca_cert.pem")); -} - } // namespace BaseTestServer::SSLOptions::SSLOptions() = default; @@ -230,30 +224,18 @@ return true; } -void BaseTestServer::RegisterTestCerts() { - bool added_root_certs = RegisterRootCertsInternal(GetTestCertsDirectory()); - DCHECK(added_root_certs); +ScopedTestRoot BaseTestServer::RegisterTestCerts() { + auto root1 = + ImportCertFromFile(GetTestCertsDirectory(), "ocsp-test-root.pem"); + auto root2 = ImportCertFromFile(GetTestCertsDirectory(), "root_ca_cert.pem"); + if (!root1 || !root2) + return ScopedTestRoot(); + return ScopedTestRoot(CertificateList{root1, root2}); } -bool BaseTestServer::LoadTestRootCert() const { - TestRootCerts* root_certs = TestRootCerts::GetInstance(); - DCHECK(root_certs); - - // Should always use absolute path to load the root certificate. - base::FilePath root_certificate_path; - if (!GetLocalCertificatesDir(certificates_dir_, &root_certificate_path)) { - LOG(ERROR) << "Could not get local certificates directory from " - << certificates_dir_ << "."; - return false; - } - - if (!RegisterRootCertsInternal(root_certificate_path)) { - LOG(ERROR) << "Could not register root certificates from " - << root_certificate_path << "."; - return false; - } - - return true; +bool BaseTestServer::LoadTestRootCert() { + scoped_test_root_ = RegisterTestCerts(); + return !scoped_test_root_.IsEmpty(); } scoped_refptr<X509Certificate> BaseTestServer::GetCertificate() const { @@ -342,9 +324,7 @@ } void BaseTestServer::CleanUpWhenStoppingServer() { - TestRootCerts* root_certs = TestRootCerts::GetInstance(); - root_certs->Clear(); - + scoped_test_root_.Reset({}); host_port_pair_.set_port(0); allowed_port_.reset(); started_ = false;
diff --git a/net/test/spawned_test_server/base_test_server.h b/net/test/spawned_test_server/base_test_server.h index 149f11a..3475e32 100644 --- a/net/test/spawned_test_server/base_test_server.h +++ b/net/test/spawned_test_server/base_test_server.h
@@ -19,6 +19,7 @@ #include "base/memory/ref_counted.h" #include "base/values.h" #include "net/base/host_port_pair.h" +#include "net/cert/test_root_certs.h" #include "third_party/abseil-cpp/absl/types/optional.h" class GURL; @@ -27,6 +28,7 @@ class AddressList; class ScopedPortException; +class ScopedTestRoot; class X509Certificate; // The base class of Test server implementation. @@ -176,11 +178,11 @@ } // Registers the test server's certs for the current process. - static void RegisterTestCerts(); + [[nodiscard]] static ScopedTestRoot RegisterTestCerts(); // Marks the root certificate of an HTTPS test server as trusted for // the duration of tests. - [[nodiscard]] bool LoadTestRootCert() const; + [[nodiscard]] bool LoadTestRootCert(); // Returns the certificate that the server is using. scoped_refptr<X509Certificate> GetCertificate() const; @@ -233,6 +235,8 @@ // Directory that contains the SSL certificates. base::FilePath certificates_dir_; + ScopedTestRoot scoped_test_root_; + // Address on which the tests should connect to the server. With // RemoteTestServer it may be different from the address on which the server // listens on.
diff --git a/net/tools/cert_verify_tool/verify_using_cert_verify_proc.cc b/net/tools/cert_verify_tool/verify_using_cert_verify_proc.cc index 81221a9..bd722e3 100644 --- a/net/tools/cert_verify_tool/verify_using_cert_verify_proc.cc +++ b/net/tools/cert_verify_tool/verify_using_cert_verify_proc.cc
@@ -129,14 +129,13 @@ net::TestRootCerts* test_root_certs = net::TestRootCerts::GetInstance(); CHECK(test_root_certs->IsEmpty()); + net::ScopedTestRoot scoped_test_roots; if (!x509_additional_trust_anchors.empty() && !cert_verify_proc->SupportsAdditionalTrustAnchors()) { std::cerr << "NOTE: Additional trust anchors not supported on this " "platform. Using TestRootCerts instead.\n"; - for (const auto& trust_anchor : x509_additional_trust_anchors) - test_root_certs->Add(trust_anchor.get()); - + scoped_test_roots.Reset(x509_additional_trust_anchors); x509_additional_trust_anchors.clear(); } @@ -147,9 +146,6 @@ /*ocsp_response=*/std::string(), /*sct_list=*/std::string(), flags, crl_set, x509_additional_trust_anchors, &result, net::NetLogWithSource()); - // Remove any temporary trust anchors. - test_root_certs->Clear(); - std::cout << "CertVerifyProc result: " << net::ErrorToShortString(rv) << "\n"; PrintCertVerifyResult(result); if (!dump_path.empty() && result.verified_cert) {
diff --git a/printing/backend/OWNERS b/printing/backend/OWNERS index 574fd32..399f92a1 100644 --- a/printing/backend/OWNERS +++ b/printing/backend/OWNERS
@@ -1,2 +1,2 @@ # CUPS-specific code. -per-file *cups*=skau@chromium.org +per-file *cups*=file://chromeos/printing/OWNERS
diff --git a/services/network/network_context.cc b/services/network/network_context.cc index 33264a4..41cb92c 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc
@@ -2063,7 +2063,7 @@ } void NetworkContext::AddDomainReliabilityContextForTesting( - const GURL& origin, + const url::Origin& origin, const GURL& upload_url, AddDomainReliabilityContextForTestingCallback callback) { auto config = std::make_unique<domain_reliability::DomainReliabilityConfig>(); @@ -2824,7 +2824,7 @@ #endif // BUILDFLAG(IS_P2P_ENABLED) void NetworkContext::CanUploadDomainReliability( - const GURL& origin, + const url::Origin& origin, base::OnceCallback<void(bool)> callback) { client_->OnCanSendDomainReliabilityUpload( origin,
diff --git a/services/network/network_context.h b/services/network/network_context.h index fe906c83..0d6063bd 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h
@@ -459,7 +459,7 @@ mojom::SignedExchangeReportPtr report, const net::NetworkIsolationKey& network_isolation_key) override; void AddDomainReliabilityContextForTesting( - const GURL& origin, + const url::Origin& origin, const GURL& upload_url, AddDomainReliabilityContextForTestingCallback callback) override; void ForceDomainReliabilityUploadsForTesting( @@ -646,7 +646,7 @@ void DestroySocketManager(P2PSocketManager* socket_manager); #endif // BUILDFLAG(IS_P2P_ENABLED) - void CanUploadDomainReliability(const GURL& origin, + void CanUploadDomainReliability(const url::Origin& origin, base::OnceCallback<void(bool)> callback); void OnVerifyCertForSignedExchangeComplete(uint64_t cert_verify_id,
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom index 99cd010..d911012 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom
@@ -799,7 +799,7 @@ (array<url.mojom.Origin> origins); // Checks if a Domain Reliability report can be uploaded for the given origin. - OnCanSendDomainReliabilityUpload(url.mojom.Url origin) => (bool allowed); + OnCanSendDomainReliabilityUpload(url.mojom.Origin origin) => (bool allowed); // Called to generate an auth token for SPNEGO authentication on Android. [EnableIf=is_android] @@ -1459,7 +1459,7 @@ [Sync] // Adds a Domain Reliability Context. AddDomainReliabilityContextForTesting( - url.mojom.Url origin, url.mojom.Url upload_url) => (); + url.mojom.Origin origin, url.mojom.Url upload_url) => (); [Sync] // Forces all pending Domain Reliability uploads to run now, even if their
diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h index 82edffa..538e9787 100644 --- a/services/network/test/test_network_context.h +++ b/services/network/test/test_network_context.h
@@ -278,7 +278,7 @@ const std::string& host, DeleteDynamicDataForHostCallback callback) override {} void AddDomainReliabilityContextForTesting( - const GURL& origin, + const url::Origin& origin, const GURL& upload_url, AddDomainReliabilityContextForTestingCallback callback) override {} void ForceDomainReliabilityUploadsForTesting(
diff --git a/services/network/test/test_network_context_client.h b/services/network/test/test_network_context_client.h index af8682b..95a4cdf 100644 --- a/services/network/test/test_network_context_client.h +++ b/services/network/test/test_network_context_client.h
@@ -40,7 +40,7 @@ const std::vector<url::Origin>& origins, OnCanSendReportingReportsCallback callback) override {} void OnCanSendDomainReliabilityUpload( - const GURL& origin, + const url::Origin& origin, OnCanSendDomainReliabilityUploadCallback callback) override {} #if BUILDFLAG(IS_ANDROID) void OnGenerateHttpNegotiateAuthToken(
diff --git a/services/network/url_loader_unittest.cc b/services/network/url_loader_unittest.cc index eaebf5f..590ae44 100644 --- a/services/network/url_loader_unittest.cc +++ b/services/network/url_loader_unittest.cc
@@ -677,9 +677,12 @@ public: URLLoaderTest() : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { - net::TestRootCerts* root_certs = net::TestRootCerts::GetInstance(); - root_certs->AddFromFile( + scoped_refptr<net::X509Certificate> quic_root = net::ImportCertFromFile( net::GetTestCertsDirectory().AppendASCII("quic-root.pem")); + if (quic_root) + scoped_test_root_.Reset({quic_root}); + else + ADD_FAILURE(); net::QuicSimpleTestServer::Start(); net::URLRequestFailedJob::AddUrlHandler(); @@ -1113,6 +1116,7 @@ base::test::ScopedFeatureList scoped_feature_list_; base::test::TaskEnvironment task_environment_; + net::ScopedTestRoot scoped_test_root_; net::EmbeddedTestServer test_server_; std::unique_ptr<net::ScopedDefaultHostResolverProc> mock_host_resolver_; raw_ptr<net::TestNetworkDelegate>
diff --git a/services/service_manager/public/cpp/service_executable/BUILD.gn b/services/service_manager/public/cpp/service_executable/BUILD.gn index 4c1c496..e07aaf61 100644 --- a/services/service_manager/public/cpp/service_executable/BUILD.gn +++ b/services/service_manager/public/cpp/service_executable/BUILD.gn
@@ -52,11 +52,13 @@ sources = [ "main.cc" ] public_deps = [ "//services/service_manager/public/mojom" ] + testonly = true deps = [ ":support", "//base", "//base:base_static", "//base:i18n", + "//base/test:test_support", ] }
diff --git a/services/service_manager/public/cpp/service_executable/main.cc b/services/service_manager/public/cpp/service_executable/main.cc index b6f6e8b..3b2d494 100644 --- a/services/service_manager/public/cpp/service_executable/main.cc +++ b/services/service_manager/public/cpp/service_executable/main.cc
@@ -8,7 +8,6 @@ #include "base/containers/contains.h" #include "base/debug/debugger.h" #include "base/debug/stack_trace.h" -#include "base/feature_list.h" #include "base/files/file_path.h" #include "base/i18n/icu_util.h" #include "base/logging.h" @@ -17,6 +16,7 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/task/thread_pool/thread_pool_instance.h" +#include "base/test/scoped_feature_list.h" #include "build/build_config.h" #include "services/service_manager/public/cpp/service_executable/service_executable_environment.h" #include "services/service_manager/public/cpp/service_executable/service_main.h" @@ -91,7 +91,8 @@ #endif base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - base::FeatureList::InitializeInstance( + base::test::ScopedFeatureList feature_list; + feature_list.InitFromCommandLine( command_line->GetSwitchValueASCII(switches::kEnableFeatures), command_line->GetSwitchValueASCII(switches::kDisableFeatures));
diff --git a/testing/buildbot/chrome.json b/testing/buildbot/chrome.json index 354a4de8..ca6041c 100644 --- a/testing/buildbot/chrome.json +++ b/testing/buildbot/chrome.json
@@ -1932,7 +1932,7 @@ { "args": [], "cros_board": "atlas", - "cros_img": "atlas-release/R105-14989.11.0", + "cros_img": "atlas-release/R106-15036.0.0", "name": "lacros_all_tast_tests ATLAS_RELEASE_DEV", "resultdb": { "enable": true, @@ -1996,7 +1996,7 @@ { "args": [], "cros_board": "eve", - "cros_img": "eve-release/R105-14989.11.0", + "cros_img": "eve-release/R106-15036.0.0", "name": "lacros_all_tast_tests EVE_RELEASE_DEV", "resultdb": { "enable": true, @@ -2103,7 +2103,7 @@ { "args": [], "cros_board": "jacuzzi", - "cros_img": "jacuzzi-release/R105-14989.11.0", + "cros_img": "jacuzzi-release/R106-15036.0.0", "name": "lacros_all_tast_tests JACUZZI_RELEASE_DEV", "resultdb": { "enable": true,
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index 3c91fb1..a134574 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -5753,21 +5753,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5232.0", + "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "dimension_sets": [ @@ -5780,7 +5780,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "isolate_profile_data": true, @@ -5918,21 +5918,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5232.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "dimension_sets": [ @@ -5944,7 +5944,7 @@ }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "args": [ @@ -6064,21 +6064,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5232.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "dimension_sets": [ @@ -6090,7 +6090,7 @@ }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "isolate_profile_data": true,
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 369abc5..db2f912b 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -99293,21 +99293,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5232.0", + "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", @@ -99315,7 +99315,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "isolate_profile_data": true, @@ -99428,28 +99428,28 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5232.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "args": [ @@ -99549,28 +99549,28 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5232.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "isolate_profile_data": true, @@ -100908,20 +100908,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5232.0", + "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "dimension_sets": [ @@ -100935,7 +100935,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "merge": { @@ -101073,20 +101073,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5232.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "dimension_sets": [ @@ -101099,7 +101099,7 @@ }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "args": [ @@ -101219,20 +101219,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5232.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "dimension_sets": [ @@ -101245,7 +101245,7 @@ }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "merge": { @@ -102741,20 +102741,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5232.0", + "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "dimension_sets": [ @@ -102768,7 +102768,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "merge": { @@ -102906,20 +102906,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5232.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "dimension_sets": [ @@ -102932,7 +102932,7 @@ }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "args": [ @@ -103052,20 +103052,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5232.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "dimension_sets": [ @@ -103078,7 +103078,7 @@ }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "merge": { @@ -103813,20 +103813,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5232.0", + "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "dimension_sets": [ @@ -103839,7 +103839,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" } ] },
diff --git a/testing/buildbot/chromium.memory.json b/testing/buildbot/chromium.memory.json index 680dc015..a94139d 100644 --- a/testing/buildbot/chromium.memory.json +++ b/testing/buildbot/chromium.memory.json
@@ -20871,21 +20871,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5232.0", + "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "dimension_sets": [ @@ -20898,7 +20898,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "isolate_profile_data": true, @@ -21036,21 +21036,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5232.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "dimension_sets": [ @@ -21062,7 +21062,7 @@ }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "args": [ @@ -21182,21 +21182,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5232.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5234.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5232.0", - "revision": "version:106.0.5232.0" + "location": "lacros_version_skew_tests_v106.0.5234.0", + "revision": "version:106.0.5234.0" } ], "dimension_sets": [ @@ -21208,7 +21208,7 @@ }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 106.0.5232.0" + "variant_id": "Lacros version skew testing ash 106.0.5234.0" }, { "isolate_profile_data": true,
diff --git a/testing/buildbot/internal.chromeos.fyi.json b/testing/buildbot/internal.chromeos.fyi.json index ae285aa..34de8f3 100644 --- a/testing/buildbot/internal.chromeos.fyi.json +++ b/testing/buildbot/internal.chromeos.fyi.json
@@ -1049,7 +1049,7 @@ { "args": [], "cros_board": "octopus", - "cros_img": "octopus-release/R105-14989.11.0", + "cros_img": "octopus-release/R106-15036.0.0", "name": "lacros_fyi_tast_tests OCTOPUS_RELEASE_DEV", "swarming": {}, "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", @@ -1096,7 +1096,7 @@ { "args": [], "cros_board": "octopus", - "cros_img": "octopus-release/R105-14989.11.0", + "cros_img": "octopus-release/R106-15036.0.0", "name": "ozone_unittests OCTOPUS_RELEASE_DEV", "swarming": {}, "test": "ozone_unittests",
diff --git a/testing/buildbot/variants.pyl b/testing/buildbot/variants.pyl index 66f02e9..8743ae7f 100644 --- a/testing/buildbot/variants.pyl +++ b/testing/buildbot/variants.pyl
@@ -22,15 +22,15 @@ }, 'LACROS_VERSION_SKEW_CANARY': { 'args': [ - '--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5232.0/test_ash_chrome', + '--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5234.0/test_ash_chrome', ], - 'identifier': 'Lacros version skew testing ash 106.0.5232.0', + 'identifier': 'Lacros version skew testing ash 106.0.5234.0', 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/linux-ash-chromium/x86_64/ash.zip', - 'location': 'lacros_version_skew_tests_v106.0.5232.0', - 'revision': 'version:106.0.5232.0', + 'location': 'lacros_version_skew_tests_v106.0.5234.0', + 'revision': 'version:106.0.5234.0', }, ], }, @@ -863,8 +863,8 @@ 'CROS_ATLAS_RELEASE_DEV': { 'skylab': { 'cros_board': 'atlas', - 'cros_chrome_version': '105.0.5195.5', - 'cros_img': 'atlas-release/R105-14989.11.0', + 'cros_chrome_version': '106.0.5226.0', + 'cros_img': 'atlas-release/R106-15036.0.0', }, 'enabled': True, 'identifier': 'ATLAS_RELEASE_DEV', @@ -899,8 +899,8 @@ 'CROS_EVE_RELEASE_DEV': { 'skylab': { 'cros_board': 'eve', - 'cros_chrome_version': '105.0.5195.5', - 'cros_img': 'eve-release/R105-14989.11.0', + 'cros_chrome_version': '106.0.5226.0', + 'cros_img': 'eve-release/R106-15036.0.0', }, 'enabled': True, 'identifier': 'EVE_RELEASE_DEV', @@ -989,8 +989,8 @@ 'CROS_JACUZZI_RELEASE_DEV': { 'skylab': { 'cros_board': 'jacuzzi', - 'cros_chrome_version': '105.0.5195.5', - 'cros_img': 'jacuzzi-release/R105-14989.11.0', + 'cros_chrome_version': '106.0.5226.0', + 'cros_img': 'jacuzzi-release/R106-15036.0.0', }, 'enabled': True, 'identifier': 'JACUZZI_RELEASE_DEV', @@ -1034,8 +1034,8 @@ 'CROS_OCTOPUS_RELEASE_DEV': { 'skylab': { 'cros_board': 'octopus', - 'cros_chrome_version': '105.0.5195.5', - 'cros_img': 'octopus-release/R105-14989.11.0', + 'cros_chrome_version': '106.0.5226.0', + 'cros_img': 'octopus-release/R106-15036.0.0', }, 'enabled': True, 'identifier': 'OCTOPUS_RELEASE_DEV',
diff --git a/third_party/blink/common/permissions_policy/permissions_policy.cc b/third_party/blink/common/permissions_policy/permissions_policy.cc index e01e9cc..6d450a4 100644 --- a/third_party/blink/common/permissions_policy/permissions_policy.cc +++ b/third_party/blink/common/permissions_policy/permissions_policy.cc
@@ -9,6 +9,7 @@ #include "base/no_destructor.h" #include "services/network/public/mojom/web_sandbox_flags.mojom-shared.h" #include "third_party/blink/public/common/client_hints/client_hints.h" +#include "third_party/blink/public/common/frame/fenced_frame_permissions_policies.h" #include "third_party/blink/public/common/permissions_policy/permissions_policy_features.h" #include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom.h" @@ -358,18 +359,30 @@ // static std::unique_ptr<PermissionsPolicy> PermissionsPolicy::CreateForFencedFrame( - const url::Origin& origin) { - return CreateForFencedFrame(origin, GetPermissionsPolicyFeatureList()); + const url::Origin& origin, + blink::mojom::FencedFrameMode mode) { + return CreateForFencedFrame(origin, GetPermissionsPolicyFeatureList(), mode); } std::unique_ptr<PermissionsPolicy> PermissionsPolicy::CreateForFencedFrame( const url::Origin& origin, - const PermissionsPolicyFeatureList& features) { + const PermissionsPolicyFeatureList& features, + blink::mojom::FencedFrameMode mode) { std::unique_ptr<PermissionsPolicy> new_policy = base::WrapUnique(new PermissionsPolicy(origin, features)); for (const auto& feature : features) { new_policy->inherited_policies_[feature.first] = false; } + // TODO(crbug.com/1347953): this is a medium-term solution to allow + // attribution reporting inside an opaque ad. This will eventually be replaced + // by urn:uuid bound attributes as outlined in this document: + // https://docs.google.com/document/d/11QaI40IAr12CDFrIUQbugxmS9LfircghHUghW-EDzMk/edit?usp=sharing + if (mode == blink::mojom::FencedFrameMode::kOpaqueAds) { + for (const blink::mojom::PermissionsPolicyFeature feature : + blink::kFencedFrameOpaqueAdsDefaultAllowedFeatures) { + new_policy->inherited_policies_[feature] = true; + } + } return new_policy; }
diff --git a/third_party/blink/common/permissions_policy/permissions_policy_unittest.cc b/third_party/blink/common/permissions_policy/permissions_policy_unittest.cc index 73cdbae..1934c9b 100644 --- a/third_party/blink/common/permissions_policy/permissions_policy_unittest.cc +++ b/third_party/blink/common/permissions_policy/permissions_policy_unittest.cc
@@ -39,6 +39,8 @@ {kDefaultSelfFeature, PermissionsPolicyFeatureDefault::EnableForSelf}, {mojom::PermissionsPolicyFeature::kClientHintDPR, + PermissionsPolicyFeatureDefault::EnableForSelf}, + {mojom::PermissionsPolicyFeature::kAttributionReporting, PermissionsPolicyFeatureDefault::EnableForSelf}}) {} ~PermissionsPolicyTest() override = default; @@ -66,8 +68,9 @@ origin, feature_list_); } std::unique_ptr<PermissionsPolicy> CreateForFencedFrame( - const url::Origin& origin) { - return PermissionsPolicy::CreateForFencedFrame(origin, feature_list_); + const url::Origin& origin, + const blink::mojom::FencedFrameMode mode) { + return PermissionsPolicy::CreateForFencedFrame(origin, feature_list_, mode); } bool PolicyContainsInheritedValue(const PermissionsPolicy* policy, @@ -1657,10 +1660,22 @@ EXPECT_FALSE(policy3->IsFeatureEnabled(kDefaultSelfFeature)); } -TEST_F(PermissionsPolicyTest, CreateForFencedFrame) { - std::unique_ptr<PermissionsPolicy> policy = CreateForFencedFrame(origin_a_); +TEST_F(PermissionsPolicyTest, CreateForDefaultFencedFrame) { + std::unique_ptr<PermissionsPolicy> policy = + CreateForFencedFrame(origin_a_, blink::mojom::FencedFrameMode::kDefault); EXPECT_FALSE(policy->IsFeatureEnabled(kDefaultOnFeature)); EXPECT_FALSE(policy->IsFeatureEnabled(kDefaultSelfFeature)); + EXPECT_FALSE(policy->IsFeatureEnabled( + mojom::PermissionsPolicyFeature::kAttributionReporting)); +} + +TEST_F(PermissionsPolicyTest, CreateForOpaqueFencedFrame) { + std::unique_ptr<PermissionsPolicy> policy = CreateForFencedFrame( + origin_a_, blink::mojom::FencedFrameMode::kOpaqueAds); + EXPECT_FALSE(policy->IsFeatureEnabled(kDefaultOnFeature)); + EXPECT_FALSE(policy->IsFeatureEnabled(kDefaultSelfFeature)); + EXPECT_TRUE(policy->IsFeatureEnabled( + mojom::PermissionsPolicyFeature::kAttributionReporting)); } TEST_F(PermissionsPolicyTest, CreateFromParsedPolicy) {
diff --git a/third_party/blink/perf_tests/paint/complex-iframe-filtered.html b/third_party/blink/perf_tests/paint/complex-iframe-filtered.html deleted file mode 100644 index eb98925..0000000 --- a/third_party/blink/perf_tests/paint/complex-iframe-filtered.html +++ /dev/null
@@ -1,33 +0,0 @@ -<!doctype HTML> - -<iframe id="iframe" width=500px; height=500px; srcdoc=" - <!doctype HTML> - <div id='container'> - <div id='template'> - <h1><span>Sample</span> Title<span><span> <a href=#>link1</a></span><span> <a href=#>link2</a></span></span></h1> - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p> - <div><span>Note</span> - <p>Lorem ipsum dolor sit amet, <span>consectetur adipiscing elit</span>, sed do eiusmod tempor <a href=#>incididunt ut labore</a> et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco <span><span>laboris nisi ut aliquip</span> ex ea commodo consequat</span>. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<p> - </div> - </div> - </div> - <script> - var cloned = template.cloneNode(true); - for (var i = 0; i < 10000; ++i) - container.appendChild(cloned.cloneNode(true)); - </script> -"></iframe> - -<script src="../resources/runner.js"></script> -<script src="resources/paint.js"></script> -<script> -var blurred = false; -onload = () => { - measurePaint({ - run: () => { - blurred = !blurred; - iframe.style = blurred ? "filter: blur(5px);" : ""; - } - }); -}; -</script>
diff --git a/third_party/blink/perf_tests/paint/move-text-with-mask.html b/third_party/blink/perf_tests/paint/move-text-with-mask.html deleted file mode 100644 index 7f598a81..0000000 --- a/third_party/blink/perf_tests/paint/move-text-with-mask.html +++ /dev/null
@@ -1,35 +0,0 @@ -<!DOCTYPE html> -<body> -<script src="../resources/runner.js"></script> -<script src="resources/paint.js"></script> -<div id="block"> - <span id="container" style="-webkit-mask-box-image: url(resources/mask.png) 50 50 50 50"></span> -</div> -<script> -// This test measures the lifecycle update performance when move text -// with mask in a large page. - -var initialTextCount = 10000; -var initialText = ""; -for (var i = 0; i < initialTextCount; i++) { - if (i % 10 == 0) - initialText += '<br>'; - initialText += '<span>abc</span> '; -} - -var margin = 10; - -measurePaint({ - run: function() { - margin += 5; - block.style.marginTop = margin + 'px'; - }, - setup: function() { - container.innerHTML = initialText; - }, - done: function() { - container.innerHTML = ''; - }, -}); -</script> -</body>
diff --git a/third_party/blink/public/common/BUILD.gn b/third_party/blink/public/common/BUILD.gn index 7439e172e..96c0e812 100644 --- a/third_party/blink/public/common/BUILD.gn +++ b/third_party/blink/public/common/BUILD.gn
@@ -136,6 +136,7 @@ "fetch/fetch_api_request_headers_mojom_traits.h", "forcedark/forcedark_switches.h", "frame/event_page_show_persisted.h", + "frame/fenced_frame_permissions_policies.h", "frame/fenced_frame_sandbox_flags.h", "frame/frame_ad_evidence.h", "frame/frame_owner_element_type.h",
diff --git a/third_party/blink/public/common/frame/fenced_frame_permissions_policies.h b/third_party/blink/public/common/frame/fenced_frame_permissions_policies.h new file mode 100644 index 0000000..966cbe88 --- /dev/null +++ b/third_party/blink/public/common/frame/fenced_frame_permissions_policies.h
@@ -0,0 +1,23 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be found +// in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_FRAME_FENCED_FRAME_PERMISSIONS_POLICIES_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_FRAME_FENCED_FRAME_PERMISSIONS_POLICIES_H_ + +namespace blink { + +// In fenced frame trees, these permission policies are expected to be enabled. +// If any feature is disallowed for the fenced frame's origin, then the fenced +// frame will not be allowed to navigate. This is a medium-term solution that +// will be replaced by a system where consumer APIs (like FLEDGE) can select +// which features to require in order to navigate a fenced frame successfully. +// If a fenced frame navigates, each of these features will be allowed as if +// its policy was set to "allow: feature(*)". +constexpr blink::mojom::PermissionsPolicyFeature + kFencedFrameOpaqueAdsDefaultAllowedFeatures[] = { + blink::mojom::PermissionsPolicyFeature::kAttributionReporting}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_FRAME_FENCED_FRAME_PERMISSIONS_POLICIES_H_
diff --git a/third_party/blink/public/common/permissions_policy/permissions_policy.h b/third_party/blink/public/common/permissions_policy/permissions_policy.h index 6da17e5..abdc5e9 100644 --- a/third_party/blink/public/common/permissions_policy/permissions_policy.h +++ b/third_party/blink/public/common/permissions_policy/permissions_policy.h
@@ -12,6 +12,7 @@ #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/common/common_export.h" #include "third_party/blink/public/common/permissions_policy/permissions_policy_features.h" +#include "third_party/blink/public/mojom/fenced_frame/fenced_frame.mojom-shared.h" #include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom-forward.h" #include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom-forward.h" #include "url/origin.h" @@ -194,9 +195,12 @@ const PermissionsPolicy*); // Creates a PermissionsPolicy for a fenced frame. All permissions are - // disabled in fenced frames. + // disabled in fenced frames except for attribution reporting (which are only + // enabled for opaque-ads fenced frames). Permissions do not inherit from the + // parent to prevent cross-channel communication. static std::unique_ptr<PermissionsPolicy> CreateForFencedFrame( - const url::Origin& origin); + const url::Origin& origin, + blink::mojom::FencedFrameMode mode); static std::unique_ptr<PermissionsPolicy> CreateFromParsedPolicy( const ParsedPermissionsPolicy& parsed_policy, @@ -273,7 +277,8 @@ static std::unique_ptr<PermissionsPolicy> CreateForFencedFrame( const url::Origin& origin, - const PermissionsPolicyFeatureList& features); + const PermissionsPolicyFeatureList& features, + blink::mojom::FencedFrameMode mode); bool InheritedValueForFeature( const PermissionsPolicy* parent_policy,
diff --git a/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.cc b/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.cc index b4df6a13..ef9ee7f4 100644 --- a/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.cc +++ b/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.cc
@@ -254,14 +254,92 @@ DCHECK(cache_allowed_); DCHECK(fast_reject_filter_map_); + is_new_entry = false; + + // In order to minimize memory consumption, if the traversal scope of an + // other element is a superset of the traversal scope of the target element, + // use the less accurate fast reject filter of the other element. + switch (argument_context_.TraversalScope()) { + case CheckPseudoHasArgumentTraversalScope::kSubtree: + for (Element* parent = element->parentElement(); parent; + parent = parent->parentElement()) { + auto iterator = fast_reject_filter_map_->find(parent); + if (iterator == fast_reject_filter_map_->end()) + continue; + if (!iterator->value->BloomFilterAllocated()) + continue; + return *iterator->value.get(); + } + break; + case CheckPseudoHasArgumentTraversalScope::kOneNextSiblingSubtree: + for (Element* parent = element->parentElement(); parent; + parent = parent->parentElement()) { + Element* sibling = ElementTraversal::PreviousSibling(*parent); + for (int i = argument_context_.AdjacentDistanceLimit() - 1; + sibling && i >= 0; + sibling = ElementTraversal::PreviousSibling(*sibling), --i) { + } + if (!sibling) + continue; + auto iterator = fast_reject_filter_map_->find(sibling); + if (iterator == fast_reject_filter_map_->end()) + continue; + if (!iterator->value->BloomFilterAllocated()) + continue; + return *iterator->value.get(); + } + break; + case CheckPseudoHasArgumentTraversalScope::kAllNextSiblingSubtrees: + for (Element* parent = element->parentElement(); parent; + parent = parent->parentElement()) { + for (Element* sibling = ElementTraversal::PreviousSibling(*parent); + sibling; sibling = ElementTraversal::PreviousSibling(*sibling)) { + auto iterator = fast_reject_filter_map_->find(sibling); + if (iterator == fast_reject_filter_map_->end()) + continue; + if (!iterator->value->BloomFilterAllocated()) + continue; + return *iterator->value.get(); + } + } + break; + case CheckPseudoHasArgumentTraversalScope::kAllNextSiblings: + for (Element* sibling = ElementTraversal::PreviousSibling(*element); + sibling; sibling = ElementTraversal::PreviousSibling(*sibling)) { + auto iterator = fast_reject_filter_map_->find(sibling); + if (iterator == fast_reject_filter_map_->end()) + continue; + if (!iterator->value->BloomFilterAllocated()) + continue; + return *iterator->value.get(); + } + break; + default: + NOTREACHED(); + break; + } + auto entry = fast_reject_filter_map_->insert(element, nullptr); - is_new_entry = entry.is_new_entry; if (entry.is_new_entry) { entry.stored_value->value = std::make_unique<CheckPseudoHasFastRejectFilter>(); + is_new_entry = true; } DCHECK(entry.stored_value->value); return *entry.stored_value->value.get(); } +size_t +CheckPseudoHasCacheScope::Context::GetBloomFilterAllocationCountForTesting() + const { + if (!cache_allowed_) + return 0; + size_t bloom_filter_allocation_count = 0; + for (const auto& iterator : *fast_reject_filter_map_) { + if (iterator.value->BloomFilterAllocated()) + bloom_filter_allocation_count++; + } + return bloom_filter_allocation_count; +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.h b/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.h index 7a0e72b63..0c79b906 100644 --- a/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.h +++ b/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.h
@@ -273,6 +273,8 @@ return cache_allowed_ ? fast_reject_filter_map_->size() : 0; } + size_t GetBloomFilterAllocationCountForTesting() const; + bool cache_allowed_; ElementCheckPseudoHasResultMap* result_map_; ElementCheckPseudoHasFastRejectFilterMap* fast_reject_filter_map_;
diff --git a/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope_context_test.cc b/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope_context_test.cc index 0d1a543..78f647a 100644 --- a/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope_context_test.cc +++ b/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope_context_test.cc
@@ -101,7 +101,8 @@ const char* selector_text, unsigned expected_result_cache_count, const ExpectedResultCacheEntry (&expected_result_cache_entries)[length], - unsigned expected_fast_reject_filter_cache_count) const { + unsigned expected_fast_reject_filter_cache_count, + unsigned expected_bloom_filter_allocation_count) const { CSSSelectorVector selector_vector = CSSParser::ParseSelector( MakeGarbageCollected<CSSParserContext>( *document, NullURL(), true /* origin_clean */, Referrer(), @@ -167,6 +168,10 @@ EXPECT_EQ(expected_fast_reject_filter_cache_count, cache_scope_context.GetFastRejectFilterCacheCountForTesting()) << "Failed : " << query_name; + + EXPECT_EQ(expected_bloom_filter_allocation_count, + cache_scope_context.GetBloomFilterAllocationCountForTesting()) + << "Failed : " << query_name; } template <unsigned cache_size> @@ -177,7 +182,8 @@ unsigned expected_result_cache_count, const ExpectedResultCacheEntry ( &expected_result_cache_entries)[cache_size], - unsigned expected_fast_reject_filter_cache_count) const { + unsigned expected_fast_reject_filter_cache_count, + unsigned expected_bloom_filter_allocation_count) const { Element* query_scope_element = document->getElementById(query_scope_element_id); ASSERT_TRUE(query_scope_element); @@ -193,7 +199,8 @@ CheckCacheResults( document, query_name, selector_text, expected_result_cache_count, - expected_result_cache_entries, expected_fast_reject_filter_cache_count); + expected_result_cache_entries, expected_fast_reject_filter_cache_count, + expected_bloom_filter_allocation_count); } template <unsigned query_result_size, unsigned cache_size> @@ -205,7 +212,8 @@ unsigned expected_result_cache_count, const ExpectedResultCacheEntry ( &expected_result_cache_entries)[cache_size], - unsigned expected_fast_reject_filter_cache_count) const { + unsigned expected_fast_reject_filter_cache_count, + unsigned expected_bloom_filter_allocation_count) const { Element* query_scope_element = document->getElementById(query_scope_element_id); ASSERT_TRUE(query_scope_element); @@ -230,7 +238,8 @@ CheckCacheResults( document, query_name, selector_text, expected_result_cache_count, - expected_result_cache_entries, expected_fast_reject_filter_cache_count); + expected_result_cache_entries, expected_fast_reject_filter_cache_count, + expected_bloom_filter_allocation_count); } }; @@ -311,7 +320,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div4", kNotCached, kNotYetChecked}, {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div2", ":has(.b)", /* expected_match_result */ true, @@ -343,7 +353,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div4", kNotCached, kNotYetChecked}, {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div2", ":has(.c)", /* expected_match_result */ false, @@ -374,7 +385,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div4", kNotCached, kNotYetChecked}, {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, Case1StartsWithChildCombinator) { @@ -489,7 +501,8 @@ {"#div24", kNotCached, kNotYetChecked}, {"#div3", kNotCached, kNotYetChecked}, {"#div31", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div2", ":has(> .a .b)", /* expected_match_result */ false, @@ -535,7 +548,8 @@ {"#div24", kNotCached, kAlreadyNotMatched}, {"#div3", kNotCached, kNotYetChecked}, {"#div31", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div2", ":has(> .a .c)", /* expected_match_result */ false, @@ -581,7 +595,8 @@ {"#div24", kNotCached, kAlreadyNotMatched}, {"#div3", kNotCached, kNotYetChecked}, {"#div31", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, Case2StartsWithIndirectAdjacent) { @@ -647,7 +662,8 @@ {"#div252", kNotCached, kNotYetChecked}, {"#div3", kNotCached, kNotYetChecked}, {"#div31", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div22", ":has(~ .b)", /* expected_match_result */ false, @@ -674,7 +690,8 @@ {"#div252", kNotCached, kNotYetChecked}, {"#div3", kNotCached, kNotYetChecked}, {"#div31", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, Case2StartsWithDirectAdjacent) { @@ -773,7 +790,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div4", kNotCached, kNotYetChecked}, {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div22", ":has(+ .a ~ .b)", /* expected_match_result */ false, @@ -815,7 +833,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div4", kNotCached, kNotYetChecked}, {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div22", ":has(+ .a ~ .c)", /* expected_match_result */ false, @@ -857,7 +876,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div4", kNotCached, kNotYetChecked}, {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, Case3) { @@ -965,7 +985,8 @@ {"#div25", kNotCached, kNotYetChecked}, {"#div3", kNotCached, kNotYetChecked}, {"#div4", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div1", ":has(+ .a .b)", /* expected_match_result */ false, @@ -1009,7 +1030,8 @@ {"#div25", kNotCached, kAlreadyNotMatched}, {"#div3", kNotCached, kNotYetChecked}, {"#div4", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div22", ":has(+ .a .c)", /* expected_match_result */ false, @@ -1053,7 +1075,8 @@ {"#div25", kNotCached, kNotYetChecked}, {"#div3", kNotCached, kNotYetChecked}, {"#div4", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, Case4) { @@ -1174,7 +1197,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div4", kNotCached, kNotYetChecked}, {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div21", ":has(~ .a .b)", /* expected_match_result */ true, @@ -1225,7 +1249,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div4", kNotCached, kNotYetChecked}, {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div1", ":has(~ .a .b)", /* expected_match_result */ false, @@ -1274,7 +1299,8 @@ {"#div31", kNotCached, kAlreadyNotMatched}, {"#div4", kNotCached, kAlreadyNotMatched}, {"#div41", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div22", ":has(~ .a .c)", /* expected_match_result */ false, @@ -1323,7 +1349,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div4", kNotCached, kNotYetChecked}, {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, @@ -1368,13 +1395,15 @@ kSameAsCached}, {"#div14", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div11", ":has(.a .b)", /* expected_match_result */ false, /* expected_result_cache_count */ 1, {{"#div11", kNotMatched, kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div12", ":has(.a .b)", /* expected_match_result */ true, @@ -1392,7 +1421,8 @@ {"#div13", kNotCached, kNotYetChecked}, {"#div131", kNotCached, kNotYetChecked}, {"#div14", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); // ':has(.a .b)' does not match #div1211 but this caches possibly matched // elements because argument selector checking can cross over the :has() @@ -1413,7 +1443,8 @@ {"#div13", kNotCached, kNotYetChecked}, {"#div131", kNotCached, kNotYetChecked}, {"#div14", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); // ':has(.a .b)' does not match #div13 but this caches possibly matched // elements because argument selector checking can cross over the :has() @@ -1434,7 +1465,8 @@ {"#div131", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, kSameAsCached}, {"#div14", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(.a .b)", {"div1", "div12", "div121"}, @@ -1454,7 +1486,29 @@ kSameAsCached}, {"#div14", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 5); + /* expected_fast_reject_filter_cache_count */ 5, + /* expected_bloom_filter_allocation_count */ 0); + + TestQuerySelectorAll( + document, "main", ":has(.a .b), :has(.c .d)", {"div1", "div12", "div121"}, + /* expected_result_cache_count */ 12, + {{"html", kMatched, kSameAsCached}, + {"body", kMatched, kSameAsCached}, + {"#main", kMatched, kSameAsCached}, + {"#div1", kMatchedAndSomeChildrenChecked, kSameAsCached}, + {"#div11", kNotMatched, kSameAsCached}, + {"#div12", kMatched, kSameAsCached}, + {"#div121", kMatched, kSameAsCached}, + {"#div1211", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, + {"#div12111", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div13", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, + {"#div131", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div14", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + kSameAsCached}}, + /* expected_fast_reject_filter_cache_count */ 6, + /* expected_bloom_filter_allocation_count */ 3); } TEST_F(CheckPseudoHasCacheScopeContextTest, @@ -1486,7 +1540,8 @@ {"#div1111", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, {"#div11111", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div11", ":has(> .a .b)", /* expected_match_result */ false, @@ -1497,7 +1552,8 @@ kSameAsCached}, {"#div1111", kNotCached, kAlreadyNotMatched}, {"#div11111", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(> .a .b)", {"div1", "div111"}, @@ -1509,7 +1565,21 @@ {"#div1111", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, {"#div11111", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 2); + /* expected_fast_reject_filter_cache_count */ 2, + /* expected_bloom_filter_allocation_count */ 0); + + TestQuerySelectorAll( + document, "main", ":has(> .a .b), :has(> .c .d)", {"div1", "div111"}, + /* expected_result_cache_count */ 5, + {{"#div1", kMatched, kSameAsCached}, + {"#div11", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, + {"#div111", kMatchedAndAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div1111", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, + {"#div11111", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + kSameAsCached}}, + /* expected_fast_reject_filter_cache_count */ 2, + /* expected_bloom_filter_allocation_count */ 1); } TEST_F(CheckPseudoHasCacheScopeContextTest, @@ -1551,7 +1621,8 @@ {{"#div112", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, {"#div1121", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div111", ":has(> .a .b)", /* expected_match_result */ true, @@ -1562,7 +1633,8 @@ kSameAsCached}, {"#div1112", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div11", ":has(> .a .b)", /* expected_match_result */ true, @@ -1579,7 +1651,8 @@ {"#div1121", kNotCached, kAlreadyNotMatched}, {"#div113", kNotCached, kAlreadyNotMatched}, {"#div1131", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div1", ":has(> .a .b)", /* expected_match_result */ false, @@ -1597,7 +1670,8 @@ {"#div1131", kNotCached, kAlreadyNotMatched}, {"#div12", kNotCached, kAlreadyNotMatched}, {"#div121", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(> .a .b) ~ .c .d", {"div1131", "div121"}, @@ -1623,7 +1697,8 @@ {"#div121", kNotCached, kAlreadyNotMatched}, {"#div2", kNotCached, kNotYetChecked}, {"#div21", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 4); + /* expected_fast_reject_filter_cache_count */ 4, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, @@ -1669,7 +1744,8 @@ {"#div122", kNotCached, kNotYetChecked}, {"#div13", kNotCached, kNotYetChecked}, {"#div2", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div1211", ":has(~ .a) .b", /* expected_match_result */ true, @@ -1689,7 +1765,8 @@ kSameAsCached}, {"#div2", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 3); + /* expected_fast_reject_filter_cache_count */ 3, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(~ .a) .b", {"div1111", "div1211"}, @@ -1710,7 +1787,8 @@ kSameAsCached}, {"#div2", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 4); + /* expected_fast_reject_filter_cache_count */ 4, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, @@ -1752,7 +1830,8 @@ {"#div23", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, {"#div231", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div211", ":has(+ .a .b) .c", /* expected_match_result */ true, @@ -1768,7 +1847,8 @@ kSameAsCached}, {"#div23", kNotCached, kNotYetChecked}, {"#div231", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(+ .a .b) .c", {"div11", "div211"}, @@ -1785,7 +1865,8 @@ {"#div23", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, {"#div231", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 2); + /* expected_fast_reject_filter_cache_count */ 2, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, @@ -1830,7 +1911,8 @@ {"#div22", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, {"#div221", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div2111", ":has(~ .a .b) .c", /* expected_match_result */ true, @@ -1847,7 +1929,8 @@ {"#div2121", kNotCached, kAlreadyNotMatched}, {"#div22", kNotCached, kNotYetChecked}, {"#div221", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(~ .a .b) .c", {"div11", "div2111"}, @@ -1865,7 +1948,8 @@ {"#div22", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, {"#div221", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 2); + /* expected_fast_reject_filter_cache_count */ 2, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, @@ -1930,7 +2014,8 @@ {"#div51", kNotCached, kAlreadyNotMatched}, {"#div6", kNotCached, kAlreadyNotMatched}, {"#div61", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div11", ":has(+ .a ~ .b .c)", /* expected_match_result */ true, @@ -1946,7 +2031,8 @@ kSameAsCached}, {"#div141", kNotCached, kAlreadyNotMatched}, {"#div15", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div12", ":has(+ .a ~ .b .c)", /* expected_match_result */ false, @@ -1961,7 +2047,8 @@ {"#div14", kNotCached, kAlreadyNotMatched}, {"#div141", kNotCached, kAlreadyNotMatched}, {"#div15", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 1); + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(+ .a ~ .b .c)", {"div11", "div4"}, @@ -1991,7 +2078,39 @@ {"#div51", kNotCached, kAlreadyNotMatched}, {"#div6", kNotCached, kAlreadyNotMatched}, {"#div61", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 3); + /* expected_fast_reject_filter_cache_count */ 3, + /* expected_bloom_filter_allocation_count */ 0); + + TestQuerySelectorAll( + document, "main", ":has(+ .a ~ .b .c), :has(+ .d ~ .e .f)", + {"div11", "div4"}, /* expected_result_cache_count */ 9, + {{"main", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, + {"#div1", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, + {"#div11", kMatched, kSameAsCached}, + {"#div12", kNotMatched, kSameAsCached}, + {"#div13", + kNotMatchedAndAllDescendantsOrNextSiblingsCheckedAndSomeChildrenChecked, + kSameAsCached}, + {"#div131", kNotCached, kAlreadyNotMatched}, + {"#div132", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div14", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div141", kNotCached, kAlreadyNotMatched}, + {"#div15", kNotCached, kAlreadyNotMatched}, + {"#div2", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div21", kNotCached, kAlreadyNotMatched}, + {"#div3", kNotCached, kAlreadyNotMatched}, + {"#div31", kNotCached, kAlreadyNotMatched}, + {"#div4", kMatched, kSameAsCached}, + {"#div41", kNotCached, kAlreadyNotMatched}, + {"#div5", kNotCached, kAlreadyNotMatched}, + {"#div51", kNotCached, kAlreadyNotMatched}, + {"#div6", kNotCached, kAlreadyNotMatched}, + {"#div61", kNotCached, kAlreadyNotMatched}}, + /* expected_fast_reject_filter_cache_count */ 3, + /* expected_bloom_filter_allocation_count */ 2); } TEST_F(CheckPseudoHasCacheScopeContextTest, QuerySelectorAllCase5) { @@ -2035,7 +2154,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div32", kNotCached, kNotYetChecked}, {"#div33", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0); + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div21", ":has(+ .a)", /* expected_match_result */ true, @@ -2053,7 +2173,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div32", kNotCached, kNotYetChecked}, {"#div33", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0); + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll(document, "main", ":has(+ .a)", {"div2", "div21"}, /* expected_result_cache_count */ 0, @@ -2070,7 +2191,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div32", kNotCached, kNotYetChecked}, {"#div33", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0); + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, QuerySelectorAllCase6) { @@ -2115,7 +2237,8 @@ {"#div121", kNotCached, kNotYetChecked}, {"#div122", kNotCached, kNotYetChecked}, {"#div123", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0); + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div112", ":has(> .a)", /* expected_match_result */ true, @@ -2133,7 +2256,8 @@ {"#div121", kNotCached, kNotYetChecked}, {"#div122", kNotCached, kNotYetChecked}, {"#div123", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0); + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div12", ":has(> .a)", /* expected_match_result */ true, @@ -2151,7 +2275,8 @@ {"#div121", kNotCached, kNotYetChecked}, {"#div122", kNotCached, kNotYetChecked}, {"#div123", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0); + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll(document, "main", ":has(> .a)", {"div1", "div112", "div12"}, @@ -2169,7 +2294,8 @@ {"#div121", kNotCached, kNotYetChecked}, {"#div122", kNotCached, kNotYetChecked}, {"#div123", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0); + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, QuerySelectorAllCase7) { @@ -2211,7 +2337,8 @@ {"#div231", kNotCached, kNotYetChecked}, {"#div232", kNotCached, kNotYetChecked}, {"#div233", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0); + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div22", ":has(+ .a > .b)", /* expected_match_result */ true, @@ -2228,7 +2355,8 @@ {"#div231", kNotCached, kNotYetChecked}, {"#div232", kNotCached, kNotYetChecked}, {"#div233", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0); + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll(document, "main", ":has(+ .a > .b)", {"div1", "div22"}, /* expected_result_cache_count */ 0, @@ -2244,7 +2372,8 @@ {"#div231", kNotCached, kNotYetChecked}, {"#div232", kNotCached, kNotYetChecked}, {"#div233", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0); + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, QuerySelectorAllCase8) { @@ -2295,7 +2424,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div32", kNotCached, kNotYetChecked}, {"#div33", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0); + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div2", ":has(~ .a > .b)", /* expected_match_result */ true, @@ -2316,7 +2446,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div32", kNotCached, kNotYetChecked}, {"#div33", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0); + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div21", ":has(~ .a > .b)", /* expected_match_result */ true, @@ -2337,7 +2468,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div32", kNotCached, kNotYetChecked}, {"#div33", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0); + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll(document, "main", ":has(~ .a > .b)", {"div1", "div2", "div21"}, @@ -2358,7 +2490,8 @@ {"#div31", kNotCached, kNotYetChecked}, {"#div32", kNotCached, kNotYetChecked}, {"#div33", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0); + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); } } // namespace blink
diff --git a/third_party/blink/renderer/core/execution_context/security_context_init.cc b/third_party/blink/renderer/core/execution_context/security_context_init.cc index 23e541c..8b2a890 100644 --- a/third_party/blink/renderer/core/execution_context/security_context_init.cc +++ b/third_party/blink/renderer/core/execution_context/security_context_init.cc
@@ -204,7 +204,8 @@ if (frame.IsInFencedFrameTree()) { // In Fenced Frames, all permission policy gated features must be disabled // for privacy reasons. - permissions_policy = PermissionsPolicy::CreateForFencedFrame(origin); + permissions_policy = PermissionsPolicy::CreateForFencedFrame( + origin, frame.GetFencedFrameMode().value()); } else { auto* parent_permissions_policy = frame.Tree().Parent() ? frame.Tree()
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_image_source.h b/third_party/blink/renderer/core/html/canvas/canvas_image_source.h index 49ae239..6e516fd 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_image_source.h +++ b/third_party/blink/renderer/core/html/canvas/canvas_image_source.h
@@ -44,6 +44,7 @@ kUndecodableSourceImageStatus, // Image element with a 'broken' image kZeroSizeCanvasSourceImageStatus, // Source is a canvas with width or heigh // of zero + kZeroSizeImageSourceStatus, // Image element with width or height of zero kIncompleteSourceImageStatus, // Image element with no source media kInvalidSourceImageStatus, };
diff --git a/third_party/blink/renderer/core/html/canvas/image_element_base.cc b/third_party/blink/renderer/core/html/canvas/image_element_base.cc index add01fad..a10d6ed 100644 --- a/third_party/blink/renderer/core/html/canvas/image_element_base.cc +++ b/third_party/blink/renderer/core/html/canvas/image_element_base.cc
@@ -65,9 +65,19 @@ } scoped_refptr<Image> source_image = image_content->GetImage(); + + if (!source_image->width() || !source_image->height()) { + *status = kZeroSizeImageSourceStatus; + return nullptr; + } + if (auto* svg_image = DynamicTo<SVGImage>(source_image.get())) { UseCounter::Count(GetElement().GetDocument(), WebFeature::kSVGInCanvas2D); gfx::SizeF image_size = svg_image->ConcreteObjectSize(default_object_size); + if (!image_size.width() || !image_size.height()) { + *status = kZeroSizeImageSourceStatus; + return nullptr; + } source_image = SVGImageForContainer::Create( svg_image, image_size, 1, GetElement().GetDocument().CompleteURL(GetElement().ImageSourceURL()),
diff --git a/third_party/blink/renderer/core/html/html_anchor_element.cc b/third_party/blink/renderer/core/html/html_anchor_element.cc index 609d2ec3..ee17136 100644 --- a/third_party/blink/renderer/core/html/html_anchor_element.cc +++ b/third_party/blink/renderer/core/html/html_anchor_element.cc
@@ -212,7 +212,7 @@ } bool HTMLAnchorElement::HasActivationBehavior() const { - return true; + return IsLink(); } void HTMLAnchorElement::SetActive(bool active) {
diff --git a/third_party/blink/renderer/core/layout/ng/flex/ng_flex_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/flex/ng_flex_layout_algorithm.cc index c684ea10..4e1b2b2 100644 --- a/third_party/blink/renderer/core/layout/ng/flex/ng_flex_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/flex/ng_flex_layout_algorithm.cc
@@ -260,9 +260,8 @@ // Make the child offset relative to our fragment. offset.block_offset -= previous_consumed_block_size; - container_builder_.AddOutOfFlowChildCandidate( - child, offset, inline_edge, block_edge, - /* needs_block_offset_adjustment */ false); + container_builder_.AddOutOfFlowChildCandidate(child, offset, inline_edge, + block_edge); } }
diff --git a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc index 5ae499b..926d075 100644 --- a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc
@@ -3541,8 +3541,7 @@ child_offset.block_offset -= previous_consumed_block_size; container_builder_.AddOutOfFlowChildCandidate( - out_of_flow_item.node, child_offset, inline_edge, block_edge, - /* needs_block_offset_adjustment */ false); + out_of_flow_item.node, child_offset, inline_edge, block_edge); } }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.cc b/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.cc index 266ed62..76ee25b 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.cc
@@ -356,7 +356,6 @@ void NGBoxFragmentBuilder::MoveChildrenInBlockDirection(LayoutUnit delta) { DCHECK(is_new_fc_); - DCHECK(!has_oof_candidate_that_needs_block_offset_adjustment_); DCHECK_NE(FragmentBlockSize(), kIndefiniteSize); DCHECK(oof_positioned_descendants_.IsEmpty());
diff --git a/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.cc b/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.cc index 3378991..a6beb3f 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.cc
@@ -194,21 +194,11 @@ NGBlockNode child, const LogicalOffset& child_offset, NGLogicalStaticPosition::InlineEdge inline_edge, - NGLogicalStaticPosition::BlockEdge block_edge, - bool needs_block_offset_adjustment) { + NGLogicalStaticPosition::BlockEdge block_edge) { DCHECK(child); - - // If an OOF-positioned candidate has a static-position which uses a - // non-block-start edge, we may need to adjust its static-position when the - // final block-size is known. - needs_block_offset_adjustment &= - block_edge != NGLogicalStaticPosition::BlockEdge::kBlockStart; - has_oof_candidate_that_needs_block_offset_adjustment_ |= - needs_block_offset_adjustment; - oof_positioned_candidates_.emplace_back( child, NGLogicalStaticPosition{child_offset, inline_edge, block_edge}, - NGInlineContainer<LogicalOffset>(), needs_block_offset_adjustment); + NGInlineContainer<LogicalOffset>()); } void NGContainerFragmentBuilder::AddOutOfFlowChildCandidate( @@ -253,27 +243,6 @@ HeapVector<NGLogicalOutOfFlowPositionedNode>* candidates) { DCHECK(candidates->IsEmpty()); std::swap(oof_positioned_candidates_, *candidates); - - if (!has_oof_candidate_that_needs_block_offset_adjustment_) - return; - - using BlockEdge = NGLogicalStaticPosition::BlockEdge; - - // We might have an OOF-positioned candidate whose static-position depends on - // the final block-size of this fragment. - DCHECK_NE(BlockSize(), kIndefiniteSize); - for (auto& candidate : *candidates) { - if (!candidate.needs_block_offset_adjustment) - continue; - - if (candidate.static_position.block_edge == BlockEdge::kBlockCenter) - candidate.static_position.offset.block_offset += BlockSize() / 2; - else if (candidate.static_position.block_edge == BlockEdge::kBlockEnd) - candidate.static_position.offset.block_offset += BlockSize(); - candidate.needs_block_offset_adjustment = false; - } - - has_oof_candidate_that_needs_block_offset_adjustment_ = false; } void NGContainerFragmentBuilder::AddMulticolWithPendingOOFs( @@ -295,7 +264,6 @@ void NGContainerFragmentBuilder::SwapOutOfFlowFragmentainerDescendants( HeapVector<NGLogicalOOFNodeForFragmentation>* descendants) { DCHECK(descendants->IsEmpty()); - DCHECK(!has_oof_candidate_that_needs_block_offset_adjustment_); std::swap(oof_positioned_fragmentainer_descendants_, *descendants); } @@ -313,7 +281,6 @@ DCHECK(!candidate.inline_container.container); destination_builder->AddOutOfFlowFragmentainerDescendant( {node, candidate.static_position, multicol->fixedpos_inline_container, - candidate.needs_block_offset_adjustment, multicol->fixedpos_containing_block, multicol->fixedpos_containing_block, multicol->fixedpos_inline_container}); @@ -420,7 +387,6 @@ new_fixedpos_inline_container = *fixedpos_inline_container; AddOutOfFlowFragmentainerDescendant( {node, static_position, new_fixedpos_inline_container, - /* needs_block_offset_adjustment */ false, *fixedpos_containing_block, *fixedpos_containing_block, new_fixedpos_inline_container}); continue; @@ -652,7 +618,6 @@ } NGLogicalOOFNodeForFragmentation oof_node( descendant.Node(), static_position, new_inline_container, - /* needs_block_offset_adjustment */ false, NGContainingBlock<LogicalOffset>( containing_block_offset, containing_block_rel_offset, containing_block_fragment, container_inside_column_spanner,
diff --git a/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.h b/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.h index b5acd33..c92faedd 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.h +++ b/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.h
@@ -128,13 +128,12 @@ // NGOutOfFlowLayoutPart(container_style, builder).Run(); // // See layout part for builder interaction. - void AddOutOfFlowChildCandidate( - NGBlockNode, - const LogicalOffset& child_offset, - NGLogicalStaticPosition::InlineEdge = - NGLogicalStaticPosition::kInlineStart, - NGLogicalStaticPosition::BlockEdge = NGLogicalStaticPosition::kBlockStart, - bool needs_block_offset_adjustment = true); + void AddOutOfFlowChildCandidate(NGBlockNode, + const LogicalOffset& child_offset, + NGLogicalStaticPosition::InlineEdge = + NGLogicalStaticPosition::kInlineStart, + NGLogicalStaticPosition::BlockEdge = + NGLogicalStaticPosition::kBlockStart); void AddOutOfFlowChildCandidate( const NGLogicalOutOfFlowPositionedNode& candidate); @@ -453,7 +452,6 @@ bool should_force_same_fragmentation_flow_ = false; bool should_add_break_tokens_manually_ = false; - bool has_oof_candidate_that_needs_block_offset_adjustment_ = false; bool has_out_of_flow_fragment_child_ = false; bool has_out_of_flow_in_fragmentainer_subtree_ = false;
diff --git a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc index c4c8999..aaa44f9 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc
@@ -949,7 +949,6 @@ descendant.Node(), static_position, inline_container, - /* needs_block_offset_adjustment */ false, NGContainingBlock<LogicalOffset>( containing_block_offset, containing_block_rel_offset, containing_block_fragment,
diff --git a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_positioned_node.h b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_positioned_node.h index f75ad1e..e95e3cf 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_positioned_node.h +++ b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_positioned_node.h
@@ -203,7 +203,6 @@ Member<LayoutBox> box; NGLogicalStaticPosition static_position; NGInlineContainer<LogicalOffset> inline_container; - bool needs_block_offset_adjustment; // Whether or not this is an NGLogicalOOFNodeForFragmentation. unsigned is_for_fragmentation : 1; @@ -211,12 +210,10 @@ NGBlockNode node, NGLogicalStaticPosition static_position, NGInlineContainer<LogicalOffset> inline_container = - NGInlineContainer<LogicalOffset>(), - bool needs_block_offset_adjustment = false) + NGInlineContainer<LogicalOffset>()) : box(node.GetLayoutBox()), static_position(static_position), inline_container(inline_container), - needs_block_offset_adjustment(needs_block_offset_adjustment), is_for_fragmentation(false) { DCHECK(!inline_container.container || inline_container.container == @@ -299,7 +296,6 @@ NGLogicalStaticPosition static_position, NGInlineContainer<LogicalOffset> inline_container = NGInlineContainer<LogicalOffset>(), - bool needs_block_offset_adjustment = false, NGContainingBlock<LogicalOffset> containing_block = NGContainingBlock<LogicalOffset>(), NGContainingBlock<LogicalOffset> fixedpos_containing_block = @@ -308,8 +304,7 @@ NGInlineContainer<LogicalOffset>()) : NGLogicalOutOfFlowPositionedNode(node, static_position, - inline_container, - needs_block_offset_adjustment), + inline_container), containing_block(containing_block), fixedpos_containing_block(fixedpos_containing_block), fixedpos_inline_container(fixedpos_inline_container) { @@ -318,11 +313,9 @@ explicit NGLogicalOOFNodeForFragmentation( const NGLogicalOutOfFlowPositionedNode& oof_node) - : NGLogicalOutOfFlowPositionedNode( - oof_node.Node(), - oof_node.static_position, - oof_node.inline_container, - oof_node.needs_block_offset_adjustment) { + : NGLogicalOutOfFlowPositionedNode(oof_node.Node(), + oof_node.static_position, + oof_node.inline_container) { is_for_fragmentation = true; }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_simplified_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_simplified_layout_algorithm.cc index 0c24f1d..cf75261 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_simplified_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_simplified_layout_algorithm.cc
@@ -271,7 +271,7 @@ NGLogicalStaticPosition position = layer->GetStaticPosition(); container_builder_.AddOutOfFlowChildCandidate( To<NGBlockNode>(child), position.offset, position.inline_edge, - position.block_edge, /* needs_block_offset_adjustment */ false); + position.block_edge); } // We add both items and line-box fragments for existing mechanisms to work.
diff --git a/third_party/blink/renderer/core/paint/replaced_painter.cc b/third_party/blink/renderer/core/paint/replaced_painter.cc index a8ebe06..a2963a2 100644 --- a/third_party/blink/renderer/core/paint/replaced_painter.cc +++ b/third_party/blink/renderer/core/paint/replaced_painter.cc
@@ -187,34 +187,7 @@ layout_replaced_); layout_replaced_.PaintReplaced(content_paint_state.GetPaintInfo(), content_paint_state.PaintOffset()); - - if (layout_replaced_.BelongsToElementChangingOverflowBehaviour() && - !layout_replaced_.ClipsToContentBox() && - layout_replaced_.HasVisualOverflow()) { - UseCounter::Count(layout_replaced_.GetDocument(), - WebFeature::kReplacedElementPaintedWithOverflow); - - auto overflow_size = layout_replaced_.PhysicalVisualOverflowRect().size; - auto overflow_area = overflow_size.width * overflow_size.height; - - auto content_size = layout_replaced_.Size(); - auto content_area = content_size.Width() * content_size.Height(); - - DCHECK_GT(overflow_area, content_area); - const float device_pixel_ratio = - layout_replaced_.GetDocument().DevicePixelRatio(); - const int overflow_outside_content_rect = - (overflow_area - content_area).ToInt() / pow(device_pixel_ratio, 2); - UMA_HISTOGRAM_COUNTS_100000( - "Blink.Overflow.ReplacedElementAreaOutsideContentRect", - overflow_outside_content_rect); - - constexpr int kMaxContentBreakageHeuristic = 5000; - if (overflow_outside_content_rect > kMaxContentBreakageHeuristic) { - UseCounter::Count(layout_replaced_.GetDocument(), - WebFeature::kReplacedElementPaintedWithLargeOverflow); - } - } + MeasureOverflowMetrics(); } if (layout_replaced_.StyleRef().Visibility() == EVisibility::kVisible && @@ -304,4 +277,38 @@ return true; } +void ReplacedPainter::MeasureOverflowMetrics() const { + if (!layout_replaced_.BelongsToElementChangingOverflowBehaviour() || + layout_replaced_.ClipsToContentBox() || + !layout_replaced_.HasVisualOverflow()) { + return; + } + + auto overflow_size = layout_replaced_.PhysicalVisualOverflowRect().size; + auto overflow_area = overflow_size.width * overflow_size.height; + + auto content_size = layout_replaced_.Size(); + auto content_area = content_size.Width() * content_size.Height(); + + DCHECK_GE(overflow_area, content_area); + if (overflow_area == content_area) + return; + + const float device_pixel_ratio = + layout_replaced_.GetDocument().DevicePixelRatio(); + const int overflow_outside_content_rect = + (overflow_area - content_area).ToInt() / pow(device_pixel_ratio, 2); + UMA_HISTOGRAM_COUNTS_100000( + "Blink.Overflow.ReplacedElementAreaOutsideContentRect", + overflow_outside_content_rect); + + UseCounter::Count(layout_replaced_.GetDocument(), + WebFeature::kReplacedElementPaintedWithOverflow); + constexpr int kMaxContentBreakageHeuristic = 5000; + if (overflow_outside_content_rect > kMaxContentBreakageHeuristic) { + UseCounter::Count(layout_replaced_.GetDocument(), + WebFeature::kReplacedElementPaintedWithLargeOverflow); + } +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/replaced_painter.h b/third_party/blink/renderer/core/paint/replaced_painter.h index 7a987fd..2a56067 100644 --- a/third_party/blink/renderer/core/paint/replaced_painter.h +++ b/third_party/blink/renderer/core/paint/replaced_painter.h
@@ -27,6 +27,7 @@ private: bool ShouldPaintBoxDecorationBackground(const PaintInfo&); + void MeasureOverflowMetrics() const; const LayoutReplaced& layout_replaced_; };
diff --git a/third_party/blink/renderer/core/streams/readable_byte_stream_controller.h b/third_party/blink/renderer/core/streams/readable_byte_stream_controller.h index e43cb87..2265837 100644 --- a/third_party/blink/renderer/core/streams/readable_byte_stream_controller.h +++ b/third_party/blink/renderer/core/streams/readable_byte_stream_controller.h
@@ -7,6 +7,7 @@ #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h" +#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/streams/readable_stream_byob_reader.h" #include "third_party/blink/renderer/core/streams/readable_stream_controller.h" #include "third_party/blink/renderer/core/typed_arrays/array_buffer_view_helpers.h" @@ -28,7 +29,8 @@ class StreamPromiseResolver; class UnderlyingSource; -class ReadableByteStreamController : public ReadableStreamController { +class CORE_EXPORT ReadableByteStreamController + : public ReadableStreamController { DEFINE_WRAPPERTYPEINFO(); public:
diff --git a/third_party/blink/renderer/core/streams/readable_stream_byob_request.h b/third_party/blink/renderer/core/streams/readable_stream_byob_request.h index db629534..3a6fae7f 100644 --- a/third_party/blink/renderer/core/streams/readable_stream_byob_request.h +++ b/third_party/blink/renderer/core/streams/readable_stream_byob_request.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_STREAMS_READABLE_STREAM_BYOB_REQUEST_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_STREAMS_READABLE_STREAM_BYOB_REQUEST_H_ +#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/streams/readable_byte_stream_controller.h" #include "third_party/blink/renderer/core/typed_arrays/array_buffer_view_helpers.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" @@ -15,7 +16,7 @@ class ScriptState; class DOMArrayBufferView; -class ReadableStreamBYOBRequest : public ScriptWrappable { +class CORE_EXPORT ReadableStreamBYOBRequest : public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); public:
diff --git a/third_party/blink/renderer/core/streams/underlying_byte_source_base.h b/third_party/blink/renderer/core/streams/underlying_byte_source_base.h index e7e729c..8e4496a2 100644 --- a/third_party/blink/renderer/core/streams/underlying_byte_source_base.h +++ b/third_party/blink/renderer/core/streams/underlying_byte_source_base.h
@@ -12,6 +12,7 @@ namespace blink { +class ExceptionState; class ReadableByteStreamController; class ScriptPromise; class ScriptState;
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.cc b/third_party/blink/renderer/modules/accessibility/ax_object.cc index 510c573..857e2ddd 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object.cc
@@ -614,7 +614,7 @@ } const AXObject* FindAncestorWithAriaHidden(const AXObject* start) { - for (const AXObject* object = start; object; + for (const AXObject* object = start; object && !object->IsWebArea(); object = object->ParentObject()) { if (object->AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kHidden)) return object; @@ -1231,9 +1231,6 @@ bool is_visible = IsVisible(); if (!is_visible) node_data->AddState(ax::mojom::blink::State::kInvisible); - SANITIZER_CHECK_EQ(cached_is_aria_hidden_, !!FindAncestorWithAriaHidden(this)) - << "IsAriaHidden() doesn't match existence of an aria-hidden ancestor: " - << ToString(true); if (is_visible || is_focusable) { // If the author applied the ARIA "textbox" role on something that is not @@ -2870,8 +2867,9 @@ } bool AXObject::ComputeIsAriaHidden(IgnoredReasons* ignored_reasons) const { - if (IsA<Document>(GetNode())) - return false; // The root node cannot be aria-hidden. + // The root node of a document or popup document cannot be aria-hidden. + if (IsWebArea()) + return false; // aria-hidden:true works a bit like display:none. // * aria-hidden=true affects entire subtree. @@ -6657,6 +6655,18 @@ return common_ancestor; } +void AXObject::PreSerializationConsistencyCheck() { +#if defined(AX_FAIL_FAST_BUILD) + if (!AXObjectCache().IsFrozen()) + return; // Only perform checks if tree is frozen. + SANITIZER_CHECK(!IsDetached()); + // Extra checks that only occur during serialization. + SANITIZER_CHECK_EQ(cached_is_aria_hidden_, !!FindAncestorWithAriaHidden(this)) + << "IsAriaHidden() doesn't match existence of an aria-hidden ancestor: " + << ToString(true); +#endif +} + String AXObject::ToString(bool verbose, bool cached_values_only) const { // Build a friendly name for debugging the object. // If verbose, build a longer name name in the form of: @@ -6740,12 +6750,17 @@ string_builder = string_builder + " ariaHidden"; } else if (IsAriaHidden()) { const AXObject* aria_hidden_root = AriaHiddenRoot(); - DCHECK(aria_hidden_root); - string_builder = string_builder + " ariaHiddenRoot"; - if (aria_hidden_root != this) { - string_builder = - string_builder + GetNodeString(aria_hidden_root->GetNode()); + if (aria_hidden_root) { + string_builder = string_builder + " ariaHiddenRoot"; + if (aria_hidden_root != this) { + string_builder = + string_builder + GetNodeString(aria_hidden_root->GetNode()); + } + } else { + string_builder = string_builder + " ariaHiddenRootMissing"; } + } else if (AriaHiddenRoot()) { + string_builder = string_builder + " ariaHiddenRootExtra"; } if (cached_values_only ? cached_is_hidden_via_style : IsHiddenViaStyle()) string_builder = string_builder + " isHiddenViaCSS";
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.h b/third_party/blink/renderer/modules/accessibility/ax_object.h index 5b629b5f..f3e9f8f 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.h +++ b/third_party/blink/renderer/modules/accessibility/ax_object.h
@@ -1327,6 +1327,9 @@ // xml-roles object attribute. const AtomicString& GetRoleAttributeStringForObjectAttribute(); + // Extra checks that occur right before a node is evaluated for serialization. + void PreSerializationConsistencyCheck(); + // Returns a string representation of this object. // |cached_values_only| avoids recomputing cached values, and thus can be // used during UpdateCachedValuesIfNecessary() without causing recursion.
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc index aa20b7d..e9f6a54 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc
@@ -1680,7 +1680,7 @@ if (!objects_.Take(ax_id)) return; - DCHECK_GE(objects_.size(), ids_in_use_.size()); + DCHECK_EQ(objects_.size(), ids_in_use_.size()); } // This is safe to call even if there isn't a current mapping.
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc index b2d7e2e8..9ae7df3 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc
@@ -1816,7 +1816,6 @@ } CanvasPattern* BaseRenderingContext2D::createPattern( - CanvasImageSource* image_source, const String& repetition_type, ExceptionState& exception_state) { @@ -1850,6 +1849,8 @@ ? "height" : "width")); return nullptr; + case kZeroSizeImageSourceStatus: + return nullptr; case kUndecodableSourceImageStatus: exception_state.ThrowDOMException( DOMExceptionCode::kInvalidStateError,
diff --git a/third_party/blink/renderer/modules/exported/web_ax_object.cc b/third_party/blink/renderer/modules/exported/web_ax_object.cc index 8a7b3dd..ad4bcfa 100644 --- a/third_party/blink/renderer/modules/exported/web_ax_object.cc +++ b/third_party/blink/renderer/modules/exported/web_ax_object.cc
@@ -165,13 +165,17 @@ // order to ensure that layout calls are not made at an unsafe time in the // document lifecycle. bool WebAXObject::MaybeUpdateLayoutAndCheckValidity() { - if (!IsDetached()) { - if (!MaybeUpdateLayoutAndCheckValidity(GetDocument())) - return false; - } + DCHECK(!IsDetached()); + + if (!MaybeUpdateLayoutAndCheckValidity(GetDocument())) + return false; // Doing a layout can cause this object to be invalid, so check again. - return CheckValidity(); + if (!CheckValidity()) + return false; + + private_->PreSerializationConsistencyCheck(); + return true; } // Returns true if the object is valid and can be accessed. @@ -1374,6 +1378,8 @@ // static void WebAXObject::Thaw(const WebDocument& web_document) { const Document* doc = web_document.ConstUnwrap<Document>(); + if (!doc) + return; auto* cache = To<AXObjectCacheImpl>(doc->ExistingAXObjectCache()); if (cache) cache->Thaw();
diff --git a/third_party/blink/renderer/modules/serial/serial_port.cc b/third_party/blink/renderer/modules/serial/serial_port.cc index 71bda2a..46f3ceb 100644 --- a/third_party/blink/renderer/modules/serial/serial_port.cc +++ b/third_party/blink/renderer/modules/serial/serial_port.cc
@@ -289,12 +289,8 @@ DCHECK(!underlying_source_); underlying_source_ = MakeGarbageCollected<SerialPortUnderlyingSource>( script_state, this, std::move(consumer)); - // Ideally the stream would report the number of bytes that can be read from - // the underlying Mojo data pipe. As an approximation the high water mark is - // set to 0 so that data remains in the pipe rather than being queued in the - // stream and thus adding an extra layer of buffering. - readable_ = ReadableStream::CreateWithCountQueueingStrategy( - script_state, underlying_source_, /*high_water_mark=*/0); + readable_ = + ReadableStream::CreateByteStream(script_state, underlying_source_); return readable_; }
diff --git a/third_party/blink/renderer/modules/serial/serial_port_underlying_source.cc b/third_party/blink/renderer/modules/serial/serial_port_underlying_source.cc index 3d7cc0dcc..059998a8c 100644 --- a/third_party/blink/renderer/modules/serial/serial_port_underlying_source.cc +++ b/third_party/blink/renderer/modules/serial/serial_port_underlying_source.cc
@@ -4,9 +4,12 @@ #include "third_party/blink/renderer/modules/serial/serial_port_underlying_source.h" +#include "base/numerics/safe_conversions.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" #include "third_party/blink/renderer/core/dom/dom_exception.h" -#include "third_party/blink/renderer/core/streams/readable_stream_default_controller_with_script_scope.h" +#include "third_party/blink/renderer/core/streams/readable_byte_stream_controller.h" +#include "third_party/blink/renderer/core/streams/readable_stream_byob_request.h" +#include "third_party/blink/renderer/core/typed_arrays/dom_array_piece.h" #include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h" #include "third_party/blink/renderer/modules/serial/serial_port.h" #include "third_party/blink/renderer/platform/wtf/functional.h" @@ -17,9 +20,10 @@ ScriptState* script_state, SerialPort* serial_port, mojo::ScopedDataPipeConsumerHandle handle) - : UnderlyingSourceBase(script_state), + : ExecutionContextLifecycleObserver(ExecutionContext::From(script_state)), data_pipe_(std::move(handle)), watcher_(FROM_HERE, mojo::SimpleWatcher::ArmingPolicy::MANUAL), + script_state_(script_state), serial_port_(serial_port) { watcher_.Watch(data_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, MOJO_TRIGGER_CONDITION_SIGNALS_SATISFIED, @@ -27,7 +31,12 @@ WrapWeakPersistent(this))); } -ScriptPromise SerialPortUnderlyingSource::pull(ScriptState* script_state) { +ScriptPromise SerialPortUnderlyingSource::Pull( + ReadableByteStreamController* controller, + ExceptionState&) { + DCHECK(controller_ == nullptr || controller_ == controller); + controller_ = controller; + DCHECK(data_pipe_); ReadDataOrArmWatcher(); @@ -35,11 +44,11 @@ // we allow the stream to be canceled before that data is received. pull() // will not be called again until a chunk is enqueued or if an error has been // signaled to the controller. - return ScriptPromise::CastUndefined(script_state); + return ScriptPromise::CastUndefined(script_state_); } -ScriptPromise SerialPortUnderlyingSource::Cancel(ScriptState* script_state, - ScriptValue reason) { +ScriptPromise SerialPortUnderlyingSource::Cancel( + ExceptionState& exception_state) { DCHECK(data_pipe_); Close(); @@ -48,10 +57,10 @@ // don't need to do it here. if (serial_port_->IsClosing()) { serial_port_->UnderlyingSourceClosed(); - return ScriptPromise::CastUndefined(script_state); + return ScriptPromise::CastUndefined(script_state_); } - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); + auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state_); serial_port_->Flush( device::mojom::blink::SerialPortFlushMode::kReceive, WTF::Bind(&SerialPortUnderlyingSource::OnFlush, WrapPersistent(this), @@ -59,9 +68,18 @@ return resolver->Promise(); } +ScriptPromise SerialPortUnderlyingSource::Cancel( + v8::Local<v8::Value> reason, + ExceptionState& exception_state) { + return Cancel(exception_state); +} + +ScriptState* SerialPortUnderlyingSource::GetScriptState() { + return script_state_; +} + void SerialPortUnderlyingSource::ContextDestroyed() { Close(); - UnderlyingSourceBase::ContextDestroyed(); } void SerialPortUnderlyingSource::SignalErrorOnClose(DOMException* exception) { @@ -71,28 +89,47 @@ return; } - Controller()->Error(exception); + ScriptState::Scope script_state_scope(script_state_); + controller_->error(script_state_, + ScriptValue::From(script_state_, exception)); serial_port_->UnderlyingSourceClosed(); } void SerialPortUnderlyingSource::Trace(Visitor* visitor) const { visitor->Trace(pending_exception_); + visitor->Trace(script_state_); visitor->Trace(serial_port_); - UnderlyingSourceBase::Trace(visitor); + visitor->Trace(controller_); + UnderlyingByteSourceBase::Trace(visitor); + ExecutionContextLifecycleObserver::Trace(visitor); } void SerialPortUnderlyingSource::ReadDataOrArmWatcher() { const void* buffer = nullptr; - uint32_t available = 0; + uint32_t length = 0; MojoResult result = - data_pipe_->BeginReadData(&buffer, &available, MOJO_READ_DATA_FLAG_NONE); + data_pipe_->BeginReadData(&buffer, &length, MOJO_READ_DATA_FLAG_NONE); switch (result) { case MOJO_RESULT_OK: { - auto* array = DOMUint8Array::Create( - static_cast<const unsigned char*>(buffer), available); - result = data_pipe_->EndReadData(available); + // respond() or enqueue() will only throw if their arguments are invalid + // or the stream is errored. The code below guarantees that the length is + // in range and the chunk is a valid view. If the stream becomes errored + // then this method cannot be called because the watcher is disarmed. + NonThrowableExceptionState exception_state; + + if (ReadableStreamBYOBRequest* request = controller_->byobRequest()) { + DOMArrayPiece view(request->view().Get()); + length = + std::min(base::saturated_cast<uint32_t>(view.ByteLength()), length); + memcpy(view.Data(), buffer, length); + request->respond(script_state_, length, exception_state); + } else { + auto chunk = NotShared(DOMUint8Array::Create( + static_cast<const unsigned char*>(buffer), length)); + controller_->enqueue(script_state_, chunk, exception_state); + } + result = data_pipe_->EndReadData(length); DCHECK_EQ(result, MOJO_RESULT_OK); - Controller()->Enqueue(array); break; } case MOJO_RESULT_FAILED_PRECONDITION: @@ -110,6 +147,8 @@ void SerialPortUnderlyingSource::OnHandleReady( MojoResult result, const mojo::HandleSignalsState& state) { + ScriptState::Scope script_state_scope(script_state_); + switch (result) { case MOJO_RESULT_OK: ReadDataOrArmWatcher(); @@ -130,7 +169,8 @@ void SerialPortUnderlyingSource::PipeClosed() { if (pending_exception_) { - Controller()->Error(pending_exception_); + controller_->error(script_state_, + ScriptValue::From(script_state_, pending_exception_)); serial_port_->UnderlyingSourceClosed(); } Close();
diff --git a/third_party/blink/renderer/modules/serial/serial_port_underlying_source.h b/third_party/blink/renderer/modules/serial/serial_port_underlying_source.h index 8c564b76..e00b9c46 100644 --- a/third_party/blink/renderer/modules/serial/serial_port_underlying_source.h +++ b/third_party/blink/renderer/modules/serial/serial_port_underlying_source.h
@@ -7,23 +7,30 @@ #include "mojo/public/cpp/system/data_pipe.h" #include "mojo/public/cpp/system/simple_watcher.h" -#include "third_party/blink/renderer/core/streams/underlying_source_base.h" +#include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h" +#include "third_party/blink/renderer/core/streams/underlying_byte_source_base.h" namespace blink { class DOMException; +class ExceptionState; class ScriptPromiseResolver; class SerialPort; -class SerialPortUnderlyingSource : public UnderlyingSourceBase { +class SerialPortUnderlyingSource : public UnderlyingByteSourceBase, + ExecutionContextLifecycleObserver { public: SerialPortUnderlyingSource(ScriptState*, SerialPort*, mojo::ScopedDataPipeConsumerHandle); - // UnderlyingSourceBase - ScriptPromise pull(ScriptState*) override; - ScriptPromise Cancel(ScriptState*, ScriptValue reason) override; + // UnderlyingByteSourceBase + ScriptPromise Pull(ReadableByteStreamController* controller, + ExceptionState&) override; + ScriptPromise Cancel(ExceptionState&) override; + ScriptPromise Cancel(v8::Local<v8::Value> reason, ExceptionState&) override; + ScriptState* GetScriptState() override; + void ContextDestroyed() override; void SignalErrorOnClose(DOMException*); @@ -41,7 +48,9 @@ mojo::ScopedDataPipeConsumerHandle data_pipe_; mojo::SimpleWatcher watcher_; - Member<SerialPort> serial_port_; + const Member<ScriptState> script_state_; + const Member<SerialPort> serial_port_; + Member<ReadableByteStreamController> controller_; Member<DOMException> pending_exception_; };
diff --git a/third_party/blink/tools/blinkpy/tool/commands/queries.py b/third_party/blink/tools/blinkpy/tool/commands/queries.py index 671bde9f..ce4a8925 100644 --- a/third_party/blink/tools/blinkpy/tool/commands/queries.py +++ b/third_party/blink/tools/blinkpy/tool/commands/queries.py
@@ -126,7 +126,8 @@ if options.paths: files = default_port.default_expectations_files() - web_tests_dir = default_port.web_tests_dir() + web_tests_dir = default_port._filesystem.normpath( + default_port.web_tests_dir()) for file in files: if file.startswith(web_tests_dir): file = file.replace(web_tests_dir,
diff --git a/third_party/blink/tools/blinkpy/tool/commands/rebaseline.py b/third_party/blink/tools/blinkpy/tool/commands/rebaseline.py index 1daba38..280d624 100644 --- a/third_party/blink/tools/blinkpy/tool/commands/rebaseline.py +++ b/third_party/blink/tools/blinkpy/tool/commands/rebaseline.py
@@ -537,12 +537,24 @@ test_flag_pairs_to_suffixes[test, flag_spec].update( self._suffixes_for_actual_failures(test, build, step_name)) - optimize_commands = [] + suffixes_flag_spec = collections.defaultdict(set) + test_list = collections.defaultdict(list) for (test, flag_spec), suffixes in test_flag_pairs_to_suffixes.items(): - # No need to optimize baselines for a test with no failures. if not suffixes: continue - path_to_blink_tool = self._tool.path() + if flag_spec is None: + flag_spec = 'default' + + suffixes_flag_spec[flag_spec].update(suffixes) + test_list[flag_spec].append(test) + + optimize_commands = collections.defaultdict(lambda: ([], '')) + cwd = self._tool.git().checkout_root + path_to_blink_tool = self._tool.path() + + # Build one optimize-baselines invocation command for each flag_spec. + # All the tests in the test list will be optimized iteratively. + for flag_spec, test_list_flag in test_list.items(): command = [ self._tool.executable, path_to_blink_tool, @@ -554,11 +566,15 @@ ] if verbose: command.append('--verbose') - if flag_spec: + if flag_spec != 'default': command.extend(['--flag-specific', flag_spec]) - command.extend(['--suffixes', ','.join(sorted(suffixes)), test]) - cwd = self._tool.git().checkout_root - optimize_commands.append((command, cwd)) + command.extend([ + '--suffixes', ','.join(sorted(suffixes_flag_spec[flag_spec])) + ]) + for test in test_list_flag: + command.append(test) + + optimize_commands[flag_spec] = (command, cwd) return optimize_commands @@ -652,9 +668,12 @@ self._update_expectations_files(lines_to_remove) if options.optimize: - self._run_in_parallel( - self._optimize_commands(test_baseline_set, options.verbose, - options.resultDB)) + optimize_commands = self._optimize_commands( + test_baseline_set, options.verbose, options.resultDB) + + for _, (cmd, cwd) in optimize_commands.items(): + output = self._tool.executive.run_command(cmd, cwd) + print(output) self._tool.git().add_list(self.unstaged_baselines())
diff --git a/third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl_unittest.py b/third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl_unittest.py index 8dba493..48292e063 100644 --- a/third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl_unittest.py +++ b/third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl_unittest.py
@@ -649,7 +649,7 @@ '--step-name', 'blink_web_tests (with patch)', ]], - [[ + [ 'python', 'echo', 'optimize-baselines', @@ -657,7 +657,7 @@ '--suffixes', 'wav', 'one/flaky-fail.html', - ]]]) + ]]) def test_rebaseline_command_invocations_multiple_steps(self): """Test the rebaseline tool handles multiple steps on the same builder. @@ -700,21 +700,20 @@ 'not_site_per_process_blink_web_tests (with patch)' ], ]) - self.assertEqual(sorted(self.tool.executive.calls[2]), [ - [ - 'python', 'echo', 'optimize-baselines', '--no-manifest-update', - '--flag-specific', 'disable-layout-ng', '--suffixes', 'txt', - 'one/text-fail.html' - ], - [ - 'python', 'echo', 'optimize-baselines', '--no-manifest-update', - '--flag-specific', 'disable-site-isolation-trials', - '--suffixes', 'txt', 'one/text-fail.html' - ], - [ - 'python', 'echo', 'optimize-baselines', '--no-manifest-update', - '--suffixes', 'txt', 'one/text-fail.html' - ] + print(self.tool.executive.calls) + self.assertEqual(self.tool.executive.calls[2], [ + 'python', 'echo', 'optimize-baselines', '--no-manifest-update', + '--suffixes', 'txt', 'one/text-fail.html' + ]) + self.assertEqual(self.tool.executive.calls[3], [ + 'python', 'echo', 'optimize-baselines', '--no-manifest-update', + '--flag-specific', 'disable-layout-ng', '--suffixes', 'txt', + 'one/text-fail.html' + ]) + self.assertEqual(self.tool.executive.calls[4], [ + 'python', 'echo', 'optimize-baselines', '--no-manifest-update', + '--flag-specific', 'disable-site-isolation-trials', '--suffixes', + 'txt', 'one/text-fail.html' ]) def test_trigger_try_jobs(self):
diff --git a/third_party/blink/tools/blinkpy/tool/commands/rebaseline_test_unittest.py b/third_party/blink/tools/blinkpy/tool/commands/rebaseline_test_unittest.py index f8cb81fe7..abe7059e 100644 --- a/third_party/blink/tools/blinkpy/tool/commands/rebaseline_test_unittest.py +++ b/third_party/blink/tools/blinkpy/tool/commands/rebaseline_test_unittest.py
@@ -9,6 +9,7 @@ from blinkpy.common.system.output_capture import OutputCapture from blinkpy.tool.commands.rebaseline_test import RebaselineTest from blinkpy.tool.commands.rebaseline_unittest import BaseTestCase +from blinkpy.web_tests.port.test import MOCK_WEB_TESTS class TestRebaselineTest(BaseTestCase): @@ -79,16 +80,16 @@ def test_baseline_directory(self): self.assertMultiLineEqual( self.command.baseline_directory('MOCK Mac10.11'), - '/test.checkout/wtests/platform/test-mac-mac10.11') + MOCK_WEB_TESTS + 'platform/test-mac-mac10.11') self.assertMultiLineEqual( self.command.baseline_directory('MOCK Mac10.10'), - '/test.checkout/wtests/platform/test-mac-mac10.10') + MOCK_WEB_TESTS + 'platform/test-mac-mac10.10') self.assertMultiLineEqual( self.command.baseline_directory('MOCK Trusty'), - '/test.checkout/wtests/platform/test-linux-trusty') + MOCK_WEB_TESTS + 'platform/test-linux-trusty') self.assertMultiLineEqual( self.command.baseline_directory('MOCK Precise'), - '/test.checkout/wtests/platform/test-linux-precise') + MOCK_WEB_TESTS + 'platform/test-linux-precise') def test_rebaseline_updates_expectations_file_noop(self): # pylint: disable=protected-access
diff --git a/third_party/blink/tools/blinkpy/tool/commands/rebaseline_unittest.py b/third_party/blink/tools/blinkpy/tool/commands/rebaseline_unittest.py index 09350f30..b65a9c8 100644 --- a/third_party/blink/tools/blinkpy/tool/commands/rebaseline_unittest.py +++ b/third_party/blink/tools/blinkpy/tool/commands/rebaseline_unittest.py
@@ -16,7 +16,8 @@ from blinkpy.tool.mock_tool import MockBlinkTool from blinkpy.web_tests.builder_list import BuilderList from blinkpy.web_tests.port.factory_mock import MockPortFactory -from blinkpy.web_tests.port.test import add_manifest_to_mock_filesystem +from blinkpy.web_tests.port.test import (add_manifest_to_mock_filesystem, + MOCK_WEB_TESTS) class BaseTestCase(unittest.TestCase): @@ -312,9 +313,9 @@ baseline_paths = self.command._generic_baseline_paths( test_baseline_set) self.assertEqual(baseline_paths, [ - '/test.checkout/wtests/platform/generic/passes/text-expected.png', - '/test.checkout/wtests/platform/generic/passes/text-expected.txt', - '/test.checkout/wtests/platform/generic/passes/text-expected.wav', + MOCK_WEB_TESTS + 'platform/generic/passes/text-expected.png', + MOCK_WEB_TESTS + 'platform/generic/passes/text-expected.txt', + MOCK_WEB_TESTS + 'platform/generic/passes/text-expected.wav', ]) def test_unstaged_baselines(self): @@ -326,8 +327,8 @@ RELATIVE_WEB_TESTS + 'x/foo.html': 'M', 'docs/something.md': '?', } self.assertEqual(self.command.unstaged_baselines(), [ - '/mock-checkout/' + RELATIVE_WEB_TESTS + 'x/foo-expected.png', - '/mock-checkout/' + RELATIVE_WEB_TESTS + 'x/foo-expected.txt', + MOCK_WEB_TESTS + 'x/foo-expected.png', + MOCK_WEB_TESTS + 'x/foo-expected.txt', ]) def test_suffixes_for_actual_failures_for_wpt(self): @@ -457,7 +458,7 @@ '--step-name', 'blink_web_tests (with patch)', ]], - [[ + [ 'python', 'echo', 'optimize-baselines', @@ -466,7 +467,7 @@ '--suffixes', 'png,txt', 'userscripts/first-test.html', - ]]]) + ]]) def test_rebaseline_debug(self): test_baseline_set = TestBaselineSet(self.tool) @@ -504,7 +505,7 @@ '--step-name', 'blink_web_tests (with patch)', ]], - [[ + [ 'python', 'echo', 'optimize-baselines', @@ -513,7 +514,7 @@ '--suffixes', 'png,txt', 'userscripts/first-test.html', - ]]]) + ]]) def test_no_optimize(self): test_baseline_set = TestBaselineSet(self.tool) @@ -631,7 +632,7 @@ '--step-name', 'blink_web_tests (with patch)', ]], - [[ + [ 'python', 'echo', 'optimize-baselines', @@ -640,7 +641,7 @@ '--suffixes', 'png,txt', 'userscripts/first-test.html', - ]]]) + ]]) class TestRebaselineUpdatesExpectationsFiles(BaseTestCase): @@ -1138,9 +1139,9 @@ host.port_factory = MockPortFactory(host) port = host.port_factory.get() base_dir = port.web_tests_dir() - host.filesystem.write_text_file(base_dir + '/a/x.html', '<html>') - host.filesystem.write_text_file(base_dir + '/a/y.html', '<html>') - host.filesystem.write_text_file(base_dir + '/a/z.html', '<html>') + host.filesystem.write_text_file(base_dir + 'a/x.html', '<html>') + host.filesystem.write_text_file(base_dir + 'a/y.html', '<html>') + host.filesystem.write_text_file(base_dir + 'a/z.html', '<html>') host.builders = BuilderList({ 'MOCK Mac10.12': { 'port_name': 'test-mac-mac10.12',
diff --git a/third_party/blink/tools/blinkpy/w3c/wpt_expectations_updater_unittest.py b/third_party/blink/tools/blinkpy/w3c/wpt_expectations_updater_unittest.py index 84e583e..65b34637 100644 --- a/third_party/blink/tools/blinkpy/w3c/wpt_expectations_updater_unittest.py +++ b/third_party/blink/tools/blinkpy/w3c/wpt_expectations_updater_unittest.py
@@ -10,7 +10,6 @@ from blinkpy.common.net.git_cl_mock import MockGitCL from blinkpy.common.net.results_fetcher import Build from blinkpy.common.net.web_test_results import WebTestResult, WebTestResults -from blinkpy.common.path_finder import RELATIVE_WEB_TESTS from blinkpy.common.system.executive import ScriptError from blinkpy.common.system.log_testing import LoggingTestCase @@ -23,8 +22,8 @@ from blinkpy.web_tests.models.test_expectations import TestExpectations from blinkpy.web_tests.port.android import PRODUCTS_TO_EXPECTATION_FILE_PATHS from blinkpy.web_tests.port.factory_mock import MockPortFactory +from blinkpy.web_tests.port.test import MOCK_WEB_TESTS -MOCK_WEB_TESTS = '/mock-checkout/' + RELATIVE_WEB_TESTS class WPTExpectationsUpdaterTest(LoggingTestCase): def mock_host(self): @@ -77,7 +76,7 @@ # Write a dummy manifest file, describing what tests exist. host.filesystem.write_text_file( - host.port_factory.get().web_tests_dir() + '/external/' + + host.port_factory.get().web_tests_dir() + 'external/' + BASE_MANIFEST_NAME, json.dumps({ 'items': { @@ -90,14 +89,14 @@ 'testharness': { 'test/path.html': ['abcdef123', [None, {}]], 'test/zzzz.html': ['ghijkl456', [None, {}]], - 'fake/some_test.html': [ - 'ghijkl456', ['fake/some_test.html?HelloWorld', {}]], - 'fake/file/deleted_path.html': [ - 'ghijkl456', [None, {}]], + 'fake/some_test.html': + ['ghijkl456', ['fake/some_test.html?HelloWorld', {}]], + 'fake/file/deleted_path.html': + ['ghijkl456', [None, {}]], 'test/task.js': [ - 'mnpqrs789', - ['test/task.html', {}], - ['test/task2.html', {}]], + 'mnpqrs789', ['test/task.html', {}], + ['test/task2.html', {}] + ], }, 'manual': { 'x-manual.html': ['abcdef123', [None, {}]], @@ -612,14 +611,14 @@ def test_skipped_specifiers_when_test_is_skip(self): host = self.mock_host() - expectations_path = '/test.checkout/wtests/NeverFixTests' + expectations_path = MOCK_WEB_TESTS + 'NeverFixTests' host.filesystem.write_text_file( expectations_path, ('# tags: [ Linux ]\n' '# results: [ Skip ]\n' 'crbug.com/111 [ Linux ] external/wpt/test.html [ Skip ]\n')) host.filesystem.write_text_file( - '/test.checkout/wtests/external/wpt/test.html', '') + MOCK_WEB_TESTS + 'external/wpt/test.html', '') updater = WPTExpectationsUpdater(host) self.assertEqual( updater.skipped_specifiers('external/wpt/test.html'), @@ -627,14 +626,14 @@ def test_specifiers_can_extend_to_all_platforms(self): host = self.mock_host() - expectations_path = '/test.checkout/wtests/NeverFixTests' + expectations_path = MOCK_WEB_TESTS + 'NeverFixTests' host.filesystem.write_text_file( expectations_path, ('# tags: [ Linux ]\n' '# results: [ Skip ]\n' 'crbug.com/111 [ Linux ] external/wpt/test.html [ Skip ]\n')) host.filesystem.write_text_file( - '/test.checkout/wtests/external/wpt/test.html', '') + MOCK_WEB_TESTS + 'external/wpt/test.html', '') updater = WPTExpectationsUpdater(host) self.assertTrue( updater.specifiers_can_extend_to_all_platforms( @@ -698,7 +697,7 @@ def test_normalized_specifiers_with_skipped_test(self): host = self.mock_host() - expectations_path = '/test.checkout/wtests/NeverFixTests' + expectations_path = MOCK_WEB_TESTS + 'NeverFixTests' host.filesystem.write_text_file( expectations_path, ('# tags: [ Linux Mac10.11 ]\n' @@ -706,7 +705,7 @@ 'crbug.com/111 [ Linux ] external/wpt/test.html [ Skip ]\n' 'crbug.com/111 [ Mac10.11 ] external/wpt/test.html [ Skip ]\n')) host.filesystem.write_text_file( - '/test.checkout/wtests/external/wpt/test.html', '') + MOCK_WEB_TESTS + 'external/wpt/test.html', '') updater = WPTExpectationsUpdater(host) self.assertEqual( updater.normalized_specifiers( @@ -1302,7 +1301,7 @@ }) def test_cleanup_all_deleted_tests_in_expectations_files(self): - host = MockHost() + host = self.mock_host() port = host.port_factory.get() fs = host.filesystem expectations_path = fs.join(MOCK_WEB_TESTS, 'TestExpectations') @@ -1342,7 +1341,7 @@ 'some/test/d.html [ Failure ]\n')) def test_skip_slow_timeout_tests(self): - host = MockHost() + host = self.mock_host() fs = host.filesystem expectations_path = fs.join(MOCK_WEB_TESTS, 'TestExpectations') data = ('# results: [ Pass Failure Crash Timeout Skip ]\n' @@ -1366,7 +1365,7 @@ self.assertEqual(newdata, fs.read_text_file(expectations_path)) def test_cleanup_all_test_expectations_files(self): - host = MockHost() + host = self.mock_host() fs = host.filesystem test_expect_path = fs.join(MOCK_WEB_TESTS, 'TestExpectations') webdriver_expect_path = fs.join(MOCK_WEB_TESTS,
diff --git a/third_party/blink/tools/blinkpy/w3c/wpt_manifest_unittest.py b/third_party/blink/tools/blinkpy/w3c/wpt_manifest_unittest.py index 6410d1c..0603562 100644 --- a/third_party/blink/tools/blinkpy/w3c/wpt_manifest_unittest.py +++ b/third_party/blink/tools/blinkpy/w3c/wpt_manifest_unittest.py
@@ -8,14 +8,14 @@ from blinkpy.common.system.executive import ScriptError from blinkpy.common.system.executive_mock import MockExecutive from blinkpy.w3c.wpt_manifest import WPTManifest -from blinkpy.web_tests.port.test import TestPort, WEB_TEST_DIR +from blinkpy.web_tests.port.test import TestPort, MOCK_WEB_TESTS class WPTManifestUnitTest(unittest.TestCase): def test_ensure_manifest_copies_new_manifest(self): host = MockHost() port = TestPort(host) - manifest_path = WEB_TEST_DIR + '/external/wpt/MANIFEST.json' + manifest_path = MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json' self.assertFalse(host.filesystem.exists(manifest_path)) WPTManifest.ensure_manifest(port) @@ -30,13 +30,13 @@ '-v', '--no-download', '--tests-root', - WEB_TEST_DIR + '/external/wpt', + MOCK_WEB_TESTS + 'external/wpt', ]]) def test_ensure_manifest_updates_manifest_if_it_exists(self): host = MockHost() port = TestPort(host) - manifest_path = WEB_TEST_DIR + '/external/wpt/MANIFEST.json' + manifest_path = MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json' host.filesystem.write_text_file(manifest_path, '{"manifest": "NOT base"}') @@ -54,7 +54,7 @@ '-v', '--no-download', '--tests-root', - WEB_TEST_DIR + '/external/wpt', + MOCK_WEB_TESTS + 'external/wpt', ]]) def test_ensure_manifest_raises_exception(self): @@ -76,7 +76,7 @@ '-v', '--no-download', '--tests-root', - WEB_TEST_DIR + '/wpt_internal', + MOCK_WEB_TESTS + 'wpt_internal', ]]) def test_does_not_throw_when_missing_some_test_types(self): @@ -94,9 +94,9 @@ ''' host = MockHost() host.filesystem.write_text_file( - WEB_TEST_DIR + '/external/wpt/MANIFEST.json', manifest_json) - manifest = WPTManifest( - host, WEB_TEST_DIR + '/external/wpt/MANIFEST.json') + MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json', manifest_json) + manifest = WPTManifest(host, + MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json') self.assertTrue(manifest.is_test_file('test.any.js')) self.assertEqual(manifest.all_url_items(), {u'test.any.html': [u'test.any.html', {}]}) @@ -120,9 +120,9 @@ ''' host = MockHost() host.filesystem.write_text_file( - WEB_TEST_DIR + '/external/wpt/MANIFEST.json', manifest_json) - manifest = WPTManifest( - host, WEB_TEST_DIR + '/external/wpt/MANIFEST.json') + MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json', manifest_json) + manifest = WPTManifest(host, + MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json') self.assertEqual(manifest.all_url_items(), {u'test.any.html': [u'test.any.html', {}]}) @@ -145,9 +145,9 @@ } ''' host = MockHost() host.filesystem.write_text_file( - WEB_TEST_DIR + '/external/wpt/MANIFEST.json', manifest_json) - manifest = WPTManifest( - host, WEB_TEST_DIR + '/external/wpt/MANIFEST.json') + MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json', manifest_json) + manifest = WPTManifest(host, + MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json') self.assertEqual( manifest.all_url_items(), { u'test.any.html': [u'test.any.html', {}], @@ -185,9 +185,9 @@ ''' host = MockHost() host.filesystem.write_text_file( - WEB_TEST_DIR + '/external/wpt/MANIFEST.json', manifest_json) - manifest = WPTManifest( - host, WEB_TEST_DIR + '/external/wpt/MANIFEST.json') + MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json', manifest_json) + manifest = WPTManifest(host, + MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json') self.assertEqual( manifest.all_url_items(), { u'test.html': [u'test.html', {}], @@ -252,9 +252,9 @@ host = MockHost() host.filesystem.write_text_file( - WEB_TEST_DIR + '/external/wpt/MANIFEST.json', manifest_json) + MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json', manifest_json) manifest = WPTManifest(host, - WEB_TEST_DIR + '/external/wpt/MANIFEST.json') + MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json') self.assertEqual( manifest.extract_fuzzy_metadata('fuzzy.html'), @@ -295,9 +295,9 @@ host = MockHost() host.filesystem.write_text_file( - WEB_TEST_DIR + '/external/wpt/MANIFEST.json', manifest_json) + MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json', manifest_json) manifest = WPTManifest(host, - WEB_TEST_DIR + '/external/wpt/MANIFEST.json') + MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json') self.assertEqual( manifest.extract_test_pac('with-pac.html'),
diff --git a/third_party/blink/tools/blinkpy/w3c/wpt_metadata_builder_unittest.py b/third_party/blink/tools/blinkpy/w3c/wpt_metadata_builder_unittest.py index 56e1080..028da6d 100644 --- a/third_party/blink/tools/blinkpy/w3c/wpt_metadata_builder_unittest.py +++ b/third_party/blink/tools/blinkpy/w3c/wpt_metadata_builder_unittest.py
@@ -97,7 +97,7 @@ # Write a dummy manifest file, describing what tests exist. self.host.filesystem.write_text_file( - self.port.web_tests_dir() + '/external/' + BASE_MANIFEST_NAME, + self.port.web_tests_dir() + 'external/' + BASE_MANIFEST_NAME, json.dumps({ 'items': { 'reftest': {
diff --git a/third_party/blink/tools/blinkpy/web_tests/controllers/test_result_sink_unittest.py b/third_party/blink/tools/blinkpy/web_tests/controllers/test_result_sink_unittest.py index 9251881f..673467d 100644 --- a/third_party/blink/tools/blinkpy/web_tests/controllers/test_result_sink_unittest.py +++ b/third_party/blink/tools/blinkpy/web_tests/controllers/test_result_sink_unittest.py
@@ -19,7 +19,7 @@ from blinkpy.web_tests.models.typ_types import ResultType from blinkpy.web_tests.port.test import add_manifest_to_mock_filesystem from blinkpy.web_tests.port.test import TestPort -from blinkpy.web_tests.port.test import WEB_TEST_DIR +from blinkpy.web_tests.port.test import MOCK_WEB_TESTS class TestResultSinkTestBase(unittest.TestCase): @@ -329,7 +329,7 @@ 'virtual/virtual_passes/passes/does_not_exist.html', 'passes/does_not_exist.html') self.port.host.filesystem.write_text_file( - self.port.host.filesystem.join(WEB_TEST_DIR, 'virtual', + self.port.host.filesystem.join(MOCK_WEB_TESTS, 'virtual', 'virtual_passes', 'passes', 'exists.html'), 'body',
diff --git a/third_party/blink/tools/blinkpy/web_tests/lint_test_expectations_unittest.py b/third_party/blink/tools/blinkpy/web_tests/lint_test_expectations_unittest.py index f1847c4..72dd1b3 100644 --- a/third_party/blink/tools/blinkpy/web_tests/lint_test_expectations_unittest.py +++ b/third_party/blink/tools/blinkpy/web_tests/lint_test_expectations_unittest.py
@@ -35,7 +35,7 @@ from blinkpy.web_tests import lint_test_expectations from blinkpy.web_tests.port.android import PRODUCTS_TO_EXPECTATION_FILE_PATHS from blinkpy.web_tests.port.base import VirtualTestSuite -from blinkpy.web_tests.port.test import WEB_TEST_DIR +from blinkpy.web_tests.port.test import MOCK_WEB_TESTS from six import StringIO @@ -152,8 +152,9 @@ host.port_factory.get = lambda platform=None, options=None: port host.port_factory.all_port_names = lambda platform=None: [port.name()] - host.filesystem.write_text_file(WEB_TEST_DIR + '/LeakExpectations', - '-- syntax error') + host.filesystem.write_text_file( + host.filesystem.join(MOCK_WEB_TESTS, 'LeakExpectations'), + '-- syntax error') failures, warnings = lint_test_expectations.lint(host, options) self.assertTrue(failures) @@ -468,16 +469,17 @@ VirtualTestSuite(prefix='foo', platforms=['Linux', 'Mac', 'Win'], bases=['test'], args=['--foo']), VirtualTestSuite(prefix='bar', platforms=['Linux', 'Mac', 'Win'], bases=['test'], args=['--bar']), ] fs = self.host.filesystem - fs.maybe_make_directory(fs.join(WEB_TEST_DIR, 'test')) + fs.maybe_make_directory(fs.join(MOCK_WEB_TESTS, 'test')) res = lint_test_expectations.check_virtual_test_suites( self.host, self.options) self.assertEqual(len(res), 2) fs.write_text_file( - fs.join(WEB_TEST_DIR, 'virtual', 'foo', 'README.md'), '') + fs.join(MOCK_WEB_TESTS, 'virtual', 'foo', 'README.md'), '') fs.write_text_file( - fs.join(WEB_TEST_DIR, 'virtual', 'bar', 'test', 'README.txt'), '') + fs.join(MOCK_WEB_TESTS, 'virtual', 'bar', 'test', 'README.txt'), + '') res = lint_test_expectations.check_virtual_test_suites( self.host, self.options) self.assertFalse(res) @@ -513,10 +515,10 @@ ] fs = self.host.filesystem - fs.maybe_make_directory(fs.join(WEB_TEST_DIR, 'base1')) - fs.write_text_file(fs.join(WEB_TEST_DIR, 'base3.html'), '') + fs.maybe_make_directory(fs.join(MOCK_WEB_TESTS, 'base1')) + fs.write_text_file(fs.join(MOCK_WEB_TESTS, 'base3.html'), '') fs.write_text_file( - fs.join(WEB_TEST_DIR, 'virtual', 'foo', 'README.md'), '') + fs.join(MOCK_WEB_TESTS, 'virtual', 'foo', 'README.md'), '') res = lint_test_expectations.check_virtual_test_suites( self.host, self.options) self.assertEqual(len(res), 1)
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 63e6cdb..7e05703 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
@@ -31,7 +31,6 @@ import optparse import unittest -from blinkpy.common.path_finder import RELATIVE_WEB_TESTS from blinkpy.common.host_mock import MockHost from blinkpy.common.system.executive_mock import MockExecutive from blinkpy.common.system.log_testing import LoggingTestCase @@ -43,9 +42,7 @@ from blinkpy.web_tests.port.factory import PortFactory from blinkpy.web_tests.port.test import (add_unit_tests_to_mock_filesystem, add_manifest_to_mock_filesystem, - WEB_TEST_DIR, TestPort) - -MOCK_WEB_TESTS = '/mock-checkout/' + RELATIVE_WEB_TESTS + MOCK_WEB_TESTS, TestPort) class PortTest(LoggingTestCase): @@ -492,6 +489,9 @@ def _make_port_for_test_additional_expectations(self, options_dict={}): port = self.make_port( port_name='foo', options=optparse.Values(options_dict)) + port.host.filesystem.remove(MOCK_WEB_TESTS + 'TestExpectations') + port.host.filesystem.remove(MOCK_WEB_TESTS + 'NeverFixTests') + port.host.filesystem.remove(MOCK_WEB_TESTS + 'SlowTests') port.host.filesystem.write_text_file( MOCK_WEB_TESTS + 'platform/foo/TestExpectations', '') port.host.filesystem.write_text_file( @@ -537,6 +537,9 @@ def test_flag_specific_expectations(self): port = self.make_port(port_name='foo') + port.host.filesystem.remove(MOCK_WEB_TESTS + 'TestExpectations') + port.host.filesystem.remove(MOCK_WEB_TESTS + 'NeverFixTests') + port.host.filesystem.remove(MOCK_WEB_TESTS + 'SlowTests') port.host.filesystem.write_text_file( MOCK_WEB_TESTS + 'FlagExpectations/special-flag-a', 'aa') port.host.filesystem.write_text_file( @@ -735,7 +738,7 @@ port.set_option_default('manifest_update', False) filesystem = port.host.filesystem filesystem.write_text_file( - WEB_TEST_DIR + '/external/wpt/MANIFEST.json', '{}') + MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json', '{}') filesystem.clear_written_files() port.wpt_manifest('external/wpt') @@ -936,19 +939,19 @@ self.assertFalse(port.is_non_wpt_test_file('', 'notref-foo.xhr')) self.assertFalse( - port.is_non_wpt_test_file(WEB_TEST_DIR + '/external/wpt/common', + port.is_non_wpt_test_file(MOCK_WEB_TESTS + 'external/wpt/common', 'blank.html')) self.assertFalse( - port.is_non_wpt_test_file(WEB_TEST_DIR + '/external/wpt/console', + port.is_non_wpt_test_file(MOCK_WEB_TESTS + 'external/wpt/console', 'console-is-a-namespace.any.js')) self.assertFalse( - port.is_non_wpt_test_file(WEB_TEST_DIR + '/external/wpt', + port.is_non_wpt_test_file(MOCK_WEB_TESTS + 'external/wpt', 'testharness_runner.html')) self.assertTrue( port.is_non_wpt_test_file( - WEB_TEST_DIR + '/external/wpt_automation', 'foo.html')) + MOCK_WEB_TESTS + '/external/wpt_automation', 'foo.html')) self.assertFalse( - port.is_non_wpt_test_file(WEB_TEST_DIR + '/wpt_internal/console', + port.is_non_wpt_test_file(MOCK_WEB_TESTS + 'wpt_internal/console', 'console-is-a-namespace.any.js')) def test_is_wpt_test(self): @@ -1141,17 +1144,17 @@ def test_reference_files(self): port = self.make_port(with_tests=True) - self.assertEqual( - port.reference_files('passes/svgreftest.svg'), - [('==', port.web_tests_dir() + '/platform/generic/passes/svgreftest-expected.svg')]) + self.assertEqual(port.reference_files('passes/svgreftest.svg'), + [('==', port.web_tests_dir() + + 'platform/generic/passes/svgreftest-expected.svg')]) self.assertEqual( port.reference_files('passes/xhtreftest.svg'), - [('==', port.web_tests_dir() + '/platform/generic/passes/xhtreftest-expected.html') - ]) + [('==', port.web_tests_dir() + + 'platform/generic/passes/xhtreftest-expected.html')]) self.assertEqual( port.reference_files('passes/phpreftest.php'), [('!=', port.web_tests_dir() + - '/platform/generic/passes/phpreftest-expected-mismatch.svg')]) + 'platform/generic/passes/phpreftest-expected-mismatch.svg')]) def test_reference_files_from_manifest(self): port = self.make_port(with_tests=True) @@ -1162,7 +1165,7 @@ 'external/wpt/html/dom/elements/global-attributes/dir_auto-EN-L.html' ), [('==', port.web_tests_dir() + - '/external/wpt/html/dom/elements/global-attributes/dir_auto-EN-L-ref.html' + 'external/wpt/html/dom/elements/global-attributes/dir_auto-EN-L-ref.html' )]) self.assertEqual( port.reference_files( @@ -1170,7 +1173,7 @@ 'external/wpt/html/dom/elements/global-attributes/dir_auto-EN-L.html' ), [('==', port.web_tests_dir() + - '/external/wpt/html/dom/elements/global-attributes/dir_auto-EN-L-ref.html' + 'external/wpt/html/dom/elements/global-attributes/dir_auto-EN-L-ref.html' )]) def test_http_server_supports_ipv6(self):
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 8978598..9f19451 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/test.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/test.py
@@ -39,11 +39,9 @@ from blinkpy.web_tests.port.driver import DeviceFailure, Driver, DriverOutput from blinkpy.w3c.wpt_manifest import BASE_MANIFEST_NAME -# Here we use a non-standard location for the web tests, to ensure that -# this works. The path contains a '.' in the name because we've seen bugs -# related to this before. -WEB_TEST_DIR = '/test.checkout/wtests' -PERF_TEST_DIR = '/test.checkout/PerformanceTests' +MOCK_ROOT = '/mock-checkout/' +MOCK_WEB_TESTS = MOCK_ROOT + 'third_party/blink/web_tests/' +PERF_TEST_DIR = MOCK_ROOT + 'PerformanceTests' # This sets basic expectations for a test. Each individual expectation @@ -432,10 +430,10 @@ # we don't need a real filesystem to run the tests. def add_unit_tests_to_mock_filesystem(filesystem): # Add the test_expectations file. - filesystem.maybe_make_directory(WEB_TEST_DIR) - if not filesystem.exists(WEB_TEST_DIR + '/TestExpectations'): + filesystem.maybe_make_directory(MOCK_WEB_TESTS) + if not filesystem.exists(MOCK_WEB_TESTS + 'TestExpectations'): filesystem.write_text_file( - WEB_TEST_DIR + '/TestExpectations', """ + MOCK_WEB_TESTS + 'TestExpectations', """ # results: [ Pass Failure Crash Timeout Skip ] failures/expected/audio.html [ Failure ] failures/expected/crash.html [ Crash ] @@ -461,9 +459,9 @@ virtual/skipped/failures/expected* [ Skip ] """) - if not filesystem.exists(WEB_TEST_DIR + '/NeverFixTests'): + if not filesystem.exists(MOCK_WEB_TESTS + 'NeverFixTests'): filesystem.write_text_file( - WEB_TEST_DIR + '/NeverFixTests', """ + MOCK_WEB_TESTS + 'NeverFixTests', """ # results: [ Pass Failure Crash Timeout Skip ] failures/expected/keyboard.html [ Skip ] failures/expected/exception.html [ Skip ] @@ -473,9 +471,9 @@ virtual/virtual_failures/failures/expected/device_failure.html [ Skip ] """) - if not filesystem.exists(WEB_TEST_DIR + '/SlowTests'): + if not filesystem.exists(MOCK_WEB_TESTS + 'SlowTests'): filesystem.write_text_file( - WEB_TEST_DIR + '/SlowTests', """ + MOCK_WEB_TESTS + 'SlowTests', """ # results: [ Slow ] passes/slow.html [ Slow ] """) @@ -483,10 +481,10 @@ # FIXME: This test was only being ignored because of missing a leading '/'. # Fixing the typo causes several tests to assert, so disabling the test entirely. # Add in a file should be ignored by port.find_test_files(). - #files[WEB_TEST_DIR + '/userscripts/resources/iframe.html'] = 'iframe' + #files[MOCK_WEB_TESTS + 'userscripts/resources/iframe.html'] = 'iframe' def add_file(test, suffix, contents): - dirname = filesystem.join(WEB_TEST_DIR, + dirname = filesystem.join(MOCK_WEB_TESTS, test.name[0:test.name.rfind('/')]) base = test.base filesystem.maybe_make_directory(dirname) @@ -494,9 +492,7 @@ filesystem.join(dirname, base + suffix), contents) def add_baseline(test, suffix, contents): - dirname = filesystem.join(WEB_TEST_DIR, - "platform", - "generic", + dirname = filesystem.join(MOCK_WEB_TESTS, "platform", "generic", test.name[0:test.name.rfind('/')]) base = test.base filesystem.maybe_make_directory(dirname) @@ -515,16 +511,16 @@ add_baseline(test, '-expected.png', test.expected_image) filesystem.write_text_file( - filesystem.join(WEB_TEST_DIR, 'platform', 'generic', - 'virtual', 'virtual_passes', 'passes', - 'args-expected.txt'), 'args-txt --virtual-arg') + filesystem.join(MOCK_WEB_TESTS, 'platform', 'generic', 'virtual', + 'virtual_passes', 'passes', 'args-expected.txt'), + 'args-txt --virtual-arg') filesystem.maybe_make_directory( - filesystem.join(WEB_TEST_DIR, 'virtual', 'virtual_passes')) + filesystem.join(MOCK_WEB_TESTS, 'virtual', 'virtual_passes')) filesystem.maybe_make_directory( - filesystem.join(WEB_TEST_DIR, 'external', 'wpt')) + filesystem.join(MOCK_WEB_TESTS, 'external', 'wpt')) filesystem.write_text_file( - filesystem.join(WEB_TEST_DIR, 'external', BASE_MANIFEST_NAME), + filesystem.join(MOCK_WEB_TESTS, 'external', BASE_MANIFEST_NAME), '{"manifest": "base"}') # Clear the list of written files so that we can watch what happens during testing. @@ -536,7 +532,7 @@ port.set_option_default('manifest_update', False) filesystem = port.host.filesystem filesystem.write_text_file( - WEB_TEST_DIR + '/external/wpt/MANIFEST.json', + MOCK_WEB_TESTS + 'external/wpt/MANIFEST.json', json.dumps({ 'items': { 'testharness': { @@ -605,18 +601,18 @@ } })) filesystem.write_text_file( - WEB_TEST_DIR + '/external/wpt/dom/ranges/Range-attributes.html', '') + MOCK_WEB_TESTS + 'external/wpt/dom/ranges/Range-attributes.html', '') filesystem.write_text_file( - WEB_TEST_DIR + '/external/wpt/dom/ranges/Range-attributes-slow.html', + MOCK_WEB_TESTS + 'external/wpt/dom/ranges/Range-attributes-slow.html', '') filesystem.write_text_file( - WEB_TEST_DIR + '/external/wpt/console/console-is-a-namespace.any.js', + MOCK_WEB_TESTS + 'external/wpt/console/console-is-a-namespace.any.js', '') filesystem.write_text_file( - WEB_TEST_DIR + '/external/wpt/common/blank.html', 'foo') + MOCK_WEB_TESTS + 'external/wpt/common/blank.html', 'foo') filesystem.write_text_file( - WEB_TEST_DIR + '/wpt_internal/MANIFEST.json', + MOCK_WEB_TESTS + 'wpt_internal/MANIFEST.json', json.dumps({ 'items': { 'testharness': { @@ -626,7 +622,7 @@ } } })) - filesystem.write_text_file(WEB_TEST_DIR + '/wpt_internal/dom/bar.html', + filesystem.write_text_file(MOCK_WEB_TESTS + 'wpt_internal/dom/bar.html', 'baz') @@ -665,7 +661,7 @@ # test ports. rebaseline_unittest.py needs to not mix both "real" ports # and "test" ports - self._generic_expectations_path = WEB_TEST_DIR + '/TestExpectations' + self._generic_expectations_path = MOCK_WEB_TESTS + 'TestExpectations' self._results_directory = None self._operating_system = 'mac' @@ -765,7 +761,7 @@ return (None, None, None) def web_tests_dir(self): - return WEB_TEST_DIR + return MOCK_WEB_TESTS def _perf_tests_dir(self): return PERF_TEST_DIR
diff --git a/third_party/blink/tools/blinkpy/web_tests/run_web_tests_unittest.py b/third_party/blink/tools/blinkpy/web_tests/run_web_tests_unittest.py index 25a1d73..c731db2f 100644 --- a/third_party/blink/tools/blinkpy/web_tests/run_web_tests_unittest.py +++ b/third_party/blink/tools/blinkpy/web_tests/run_web_tests_unittest.py
@@ -1175,7 +1175,7 @@ def test_smoke_test(self): host = MockHost() - smoke_test_filename = test.WEB_TEST_DIR + '/SmokeTests' + smoke_test_filename = test.MOCK_WEB_TESTS + 'SmokeTests' host.filesystem.write_text_file(smoke_test_filename, 'passes/text.html\n') @@ -1215,7 +1215,7 @@ def test_smoke_test_default_retry(self): host = MockHost() - smoke_test_filename = test.WEB_TEST_DIR + '/SmokeTests' + smoke_test_filename = test.MOCK_WEB_TESTS + 'SmokeTests' host.filesystem.write_text_file( smoke_test_filename, 'failures/unexpected/text-image-checksum.html\n') @@ -1996,7 +1996,7 @@ test_name = 'failures/unexpected/reftest.html' host = MockHost() host.filesystem.write_text_file( - test.WEB_TEST_DIR + '/failures/unexpected/reftest-expected.txt', + test.MOCK_WEB_TESTS + 'failures/unexpected/reftest-expected.txt', 'mismatch') run_details, _, _ = logging_run([test_name], tests_included=True, @@ -2010,9 +2010,9 @@ def test_extra_baselines(self): host = MockHost() - extra_txt = test.WEB_TEST_DIR + '/passes/image-expected.txt' + extra_txt = test.MOCK_WEB_TESTS + 'passes/image-expected.txt' host.filesystem.write_text_file(extra_txt, 'Extra txt') - extra_wav = test.WEB_TEST_DIR + '/passes/image-expected.wav' + extra_wav = test.MOCK_WEB_TESTS + 'passes/image-expected.wav' host.filesystem.write_text_file(extra_wav, 'Extra wav') test_name = 'passes/image.html' run_details, log_stream, _ = logging_run([test_name], @@ -2034,9 +2034,9 @@ def test_empty_overriding_baselines(self): host = MockHost() - base_baseline = test.WEB_TEST_DIR + '/passes/image-expected.txt' + base_baseline = test.MOCK_WEB_TESTS + 'passes/image-expected.txt' host.filesystem.write_text_file(base_baseline, 'Non-empty') - platform_baseline = test.WEB_TEST_DIR + '/platform/test-mac-mac10.10/passes/image-expected.txt' + platform_baseline = test.MOCK_WEB_TESTS + 'platform/test-mac-mac10.10/passes/image-expected.txt' host.filesystem.write_text_file(platform_baseline, '') test_name = 'passes/image.html' run_details, log_stream, _ = logging_run([test_name], @@ -2051,9 +2051,9 @@ def test_reftest_extra_baselines(self): host = MockHost() - extra_png = test.WEB_TEST_DIR + '/passes/reftest-expected.png' + extra_png = test.MOCK_WEB_TESTS + 'passes/reftest-expected.png' host.filesystem.write_text_file(extra_png, 'Extra png') - extra_wav = test.WEB_TEST_DIR + '/passes/reftest-expected.wav' + extra_wav = test.MOCK_WEB_TESTS + 'passes/reftest-expected.wav' host.filesystem.write_text_file(extra_wav, 'Extra wav') test_name = 'passes/reftest.html' run_details, log_stream, _ = logging_run([test_name], @@ -2073,9 +2073,9 @@ def test_reftest_with_text_extra_baselines(self): host = MockHost() - extra_png = test.WEB_TEST_DIR + '/passes/reftest-with-text-expected.png' + extra_png = test.MOCK_WEB_TESTS + 'passes/reftest-with-text-expected.png' host.filesystem.write_text_file(extra_png, 'Extra png') - extra_wav = test.WEB_TEST_DIR + '/passes/reftest-with-text-expected.wav' + extra_wav = test.MOCK_WEB_TESTS + 'passes/reftest-with-text-expected.wav' host.filesystem.write_text_file(extra_wav, 'Extra wav') test_name = 'passes/reftest-with-text.html' run_details, log_stream, _ = logging_run([test_name], @@ -2095,7 +2095,7 @@ def test_reftest_extra_png_baseline(self): host = MockHost() - extra_png = test.WEB_TEST_DIR + '/passes/reftest-expected.png' + extra_png = test.MOCK_WEB_TESTS + 'passes/reftest-expected.png' host.filesystem.write_text_file(extra_png, 'Extra png') test_name = 'passes/reftest.html' run_details, log_stream, _ = logging_run([test_name], @@ -2107,14 +2107,14 @@ def test_passing_testharness_extra_baselines(self): host = MockHost() - extra_png = test.WEB_TEST_DIR + '/passes/testharness-expected.png' + extra_png = test.MOCK_WEB_TESTS + 'passes/testharness-expected.png' host.filesystem.write_text_file(extra_png, 'Extra png') - extra_txt = test.WEB_TEST_DIR + '/passes/testharness-expected.txt' + extra_txt = test.MOCK_WEB_TESTS + 'passes/testharness-expected.txt' host.filesystem.write_text_file( extra_txt, 'This is a testharness.js-based test.\nPASS: bah\nHarness: the test ran to completion.' ) - extra_wav = test.WEB_TEST_DIR + '/passes/testharness-expected.wav' + extra_wav = test.MOCK_WEB_TESTS + 'passes/testharness-expected.wav' host.filesystem.write_text_file(extra_wav, 'Extra wav') test_name = 'passes/testharness.html' run_details, log_stream, _ = logging_run([test_name], @@ -2139,7 +2139,7 @@ def test_passing_testharness_extra_txt_baseline(self): host = MockHost() - extra_txt = test.WEB_TEST_DIR + '/passes/testharness-expected.txt' + extra_txt = test.MOCK_WEB_TESTS + 'passes/testharness-expected.txt' host.filesystem.write_text_file( extra_txt, 'This is a testharness.js-based test.\nPASS: bah\nHarness: the test ran to completion.' @@ -2154,7 +2154,7 @@ def test_passing_testharness_extra_mismatching_txt_baseline(self): host = MockHost() - extra_txt = test.WEB_TEST_DIR + '/passes/testharness-expected.txt' + extra_txt = test.MOCK_WEB_TESTS + 'passes/testharness-expected.txt' host.filesystem.write_text_file( extra_txt, 'This is a testharness.js-based test.\nFAIL: bah\nHarness: the test ran to completion.' @@ -2177,9 +2177,9 @@ # An all-pass testharness text baseline is necessary when it overrides a fallback baseline. host = MockHost() # The base baseline expects a failure. - base_baseline = test.WEB_TEST_DIR + '/passes/testharness-expected.txt' + base_baseline = test.MOCK_WEB_TESTS + 'passes/testharness-expected.txt' host.filesystem.write_text_file(base_baseline, 'Failure') - platform_baseline = test.WEB_TEST_DIR + '/platform/test-mac-mac10.10/passes/testharness-expected.txt' + platform_baseline = test.MOCK_WEB_TESTS + 'platform/test-mac-mac10.10/passes/testharness-expected.txt' host.filesystem.write_text_file( platform_baseline, 'This is a testharness.js-based test.\nPASS: bah\nHarness: the test ran to completion.' @@ -2193,8 +2193,8 @@ def test_testharness_expected_txt(self): host = MockHost() test_name = '/failures/unexpected/testharness.html' - expected_txt = (test.WEB_TEST_DIR + - '/failures/unexpected/testharness-expected.txt') + expected_txt = (test.MOCK_WEB_TESTS + + 'failures/unexpected/testharness-expected.txt') # The expected.txt contains the same content as the actual output. host.filesystem.write_text_file( expected_txt, 'This is a testharness.js-based test.\nFAIL: bah\n' @@ -2393,20 +2393,20 @@ """ for ext in expected_extensions: baseline = '%s-expected%s' % (expected_file_base, ext) - baseline_full_path = '%s/%s' % (test.WEB_TEST_DIR, baseline) + baseline_full_path = test.MOCK_WEB_TESTS + baseline self.assertIsNotNone(written_files.get(baseline_full_path)) baseline_message = 'Writing new baseline "%s"\n' % baseline self.assert_contains(log_stream, baseline_message) # Assert that baselines with other extensions were not written. for ext in ({'.png', '.txt', '.wav'} - set(expected_extensions)): baseline = '%s-expected%s' % (expected_file_base, ext) - baseline_full_path = '%s/%s' % (test.WEB_TEST_DIR, baseline) + baseline_full_path = test.MOCK_WEB_TESTS + baseline self.assertIsNone(written_files.get(baseline_full_path)) def assert_wpt_manifests_not_written(self, host, written_files): - external_manifest = host.filesystem.join(test.WEB_TEST_DIR, + external_manifest = host.filesystem.join(test.MOCK_WEB_TESTS, 'external/wpt', MANIFEST_NAME) - internal_manifest = host.filesystem.join(test.WEB_TEST_DIR, + internal_manifest = host.filesystem.join(test.MOCK_WEB_TESTS, 'wpt_internal', MANIFEST_NAME) self.assertNotIn(external_manifest, written_files) self.assertNotIn(internal_manifest, written_files) @@ -2496,8 +2496,9 @@ # Tests that we update existing baseline for a testharness test. host = MockHost() host.filesystem.write_text_file( - test.WEB_TEST_DIR + - '/platform/generic/failures/unexpected/testharness-expected.txt', 'foo') + test.MOCK_WEB_TESTS + + 'platform/generic/failures/unexpected/testharness-expected.txt', + 'foo') details, log_stream, _ = logging_run( ['--reset-results', 'failures/unexpected/testharness.html'], tests_included=True, @@ -2528,8 +2529,8 @@ # if the new baseline is different from the fallback baseline. host = MockHost() host.filesystem.write_text_file( - test.WEB_TEST_DIR + - '/platform/generic/failures/unexpected/text-image-checksum-expected.txt', + test.MOCK_WEB_TESTS + + 'platform/generic/failures/unexpected/text-image-checksum-expected.txt', # This value is the same as actual text result of the test defined # in blinkpy.web_tests.port.test. This is added so that we also # check that the text baseline isn't written if it matches. @@ -2556,8 +2557,8 @@ # if the new baseline is different from the fallback baseline. host = MockHost() host.filesystem.write_text_file( - test.WEB_TEST_DIR + - '/platform/generic/failures/unexpected/text-image-checksum-expected.txt', + test.MOCK_WEB_TESTS + + 'platform/generic/failures/unexpected/text-image-checksum-expected.txt', # This value is the same as actual text result of the test defined # in blinkpy.web_tests.port.test. This is added so that we also # check that the text baseline isn't written if it matches. @@ -2615,9 +2616,9 @@ def test_reset_results_remove_extra_baselines(self): host = MockHost() - extra_txt = test.WEB_TEST_DIR + '/platform/generic/failures/unexpected/image-only-expected.txt' + extra_txt = test.MOCK_WEB_TESTS + 'platform/generic/failures/unexpected/image-only-expected.txt' host.filesystem.write_text_file(extra_txt, 'Extra txt') - extra_wav = test.WEB_TEST_DIR + '/platform/generic/failures/unexpected/image-only-expected.wav' + extra_wav = test.MOCK_WEB_TESTS + 'platform/generic/failures/unexpected/image-only-expected.wav' host.filesystem.write_text_file(extra_wav, 'Extra wav') details, log_stream, _ = logging_run( ['--reset-results', 'failures/unexpected/image-only.html'], @@ -2636,11 +2637,11 @@ def test_reset_results_reftest_remove_extra_baselines(self): host = MockHost() - extra_png = test.WEB_TEST_DIR + '/platform/generic/passes/reftest-expected.png' + extra_png = test.MOCK_WEB_TESTS + 'platform/generic/passes/reftest-expected.png' host.filesystem.write_text_file(extra_png, 'Extra png') - extra_wav = test.WEB_TEST_DIR + '/platform/generic/passes/reftest-expected.wav' + extra_wav = test.MOCK_WEB_TESTS + 'platform/generic/passes/reftest-expected.wav' host.filesystem.write_text_file(extra_wav, 'Extra wav') - extra_txt = test.WEB_TEST_DIR + '/platform/generic/passes/reftest-expected.txt' + extra_txt = test.MOCK_WEB_TESTS + 'platform/generic/passes/reftest-expected.txt' host.filesystem.write_text_file(extra_txt, 'reftest') details, _, _ = logging_run(['--reset-results', 'passes/reftest.html'], tests_included=True, @@ -2654,9 +2655,9 @@ def test_reset_results_reftest_with_text_remove_extra_baselines(self): host = MockHost() - extra_png = test.WEB_TEST_DIR + '/platform/generic/passes/reftest-with-text-expected.png' + extra_png = test.MOCK_WEB_TESTS + 'platform/generic/passes/reftest-with-text-expected.png' host.filesystem.write_text_file(extra_png, 'Extra png') - extra_wav = test.WEB_TEST_DIR + '/platform/generic/passes/reftest-with-text-expected.wav' + extra_wav = test.MOCK_WEB_TESTS + 'platform/generic/passes/reftest-with-text-expected.wav' host.filesystem.write_text_file(extra_wav, 'Extra wav') details, _, _ = logging_run( ['--reset-results', 'passes/reftest-with-text.html'], @@ -2668,14 +2669,15 @@ self.assertIsNone(written_files[extra_png]) self.assertIsNone(written_files[extra_wav]) self.assertNotIn( - test.WEB_TEST_DIR + '/platform/generic/passes/reftest-with-text-expected.txt', + test.MOCK_WEB_TESTS + + 'platform/generic/passes/reftest-with-text-expected.txt', written_files) def test_reset_results_passing_testharness_remove_extra_baselines(self): host = MockHost() - extra_png = test.WEB_TEST_DIR + '/platform/generic/passes/testharness-expected.png' + extra_png = test.MOCK_WEB_TESTS + 'platform/generic/passes/testharness-expected.png' host.filesystem.write_text_file(extra_png, 'Extra png') - extra_txt = test.WEB_TEST_DIR + '/platform/generic/passes/testharness-expected.txt' + extra_txt = test.MOCK_WEB_TESTS + 'platform/generic/passes/testharness-expected.txt' host.filesystem.write_text_file(extra_txt, 'Extra txt') details, log_stream, _ = logging_run( ['--reset-results', 'passes/testharness.html'], @@ -2712,14 +2714,14 @@ # results are different from the current baselines. host = MockHost() host.filesystem.write_text_file( - test.WEB_TEST_DIR + - '/platform/generic/failures/unexpected/text-image-checksum-expected.txt', + test.MOCK_WEB_TESTS + + 'platform/generic/failures/unexpected/text-image-checksum-expected.txt', # This value is the same as actual text result of the test defined # in blinkpy.web_tests.port.test. This is added so that we also # check that the text baseline isn't written if it matches. 'text-image-checksum_fail-txt') host.filesystem.write_text_file( - test.WEB_TEST_DIR + '/FlagSpecificConfig', + test.MOCK_WEB_TESTS + 'FlagSpecificConfig', '[{"name": "flag", "args": ["--flag-arg"]}]') details, log_stream, _ = logging_run([ '--flag-specific=flag', '--reset-results', @@ -2742,14 +2744,14 @@ # results are different from the current baselines. host = MockHost() host.filesystem.write_text_file( - test.WEB_TEST_DIR + - '/platform/generic/failures/unexpected/text-image-checksum-expected.txt', + test.MOCK_WEB_TESTS + + 'platform/generic/failures/unexpected/text-image-checksum-expected.txt', # This value is the same as actual text result of the test defined # in blinkpy.web_tests.port.test. This is added so that we also # check that the text baseline isn't written if it matches. 'text-image-checksum_fail-txt') host.filesystem.write_text_file( - test.WEB_TEST_DIR + '/FlagSpecificConfig', + test.MOCK_WEB_TESTS + 'FlagSpecificConfig', '[{"name": "flag", "args": ["--flag-arg"]}]') details, log_stream, _ = logging_run([ '--flag-specific=flag', '--copy-baselines', @@ -2774,19 +2776,19 @@ # actual results are the same as the fallback baselines. host = MockHost() host.filesystem.write_text_file( - test.WEB_TEST_DIR + - '/platform/generic/failures/unexpected/text-image-checksum-expected.txt', + test.MOCK_WEB_TESTS + + 'platform/generic/failures/unexpected/text-image-checksum-expected.txt', # This value is the same as actual text result of the test defined # in blinkpy.web_tests.port.test. This is added so that we check # that the flag-specific text baseline is removed if the actual # result is the same as this fallback baseline. 'text-image-checksum_fail-txt') host.filesystem.write_text_file( - test.WEB_TEST_DIR + '/FlagSpecificConfig', + test.MOCK_WEB_TESTS + 'FlagSpecificConfig', '[{"name": "flag", "args": ["--flag-arg"]}]') flag_specific_baseline_txt = ( - test.WEB_TEST_DIR + - '/flag-specific/flag/failures/unexpected/text-image-checksum-expected.txt' + test.MOCK_WEB_TESTS + + 'flag-specific/flag/failures/unexpected/text-image-checksum-expected.txt' ) host.filesystem.write_text_file( flag_specific_baseline_txt, @@ -2814,8 +2816,8 @@ # results are different from the current baselines. host = MockHost() host.filesystem.write_text_file( - test.WEB_TEST_DIR + - '/platform/generic/failures/unexpected/text-image-checksum-expected.txt', + test.MOCK_WEB_TESTS + + 'platform/generic/failures/unexpected/text-image-checksum-expected.txt', # This value is the same as actual text result of the test defined # in blinkpy.web_tests.port.test. This is added so that we also # check that the text baseline isn't written if it matches. @@ -2842,8 +2844,8 @@ # baseline (which should not matter). host = MockHost() host.filesystem.write_text_file( - test.WEB_TEST_DIR + - '/platform/test-mac-mac10.10/failures/unexpected/text-image-checksum-expected.png', + test.MOCK_WEB_TESTS + + 'platform/test-mac-mac10.10/failures/unexpected/text-image-checksum-expected.png', 'wrong-png-baseline') details, log_stream, _ = logging_run([ @@ -2867,12 +2869,13 @@ # baseline (which should not matter). host = MockHost() host.filesystem.write_text_file( - test.WEB_TEST_DIR + - '/platform/test-mac-mac10.10/failures/unexpected/text-image-checksum-expected.png', + test.MOCK_WEB_TESTS + + 'platform/test-mac-mac10.10/failures/unexpected/text-image-checksum-expected.png', 'wrong-png-baseline') host.filesystem.remove( - test.WEB_TEST_DIR + - '/platform/generic/failures/unexpected/text-image-checksum-expected.png') + test.MOCK_WEB_TESTS + + 'platform/generic/failures/unexpected/text-image-checksum-expected.png' + ) details, log_stream, _ = logging_run([ '--reset-results', 'failures/unexpected/text-image-checksum.html' @@ -2894,16 +2897,16 @@ # actual results are the same as the fallback baselines. host = MockHost() host.filesystem.write_text_file( - test.WEB_TEST_DIR + - '/platform/generic/failures/unexpected/text-image-checksum-expected.txt', + test.MOCK_WEB_TESTS + + 'platform/generic/failures/unexpected/text-image-checksum-expected.txt', # This value is the same as actual text result of the test defined # in blinkpy.web_tests.port.test. This is added so that we check # that the flag-specific text baseline is removed if the actual # result is the same as this fallback baseline. 'text-image-checksum_fail-txt') virtual_baseline_txt = ( - test.WEB_TEST_DIR + - '/platform/generic/virtual/virtual_failures/failures/unexpected/text-image-checksum-expected.txt' + test.MOCK_WEB_TESTS + + 'platform/generic/virtual/virtual_failures/failures/unexpected/text-image-checksum-expected.txt' ) host.filesystem.write_text_file( virtual_baseline_txt, 'existing-baseline-different-from-fallback')
diff --git a/third_party/blink/tools/blinkpy/web_tests/update_expectations_unittest.py b/third_party/blink/tools/blinkpy/web_tests/update_expectations_unittest.py index d08073d..71a6faa 100644 --- a/third_party/blink/tools/blinkpy/web_tests/update_expectations_unittest.py +++ b/third_party/blink/tools/blinkpy/web_tests/update_expectations_unittest.py
@@ -12,7 +12,7 @@ from blinkpy.web_tests.update_expectations import ExpectationsRemover from blinkpy.web_tests.builder_list import BuilderList from blinkpy.web_tests.port.factory import PortFactory -from blinkpy.web_tests.port.test import WEB_TEST_DIR +from blinkpy.web_tests.port.test import MOCK_WEB_TESTS from blinkpy.web_tests.update_expectations import main from blinkpy.tool.commands.flaky_tests import FlakyTests @@ -108,7 +108,7 @@ 'test/e.html', 'test/f.html', 'test/g.html' ] for test in test_list: - path = filesystem.join(WEB_TEST_DIR, test) + path = filesystem.join(MOCK_WEB_TESTS, test) filesystem.write_binary_file(path, '') def _create_expectations_remover(self,
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 2254887d..cb38a9c 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -6760,7 +6760,6 @@ # Sheriff 2022-04-01 crbug.com/1312266 [ Mac10.13 ] external/wpt/preload/preload-time-to-fetch.https.html [ Failure ] -crbug.com/1312484 [ Mac11 ] external/wpt/navigation-api/ordering-and-transition/navigate-cross-document-double.html [ Skip ] # Sheriff 2022-04-05 crbug.com/1203491 [ Linux ] fast/events/touch/gesture/touch-gesture-scroll-listbox.html [ Failure Pass ] @@ -7041,7 +7040,6 @@ # Sheriff 2022-07-21 crbug.com/1346158 crbug.com/1346158 external/wpt/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-window.html [ Failure Pass ] -crbug.com/1310202 [ Mac11 ] wpt_internal/navigation-api/ordering-and-transition/navigate-cross-document-double.html [ Failure Pass ] # Sheriff 2022-07-25 crbug.com/1346822 [ Mac10.15 ] virtual/off-main-thread-css-paint/external/wpt/css/css-paint-api/geometry-background-image-002.https.html [ Failure Pass ] @@ -7064,14 +7062,11 @@ # Failure on all platforms was added before, see crbug.com/1306770 crbug.com/1348118 http/tests/inspector-protocol/network/interception-download.js [ Failure Pass Timeout ] crbug.com/1348118 [ Linux ] virtual/first-party-sets/http/tests/inspector-protocol/network/interception-download.js [ Pass Timeout ] -# See crbug.com/1310202 for Failure -crbug.com/1348118 [ Linux ] wpt_internal/navigation-api/ordering-and-transition/navigate-cross-document-double.html [ Failure Pass Timeout ] # See crbug.com/1344277 for Crash and Failure crbug.com/1348118 [ Linux ] wpt_internal/webxr/ar/ar_light_estimation.https.html [ Crash Failure Pass Timeout ] crbug.com/1348275 [ Mac12-arm64 ] virtual/scroll-unification/fast/scrolling/inertial-scrolling-with-pointer-events-none-overlay.html [ Failure Pass ] # Sheriff 2022-07-29 - Flaky failure. -crbug.com/1348118 [ Mac11-arm64 ] wpt_internal/navigation-api/ordering-and-transition/navigate-cross-document-double.html [ Failure Pass Timeout ] crbug.com/1347675 virtual/fenced-frame-mparch/wpt_internal/fenced_frame/fragment-navigation.https.html [ Pass Timeout ] # Sheriff 2022-08-01 @@ -7089,7 +7084,6 @@ crbug.com/1350337 [ Linux ] external/wpt/web-locks/query-ordering.tentative.https.html [ Failure Pass ] crbug.com/1350341 [ Linux ] virtual/threaded-no-composited-antialiasing/animations/direction-and-fill/fill-mode-missing-from-to-keyframes.html [ Failure Pass ] - # These seem to consistently fail with disabling code cache. crbug.com/1351903 http/tests/devtools/network/font-face.js [ Failure Pass ] crbug.com/1351903 virtual/disable-frequency-capping-for-overlay-popup-detection/http/tests/subresource_filter/overlay_popup_ad/overlay-popup-ad-fixed-position.html [ Failure Pass ] @@ -7102,3 +7096,10 @@ # Most likely a forced style/layout update from accessibiity while we are # render blocking, which should not happen. crbug.com/1351811 external/wpt/css/css-transitions/no-transition-from-ua-to-blocking-stylesheet.html [ Pass Failure ] + +# Flakes on all platforms. +crbug.com/1352209 wpt_internal/navigation-api/ordering-and-transition/navigate-cross-document-double.html [ Failure Pass ] + +# Sheriff 2022-08-12 +crbug.com/1350611 [ Mac10.15 ] external/wpt/html/browsers/browsing-the-web/remote-context-helper-tests/navigation-same-document.window.html [ Failure Pass ] +crbug.com/1352248 [ Mac10.15 ] virtual/disable-frequency-capping-for-overlay-popup-detection/http/tests/subresource_filter/overlay_popup_ad/overlay-popup-non-ad-followed-by-ad.html [ Failure Pass ]
diff --git a/third_party/blink/web_tests/external/wpt/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.broken.html b/third_party/blink/web_tests/external/wpt/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.broken.html index 017048c..4b22ffc 100644 --- a/third_party/blink/web_tests/external/wpt/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.broken.html +++ b/third_party/blink/web_tests/external/wpt/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.broken.html
@@ -22,8 +22,7 @@ ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); var img = document.getElementById('broken.png'); -ctx.drawImage(img, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2); +assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(img, 0, 0); }); });
diff --git a/third_party/blink/web_tests/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.broken.html b/third_party/blink/web_tests/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.broken.html index 8eafcad..9f1bb2d 100644 --- a/third_party/blink/web_tests/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.broken.html +++ b/third_party/blink/web_tests/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.broken.html
@@ -20,7 +20,7 @@ _addTest(function(canvas, ctx) { var img = document.getElementById('broken.png'); -_assertSame(ctx.createPattern(img, 'repeat'), null, "ctx.createPattern(img, 'repeat')", "null"); +assert_throws_dom("INVALID_STATE_ERR", function() { ctx.createPattern(img, 'repeat'); }); });
diff --git a/third_party/blink/web_tests/external/wpt/html/canvas/element/manual/imagebitmap/createImageBitmap-invalid-args.html b/third_party/blink/web_tests/external/wpt/html/canvas/element/manual/imagebitmap/createImageBitmap-invalid-args.html index 74ca9a85..3cae352 100644 --- a/third_party/blink/web_tests/external/wpt/html/canvas/element/manual/imagebitmap/createImageBitmap-invalid-args.html +++ b/third_party/blink/web_tests/external/wpt/html/canvas/element/manual/imagebitmap/createImageBitmap-invalid-args.html
@@ -209,7 +209,7 @@ }, "createImageBitmap with a broken image source."); promise_test( t => { - return makeAvailableButBrokenImage("/images/broken.png").then(image => { + return makeAvailableButBrokenImage("/images/undecodable.png").then(image => { return promise_rejects_dom(t, "InvalidStateError", createImageBitmap(image)); });
diff --git a/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml-new/drawing-images-to-the-canvas.yaml b/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml-new/drawing-images-to-the-canvas.yaml index 8569ed0..8c6de99 100644 --- a/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml-new/drawing-images-to-the-canvas.yaml +++ b/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml-new/drawing-images-to-the-canvas.yaml
@@ -464,8 +464,7 @@ ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); var img = document.getElementById('broken.png'); - ctx.drawImage(img, 0, 0); - @assert pixel 50,25 ==~ 0,255,0,255; @moz-todo + @assert throws INVALID_STATE_ERR ctx.drawImage(img, 0, 0); expected: green - name: 2d.drawImage.nonexistent
diff --git a/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml/element/fill-and-stroke-styles.yaml b/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml/element/fill-and-stroke-styles.yaml index 88a36119..1650ec49 100644 --- a/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml/element/fill-and-stroke-styles.yaml +++ b/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml/element/fill-and-stroke-styles.yaml
@@ -1487,7 +1487,7 @@ - broken.png code: | var img = document.getElementById('broken.png'); - @assert ctx.createPattern(img, 'repeat') === null; + @assert throws INVALID_STATE_ERR ctx.createPattern(img, 'repeat'); - name: 2d.pattern.image.nonexistent testing:
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/environment-changes/viewport-change.html b/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/environment-changes/viewport-change.html index f6ae657..bf65172b 100644 --- a/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/environment-changes/viewport-change.html +++ b/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/environment-changes/viewport-change.html
@@ -39,7 +39,7 @@ var expected = {wide:resolve(img.dataset.wide), narrow:resolve(img.dataset.narrow)}; var current = iframe.className; var next = current === 'wide' ? 'narrow' : 'wide'; - var expect_change = expected[next].indexOf('broken.png') === -1 && !('noChange' in img.dataset); + var expect_change = expected[next].indexOf('undecodable.png') === -1 && !('noChange' in img.dataset); test(function() { assert_equals(img.currentSrc, expected[current]);
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/interactive-elements/the-summary-element/anchor-without-link.html b/third_party/blink/web_tests/external/wpt/html/semantics/interactive-elements/the-summary-element/anchor-without-link.html new file mode 100644 index 0000000..edaf786 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/semantics/interactive-elements/the-summary-element/anchor-without-link.html
@@ -0,0 +1,40 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>summary element: clicking on anchor without link</title> +<link rel="author" title="Di Zhang" href="mailto:dizhangg@chromium.org"> +<link rel="help" href="https://html.spec.whatwg.org/C/#the-summary-element"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<details id="details"> + <summary><a id="no_inline">Details</a></summary> + <p>Text</p> +</details> + +<details id="details_inline"> + <summary><a><i id="has_inline">Details</i></a></summary> + <p>Text</p> +</details> + + +<script> + +async function testClickingOnAnchorWithoutLink (detailsId, targetId) { + const details = document.getElementById(detailsId); + const target = document.getElementById(targetId); + const initialLoc = location.hash; + + assert_false(details.open); + target.click(); + assert_true(details.open); + assert_equals(location.hash, initialLoc); +} + +promise_test(() => testClickingOnAnchorWithoutLink('details', 'no_inline'), + "clicking on anchor without link should open details and not navigate."); + +promise_test(() => testClickingOnAnchorWithoutLink('details_inline', 'has_inline'), + "clicking on anchor without link, with embedded inline element should open details and not navigate."); + +</script>
diff --git a/third_party/blink/web_tests/external/wpt/images/broken.png b/third_party/blink/web_tests/external/wpt/images/broken.png index f2581017..2ff648a 100644 --- a/third_party/blink/web_tests/external/wpt/images/broken.png +++ b/third_party/blink/web_tests/external/wpt/images/broken.png Binary files differ
diff --git a/third_party/blink/web_tests/external/wpt/images/undecodable.png b/third_party/blink/web_tests/external/wpt/images/undecodable.png new file mode 100644 index 0000000..f2581017 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/images/undecodable.png Binary files differ
diff --git a/third_party/blink/web_tests/external/wpt/serial/serialPort_readable_byob.https.any.js b/third_party/blink/web_tests/external/wpt/serial/serialPort_readable_byob.https.any.js new file mode 100644 index 0000000..8672cf71 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/serial/serialPort_readable_byob.https.any.js
@@ -0,0 +1,65 @@ +// META: script=/resources/test-only-api.js +// META: script=/serial/resources/common.js +// META: script=resources/automation.js + +async function readInto(reader, buffer) { + let offset = 0; + while (offset < buffer.byteLength) { + const {value: view, done} = + await reader.read(new Uint8Array(buffer, offset)); + buffer = view.buffer; + if (done) { + break; + } + offset += view.byteLength; + } + return buffer; +} + +serial_test(async (t, fake) => { + const {port, fakePort} = await getFakeSerialPort(fake); + const bufferSize = 1024; + await port.open({baudRate: 9600, bufferSize}); + + const reader = port.readable.getReader({mode: 'byob'}); + assert_true(reader instanceof ReadableStreamBYOBReader); + + await fakePort.writable(); + const data = new Uint8Array(bufferSize); + for (let i = 0; i < data.byteLength; ++i) + data[i] = i & 0xff; + fakePort.write(data); + + let buffer = new ArrayBuffer(512); + buffer = await readInto(reader, buffer); + assert_equals(512, buffer.byteLength, 'original size retained'); + compareArrays(data.subarray(0, 512), new Uint8Array(buffer)); + + buffer = await readInto(reader, buffer); + assert_equals(512, buffer.byteLength, 'original size retained'); + compareArrays(data.subarray(512), new Uint8Array(buffer)); + reader.releaseLock(); + + await port.close(); +}, 'Can read specific subsets of the available data'); + +serial_test(async (t, fake) => { + const {port, fakePort} = await getFakeSerialPort(fake); + await port.open({baudRate: 9600, bufferSize: 64}); + + const reader = port.readable.getReader({mode: 'byob'}); + assert_true(reader instanceof ReadableStreamBYOBReader); + + await fakePort.writable(); + const data = new Uint8Array(1024); + for (let i = 0; i < data.byteLength; ++i) + data[i] = i & 0xff; + fakePort.write(data); + + let buffer = new ArrayBuffer(1024); + buffer = await readInto(reader, buffer); + compareArrays(data, new Uint8Array(buffer)); + reader.releaseLock(); + + await port.close(); +}, 'Can read a large amount of data over multiple iterations');
diff --git a/third_party/blink/web_tests/external/wpt/serial/serialPort_readable_smallRead.https.any.js b/third_party/blink/web_tests/external/wpt/serial/serialPort_readable_smallRead.https.any.js index b53ea71..b926aa6 100644 --- a/third_party/blink/web_tests/external/wpt/serial/serialPort_readable_smallRead.https.any.js +++ b/third_party/blink/web_tests/external/wpt/serial/serialPort_readable_smallRead.https.any.js
@@ -8,6 +8,7 @@ await port.open({baudRate: 9600, bufferSize: 64}); const reader = port.readable.getReader(); + assert_true(reader instanceof ReadableStreamDefaultReader); await fakePort.writable(); const data = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
diff --git a/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.broken-expected.txt b/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.broken-expected.txt deleted file mode 100644 index 53c7944..0000000 --- a/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.broken-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Canvas test: 2d.pattern.image.broken assert_equals: ctx.createPattern(img, 'repeat') === null (got [object CanvasPattern][object], expected [object]) expected null but got object "[object CanvasPattern]" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.zeroheight-expected.txt b/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.zeroheight-expected.txt deleted file mode 100644 index e4709caf..0000000 --- a/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.zeroheight-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Canvas test: 2d.pattern.image.zeroheight assert_equals: ctx.createPattern(img, 'repeat') === null (got [object CanvasPattern][object], expected [object]) expected null but got object "[object CanvasPattern]" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.zerowidth-expected.txt b/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.zerowidth-expected.txt deleted file mode 100644 index c6d7362..0000000 --- a/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.zerowidth-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Canvas test: 2d.pattern.image.zerowidth assert_equals: ctx.createPattern(img, 'repeat') === null (got [object CanvasPattern][object], expected [object]) expected null but got object "[object CanvasPattern]" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.svgimage.zeroheight-expected.txt b/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.svgimage.zeroheight-expected.txt deleted file mode 100644 index fc1253c..0000000 --- a/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.svgimage.zeroheight-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Canvas test: 2d.pattern.svgimage.zeroheight assert_equals: ctx.createPattern(img, 'repeat') === null (got [object CanvasPattern][object], expected [object]) expected null but got object "[object CanvasPattern]" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.svgimage.zerowidth-expected.txt b/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.svgimage.zerowidth-expected.txt deleted file mode 100644 index ce4531f7..0000000 --- a/third_party/blink/web_tests/platform/generic/external/wpt/html/canvas/element/fill-and-stroke-styles/2d.pattern.svgimage.zerowidth-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Canvas test: 2d.pattern.svgimage.zerowidth assert_equals: ctx.createPattern(img, 'repeat') === null (got [object CanvasPattern][object], expected [object]) expected null but got object "[object CanvasPattern]" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/generic/external/wpt/html/semantics/embedded-content/the-img-element/environment-changes/viewport-change-expected.txt b/third_party/blink/web_tests/platform/generic/external/wpt/html/semantics/embedded-content/the-img-element/environment-changes/viewport-change-expected.txt index bbfce76..47b7441 100644 --- a/third_party/blink/web_tests/platform/generic/external/wpt/html/semantics/embedded-content/the-img-element/environment-changes/viewport-change-expected.txt +++ b/third_party/blink/web_tests/platform/generic/external/wpt/html/semantics/embedded-content/the-img-element/environment-changes/viewport-change-expected.txt
@@ -12,11 +12,11 @@ PASS img (srcset 1 cand) valid image, onload, narrow PASS img (srcset 1 cand) valid image, resize to wide PASS picture: source (max-width:500px) broken image, img broken image, onload, narrow -FAIL picture: source (max-width:500px) broken image, img broken image, resize to wide assert_unreached: Got unexpected load event Reached unreachable code +FAIL picture: source (max-width:500px) broken image, img broken image, resize to wide assert_unreached: Got unexpected error event Reached unreachable code PASS picture: source (max-width:500px) broken image, img valid image, onload, narrow PASS picture: source (max-width:500px) broken image, img valid image, resize to wide PASS picture: source (max-width:500px) valid image, img broken image, onload, narrow -FAIL picture: source (max-width:500px) valid image, img broken image, resize to wide assert_unreached: Got unexpected load event Reached unreachable code +FAIL picture: source (max-width:500px) valid image, img broken image, resize to wide assert_unreached: Got unexpected error event Reached unreachable code PASS picture: source (max-width:500px) valid image, img valid image, onload, narrow PASS picture: source (max-width:500px) valid image, img valid image, resize to wide PASS picture: same URL in source (max-width:500px) and img, onload, narrow @@ -34,9 +34,9 @@ PASS img (srcset 1 cand) valid image, onload, wide PASS img (srcset 1 cand) valid image, resize to narrow PASS picture: source (max-width:500px) broken image, img broken image, onload, wide -FAIL picture: source (max-width:500px) broken image, img broken image, resize to narrow assert_unreached: Got unexpected load event Reached unreachable code +FAIL picture: source (max-width:500px) broken image, img broken image, resize to narrow assert_unreached: Got unexpected error event Reached unreachable code PASS picture: source (max-width:500px) broken image, img valid image, onload, wide -FAIL picture: source (max-width:500px) broken image, img valid image, resize to narrow assert_unreached: Got unexpected load event Reached unreachable code +FAIL picture: source (max-width:500px) broken image, img valid image, resize to narrow assert_unreached: Got unexpected error event Reached unreachable code PASS picture: source (max-width:500px) valid image, img broken image, onload, wide PASS picture: source (max-width:500px) valid image, img broken image, resize to narrow PASS picture: source (max-width:500px) valid image, img valid image, onload, wide
diff --git a/third_party/blink/web_tests/platform/generic/virtual/fenced-frame-shadow-dom/wpt_internal/fenced_frame/attribution-reporting-allow-all.https-expected.txt b/third_party/blink/web_tests/platform/generic/virtual/fenced-frame-shadow-dom/wpt_internal/fenced_frame/attribution-reporting-allow-all.https-expected.txt new file mode 100644 index 0000000..e0c4e23 --- /dev/null +++ b/third_party/blink/web_tests/platform/generic/virtual/fenced-frame-shadow-dom/wpt_internal/fenced_frame/attribution-reporting-allow-all.https-expected.txt
@@ -0,0 +1,6 @@ +This is a testharness.js-based test. +Harness Error. harness_status.status = 1 , harness_status.message = ResizeObserver loop limit exceeded +PASS Same-origin fenced frame loads when attribution policy is * +PASS Cross-origin fenced frame loads when attribution policy is * +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/generic/virtual/fenced-frame-shadow-dom/wpt_internal/fenced_frame/attribution-reporting-allow-none.https-expected.txt b/third_party/blink/web_tests/platform/generic/virtual/fenced-frame-shadow-dom/wpt_internal/fenced_frame/attribution-reporting-allow-none.https-expected.txt new file mode 100644 index 0000000..ddd5c46 --- /dev/null +++ b/third_party/blink/web_tests/platform/generic/virtual/fenced-frame-shadow-dom/wpt_internal/fenced_frame/attribution-reporting-allow-none.https-expected.txt
@@ -0,0 +1,6 @@ +This is a testharness.js-based test. +Harness Error. harness_status.status = 1 , harness_status.message = ResizeObserver loop limit exceeded +PASS Same-origin fenced frame does not load when attribution policy is none +PASS Cross-origin fenced frame does not load when attribution policy is none +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/generic/virtual/fenced-frame-shadow-dom/wpt_internal/fenced_frame/attribution-reporting-allow-self.https-expected.txt b/third_party/blink/web_tests/platform/generic/virtual/fenced-frame-shadow-dom/wpt_internal/fenced_frame/attribution-reporting-allow-self.https-expected.txt new file mode 100644 index 0000000..fbcfd81 --- /dev/null +++ b/third_party/blink/web_tests/platform/generic/virtual/fenced-frame-shadow-dom/wpt_internal/fenced_frame/attribution-reporting-allow-self.https-expected.txt
@@ -0,0 +1,8 @@ +This is a testharness.js-based test. +Harness Error. harness_status.status = 1 , harness_status.message = ResizeObserver loop limit exceeded +PASS Same-origin fenced frame loads when attribution policy is self +PASS Cross-origin fenced frame does not load when attribution policy is self +PASS Fenced frames attribution reporting policy is set to allow * +PASS A fenced frame redirected to a page that does not allow attribution reporting does not navigate +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/generic/virtual/fenced-frame-shadow-dom/wpt_internal/fenced_frame/attribution-reporting-unset.https-expected.txt b/third_party/blink/web_tests/platform/generic/virtual/fenced-frame-shadow-dom/wpt_internal/fenced_frame/attribution-reporting-unset.https-expected.txt new file mode 100644 index 0000000..161fdc729 --- /dev/null +++ b/third_party/blink/web_tests/platform/generic/virtual/fenced-frame-shadow-dom/wpt_internal/fenced_frame/attribution-reporting-unset.https-expected.txt
@@ -0,0 +1,6 @@ +This is a testharness.js-based test. +Harness Error. harness_status.status = 1 , harness_status.message = ResizeObserver loop limit exceeded +PASS Same-origin fenced frame loads when attribution policy is unset +PASS Cross-origin fenced frame loads when attribution policy is unset +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-all.https.html b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-all.https.html new file mode 100644 index 0000000..8e2bdbe --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-all.https.html
@@ -0,0 +1,23 @@ +<!DOCTYPE html> +<title>Test attribution-reporting permission policy gating (*)</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/utils.js"></script> +<script src="/common/dispatcher/dispatcher.js"></script> +<script src="resources/utils.js"></script> +<script src="/common/get-host-info.sub.js"></script> +<script src="resources/attribution-reporting-helper.js"></script> + +<body> +<script> +promise_test(async(t) => { + await runAttributionReportingTest(t, true, get_host_info().ORIGIN); +}, 'Same-origin fenced frame loads when attribution policy is *'); + +promise_test(async(t) => { + await runAttributionReportingTest(t, true, get_host_info().REMOTE_ORIGIN); +}, 'Cross-origin fenced frame loads when attribution policy is *'); + +</script> +</body> +</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-all.https.html.headers b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-all.https.html.headers new file mode 100644 index 0000000..3452ffe --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-all.https.html.headers
@@ -0,0 +1 @@ +Permissions-Policy: attribution-reporting=(*) \ No newline at end of file
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-none.https.html b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-none.https.html new file mode 100644 index 0000000..bbbacc3 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-none.https.html
@@ -0,0 +1,23 @@ +<!DOCTYPE html> +<title>Test attribution-reporting permission policy gating ()</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/utils.js"></script> +<script src="/common/dispatcher/dispatcher.js"></script> +<script src="resources/utils.js"></script> +<script src="/common/get-host-info.sub.js"></script> +<script src="resources/attribution-reporting-helper.js"></script> + +<body> +<script> +promise_test(async(t) => { + await runAttributionReportingTest(t, false, get_host_info().ORIGIN); +}, 'Same-origin fenced frame does not load when attribution policy is none'); + +promise_test(async(t) => { + await runAttributionReportingTest(t, false, get_host_info().REMOTE_ORIGIN); +}, 'Cross-origin fenced frame does not load when attribution policy is none'); + +</script> +</body> +</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-none.https.html.headers b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-none.https.html.headers new file mode 100644 index 0000000..af6d6ec --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-none.https.html.headers
@@ -0,0 +1 @@ +Permissions-Policy: attribution-reporting=() \ No newline at end of file
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-self.https.html b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-self.https.html new file mode 100644 index 0000000..3c282f9 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-self.https.html
@@ -0,0 +1,72 @@ +<!DOCTYPE html> +<title>Test attribution-reporting permission policy gating (self)</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/utils.js"></script> +<script src="/common/dispatcher/dispatcher.js"></script> +<script src="resources/utils.js"></script> +<script src="/common/get-host-info.sub.js"></script> +<script src="resources/attribution-reporting-helper.js"></script> + +<body> +<script> +promise_test(async(t) => { + await runAttributionReportingTest(t, true, get_host_info().ORIGIN); +}, 'Same-origin fenced frame loads when attribution policy is self'); + +promise_test(async(t) => { + await runAttributionReportingTest(t, false, get_host_info().REMOTE_ORIGIN); +}, 'Cross-origin fenced frame does not load when attribution policy is self'); + +promise_test(async(t) => { + const fencedframe = attachFencedFrameContext({ + attributes: [["mode", "opaque-ads"]], + origin: get_host_info().ORIGIN}); + + await fencedframe.execute(async () => { + assert_true(document.featurePolicy.allowsFeature('attribution-reporting'), + "Attribution reporting should be allowed in the outer fenced frame."); + const fencedframe_inner = attachFencedFrameContext({ + attributes: [["mode", "opaque-ads"]], + origin: get_host_info().REMOTE_ORIGIN}); + + await fencedframe_inner.execute(async () => { + assert_true( + document.featurePolicy.allowsFeature('attribution-reporting'), + "Attribution reporting should be allowed in the nested fenced " + + "frame that's cross origin to its embedder."); + }, []); + }, []); +}, 'Fenced frames attribution reporting policy is set to allow *'); + +promise_test(async(t) => { + // We do this test the "old fashioned way" because a redirect in a fenced + // frame remote context will cause it to lose its ability to communicate with + // the main page (which results in a timeout). + const page1_key = token(); + const redirect_key = token(); + + const fencedframe = attachFencedFrame( + generateURL("resources/attribution-reporting-redirect.https.html", + [page1_key, redirect_key]), "opaque-ads"); + + // The fenced frame will send its attribution reporting result and then + // attempt to redirect to a remote origin page. + const page1_resp = await nextValueFromServer(page1_key); + assert_equals(page1_resp, "true", + "Attribution reporting should be enabled on the original page."); + + // There is no API to observe whether the document in the fenced frame loaded + // or not. Instead, set up a timeout. If the document loads, "FAIL" will be + // sent to the server. Otherwise "blocked" will be sent after 2 seconds. + const fencedframe_blocked = new Promise(r => t.step_timeout(r, 1000)); + assert_equals("blocked", await Promise.any([ + nextValueFromServer(redirect_key).then(() => "loaded"), + fencedframe_blocked.then(() => "blocked") + ]), "The fenced frame redirect should not be successful."); +}, 'A fenced frame redirected to a page that does not allow attribution ' + + 'reporting does not navigate'); + +</script> +</body> +</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-self.https.html.headers b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-self.https.html.headers new file mode 100644 index 0000000..9d2c963 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-allow-self.https.html.headers
@@ -0,0 +1 @@ +Permissions-Policy: attribution-reporting=(self) \ No newline at end of file
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-unset.https.html b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-unset.https.html new file mode 100644 index 0000000..91f6a6ef --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-unset.https.html
@@ -0,0 +1,23 @@ +<!DOCTYPE html> +<title>Test attribution-reporting permission policy gating unset</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/utils.js"></script> +<script src="/common/dispatcher/dispatcher.js"></script> +<script src="resources/utils.js"></script> +<script src="/common/get-host-info.sub.js"></script> +<script src="resources/attribution-reporting-helper.js"></script> + +<body> +<script> +promise_test(async(t) => { + await runAttributionReportingTest(t, true, get_host_info().ORIGIN); +}, 'Same-origin fenced frame loads when attribution policy is unset'); + +promise_test(async(t) => { + await runAttributionReportingTest(t, true, get_host_info().REMOTE_ORIGIN); +}, 'Cross-origin fenced frame loads when attribution policy is unset'); + +</script> +</body> +</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-unset.https.html.headers b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-unset.https.html.headers new file mode 100644 index 0000000..e087474 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/attribution-reporting-unset.https.html.headers
@@ -0,0 +1 @@ +Permissions-Policy: geolocation=(*) \ No newline at end of file
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/attribution-reporting-helper.js b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/attribution-reporting-helper.js new file mode 100644 index 0000000..b7a542c --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/attribution-reporting-helper.js
@@ -0,0 +1,31 @@ +// This is a helper file used for the attribution-reporting-*.https.html tests. +// To use this, make sure you import these scripts: +// <script src="/resources/testharness.js"></script> +// <script src="/resources/testharnessreport.js"></script> +// <script src="/common/utils.js"></script> +// <script src="/common/dispatcher/dispatcher.js"></script> +// <script src="resources/utils.js"></script> +// <script src="/common/get-host-info.sub.js"></script> + +async function runAttributionReportingTest(t, should_load, fenced_origin) { + const fencedframe = attachFencedFrameContext({ + attributes: [["mode", "opaque-ads"]], + origin: fenced_origin}); + + if (!should_load) { + const fencedframe_blocked = new Promise(r => t.step_timeout(r, 1000)); + const fencedframe_loaded = fencedframe.execute(() => {}); + assert_equals("blocked", await Promise.any([ + fencedframe_blocked.then(() => "blocked"), + fencedframe_loaded.then(() => "loaded"), + ]), "The fenced frame should not be loaded."); + return; + } + + await fencedframe.execute(() => { + assert_true( + document.featurePolicy.allowsFeature('attribution-reporting'), + "Attribution reporting should be allowed if the fenced " + + " frame loaded."); + }); +}
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/attribution-reporting-redirect.https.html b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/attribution-reporting-redirect.https.html new file mode 100644 index 0000000..6e1df77d --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/attribution-reporting-redirect.https.html
@@ -0,0 +1,28 @@ +<!DOCTYPE html> +<script src="utils.js"></script> +<script src="/common/get-host-info.sub.js"></script> +<title>Fenced frame attribution reporting redirect test</title> + +<body> +<script> +// This helper function will redirect a fenced frame to a remote origin page +// while embedded in a frame that does not allow attribution reporting on +// remote origins. That redirect should fail to load because of the attribution +// reporting restriction. +const [key1, key2] = parseKeylist(); + +if (location.origin == get_host_info().ORIGIN) { + writeValueToServer(key1, + document.featurePolicy.allowsFeature('attribution-reporting')); + + const next_url = getRemoteOriginURL(generateURL( + "attribution-reporting-redirect.https.html", [key1, key2])); + location.href = next_url; +} else { + // The redirect should have been unsuccessful, so we should not reach this + // point. + writeValueToServer(key2, "FAIL"); +} + +</script> +</body>
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/attribution-reporting-redirect.https.html.headers b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/attribution-reporting-redirect.https.html.headers new file mode 100644 index 0000000..1b63235 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/attribution-reporting-redirect.https.html.headers
@@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame
diff --git a/third_party/closure_compiler/externs/developer_private.js b/third_party/closure_compiler/externs/developer_private.js index 054c02fa..b009e67 100644 --- a/third_party/closure_compiler/externs/developer_private.js +++ b/third_party/closure_compiler/externs/developer_private.js
@@ -72,6 +72,7 @@ FROM_STORE: 'FROM_STORE', UNPACKED: 'UNPACKED', THIRD_PARTY: 'THIRD_PARTY', + INSTALLED_BY_DEFAULT: 'INSTALLED_BY_DEFAULT', UNKNOWN: 'UNKNOWN', }; @@ -469,6 +470,14 @@ chrome.developerPrivate.SiteGroup; /** + * @typedef {{ + * id: string, + * siteAccess: !chrome.developerPrivate.HostAccess + * }} + */ +chrome.developerPrivate.MatchingExtensionInfo; + +/** * @enum {string} */ chrome.developerPrivate.PackStatus = { @@ -853,6 +862,13 @@ chrome.developerPrivate.getUserAndExtensionSitesByEtld = function(callback) {}; /** + * @param {string} site + * @param {function(!Array<!chrome.developerPrivate.MatchingExtensionInfo>): void=} + * callback + */ +chrome.developerPrivate.getMatchingExtensionsForSite = function(site, callback) {}; + +/** * @param {string} id * @param {boolean} enabled * @param {function(): void=} callback
diff --git a/third_party/libevent/README.chromium b/third_party/libevent/README.chromium index b855319..9330bdd4 100644 --- a/third_party/libevent/README.chromium +++ b/third_party/libevent/README.chromium
@@ -32,3 +32,4 @@ problems on macOS Sierra. 7) Change buffer.c to not redefine _GNU_SOURCE. 8) Change _event_strlcpy in strlcpy.c to not use K&R syntax. +9) Change a bitfield in evhttp.h from int to unsigned int.
diff --git a/third_party/libevent/evhttp.h b/third_party/libevent/evhttp.h index 48c1d918..0195db2 100644 --- a/third_party/libevent/evhttp.h +++ b/third_party/libevent/evhttp.h
@@ -221,8 +221,8 @@ struct evbuffer *input_buffer; /* read data */ ev_int64_t ntoread; - int chunked:1, /* a chunked request */ - userdone:1; /* the user has sent all data */ + unsigned int chunked:1, /* a chunked request */ + userdone:1; /* the user has sent all data */ struct evbuffer *output_buffer; /* outgoing post or data */
diff --git a/third_party/webgpu-cts/ts_sources.txt b/third_party/webgpu-cts/ts_sources.txt index b7dc18c..058402c 100644 --- a/third_party/webgpu-cts/ts_sources.txt +++ b/third_party/webgpu-cts/ts_sources.txt
@@ -203,6 +203,7 @@ src/webgpu/api/validation/capability_checks/features/query_types.spec.ts src/webgpu/util/create_elements.ts src/webgpu/api/validation/capability_checks/features/texture_formats.spec.ts +src/webgpu/api/validation/encoding/beginComputePass.spec.ts src/webgpu/api/validation/encoding/beginRenderPass.spec.ts src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts src/webgpu/api/validation/encoding/encoder_state.spec.ts
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index c205ff4..6cf9110 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -9104,6 +9104,24 @@ <int value="756" label="IBAN_VALUE - Predictions different - Value agrees with both predictions"/> + <int value="757" + label="CREDIT_CARD_STANDALONE_VERIFICATION_CODE - Predictions equal - + Value agrees"/> + <int value="758" + label="CREDIT_CARD_STANDALONE_VERIFICATION_CODE - Predictions equal - + Value disagrees"/> + <int value="759" + label="CREDIT_CARD_STANDALONE_VERIFICATION_CODE - Predictions different + - Value agrees with old prediction"/> + <int value="760" + label="CREDIT_CARD_STANDALONE_VERIFICATION_CODE - Predictions different + - Value agrees with new prediction"/> + <int value="761" + label="CREDIT_CARD_STANDALONE_VERIFICATION_CODE - Predictions different + - Value agrees with neither prediction"/> + <int value="762" + label="CREDIT_CARD_STANDALONE_VERIFICATION_CODE - Predictions different + - Value agrees with both predictions"/> </enum> <enum name="AutofillPredictionSource"> @@ -23238,6 +23256,22 @@ <int value="2" label="Has enough SCTs"/> </enum> +<enum name="CustomTabsBrandingDecision"> + <summary>Used by CustomTabs.Branding.BrandingDecision</summary> + <int value="0" label="None"> + Branding is not shown. Used when branding is already shown in the past set + cadence (e.g. one hour). + </int> + <int value="1" label="Shown on toolbar"> + Branding is shown on the toolbar. Used when the client app launches CCT past + the set branding cadence. + </int> + <int value="2" label="Shown with Toast"> + Branding is shown with a toast. Used when the client app launches CCT for + the first time. + </int> +</enum> + <enum name="CustomTabsCloseCause"> <int value="0" label="User action in Chrome (back press, close button)"/> <int value="1" label="User action in Android (home)"/> @@ -35294,6 +35328,7 @@ <int value="1695" label="ACCESSIBILITY_PRIVATE_SILENCESPOKENFEEDBACK"/> <int value="1696" label="AUTOTESTPRIVATE_SETALLOWEDPREF"/> <int value="1697" label="PASSWORDSPRIVATE_REQUESTCREDENTIALDETAILS"/> + <int value="1698" label="DEVELOPERPRIVATE_GETMATCHINGEXTENSIONSFORSITE"/> </enum> <enum name="ExtensionIconState"> @@ -56719,6 +56754,7 @@ <int value="-1466206556" label="ArcDocumentsProviderUnknownSize:enabled"/> <int value="-1466100014" label="EchePhoneHubPermissionsOnboarding:disabled"/> <int value="-1465172796" label="CCTModule:disabled"/> + <int value="-1464860971" label="BluetoothCoredump:enabled"/> <int value="-1464832541" label="EnableFuzzyAppSearch:disabled"/> <int value="-1463489219" label="OfflinePagesCTSuppressNotifications:enabled"/> <int value="-1463410070" label="IPH_DemoMode:enabled"/> @@ -60131,6 +60167,7 @@ <int value="683013217" label="AllowPopupsDuringPageUnload:disabled"/> <int value="683433500" label="CommerceMerchantViewer:disabled"/> <int value="683746280" label="PrivacyGuideAndroid:disabled"/> + <int value="684112629" label="BluetoothCoredump:disabled"/> <int value="684198422" label="UnifiedPasswordManagerDesktop:enabled"/> <int value="684806628" label="TranslateLanguageByULP:disabled"/> <int value="685406951" label="UseNotificationCompatBuilder:disabled"/>
diff --git a/tools/metrics/histograms/metadata/custom_tabs/histograms.xml b/tools/metrics/histograms/metadata/custom_tabs/histograms.xml index 1ec0440..90919e7 100644 --- a/tools/metrics/histograms/metadata/custom_tabs/histograms.xml +++ b/tools/metrics/histograms/metadata/custom_tabs/histograms.xml
@@ -52,6 +52,63 @@ </summary> </histogram> +<histogram name="CustomTabs.Branding.BrandingCheckCanceled" + enum="BooleanCanceled" expires_after="2023-02-09"> + <owner>wenyufu@chromium.org</owner> + <owner>chrome-connective-tissue@google.com</owner> + <summary> + For every CCT launch, Chrome will start an async task in the background + checking the last time branding is shown for the client app. Record whether + such branding check is canceled due to timeout when it is finished. Record + for Android CCT only. + </summary> +</histogram> + +<histogram name="CustomTabs.Branding.BrandingCheckDuration" units="ms" + expires_after="2023-02-09"> + <owner>wenyufu@chromium.org</owner> + <owner>chrome-connective-tissue@google.com</owner> + <summary> + For every CCT launch, Chrome will start an async task in the background + checking the last time branding is shown for the client app. Record the + duration of this background async task when it completes, regardless whether + it is canceled. Record for Android CCT only. + </summary> +</histogram> + +<histogram name="CustomTabs.Branding.BrandingDecision" + enum="CustomTabsBrandingDecision" expires_after="2023-02-09"> + <owner>wenyufu@chromium.org</owner> + <owner>chrome-connective-tissue@google.com</owner> + <summary> + For every CCT launch, Chrome will start an async task in the background + checking the last time branding is shown for the client app. When such task + completed, a branding decision will be made based on the last time branding + was shown, and the task completion time. (e.g. show a "chrome logo + + text" combination on the toolbar). See go/clank-cct-branding-dd for + detail. + + Record what branding decision will be used for the current CCT session when + the branding check is finished or canceled. Record for Android CCT only. + </summary> +</histogram> + +<histogram name="CustomTabs.Branding.IsPackageNameValid" enum="BooleanValid" + expires_after="2023-02-09"> + <owner>wenyufu@chromium.org</owner> + <owner>chrome-connective-tissue@google.com</owner> + <summary> + For every CCT launch, Chrome will start an async task in the background + checking the last time branding is shown for the client app. Recorded + whether the package name of CCT client app can be found on device when the + async task is finished. Record for Android CCT only. + + If the client app is using CCT service connection, the client app package + name will be read from CCT service; otherwise the package name will be + parsed from the Activity#getReferrer of CustomTabsActivity. + </summary> +</histogram> + <histogram name="CustomTabs.ClientAppId" enum="ClientAppId" expires_after="2023-01-29"> <owner>yusufo@chromium.org</owner>
diff --git a/tools/typescript/definitions/developer_private.d.ts b/tools/typescript/definitions/developer_private.d.ts index 7b99d2aa..7627a9e 100644 --- a/tools/typescript/definitions/developer_private.d.ts +++ b/tools/typescript/definitions/developer_private.d.ts
@@ -44,6 +44,7 @@ FROM_STORE = 'FROM_STORE', UNPACKED = 'UNPACKED', THIRD_PARTY = 'THIRD_PARTY', + INSTALLED_BY_DEFAULT = 'INSTALLED_BY_DEFAULT', UNKNOWN = 'UNKNOWN', }
diff --git a/ui/accessibility/BUILD.gn b/ui/accessibility/BUILD.gn index 22483104..d8696d7 100644 --- a/ui/accessibility/BUILD.gn +++ b/ui/accessibility/BUILD.gn
@@ -155,6 +155,7 @@ "ax_tree.h", "ax_tree_combiner.cc", "ax_tree_combiner.h", + "ax_tree_manager.cc", "ax_tree_manager.h", "ax_tree_manager_base.cc", "ax_tree_manager_base.h",
diff --git a/ui/accessibility/ax_tree_manager.cc b/ui/accessibility/ax_tree_manager.cc new file mode 100644 index 0000000..f65fb53 --- /dev/null +++ b/ui/accessibility/ax_tree_manager.cc
@@ -0,0 +1,23 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/accessibility/ax_tree_manager.h" + +#include "ui/accessibility/ax_export.h" +#include "ui/accessibility/ax_node.h" +#include "ui/accessibility/ax_tree_id.h" +#include "ui/accessibility/ax_tree_observer.h" + +namespace ui { + +AXTreeManager::AXTreeManager() + : ax_tree_id_(AXTreeIDUnknown()), ax_tree_(nullptr) {} + +AXTreeManager::AXTreeManager(const AXTreeID& tree_id, + std::unique_ptr<AXTree> tree) + : ax_tree_id_(tree_id), ax_tree_(std::move(tree)) {} + +AXTreeManager::~AXTreeManager() = default; + +} // namespace ui
diff --git a/ui/accessibility/ax_tree_manager.h b/ui/accessibility/ax_tree_manager.h index 52f892c1..8f448abe 100644 --- a/ui/accessibility/ax_tree_manager.h +++ b/ui/accessibility/ax_tree_manager.h
@@ -5,18 +5,25 @@ #ifndef UI_ACCESSIBILITY_AX_TREE_MANAGER_H_ #define UI_ACCESSIBILITY_AX_TREE_MANAGER_H_ +#include "base/scoped_observation.h" #include "ui/accessibility/ax_export.h" -#include "ui/accessibility/ax_node.h" -#include "ui/accessibility/ax_tree_id.h" +#include "ui/accessibility/ax_tree.h" #include "ui/accessibility/ax_tree_observer.h" namespace ui { +class AXNode; + // Abstract interface for a class that owns an AXTree and manages its // connections to other AXTrees in the same page or desktop (parent and child // trees). -class AX_EXPORT AXTreeManager { +class AX_EXPORT AXTreeManager : public AXTreeObserver { public: + AXTreeManager(const AXTreeManager&) = delete; + AXTreeManager& operator=(const AXTreeManager&) = delete; + + ~AXTreeManager() override; + // Returns the AXNode with the given |node_id| from the tree that has the // given |tree_id|. This allows for callers to access nodes outside of their // own tree. Returns nullptr if |tree_id| or |node_id| is not found. @@ -56,6 +63,34 @@ // TODO(benjamin.beaudry) Instead of this, implement GetTreeData() on all // AXTreeManager subclasses, and have callers use GetTreeData().ToString(); virtual std::string ToString() const = 0; + + const AXTreeID& ax_tree_id() const { return ax_tree_id_; } + AXTree* ax_tree() const { return ax_tree_.get(); } + + // AXTreeObserver implementation. + void OnTreeDataChanged(ui::AXTree* tree, + const ui::AXTreeData& old_data, + const ui::AXTreeData& new_data) override {} + void OnNodeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override {} + void OnSubtreeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override {} + void OnNodeCreated(ui::AXTree* tree, ui::AXNode* node) override {} + void OnNodeDeleted(ui::AXTree* tree, int32_t node_id) override {} + void OnNodeReparented(ui::AXTree* tree, ui::AXNode* node) override {} + void OnRoleChanged(ui::AXTree* tree, + ui::AXNode* node, + ax::mojom::Role old_role, + ax::mojom::Role new_role) override {} + void OnAtomicUpdateFinished( + ui::AXTree* tree, + bool root_changed, + const std::vector<ui::AXTreeObserver::Change>& changes) override {} + + protected: + AXTreeManager(); + explicit AXTreeManager(const AXTreeID& tree_id, std::unique_ptr<AXTree> tree); + + AXTreeID ax_tree_id_; + std::unique_ptr<AXTree> ax_tree_; }; } // namespace ui
diff --git a/ui/accessibility/platform/ax_platform_tree_manager.h b/ui/accessibility/platform/ax_platform_tree_manager.h index 8d2944a..642104f 100644 --- a/ui/accessibility/platform/ax_platform_tree_manager.h +++ b/ui/accessibility/platform/ax_platform_tree_manager.h
@@ -25,6 +25,11 @@ // Returns an AXPlatformNode that corresponds to the given |node|. virtual AXPlatformNode* GetPlatformNodeFromTree(const AXNode& node) const = 0; + + protected: + explicit AXPlatformTreeManager(const AXTreeID& tree_id, + std::unique_ptr<AXTree> tree) + : AXTreeManager(tree_id, std::move(tree)) {} }; } // namespace ui
diff --git a/ui/accessibility/test_ax_tree_manager.cc b/ui/accessibility/test_ax_tree_manager.cc index 5ee1750..817a2d2 100644 --- a/ui/accessibility/test_ax_tree_manager.cc +++ b/ui/accessibility/test_ax_tree_manager.cc
@@ -13,14 +13,17 @@ TestAXTreeManager::TestAXTreeManager() = default; TestAXTreeManager::TestAXTreeManager(std::unique_ptr<AXTree> tree) - : tree_(std::move(tree)) { - if (tree_) + : AXTreeManager(tree ? tree->data().tree_id : AXTreeIDUnknown(), + std::move(tree)) { + if (ax_tree_) AXTreeManagerMap::GetInstance().AddTreeManager(GetTreeID(), this); } TestAXTreeManager::TestAXTreeManager(TestAXTreeManager&& manager) - : tree_(std::move(manager.tree_)) { - if (tree_) { + : AXTreeManager(manager.ax_tree_ ? manager.ax_tree_->data().tree_id + : AXTreeIDUnknown(), + std::move(manager.ax_tree_)) { + if (ax_tree_) { AXTreeManagerMap::GetInstance().RemoveTreeManager(GetTreeID()); AXTreeManagerMap::GetInstance().AddTreeManager(GetTreeID(), this); } @@ -29,71 +32,72 @@ TestAXTreeManager& TestAXTreeManager::operator=(TestAXTreeManager&& manager) { if (this == &manager) return *this; - if (manager.tree_) + if (manager.ax_tree_) AXTreeManagerMap::GetInstance().RemoveTreeManager(manager.GetTreeID()); // std::move(nullptr) == nullptr, so no need to check if `manager.tree_` is // assigned. - SetTree(std::move(manager.tree_)); + SetTree(std::move(manager.ax_tree_)); return *this; } TestAXTreeManager::~TestAXTreeManager() { - if (tree_) + if (ax_tree_) AXTreeManagerMap::GetInstance().RemoveTreeManager(GetTreeID()); } void TestAXTreeManager::DestroyTree() { - if (!tree_) + if (!ax_tree_) return; AXTreeManagerMap::GetInstance().RemoveTreeManager(GetTreeID()); - tree_.reset(); + ax_tree_.reset(); } AXTree* TestAXTreeManager::GetTree() const { - DCHECK(tree_) << "Did you forget to call SetTree?"; - return tree_.get(); + DCHECK(ax_tree_) << "Did you forget to call SetTree?"; + return ax_tree_.get(); } void TestAXTreeManager::SetTree(std::unique_ptr<AXTree> tree) { - if (tree_) + if (ax_tree_) AXTreeManagerMap::GetInstance().RemoveTreeManager(GetTreeID()); - tree_ = std::move(tree); - if (tree_) + ax_tree_ = std::move(tree); + ax_tree_id_ = GetTreeID(); + if (ax_tree_) AXTreeManagerMap::GetInstance().AddTreeManager(GetTreeID(), this); } AXNode* TestAXTreeManager::GetNodeFromTree(const AXTreeID tree_id, const AXNodeID node_id) const { - return (tree_ && GetTreeID() == tree_id) ? tree_->GetFromId(node_id) - : nullptr; + return (ax_tree_ && GetTreeID() == tree_id) ? ax_tree_->GetFromId(node_id) + : nullptr; } AXNode* TestAXTreeManager::GetNodeFromTree(const AXNodeID node_id) const { - return tree_ ? tree_->GetFromId(node_id) : nullptr; + return ax_tree_ ? ax_tree_->GetFromId(node_id) : nullptr; } void TestAXTreeManager::AddObserver(AXTreeObserver* observer) { - if (tree_) - tree_->AddObserver(observer); + if (ax_tree_) + ax_tree_->AddObserver(observer); } void TestAXTreeManager::RemoveObserver(AXTreeObserver* observer) { - if (tree_) - tree_->RemoveObserver(observer); + if (ax_tree_) + ax_tree_->RemoveObserver(observer); } AXTreeID TestAXTreeManager::GetTreeID() const { - return tree_ ? tree_->data().tree_id : AXTreeIDUnknown(); + return ax_tree_ ? ax_tree_->data().tree_id : AXTreeIDUnknown(); } AXTreeID TestAXTreeManager::GetParentTreeID() const { - return tree_ ? tree_->data().parent_tree_id : AXTreeIDUnknown(); + return ax_tree_ ? ax_tree_->data().parent_tree_id : AXTreeIDUnknown(); } AXNode* TestAXTreeManager::GetRootAsAXNode() const { - return tree_ ? tree_->root() : nullptr; + return ax_tree_ ? ax_tree_->root() : nullptr; } AXNode* TestAXTreeManager::GetParentNodeFromParentTreeAsAXNode() const {
diff --git a/ui/accessibility/test_ax_tree_manager.h b/ui/accessibility/test_ax_tree_manager.h index dabc565..e0b6717 100644 --- a/ui/accessibility/test_ax_tree_manager.h +++ b/ui/accessibility/test_ax_tree_manager.h
@@ -30,7 +30,7 @@ // Takes ownership of |tree|. explicit TestAXTreeManager(std::unique_ptr<AXTree> tree); - virtual ~TestAXTreeManager(); + ~TestAXTreeManager() override; TestAXTreeManager(const TestAXTreeManager& manager) = delete; TestAXTreeManager& operator=(const TestAXTreeManager& manager) = delete; @@ -54,9 +54,6 @@ AXNode* GetRootAsAXNode() const override; AXNode* GetParentNodeFromParentTreeAsAXNode() const override; std::string ToString() const override; - - private: - std::unique_ptr<AXTree> tree_; }; } // namespace ui
diff --git a/ui/base/ime/ash/ime_assistive_window_handler_interface.h b/ui/base/ime/ash/ime_assistive_window_handler_interface.h index a035d16..c36e960 100644 --- a/ui/base/ime/ash/ime_assistive_window_handler_interface.h +++ b/ui/base/ime/ash/ime_assistive_window_handler_interface.h
@@ -30,10 +30,6 @@ gfx::Rect caret; // Position of the autocorrect span, empty if not present. gfx::Rect autocorrect; - - bool operator==(const Bounds& rhs) const { - return caret == rhs.caret && autocorrect == rhs.autocorrect; - } }; // A interface to handle the assistive windows related method call.
diff --git a/ui/chromeos/file_manager_strings.grdp b/ui/chromeos/file_manager_strings.grdp index c78333f7..580077c 100644 --- a/ui/chromeos/file_manager_strings.grdp +++ b/ui/chromeos/file_manager_strings.grdp
@@ -1188,6 +1188,9 @@ <message name="IDS_FILE_BROWSER_DRIVE_INDIVIDUAL_QUOTA_LOW" desc="Text showing individual space left on Google Drive"> Storage low <ph name="REMAINING_PERCENTAGE">$1<ex>12</ex></ph>% left of your <ph name="TOTAL_SPACE">$2<ex>10 TB</ex></ph> individual storage. </message> + <message name="IDS_FILE_BROWSER_DRIVE_WARNING_QUOTA_OVER" desc="Word prepended to 'drive quota over' warning messages exclusively for screen readers to make up for warning icons that are not picked up by them"> + Warning + </message> <message name="IDS_FILE_BROWSER_DRIVE_INDIVIDUAL_QUOTA_OVER" desc="Text informing users that their Google Drive individual quota has been exceeded"> You’ve used all your individual Google Workspace storage. </message>
diff --git a/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_DRIVE_WARNING_QUOTA_OVER.png.sha1 b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_DRIVE_WARNING_QUOTA_OVER.png.sha1 new file mode 100644 index 0000000..79e58d81 --- /dev/null +++ b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_DRIVE_WARNING_QUOTA_OVER.png.sha1
@@ -0,0 +1 @@ +ec97981b96e24590d38d4ab0b1eaf06b69d187c9 \ No newline at end of file
diff --git a/ui/color/color_id.h b/ui/color/color_id.h index 277c93b4..401c3197 100644 --- a/ui/color/color_id.h +++ b/ui/color/color_id.h
@@ -210,6 +210,8 @@ \ E_CPONLY(kColorAshOnboardingFocusRing) \ \ + E_CPONLY(kColorAshPrivacyIndicatorsBackground) \ + \ /* TODO(crbug/1319917): Remove these when dark light mode is launched. */ \ E_CPONLY(kColorAshSystemUILightBorderColor1) \ E_CPONLY(kColorAshSystemUILightBorderColor2) \
diff --git a/ui/file_manager/file_manager/foreground/elements/BUILD.gn b/ui/file_manager/file_manager/foreground/elements/BUILD.gn index 5bdd5a5..1f63f40 100644 --- a/ui/file_manager/file_manager/foreground/elements/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/elements/BUILD.gn
@@ -84,7 +84,7 @@ "//ui/file_manager/file_manager/externs:volume_info", "//ui/file_manager/file_manager/foreground/js:file_rename", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/cr_elements/cr_input:cr_input.m", "//ui/webui/resources/js:i18n_behavior.m", ] @@ -124,7 +124,7 @@ deps = [ "//ui/file_manager/file_manager/common/js:async_util", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/cr_elements/cr_input:cr_input.m", "//ui/webui/resources/js:load_time_data.m", ]
diff --git a/ui/file_manager/file_manager/foreground/elements/files_format_dialog.js b/ui/file_manager/file_manager/foreground/elements/files_format_dialog.js index 78aec2f..7ccfbf3d 100644 --- a/ui/file_manager/file_manager/foreground/elements/files_format_dialog.js +++ b/ui/file_manager/file_manager/foreground/elements/files_format_dialog.js
@@ -3,7 +3,7 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/cr_elements/md_select_css.m.js';
diff --git a/ui/file_manager/file_manager/foreground/elements/files_password_dialog_unittest.js b/ui/file_manager/file_manager/foreground/elements/files_password_dialog_unittest.js index 241bdad..f85b1cf 100644 --- a/ui/file_manager/file_manager/foreground/elements/files_password_dialog_unittest.js +++ b/ui/file_manager/file_manager/foreground/elements/files_password_dialog_unittest.js
@@ -3,7 +3,7 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; import {assert} from 'chrome://resources/js/assert.m.js';
diff --git a/ui/file_manager/file_manager/foreground/js/ui/banners/drive_out_of_individual_space_banner.html b/ui/file_manager/file_manager/foreground/js/ui/banners/drive_out_of_individual_space_banner.html index 3421ad4..2a0b813 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/banners/drive_out_of_individual_space_banner.html +++ b/ui/file_manager/file_manager/foreground/js/ui/banners/drive_out_of_individual_space_banner.html
@@ -4,7 +4,11 @@ } </style> <warning-banner> - <span slot="text">$i18n{DRIVE_INDIVIDUAL_QUOTA_OVER}</span> + <span slot="text" aria-label="$i18n{DRIVE_WARNING_QUOTA_OVER}: $i18n{DRIVE_INDIVIDUAL_QUOTA_OVER}"> + <span aria-hidden="true"> + $i18n{DRIVE_INDIVIDUAL_QUOTA_OVER} + </span> + </span> <cr-button slot="extra-button" href="$i18n{GOOGLE_DRIVE_MANAGE_STORAGE_URL}"> $i18n{LEARN_MORE_LABEL} </cr-button>
diff --git a/ui/file_manager/file_manager/foreground/js/ui/banners/drive_out_of_organization_space_banner.js b/ui/file_manager/file_manager/foreground/js/ui/banners/drive_out_of_organization_space_banner.js index 5025b685..627e281 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/banners/drive_out_of_organization_space_banner.js +++ b/ui/file_manager/file_manager/foreground/js/ui/banners/drive_out_of_organization_space_banner.js
@@ -58,8 +58,13 @@ return; } - this.shadowRoot.querySelector('span[slot="text"]').innerText = + const message = strf('DRIVE_ORGANIZATION_QUOTA_OVER', context.organizationName); + const warning = strf('DRIVE_WARNING_QUOTA_OVER'); + this.shadowRoot.querySelector('span[slot="text"]').outerHTML = ` +<span slot="text" aria-label="${warning}: ${message}"> + <span aria-hidden="true">${message}</span> +</span>`; } }
diff --git a/ui/message_center/public/cpp/notification.h b/ui/message_center/public/cpp/notification.h index 249a7777..9e9ebd4 100644 --- a/ui/message_center/public/cpp/notification.h +++ b/ui/message_center/public/cpp/notification.h
@@ -185,6 +185,12 @@ // SystemNotificationWarningLevel should be used. absl::optional<SkColor> accent_color; + // Similar to `accent_color`, but store a ColorId instead of SkColor so that + // the notification view can use this id to correctly handle theme change. In + // CrOS notification, if `accent_color_id` is provided, `accent_color` will + // not be used. + absl::optional<ui::ColorId> accent_color_id; + // Controls whether a settings button should appear on the notification. See // enum definition. TODO(estade): turn this into a boolean. See // crbug.com/780342 @@ -441,6 +447,13 @@ optional_fields_.accent_color = accent_color; } + absl::optional<ui::ColorId> accent_color_id() const { + return optional_fields_.accent_color_id; + } + void set_accent_color_id(ui::ColorId accent_color_id) { + optional_fields_.accent_color_id = accent_color_id; + } + bool should_show_settings_button() const { return optional_fields_.settings_button_handler != SettingsButtonHandler::NONE;
diff --git a/ui/ozone/platform/wayland/host/wayland_event_source.cc b/ui/ozone/platform/wayland/host/wayland_event_source.cc index 4ae9807..61f5161 100644 --- a/ui/ozone/platform/wayland/host/wayland_event_source.cc +++ b/ui/ozone/platform/wayland/host/wayland_event_source.cc
@@ -369,7 +369,7 @@ TouchEvent event(ET_TOUCH_PRESSED, location, location, timestamp, details, keyboard_modifiers_); DCHECK_EQ(dispatch_policy, DispatchPolicy::kOnFrame); - touch_frames_.push_front( + touch_frames_.push_back( std::make_unique<TouchFrame>(event, base::NullCallback())); } @@ -394,7 +394,7 @@ SetTouchTargetAndDispatchTouchEvent(&event); OnTouchReleaseInternal(id); } else { - touch_frames_.push_front(std::make_unique<TouchFrame>( + touch_frames_.push_back(std::make_unique<TouchFrame>( event, base::BindOnce(&WaylandEventSource::OnTouchReleaseInternal, base::Unretained(this), id))); } @@ -467,7 +467,7 @@ if (dispatch_policy == DispatchPolicy::kImmediate) { SetTouchTargetAndDispatchTouchEvent(&event); } else { - touch_frames_.push_front( + touch_frames_.push_back( std::make_unique<TouchFrame>(event, base::NullCallback())); } }
diff --git a/ui/views/accessibility/views_ax_tree_manager.cc b/ui/views/accessibility/views_ax_tree_manager.cc index ac2e04c..b7d91d5e 100644 --- a/ui/views/accessibility/views_ax_tree_manager.cc +++ b/ui/views/accessibility/views_ax_tree_manager.cc
@@ -24,14 +24,15 @@ namespace views { ViewsAXTreeManager::ViewsAXTreeManager(Widget* widget) - : widget_(widget), - tree_id_(ui::AXTreeID::CreateNewAXTreeID()), - tree_source_(cache_.GetOrCreate(widget), tree_id_, &cache_), + : ui::AXTreeManager(ui::AXTreeID::CreateNewAXTreeID(), + std::make_unique<ui::AXTree>()), + widget_(widget), + tree_source_(cache_.GetOrCreate(widget), ax_tree_id_, &cache_), tree_serializer_(&tree_source_), - event_generator_(&ax_tree_) { + event_generator_(ax_tree()) { DCHECK(widget); - ui::AXTreeManagerMap::GetInstance().AddTreeManager(tree_id_, this); - views::WidgetAXTreeIDMap::GetInstance().AddWidget(tree_id_, widget); + ui::AXTreeManagerMap::GetInstance().AddTreeManager(ax_tree_id_, this); + views::WidgetAXTreeIDMap::GetInstance().AddWidget(ax_tree_id_, widget); views_event_observer_.Observe(AXEventManager::Get()); widget_observer_.Observe(widget); @@ -49,7 +50,7 @@ event_generator_.ReleaseTree(); views_event_observer_.Reset(); widget_observer_.Reset(); - ui::AXTreeManagerMap::GetInstance().RemoveTreeManager(tree_id_); + ui::AXTreeManagerMap::GetInstance().RemoveTreeManager(ax_tree_id_); } void ViewsAXTreeManager::SetGeneratedEventCallbackForTesting( @@ -74,14 +75,14 @@ ui::AXNode* ViewsAXTreeManager::GetNodeFromTree( const ui::AXNodeID node_id) const { - if (!widget_ || !widget_->GetRootView()) + if (!widget_ || !widget_->GetRootView() || !ax_tree_) return nullptr; - return ax_tree_.GetFromId(node_id); + return ax_tree_->GetFromId(node_id); } ui::AXTreeID ViewsAXTreeManager::GetTreeID() const { - return tree_id_; + return ax_tree_id_; } ui::AXTreeID ViewsAXTreeManager::GetParentTreeID() const { @@ -91,10 +92,10 @@ } ui::AXNode* ViewsAXTreeManager::GetRootAsAXNode() const { - if (!widget_ || !widget_->GetRootView()) + if (!widget_ || !widget_->GetRootView() || !ax_tree_) return nullptr; - return ax_tree_.root(); + return ax_tree_->root(); } ui::AXNode* ViewsAXTreeManager::GetParentNodeFromParentTreeAsAXNode() const { @@ -174,12 +175,12 @@ void ViewsAXTreeManager::UnserializeTreeUpdates( const std::vector<ui::AXTreeUpdate>& updates) { - if (!widget_ || !widget_->GetRootView()) + if (!widget_ || !widget_->GetRootView() || !ax_tree_) return; for (const ui::AXTreeUpdate& update : updates) { - if (!ax_tree_.Unserialize(update)) { - NOTREACHED() << ax_tree_.error(); + if (!ax_tree_->Unserialize(update)) { + NOTREACHED() << ax_tree_->error(); return; } } @@ -188,7 +189,7 @@ // AXEventGenerator to generate events based on the updates. for (const ui::AXEventGenerator::TargetedEvent& targeted_event : event_generator_) { - if (ui::AXNode* node = ax_tree().GetFromId(targeted_event.node_id)) + if (ui::AXNode* node = ax_tree_->GetFromId(targeted_event.node_id)) FireGeneratedEvent(targeted_event.event_params.event, *node); } event_generator_.ClearEvents();
diff --git a/ui/views/accessibility/views_ax_tree_manager.h b/ui/views/accessibility/views_ax_tree_manager.h index 0dd8e07f..19e9bc6 100644 --- a/ui/views/accessibility/views_ax_tree_manager.h +++ b/ui/views/accessibility/views_ax_tree_manager.h
@@ -70,9 +70,6 @@ ViewsAXTreeManager(const ViewsAXTreeManager& manager) = delete; ViewsAXTreeManager& operator=(const ViewsAXTreeManager& manager) = delete; - // Returns a reference to the managed AXTree. - const ui::AXTree& ax_tree() const { return ax_tree_; } - // For testing only, register a function to be called when a generated event // is fired from this ViewsAXTreeManager. void SetGeneratedEventCallbackForTesting( @@ -132,13 +129,6 @@ // that are used to serialize the Views tree. AXAuraObjCache cache_; - // The ID for this AXTree. - ui::AXTreeID tree_id_; - - // The AXTree that mirrors the Views tree and which is created by - // deserializing the updates from |tree_source_|. - ui::AXTree ax_tree_; - // The tree source that enables us to serialize the Views tree. AXTreeSourceViews tree_source_;
diff --git a/ui/webui/resources/BUILD.gn b/ui/webui/resources/BUILD.gn index af92076..5fd8142 100644 --- a/ui/webui/resources/BUILD.gn +++ b/ui/webui/resources/BUILD.gn
@@ -167,7 +167,7 @@ "cr_elements/cr_button/cr_button.m.d.ts", "cr_elements/cr_checkbox/cr_checkbox.d.ts", "cr_elements/cr_container_shadow_behavior.m.d.ts", - "cr_elements/cr_dialog/cr_dialog.m.d.ts", + "cr_elements/cr_dialog/cr_dialog.d.ts", "cr_elements/cr_icon_button/cr_icon_button.d.ts", "cr_elements/cr_input/cr_input.m.d.ts", "cr_elements/cr_lottie/cr_lottie.m.d.ts",
diff --git a/ui/webui/resources/cr_components/app_management/file_handling_item.ts b/ui/webui/resources/cr_components/app_management/file_handling_item.ts index 4218afe..64078cf 100644 --- a/ui/webui/resources/cr_components/app_management/file_handling_item.ts +++ b/ui/webui/resources/cr_components/app_management/file_handling_item.ts
@@ -9,7 +9,7 @@ import {focusWithoutInk} from 'chrome://resources/js/cr/ui/focus_without_ink.m.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin} from '../../js/i18n_mixin.js'; import {App} from './app_management.mojom-webui.js';
diff --git a/ui/webui/resources/cr_components/certificate_manager/ca_trust_edit_dialog.ts b/ui/webui/resources/cr_components/certificate_manager/ca_trust_edit_dialog.ts index 32cb43e..9711682 100644 --- a/ui/webui/resources/cr_components/certificate_manager/ca_trust_edit_dialog.ts +++ b/ui/webui/resources/cr_components/certificate_manager/ca_trust_edit_dialog.ts
@@ -10,7 +10,7 @@ */ import '../../cr_elements/cr_button/cr_button.m.js'; import '../../cr_elements/cr_checkbox/cr_checkbox.js'; -import '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import '../../cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/paper-spinner/paper-spinner-lite.js'; import './certificate_shared.css.js'; @@ -18,7 +18,7 @@ import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {CrCheckboxElement} from '../../cr_elements/cr_checkbox/cr_checkbox.js'; -import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin} from '../../js/i18n_mixin.js'; import {loadTimeData} from '../../js/load_time_data.m.js';
diff --git a/ui/webui/resources/cr_components/certificate_manager/certificate_delete_confirmation_dialog.ts b/ui/webui/resources/cr_components/certificate_manager/certificate_delete_confirmation_dialog.ts index 0c1868b..6294f530 100644 --- a/ui/webui/resources/cr_components/certificate_manager/certificate_delete_confirmation_dialog.ts +++ b/ui/webui/resources/cr_components/certificate_manager/certificate_delete_confirmation_dialog.ts
@@ -7,12 +7,12 @@ * of certificates. */ import '../../cr_elements/cr_button/cr_button.m.js'; -import '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import '../../cr_elements/cr_dialog/cr_dialog.js'; import './certificate_shared.css.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.js'; import {assertNotReached} from '../../js/assert_ts.js'; import {I18nMixin} from '../../js/i18n_mixin.js'; import {loadTimeData} from '../../js/load_time_data.m.js';
diff --git a/ui/webui/resources/cr_components/certificate_manager/certificate_password_decryption_dialog.ts b/ui/webui/resources/cr_components/certificate_manager/certificate_password_decryption_dialog.ts index 0ed9234..03bcdd71 100644 --- a/ui/webui/resources/cr_components/certificate_manager/certificate_password_decryption_dialog.ts +++ b/ui/webui/resources/cr_components/certificate_manager/certificate_password_decryption_dialog.ts
@@ -7,14 +7,14 @@ * a previously exported personal certificate can be imported. */ import '../../cr_elements/cr_button/cr_button.m.js'; -import '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import '../../cr_elements/cr_dialog/cr_dialog.js'; import '../../cr_elements/cr_input/cr_input.m.js'; import './certificate_shared.css.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {CrButtonElement} from '../../cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin} from '../../js/i18n_mixin.js'; import {getTemplate} from './certificate_password_decryption_dialog.html.js';
diff --git a/ui/webui/resources/cr_components/certificate_manager/certificate_password_encryption_dialog.ts b/ui/webui/resources/cr_components/certificate_manager/certificate_password_encryption_dialog.ts index b1d44b3a..eb99d35d 100644 --- a/ui/webui/resources/cr_components/certificate_manager/certificate_password_encryption_dialog.ts +++ b/ui/webui/resources/cr_components/certificate_manager/certificate_password_encryption_dialog.ts
@@ -7,7 +7,7 @@ * before it is exported to disk. */ import '../../cr_elements/cr_button/cr_button.m.js'; -import '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import '../../cr_elements/cr_dialog/cr_dialog.js'; import '../../cr_elements/cr_input/cr_input.m.js'; import '../../cr_elements/shared_vars_css.m.js'; import './certificate_shared.css.js'; @@ -15,7 +15,7 @@ import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {CrButtonElement} from '../../cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin} from '../../js/i18n_mixin.js'; import {getTemplate} from './certificate_password_encryption_dialog.html.js';
diff --git a/ui/webui/resources/cr_components/certificate_manager/certificate_provisioning_details_dialog.ts b/ui/webui/resources/cr_components/certificate_manager/certificate_provisioning_details_dialog.ts index 8f39ff58..e48e4dc 100644 --- a/ui/webui/resources/cr_components/certificate_manager/certificate_provisioning_details_dialog.ts +++ b/ui/webui/resources/cr_components/certificate_manager/certificate_provisioning_details_dialog.ts
@@ -7,12 +7,12 @@ * view the details of an in-progress certiifcate provisioning process. */ import '../../cr_elements/cr_expand_button/cr_expand_button.js'; -import '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import '../../cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin} from '../../js/i18n_mixin.js'; import {CertificateProvisioningBrowserProxyImpl, CertificateProvisioningProcess} from './certificate_provisioning_browser_proxy.js';
diff --git a/ui/webui/resources/cr_components/certificate_manager/certificates_error_dialog.ts b/ui/webui/resources/cr_components/certificate_manager/certificates_error_dialog.ts index ae6d7d5..271cfa2 100644 --- a/ui/webui/resources/cr_components/certificate_manager/certificates_error_dialog.ts +++ b/ui/webui/resources/cr_components/certificate_manager/certificates_error_dialog.ts
@@ -7,12 +7,12 @@ * The user can only close the dialog, there is no other possible interaction. */ import '../../cr_elements/cr_button/cr_button.m.js'; -import '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import '../../cr_elements/cr_dialog/cr_dialog.js'; import './certificate_shared.css.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin} from '../../js/i18n_mixin.js'; import {loadTimeData} from '../../js/load_time_data.m.js';
diff --git a/ui/webui/resources/cr_components/chromeos/bluetooth/BUILD.gn b/ui/webui/resources/cr_components/chromeos/bluetooth/BUILD.gn index 4032cb62..3a35526 100644 --- a/ui/webui/resources/cr_components/chromeos/bluetooth/BUILD.gn +++ b/ui/webui/resources/cr_components/chromeos/bluetooth/BUILD.gn
@@ -73,7 +73,7 @@ js_library("bluetooth_dialog") { deps = [ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/cr_elements/cr_input:cr_input.m", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:i18n_behavior.m",
diff --git a/ui/webui/resources/cr_components/chromeos/bluetooth/bluetooth_dialog.js b/ui/webui/resources/cr_components/chromeos/bluetooth/bluetooth_dialog.js index 3d57b77a..9746a534 100644 --- a/ui/webui/resources/cr_components/chromeos/bluetooth/bluetooth_dialog.js +++ b/ui/webui/resources/cr_components/chromeos/bluetooth/bluetooth_dialog.js
@@ -10,7 +10,7 @@ */ import '../../../cr_elements/cr_button/cr_button.m.js'; -import '../../../cr_elements/cr_dialog/cr_dialog.m.js'; +import '../../../cr_elements/cr_dialog/cr_dialog.js'; import '../../../cr_elements/cr_input/cr_input.m.js'; import '../../../cr_elements/hidden_style_css.m.js'; import '../../../js/cr.m.js';
diff --git a/ui/webui/resources/cr_components/chromeos/cellular_setup/BUILD.gn b/ui/webui/resources/cr_components/chromeos/cellular_setup/BUILD.gn index 9e08e40..de4b1ab 100644 --- a/ui/webui/resources/cr_components/chromeos/cellular_setup/BUILD.gn +++ b/ui/webui/resources/cr_components/chromeos/cellular_setup/BUILD.gn
@@ -378,6 +378,7 @@ html_file = "cellular_eid_dialog.html" html_type = "dom-module" namespace_rewrites = cr_components_chromeos_namespace_rewrites + migrated_imports = cr_components_migrated_imports auto_imports = cr_components_chromeos_auto_imports }
diff --git a/ui/webui/resources/cr_components/chromeos/network/BUILD.gn b/ui/webui/resources/cr_components/chromeos/network/BUILD.gn index 6fceab5..ea6e814 100644 --- a/ui/webui/resources/cr_components/chromeos/network/BUILD.gn +++ b/ui/webui/resources/cr_components/chromeos/network/BUILD.gn
@@ -379,7 +379,7 @@ "//third_party/polymer/v3_0/components-chromium/iron-icon:iron-icon", "//third_party/polymer/v3_0/components-chromium/paper-spinner:paper-spinner-lite", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/cr_elements/cr_toggle:cr_toggle.m", "//ui/webui/resources/cr_elements/policy:cr_policy_indicator.m", "//ui/webui/resources/js:i18n_behavior.m", @@ -662,7 +662,7 @@ "//third_party/polymer/v3_0/components-chromium/iron-icon:iron-icon", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/cr_elements/cr_toggle:cr_toggle.m", "//ui/webui/resources/js:i18n_behavior.m", ] @@ -731,6 +731,7 @@ html_file = "network_config.html" html_type = "dom-module" auto_imports = cr_components_chromeos_auto_imports + migrated_imports = cr_components_migrated_imports namespace_rewrites = cr_components_chromeos_namespace_rewrites } @@ -867,6 +868,7 @@ html_file = "sim_lock_dialogs.html" html_type = "dom-module" auto_imports = cr_components_chromeos_auto_imports + migrated_imports = cr_components_migrated_imports namespace_rewrites = cr_components_chromeos_namespace_rewrites }
diff --git a/ui/webui/resources/cr_components/chromeos/os_cr_components.gni b/ui/webui/resources/cr_components/chromeos/os_cr_components.gni index cbb9e2ab..52f0d360 100644 --- a/ui/webui/resources/cr_components/chromeos/os_cr_components.gni +++ b/ui/webui/resources/cr_components/chromeos/os_cr_components.gni
@@ -72,6 +72,7 @@ ] cr_components_migrated_imports = [ + "ui/webui/resources/cr_elements/cr_dialog/cr_dialog.html", "ui/webui/resources/cr_elements/cr_icon_button/cr_icon_button.html", "ui/webui/resources/cr_elements/cr_radio_group/cr_radio_group.html", "ui/webui/resources/html/list_property_update_behavior.html",
diff --git a/ui/webui/resources/cr_components/chromeos/quick_unlock/BUILD.gn b/ui/webui/resources/cr_components/chromeos/quick_unlock/BUILD.gn index f90dac88..968db79b 100644 --- a/ui/webui/resources/cr_components/chromeos/quick_unlock/BUILD.gn +++ b/ui/webui/resources/cr_components/chromeos/quick_unlock/BUILD.gn
@@ -72,6 +72,7 @@ html_file = "setup_pin_keyboard.html" html_type = "dom-module" namespace_rewrites = cr_components_chromeos_namespace_rewrites + migrated_imports = cr_components_migrated_imports auto_imports = cr_components_chromeos_auto_imports }
diff --git a/ui/webui/resources/cr_components/chromeos/smb_shares/BUILD.gn b/ui/webui/resources/cr_components/chromeos/smb_shares/BUILD.gn index 8d90e43b..1e9e8cd 100644 --- a/ui/webui/resources/cr_components/chromeos/smb_shares/BUILD.gn +++ b/ui/webui/resources/cr_components/chromeos/smb_shares/BUILD.gn
@@ -20,7 +20,7 @@ ":smb_browser_proxy", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", "//ui/webui/resources/cr_elements/cr_checkbox:cr_checkbox", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", "//ui/webui/resources/cr_elements/cr_input:cr_input.m", "//ui/webui/resources/js:cr.m", "//ui/webui/resources/js:i18n_behavior.m",
diff --git a/ui/webui/resources/cr_components/chromeos/smb_shares/add_smb_share_dialog.js b/ui/webui/resources/cr_components/chromeos/smb_shares/add_smb_share_dialog.js index 9d1af7dba..6cb14d5 100644 --- a/ui/webui/resources/cr_components/chromeos/smb_shares/add_smb_share_dialog.js +++ b/ui/webui/resources/cr_components/chromeos/smb_shares/add_smb_share_dialog.js
@@ -11,7 +11,7 @@ import '../../../cr_elements/cr_button/cr_button.m.js'; import '../../../cr_elements/cr_checkbox/cr_checkbox.js'; -import '../../../cr_elements/cr_dialog/cr_dialog.m.js'; +import '../../../cr_elements/cr_dialog/cr_dialog.js'; import '../../../cr_elements/cr_input/cr_input.m.js'; import '../../../cr_elements/cr_searchable_drop_down/cr_searchable_drop_down.js'; import '../../../cr_elements/icons.m.js';
diff --git a/ui/webui/resources/cr_components/history_clusters/clusters.ts b/ui/webui/resources/cr_components/history_clusters/clusters.ts index 5e55701..6acf6ab6 100644 --- a/ui/webui/resources/cr_components/history_clusters/clusters.ts +++ b/ui/webui/resources/cr_components/history_clusters/clusters.ts
@@ -5,7 +5,7 @@ import './cluster.js'; import './history_clusters_shared_style.css.js'; import '../../cr_elements/cr_button/cr_button.m.js'; -import '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import '../../cr_elements/cr_dialog/cr_dialog.js'; import '../../cr_elements/cr_lazy_render/cr_lazy_render.js'; import '../../cr_elements/cr_toast/cr_toast.js'; import 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; @@ -17,7 +17,7 @@ import {IronScrollThresholdElement} from 'chrome://resources/polymer/v3_0/iron-scroll-threshold/iron-scroll-threshold.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.js'; import {CrLazyRenderElement} from '../../cr_elements/cr_lazy_render/cr_lazy_render.js'; import {CrToastElement} from '../../cr_elements/cr_toast/cr_toast.js'; import {assert} from '../../js/assert_ts.js';
diff --git a/ui/webui/resources/cr_components/managed_dialog/managed_dialog.ts b/ui/webui/resources/cr_components/managed_dialog/managed_dialog.ts index f4b87ad2..aca3802 100644 --- a/ui/webui/resources/cr_components/managed_dialog/managed_dialog.ts +++ b/ui/webui/resources/cr_components/managed_dialog/managed_dialog.ts
@@ -7,14 +7,14 @@ * interact with some UI features which are managed by the user's organization. */ import '../../cr_elements/cr_button/cr_button.m.js'; -import '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import '../../cr_elements/cr_dialog/cr_dialog.js'; import '../../cr_elements/icons.m.js'; import '../../cr_elements/shared_vars_css.m.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from '../../cr_elements/cr_dialog/cr_dialog.js'; import {I18nMixin} from '../../js/i18n_mixin.js'; import {getTemplate} from './managed_dialog.html.js';
diff --git a/ui/webui/resources/cr_components/most_visited/most_visited.ts b/ui/webui/resources/cr_components/most_visited/most_visited.ts index 7f76ad7d..435eace3 100644 --- a/ui/webui/resources/cr_components/most_visited/most_visited.ts +++ b/ui/webui/resources/cr_components/most_visited/most_visited.ts
@@ -4,7 +4,7 @@ import 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; import 'chrome://resources/cr_elements/cr_icons_css.m.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; @@ -12,7 +12,7 @@ import 'chrome://resources/cr_elements/hidden_style_css.m.js'; import {CrActionMenuElement} from 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrToastElement} from 'chrome://resources/cr_elements/cr_toast/cr_toast.js'; import {assert} from 'chrome://resources/js/assert.m.js'; import {skColorToRgba} from 'chrome://resources/js/color_utils.js';
diff --git a/ui/webui/resources/cr_elements/BUILD.gn b/ui/webui/resources/cr_elements/BUILD.gn index 639bd22..11b5a43 100644 --- a/ui/webui/resources/cr_elements/BUILD.gn +++ b/ui/webui/resources/cr_elements/BUILD.gn
@@ -88,8 +88,6 @@ "cr_button/cr_button.js", "cr_container_shadow_behavior.html", "cr_container_shadow_behavior.js", - "cr_dialog/cr_dialog.html", - "cr_dialog/cr_dialog.js", "cr_icons_css.html", "cr_input/cr_input.html", "cr_input/cr_input.js", @@ -137,7 +135,7 @@ "cr_button/cr_button.m.js", "cr_checkbox/cr_checkbox.js", "cr_container_shadow_behavior.m.js", - "cr_dialog/cr_dialog.m.js", + "cr_dialog/cr_dialog.js", "cr_icon_button/cr_icon_button.js", "cr_icons_css.m.js", "cr_input/cr_input.m.js", @@ -171,7 +169,6 @@ group("closure_compile") { deps = [ ":cr_elements_resources", - "cr_dialog:closure_compile", "cr_input:closure_compile", "cr_lottie:closure_compile", "cr_radio_button:closure_compile", @@ -286,7 +283,7 @@ ":shared_vars_css_module", "cr_button:cr_button_module", "cr_checkbox:web_components", - "cr_dialog:cr_dialog_module", + "cr_dialog:web_components", "cr_icon_button:web_components", "cr_input:polymer3_elements", "cr_lottie:cr_lottie_module",
diff --git a/ui/webui/resources/cr_elements/cr_dialog/BUILD.gn b/ui/webui/resources/cr_elements/cr_dialog/BUILD.gn index e254ddde..6a2207b 100644 --- a/ui/webui/resources/cr_elements/cr_dialog/BUILD.gn +++ b/ui/webui/resources/cr_elements/cr_dialog/BUILD.gn
@@ -3,45 +3,21 @@ # found in the LICENSE file. import("//third_party/closure_compiler/compile_js.gni") -import("//tools/polymer/polymer.gni") +import("//tools/polymer/html_to_js.gni") -js_type_check("closure_compile") { - uses_legacy_modules = true +html_to_js("web_components") { + js_files = [ "cr_dialog.js" ] +} + +js_type_check("closure_compile_module") { + is_polymer3 = true deps = [ ":cr_dialog" ] } js_library("cr_dialog") { deps = [ - "..:cr_container_shadow_behavior", - "//ui/webui/resources/js:assert", - ] -} - -polymer_modulizer("cr_dialog") { - js_file = "cr_dialog.js" - html_file = "cr_dialog.html" - html_type = "dom-module" - migrated_imports = - [ "ui/webui/resources/cr_elements/cr_icon_button/cr_icon_button.html" ] - auto_imports = [ - "ui/webui/resources/cr_elements/cr_container_shadow_behavior.html|CrContainerShadowBehavior", - "ui/webui/resources/html/assert.html|assert", - ] -} - -js_type_check("closure_compile_module") { - is_polymer3 = true - deps = [ ":cr_dialog.m" ] -} - -js_library("cr_dialog.m") { - sources = [ - "$root_gen_dir/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.m.js", - ] - deps = [ "..:cr_container_shadow_behavior.m", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/js:assert.m", ] - extra_deps = [ ":cr_dialog_module" ] }
diff --git a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.m.d.ts b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.d.ts similarity index 100% rename from ui/webui/resources/cr_elements/cr_dialog/cr_dialog.m.d.ts rename to ui/webui/resources/cr_elements/cr_dialog/cr_dialog.d.ts
diff --git a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.html b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.html index a7e18d9..773bf673 100644 --- a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.html +++ b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.html
@@ -1,14 +1,3 @@ -<link rel="import" href="../../html/polymer.html"> - -<link rel="import" href="../../html/assert.html"> -<link rel="import" href="../cr_container_shadow_behavior.html"> -<link rel="import" href="../cr_icon_button/cr_icon_button.html"> -<link rel="import" href="../cr_icons_css.html"> -<link rel="import" href="../hidden_style_css.html"> -<link rel="import" href="../shared_vars_css.html"> - -<dom-module id="cr-dialog"> - <template> <style include="cr-hidden-style cr-icons"> dialog { --scroll-border-color: var(--paper-grey-300); @@ -210,6 +199,3 @@ </div> </dialog> </if> - </template> - <script src="cr_dialog.js"></script> -</dom-module>
diff --git a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js index dd0316c..c8f54b7 100644 --- a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js +++ b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
@@ -19,9 +19,20 @@ * width/height (as well as other available mixins to style other parts of the * dialog contents). */ +import {Polymer, html} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {assert} from '../../js/assert.m.js'; +import {CrContainerShadowBehavior} from '../cr_container_shadow_behavior.m.js'; +import '../cr_icon_button/cr_icon_button.js'; +import '../cr_icons_css.m.js'; +import '../hidden_style_css.m.js'; +import '../shared_vars_css.m.js'; + Polymer({ is: 'cr-dialog', + _template: html`{__html_template__}`, + behaviors: [CrContainerShadowBehavior], properties: { @@ -338,4 +349,3 @@ this.$$('.title-container').focus(); }, }); -/* #ignore */ console.warn('crbug/1173575, non-JS module files deprecated.');