diff --git a/DEPS b/DEPS index d9d51039..6138701e 100644 --- a/DEPS +++ b/DEPS
@@ -231,7 +231,7 @@ # 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': 'de1d7fb07f93b6119555f30b70db2568f5bf32a5', + 'skia_revision': '282d5a051a5e0b13c13b95708a5eeab84f32b333', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -239,11 +239,11 @@ # 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': '29c01d51866489160e894b12827048b9498096ce', + 'angle_revision': '9391199053684d3464f5d3f759ce1653040c3cad', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': 'efbbb2f07b3642b570472f01ed75b04bf1eeb4af', + 'swiftshader_revision': '36e6c2a89c74db98dbedbc1f5c7d87768f0af8cb', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. @@ -278,7 +278,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. - 'freetype_revision': 'a29e020059ca6f73a212ec76af94b22a694ad765', + 'freetype_revision': '12ef831fc314518bff45278008a568608501a8e4', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. @@ -298,7 +298,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '444aba89e1c30edf348c611a9df79e2376178ba8', + 'catapult_revision': '1d51e702a8ff57f38556422f2a6eafb0767a5da7', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -306,7 +306,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': '9bae60435628d3f34790eedcc522e2dad22325cc', + 'devtools_frontend_revision': 'f9be6f9229a68cf4c095fd34eae3c147650ab2f7', # 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. @@ -346,7 +346,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': '4420ecc71e275f4675e981610067b426c0282f07', + 'dawn_revision': '029d67f2c807250c48aeee6172646d4937a24a54', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -413,7 +413,7 @@ 'libcxx_revision': '79a2e924d96e2fc1e4b937c42efd08898fa472d7', # GN CIPD package version. - 'gn_version': 'git_revision:de86ec4176235871a7cb335756987e41246dae4a', + 'gn_version': 'git_revision:0153d369bbccc908f4da4993b1ba82728055926a', } # Only these hosts are allowed for dependencies in this DEPS file. @@ -663,6 +663,17 @@ 'condition': 'checkout_ios', }, + 'src/ios/third_party/native_closure_compiler': { + 'packages': [ + { + 'package': 'chromium/third_party/native_closure_compiler_macos', + 'version': 'version:2@20210505.0.0', + }, + ], + 'condition': 'checkout_ios', + 'dep_type': 'cipd', + }, + 'src/ios/third_party/ochamcrest/src': { 'url': Var('chromium_git') + '/external/github.com/hamcrest/OCHamcrest.git' + '@' + '92d9c14d13bb864255e65c09383564653896916b', 'condition': 'checkout_ios', @@ -1006,7 +1017,7 @@ # Tools used when building Chrome for Chrome OS. This affects both the Simple # Chrome workflow, as well as the chromeos-chrome ebuild. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'a49cb4dc98f176f64d0e39d8aebb87c6b5bc3c1b', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '407ec66d620adaa61d3e52f68114dae635cdfb54', 'condition': 'checkout_chromeos', }, @@ -1412,7 +1423,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '18d0bcdb5c126006c04dfeceff3801aeaa10689f', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '77083582a8c35dfca271f3351912444a30955f5a', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1633,7 +1644,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'b0291fd966b55a5efc496772555b94842bde1085', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '29b4049abc5928d995b51f8614dfb27dc7e3359e', + Var('webrtc_git') + '/src.git' + '@' + '8d9395d30bd5c1bfd73749db0d4723db6e02f536', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1691,7 +1702,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@d3297d09026c81e6a221d007598ec8349257d8c3', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@710e883c10e75e878ee3646f7f4557f4d5302555', 'condition': 'checkout_src_internal', }, @@ -1710,7 +1721,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/help_app/app', - 'version': 'YACky8ppLFM0FXPDau15wHt9xmw-BVM8HKnMLz5HQXgC', + 'version': 'qOOwSFA26ck4vnbkaSGVzKnT0J3jg7Tz0RCSffNVJNEC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', @@ -1721,7 +1732,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/media_app/app', - 'version': 'VGbkbIQy4l5j2gmve_60OzV-VQA2ZqWVEJDnpLrE7IoC', + 'version': 'xKlTfLanaaA9XzUEif2405NJVypAOJopXtyJEIrvyaMC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', @@ -1732,7 +1743,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/projector_app/app', - 'version': 'fTUxaSWoNv-UNcZzhkVzQkety15q56CblJ2DE2oGKpMC', + 'version': 'Qqoyo9-UhF3EdEvFV1vURjvU_bvLLJqeQWLaAfw_ws8C', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/WATCHLISTS b/WATCHLISTS index 56ea209..bb3d0c38 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -1838,7 +1838,7 @@ 'filepath': 'apitest|unittest|browsertest|uitest|chrome/test/', }, 'tether': { - 'filepath': 'chrome/browser/chromeos/tether/'\ + 'filepath': 'chrome/browser/ash/tether/'\ '|chrome/browser/ui/ash/network/tether*'\ '|chromeos/components/tether/' },
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/devui/CrashesListFragmentTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/devui/CrashesListFragmentTest.java index 0013c31..4c9dca5 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/devui/CrashesListFragmentTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/devui/CrashesListFragmentTest.java
@@ -229,7 +229,7 @@ @Override public boolean matchesSafely(View view) { - Drawable expectedDrawable = mResources.getDrawable(expectedId); + Drawable expectedDrawable = view.getContext().getDrawable(expectedId); return withDrawable(expectedDrawable).matches(view); }
diff --git a/android_webview/nonembedded/java/src/org/chromium/android_webview/devui/FlagsFragment.java b/android_webview/nonembedded/java/src/org/chromium/android_webview/devui/FlagsFragment.java index 7f8feee..c7db9a5 100644 --- a/android_webview/nonembedded/java/src/org/chromium/android_webview/devui/FlagsFragment.java +++ b/android_webview/nonembedded/java/src/org/chromium/android_webview/devui/FlagsFragment.java
@@ -154,7 +154,7 @@ private void setClearTextButtonEnabled(EditText editText, boolean enabled) { int iconColor = getResources().getColor(R.color.navigation_unselected); - Drawable clearTextIcon = getResources().getDrawable(R.drawable.ic_clear_text); + Drawable clearTextIcon = getContext().getDrawable(R.drawable.ic_clear_text); clearTextIcon.mutate(); clearTextIcon.setColorFilter(new PorterDuffColorFilter(iconColor, PorterDuff.Mode.SRC_IN));
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 7bf739f9..95f662fa9 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -2037,6 +2037,7 @@ "//ui/chromeos/events", "//ui/chromeos/resources", "//ui/chromeos/styles:cros_styles_views", + "//ui/color", "//ui/compositor", "//ui/compositor_extra", "//ui/display",
diff --git a/ash/DEPS b/ash/DEPS index 3e92814..157277a 100644 --- a/ash/DEPS +++ b/ash/DEPS
@@ -48,32 +48,32 @@ # Ash sits above content. Exceptions live in //ash/webui. "-content", - # Only allow Chrome OS services and D-Bus clients accessible to the mustash - # ash process. + # Some code in //chromeos should not be used by ash, so use an allowlist. + # See //chromeos/README.md for details about Lacros, which is migrating some + # code out of //chromeos into //ash. "-chromeos", - "+chromeos/components/feature_usage/feature_usage_metrics.h", - "+chromeos/components/multidevice/logging/logging.h", + # //ash can use chromeos components that sit below it in the dependency tree. + "+chromeos/components/feature_usage", + "+chromeos/components/multidevice", "+chromeos/components/phonehub", - "+chromeos/components/proximity_auth/public/mojom", + "+chromeos/components/proximity_auth/public", "+chromeos/components/sensors", - "+chromeos/crosapi/cpp/crosapi_constants.h", - "+chromeos/crosapi/mojom", - "+chromeos/dbus/initialize_dbus_client.h", - "+chromeos/dbus/audio", - "+chromeos/dbus/init", - "+chromeos/dbus/hammerd", - "+chromeos/dbus/hermes", - "+chromeos/dbus/power", - "+chromeos/dbus/power_manager", - "+chromeos/dbus/rmad", - "+chromeos/dbus/shill", - "+chromeos/dbus/system_clock", - "+chromeos/dbus/usb", + # crosapi is an API to support lacros. + "+chromeos/crosapi", + # //ash can access all D-Bus client libraries. The mustash project previously + # limit D-Bus communication to a subset of OS daemons, but that project + # stopped in 2019. See //ash/README.md. + "+chromeos/dbus", + # //ash should use code in //ash/session to get login state. The state in + # //ash/session and the state in //chromeos/login/login_state are both + # derived from the canonical state in the browser. Using both sources could + # create subtle inconsistencies based on when observers are called. + "-chromeos/login/login_state", "+chromeos/network", + # //ash can use the public interfaces of various services. "+chromeos/services/assistant/public" , "+chromeos/services/assistant/test_support", - "+chromeos/services/libassistant/public/cpp", - "+chromeos/services/libassistant/public/mojom", + "+chromeos/services/libassistant/public", "+chromeos/services/machine_learning/public", "+chromeos/services/multidevice_setup/public", "+chromeos/services/nearby/public", @@ -82,7 +82,6 @@ "+chromeos/settings/timezone_settings.h", "+chromeos/strings", "+chromeos/system", - # Do not eliminate this. "+chromeos/ui", # ui/base/idle depends on SessionManagerClient so disallow it.
diff --git a/ash/ambient/ui/ambient_info_view.cc b/ash/ambient/ui/ambient_info_view.cc index 110674ee..130f205 100644 --- a/ash/ambient/ui/ambient_info_view.cc +++ b/ash/ambient/ui/ambient_info_view.cc
@@ -54,10 +54,11 @@ void AmbientInfoView::OnThemeChanged() { views::View::OnThemeChanged(); + const auto* color_provider = GetColorProvider(); details_label_->SetShadows( - ambient::util::GetTextShadowValues(GetNativeTheme())); + ambient::util::GetTextShadowValues(color_provider)); related_details_label_->SetShadows( - ambient::util::GetTextShadowValues(GetNativeTheme())); + ambient::util::GetTextShadowValues(color_provider)); } void AmbientInfoView::UpdateImageDetails(
diff --git a/ash/ambient/ui/glanceable_info_view.cc b/ash/ambient/ui/glanceable_info_view.cc index 858dcb4..c9b025c 100644 --- a/ash/ambient/ui/glanceable_info_view.cc +++ b/ash/ambient/ui/glanceable_info_view.cc
@@ -94,7 +94,7 @@ void GlanceableInfoView::OnThemeChanged() { views::View::OnThemeChanged(); gfx::ShadowValues text_shadow_values = - ambient::util::GetTextShadowValues(GetNativeTheme()); + ambient::util::GetTextShadowValues(GetColorProvider()); time_view_->SetTextShadowValues(text_shadow_values); temperature_->SetShadows(text_shadow_values); }
diff --git a/ash/ambient/ui/media_string_view.cc b/ash/ambient/ui/media_string_view.cc index 5e9429c4..0f0deca 100644 --- a/ash/ambient/ui/media_string_view.cc +++ b/ash/ambient/ui/media_string_view.cc
@@ -128,7 +128,8 @@ void MediaStringView::OnThemeChanged() { views::View::OnThemeChanged(); - media_text_->SetShadows(ambient::util::GetTextShadowValues(GetNativeTheme())); + media_text_->SetShadows( + ambient::util::GetTextShadowValues(GetColorProvider())); } void MediaStringView::OnViewBoundsChanged(views::View* observed_view) { UpdateMaskLayer();
diff --git a/ash/ambient/util/ambient_util.cc b/ash/ambient/util/ambient_util.cc index 6f2c926..fdae1f3 100644 --- a/ash/ambient/util/ambient_util.cc +++ b/ash/ambient/util/ambient_util.cc
@@ -11,9 +11,10 @@ #include "ash/style/ash_color_provider.h" #include "base/no_destructor.h" #include "third_party/skia/include/core/SkColor.h" +#include "ui/color/color_id.h" +#include "ui/color/color_provider.h" #include "ui/gfx/color_palette.h" #include "ui/gfx/shadow_value.h" -#include "ui/native_theme/native_theme.h" namespace ash { namespace ambient { @@ -50,8 +51,8 @@ return *font_list; } -gfx::ShadowValues GetTextShadowValues(const ui::NativeTheme* theme) { - // If the theme does not exist the shadow values are being created in +gfx::ShadowValues GetTextShadowValues(const ui::ColorProvider* color_provider) { + // If `color_provider` does not exist the shadow values are being created in // order to calculate margins. In that case the color plays no role so set it // to gfx::kPlaceholderColor. // Currently an elevation of 2 falls back to MakeMdShadowValues so use @@ -60,8 +61,8 @@ // |key_shadow_color| and |ambient_shadow_color|. // TODO(elainechien): crbug.com/1056950 SkColor shadow_base_color = - theme ? theme->GetSystemColor(ui::NativeTheme::kColorId_ShadowBase) - : gfx::kPlaceholderColor; + color_provider ? color_provider->GetColor(ui::kColorShadowBase) + : gfx::kPlaceholderColor; return gfx::ShadowValue::MakeShadowValues( kTextShadowElevation, shadow_base_color, shadow_base_color); }
diff --git a/ash/ambient/util/ambient_util.h b/ash/ambient/util/ambient_util.h index 0640052..32d4d515 100644 --- a/ash/ambient/util/ambient_util.h +++ b/ash/ambient/util/ambient_util.h
@@ -14,7 +14,7 @@ #include "ui/gfx/shadow_value.h" namespace ui { -class NativeTheme; +class ColorProvider; } namespace ash { @@ -37,7 +37,8 @@ // Returns the default static text shadow for Ambient Mode. |theme| can be a // nullptr if the ShadowValues returned are only used to calculate margins, in // which kPlaceholderColor will be used for the shadow color. -ASH_EXPORT gfx::ShadowValues GetTextShadowValues(const ui::NativeTheme* theme); +ASH_EXPORT gfx::ShadowValues GetTextShadowValues( + const ui::ColorProvider* color_provider); ASH_EXPORT bool IsAmbientModeTopicTypeAllowed(::ambient::TopicType topic);
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index 2f911657..a006c69b 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -533,12 +533,15 @@ <message name="IDS_ASH_STATUS_TRAY_BLUETOOTH_PAIR_NEW_DEVICE" desc="The sub-header label for the button to pair a new device."> Pair new device </message> - <message name="IDS_ASH_STATUS_TRAY_BLUETOOTH_CURRENTLY_CONNECTED_DEVICES" desc="The sub-header label for currently connected devices in Bluetooth device list."> + <message name="IDS_ASH_STATUS_TRAY_BLUETOOTH_CURRENTLY_CONNECTED_DEVICES" desc="The sub-header label for currently connected devices in the Bluetooth device list."> Currently connected </message> - <message name="IDS_ASH_STATUS_TRAY_BLUETOOTH_PREVIOUSLY_CONNECTED_DEVICES" desc="The sub-header label for previously connected devices in Bluetooth device list."> + <message name="IDS_ASH_STATUS_TRAY_BLUETOOTH_PREVIOUSLY_CONNECTED_DEVICES" desc="The sub-header label for previously connected devices in the Bluetooth device list."> Previously connected </message> + <message name="IDS_ASH_STATUS_TRAY_BLUETOOTH_NO_DEVICE_CONNECTED" desc="The sub-header label for no devices connected in the Bluetooth device list."> + No device connected + </message> <message name="IDS_ASH_STATUS_TRAY_UPDATE" desc="The label used in the tray popup to notify that the user should restart to get system updates."> Restart to update
diff --git a/ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_BLUETOOTH_NO_DEVICE_CONNECTED.png.sha1 b/ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_BLUETOOTH_NO_DEVICE_CONNECTED.png.sha1 new file mode 100644 index 0000000..7f7df6d --- /dev/null +++ b/ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_BLUETOOTH_NO_DEVICE_CONNECTED.png.sha1
@@ -0,0 +1 @@ +1087627139c0d0fa0010136ab561cc32462988fd \ No newline at end of file
diff --git a/ash/capture_mode/capture_mode_session.cc b/ash/capture_mode/capture_mode_session.cc index 3dac930..d8bf21e 100644 --- a/ash/capture_mode/capture_mode_session.cc +++ b/ash/capture_mode/capture_mode_session.cc
@@ -34,6 +34,7 @@ #include "ui/aura/client/capture_client.h" #include "ui/aura/env.h" #include "ui/aura/window.h" +#include "ui/aura/window_delegate.h" #include "ui/aura/window_tracker.h" #include "ui/base/cursor/cursor_factory.h" #include "ui/base/cursor/cursor_util.h" @@ -1258,6 +1259,11 @@ !(capture_mode_settings_widget_ && capture_mode_settings_widget_->GetWindowBoundsInScreen().Contains( screen_location))) { + if (capture_mode_settings_widget_ && + located_press_event_on_settings_menu_) { + capture_mode_settings_widget_->GetNativeWindow()->delegate()->OnEvent( + event); + } event->SetHandled(); event->StopPropagation(); } @@ -1278,6 +1284,8 @@ switch (event->type()) { case ui::ET_MOUSE_PRESSED: case ui::ET_TOUCH_PRESSED: + if (is_event_on_settings_menu) + located_press_event_on_settings_menu_ = true; old_mouse_warp_status_ = SetMouseWarpEnabled(false); OnLocatedEventPressed(location_in_root, is_touch, is_event_on_capture_bar_or_menu); @@ -1294,6 +1302,7 @@ old_mouse_warp_status_.reset(); OnLocatedEventReleased(is_event_on_capture_bar_or_menu, region_intersects_capture_bar); + located_press_event_on_settings_menu_ = false; break; case ui::ET_MOUSE_MOVED: if (region_intersects_capture_bar) {
diff --git a/ash/capture_mode/capture_mode_session.h b/ash/capture_mode/capture_mode_session.h index 4f5bf51..d31c4cb 100644 --- a/ash/capture_mode/capture_mode_session.h +++ b/ash/capture_mode/capture_mode_session.h
@@ -387,6 +387,14 @@ // is done. CaptureModeAdvancedSettingsView* capture_mode_advanced_settings_view_ = nullptr; + + // This helps indicating whether located events should be handled by the + // capture mode settings menu view or the capture mode Pre-EventHandler. When + // it's true, settings menu view should handle the event. Set it to true when + // the event is a press event and is located on the settings menu view. Set it + // to false when the event is a release event and "event_on_settings_menu_" is + // true. + bool located_press_event_on_settings_menu_ = false; }; } // namespace ash
diff --git a/ash/public/cpp/external_arc/BUILD.gn b/ash/public/cpp/external_arc/BUILD.gn index 98ee0e5..242f62d 100644 --- a/ash/public/cpp/external_arc/BUILD.gn +++ b/ash/public/cpp/external_arc/BUILD.gn
@@ -49,6 +49,7 @@ "//ui/accessibility:accessibility", "//ui/accessibility:ax_base", "//ui/aura", + "//ui/color", "//ui/message_center", "//ui/views", "//ui/wm",
diff --git a/ash/public/cpp/external_arc/message_center/arc_notification_content_view.cc b/ash/public/cpp/external_arc/message_center/arc_notification_content_view.cc index 5cba3428..405599ac 100644 --- a/ash/public/cpp/external_arc/message_center/arc_notification_content_view.cc +++ b/ash/public/cpp/external_arc/message_center/arc_notification_content_view.cc
@@ -20,6 +20,8 @@ #include "ui/accessibility/ax_node_data.h" #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/layer.h" #include "ui/compositor/layer_animation_observer.h" #include "ui/compositor/layer_tree_owner.h" @@ -563,8 +565,8 @@ return; mask_insets_ = new_insets; - SkColor color = GetNativeTheme()->GetSystemColor( - ui::NativeTheme::kColorId_NotificationBackground); + SkColor color = + GetColorProvider()->GetColor(ui::kColorNotificationBackgroundInactive); if (ash::features::IsNotificationsRefreshEnabled()) color = SK_ColorTRANSPARENT;
diff --git a/ash/public/cpp/external_arc/message_center/arc_notification_view.cc b/ash/public/cpp/external_arc/message_center/arc_notification_view.cc index 75a3aa2..dcef32f 100644 --- a/ash/public/cpp/external_arc/message_center/arc_notification_view.cc +++ b/ash/public/cpp/external_arc/message_center/arc_notification_view.cc
@@ -16,6 +16,8 @@ #include "ui/base/ime/input_method.h" #include "ui/base/ime/text_input_client.h" #include "ui/base/ime/text_input_type.h" +#include "ui/color/color_id.h" +#include "ui/color/color_provider.h" #include "ui/gfx/geometry/size.h" #include "ui/message_center/public/cpp/message_center_constants.h" #include "ui/message_center/views/notification_background_painter.h" @@ -168,8 +170,7 @@ void ArcNotificationView::OnThemeChanged() { message_center::MessageView::OnThemeChanged(); focus_painter_ = views::Painter::CreateSolidFocusPainter( - GetNativeTheme()->GetSystemColor( - ui::NativeTheme::kColorId_FocusedBorderColor), + GetColorProvider()->GetColor(ui::kColorFocusableBorderFocused), gfx::Insets(0, 1, 3, 2)); }
diff --git a/ash/shelf/shelf_tooltip_preview_bubble.cc b/ash/shelf/shelf_tooltip_preview_bubble.cc index b4efaac..13f6326c 100644 --- a/ash/shelf/shelf_tooltip_preview_bubble.cc +++ b/ash/shelf/shelf_tooltip_preview_bubble.cc
@@ -54,10 +54,8 @@ kTooltipPaddingBottom, kTooltipPaddingLeftRight), kPreviewPadding)); - const ui::NativeTheme* theme = anchor_widget()->GetNativeTheme(); - for (auto* window : windows) { - WindowPreview* preview = new WindowPreview(window, this, theme); + WindowPreview* preview = new WindowPreview(window, this); AddChildView(preview); previews_.push_back(preview); }
diff --git a/ash/shelf/window_preview.cc b/ash/shelf/window_preview.cc index e31f8216d..fd2549b 100644 --- a/ash/shelf/window_preview.cc +++ b/ash/shelf/window_preview.cc
@@ -10,6 +10,8 @@ #include "ash/wm/window_util.h" #include "base/bind.h" #include "ui/aura/window.h" +#include "ui/color/color_id.h" +#include "ui/color/color_provider.h" #include "ui/gfx/color_palette.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/views/background.h" @@ -34,9 +36,7 @@ SkColorSetA(gfx::kGoogleGrey100, 0x24); constexpr int kPreviewBorderRadius = 4; -WindowPreview::WindowPreview(aura::Window* window, - Delegate* delegate, - const ui::NativeTheme* theme) +WindowPreview::WindowPreview(aura::Window* window, Delegate* delegate) : delegate_(delegate) { preview_view_ = new WindowPreviewView(window, /*trilinear_filtering_on_init=*/false); @@ -52,8 +52,6 @@ AddChildView(preview_view_); AddChildView(title_); AddChildView(close_button_); - - SetStyling(theme); } WindowPreview::~WindowPreview() = default; @@ -136,11 +134,12 @@ return "WindowPreview"; } -void WindowPreview::SetStyling(const ui::NativeTheme* theme) { +void WindowPreview::OnThemeChanged() { + const auto* color_provider = GetColorProvider(); SkColor background_color = - theme->GetSystemColor(ui::NativeTheme::kColorId_TooltipBackground); + color_provider->GetColor(ui::kColorTooltipBackground); title_->SetEnabledColor( - theme->GetSystemColor(ui::NativeTheme::kColorId_TooltipText)); + color_provider->GetColor(ui::kColorTooltipForeground)); title_->SetBackgroundColor(background_color); // The background is not opaque, so we can't do subpixel rendering.
diff --git a/ash/shelf/window_preview.h b/ash/shelf/window_preview.h index 16bc06c2..5b50be54 100644 --- a/ash/shelf/window_preview.h +++ b/ash/shelf/window_preview.h
@@ -42,9 +42,7 @@ virtual ~Delegate() {} }; - WindowPreview(aura::Window* window, - Delegate* delegate, - const ui::NativeTheme* theme); + WindowPreview(aura::Window* window, Delegate* delegate); WindowPreview(const WindowPreview&) = delete; WindowPreview& operator=(const WindowPreview&) = delete; @@ -56,12 +54,11 @@ void Layout() override; bool OnMousePressed(const ui::MouseEvent& event) override; const char* GetClassName() const override; + void OnThemeChanged() override; const WindowPreviewView* preview_view() const { return preview_view_; } private: - void SetStyling(const ui::NativeTheme* theme); - // All the preview containers have the same size. gfx::Size GetPreviewContainerSize() const;
diff --git a/ash/system/bluetooth/bluetooth_detailed_view_controller.cc b/ash/system/bluetooth/bluetooth_detailed_view_controller.cc index 9782dd99..c86f4f9 100644 --- a/ash/system/bluetooth/bluetooth_detailed_view_controller.cc +++ b/ash/system/bluetooth/bluetooth_detailed_view_controller.cc
@@ -12,6 +12,7 @@ #include "ash/system/model/system_tray_model.h" #include "base/check.h" #include "chromeos/services/bluetooth_config/public/cpp/cros_bluetooth_config_util.h" +#include "mojo/public/cpp/bindings/clone_traits.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/l10n/l10n_util.h" #include "ui/views/view.h" @@ -19,6 +20,7 @@ namespace ash { namespace { using chromeos::bluetooth_config::IsBluetoothEnabledOrEnabling; +using chromeos::bluetooth_config::mojom::DeviceConnectionState; } // namespace BluetoothDetailedViewController::BluetoothDetailedViewController( @@ -45,6 +47,11 @@ bluetooth_detailed_view.get()); BluetoothEnabledStateChanged(); + if (IsBluetoothEnabledOrEnabling(system_state_)) { + device_list_controller_->UpdateDeviceList(connected_devices_, + previously_connected_devices_); + } + // We are expected to return an unowned pointer that the caller is responsible // for deleting. return bluetooth_detailed_view.release()->GetAsView(); @@ -64,6 +71,22 @@ if (has_bluetooth_enabled_state_changed) BluetoothEnabledStateChanged(); + + connected_devices_.clear(); + previously_connected_devices_.clear(); + + for (auto& paired_device : properties->paired_devices) { + if (paired_device->device_properties->connection_state == + DeviceConnectionState::kConnected) { + connected_devices_.push_back(std::move(paired_device)); + } else { + previously_connected_devices_.push_back(std::move(paired_device)); + } + } + if (device_list_controller_ && IsBluetoothEnabledOrEnabling(system_state_)) { + device_list_controller_->UpdateDeviceList(connected_devices_, + previously_connected_devices_); + } } void BluetoothDetailedViewController::OnToggleClicked(bool new_state) {
diff --git a/ash/system/bluetooth/bluetooth_detailed_view_controller.h b/ash/system/bluetooth/bluetooth_detailed_view_controller.h index 412d961d..b4ee723 100644 --- a/ash/system/bluetooth/bluetooth_detailed_view_controller.h +++ b/ash/system/bluetooth/bluetooth_detailed_view_controller.h
@@ -7,6 +7,7 @@ #include <memory> #include <string> +#include <vector> #include "ash/ash_export.h" #include "ash/system/bluetooth/bluetooth_detailed_view.h" @@ -41,6 +42,10 @@ const BluetoothDetailedViewController&) = delete; ~BluetoothDetailedViewController() override; + protected: + using PairedBluetoothDevicePropertiesPtrs = std::vector< + chromeos::bluetooth_config::mojom::PairedBluetoothDevicePropertiesPtr>; + private: // DetailedViewControllerBase: views::View* CreateView() override; @@ -73,6 +78,8 @@ chromeos::bluetooth_config::mojom::BluetoothSystemState::kUnavailable; tray::BluetoothDetailedView* view_ = nullptr; std::unique_ptr<BluetoothDeviceListController> device_list_controller_; + PairedBluetoothDevicePropertiesPtrs connected_devices_; + PairedBluetoothDevicePropertiesPtrs previously_connected_devices_; }; } // namespace ash
diff --git a/ash/system/bluetooth/bluetooth_detailed_view_controller_unittest.cc b/ash/system/bluetooth/bluetooth_detailed_view_controller_unittest.cc index 5fa4c51..dc06172c 100644 --- a/ash/system/bluetooth/bluetooth_detailed_view_controller_unittest.cc +++ b/ash/system/bluetooth/bluetooth_detailed_view_controller_unittest.cc
@@ -5,6 +5,7 @@ #include "ash/system/bluetooth/bluetooth_detailed_view_controller.h" #include <memory> +#include <vector> #include "ash/constants/ash_features.h" #include "ash/public/cpp/test/test_system_tray_client.h" @@ -17,15 +18,21 @@ #include "base/run_loop.h" #include "base/test/scoped_feature_list.h" #include "chromeos/services/bluetooth_config/fake_adapter_state_controller.h" +#include "chromeos/services/bluetooth_config/fake_device_cache.h" #include "chromeos/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom.h" #include "chromeos/services/bluetooth_config/scoped_bluetooth_config_test_helper.h" +#include "mojo/public/cpp/bindings/clone_traits.h" namespace ash { namespace tray { namespace { using chromeos::bluetooth_config::AdapterStateController; +using chromeos::bluetooth_config::mojom::BluetoothDeviceProperties; using chromeos::bluetooth_config::mojom::BluetoothSystemState; +using chromeos::bluetooth_config::mojom::DeviceConnectionState; +using chromeos::bluetooth_config::mojom::PairedBluetoothDeviceProperties; +using chromeos::bluetooth_config::mojom::PairedBluetoothDevicePropertiesPtr; class FakeBluetoothDetailedViewFactory : public BluetoothDetailedView::Factory { public: @@ -121,6 +128,22 @@ ->GetAdapterState(); } + PairedBluetoothDevicePropertiesPtr CreatePairedDevice( + DeviceConnectionState connection_state) { + PairedBluetoothDevicePropertiesPtr paired_properties = + PairedBluetoothDeviceProperties::New(); + paired_properties->device_properties = BluetoothDeviceProperties::New(); + paired_properties->device_properties->connection_state = connection_state; + return paired_properties; + } + + void SetPairedDevices( + std::vector<PairedBluetoothDevicePropertiesPtr> paired_devices) { + scoped_bluetooth_config_test_helper_.fake_device_cache()->SetPairedDevices( + std::move(paired_devices)); + base::RunLoop().RunUntilIdle(); + } + void SetBluetoothAdapterState(BluetoothSystemState system_state) { scoped_bluetooth_config_test_helper_.fake_adapter_state_controller() ->SetSystemState(system_state); @@ -200,5 +223,28 @@ EXPECT_EQ(1, GetSystemTrayClient()->show_bluetooth_pairing_dialog_count()); } +TEST_F(BluetoothDetailedViewControllerTest, + CorrectlySplitsDevicesByConnectionState) { + std::vector<PairedBluetoothDevicePropertiesPtr> paired_devices; + paired_devices.push_back( + CreatePairedDevice(DeviceConnectionState::kNotConnected)); + paired_devices.push_back( + CreatePairedDevice(DeviceConnectionState::kConnecting)); + paired_devices.push_back( + CreatePairedDevice(DeviceConnectionState::kConnected)); + + EXPECT_EQ(0u, bluetooth_device_list_controller()->connected_devices_count()); + EXPECT_EQ( + 0u, + bluetooth_device_list_controller()->previously_connected_devices_count()); + + SetPairedDevices(std::move(paired_devices)); + + EXPECT_EQ(1u, bluetooth_device_list_controller()->connected_devices_count()); + EXPECT_EQ( + 2u, + bluetooth_device_list_controller()->previously_connected_devices_count()); +} + } // namespace tray } // namespace ash
diff --git a/ash/system/bluetooth/bluetooth_detailed_view_impl.cc b/ash/system/bluetooth/bluetooth_detailed_view_impl.cc index 9a4f6c1..5529751 100644 --- a/ash/system/bluetooth/bluetooth_detailed_view_impl.cc +++ b/ash/system/bluetooth/bluetooth_detailed_view_impl.cc
@@ -97,6 +97,11 @@ return scroll_content(); } +void BluetoothDetailedViewImpl::HandleViewClicked(views::View* view) { + delegate()->OnDeviceListItemSelected( + static_cast<BluetoothDeviceListItemView*>(view)->device_properties()); +} + const char* BluetoothDetailedViewImpl::GetClassName() const { return "BluetoothDetailedViewImpl"; }
diff --git a/ash/system/bluetooth/bluetooth_detailed_view_impl.h b/ash/system/bluetooth/bluetooth_detailed_view_impl.h index ebd4e1bb..b12f8b7 100644 --- a/ash/system/bluetooth/bluetooth_detailed_view_impl.h +++ b/ash/system/bluetooth/bluetooth_detailed_view_impl.h
@@ -58,6 +58,9 @@ void NotifyDeviceListChanged() override; views::View* device_list() override; + // TrayDetailedView: + void HandleViewClicked(views::View* view) override; + // views::View: const char* GetClassName() const override;
diff --git a/ash/system/bluetooth/bluetooth_detailed_view_unittest.cc b/ash/system/bluetooth/bluetooth_detailed_view_unittest.cc index 6271baf50..40f3640 100644 --- a/ash/system/bluetooth/bluetooth_detailed_view_unittest.cc +++ b/ash/system/bluetooth/bluetooth_detailed_view_unittest.cc
@@ -10,6 +10,7 @@ #include "ash/public/cpp/test/test_system_tray_client.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/bluetooth/bluetooth_detailed_view_impl.h" +#include "ash/system/bluetooth/bluetooth_device_list_item_view.h" #include "ash/system/bluetooth/bluetooth_disabled_detailed_view.h" #include "ash/system/tray/detailed_view_delegate.h" #include "ash/system/unified/top_shortcut_button.h" @@ -35,6 +36,9 @@ namespace tray { namespace { +const std::string kDeviceNickname = "mau5"; + +using chromeos::bluetooth_config::mojom::PairedBluetoothDeviceProperties; using chromeos::bluetooth_config::mojom::PairedBluetoothDevicePropertiesPtr; class FakeBluetoothDetailedViewDelegate @@ -294,5 +298,28 @@ EXPECT_EQ(view_center, button_center.y()); } +TEST_F(BluetoothDetailedViewTest, SelectingDeviceListItemNotifiesDelegate) { + bluetooth_detailed_view()->UpdateBluetoothEnabledState(true); + + PairedBluetoothDevicePropertiesPtr paired_properties = + PairedBluetoothDeviceProperties::New(); + paired_properties->nickname = kDeviceNickname; + + BluetoothDeviceListItemView* device_list_item = + bluetooth_detailed_view()->AddDeviceListItem(); + device_list_item->UpdateDeviceProperties(paired_properties); + + bluetooth_detailed_view()->NotifyDeviceListChanged(); + + EXPECT_FALSE( + bluetooth_detailed_view_delegate()->last_device_list_item_selected()); + ClickOnAndWait(device_list_item); + EXPECT_TRUE( + bluetooth_detailed_view_delegate()->last_device_list_item_selected()); + EXPECT_EQ(kDeviceNickname, bluetooth_detailed_view_delegate() + ->last_device_list_item_selected() + ->nickname); +} + } // namespace tray } // namespace ash
diff --git a/ash/system/bluetooth/bluetooth_device_list_controller_impl.cc b/ash/system/bluetooth/bluetooth_device_list_controller_impl.cc index 695fef46..3d55c68e 100644 --- a/ash/system/bluetooth/bluetooth_device_list_controller_impl.cc +++ b/ash/system/bluetooth/bluetooth_device_list_controller_impl.cc
@@ -7,12 +7,35 @@ #include "ash/constants/ash_features.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/bluetooth/bluetooth_detailed_view.h" +#include "ash/system/bluetooth/bluetooth_device_list_item_view.h" +#include "ash/system/tray/tray_popup_utils.h" #include "ash/system/tray/tri_view.h" #include "base/check.h" #include "ui/gfx/paint_vector_icon.h" +#include "ui/views/controls/separator.h" #include "ui/views/view.h" namespace ash { +namespace { + +// Helper function to remove |*view| from its view hierarchy, delete the view, +// and reset the value of |*view| to be |nullptr|. +template <class T> +void RemoveAndResetViewIfExists(T** view) { + DCHECK(view); + + if (!*view) + return; + + views::View* parent = (*view)->parent(); + + if (parent) { + parent->RemoveChildViewT(*view); + *view = nullptr; + } +} + +} // namespace BluetoothDeviceListControllerImpl::BluetoothDeviceListControllerImpl( tray::BluetoothDetailedView* bluetooth_detailed_view) @@ -20,10 +43,19 @@ DCHECK(ash::features::IsBluetoothRevampEnabled()); } +BluetoothDeviceListControllerImpl::~BluetoothDeviceListControllerImpl() = + default; + void BluetoothDeviceListControllerImpl::UpdateBluetoothEnabledState( bool enabled) { - if (is_bluetooth_enabled_ && !enabled) + if (is_bluetooth_enabled_ && !enabled) { + device_id_to_view_map_.clear(); + device_list_separator_ = nullptr; + connected_sub_header_ = nullptr; + no_device_connected_sub_header_ = nullptr; + previously_connected_sub_header_ = nullptr; bluetooth_detailed_view_->device_list()->RemoveAllChildViews(); + } is_bluetooth_enabled_ = enabled; } @@ -31,16 +63,89 @@ const PairedBluetoothDevicePropertiesPtrs& connected, const PairedBluetoothDevicePropertiesPtrs& previously_connected) { DCHECK(is_bluetooth_enabled_); - currently_connected_devices_sub_header_ = AddOrReorderSubHeader( - currently_connected_devices_sub_header_, - IDS_ASH_STATUS_TRAY_BLUETOOTH_CURRENTLY_CONNECTED_DEVICES, 1); - previously_connected_devices_sub_header_ = AddOrReorderSubHeader( - previously_connected_devices_sub_header_, - IDS_ASH_STATUS_TRAY_BLUETOOTH_PREVIOUSLY_CONNECTED_DEVICES, 2); + + // This function will create views for new devices, re-use views for existing + // devices, and remove views for devices that no longer exist. To do this, we + // keep track of all the preexisting views in |previous_views|, removing a + // view from this map when the corresponding device is found in |connected| or + // |previously_connected|. Before returning, any view remaining in + // |previous_views| is no longer needed and is deleted. + base::flat_map<std::string, BluetoothDeviceListItemView*> previous_views = + std::move(device_id_to_view_map_); + device_id_to_view_map_.clear(); + + // Since we re-use views when possible, we need to re-order them to match the + // order of the devices we are provided with. We use |index| to keep track of + // the next index within the device list where a view should be placed, i.e. + // all views before |index| are in their final position. + int index = 0; + + // The list of connected devices. + if (!connected.empty()) { + connected_sub_header_ = CreateSubHeaderIfMissingAndReorder( + connected_sub_header_, + IDS_ASH_STATUS_TRAY_BLUETOOTH_CURRENTLY_CONNECTED_DEVICES, index); + + // Increment |index| since this position was taken by + // |connected_sub_header_|. + index++; + + index = CreateViewsIfMissingAndReorder(connected, &previous_views, index); + } else { + RemoveAndResetViewIfExists(&connected_sub_header_); + } + + // The separator between the connected and previously connected devices. + if (!connected.empty() && !previously_connected.empty()) { + if (!device_list_separator_) { + device_list_separator_ = + bluetooth_detailed_view_->device_list()->AddChildView( + TrayPopupUtils::CreateListSubHeaderSeparator()); + } + bluetooth_detailed_view_->device_list()->ReorderChildView( + device_list_separator_, index); + + // Increment |index| since this position was taken by + // |device_list_separator_|. + index++; + } else { + RemoveAndResetViewIfExists(&device_list_separator_); + } + + // The previously connected devices. + if (!previously_connected.empty()) { + previously_connected_sub_header_ = CreateSubHeaderIfMissingAndReorder( + previously_connected_sub_header_, + IDS_ASH_STATUS_TRAY_BLUETOOTH_PREVIOUSLY_CONNECTED_DEVICES, index); + + // Increment |index| since this position was taken by + // |previously_connected_sub_header_|. + index++; + + // Ignore the returned index since we are now done re-ordering the list. + CreateViewsIfMissingAndReorder(previously_connected, &previous_views, + index); + } else { + RemoveAndResetViewIfExists(&previously_connected_sub_header_); + } + + // The header when there are no connected or previously connected devices. + if (device_id_to_view_map_.empty()) { + no_device_connected_sub_header_ = CreateSubHeaderIfMissingAndReorder( + no_device_connected_sub_header_, + IDS_ASH_STATUS_TRAY_BLUETOOTH_NO_DEVICE_CONNECTED, index); + } else { + RemoveAndResetViewIfExists(&no_device_connected_sub_header_); + } + + for (const auto& id_and_view : previous_views) { + bluetooth_detailed_view_->device_list()->RemoveChildViewT( + id_and_view.second); + } bluetooth_detailed_view_->NotifyDeviceListChanged(); } -TriView* BluetoothDeviceListControllerImpl::AddOrReorderSubHeader( +TriView* BluetoothDeviceListControllerImpl::CreateSubHeaderIfMissingAndReorder( TriView* sub_header, int text_id, int index) { @@ -52,4 +157,34 @@ return sub_header; } +int BluetoothDeviceListControllerImpl::CreateViewsIfMissingAndReorder( + const PairedBluetoothDevicePropertiesPtrs& device_property_list, + base::flat_map<std::string, BluetoothDeviceListItemView*>* previous_views, + int index) { + DCHECK(previous_views); + + BluetoothDeviceListItemView* device_view = nullptr; + + for (const auto& device_properties : device_property_list) { + const std::string& device_id = device_properties->device_properties->id; + auto it = previous_views->find(device_id); + + if (it == previous_views->end()) { + device_view = bluetooth_detailed_view_->AddDeviceListItem(); + } else { + device_view = it->second; + previous_views->erase(it); + } + device_id_to_view_map_.emplace(device_id, device_view); + + device_view->UpdateDeviceProperties(device_properties); + bluetooth_detailed_view_->device_list()->ReorderChildView(device_view, + index); + + // Increment |index| since this position was taken by |device_view|. + index++; + } + return index; +} + } // namespace ash
diff --git a/ash/system/bluetooth/bluetooth_device_list_controller_impl.h b/ash/system/bluetooth/bluetooth_device_list_controller_impl.h index 687a047..787747a 100644 --- a/ash/system/bluetooth/bluetooth_device_list_controller_impl.h +++ b/ash/system/bluetooth/bluetooth_device_list_controller_impl.h
@@ -5,15 +5,24 @@ #ifndef ASH_SYSTEM_BLUETOOTH_BLUETOOTH_DEVICE_LIST_CONTROLLER_IMPL_H_ #define ASH_SYSTEM_BLUETOOTH_BLUETOOTH_DEVICE_LIST_CONTROLLER_IMPL_H_ +#include <string> +#include <vector> + #include "ash/ash_export.h" #include "ash/system/bluetooth/bluetooth_device_list_controller.h" +#include "base/containers/flat_map.h" #include "chromeos/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom.h" +namespace views { +class Separator; +} // namespace views + namespace ash { namespace tray { class BluetoothDetailedView; } // namespace tray +class BluetoothDeviceListItemView; class TriView; // BluetoothDeviceListController implementation. @@ -26,25 +35,44 @@ delete; BluetoothDeviceListControllerImpl& operator=( const BluetoothDeviceListControllerImpl&) = delete; - ~BluetoothDeviceListControllerImpl() override = default; + ~BluetoothDeviceListControllerImpl() override; private: + friend class BluetoothDeviceListControllerTest; + // BluetoothDeviceListController: void UpdateBluetoothEnabledState(bool enabled) override; void UpdateDeviceList( const PairedBluetoothDevicePropertiesPtrs& connected, const PairedBluetoothDevicePropertiesPtrs& previously_connected) override; - // Adds a new sub-header with |text_id| if |sub_header| is |nullptr|, - // otherwise reuses |sub_header|. Whichever sub-header used is then reordered - // to |index| and returned. - TriView* AddOrReorderSubHeader(TriView* sub_header, int text_id, int index); + // Creates a sub-header with text represented by the |text_id| message ID when + // |sub_header| is |nullptr|, otherwise uses the provided |sub_header|. The + // used sub-header is then moved to index |index| within the device list and + // returned. + TriView* CreateSubHeaderIfMissingAndReorder(TriView* sub_header, + int text_id, + int index); + + // Creates and initializes a view for each of the device properties within + // |device_property_list| if a view does not already exist, otherwise re-using + // the existing view to avoid disrupting a11y. Each view will be reordered to + // start at |index| and will be removed from |previous_views|. The index of + // the position after the final view that was added is returned. + int CreateViewsIfMissingAndReorder( + const PairedBluetoothDevicePropertiesPtrs& device_property_list, + base::flat_map<std::string, BluetoothDeviceListItemView*>* previous_views, + int index); tray::BluetoothDetailedView* bluetooth_detailed_view_; bool is_bluetooth_enabled_ = false; - TriView* currently_connected_devices_sub_header_ = nullptr; - TriView* previously_connected_devices_sub_header_ = nullptr; + base::flat_map<std::string, BluetoothDeviceListItemView*> + device_id_to_view_map_; + views::Separator* device_list_separator_ = nullptr; + TriView* connected_sub_header_ = nullptr; + TriView* no_device_connected_sub_header_ = nullptr; + TriView* previously_connected_sub_header_ = nullptr; }; } // namespace ash
diff --git a/ash/system/bluetooth/bluetooth_device_list_controller_unittest.cc b/ash/system/bluetooth/bluetooth_device_list_controller_unittest.cc index 43af681d..f619098 100644 --- a/ash/system/bluetooth/bluetooth_device_list_controller_unittest.cc +++ b/ash/system/bluetooth/bluetooth_device_list_controller_unittest.cc
@@ -5,14 +5,35 @@ #include "ash/system/bluetooth/bluetooth_device_list_controller_impl.h" #include <memory> +#include <string> +#include <vector> #include "ash/constants/ash_features.h" +#include "ash/strings/grit/ash_strings.h" #include "ash/system/bluetooth/bluetooth_detailed_view.h" +#include "ash/system/bluetooth/bluetooth_device_list_item_view.h" #include "ash/system/bluetooth/fake_bluetooth_detailed_view.h" +#include "ash/system/tray/tri_view.h" #include "ash/test/ash_test_base.h" #include "base/test/scoped_feature_list.h" +#include "chromeos/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/views/controls/label.h" +#include "ui/views/controls/separator.h" namespace ash { +namespace { + +using chromeos::bluetooth_config::mojom::BluetoothDeviceProperties; +using chromeos::bluetooth_config::mojom::DeviceConnectionState; +using chromeos::bluetooth_config::mojom::PairedBluetoothDeviceProperties; +using chromeos::bluetooth_config::mojom::PairedBluetoothDevicePropertiesPtr; + +const char kDeviceId1[] = "/device/id/1"; +const char kDeviceId2[] = "/device/id/2"; +const char kDeviceNickname[] = "mau5"; + +} // namespace class BluetoothDeviceListControllerTest : public AshTestBase { public: @@ -30,15 +51,140 @@ void TearDown() override { AshTestBase::TearDown(); } - tray::BluetoothDetailedView* bluetooth_detailed_view() { - return fake_bluetooth_detailed_view_.get(); + const TriView* FindConnectedSubHeader() { + return FindSubHeaderWithText(l10n_util::GetStringUTF16( + IDS_ASH_STATUS_TRAY_BLUETOOTH_CURRENTLY_CONNECTED_DEVICES)); + } + + const TriView* FindPreviouslyConnectedSubHeader() { + return FindSubHeaderWithText(l10n_util::GetStringUTF16( + IDS_ASH_STATUS_TRAY_BLUETOOTH_PREVIOUSLY_CONNECTED_DEVICES)); + } + + const TriView* FindNoDeviceConnectedSubHeader() { + return FindSubHeaderWithText(l10n_util::GetStringUTF16( + IDS_ASH_STATUS_TRAY_BLUETOOTH_NO_DEVICE_CONNECTED)); + } + + const views::Separator* FindSeparator() { + for (const auto* view : device_list()->children()) { + if (!std::strcmp("Separator", view->GetClassName())) + return static_cast<const views::Separator*>(view); + } + return nullptr; + } + + PairedBluetoothDevicePropertiesPtr BuildDeviceProperties( + const std::string& id) { + PairedBluetoothDevicePropertiesPtr device_properties = + PairedBluetoothDeviceProperties::New(); + device_properties->device_properties = BluetoothDeviceProperties::New(); + device_properties->device_properties->id = id; + return device_properties; + } + + const std::u16string& GetSubHeaderText(const TriView* sub_header) { + EXPECT_TRUE(sub_header); + EXPECT_EQ(1u, sub_header->children().at(1)->children().size()); + return static_cast<views::Label*>( + sub_header->children().at(1)->children().at(0)) + ->GetText(); + } + + const char* GetDeviceId(const BluetoothDeviceListItemView* device_item_view) { + return device_item_view->device_properties()->device_properties->id.c_str(); + } + + const BluetoothDeviceListItemView* GetFirstDeviceView() { + EXPECT_LT(1u, device_list()->children().size()); + return static_cast<BluetoothDeviceListItemView*>( + device_list()->children().at(1)); + } + + void CheckDeviceListOrdering(size_t connected_device_count, + size_t previously_connected_device_count) { + if (connected_device_count && previously_connected_device_count) { + const TriView* connected_sub_header = FindConnectedSubHeader(); + const TriView* previously_connected_sub_header = + FindPreviouslyConnectedSubHeader(); + const views::Separator* device_list_separator = FindSeparator(); + + EXPECT_TRUE(connected_sub_header); + EXPECT_TRUE(previously_connected_sub_header); + EXPECT_TRUE(device_list_separator); + + const unsigned int connected_index = + device_list()->GetIndexOf(connected_sub_header); + const unsigned int previously_connected_index = + device_list()->GetIndexOf(previously_connected_sub_header); + const unsigned int separator_index = + device_list()->GetIndexOf(device_list_separator); + + EXPECT_EQ(0u, connected_index); + EXPECT_EQ(connected_device_count + 1, separator_index); + EXPECT_EQ(separator_index + 1, previously_connected_index); + return; + } + + if (connected_device_count) { + const TriView* connected_sub_header = FindConnectedSubHeader(); + EXPECT_TRUE(connected_sub_header); + EXPECT_EQ(0, device_list()->GetIndexOf(connected_sub_header)); + EXPECT_EQ(connected_device_count + 1, device_list()->children().size()); + return; + } + + if (previously_connected_device_count) { + const TriView* previously_connected_sub_header = + FindPreviouslyConnectedSubHeader(); + EXPECT_TRUE(previously_connected_sub_header); + EXPECT_EQ(0, device_list()->GetIndexOf(previously_connected_sub_header)); + EXPECT_EQ(previously_connected_device_count + 1, + device_list()->children().size()); + return; + } + + const TriView* no_device_connected_sub_header = + FindNoDeviceConnectedSubHeader(); + EXPECT_TRUE(no_device_connected_sub_header); + EXPECT_EQ(0, device_list()->GetIndexOf(no_device_connected_sub_header)); + EXPECT_EQ(1u, device_list()->children().size()); + } + + void CheckNotifyDeviceListChangedCount(size_t call_count) { + EXPECT_EQ(call_count, fake_bluetooth_detailed_view() + ->notify_device_list_changed_call_count()); + } + + views::View* device_list() { + return static_cast<tray::BluetoothDetailedView*>( + fake_bluetooth_detailed_view_.get()) + ->device_list(); } BluetoothDeviceListController* bluetooth_device_list_controller() { return bluetooth_device_list_controller_impl_.get(); } + tray::FakeBluetoothDetailedView* fake_bluetooth_detailed_view() { + return fake_bluetooth_detailed_view_.get(); + } + + protected: + const std::vector<PairedBluetoothDevicePropertiesPtr> empty_list_; + private: + const TriView* FindSubHeaderWithText(const std::u16string text) { + for (const auto* view : device_list()->children()) { + if (std::strcmp("TriView", view->GetClassName())) + continue; + const TriView* sub_header = static_cast<const TriView*>(view); + if (GetSubHeaderText(sub_header) == text) + return sub_header; + } + return nullptr; + } + base::test::ScopedFeatureList feature_list_; std::unique_ptr<tray::FakeBluetoothDetailedView> fake_bluetooth_detailed_view_; @@ -46,8 +192,135 @@ bluetooth_device_list_controller_impl_; }; -TEST_F(BluetoothDeviceListControllerTest, CanConstruct) { - EXPECT_TRUE(true); +TEST_F(BluetoothDeviceListControllerTest, + HasCorrectSubHeaderWithNoPairedDevices) { + CheckNotifyDeviceListChangedCount(/*call_count=*/0u); + + bluetooth_device_list_controller()->UpdateBluetoothEnabledState(true); + bluetooth_device_list_controller()->UpdateDeviceList( + /*connected=*/empty_list_, + /*previously_connected=*/empty_list_); + CheckNotifyDeviceListChangedCount(/*call_count=*/1u); + + EXPECT_EQ(1u, device_list()->children().size()); + + const TriView* no_device_connected_sub_header = + FindNoDeviceConnectedSubHeader(); + EXPECT_TRUE(no_device_connected_sub_header); +} + +TEST_F(BluetoothDeviceListControllerTest, + HasCorrectDeviceListOrderWithPairedDevices) { + CheckNotifyDeviceListChangedCount(/*call_count=*/0u); + + bluetooth_device_list_controller()->UpdateBluetoothEnabledState(true); + + std::vector<PairedBluetoothDevicePropertiesPtr> connected_list; + connected_list.push_back(BuildDeviceProperties(kDeviceId1)); + + bluetooth_device_list_controller()->UpdateDeviceList( + /*connected=*/connected_list, + /*previously_connected=*/empty_list_); + CheckNotifyDeviceListChangedCount(/*call_count=*/1u); + + const TriView* connected_devices_sub_header = FindConnectedSubHeader(); + + EXPECT_EQ(2u, device_list()->children().size()); + EXPECT_STREQ(kDeviceId1, GetDeviceId(GetFirstDeviceView())); + EXPECT_TRUE(connected_devices_sub_header); + + CheckDeviceListOrdering( + /*connected_device_count=*/connected_list.size(), + /*previously_connected_device_count=*/empty_list_.size()); + + std::vector<PairedBluetoothDevicePropertiesPtr> previously_connected_list; + previously_connected_list.push_back(BuildDeviceProperties(kDeviceId2)); + + bluetooth_device_list_controller()->UpdateDeviceList( + /*connected=*/empty_list_, + /*previously_connected=*/previously_connected_list); + CheckNotifyDeviceListChangedCount(/*call_count=*/2u); + + const TriView* previously_connected_devices_sub_header = + FindPreviouslyConnectedSubHeader(); + + EXPECT_EQ(2u, device_list()->children().size()); + EXPECT_STREQ(kDeviceId2, GetDeviceId(GetFirstDeviceView())); + EXPECT_TRUE(previously_connected_devices_sub_header); + + CheckDeviceListOrdering( + /*connected_device_count=*/0, + /*previously_connected_device_count=*/previously_connected_list.size()); + + // "Update" the device list multiple times to be sure that no children are + // duplicated and every child is re-ordered correctly. + for (int i = 0; i < 2; i++) { + bluetooth_device_list_controller()->UpdateDeviceList( + /*connected=*/connected_list, + /*previously_connected=*/previously_connected_list); + } + + CheckNotifyDeviceListChangedCount(/*call_count=*/4u); + + EXPECT_EQ(5u, device_list()->children().size()); + + CheckDeviceListOrdering( + /*connected_device_count=*/connected_list.size(), + /*previously_connected_device_count=*/previously_connected_list.size()); +} + +TEST_F(BluetoothDeviceListControllerTest, ExistingDeviceViewsAreUpdated) { + CheckNotifyDeviceListChangedCount(/*call_count=*/0u); + + bluetooth_device_list_controller()->UpdateBluetoothEnabledState(true); + + std::vector<PairedBluetoothDevicePropertiesPtr> connected_list; + connected_list.push_back(BuildDeviceProperties(kDeviceId1)); + + bluetooth_device_list_controller()->UpdateDeviceList( + /*connected=*/connected_list, + /*previously_connected=*/empty_list_); + CheckNotifyDeviceListChangedCount(/*call_count=*/1u); + + EXPECT_EQ(2u, device_list()->children().size()); + + const BluetoothDeviceListItemView* first_item = GetFirstDeviceView(); + + EXPECT_FALSE(first_item->device_properties()->nickname.has_value()); + + connected_list.at(0)->nickname = kDeviceNickname; + + bluetooth_device_list_controller()->UpdateDeviceList( + /*connected=*/connected_list, + /*previously_connected=*/empty_list_); + CheckNotifyDeviceListChangedCount(/*call_count=*/2u); + + EXPECT_EQ(2u, device_list()->children().size()); + EXPECT_EQ(1, device_list()->GetIndexOf(first_item)); + EXPECT_TRUE(first_item->device_properties()->nickname.has_value()); + EXPECT_STREQ(kDeviceNickname, + first_item->device_properties()->nickname.value().c_str()); +} + +TEST_F(BluetoothDeviceListControllerTest, + DeviceListIsClearedWhenBluetoothBecomesDisabled) { + CheckNotifyDeviceListChangedCount(/*call_count=*/0u); + + bluetooth_device_list_controller()->UpdateBluetoothEnabledState(true); + + std::vector<PairedBluetoothDevicePropertiesPtr> connected_list; + connected_list.push_back(BuildDeviceProperties(kDeviceId1)); + + bluetooth_device_list_controller()->UpdateDeviceList( + /*connected=*/connected_list, + /*previously_connected=*/empty_list_); + CheckNotifyDeviceListChangedCount(/*call_count=*/1u); + + EXPECT_EQ(2u, device_list()->children().size()); + + bluetooth_device_list_controller()->UpdateBluetoothEnabledState(false); + + EXPECT_EQ(0u, device_list()->children().size()); } } // namespace ash
diff --git a/ash/system/bluetooth/bluetooth_device_list_item_view.cc b/ash/system/bluetooth/bluetooth_device_list_item_view.cc index b4abc9bd..f950a9d 100644 --- a/ash/system/bluetooth/bluetooth_device_list_item_view.cc +++ b/ash/system/bluetooth/bluetooth_device_list_item_view.cc
@@ -26,4 +26,8 @@ device_properties_ = mojo::Clone(device_properties); } +const char* BluetoothDeviceListItemView::GetClassName() const { + return "BluetoothDeviceListItemView"; +} + } // namespace ash
diff --git a/ash/system/bluetooth/bluetooth_device_list_item_view.h b/ash/system/bluetooth/bluetooth_device_list_item_view.h index e70b57c..f08d7739 100644 --- a/ash/system/bluetooth/bluetooth_device_list_item_view.h +++ b/ash/system/bluetooth/bluetooth_device_list_item_view.h
@@ -34,6 +34,9 @@ } private: + // views::View: + const char* GetClassName() const override; + chromeos::bluetooth_config::mojom::PairedBluetoothDevicePropertiesPtr device_properties_; };
diff --git a/ash/system/bluetooth/fake_bluetooth_detailed_view.cc b/ash/system/bluetooth/fake_bluetooth_detailed_view.cc index 9f978157..059f2a3c 100644 --- a/ash/system/bluetooth/fake_bluetooth_detailed_view.cc +++ b/ash/system/bluetooth/fake_bluetooth_detailed_view.cc
@@ -6,13 +6,15 @@ #include "ash/system/bluetooth/bluetooth_device_list_item_view.h" #include "ash/system/tray/tri_view.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/views/controls/label.h" namespace ash { namespace tray { FakeBluetoothDetailedView::FakeBluetoothDetailedView(Delegate* delegate) : BluetoothDetailedView(delegate), - device_list_(std::make_unique<views::ScrollView>()) {} + device_list_(std::make_unique<views::View>()) {} FakeBluetoothDetailedView::~FakeBluetoothDetailedView() = default; @@ -30,9 +32,13 @@ } ash::TriView* FakeBluetoothDetailedView::AddDeviceListSubHeader( - const gfx::VectorIcon&, - int) { - return device_list_->AddChildView(new ash::TriView()); + const gfx::VectorIcon& /*icon*/, + int text_id) { + std::unique_ptr<TriView> sub_header = std::make_unique<TriView>(); + sub_header->AddView(TriView::Container::CENTER, + new views::Label(l10n_util::GetStringUTF16(text_id))); + device_list_->AddChildView(sub_header.get()); + return sub_header.release(); } void FakeBluetoothDetailedView::NotifyDeviceListChanged() { @@ -40,7 +46,7 @@ } views::View* FakeBluetoothDetailedView::device_list() { - return device_list_->contents(); + return device_list_.get(); } } // namespace tray
diff --git a/ash/system/bluetooth/fake_bluetooth_detailed_view.h b/ash/system/bluetooth/fake_bluetooth_detailed_view.h index 197bf4d..59745f4 100644 --- a/ash/system/bluetooth/fake_bluetooth_detailed_view.h +++ b/ash/system/bluetooth/fake_bluetooth_detailed_view.h
@@ -11,7 +11,6 @@ #include "ash/system/bluetooth/bluetooth_detailed_view.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/gfx/vector_icon_types.h" -#include "ui/views/controls/scroll_view.h" namespace views { class View; @@ -47,13 +46,13 @@ void UpdateBluetoothEnabledState(bool enabled) override; BluetoothDeviceListItemView* AddDeviceListItem() override; ash::TriView* AddDeviceListSubHeader(const gfx::VectorIcon& /*icon*/, - int /*text_id*/) override; + int text_id) override; void NotifyDeviceListChanged() override; views::View* device_list() override; size_t notify_device_list_changed_call_count_ = 0; absl::optional<bool> last_bluetooth_enabled_state_; - std::unique_ptr<views::ScrollView> device_list_; + std::unique_ptr<views::View> device_list_; }; } // namespace tray
diff --git a/ash/system/message_center/stacked_notification_bar.cc b/ash/system/message_center/stacked_notification_bar.cc index 3f17e2c1..2eae67b 100644 --- a/ash/system/message_center/stacked_notification_bar.cc +++ b/ash/system/message_center/stacked_notification_bar.cc
@@ -14,6 +14,8 @@ #include "ash/system/unified/rounded_label_button.h" #include "base/bind.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/color/color_id.h" +#include "ui/color/color_provider.h" #include "ui/compositor/layer_animation_sequence.h" #include "ui/compositor/layer_animator.h" #include "ui/compositor/scoped_layer_animation_settings.h" @@ -135,7 +137,7 @@ void OnThemeChanged() override { views::ImageView::OnThemeChanged(); - auto* theme = GetNativeTheme(); + const auto* color_provider = GetColorProvider(); auto* notification = message_center::MessageCenter::Get()->FindVisibleNotificationById(id_); @@ -144,14 +146,12 @@ if (!notification) return; - SkColor accent_color = GetNativeTheme()->GetSystemColor( - ui::NativeTheme::kColorId_NotificationDefaultAccentColor); + SkColor accent_color = + color_provider->GetColor(ui::kColorNotificationHeaderForeground); gfx::Image masked_small_icon = notification->GenerateMaskedSmallIcon( kStackedNotificationIconSize, accent_color, - theme->GetSystemColor( - ui::NativeTheme::kColorId_MessageCenterSmallImageMaskBackground), - theme->GetSystemColor( - ui::NativeTheme::kColorId_MessageCenterSmallImageMaskForeground)); + color_provider->GetColor(ui::kColorNotificationIconBackground), + color_provider->GetColor(ui::kColorNotificationIconForeground)); if (masked_small_icon.IsEmpty()) { SetImage(gfx::CreateVectorIcon(message_center::kProductIcon,
diff --git a/ash/system/unified/notification_icons_controller.cc b/ash/system/unified/notification_icons_controller.cc index 268ab38f..1e2c852 100644 --- a/ash/system/unified/notification_icons_controller.cc +++ b/ash/system/unified/notification_icons_controller.cc
@@ -19,6 +19,8 @@ #include "ash/system/unified/unified_system_tray.h" #include "ash/system/unified/unified_system_tray_model.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/color/color_id.h" +#include "ui/color/color_provider.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/message_center/message_center.h" #include "ui/message_center/public/cpp/notification.h" @@ -75,14 +77,12 @@ if (!GetWidget()) return; - auto* theme = GetNativeTheme(); + const auto* color_provider = GetColorProvider(); gfx::Image masked_small_icon = notification->GenerateMaskedSmallIcon( kUnifiedTrayIconSize, TrayIconColor(Shell::Get()->session_controller()->GetSessionState()), - theme->GetSystemColor( - ui::NativeTheme::kColorId_MessageCenterSmallImageMaskBackground), - theme->GetSystemColor( - ui::NativeTheme::kColorId_MessageCenterSmallImageMaskForeground)); + color_provider->GetColor(ui::kColorNotificationIconBackground), + color_provider->GetColor(ui::kColorNotificationIconForeground)); if (!masked_small_icon.IsEmpty()) { image_view()->SetImage(masked_small_icon.AsImageSkia()); } else {
diff --git a/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java index b9175f8..ee15e553 100644 --- a/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java +++ b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java
@@ -71,6 +71,10 @@ private static final String REACHED_CODE_SAMPLING_INTERVAL_KEY = "reached_code_sampling_interval"; + // Compile time switch for sharing RELRO between the browser and the app zygote. + // TODO(crbug.com/1154224): remove when the issue is closed. + private static final boolean ALLOW_CHROMIUM_LINKER_IN_ZYGOTE = false; + // Default sampling interval for reached code profiler in microseconds. private static final int DEFAULT_REACHED_CODE_SAMPLING_INTERVAL_US = 10000; @@ -155,6 +159,12 @@ int CHILD_WITHOUT_ZYGOTE = 2; } + // Returns true when sharing RELRO between the browser process and the app zygote should *not* + // be attempted. + public static boolean mainProcessIntendsToProvideRelroFd() { + return !ALLOW_CHROMIUM_LINKER_IN_ZYGOTE || Build.VERSION.SDK_INT <= Build.VERSION_CODES.R; + } + /** * Inner class encapsulating points of communication between instances of LibraryLoader in * different processes.
diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc index d886d04..310f9bfb 100644 --- a/base/test/test_suite.cc +++ b/base/test/test_suite.cc
@@ -412,31 +412,7 @@ mac::ScopedNSAutoreleasePool scoped_pool; #endif - { - // Some features are required to be checked as soon as possible. Thus, make - // sure that the FeatureList is initalized before Initialize() is called so - // that tests that rely on this call are able to check the enabled and - // disabled featured passed via a command line. - // - // PS: When use_x11 and use_ozone are both true, some test suites need to - // check if Ozone is being used during the Initialize() call below. - // However, the feature list isn't initialized until later, when running - // each test suite inside RUN_ALL_TESTS() below. Eagerly initialize a - // ScopedFeatureList here to ensure the correct value is set for - // feature::IsUsingOzonePlatform. - // - // TODO(https://crbug.com/1096425): Remove the comment about - // UseOzonePlatform when USE_X11 is removed. - std::string enabled = - base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kEnableFeatures); - std::string disabled = - base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kDisableFeatures); - base::test::ScopedFeatureList feature_list; - feature_list.InitFromCommandLine(enabled, disabled); - Initialize(); - } + Initialize(); std::string client_func = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 2f65679..f4a0c60 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -6.20210927.0.1 +6.20210927.1.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 2f65679..f4a0c60 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -6.20210927.0.1 +6.20210927.1.1
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index 4a078af..092b64fc 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -2456,6 +2456,7 @@ sources = [ "../browser/attribution_reporting/android/java/src/org/chromium/chrome/browser/attribution_reporting/AttributionReportingProvider.java", "java/src/com/google/ipc/invalidation/ticl/android2/channel/GcmRegistrationTaskService.java", + "java/src/org/chromium/chrome/app/TrichromeZygotePreload.java", "java/src/org/chromium/chrome/browser/ChromeBackgroundService.java", "java/src/org/chromium/chrome/browser/ChromeBackupAgent.java", "java/src/org/chromium/chrome/browser/DeferredStartupHandler.java",
diff --git a/chrome/android/chrome_public_apk_tmpl.gni b/chrome/android/chrome_public_apk_tmpl.gni index 9c5ae20..5ed1e35 100644 --- a/chrome/android/chrome_public_apk_tmpl.gni +++ b/chrome/android/chrome_public_apk_tmpl.gni
@@ -22,6 +22,7 @@ "channel=$android_channel", "enable_vr=$enable_vr", "include_arcore_manifest_flag=false", + "zygote_preload_class=org.chromium.content_public.app.ZygotePreload", ] # Enable stack unwinding only on official build with specific channels. It is
diff --git a/chrome/android/expectations/monochrome_public_bundle.AndroidManifest.expected b/chrome/android/expectations/monochrome_public_bundle.AndroidManifest.expected index fea5945..e03f4d8 100644 --- a/chrome/android/expectations/monochrome_public_bundle.AndroidManifest.expected +++ b/chrome/android/expectations/monochrome_public_bundle.AndroidManifest.expected
@@ -85,7 +85,7 @@ android:roundIcon="@drawable/ic_launcher_round" android:supportsRtl="true" android:use32bitAbi="true" - android:zygotePreloadName="org.chromium.content.app.ZygotePreload"> + android:zygotePreloadName="org.chromium.content_public.app.ZygotePreload"> <activity # DIFF-ANCHOR: ea1a94af android:name="com.google.android.gms.common.api.GoogleApiActivity" android:exported="false"
diff --git a/chrome/android/expectations/trichrome_chrome_bundle.AndroidManifest.expected b/chrome/android/expectations/trichrome_chrome_bundle.AndroidManifest.expected index 1643eb9..c472e557 100644 --- a/chrome/android/expectations/trichrome_chrome_bundle.AndroidManifest.expected +++ b/chrome/android/expectations/trichrome_chrome_bundle.AndroidManifest.expected
@@ -85,7 +85,7 @@ android:roundIcon="@drawable/ic_launcher_round" android:supportsRtl="true" android:use32bitAbi="true" - android:zygotePreloadName="org.chromium.content.app.ZygotePreload"> + android:zygotePreloadName="org.chromium.chrome.app.TrichromeZygotePreload"> <activity # DIFF-ANCHOR: ea1a94af android:name="com.google.android.gms.common.api.GoogleApiActivity" android:exported="false"
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml index e1987b18..260bb164 100644 --- a/chrome/android/java/AndroidManifest.xml +++ b/chrome/android/java/AndroidManifest.xml
@@ -177,7 +177,7 @@ android:largeHeap="false" android:manageSpaceActivity="@string/manage_space_activity" android:supportsRtl="true" - android:zygotePreloadName="org.chromium.content.app.ZygotePreload" + android:zygotePreloadName="{{ zygote_preload_class }}" {% if backup_key is defined %} android:allowBackup="true" android:backupAgent="org.chromium.chrome.browser.ChromeBackupAgent"
diff --git a/chrome/android/java/src/org/chromium/chrome/app/TrichromeZygotePreload.java b/chrome/android/java/src/org/chromium/chrome/app/TrichromeZygotePreload.java new file mode 100644 index 0000000..41417b4d --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/app/TrichromeZygotePreload.java
@@ -0,0 +1,26 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.app; + +import android.content.pm.ApplicationInfo; + +import org.chromium.base.library_loader.LibraryLoader; +import org.chromium.chrome.browser.ProductConfig; +import org.chromium.content_public.app.ZygotePreload; + +/** + * The {@link ZygotePreload} allowing to use the ModernLinker when running Trichrome. + */ +public class TrichromeZygotePreload extends ZygotePreload { + @Override + public void doPreload(ApplicationInfo appInfo) { + // The ModernLinker is only needed when the App Zygote intends to create the RELRO region. + boolean useModernLinker = ProductConfig.USE_MODERN_LINKER + && !LibraryLoader.mainProcessIntendsToProvideRelroFd(); + LibraryLoader.getInstance().setLinkerImplementation( + /* useChromiumLinker= */ useModernLinker, /* useModernLinker= */ useModernLinker); + doPreloadCommon(appInfo); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java index cda1735..2a09f83 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java
@@ -143,8 +143,7 @@ private static BookmarkId addBookmarkAndShowSaveFlow(Activity activity, BookmarkModel bookmarkModel, Tab tab, BottomSheetController bottomSheetController) { - BookmarkId bookmarkId = - addBookmarkInternal(activity, bookmarkModel, tab.getTitle(), tab.getOriginalUrl()); + BookmarkId bookmarkId = addBookmarkInternal(activity, bookmarkModel, tab); BookmarkSaveFlowCoordinator bookmarkSaveFlowCoordinator = new BookmarkSaveFlowCoordinator(activity, bottomSheetController); bookmarkSaveFlowCoordinator.show(bookmarkId); @@ -155,8 +154,7 @@ // The legacy code path to add or edit bookmark without triggering the bookmark bottom sheet. private static BookmarkId addBookmarkAndShowSnackbar(BookmarkModel bookmarkModel, Tab tab, SnackbarManager snackbarManager, Activity activity, boolean fromCustomTab) { - BookmarkId bookmarkId = - addBookmarkInternal(activity, bookmarkModel, tab.getTitle(), tab.getOriginalUrl()); + BookmarkId bookmarkId = addBookmarkInternal(activity, bookmarkModel, tab); if (bookmarkId != null && bookmarkId.getType() == BookmarkType.NORMAL) { @BrowserProfileType @@ -235,11 +233,15 @@ } /** - * An internal version of {@link #addBookmarkSilently(Context, BookmarkModel, String, String)}. - * Will reset last used parent if it fails to add a bookmark + * Adds a bookmark with the given {@link Tab}. This will reset last used parent if it fails to + * add a bookmark. + * + * @param context The current Android {@link Context}. + * @param bookmarkModel The current {@link BookmarkModel} which talks to native. + * @param tab The current {@link Tab} which bookmark properties are pulled. */ private static BookmarkId addBookmarkInternal( - Context context, BookmarkModel bookmarkModel, String title, GURL url) { + Context context, BookmarkModel bookmarkModel, Tab tab) { BookmarkId parent = getLastUsedParent(context); BookmarkItem parentItem = null; if (parent != null) { @@ -249,9 +251,17 @@ || !parentItem.isFolder()) { parent = bookmarkModel.getDefaultFolder(); } - BookmarkId bookmarkId = - bookmarkModel.addBookmark(parent, bookmarkModel.getChildCount(parent), title, url); + BookmarkId bookmarkId = null; + // The shopping list experiment saves extra metadata along with the bookmark. + if (ChromeFeatureList.isInitialized() + && ChromeFeatureList.isEnabled(ChromeFeatureList.SHOPPING_LIST)) { + bookmarkId = bookmarkModel.addPowerBookmark(tab.getWebContents(), parent, + bookmarkModel.getChildCount(parent), tab.getTitle(), tab.getUrl()); + } else { + bookmarkId = bookmarkModel.addBookmark( + parent, bookmarkModel.getChildCount(parent), tab.getTitle(), tab.getUrl()); + } // TODO(lazzzis): remove log after bookmark sync is fixed, crbug.com/986978 if (bookmarkId == null) { Log.e(TAG,
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFirstRunFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFirstRunFragment.java index 4be647e0..864aaaa 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFirstRunFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFirstRunFragment.java
@@ -34,8 +34,9 @@ /** * This fragment handles the sign-in without sync consent during the FRE. */ -public class SigninFirstRunFragment - extends Fragment implements FirstRunFragment, SigninFirstRunCoordinator.Listener { +public class SigninFirstRunFragment extends Fragment implements FirstRunFragment, + SigninFirstRunCoordinator.Listener, + FreUMADialogCoordinator.Listener { private static final String FOOTER_LINK_OPEN = "<LINK>"; private static final String FOOTER_LINK_CLOSE = "</LINK>"; @@ -44,8 +45,8 @@ private ModalDialogManager mModalDialogManager; private @Nullable SigninFirstRunCoordinator mSigninFirstRunCoordinator; - private @Nullable FreUMADialogCoordinator mFreUMADialogCoordinator; private boolean mNativeInitialized; + private boolean mAllowCrashUpload; public SigninFirstRunFragment() {} @@ -63,6 +64,8 @@ final View view = inflater.inflate(R.layout.signin_first_run_view, container, false); mSigninFirstRunCoordinator = new SigninFirstRunCoordinator(requireContext(), view, mModalDialogManager, this); + mAllowCrashUpload = true; + notifyCoordinatorWhenNativeAndPolicyAreLoaded(); final NoUnderlineClickableSpan footerLinkSpan = new NoUnderlineClickableSpan(getResources(), this::onFooterLinkClicked); final SpannableString footerString = SpanApplier.applySpans( @@ -71,7 +74,6 @@ TextViewWithClickableSpans footerView = view.findViewById(R.id.signin_fre_footer); footerView.setText(footerString); footerView.setMovementMethod(LinkMovementMethod.getInstance()); - notifyCoordinatorWhenNativeAndPolicyAreLoaded(); return view; } @@ -128,7 +130,16 @@ /** Implements {@link SigninFirstRunCoordinator.Listener}. */ @Override public void advanceToNextPage() { - getPageDelegate().acceptTermsOfService(true); + getPageDelegate().acceptTermsOfService(mAllowCrashUpload); + } + + /** + * Implements {@link + * org.chromium.chrome.browser.signin.ui.fre.FreUMADialogCoordinator.Listener} + */ + @Override + public void onAllowCrashUploadChecked(boolean allowCrashUpload) { + mAllowCrashUpload = allowCrashUpload; } private void notifyCoordinatorWhenNativeAndPolicyAreLoaded() { @@ -140,7 +151,6 @@ } private void onFooterLinkClicked(View view) { - mFreUMADialogCoordinator = - new FreUMADialogCoordinator(requireContext(), mModalDialogManager); + new FreUMADialogCoordinator(requireContext(), mModalDialogManager, this); } } \ No newline at end of file
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentTest.java index f971b4a1..7b25ceb 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentTest.java
@@ -6,6 +6,7 @@ import static androidx.test.espresso.Espresso.onView; import static androidx.test.espresso.action.ViewActions.click; +import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist; import static androidx.test.espresso.assertion.ViewAssertions.matches; import static androidx.test.espresso.matcher.RootMatchers.isDialog; import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; @@ -355,6 +356,7 @@ onView(withId(R.id.signin_fre_footer)).perform(clickOnClickableSpan()); onView(withText(R.string.signin_fre_uma_dialog_title)).check(matches(isDisplayed())); + onView(withId(R.id.fre_uma_dialog_switch)).check(matches(isDisplayed())); onView(withText(R.string.signin_fre_uma_dialog_first_section_header)) .check(matches(isDisplayed())); onView(withText(R.string.signin_fre_uma_dialog_first_section_body)) @@ -368,6 +370,51 @@ @Test @MediumTest + public void testFragmentWhenDismissingUMADialog() { + TestThreadUtils.runOnUiThreadBlocking(() -> { mFragment.onNativeInitialized(); }); + launchActivityWithFragment(); + onView(withId(R.id.signin_fre_footer)).perform(clickOnClickableSpan()); + + onView(withText(R.string.done)).perform(click()); + + onView(withText(R.string.signin_fre_uma_dialog_title)).check(doesNotExist()); + } + + @Test + @MediumTest + public void testDismissButtonWhenAllowCrashUploadTurnedOff() { + TestThreadUtils.runOnUiThreadBlocking(() -> { mFragment.onNativeInitialized(); }); + launchActivityWithFragment(); + onView(withId(R.id.signin_fre_footer)).perform(clickOnClickableSpan()); + onView(withId(R.id.fre_uma_dialog_switch)).perform(click()); + onView(withText(R.string.done)).perform(click()); + + onView(withText(R.string.signin_fre_dismiss_button)).perform(click()); + + CriteriaHelper.pollUiThread(() -> { return mFragment.mIsAdvanceToNextPageCalled; }); + verify(mFirstRunPageDelegateMock).acceptTermsOfService(false); + } + + @Test + @MediumTest + public void testContinueButtonWhenAllowCrashUploadTurnedOff() { + TestThreadUtils.runOnUiThreadBlocking(() -> { mFragment.onNativeInitialized(); }); + mAccountManagerTestRule.addAccount(TEST_EMAIL1, FULL_NAME1, GIVEN_NAME1, null); + launchActivityWithFragment(); + onView(withId(R.id.signin_fre_footer)).perform(clickOnClickableSpan()); + onView(withId(R.id.fre_uma_dialog_switch)).perform(click()); + onView(withText(R.string.done)).perform(click()); + + final String continueAsText = mChromeActivityTestRule.getActivity().getString( + R.string.signin_promo_continue_as, GIVEN_NAME1); + onView(withText(continueAsText)).perform(click()); + + CriteriaHelper.pollUiThread(() -> { return mFragment.mIsAdvanceToNextPageCalled; }); + verify(mFirstRunPageDelegateMock).acceptTermsOfService(false); + } + + @Test + @MediumTest public void testFragmentWhenAddingAnotherAccount() { TestThreadUtils.runOnUiThreadBlocking(() -> { mFragment.onNativeInitialized(); }); mAccountManagerTestRule.addAccount(TEST_EMAIL1, FULL_NAME1, GIVEN_NAME1, null);
diff --git a/chrome/android/trichrome.gni b/chrome/android/trichrome.gni index d0de691..5a97c2f5 100644 --- a/chrome/android/trichrome.gni +++ b/chrome/android/trichrome.gni
@@ -35,6 +35,7 @@ "trichrome_library=$trichrome_library_package", "trichrome_certdigest=$trichrome_certdigest", "use32bitAbi=android:use32bitAbi=\"true\"", + "zygote_preload_class=org.chromium.chrome.app.TrichromeZygotePreload", ] trichrome_synchronized_proguard =
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index 83bdf638..c2e6471 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -1074,6 +1074,30 @@ Please retry. If you see this error again please contact your support representative. </message> + <!-- Strings for OS trial screen--> + <message name="IDS_OS_TRIAL_TITLE" desc="Title of the install or try screen, the first screen of the CloudReady 2.0 Installation flow"> + Welcome to CloudReady 2.0 + </message> + <message name="IDS_OS_TRIAL_SUBTITLE" desc="Subtitle of the install or try screen, the first screen of the CloudReady 2.0 Installation flow"> + <ph name="BEGIN_PARAGRAPH1"><p></ph>For the best experience, install CloudReady 2.0 to your internal disk. You can also install it later from the login screen.<ph name="END_PARAGRAPH1"></p></ph> + <ph name="BEGIN_PARAGRAPH2"><p></ph>If you're not ready to install, you can run from USB to try it out. This will keep your existing OS and data, but you may see storage and performance limits.<ph name="END_PARAGRAPH2"></p></ph> + </message> + <message name="IDS_OS_TRIAL_INSTALL_TITLE" desc="Title of the try option in the install or try screen, the first screen of the CloudReady 2.0 Installation flow."> + Install CloudReady 2.0 + </message> + <message name="IDS_OS_TRIAL_INSTALL_SUBTITLE" desc="Subtitle of the try option in the install or try screen, the first screen of the CloudReady 2.0 Installation flow"> + Convert this device into a CloudReady 2.0 device. + </message> + <message name="IDS_OS_TRIAL_TRY_TITLE" desc="Title of the install option in the install or try screen, the first screen of the CloudReady 2.0 Installation flow"> + Try it first + </message> + <message name="IDS_OS_TRIAL_TRY_SUBTITLE" desc="Subtitle of the install option in the install or try screen, the first screen of the CloudReady 2.0 Installation flow"> + Keep your OS and run CloudReady 2.0 from USB. + </message> + <message name="IDS_OS_TRIAL_NEXT_BUTTON" desc="Text of the next button in the install or try screen, the first screen of the CloudReady 2.0 Installation flow"> + Next + </message> + <!-- Strings for OS install --> <message name="IDS_OS_INSTALL_SCREEN_ERROR_TITLE" desc="Title of the error page of the OS install screen"> Installation failed
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_INSTALL_SUBTITLE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_INSTALL_SUBTITLE.png.sha1 new file mode 100644 index 0000000..3b891f6a --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_INSTALL_SUBTITLE.png.sha1
@@ -0,0 +1 @@ +ed870cdd317edc06e8b5791df23e3fbd91fe0ab8 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_INSTALL_TITLE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_INSTALL_TITLE.png.sha1 new file mode 100644 index 0000000..3b891f6a --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_INSTALL_TITLE.png.sha1
@@ -0,0 +1 @@ +ed870cdd317edc06e8b5791df23e3fbd91fe0ab8 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_NEXT_BUTTON.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_NEXT_BUTTON.png.sha1 new file mode 100644 index 0000000..3b891f6a --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_NEXT_BUTTON.png.sha1
@@ -0,0 +1 @@ +ed870cdd317edc06e8b5791df23e3fbd91fe0ab8 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_SUBTITLE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_SUBTITLE.png.sha1 new file mode 100644 index 0000000..3b891f6a --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_SUBTITLE.png.sha1
@@ -0,0 +1 @@ +ed870cdd317edc06e8b5791df23e3fbd91fe0ab8 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_TITLE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_TITLE.png.sha1 new file mode 100644 index 0000000..3b891f6a --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_TITLE.png.sha1
@@ -0,0 +1 @@ +ed870cdd317edc06e8b5791df23e3fbd91fe0ab8 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_TRY_SUBTITLE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_TRY_SUBTITLE.png.sha1 new file mode 100644 index 0000000..3b891f6a --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_TRY_SUBTITLE.png.sha1
@@ -0,0 +1 @@ +ed870cdd317edc06e8b5791df23e3fbd91fe0ab8 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_TRY_TITLE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_TRY_TITLE.png.sha1 new file mode 100644 index 0000000..3b891f6a --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_OS_TRIAL_TRY_TITLE.png.sha1
@@ -0,0 +1 @@ +ed870cdd317edc06e8b5791df23e3fbd91fe0ab8 \ No newline at end of file
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 4363a70..6fb1c7ca 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -5999,6 +5999,24 @@ <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_EXPLORE" desc="Text to encourage users to explore Google Photos in the new tab page."> Explore more of your memories in Google Photos </message> + <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TITLE" desc="Title of the opt-in UI for Google Photos in the new tab page."> + See your memories here + </message> + <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TEXT" desc="Text for the opt-in UI for Google Photos in the new tab page."> + You’ll see your memories from Google Photos here. They’ll only show when you’re signed in. + </message> + <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_BUTTON_OPT_IN" desc="Label of the button to opt-in of Google Photos in the new tab page."> + See memories + </message> + <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_BUTTON_OPT_OUT" desc="Label of the button to opt-out of Google Photos in the new tab page."> + No thanks + </message> + <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_EXAMPLE" desc="Example of a memory title for the Google Photos module in the new tab page."> + 2 years ago + </message> + <message name="IDS_NTP_MODULES_PHOTOS_NEW" desc="Text shown on the header chip of Google Photos module."> + New + </message> <message name="IDS_NTP_MODULES_KALEIDOSCOPE_TITLE" desc="Title shown in the header of the Kaleidoscope module."> Top picks for you </message>
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_BUTTON_OPT_IN.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_BUTTON_OPT_IN.png.sha1 new file mode 100644 index 0000000..34dbedb --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_BUTTON_OPT_IN.png.sha1
@@ -0,0 +1 @@ +96415d2481956732ec758c1d1adb7554eb885a4f \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_BUTTON_OPT_OUT.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_BUTTON_OPT_OUT.png.sha1 new file mode 100644 index 0000000..34dbedb --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_BUTTON_OPT_OUT.png.sha1
@@ -0,0 +1 @@ +96415d2481956732ec758c1d1adb7554eb885a4f \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_EXAMPLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_EXAMPLE.png.sha1 new file mode 100644 index 0000000..34dbedb --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_EXAMPLE.png.sha1
@@ -0,0 +1 @@ +96415d2481956732ec758c1d1adb7554eb885a4f \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TEXT.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TEXT.png.sha1 new file mode 100644 index 0000000..34dbedb --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TEXT.png.sha1
@@ -0,0 +1 @@ +96415d2481956732ec758c1d1adb7554eb885a4f \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TITLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TITLE.png.sha1 new file mode 100644 index 0000000..34dbedb --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TITLE.png.sha1
@@ -0,0 +1 @@ +96415d2481956732ec758c1d1adb7554eb885a4f \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_NEW.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_NEW.png.sha1 new file mode 100644 index 0000000..34dbedb --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_NEW.png.sha1
@@ -0,0 +1 @@ +96415d2481956732ec758c1d1adb7554eb885a4f \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 4e7aa95a..ee7d096 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -964,6 +964,10 @@ "optimization_guide/prediction/prediction_model_download_manager.cc", "optimization_guide/prediction/prediction_model_download_manager.h", "optimization_guide/prediction/prediction_model_download_observer.h", + "page_info/about_this_site_service_factory.cc", + "page_info/about_this_site_service_factory.h", + "page_info/chrome_about_this_site_service_client.cc", + "page_info/chrome_about_this_site_service_client.h", "page_load_metrics/observers/aborts_page_load_metrics_observer.cc", "page_load_metrics/observers/aborts_page_load_metrics_observer.h", "page_load_metrics/observers/ad_metrics/floc_page_load_metrics_observer.cc", @@ -2399,10 +2403,6 @@ "apps/digital_goods/digital_goods_impl.h", "apps/digital_goods/util.cc", "apps/digital_goods/util.h", - "policy/messaging_layer/util/heartbeat_event.cc", - "policy/messaging_layer/util/heartbeat_event.h", - "policy/messaging_layer/util/heartbeat_event_factory.cc", - "policy/messaging_layer/util/heartbeat_event_factory.h", ] deps += [ "//ash/components/audio", @@ -2487,6 +2487,14 @@ deps += [ "//chromeos/services/libassistant/public/mojom" ] } } + if (is_chromeos) { + sources += [ + "policy/messaging_layer/util/heartbeat_event.cc", + "policy/messaging_layer/util/heartbeat_event.h", + "policy/messaging_layer/util/heartbeat_event_factory.cc", + "policy/messaging_layer/util/heartbeat_event_factory.h", + ] + } if (is_linux || is_chromeos) { deps += [ "//chrome/browser/error_reporting" ] } @@ -2516,6 +2524,10 @@ ] } + if (is_win || is_mac || is_linux || is_chromeos_ash) { + deps += [ "//chrome/browser/ui/webui/connectors_internals:mojo_bindings" ] + } + if (is_android) { sources += [ "after_startup_task_utils_android.cc", @@ -3584,6 +3596,7 @@ "cart/cart_discount_link_fetcher.h", "cart/cart_discount_metric_collector.cc", "cart/cart_discount_metric_collector.h", + "cart/cart_features.cc", "cart/cart_features.h", "cart/cart_handler.cc", "cart/cart_handler.h", @@ -4970,6 +4983,8 @@ "lacros/feedback_util.h", "lacros/field_trial_observer.cc", "lacros/field_trial_observer.h", + "lacros/identity_manager_lacros.cc", + "lacros/identity_manager_lacros.h", "lacros/immersive_context_lacros.cc", "lacros/immersive_context_lacros.h", "lacros/lacros_butter_bar.cc",
diff --git a/chrome/browser/ash/accessibility/accessibility_manager.h b/chrome/browser/ash/accessibility/accessibility_manager.h index 1ea5553..e78de06 100644 --- a/chrome/browser/ash/accessibility/accessibility_manager.h +++ b/chrome/browser/ash/accessibility/accessibility_manager.h
@@ -115,6 +115,9 @@ public ProfileObserver, public speech::SodaInstaller::Observer { public: + AccessibilityManager(const AccessibilityManager&) = delete; + AccessibilityManager& operator=(const AccessibilityManager&) = delete; + // Creates an instance of AccessibilityManager, this should be called once, // because only one instance should exist at the same time. static void Initialize(); @@ -592,8 +595,6 @@ friend class AccessibilityManagerSodaTest; friend class AccessibilityManagerDictationDialogTest; friend class AccessibilityManagerNoOnDeviceSpeechRecognitionTest; - - DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); }; } // namespace ash
diff --git a/chrome/browser/ash/accessibility/accessibility_manager_browsertest.cc b/chrome/browser/ash/accessibility/accessibility_manager_browsertest.cc index d054bcf..e54d46ab 100644 --- a/chrome/browser/ash/accessibility/accessibility_manager_browsertest.cc +++ b/chrome/browser/ash/accessibility/accessibility_manager_browsertest.cc
@@ -337,6 +337,10 @@ AccessibilityManagerTest() : disable_animations_( ui::ScopedAnimationDurationScaleMode::ZERO_DURATION) {} + + AccessibilityManagerTest(const AccessibilityManagerTest&) = delete; + AccessibilityManagerTest& operator=(const AccessibilityManagerTest&) = delete; + ~AccessibilityManagerTest() override = default; void SetUpOnMainThread() override { @@ -399,7 +403,6 @@ private: ui::ScopedAnimationDurationScaleMode disable_animations_; - DISALLOW_COPY_AND_ASSIGN(AccessibilityManagerTest); }; // Test that a new user's application locale is mapped to a supported Dictation @@ -1220,6 +1223,11 @@ AccessibilityManagerLoginTest() : disable_animations_( ui::ScopedAnimationDurationScaleMode::ZERO_DURATION) {} + + AccessibilityManagerLoginTest(const AccessibilityManagerLoginTest&) = delete; + AccessibilityManagerLoginTest& operator=( + const AccessibilityManagerLoginTest&) = delete; + ~AccessibilityManagerLoginTest() override = default; void SetUpOnMainThread() override { @@ -1267,8 +1275,6 @@ private: ui::ScopedAnimationDurationScaleMode disable_animations_; - - DISALLOW_COPY_AND_ASSIGN(AccessibilityManagerLoginTest); }; IN_PROC_BROWSER_TEST_F(AccessibilityManagerLoginTest, BrailleOnLoginScreen) { @@ -1375,6 +1381,12 @@ embedded_test_server(), this); } } + + AccessibilityManagerUserTypeTest(const AccessibilityManagerUserTypeTest&) = + delete; + AccessibilityManagerUserTypeTest& operator=( + const AccessibilityManagerUserTypeTest&) = delete; + ~AccessibilityManagerUserTypeTest() override = default; void SetUpCommandLine(base::CommandLine* command_line) override { @@ -1398,9 +1410,6 @@ std::unique_ptr<LoggedInUserMixin> logged_in_user_mixin_; MockBrailleController braille_controller_; - - private: - DISALLOW_COPY_AND_ASSIGN(AccessibilityManagerUserTypeTest); }; INSTANTIATE_TEST_SUITE_P(UserTypeInstantiation,
diff --git a/chrome/browser/ash/accessibility/magnification_controller_browsertest.cc b/chrome/browser/ash/accessibility/magnification_controller_browsertest.cc index 50228023..47b74a3d 100644 --- a/chrome/browser/ash/accessibility/magnification_controller_browsertest.cc +++ b/chrome/browser/ash/accessibility/magnification_controller_browsertest.cc
@@ -67,6 +67,9 @@ explicit MagnifierAnimationWaiter(FullscreenMagnifierController* controller) : controller_(controller) {} + MagnifierAnimationWaiter(const MagnifierAnimationWaiter&) = delete; + MagnifierAnimationWaiter& operator=(const MagnifierAnimationWaiter&) = delete; + void Wait() { base::RepeatingTimer check_timer; check_timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(10), this, @@ -85,7 +88,6 @@ FullscreenMagnifierController* controller_; // not owned scoped_refptr<content::MessageLoopRunner> runner_; - DISALLOW_COPY_AND_ASSIGN(MagnifierAnimationWaiter); }; } // namespace @@ -93,6 +95,12 @@ class FullscreenMagnifierControllerTest : public InProcessBrowserTest { protected: FullscreenMagnifierControllerTest() {} + + FullscreenMagnifierControllerTest(const FullscreenMagnifierControllerTest&) = + delete; + FullscreenMagnifierControllerTest& operator=( + const FullscreenMagnifierControllerTest&) = delete; + ~FullscreenMagnifierControllerTest() override {} void SetUpCommandLine(base::CommandLine* command_line) override { @@ -155,9 +163,6 @@ void SetFocusOnElement(const std::string& element_id) { ExecuteScript("document.getElementById('" + element_id + "').focus();"); } - - private: - DISALLOW_COPY_AND_ASSIGN(FullscreenMagnifierControllerTest); }; // Test is flaky on ChromeOS: crbug.com/1150753
diff --git a/chrome/browser/ash/accessibility/magnification_manager.h b/chrome/browser/ash/accessibility/magnification_manager.h index c71844b..f58fd36 100644 --- a/chrome/browser/ash/accessibility/magnification_manager.h +++ b/chrome/browser/ash/accessibility/magnification_manager.h
@@ -37,6 +37,9 @@ public ui::EventHandler, public views::AXEventObserver { public: + MagnificationManager(const MagnificationManager&) = delete; + MagnificationManager& operator=(const MagnificationManager&) = delete; + // Creates an instance of MagnificationManager. This should be called once. static void Initialize(); @@ -119,8 +122,6 @@ std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; base::WeakPtrFactory<MagnificationManager> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(MagnificationManager); }; } // namespace ash
diff --git a/chrome/browser/ash/accessibility/magnification_manager_browsertest.cc b/chrome/browser/ash/accessibility/magnification_manager_browsertest.cc index eb418be..aa3b2cb5a 100644 --- a/chrome/browser/ash/accessibility/magnification_manager_browsertest.cc +++ b/chrome/browser/ash/accessibility/magnification_manager_browsertest.cc
@@ -151,6 +151,10 @@ class MagnificationManagerTest : public InProcessBrowserTest { protected: MagnificationManagerTest() {} + + MagnificationManagerTest(const MagnificationManagerTest&) = delete; + MagnificationManagerTest& operator=(const MagnificationManagerTest&) = delete; + ~MagnificationManagerTest() override {} void SetUpCommandLine(base::CommandLine* command_line) override { @@ -167,8 +171,6 @@ const AccountId test_account_id_ = AccountId::FromUserEmailGaiaId(kTestUserName, kTestUserGaiaId); - - DISALLOW_COPY_AND_ASSIGN(MagnificationManagerTest); }; IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToOff) {
diff --git a/chrome/browser/ash/accessibility/select_to_speak_browsertest.cc b/chrome/browser/ash/accessibility/select_to_speak_browsertest.cc index 2d836224..c284261 100644 --- a/chrome/browser/ash/accessibility/select_to_speak_browsertest.cc +++ b/chrome/browser/ash/accessibility/select_to_speak_browsertest.cc
@@ -49,6 +49,9 @@ class SelectToSpeakTest : public InProcessBrowserTest { public: + SelectToSpeakTest(const SelectToSpeakTest&) = delete; + SelectToSpeakTest& operator=(const SelectToSpeakTest&) = delete; + void OnFocusRingChanged() { if (loop_runner_) { loop_runner_->Quit(); @@ -168,7 +171,6 @@ scoped_refptr<content::MessageLoopRunner> loop_runner_; scoped_refptr<content::MessageLoopRunner> tray_loop_runner_; base::WeakPtrFactory<SelectToSpeakTest> weak_ptr_factory_{this}; - DISALLOW_COPY_AND_ASSIGN(SelectToSpeakTest); }; /* Test fixture enabling experimental accessibility language detection switch */
diff --git a/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc b/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc index 4470cd8..5d1a2097 100644 --- a/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc +++ b/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc
@@ -1500,6 +1500,10 @@ class OobeSpokenFeedbackTest : public OobeBaseTest { protected: OobeSpokenFeedbackTest() = default; + + OobeSpokenFeedbackTest(const OobeSpokenFeedbackTest&) = delete; + OobeSpokenFeedbackTest& operator=(const OobeSpokenFeedbackTest&) = delete; + ~OobeSpokenFeedbackTest() override {} void SetUpCommandLine(base::CommandLine* command_line) override { @@ -1513,9 +1517,6 @@ } test::SpeechMonitor sm_; - - private: - DISALLOW_COPY_AND_ASSIGN(OobeSpokenFeedbackTest); }; IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, SpokenFeedbackInOobe) {
diff --git a/chrome/browser/ash/accessibility/sticky_keys_browsertest.cc b/chrome/browser/ash/accessibility/sticky_keys_browsertest.cc index bad3e93..277a7d69 100644 --- a/chrome/browser/ash/accessibility/sticky_keys_browsertest.cc +++ b/chrome/browser/ash/accessibility/sticky_keys_browsertest.cc
@@ -34,6 +34,10 @@ class StickyKeysBrowserTest : public InProcessBrowserTest { protected: StickyKeysBrowserTest() = default; + + StickyKeysBrowserTest(const StickyKeysBrowserTest&) = delete; + StickyKeysBrowserTest& operator=(const StickyKeysBrowserTest&) = delete; + ~StickyKeysBrowserTest() override = default; void SetStickyKeysEnabled(bool enabled) { @@ -64,8 +68,6 @@ } content::NotificationRegistrar registrar_; - - DISALLOW_COPY_AND_ASSIGN(StickyKeysBrowserTest); }; IN_PROC_BROWSER_TEST_F(StickyKeysBrowserTest, OpenTrayMenu) {
diff --git a/chrome/browser/ash/account_manager/account_manager_policy_controller_factory.h b/chrome/browser/ash/account_manager/account_manager_policy_controller_factory.h index b1ab2aa..04feed49 100644 --- a/chrome/browser/ash/account_manager/account_manager_policy_controller_factory.h +++ b/chrome/browser/ash/account_manager/account_manager_policy_controller_factory.h
@@ -15,6 +15,11 @@ class AccountManagerPolicyControllerFactory : public BrowserContextKeyedServiceFactory { public: + AccountManagerPolicyControllerFactory( + const AccountManagerPolicyControllerFactory&) = delete; + AccountManagerPolicyControllerFactory& operator=( + const AccountManagerPolicyControllerFactory&) = delete; + // Gets the instance of the service associated with |context|. static AccountManagerPolicyController* GetForBrowserContext( content::BrowserContext* context); @@ -31,8 +36,6 @@ KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(AccountManagerPolicyControllerFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/app_restore/app_restore_arc_task_handler.cc b/chrome/browser/ash/app_restore/app_restore_arc_task_handler.cc index 27ac65d2..4d6c2ae5 100644 --- a/chrome/browser/ash/app_restore/app_restore_arc_task_handler.cc +++ b/chrome/browser/ash/app_restore/app_restore_arc_task_handler.cc
@@ -10,6 +10,7 @@ #include "chrome/browser/ash/app_restore/arc_window_utils.h" #include "chrome/browser/ash/arc/session/arc_session_manager.h" #include "chrome/browser/profiles/profile.h" +#include "components/app_restore/features.h" #include "components/app_restore/full_restore_utils.h" namespace ash { @@ -33,7 +34,12 @@ window_handler_ = std::make_unique<full_restore::ArcWindowHandler>(); #endif - arc_app_launch_handler_ = std::make_unique<ArcAppLaunchHandler>(); + if (::app_restore::features::IsArcAppsForDesksTemplatesEnabled()) { + desks_templates_arc_app_launch_handler_ = + std::make_unique<ArcAppLaunchHandler>(); + } + full_restore_arc_app_launch_handler_ = + std::make_unique<ArcAppLaunchHandler>(); arc::ArcSessionManager* arc_session_manager = arc::ArcSessionManager::Get(); // arc::ArcSessionManager might not be set in tests. @@ -77,8 +83,11 @@ window_handler_->OnAppInstanceConnected(); #endif - if (arc_app_launch_handler_) - arc_app_launch_handler_->OnAppConnectionReady(); + for (auto* handler : {desks_templates_arc_app_launch_handler(), + full_restore_arc_app_launch_handler()}) { + if (handler) + handler->OnAppConnectionReady(); + } ::full_restore::SetArcConnection(/*is_connection_ready=*/true); } @@ -92,17 +101,24 @@ } void AppRestoreArcTaskHandler::OnArcPlayStoreEnabledChanged(bool enabled) { - if (arc_app_launch_handler_) - arc_app_launch_handler_->OnArcPlayStoreEnabledChanged(enabled); + for (auto* handler : {desks_templates_arc_app_launch_handler(), + full_restore_arc_app_launch_handler()}) { + if (handler) + handler->OnArcPlayStoreEnabledChanged(enabled); + } } void AppRestoreArcTaskHandler::OnShelfReady() { - if (arc_app_launch_handler_) - arc_app_launch_handler_->OnShelfReady(); + for (auto* handler : {desks_templates_arc_app_launch_handler(), + full_restore_arc_app_launch_handler()}) { + if (handler) + handler->OnShelfReady(); + } } void AppRestoreArcTaskHandler::Shutdown() { - arc_app_launch_handler_.reset(); + desks_templates_arc_app_launch_handler_.reset(); + full_restore_arc_app_launch_handler_.reset(); window_handler_.reset(); }
diff --git a/chrome/browser/ash/app_restore/app_restore_arc_task_handler.h b/chrome/browser/ash/app_restore/app_restore_arc_task_handler.h index 1731f61..047165a 100644 --- a/chrome/browser/ash/app_restore/app_restore_arc_task_handler.h +++ b/chrome/browser/ash/app_restore/app_restore_arc_task_handler.h
@@ -25,11 +25,10 @@ class ArcAppLaunchHandler; // The AppRestoreArcTaskHandler class observes ArcAppListPrefs, and calls -// FullRestoreSaveHandler to update the ARC app launch info when a task is -// created or destroyed. -// -// AppRestoreArcTaskHandler is an independent KeyedService so that it could be -// created along with ARC system rather than with FullRestoreService. +// app restore clients to update the ARC app launch info when a task is created +// or destroyed. AppRestoreArcTaskHandler is an independent KeyedService so that +// it could be created along with ARC system rather than with desks templates or +// full restore. class AppRestoreArcTaskHandler : public KeyedService, public ArcAppListPrefs::Observer, public arc::ArcSessionManagerObserver { @@ -39,7 +38,6 @@ explicit AppRestoreArcTaskHandler(Profile* profile); AppRestoreArcTaskHandler(const AppRestoreArcTaskHandler&) = delete; AppRestoreArcTaskHandler& operator=(const AppRestoreArcTaskHandler&) = delete; - ~AppRestoreArcTaskHandler() override; #if BUILDFLAG(ENABLE_WAYLAND_SERVER) @@ -48,8 +46,11 @@ } #endif - ArcAppLaunchHandler* arc_app_launch_handler() { - return arc_app_launch_handler_.get(); + ArcAppLaunchHandler* desks_templates_arc_app_launch_handler() { + return desks_templates_arc_app_launch_handler_.get(); + } + ArcAppLaunchHandler* full_restore_arc_app_launch_handler() { + return full_restore_arc_app_launch_handler_.get(); } // ArcAppListPrefs::Observer. @@ -85,7 +86,10 @@ std::unique_ptr<full_restore::ArcWindowHandler> window_handler_; #endif - std::unique_ptr<ArcAppLaunchHandler> arc_app_launch_handler_; + // The ArcAppLaunchHandlers, one for each feature that wants to launch ARC + // apps. + std::unique_ptr<ArcAppLaunchHandler> desks_templates_arc_app_launch_handler_; + std::unique_ptr<ArcAppLaunchHandler> full_restore_arc_app_launch_handler_; }; } // namespace app_restore
diff --git a/chrome/browser/ash/app_restore/full_restore_app_launch_handler.cc b/chrome/browser/ash/app_restore/full_restore_app_launch_handler.cc index 1e3e5e6..1b93ff7 100644 --- a/chrome/browser/ash/app_restore/full_restore_app_launch_handler.cc +++ b/chrome/browser/ash/app_restore/full_restore_app_launch_handler.cc
@@ -216,7 +216,8 @@ VLOG(1) << "Restore apps in " << profile()->GetPath(); if (auto* arc_task_handler = app_restore::AppRestoreArcTaskHandler::GetForProfile(profile())) { - arc_task_handler->arc_app_launch_handler()->RestoreArcApps(this); + arc_task_handler->full_restore_arc_app_launch_handler()->RestoreArcApps( + this); } LaunchApps();
diff --git a/chrome/browser/ash/app_restore/full_restore_app_launch_handler_browsertest.cc b/chrome/browser/ash/app_restore/full_restore_app_launch_handler_browsertest.cc index 845ffd5..c51adc5 100644 --- a/chrome/browser/ash/app_restore/full_restore_app_launch_handler_browsertest.cc +++ b/chrome/browser/ash/app_restore/full_restore_app_launch_handler_browsertest.cc
@@ -1270,7 +1270,7 @@ arc_app_launch_handler_ = app_restore::AppRestoreArcTaskHandler::GetForProfile(profile()) - ->arc_app_launch_handler(); + ->full_restore_arc_app_launch_handler(); arc_app_launch_handler_->is_app_connection_ready_ = false; app_launch_handler_ = @@ -2034,7 +2034,7 @@ if (!arc_app_launch_handler_) { arc_app_launch_handler_ = app_restore::AppRestoreArcTaskHandler::GetForProfile(profile()) - ->arc_app_launch_handler(); + ->full_restore_arc_app_launch_handler(); } arc_app_launch_handler_->OnAppConnectionReady(); }
diff --git a/chrome/browser/ash/apps/apk_web_app_installer.h b/chrome/browser/ash/apps/apk_web_app_installer.h index f64fd3e..0a0a16eb6 100644 --- a/chrome/browser/ash/apps/apk_web_app_installer.h +++ b/chrome/browser/ash/apps/apk_web_app_installer.h
@@ -39,6 +39,9 @@ // a WeakPtr<Owner> member as a proxy for a profile lifetime observer. class Owner {}; + ApkWebAppInstaller(const ApkWebAppInstaller&) = delete; + ApkWebAppInstaller& operator=(const ApkWebAppInstaller&) = delete; + // Installs a web app represented by |web_app_info| with icon bytes // |icon_png_data| into |profile|. |owner| must stay alive for this class to // finish its tasks, otherwise installation will be aborted. Runs |callback| @@ -90,8 +93,6 @@ base::WeakPtr<Owner> weak_owner_; std::unique_ptr<WebApplicationInfo> web_app_info_; - - DISALLOW_COPY_AND_ASSIGN(ApkWebAppInstaller); }; } // namespace ash
diff --git a/chrome/browser/ash/apps/apk_web_app_service_factory.h b/chrome/browser/ash/apps/apk_web_app_service_factory.h index 43e44e2e..a15fd884 100644 --- a/chrome/browser/ash/apps/apk_web_app_service_factory.h +++ b/chrome/browser/ash/apps/apk_web_app_service_factory.h
@@ -26,6 +26,9 @@ // ApkWebAppService may be created for any profile that supports ARC. class ApkWebAppServiceFactory : public BrowserContextKeyedServiceFactory { public: + ApkWebAppServiceFactory(const ApkWebAppServiceFactory&) = delete; + ApkWebAppServiceFactory& operator=(const ApkWebAppServiceFactory&) = delete; + static ApkWebAppService* GetForProfile(Profile* profile); static ApkWebAppServiceFactory* GetInstance(); @@ -41,8 +44,6 @@ content::BrowserContext* context) const override; content::BrowserContext* GetBrowserContextToUse( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(ApkWebAppServiceFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/arc/accessibility/accessibility_window_info_data_wrapper.h b/chrome/browser/ash/arc/accessibility/accessibility_window_info_data_wrapper.h index 7026b834..c167d2ed 100644 --- a/chrome/browser/ash/arc/accessibility/accessibility_window_info_data_wrapper.h +++ b/chrome/browser/ash/arc/accessibility/accessibility_window_info_data_wrapper.h
@@ -22,6 +22,11 @@ AXTreeSourceArc* tree_source, mojom::AccessibilityWindowInfoData* window); + AccessibilityWindowInfoDataWrapper( + const AccessibilityWindowInfoDataWrapper&) = delete; + AccessibilityWindowInfoDataWrapper& operator=( + const AccessibilityWindowInfoDataWrapper&) = delete; + // AccessibilityInfoDataWrapper overrides. bool IsNode() const override; mojom::AccessibilityNodeInfoData* GetNode() const override; @@ -53,8 +58,6 @@ std::vector<int32_t>* out_value) const; mojom::AccessibilityWindowInfoData* window_ptr_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(AccessibilityWindowInfoDataWrapper); }; } // namespace arc
diff --git a/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc b/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc index 00e53cf..05932e2 100644 --- a/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc +++ b/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc
@@ -153,6 +153,11 @@ ArcAccessibilityHelperBridgeTest() = default; + ArcAccessibilityHelperBridgeTest(const ArcAccessibilityHelperBridgeTest&) = + delete; + ArcAccessibilityHelperBridgeTest& operator=( + const ArcAccessibilityHelperBridgeTest&) = delete; + void SetUp() override { ChromeViewsTestBase::SetUp(); @@ -209,8 +214,6 @@ std::unique_ptr<ArcBridgeService> bridge_service_; std::unique_ptr<TestArcAccessibilityHelperBridge> accessibility_helper_bridge_; - - DISALLOW_COPY_AND_ASSIGN(ArcAccessibilityHelperBridgeTest); }; TEST_F(ArcAccessibilityHelperBridgeTest, AnnouncementEvent) {
diff --git a/chrome/browser/ash/arc/accessibility/ax_tree_source_arc_unittest.cc b/chrome/browser/ash/arc/accessibility/ax_tree_source_arc_unittest.cc index 37c2a6f..4621462d 100644 --- a/chrome/browser/ash/arc/accessibility/ax_tree_source_arc_unittest.cc +++ b/chrome/browser/ash/arc/accessibility/ax_tree_source_arc_unittest.cc
@@ -105,6 +105,9 @@ tree_source_->set_automation_event_router_for_test(router_.get()); } + AXTreeSourceArcTest(const AXTreeSourceArcTest&) = delete; + AXTreeSourceArcTest& operator=(const AXTreeSourceArcTest&) = delete; + // AXTreeSourceArc::Delegate overrides. void OnAction(const ui::AXActionData& data) const override {} bool UseFullFocusMode() const override { return full_focus_mode_; } @@ -162,8 +165,6 @@ const std::unique_ptr<AXTreeSourceArc> tree_source_; bool full_focus_mode_ = false; - - DISALLOW_COPY_AND_ASSIGN(AXTreeSourceArcTest); }; TEST_F(AXTreeSourceArcTest, ReorderChildrenByLayout) {
diff --git a/chrome/browser/ash/arc/arc_support_host.h b/chrome/browser/ash/arc/arc_support_host.h index f8152775..9acd112 100644 --- a/chrome/browser/ash/arc/arc_support_host.h +++ b/chrome/browser/ash/arc/arc_support_host.h
@@ -145,6 +145,10 @@ base::RepeatingCallback<void(Profile* profile)>; explicit ArcSupportHost(Profile* profile); + + ArcSupportHost(const ArcSupportHost&) = delete; + ArcSupportHost& operator=(const ArcSupportHost&) = delete; + ~ArcSupportHost() override; void SetAuthDelegate(AuthDelegate* delegate); @@ -283,8 +287,6 @@ // Prefix of the device management (DM) server URL used to detect whether the // SAML flow finished. The DM server is the SAML service provider. std::string active_directory_auth_device_management_url_prefix_; - - DISALLOW_COPY_AND_ASSIGN(ArcSupportHost); }; #endif // CHROME_BROWSER_ASH_ARC_ARC_SUPPORT_HOST_H_
diff --git a/chrome/browser/ash/arc/arc_util_unittest.cc b/chrome/browser/ash/arc/arc_util_unittest.cc index 655d668..0de1305 100644 --- a/chrome/browser/ash/arc/arc_util_unittest.cc +++ b/chrome/browser/ash/arc/arc_util_unittest.cc
@@ -81,6 +81,10 @@ RegisterPrefs(test_local_state_->registry()); } + FakeUserManagerWithLocalState(const FakeUserManagerWithLocalState&) = delete; + FakeUserManagerWithLocalState& operator=( + const FakeUserManagerWithLocalState&) = delete; + PrefService* GetLocalState() const override { return test_local_state_.get(); } @@ -94,8 +98,6 @@ TestingProfileManager* const testing_profile_manager_; std::unique_ptr<TestingPrefServiceSimple> test_local_state_; - - DISALLOW_COPY_AND_ASSIGN(FakeUserManagerWithLocalState); }; class ScopedLogIn {
diff --git a/chrome/browser/ash/arc/auth/arc_active_directory_enrollment_token_fetcher_browsertest.cc b/chrome/browser/ash/arc/auth/arc_active_directory_enrollment_token_fetcher_browsertest.cc index edf2b618..782bd2f4 100644 --- a/chrome/browser/ash/arc/auth/arc_active_directory_enrollment_token_fetcher_browsertest.cc +++ b/chrome/browser/ash/arc/auth/arc_active_directory_enrollment_token_fetcher_browsertest.cc
@@ -236,6 +236,12 @@ class ArcActiveDirectoryEnrollmentTokenFetcherBrowserTest : public InProcessBrowserTest, public ArcSupportHost::ErrorDelegate { + public: + ArcActiveDirectoryEnrollmentTokenFetcherBrowserTest( + const ArcActiveDirectoryEnrollmentTokenFetcherBrowserTest&) = delete; + ArcActiveDirectoryEnrollmentTokenFetcherBrowserTest& operator=( + const ArcActiveDirectoryEnrollmentTokenFetcherBrowserTest&) = delete; + protected: ArcActiveDirectoryEnrollmentTokenFetcherBrowserTest() = default; ~ArcActiveDirectoryEnrollmentTokenFetcherBrowserTest() override = default; @@ -372,8 +378,6 @@ void OnRunNetworkTestsClicked() override {} std::unique_ptr<ArcSupportHost> support_host_; - - DISALLOW_COPY_AND_ASSIGN(ArcActiveDirectoryEnrollmentTokenFetcherBrowserTest); }; // Non-SAML flow fetches valid enrollment token and user id.
diff --git a/chrome/browser/ash/arc/auth/arc_auth_service_browsertest.cc b/chrome/browser/ash/arc/auth/arc_auth_service_browsertest.cc index 4f9987d8..3ad9344 100644 --- a/chrome/browser/ash/arc/auth/arc_auth_service_browsertest.cc +++ b/chrome/browser/ash/arc/auth/arc_auth_service_browsertest.cc
@@ -200,6 +200,10 @@ }; class ArcAuthServiceTest : public InProcessBrowserTest { + public: + ArcAuthServiceTest(const ArcAuthServiceTest&) = delete; + ArcAuthServiceTest& operator=(const ArcAuthServiceTest&) = delete; + protected: ArcAuthServiceTest() = default; @@ -458,8 +462,6 @@ // Not owned. ArcAuthService* auth_service_ = nullptr; ArcBridgeService* arc_bridge_service_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ArcAuthServiceTest); }; IN_PROC_BROWSER_TEST_F(ArcAuthServiceTest, GetPrimaryAccountForGaiaAccounts) {
diff --git a/chrome/browser/ash/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc b/chrome/browser/ash/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc index 67b41426..5cbca80 100644 --- a/chrome/browser/ash/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc +++ b/chrome/browser/ash/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc
@@ -61,6 +61,12 @@ } // namespace class ArcRobotAuthCodeFetcherBrowserTest : public InProcessBrowserTest { + public: + ArcRobotAuthCodeFetcherBrowserTest( + const ArcRobotAuthCodeFetcherBrowserTest&) = delete; + ArcRobotAuthCodeFetcherBrowserTest& operator=( + const ArcRobotAuthCodeFetcherBrowserTest&) = delete; + protected: // Test configuration for whether to set up the CloudPolicyClient connection. // By default, the test sets up the connection. @@ -147,8 +153,6 @@ network::TestURLLoaderFactory test_url_loader_factory_; std::unique_ptr<user_manager::ScopedUserManager> user_manager_enabler_; - - DISALLOW_COPY_AND_ASSIGN(ArcRobotAuthCodeFetcherBrowserTest); }; IN_PROC_BROWSER_TEST_F(ArcRobotAuthCodeFetcherBrowserTest, @@ -191,14 +195,17 @@ class ArcRobotAuthCodeFetcherOfflineBrowserTest : public ArcRobotAuthCodeFetcherBrowserTest { + public: + ArcRobotAuthCodeFetcherOfflineBrowserTest( + const ArcRobotAuthCodeFetcherOfflineBrowserTest&) = delete; + ArcRobotAuthCodeFetcherOfflineBrowserTest& operator=( + const ArcRobotAuthCodeFetcherOfflineBrowserTest&) = delete; + protected: ArcRobotAuthCodeFetcherOfflineBrowserTest() : ArcRobotAuthCodeFetcherBrowserTest(CloudPolicyClientSetup::kSkip) {} ~ArcRobotAuthCodeFetcherOfflineBrowserTest() override = default; - - private: - DISALLOW_COPY_AND_ASSIGN(ArcRobotAuthCodeFetcherOfflineBrowserTest); }; // Tests that the fetch fails when CloudPolicyClient has not been set up yet.
diff --git a/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.h b/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.h index ce84b81c..1ccbfe3 100644 --- a/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.h +++ b/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.h
@@ -677,12 +677,13 @@ std::unique_ptr<device::BluetoothGattConnection> connection, bool need_hard_disconnect); GattConnection(); + GattConnection(const GattConnection&) = delete; + GattConnection& operator=(const GattConnection&) = delete; ~GattConnection(); GattConnection(GattConnection&&); GattConnection& operator=(GattConnection&&); private: - DISALLOW_COPY_AND_ASSIGN(GattConnection); }; std::unordered_map<std::string, GattConnection> gatt_connections_;
diff --git a/chrome/browser/ash/arc/extensions/arc_support_message_host.h b/chrome/browser/ash/arc/extensions/arc_support_message_host.h index 61deda8..87933bbd 100644 --- a/chrome/browser/ash/arc/extensions/arc_support_message_host.h +++ b/chrome/browser/ash/arc/extensions/arc_support_message_host.h
@@ -28,6 +28,9 @@ virtual ~Observer() = default; }; + ArcSupportMessageHost(const ArcSupportMessageHost&) = delete; + ArcSupportMessageHost& operator=(const ArcSupportMessageHost&) = delete; + static const char kHostName[]; static const char* const kHostOrigin[]; @@ -57,8 +60,6 @@ Observer* observer_ = nullptr; Client* client_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ArcSupportMessageHost); }; } // namespace arc
diff --git a/chrome/browser/ash/arc/extensions/fake_arc_support.h b/chrome/browser/ash/arc/extensions/fake_arc_support.h index 0ec454e..3bb24013 100644 --- a/chrome/browser/ash/arc/extensions/fake_arc_support.h +++ b/chrome/browser/ash/arc/extensions/fake_arc_support.h
@@ -30,6 +30,10 @@ }; explicit FakeArcSupport(ArcSupportHost* support_host); + + FakeArcSupport(const FakeArcSupport&) = delete; + FakeArcSupport& operator=(const FakeArcSupport&) = delete; + ~FakeArcSupport() override; // Emulates to open ARC support Chrome app, and connect message host to @@ -140,8 +144,6 @@ base::ObserverList<Observer>::Unchecked observer_list_; base::WeakPtrFactory<FakeArcSupport> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(FakeArcSupport); }; } // namespace arc
diff --git a/chrome/browser/ash/arc/fileapi/arc_documents_provider_root_map_factory.h b/chrome/browser/ash/arc/fileapi/arc_documents_provider_root_map_factory.h index 97f9bd2..4611533 100644 --- a/chrome/browser/ash/arc/fileapi/arc_documents_provider_root_map_factory.h +++ b/chrome/browser/ash/arc/fileapi/arc_documents_provider_root_map_factory.h
@@ -16,6 +16,11 @@ class ArcDocumentsProviderRootMapFactory : public BrowserContextKeyedServiceFactory { public: + ArcDocumentsProviderRootMapFactory( + const ArcDocumentsProviderRootMapFactory&) = delete; + ArcDocumentsProviderRootMapFactory& operator=( + const ArcDocumentsProviderRootMapFactory&) = delete; + // Returns the ArcDocumentsProviderRootMap for |context|, creating it if not // created yet. static ArcDocumentsProviderRootMap* GetForBrowserContext( @@ -36,8 +41,6 @@ content::BrowserContext* context) const override; KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(ArcDocumentsProviderRootMapFactory); }; } // namespace arc
diff --git a/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h b/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h index 86c19a62..66def24 100644 --- a/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h +++ b/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h
@@ -54,6 +54,10 @@ ArcFileSystemBridge(content::BrowserContext* context, ArcBridgeService* bridge_service); + + ArcFileSystemBridge(const ArcFileSystemBridge&) = delete; + ArcFileSystemBridge& operator=(const ArcFileSystemBridge&) = delete; + ~ArcFileSystemBridge() override; // Returns the factory instance for this class. @@ -192,8 +196,6 @@ std::unique_ptr<ArcSelectFilesHandlersManager> select_files_handlers_manager_; base::WeakPtrFactory<ArcFileSystemBridge> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(ArcFileSystemBridge); }; } // namespace arc
diff --git a/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.h b/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.h index e279a80..6d99d7df 100644 --- a/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.h +++ b/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.h
@@ -125,6 +125,11 @@ ArcFileSystemOperationRunner(content::BrowserContext* context, ArcBridgeService* bridge_service); + + ArcFileSystemOperationRunner(const ArcFileSystemOperationRunner&) = delete; + ArcFileSystemOperationRunner& operator=(const ArcFileSystemOperationRunner&) = + delete; + ~ArcFileSystemOperationRunner() override; // Adds or removes observers. @@ -237,8 +242,6 @@ base::ObserverList<Observer>::Unchecked observer_list_; base::WeakPtrFactory<ArcFileSystemOperationRunner> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(ArcFileSystemOperationRunner); }; } // namespace arc
diff --git a/chrome/browser/ash/arc/fileapi/file_stream_forwarder.h b/chrome/browser/ash/arc/fileapi/file_stream_forwarder.h index b84953b6..f1933d8 100644 --- a/chrome/browser/ash/arc/fileapi/file_stream_forwarder.h +++ b/chrome/browser/ash/arc/fileapi/file_stream_forwarder.h
@@ -41,6 +41,9 @@ base::ScopedFD fd_dest, ResultCallback callback); + FileStreamForwarder(const FileStreamForwarder&) = delete; + FileStreamForwarder& operator=(const FileStreamForwarder&) = delete; + // Posts a task to destruct this object on the IO thread. // Must not be called multiple times for the same object. void Destroy(); @@ -79,8 +82,6 @@ std::unique_ptr<storage::FileStreamReader> stream_reader_; base::WeakPtrFactory<FileStreamForwarder> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(FileStreamForwarder); }; // FileStreamForwarderPtr is unique_ptr with a custom deleter. Use this to
diff --git a/chrome/browser/ash/arc/input_method_manager/arc_input_method_manager_service_unittest.cc b/chrome/browser/ash/arc/input_method_manager/arc_input_method_manager_service_unittest.cc index d7d9b8c..b5c5dbd 100644 --- a/chrome/browser/ash/arc/input_method_manager/arc_input_method_manager_service_unittest.cc +++ b/chrome/browser/ash/arc/input_method_manager/arc_input_method_manager_service_unittest.cc
@@ -212,6 +212,10 @@ TestInputMethodManager() { state_ = scoped_refptr<TestState>(new TestState()); } + + TestInputMethodManager(const TestInputMethodManager&) = delete; + TestInputMethodManager& operator=(const TestInputMethodManager&) = delete; + ~TestInputMethodManager() override = default; scoped_refptr<InputMethodManager::State> GetActiveIMEState() override { @@ -222,8 +226,6 @@ private: scoped_refptr<TestState> state_; - - DISALLOW_COPY_AND_ASSIGN(TestInputMethodManager); }; class TestIMEInputContextHandler : public ui::MockIMEInputContextHandler { @@ -231,18 +233,26 @@ explicit TestIMEInputContextHandler(ui::InputMethod* input_method) : input_method_(input_method) {} + TestIMEInputContextHandler(const TestIMEInputContextHandler&) = delete; + TestIMEInputContextHandler& operator=(const TestIMEInputContextHandler&) = + delete; + ui::InputMethod* GetInputMethod() override { return input_method_; } private: ui::InputMethod* const input_method_; - - DISALLOW_COPY_AND_ASSIGN(TestIMEInputContextHandler); }; class ArcInputMethodManagerServiceTest : public testing::Test { protected: ArcInputMethodManagerServiceTest() : arc_service_manager_(std::make_unique<ArcServiceManager>()) {} + + ArcInputMethodManagerServiceTest(const ArcInputMethodManagerServiceTest&) = + delete; + ArcInputMethodManagerServiceTest& operator=( + const ArcInputMethodManagerServiceTest&) = delete; + ~ArcInputMethodManagerServiceTest() override = default; ArcInputMethodManagerService* service() { return service_; } @@ -312,8 +322,6 @@ TestInputMethodManager* input_method_manager_ = nullptr; TestInputMethodManagerBridge* test_bridge_ = nullptr; // Owned by |service_| ArcInputMethodManagerService* service_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ArcInputMethodManagerServiceTest); }; } // anonymous namespace
diff --git a/chrome/browser/ash/arc/instance_throttle/arc_active_window_throttle_observer_unittest.cc b/chrome/browser/ash/arc/instance_throttle/arc_active_window_throttle_observer_unittest.cc index 6d9c7d87..367df0d 100644 --- a/chrome/browser/ash/arc/instance_throttle/arc_active_window_throttle_observer_unittest.cc +++ b/chrome/browser/ash/arc/instance_throttle/arc_active_window_throttle_observer_unittest.cc
@@ -20,6 +20,11 @@ ArcActiveWindowThrottleObserverTest() : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} + ArcActiveWindowThrottleObserverTest( + const ArcActiveWindowThrottleObserverTest&) = delete; + ArcActiveWindowThrottleObserverTest& operator=( + const ArcActiveWindowThrottleObserverTest&) = delete; + protected: ArcActiveWindowThrottleObserver* window_observer() { return &window_observer_; @@ -28,8 +33,6 @@ private: base::test::SingleThreadTaskEnvironment task_environment_; ArcActiveWindowThrottleObserver window_observer_; - - DISALLOW_COPY_AND_ASSIGN(ArcActiveWindowThrottleObserverTest); }; TEST_F(ArcActiveWindowThrottleObserverTest, TestConstructDestruct) {}
diff --git a/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc b/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc index 5bd0124..3d79fd7 100644 --- a/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc +++ b/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc
@@ -30,6 +30,11 @@ public: using testing::Test::Test; + ArcAppLaunchThrottleObserverTest(const ArcAppLaunchThrottleObserverTest&) = + delete; + ArcAppLaunchThrottleObserverTest& operator=( + const ArcAppLaunchThrottleObserverTest&) = delete; + protected: ArcAppLaunchThrottleObserver* observer() { return &app_launch_observer_; } @@ -39,8 +44,6 @@ content::BrowserTaskEnvironment task_environment_{ base::test::TaskEnvironment::TimeSource::MOCK_TIME}; ArcAppLaunchThrottleObserver app_launch_observer_; - - DISALLOW_COPY_AND_ASSIGN(ArcAppLaunchThrottleObserverTest); }; TEST_F(ArcAppLaunchThrottleObserverTest, TestConstructDestruct) {}
diff --git a/chrome/browser/ash/arc/instance_throttle/arc_boot_phase_throttle_observer_unittest.cc b/chrome/browser/ash/arc/instance_throttle/arc_boot_phase_throttle_observer_unittest.cc index 920d347..49b5ebc 100644 --- a/chrome/browser/ash/arc/instance_throttle/arc_boot_phase_throttle_observer_unittest.cc +++ b/chrome/browser/ash/arc/instance_throttle/arc_boot_phase_throttle_observer_unittest.cc
@@ -60,6 +60,11 @@ ArcBootPhaseThrottleObserver::ObserverStateChangedCallback()); } + ArcBootPhaseThrottleObserverTest(const ArcBootPhaseThrottleObserverTest&) = + delete; + ArcBootPhaseThrottleObserverTest& operator=( + const ArcBootPhaseThrottleObserverTest&) = delete; + void TearDown() override { observer()->StopObserving(); testing_profile_.reset(); @@ -86,8 +91,6 @@ std::unique_ptr<ArcSessionManager> arc_session_manager_; ArcBootPhaseThrottleObserver observer_; std::unique_ptr<TestingProfile> testing_profile_; - - DISALLOW_COPY_AND_ASSIGN(ArcBootPhaseThrottleObserverTest); }; TEST_F(ArcBootPhaseThrottleObserverTest, TestConstructDestruct) {}
diff --git a/chrome/browser/ash/arc/kiosk/arc_kiosk_bridge_unittest.cc b/chrome/browser/ash/arc/kiosk/arc_kiosk_bridge_unittest.cc index 8712ee4..78ba775 100644 --- a/chrome/browser/ash/arc/kiosk/arc_kiosk_bridge_unittest.cc +++ b/chrome/browser/ash/arc/kiosk/arc_kiosk_bridge_unittest.cc
@@ -33,13 +33,13 @@ kiosk_bridge_(ArcKioskBridge::CreateForTesting(bridge_service_.get(), delegate_.get())) {} + ArcKioskBridgeTest(const ArcKioskBridgeTest&) = delete; + ArcKioskBridgeTest& operator=(const ArcKioskBridgeTest&) = delete; + protected: std::unique_ptr<ArcBridgeService> bridge_service_; std::unique_ptr<MockArcKioskBridgeDelegate> delegate_; std::unique_ptr<ArcKioskBridge> kiosk_bridge_; - - private: - DISALLOW_COPY_AND_ASSIGN(ArcKioskBridgeTest); }; TEST_F(ArcKioskBridgeTest, MaintenanceSessionFinished) {
diff --git a/chrome/browser/ash/arc/notification/arc_management_transition_notification.cc b/chrome/browser/ash/arc/notification/arc_management_transition_notification.cc index c0c2c68..c24496c 100644 --- a/chrome/browser/ash/arc/notification/arc_management_transition_notification.cc +++ b/chrome/browser/ash/arc/notification/arc_management_transition_notification.cc
@@ -48,6 +48,9 @@ base::Unretained(this))); } + NotificationDelegate(const NotificationDelegate&) = delete; + NotificationDelegate& operator=(const NotificationDelegate&) = delete; + // ArcSessionManagerObserver: void OnArcPlayStoreEnabledChanged(bool enabled) override { // ARC Play Store can be only opted out in case notifcation is shown. @@ -79,8 +82,6 @@ // Registrar used to monitor ARC enabled state. PrefChangeRegistrar pref_change_registrar_; - - DISALLOW_COPY_AND_ASSIGN(NotificationDelegate); }; const gfx::VectorIcon& GetNotificationIcon(ArcManagementTransition transition) {
diff --git a/chrome/browser/ash/arc/notification/arc_provision_notification_service_unittest.cc b/chrome/browser/ash/arc/notification/arc_provision_notification_service_unittest.cc index 08f5e498..2a0330a 100644 --- a/chrome/browser/ash/arc/notification/arc_provision_notification_service_unittest.cc +++ b/chrome/browser/ash/arc/notification/arc_provision_notification_service_unittest.cc
@@ -44,6 +44,11 @@ ArcProvisionNotificationServiceTest() : user_manager_enabler_(std::make_unique<ash::FakeChromeUserManager>()) {} + ArcProvisionNotificationServiceTest( + const ArcProvisionNotificationServiceTest&) = delete; + ArcProvisionNotificationServiceTest& operator=( + const ArcProvisionNotificationServiceTest&) = delete; + void SetUp() override { SetUpInternal(/*should_create_session_manager=*/true); } @@ -109,8 +114,6 @@ private: user_manager::ScopedUserManager user_manager_enabler_; - - DISALLOW_COPY_AND_ASSIGN(ArcProvisionNotificationServiceTest); }; } // namespace @@ -323,6 +326,12 @@ : public ArcProvisionNotificationServiceTest { protected: ArcProvisionNotificationServiceOobeTest() = default; + + ArcProvisionNotificationServiceOobeTest( + const ArcProvisionNotificationServiceOobeTest&) = delete; + ArcProvisionNotificationServiceOobeTest& operator=( + const ArcProvisionNotificationServiceOobeTest&) = delete; + void SetUp() override { // SessionManager is created in FakeLoginDisplayHost. We should not create // another one here. @@ -343,8 +352,6 @@ private: std::unique_ptr<ash::FakeLoginDisplayHost> fake_login_display_host_; - - DISALLOW_COPY_AND_ASSIGN(ArcProvisionNotificationServiceOobeTest); }; // For mananged user whose B&R or GLS is not managed, Arc Tos is shown during
diff --git a/chrome/browser/ash/arc/policy/arc_policy_bridge.h b/chrome/browser/ash/arc/policy/arc_policy_bridge.h index 0c376c2..4c00064 100644 --- a/chrome/browser/ash/arc/policy/arc_policy_bridge.h +++ b/chrome/browser/ash/arc/policy/arc_policy_bridge.h
@@ -58,6 +58,9 @@ public: class Observer { public: + Observer(const Observer&) = delete; + Observer& operator=(const Observer&) = delete; + // Called when policy is sent to CloudDPC. virtual void OnPolicySent(const std::string& policy) {} @@ -98,8 +101,6 @@ protected: Observer() = default; virtual ~Observer() = default; - - DISALLOW_COPY_AND_ASSIGN(Observer); }; // Policy constants. @@ -124,6 +125,10 @@ ArcPolicyBridge(content::BrowserContext* context, ArcBridgeService* bridge_service, policy::PolicyService* policy_service); + + ArcPolicyBridge(const ArcPolicyBridge&) = delete; + ArcPolicyBridge& operator=(const ArcPolicyBridge&) = delete; + ~ArcPolicyBridge() override; const std::string& GetInstanceGuidForTesting(); @@ -225,8 +230,6 @@ // Must be the last member. base::WeakPtrFactory<ArcPolicyBridge> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(ArcPolicyBridge); }; } // namespace arc
diff --git a/chrome/browser/ash/arc/policy/arc_policy_bridge_unittest.cc b/chrome/browser/ash/arc/policy/arc_policy_bridge_unittest.cc index 1551232..0dadeee 100644 --- a/chrome/browser/ash/arc/policy/arc_policy_bridge_unittest.cc +++ b/chrome/browser/ash/arc/policy/arc_policy_bridge_unittest.cc
@@ -217,6 +217,9 @@ public: ArcPolicyBridgeTestBase() = default; + ArcPolicyBridgeTestBase(const ArcPolicyBridgeTestBase&) = delete; + ArcPolicyBridgeTestBase& operator=(const ArcPolicyBridgeTestBase&) = delete; + void DoSetUp(bool is_affiliated) { bridge_service_ = std::make_unique<ArcBridgeService>(); EXPECT_CALL(policy_service_, @@ -343,8 +346,6 @@ std::unique_ptr<FakePolicyInstance> policy_instance_; policy::PolicyMap policy_map_; policy::MockPolicyService policy_service_; - - DISALLOW_COPY_AND_ASSIGN(ArcPolicyBridgeTestBase); }; class ArcPolicyBridgeTest : public ArcPolicyBridgeTestBase,
diff --git a/chrome/browser/ash/arc/process/arc_process_service.h b/chrome/browser/ash/arc/process/arc_process_service.h index 737b7a7..dbfb4f61 100644 --- a/chrome/browser/ash/arc/process/arc_process_service.h +++ b/chrome/browser/ash/arc/process/arc_process_service.h
@@ -118,6 +118,10 @@ class NSPidToPidMap : public base::RefCountedThreadSafe<NSPidToPidMap> { public: NSPidToPidMap(); + + NSPidToPidMap(const NSPidToPidMap&) = delete; + NSPidToPidMap& operator=(const NSPidToPidMap&) = delete; + base::ProcessId& operator[](const base::ProcessId& key) { return pidmap_[key]; } @@ -139,7 +143,6 @@ ~NSPidToPidMap(); PidMap pidmap_; - DISALLOW_COPY_AND_ASSIGN(NSPidToPidMap); }; private:
diff --git a/chrome/browser/ash/arc/screen_capture/arc_screen_capture_session.h b/chrome/browser/ash/arc/screen_capture/arc_screen_capture_session.h index fe44b77..8de3da6 100644 --- a/chrome/browser/ash/arc/screen_capture/arc_screen_capture_session.h +++ b/chrome/browser/ash/arc/screen_capture/arc_screen_capture_session.h
@@ -53,6 +53,9 @@ const gfx::Size& size, bool enable_notification); + ArcScreenCaptureSession(const ArcScreenCaptureSession&) = delete; + ArcScreenCaptureSession& operator=(const ArcScreenCaptureSession&) = delete; + // Implements mojo::ScreenCaptureSession interface. void SetOutputBuffer(mojo::ScopedHandle graphics_buffer, uint32_t stride, @@ -116,8 +119,6 @@ std::unique_ptr<gfx::ClientNativePixmapFactory> client_native_pixmap_factory_; base::WeakPtrFactory<ArcScreenCaptureSession> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(ArcScreenCaptureSession); }; } // namespace arc
diff --git a/chrome/browser/ash/arc/session/arc_play_store_enabled_preference_handler_unittest.cc b/chrome/browser/ash/arc/session/arc_play_store_enabled_preference_handler_unittest.cc index 8624fab..3d21f2d2 100644 --- a/chrome/browser/ash/arc/session/arc_play_store_enabled_preference_handler_unittest.cc +++ b/chrome/browser/ash/arc/session/arc_play_store_enabled_preference_handler_unittest.cc
@@ -57,6 +57,11 @@ ArcPlayStoreEnabledPreferenceHandlerTest() : user_manager_enabler_(std::make_unique<ash::FakeChromeUserManager>()) {} + ArcPlayStoreEnabledPreferenceHandlerTest( + const ArcPlayStoreEnabledPreferenceHandlerTest&) = delete; + ArcPlayStoreEnabledPreferenceHandlerTest& operator=( + const ArcPlayStoreEnabledPreferenceHandlerTest&) = delete; + void SetUp() override { // Need to initialize DBusThreadManager before ArcSessionManager's // constructor calls DBusThreadManager::Get(). @@ -154,8 +159,6 @@ std::unique_ptr<ash::FakeLoginDisplayHost> fake_login_display_host_; std::unique_ptr<ArcPlayStoreEnabledPreferenceHandler> preference_handler_; TestingPrefServiceSimple pref_service_; - - DISALLOW_COPY_AND_ASSIGN(ArcPlayStoreEnabledPreferenceHandlerTest); }; TEST_F(ArcPlayStoreEnabledPreferenceHandlerTest, PrefChangeTriggersService) {
diff --git a/chrome/browser/ash/arc/session/arc_session_manager_browsertest.cc b/chrome/browser/ash/arc/session/arc_session_manager_browsertest.cc index 2326e74..2f5b428 100644 --- a/chrome/browser/ash/arc/session/arc_session_manager_browsertest.cc +++ b/chrome/browser/ash/arc/session/arc_session_manager_browsertest.cc
@@ -112,6 +112,10 @@ class ArcSessionManagerTest : public MixinBasedInProcessBrowserTest { protected: ArcSessionManagerTest() = default; + + ArcSessionManagerTest(const ArcSessionManagerTest&) = delete; + ArcSessionManagerTest& operator=(const ArcSessionManagerTest&) = delete; + ~ArcSessionManagerTest() override = default; // MixinBasedInProcessBrowserTest: @@ -231,8 +235,6 @@ identity_test_environment_adaptor_; base::ScopedTempDir temp_dir_; std::unique_ptr<TestingProfile> profile_; - - DISALLOW_COPY_AND_ASSIGN(ArcSessionManagerTest); }; IN_PROC_BROWSER_TEST_F(ArcSessionManagerTest, ConsumerAccount) {
diff --git a/chrome/browser/ash/arc/session/arc_session_manager_unittest.cc b/chrome/browser/ash/arc/session/arc_session_manager_unittest.cc index 73b9e40..d4277e99 100644 --- a/chrome/browser/ash/arc/session/arc_session_manager_unittest.cc +++ b/chrome/browser/ash/arc/session/arc_session_manager_unittest.cc
@@ -367,6 +367,9 @@ public: ArcSessionManagerTest() = default; + ArcSessionManagerTest(const ArcSessionManagerTest&) = delete; + ArcSessionManagerTest& operator=(const ArcSessionManagerTest&) = delete; + void SetUp() override { ArcSessionManagerTestBase::SetUp(); @@ -387,9 +390,6 @@ chromeos::CryptohomeMiscClient::Shutdown(); ArcSessionManagerTestBase::TearDown(); } - - private: - DISALLOW_COPY_AND_ASSIGN(ArcSessionManagerTest); }; TEST_F(ArcSessionManagerTest, BaseWorkflow) { @@ -1131,13 +1131,15 @@ public: ArcSessionManagerArcAlwaysStartTest() = default; + ArcSessionManagerArcAlwaysStartTest( + const ArcSessionManagerArcAlwaysStartTest&) = delete; + ArcSessionManagerArcAlwaysStartTest& operator=( + const ArcSessionManagerArcAlwaysStartTest&) = delete; + void SetUp() override { SetArcAlwaysStartWithoutPlayStoreForTesting(); ArcSessionManagerTest::SetUp(); } - - private: - DISALLOW_COPY_AND_ASSIGN(ArcSessionManagerArcAlwaysStartTest); }; ArcProvisioningResult CreateProvisioningResult( @@ -1456,6 +1458,10 @@ public: ArcSessionManagerKioskTest() = default; + ArcSessionManagerKioskTest(const ArcSessionManagerKioskTest&) = delete; + ArcSessionManagerKioskTest& operator=(const ArcSessionManagerKioskTest&) = + delete; + void SetUp() override { ArcSessionManagerTestBase::SetUp(); const AccountId account_id( @@ -1463,9 +1469,6 @@ GetFakeUserManager()->AddArcKioskAppUser(account_id); GetFakeUserManager()->LoginUser(account_id); } - - private: - DISALLOW_COPY_AND_ASSIGN(ArcSessionManagerKioskTest); }; TEST_F(ArcSessionManagerKioskTest, AuthFailure) { @@ -1495,6 +1498,11 @@ public: ArcSessionManagerPublicSessionTest() = default; + ArcSessionManagerPublicSessionTest( + const ArcSessionManagerPublicSessionTest&) = delete; + ArcSessionManagerPublicSessionTest& operator=( + const ArcSessionManagerPublicSessionTest&) = delete; + void SetUp() override { ArcSessionManagerTestBase::SetUp(); const AccountId account_id( @@ -1502,9 +1510,6 @@ GetFakeUserManager()->AddPublicAccountUser(account_id); GetFakeUserManager()->LoginUser(account_id); } - - private: - DISALLOW_COPY_AND_ASSIGN(ArcSessionManagerPublicSessionTest); }; TEST_F(ArcSessionManagerPublicSessionTest, AuthFailure) { @@ -1538,6 +1543,11 @@ public: ArcSessionOobeOptInNegotiatorTest() = default; + ArcSessionOobeOptInNegotiatorTest(const ArcSessionOobeOptInNegotiatorTest&) = + delete; + ArcSessionOobeOptInNegotiatorTest& operator=( + const ArcSessionOobeOptInNegotiatorTest&) = delete; + void SetUp() override { ArcSessionManagerTest::SetUp(); @@ -1635,8 +1645,6 @@ observer_list_; std::unique_ptr<ash::FakeLoginDisplayHost> fake_login_display_host_; TestingPrefServiceSimple pref_service_; - - DISALLOW_COPY_AND_ASSIGN(ArcSessionOobeOptInNegotiatorTest); }; INSTANTIATE_TEST_SUITE_P(All, @@ -1746,6 +1754,9 @@ public: ArcSessionRetryTest() = default; + ArcSessionRetryTest(const ArcSessionRetryTest&) = delete; + ArcSessionRetryTest& operator=(const ArcSessionRetryTest&) = delete; + void SetUp() override { ArcSessionManagerTest::SetUp(); @@ -1777,9 +1788,6 @@ arc_session_manager()->Shutdown(); ArcSessionManagerTest::TearDown(); } - - private: - DISALLOW_COPY_AND_ASSIGN(ArcSessionRetryTest); }; INSTANTIATE_TEST_SUITE_P(All,
diff --git a/chrome/browser/ash/arc/tracing/arc_app_performance_tracing.cc b/chrome/browser/ash/arc/tracing/arc_app_performance_tracing.cc index 0432f55..d282586 100644 --- a/chrome/browser/ash/arc/tracing/arc_app_performance_tracing.cc +++ b/chrome/browser/ash/arc/tracing/arc_app_performance_tracing.cc
@@ -84,6 +84,9 @@ return *instance.get(); } + AppToCategoryMapper(const AppToCategoryMapper&) = delete; + AppToCategoryMapper& operator=(const AppToCategoryMapper&) = delete; + // Returns empty string if category is not set for app |app_id|. const std::string& GetCategory(const std::string& app_id) const { const auto& it = app_id_to_category_.find(app_id); @@ -100,8 +103,6 @@ ~AppToCategoryMapper() = default; std::map<std::string, std::string> app_id_to_category_; - - DISALLOW_COPY_AND_ASSIGN(AppToCategoryMapper); }; } // namespace
diff --git a/chrome/browser/ash/arc/tracing/arc_system_stat_collector.cc b/chrome/browser/ash/arc/tracing/arc_system_stat_collector.cc index 39092b7c..cce4a23 100644 --- a/chrome/browser/ash/arc/tracing/arc_system_stat_collector.cc +++ b/chrome/browser/ash/arc/tracing/arc_system_stat_collector.cc
@@ -117,12 +117,14 @@ LOG(WARNING) << "Not detected path to read CPU temperature."; } + CpuTemperaturePathDetector(const CpuTemperaturePathDetector&) = delete; + CpuTemperaturePathDetector& operator=(const CpuTemperaturePathDetector&) = + delete; + const base::FilePath& path() const { return path_; } private: base::FilePath path_; - - DISALLOW_COPY_AND_ASSIGN(CpuTemperaturePathDetector); }; const base::FilePath& GetCpuTemperaturePathOnFileThread() {
diff --git a/chrome/browser/ash/arc/tracing/arc_tracing_bridge.cc b/chrome/browser/ash/arc/tracing/arc_tracing_bridge.cc index 3f382c01..7566ba1 100644 --- a/chrome/browser/ash/arc/tracing/arc_tracing_bridge.cc +++ b/chrome/browser/ash/arc/tracing/arc_tracing_bridge.cc
@@ -67,6 +67,9 @@ return instance.get(); } + ArcTracingDataSource(const ArcTracingDataSource&) = delete; + ArcTracingDataSource& operator=(const ArcTracingDataSource&) = delete; + // Called after constructing |bridge|. void RegisterBridgeOnUI(ArcTracingBridge* bridge) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -259,8 +262,6 @@ tracing::PerfettoProducer* producer_on_ui_thread_ = nullptr; perfetto::DataSourceConfig data_source_config_; std::unique_ptr<tracing::SystemTraceWriter<std::string>> trace_writer_; - - DISALLOW_COPY_AND_ASSIGN(ArcTracingDataSource); }; } // namespace
diff --git a/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher.h b/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher.h index e7e10fdb..216b488 100644 --- a/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher.h +++ b/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher.h
@@ -21,6 +21,10 @@ class ArcTracingEventMatcher { public: ArcTracingEventMatcher(); + + ArcTracingEventMatcher(const ArcTracingEventMatcher&) = delete; + ArcTracingEventMatcher& operator=(const ArcTracingEventMatcher&) = delete; + // Format category:name[*]?(arg_name=arg_value;..) // For example: // exo:Surface::Attach @@ -60,8 +64,6 @@ bool name_prefix_match_ = false; // Defines set of arguments to match if needed. std::map<std::string, std::string> args_; - - DISALLOW_COPY_AND_ASSIGN(ArcTracingEventMatcher); }; } // namespace arc
diff --git a/chrome/browser/ash/arc/tracing/arc_tracing_graphics_model.h b/chrome/browser/ash/arc/tracing/arc_tracing_graphics_model.h index d99d21a..7f254d69 100644 --- a/chrome/browser/ash/arc/tracing/arc_tracing_graphics_model.h +++ b/chrome/browser/ash/arc/tracing/arc_tracing_graphics_model.h
@@ -148,6 +148,10 @@ using ViewMap = std::map<ViewId, EventsContainer>; ArcTracingGraphicsModel(); + + ArcTracingGraphicsModel(const ArcTracingGraphicsModel&) = delete; + ArcTracingGraphicsModel& operator=(const ArcTracingGraphicsModel&) = delete; + ~ArcTracingGraphicsModel(); // Trims container events by |trim_timestamp|. All global events are discarded @@ -241,8 +245,6 @@ ArcSystemModel system_model_; // Allows to have model incomplete, used in overview and in tests. bool skip_structure_validation_ = false; - - DISALLOW_COPY_AND_ASSIGN(ArcTracingGraphicsModel); }; std::ostream& operator<<(std::ostream& os,
diff --git a/chrome/browser/ash/assistant/assistant_util_unittest.cc b/chrome/browser/ash/assistant/assistant_util_unittest.cc index ea4302e..c0c0e71 100644 --- a/chrome/browser/ash/assistant/assistant_util_unittest.cc +++ b/chrome/browser/ash/assistant/assistant_util_unittest.cc
@@ -51,6 +51,10 @@ RegisterPrefs(test_local_state_->registry()); } + FakeUserManagerWithLocalState(const FakeUserManagerWithLocalState&) = delete; + FakeUserManagerWithLocalState& operator=( + const FakeUserManagerWithLocalState&) = delete; + PrefService* GetLocalState() const override { return test_local_state_.get(); } @@ -64,8 +68,6 @@ TestingProfileManager* const testing_profile_manager_; std::unique_ptr<TestingPrefServiceSimple> test_local_state_; - - DISALLOW_COPY_AND_ASSIGN(FakeUserManagerWithLocalState); }; class ScopedLogIn {
diff --git a/chrome/browser/ash/attestation/platform_verification_flow.h b/chrome/browser/ash/attestation/platform_verification_flow.h index a7b81d64..f377b4c 100644 --- a/chrome/browser/ash/attestation/platform_verification_flow.h +++ b/chrome/browser/ash/attestation/platform_verification_flow.h
@@ -119,6 +119,9 @@ AttestationClient* attestation_client, Delegate* delegate); + PlatformVerificationFlow(const PlatformVerificationFlow&) = delete; + PlatformVerificationFlow& operator=(const PlatformVerificationFlow&) = delete; + // Invokes an asynchronous operation to challenge a platform key. Any user // interaction will be associated with |web_contents|. The |service_id| is an // arbitrary value but it should uniquely identify the origin of the request @@ -238,8 +241,6 @@ std::unique_ptr<Delegate> default_delegate_; base::TimeDelta timeout_delay_; std::set<std::string> renewals_in_progress_; - - DISALLOW_COPY_AND_ASSIGN(PlatformVerificationFlow); }; } // namespace attestation
diff --git a/chrome/browser/ash/authpolicy/authpolicy_credentials_manager.h b/chrome/browser/ash/authpolicy/authpolicy_credentials_manager.h index e7258f54..291e9f73b 100644 --- a/chrome/browser/ash/authpolicy/authpolicy_credentials_manager.h +++ b/chrome/browser/ash/authpolicy/authpolicy_credentials_manager.h
@@ -130,6 +130,11 @@ public: static AuthPolicyCredentialsManagerFactory* GetInstance(); + AuthPolicyCredentialsManagerFactory( + const AuthPolicyCredentialsManagerFactory&) = delete; + AuthPolicyCredentialsManagerFactory& operator=( + const AuthPolicyCredentialsManagerFactory&) = delete; + private: friend struct base::DefaultSingletonTraits< AuthPolicyCredentialsManagerFactory>; @@ -145,8 +150,6 @@ // valid AuthPolicyCredentialsManager. KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(AuthPolicyCredentialsManagerFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/bluetooth/debug_logs_manager_factory.h b/chrome/browser/ash/bluetooth/debug_logs_manager_factory.h index 4fa0591e..af326db 100644 --- a/chrome/browser/ash/bluetooth/debug_logs_manager_factory.h +++ b/chrome/browser/ash/bluetooth/debug_logs_manager_factory.h
@@ -22,6 +22,9 @@ static DebugLogsManager* GetForProfile(Profile* profile); static DebugLogsManagerFactory* GetInstance(); + DebugLogsManagerFactory(const DebugLogsManagerFactory&) = delete; + DebugLogsManagerFactory& operator=(const DebugLogsManagerFactory&) = delete; + private: friend struct base::DefaultSingletonTraits<DebugLogsManagerFactory>; @@ -33,8 +36,6 @@ content::BrowserContext* context) const override; bool ServiceIsCreatedWithBrowserContext() const override; bool ServiceIsNULLWhileTesting() const override; - - DISALLOW_COPY_AND_ASSIGN(DebugLogsManagerFactory); }; } // namespace bluetooth
diff --git a/chrome/browser/ash/bluetooth/debug_logs_manager_unittest.cc b/chrome/browser/ash/bluetooth/debug_logs_manager_unittest.cc index 88d363e..f9b20e4 100644 --- a/chrome/browser/ash/bluetooth/debug_logs_manager_unittest.cc +++ b/chrome/browser/ash/bluetooth/debug_logs_manager_unittest.cc
@@ -29,6 +29,9 @@ public: DebugLogsManagerTest() = default; + DebugLogsManagerTest(const DebugLogsManagerTest&) = delete; + DebugLogsManagerTest& operator=(const DebugLogsManagerTest&) = delete; + void SetUp() override { DebugLogsManager::RegisterPrefs(prefs_.registry()); @@ -85,8 +88,6 @@ bluez::FakeBluetoothDebugManagerClient* fake_bluetooth_debug_manager_client_; std::unique_ptr<DebugLogsManager> debug_logs_manager_; TestingPrefServiceSimple prefs_; - - DISALLOW_COPY_AND_ASSIGN(DebugLogsManagerTest); }; TEST_F(DebugLogsManagerTest, FlagNotEnabled) {
diff --git a/chrome/browser/ash/camera_mic/vm_camera_mic_manager_unittest.cc b/chrome/browser/ash/camera_mic/vm_camera_mic_manager_unittest.cc index d792540f..b65f8e6 100644 --- a/chrome/browser/ash/camera_mic/vm_camera_mic_manager_unittest.cc +++ b/chrome/browser/ash/camera_mic/vm_camera_mic_manager_unittest.cc
@@ -141,6 +141,9 @@ vm_camera_mic_manager_->OnPrimaryUserSessionStarted(&testing_profile_); } + VmCameraMicManagerTest(const VmCameraMicManagerTest&) = delete; + VmCameraMicManagerTest& operator=(const VmCameraMicManagerTest&) = delete; + void SetCameraAccessing(VmType vm, bool value) { vm_camera_mic_manager_->SetCameraAccessing(vm, value); } @@ -189,8 +192,6 @@ FakeNotificationDisplayService* fake_display_service_; std::unique_ptr<VmCameraMicManager> vm_camera_mic_manager_; - - DISALLOW_COPY_AND_ASSIGN(VmCameraMicManagerTest); }; TEST_F(VmCameraMicManagerTest, CameraPrivacy) {
diff --git a/chrome/browser/ash/certificate_provider/certificate_provider_service.cc b/chrome/browser/ash/certificate_provider/certificate_provider_service.cc index 4a921d2..4a04768 100644 --- a/chrome/browser/ash/certificate_provider/certificate_provider_service.cc +++ b/chrome/browser/ash/certificate_provider/certificate_provider_service.cc
@@ -75,6 +75,9 @@ const CertificateInfo& cert_info, const base::WeakPtr<CertificateProviderService>& service); + SSLPrivateKey(const SSLPrivateKey&) = delete; + SSLPrivateKey& operator=(const SSLPrivateKey&) = delete; + // net::SSLPrivateKey: std::string GetProviderName() override; std::vector<uint16_t> GetAlgorithmPreferences() override; @@ -89,8 +92,6 @@ const CertificateInfo cert_info_; const base::WeakPtr<CertificateProviderService> service_; SEQUENCE_CHECKER(sequence_checker_); - - DISALLOW_COPY_AND_ASSIGN(SSLPrivateKey); }; class CertificateProviderService::ClientCertIdentity
diff --git a/chrome/browser/ash/certificate_provider/certificate_provider_service_factory.h b/chrome/browser/ash/certificate_provider/certificate_provider_service_factory.h index 7c8b079..3b69e69 100644 --- a/chrome/browser/ash/certificate_provider/certificate_provider_service_factory.h +++ b/chrome/browser/ash/certificate_provider/certificate_provider_service_factory.h
@@ -30,6 +30,11 @@ static CertificateProviderServiceFactory* GetInstance(); + CertificateProviderServiceFactory(const CertificateProviderServiceFactory&) = + delete; + CertificateProviderServiceFactory& operator=( + const CertificateProviderServiceFactory&) = delete; + private: friend struct base::DefaultSingletonTraits<CertificateProviderServiceFactory>; @@ -41,8 +46,6 @@ bool ServiceIsNULLWhileTesting() const override; KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(CertificateProviderServiceFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/certificate_provider/certificate_provider_service_unittest.cc b/chrome/browser/ash/certificate_provider/certificate_provider_service_unittest.cc index 0af5a2e..a52dc684 100644 --- a/chrome/browser/ash/certificate_provider/certificate_provider_service_unittest.cc +++ b/chrome/browser/ash/certificate_provider/certificate_provider_service_unittest.cc
@@ -169,6 +169,11 @@ test_delegate_->provider_extensions_.insert(kExtension1); } + CertificateProviderServiceTest(const CertificateProviderServiceTest&) = + delete; + CertificateProviderServiceTest& operator=( + const CertificateProviderServiceTest&) = delete; + // Triggers a GetCertificates request and returns the request id. Assumes that // at least one extension is registered as a certificate provider. int RequestCertificatesFromExtensions(net::ClientCertIdentityList* certs) { @@ -251,9 +256,6 @@ std::unique_ptr<CertificateProviderService> service_; const certificate_provider::CertificateInfo cert_info1_; const certificate_provider::CertificateInfo cert_info2_; - - private: - DISALLOW_COPY_AND_ASSIGN(CertificateProviderServiceTest); }; TEST_F(CertificateProviderServiceTest, GetCertificates) {
diff --git a/chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.h b/chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.h index 898c4a4..d318657 100644 --- a/chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.h +++ b/chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.h
@@ -27,6 +27,11 @@ static EventBasedStatusReportingServiceFactory* GetInstance(); + EventBasedStatusReportingServiceFactory( + const EventBasedStatusReportingServiceFactory&) = delete; + EventBasedStatusReportingServiceFactory& operator=( + const EventBasedStatusReportingServiceFactory&) = delete; + private: friend class base::NoDestructor<EventBasedStatusReportingServiceFactory>; @@ -36,8 +41,6 @@ // BrowserContextKeyedServiceFactory: KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(EventBasedStatusReportingServiceFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/child_accounts/event_based_status_reporting_service_unittest.cc b/chrome/browser/ash/child_accounts/event_based_status_reporting_service_unittest.cc index ce2a01d..c054996 100644 --- a/chrome/browser/ash/child_accounts/event_based_status_reporting_service_unittest.cc +++ b/chrome/browser/ash/child_accounts/event_based_status_reporting_service_unittest.cc
@@ -88,6 +88,12 @@ } // namespace class EventBasedStatusReportingServiceTest : public testing::Test { + public: + EventBasedStatusReportingServiceTest( + const EventBasedStatusReportingServiceTest&) = delete; + EventBasedStatusReportingServiceTest& operator=( + const EventBasedStatusReportingServiceTest&) = delete; + protected: EventBasedStatusReportingServiceTest() = default; ~EventBasedStatusReportingServiceTest() override = default; @@ -175,8 +181,6 @@ TestingScreenTimeController* test_screen_time_controller_; session_manager::SessionManager session_manager_; std::unique_ptr<EventBasedStatusReportingService> service_; - - DISALLOW_COPY_AND_ASSIGN(EventBasedStatusReportingServiceTest); }; TEST_F(EventBasedStatusReportingServiceTest, ReportWhenAppInstall) {
diff --git a/chrome/browser/ash/child_accounts/parent_access_code/authenticator_unittest.cc b/chrome/browser/ash/child_accounts/parent_access_code/authenticator_unittest.cc index 90e0ff2..90db5e2 100644 --- a/chrome/browser/ash/child_accounts/parent_access_code/authenticator_unittest.cc +++ b/chrome/browser/ash/child_accounts/parent_access_code/authenticator_unittest.cc
@@ -23,6 +23,12 @@ } class ParentAccessCodeAuthenticatorTest : public testing::Test { + public: + ParentAccessCodeAuthenticatorTest(const ParentAccessCodeAuthenticatorTest&) = + delete; + ParentAccessCodeAuthenticatorTest& operator=( + const ParentAccessCodeAuthenticatorTest&) = delete; + protected: ParentAccessCodeAuthenticatorTest() = default; ~ParentAccessCodeAuthenticatorTest() override = default; @@ -33,9 +39,6 @@ EXPECT_GE(timestamp, code->valid_from()); EXPECT_LE(timestamp, code->valid_to()); } - - private: - DISALLOW_COPY_AND_ASSIGN(ParentAccessCodeAuthenticatorTest); }; TEST_F(ParentAccessCodeAuthenticatorTest, GenerateHardcodedCodeValues) {
diff --git a/chrome/browser/ash/child_accounts/parent_access_code/parent_access_service.h b/chrome/browser/ash/child_accounts/parent_access_code/parent_access_service.h index d4ad4a2..b44d86b0 100644 --- a/chrome/browser/ash/child_accounts/parent_access_code/parent_access_service.h +++ b/chrome/browser/ash/child_accounts/parent_access_code/parent_access_service.h
@@ -48,6 +48,9 @@ // Gets the service singleton. static ParentAccessService& Get(); + ParentAccessService(const ParentAccessService&) = delete; + ParentAccessService& operator=(const ParentAccessService&) = delete; + // Checks if the provided |action| requires parental approval to be performed. static bool IsApprovalRequired(SupervisedAction action); @@ -80,8 +83,6 @@ ConfigSource config_source_; base::ObserverList<Observer> observers_; - - DISALLOW_COPY_AND_ASSIGN(ParentAccessService); }; } // namespace parent_access
diff --git a/chrome/browser/ash/child_accounts/screen_time_controller_factory.h b/chrome/browser/ash/child_accounts/screen_time_controller_factory.h index 5768a677..98e6050 100644 --- a/chrome/browser/ash/child_accounts/screen_time_controller_factory.h +++ b/chrome/browser/ash/child_accounts/screen_time_controller_factory.h
@@ -25,6 +25,10 @@ static ScreenTimeControllerFactory* GetInstance(); + ScreenTimeControllerFactory(const ScreenTimeControllerFactory&) = delete; + ScreenTimeControllerFactory& operator=(const ScreenTimeControllerFactory&) = + delete; + private: friend class base::NoDestructor<ScreenTimeControllerFactory>; @@ -34,8 +38,6 @@ // BrowserContextKeyedServiceFactory: KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(ScreenTimeControllerFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/child_accounts/usage_time_state_notifier.h b/chrome/browser/ash/child_accounts/usage_time_state_notifier.h index d27d2a1..7c6551d 100644 --- a/chrome/browser/ash/child_accounts/usage_time_state_notifier.h +++ b/chrome/browser/ash/child_accounts/usage_time_state_notifier.h
@@ -43,6 +43,9 @@ // initialize the instance in the first time it's called. static UsageTimeStateNotifier* GetInstance(); + UsageTimeStateNotifier(const UsageTimeStateNotifier&) = delete; + UsageTimeStateNotifier& operator=(const UsageTimeStateNotifier&) = delete; + // Adds and removes observers. void AddObserver(UsageTimeStateNotifier::Observer* observer); void RemoveObserver(UsageTimeStateNotifier::Observer* observer); @@ -69,8 +72,6 @@ base::ObserverList<Observer> observers_; UsageTimeState last_state_; - - DISALLOW_COPY_AND_ASSIGN(UsageTimeStateNotifier); }; } // namespace ash
diff --git a/chrome/browser/ash/child_accounts/usage_time_state_notifier_unittest.cc b/chrome/browser/ash/child_accounts/usage_time_state_notifier_unittest.cc index 6d048f9..5df2d41 100644 --- a/chrome/browser/ash/child_accounts/usage_time_state_notifier_unittest.cc +++ b/chrome/browser/ash/child_accounts/usage_time_state_notifier_unittest.cc
@@ -47,6 +47,11 @@ class UsageTimeStateNotifierTest : public testing::Test { protected: UsageTimeStateNotifierTest() = default; + + UsageTimeStateNotifierTest(const UsageTimeStateNotifierTest&) = delete; + UsageTimeStateNotifierTest& operator=(const UsageTimeStateNotifierTest&) = + delete; + ~UsageTimeStateNotifierTest() override = default; void SetUp() override { @@ -73,8 +78,6 @@ private: session_manager::SessionManager session_manager_; - - DISALLOW_COPY_AND_ASSIGN(UsageTimeStateNotifierTest); }; TEST_F(UsageTimeStateNotifierTest, CallObserverWhenSessionIsActive) {
diff --git a/chrome/browser/ash/crosapi/BUILD.gn b/chrome/browser/ash/crosapi/BUILD.gn index 81ee2e5..3eb77fa 100644 --- a/chrome/browser/ash/crosapi/BUILD.gn +++ b/chrome/browser/ash/crosapi/BUILD.gn
@@ -59,6 +59,8 @@ "file_manager_ash.h", "geolocation_service_ash.cc", "geolocation_service_ash.h", + "identity_manager_ash.cc", + "identity_manager_ash.h", "idle_service_ash.cc", "idle_service_ash.h", "image_writer_ash.cc",
diff --git a/chrome/browser/ash/crosapi/browser_util.cc b/chrome/browser/ash/crosapi/browser_util.cc index 371c12b..203c2e0 100644 --- a/chrome/browser/ash/crosapi/browser_util.cc +++ b/chrome/browser/ash/crosapi/browser_util.cc
@@ -64,6 +64,7 @@ #include "chromeos/crosapi/mojom/file_manager.mojom.h" #include "chromeos/crosapi/mojom/geolocation.mojom.h" #include "chromeos/crosapi/mojom/holding_space_service.mojom.h" +#include "chromeos/crosapi/mojom/identity_manager.mojom.h" #include "chromeos/crosapi/mojom/image_writer.mojom.h" #include "chromeos/crosapi/mojom/keystore_service.mojom.h" #include "chromeos/crosapi/mojom/kiosk_session_service.mojom.h" @@ -357,6 +358,7 @@ MakeInterfaceVersionEntry<crosapi::mojom::FileManager>(), MakeInterfaceVersionEntry<crosapi::mojom::GeolocationService>(), MakeInterfaceVersionEntry<crosapi::mojom::HoldingSpaceService>(), + MakeInterfaceVersionEntry<crosapi::mojom::IdentityManager>(), MakeInterfaceVersionEntry<crosapi::mojom::IdleService>(), MakeInterfaceVersionEntry<crosapi::mojom::ImageWriter>(), MakeInterfaceVersionEntry<crosapi::mojom::KeystoreService>(), @@ -434,7 +436,7 @@ } static_assert( - crosapi::mojom::Crosapi::Version_ == 50, + crosapi::mojom::Crosapi::Version_ == 51, "if you add a new crosapi, please add it to kInterfaceVersionEntries"); static_assert(!HasDuplicatedUuid(), "Each Crosapi Mojom interface should have unique UUID.");
diff --git a/chrome/browser/ash/crosapi/crosapi_ash.cc b/chrome/browser/ash/crosapi/crosapi_ash.cc index 60a566f2..35cadc8e 100644 --- a/chrome/browser/ash/crosapi/crosapi_ash.cc +++ b/chrome/browser/ash/crosapi/crosapi_ash.cc
@@ -35,6 +35,7 @@ #include "chrome/browser/ash/crosapi/field_trial_service_ash.h" #include "chrome/browser/ash/crosapi/file_manager_ash.h" #include "chrome/browser/ash/crosapi/geolocation_service_ash.h" +#include "chrome/browser/ash/crosapi/identity_manager_ash.h" #include "chrome/browser/ash/crosapi/idle_service_ash.h" #include "chrome/browser/ash/crosapi/image_writer_ash.h" #include "chrome/browser/ash/crosapi/keystore_service_ash.h" @@ -127,6 +128,7 @@ field_trial_service_ash_(std::make_unique<FieldTrialServiceAsh>()), file_manager_ash_(std::make_unique<FileManagerAsh>()), geolocation_service_ash_(std::make_unique<GeolocationServiceAsh>()), + identity_manager_ash_(std::make_unique<IdentityManagerAsh>()), idle_service_ash_(std::make_unique<IdleServiceAsh>()), image_writer_ash_(std::make_unique<ImageWriterAsh>()), keystore_service_ash_(std::make_unique<KeystoreServiceAsh>()), @@ -274,6 +276,11 @@ holding_space_keyed_service->BindReceiver(std::move(receiver)); } +void CrosapiAsh::BindIdentityManager( + mojo::PendingReceiver<crosapi::mojom::IdentityManager> receiver) { + identity_manager_ash_->BindReceiver(std::move(receiver)); +} + void CrosapiAsh::BindIdleService( mojo::PendingReceiver<crosapi::mojom::IdleService> receiver) { idle_service_ash_->BindReceiver(std::move(receiver));
diff --git a/chrome/browser/ash/crosapi/crosapi_ash.h b/chrome/browser/ash/crosapi/crosapi_ash.h index bc0b62d..929ce12 100644 --- a/chrome/browser/ash/crosapi/crosapi_ash.h +++ b/chrome/browser/ash/crosapi/crosapi_ash.h
@@ -34,6 +34,7 @@ class FieldTrialServiceAsh; class FileManagerAsh; class GeolocationServiceAsh; +class IdentityManagerAsh; class IdleServiceAsh; class ImageWriterAsh; class KeystoreServiceAsh; @@ -113,6 +114,8 @@ mojo::PendingReceiver<mojom::FileManager> receiver) override; void BindGeolocationService( mojo::PendingReceiver<mojom::GeolocationService> receiver) override; + void BindIdentityManager( + mojo::PendingReceiver<mojom::IdentityManager> receiver) override; void BindIdleService( mojo::PendingReceiver<mojom::IdleService> receiver) override; void BindImageWriter( @@ -237,6 +240,7 @@ std::unique_ptr<FieldTrialServiceAsh> field_trial_service_ash_; std::unique_ptr<FileManagerAsh> file_manager_ash_; std::unique_ptr<GeolocationServiceAsh> geolocation_service_ash_; + std::unique_ptr<IdentityManagerAsh> identity_manager_ash_; std::unique_ptr<IdleServiceAsh> idle_service_ash_; std::unique_ptr<ImageWriterAsh> image_writer_ash_; std::unique_ptr<KeystoreServiceAsh> keystore_service_ash_;
diff --git a/chrome/browser/ash/crosapi/identity_manager_ash.cc b/chrome/browser/ash/crosapi/identity_manager_ash.cc new file mode 100644 index 0000000..a045a11 --- /dev/null +++ b/chrome/browser/ash/crosapi/identity_manager_ash.cc
@@ -0,0 +1,67 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/crosapi/identity_manager_ash.h" + +#include "base/callback.h" +#include "chrome/browser/ash/profiles/profile_helper.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/identity_manager_factory.h" +#include "chromeos/crosapi/mojom/identity_manager.mojom.h" +#include "components/signin/public/identity_manager/account_info.h" +#include "components/signin/public/identity_manager/identity_manager.h" +#include "ui/gfx/image/image.h" + +namespace crosapi { + +namespace { +AccountInfo GetAccountInfo(const std::string& gaia_id) { + user_manager::User* const user = + user_manager::UserManager::Get()->GetActiveUser(); + if (!user) + return AccountInfo(); + + Profile* const profile = ash::ProfileHelper::Get()->GetProfileByUser(user); + if (!profile) + return AccountInfo(); + + signin::IdentityManager* identity_manager = + IdentityManagerFactory::GetInstance()->GetForProfileIfExists(profile); + if (!identity_manager) + return AccountInfo(); + return identity_manager->FindExtendedAccountInfoByGaiaId(gaia_id); +} +} // namespace + +IdentityManagerAsh::IdentityManagerAsh() = default; + +IdentityManagerAsh::~IdentityManagerAsh() = default; + +void IdentityManagerAsh::BindReceiver( + mojo::PendingReceiver<mojom::IdentityManager> receiver) { + receivers_.Add(this, std::move(receiver)); +} + +void IdentityManagerAsh::GetAccountFullName( + const std::string& gaia_id, + GetAccountFullNameCallback callback) { + AccountInfo account_info = GetAccountInfo(gaia_id); + if (GetAccountInfo(gaia_id).IsEmpty()) { + std::move(callback).Run(""); + return; + } + std::move(callback).Run(account_info.full_name); +} + +void IdentityManagerAsh::GetAccountImage(const std::string& gaia_id, + GetAccountImageCallback callback) { + AccountInfo account_info = GetAccountInfo(gaia_id); + if (account_info.IsEmpty()) { + std::move(callback).Run(gfx::ImageSkia()); + return; + } + std::move(callback).Run(account_info.account_image.AsImageSkia()); +} + +} // namespace crosapi
diff --git a/chrome/browser/ash/crosapi/identity_manager_ash.h b/chrome/browser/ash/crosapi/identity_manager_ash.h new file mode 100644 index 0000000..ea5ea5cc --- /dev/null +++ b/chrome/browser/ash/crosapi/identity_manager_ash.h
@@ -0,0 +1,39 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_CROSAPI_IDENTITY_MANAGER_ASH_H_ +#define CHROME_BROWSER_ASH_CROSAPI_IDENTITY_MANAGER_ASH_H_ + +#include "chromeos/crosapi/mojom/identity_manager.mojom.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/receiver_set.h" + +namespace crosapi { + +// Implements the crosapi identity manager interface. Lives in ash-chrome. +// Allows lacros-chrome to access properties from the identity manager that +// lives in ash, such as account names for accounts that are not yet known to +// lacros. +class IdentityManagerAsh : public mojom::IdentityManager { + public: + IdentityManagerAsh(); + IdentityManagerAsh(const IdentityManagerAsh&) = delete; + IdentityManagerAsh& operator=(const IdentityManagerAsh&) = delete; + ~IdentityManagerAsh() override; + + void BindReceiver(mojo::PendingReceiver<mojom::IdentityManager> receiver); + + // crosapi::mojom::IdentityManager: + void GetAccountFullName(const std::string& gaia_id, + GetAccountFullNameCallback callback) override; + void GetAccountImage(const std::string& gaia_id, + GetAccountImageCallback callback) override; + + private: + mojo::ReceiverSet<mojom::IdentityManager> receivers_; +}; + +} // namespace crosapi + +#endif // CHROME_BROWSER_ASH_CROSAPI_IDENTITY_MANAGER_ASH_H_
diff --git a/chrome/browser/ash/crostini/ansible/ansible_management_service_factory.h b/chrome/browser/ash/crostini/ansible/ansible_management_service_factory.h index 5c68d67..dc38e40 100644 --- a/chrome/browser/ash/crostini/ansible/ansible_management_service_factory.h +++ b/chrome/browser/ash/crostini/ansible/ansible_management_service_factory.h
@@ -20,6 +20,11 @@ static AnsibleManagementService* GetForProfile(Profile* profile); static AnsibleManagementServiceFactory* GetInstance(); + AnsibleManagementServiceFactory(const AnsibleManagementServiceFactory&) = + delete; + AnsibleManagementServiceFactory& operator=( + const AnsibleManagementServiceFactory&) = delete; + private: friend class base::NoDestructor<AnsibleManagementServiceFactory>; @@ -29,8 +34,6 @@ // BrowserContextKeyedServiceFactory: KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(AnsibleManagementServiceFactory); }; } // namespace crostini
diff --git a/chrome/browser/ash/crostini/crostini_browser_test_util.cc b/chrome/browser/ash/crostini/crostini_browser_test_util.cc index 1e732e0d..5fe499b 100644 --- a/chrome/browser/ash/crostini/crostini_browser_test_util.cc +++ b/chrome/browser/ash/crostini/crostini_browser_test_util.cc
@@ -29,6 +29,11 @@ explicit CrostiniBrowserTestChromeBrowserMainExtraParts(bool register_termina) : register_termina_(register_termina) {} + CrostiniBrowserTestChromeBrowserMainExtraParts( + const CrostiniBrowserTestChromeBrowserMainExtraParts&) = delete; + CrostiniBrowserTestChromeBrowserMainExtraParts& operator=( + const CrostiniBrowserTestChromeBrowserMainExtraParts&) = delete; + component_updater::FakeCrOSComponentManager* cros_component_manager() { return cros_component_manager_ptr_; } @@ -83,8 +88,6 @@ nullptr; content::NetworkConnectionChangeSimulator connection_change_simulator_; - - DISALLOW_COPY_AND_ASSIGN(CrostiniBrowserTestChromeBrowserMainExtraParts); }; CrostiniBrowserTestBase::CrostiniBrowserTestBase(bool register_termina)
diff --git a/chrome/browser/ash/crostini/crostini_browser_test_util.h b/chrome/browser/ash/crostini/crostini_browser_test_util.h index ca8b1ce6..7cacd47 100644 --- a/chrome/browser/ash/crostini/crostini_browser_test_util.h +++ b/chrome/browser/ash/crostini/crostini_browser_test_util.h
@@ -23,6 +23,9 @@ public: explicit CrostiniBrowserTestBase(bool register_termina); + CrostiniBrowserTestBase(const CrostiniBrowserTestBase&) = delete; + CrostiniBrowserTestBase& operator=(const CrostiniBrowserTestBase&) = delete; + // BrowserTestBase: void CreatedBrowserMainParts( content::BrowserMainParts* browser_main_parts) override; @@ -51,8 +54,6 @@ // Owned by chromeos::disks::DiskMountManager; chromeos::disks::MockDiskMountManager* dmgr_; - - DISALLOW_COPY_AND_ASSIGN(CrostiniBrowserTestBase); }; #endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_BROWSER_TEST_UTIL_H_
diff --git a/chrome/browser/ash/crostini/crostini_engagement_metrics_service.h b/chrome/browser/ash/crostini/crostini_engagement_metrics_service.h index ebc10e4e..b4de12e 100644 --- a/chrome/browser/ash/crostini/crostini_engagement_metrics_service.h +++ b/chrome/browser/ash/crostini/crostini_engagement_metrics_service.h
@@ -38,6 +38,12 @@ }; explicit CrostiniEngagementMetricsService(Profile* profile); + + CrostiniEngagementMetricsService(const CrostiniEngagementMetricsService&) = + delete; + CrostiniEngagementMetricsService& operator=( + const CrostiniEngagementMetricsService&) = delete; + ~CrostiniEngagementMetricsService() override; // This needs to be called when Crostini starts and stops being active so we @@ -47,8 +53,6 @@ private: std::unique_ptr<guest_os::GuestOsEngagementMetrics> guest_os_engagement_metrics_; - - DISALLOW_COPY_AND_ASSIGN(CrostiniEngagementMetricsService); }; } // namespace crostini
diff --git a/chrome/browser/ash/crostini/crostini_features.h b/chrome/browser/ash/crostini/crostini_features.h index 769671f..9a6513c2 100644 --- a/chrome/browser/ash/crostini/crostini_features.h +++ b/chrome/browser/ash/crostini/crostini_features.h
@@ -21,6 +21,9 @@ public: static CrostiniFeatures* Get(); + CrostiniFeatures(const CrostiniFeatures&) = delete; + CrostiniFeatures& operator=(const CrostiniFeatures&) = delete; + // Returns false if this |profile| will never be allowed to run crostini for // the lifetime of this process, otherwise returns true. The return value of // this method is guaranteed not to change for a given |profile| within the @@ -88,8 +91,6 @@ private: base::WeakPtrFactory<CrostiniFeatures> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(CrostiniFeatures); }; } // namespace crostini
diff --git a/chrome/browser/ash/crostini/crostini_force_close_watcher.h b/chrome/browser/ash/crostini/crostini_force_close_watcher.h index 45235a8..36cbf720 100644 --- a/chrome/browser/ash/crostini/crostini_force_close_watcher.h +++ b/chrome/browser/ash/crostini/crostini_force_close_watcher.h
@@ -45,6 +45,9 @@ virtual void Hide() = 0; }; + ForceCloseWatcher(const ForceCloseWatcher&) = delete; + ForceCloseWatcher& operator=(const ForceCloseWatcher&) = delete; + // Creates a watcher for the given |delegate| which will wait for attempts to // close its associated widget and, if needed, bring up a UI allowing the user // to forcibly close its associated window. @@ -92,8 +95,6 @@ // Implements the delay between the first and second time the user tries to // close the window. absl::optional<base::ElapsedTimer> show_dialog_timer_; - - DISALLOW_COPY_AND_ASSIGN(ForceCloseWatcher); }; // The delegate implementation to allow exo's shell surfaces to be closed by the
diff --git a/chrome/browser/ash/crostini/crostini_installer_unittest.cc b/chrome/browser/ash/crostini/crostini_installer_unittest.cc index eed1601..79607ec 100644 --- a/chrome/browser/ash/crostini/crostini_installer_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_installer_unittest.cc
@@ -97,6 +97,9 @@ TestingBrowserProcess::GetGlobal())), browser_part_(g_browser_process->platform_part()) {} + CrostiniInstallerTest(const CrostiniInstallerTest&) = delete; + CrostiniInstallerTest& operator=(const CrostiniInstallerTest&) = delete; + void SetUp() override { component_manager_ = base::MakeRefCounted<component_updater::FakeCrOSComponentManager>(); @@ -188,8 +191,6 @@ std::unique_ptr<ScopedTestingLocalState> local_state_; scoped_refptr<component_updater::FakeCrOSComponentManager> component_manager_; BrowserProcessPlatformPartTestApi browser_part_; - - DISALLOW_COPY_AND_ASSIGN(CrostiniInstallerTest); }; TEST_F(CrostiniInstallerTest, InstallFlow) {
diff --git a/chrome/browser/ash/crostini/crostini_manager_factory.h b/chrome/browser/ash/crostini/crostini_manager_factory.h index 90a40ec..e2e37f1b 100644 --- a/chrome/browser/ash/crostini/crostini_manager_factory.h +++ b/chrome/browser/ash/crostini/crostini_manager_factory.h
@@ -20,6 +20,9 @@ static CrostiniManager* GetForProfile(Profile* profile); static CrostiniManagerFactory* GetInstance(); + CrostiniManagerFactory(const CrostiniManagerFactory&) = delete; + CrostiniManagerFactory& operator=(const CrostiniManagerFactory&) = delete; + private: friend class base::NoDestructor<CrostiniManagerFactory>; @@ -29,8 +32,6 @@ // BrowserContextKeyedServiceFactory: KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(CrostiniManagerFactory); }; } // namespace crostini
diff --git a/chrome/browser/ash/crostini/crostini_remover.h b/chrome/browser/ash/crostini/crostini_remover.h index d39e398..b9f5254 100644 --- a/chrome/browser/ash/crostini/crostini_remover.h +++ b/chrome/browser/ash/crostini/crostini_remover.h
@@ -15,6 +15,9 @@ std::string vm_name, CrostiniManager::RemoveCrostiniCallback callback); + CrostiniRemover(const CrostiniRemover&) = delete; + CrostiniRemover& operator=(const CrostiniRemover&) = delete; + void RemoveCrostini(); private: @@ -29,8 +32,6 @@ Profile* profile_; std::string vm_name_; CrostiniManager::RemoveCrostiniCallback callback_; - - DISALLOW_COPY_AND_ASSIGN(CrostiniRemover); }; } // namespace crostini
diff --git a/chrome/browser/ash/crostini/crostini_reporting_util_unittest.cc b/chrome/browser/ash/crostini/crostini_reporting_util_unittest.cc index 919af34..f1f2ba3 100644 --- a/chrome/browser/ash/crostini/crostini_reporting_util_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_reporting_util_unittest.cc
@@ -29,6 +29,10 @@ public: CrostiniReportingUtilTest() = default; + CrostiniReportingUtilTest(const CrostiniReportingUtilTest&) = delete; + CrostiniReportingUtilTest& operator=(const CrostiniReportingUtilTest&) = + delete; + protected: void enable_crostini_reporting() { profile_.GetPrefs()->SetBoolean(prefs::kReportCrostiniUsageEnabled, true); @@ -38,9 +42,6 @@ base::SimpleTestClock test_clock_; TestingProfile profile_; component_updater::MockComponentUpdateService update_service_; - - private: - DISALLOW_COPY_AND_ASSIGN(CrostiniReportingUtilTest); }; TEST_F(CrostiniReportingUtilTest, WriteMetricsForReportingToPrefsIfEnabled) {
diff --git a/chrome/browser/ash/crostini/crostini_test_util.cc b/chrome/browser/ash/crostini/crostini_test_util.cc index fb24810..d224515 100644 --- a/chrome/browser/ash/crostini/crostini_test_util.cc +++ b/chrome/browser/ash/crostini/crostini_test_util.cc
@@ -18,6 +18,10 @@ public: TestViewsDelegateWithContext() = default; + TestViewsDelegateWithContext(const TestViewsDelegateWithContext&) = delete; + TestViewsDelegateWithContext& operator=(const TestViewsDelegateWithContext&) = + delete; + void set_context(gfx::NativeWindow context) { context_ = context; } // ViewsDelegate: @@ -31,8 +35,6 @@ private: gfx::NativeWindow context_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(TestViewsDelegateWithContext); }; } // namespace
diff --git a/chrome/browser/ash/crostini/crostini_upgrade_available_notification.cc b/chrome/browser/ash/crostini/crostini_upgrade_available_notification.cc index 92b1be5..a6d1d62 100644 --- a/chrome/browser/ash/crostini/crostini_upgrade_available_notification.cc +++ b/chrome/browser/ash/crostini/crostini_upgrade_available_notification.cc
@@ -35,6 +35,11 @@ ContainerId::GetDefault()); } + CrostiniUpgradeAvailableNotificationDelegate( + const CrostiniUpgradeAvailableNotificationDelegate&) = delete; + CrostiniUpgradeAvailableNotificationDelegate& operator=( + const CrostiniUpgradeAvailableNotificationDelegate&) = delete; + void Click(const absl::optional<int>& button_index, const absl::optional<std::u16string>& reply) override { disposition_ = @@ -84,8 +89,6 @@ base::WeakPtrFactory<CrostiniUpgradeAvailableNotificationDelegate> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(CrostiniUpgradeAvailableNotificationDelegate); }; std::unique_ptr<CrostiniUpgradeAvailableNotification>
diff --git a/chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer_unittest.cc b/chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer_unittest.cc index cbf56cc..c282803a 100644 --- a/chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer_unittest.cc +++ b/chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer_unittest.cc
@@ -17,6 +17,11 @@ public: using testing::Test::Test; + CrostiniActiveWindowThrottleObserverTest( + const CrostiniActiveWindowThrottleObserverTest&) = delete; + CrostiniActiveWindowThrottleObserverTest& operator=( + const CrostiniActiveWindowThrottleObserverTest&) = delete; + protected: CrostiniActiveWindowThrottleObserver* observer() { return &observer_; } @@ -24,8 +29,6 @@ base::test::SingleThreadTaskEnvironment task_environment_{ base::test::TaskEnvironment::MainThreadType::UI}; CrostiniActiveWindowThrottleObserver observer_; - - DISALLOW_COPY_AND_ASSIGN(CrostiniActiveWindowThrottleObserverTest); }; TEST_F(CrostiniActiveWindowThrottleObserverTest, TestConstructDestruct) {}
diff --git a/chrome/browser/ash/crostini/throttle/crostini_throttle.cc b/chrome/browser/ash/crostini/throttle/crostini_throttle.cc index 24373e8..99a1eb03 100644 --- a/chrome/browser/ash/crostini/throttle/crostini_throttle.cc +++ b/chrome/browser/ash/crostini/throttle/crostini_throttle.cc
@@ -49,6 +49,9 @@ context, true /* create */)); } + CrostiniThrottleFactory(const CrostiniThrottleFactory&) = delete; + CrostiniThrottleFactory& operator=(const CrostiniThrottleFactory&) = delete; + private: friend class base::NoDestructor<CrostiniThrottleFactory>; @@ -65,8 +68,6 @@ return nullptr; return new CrostiniThrottle(context); } - - DISALLOW_COPY_AND_ASSIGN(CrostiniThrottleFactory); }; } // namespace
diff --git a/chrome/browser/ash/crostini/throttle/crostini_throttle_unittest.cc b/chrome/browser/ash/crostini/throttle/crostini_throttle_unittest.cc index bb75341b..8b0d644f 100644 --- a/chrome/browser/ash/crostini/throttle/crostini_throttle_unittest.cc +++ b/chrome/browser/ash/crostini/throttle/crostini_throttle_unittest.cc
@@ -23,6 +23,9 @@ std::make_unique<TestDelegateImpl>(this)); } + CrostiniThrottleTest(const CrostiniThrottleTest&) = delete; + CrostiniThrottleTest& operator=(const CrostiniThrottleTest&) = delete; + protected: CrostiniThrottle* crostini_throttle() { return &crostini_throttle_; } @@ -60,8 +63,6 @@ CrostiniThrottle crostini_throttle_; size_t disable_cpu_restriction_counter_{0}; size_t enable_cpu_restriction_counter_{0}; - - DISALLOW_COPY_AND_ASSIGN(CrostiniThrottleTest); }; // Tests that CrostiniThrottle can be constructed and destructed.
diff --git a/chrome/browser/ash/customization/customization_document.cc b/chrome/browser/ash/customization/customization_document.cc index e44f8aa..9fdfda9 100644 --- a/chrome/browser/ash/customization/customization_document.cc +++ b/chrome/browser/ash/customization/customization_document.cc
@@ -186,6 +186,11 @@ explicit ServicesCustomizationExternalLoader(Profile* profile) : is_apps_set_(false), profile_(profile) {} + ServicesCustomizationExternalLoader( + const ServicesCustomizationExternalLoader&) = delete; + ServicesCustomizationExternalLoader& operator=( + const ServicesCustomizationExternalLoader&) = delete; + Profile* profile() { return profile_; } // Used by the ServicesCustomizationDocument to update the current apps. @@ -221,8 +226,6 @@ bool is_apps_set_; base::DictionaryValue apps_; Profile* profile_; - - DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationExternalLoader); }; // CustomizationDocument implementation. ---------------------------------------
diff --git a/chrome/browser/ash/customization/customization_document.h b/chrome/browser/ash/customization/customization_document.h index 560f478..4a4050b 100644 --- a/chrome/browser/ash/customization/customization_document.h +++ b/chrome/browser/ash/customization/customization_document.h
@@ -92,6 +92,10 @@ public: static StartupCustomizationDocument* GetInstance(); + StartupCustomizationDocument(const StartupCustomizationDocument&) = delete; + StartupCustomizationDocument& operator=(const StartupCustomizationDocument&) = + delete; + std::string GetEULAPage(const std::string& locale) const; // These methods can be called even if !IsReady(), in this case VPD values @@ -133,8 +137,6 @@ std::vector<std::string> configured_locales_; std::string initial_timezone_; std::string keyboard_layout_; - - DISALLOW_COPY_AND_ASSIGN(StartupCustomizationDocument); }; // OEM services customization document class. @@ -147,6 +149,10 @@ public: static ServicesCustomizationDocument* GetInstance(); + ServicesCustomizationDocument(const ServicesCustomizationDocument&) = delete; + ServicesCustomizationDocument& operator=( + const ServicesCustomizationDocument&) = delete; + // Registers preferences. static void RegisterPrefs(PrefRegistrySimple* registry); static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); @@ -324,8 +330,6 @@ // Weak factory for callbacks. base::WeakPtrFactory<ServicesCustomizationDocument> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(ServicesCustomizationDocument); }; } // namespace ash
diff --git a/chrome/browser/ash/customization/customization_document_browsertest.cc b/chrome/browser/ash/customization/customization_document_browsertest.cc index fa7ddb1..b802629 100644 --- a/chrome/browser/ash/customization/customization_document_browsertest.cc +++ b/chrome/browser/ash/customization/customization_document_browsertest.cc
@@ -36,6 +36,9 @@ finished_(false), runner_(new content::MessageLoopRunner) {} + LanguageSwitchedWaiter(const LanguageSwitchedWaiter&) = delete; + LanguageSwitchedWaiter& operator=(const LanguageSwitchedWaiter&) = delete; + void ExitMessageLoop(const LanguageSwitchResult& result) { finished_ = true; runner_->Quit(); @@ -57,7 +60,6 @@ SwitchLanguageCallback callback_; bool finished_; scoped_refptr<content::MessageLoopRunner> runner_; - DISALLOW_COPY_AND_ASSIGN(LanguageSwitchedWaiter); }; const struct {
diff --git a/chrome/browser/ash/display/quirks_browsertest.cc b/chrome/browser/ash/display/quirks_browsertest.cc index bbfef94e..717a48d 100644 --- a/chrome/browser/ash/display/quirks_browsertest.cc +++ b/chrome/browser/ash/display/quirks_browsertest.cc
@@ -46,6 +46,9 @@ })); } + QuirksBrowserTest(const QuirksBrowserTest&) = delete; + QuirksBrowserTest& operator=(const QuirksBrowserTest&) = delete; + protected: ~QuirksBrowserTest() override = default; @@ -103,9 +106,6 @@ // request. network::TestURLLoaderFactory test_url_loader_factory_; - - private: - DISALLOW_COPY_AND_ASSIGN(QuirksBrowserTest); }; IN_PROC_BROWSER_TEST_F(QuirksBrowserTest, DownloadIccFile) {
diff --git a/chrome/browser/ash/display/quirks_manager_delegate_impl.h b/chrome/browser/ash/display/quirks_manager_delegate_impl.h index 0e1392c..97d552b6 100644 --- a/chrome/browser/ash/display/quirks_manager_delegate_impl.h +++ b/chrome/browser/ash/display/quirks_manager_delegate_impl.h
@@ -16,6 +16,10 @@ public: QuirksManagerDelegateImpl() = default; + QuirksManagerDelegateImpl(const QuirksManagerDelegateImpl&) = delete; + QuirksManagerDelegateImpl& operator=(const QuirksManagerDelegateImpl&) = + delete; + // QuirksManager::Delegate implementation. std::string GetApiKey() const override; base::FilePath GetDisplayProfileDirectory() const override; @@ -23,8 +27,6 @@ private: ~QuirksManagerDelegateImpl() override = default; - - DISALLOW_COPY_AND_ASSIGN(QuirksManagerDelegateImpl); }; } // namespace quirks
diff --git a/chrome/browser/ash/drive/drive_integration_service.cc b/chrome/browser/ash/drive/drive_integration_service.cc index e3c1066..cbcda8a8 100644 --- a/chrome/browser/ash/drive/drive_integration_service.cc +++ b/chrome/browser/ash/drive/drive_integration_service.cc
@@ -459,6 +459,9 @@ chromeos::disks::DiskMountManager::GetInstance(), std::make_unique<base::OneShotTimer>()) {} + DriveFsHolder(const DriveFsHolder&) = delete; + DriveFsHolder& operator=(const DriveFsHolder&) = delete; + drivefs::DriveFsHost* drivefs_host() { return &drivefs_host_; } private: @@ -558,8 +561,6 @@ drivefs::DriveFsHost drivefs_host_; std::string profile_salt_; - - DISALLOW_COPY_AND_ASSIGN(DriveFsHolder); }; DriveIntegrationService::DriveIntegrationService(
diff --git a/chrome/browser/ash/drive/drivefs_native_message_host_unittest.cc b/chrome/browser/ash/drive/drivefs_native_message_host_unittest.cc index d18b174..fedc565 100644 --- a/chrome/browser/ash/drive/drivefs_native_message_host_unittest.cc +++ b/chrome/browser/ash/drive/drivefs_native_message_host_unittest.cc
@@ -30,6 +30,9 @@ public: MockClient() {} + MockClient(const MockClient&) = delete; + MockClient& operator=(const MockClient&) = delete; + MOCK_METHOD(void, PostMessageFromNativeHost, (const std::string& message), @@ -38,9 +41,6 @@ CloseChannel, (const std::string& error_message), (override)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockClient); }; class DriveFsNativeMessageHostTest @@ -53,6 +53,10 @@ chromeos::features::kDriveFsBidirectionalNativeMessaging); } + DriveFsNativeMessageHostTest(const DriveFsNativeMessageHostTest&) = delete; + DriveFsNativeMessageHostTest& operator=(const DriveFsNativeMessageHostTest&) = + delete; + DriveFs* GetForwardingInterface() override { NOTREACHED(); return nullptr; @@ -79,8 +83,6 @@ private: base::test::ScopedFeatureList scoped_feature_list_; - - DISALLOW_COPY_AND_ASSIGN(DriveFsNativeMessageHostTest); }; TEST_F(DriveFsNativeMessageHostTest, DriveFsInitiatedMessaging) { @@ -172,10 +174,13 @@ chromeos::features::kDriveFsBidirectionalNativeMessaging); } + DriveFsNativeMessageHostTestWithoutFlag( + const DriveFsNativeMessageHostTestWithoutFlag&) = delete; + DriveFsNativeMessageHostTestWithoutFlag& operator=( + const DriveFsNativeMessageHostTestWithoutFlag&) = delete; + private: base::test::ScopedFeatureList scoped_feature_list_; - - DISALLOW_COPY_AND_ASSIGN(DriveFsNativeMessageHostTestWithoutFlag); }; TEST_F(DriveFsNativeMessageHostTestWithoutFlag,
diff --git a/chrome/browser/ash/drive/fileapi/drivefs_async_file_util.cc b/chrome/browser/ash/drive/fileapi/drivefs_async_file_util.cc index d5ec914c..44775ee 100644 --- a/chrome/browser/ash/drive/fileapi/drivefs_async_file_util.cc +++ b/chrome/browser/ash/drive/fileapi/drivefs_async_file_util.cc
@@ -66,6 +66,9 @@ DCHECK(origin_task_runner_->RunsTasksInCurrentSequence()); } + CopyOperation(const CopyOperation&) = delete; + CopyOperation& operator=(const CopyOperation&) = delete; + void Start() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -135,8 +138,6 @@ storage::AsyncFileUtil::StatusCallback callback_; scoped_refptr<base::SequencedTaskRunner> origin_task_runner_; base::WeakPtr<DriveFsAsyncFileUtil> async_file_util_; - - DISALLOW_COPY_AND_ASSIGN(CopyOperation); }; // Recursively deletes a folder locally. The folder will still be available in @@ -156,6 +157,9 @@ DCHECK(origin_task_runner_->RunsTasksInCurrentSequence()); } + DeleteOperation(const DeleteOperation&) = delete; + DeleteOperation& operator=(const DeleteOperation&) = delete; + void Start() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -192,8 +196,6 @@ scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; base::FilePath path_in_trash_; - - DISALLOW_COPY_AND_ASSIGN(DeleteOperation); }; } // namespace
diff --git a/chrome/browser/ash/file_manager/audio_player_browsertest.cc b/chrome/browser/ash/file_manager/audio_player_browsertest.cc index 4a37fd1..381b003 100644 --- a/chrome/browser/ash/file_manager/audio_player_browsertest.cc +++ b/chrome/browser/ash/file_manager/audio_player_browsertest.cc
@@ -14,6 +14,10 @@ public: AudioPlayerBrowserTestBase() = default; + AudioPlayerBrowserTestBase(const AudioPlayerBrowserTestBase&) = delete; + AudioPlayerBrowserTestBase& operator=(const AudioPlayerBrowserTestBase&) = + delete; + protected: Options GetOptions() const override { Options opts; @@ -37,8 +41,6 @@ private: std::string test_case_name_; - - DISALLOW_COPY_AND_ASSIGN(AudioPlayerBrowserTestBase); }; typedef AudioPlayerBrowserTestBase<NOT_IN_GUEST_MODE> AudioPlayerBrowserTest;
diff --git a/chrome/browser/ash/file_manager/documents_provider_root_manager.cc b/chrome/browser/ash/file_manager/documents_provider_root_manager.cc index b32ea8f..3cc796c 100644 --- a/chrome/browser/ash/file_manager/documents_provider_root_manager.cc +++ b/chrome/browser/ash/file_manager/documents_provider_root_manager.cc
@@ -65,6 +65,10 @@ class BitmapWrapper { public: explicit BitmapWrapper(const SkBitmap* bitmap) : bitmap_(bitmap) {} + + BitmapWrapper(const BitmapWrapper&) = delete; + BitmapWrapper& operator=(const BitmapWrapper&) = delete; + bool operator<(const BitmapWrapper& other) const { const size_t size1 = bitmap_->computeByteSize(); const size_t size2 = other.bitmap_->computeByteSize(); @@ -78,7 +82,6 @@ private: const SkBitmap* const bitmap_; - DISALLOW_COPY_AND_ASSIGN(BitmapWrapper); }; } // namespace
diff --git a/chrome/browser/ash/file_manager/file_browser_handlers.cc b/chrome/browser/ash/file_manager/file_browser_handlers.cc index a55c8f2..1b1625f 100644 --- a/chrome/browser/ash/file_manager/file_browser_handlers.cc +++ b/chrome/browser/ash/file_manager/file_browser_handlers.cc
@@ -161,6 +161,10 @@ const Extension* extension, const std::string& action_id); + FileBrowserHandlerExecutor(const FileBrowserHandlerExecutor&) = delete; + FileBrowserHandlerExecutor& operator=(const FileBrowserHandlerExecutor&) = + delete; + // Executes the task for each file. |done| will be run with the result. void Execute(const std::vector<FileSystemURL>& file_urls, file_tasks::FileTaskFinishedCallback done); @@ -201,8 +205,6 @@ const std::string action_id_; file_tasks::FileTaskFinishedCallback done_; base::WeakPtrFactory<FileBrowserHandlerExecutor> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(FileBrowserHandlerExecutor); }; // static
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest.cc b/chrome/browser/ash/file_manager/file_manager_browsertest.cc index e73de41..1bfb019e 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest.cc
@@ -195,6 +195,9 @@ public: FilesAppBrowserTest() = default; + FilesAppBrowserTest(const FilesAppBrowserTest&) = delete; + FilesAppBrowserTest& operator=(const FilesAppBrowserTest&) = delete; + protected: void SetUpCommandLine(base::CommandLine* command_line) override { FileManagerBrowserTestBase::SetUpCommandLine(command_line); @@ -217,9 +220,6 @@ } Options GetOptions() const override { return GetParam().options; } - - private: - DISALLOW_COPY_AND_ASSIGN(FilesAppBrowserTest); }; IN_PROC_BROWSER_TEST_P(FilesAppBrowserTest, Test) { @@ -232,8 +232,9 @@ public: ExtendedFilesAppBrowserTest() = default; - private: - DISALLOW_COPY_AND_ASSIGN(ExtendedFilesAppBrowserTest); + ExtendedFilesAppBrowserTest(const ExtendedFilesAppBrowserTest&) = delete; + ExtendedFilesAppBrowserTest& operator=(const ExtendedFilesAppBrowserTest&) = + delete; }; IN_PROC_BROWSER_TEST_P(ExtendedFilesAppBrowserTest, PRE_Test) {
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc index e5cfc903..847bc81 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc
@@ -590,6 +590,10 @@ class TestVolume { protected: explicit TestVolume(const std::string& name) : name_(name) {} + + TestVolume(const TestVolume&) = delete; + TestVolume& operator=(const TestVolume&) = delete; + virtual ~TestVolume() = default; bool CreateRootDirectory(const Profile* profile) { @@ -621,8 +625,6 @@ base::FilePath root_; bool root_initialized_ = false; std::string name_; - - DISALLOW_COPY_AND_ASSIGN(TestVolume); }; base::Lock& GetLockForBlockingDefaultFileTaskRunner() {
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest_base.h b/chrome/browser/ash/file_manager/file_manager_browsertest_base.h index 8e09ff7..fd75843 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest_base.h +++ b/chrome/browser/ash/file_manager/file_manager_browsertest_base.h
@@ -112,6 +112,10 @@ bool enable_banners_framework = false; }; + FileManagerBrowserTestBase(const FileManagerBrowserTestBase&) = delete; + FileManagerBrowserTestBase& operator=(const FileManagerBrowserTestBase&) = + delete; + protected: FileManagerBrowserTestBase(); ~FileManagerBrowserTestBase() override; @@ -241,8 +245,6 @@ base::FilePath devtools_code_coverage_dir_; DevToolsAgentMap devtools_agent_; uint32_t process_id_ = 0; - - DISALLOW_COPY_AND_ASSIGN(FileManagerBrowserTestBase); }; std::ostream& operator<<(std::ostream& out, GuestMode mode);
diff --git a/chrome/browser/ash/file_manager/file_tasks_notifier_factory.h b/chrome/browser/ash/file_manager/file_tasks_notifier_factory.h index 092dc16d..63fff602 100644 --- a/chrome/browser/ash/file_manager/file_tasks_notifier_factory.h +++ b/chrome/browser/ash/file_manager/file_tasks_notifier_factory.h
@@ -19,15 +19,15 @@ public: FileTasksNotifierFactory(); + FileTasksNotifierFactory(const FileTasksNotifierFactory&) = delete; + FileTasksNotifierFactory& operator=(const FileTasksNotifierFactory&) = delete; + static FileTasksNotifierFactory* GetInstance(); FileTasksNotifier* GetForProfile(Profile* profile); KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - - private: - DISALLOW_COPY_AND_ASSIGN(FileTasksNotifierFactory); }; } // namespace file_tasks
diff --git a/chrome/browser/ash/file_manager/fileapi_util.cc b/chrome/browser/ash/file_manager/fileapi_util.cc index 94435519..20281eb 100644 --- a/chrome/browser/ash/file_manager/fileapi_util.cc +++ b/chrome/browser/ash/file_manager/fileapi_util.cc
@@ -339,6 +339,11 @@ NotifyComplete(std::move(lifetime)); } + ConvertSelectedFileInfoListToFileChooserFileInfoListImpl( + const ConvertSelectedFileInfoListToFileChooserFileInfoListImpl&) = delete; + ConvertSelectedFileInfoListToFileChooserFileInfoListImpl& operator=( + const ConvertSelectedFileInfoListToFileChooserFileInfoListImpl&) = delete; + ~ConvertSelectedFileInfoListToFileChooserFileInfoListImpl() { for (const auto& info : chooser_info_list_) { if (info && info->is_file_system()) { @@ -421,9 +426,6 @@ scoped_refptr<storage::FileSystemContext> context_; FileChooserFileInfoList chooser_info_list_; FileChooserFileInfoListCallback callback_; - - DISALLOW_COPY_AND_ASSIGN( - ConvertSelectedFileInfoListToFileChooserFileInfoListImpl); }; void CheckIfDirectoryExistsOnIoThread(
diff --git a/chrome/browser/ash/file_manager/guest_os_file_tasks_unittest.cc b/chrome/browser/ash/file_manager/guest_os_file_tasks_unittest.cc index efc45d5..3128d79f 100644 --- a/chrome/browser/ash/file_manager/guest_os_file_tasks_unittest.cc +++ b/chrome/browser/ash/file_manager/guest_os_file_tasks_unittest.cc
@@ -36,6 +36,9 @@ protected: GuestOsFileTasksTest() = default; + GuestOsFileTasksTest(const GuestOsFileTasksTest&) = delete; + GuestOsFileTasksTest& operator=(const GuestOsFileTasksTest&) = delete; + void SetUp() override { storage::ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( util::GetDownloadsMountPointName(&profile_), @@ -105,8 +108,6 @@ std::vector<guest_os::GuestOsRegistryService::VmType> app_vm_types_; crostini::FakeCrostiniFeatures fake_crostini_features_; plugin_vm::FakePluginVmFeatures fake_plugin_vm_features_; - - DISALLOW_COPY_AND_ASSIGN(GuestOsFileTasksTest); }; TEST_F(GuestOsFileTasksTest, CheckPathsCanBeShared) {
diff --git a/chrome/browser/ash/file_manager/snapshot_manager.cc b/chrome/browser/ash/file_manager/snapshot_manager.cc index 3de68e4..b5a7758 100644 --- a/chrome/browser/ash/file_manager/snapshot_manager.cc +++ b/chrome/browser/ash/file_manager/snapshot_manager.cc
@@ -96,6 +96,9 @@ public: FileRefsHolder() = default; + FileRefsHolder(const FileRefsHolder&) = delete; + FileRefsHolder& operator=(const FileRefsHolder&) = delete; + void FreeSpaceAndCreateSnapshotFile( scoped_refptr<storage::FileSystemContext> context, const storage::FileSystemURL& url, @@ -131,8 +134,6 @@ ~FileRefsHolder() = default; base::circular_deque<FileReferenceWithSizeInfo> file_refs_; - - DISALLOW_COPY_AND_ASSIGN(FileRefsHolder); }; void SnapshotManager::FileRefsHolder::FreeSpaceAndCreateSnapshotFile(
diff --git a/chrome/browser/ash/file_manager/volume_manager_factory.h b/chrome/browser/ash/file_manager/volume_manager_factory.h index e32f01c7..4c25ba9d 100644 --- a/chrome/browser/ash/file_manager/volume_manager_factory.h +++ b/chrome/browser/ash/file_manager/volume_manager_factory.h
@@ -29,6 +29,9 @@ static VolumeManagerFactory* GetInstance(); + VolumeManagerFactory(const VolumeManagerFactory&) = delete; + VolumeManagerFactory& operator=(const VolumeManagerFactory&) = delete; + protected: // BrowserContextKeyedServiceFactory overrides: content::BrowserContext* GetBrowserContextToUse( @@ -44,8 +47,6 @@ VolumeManagerFactory(); ~VolumeManagerFactory() override; - - DISALLOW_COPY_AND_ASSIGN(VolumeManagerFactory); }; } // namespace file_manager
diff --git a/chrome/browser/ash/file_system_provider/fake_provided_file_system.h b/chrome/browser/ash/file_system_provider/fake_provided_file_system.h index 1b194db..532765a 100644 --- a/chrome/browser/ash/file_system_provider/fake_provided_file_system.h +++ b/chrome/browser/ash/file_system_provider/fake_provided_file_system.h
@@ -49,13 +49,14 @@ FakeEntry(); FakeEntry(std::unique_ptr<EntryMetadata> metadata, const std::string& contents); + + FakeEntry(const FakeEntry&) = delete; + FakeEntry& operator=(const FakeEntry&) = delete; + ~FakeEntry(); std::unique_ptr<EntryMetadata> metadata; std::string contents; - - private: - DISALLOW_COPY_AND_ASSIGN(FakeEntry); }; // Fake provided file system implementation. Does not communicate with target
diff --git a/chrome/browser/ash/file_system_provider/fileapi/file_stream_reader.cc b/chrome/browser/ash/file_system_provider/fileapi/file_stream_reader.cc index f9b1935..caafdc6 100644 --- a/chrome/browser/ash/file_system_provider/fileapi/file_stream_reader.cc +++ b/chrome/browser/ash/file_system_provider/fileapi/file_stream_reader.cc
@@ -41,6 +41,9 @@ public: OperationRunner() : file_handle_(0) {} + OperationRunner(const OperationRunner&) = delete; + OperationRunner& operator=(const OperationRunner&) = delete; + // Opens a file for reading and calls the completion callback. Must be called // on UI thread. void OpenFileOnUIThread(const storage::FileSystemURL& url, @@ -183,8 +186,6 @@ base::FilePath file_path_; std::unique_ptr<ScopedFileOpener> file_opener_; int file_handle_; - - DISALLOW_COPY_AND_ASSIGN(OperationRunner); }; FileStreamReader::FileStreamReader(storage::FileSystemContext* context,
diff --git a/chrome/browser/ash/file_system_provider/fileapi/file_stream_writer.cc b/chrome/browser/ash/file_system_provider/fileapi/file_stream_writer.cc index 57745f3f..752603f3 100644 --- a/chrome/browser/ash/file_system_provider/fileapi/file_stream_writer.cc +++ b/chrome/browser/ash/file_system_provider/fileapi/file_stream_writer.cc
@@ -34,6 +34,9 @@ public: OperationRunner() : file_handle_(0) {} + OperationRunner(const OperationRunner&) = delete; + OperationRunner& operator=(const OperationRunner&) = delete; + // Opens a file for writing and calls the completion callback. Must be called // on UI thread. void OpenFileOnUIThread(const storage::FileSystemURL& url, @@ -129,8 +132,6 @@ base::WeakPtr<ProvidedFileSystemInterface> file_system_; std::unique_ptr<ScopedFileOpener> file_opener_; int file_handle_; - - DISALLOW_COPY_AND_ASSIGN(OperationRunner); }; FileStreamWriter::FileStreamWriter(const storage::FileSystemURL& url,
diff --git a/chrome/browser/ash/file_system_provider/logging_observer.h b/chrome/browser/ash/file_system_provider/logging_observer.h index 7244ea9..9a3fcde 100644 --- a/chrome/browser/ash/file_system_provider/logging_observer.h +++ b/chrome/browser/ash/file_system_provider/logging_observer.h
@@ -37,6 +37,10 @@ }; LoggingObserver(); + + LoggingObserver(const LoggingObserver&) = delete; + LoggingObserver& operator=(const LoggingObserver&) = delete; + ~LoggingObserver() override; // file_system_provider::Observer overrides. @@ -50,8 +54,6 @@ std::vector<Event> mounts; std::vector<Event> unmounts; - - DISALLOW_COPY_AND_ASSIGN(LoggingObserver); }; } // namespace file_system_provider
diff --git a/chrome/browser/ash/file_system_provider/operations/get_actions_unittest.cc b/chrome/browser/ash/file_system_provider/operations/get_actions_unittest.cc index c715569..46292bf 100644 --- a/chrome/browser/ash/file_system_provider/operations/get_actions_unittest.cc +++ b/chrome/browser/ash/file_system_provider/operations/get_actions_unittest.cc
@@ -59,6 +59,10 @@ }; CallbackLogger() {} + + CallbackLogger(const CallbackLogger&) = delete; + CallbackLogger& operator=(const CallbackLogger&) = delete; + virtual ~CallbackLogger() {} void OnGetActions(const Actions& actions, base::File::Error result) { @@ -69,8 +73,6 @@ private: std::vector<std::unique_ptr<Event>> events_; - - DISALLOW_COPY_AND_ASSIGN(CallbackLogger); }; // Returns the request value as |result| in case of successful parse.
diff --git a/chrome/browser/ash/file_system_provider/operations/get_metadata_unittest.cc b/chrome/browser/ash/file_system_provider/operations/get_metadata_unittest.cc index aea386b..488159f4 100644 --- a/chrome/browser/ash/file_system_provider/operations/get_metadata_unittest.cc +++ b/chrome/browser/ash/file_system_provider/operations/get_metadata_unittest.cc
@@ -78,6 +78,10 @@ }; CallbackLogger() {} + + CallbackLogger(const CallbackLogger&) = delete; + CallbackLogger& operator=(const CallbackLogger&) = delete; + virtual ~CallbackLogger() {} void OnGetMetadata(std::unique_ptr<EntryMetadata> metadata, @@ -89,8 +93,6 @@ private: std::vector<std::unique_ptr<Event>> events_; - - DISALLOW_COPY_AND_ASSIGN(CallbackLogger); }; } // namespace
diff --git a/chrome/browser/ash/file_system_provider/operations/open_file_unittest.cc b/chrome/browser/ash/file_system_provider/operations/open_file_unittest.cc index ef180fc..6c59ac0 100644 --- a/chrome/browser/ash/file_system_provider/operations/open_file_unittest.cc +++ b/chrome/browser/ash/file_system_provider/operations/open_file_unittest.cc
@@ -55,6 +55,10 @@ }; CallbackLogger() {} + + CallbackLogger(const CallbackLogger&) = delete; + CallbackLogger& operator=(const CallbackLogger&) = delete; + virtual ~CallbackLogger() {} void OnOpenFile(int file_handle, base::File::Error result) { @@ -65,8 +69,6 @@ private: std::vector<std::unique_ptr<Event>> events_; - - DISALLOW_COPY_AND_ASSIGN(CallbackLogger); }; } // namespace
diff --git a/chrome/browser/ash/file_system_provider/operations/read_directory_unittest.cc b/chrome/browser/ash/file_system_provider/operations/read_directory_unittest.cc index 5c7860c..6f79acd 100644 --- a/chrome/browser/ash/file_system_provider/operations/read_directory_unittest.cc +++ b/chrome/browser/ash/file_system_provider/operations/read_directory_unittest.cc
@@ -67,6 +67,10 @@ }; CallbackLogger() {} + + CallbackLogger(const CallbackLogger&) = delete; + CallbackLogger& operator=(const CallbackLogger&) = delete; + virtual ~CallbackLogger() {} void OnReadDirectory(base::File::Error result, @@ -80,8 +84,6 @@ private: std::vector<std::unique_ptr<Event>> events_; - - DISALLOW_COPY_AND_ASSIGN(CallbackLogger); }; // Returns the request value as |result| in case of successful parse.
diff --git a/chrome/browser/ash/file_system_provider/operations/read_file_unittest.cc b/chrome/browser/ash/file_system_provider/operations/read_file_unittest.cc index c2dd4c7..5d3ae73 100644 --- a/chrome/browser/ash/file_system_provider/operations/read_file_unittest.cc +++ b/chrome/browser/ash/file_system_provider/operations/read_file_unittest.cc
@@ -62,6 +62,10 @@ }; CallbackLogger() {} + + CallbackLogger(const CallbackLogger&) = delete; + CallbackLogger& operator=(const CallbackLogger&) = delete; + virtual ~CallbackLogger() {} void OnReadFile(int chunk_length, bool has_more, base::File::Error result) { @@ -72,8 +76,6 @@ private: std::vector<std::unique_ptr<Event>> events_; - - DISALLOW_COPY_AND_ASSIGN(CallbackLogger); }; } // namespace
diff --git a/chrome/browser/ash/file_system_provider/provided_file_system.cc b/chrome/browser/ash/file_system_provider/provided_file_system.cc index e6d1636..399688b7 100644 --- a/chrome/browser/ash/file_system_provider/provided_file_system.cc +++ b/chrome/browser/ash/file_system_provider/provided_file_system.cc
@@ -116,6 +116,10 @@ changes(std::move(changes)), tag(tag), callback(std::move(callback)) {} + + NotifyInQueueArgs(const NotifyInQueueArgs&) = delete; + NotifyInQueueArgs& operator=(const NotifyInQueueArgs&) = delete; + ~NotifyInQueueArgs() {} const size_t token; @@ -125,9 +129,6 @@ const std::unique_ptr<ProvidedFileSystemObserver::Changes> changes; const std::string tag; storage::AsyncFileUtil::StatusCallback callback; - - private: - DISALLOW_COPY_AND_ASSIGN(NotifyInQueueArgs); }; ProvidedFileSystem::ProvidedFileSystem(
diff --git a/chrome/browser/ash/file_system_provider/provided_file_system_interface.h b/chrome/browser/ash/file_system_provider/provided_file_system_interface.h index e9c23b0..e8c8c89 100644 --- a/chrome/browser/ash/file_system_provider/provided_file_system_interface.h +++ b/chrome/browser/ash/file_system_provider/provided_file_system_interface.h
@@ -41,6 +41,10 @@ // Represents metadata for either a file or a directory. struct EntryMetadata { EntryMetadata(); + + EntryMetadata(const EntryMetadata&) = delete; + EntryMetadata& operator=(const EntryMetadata&) = delete; + ~EntryMetadata(); // All of the metadata fields are optional. All strings which are set, are @@ -51,9 +55,6 @@ std::unique_ptr<base::Time> modification_time; std::unique_ptr<std::string> mime_type; std::unique_ptr<std::string> thumbnail; - - private: - DISALLOW_COPY_AND_ASSIGN(EntryMetadata); }; // Represents actions for either a file or a directory.
diff --git a/chrome/browser/ash/file_system_provider/provided_file_system_unittest.cc b/chrome/browser/ash/file_system_provider/provided_file_system_unittest.cc index af4d19b..932f27c 100644 --- a/chrome/browser/ash/file_system_provider/provided_file_system_unittest.cc +++ b/chrome/browser/ash/file_system_provider/provided_file_system_unittest.cc
@@ -144,6 +144,9 @@ Observer() : list_changed_counter_(0), tag_updated_counter_(0) {} + Observer(const Observer&) = delete; + Observer& operator=(const Observer&) = delete; + // ProvidedFileSystemInterfaceObserver overrides. void OnWatcherChanged(const ProvidedFileSystemInfo& file_system_info, const Watcher& watcher, @@ -186,8 +189,6 @@ int list_changed_counter_; int tag_updated_counter_; base::OnceClosure complete_callback_; - - DISALLOW_COPY_AND_ASSIGN(Observer); }; // Stub notification manager, which works in unit tests.
diff --git a/chrome/browser/ash/file_system_provider/request_manager.h b/chrome/browser/ash/file_system_provider/request_manager.h index 084c83f..947fadf0 100644 --- a/chrome/browser/ash/file_system_provider/request_manager.h +++ b/chrome/browser/ash/file_system_provider/request_manager.h
@@ -152,6 +152,10 @@ private: struct Request { Request(); + + Request(const Request&) = delete; + Request& operator=(const Request&) = delete; + ~Request(); // Timer for discarding the request during a timeout. @@ -159,9 +163,6 @@ // Handler tied to this request. std::unique_ptr<HandlerInterface> handler; - - private: - DISALLOW_COPY_AND_ASSIGN(Request); }; // Destroys the request with the passed |request_id|.
diff --git a/chrome/browser/ash/file_system_provider/request_manager_unittest.cc b/chrome/browser/ash/file_system_provider/request_manager_unittest.cc index ef3eafae..73c4eaf 100644 --- a/chrome/browser/ash/file_system_provider/request_manager_unittest.cc +++ b/chrome/browser/ash/file_system_provider/request_manager_unittest.cc
@@ -129,6 +129,10 @@ }; EventLogger() {} + + EventLogger(const EventLogger&) = delete; + EventLogger& operator=(const EventLogger&) = delete; + virtual ~EventLogger() {} void OnExecute(int request_id) { @@ -168,8 +172,6 @@ std::vector<std::unique_ptr<SuccessEvent>> success_events_; std::vector<std::unique_ptr<ErrorEvent>> error_events_; base::WeakPtrFactory<EventLogger> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(EventLogger); }; // Fake handler, which forwards callbacks to the logger. The handler is owned @@ -265,6 +267,10 @@ }; RequestObserver() {} + + RequestObserver(const RequestObserver&) = delete; + RequestObserver& operator=(const RequestObserver&) = delete; + ~RequestObserver() override {} // RequestManager::Observer overrides. @@ -315,8 +321,6 @@ std::vector<FulfilledEvent> fulfilled_; std::vector<RejectedEvent> rejected_; std::vector<Event> timeouted_; - - DISALLOW_COPY_AND_ASSIGN(RequestObserver); }; } // namespace
diff --git a/chrome/browser/ash/file_system_provider/service_factory.h b/chrome/browser/ash/file_system_provider/service_factory.h index f839b64..fdc2cea 100644 --- a/chrome/browser/ash/file_system_provider/service_factory.h +++ b/chrome/browser/ash/file_system_provider/service_factory.h
@@ -28,6 +28,9 @@ // Gets a singleton instance of the factory. static ServiceFactory* GetInstance(); + ServiceFactory(const ServiceFactory&) = delete; + ServiceFactory& operator=(const ServiceFactory&) = delete; + private: friend struct base::DefaultSingletonTraits<ServiceFactory>; @@ -40,8 +43,6 @@ bool ServiceIsCreatedWithBrowserContext() const override; content::BrowserContext* GetBrowserContextToUse( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(ServiceFactory); }; } // namespace file_system_provider
diff --git a/chrome/browser/ash/first_run/drive_first_run_controller.h b/chrome/browser/ash/first_run/drive_first_run_controller.h index cbfe683..52d4c15 100644 --- a/chrome/browser/ash/first_run/drive_first_run_controller.h +++ b/chrome/browser/ash/first_run/drive_first_run_controller.h
@@ -47,6 +47,10 @@ }; explicit DriveFirstRunController(Profile* profile); + + DriveFirstRunController(const DriveFirstRunController&) = delete; + DriveFirstRunController& operator=(const DriveFirstRunController&) = delete; + ~DriveFirstRunController(); // Starts the process to enable offline mode for the user's Drive account. @@ -88,8 +92,6 @@ int web_contents_timeout_secs_; std::string drive_offline_endpoint_url_; std::string drive_hosted_app_id_; - - DISALLOW_COPY_AND_ASSIGN(DriveFirstRunController); }; } // namespace ash
diff --git a/chrome/browser/ash/guest_os/guest_os_registry_service.h b/chrome/browser/ash/guest_os/guest_os_registry_service.h index 8bb6856..94b4e6de 100644 --- a/chrome/browser/ash/guest_os/guest_os_registry_service.h +++ b/chrome/browser/ash/guest_os/guest_os_registry_service.h
@@ -131,6 +131,10 @@ }; explicit GuestOsRegistryService(Profile* profile); + + GuestOsRegistryService(const GuestOsRegistryService&) = delete; + GuestOsRegistryService& operator=(const GuestOsRegistryService&) = delete; + ~GuestOsRegistryService() override; base::WeakPtr<GuestOsRegistryService> GetWeakPtr(); @@ -277,8 +281,6 @@ std::map<std::string, uint32_t> retry_icon_requests_; base::WeakPtrFactory<GuestOsRegistryService> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(GuestOsRegistryService); }; } // namespace guest_os
diff --git a/chrome/browser/ash/guest_os/guest_os_registry_service_factory.h b/chrome/browser/ash/guest_os/guest_os_registry_service_factory.h index 861c93d..9c98918c 100644 --- a/chrome/browser/ash/guest_os/guest_os_registry_service_factory.h +++ b/chrome/browser/ash/guest_os/guest_os_registry_service_factory.h
@@ -20,6 +20,10 @@ static guest_os::GuestOsRegistryService* GetForProfile(Profile* profile); static GuestOsRegistryServiceFactory* GetInstance(); + GuestOsRegistryServiceFactory(const GuestOsRegistryServiceFactory&) = delete; + GuestOsRegistryServiceFactory& operator=( + const GuestOsRegistryServiceFactory&) = delete; + private: friend class base::NoDestructor<GuestOsRegistryServiceFactory>; @@ -29,8 +33,6 @@ // BrowserContextKeyedServiceFactory: KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(GuestOsRegistryServiceFactory); }; } // namespace guest_os
diff --git a/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc b/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc index b06bd64..2623e10 100644 --- a/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc +++ b/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc
@@ -42,6 +42,10 @@ RecreateService(); } + GuestOsRegistryServiceTest(const GuestOsRegistryServiceTest&) = delete; + GuestOsRegistryServiceTest& operator=(const GuestOsRegistryServiceTest&) = + delete; + protected: void RecreateService() { service_.reset(nullptr); @@ -87,8 +91,6 @@ crostini::CrostiniTestHelper crostini_test_helper_; std::unique_ptr<GuestOsRegistryService> service_; - - DISALLOW_COPY_AND_ASSIGN(GuestOsRegistryServiceTest); }; TEST_F(GuestOsRegistryServiceTest, SetAndGetRegistration) {
diff --git a/chrome/browser/ash/guest_os/guest_os_share_path_factory.h b/chrome/browser/ash/guest_os/guest_os_share_path_factory.h index c1fdd66..2357afc 100644 --- a/chrome/browser/ash/guest_os/guest_os_share_path_factory.h +++ b/chrome/browser/ash/guest_os/guest_os_share_path_factory.h
@@ -20,6 +20,9 @@ static GuestOsSharePath* GetForProfile(Profile* profile); static GuestOsSharePathFactory* GetInstance(); + GuestOsSharePathFactory(const GuestOsSharePathFactory&) = delete; + GuestOsSharePathFactory& operator=(const GuestOsSharePathFactory&) = delete; + private: friend class base::NoDestructor<GuestOsSharePathFactory>; @@ -29,8 +32,6 @@ // BrowserContextKeyedServiceFactory: KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(GuestOsSharePathFactory); }; } // namespace guest_os
diff --git a/chrome/browser/ash/hats/hats_finch_helper_unittest.cc b/chrome/browser/ash/hats/hats_finch_helper_unittest.cc index b53e32d..926d668 100644 --- a/chrome/browser/ash/hats/hats_finch_helper_unittest.cc +++ b/chrome/browser/ash/hats/hats_finch_helper_unittest.cc
@@ -27,6 +27,9 @@ public: HatsFinchHelperTest() {} + HatsFinchHelperTest(const HatsFinchHelperTest&) = delete; + HatsFinchHelperTest& operator=(const HatsFinchHelperTest&) = delete; + void SetFeatureParams(const base::FieldTrialParams& params) { scoped_feature_list_.InitAndEnableFeatureWithParameters( features::kHappinessTrackingSystem, params); @@ -57,8 +60,6 @@ private: base::test::ScopedFeatureList scoped_feature_list_; - - DISALLOW_COPY_AND_ASSIGN(HatsFinchHelperTest); }; TEST_F(HatsFinchHelperTest, InitFinchSeed_ValidValues) {
diff --git a/chrome/browser/ash/hats/hats_notification_controller.h b/chrome/browser/ash/hats/hats_notification_controller.h index b12009fc..78f1d87 100644 --- a/chrome/browser/ash/hats/hats_notification_controller.h +++ b/chrome/browser/ash/hats/hats_notification_controller.h
@@ -42,6 +42,10 @@ HatsNotificationController(Profile* profile, const HatsConfig& config); + HatsNotificationController(const HatsNotificationController&) = delete; + HatsNotificationController& operator=(const HatsNotificationController&) = + delete; + // Returns true if the survey needs to be displayed for the given |profile|. static bool ShouldShowSurveyToProfile(Profile* profile, const HatsConfig& config); @@ -98,8 +102,6 @@ HatsState state_ = HatsState::kDeviceSelected; base::WeakPtrFactory<HatsNotificationController> weak_pointer_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(HatsNotificationController); }; } // namespace ash
diff --git a/chrome/browser/ash/input_method/input_method_engine_base.h b/chrome/browser/ash/input_method/input_method_engine_base.h index 671278d2..1b3c540 100644 --- a/chrome/browser/ash/input_method/input_method_engine_base.h +++ b/chrome/browser/ash/input_method/input_method_engine_base.h
@@ -251,13 +251,14 @@ const std::string& component_id, ui::IMEEngineHandlerInterface::KeyEventDoneCallback callback); PendingKeyEvent(PendingKeyEvent&& other); + + PendingKeyEvent(const PendingKeyEvent&) = delete; + PendingKeyEvent& operator=(const PendingKeyEvent&) = delete; + ~PendingKeyEvent(); std::string component_id; ui::IMEEngineHandlerInterface::KeyEventDoneCallback callback; - - private: - DISALLOW_COPY_AND_ASSIGN(PendingKeyEvent); }; // Returns true if this IME is active, false if not.
diff --git a/chrome/browser/ash/input_method/input_method_manager_impl.h b/chrome/browser/ash/input_method/input_method_manager_impl.h index 69d0da81..ac1204b 100644 --- a/chrome/browser/ash/input_method/input_method_manager_impl.h +++ b/chrome/browser/ash/input_method/input_method_manager_impl.h
@@ -190,6 +190,10 @@ std::unique_ptr<ComponentExtensionIMEManagerDelegate> component_extension_ime_manager_delegate, bool enable_extension_loading); + + InputMethodManagerImpl(const InputMethodManagerImpl&) = delete; + InputMethodManagerImpl& operator=(const InputMethodManagerImpl&) = delete; + ~InputMethodManagerImpl() override; // InputMethodManager override: @@ -334,8 +338,6 @@ ImeServiceConnectorMap ime_service_connectors_; content::NotificationRegistrar notification_registrar_; - - DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); }; } // namespace input_method
diff --git a/chrome/browser/ash/input_method/mock_input_method_manager_impl.h b/chrome/browser/ash/input_method/mock_input_method_manager_impl.h index c9189a0..5d223d5 100644 --- a/chrome/browser/ash/input_method/mock_input_method_manager_impl.h +++ b/chrome/browser/ash/input_method/mock_input_method_manager_impl.h
@@ -24,6 +24,9 @@ public: explicit State(MockInputMethodManagerImpl* manager); + State(const State&) = delete; + State& operator=(const State&) = delete; + // MockInputMethodManager::State: scoped_refptr<InputMethodManager::State> Clone() const override; std::unique_ptr<InputMethodDescriptors> GetEnabledInputMethods() @@ -41,11 +44,14 @@ private: MockInputMethodManager* const manager_; - - DISALLOW_COPY_AND_ASSIGN(State); }; MockInputMethodManagerImpl(); + + MockInputMethodManagerImpl(const MockInputMethodManagerImpl&) = delete; + MockInputMethodManagerImpl& operator=(const MockInputMethodManagerImpl&) = + delete; + ~MockInputMethodManagerImpl() override; // MockInputMethodManager: @@ -94,8 +100,6 @@ FakeImeKeyboard keyboard_; bool mod3_used_ = false; std::unique_ptr<ComponentExtensionIMEManager> comp_ime_manager_; - - DISALLOW_COPY_AND_ASSIGN(MockInputMethodManagerImpl); }; } // namespace input_method
diff --git a/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc b/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc index c9e6ffd0..a2dcffba 100644 --- a/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc +++ b/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc
@@ -157,6 +157,9 @@ AddAccount(); } + KerberosAddAccountRunner(const KerberosAddAccountRunner&) = delete; + KerberosAddAccountRunner& operator=(const KerberosAddAccountRunner&) = delete; + private: // Adds the |normalized_principal_| account to the Kerberos daemon. void AddAccount() { @@ -283,7 +286,6 @@ bool is_new_account_ = false; base::WeakPtrFactory<KerberosAddAccountRunner> weak_factory_{this}; - DISALLOW_COPY_AND_ASSIGN(KerberosAddAccountRunner); }; KerberosCredentialsManager::Observer::Observer() = default;
diff --git a/chrome/browser/ash/login/active_directory_login_browsertest.cc b/chrome/browser/ash/login/active_directory_login_browsertest.cc index e3d40a0..b3736fa 100644 --- a/chrome/browser/ash/login/active_directory_login_browsertest.cc +++ b/chrome/browser/ash/login/active_directory_login_browsertest.cc
@@ -83,6 +83,12 @@ class ActiveDirectoryLoginAutocompleteTest : public ActiveDirectoryLoginTest { public: ActiveDirectoryLoginAutocompleteTest() = default; + + ActiveDirectoryLoginAutocompleteTest( + const ActiveDirectoryLoginAutocompleteTest&) = delete; + ActiveDirectoryLoginAutocompleteTest& operator=( + const ActiveDirectoryLoginAutocompleteTest&) = delete; + void SetUpInProcessBrowserTestFixture() override { ActiveDirectoryLoginTest::SetUpInProcessBrowserTestFixture(); @@ -95,9 +101,6 @@ } std::string autocomplete_realm_; - - private: - DISALLOW_COPY_AND_ASSIGN(ActiveDirectoryLoginAutocompleteTest); }; } // namespace
diff --git a/chrome/browser/ash/login/app_mode/kiosk_browsertest.cc b/chrome/browser/ash/login/app_mode/kiosk_browsertest.cc index d848c6c..a2f043b 100644 --- a/chrome/browser/ash/login/app_mode/kiosk_browsertest.cc +++ b/chrome/browser/ash/login/app_mode/kiosk_browsertest.cc
@@ -2496,6 +2496,10 @@ } class KioskEnterpriseTest : public KioskTest { + public: + KioskEnterpriseTest(const KioskEnterpriseTest&) = delete; + KioskEnterpriseTest& operator=(const KioskEnterpriseTest&) = delete; + protected: KioskEnterpriseTest() { set_use_consumer_kiosk_mode(false); } @@ -2557,8 +2561,6 @@ private: DeviceStateMixin device_state_{ &mixin_host_, DeviceStateMixin::State::OOBE_COMPLETED_CLOUD_ENROLLED}; - - DISALLOW_COPY_AND_ASSIGN(KioskEnterpriseTest); }; IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, EnterpriseKioskApp) { @@ -2665,6 +2667,11 @@ public: KioskVirtualKeyboardTestSoundsManagerTestImpl() {} + KioskVirtualKeyboardTestSoundsManagerTestImpl( + const KioskVirtualKeyboardTestSoundsManagerTestImpl&) = delete; + KioskVirtualKeyboardTestSoundsManagerTestImpl& operator=( + const KioskVirtualKeyboardTestSoundsManagerTestImpl&) = delete; + bool Initialize(SoundKey key, const base::StringPiece& data) override { sound_data_[key] = std::string(data); return true; @@ -2698,8 +2705,6 @@ private: std::map<SoundKey, std::string> sound_data_; - - DISALLOW_COPY_AND_ASSIGN(KioskVirtualKeyboardTestSoundsManagerTestImpl); }; // Specialized test fixture for testing kiosk mode where virtual keyboard is @@ -2775,6 +2780,9 @@ public: KioskHiddenWebUITest() = default; + KioskHiddenWebUITest(const KioskHiddenWebUITest&) = delete; + KioskHiddenWebUITest& operator=(const KioskHiddenWebUITest&) = delete; + // KioskTest: void SetUpOnMainThread() override { LoginDisplayHostWebUI::DisableRestrictiveProxyCheckForTest(); @@ -2806,8 +2814,6 @@ private: bool wallpaper_loaded_ = false; scoped_refptr<content::MessageLoopRunner> runner_; - - DISALLOW_COPY_AND_ASSIGN(KioskHiddenWebUITest); }; IN_PROC_BROWSER_TEST_F(KioskHiddenWebUITest, AutolaunchWarning) {
diff --git a/chrome/browser/ash/login/auth/chrome_cryptohome_authenticator.h b/chrome/browser/ash/login/auth/chrome_cryptohome_authenticator.h index 901b671..a41f39c 100644 --- a/chrome/browser/ash/login/auth/chrome_cryptohome_authenticator.h +++ b/chrome/browser/ash/login/auth/chrome_cryptohome_authenticator.h
@@ -14,10 +14,12 @@ public: explicit ChromeCryptohomeAuthenticator(AuthStatusConsumer* consumer); + ChromeCryptohomeAuthenticator(const ChromeCryptohomeAuthenticator&) = delete; + ChromeCryptohomeAuthenticator& operator=( + const ChromeCryptohomeAuthenticator&) = delete; + protected: ~ChromeCryptohomeAuthenticator() override; - private: - DISALLOW_COPY_AND_ASSIGN(ChromeCryptohomeAuthenticator); }; } // namespace ash
diff --git a/chrome/browser/ash/login/configuration_based_oobe_browsertest.cc b/chrome/browser/ash/login/configuration_based_oobe_browsertest.cc index 6e67047..2048b366 100644 --- a/chrome/browser/ash/login/configuration_based_oobe_browsertest.cc +++ b/chrome/browser/ash/login/configuration_based_oobe_browsertest.cc
@@ -59,6 +59,9 @@ public: OobeConfigurationTest() = default; + OobeConfigurationTest(const OobeConfigurationTest&) = delete; + OobeConfigurationTest& operator=(const OobeConfigurationTest&) = delete; + bool ShouldWaitForOobeUI() override { return false; } void LoadConfiguration() { @@ -134,9 +137,6 @@ protected: std::unique_ptr<base::AutoReset<bool>> branded_build_override_; base::ScopedTempDir fake_policy_dir_; - - private: - DISALLOW_COPY_AND_ASSIGN(OobeConfigurationTest); }; class OobeConfigurationEnrollmentTest : public OobeConfigurationTest {
diff --git a/chrome/browser/ash/login/debug_overlay_browsertest.cc b/chrome/browser/ash/login/debug_overlay_browsertest.cc index 9038bca6..1766288 100644 --- a/chrome/browser/ash/login/debug_overlay_browsertest.cc +++ b/chrome/browser/ash/login/debug_overlay_browsertest.cc
@@ -23,7 +23,7 @@ constexpr int kOobeScreensCount = 39; constexpr int kLoginScreensCount = 35; -constexpr int kOsInstallScreensCount = 1; +constexpr int kOsInstallScreensCount = 2; std::string ElementsInPanel(const std::string& panel) { return base::StrCat({"$('", panel, "').children.length"});
diff --git a/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader.h b/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader.h index 78ac933..2c38d855 100644 --- a/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader.h +++ b/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader.h
@@ -42,6 +42,10 @@ explicit DemoExtensionsExternalLoader(const base::FilePath& cache_dir); + DemoExtensionsExternalLoader(const DemoExtensionsExternalLoader&) = delete; + DemoExtensionsExternalLoader& operator=(const DemoExtensionsExternalLoader&) = + delete; + // Loads the app with `app_id` and installs it from the update url or cache. void LoadApp(const std::string& app_id); @@ -72,8 +76,6 @@ std::vector<std::string> app_ids_; base::WeakPtrFactory<DemoExtensionsExternalLoader> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(DemoExtensionsExternalLoader); }; } // namespace ash
diff --git a/chrome/browser/ash/login/demo_mode/demo_session.h b/chrome/browser/ash/login/demo_mode/demo_session.h index c1a52866..641a98f 100644 --- a/chrome/browser/ash/login/demo_mode/demo_session.h +++ b/chrome/browser/ash/login/demo_mode/demo_session.h
@@ -81,6 +81,9 @@ "us", "be", "ca", "dk", "fi", "fr", "de", "ie", "it", "jp", "lu", "nl", "no", "es", "se", "gb"}; + DemoSession(const DemoSession&) = delete; + DemoSession& operator=(const DemoSession&) = delete; + static std::string DemoConfigToString(DemoModeConfig config); // Whether the device is set up to run demo sessions. @@ -242,8 +245,6 @@ bool screensaver_activated_ = false; base::WeakPtrFactory<DemoSession> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(DemoSession); }; } // namespace ash
diff --git a/chrome/browser/ash/login/demo_mode/demo_session_browsertest.cc b/chrome/browser/ash/login/demo_mode/demo_session_browsertest.cc index 986ae6ab..78800766 100644 --- a/chrome/browser/ash/login/demo_mode/demo_session_browsertest.cc +++ b/chrome/browser/ash/login/demo_mode/demo_session_browsertest.cc
@@ -52,6 +52,11 @@ // Tests locking device to policy::DEVICE_MODE_DEMO mode. It is an equivalent to // going through online demo mode setup or using offline setup. class DemoSessionDemoDeviceModeTest : public OobeBaseTest { + public: + DemoSessionDemoDeviceModeTest(const DemoSessionDemoDeviceModeTest&) = delete; + DemoSessionDemoDeviceModeTest& operator=( + const DemoSessionDemoDeviceModeTest&) = delete; + protected: DemoSessionDemoDeviceModeTest() = default; ~DemoSessionDemoDeviceModeTest() override = default; @@ -65,8 +70,6 @@ private: DeviceStateMixin device_state_{ &mixin_host_, DeviceStateMixin::State::OOBE_COMPLETED_DEMO_MODE}; - - DISALLOW_COPY_AND_ASSIGN(DemoSessionDemoDeviceModeTest); }; IN_PROC_BROWSER_TEST_F(DemoSessionDemoDeviceModeTest, IsDemoMode) { @@ -77,6 +80,12 @@ // mode. It is an equivalent to enrolling device directly by using enterprise // enrollment flow. class DemoSessionDemoEnrolledDeviceTest : public OobeBaseTest { + public: + DemoSessionDemoEnrolledDeviceTest(const DemoSessionDemoEnrolledDeviceTest&) = + delete; + DemoSessionDemoEnrolledDeviceTest& operator=( + const DemoSessionDemoEnrolledDeviceTest&) = delete; + protected: DemoSessionDemoEnrolledDeviceTest() : OobeBaseTest() { device_state_.set_domain(policy::kDemoModeDomain); @@ -93,8 +102,6 @@ private: DeviceStateMixin device_state_{ &mixin_host_, DeviceStateMixin::State::OOBE_COMPLETED_CLOUD_ENROLLED}; - - DISALLOW_COPY_AND_ASSIGN(DemoSessionDemoEnrolledDeviceTest); }; IN_PROC_BROWSER_TEST_F(DemoSessionDemoEnrolledDeviceTest, IsDemoMode) {
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 38609c5..f47bf1d 100644 --- a/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc +++ b/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc
@@ -1101,6 +1101,10 @@ // Demo setup tests related to Force Re-Enrollment. class DemoSetupFRETest : public DemoSetupArcSupportedTest { + public: + DemoSetupFRETest(const DemoSetupFRETest&) = delete; + DemoSetupFRETest& operator=(const DemoSetupFRETest&) = delete; + protected: DemoSetupFRETest() { statistics_provider_.SetMachineStatistic(system::kSerialNumberKeyForTest, @@ -1117,9 +1121,6 @@ } system::ScopedFakeStatisticsProvider statistics_provider_; - - private: - DISALLOW_COPY_AND_ASSIGN(DemoSetupFRETest); }; IN_PROC_BROWSER_TEST_F(DemoSetupFRETest, DeviceFromFactory) {
diff --git a/chrome/browser/ash/login/demo_mode/demo_setup_controller.h b/chrome/browser/ash/login/demo_mode/demo_setup_controller.h index 3745aba..f8d9d62 100644 --- a/chrome/browser/ash/login/demo_mode/demo_setup_controller.h +++ b/chrome/browser/ash/login/demo_mode/demo_setup_controller.h
@@ -189,6 +189,10 @@ static std::string GetDemoSetupStepString(const DemoSetupStep step_enum); DemoSetupController(); + + DemoSetupController(const DemoSetupController&) = delete; + DemoSetupController& operator=(const DemoSetupController&) = delete; + ~DemoSetupController() override; // Sets demo mode config that will be used to setup the device. It has to be @@ -323,8 +327,6 @@ std::unique_ptr<DemoResources> demo_resources_; base::WeakPtrFactory<DemoSetupController> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(DemoSetupController); }; } // namespace ash
diff --git a/chrome/browser/ash/login/demo_mode/demo_setup_controller_unittest.cc b/chrome/browser/ash/login/demo_mode/demo_setup_controller_unittest.cc index d89a3dd..7473f40 100644 --- a/chrome/browser/ash/login/demo_mode/demo_setup_controller_unittest.cc +++ b/chrome/browser/ash/login/demo_mode/demo_setup_controller_unittest.cc
@@ -112,6 +112,10 @@ protected: DemoSetupControllerTest() : testing_local_state_(TestingBrowserProcess::GetGlobal()) {} + + DemoSetupControllerTest(const DemoSetupControllerTest&) = delete; + DemoSetupControllerTest& operator=(const DemoSetupControllerTest&) = delete; + ~DemoSetupControllerTest() override = default; void SetUp() override { @@ -144,8 +148,6 @@ ScopedTestingLocalState testing_local_state_; ScopedStubInstallAttributes test_install_attributes_; system::ScopedFakeStatisticsProvider statistics_provider_; - - DISALLOW_COPY_AND_ASSIGN(DemoSetupControllerTest); }; TEST_F(DemoSetupControllerTest, OfflineSuccess) {
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller.h index 69f5048..f75d673 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller.h +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller.h
@@ -54,6 +54,9 @@ const base::WeakPtr<EasyUnlockNotificationController>& notification_controller); + NotificationDelegate(const NotificationDelegate&) = delete; + NotificationDelegate& operator=(const NotificationDelegate&) = delete; + // message_center::NotificationDelegate: void Click(const absl::optional<int>& button_index, const absl::optional<std::u16string>& reply) override; @@ -63,8 +66,6 @@ std::string notification_id_; base::WeakPtr<EasyUnlockNotificationController> notification_controller_; - - DISALLOW_COPY_AND_ASSIGN(NotificationDelegate); }; // Displays the notification to the user.
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller_chromeos_unittest.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller_chromeos_unittest.cc index 30526c4..86f7dc7c 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller_chromeos_unittest.cc +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller_chromeos_unittest.cc
@@ -38,6 +38,11 @@ protected: EasyUnlockNotificationControllerTest() {} + EasyUnlockNotificationControllerTest( + const EasyUnlockNotificationControllerTest&) = delete; + EasyUnlockNotificationControllerTest& operator=( + const EasyUnlockNotificationControllerTest&) = delete; + ~EasyUnlockNotificationControllerTest() override {} void SetUp() override { @@ -53,9 +58,6 @@ std::unique_ptr<testing::StrictMock<TestableNotificationController>> notification_controller_; std::unique_ptr<NotificationDisplayServiceTester> display_service_; - - private: - DISALLOW_COPY_AND_ASSIGN(EasyUnlockNotificationControllerTest); }; TEST_F(EasyUnlockNotificationControllerTest,
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_service.h index 044dbd49..099c6a3 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service.h +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service.h
@@ -61,6 +61,9 @@ // logged in and their profile is initialized. static EasyUnlockService* GetForUser(const user_manager::User& user); + EasyUnlockService(const EasyUnlockService&) = delete; + EasyUnlockService& operator=(const EasyUnlockService&) = delete; + // Registers Easy Unlock profile preferences. static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); @@ -293,8 +296,6 @@ bool tpm_key_checked_; base::WeakPtrFactory<EasyUnlockService> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(EasyUnlockService); }; } // namespace ash
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_factory.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_factory.h index e8b6927..0d0163db 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_factory.h +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_factory.h
@@ -29,6 +29,9 @@ static EasyUnlockService* GetForBrowserContext( content::BrowserContext* browser_context); + EasyUnlockServiceFactory(const EasyUnlockServiceFactory&) = delete; + EasyUnlockServiceFactory& operator=(const EasyUnlockServiceFactory&) = delete; + void set_app_path_for_testing(const base::FilePath& app_path) { app_path_for_testing_ = app_path; } @@ -50,8 +53,6 @@ bool ServiceIsNULLWhileTesting() const override; base::FilePath app_path_for_testing_; - - DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc index ebd6fca..328d317 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc
@@ -88,6 +88,11 @@ } // namespace class EasyUnlockServiceRegularTest : public testing::Test { + public: + EasyUnlockServiceRegularTest(const EasyUnlockServiceRegularTest&) = delete; + EasyUnlockServiceRegularTest& operator=(const EasyUnlockServiceRegularTest&) = + delete; + protected: EasyUnlockServiceRegularTest() : test_local_device_( @@ -283,8 +288,6 @@ false /* browser_restart */, false /* is_child */); } - - DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceRegularTest); }; TEST_F(EasyUnlockServiceRegularTest, NotAllowedWhenProhibited) {
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_signin_chromeos.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_signin_chromeos.h index baa9eea..81cd7c0 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_signin_chromeos.h +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_signin_chromeos.h
@@ -68,6 +68,10 @@ // Structure containing a user's key data loaded from cryptohome. struct UserData { UserData(); + + UserData(const UserData&) = delete; + UserData& operator=(const UserData&) = delete; + ~UserData(); // The loading state of the data. @@ -79,9 +83,6 @@ // The list of remote device dictionaries understood by Easy unlock app. // This will be returned by `GetRemoteDevices` method. base::ListValue remote_devices_value; - - private: - DISALLOW_COPY_AND_ASSIGN(UserData); }; // EasyUnlockService implementation:
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_tpm_key_manager_factory.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_tpm_key_manager_factory.h index 7413cc3..9c183ef 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_tpm_key_manager_factory.h +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_tpm_key_manager_factory.h
@@ -31,6 +31,11 @@ static EasyUnlockTpmKeyManager* Get(content::BrowserContext* context); static EasyUnlockTpmKeyManager* GetForUser(const std::string& user_id); + EasyUnlockTpmKeyManagerFactory(const EasyUnlockTpmKeyManagerFactory&) = + delete; + EasyUnlockTpmKeyManagerFactory& operator=( + const EasyUnlockTpmKeyManagerFactory&) = delete; + private: friend struct base::DefaultSingletonTraits<EasyUnlockTpmKeyManagerFactory>; @@ -42,8 +47,6 @@ content::BrowserContext* context) const override; content::BrowserContext* GetBrowserContextToUse( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(EasyUnlockTpmKeyManagerFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/login/enrollment/enrollment_local_policy_server_browsertest.cc b/chrome/browser/ash/login/enrollment/enrollment_local_policy_server_browsertest.cc index bbfd699..ecfc28b 100644 --- a/chrome/browser/ash/login/enrollment/enrollment_local_policy_server_browsertest.cc +++ b/chrome/browser/ash/login/enrollment/enrollment_local_policy_server_browsertest.cc
@@ -99,6 +99,11 @@ authenticator_id_ = "$('enterprise-enrollment').authenticator_"; } + EnrollmentLocalPolicyServerBase(const EnrollmentLocalPolicyServerBase&) = + delete; + EnrollmentLocalPolicyServerBase& operator=( + const EnrollmentLocalPolicyServerBase&) = delete; + void SetUpOnMainThread() override { fake_gaia_.SetupFakeGaiaForLogin(FakeGaiaMixin::kFakeUserEmail, FakeGaiaMixin::kFakeUserGaiaId, @@ -178,9 +183,6 @@ FakeGaiaMixin fake_gaia_{&mixin_host_}; DeviceStateMixin device_state_{ &mixin_host_, DeviceStateMixin::State::OOBE_COMPLETED_UNOWNED}; - - private: - DISALLOW_COPY_AND_ASSIGN(EnrollmentLocalPolicyServerBase); }; class AutoEnrollmentLocalPolicyServer : public EnrollmentLocalPolicyServerBase { @@ -189,6 +191,11 @@ device_state_.SetState(DeviceStateMixin::State::BEFORE_OOBE); } + AutoEnrollmentLocalPolicyServer(const AutoEnrollmentLocalPolicyServer&) = + delete; + AutoEnrollmentLocalPolicyServer& operator=( + const AutoEnrollmentLocalPolicyServer&) = delete; + void SetUpCommandLine(base::CommandLine* command_line) override { EnrollmentLocalPolicyServerBase::SetUpCommandLine(command_line); @@ -209,9 +216,6 @@ protected: NetworkPortalDetectorMixin network_portal_detector_{&mixin_host_}; - - private: - DISALLOW_COPY_AND_ASSIGN(AutoEnrollmentLocalPolicyServer); }; class AutoEnrollmentWithStatistics : public AutoEnrollmentLocalPolicyServer { @@ -274,6 +278,9 @@ &fake_statistics_provider_); } + InitialEnrollmentTest(const InitialEnrollmentTest&) = delete; + InitialEnrollmentTest& operator=(const InitialEnrollmentTest&) = delete; + void SetUpCommandLine(base::CommandLine* command_line) override { EnrollmentLocalPolicyServerBase::SetUpCommandLine(command_line); @@ -340,7 +347,6 @@ private: system::ScopedFakeStatisticsProvider fake_statistics_provider_; - DISALLOW_COPY_AND_ASSIGN(InitialEnrollmentTest); }; // Simple manual enrollment. @@ -985,15 +991,15 @@ public: OobeGuestButtonPolicy() = default; + OobeGuestButtonPolicy(const OobeGuestButtonPolicy&) = delete; + OobeGuestButtonPolicy& operator=(const OobeGuestButtonPolicy&) = delete; + void SetUpOnMainThread() override { enterprise_management::ChromeDeviceSettingsProto proto; proto.mutable_guest_mode_enabled()->set_guest_mode_enabled(GetParam()); policy_server_.UpdateDevicePolicy(proto); EnrollmentLocalPolicyServerBase::SetUpOnMainThread(); } - - private: - DISALLOW_COPY_AND_ASSIGN(OobeGuestButtonPolicy); }; IN_PROC_BROWSER_TEST_P(OobeGuestButtonPolicy, VisibilityAfterEnrollment) {
diff --git a/chrome/browser/ash/login/enrollment/enrollment_screen_unittest.cc b/chrome/browser/ash/login/enrollment/enrollment_screen_unittest.cc index 89c249b86..4255e05 100644 --- a/chrome/browser/ash/login/enrollment/enrollment_screen_unittest.cc +++ b/chrome/browser/ash/login/enrollment/enrollment_screen_unittest.cc
@@ -37,6 +37,9 @@ public: EnrollmentScreenUnitTest() = default; + EnrollmentScreenUnitTest(const EnrollmentScreenUnitTest&) = delete; + EnrollmentScreenUnitTest& operator=(const EnrollmentScreenUnitTest&) = delete; + // Creates the EnrollmentScreen and sets required parameters. virtual void SetUpEnrollmentScreen() { wizard_context_ = std::make_unique<WizardContext>(); @@ -99,14 +102,17 @@ // Objects required by the EnrollmentScreen that can be re-used. MockEnrollmentScreenView mock_view_; - - DISALLOW_COPY_AND_ASSIGN(EnrollmentScreenUnitTest); }; class ZeroTouchEnrollmentScreenUnitTest : public EnrollmentScreenUnitTest { public: ZeroTouchEnrollmentScreenUnitTest() = default; + ZeroTouchEnrollmentScreenUnitTest(const ZeroTouchEnrollmentScreenUnitTest&) = + delete; + ZeroTouchEnrollmentScreenUnitTest& operator=( + const ZeroTouchEnrollmentScreenUnitTest&) = delete; + enum AttestationEnrollmentStatus { SUCCESS, DEVICE_NOT_SETUP_FOR_ZERO_TOUCH, @@ -226,9 +232,6 @@ // Start enrollment. enrollment_screen_->Show(wizard_context_.get()); } - - private: - DISALLOW_COPY_AND_ASSIGN(ZeroTouchEnrollmentScreenUnitTest); }; TEST_F(ZeroTouchEnrollmentScreenUnitTest, FinishEnrollmentFlow) { @@ -297,6 +300,11 @@ public: AutomaticEnrollmentScreenUnitTest() = default; + AutomaticEnrollmentScreenUnitTest(const AutomaticEnrollmentScreenUnitTest&) = + delete; + AutomaticEnrollmentScreenUnitTest& operator=( + const AutomaticEnrollmentScreenUnitTest&) = delete; + void SetUpEnrollmentScreen() override { enrollment_config_.mode = GetParam(); enrollment_config_.auth_mechanism = @@ -308,9 +316,6 @@ // Automatic re-enrollment is always setup for fallback. SetUpEnrollmentScreen(); } - - private: - DISALLOW_COPY_AND_ASSIGN(AutomaticEnrollmentScreenUnitTest); }; TEST_P(AutomaticEnrollmentScreenUnitTest, ShowErrorPanel) {
diff --git a/chrome/browser/ash/login/enrollment/hands_off_enrollment_browsertest.cc b/chrome/browser/ash/login/enrollment/hands_off_enrollment_browsertest.cc index 34c70654..86c05b2 100644 --- a/chrome/browser/ash/login/enrollment/hands_off_enrollment_browsertest.cc +++ b/chrome/browser/ash/login/enrollment/hands_off_enrollment_browsertest.cc
@@ -36,6 +36,10 @@ // Hands-off enrollment flow test. class HandsOffEnrollmentTest : public MixinBasedInProcessBrowserTest { + public: + HandsOffEnrollmentTest(const HandsOffEnrollmentTest&) = delete; + HandsOffEnrollmentTest& operator=(const HandsOffEnrollmentTest&) = delete; + protected: HandsOffEnrollmentTest() {} ~HandsOffEnrollmentTest() override = default; @@ -84,9 +88,6 @@ protected: test::EnrollmentHelperMixin enrollment_helper_{&mixin_host_}; std::unique_ptr<base::AutoReset<bool>> branded_build_override_; - - private: - DISALLOW_COPY_AND_ASSIGN(HandsOffEnrollmentTest); }; IN_PROC_BROWSER_TEST_F(HandsOffEnrollmentTest, NetworkConnectionReady) {
diff --git a/chrome/browser/ash/login/enterprise_enrollment_browsertest.cc b/chrome/browser/ash/login/enterprise_enrollment_browsertest.cc index 3621d4b..85f0b65 100644 --- a/chrome/browser/ash/login/enterprise_enrollment_browsertest.cc +++ b/chrome/browser/ash/login/enterprise_enrollment_browsertest.cc
@@ -149,6 +149,10 @@ public: EnterpriseEnrollmentTestBase() = default; + EnterpriseEnrollmentTestBase(const EnterpriseEnrollmentTestBase&) = delete; + EnterpriseEnrollmentTestBase& operator=(const EnterpriseEnrollmentTestBase&) = + delete; + // Submits regular enrollment credentials. void SubmitEnrollmentCredentials() { enrollment_screen()->OnLoginDone( @@ -194,23 +198,23 @@ EXPECT_NE(host, nullptr); return host; } - - private: - DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentTestBase); }; class EnterpriseEnrollmentTest : public EnterpriseEnrollmentTestBase { public: EnterpriseEnrollmentTest() = default; - private: - DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentTest); + EnterpriseEnrollmentTest(const EnterpriseEnrollmentTest&) = delete; + EnterpriseEnrollmentTest& operator=(const EnterpriseEnrollmentTest&) = delete; }; class ActiveDirectoryJoinTest : public EnterpriseEnrollmentTest { public: ActiveDirectoryJoinTest() = default; + ActiveDirectoryJoinTest(const ActiveDirectoryJoinTest&) = delete; + ActiveDirectoryJoinTest& operator=(const ActiveDirectoryJoinTest&) = delete; + void SetUp() override { mock_authpolicy_client_ = new MockAuthPolicyClient(); mock_authpolicy_client()->DisableOperationDelayForTesting(); @@ -411,8 +415,6 @@ private: // Owned by the AuthPolicyClient global instance. MockAuthPolicyClient* mock_authpolicy_client_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ActiveDirectoryJoinTest); }; // Shows the enrollment screen and simulates an enrollment complete event. We
diff --git a/chrome/browser/ash/login/existing_user_controller_browsertest.cc b/chrome/browser/ash/login/existing_user_controller_browsertest.cc index 4d5507b..5933d04 100644 --- a/chrome/browser/ash/login/existing_user_controller_browsertest.cc +++ b/chrome/browser/ash/login/existing_user_controller_browsertest.cc
@@ -213,6 +213,10 @@ protected: ExistingUserControllerTest() = default; + ExistingUserControllerTest(const ExistingUserControllerTest&) = delete; + ExistingUserControllerTest& operator=(const ExistingUserControllerTest&) = + delete; + ExistingUserController* existing_user_controller() { return ExistingUserController::current_controller(); } @@ -325,9 +329,6 @@ AccountId::FromUserEmailGaiaId(kExistingUser, kExistingGaiaID)}; LoginManagerMixin login_manager_{&mixin_host_, {existing_user_}}; - - private: - DISALLOW_COPY_AND_ASSIGN(ExistingUserControllerTest); }; IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, ExistingUserLogin) { @@ -348,14 +349,16 @@ public: ExistingUserControllerUntrustedTest() = default; + ExistingUserControllerUntrustedTest( + const ExistingUserControllerUntrustedTest&) = delete; + ExistingUserControllerUntrustedTest& operator=( + const ExistingUserControllerUntrustedTest&) = delete; + void SetUpOnMainThread() override { ExistingUserControllerTest::SetUpOnMainThread(); MakeCrosSettingsPermanentlyUntrusted(); ExpectLoginFailure(); } - - private: - DISALLOW_COPY_AND_ASSIGN(ExistingUserControllerUntrustedTest); }; IN_PROC_BROWSER_TEST_F(ExistingUserControllerUntrustedTest, @@ -386,6 +389,12 @@ class ExistingUserControllerPublicSessionTest : public ExistingUserControllerTest, public user_manager::UserManager::Observer { + public: + ExistingUserControllerPublicSessionTest( + const ExistingUserControllerPublicSessionTest&) = delete; + ExistingUserControllerPublicSessionTest& operator=( + const ExistingUserControllerPublicSessionTest&) = delete; + protected: ExistingUserControllerPublicSessionTest() {} @@ -554,8 +563,6 @@ private: std::unique_ptr<base::RunLoop> local_state_changed_run_loop_; - - DISALLOW_COPY_AND_ASSIGN(ExistingUserControllerPublicSessionTest); }; IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest,
diff --git a/chrome/browser/ash/login/help_app_launcher.h b/chrome/browser/ash/login/help_app_launcher.h index 9902e4c..0eaf0a2 100644 --- a/chrome/browser/ash/login/help_app_launcher.h +++ b/chrome/browser/ash/login/help_app_launcher.h
@@ -50,6 +50,9 @@ // display. explicit HelpAppLauncher(gfx::NativeWindow parent_window); + HelpAppLauncher(const HelpAppLauncher&) = delete; + HelpAppLauncher& operator=(const HelpAppLauncher&) = delete; + // Shows specified help topic. void ShowHelpTopic(HelpTopic help_topic_id); @@ -67,8 +70,6 @@ // Parent window which is passed to help dialog. gfx::NativeWindow parent_window_; - - DISALLOW_COPY_AND_ASSIGN(HelpAppLauncher); }; } // namespace ash
diff --git a/chrome/browser/ash/login/lock/screen_locker.h b/chrome/browser/ash/login/lock/screen_locker.h index bb8c3d8..b9540abd 100644 --- a/chrome/browser/ash/login/lock/screen_locker.h +++ b/chrome/browser/ash/login/lock/screen_locker.h
@@ -73,6 +73,9 @@ explicit ScreenLocker(const user_manager::UserList& users); + ScreenLocker(const ScreenLocker&) = delete; + ScreenLocker& operator=(const ScreenLocker&) = delete; + // Returns the default instance if it has been created. static ScreenLocker* default_screen_locker() { return screen_locker_; } @@ -323,8 +326,6 @@ SecurityTokenPinDialogHostImpl security_token_pin_dialog_host_impl_; base::WeakPtrFactory<ScreenLocker> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(ScreenLocker); }; } // namespace ash
diff --git a/chrome/browser/ash/login/login_screen_policy_browsertest.cc b/chrome/browser/ash/login/login_screen_policy_browsertest.cc index da94c51..b408d09f 100644 --- a/chrome/browser/ash/login/login_screen_policy_browsertest.cc +++ b/chrome/browser/ash/login/login_screen_policy_browsertest.cc
@@ -54,14 +54,14 @@ public: LoginScreenPolicyTest() = default; + LoginScreenPolicyTest(const LoginScreenPolicyTest&) = delete; + LoginScreenPolicyTest& operator=(const LoginScreenPolicyTest&) = delete; + void RefreshDevicePolicyAndWaitForSettingChange( const char* cros_setting_name); protected: LoginManagerMixin login_manager_{&mixin_host_}; - - private: - DISALLOW_COPY_AND_ASSIGN(LoginScreenPolicyTest); }; void LoginScreenPolicyTest::RefreshDevicePolicyAndWaitForSettingChange(
diff --git a/chrome/browser/ash/login/oobe_localization_browsertest.cc b/chrome/browser/ash/login/oobe_localization_browsertest.cc index fae2644..0d806928 100644 --- a/chrome/browser/ash/login/oobe_localization_browsertest.cc +++ b/chrome/browser/ash/login/oobe_localization_browsertest.cc
@@ -190,6 +190,9 @@ public: OobeLocalizationTest(); + OobeLocalizationTest(const OobeLocalizationTest&) = delete; + OobeLocalizationTest& operator=(const OobeLocalizationTest&) = delete; + // Verifies that the comma-separated `values` corresponds with the first // values in `select_id`, optionally checking for an options group label after // the first set of options. @@ -209,8 +212,6 @@ private: system::ScopedFakeStatisticsProvider fake_statistics_provider_; - - DISALLOW_COPY_AND_ASSIGN(OobeLocalizationTest); }; OobeLocalizationTest::OobeLocalizationTest() : OobeBaseTest() {
diff --git a/chrome/browser/ash/login/profile_auth_data.h b/chrome/browser/ash/login/profile_auth_data.h index 20ef648..a4c5eef 100644 --- a/chrome/browser/ash/login/profile_auth_data.h +++ b/chrome/browser/ash/login/profile_auth_data.h
@@ -18,6 +18,10 @@ // used for authentication to the user's actual BrowserContext. class ProfileAuthData { public: + ProfileAuthData() = delete; + ProfileAuthData(const ProfileAuthData&) = delete; + ProfileAuthData& operator=(const ProfileAuthData&) = delete; + // Transfers authentication-related data from `from_partition` to // `to_partition` and invokes `completion_callback` on the UI thread when the // operation has completed. The following data is transferred: @@ -37,9 +41,6 @@ bool transfer_auth_cookies_on_first_login, bool transfer_saml_auth_cookies_on_subsequent_login, base::OnceClosure completion_callback); - - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(ProfileAuthData); }; } // namespace ash
diff --git a/chrome/browser/ash/login/quick_unlock/fingerprint_storage_unittest.cc b/chrome/browser/ash/login/quick_unlock/fingerprint_storage_unittest.cc index 3ab4723..8a51a76 100644 --- a/chrome/browser/ash/login/quick_unlock/fingerprint_storage_unittest.cc +++ b/chrome/browser/ash/login/quick_unlock/fingerprint_storage_unittest.cc
@@ -20,6 +20,11 @@ namespace { class FingerprintStorageUnitTest : public testing::Test { + public: + FingerprintStorageUnitTest(const FingerprintStorageUnitTest&) = delete; + FingerprintStorageUnitTest& operator=(const FingerprintStorageUnitTest&) = + delete; + protected: FingerprintStorageUnitTest() : profile_(std::make_unique<TestingProfile>()) {} ~FingerprintStorageUnitTest() override {} @@ -36,8 +41,6 @@ content::BrowserTaskEnvironment task_environment_; std::unique_ptr<TestingProfile> profile_; - - DISALLOW_COPY_AND_ASSIGN(FingerprintStorageUnitTest); }; } // namespace @@ -45,6 +48,10 @@ // Provides test-only FingerprintStorage APIs. class FingerprintStorageTestApi { public: + FingerprintStorageTestApi(const FingerprintStorageTestApi&) = delete; + FingerprintStorageTestApi& operator=(const FingerprintStorageTestApi&) = + delete; + // Does *not* take ownership over `fingerprint_storage`. explicit FingerprintStorageTestApi(FingerprintStorage* fingerprint_storage) : fingerprint_storage_(fingerprint_storage) {} @@ -55,8 +62,6 @@ private: FingerprintStorage* fingerprint_storage_; - - DISALLOW_COPY_AND_ASSIGN(FingerprintStorageTestApi); }; // Verifies that:
diff --git a/chrome/browser/ash/login/quick_unlock/pin_storage_prefs_unittest.cc b/chrome/browser/ash/login/quick_unlock/pin_storage_prefs_unittest.cc index c6ec2a1..9102acc 100644 --- a/chrome/browser/ash/login/quick_unlock/pin_storage_prefs_unittest.cc +++ b/chrome/browser/ash/login/quick_unlock/pin_storage_prefs_unittest.cc
@@ -19,6 +19,10 @@ namespace { class PinStoragePrefsUnitTest : public testing::Test { + public: + PinStoragePrefsUnitTest(const PinStoragePrefsUnitTest&) = delete; + PinStoragePrefsUnitTest& operator=(const PinStoragePrefsUnitTest&) = delete; + protected: PinStoragePrefsUnitTest() : profile_(std::make_unique<TestingProfile>()) {} ~PinStoragePrefsUnitTest() override = default; @@ -35,8 +39,6 @@ content::BrowserTaskEnvironment task_environment_; std::unique_ptr<TestingProfile> profile_; - - DISALLOW_COPY_AND_ASSIGN(PinStoragePrefsUnitTest); }; } // namespace @@ -48,6 +50,9 @@ explicit PinStoragePrefsTestApi(PinStoragePrefs* pin_storage) : pin_storage_(pin_storage) {} + PinStoragePrefsTestApi(const PinStoragePrefsTestApi&) = delete; + PinStoragePrefsTestApi& operator=(const PinStoragePrefsTestApi&) = delete; + std::string PinSalt() const { return pin_storage_->PinSalt(); } std::string PinSecret() const { return pin_storage_->PinSecret(); } @@ -61,8 +66,6 @@ private: PinStoragePrefs* pin_storage_; - - DISALLOW_COPY_AND_ASSIGN(PinStoragePrefsTestApi); }; // Verifies that:
diff --git a/chrome/browser/ash/login/quick_unlock/quick_unlock_factory.h b/chrome/browser/ash/login/quick_unlock/quick_unlock_factory.h index 07050077..70c963c 100644 --- a/chrome/browser/ash/login/quick_unlock/quick_unlock_factory.h +++ b/chrome/browser/ash/login/quick_unlock/quick_unlock_factory.h
@@ -38,6 +38,9 @@ static QuickUnlockFactory* GetInstance(); + QuickUnlockFactory(const QuickUnlockFactory&) = delete; + QuickUnlockFactory& operator=(const QuickUnlockFactory&) = delete; + private: friend struct base::DefaultSingletonTraits<QuickUnlockFactory>; @@ -47,8 +50,6 @@ // BrowserContextKeyedServiceFactory: KeyedService* BuildServiceInstanceFor( content::BrowserContext* profile) const override; - - DISALLOW_COPY_AND_ASSIGN(QuickUnlockFactory); }; } // namespace quick_unlock
diff --git a/chrome/browser/ash/login/quick_unlock/quick_unlock_storage_unittest.cc b/chrome/browser/ash/login/quick_unlock/quick_unlock_storage_unittest.cc index dc5569a7..8f00eef 100644 --- a/chrome/browser/ash/login/quick_unlock/quick_unlock_storage_unittest.cc +++ b/chrome/browser/ash/login/quick_unlock/quick_unlock_storage_unittest.cc
@@ -38,6 +38,11 @@ } // namespace class QuickUnlockStorageUnitTest : public testing::Test { + public: + QuickUnlockStorageUnitTest(const QuickUnlockStorageUnitTest&) = delete; + QuickUnlockStorageUnitTest& operator=(const QuickUnlockStorageUnitTest&) = + delete; + protected: QuickUnlockStorageUnitTest() : profile_(std::make_unique<TestingProfile>()) {} ~QuickUnlockStorageUnitTest() override {} @@ -52,8 +57,6 @@ content::BrowserTaskEnvironment task_environment_; std::unique_ptr<TestingProfile> profile_; - - DISALLOW_COPY_AND_ASSIGN(QuickUnlockStorageUnitTest); }; // Provides test-only QuickUnlockStorage APIs. @@ -63,6 +66,10 @@ explicit QuickUnlockStorageTestApi(QuickUnlockStorage* quick_unlock_storage) : quick_unlock_storage_(quick_unlock_storage) {} + QuickUnlockStorageTestApi(const QuickUnlockStorageTestApi&) = delete; + QuickUnlockStorageTestApi& operator=(const QuickUnlockStorageTestApi&) = + delete; + // Reduces the amount of strong auth time available by `time_delta`. void ReduceRemainingStrongAuthTimeBy(const base::TimeDelta& time_delta) { quick_unlock_storage_->last_strong_auth_ -= time_delta; @@ -80,8 +87,6 @@ private: QuickUnlockStorage* quick_unlock_storage_; - - DISALLOW_COPY_AND_ASSIGN(QuickUnlockStorageTestApi); }; // Verifies that marking the strong auth makes TimeSinceLastStrongAuth a > zero
diff --git a/chrome/browser/ash/login/saml/in_session_password_change_manager.h b/chrome/browser/ash/login/saml/in_session_password_change_manager.h index 05ca76c5..44bc26f 100644 --- a/chrome/browser/ash/login/saml/in_session_password_change_manager.h +++ b/chrome/browser/ash/login/saml/in_session_password_change_manager.h
@@ -34,6 +34,11 @@ // rerunning the task or posting the task to be re-run, which means that there // is only ever one of task that is scheduled to be run. class RecheckPasswordExpiryTask { + public: + RecheckPasswordExpiryTask(const RecheckPasswordExpiryTask&) = delete; + RecheckPasswordExpiryTask& operator=(const RecheckPasswordExpiryTask&) = + delete; + private: RecheckPasswordExpiryTask(); ~RecheckPasswordExpiryTask(); @@ -51,8 +56,6 @@ // Only InSessionPasswordChangeManager can use this class. friend class InSessionPasswordChangeManager; - - DISALLOW_COPY_AND_ASSIGN(RecheckPasswordExpiryTask); }; // Manages the flow of changing a password in-session - handles user
diff --git a/chrome/browser/ash/login/saml/saml_browsertest.cc b/chrome/browser/ash/login/saml/saml_browsertest.cc index c4b98f8..ebfc374 100644 --- a/chrome/browser/ash/login/saml/saml_browsertest.cc +++ b/chrome/browser/ash/login/saml/saml_browsertest.cc
@@ -176,6 +176,11 @@ public: SecretInterceptingFakeUserDataAuthClient(); + SecretInterceptingFakeUserDataAuthClient( + const SecretInterceptingFakeUserDataAuthClient&) = delete; + SecretInterceptingFakeUserDataAuthClient& operator=( + const SecretInterceptingFakeUserDataAuthClient&) = delete; + void Mount(const ::user_data_auth::MountRequest& request, MountCallback callback) override; @@ -183,8 +188,6 @@ private: std::string salted_hashed_secret_; - - DISALLOW_COPY_AND_ASSIGN(SecretInterceptingFakeUserDataAuthClient); }; SecretInterceptingFakeUserDataAuthClient:: @@ -1414,13 +1417,15 @@ public testing::WithParamInterface<bool> { public: SAMLPasswordAttributesTest() = default; + + SAMLPasswordAttributesTest(const SAMLPasswordAttributesTest&) = delete; + SAMLPasswordAttributesTest& operator=(const SAMLPasswordAttributesTest&) = + delete; + void SetUpOnMainThread() override; protected: bool in_session_pw_change_policy_enabled() { return GetParam(); } - - private: - DISALLOW_COPY_AND_ASSIGN(SAMLPasswordAttributesTest); }; void SAMLPasswordAttributesTest::SetUpOnMainThread() {
diff --git a/chrome/browser/ash/login/screens/os_install_screen_browsertest.cc b/chrome/browser/ash/login/screens/os_install_screen_browsertest.cc index 47bd0c7..96f2731 100644 --- a/chrome/browser/ash/login/screens/os_install_screen_browsertest.cc +++ b/chrome/browser/ash/login/screens/os_install_screen_browsertest.cc
@@ -3,12 +3,14 @@ // found in the LICENSE file. #include "ash/constants/ash_switches.h" +#include "ash/public/cpp/login_screen_test_api.h" #include "base/test/scoped_mock_time_message_loop_task_runner.h" #include "chrome/browser/ash/login/screens/welcome_screen.h" #include "chrome/browser/ash/login/test/oobe_base_test.h" #include "chrome/browser/ash/login/test/oobe_screen_waiter.h" #include "chrome/browser/ash/login/wizard_controller.h" #include "chrome/browser/ui/webui/chromeos/login/os_install_screen_handler.h" +#include "chrome/browser/ui/webui/chromeos/login/os_trial_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h" #include "chrome/grit/generated_resources.h" #include "chromeos/dbus/power/fake_power_manager_client.h" @@ -22,6 +24,9 @@ const test::UIPath kWelcomeScreen = {"connect", "welcomeScreen"}; const test::UIPath kOsInstallButton = {"connect", "welcomeScreen", "osInstall"}; +const test::UIPath kOsTrialInstallRadioButton = {"os-trial", "installButton"}; +const test::UIPath kOsTrialNextButton = {"os-trial", "nextButton"}; + const test::UIPath kOsInstallExitButton = {"os-install", "osInstallExitButton"}; const test::UIPath kOsInstallIntroNextButton = {"os-install", "osInstallIntroNextButton"}; @@ -77,6 +82,11 @@ void AdvanceToOsInstallScreen() { OobeScreenWaiter(WelcomeView::kScreenId).Wait(); test::OobeJS().TapOnPath(kOsInstallButton); + + OobeScreenWaiter(OsTrialScreenView::kScreenId).Wait(); + test::OobeJS().ExpectHasAttribute("checked", kOsTrialInstallRadioButton); + test::OobeJS().ClickOnPath(kOsTrialNextButton); + OobeScreenWaiter(OsInstallScreenView::kScreenId).Wait(); test::OobeJS().ExpectVisiblePath(kOsInstallDialogIntro); } @@ -168,8 +178,7 @@ test::OobeJS().ExpectVisiblePath(kOsInstallDialogIntro); // Exit os install flow test::OobeJS().TapOnPath(kOsInstallExitButton); - OobeScreenWaiter(WelcomeView::kScreenId).Wait(); - test::OobeJS().ExpectVisiblePath(kWelcomeScreen); + OobeScreenWaiter(OsTrialScreenView::kScreenId).Wait(); } // Check that if no destination device is found, the error step is shown.
diff --git a/chrome/browser/ash/login/screens/os_trial_screen.cc b/chrome/browser/ash/login/screens/os_trial_screen.cc new file mode 100644 index 0000000..f5ad8ecb --- /dev/null +++ b/chrome/browser/ash/login/screens/os_trial_screen.cc
@@ -0,0 +1,67 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/login/screens/os_trial_screen.h" + +#include "chrome/browser/ui/webui/chromeos/login/os_trial_screen_handler.h" + +namespace ash { + +constexpr const char kUserActionTryNextClicked[] = "os-trial-try"; +constexpr const char kUserActionInstallNextClicked[] = "os-trial-install"; +constexpr const char kUserActionBackClicked[] = "os-trial-back"; + +// static +std::string OsTrialScreen::GetResultString(Result result) { + switch (result) { + case Result::NEXT_TRY: + return "NextTry"; + case Result::NEXT_INSTALL: + return "NextInstall"; + case Result::BACK: + return "Back"; + } +} + +OsTrialScreen::OsTrialScreen(OsTrialScreenView* view, + const ScreenExitCallback& exit_callback) + : BaseScreen(OsTrialScreenView::kScreenId, OobeScreenPriority::DEFAULT), + view_(view), + exit_callback_(exit_callback) { + DCHECK(view_); + if (view_) + view_->Bind(this); +} + +OsTrialScreen::~OsTrialScreen() { + if (view_) + view_->Unbind(); +} + +void OsTrialScreen::OnViewDestroyed(OsTrialScreenView* view) { + if (view_ == view) + view_ = nullptr; +} + +void OsTrialScreen::ShowImpl() { + if (!view_) + return; + + view_->Show(); +} + +void OsTrialScreen::HideImpl() {} + +void OsTrialScreen::OnUserAction(const std::string& action_id) { + if (action_id == kUserActionTryNextClicked) { + exit_callback_.Run(Result::NEXT_TRY); + } else if (action_id == kUserActionInstallNextClicked) { + exit_callback_.Run(Result::NEXT_INSTALL); + } else if (action_id == kUserActionBackClicked) { + exit_callback_.Run(Result::BACK); + } else { + BaseScreen::OnUserAction(action_id); + } +} +} // namespace ash
diff --git a/chrome/browser/ash/login/screens/os_trial_screen.h b/chrome/browser/ash/login/screens/os_trial_screen.h new file mode 100644 index 0000000..998fce64 --- /dev/null +++ b/chrome/browser/ash/login/screens/os_trial_screen.h
@@ -0,0 +1,53 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_LOGIN_SCREENS_OS_TRIAL_SCREEN_H_ +#define CHROME_BROWSER_ASH_LOGIN_SCREENS_OS_TRIAL_SCREEN_H_ + +#include <string> + +#include "chrome/browser/ash/login/screens/base_screen.h" +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "chrome/browser/ui/webui/chromeos/login/os_trial_screen_handler.h" + +namespace ash { + +class OsTrialScreen : public BaseScreen { + public: + enum class Result { + NEXT_TRY, + NEXT_INSTALL, + BACK, + }; + + static std::string GetResultString(Result result); + + using ScreenExitCallback = base::RepeatingCallback<void(Result result)>; + OsTrialScreen(OsTrialScreenView* view, + const ScreenExitCallback& exit_callback); + OsTrialScreen(const OsTrialScreen&) = delete; + OsTrialScreen& operator=(const OsTrialScreen&) = delete; + ~OsTrialScreen() override; + + void OnViewDestroyed(OsTrialScreenView* view); + + private: + // BaseScreen: + void ShowImpl() override; + void HideImpl() override; + void OnUserAction(const std::string& action_id) override; + + OsTrialScreenView* view_ = nullptr; + ScreenExitCallback exit_callback_; +}; + +} // namespace ash + +// TODO(https://crbug.com/1164001): remove after the //chrome/browser/chromeos +// source migration is finished. +namespace chromeos { +using ::ash::OsTrialScreen; +} + +#endif // CHROME_BROWSER_ASH_LOGIN_SCREENS_OS_TRIAL_SCREEN_H_
diff --git a/chrome/browser/ash/login/screens/sync_consent_screen.h b/chrome/browser/ash/login/screens/sync_consent_screen.h index 7be86b9..0709f48e 100644 --- a/chrome/browser/ash/login/screens/sync_consent_screen.h +++ b/chrome/browser/ash/login/screens/sync_consent_screen.h
@@ -56,6 +56,11 @@ public: SyncConsentScreenTestDelegate() = default; + SyncConsentScreenTestDelegate(const SyncConsentScreenTestDelegate&) = + delete; + SyncConsentScreenTestDelegate& operator=( + const SyncConsentScreenTestDelegate&) = delete; + // This is called from SyncConsentScreen when user consent is passed to // consent auditor with resource ids recorder as consent. virtual void OnConsentRecordedIds( @@ -68,9 +73,6 @@ virtual void OnConsentRecordedStrings( const ::login::StringList& consent_description, const std::string& consent_confirmation) = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(SyncConsentScreenTestDelegate); }; class SyncConsentScreenExitTestDelegate {
diff --git a/chrome/browser/ash/login/screens/update_required_screen_unittest.cc b/chrome/browser/ash/login/screens/update_required_screen_unittest.cc index c42db52..a11bd3c 100644 --- a/chrome/browser/ash/login/screens/update_required_screen_unittest.cc +++ b/chrome/browser/ash/login/screens/update_required_screen_unittest.cc
@@ -44,6 +44,10 @@ UpdateRequiredScreenUnitTest() : local_state_(TestingBrowserProcess::GetGlobal()) {} + UpdateRequiredScreenUnitTest(const UpdateRequiredScreenUnitTest&) = delete; + UpdateRequiredScreenUnitTest& operator=(const UpdateRequiredScreenUnitTest&) = + delete; + void SetUpdateEngineStatus(update_engine::Operation operation) { update_engine::StatusResult status; status.set_current_operation(operation); @@ -124,8 +128,6 @@ ScopedTestingCrosSettings scoped_testing_cros_settings_; // This is used for `GetEnterpriseDisplayDomain`. ScopedStubInstallAttributes test_install_attributes_; - - DISALLOW_COPY_AND_ASSIGN(UpdateRequiredScreenUnitTest); }; namespace {
diff --git a/chrome/browser/ash/login/screens/update_screen_unittest.cc b/chrome/browser/ash/login/screens/update_screen_unittest.cc index 84408404..cb332ed 100644 --- a/chrome/browser/ash/login/screens/update_screen_unittest.cc +++ b/chrome/browser/ash/login/screens/update_screen_unittest.cc
@@ -36,6 +36,9 @@ public: UpdateScreenUnitTest() : local_state_(TestingBrowserProcess::GetGlobal()) {} + UpdateScreenUnitTest(const UpdateScreenUnitTest&) = delete; + UpdateScreenUnitTest& operator=(const UpdateScreenUnitTest&) = delete; + // Simulates an update being available (or not). // The parameter "update_screen" points to the currently active UpdateScreen. // The parameter "available" indicates whether an update is available. @@ -128,8 +131,6 @@ content::BrowserTaskEnvironment task_environment_; ScopedTestingLocalState local_state_; std::unique_ptr<NetworkHandlerTestHelper> network_handler_test_helper_; - - DISALLOW_COPY_AND_ASSIGN(UpdateScreenUnitTest); }; TEST_F(UpdateScreenUnitTest, HandlesNoUpdate) {
diff --git a/chrome/browser/ash/login/session/chrome_session_manager.cc b/chrome/browser/ash/login/session/chrome_session_manager.cc index 1610b249..86f00f8 100644 --- a/chrome/browser/ash/login/session/chrome_session_manager.cc +++ b/chrome/browser/ash/login/session/chrome_session_manager.cc
@@ -31,11 +31,11 @@ #include "chrome/browser/ash/policy/handlers/tpm_auto_update_mode_policy_handler.h" #include "chrome/browser/ash/policy/reporting/app_install_event_log_manager_wrapper.h" #include "chrome/browser/ash/profiles/profile_helper.h" +#include "chrome/browser/ash/tether/tether_service.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part_chromeos.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/boot_times_recorder.h" -#include "chrome/browser/chromeos/tether/tether_service.h" #include "chrome/browser/chromeos/tpm_firmware_update_notification.h" #include "chrome/browser/chromeos/u2f_notification.h" #include "chrome/browser/policy/profile_policy_connector.h"
diff --git a/chrome/browser/ash/login/session/chrome_session_manager_browsertest.cc b/chrome/browser/ash/login/session/chrome_session_manager_browsertest.cc index 395c901..6da3327 100644 --- a/chrome/browser/ash/login/session/chrome_session_manager_browsertest.cc +++ b/chrome/browser/ash/login/session/chrome_session_manager_browsertest.cc
@@ -323,6 +323,9 @@ public: GuestSessionRlzTest() : is_locked_(GetParam()) {} + GuestSessionRlzTest(const GuestSessionRlzTest&) = delete; + GuestSessionRlzTest& operator=(const GuestSessionRlzTest&) = delete; + protected: StubInstallAttributes* stub_install_attributes() { return scoped_stub_install_attributes_->Get(); @@ -360,8 +363,6 @@ std::unique_ptr<system::ScopedFakeStatisticsProvider> scoped_fake_statistics_provider_; std::unique_ptr<ScopedStubInstallAttributes> scoped_stub_install_attributes_; - - DISALLOW_COPY_AND_ASSIGN(GuestSessionRlzTest); }; IN_PROC_BROWSER_TEST_P(GuestSessionRlzTest, DeviceIsLocked) {
diff --git a/chrome/browser/ash/login/session/user_session_manager.cc b/chrome/browser/ash/login/session/user_session_manager.cc index 9b3e65c..610fb5ef 100644 --- a/chrome/browser/ash/login/session/user_session_manager.cc +++ b/chrome/browser/ash/login/session/user_session_manager.cc
@@ -84,13 +84,13 @@ #include "chrome/browser/ash/settings/cros_settings.h" #include "chrome/browser/ash/sync/ash_turn_sync_on_helper.h" #include "chrome/browser/ash/sync/os_sync_util.h" +#include "chrome/browser/ash/tether/tether_service.h" #include "chrome/browser/ash/web_applications/help_app/help_app_notification_controller.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part_chromeos.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/boot_times_recorder.h" #include "chrome/browser/chromeos/logging.h" -#include "chrome/browser/chromeos/tether/tether_service.h" #include "chrome/browser/chromeos/tpm_firmware_update_notification.h" #include "chrome/browser/chromeos/u2f_notification.h" #include "chrome/browser/first_run/first_run.h"
diff --git a/chrome/browser/ash/login/session/user_session_manager.h b/chrome/browser/ash/login/session/user_session_manager.h index ea2993a..f1874e0 100644 --- a/chrome/browser/ash/login/session/user_session_manager.h +++ b/chrome/browser/ash/login/session/user_session_manager.h
@@ -163,6 +163,9 @@ // Returns UserSessionManager instance. static UserSessionManager* GetInstance(); + UserSessionManager(const UserSessionManager&) = delete; + UserSessionManager& operator=(const UserSessionManager&) = delete; + // Called when user is logged in to override base::DIR_HOME path. static void OverrideHomedir(); @@ -680,8 +683,6 @@ onboarding_user_activity_counter_; base::WeakPtrFactory<UserSessionManager> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(UserSessionManager); }; } // namespace ash
diff --git a/chrome/browser/ash/login/session/user_session_manager_test_api.h b/chrome/browser/ash/login/session/user_session_manager_test_api.h index f2bdb938..1a61e7bb5 100644 --- a/chrome/browser/ash/login/session/user_session_manager_test_api.h +++ b/chrome/browser/ash/login/session/user_session_manager_test_api.h
@@ -18,6 +18,10 @@ public: explicit UserSessionManagerTestApi(UserSessionManager* session_manager); + UserSessionManagerTestApi(const UserSessionManagerTestApi&) = delete; + UserSessionManagerTestApi& operator=(const UserSessionManagerTestApi&) = + delete; + // Injects `user_context` that will be used to create StubAuthenticator // instance when UserSessionManager::CreateAuthenticator() is called. // DEPRECATED: Use InjectStubAuthenticatorBuilder instead. @@ -41,8 +45,6 @@ private: UserSessionManager* session_manager_; // not owned - - DISALLOW_COPY_AND_ASSIGN(UserSessionManagerTestApi); }; } // namespace test
diff --git a/chrome/browser/ash/login/signin/auth_error_observer_factory.h b/chrome/browser/ash/login/signin/auth_error_observer_factory.h index 025e1a0..292be1c 100644 --- a/chrome/browser/ash/login/signin/auth_error_observer_factory.h +++ b/chrome/browser/ash/login/signin/auth_error_observer_factory.h
@@ -26,6 +26,9 @@ // Returns an instance of the AuthErrorObserverFactory singleton. static AuthErrorObserverFactory* GetInstance(); + AuthErrorObserverFactory(const AuthErrorObserverFactory&) = delete; + AuthErrorObserverFactory& operator=(const AuthErrorObserverFactory&) = delete; + private: friend struct base::DefaultSingletonTraits<AuthErrorObserverFactory>; @@ -35,8 +38,6 @@ // BrowserContextKeyedServiceFactory implementation. KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(AuthErrorObserverFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/login/signin/oauth2_browsertest.cc b/chrome/browser/ash/login/signin/oauth2_browsertest.cc index 30e7b5e..342fc570 100644 --- a/chrome/browser/ash/login/signin/oauth2_browsertest.cc +++ b/chrome/browser/ash/login/signin/oauth2_browsertest.cc
@@ -122,6 +122,10 @@ waiting_for_state_(false), final_state_(OAuth2LoginManager::SESSION_RESTORE_NOT_STARTED) {} + OAuth2LoginManagerStateWaiter(const OAuth2LoginManagerStateWaiter&) = delete; + OAuth2LoginManagerStateWaiter& operator=( + const OAuth2LoginManagerStateWaiter&) = delete; + void WaitForStates( const std::set<OAuth2LoginManager::SessionRestoreState>& states) { DCHECK(!waiting_for_state_); @@ -163,8 +167,6 @@ bool waiting_for_state_; OAuth2LoginManager::SessionRestoreState final_state_; std::unique_ptr<base::RunLoop> run_loop_; - - DISALLOW_COPY_AND_ASSIGN(OAuth2LoginManagerStateWaiter); }; // Blocks a thread associated with a given `task_runner` on construction and @@ -203,6 +205,9 @@ start_event_(base::WaitableEvent::ResetPolicy::MANUAL, base::WaitableEvent::InitialState::NOT_SIGNALED) {} + RequestDeferrer(const RequestDeferrer&) = delete; + RequestDeferrer& operator=(const RequestDeferrer&) = delete; + void UnblockRequest() { blocking_event_.Signal(); } void WaitForRequestToStart() { @@ -231,13 +236,15 @@ base::WaitableEvent blocking_event_; base::WaitableEvent start_event_; std::unique_ptr<base::RunLoop> run_loop_; - - DISALLOW_COPY_AND_ASSIGN(RequestDeferrer); }; } // namespace class OAuth2Test : public OobeBaseTest { + public: + OAuth2Test(const OAuth2Test&) = delete; + OAuth2Test& operator=(const OAuth2Test&) = delete; + protected: OAuth2Test() = default; ~OAuth2Test() override = default; @@ -475,8 +482,6 @@ private: base::FilePath test_data_dir_; std::map<std::string, RequestDeferrer*> request_deferers_; - - DISALLOW_COPY_AND_ASSIGN(OAuth2Test); }; class CookieReader { @@ -873,6 +878,10 @@ class MergeSessionTest : public OAuth2Test, public testing::WithParamInterface<bool> { + public: + MergeSessionTest(const MergeSessionTest&) = delete; + MergeSessionTest& operator=(const MergeSessionTest&) = delete; + protected: MergeSessionTest() = default; @@ -969,9 +978,6 @@ RequestDeferrer merge_session_deferer_; GURL fake_google_page_url_; GURL non_google_page_url_; - - private: - DISALLOW_COPY_AND_ASSIGN(MergeSessionTest); }; Browser* FindOrCreateVisibleBrowser(Profile* profile) {
diff --git a/chrome/browser/ash/login/signin/oauth2_login_manager_factory.h b/chrome/browser/ash/login/signin/oauth2_login_manager_factory.h index 3739203..605f236 100644 --- a/chrome/browser/ash/login/signin/oauth2_login_manager_factory.h +++ b/chrome/browser/ash/login/signin/oauth2_login_manager_factory.h
@@ -27,6 +27,10 @@ // Returns an instance of the OAuth2LoginManagerFactory singleton. static OAuth2LoginManagerFactory* GetInstance(); + OAuth2LoginManagerFactory(const OAuth2LoginManagerFactory&) = delete; + OAuth2LoginManagerFactory& operator=(const OAuth2LoginManagerFactory&) = + delete; + private: friend struct base::DefaultSingletonTraits<OAuth2LoginManagerFactory>; @@ -36,8 +40,6 @@ // BrowserContextKeyedServiceFactory implementation. KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(OAuth2LoginManagerFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/login/signin/offline_signin_limiter.h b/chrome/browser/ash/login/signin/offline_signin_limiter.h index dcfac1d..6b5d093a 100644 --- a/chrome/browser/ash/login/signin/offline_signin_limiter.h +++ b/chrome/browser/ash/login/signin/offline_signin_limiter.h
@@ -32,6 +32,9 @@ public base::PowerSuspendObserver, public session_manager::SessionManagerObserver { public: + OfflineSigninLimiter(const OfflineSigninLimiter&) = delete; + OfflineSigninLimiter& operator=(const OfflineSigninLimiter&) = delete; + // Called when the user successfully authenticates. `auth_flow` indicates // the type of authentication flow that the user went through. void SignedIn(UserContext::AuthFlow auth_flow); @@ -93,8 +96,6 @@ std::unique_ptr<base::WallClockTimer> offline_signin_limit_timer_; std::unique_ptr<base::WallClockTimer> offline_lock_screen_signin_limit_timer_; - - DISALLOW_COPY_AND_ASSIGN(OfflineSigninLimiter); }; } // namespace ash
diff --git a/chrome/browser/ash/login/signin/offline_signin_limiter_factory.h b/chrome/browser/ash/login/signin/offline_signin_limiter_factory.h index 4b3b3d9..db04f8fe 100644 --- a/chrome/browser/ash/login/signin/offline_signin_limiter_factory.h +++ b/chrome/browser/ash/login/signin/offline_signin_limiter_factory.h
@@ -28,6 +28,10 @@ static OfflineSigninLimiter* GetForProfile(Profile* profile); + OfflineSigninLimiterFactory(const OfflineSigninLimiterFactory&) = delete; + OfflineSigninLimiterFactory& operator=(const OfflineSigninLimiterFactory&) = + delete; + // `clock` will be passed to all OfflineSigninLimiters. Ensure that their // Shutdown() methods have been called before destroying `clock`. static void SetClockForTesting(base::Clock* clock); @@ -43,8 +47,6 @@ content::BrowserContext* context) const override; static base::Clock* clock_for_testing_; - - DISALLOW_COPY_AND_ASSIGN(OfflineSigninLimiterFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/login/signin/offline_signin_limiter_unittest.cc b/chrome/browser/ash/login/signin/offline_signin_limiter_unittest.cc index 2ec25f7..86c28b8 100644 --- a/chrome/browser/ash/login/signin/offline_signin_limiter_unittest.cc +++ b/chrome/browser/ash/login/signin/offline_signin_limiter_unittest.cc
@@ -44,6 +44,10 @@ } // namespace class OfflineSigninLimiterTest : public testing::Test { + public: + OfflineSigninLimiterTest(const OfflineSigninLimiterTest&) = delete; + OfflineSigninLimiterTest& operator=(const OfflineSigninLimiterTest&) = delete; + protected: OfflineSigninLimiterTest(); ~OfflineSigninLimiterTest() override; @@ -80,8 +84,6 @@ TestingPrefServiceSimple testing_local_state_; base::test::ScopedFeatureList feature_list_; - - DISALLOW_COPY_AND_ASSIGN(OfflineSigninLimiterTest); }; OfflineSigninLimiterTest::OfflineSigninLimiterTest()
diff --git a/chrome/browser/ash/login/signin/signin_error_notifier_factory.h b/chrome/browser/ash/login/signin/signin_error_notifier_factory.h index ea6b8c7..92d202d2 100644 --- a/chrome/browser/ash/login/signin/signin_error_notifier_factory.h +++ b/chrome/browser/ash/login/signin/signin_error_notifier_factory.h
@@ -26,6 +26,10 @@ // Returns an instance of the SigninErrorNotifierFactory singleton. static SigninErrorNotifierFactory* GetInstance(); + SigninErrorNotifierFactory(const SigninErrorNotifierFactory&) = delete; + SigninErrorNotifierFactory& operator=(const SigninErrorNotifierFactory&) = + delete; + private: friend struct base::DefaultSingletonTraits<SigninErrorNotifierFactory>; @@ -35,8 +39,6 @@ // BrowserContextKeyedServiceFactory: KeyedService* BuildServiceInstanceFor( content::BrowserContext* profile) const override; - - DISALLOW_COPY_AND_ASSIGN(SigninErrorNotifierFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/login/signin/token_handle_fetcher.cc b/chrome/browser/ash/login/signin/token_handle_fetcher.cc index 68a8946..62827e6 100644 --- a/chrome/browser/ash/login/signin/token_handle_fetcher.cc +++ b/chrome/browser/ash/login/signin/token_handle_fetcher.cc
@@ -35,6 +35,11 @@ return base::Singleton<TokenHandleFetcherShutdownNotifierFactory>::get(); } + TokenHandleFetcherShutdownNotifierFactory( + const TokenHandleFetcherShutdownNotifierFactory&) = delete; + TokenHandleFetcherShutdownNotifierFactory& operator=( + const TokenHandleFetcherShutdownNotifierFactory&) = delete; + private: friend struct base::DefaultSingletonTraits< TokenHandleFetcherShutdownNotifierFactory>; @@ -45,8 +50,6 @@ DependsOn(IdentityManagerFactory::GetInstance()); } ~TokenHandleFetcherShutdownNotifierFactory() override {} - - DISALLOW_COPY_AND_ASSIGN(TokenHandleFetcherShutdownNotifierFactory); }; } // namespace
diff --git a/chrome/browser/ash/login/signin_partition_manager.h b/chrome/browser/ash/login/signin_partition_manager.h index e802023..346254a 100644 --- a/chrome/browser/ash/login/signin_partition_manager.h +++ b/chrome/browser/ash/login/signin_partition_manager.h
@@ -102,6 +102,9 @@ static Factory* GetInstance(); + Factory(const Factory&) = delete; + Factory& operator=(const Factory&) = delete; + private: friend struct base::DefaultSingletonTraits<Factory>; @@ -113,8 +116,6 @@ content::BrowserContext* context) const override; content::BrowserContext* GetBrowserContextToUse( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(Factory); }; private:
diff --git a/chrome/browser/ash/login/signin_partition_manager_unittest.cc b/chrome/browser/ash/login/signin_partition_manager_unittest.cc index 4c1a30f..d4956c6c 100644 --- a/chrome/browser/ash/login/signin_partition_manager_unittest.cc +++ b/chrome/browser/ash/login/signin_partition_manager_unittest.cc
@@ -77,6 +77,11 @@ } // namespace class SigninPartitionManagerTest : public ChromeRenderViewHostTestHarness { + public: + SigninPartitionManagerTest(const SigninPartitionManagerTest&) = delete; + SigninPartitionManagerTest& operator=(const SigninPartitionManagerTest&) = + delete; + protected: SigninPartitionManagerTest() {} ~SigninPartitionManagerTest() override {} @@ -223,8 +228,6 @@ std::vector<std::pair<content::StoragePartition*, base::OnceClosure>> pending_clear_tasks_; - - DISALLOW_COPY_AND_ASSIGN(SigninPartitionManagerTest); }; TEST_F(SigninPartitionManagerTest, TestSubsequentAttempts) {
diff --git a/chrome/browser/ash/login/test/oobe_auth_page_waiter.h b/chrome/browser/ash/login/test/oobe_auth_page_waiter.h index 0b3c4d6..0716be5 100644 --- a/chrome/browser/ash/login/test/oobe_auth_page_waiter.h +++ b/chrome/browser/ash/login/test/oobe_auth_page_waiter.h
@@ -22,6 +22,9 @@ // Gaia Login and Enrollment screens use different authenticators. // `auth_page_type` specifies which authenticator to wait for. explicit OobeAuthPageWaiter(AuthPageType auth_page_type); + + OobeAuthPageWaiter& operator=(const OobeAuthPageWaiter&) = delete; + ~OobeAuthPageWaiter(); // Waits for the "ready" event be triggered by the page authenticator. @@ -34,8 +37,6 @@ const char* GetAuthenticator(); const AuthPageType auth_page_type_; - - DISALLOW_ASSIGN(OobeAuthPageWaiter); }; // Helper that creates an OobeAuthPageWaiter that listens for Gaia page JS
diff --git a/chrome/browser/ash/login/ui/login_display.h b/chrome/browser/ash/login/ui/login_display.h index 9554140..9d9dee85 100644 --- a/chrome/browser/ash/login/ui/login_display.h +++ b/chrome/browser/ash/login/ui/login_display.h
@@ -53,6 +53,10 @@ }; LoginDisplay(); + + LoginDisplay(const LoginDisplay&) = delete; + LoginDisplay& operator=(const LoginDisplay&) = delete; + virtual ~LoginDisplay(); // Clears and enables fields on user pod or GAIA frame. @@ -91,8 +95,6 @@ // in redesigned login stack. // Login stack (and this object) will be recreated for next user sign in. bool is_signin_completed_ = false; - - DISALLOW_COPY_AND_ASSIGN(LoginDisplay); }; } // namespace ash
diff --git a/chrome/browser/ash/login/ui/login_display_host.h b/chrome/browser/ash/login/ui/login_display_host.h index 5e4d1bd..c918805 100644 --- a/chrome/browser/ash/login/ui/login_display_host.h +++ b/chrome/browser/ash/login/ui/login_display_host.h
@@ -69,6 +69,9 @@ virtual void WebDialogViewBoundsChanged(const gfx::Rect& bounds) = 0; }; + LoginDisplayHost(const LoginDisplayHost&) = delete; + LoginDisplayHost& operator=(const LoginDisplayHost&) = delete; + // Returns the default LoginDisplayHost instance if it has been created. static LoginDisplayHost* default_host() { return default_host_; } @@ -253,8 +256,6 @@ // Callback to be executed when WebUI is started. base::RepeatingClosure on_wizard_controller_created_for_tests_; - - DISALLOW_COPY_AND_ASSIGN(LoginDisplayHost); }; } // namespace ash
diff --git a/chrome/browser/ash/login/ui/login_screen_extension_ui/create_options.h b/chrome/browser/ash/login/ui/login_screen_extension_ui/create_options.h index e956aa3..b349fd0 100644 --- a/chrome/browser/ash/login/ui/login_screen_extension_ui/create_options.h +++ b/chrome/browser/ash/login/ui/login_screen_extension_ui/create_options.h
@@ -18,14 +18,16 @@ const GURL& content_url, bool can_be_closed_by_user, base::OnceClosure close_callback); + + CreateOptions(const CreateOptions&) = delete; + CreateOptions& operator=(const CreateOptions&) = delete; + ~CreateOptions(); const std::string extension_name; const GURL content_url; bool can_be_closed_by_user; base::OnceClosure close_callback; - - DISALLOW_COPY_AND_ASSIGN(CreateOptions); }; } // namespace login_screen_extension_ui
diff --git a/chrome/browser/ash/login/ui/login_web_dialog.h b/chrome/browser/ash/login/ui/login_web_dialog.h index 8e82d89..690a060 100644 --- a/chrome/browser/ash/login/ui/login_web_dialog.h +++ b/chrome/browser/ash/login/ui/login_web_dialog.h
@@ -40,6 +40,10 @@ gfx::NativeWindow parent_window, const std::u16string& title, const GURL& url); + + LoginWebDialog(const LoginWebDialog&) = delete; + LoginWebDialog& operator=(const LoginWebDialog&) = delete; + ~LoginWebDialog() override; void Show(); @@ -89,8 +93,6 @@ std::u16string title_; const GURL url_; - - DISALLOW_COPY_AND_ASSIGN(LoginWebDialog); }; } // namespace ash
diff --git a/chrome/browser/ash/login/ui/user_adding_screen.h b/chrome/browser/ash/login/ui/user_adding_screen.h index 1a4e03c..b518c69 100644 --- a/chrome/browser/ash/login/ui/user_adding_screen.h +++ b/chrome/browser/ash/login/ui/user_adding_screen.h
@@ -20,6 +20,9 @@ virtual ~Observer() {} }; + UserAddingScreen(const UserAddingScreen&) = delete; + UserAddingScreen& operator=(const UserAddingScreen&) = delete; + static UserAddingScreen* Get(); virtual void Start() = 0; @@ -32,8 +35,6 @@ protected: UserAddingScreen(); virtual ~UserAddingScreen(); - - DISALLOW_COPY_AND_ASSIGN(UserAddingScreen); }; } // namespace ash
diff --git a/chrome/browser/ash/login/ui/user_adding_screen_browsertest.cc b/chrome/browser/ash/login/ui/user_adding_screen_browsertest.cc index dc0becff..0fb4746b 100644 --- a/chrome/browser/ash/login/ui/user_adding_screen_browsertest.cc +++ b/chrome/browser/ash/login/ui/user_adding_screen_browsertest.cc
@@ -42,6 +42,9 @@ login_mixin_.AppendRegularUsers(3); } + UserAddingScreenTest(const UserAddingScreenTest&) = delete; + UserAddingScreenTest& operator=(const UserAddingScreenTest&) = delete; + void SetUpInProcessBrowserTestFixture() override { LoginManagerTest::SetUpInProcessBrowserTestFixture(); UserAddingScreen::Get()->AddObserver(this); @@ -86,8 +89,6 @@ std::unique_ptr<base::RunLoop> run_loop_; bool finished_ = false; // True if OnUserAddingFinished() has been called // before WaitUntilUserAddingFinishedOrCancelled(). - - DISALLOW_COPY_AND_ASSIGN(UserAddingScreenTest); }; IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, CancelAdding) {
diff --git a/chrome/browser/ash/login/users/avatar/user_image_manager_browsertest.cc b/chrome/browser/ash/login/users/avatar/user_image_manager_browsertest.cc index 803a54c..c789da8 100644 --- a/chrome/browser/ash/login/users/avatar/user_image_manager_browsertest.cc +++ b/chrome/browser/ash/login/users/avatar/user_image_manager_browsertest.cc
@@ -132,6 +132,9 @@ class UserImageManagerTestBase : public LoginManagerTest, public user_manager::UserManager::Observer { public: + UserImageManagerTestBase(const UserImageManagerTestBase&) = delete; + UserImageManagerTestBase& operator=(const UserImageManagerTestBase&) = delete; + std::unique_ptr<net::test_server::BasicHttpResponse> HandleRequest( const net::test_server::HttpRequest& request) { if (request.relative_url.find("/avatar.jpg") == std::string::npos) @@ -318,9 +321,6 @@ controllable_http_response_; FakeGaiaMixin fake_gaia_{&mixin_host_}; - - private: - DISALLOW_COPY_AND_ASSIGN(UserImageManagerTestBase); }; class UserImageManagerTest : public UserImageManagerTestBase { @@ -541,6 +541,11 @@ class UserImageManagerPolicyTest : public UserImageManagerTestBase, public policy::CloudPolicyStore::Observer { + public: + UserImageManagerPolicyTest(const UserImageManagerPolicyTest&) = delete; + UserImageManagerPolicyTest& operator=(const UserImageManagerPolicyTest&) = + delete; + protected: UserImageManagerPolicyTest() : owner_key_util_(new ownership::MockOwnerKeyUtil()) { @@ -629,9 +634,6 @@ cryptohome::AccountIdentifier cryptohome_id_ = cryptohome::CreateAccountIdentifierFromAccountId(enterprise_account_id_); LoginManagerMixin login_manager_{&mixin_host_}; - - private: - DISALLOW_COPY_AND_ASSIGN(UserImageManagerPolicyTest); }; // Verifies that the user image can be set through policy. Also verifies that
diff --git a/chrome/browser/ash/login/users/fake_chrome_user_manager.cc b/chrome/browser/ash/login/users/fake_chrome_user_manager.cc index fc27dee..f09604d 100644 --- a/chrome/browser/ash/login/users/fake_chrome_user_manager.cc +++ b/chrome/browser/ash/login/users/fake_chrome_user_manager.cc
@@ -42,6 +42,9 @@ public: FakeTaskRunner() = default; + FakeTaskRunner(const FakeTaskRunner&) = delete; + FakeTaskRunner& operator=(const FakeTaskRunner&) = delete; + protected: ~FakeTaskRunner() override {} @@ -59,8 +62,6 @@ return PostDelayedTask(from_here, std::move(task), delay); } bool RunsTasksInCurrentSequence() const override { return true; } - - DISALLOW_COPY_AND_ASSIGN(FakeTaskRunner); }; } // namespace
diff --git a/chrome/browser/ash/login/users/wallpaper_policy_browsertest.cc b/chrome/browser/ash/login/users/wallpaper_policy_browsertest.cc index f95082e..4690a4a 100644 --- a/chrome/browser/ash/login/users/wallpaper_policy_browsertest.cc +++ b/chrome/browser/ash/login/users/wallpaper_policy_browsertest.cc
@@ -130,6 +130,10 @@ class WallpaperPolicyTest : public LoginManagerTest, public WallpaperControllerObserver { + public: + WallpaperPolicyTest(const WallpaperPolicyTest&) = delete; + WallpaperPolicyTest& operator=(const WallpaperPolicyTest&) = delete; + protected: WallpaperPolicyTest() : LoginManagerTest(), owner_key_util_(new ownership::MockOwnerKeyUtil()) { @@ -309,8 +313,6 @@ absl::optional<SkColor> average_color_; base::WeakPtrFactory<WallpaperPolicyTest> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(WallpaperPolicyTest); }; // Verifies that the wallpaper can be set and re-set through policy and that
diff --git a/chrome/browser/ash/login/version_updater/update_time_estimator_unittest.cc b/chrome/browser/ash/login/version_updater/update_time_estimator_unittest.cc index 57729c6..80b91d7 100644 --- a/chrome/browser/ash/login/version_updater/update_time_estimator_unittest.cc +++ b/chrome/browser/ash/login/version_updater/update_time_estimator_unittest.cc
@@ -25,6 +25,10 @@ public: UpdateTimeEstimatorUnitTest() = default; + UpdateTimeEstimatorUnitTest(const UpdateTimeEstimatorUnitTest&) = delete; + UpdateTimeEstimatorUnitTest& operator=(const UpdateTimeEstimatorUnitTest&) = + delete; + void SetUp() override { time_estimator_.set_tick_clock_for_testing(&tick_clock_); } @@ -42,9 +46,6 @@ UpdateTimeEstimator time_estimator_; base::SimpleTestTickClock tick_clock_; - - private: - DISALLOW_COPY_AND_ASSIGN(UpdateTimeEstimatorUnitTest); }; TEST_F(UpdateTimeEstimatorUnitTest, DownloadingTimeLeft) {
diff --git a/chrome/browser/ash/login/version_updater/version_updater_unittest.cc b/chrome/browser/ash/login/version_updater/version_updater_unittest.cc index 48c1fd6..09679c4 100644 --- a/chrome/browser/ash/login/version_updater/version_updater_unittest.cc +++ b/chrome/browser/ash/login/version_updater/version_updater_unittest.cc
@@ -55,6 +55,9 @@ public: VersionUpdaterUnitTest() : local_state_(TestingBrowserProcess::GetGlobal()) {} + VersionUpdaterUnitTest(const VersionUpdaterUnitTest&) = delete; + VersionUpdaterUnitTest& operator=(const VersionUpdaterUnitTest&) = delete; + void SetUpdateEngineStatus(update_engine::Operation operation) { update_engine::StatusResult status; status.set_current_operation(operation); @@ -146,8 +149,6 @@ ScopedTestingLocalState local_state_; int checks_count_ = 0; - - DISALLOW_COPY_AND_ASSIGN(VersionUpdaterUnitTest); }; TEST_F(VersionUpdaterUnitTest, HandlesNoUpdate) {
diff --git a/chrome/browser/ash/login/webview_login_browsertest.cc b/chrome/browser/ash/login/webview_login_browsertest.cc index 918da9e..c8dab786 100644 --- a/chrome/browser/ash/login/webview_login_browsertest.cc +++ b/chrome/browser/ash/login/webview_login_browsertest.cc
@@ -205,6 +205,9 @@ public: PrefChangeWatcher(const std::string& pref_name, PrefService* prefs); + PrefChangeWatcher(const PrefChangeWatcher&) = delete; + PrefChangeWatcher& operator=(const PrefChangeWatcher&) = delete; + void Wait(); private: @@ -214,8 +217,6 @@ base::RunLoop run_loop_; PrefChangeRegistrar registrar_; - - DISALLOW_COPY_AND_ASSIGN(PrefChangeWatcher); }; PrefChangeWatcher::PrefChangeWatcher(const std::string& pref_name, @@ -1169,6 +1170,10 @@ public: WebviewClientCertsLoginTest() = default; + WebviewClientCertsLoginTest(const WebviewClientCertsLoginTest&) = delete; + WebviewClientCertsLoginTest& operator=(const WebviewClientCertsLoginTest&) = + delete; + // Imports specified client certificates into the system slot. void SetUpClientCertsInSystemSlot( const std::vector<std::string>& client_cert_names) { @@ -1178,8 +1183,6 @@ private: ScopedTestSystemNSSKeySlotMixin system_nss_key_slot_mixin_{&mixin_host_}; - - DISALLOW_COPY_AND_ASSIGN(WebviewClientCertsLoginTest); }; // Tests that client certificate authentication is not enabled in a webview on @@ -1537,6 +1540,10 @@ net::SpawnedTestServer::TYPE_BASIC_AUTH_PROXY, base::FilePath())) {} + WebviewProxyAuthLoginTest(const WebviewProxyAuthLoginTest&) = delete; + WebviewProxyAuthLoginTest& operator=(const WebviewProxyAuthLoginTest&) = + delete; + protected: void SetUp() override { // Start proxy server @@ -1646,8 +1653,6 @@ DeviceStateMixin device_state_{ &mixin_host_, DeviceStateMixin::State::OOBE_COMPLETED_CLOUD_ENROLLED}; - - DISALLOW_COPY_AND_ASSIGN(WebviewProxyAuthLoginTest); }; // Disabled fails on msan and also non-msan bots: https://crbug.com/849128.
diff --git a/chrome/browser/ash/login/wizard_controller.cc b/chrome/browser/ash/login/wizard_controller.cc index 8551cc88..6b902f1f4 100644 --- a/chrome/browser/ash/login/wizard_controller.cc +++ b/chrome/browser/ash/login/wizard_controller.cc
@@ -151,6 +151,7 @@ #include "chrome/browser/ui/webui/chromeos/login/offline_login_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" #include "chrome/browser/ui/webui/chromeos/login/os_install_screen_handler.h" +#include "chrome/browser/ui/webui/chromeos/login/os_trial_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/packaged_license_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/parental_handoff_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/pin_setup_screen_handler.h" @@ -753,6 +754,10 @@ oobe_ui->GetView<OsInstallScreenHandler>(), base::BindRepeating(&WizardController::OnOsInstallScreenExit, weak_factory_.GetWeakPtr()))); + append(std::make_unique<OsTrialScreen>( + oobe_ui->GetView<OsTrialScreenHandler>(), + base::BindRepeating(&WizardController::OnOsTrialScreenExit, + weak_factory_.GetWeakPtr()))); } return result; @@ -962,6 +967,10 @@ SetCurrentScreen(GetScreen(OsInstallScreenView::kScreenId)); } +void WizardController::ShowOsTrialScreen() { + SetCurrentScreen(GetScreen(OsTrialScreenView::kScreenId)); +} + void WizardController::ShowConsolidatedConsentScreen() { SetCurrentScreen(GetScreen(ConsolidatedConsentScreenView::kScreenId)); } @@ -1129,6 +1138,25 @@ } } +void WizardController::OnOsTrialScreenExit(OsTrialScreen::Result result) { + OnScreenExit(OsTrialScreenView::kScreenId, + OsTrialScreen::GetResultString(result)); + switch (result) { + case OsTrialScreen::Result::BACK: + // The OS Trial screen is only shown when OS Installation is started from + // the welcome screen, so if the back button was clicked we go back to + // the welcome screen. + ShowWelcomeScreen(); + break; + case OsTrialScreen::Result::NEXT_TRY: + ShowNetworkScreen(); + break; + case OsTrialScreen::Result::NEXT_INSTALL: + ShowOsInstallScreen(); + break; + } +} + void WizardController::SkipToLoginForTesting() { VLOG(1) << "WizardController::SkipToLoginForTesting()"; if (current_screen_ && current_screen_->screen_id() == GaiaView::kScreenId) @@ -1200,7 +1228,7 @@ ShowEnableDebuggingScreen(); return; case WelcomeScreen::Result::START_OS_INSTALL: - AdvanceToScreen(OsInstallScreenView::kScreenId); + ShowOsTrialScreen(); return; case WelcomeScreen::Result::NEXT: ShowNetworkScreen(); @@ -2024,6 +2052,7 @@ screen_id == LocaleSwitchView::kScreenId || screen_id == OfflineLoginView::kScreenId || screen_id == OsInstallScreenView::kScreenId || + screen_id == OsTrialScreenView::kScreenId || screen_id == ParentalHandoffScreenView::kScreenId) { SetCurrentScreen(GetScreen(screen_id)); } else {
diff --git a/chrome/browser/ash/login/wizard_controller.h b/chrome/browser/ash/login/wizard_controller.h index 3aa181d..d025cde 100644 --- a/chrome/browser/ash/login/wizard_controller.h +++ b/chrome/browser/ash/login/wizard_controller.h
@@ -16,7 +16,6 @@ #include "base/observer_list.h" #include "base/time/time.h" #include "chrome/browser/ash/accessibility/accessibility_manager.h" -#include "third_party/abseil-cpp/absl/types/optional.h" #include "chrome/browser/ash/login/demo_mode/demo_session.h" #include "chrome/browser/ash/login/enrollment/auto_enrollment_controller.h" #include "chrome/browser/ash/login/enrollment/enrollment_screen.h" @@ -44,6 +43,7 @@ #include "chrome/browser/ash/login/screens/network_screen.h" #include "chrome/browser/ash/login/screens/offline_login_screen.h" #include "chrome/browser/ash/login/screens/os_install_screen.h" +#include "chrome/browser/ash/login/screens/os_trial_screen.h" #include "chrome/browser/ash/login/screens/packaged_license_screen.h" #include "chrome/browser/ash/login/screens/parental_handoff_screen.h" #include "chrome/browser/ash/login/screens/pin_setup_screen.h" @@ -55,6 +55,7 @@ #include "chrome/browser/ash/login/screens/user_creation_screen.h" #include "chrome/browser/ash/login/screens/welcome_screen.h" #include "chrome/browser/ash/policy/enrollment/enrollment_config.h" +#include "third_party/abseil-cpp/absl/types/optional.h" // TODO(https://crbug.com/1164001): move to forward declaration. #include "chromeos/geolocation/geoposition.h" // TODO(https://crbug.com/1164001): move to forward declaration. @@ -278,6 +279,7 @@ void ShowEduCoexistenceLoginScreen(); void ShowParentalHandoffScreen(); void ShowOsInstallScreen(); + void ShowOsTrialScreen(); void ShowLacrosDataMigrationScreen(); void ShowConsolidatedConsentScreen(); @@ -349,6 +351,7 @@ void OnParentalHandoffScreenExit(ParentalHandoffScreen::Result result); void OnOfflineLoginScreenExit(OfflineLoginScreen::Result result); void OnOsInstallScreenExit(); + void OnOsTrialScreenExit(OsTrialScreen::Result result); void OnConsolidatedConsentScreenExit( ConsolidatedConsentScreen::Result result);
diff --git a/chrome/browser/ash/login/wizard_controller_browsertest.cc b/chrome/browser/ash/login/wizard_controller_browsertest.cc index af79bbf..7af82bfc 100644 --- a/chrome/browser/ash/login/wizard_controller_browsertest.cc +++ b/chrome/browser/ash/login/wizard_controller_browsertest.cc
@@ -355,6 +355,10 @@ } // namespace class WizardControllerTest : public OobeBaseTest { + public: + WizardControllerTest(const WizardControllerTest&) = delete; + WizardControllerTest& operator=(const WizardControllerTest&) = delete; + protected: WizardControllerTest() = default; ~WizardControllerTest() override = default; @@ -405,9 +409,6 @@ WizardController::default_controller()->GetScreen( WrongHWIDScreenView::kScreenId)); } - - private: - DISALLOW_COPY_AND_ASSIGN(WizardControllerTest); }; IN_PROC_BROWSER_TEST_F(WizardControllerTest, SwitchLanguage) { @@ -471,6 +472,10 @@ } class WizardControllerFlowTest : public WizardControllerTest { + public: + WizardControllerFlowTest(const WizardControllerFlowTest&) = delete; + WizardControllerFlowTest& operator=(const WizardControllerFlowTest&) = delete; + protected: WizardControllerFlowTest() {} // WizardControllerTest: @@ -777,8 +782,6 @@ NetworkPortalDetectorTestImpl* network_portal_detector_ = nullptr; network::TestURLLoaderFactory test_url_loader_factory_; std::unique_ptr<base::AutoReset<bool>> branded_build_override_; - - DISALLOW_COPY_AND_ASSIGN(WizardControllerFlowTest); }; IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowMain) { @@ -972,6 +975,12 @@ : public WizardControllerFlowTest, public testing::WithParamInterface<UpdateScreen::Result>, public LocalStateMixin::Delegate { + public: + WizardControllerUpdateAfterCompletedOobeTest( + const WizardControllerUpdateAfterCompletedOobeTest&) = delete; + WizardControllerUpdateAfterCompletedOobeTest& operator=( + const WizardControllerUpdateAfterCompletedOobeTest&) = delete; + protected: WizardControllerUpdateAfterCompletedOobeTest() = default; @@ -982,7 +991,6 @@ private: LocalStateMixin local_state_mixin_{&mixin_host_, this}; - DISALLOW_COPY_AND_ASSIGN(WizardControllerUpdateAfterCompletedOobeTest); }; // This test verifies that if WizardController reports any result after the @@ -1046,6 +1054,12 @@ UpdateScreen::Result::UPDATE_ERROR)); class WizardControllerDeviceStateTest : public WizardControllerFlowTest { + public: + WizardControllerDeviceStateTest(const WizardControllerDeviceStateTest&) = + delete; + WizardControllerDeviceStateTest& operator=( + const WizardControllerDeviceStateTest&) = delete; + protected: WizardControllerDeviceStateTest() { fake_statistics_provider_.SetMachineStatistic( @@ -1106,8 +1120,6 @@ DeviceStateMixin::State::BEFORE_OOBE}; std::unique_ptr<base::HistogramTester> histogram_tester_; - - DISALLOW_COPY_AND_ASSIGN(WizardControllerDeviceStateTest); }; IN_PROC_BROWSER_TEST_F(WizardControllerDeviceStateTest, @@ -1227,6 +1239,12 @@ class WizardControllerDeviceStateExplicitRequirementTest : public WizardControllerDeviceStateTest, public testing::WithParamInterface<bool /* fre_explicitly_required */> { + public: + WizardControllerDeviceStateExplicitRequirementTest( + const WizardControllerDeviceStateExplicitRequirementTest&) = delete; + WizardControllerDeviceStateExplicitRequirementTest& operator=( + const WizardControllerDeviceStateExplicitRequirementTest&) = delete; + protected: WizardControllerDeviceStateExplicitRequirementTest() { if (IsFREExplicitlyRequired()) { @@ -1238,9 +1256,6 @@ // Returns true if forced re-enrollment was explicitly required (which // corresponds to the check_enrollment VPD value being set to "1"). bool IsFREExplicitlyRequired() { return GetParam(); } - - private: - DISALLOW_COPY_AND_ASSIGN(WizardControllerDeviceStateExplicitRequirementTest); }; // Test the control flow for Forced Re-Enrollment. First, a connection error @@ -1440,6 +1455,12 @@ class WizardControllerDeviceStateWithInitialEnrollmentTest : public WizardControllerDeviceStateTest { + public: + WizardControllerDeviceStateWithInitialEnrollmentTest( + const WizardControllerDeviceStateWithInitialEnrollmentTest&) = delete; + WizardControllerDeviceStateWithInitialEnrollmentTest& operator=( + const WizardControllerDeviceStateWithInitialEnrollmentTest&) = delete; + protected: WizardControllerDeviceStateWithInitialEnrollmentTest() { fake_statistics_provider_.SetMachineStatistic( @@ -1526,10 +1547,6 @@ SystemClockClient::TestInterface* system_clock_client() { return SystemClockClient::Get()->GetTestInterface(); } - - private: - DISALLOW_COPY_AND_ASSIGN( - WizardControllerDeviceStateWithInitialEnrollmentTest); }; // Tests that a device that is brand new properly does initial enrollment. @@ -1958,6 +1975,12 @@ } class WizardControllerBrokenLocalStateTest : public WizardControllerTest { + public: + WizardControllerBrokenLocalStateTest( + const WizardControllerBrokenLocalStateTest&) = delete; + WizardControllerBrokenLocalStateTest& operator=( + const WizardControllerBrokenLocalStateTest&) = delete; + protected: WizardControllerBrokenLocalStateTest() = default; ~WizardControllerBrokenLocalStateTest() override = default; @@ -1973,8 +1996,6 @@ private: std::unique_ptr<PrefService> local_state_; - - DISALLOW_COPY_AND_ASSIGN(WizardControllerBrokenLocalStateTest); }; IN_PROC_BROWSER_TEST_F(WizardControllerBrokenLocalStateTest, @@ -2001,6 +2022,12 @@ } class WizardControllerProxyAuthOnSigninTest : public WizardControllerTest { + public: + WizardControllerProxyAuthOnSigninTest( + const WizardControllerProxyAuthOnSigninTest&) = delete; + WizardControllerProxyAuthOnSigninTest& operator=( + const WizardControllerProxyAuthOnSigninTest&) = delete; + protected: WizardControllerProxyAuthOnSigninTest() : proxy_server_(net::SpawnedTestServer::TYPE_BASIC_AUTH_PROXY, @@ -2029,8 +2056,6 @@ private: net::SpawnedTestServer proxy_server_; - - DISALLOW_COPY_AND_ASSIGN(WizardControllerProxyAuthOnSigninTest); }; IN_PROC_BROWSER_TEST_F(WizardControllerProxyAuthOnSigninTest, @@ -2046,6 +2071,11 @@ } class WizardControllerKioskFlowTest : public WizardControllerFlowTest { + public: + WizardControllerKioskFlowTest(const WizardControllerKioskFlowTest&) = delete; + WizardControllerKioskFlowTest& operator=( + const WizardControllerKioskFlowTest&) = delete; + protected: WizardControllerKioskFlowTest() {} @@ -2059,9 +2089,6 @@ switches::kAppOemManifestFile, test_data_dir.AppendASCII("kiosk_manifest.json")); } - - private: - DISALLOW_COPY_AND_ASSIGN(WizardControllerKioskFlowTest); }; IN_PROC_BROWSER_TEST_F(WizardControllerKioskFlowTest, @@ -2160,6 +2187,12 @@ class WizardControllerEnableAdbSideloadingTest : public WizardControllerFlowTest { + public: + WizardControllerEnableAdbSideloadingTest( + const WizardControllerEnableAdbSideloadingTest&) = delete; + WizardControllerEnableAdbSideloadingTest& operator=( + const WizardControllerEnableAdbSideloadingTest&) = delete; + protected: WizardControllerEnableAdbSideloadingTest() = default; @@ -2169,9 +2202,6 @@ auto* const wizard_controller = WizardController::default_controller(); wizard_controller->AdvanceToScreen(screen); } - - private: - DISALLOW_COPY_AND_ASSIGN(WizardControllerEnableAdbSideloadingTest); }; IN_PROC_BROWSER_TEST_F(WizardControllerEnableAdbSideloadingTest, @@ -2227,6 +2257,12 @@ } class WizardControllerEnableDebuggingTest : public WizardControllerFlowTest { + public: + WizardControllerEnableDebuggingTest( + const WizardControllerEnableDebuggingTest&) = delete; + WizardControllerEnableDebuggingTest& operator=( + const WizardControllerEnableDebuggingTest&) = delete; + protected: WizardControllerEnableDebuggingTest() {} @@ -2235,9 +2271,6 @@ WizardControllerFlowTest::SetUpCommandLine(command_line); command_line->AppendSwitch(chromeos::switches::kSystemDevMode); } - - private: - DISALLOW_COPY_AND_ASSIGN(WizardControllerEnableDebuggingTest); }; IN_PROC_BROWSER_TEST_F(WizardControllerEnableDebuggingTest, @@ -2264,6 +2297,11 @@ } class WizardControllerDemoSetupTest : public WizardControllerFlowTest { + public: + WizardControllerDemoSetupTest(const WizardControllerDemoSetupTest&) = delete; + WizardControllerDemoSetupTest& operator=( + const WizardControllerDemoSetupTest&) = delete; + protected: WizardControllerDemoSetupTest() = default; ~WizardControllerDemoSetupTest() override = default; @@ -2281,9 +2319,6 @@ wizard_controller->SimulateDemoModeSetupForTesting(); wizard_controller->AdvanceToScreen(screen); } - - private: - DISALLOW_COPY_AND_ASSIGN(WizardControllerDemoSetupTest); }; IN_PROC_BROWSER_TEST_F(WizardControllerDemoSetupTest, @@ -2568,6 +2603,12 @@ class WizardControllerDemoSetupDeviceDisabledTest : public WizardControllerDeviceStateTest { + public: + WizardControllerDemoSetupDeviceDisabledTest( + const WizardControllerDemoSetupDeviceDisabledTest&) = delete; + WizardControllerDemoSetupDeviceDisabledTest& operator=( + const WizardControllerDemoSetupDeviceDisabledTest&) = delete; + protected: WizardControllerDemoSetupDeviceDisabledTest() = default; ~WizardControllerDemoSetupDeviceDisabledTest() override = default; @@ -2577,9 +2618,6 @@ WizardControllerDeviceStateTest::SetUpOnMainThread(); testing::Mock::VerifyAndClearExpectations(mock_welcome_screen_); } - - private: - DISALLOW_COPY_AND_ASSIGN(WizardControllerDemoSetupDeviceDisabledTest); }; IN_PROC_BROWSER_TEST_F(WizardControllerDemoSetupDeviceDisabledTest, @@ -2671,6 +2709,12 @@ } class WizardControllerOobeResumeTest : public WizardControllerTest { + public: + WizardControllerOobeResumeTest(const WizardControllerOobeResumeTest&) = + delete; + WizardControllerOobeResumeTest& operator=( + const WizardControllerOobeResumeTest&) = delete; + protected: WizardControllerOobeResumeTest() {} // WizardControllerTest: @@ -2712,9 +2756,6 @@ MockEnrollmentScreen* mock_enrollment_screen_; std::unique_ptr<base::AutoReset<bool>> branded_build_override_; - - private: - DISALLOW_COPY_AND_ASSIGN(WizardControllerOobeResumeTest); }; IN_PROC_BROWSER_TEST_F(WizardControllerOobeResumeTest, @@ -2771,6 +2812,12 @@ } class WizardControllerCellularFirstTest : public WizardControllerFlowTest { + public: + WizardControllerCellularFirstTest(const WizardControllerCellularFirstTest&) = + delete; + WizardControllerCellularFirstTest& operator=( + const WizardControllerCellularFirstTest&) = delete; + protected: WizardControllerCellularFirstTest() {} @@ -2779,9 +2826,6 @@ WizardControllerFlowTest::SetUpCommandLine(command_line); command_line->AppendSwitch(switches::kCellularFirst); } - - private: - DISALLOW_COPY_AND_ASSIGN(WizardControllerCellularFirstTest); }; IN_PROC_BROWSER_TEST_F(WizardControllerCellularFirstTest, CellularFirstFlow) { @@ -2789,6 +2833,12 @@ } class WizardControllerOobeConfigurationTest : public WizardControllerTest { + public: + WizardControllerOobeConfigurationTest( + const WizardControllerOobeConfigurationTest&) = delete; + WizardControllerOobeConfigurationTest& operator=( + const WizardControllerOobeConfigurationTest&) = delete; + protected: WizardControllerOobeConfigurationTest() {} @@ -2810,9 +2860,6 @@ // Clear portal list (as it is by default in OOBE). NetworkHandler::Get()->network_state_handler()->SetCheckPortalList(""); } - - private: - DISALLOW_COPY_AND_ASSIGN(WizardControllerOobeConfigurationTest); }; IN_PROC_BROWSER_TEST_F(WizardControllerOobeConfigurationTest, @@ -2826,6 +2873,12 @@ } class WizardControllerRollbackFlowTest : public WizardControllerFlowTest { + public: + WizardControllerRollbackFlowTest(const WizardControllerRollbackFlowTest&) = + delete; + WizardControllerRollbackFlowTest& operator=( + const WizardControllerRollbackFlowTest&) = delete; + protected: WizardControllerRollbackFlowTest() {} @@ -2860,9 +2913,6 @@ content::NotificationRegistrar registrar_; FakeRollbackNetworkConfig* network_config_; - - private: - DISALLOW_COPY_AND_ASSIGN(WizardControllerRollbackFlowTest); }; IN_PROC_BROWSER_TEST_F(WizardControllerRollbackFlowTest,
diff --git a/chrome/browser/ash/mobile/mobile_activator.h b/chrome/browser/ash/mobile/mobile_activator.h index 55f49b8..e891f63 100644 --- a/chrome/browser/ash/mobile/mobile_activator.h +++ b/chrome/browser/ash/mobile/mobile_activator.h
@@ -114,6 +114,9 @@ virtual ~Observer() {} }; + MobileActivator(const MobileActivator&) = delete; + MobileActivator& operator=(const MobileActivator&) = delete; + static MobileActivator* GetInstance(); // Add/remove activation process observer. @@ -255,8 +258,6 @@ base::ObserverList<Observer>::Unchecked observers_; base::WeakPtrFactory<MobileActivator> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(MobileActivator); }; } // namespace ash
diff --git a/chrome/browser/ash/net/rollback_network_config/rollback_network_config.cc b/chrome/browser/ash/net/rollback_network_config/rollback_network_config.cc index f897017..c1cc921 100644 --- a/chrome/browser/ash/net/rollback_network_config/rollback_network_config.cc +++ b/chrome/browser/ash/net/rollback_network_config/rollback_network_config.cc
@@ -92,8 +92,8 @@ if (!network_state || !network_state->IsInProfile()) { managed_network_configuration_handler()->CreateConfiguration( kDeviceUserHash, base::Value::AsDictionaryValue(network), - base::DoNothing::Once<const std::string&, const std::string&>().Then( - std::move(success_callback)), + base::BindOnce([](const std::string&, const std::string&) { + }).Then(std::move(success_callback)), base::BindOnce(&PrintError).Then(std::move(failure_callback))); } else if (network_state) { managed_network_configuration_handler()->SetProperties(
diff --git a/chrome/browser/ash/net/secure_dns_manager_unittest.cc b/chrome/browser/ash/net/secure_dns_manager_unittest.cc index 7238f7f..377ed46 100644 --- a/chrome/browser/ash/net/secure_dns_manager_unittest.cc +++ b/chrome/browser/ash/net/secure_dns_manager_unittest.cc
@@ -65,6 +65,9 @@ public: SecureDnsManagerTest() = default; + SecureDnsManagerTest(const SecureDnsManagerTest&) = delete; + SecureDnsManagerTest& operator=(const SecureDnsManagerTest&) = delete; + void SetUp() override { pref_service_.registry()->RegisterStringPref(prefs::kDnsOverHttpsMode, SecureDnsConfig::kModeOff); @@ -78,8 +81,6 @@ content::BrowserTaskEnvironment task_environment_; chromeos::NetworkHandlerTestHelper network_handler_test_helper_; TestingPrefServiceSimple pref_service_; - - DISALLOW_COPY_AND_ASSIGN(SecureDnsManagerTest); }; TEST_F(SecureDnsManagerTest, SetModeOff) {
diff --git a/chrome/browser/ash/ownership/owner_settings_service_ash_factory.h b/chrome/browser/ash/ownership/owner_settings_service_ash_factory.h index 7815651..a8ee636a 100644 --- a/chrome/browser/ash/ownership/owner_settings_service_ash_factory.h +++ b/chrome/browser/ash/ownership/owner_settings_service_ash_factory.h
@@ -35,6 +35,11 @@ static OwnerSettingsServiceAshFactory* GetInstance(); + OwnerSettingsServiceAshFactory(const OwnerSettingsServiceAshFactory&) = + delete; + OwnerSettingsServiceAshFactory& operator=( + const OwnerSettingsServiceAshFactory&) = delete; + static void SetDeviceSettingsServiceForTesting( DeviceSettingsService* device_settings_service); @@ -60,8 +65,6 @@ content::BrowserContext* browser_context) const override; scoped_refptr<ownership::OwnerKeyUtil> owner_key_util_; - - DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceAshFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/ownership/owner_settings_service_ash_unittest.cc b/chrome/browser/ash/ownership/owner_settings_service_ash_unittest.cc index fc47825..2b7e9f47 100644 --- a/chrome/browser/ash/ownership/owner_settings_service_ash_unittest.cc +++ b/chrome/browser/ash/ownership/owner_settings_service_ash_unittest.cc
@@ -100,6 +100,10 @@ user_data_dir_override_(chrome::DIR_USER_DATA), management_settings_set_(false) {} + OwnerSettingsServiceAshTest(const OwnerSettingsServiceAshTest&) = delete; + OwnerSettingsServiceAshTest& operator=(const OwnerSettingsServiceAshTest&) = + delete; + void SetUp() override { DeviceSettingsTestBase::SetUp(); provider_ = std::make_unique<DeviceSettingsProvider>( @@ -153,9 +157,6 @@ std::unique_ptr<DeviceSettingsProvider> provider_; base::ScopedPathOverride user_data_dir_override_; bool management_settings_set_; - - private: - DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceAshTest); }; TEST_F(OwnerSettingsServiceAshTest, SingleSetTest) {
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.h b/chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.h index f342bf17..c4dca1c 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.h +++ b/chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.h
@@ -38,6 +38,12 @@ }; explicit PluginVmEngagementMetricsService(Profile* profile); + + PluginVmEngagementMetricsService(const PluginVmEngagementMetricsService&) = + delete; + PluginVmEngagementMetricsService& operator=( + const PluginVmEngagementMetricsService&) = delete; + ~PluginVmEngagementMetricsService() override; // This needs to be called when Plugin Vm starts and stops being active so we @@ -47,8 +53,6 @@ private: std::unique_ptr<guest_os::GuestOsEngagementMetrics> guest_os_engagement_metrics_; - - DISALLOW_COPY_AND_ASSIGN(PluginVmEngagementMetricsService); }; } // namespace plugin_vm
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_installer.h b/chrome/browser/ash/plugin_vm/plugin_vm_installer.h index 6c6cc51..7d83a701 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_installer.h +++ b/chrome/browser/ash/plugin_vm/plugin_vm_installer.h
@@ -123,6 +123,9 @@ explicit PluginVmInstaller(Profile* profile); + PluginVmInstaller(const PluginVmInstaller&) = delete; + PluginVmInstaller& operator=(const PluginVmInstaller&) = delete; + // Start the installation. Progress updates will be sent to the observer. // Returns a FailureReason if the installation couldn't be started. absl::optional<FailureReason> Start(); @@ -295,8 +298,6 @@ mojo::Remote<device::mojom::WakeLock> wake_lock_; base::WeakPtrFactory<PluginVmInstaller> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(PluginVmInstaller); }; } // namespace plugin_vm
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_installer_factory.h b/chrome/browser/ash/plugin_vm/plugin_vm_installer_factory.h index af696aa..7f7c5719 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_installer_factory.h +++ b/chrome/browser/ash/plugin_vm/plugin_vm_installer_factory.h
@@ -24,6 +24,9 @@ static PluginVmInstaller* GetForProfile(Profile* profile); static PluginVmInstallerFactory* GetInstance(); + PluginVmInstallerFactory(const PluginVmInstallerFactory&) = delete; + PluginVmInstallerFactory& operator=(const PluginVmInstallerFactory&) = delete; + private: friend struct base::DefaultSingletonTraits<PluginVmInstallerFactory>; @@ -35,8 +38,6 @@ content::BrowserContext* context) const override; content::BrowserContext* GetBrowserContextToUse( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(PluginVmInstallerFactory); }; } // namespace plugin_vm
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_util_unittest.cc b/chrome/browser/ash/plugin_vm/plugin_vm_util_unittest.cc index e13a78a..584f463 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_util_unittest.cc +++ b/chrome/browser/ash/plugin_vm/plugin_vm_util_unittest.cc
@@ -25,6 +25,9 @@ public: PluginVmUtilTest() = default; + PluginVmUtilTest(const PluginVmUtilTest&) = delete; + PluginVmUtilTest& operator=(const PluginVmUtilTest&) = delete; + MOCK_METHOD(void, OnPolicyChanged, (bool)); protected: @@ -48,9 +51,6 @@ testing_profile_ = std::make_unique<TestingProfile>(); test_helper_ = std::make_unique<PluginVmTestHelper>(testing_profile_.get()); } - - private: - DISALLOW_COPY_AND_ASSIGN(PluginVmUtilTest); }; TEST_F(PluginVmUtilTest, PluginVmShouldBeAllowedOnceAllConditionsAreMet) {
diff --git a/chrome/browser/ash/policy/active_directory/active_directory_join_delegate.h b/chrome/browser/ash/policy/active_directory/active_directory_join_delegate.h index b710197b6..6eba7b99 100644 --- a/chrome/browser/ash/policy/active_directory/active_directory_join_delegate.h +++ b/chrome/browser/ash/policy/active_directory/active_directory_join_delegate.h
@@ -22,6 +22,11 @@ class ActiveDirectoryJoinDelegate { public: ActiveDirectoryJoinDelegate() = default; + + ActiveDirectoryJoinDelegate(const ActiveDirectoryJoinDelegate&) = delete; + ActiveDirectoryJoinDelegate& operator=(const ActiveDirectoryJoinDelegate&) = + delete; + // Start the Active Directory domain join flow. |dm_token| will be stored in // the device policy. |domain_join_config| could be used to streamline the // flow. @@ -31,9 +36,6 @@ protected: ~ActiveDirectoryJoinDelegate() = default; - - private: - DISALLOW_COPY_AND_ASSIGN(ActiveDirectoryJoinDelegate); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/active_directory/active_directory_policy_manager_unittest.cc b/chrome/browser/ash/policy/active_directory/active_directory_policy_manager_unittest.cc index 80b6bac..cde0932 100644 --- a/chrome/browser/ash/policy/active_directory/active_directory_policy_manager_unittest.cc +++ b/chrome/browser/ash/policy/active_directory/active_directory_policy_manager_unittest.cc
@@ -40,6 +40,11 @@ "realm.com", "device_id")) {} + ActiveDirectoryPolicyManagerTest(const ActiveDirectoryPolicyManagerTest&) = + delete; + ActiveDirectoryPolicyManagerTest& operator=( + const ActiveDirectoryPolicyManagerTest&) = delete; + // testing::Test overrides: void SetUp() override { chromeos::AuthPolicyClient::InitializeFake(); @@ -99,7 +104,6 @@ private: base::test::TaskEnvironment task_environment_; chromeos::ScopedStubInstallAttributes install_attributes_; - DISALLOW_COPY_AND_ASSIGN(ActiveDirectoryPolicyManagerTest); }; class UserActiveDirectoryPolicyManagerTest
diff --git a/chrome/browser/ash/policy/affiliation/affiliation_test_helper.h b/chrome/browser/ash/policy/affiliation/affiliation_test_helper.h index b6d7347..0421ec5 100644 --- a/chrome/browser/ash/policy/affiliation/affiliation_test_helper.h +++ b/chrome/browser/ash/policy/affiliation/affiliation_test_helper.h
@@ -41,9 +41,12 @@ chromeos::FakeAuthPolicyClient* fake_authpolicy_client); // Allow move construction, so the static constructors can be used despite - // DISALLOW_COPY_AND_ASSIGN. + // deleted constructors. AffiliationTestHelper(AffiliationTestHelper&& other); + AffiliationTestHelper(const AffiliationTestHelper&) = delete; + AffiliationTestHelper& operator=(const AffiliationTestHelper&) = delete; + // Sets device affiliation IDs to |device_affiliation_ids| in // |fake_session_manager_client_| and modifies |test_helper| so that it // contains correct values of device affiliation IDs for future use. To add @@ -94,8 +97,6 @@ chromeos::FakeSessionManagerClient* fake_session_manager_client_; // Not owned. chromeos::FakeAuthPolicyClient* fake_authpolicy_client_; // Not owned. - - DISALLOW_COPY_AND_ASSIGN(AffiliationTestHelper); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/affiliation/user_affiliation_browsertest.cc b/chrome/browser/ash/policy/affiliation/user_affiliation_browsertest.cc index 4e6b366..fcbcb4c2 100644 --- a/chrome/browser/ash/policy/affiliation/user_affiliation_browsertest.cc +++ b/chrome/browser/ash/policy/affiliation/user_affiliation_browsertest.cc
@@ -119,6 +119,10 @@ affiliation_mixin_.set_affiliated(GetParam().affiliated); } + UserAffiliationBrowserTest(const UserAffiliationBrowserTest&) = delete; + UserAffiliationBrowserTest& operator=(const UserAffiliationBrowserTest&) = + delete; + protected: // MixinBasedInProcessBrowserTest: void SetUpCommandLine(base::CommandLine* command_line) override { @@ -244,8 +248,6 @@ ? ash::DeviceStateMixin::State:: OOBE_COMPLETED_ACTIVE_DIRECTORY_ENROLLED : ash::DeviceStateMixin::State::OOBE_COMPLETED_CLOUD_ENROLLED}; - - DISALLOW_COPY_AND_ASSIGN(UserAffiliationBrowserTest); }; IN_PROC_BROWSER_TEST_P(UserAffiliationBrowserTest, PRE_PRE_TestAffiliation) {
diff --git a/chrome/browser/ash/policy/arc/unaffiliated_arc_allowed_browsertest.cc b/chrome/browser/ash/policy/arc/unaffiliated_arc_allowed_browsertest.cc index d5249a8..2c3ba04 100644 --- a/chrome/browser/ash/policy/arc/unaffiliated_arc_allowed_browsertest.cc +++ b/chrome/browser/ash/policy/arc/unaffiliated_arc_allowed_browsertest.cc
@@ -47,6 +47,10 @@ affiliation_mixin_.set_affiliated(GetParam().affiliated); } + UnaffiliatedArcAllowedTest(const UnaffiliatedArcAllowedTest&) = delete; + UnaffiliatedArcAllowedTest& operator=(const UnaffiliatedArcAllowedTest&) = + delete; + void SetUpCommandLine(base::CommandLine* command_line) override { DevicePolicyCrosBrowserTest::SetUpCommandLine(command_line); arc::SetArcAvailableCommandLineForTesting(command_line); @@ -83,9 +87,6 @@ } AffiliationMixin affiliation_mixin_{&mixin_host_, policy_helper()}; - - private: - DISALLOW_COPY_AND_ASSIGN(UnaffiliatedArcAllowedTest); }; IN_PROC_BROWSER_TEST_P(UnaffiliatedArcAllowedTest, PRE_ProfileTest) {
diff --git a/chrome/browser/ash/policy/core/cached_policy_key_loader_unittest.cc b/chrome/browser/ash/policy/core/cached_policy_key_loader_unittest.cc index a93d88bc..76f31b6b4 100644 --- a/chrome/browser/ash/policy/core/cached_policy_key_loader_unittest.cc +++ b/chrome/browser/ash/policy/core/cached_policy_key_loader_unittest.cc
@@ -31,6 +31,10 @@ protected: CachedPolicyKeyLoaderTest() = default; + CachedPolicyKeyLoaderTest(const CachedPolicyKeyLoaderTest&) = delete; + CachedPolicyKeyLoaderTest& operator=(const CachedPolicyKeyLoaderTest&) = + delete; + void SetUp() override { ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir()); @@ -82,8 +86,6 @@ private: base::ScopedTempDir tmp_dir_; - - DISALLOW_COPY_AND_ASSIGN(CachedPolicyKeyLoaderTest); }; // Loads an existing key file using EnsurePolicyKeyLoaded.
diff --git a/chrome/browser/ash/policy/core/device_cloud_policy_browsertest.cc b/chrome/browser/ash/policy/core/device_cloud_policy_browsertest.cc index 978e7c99..0bef723 100644 --- a/chrome/browser/ash/policy/core/device_cloud_policy_browsertest.cc +++ b/chrome/browser/ash/policy/core/device_cloud_policy_browsertest.cc
@@ -67,6 +67,12 @@ // The test is performed against a test policy server, which is set up for // rotating the policy key automatically with each policy fetch. class KeyRotationDeviceCloudPolicyTest : public DevicePolicyCrosBrowserTest { + public: + KeyRotationDeviceCloudPolicyTest(const KeyRotationDeviceCloudPolicyTest&) = + delete; + KeyRotationDeviceCloudPolicyTest& operator=( + const KeyRotationDeviceCloudPolicyTest&) = delete; + protected: const int kInitialPolicyValue = 123; const int kSecondPolicyValue = 456; @@ -189,8 +195,6 @@ std::unique_ptr<PolicyChangeRegistrar> policy_change_registrar_; int awaited_policy_value_ = -1; std::unique_ptr<base::RunLoop> policy_change_waiting_run_loop_; - - DISALLOW_COPY_AND_ASSIGN(KeyRotationDeviceCloudPolicyTest); }; } // namespace
diff --git a/chrome/browser/ash/policy/core/device_cloud_policy_manager_ash_unittest.cc b/chrome/browser/ash/policy/core/device_cloud_policy_manager_ash_unittest.cc index fef4005cf..f6ceff3 100644 --- a/chrome/browser/ash/policy/core/device_cloud_policy_manager_ash_unittest.cc +++ b/chrome/browser/ash/policy/core/device_cloud_policy_manager_ash_unittest.cc
@@ -128,6 +128,12 @@ class DeviceCloudPolicyManagerAshTest : public ash::DeviceSettingsTestBase, public chromeos::SessionManagerClient::Observer { + public: + DeviceCloudPolicyManagerAshTest(const DeviceCloudPolicyManagerAshTest&) = + delete; + DeviceCloudPolicyManagerAshTest& operator=( + const DeviceCloudPolicyManagerAshTest&) = delete; + protected: DeviceCloudPolicyManagerAshTest() : state_keys_broker_(&session_manager_client_), store_(nullptr) { @@ -308,8 +314,6 @@ // This property is required to instantiate the session manager, a singleton // which is used by the device status collector. session_manager::SessionManager session_manager_; - - DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerAshTest); }; TEST_F(DeviceCloudPolicyManagerAshTest, FreshDevice) { @@ -465,6 +469,11 @@ : public DeviceCloudPolicyManagerAshTest, public testing::WithParamInterface<bool> { public: + DeviceCloudPolicyManagerAshEnrollmentTest( + const DeviceCloudPolicyManagerAshEnrollmentTest&) = delete; + DeviceCloudPolicyManagerAshEnrollmentTest& operator=( + const DeviceCloudPolicyManagerAshEnrollmentTest&) = delete; + void Done(EnrollmentStatus status) { enrollment_handler_.reset(); ConnectManager(false); @@ -768,9 +777,6 @@ bool expect_robot_auth_fetch_failure_; bool done_; - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerAshEnrollmentTest); }; TEST_P(DeviceCloudPolicyManagerAshEnrollmentTest, Success) {
diff --git a/chrome/browser/ash/policy/core/device_cloud_policy_store_ash_unittest.cc b/chrome/browser/ash/policy/core/device_cloud_policy_store_ash_unittest.cc index a0fc030..8d75037 100644 --- a/chrome/browser/ash/policy/core/device_cloud_policy_store_ash_unittest.cc +++ b/chrome/browser/ash/policy/core/device_cloud_policy_store_ash_unittest.cc
@@ -47,6 +47,11 @@ } // namespace class DeviceCloudPolicyStoreAshTest : public ash::DeviceSettingsTestBase { + public: + DeviceCloudPolicyStoreAshTest(const DeviceCloudPolicyStoreAshTest&) = delete; + DeviceCloudPolicyStoreAshTest& operator=( + const DeviceCloudPolicyStoreAshTest&) = delete; + protected: DeviceCloudPolicyStoreAshTest() : local_state_(TestingBrowserProcess::GetGlobal()) {} @@ -140,9 +145,6 @@ std::unique_ptr<DeviceCloudPolicyStoreAsh> store_; MockCloudPolicyStoreObserver observer_; - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyStoreAshTest); }; TEST_F(DeviceCloudPolicyStoreAshTest, LoadNoKey) {
diff --git a/chrome/browser/ash/policy/core/device_local_account_browsertest.cc b/chrome/browser/ash/policy/core/device_local_account_browsertest.cc index 3ac96031..17e3942 100644 --- a/chrome/browser/ash/policy/core/device_local_account_browsertest.cc +++ b/chrome/browser/ash/policy/core/device_local_account_browsertest.cc
@@ -393,6 +393,10 @@ public user_manager::UserManager::Observer, public BrowserListObserver, public extensions::AppWindowRegistry::Observer { + public: + DeviceLocalAccountTest(const DeviceLocalAccountTest&) = delete; + DeviceLocalAccountTest& operator=(const DeviceLocalAccountTest&) = delete; + protected: DeviceLocalAccountTest() : public_session_input_method_id_( @@ -747,7 +751,6 @@ private: extensions::SandboxedUnpacker::ScopedVerifierFormatOverrideForTest verifier_format_override_; - DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountTest); }; static bool IsKnownUser(const AccountId& account_id) {
diff --git a/chrome/browser/ash/policy/core/device_local_account_policy_service_unittest.cc b/chrome/browser/ash/policy/core/device_local_account_policy_service_unittest.cc index 6ea2c491..26e6417 100644 --- a/chrome/browser/ash/policy/core/device_local_account_policy_service_unittest.cc +++ b/chrome/browser/ash/policy/core/device_local_account_policy_service_unittest.cc
@@ -122,6 +122,11 @@ class DeviceLocalAccountPolicyServiceTest : public DeviceLocalAccountPolicyServiceTestBase { public: + DeviceLocalAccountPolicyServiceTest( + const DeviceLocalAccountPolicyServiceTest&) = delete; + DeviceLocalAccountPolicyServiceTest& operator=( + const DeviceLocalAccountPolicyServiceTest&) = delete; + MOCK_METHOD1(OnRefreshDone, void(bool)); // DeviceLocalAccountPolicyServiceTestBase: @@ -135,9 +140,6 @@ void InstallDevicePolicy() override; MockDeviceLocalAccountPolicyServiceObserver service_observer_; - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyServiceTest); }; DeviceLocalAccountPolicyServiceTestBase:: @@ -542,6 +544,12 @@ class DeviceLocalAccountPolicyExtensionCacheTest : public DeviceLocalAccountPolicyServiceTestBase { + public: + DeviceLocalAccountPolicyExtensionCacheTest( + const DeviceLocalAccountPolicyExtensionCacheTest&) = delete; + DeviceLocalAccountPolicyExtensionCacheTest& operator=( + const DeviceLocalAccountPolicyExtensionCacheTest&) = delete; + protected: DeviceLocalAccountPolicyExtensionCacheTest(); @@ -555,9 +563,6 @@ base::FilePath cache_dir_1_; base::FilePath cache_dir_2_; base::FilePath cache_dir_3_; - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyExtensionCacheTest); }; DeviceLocalAccountPolicyExtensionCacheTest:: @@ -821,6 +826,12 @@ class DeviceLocalAccountPolicyProviderTest : public DeviceLocalAccountPolicyServiceTestBase { + public: + DeviceLocalAccountPolicyProviderTest( + const DeviceLocalAccountPolicyProviderTest&) = delete; + DeviceLocalAccountPolicyProviderTest& operator=( + const DeviceLocalAccountPolicyProviderTest&) = delete; + protected: DeviceLocalAccountPolicyProviderTest(); @@ -831,9 +842,6 @@ std::unique_ptr<DeviceLocalAccountPolicyProvider> provider_; MockConfigurationPolicyObserver provider_observer_; std::unique_ptr<ash::ScopedCrosSettingsTestHelper> cros_settings_helper_; - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyProviderTest); }; DeviceLocalAccountPolicyProviderTest::DeviceLocalAccountPolicyProviderTest() @@ -1208,6 +1216,12 @@ class DeviceLocalAccountPolicyProviderLoadImmediateTest : public DeviceLocalAccountPolicyServiceTestBase { + public: + DeviceLocalAccountPolicyProviderLoadImmediateTest( + const DeviceLocalAccountPolicyProviderLoadImmediateTest&) = delete; + DeviceLocalAccountPolicyProviderLoadImmediateTest& operator=( + const DeviceLocalAccountPolicyProviderLoadImmediateTest&) = delete; + protected: DeviceLocalAccountPolicyProviderLoadImmediateTest(); @@ -1216,9 +1230,6 @@ std::unique_ptr<DeviceLocalAccountPolicyProvider> provider_; MockDeviceLocalAccountPolicyServiceObserver service_observer_; - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyProviderLoadImmediateTest); }; DeviceLocalAccountPolicyProviderLoadImmediateTest::
diff --git a/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.cc b/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.cc index 4efb2a5..6dcf1210 100644 --- a/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.cc +++ b/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.cc
@@ -120,6 +120,11 @@ return base::Singleton<UserCloudPolicyManagerAshNotifierFactory>::get(); } + UserCloudPolicyManagerAshNotifierFactory( + const UserCloudPolicyManagerAshNotifierFactory&) = delete; + UserCloudPolicyManagerAshNotifierFactory& operator=( + const UserCloudPolicyManagerAshNotifierFactory&) = delete; + private: friend struct base::DefaultSingletonTraits< UserCloudPolicyManagerAshNotifierFactory>; @@ -131,8 +136,6 @@ } ~UserCloudPolicyManagerAshNotifierFactory() override = default; - - DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerAshNotifierFactory); }; } // namespace
diff --git a/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash_browsertest.cc b/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash_browsertest.cc index b05cc364..3a44701 100644 --- a/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash_browsertest.cc +++ b/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash_browsertest.cc
@@ -38,6 +38,11 @@ public testing::WithParamInterface< std::tuple<std::vector<base::Feature>, ash::LoggedInUserMixin::LogInType>> { + public: + UserCloudPolicyManagerTest(const UserCloudPolicyManagerTest&) = delete; + UserCloudPolicyManagerTest& operator=(const UserCloudPolicyManagerTest&) = + delete; + protected: UserCloudPolicyManagerTest() { // Override default tests configuration that prevents effective testing of @@ -79,8 +84,6 @@ private: base::test::ScopedFeatureList scoped_feature_list_; - - DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerTest); }; IN_PROC_BROWSER_TEST_P(UserCloudPolicyManagerTest, StartSession) {
diff --git a/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash_unittest.cc b/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash_unittest.cc index 4a32cbf..41196b9 100644 --- a/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash_unittest.cc +++ b/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash_unittest.cc
@@ -124,6 +124,10 @@ class UserCloudPolicyManagerAshTest : public testing::TestWithParam<std::vector<base::Feature>> { public: + UserCloudPolicyManagerAshTest(const UserCloudPolicyManagerAshTest&) = delete; + UserCloudPolicyManagerAshTest& operator=( + const UserCloudPolicyManagerAshTest&) = delete; + // Note: This method has to be public, so that a pointer to it may be obtained // in the test. void MakeManagerWithPreloadedStore(const base::TimeDelta& fetch_timeout) { @@ -468,8 +472,6 @@ test_system_shared_loader_factory_; base::test::ScopedFeatureList scoped_feature_list_; - - DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerAshTest); }; // TODO(agawronska): Remove test instantiation with kDMServerOAuthForChildUser @@ -1148,6 +1150,11 @@ class UserCloudPolicyManagerAshChildTest : public UserCloudPolicyManagerAshTest { public: + UserCloudPolicyManagerAshChildTest( + const UserCloudPolicyManagerAshChildTest&) = delete; + UserCloudPolicyManagerAshChildTest& operator=( + const UserCloudPolicyManagerAshChildTest&) = delete; + // Issues OAuthToken for device management scopes. void IssueOAuth2AccessToken(base::TimeDelta token_lifetime) { signin::ScopeSet scopes; @@ -1179,9 +1186,6 @@ store_->NotifyStoreLoaded(); EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); } - - private: - DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerAshChildTest); }; // TODO(agawronska): Remove test instantiation with kDMServerOAuthForChildUser
diff --git a/chrome/browser/ash/policy/core/user_cloud_policy_store_ash_unittest.cc b/chrome/browser/ash/policy/core/user_cloud_policy_store_ash_unittest.cc index a8d4bf0..5205870 100644 --- a/chrome/browser/ash/policy/core/user_cloud_policy_store_ash_unittest.cc +++ b/chrome/browser/ash/policy/core/user_cloud_policy_store_ash_unittest.cc
@@ -82,6 +82,9 @@ explicit FakeSessionManagerClient(const base::FilePath& user_policy_dir) : user_policy_dir_(user_policy_dir) {} + FakeSessionManagerClient(const FakeSessionManagerClient&) = delete; + FakeSessionManagerClient& operator=(const FakeSessionManagerClient&) = delete; + // SessionManagerClient override: void StorePolicyForUser(const cryptohome::AccountIdentifier& cryptohome_id, const std::string& policy_blob, @@ -114,10 +117,14 @@ std::map<cryptohome::AccountIdentifier, std::string> public_key_map_; base::WeakPtrFactory<FakeSessionManagerClient> weak_ptr_factory_{this}; - DISALLOW_COPY_AND_ASSIGN(FakeSessionManagerClient); }; class UserCloudPolicyStoreAshTest : public testing::Test { + public: + UserCloudPolicyStoreAshTest(const UserCloudPolicyStoreAshTest&) = delete; + UserCloudPolicyStoreAshTest& operator=(const UserCloudPolicyStoreAshTest&) = + delete; + protected: UserCloudPolicyStoreAshTest() : task_environment_( @@ -249,8 +256,6 @@ private: base::ScopedTempDir tmp_dir_; - - DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreAshTest); }; TEST_F(UserCloudPolicyStoreAshTest, InitialStore) {
diff --git a/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_factory.h b/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_factory.h index 9e61036..48aee35 100644 --- a/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_factory.h +++ b/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_factory.h
@@ -23,6 +23,11 @@ // Returns an instance of the UserCloudPolicyTokenForwarderFactory singleton. static UserCloudPolicyTokenForwarderFactory* GetInstance(); + UserCloudPolicyTokenForwarderFactory( + const UserCloudPolicyTokenForwarderFactory&) = delete; + UserCloudPolicyTokenForwarderFactory& operator=( + const UserCloudPolicyTokenForwarderFactory&) = delete; + private: friend struct base::DefaultSingletonTraits< UserCloudPolicyTokenForwarderFactory>; @@ -35,8 +40,6 @@ content::BrowserContext* context) const override; bool ServiceIsCreatedWithBrowserContext() const override; bool ServiceIsNULLWhileTesting() const override; - - DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyTokenForwarderFactory); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_unittest.cc b/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_unittest.cc index 248c816..92c54ad 100644 --- a/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_unittest.cc +++ b/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_unittest.cc
@@ -92,6 +92,12 @@ }; class UserCloudPolicyTokenForwarderTest : public testing::Test { + public: + UserCloudPolicyTokenForwarderTest(const UserCloudPolicyTokenForwarderTest&) = + delete; + UserCloudPolicyTokenForwarderTest& operator=( + const UserCloudPolicyTokenForwarderTest&) = delete; + protected: static ash::FakeChromeUserManager* GetFakeUserManager() { return static_cast<ash::FakeChromeUserManager*>( @@ -216,8 +222,6 @@ std::unique_ptr<MockCloudPolicyStore> store_; base::test::ScopedFeatureList scoped_feature_list_; - - DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyTokenForwarderTest); }; TEST_F(UserCloudPolicyTokenForwarderTest,
diff --git a/chrome/browser/ash/policy/display/display_resolution_handler_browsertest.cc b/chrome/browser/ash/policy/display/display_resolution_handler_browsertest.cc index 3423412..78c0c9ec 100644 --- a/chrome/browser/ash/policy/display/display_resolution_handler_browsertest.cc +++ b/chrome/browser/ash/policy/display/display_resolution_handler_browsertest.cc
@@ -168,6 +168,11 @@ : public policy::DeviceDisplayPolicyCrosBrowserTest, public testing::WithParamInterface<PolicyValue> { public: + DeviceDisplayResolutionTestBase(const DeviceDisplayResolutionTestBase&) = + delete; + DeviceDisplayResolutionTestBase& operator=( + const DeviceDisplayResolutionTestBase&) = delete; + void SetUpCommandLine(base::CommandLine* command_line) override { command_line->AppendSwitch(chromeos::switches::kLoginManager); command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); @@ -183,22 +188,20 @@ policy_helper()->RefreshPolicyAndWaitUntilDeviceSettingsUpdated( {chromeos::kDeviceDisplayResolution}); } - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceDisplayResolutionTestBase); }; class DeviceDisplayResolutionTest : public DeviceDisplayResolutionTestBase { public: DeviceDisplayResolutionTest() {} + DeviceDisplayResolutionTest(const DeviceDisplayResolutionTest&) = delete; + DeviceDisplayResolutionTest& operator=(const DeviceDisplayResolutionTest&) = + delete; + protected: void SetPolicy(PolicyValue value) { DeviceDisplayResolutionTestBase::SetPolicy(value, false); } - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceDisplayResolutionTest); }; IN_PROC_BROWSER_TEST_P(DeviceDisplayResolutionTest, Internal) { @@ -303,6 +306,11 @@ class DisplayResolutionBootTest : public MixinBasedInProcessBrowserTest, public testing::WithParamInterface<PolicyValue> { + public: + DisplayResolutionBootTest(const DisplayResolutionBootTest&) = delete; + DisplayResolutionBootTest& operator=(const DisplayResolutionBootTest&) = + delete; + protected: DisplayResolutionBootTest() { device_state_.set_skip_initial_policy_setup(true); @@ -330,7 +338,6 @@ private: DevicePolicyCrosTestHelper policy_helper_; DeviceDisplayCrosTestHelper helper_; - DISALLOW_COPY_AND_ASSIGN(DisplayResolutionBootTest); }; IN_PROC_BROWSER_TEST_P(DisplayResolutionBootTest, PRE_Reboot) { @@ -394,6 +401,11 @@ public: DeviceDisplayResolutionRecommendedTest() {} + DeviceDisplayResolutionRecommendedTest( + const DeviceDisplayResolutionRecommendedTest&) = delete; + DeviceDisplayResolutionRecommendedTest& operator=( + const DeviceDisplayResolutionRecommendedTest&) = delete; + protected: void SetPolicy(PolicyValue value) { DeviceDisplayResolutionTestBase::SetPolicy(value, true); @@ -419,7 +431,6 @@ private: DeviceDisplayCrosTestHelper display_helper_; - DISALLOW_COPY_AND_ASSIGN(DeviceDisplayResolutionRecommendedTest); }; IN_PROC_BROWSER_TEST_P(DeviceDisplayResolutionRecommendedTest, Internal) {
diff --git a/chrome/browser/ash/policy/display/display_rotation_default_handler_browsertest.cc b/chrome/browser/ash/policy/display/display_rotation_default_handler_browsertest.cc index 07608d5f..c0b1074 100644 --- a/chrome/browser/ash/policy/display/display_rotation_default_handler_browsertest.cc +++ b/chrome/browser/ash/policy/display/display_rotation_default_handler_browsertest.cc
@@ -180,6 +180,10 @@ class DisplayRotationBootTest : public MixinBasedInProcessBrowserTest, public testing::WithParamInterface<display::Display::Rotation> { + public: + DisplayRotationBootTest(const DisplayRotationBootTest&) = delete; + DisplayRotationBootTest& operator=(const DisplayRotationBootTest&) = delete; + protected: DisplayRotationBootTest() { device_state_.set_skip_initial_policy_setup(true); @@ -202,7 +206,6 @@ private: DevicePolicyCrosTestHelper policy_helper_; DeviceDisplayCrosTestHelper display_helper_; - DISALLOW_COPY_AND_ASSIGN(DisplayRotationBootTest); }; IN_PROC_BROWSER_TEST_P(DisplayRotationBootTest, PRE_Reboot) {
diff --git a/chrome/browser/ash/policy/enrollment/auto_enrollment_client_impl_unittest.cc b/chrome/browser/ash/policy/enrollment/auto_enrollment_client_impl_unittest.cc index bfcda29..4a50995 100644 --- a/chrome/browser/ash/policy/enrollment/auto_enrollment_client_impl_unittest.cc +++ b/chrome/browser/ash/policy/enrollment/auto_enrollment_client_impl_unittest.cc
@@ -130,6 +130,11 @@ : public testing::Test, public ::testing::WithParamInterface< std::tuple<AutoEnrollmentClientImplTestState, int>> { + public: + AutoEnrollmentClientImplTest(const AutoEnrollmentClientImplTest&) = delete; + AutoEnrollmentClientImplTest& operator=(const AutoEnrollmentClientImplTest&) = + delete; + protected: AutoEnrollmentClientImplTest() : scoped_testing_local_state_(TestingBrowserProcess::GetGlobal()), @@ -609,7 +614,6 @@ network::TestURLLoaderFactory url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_; std::unique_ptr<AutoEnrollmentClient> client_; - DISALLOW_COPY_AND_ASSIGN(AutoEnrollmentClientImplTest); }; TEST_P(AutoEnrollmentClientImplTest, NetworkFailure) {
diff --git a/chrome/browser/ash/policy/enrollment/fake_auto_enrollment_client.h b/chrome/browser/ash/policy/enrollment/fake_auto_enrollment_client.h index c9b496be..b8fd081 100644 --- a/chrome/browser/ash/policy/enrollment/fake_auto_enrollment_client.h +++ b/chrome/browser/ash/policy/enrollment/fake_auto_enrollment_client.h
@@ -62,6 +62,10 @@ }; explicit FakeAutoEnrollmentClient(const ProgressCallback& progress_callback); + + FakeAutoEnrollmentClient(const FakeAutoEnrollmentClient&) = delete; + FakeAutoEnrollmentClient& operator=(const FakeAutoEnrollmentClient&) = delete; + ~FakeAutoEnrollmentClient() override; void Start() override; @@ -81,8 +85,6 @@ private: ProgressCallback progress_callback_; AutoEnrollmentState state_; - - DISALLOW_COPY_AND_ASSIGN(FakeAutoEnrollmentClient); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/external_data/cloud_external_data_manager_base.cc b/chrome/browser/ash/policy/external_data/cloud_external_data_manager_base.cc index db7acd3..5c414ac 100644 --- a/chrome/browser/ash/policy/external_data/cloud_external_data_manager_base.cc +++ b/chrome/browser/ash/policy/external_data/cloud_external_data_manager_base.cc
@@ -61,6 +61,9 @@ scoped_refptr<base::SequencedTaskRunner> task_runner, scoped_refptr<base::SequencedTaskRunner> callback_task_runner); + Backend(const Backend&) = delete; + Backend& operator=(const Backend&) = delete; + // Allows downloaded external data to be cached in |external_data_store|. // Ownership of the store is taken. The store can be destroyed by calling // SetExternalDataStore(nullptr). @@ -159,8 +162,6 @@ std::unique_ptr<ExternalPolicyDataUpdater> updater_; SEQUENCE_CHECKER(sequence_checker_); - - DISALLOW_COPY_AND_ASSIGN(Backend); }; CloudExternalDataManagerBase::Backend::Backend(
diff --git a/chrome/browser/ash/policy/external_data/cloud_external_data_manager_base_unittest.cc b/chrome/browser/ash/policy/external_data/cloud_external_data_manager_base_unittest.cc index 007f6b86..c3e6e1fc 100644 --- a/chrome/browser/ash/policy/external_data/cloud_external_data_manager_base_unittest.cc +++ b/chrome/browser/ash/policy/external_data/cloud_external_data_manager_base_unittest.cc
@@ -72,6 +72,12 @@ } // namespace class CloudExternalDataManagerBaseTest : public testing::Test { + public: + CloudExternalDataManagerBaseTest(const CloudExternalDataManagerBaseTest&) = + delete; + CloudExternalDataManagerBaseTest& operator=( + const CloudExternalDataManagerBaseTest&) = delete; + protected: CloudExternalDataManagerBaseTest(); @@ -115,9 +121,6 @@ std::map<int, std::unique_ptr<std::string>> callback_data_; PolicyDetailsMap policy_details_; - - private: - DISALLOW_COPY_AND_ASSIGN(CloudExternalDataManagerBaseTest); }; CloudExternalDataManagerBaseTest::CloudExternalDataManagerBaseTest() {}
diff --git a/chrome/browser/ash/policy/external_data/cloud_external_data_policy_observer.h b/chrome/browser/ash/policy/external_data/cloud_external_data_policy_observer.h index 3f7dda04..ff913cea 100644 --- a/chrome/browser/ash/policy/external_data/cloud_external_data_policy_observer.h +++ b/chrome/browser/ash/policy/external_data/cloud_external_data_policy_observer.h
@@ -67,6 +67,12 @@ DeviceLocalAccountPolicyService* device_local_account_policy_service, const std::string& policy, Delegate* delegate); + + CloudExternalDataPolicyObserver(const CloudExternalDataPolicyObserver&) = + delete; + CloudExternalDataPolicyObserver& operator=( + const CloudExternalDataPolicyObserver&) = delete; + ~CloudExternalDataPolicyObserver() override; void Init(); @@ -128,8 +134,6 @@ FetchWeakPtrMap fetch_weak_ptrs_; base::WeakPtrFactory<CloudExternalDataPolicyObserver> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(CloudExternalDataPolicyObserver); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/external_data/device_cloud_external_data_policy_observer.h b/chrome/browser/ash/policy/external_data/device_cloud_external_data_policy_observer.h index 9b2051c..a500fa5 100644 --- a/chrome/browser/ash/policy/external_data/device_cloud_external_data_policy_observer.h +++ b/chrome/browser/ash/policy/external_data/device_cloud_external_data_policy_observer.h
@@ -53,6 +53,12 @@ DeviceCloudExternalDataPolicyObserver(PolicyService* policy_service, const std::string& policy, Delegate* delegate); + + DeviceCloudExternalDataPolicyObserver( + const DeviceCloudExternalDataPolicyObserver&) = delete; + DeviceCloudExternalDataPolicyObserver& operator=( + const DeviceCloudExternalDataPolicyObserver&) = delete; + ~DeviceCloudExternalDataPolicyObserver() override; // PolicyService::Observer: @@ -80,8 +86,6 @@ base::WeakPtrFactory<DeviceCloudExternalDataPolicyObserver> weak_factory_{ this}; - - DISALLOW_COPY_AND_ASSIGN(DeviceCloudExternalDataPolicyObserver); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/external_data/device_local_account_external_data_manager.h b/chrome/browser/ash/policy/external_data/device_local_account_external_data_manager.h index c551958..57fc20b6 100644 --- a/chrome/browser/ash/policy/external_data/device_local_account_external_data_manager.h +++ b/chrome/browser/ash/policy/external_data/device_local_account_external_data_manager.h
@@ -35,6 +35,12 @@ class DeviceLocalAccountExternalDataManager : public CloudExternalDataManagerBase, public base::RefCounted<DeviceLocalAccountExternalDataManager> { + public: + DeviceLocalAccountExternalDataManager( + const DeviceLocalAccountExternalDataManager&) = delete; + DeviceLocalAccountExternalDataManager& operator=( + const DeviceLocalAccountExternalDataManager&) = delete; + private: friend class DeviceLocalAccountExternalDataService; friend class base::RefCounted<DeviceLocalAccountExternalDataManager>; @@ -57,8 +63,6 @@ // CloudExternalDataManagerBase: void OnPolicyStoreLoaded() override; - - DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountExternalDataManager); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/external_data/handlers/cloud_external_data_policy_handler.h b/chrome/browser/ash/policy/external_data/handlers/cloud_external_data_policy_handler.h index 0325c5d..b5096e8 100644 --- a/chrome/browser/ash/policy/external_data/handlers/cloud_external_data_policy_handler.h +++ b/chrome/browser/ash/policy/external_data/handlers/cloud_external_data_policy_handler.h
@@ -16,12 +16,14 @@ public: CloudExternalDataPolicyHandler(); + CloudExternalDataPolicyHandler(const CloudExternalDataPolicyHandler&) = + delete; + CloudExternalDataPolicyHandler& operator=( + const CloudExternalDataPolicyHandler&) = delete; + virtual void RemoveForAccountId(const AccountId& account_id) = 0; static AccountId GetAccountId(const std::string& user_id); - - private: - DISALLOW_COPY_AND_ASSIGN(CloudExternalDataPolicyHandler); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/external_data/handlers/device_cloud_external_data_policy_handler.h b/chrome/browser/ash/policy/external_data/handlers/device_cloud_external_data_policy_handler.h index df6f6de..9befed6 100644 --- a/chrome/browser/ash/policy/external_data/handlers/device_cloud_external_data_policy_handler.h +++ b/chrome/browser/ash/policy/external_data/handlers/device_cloud_external_data_policy_handler.h
@@ -16,10 +16,12 @@ public: DeviceCloudExternalDataPolicyHandler(); - virtual void Shutdown() = 0; + DeviceCloudExternalDataPolicyHandler( + const DeviceCloudExternalDataPolicyHandler&) = delete; + DeviceCloudExternalDataPolicyHandler& operator=( + const DeviceCloudExternalDataPolicyHandler&) = delete; - private: - DISALLOW_COPY_AND_ASSIGN(DeviceCloudExternalDataPolicyHandler); + virtual void Shutdown() = 0; }; } // namespace policy
diff --git a/chrome/browser/ash/policy/handlers/configuration_policy_handler_ash.h b/chrome/browser/ash/policy/handlers/configuration_policy_handler_ash.h index cbd84ca6..c0d2c27 100644 --- a/chrome/browser/ash/policy/handlers/configuration_policy_handler_ash.h +++ b/chrome/browser/ash/policy/handlers/configuration_policy_handler_ash.h
@@ -223,14 +223,15 @@ public: ArcServicePolicyHandler(const char* policy, const char* pref); + ArcServicePolicyHandler(const ArcServicePolicyHandler&) = delete; + ArcServicePolicyHandler& operator=(const ArcServicePolicyHandler&) = delete; + // IntRangePolicyHandlerBase: void ApplyPolicySettings(const PolicyMap& policies, PrefValueMap* prefs) override; private: const std::string pref_; - - DISALLOW_COPY_AND_ASSIGN(ArcServicePolicyHandler); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/handlers/configuration_policy_handler_ash_unittest.cc b/chrome/browser/ash/policy/handlers/configuration_policy_handler_ash_unittest.cc index d761d93..fecbf58 100644 --- a/chrome/browser/ash/policy/handlers/configuration_policy_handler_ash_unittest.cc +++ b/chrome/browser/ash/policy/handlers/configuration_policy_handler_ash_unittest.cc
@@ -40,12 +40,14 @@ protected: LoginScreenPowerManagementPolicyHandlerTest(); + LoginScreenPowerManagementPolicyHandlerTest( + const LoginScreenPowerManagementPolicyHandlerTest&) = delete; + LoginScreenPowerManagementPolicyHandlerTest& operator=( + const LoginScreenPowerManagementPolicyHandlerTest&) = delete; + void SetUp() override; Schema chrome_schema_; - - private: - DISALLOW_COPY_AND_ASSIGN(LoginScreenPowerManagementPolicyHandlerTest); }; LoginScreenPowerManagementPolicyHandlerTest::
diff --git a/chrome/browser/ash/policy/handlers/device_dock_mac_address_source_handler_unittest.cc b/chrome/browser/ash/policy/handlers/device_dock_mac_address_source_handler_unittest.cc index 57ebf7f..c3bc9e167 100644 --- a/chrome/browser/ash/policy/handlers/device_dock_mac_address_source_handler_unittest.cc +++ b/chrome/browser/ash/policy/handlers/device_dock_mac_address_source_handler_unittest.cc
@@ -30,6 +30,11 @@ ash::CrosSettings::Get(), &network_device_handler_mock_); } + DeviceDockMacAddressHandlerBaseTest( + const DeviceDockMacAddressHandlerBaseTest&) = delete; + DeviceDockMacAddressHandlerBaseTest& operator=( + const DeviceDockMacAddressHandlerBaseTest&) = delete; + protected: void MakeCrosSettingsTrusted() { scoped_cros_settings_test_helper_.SetTrustedStatus( @@ -42,9 +47,6 @@ network_device_handler_mock_; std::unique_ptr<DeviceDockMacAddressHandler> device_dock_mac_address_handler_; - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceDockMacAddressHandlerBaseTest); }; // Tests that DockMacAddressHandler does not change device handler property if @@ -61,8 +63,10 @@ public: DeviceDockMacAddressHandlerTest() = default; - private: - DISALLOW_COPY_AND_ASSIGN(DeviceDockMacAddressHandlerTest); + DeviceDockMacAddressHandlerTest(const DeviceDockMacAddressHandlerTest&) = + delete; + DeviceDockMacAddressHandlerTest& operator=( + const DeviceDockMacAddressHandlerTest&) = delete; }; // Tests that DockMacAddressHandler does not change device handler property if
diff --git a/chrome/browser/ash/policy/handlers/device_quirks_policy_browsertest.cc b/chrome/browser/ash/policy/handlers/device_quirks_policy_browsertest.cc index 35be0c3..5a72509 100644 --- a/chrome/browser/ash/policy/handlers/device_quirks_policy_browsertest.cc +++ b/chrome/browser/ash/policy/handlers/device_quirks_policy_browsertest.cc
@@ -25,6 +25,9 @@ public: DeviceQuirksPolicyTest() {} + DeviceQuirksPolicyTest(const DeviceQuirksPolicyTest&) = delete; + DeviceQuirksPolicyTest& operator=(const DeviceQuirksPolicyTest&) = delete; + void SetUpOnMainThread() override { // NOTE: QuirksManager::Initialize() isn't necessary here, since it'll be // called in ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun(). @@ -82,9 +85,6 @@ } base::FilePath icc_path_; // Path to icc file if found or downloaded. - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceQuirksPolicyTest); }; IN_PROC_BROWSER_TEST_F(DeviceQuirksPolicyTest, CheckUnset) {
diff --git a/chrome/browser/ash/policy/handlers/device_system_use_24hour_clock_browsertest.cc b/chrome/browser/ash/policy/handlers/device_system_use_24hour_clock_browsertest.cc index 0e9264b..2ff476ca 100644 --- a/chrome/browser/ash/policy/handlers/device_system_use_24hour_clock_browsertest.cc +++ b/chrome/browser/ash/policy/handlers/device_system_use_24hour_clock_browsertest.cc
@@ -29,6 +29,11 @@ public: SystemUse24HourClockPolicyTest() = default; + SystemUse24HourClockPolicyTest(const SystemUse24HourClockPolicyTest&) = + delete; + SystemUse24HourClockPolicyTest& operator=( + const SystemUse24HourClockPolicyTest&) = delete; + // DevicePolicyCrosBrowserTest: void SetUpOnMainThread() override { DevicePolicyCrosBrowserTest::SetUpOnMainThread(); @@ -72,8 +77,6 @@ private: std::unique_ptr<ash::SystemTrayTestApi> tray_test_api_; - - DISALLOW_COPY_AND_ASSIGN(SystemUse24HourClockPolicyTest); }; IN_PROC_BROWSER_TEST_F(SystemUse24HourClockPolicyTest, CheckUnset) {
diff --git a/chrome/browser/ash/policy/handlers/minimum_version_policy_handler.h b/chrome/browser/ash/policy/handlers/minimum_version_policy_handler.h index 51c5d8886..aeeab20 100644 --- a/chrome/browser/ash/policy/handlers/minimum_version_policy_handler.h +++ b/chrome/browser/ash/policy/handlers/minimum_version_policy_handler.h
@@ -134,6 +134,11 @@ explicit MinimumVersionPolicyHandler(Delegate* delegate, ash::CrosSettings* cros_settings); + + MinimumVersionPolicyHandler(const MinimumVersionPolicyHandler&) = delete; + MinimumVersionPolicyHandler& operator=(const MinimumVersionPolicyHandler&) = + delete; + ~MinimumVersionPolicyHandler() override; // BuildStateObserver: @@ -312,8 +317,6 @@ base::ObserverList<Observer>::Unchecked observers_; base::WeakPtrFactory<MinimumVersionPolicyHandler> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(MinimumVersionPolicyHandler); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/handlers/power_policy_browsertest.cc b/chrome/browser/ash/policy/handlers/power_policy_browsertest.cc index 7218d05a..1c0c4d57 100644 --- a/chrome/browser/ash/policy/handlers/power_policy_browsertest.cc +++ b/chrome/browser/ash/policy/handlers/power_policy_browsertest.cc
@@ -120,6 +120,11 @@ } // namespace class PowerPolicyBrowserTestBase : public DevicePolicyCrosBrowserTest { + public: + PowerPolicyBrowserTestBase(const PowerPolicyBrowserTestBase&) = delete; + PowerPolicyBrowserTestBase& operator=(const PowerPolicyBrowserTestBase&) = + delete; + protected: PowerPolicyBrowserTestBase(); @@ -148,11 +153,15 @@ // Reloads user policy for |profile| from session manager client. void ReloadUserPolicy(Profile* profile); - - DISALLOW_COPY_AND_ASSIGN(PowerPolicyBrowserTestBase); }; class PowerPolicyLoginScreenBrowserTest : public PowerPolicyBrowserTestBase { + public: + PowerPolicyLoginScreenBrowserTest(const PowerPolicyLoginScreenBrowserTest&) = + delete; + PowerPolicyLoginScreenBrowserTest& operator=( + const PowerPolicyLoginScreenBrowserTest&) = delete; + protected: PowerPolicyLoginScreenBrowserTest(); @@ -160,20 +169,20 @@ void SetUpCommandLine(base::CommandLine* command_line) override; void SetUpOnMainThread() override; void TearDownOnMainThread() override; - - private: - DISALLOW_COPY_AND_ASSIGN(PowerPolicyLoginScreenBrowserTest); }; class PowerPolicyInSessionBrowserTest : public PowerPolicyBrowserTestBase { + public: + PowerPolicyInSessionBrowserTest(const PowerPolicyInSessionBrowserTest&) = + delete; + PowerPolicyInSessionBrowserTest& operator=( + const PowerPolicyInSessionBrowserTest&) = delete; + protected: PowerPolicyInSessionBrowserTest(); // PowerPolicyBrowserTestBase: void SetUpOnMainThread() override; - - private: - DISALLOW_COPY_AND_ASSIGN(PowerPolicyInSessionBrowserTest); }; PowerPolicyBrowserTestBase::PowerPolicyBrowserTestBase() = default;
diff --git a/chrome/browser/ash/policy/handlers/restore_on_startup_browsertest.cc b/chrome/browser/ash/policy/handlers/restore_on_startup_browsertest.cc index 2245980..d7d019d8 100644 --- a/chrome/browser/ash/policy/handlers/restore_on_startup_browsertest.cc +++ b/chrome/browser/ash/policy/handlers/restore_on_startup_browsertest.cc
@@ -38,13 +38,13 @@ public: RestoreOnStartupTest() = default; + RestoreOnStartupTest(const RestoreOnStartupTest&) = delete; + RestoreOnStartupTest& operator=(const RestoreOnStartupTest&) = delete; + // LoginPolicyTestBase: void GetMandatoryPoliciesValue(base::DictionaryValue* policy) const override; void VerifyStartUpURLs(); - - private: - DISALLOW_COPY_AND_ASSIGN(RestoreOnStartupTest); }; void RestoreOnStartupTest::GetMandatoryPoliciesValue(
diff --git a/chrome/browser/ash/policy/handlers/site_isolation_flag_handling_browsertest.cc b/chrome/browser/ash/policy/handlers/site_isolation_flag_handling_browsertest.cc index 3369832..590253e 100644 --- a/chrome/browser/ash/policy/handlers/site_isolation_flag_handling_browsertest.cc +++ b/chrome/browser/ash/policy/handlers/site_isolation_flag_handling_browsertest.cc
@@ -171,6 +171,11 @@ class SiteIsolationFlagHandlingTest : public ash::OobeBaseTest, public ::testing::WithParamInterface<Params> { + public: + SiteIsolationFlagHandlingTest(const SiteIsolationFlagHandlingTest&) = delete; + SiteIsolationFlagHandlingTest& operator=( + const SiteIsolationFlagHandlingTest&) = delete; + protected: SiteIsolationFlagHandlingTest() : account_id_(AccountId::FromUserEmailGaiaId("username@examle.com", @@ -279,9 +284,6 @@ // Observes for user session start. std::unique_ptr<ash::SessionStateWaiter> user_session_started_observer_; - - private: - DISALLOW_COPY_AND_ASSIGN(SiteIsolationFlagHandlingTest); }; } // namespace
diff --git a/chrome/browser/ash/policy/invalidation/affiliated_cloud_policy_invalidator_unittest.cc b/chrome/browser/ash/policy/invalidation/affiliated_cloud_policy_invalidator_unittest.cc index 79314892..96b344d 100644 --- a/chrome/browser/ash/policy/invalidation/affiliated_cloud_policy_invalidator_unittest.cc +++ b/chrome/browser/ash/policy/invalidation/affiliated_cloud_policy_invalidator_unittest.cc
@@ -47,12 +47,12 @@ public: FakeCloudPolicyStore(); + FakeCloudPolicyStore(const FakeCloudPolicyStore&) = delete; + FakeCloudPolicyStore& operator=(const FakeCloudPolicyStore&) = delete; + // CloudPolicyStore: void Store(const em::PolicyFetchResponse& policy) override; void Load() override; - - private: - DISALLOW_COPY_AND_ASSIGN(FakeCloudPolicyStore); }; FakeCloudPolicyStore::FakeCloudPolicyStore() {}
diff --git a/chrome/browser/ash/policy/invalidation/affiliated_invalidation_service_provider.h b/chrome/browser/ash/policy/invalidation/affiliated_invalidation_service_provider.h index 862b1a5e..16cc35561 100644 --- a/chrome/browser/ash/policy/invalidation/affiliated_invalidation_service_provider.h +++ b/chrome/browser/ash/policy/invalidation/affiliated_invalidation_service_provider.h
@@ -34,6 +34,8 @@ public: Consumer(); + Consumer& operator=(const Consumer&) = delete; + // This method is called when the invalidation service that the consumer // should use changes: // * If |invalidation_service| is a nullptr, no invalidation service is @@ -46,11 +48,13 @@ protected: virtual ~Consumer(); - - DISALLOW_ASSIGN(Consumer); }; AffiliatedInvalidationServiceProvider(); + + AffiliatedInvalidationServiceProvider& operator=( + const AffiliatedInvalidationServiceProvider&) = delete; + virtual ~AffiliatedInvalidationServiceProvider(); // Indicates that |consumer| is interested in using the shared @@ -70,9 +74,6 @@ // per-profile invalidation services and no longer maintains a device-global // invalidation service. virtual void Shutdown() = 0; - - private: - DISALLOW_ASSIGN(AffiliatedInvalidationServiceProvider); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/invalidation/fake_affiliated_invalidation_service_provider.h b/chrome/browser/ash/policy/invalidation/fake_affiliated_invalidation_service_provider.h index 3be4c1c..5f37598f 100644 --- a/chrome/browser/ash/policy/invalidation/fake_affiliated_invalidation_service_provider.h +++ b/chrome/browser/ash/policy/invalidation/fake_affiliated_invalidation_service_provider.h
@@ -15,13 +15,15 @@ public: FakeAffiliatedInvalidationServiceProvider(); + FakeAffiliatedInvalidationServiceProvider( + const FakeAffiliatedInvalidationServiceProvider&) = delete; + FakeAffiliatedInvalidationServiceProvider& operator=( + const FakeAffiliatedInvalidationServiceProvider&) = delete; + // AffiliatedInvalidationServiceProvider: void RegisterConsumer(Consumer* consumer) override; void UnregisterConsumer(Consumer* consumer) override; void Shutdown() override; - - private: - DISALLOW_COPY_AND_ASSIGN(FakeAffiliatedInvalidationServiceProvider); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/login/blocking_login_browsertest.cc b/chrome/browser/ash/policy/login/blocking_login_browsertest.cc index 34ebd71..04a57112 100644 --- a/chrome/browser/ash/policy/login/blocking_login_browsertest.cc +++ b/chrome/browser/ash/policy/login/blocking_login_browsertest.cc
@@ -93,6 +93,9 @@ public: BlockingLoginTest() : profile_added_(NULL) {} + BlockingLoginTest(const BlockingLoginTest&) = delete; + BlockingLoginTest& operator=(const BlockingLoginTest&) = delete; + void SetUpCommandLine(base::CommandLine* command_line) override { ash::OobeBaseTest::SetUpCommandLine(command_line); @@ -217,8 +220,6 @@ private: std::vector<std::unique_ptr<net::test_server::HttpResponse>> responses_; content::NotificationRegistrar registrar_; - - DISALLOW_COPY_AND_ASSIGN(BlockingLoginTest); }; IN_PROC_BROWSER_TEST_P(BlockingLoginTest, LoginBlocksForUser) {
diff --git a/chrome/browser/ash/policy/login/device_login_screen_policy_browsertest.cc b/chrome/browser/ash/policy/login/device_login_screen_policy_browsertest.cc index b87d4f8..e76c1dd 100644 --- a/chrome/browser/ash/policy/login/device_login_screen_policy_browsertest.cc +++ b/chrome/browser/ash/policy/login/device_login_screen_policy_browsertest.cc
@@ -51,6 +51,9 @@ public: PrefChangeWatcher(const char* pref_name, PrefService* prefs); + PrefChangeWatcher(const PrefChangeWatcher&) = delete; + PrefChangeWatcher& operator=(const PrefChangeWatcher&) = delete; + void Wait(); void OnPrefChange(); @@ -60,8 +63,6 @@ base::RunLoop run_loop_; PrefChangeRegistrar registrar_; - - DISALLOW_COPY_AND_ASSIGN(PrefChangeWatcher); }; PrefChangeWatcher::PrefChangeWatcher(const char* pref_name, @@ -84,6 +85,12 @@ } // namespace class DeviceLoginScreenPolicyBrowsertest : public DevicePolicyCrosBrowserTest { + public: + DeviceLoginScreenPolicyBrowsertest( + const DeviceLoginScreenPolicyBrowsertest&) = delete; + DeviceLoginScreenPolicyBrowsertest& operator=( + const DeviceLoginScreenPolicyBrowsertest&) = delete; + protected: DeviceLoginScreenPolicyBrowsertest(); ~DeviceLoginScreenPolicyBrowsertest() override; @@ -100,9 +107,6 @@ base::Value GetPrefValue(const char* pref_name) const; Profile* login_profile_ = nullptr; - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceLoginScreenPolicyBrowsertest); }; DeviceLoginScreenPolicyBrowsertest::DeviceLoginScreenPolicyBrowsertest() {}
diff --git a/chrome/browser/ash/policy/login/force_maximize_on_first_run_browsertest.cc b/chrome/browser/ash/policy/login/force_maximize_on_first_run_browsertest.cc index fbf8119..1a63eefd2 100644 --- a/chrome/browser/ash/policy/login/force_maximize_on_first_run_browsertest.cc +++ b/chrome/browser/ash/policy/login/force_maximize_on_first_run_browsertest.cc
@@ -29,6 +29,11 @@ namespace policy { class ForceMaximizeOnFirstRunTest : public LoginPolicyTestBase { + public: + ForceMaximizeOnFirstRunTest(const ForceMaximizeOnFirstRunTest&) = delete; + ForceMaximizeOnFirstRunTest& operator=(const ForceMaximizeOnFirstRunTest&) = + delete; + protected: ForceMaximizeOnFirstRunTest() {} @@ -51,9 +56,6 @@ chromeos::ProfileHelper::Get()->GetProfileByUser(user); return CreateBrowser(profile); } - - private: - DISALLOW_COPY_AND_ASSIGN(ForceMaximizeOnFirstRunTest); }; IN_PROC_BROWSER_TEST_F(ForceMaximizeOnFirstRunTest, PRE_TwoRuns) { @@ -91,15 +93,17 @@ } class ForceMaximizePolicyFalseTest : public ForceMaximizeOnFirstRunTest { + public: + ForceMaximizePolicyFalseTest(const ForceMaximizePolicyFalseTest&) = delete; + ForceMaximizePolicyFalseTest& operator=(const ForceMaximizePolicyFalseTest&) = + delete; + protected: ForceMaximizePolicyFalseTest() : ForceMaximizeOnFirstRunTest() {} void GetMandatoryPoliciesValue(base::DictionaryValue* policy) const override { policy->SetBoolean(key::kForceMaximizeOnFirstRun, false); } - - private: - DISALLOW_COPY_AND_ASSIGN(ForceMaximizePolicyFalseTest); }; IN_PROC_BROWSER_TEST_F(ForceMaximizePolicyFalseTest, GeneralFirstRun) {
diff --git a/chrome/browser/ash/policy/login/login_policy_test_base.h b/chrome/browser/ash/policy/login/login_policy_test_base.h index 03f6d10..501b058 100644 --- a/chrome/browser/ash/policy/login/login_policy_test_base.h +++ b/chrome/browser/ash/policy/login/login_policy_test_base.h
@@ -27,6 +27,10 @@ // to login. // TODO (crbug/1014663): Deprecate this class in favor of LoggedInUserMixin. class LoginPolicyTestBase : public ash::OobeBaseTest { + public: + LoginPolicyTestBase(const LoginPolicyTestBase&) = delete; + LoginPolicyTestBase& operator=(const LoginPolicyTestBase&) = delete; + protected: LoginPolicyTestBase(); ~LoginPolicyTestBase() override; @@ -65,8 +69,6 @@ const AccountId account_id_; // Test AccountId. std::unique_ptr<UserPolicyTestHelper> user_policy_helper_; - - DISALLOW_COPY_AND_ASSIGN(LoginPolicyTestBase); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/login/login_screen_accessibility_policy_browsertest.cc b/chrome/browser/ash/policy/login/login_screen_accessibility_policy_browsertest.cc index 80979e8..b975f99 100644 --- a/chrome/browser/ash/policy/login/login_screen_accessibility_policy_browsertest.cc +++ b/chrome/browser/ash/policy/login/login_screen_accessibility_policy_browsertest.cc
@@ -49,6 +49,9 @@ public: PrefChangeWatcher(const char* pref_name, PrefService* prefs); + PrefChangeWatcher(const PrefChangeWatcher&) = delete; + PrefChangeWatcher& operator=(const PrefChangeWatcher&) = delete; + void Wait(); void OnPrefChange(); @@ -58,8 +61,6 @@ base::RunLoop run_loop_; PrefChangeRegistrar registrar_; - - DISALLOW_COPY_AND_ASSIGN(PrefChangeWatcher); }; PrefChangeWatcher::PrefChangeWatcher(const char* pref_name, @@ -84,6 +85,12 @@ class LoginScreenAccessibilityPolicyBrowsertest : public DevicePolicyCrosBrowserTest { + public: + LoginScreenAccessibilityPolicyBrowsertest( + const LoginScreenAccessibilityPolicyBrowsertest&) = delete; + LoginScreenAccessibilityPolicyBrowsertest& operator=( + const LoginScreenAccessibilityPolicyBrowsertest&) = delete; + protected: LoginScreenAccessibilityPolicyBrowsertest(); ~LoginScreenAccessibilityPolicyBrowsertest() override; @@ -100,9 +107,6 @@ base::Value GetPrefValue(const char* pref_name) const; Profile* login_profile_ = nullptr; - - private: - DISALLOW_COPY_AND_ASSIGN(LoginScreenAccessibilityPolicyBrowsertest); }; LoginScreenAccessibilityPolicyBrowsertest::
diff --git a/chrome/browser/ash/policy/login/login_screen_default_policy_browsertest.cc b/chrome/browser/ash/policy/login/login_screen_default_policy_browsertest.cc index 30130b9..8df31ea 100644 --- a/chrome/browser/ash/policy/login/login_screen_default_policy_browsertest.cc +++ b/chrome/browser/ash/policy/login/login_screen_default_policy_browsertest.cc
@@ -46,6 +46,9 @@ public: PrefChangeWatcher(const char* pref_name, PrefService* prefs); + PrefChangeWatcher(const PrefChangeWatcher&) = delete; + PrefChangeWatcher& operator=(const PrefChangeWatcher&) = delete; + void Wait(); void OnPrefChange(); @@ -55,8 +58,6 @@ base::RunLoop run_loop_; PrefChangeRegistrar registrar_; - - DISALLOW_COPY_AND_ASSIGN(PrefChangeWatcher); }; PrefChangeWatcher::PrefChangeWatcher(const char* pref_name, PrefService* prefs) @@ -81,6 +82,12 @@ class LoginScreenDefaultPolicyBrowsertestBase : public DevicePolicyCrosBrowserTest { + public: + LoginScreenDefaultPolicyBrowsertestBase( + const LoginScreenDefaultPolicyBrowsertestBase&) = delete; + LoginScreenDefaultPolicyBrowsertestBase& operator=( + const LoginScreenDefaultPolicyBrowsertestBase&) = delete; + protected: LoginScreenDefaultPolicyBrowsertestBase(); ~LoginScreenDefaultPolicyBrowsertestBase() override; @@ -91,13 +98,16 @@ void RefreshDevicePolicyAndWaitForPrefChange(const char* pref_name); Profile* login_profile_; - - private: - DISALLOW_COPY_AND_ASSIGN(LoginScreenDefaultPolicyBrowsertestBase); }; class LoginScreenDefaultPolicyLoginScreenBrowsertest : public LoginScreenDefaultPolicyBrowsertestBase { + public: + LoginScreenDefaultPolicyLoginScreenBrowsertest( + const LoginScreenDefaultPolicyLoginScreenBrowsertest&) = delete; + LoginScreenDefaultPolicyLoginScreenBrowsertest& operator=( + const LoginScreenDefaultPolicyLoginScreenBrowsertest&) = delete; + protected: LoginScreenDefaultPolicyLoginScreenBrowsertest(); ~LoginScreenDefaultPolicyLoginScreenBrowsertest() override; @@ -109,13 +119,16 @@ void VerifyPrefFollowsRecommendation(const char* pref_name, const base::Value& recommended_value); - - private: - DISALLOW_COPY_AND_ASSIGN(LoginScreenDefaultPolicyLoginScreenBrowsertest); }; class LoginScreenDefaultPolicyInSessionBrowsertest : public LoginScreenDefaultPolicyBrowsertestBase { + public: + LoginScreenDefaultPolicyInSessionBrowsertest( + const LoginScreenDefaultPolicyInSessionBrowsertest&) = delete; + LoginScreenDefaultPolicyInSessionBrowsertest& operator=( + const LoginScreenDefaultPolicyInSessionBrowsertest&) = delete; + protected: LoginScreenDefaultPolicyInSessionBrowsertest(); ~LoginScreenDefaultPolicyInSessionBrowsertest() override; @@ -124,9 +137,6 @@ void SetUpOnMainThread() override; void VerifyPrefFollowsDefault(const char* pref_name); - - private: - DISALLOW_COPY_AND_ASSIGN(LoginScreenDefaultPolicyInSessionBrowsertest); }; LoginScreenDefaultPolicyBrowsertestBase::
diff --git a/chrome/browser/ash/policy/login/signin_profile_extensions_policy_browsertest.cc b/chrome/browser/ash/policy/login/signin_profile_extensions_policy_browsertest.cc index 501fadb..def2482 100644 --- a/chrome/browser/ash/policy/login/signin_profile_extensions_policy_browsertest.cc +++ b/chrome/browser/ash/policy/login/signin_profile_extensions_policy_browsertest.cc
@@ -113,6 +113,10 @@ &ExtensionInstallErrorObserver::IsNotificationRelevant, base::Unretained(this))) {} + ExtensionInstallErrorObserver(const ExtensionInstallErrorObserver&) = delete; + ExtensionInstallErrorObserver& operator=( + const ExtensionInstallErrorObserver&) = delete; + void Wait() { notification_observer_.Wait(); } private: @@ -130,8 +134,6 @@ const Profile* const profile_; const std::string extension_id_; content::WindowedNotificationObserver notification_observer_; - - DISALLOW_COPY_AND_ASSIGN(ExtensionInstallErrorObserver); }; // Observer that allows waiting until the specified version of the given @@ -187,6 +189,12 @@ // Class for testing sign-in profile apps/extensions. class SigninProfileExtensionsPolicyTest : public SigninProfileExtensionsPolicyTestBase { + public: + SigninProfileExtensionsPolicyTest(const SigninProfileExtensionsPolicyTest&) = + delete; + SigninProfileExtensionsPolicyTest& operator=( + const SigninProfileExtensionsPolicyTest&) = delete; + protected: SigninProfileExtensionsPolicyTest() : SigninProfileExtensionsPolicyTestBase(version_info::Channel::STABLE) {} @@ -199,9 +207,6 @@ } ExtensionForceInstallMixin extension_force_install_mixin_{&mixin_host_}; - - private: - DISALLOW_COPY_AND_ASSIGN(SigninProfileExtensionsPolicyTest); }; } // namespace
diff --git a/chrome/browser/ash/policy/login/signin_profile_extensions_policy_test_base.h b/chrome/browser/ash/policy/login/signin_profile_extensions_policy_test_base.h index db872ab..2fc3ed89 100644 --- a/chrome/browser/ash/policy/login/signin_profile_extensions_policy_test_base.h +++ b/chrome/browser/ash/policy/login/signin_profile_extensions_policy_test_base.h
@@ -20,6 +20,11 @@ // the device policy. class SigninProfileExtensionsPolicyTestBase : public DevicePolicyCrosBrowserTest { + SigninProfileExtensionsPolicyTestBase( + const SigninProfileExtensionsPolicyTestBase&) = delete; + SigninProfileExtensionsPolicyTestBase& operator=( + const SigninProfileExtensionsPolicyTestBase&) = delete; + protected: explicit SigninProfileExtensionsPolicyTestBase(version_info::Channel channel); @@ -40,8 +45,6 @@ private: const extensions::ScopedCurrentChannel scoped_current_channel_; - - DISALLOW_COPY_AND_ASSIGN(SigninProfileExtensionsPolicyTestBase); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/networking/network_configuration_updater_unittest.cc b/chrome/browser/ash/policy/networking/network_configuration_updater_unittest.cc index 8da21e9..21d1a23c 100644 --- a/chrome/browser/ash/policy/networking/network_configuration_updater_unittest.cc +++ b/chrome/browser/ash/policy/networking/network_configuration_updater_unittest.cc
@@ -92,10 +92,12 @@ public: MockPolicyProvidedCertsObserver() = default; - MOCK_METHOD0(OnPolicyProvidedCertsChanged, void()); + MockPolicyProvidedCertsObserver(const MockPolicyProvidedCertsObserver&) = + delete; + MockPolicyProvidedCertsObserver& operator=( + const MockPolicyProvidedCertsObserver&) = delete; - private: - DISALLOW_COPY_AND_ASSIGN(MockPolicyProvidedCertsObserver); + MOCK_METHOD0(OnPolicyProvidedCertsChanged, void()); }; class FakeNetworkDeviceHandler : public chromeos::FakeNetworkDeviceHandler { @@ -103,6 +105,9 @@ FakeNetworkDeviceHandler() : allow_roaming_(false), mac_addr_randomization_(false) {} + FakeNetworkDeviceHandler(const FakeNetworkDeviceHandler&) = delete; + FakeNetworkDeviceHandler& operator=(const FakeNetworkDeviceHandler&) = delete; + void SetCellularAllowRoaming(bool allow_roaming, bool policy_allow_roaming) override { allow_roaming_ = allow_roaming; @@ -116,9 +121,6 @@ bool allow_roaming_ = false; bool policy_allow_roaming_ = true; bool mac_addr_randomization_; - - private: - DISALLOW_COPY_AND_ASSIGN(FakeNetworkDeviceHandler); }; class FakeCertificateImporter : public chromeos::onc::CertificateImporter {
diff --git a/chrome/browser/ash/policy/networking/network_policy_application_browsertest.cc b/chrome/browser/ash/policy/networking/network_policy_application_browsertest.cc index 5aa7af9..7eaf7ff 100644 --- a/chrome/browser/ash/policy/networking/network_policy_application_browsertest.cc +++ b/chrome/browser/ash/policy/networking/network_policy_application_browsertest.cc
@@ -58,6 +58,9 @@ run_loop_.QuitClosure()); } + ServiceConnectedWaiter(const ServiceConnectedWaiter&) = delete; + ServiceConnectedWaiter& operator=(const ServiceConnectedWaiter&) = delete; + // Waits until the |service_path| passed to the constructor has connected. // If it has connected since the constructor has run, will return immediately. void Wait() { @@ -70,8 +73,6 @@ ash::ShillServiceClient::TestInterface* shill_service_client_test_; std::string service_path_; base::RunLoop run_loop_; - - DISALLOW_COPY_AND_ASSIGN(ServiceConnectedWaiter); }; // Registers itself as ash::NetworkPolicyObserver and records events for @@ -131,6 +132,10 @@ test_account_id_ = login_mixin_.users()[0].account_id; } + NetworkPolicyApplicationTest(const NetworkPolicyApplicationTest&) = delete; + NetworkPolicyApplicationTest& operator=(const NetworkPolicyApplicationTest&) = + delete; + protected: // InProcessBrowserTest: void SetUp() override { @@ -223,8 +228,6 @@ private: testing::NiceMock<MockConfigurationPolicyProvider> policy_provider_; PolicyMap current_policy_; - - DISALLOW_COPY_AND_ASSIGN(NetworkPolicyApplicationTest); }; // This test applies a global network policy with
diff --git a/chrome/browser/ash/policy/networking/policy_cert_service_factory.h b/chrome/browser/ash/policy/networking/policy_cert_service_factory.h index 3007f272..a79a203 100644 --- a/chrome/browser/ash/policy/networking/policy_cert_service_factory.h +++ b/chrome/browser/ash/policy/networking/policy_cert_service_factory.h
@@ -43,6 +43,9 @@ static PolicyCertServiceFactory* GetInstance(); + PolicyCertServiceFactory(const PolicyCertServiceFactory&) = delete; + PolicyCertServiceFactory& operator=(const PolicyCertServiceFactory&) = delete; + // Used to mark or clear |user_email| as having used certificates pushed by // policy before. static void SetUsedPolicyCertificates(const std::string& user_email); @@ -63,8 +66,6 @@ content::BrowserContext* GetBrowserContextToUse( content::BrowserContext* context) const override; bool ServiceIsNULLWhileTesting() const override; - - DISALLOW_COPY_AND_ASSIGN(PolicyCertServiceFactory); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/networking/policy_certs_browsertest.cc b/chrome/browser/ash/policy/networking/policy_certs_browsertest.cc index 8d757d3b..9397a41a 100644 --- a/chrome/browser/ash/policy/networking/policy_certs_browsertest.cc +++ b/chrome/browser/ash/policy/networking/policy_certs_browsertest.cc
@@ -120,6 +120,11 @@ public: WebTrustedCertsChangedObserver() = default; + WebTrustedCertsChangedObserver(const WebTrustedCertsChangedObserver&) = + delete; + WebTrustedCertsChangedObserver& operator=( + const WebTrustedCertsChangedObserver&) = delete; + // chromeos::PolicyCertificateProvider::Observer void OnPolicyProvidedCertsChanged() override { run_loop_.Quit(); } @@ -127,8 +132,6 @@ private: base::RunLoop run_loop_; - - DISALLOW_COPY_AND_ASSIGN(WebTrustedCertsChangedObserver); }; // Allows waiting until |NetworkCertLoader| updates its list of certificates. @@ -165,14 +168,16 @@ public: CertDatabaseChangedObserver() {} + CertDatabaseChangedObserver(const CertDatabaseChangedObserver&) = delete; + CertDatabaseChangedObserver& operator=(const CertDatabaseChangedObserver&) = + delete; + void OnCertDBChanged() override { run_loop_.Quit(); } void Wait() { run_loop_.Run(); } private: base::RunLoop run_loop_; - - DISALLOW_COPY_AND_ASSIGN(CertDatabaseChangedObserver); }; // Retrieves the path to the directory containing certificates designated for @@ -764,6 +769,12 @@ } class PolicyProvidedCertsOnUserSessionInitTest : public LoginPolicyTestBase { + public: + PolicyProvidedCertsOnUserSessionInitTest( + const PolicyProvidedCertsOnUserSessionInitTest&) = delete; + PolicyProvidedCertsOnUserSessionInitTest& operator=( + const PolicyProvidedCertsOnUserSessionInitTest&) = delete; + protected: PolicyProvidedCertsOnUserSessionInitTest() {} @@ -780,9 +791,6 @@ chromeos::ProfileHelper::Get()->GetProfileByUser(user); return profile; } - - private: - DISALLOW_COPY_AND_ASSIGN(PolicyProvidedCertsOnUserSessionInitTest); }; // Verifies that the policy-provided trust root is active as soon as the user @@ -863,6 +871,12 @@ // |kSigninScreenExtension2| into the sign-in profile. class PolicyProvidedCertsForSigninExtensionTest : public SigninProfileExtensionsPolicyTestBase { + public: + PolicyProvidedCertsForSigninExtensionTest( + const PolicyProvidedCertsForSigninExtensionTest&) = delete; + PolicyProvidedCertsForSigninExtensionTest& operator=( + const PolicyProvidedCertsForSigninExtensionTest&) = delete; + protected: // Use DEV channel as sign-in screen extensions are currently usable there. PolicyProvidedCertsForSigninExtensionTest() @@ -963,8 +977,6 @@ return onc_dict; } - - DISALLOW_COPY_AND_ASSIGN(PolicyProvidedCertsForSigninExtensionTest); }; // namespace policy // Verifies that a device-policy-provided, extension-scoped trust anchor is
diff --git a/chrome/browser/ash/policy/networking/user_network_configuration_updater_factory.h b/chrome/browser/ash/policy/networking/user_network_configuration_updater_factory.h index 2f40080..83f1db82 100644 --- a/chrome/browser/ash/policy/networking/user_network_configuration_updater_factory.h +++ b/chrome/browser/ash/policy/networking/user_network_configuration_updater_factory.h
@@ -35,6 +35,11 @@ static UserNetworkConfigurationUpdaterFactory* GetInstance(); + UserNetworkConfigurationUpdaterFactory( + const UserNetworkConfigurationUpdaterFactory&) = delete; + UserNetworkConfigurationUpdaterFactory& operator=( + const UserNetworkConfigurationUpdaterFactory&) = delete; + private: friend struct base::DefaultSingletonTraits< UserNetworkConfigurationUpdaterFactory>; @@ -49,8 +54,6 @@ bool ServiceIsNULLWhileTesting() const override; KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(UserNetworkConfigurationUpdaterFactory); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/off_hours/device_off_hours_controller.h b/chrome/browser/ash/policy/off_hours/device_off_hours_controller.h index 3e10e2f..3ace2e3 100644 --- a/chrome/browser/ash/policy/off_hours/device_off_hours_controller.h +++ b/chrome/browser/ash/policy/off_hours/device_off_hours_controller.h
@@ -53,6 +53,10 @@ // Creates a device off hours controller instance. DeviceOffHoursController(); + + DeviceOffHoursController(const DeviceOffHoursController&) = delete; + DeviceOffHoursController& operator=(const DeviceOffHoursController&) = delete; + ~DeviceOffHoursController() override; void AddObserver(Observer* observer); @@ -147,8 +151,6 @@ enterprise_management::ChromeDeviceSettingsProto device_settings_proto_; base::WeakPtrFactory<DeviceOffHoursController> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(DeviceOffHoursController); }; } // namespace off_hours
diff --git a/chrome/browser/ash/policy/off_hours/device_off_hours_controller_unittest.cc b/chrome/browser/ash/policy/off_hours/device_off_hours_controller_unittest.cc index 63d9608..68904a2 100644 --- a/chrome/browser/ash/policy/off_hours/device_off_hours_controller_unittest.cc +++ b/chrome/browser/ash/policy/off_hours/device_off_hours_controller_unittest.cc
@@ -100,6 +100,12 @@ } // namespace class DeviceOffHoursControllerSimpleTest : public ash::DeviceSettingsTestBase { + public: + DeviceOffHoursControllerSimpleTest( + const DeviceOffHoursControllerSimpleTest&) = delete; + DeviceOffHoursControllerSimpleTest& operator=( + const DeviceOffHoursControllerSimpleTest&) = delete; + protected: DeviceOffHoursControllerSimpleTest() : ash::DeviceSettingsTestBase( @@ -152,9 +158,6 @@ // The object is owned by DeviceSettingsService class. policy::off_hours::DeviceOffHoursController* device_off_hours_controller_; - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceOffHoursControllerSimpleTest); }; TEST_F(DeviceOffHoursControllerSimpleTest, CheckOffHoursUnset) { @@ -315,6 +318,12 @@ class DeviceOffHoursControllerFakeClockTest : public DeviceOffHoursControllerSimpleTest { + public: + DeviceOffHoursControllerFakeClockTest( + const DeviceOffHoursControllerFakeClockTest&) = delete; + DeviceOffHoursControllerFakeClockTest& operator=( + const DeviceOffHoursControllerFakeClockTest&) = delete; + protected: DeviceOffHoursControllerFakeClockTest() {} @@ -352,8 +361,6 @@ private: base::SimpleTestClock test_clock_; base::test::ScopedPowerMonitorTestSource fake_power_monitor_source_; - - DISALLOW_COPY_AND_ASSIGN(DeviceOffHoursControllerFakeClockTest); }; TEST_F(DeviceOffHoursControllerFakeClockTest, FakeClock) {
diff --git a/chrome/browser/ash/policy/remote_commands/device_command_remote_powerwash_job_unittest.cc b/chrome/browser/ash/policy/remote_commands/device_command_remote_powerwash_job_unittest.cc index 3538b07..fd6c7eb 100644 --- a/chrome/browser/ash/policy/remote_commands/device_command_remote_powerwash_job_unittest.cc +++ b/chrome/browser/ash/policy/remote_commands/device_command_remote_powerwash_job_unittest.cc
@@ -38,6 +38,11 @@ client, /*store=*/nullptr, PolicyInvalidationScope::kDevice) {} + + TestingRemoteCommandsService(const TestingRemoteCommandsService&) = delete; + TestingRemoteCommandsService& operator=(const TestingRemoteCommandsService&) = + delete; + // RemoteCommandsService: void SetOnCommandAckedCallback(base::OnceClosure callback) override { on_command_acked_callback_ = std::move(callback); @@ -49,9 +54,6 @@ protected: base::OnceClosure on_command_acked_callback_; - - private: - DISALLOW_COPY_AND_ASSIGN(TestingRemoteCommandsService); }; std::unique_ptr<policy::RemoteCommandJob> CreateRemotePowerwashJob( @@ -78,6 +80,12 @@ } class DeviceCommandRemotePowerwashJobTest : public testing::Test { + public: + DeviceCommandRemotePowerwashJobTest( + const DeviceCommandRemotePowerwashJobTest&) = delete; + DeviceCommandRemotePowerwashJobTest& operator=( + const DeviceCommandRemotePowerwashJobTest&) = delete; + protected: DeviceCommandRemotePowerwashJobTest(); ~DeviceCommandRemotePowerwashJobTest() override; @@ -88,9 +96,6 @@ const std::unique_ptr<MockCloudPolicyClient> client_; const std::unique_ptr<TestingRemoteCommandsService> service_; chromeos::ScopedFakeInMemorySessionManagerClient scoped_session_manager_; - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceCommandRemotePowerwashJobTest); }; DeviceCommandRemotePowerwashJobTest::DeviceCommandRemotePowerwashJobTest()
diff --git a/chrome/browser/ash/policy/remote_commands/device_command_screenshot_job_unittest.cc b/chrome/browser/ash/policy/remote_commands/device_command_screenshot_job_unittest.cc index fdff62b..4570ee2 100644 --- a/chrome/browser/ash/policy/remote_commands/device_command_screenshot_job_unittest.cc +++ b/chrome/browser/ash/policy/remote_commands/device_command_screenshot_job_unittest.cc
@@ -190,6 +190,10 @@ class DeviceCommandScreenshotTest : public ChromeAshTestBase { public: + DeviceCommandScreenshotTest(const DeviceCommandScreenshotTest&) = delete; + DeviceCommandScreenshotTest& operator=(const DeviceCommandScreenshotTest&) = + delete; + void VerifyResults(RemoteCommandJob* job, RemoteCommandJob::Status expected_status, std::string expected_payload); @@ -213,8 +217,6 @@ private: scoped_refptr<base::TestMockTimeTaskRunner> task_runner_; - - DISALLOW_COPY_AND_ASSIGN(DeviceCommandScreenshotTest); }; DeviceCommandScreenshotTest::DeviceCommandScreenshotTest()
diff --git a/chrome/browser/ash/policy/remote_commands/device_command_set_volume_job_unittest.cc b/chrome/browser/ash/policy/remote_commands/device_command_set_volume_job_unittest.cc index 2904813f..2f96eee 100644 --- a/chrome/browser/ash/policy/remote_commands/device_command_set_volume_job_unittest.cc +++ b/chrome/browser/ash/policy/remote_commands/device_command_set_volume_job_unittest.cc
@@ -59,6 +59,11 @@ } // namespace class DeviceCommandSetVolumeTest : public ChromeAshTestBase { + public: + DeviceCommandSetVolumeTest(const DeviceCommandSetVolumeTest&) = delete; + DeviceCommandSetVolumeTest& operator=(const DeviceCommandSetVolumeTest&) = + delete; + protected: DeviceCommandSetVolumeTest(); @@ -67,9 +72,6 @@ base::RunLoop run_loop_; base::TimeTicks test_start_time_; - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceCommandSetVolumeTest); }; DeviceCommandSetVolumeTest::DeviceCommandSetVolumeTest() {}
diff --git a/chrome/browser/ash/policy/remote_commands/device_command_wipe_users_job_unittest.cc b/chrome/browser/ash/policy/remote_commands/device_command_wipe_users_job_unittest.cc index b801e9b9..322a0fef 100644 --- a/chrome/browser/ash/policy/remote_commands/device_command_wipe_users_job_unittest.cc +++ b/chrome/browser/ash/policy/remote_commands/device_command_wipe_users_job_unittest.cc
@@ -44,6 +44,11 @@ client, /*store=*/nullptr, PolicyInvalidationScope::kDevice) {} + + TestingRemoteCommandsService(const TestingRemoteCommandsService&) = delete; + TestingRemoteCommandsService& operator=(const TestingRemoteCommandsService&) = + delete; + // RemoteCommandsService: void SetOnCommandAckedCallback(base::OnceClosure callback) override { on_command_acked_callback_ = std::move(callback); @@ -55,9 +60,6 @@ protected: base::OnceClosure on_command_acked_callback_; - - private: - DISALLOW_COPY_AND_ASSIGN(TestingRemoteCommandsService); }; std::unique_ptr<policy::RemoteCommandJob> CreateWipeUsersJob( @@ -82,6 +84,11 @@ } class DeviceCommandWipeUsersJobTest : public testing::Test { + public: + DeviceCommandWipeUsersJobTest(const DeviceCommandWipeUsersJobTest&) = delete; + DeviceCommandWipeUsersJobTest& operator=( + const DeviceCommandWipeUsersJobTest&) = delete; + protected: DeviceCommandWipeUsersJobTest(); ~DeviceCommandWipeUsersJobTest() override; @@ -92,9 +99,6 @@ ScopedTestingLocalState local_state_; const std::unique_ptr<MockCloudPolicyClient> client_; const std::unique_ptr<TestingRemoteCommandsService> service_; - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceCommandWipeUsersJobTest); }; DeviceCommandWipeUsersJobTest::DeviceCommandWipeUsersJobTest()
diff --git a/chrome/browser/ash/policy/remote_commands/user_command_arc_job_unittest.cc b/chrome/browser/ash/policy/remote_commands/user_command_arc_job_unittest.cc index 4de767e..0cfb08b0 100644 --- a/chrome/browser/ash/policy/remote_commands/user_command_arc_job_unittest.cc +++ b/chrome/browser/ash/policy/remote_commands/user_command_arc_job_unittest.cc
@@ -50,6 +50,10 @@ } class UserCommandArcJobTest : public testing::Test { + public: + UserCommandArcJobTest(const UserCommandArcJobTest&) = delete; + UserCommandArcJobTest& operator=(const UserCommandArcJobTest&) = delete; + protected: UserCommandArcJobTest(); ~UserCommandArcJobTest() override; @@ -64,9 +68,6 @@ const std::unique_ptr<TestingProfile> profile_; arc::ArcPolicyBridge* const arc_policy_bridge_; const std::unique_ptr<arc::FakePolicyInstance> policy_instance_; - - private: - DISALLOW_COPY_AND_ASSIGN(UserCommandArcJobTest); }; UserCommandArcJobTest::UserCommandArcJobTest()
diff --git a/chrome/browser/ash/policy/reporting/app_install_event_log_manager_wrapper_unittest.cc b/chrome/browser/ash/policy/reporting/app_install_event_log_manager_wrapper_unittest.cc index 9f80365..67a2747 100644 --- a/chrome/browser/ash/policy/reporting/app_install_event_log_manager_wrapper_unittest.cc +++ b/chrome/browser/ash/policy/reporting/app_install_event_log_manager_wrapper_unittest.cc
@@ -41,6 +41,11 @@ explicit AppInstallEventLogManagerWrapperTestable(Profile* profile) : AppInstallEventLogManagerWrapper(profile) {} + AppInstallEventLogManagerWrapperTestable( + const AppInstallEventLogManagerWrapperTestable&) = delete; + AppInstallEventLogManagerWrapperTestable& operator=( + const AppInstallEventLogManagerWrapperTestable&) = delete; + scoped_refptr<base::SequencedTaskRunner> log_task_runner() { return log_task_runner_->GetTaskRunner(); } @@ -51,9 +56,6 @@ // AppInstallEventLogManagerWrapper: MOCK_METHOD0(CreateManager, void()); MOCK_METHOD0(DestroyManager, void()); - - private: - DISALLOW_COPY_AND_ASSIGN(AppInstallEventLogManagerWrapperTestable); }; } // namespace @@ -63,6 +65,11 @@ AppInstallEventLogManagerWrapperTest() : log_file_path_(profile_.GetPath().Append(kLogFileName)) {} + AppInstallEventLogManagerWrapperTest( + const AppInstallEventLogManagerWrapperTest&) = delete; + AppInstallEventLogManagerWrapperTest& operator=( + const AppInstallEventLogManagerWrapperTest&) = delete; + // testing::Test: void SetUp() override { app_list_.Append(kPackageName); } @@ -131,9 +138,6 @@ std::unique_ptr<AppInstallEventLogManagerWrapperTestable> wrapper_; scoped_refptr<base::SequencedTaskRunner> log_task_runner_; - - private: - DISALLOW_COPY_AND_ASSIGN(AppInstallEventLogManagerWrapperTest); }; // Populate a log file and the prefs holding the lists of apps for which
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector_unittest.cc b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector_unittest.cc index 328b9ba..7f30014 100644 --- a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector_unittest.cc +++ b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector_unittest.cc
@@ -107,6 +107,12 @@ } // namespace class ArcAppInstallEventLogCollectorTest : public testing::Test { + public: + ArcAppInstallEventLogCollectorTest( + const ArcAppInstallEventLogCollectorTest&) = delete; + ArcAppInstallEventLogCollectorTest& operator=( + const ArcAppInstallEventLogCollectorTest&) = delete; + protected: ArcAppInstallEventLogCollectorTest() = default; ~ArcAppInstallEventLogCollectorTest() override = default; @@ -181,8 +187,6 @@ FakeAppInstallEventLogCollectorDelegate delegate_; TestingPrefServiceSimple pref_service_; ArcAppTest arc_app_test_; - - DISALLOW_COPY_AND_ASSIGN(ArcAppInstallEventLogCollectorTest); }; // Test the case when collector is created and destroyed inside the one user
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_manager_unittest.cc b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_manager_unittest.cc index 9763271fb..1f52c0fe 100644 --- a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_manager_unittest.cc +++ b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_manager_unittest.cc
@@ -138,6 +138,9 @@ test_task_runner_ = new base::TestSimpleTaskRunner; } + TestLogTaskRunnerWrapper(const TestLogTaskRunnerWrapper&) = delete; + TestLogTaskRunnerWrapper& operator=(const TestLogTaskRunnerWrapper&) = delete; + scoped_refptr<base::SequencedTaskRunner> GetTaskRunner() override { return test_task_runner_; } @@ -148,13 +151,17 @@ private: scoped_refptr<base::TestSimpleTaskRunner> test_task_runner_; - - DISALLOW_COPY_AND_ASSIGN(TestLogTaskRunnerWrapper); }; } // namespace class ArcAppInstallEventLogManagerTest : public testing::Test { + public: + ArcAppInstallEventLogManagerTest(const ArcAppInstallEventLogManagerTest&) = + delete; + ArcAppInstallEventLogManagerTest& operator=( + const ArcAppInstallEventLogManagerTest&) = delete; + protected: ArcAppInstallEventLogManagerTest() : uploader_(&cloud_policy_client_, /*profile=*/nullptr), @@ -318,9 +325,6 @@ Events events_; std::unique_ptr<ArcAppInstallEventLogManager> manager_; - - private: - DISALLOW_COPY_AND_ASSIGN(ArcAppInstallEventLogManagerTest); }; // Create a manager with an empty log. Verify that no store is scheduled and no
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_unittest.cc b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_unittest.cc index 5c70eb4..93166bdf 100644 --- a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_unittest.cc +++ b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_unittest.cc
@@ -31,6 +31,11 @@ } // namespace class ArcAppInstallEventLogTest : public testing::Test { + public: + ArcAppInstallEventLogTest(const ArcAppInstallEventLogTest&) = delete; + ArcAppInstallEventLogTest& operator=(const ArcAppInstallEventLogTest&) = + delete; + protected: ArcAppInstallEventLogTest() {} @@ -124,9 +129,6 @@ base::FilePath file_name_; std::unique_ptr<ArcAppInstallEventLog> log_; em::AppInstallReportRequest report_; - - private: - DISALLOW_COPY_AND_ASSIGN(ArcAppInstallEventLogTest); }; // Do not add any log entries. Serialize the log. Verify that the serialization
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_uploader_unittest.cc b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_uploader_unittest.cc index e0dcc0e..8c0a0d2 100644 --- a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_uploader_unittest.cc +++ b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_uploader_unittest.cc
@@ -63,20 +63,28 @@ public: MockArcAppInstallEventLogUploaderDelegate() {} + MockArcAppInstallEventLogUploaderDelegate( + const MockArcAppInstallEventLogUploaderDelegate&) = delete; + MockArcAppInstallEventLogUploaderDelegate& operator=( + const MockArcAppInstallEventLogUploaderDelegate&) = delete; + void SerializeForUpload(SerializationCallback callback) override { SerializeForUpload_(callback); } MOCK_METHOD1(SerializeForUpload_, void(SerializationCallback&)); MOCK_METHOD0(OnUploadSuccess, void()); - - private: - DISALLOW_COPY_AND_ASSIGN(MockArcAppInstallEventLogUploaderDelegate); }; } // namespace class ArcAppInstallEventLogUploaderTest : public testing::Test { + public: + ArcAppInstallEventLogUploaderTest(const ArcAppInstallEventLogUploaderTest&) = + delete; + ArcAppInstallEventLogUploaderTest& operator=( + const ArcAppInstallEventLogUploaderTest&) = delete; + protected: ArcAppInstallEventLogUploaderTest() = default; @@ -172,9 +180,6 @@ chromeos::system::ScopedFakeStatisticsProvider scoped_fake_statistics_provider_; - - private: - DISALLOW_COPY_AND_ASSIGN(ArcAppInstallEventLogUploaderTest); }; // Make a log upload request. Have serialization and log upload succeed. Verify
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_event_logger_unittest.cc b/chrome/browser/ash/policy/reporting/arc_app_install_event_logger_unittest.cc index 37aa03b..b1f5031 100644 --- a/chrome/browser/ash/policy/reporting/arc_app_install_event_logger_unittest.cc +++ b/chrome/browser/ash/policy/reporting/arc_app_install_event_logger_unittest.cc
@@ -130,6 +130,11 @@ public: MockAppInstallEventLoggerDelegate() = default; + MockAppInstallEventLoggerDelegate(const MockAppInstallEventLoggerDelegate&) = + delete; + MockAppInstallEventLoggerDelegate& operator=( + const MockAppInstallEventLoggerDelegate&) = delete; + void GetAndroidId(AndroidIdCallback callback) const override { GetAndroidId_(&callback); } @@ -138,9 +143,6 @@ void(const std::set<std::string>& packages, const em::AppInstallReportLogEvent& event)); MOCK_CONST_METHOD1(GetAndroidId_, void(AndroidIdCallback*)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockAppInstallEventLoggerDelegate); }; void SetPolicy(policy::PolicyMap* map, const char* name, base::Value value) { @@ -157,6 +159,10 @@ base::test::TaskEnvironment::MainThreadType::UI, base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} + AppInstallEventLoggerTest(const AppInstallEventLoggerTest&) = delete; + AppInstallEventLoggerTest& operator=(const AppInstallEventLoggerTest&) = + delete; + void SetUp() override { RegisterLocalState(pref_service_.registry()); TestingBrowserProcess::GetGlobal()->SetLocalState(&pref_service_); @@ -226,9 +232,6 @@ em::AppInstallReportLogEvent event_; std::unique_ptr<ArcAppInstallEventLogger> logger_; - - private: - DISALLOW_COPY_AND_ASSIGN(AppInstallEventLoggerTest); }; // Store lists of apps for which push-install has been requested and is still
diff --git a/chrome/browser/ash/policy/reporting/single_arc_app_install_event_log_unittest.cc b/chrome/browser/ash/policy/reporting/single_arc_app_install_event_log_unittest.cc index 89d55d97a..abb9010 100644 --- a/chrome/browser/ash/policy/reporting/single_arc_app_install_event_log_unittest.cc +++ b/chrome/browser/ash/policy/reporting/single_arc_app_install_event_log_unittest.cc
@@ -28,6 +28,12 @@ } // namespace class SingleArcAppInstallEventLogTest : public testing::Test { + public: + SingleArcAppInstallEventLogTest(const SingleArcAppInstallEventLogTest&) = + delete; + SingleArcAppInstallEventLogTest& operator=( + const SingleArcAppInstallEventLogTest&) = delete; + protected: SingleArcAppInstallEventLogTest() {} @@ -56,9 +62,6 @@ em::AppInstallReport report_; std::unique_ptr<base::ScopedTempDir> temp_dir_; std::unique_ptr<base::File> file_; - - private: - DISALLOW_COPY_AND_ASSIGN(SingleArcAppInstallEventLogTest); }; // Verify that the package name is returned correctly.
diff --git a/chrome/browser/ash/policy/rsu/lookup_key_uploader_unittest.cc b/chrome/browser/ash/policy/rsu/lookup_key_uploader_unittest.cc index 273db5c..7dcc279 100644 --- a/chrome/browser/ash/policy/rsu/lookup_key_uploader_unittest.cc +++ b/chrome/browser/ash/policy/rsu/lookup_key_uploader_unittest.cc
@@ -37,6 +37,10 @@ "MTIz"; // base::Base64Encode(kValidRsuDeviceId, kValidRsuDeviceencoded) } class LookupKeyUploaderTest : public ash::DeviceSettingsTestBase { + public: + LookupKeyUploaderTest(const LookupKeyUploaderTest&) = delete; + LookupKeyUploaderTest& operator=(const LookupKeyUploaderTest&) = delete; + protected: LookupKeyUploaderTest() = default; @@ -73,9 +77,6 @@ MockEnrollmentCertificateUploader certificate_uploader_; std::unique_ptr<LookupKeyUploader> lookup_key_uploader_; MockCloudPolicyStore policy_store_; - - private: - DISALLOW_COPY_AND_ASSIGN(LookupKeyUploaderTest); }; TEST_F(LookupKeyUploaderTest, Uploads) {
diff --git a/chrome/browser/ash/policy/status_collector/device_status_collector.cc b/chrome/browser/ash/policy/status_collector/device_status_collector.cc index 4cba2ed..5e0664b 100644 --- a/chrome/browser/ash/policy/status_collector/device_status_collector.cc +++ b/chrome/browser/ash/policy/status_collector/device_status_collector.cc
@@ -826,8 +826,6 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); response_params_.device_status->mutable_tpm_status_info()->MergeFrom( tpm_status_info); - LOG(WARNING) << "tpm_status_info.attestation_prepared: " - << tpm_status_info.attestation_prepared(); SetDeviceStatusReported(); }
diff --git a/chrome/browser/ash/policy/uploading/heartbeat_scheduler.cc b/chrome/browser/ash/policy/uploading/heartbeat_scheduler.cc index f17b19a1..4c3a248 100644 --- a/chrome/browser/ash/policy/uploading/heartbeat_scheduler.cc +++ b/chrome/browser/ash/policy/uploading/heartbeat_scheduler.cc
@@ -85,6 +85,10 @@ gcm::GCMDriver* gcm_driver, const scoped_refptr<base::SequencedTaskRunner>& task_runner); + HeartbeatRegistrationHelper(const HeartbeatRegistrationHelper&) = delete; + HeartbeatRegistrationHelper& operator=(const HeartbeatRegistrationHelper&) = + delete; + void Register(RegistrationHelperCallback callback); private: @@ -106,8 +110,6 @@ // Should remain the last member so it will be destroyed first and // invalidate all weak pointers. base::WeakPtrFactory<HeartbeatRegistrationHelper> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(HeartbeatRegistrationHelper); }; HeartbeatRegistrationHelper::HeartbeatRegistrationHelper(
diff --git a/chrome/browser/ash/policy/uploading/upload_job.h b/chrome/browser/ash/policy/uploading/upload_job.h index 5886ed7..0aa7905 100644 --- a/chrome/browser/ash/policy/uploading/upload_job.h +++ b/chrome/browser/ash/policy/uploading/upload_job.h
@@ -37,6 +37,8 @@ class Delegate { public: + Delegate& operator=(const Delegate&) = delete; + // When the upload finishes successfully, the OnSuccess() method is invoked. virtual void OnSuccess() = 0; @@ -46,11 +48,10 @@ protected: virtual ~Delegate(); - - private: - DISALLOW_ASSIGN(Delegate); }; + UploadJob& operator=(const UploadJob&) = delete; + virtual ~UploadJob() {} // Adds one data segment to the UploadJob. A DataSegment corresponds @@ -69,8 +70,6 @@ // Initiates the data upload . This method must only be called once. virtual void Start() = 0; - - DISALLOW_ASSIGN(UploadJob); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/uploading/upload_job_impl.cc b/chrome/browser/ash/policy/uploading/upload_job_impl.cc index 3753b33..6d043a2 100644 --- a/chrome/browser/ash/policy/uploading/upload_job_impl.cc +++ b/chrome/browser/ash/policy/uploading/upload_job_impl.cc
@@ -66,6 +66,9 @@ std::unique_ptr<std::string> data, const std::map<std::string, std::string>& header_entries); + DataSegment(const DataSegment&) = delete; + DataSegment& operator=(const DataSegment&) = delete; + // Returns the header entries for this DataSegment. const std::map<std::string, std::string>& GetHeaderEntries() const; @@ -90,8 +93,6 @@ const std::string filename_; std::unique_ptr<std::string> data_; std::map<std::string, std::string> header_entries_; - - DISALLOW_COPY_AND_ASSIGN(DataSegment); }; DataSegment::DataSegment(
diff --git a/chrome/browser/ash/policy/uploading/upload_job_impl.h b/chrome/browser/ash/policy/uploading/upload_job_impl.h index a316c4e..8b7dd37 100644 --- a/chrome/browser/ash/policy/uploading/upload_job_impl.h +++ b/chrome/browser/ash/policy/uploading/upload_job_impl.h
@@ -43,12 +43,11 @@ // mark the boundaries between data segments. class MimeBoundaryGenerator { public: + MimeBoundaryGenerator& operator=(const MimeBoundaryGenerator&) = delete; + virtual ~MimeBoundaryGenerator(); virtual std::string GenerateBoundary() const = 0; - - private: - DISALLOW_ASSIGN(MimeBoundaryGenerator); }; // An implemenation of the MimeBoundaryGenerator which uses random
diff --git a/chrome/browser/ash/policy/value_validation/onc_device_policy_value_validator.h b/chrome/browser/ash/policy/value_validation/onc_device_policy_value_validator.h index 6a087dc7..90a01ce9 100644 --- a/chrome/browser/ash/policy/value_validation/onc_device_policy_value_validator.h +++ b/chrome/browser/ash/policy/value_validation/onc_device_policy_value_validator.h
@@ -19,14 +19,15 @@ public: ONCDevicePolicyValueValidator(); + ONCDevicePolicyValueValidator(const ONCDevicePolicyValueValidator&) = delete; + ONCDevicePolicyValueValidator& operator=( + const ONCDevicePolicyValueValidator&) = delete; + protected: // ONCPolicyValueValidatorBase: absl::optional<std::string> GetONCStringFromPayload( const enterprise_management::ChromeDeviceSettingsProto& policy_payload) const override; - - private: - DISALLOW_COPY_AND_ASSIGN(ONCDevicePolicyValueValidator); }; } // namespace policy
diff --git a/chrome/browser/ash/policy/value_validation/onc_user_policy_value_validator.h b/chrome/browser/ash/policy/value_validation/onc_user_policy_value_validator.h index aa940ab..abfd796 100644 --- a/chrome/browser/ash/policy/value_validation/onc_user_policy_value_validator.h +++ b/chrome/browser/ash/policy/value_validation/onc_user_policy_value_validator.h
@@ -19,14 +19,15 @@ public: ONCUserPolicyValueValidator(); + ONCUserPolicyValueValidator(const ONCUserPolicyValueValidator&) = delete; + ONCUserPolicyValueValidator& operator=(const ONCUserPolicyValueValidator&) = + delete; + protected: // ONCPolicyValueValidatorBase: absl::optional<std::string> GetONCStringFromPayload( const enterprise_management::CloudPolicySettings& policy_payload) const override; - - private: - DISALLOW_COPY_AND_ASSIGN(ONCUserPolicyValueValidator); }; } // namespace policy
diff --git a/chrome/browser/ash/power/cpu_data_collector_unittest.cc b/chrome/browser/ash/power/cpu_data_collector_unittest.cc index 953ad25..6ec9c39 100644 --- a/chrome/browser/ash/power/cpu_data_collector_unittest.cc +++ b/chrome/browser/ash/power/cpu_data_collector_unittest.cc
@@ -73,6 +73,9 @@ TimeDelta::FromMilliseconds(910000), TimeDelta::FromMilliseconds(510000)}) {} + CpuDataCollectorTest(const CpuDataCollectorTest&) = delete; + CpuDataCollectorTest& operator=(const CpuDataCollectorTest&) = delete; + // testing::Test: void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); @@ -100,9 +103,6 @@ base::FilePath time_in_state_path_cpu0_; base::FilePath time_in_state_path_cpu1_; base::FilePath all_time_in_state_path_; - - private: - DISALLOW_COPY_AND_ASSIGN(CpuDataCollectorTest); }; TEST_F(CpuDataCollectorTest, ReadCpuFreqTimeInState) {
diff --git a/chrome/browser/ash/power/extension_event_observer.h b/chrome/browser/ash/power/extension_event_observer.h index 3a3c439..206a31d 100644 --- a/chrome/browser/ash/power/extension_event_observer.h +++ b/chrome/browser/ash/power/extension_event_observer.h
@@ -67,6 +67,10 @@ }; ExtensionEventObserver(); + + ExtensionEventObserver(const ExtensionEventObserver&) = delete; + ExtensionEventObserver& operator=(const ExtensionEventObserver&) = delete; + ~ExtensionEventObserver() override; std::unique_ptr<TestApi> CreateTestApi(); @@ -129,8 +133,6 @@ base::CancelableOnceClosure suspend_readiness_callback_; base::WeakPtrFactory<ExtensionEventObserver> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(ExtensionEventObserver); }; } // namespace ash
diff --git a/chrome/browser/ash/power/ml/adaptive_screen_brightness_ukm_logger_impl_unittest.cc b/chrome/browser/ash/power/ml/adaptive_screen_brightness_ukm_logger_impl_unittest.cc index a7f1649..60c7c76 100644 --- a/chrome/browser/ash/power/ml/adaptive_screen_brightness_ukm_logger_impl_unittest.cc +++ b/chrome/browser/ash/power/ml/adaptive_screen_brightness_ukm_logger_impl_unittest.cc
@@ -24,6 +24,11 @@ public: AdaptiveScreenBrightnessUkmLoggerImplTest() {} + AdaptiveScreenBrightnessUkmLoggerImplTest( + const AdaptiveScreenBrightnessUkmLoggerImplTest&) = delete; + AdaptiveScreenBrightnessUkmLoggerImplTest& operator=( + const AdaptiveScreenBrightnessUkmLoggerImplTest&) = delete; + void LogActivity(const ScreenBrightnessEvent& screen_brightness_event, ukm::SourceId tab_id, bool has_form_entry) { @@ -36,8 +41,6 @@ private: AdaptiveScreenBrightnessUkmLoggerImpl screen_brightness_ukm_logger_impl_; - - DISALLOW_COPY_AND_ASSIGN(AdaptiveScreenBrightnessUkmLoggerImplTest); }; TEST_F(AdaptiveScreenBrightnessUkmLoggerImplTest, Basic) {
diff --git a/chrome/browser/ash/power/ml/smart_dim/ml_agent.h b/chrome/browser/ash/power/ml/smart_dim/ml_agent.h index 3e3c229..23db2bb 100644 --- a/chrome/browser/ash/power/ml/smart_dim/ml_agent.h +++ b/chrome/browser/ash/power/ml/smart_dim/ml_agent.h
@@ -29,6 +29,9 @@ public: static SmartDimMlAgent* GetInstance(); + SmartDimMlAgent(const SmartDimMlAgent&) = delete; + SmartDimMlAgent& operator=(const SmartDimMlAgent&) = delete; + // Post a request to determine whether an upcoming dim should go ahead based // on input |features|. When a decision is arrived at, runs the callback. If // this method is called again before it calls the previous callback, the @@ -64,8 +67,6 @@ dim_decision_callback_; SEQUENCE_CHECKER(sequence_checker_); - - DISALLOW_COPY_AND_ASSIGN(SmartDimMlAgent); }; } // namespace ml
diff --git a/chrome/browser/ash/power/ml/smart_dim/ml_agent_unittest.cc b/chrome/browser/ash/power/ml/smart_dim/ml_agent_unittest.cc index 90f1a62..1cabdd81 100644 --- a/chrome/browser/ash/power/ml/smart_dim/ml_agent_unittest.cc +++ b/chrome/browser/ash/power/ml/smart_dim/ml_agent_unittest.cc
@@ -130,6 +130,9 @@ base::test::TaskEnvironment::MainThreadType::IO, base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} + SmartDimMlAgentTest(const SmartDimMlAgentTest&) = delete; + SmartDimMlAgentTest& operator=(const SmartDimMlAgentTest&) = delete; + void SetUp() override { MachineLearningClient::InitializeFake(); chromeos::machine_learning::ServiceConnection:: @@ -151,7 +154,6 @@ private: data_decoder::test::InProcessDataDecoder in_process_data_decoder_; - DISALLOW_COPY_AND_ASSIGN(SmartDimMlAgentTest); }; // This test covers two things:
diff --git a/chrome/browser/ash/power/ml/user_activity_ukm_logger_helpers.h b/chrome/browser/ash/power/ml/user_activity_ukm_logger_helpers.h index 1213559..2dbad6ab 100644 --- a/chrome/browser/ash/power/ml/user_activity_ukm_logger_helpers.h +++ b/chrome/browser/ash/power/ml/user_activity_ukm_logger_helpers.h
@@ -63,6 +63,12 @@ class UserActivityUkmLoggerBucketizer { public: + UserActivityUkmLoggerBucketizer() = delete; + UserActivityUkmLoggerBucketizer(const UserActivityUkmLoggerBucketizer&) = + delete; + UserActivityUkmLoggerBucketizer& operator=( + const UserActivityUkmLoggerBucketizer&) = delete; + // Bucketizes features if they are present. Returns a // feature->bucketized_value map. static std::map<std::string, int> BucketizeUserActivityEventFeatures( @@ -71,10 +77,6 @@ // Bucketizes features and also EventLogDuration. static std::map<std::string, int> BucketizeUserActivityEventData( const UserActivityEvent& event); - - private: - UserActivityUkmLoggerBucketizer() = delete; - DISALLOW_COPY_AND_ASSIGN(UserActivityUkmLoggerBucketizer); }; } // namespace ml
diff --git a/chrome/browser/ash/power/ml/user_activity_ukm_logger_unittest.cc b/chrome/browser/ash/power/ml/user_activity_ukm_logger_unittest.cc index 520fff52b..a8f5026b 100644 --- a/chrome/browser/ash/power/ml/user_activity_ukm_logger_unittest.cc +++ b/chrome/browser/ash/power/ml/user_activity_ukm_logger_unittest.cc
@@ -69,6 +69,10 @@ user_activity_logger_delegate_ukm_.ukm_recorder_ = &recorder_; } + UserActivityUkmLoggerTest(const UserActivityUkmLoggerTest&) = delete; + UserActivityUkmLoggerTest& operator=(const UserActivityUkmLoggerTest&) = + delete; + protected: void LogActivity(const UserActivityEvent& event) { user_activity_logger_delegate_ukm_.LogActivity(event); @@ -146,7 +150,6 @@ private: UserActivityUkmLoggerImpl user_activity_logger_delegate_ukm_; - DISALLOW_COPY_AND_ASSIGN(UserActivityUkmLoggerTest); }; TEST_F(UserActivityUkmLoggerTest, BasicLogging) {
diff --git a/chrome/browser/ash/power/power_data_collector.h b/chrome/browser/ash/power/power_data_collector.h index 32ad046..2824780e 100644 --- a/chrome/browser/ash/power/power_data_collector.h +++ b/chrome/browser/ash/power/power_data_collector.h
@@ -54,6 +54,9 @@ base::TimeDelta sleep_duration; }; + PowerDataCollector(const PowerDataCollector&) = delete; + PowerDataCollector& operator=(const PowerDataCollector&) = delete; + const base::circular_deque<PowerSupplySample>& power_supply_data() const { return power_supply_data_; } @@ -95,8 +98,6 @@ base::circular_deque<PowerSupplySample> power_supply_data_; base::circular_deque<SystemResumedSample> system_resumed_data_; CpuDataCollector cpu_data_collector_; - - DISALLOW_COPY_AND_ASSIGN(PowerDataCollector); }; // Adds |sample| to |sample_deque|.
diff --git a/chrome/browser/ash/power/process_data_collector.h b/chrome/browser/ash/power/process_data_collector.h index 2d7cb85..cd13caf 100644 --- a/chrome/browser/ash/power/process_data_collector.h +++ b/chrome/browser/ash/power/process_data_collector.h
@@ -164,6 +164,9 @@ // DBusThreadManager is shut down. static void Shutdown(); + ProcessDataCollector(const ProcessDataCollector&) = delete; + ProcessDataCollector& operator=(const ProcessDataCollector&) = delete; + // The analog for the |SampleCpuUsage| function but for testing. Do not call // this while a |ProcessDataCollector| has been initialized with |Initialize| // rather than |InitializeForTesting|. @@ -324,8 +327,6 @@ SEQUENCE_CHECKER(sequence_checker_); base::WeakPtrFactory<ProcessDataCollector> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(ProcessDataCollector); }; } // namespace ash
diff --git a/chrome/browser/ash/printing/bulk_printers_calculator.cc b/chrome/browser/ash/printing/bulk_printers_calculator.cc index f35ca8a..6be4fa7 100644 --- a/chrome/browser/ash/printing/bulk_printers_calculator.cc +++ b/chrome/browser/ash/printing/bulk_printers_calculator.cc
@@ -108,6 +108,9 @@ DETACH_FROM_SEQUENCE(sequence_checker_); } + Restrictions(const Restrictions&) = delete; + Restrictions& operator=(const Restrictions&) = delete; + // Sets the printer cache using the policy blob |data|. TaskData SetData(TaskData task_data, std::unique_ptr<std::string> data) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -221,7 +224,6 @@ std::set<std::string> allowlist_; SEQUENCE_CHECKER(sequence_checker_); - DISALLOW_COPY_AND_ASSIGN(Restrictions); }; class BulkPrintersCalculatorImpl : public BulkPrintersCalculator {
diff --git a/chrome/browser/ash/printing/history/print_job_history_service_factory.h b/chrome/browser/ash/printing/history/print_job_history_service_factory.h index cdfc053e..7584f3d1 100644 --- a/chrome/browser/ash/printing/history/print_job_history_service_factory.h +++ b/chrome/browser/ash/printing/history/print_job_history_service_factory.h
@@ -32,6 +32,10 @@ static PrintJobHistoryServiceFactory* GetInstance(); + PrintJobHistoryServiceFactory(const PrintJobHistoryServiceFactory&) = delete; + PrintJobHistoryServiceFactory& operator=( + const PrintJobHistoryServiceFactory&) = delete; + private: friend struct base::DefaultSingletonTraits<PrintJobHistoryServiceFactory>; @@ -43,8 +47,6 @@ content::BrowserContext* context) const override; void RegisterProfilePrefs( user_prefs::PrefRegistrySyncable* registry) override; - - DISALLOW_COPY_AND_ASSIGN(PrintJobHistoryServiceFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/printing/synced_printers_manager_factory.h b/chrome/browser/ash/printing/synced_printers_manager_factory.h index 2237676..27c8e6da 100644 --- a/chrome/browser/ash/printing/synced_printers_manager_factory.h +++ b/chrome/browser/ash/printing/synced_printers_manager_factory.h
@@ -25,6 +25,10 @@ static SyncedPrintersManagerFactory* GetInstance(); + SyncedPrintersManagerFactory(const SyncedPrintersManagerFactory&) = delete; + SyncedPrintersManagerFactory& operator=(const SyncedPrintersManagerFactory&) = + delete; + protected: content::BrowserContext* GetBrowserContextToUse( content::BrowserContext* context) const override; @@ -38,8 +42,6 @@ // BrowserContextKeyedServiceFactory implementation: SyncedPrintersManager* BuildServiceInstanceFor( content::BrowserContext* browser_context) const override; - - DISALLOW_COPY_AND_ASSIGN(SyncedPrintersManagerFactory); }; } // namespace ash
diff --git a/chrome/browser/ash/release_notes/release_notes_storage_unittest.cc b/chrome/browser/ash/release_notes/release_notes_storage_unittest.cc index 5cf5711..c22983c 100644 --- a/chrome/browser/ash/release_notes/release_notes_storage_unittest.cc +++ b/chrome/browser/ash/release_notes/release_notes_storage_unittest.cc
@@ -34,6 +34,10 @@ class ReleaseNotesStorageTest : public testing::Test, public testing::WithParamInterface<bool> { + public: + ReleaseNotesStorageTest(const ReleaseNotesStorageTest&) = delete; + ReleaseNotesStorageTest& operator=(const ReleaseNotesStorageTest&) = delete; + protected: ReleaseNotesStorageTest() : user_manager_(new FakeChromeUserManager()), @@ -84,8 +88,6 @@ bool is_managed_ = false; bool is_ephemeral_ = false; bool is_unicorn_ = false; - - DISALLOW_COPY_AND_ASSIGN(ReleaseNotesStorageTest); }; // Release notes are not shown for profiles that have been created in this
diff --git a/chrome/browser/ash/settings/device_settings_provider_unittest.cc b/chrome/browser/ash/settings/device_settings_provider_unittest.cc index de0a590..387c7a2a 100644 --- a/chrome/browser/ash/settings/device_settings_provider_unittest.cc +++ b/chrome/browser/ash/settings/device_settings_provider_unittest.cc
@@ -53,6 +53,10 @@ class DeviceSettingsProviderTest : public DeviceSettingsTestBase { public: + DeviceSettingsProviderTest(const DeviceSettingsProviderTest&) = delete; + DeviceSettingsProviderTest& operator=(const DeviceSettingsProviderTest&) = + delete; + MOCK_METHOD1(SettingChanged, void(const std::string&)); MOCK_METHOD0(GetTrustedCallback, void(void)); @@ -464,9 +468,6 @@ std::unique_ptr<DeviceSettingsProvider> provider_; base::ScopedPathOverride user_data_dir_override_; - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceSettingsProviderTest); }; // Same as above, but enrolled into an enterprise
diff --git a/chrome/browser/ash/settings/device_settings_service_unittest.cc b/chrome/browser/ash/settings/device_settings_service_unittest.cc index 620deda..f549077 100644 --- a/chrome/browser/ash/settings/device_settings_service_unittest.cc +++ b/chrome/browser/ash/settings/device_settings_service_unittest.cc
@@ -43,6 +43,10 @@ class DeviceSettingsServiceTest : public DeviceSettingsTestBase { public: + DeviceSettingsServiceTest(const DeviceSettingsServiceTest&) = delete; + DeviceSettingsServiceTest& operator=(const DeviceSettingsServiceTest&) = + delete; + void SetOperationCompleted() { operation_completed_ = true; } void SetOwnershipStatus( @@ -84,9 +88,6 @@ bool is_owner_; bool is_owner_set_; DeviceSettingsService::OwnershipStatus ownership_status_; - - private: - DISALLOW_COPY_AND_ASSIGN(DeviceSettingsServiceTest); }; TEST_F(DeviceSettingsServiceTest, LoadNoKey) {
diff --git a/chrome/browser/ash/settings/device_settings_test_helper.h b/chrome/browser/ash/settings/device_settings_test_helper.h index a58b390c..1ca0d3cb 100644 --- a/chrome/browser/ash/settings/device_settings_test_helper.h +++ b/chrome/browser/ash/settings/device_settings_test_helper.h
@@ -47,6 +47,10 @@ // settings. |device_settings_service_| starts out in uninitialized state, so // startup code gets tested as well. class DeviceSettingsTestBase : public testing::Test { + public: + DeviceSettingsTestBase(const DeviceSettingsTestBase&) = delete; + DeviceSettingsTestBase& operator=(const DeviceSettingsTestBase&) = delete; + protected: DeviceSettingsTestBase(); explicit DeviceSettingsTestBase(base::test::TaskEnvironment::TimeSource time); @@ -86,8 +90,6 @@ private: bool teardown_called_ = false; - - DISALLOW_COPY_AND_ASSIGN(DeviceSettingsTestBase); }; } // namespace ash
diff --git a/chrome/browser/ash/settings/session_manager_operation_unittest.cc b/chrome/browser/ash/settings/session_manager_operation_unittest.cc index 9dfc4c5..32856e33 100644 --- a/chrome/browser/ash/settings/session_manager_operation_unittest.cc +++ b/chrome/browser/ash/settings/session_manager_operation_unittest.cc
@@ -78,6 +78,10 @@ owner_key_util_); } + SessionManagerOperationTest(const SessionManagerOperationTest&) = delete; + SessionManagerOperationTest& operator=(const SessionManagerOperationTest&) = + delete; + void SetUp() override { policy_.payload().mutable_user_allowlist()->add_user_allowlist( "fake-whitelist"); @@ -122,9 +126,6 @@ OwnerSettingsServiceAsh* service_; bool validated_; - - private: - DISALLOW_COPY_AND_ASSIGN(SessionManagerOperationTest); }; TEST_F(SessionManagerOperationTest, LoadNoPolicyNoKey) {
diff --git a/chrome/browser/ash/settings/shutdown_policy_handler.h b/chrome/browser/ash/settings/shutdown_policy_handler.h index 41b48c5..de088e8 100644 --- a/chrome/browser/ash/settings/shutdown_policy_handler.h +++ b/chrome/browser/ash/settings/shutdown_policy_handler.h
@@ -28,6 +28,10 @@ }; ShutdownPolicyHandler(CrosSettings* cros_settings, Delegate* delegate); + + ShutdownPolicyHandler(const ShutdownPolicyHandler&) = delete; + ShutdownPolicyHandler& operator=(const ShutdownPolicyHandler&) = delete; + ~ShutdownPolicyHandler(); // Once a trusted set of policies is established, this function notifies @@ -42,8 +46,6 @@ base::CallbackListSubscription shutdown_policy_subscription_; base::WeakPtrFactory<ShutdownPolicyHandler> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(ShutdownPolicyHandler); }; } // namespace ash
diff --git a/chrome/browser/ash/settings/stats_reporting_controller.h b/chrome/browser/ash/settings/stats_reporting_controller.h index c9a439e..9a29d47 100644 --- a/chrome/browser/ash/settings/stats_reporting_controller.h +++ b/chrome/browser/ash/settings/stats_reporting_controller.h
@@ -50,6 +50,9 @@ static void Shutdown(); static StatsReportingController* Get(); + StatsReportingController(const StatsReportingController&) = delete; + StatsReportingController& operator=(const StatsReportingController&) = delete; + static void RegisterLocalStatePrefs(PrefRegistrySimple* registry); // Store the new value of |enabled|. This will happen straight away if @@ -157,8 +160,6 @@ base::OnceClosure on_device_settings_stored_callback_; base::WeakPtrFactory<StatsReportingController> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(StatsReportingController); }; } // namespace ash
diff --git a/chrome/browser/ash/smb_client/discovery/network_scanner.h b/chrome/browser/ash/smb_client/discovery/network_scanner.h index 1d5be29..3aa535e 100644 --- a/chrome/browser/ash/smb_client/discovery/network_scanner.h +++ b/chrome/browser/ash/smb_client/discovery/network_scanner.h
@@ -26,9 +26,11 @@ RequestInfo(uint32_t remaining_requests, FindHostsCallback callback); RequestInfo(RequestInfo&& other); - ~RequestInfo(); - DISALLOW_COPY_AND_ASSIGN(RequestInfo); + RequestInfo(const RequestInfo&) = delete; + RequestInfo& operator=(const RequestInfo&) = delete; + + ~RequestInfo(); }; // NetworkScanner discovers SMB hosts in the local network by querying
diff --git a/chrome/browser/ash/system/automatic_reboot_manager_unittest.cc b/chrome/browser/ash/system/automatic_reboot_manager_unittest.cc index 7520701..bdd5b25 100644 --- a/chrome/browser/ash/system/automatic_reboot_manager_unittest.cc +++ b/chrome/browser/ash/system/automatic_reboot_manager_unittest.cc
@@ -65,6 +65,9 @@ explicit MockUptimeProvider( base::TestMockTimeTaskRunner* mock_time_task_runner); + MockUptimeProvider(const MockUptimeProvider&) = delete; + MockUptimeProvider& operator=(const MockUptimeProvider&) = delete; + void WriteUptimeToFile(); // Adjusts the offset so that the current mock uptime will be |uptime|. @@ -84,8 +87,6 @@ base::FilePath uptime_file_path_; base::TimeDelta uptime_offset_; - - DISALLOW_COPY_AND_ASSIGN(MockUptimeProvider); }; class TestAutomaticRebootManagerTaskRunner @@ -93,6 +94,11 @@ public: TestAutomaticRebootManagerTaskRunner(); + TestAutomaticRebootManagerTaskRunner( + const TestAutomaticRebootManagerTaskRunner&) = delete; + TestAutomaticRebootManagerTaskRunner& operator=( + const TestAutomaticRebootManagerTaskRunner&) = delete; + MockUptimeProvider* uptime_provider() const { return uptime_provider_.get(); } @@ -106,8 +112,6 @@ void OnAfterTaskRun() override; std::unique_ptr<MockUptimeProvider> uptime_provider_; - - DISALLOW_COPY_AND_ASSIGN(TestAutomaticRebootManagerTaskRunner); }; class MockAutomaticRebootManagerObserver @@ -137,6 +141,12 @@ } // namespace class AutomaticRebootManagerBasicTest : public testing::Test { + public: + AutomaticRebootManagerBasicTest(const AutomaticRebootManagerBasicTest&) = + delete; + AutomaticRebootManagerBasicTest& operator=( + const AutomaticRebootManagerBasicTest&) = delete; + protected: AutomaticRebootManagerBasicTest(); ~AutomaticRebootManagerBasicTest() override; @@ -218,9 +228,6 @@ session_manager::SessionManager session_manager_; FakeUpdateEngineClient* update_engine_client_ = nullptr; // Not owned. - - private: - DISALLOW_COPY_AND_ASSIGN(AutomaticRebootManagerBasicTest); }; enum AutomaticRebootManagerTestScenario {
diff --git a/chrome/browser/ash/system/device_disabling_browsertest.cc b/chrome/browser/ash/system/device_disabling_browsertest.cc index f47c81c..b2f4529 100644 --- a/chrome/browser/ash/system/device_disabling_browsertest.cc +++ b/chrome/browser/ash/system/device_disabling_browsertest.cc
@@ -70,6 +70,9 @@ public: DeviceDisablingTest() = default; + DeviceDisablingTest(const DeviceDisablingTest&) = delete; + DeviceDisablingTest& operator=(const DeviceDisablingTest&) = delete; + // Sets up a device state blob that indicates the device is disabled. void SetDeviceDisabledPolicy(); @@ -92,8 +95,6 @@ private: DeviceStateMixin device_state_{ &mixin_host_, DeviceStateMixin::State::OOBE_COMPLETED_CLOUD_ENROLLED}; - - DISALLOW_COPY_AND_ASSIGN(DeviceDisablingTest); }; void DeviceDisablingTest::SetDeviceDisabledPolicy() { @@ -239,15 +240,17 @@ public: PresetPolicyDeviceDisablingTest() {} + PresetPolicyDeviceDisablingTest(const PresetPolicyDeviceDisablingTest&) = + delete; + PresetPolicyDeviceDisablingTest& operator=( + const PresetPolicyDeviceDisablingTest&) = delete; + protected: // DeviceDisablingTest: void SetUpInProcessBrowserTestFixture() override { DeviceDisablingTest::SetUpInProcessBrowserTestFixture(); SetDeviceDisabledPolicy(); } - - private: - DISALLOW_COPY_AND_ASSIGN(PresetPolicyDeviceDisablingTest); }; // Same test as the one in DeviceDisablingTest, except the policy is being set
diff --git a/chrome/browser/ash/system/device_disabling_manager.h b/chrome/browser/ash/system/device_disabling_manager.h index d4caa52..06baeca8 100644 --- a/chrome/browser/ash/system/device_disabling_manager.h +++ b/chrome/browser/ash/system/device_disabling_manager.h
@@ -55,17 +55,18 @@ class Observer { public: + Observer& operator=(const Observer&) = delete; + virtual ~Observer(); virtual void OnDisabledMessageChanged( const std::string& disabled_message) = 0; - - private: - DISALLOW_ASSIGN(Observer); }; class Delegate { public: + Delegate& operator=(const Delegate&) = delete; + virtual ~Delegate(); // Terminate the current session (if any) and restart Chrome to show the @@ -74,15 +75,16 @@ // Show the device disabled screen. virtual void ShowDeviceDisabledScreen() = 0; - - private: - DISALLOW_ASSIGN(Delegate); }; // |delegate| must outlive |this|. DeviceDisablingManager(Delegate* delegate, CrosSettings* cros_settings, user_manager::UserManager* user_manager); + + DeviceDisablingManager(const DeviceDisablingManager&) = delete; + DeviceDisablingManager& operator=(const DeviceDisablingManager&) = delete; + ~DeviceDisablingManager(); // Must be called after construction. @@ -147,8 +149,6 @@ std::string serial_number_; base::WeakPtrFactory<DeviceDisablingManager> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(DeviceDisablingManager); }; } // namespace system
diff --git a/chrome/browser/ash/system/device_disabling_manager_default_delegate.h b/chrome/browser/ash/system/device_disabling_manager_default_delegate.h index eebad89..14a02120 100644 --- a/chrome/browser/ash/system/device_disabling_manager_default_delegate.h +++ b/chrome/browser/ash/system/device_disabling_manager_default_delegate.h
@@ -16,12 +16,15 @@ public: DeviceDisablingManagerDefaultDelegate(); + DeviceDisablingManagerDefaultDelegate( + const DeviceDisablingManagerDefaultDelegate&) = delete; + DeviceDisablingManagerDefaultDelegate& operator=( + const DeviceDisablingManagerDefaultDelegate&) = delete; + private: // DeviceDisablingManager::Delegate: void RestartToLoginScreen() override; void ShowDeviceDisabledScreen() override; - - DISALLOW_COPY_AND_ASSIGN(DeviceDisablingManagerDefaultDelegate); }; } // namespace system
diff --git a/chrome/browser/ash/system/device_disabling_manager_unittest.cc b/chrome/browser/ash/system/device_disabling_manager_unittest.cc index 38ae5d6..bf4bbf14 100644 --- a/chrome/browser/ash/system/device_disabling_manager_unittest.cc +++ b/chrome/browser/ash/system/device_disabling_manager_unittest.cc
@@ -54,6 +54,11 @@ public: DeviceDisablingManagerTestBase(); + DeviceDisablingManagerTestBase(const DeviceDisablingManagerTestBase&) = + delete; + DeviceDisablingManagerTestBase& operator=( + const DeviceDisablingManagerTestBase&) = delete; + // testing::Test: void TearDown() override; @@ -80,8 +85,6 @@ FakeChromeUserManager fake_user_manager_; std::unique_ptr<DeviceDisablingManager> device_disabling_manager_; chromeos::system::FakeStatisticsProvider statistics_provider_; - - DISALLOW_COPY_AND_ASSIGN(DeviceDisablingManagerTestBase); }; DeviceDisablingManagerTestBase::DeviceDisablingManagerTestBase() { @@ -125,6 +128,11 @@ public: DeviceDisablingManagerOOBETest(); + DeviceDisablingManagerOOBETest(const DeviceDisablingManagerOOBETest&) = + delete; + DeviceDisablingManagerOOBETest& operator=( + const DeviceDisablingManagerOOBETest&) = delete; + // DeviceDisablingManagerTestBase: void SetUp() override; void TearDown() override; @@ -143,8 +151,6 @@ base::RunLoop run_loop_; bool device_disabled_; - - DISALLOW_COPY_AND_ASSIGN(DeviceDisablingManagerOOBETest); }; DeviceDisablingManagerOOBETest::DeviceDisablingManagerOOBETest() @@ -251,6 +257,10 @@ public: DeviceDisablingManagerTest(); + DeviceDisablingManagerTest(const DeviceDisablingManagerTest&) = delete; + DeviceDisablingManagerTest& operator=(const DeviceDisablingManagerTest&) = + delete; + // DeviceDisablingManagerTestBase: void TearDown() override; void CreateDeviceDisablingManager() override; @@ -269,8 +279,6 @@ FakeSessionManagerClient session_manager_client_; policy::DevicePolicyBuilder device_policy_; - - DISALLOW_COPY_AND_ASSIGN(DeviceDisablingManagerTest); }; DeviceDisablingManagerTest::DeviceDisablingManagerTest() {
diff --git a/chrome/browser/ash/system/input_device_settings_impl_ozone.cc b/chrome/browser/ash/system/input_device_settings_impl_ozone.cc index 0c8a5fb..625a323b 100644 --- a/chrome/browser/ash/system/input_device_settings_impl_ozone.cc +++ b/chrome/browser/ash/system/input_device_settings_impl_ozone.cc
@@ -25,6 +25,10 @@ public: InputDeviceSettingsImplOzone(); + InputDeviceSettingsImplOzone(const InputDeviceSettingsImplOzone&) = delete; + InputDeviceSettingsImplOzone& operator=(const InputDeviceSettingsImplOzone&) = + delete; + protected: ~InputDeviceSettingsImplOzone() override {} @@ -69,8 +73,6 @@ TouchpadSettings current_touchpad_settings_; MouseSettings current_mouse_settings_; PointingStickSettings current_pointing_stick_settings_; - - DISALLOW_COPY_AND_ASSIGN(InputDeviceSettingsImplOzone); }; InputDeviceSettingsImplOzone::InputDeviceSettingsImplOzone() = default;
diff --git a/chrome/browser/ash/system/user_removal_manager_unittest.cc b/chrome/browser/ash/system/user_removal_manager_unittest.cc index 4509953f..3178a7e3 100644 --- a/chrome/browser/ash/system/user_removal_manager_unittest.cc +++ b/chrome/browser/ash/system/user_removal_manager_unittest.cc
@@ -26,17 +26,22 @@ public: FakeChromeUserRemovalManager() = default; + FakeChromeUserRemovalManager(const FakeChromeUserRemovalManager&) = delete; + FakeChromeUserRemovalManager& operator=(const FakeChromeUserRemovalManager&) = + delete; + void RemoveUser(const AccountId& account_id, user_manager::UserRemovalReason reason, user_manager::RemoveUserDelegate* delegate) override { RemoveUserFromList(account_id); } - - private: - DISALLOW_COPY_AND_ASSIGN(FakeChromeUserRemovalManager); }; class UserRemovalManagerTest : public testing::Test { + public: + UserRemovalManagerTest(const UserRemovalManagerTest&) = delete; + UserRemovalManagerTest& operator=(const UserRemovalManagerTest&) = delete; + protected: UserRemovalManagerTest(); ~UserRemovalManagerTest() override; @@ -45,9 +50,6 @@ const ScopedTestingLocalState local_state_; const user_manager::ScopedUserManager scoped_user_manager_; - - private: - DISALLOW_COPY_AND_ASSIGN(UserRemovalManagerTest); }; UserRemovalManagerTest::UserRemovalManagerTest()
diff --git a/chrome/browser/ash/system_logs/single_debug_daemon_log_source_unittest.cc b/chrome/browser/ash/system_logs/single_debug_daemon_log_source_unittest.cc index e0c7a27..a15fdab 100644 --- a/chrome/browser/ash/system_logs/single_debug_daemon_log_source_unittest.cc +++ b/chrome/browser/ash/system_logs/single_debug_daemon_log_source_unittest.cc
@@ -23,6 +23,11 @@ public: SingleDebugDaemonLogSourceTest() : num_callback_calls_(0) {} + SingleDebugDaemonLogSourceTest(const SingleDebugDaemonLogSourceTest&) = + delete; + SingleDebugDaemonLogSourceTest& operator=( + const SingleDebugDaemonLogSourceTest&) = delete; + void SetUp() override { // Since no debug daemon will be available during a unit test, use // FakeDebugDaemonClient to provide dummy DebugDaemonClient functionality. @@ -59,8 +64,6 @@ // Stores results from the log source. SystemLogsResponse response_; - - DISALLOW_COPY_AND_ASSIGN(SingleDebugDaemonLogSourceTest); }; TEST_F(SingleDebugDaemonLogSourceTest, SingleCall) {
diff --git a/chrome/browser/chromeos/tether/BUILD.gn b/chrome/browser/ash/tether/BUILD.gn similarity index 100% rename from chrome/browser/chromeos/tether/BUILD.gn rename to chrome/browser/ash/tether/BUILD.gn
diff --git a/chrome/browser/chromeos/tether/OWNERS b/chrome/browser/ash/tether/OWNERS similarity index 100% rename from chrome/browser/chromeos/tether/OWNERS rename to chrome/browser/ash/tether/OWNERS
diff --git a/chrome/browser/chromeos/tether/fake_tether_service.cc b/chrome/browser/ash/tether/fake_tether_service.cc similarity index 96% rename from chrome/browser/chromeos/tether/fake_tether_service.cc rename to chrome/browser/ash/tether/fake_tether_service.cc index 033acb6..725fe130 100644 --- a/chrome/browser/chromeos/tether/fake_tether_service.cc +++ b/chrome/browser/ash/tether/fake_tether_service.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/tether/fake_tether_service.h" +#include "chrome/browser/ash/tether/fake_tether_service.h" constexpr char kTetherGuidPrefix[] = "tether-guid-"; constexpr char kTetherNamePrefix[] = "tether";
diff --git a/chrome/browser/chromeos/tether/fake_tether_service.h b/chrome/browser/ash/tether/fake_tether_service.h similarity index 83% rename from chrome/browser/chromeos/tether/fake_tether_service.h rename to chrome/browser/ash/tether/fake_tether_service.h index 3eb685b0..0c25de0f 100644 --- a/chrome/browser/chromeos/tether/fake_tether_service.h +++ b/chrome/browser/ash/tether/fake_tether_service.h
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_TETHER_FAKE_TETHER_SERVICE_H_ -#define CHROME_BROWSER_CHROMEOS_TETHER_FAKE_TETHER_SERVICE_H_ +#ifndef CHROME_BROWSER_ASH_TETHER_FAKE_TETHER_SERVICE_H_ +#define CHROME_BROWSER_ASH_TETHER_FAKE_TETHER_SERVICE_H_ -#include "chrome/browser/chromeos/tether/tether_service.h" +#include "chrome/browser/ash/tether/tether_service.h" // A stub of TetherService that provides an easy way to develop for Tether on // non-Chromebooks or without a Tether host. To use, see @@ -40,4 +40,4 @@ DISALLOW_COPY_AND_ASSIGN(FakeTetherService); }; -#endif // CHROME_BROWSER_CHROMEOS_TETHER_FAKE_TETHER_SERVICE_H_ +#endif // CHROME_BROWSER_ASH_TETHER_FAKE_TETHER_SERVICE_H_
diff --git a/chrome/browser/chromeos/tether/tether_service.cc b/chrome/browser/ash/tether/tether_service.cc similarity index 99% rename from chrome/browser/chromeos/tether/tether_service.cc rename to chrome/browser/ash/tether/tether_service.cc index 92a2045..36fdb2f 100644 --- a/chrome/browser/chromeos/tether/tether_service.cc +++ b/chrome/browser/ash/tether/tether_service.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/tether/tether_service.h" +#include "chrome/browser/ash/tether/tether_service.h" #include "base/bind.h" #include "base/command_line.h" @@ -10,7 +10,7 @@ #include "base/metrics/histogram_macros.h" #include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/ash/profiles/profile_helper.h" -#include "chrome/browser/chromeos/tether/tether_service_factory.h" +#include "chrome/browser/ash/tether/tether_service_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/ash/network/tether_notification_presenter.h" #include "chrome/common/pref_names.h"
diff --git a/chrome/browser/chromeos/tether/tether_service.h b/chrome/browser/ash/tether/tether_service.h similarity index 98% rename from chrome/browser/chromeos/tether/tether_service.h rename to chrome/browser/ash/tether/tether_service.h index 56941660..45e2f6e 100644 --- a/chrome/browser/chromeos/tether/tether_service.h +++ b/chrome/browser/ash/tether/tether_service.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_TETHER_TETHER_SERVICE_H_ -#define CHROME_BROWSER_CHROMEOS_TETHER_TETHER_SERVICE_H_ +#ifndef CHROME_BROWSER_ASH_TETHER_TETHER_SERVICE_H_ +#define CHROME_BROWSER_ASH_TETHER_TETHER_SERVICE_H_ #include <memory> @@ -286,4 +286,4 @@ base::WeakPtrFactory<TetherService> weak_ptr_factory_{this}; }; -#endif // CHROME_BROWSER_CHROMEOS_TETHER_TETHER_SERVICE_H_ +#endif // CHROME_BROWSER_ASH_TETHER_TETHER_SERVICE_H_
diff --git a/chrome/browser/chromeos/tether/tether_service_factory.cc b/chrome/browser/ash/tether/tether_service_factory.cc similarity index 96% rename from chrome/browser/chromeos/tether/tether_service_factory.cc rename to chrome/browser/ash/tether/tether_service_factory.cc index 316e998..9de1f50 100644 --- a/chrome/browser/chromeos/tether/tether_service_factory.cc +++ b/chrome/browser/ash/tether/tether_service_factory.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/tether/tether_service_factory.h" +#include "chrome/browser/ash/tether/tether_service_factory.h" #include "ash/constants/ash_switches.h" #include "base/command_line.h" @@ -11,7 +11,7 @@ #include "chrome/browser/ash/device_sync/device_sync_client_factory.h" #include "chrome/browser/ash/multidevice_setup/multidevice_setup_client_factory.h" #include "chrome/browser/ash/secure_channel/secure_channel_client_provider.h" -#include "chrome/browser/chromeos/tether/fake_tether_service.h" +#include "chrome/browser/ash/tether/fake_tether_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" #include "chromeos/dbus/dbus_thread_manager.h"
diff --git a/chrome/browser/chromeos/tether/tether_service_factory.h b/chrome/browser/ash/tether/tether_service_factory.h similarity index 81% rename from chrome/browser/chromeos/tether/tether_service_factory.h rename to chrome/browser/ash/tether/tether_service_factory.h index 3080d8c1..af79104 100644 --- a/chrome/browser/chromeos/tether/tether_service_factory.h +++ b/chrome/browser/ash/tether/tether_service_factory.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_TETHER_TETHER_SERVICE_FACTORY_H_ -#define CHROME_BROWSER_CHROMEOS_TETHER_TETHER_SERVICE_FACTORY_H_ +#ifndef CHROME_BROWSER_ASH_TETHER_TETHER_SERVICE_FACTORY_H_ +#define CHROME_BROWSER_ASH_TETHER_TETHER_SERVICE_FACTORY_H_ #include "base/macros.h" -#include "chrome/browser/chromeos/tether/tether_service.h" +#include "chrome/browser/ash/tether/tether_service.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" namespace content { @@ -42,4 +42,4 @@ DISALLOW_COPY_AND_ASSIGN(TetherServiceFactory); }; -#endif // CHROME_BROWSER_CHROMEOS_TETHER_TETHER_SERVICE_FACTORY_H_ +#endif // CHROME_BROWSER_ASH_TETHER_TETHER_SERVICE_FACTORY_H_
diff --git a/chrome/browser/chromeos/tether/tether_service_unittest.cc b/chrome/browser/ash/tether/tether_service_unittest.cc similarity index 99% rename from chrome/browser/chromeos/tether/tether_service_unittest.cc rename to chrome/browser/ash/tether/tether_service_unittest.cc index dfe3ed5..a2126c76 100644 --- a/chrome/browser/chromeos/tether/tether_service_unittest.cc +++ b/chrome/browser/ash/tether/tether_service_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/tether/tether_service.h" +#include "chrome/browser/ash/tether/tether_service.h" #include <memory>
diff --git a/chrome/browser/ash/usb/cros_usb_detector.cc b/chrome/browser/ash/usb/cros_usb_detector.cc index ccba4522..15278dc 100644 --- a/chrome/browser/ash/usb/cros_usb_detector.cc +++ b/chrome/browser/ash/usb/cros_usb_detector.cc
@@ -152,6 +152,10 @@ settings_sub_page_(std::move(settings_sub_page)), disposition_(CrosUsbNotificationClosed::kUnknown) {} + CrosUsbNotificationDelegate(const CrosUsbNotificationDelegate&) = delete; + CrosUsbNotificationDelegate& operator=(const CrosUsbNotificationDelegate&) = + delete; + void Click(const absl::optional<int>& button_index, const absl::optional<std::u16string>& reply) override { disposition_ = CrosUsbNotificationClosed::kUnknown; @@ -191,8 +195,6 @@ std::string settings_sub_page_; CrosUsbNotificationClosed disposition_; base::WeakPtrFactory<CrosUsbNotificationDelegate> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(CrosUsbNotificationDelegate); }; // List of class codes to handle / not handle.
diff --git a/chrome/browser/ash/web_applications/chrome_camera_app_ui_delegate.h b/chrome/browser/ash/web_applications/chrome_camera_app_ui_delegate.h index b13603e..debe8b3 100644 --- a/chrome/browser/ash/web_applications/chrome_camera_app_ui_delegate.h +++ b/chrome/browser/ash/web_applications/chrome_camera_app_ui_delegate.h
@@ -40,6 +40,9 @@ public: class CameraAppDialog : public chromeos::SystemWebDialogDelegate { public: + CameraAppDialog(const CameraAppDialog&) = delete; + CameraAppDialog& operator=(const CameraAppDialog&) = delete; + static void ShowIntent(const std::string& queries, gfx::NativeWindow parent); @@ -61,8 +64,6 @@ private: explicit CameraAppDialog(const std::string& url); ~CameraAppDialog() override; - - DISALLOW_COPY_AND_ASSIGN(CameraAppDialog); }; class FileMonitor {
diff --git a/chrome/browser/ash/wilco_dtc_supportd/testing_wilco_dtc_supportd_bridge_wrapper.cc b/chrome/browser/ash/wilco_dtc_supportd/testing_wilco_dtc_supportd_bridge_wrapper.cc index 181d5e750..9fc21d3 100644 --- a/chrome/browser/ash/wilco_dtc_supportd/testing_wilco_dtc_supportd_bridge_wrapper.cc +++ b/chrome/browser/ash/wilco_dtc_supportd/testing_wilco_dtc_supportd_bridge_wrapper.cc
@@ -47,6 +47,11 @@ : get_service_handler_callback_(std::move(get_service_handler_callback)) { } + TestingMojoWilcoDtcSupportdServiceFactory( + const TestingMojoWilcoDtcSupportdServiceFactory&) = delete; + TestingMojoWilcoDtcSupportdServiceFactory& operator=( + const TestingMojoWilcoDtcSupportdServiceFactory&) = delete; + // Completes the Mojo receiver of |this| to the given Mojo pending receiver. // This method allows to redirect to |this| the calls on the // WilcoDtcSupportdServiceFactory interface that are made by the @@ -96,8 +101,6 @@ chromeos::wilco_dtc_supportd::mojom::WilcoDtcSupportdClient> mojo_wilco_dtc_supportd_client)> get_service_handler_callback_; - - DISALLOW_COPY_AND_ASSIGN(TestingMojoWilcoDtcSupportdServiceFactory); }; // Testing implementation of the WilcoDtcSupportdBridge delegate that stubs out @@ -112,6 +115,11 @@ : mojo_wilco_dtc_supportd_service_factory_( std::move(mojo_wilco_dtc_supportd_service_factory)) {} + TestingWilcoDtcSupportdBridgeWrapperDelegate( + const TestingWilcoDtcSupportdBridgeWrapperDelegate&) = delete; + TestingWilcoDtcSupportdBridgeWrapperDelegate& operator=( + const TestingWilcoDtcSupportdBridgeWrapperDelegate&) = delete; + // WilcoDtcSupportdBridge::Delegate overrides: void CreateWilcoDtcSupportdServiceFactoryMojoInvitation( @@ -134,8 +142,6 @@ private: std::unique_ptr<TestingMojoWilcoDtcSupportdServiceFactory> mojo_wilco_dtc_supportd_service_factory_; - - DISALLOW_COPY_AND_ASSIGN(TestingWilcoDtcSupportdBridgeWrapperDelegate); }; FakeWilcoDtcSupportdClient* GetFakeDbusWilcoDtcSupportdClient() {
diff --git a/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_client.h b/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_client.h index 2bb12e58..887e30f 100644 --- a/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_client.h +++ b/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_client.h
@@ -27,6 +27,9 @@ // Returns the global instance if initialized. static WilcoDtcSupportdClient* Get(); + WilcoDtcSupportdClient(const WilcoDtcSupportdClient&) = delete; + WilcoDtcSupportdClient& operator=(const WilcoDtcSupportdClient&) = delete; + // Registers |callback| to run when the wilco_dtc_supportd service becomes // available. virtual void WaitForServiceToBeAvailable( @@ -41,9 +44,6 @@ // Create() should be used instead. WilcoDtcSupportdClient(); ~WilcoDtcSupportdClient() override; - - private: - DISALLOW_COPY_AND_ASSIGN(WilcoDtcSupportdClient); }; } // namespace ash
diff --git a/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_notification_controller_unittest.cc b/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_notification_controller_unittest.cc index 38f7410..251d18b 100644 --- a/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_notification_controller_unittest.cc +++ b/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_notification_controller_unittest.cc
@@ -87,6 +87,11 @@ profile_manager_.profile_manager()); } + WilcoDtcSupportdNotificationControllerTest( + const WilcoDtcSupportdNotificationControllerTest&) = delete; + WilcoDtcSupportdNotificationControllerTest& operator=( + const WilcoDtcSupportdNotificationControllerTest&) = delete; + protected: WilcoDtcSupportdNotificationController* notification_controller() const { return notification_controller_.get(); @@ -121,8 +126,6 @@ std::unique_ptr<WilcoDtcSupportdNotificationController> notification_controller_; std::unique_ptr<NotificationDisplayServiceTester> service_tester_; - - DISALLOW_COPY_AND_ASSIGN(WilcoDtcSupportdNotificationControllerTest); }; } // namespace
diff --git a/chrome/browser/attribution_reporting/chrome_attribution_browsertest.cc b/chrome/browser/attribution_reporting/chrome_attribution_browsertest.cc index c39a085..29b3854 100644 --- a/chrome/browser/attribution_reporting/chrome_attribution_browsertest.cc +++ b/chrome/browser/attribution_reporting/chrome_attribution_browsertest.cc
@@ -57,13 +57,14 @@ EXPECT_TRUE(ui_test_utils::NavigateToURL( browser(), - server_.GetURL("a.test", - "/conversions/page_with_impression_creator.html"))); + server_.GetURL( + "a.test", + "/attribution_reporting/page_with_impression_creator.html"))); // Create an anchor tag with impression attributes which opens a link in a // new window. GURL link_url = server_.GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); EXPECT_TRUE(ExecJs(web_contents, content::JsReplace(R"( createImpressionTag({id: 'link', url: $1, @@ -104,8 +105,9 @@ EXPECT_TRUE(ui_test_utils::NavigateToURL( browser(), - server_.GetURL("a.test", - "/conversions/page_with_conversion_redirect.html"))); + server_.GetURL( + "a.test", + "/attribution_reporting/page_with_conversion_redirect.html"))); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -142,14 +144,15 @@ EXPECT_TRUE(ui_test_utils::NavigateToURL( browser(), - server_.GetURL("a.test", - "/conversions/page_with_impression_creator.html"))); + server_.GetURL( + "a.test", + "/attribution_reporting/page_with_impression_creator.html"))); // Create an observer to catch the opened WebContents. content::WebContentsAddedObserver window_observer; GURL link_url = server_.GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); // Navigate the page using window.open and set an attribution source. EXPECT_TRUE(ExecJs(web_contents, content::JsReplace(R"( window.open($1, "_blank",
diff --git a/chrome/browser/attribution_reporting/conversions_usage_restriction_trial_browsertest.cc b/chrome/browser/attribution_reporting/conversions_usage_restriction_trial_browsertest.cc index d7c8601..6bd281e1 100644 --- a/chrome/browser/attribution_reporting/conversions_usage_restriction_trial_browsertest.cc +++ b/chrome/browser/attribution_reporting/conversions_usage_restriction_trial_browsertest.cc
@@ -21,7 +21,7 @@ #include "url/gurl.h" namespace { -constexpr char kBaseDataDir[] = "content/test/data/conversions"; +constexpr char kBaseDataDir[] = "content/test/data/attribution_reporting"; constexpr char kOriginTrialTestPublicKey[] = "dRCs+TocuKkocNKa0AtZ4awrt9XKH2SQCI6o4FY6BNA="; } // namespace
diff --git a/chrome/browser/cart/cart_features.cc b/chrome/browser/cart/cart_features.cc new file mode 100644 index 0000000..d64225d --- /dev/null +++ b/chrome/browser/cart/cart_features.cc
@@ -0,0 +1,36 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/cart/cart_features.h" + +#include "base/no_destructor.h" +#include "third_party/re2/src/re2/re2.h" + +namespace cart_features { + +namespace { + +constexpr base::FeatureParam<std::string> kPartnerMerchantPattern{ + &ntp_features::kNtpChromeCartModule, "partner-merchant-pattern", + // This regex does not match anything. + "\\b\\B"}; + +const re2::RE2& GetPartnerMerchantPattern() { + re2::RE2::Options options; + options.set_case_sensitive(false); + static base::NoDestructor<re2::RE2> instance(kPartnerMerchantPattern.Get(), + options); + return *instance; +} + +} // namespace + +bool IsPartnerMerchant(const GURL& url) { + const std::string& url_string = url.spec(); + return RE2::PartialMatch( + re2::StringPiece(url_string.data(), url_string.size()), + GetPartnerMerchantPattern()); +} + +} // namespace cart_features
diff --git a/chrome/browser/cart/cart_features.h b/chrome/browser/cart/cart_features.h index e25cdd1..bde0b5ef 100644 --- a/chrome/browser/cart/cart_features.h +++ b/chrome/browser/cart/cart_features.h
@@ -7,18 +7,17 @@ #include "base/feature_list.h" #include "components/search/ntp_features.h" +#include "url/gurl.h" namespace cart_features { -constexpr base::FeatureParam<std::string> kPartnerMerchantPattern{ - &ntp_features::kNtpChromeCartModule, "partner-merchant-pattern", - // This regex does not match anything. - "\\b\\B"}; - // Default value is 6 hours. constexpr base::FeatureParam<base::TimeDelta> kDiscountFetchDelayParam( &ntp_features::kNtpChromeCartModule, "discount-fetch-delay", base::TimeDelta::FromHours(6)); + +// Check if a URL belongs to a partner merchant. +bool IsPartnerMerchant(const GURL& url); } // namespace cart_features #endif // CHROME_BROWSER_CART_CART_FEATURES_H_
diff --git a/chrome/browser/cart/cart_handler.cc b/chrome/browser/cart/cart_handler.cc index f07093a7..e66183de 100644 --- a/chrome/browser/cart/cart_handler.cc +++ b/chrome/browser/cart/cart_handler.cc
@@ -6,32 +6,11 @@ #include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "chrome/browser/cart/cart_db_content.pb.h" #include "chrome/browser/cart/cart_features.h" #include "chrome/browser/cart/cart_service.h" #include "chrome/browser/cart/cart_service_factory.h" #include "components/search/ntp_features.h" -#include "third_party/re2/src/re2/re2.h" - -namespace { - -const re2::RE2& GetPartnerMerchantPattern() { - re2::RE2::Options options; - options.set_case_sensitive(false); - static base::NoDestructor<re2::RE2> instance( - cart_features::kPartnerMerchantPattern.Get(), options); - return *instance; -} - -bool IsPartnerMerchant(const GURL& url) { - const std::string& url_string = url.spec(); - return RE2::PartialMatch( - re2::StringPiece(url_string.data(), url_string.size()), - GetPartnerMerchantPattern()); -} - -} // namespace CartHandler::CartHandler( mojo::PendingReceiver<chrome_cart::mojom::CartHandler> handler, @@ -92,7 +71,8 @@ auto cart = chrome_cart::mojom::MerchantCart::New(); cart->merchant = std::move(proto_pair.second.merchant()); - if (IsPartnerMerchant(GURL(proto_pair.second.merchant_cart_url()))) { + if (cart_features::IsPartnerMerchant( + GURL(proto_pair.second.merchant_cart_url()))) { cart->cart_url = CartService::AppendUTM( GURL(std::move(proto_pair.second.merchant_cart_url())), show_discount);
diff --git a/chrome/browser/cart/cart_service.cc b/chrome/browser/cart/cart_service.cc index f0a4b5ef..37246fd8b 100644 --- a/chrome/browser/cart/cart_service.cc +++ b/chrome/browser/cart/cart_service.cc
@@ -82,21 +82,6 @@ .InDays() > 14; } -const re2::RE2& GetPartnerMerchantPattern() { - re2::RE2::Options options; - options.set_case_sensitive(false); - static base::NoDestructor<re2::RE2> instance( - cart_features::kPartnerMerchantPattern.Get(), options); - return *instance; -} - -bool IsPartnerMerchant(const GURL& url) { - const std::string& url_string = url.spec(); - return RE2::PartialMatch( - re2::StringPiece(url_string.data(), url_string.size()), - GetPartnerMerchantPattern()); -} - const re2::RE2& GetSkipCartExtractionPattern() { re2::RE2::Options options; options.set_case_sensitive(false); @@ -153,7 +138,7 @@ } GURL CartService::AppendUTM(const GURL& base_url, bool is_discount_enabled) { - DCHECK(base_url.is_valid() && IsPartnerMerchant(base_url)); + DCHECK(base_url.is_valid() && cart_features::IsPartnerMerchant(base_url)); if (kRbdUtmParam.Get()) { return net::AppendOrReplaceQueryParameter( @@ -308,7 +293,8 @@ bool success, std::vector<CartDB::KeyAndValue> proto_pairs) { for (auto proto_pair : proto_pairs) { - if (IsPartnerMerchant(GURL(proto_pair.second.merchant_cart_url()))) { + if (cart_features::IsPartnerMerchant( + GURL(proto_pair.second.merchant_cart_url()))) { std::move(callback).Run(true); return; } @@ -346,11 +332,11 @@ const GURL& cart_url, base::OnceCallback<void(const ::GURL&)> callback) { auto url = cart_url; - if (IsPartnerMerchant(cart_url)) { + if (cart_features::IsPartnerMerchant(cart_url)) { url = AppendUTM(cart_url, IsCartDiscountEnabled()); } - if (!IsPartnerMerchant(cart_url) || !IsCartDiscountEnabled()) { + if (!cart_features::IsPartnerMerchant(cart_url) || !IsCartDiscountEnabled()) { std::move(callback).Run(url); CartDiscountMetricCollector::RecordClickedOnDiscount(false); return; @@ -409,7 +395,7 @@ void CartService::PrepareForNavigation(const GURL& cart_url, bool is_navigating) { metrics_tracker_->PrepareToRecordUKM(cart_url); - if (is_navigating || !IsPartnerMerchant(cart_url) || + if (is_navigating || !cart_features::IsPartnerMerchant(cart_url) || !IsCartDiscountEnabled()) { return; }
diff --git a/chrome/browser/cart/commerce_hint_service.cc b/chrome/browser/cart/commerce_hint_service.cc index 547d0aad..fd8698c4 100644 --- a/chrome/browser/cart/commerce_hint_service.cc +++ b/chrome/browser/cart/commerce_hint_service.cc
@@ -8,7 +8,6 @@ #include <memory> #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "base/time/time.h" #include "chrome/browser/cart/cart_db_content.pb.h" #include "chrome/browser/cart/cart_features.h" @@ -27,7 +26,6 @@ #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "services/metrics/public/cpp/ukm_builders.h" #include "services/metrics/public/cpp/ukm_recorder.h" -#include "third_party/re2/src/re2/re2.h" namespace cart { @@ -39,21 +37,6 @@ url, net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); } -const re2::RE2& GetPartnerMerchantPattern() { - re2::RE2::Options options; - options.set_case_sensitive(false); - static base::NoDestructor<re2::RE2> instance( - cart_features::kPartnerMerchantPattern.Get(), options); - return *instance; -} - -bool IsPartnerMerchant(const GURL& url) { - const std::string& url_string = url.spec(); - return RE2::PartialMatch( - re2::StringPiece(url_string.data(), url_string.size()), - GetPartnerMerchantPattern()); -} - void ConstructCartProto(cart_db::ChromeCartContentProto* proto, const GURL& navigation_url, std::vector<mojom::ProductPtr> products) { @@ -208,8 +191,8 @@ } // When rule-based discount is enabled, do not accept cart page URLs from // partner merchants as there could be things like discount tokens in them. - if (service_->IsCartDiscountEnabled() && IsPartnerMerchant(navigation_url) && - product_id.empty()) { + if (service_->IsCartDiscountEnabled() && + cart_features::IsPartnerMerchant(navigation_url) && product_id.empty()) { validated_cart = absl::nullopt; } cart_db::ChromeCartContentProto proto; @@ -236,7 +219,8 @@ absl::optional<GURL> validated_cart = cart_url; // When rule-based discount is enabled, do not accept cart page URLs from // partner merchants as there could be things like discount tokens in them. - if (service_->IsCartDiscountEnabled() && IsPartnerMerchant(cart_url)) { + if (service_->IsCartDiscountEnabled() && + cart_features::IsPartnerMerchant(cart_url)) { validated_cart = absl::nullopt; } cart_db::ChromeCartContentProto proto;
diff --git a/chrome/browser/cart/fetch_discount_worker.cc b/chrome/browser/cart/fetch_discount_worker.cc index 77ddca43..38b080b 100644 --- a/chrome/browser/cart/fetch_discount_worker.cc +++ b/chrome/browser/cart/fetch_discount_worker.cc
@@ -6,6 +6,7 @@ #include "base/memory/scoped_refptr.h" #include "base/metrics/field_trial_params.h" +#include "base/no_destructor.h" #include "base/task/thread_pool.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/cart/cart_discount_fetcher.h" @@ -22,6 +23,7 @@ #include "google_apis/gaia/gaia_constants.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "services/network/public/cpp/shared_url_loader_factory.h" +#include "third_party/re2/src/re2/re2.h" namespace { const char kOauthName[] = "rbd"; @@ -138,6 +140,20 @@ weak_ptr_factory_.GetWeakPtr()); cart_service_delegate_->RecordFetchTimestamp(); + // If there is no partner merchant cart, don't fetch immediately; instead, + // post another delayed fetch. + bool has_partner_merchant = false; + for (auto pair : proto_pairs) { + if (cart_features::IsPartnerMerchant( + GURL(pair.second.merchant_cart_url()))) { + has_partner_merchant = true; + break; + } + } + if (!has_partner_merchant) { + Start(cart_features::kDiscountFetchDelayParam.Get()); + return; + } backend_task_runner_->PostTask( FROM_HERE, base::BindOnce(
diff --git a/chrome/browser/cart/fetch_discount_worker_unittest.cc b/chrome/browser/cart/fetch_discount_worker_unittest.cc index 46c0691..8b2d764 100644 --- a/chrome/browser/cart/fetch_discount_worker_unittest.cc +++ b/chrome/browser/cart/fetch_discount_worker_unittest.cc
@@ -275,7 +275,8 @@ features_.InitAndEnableFeatureWithParameters( ntp_features::kNtpChromeCartModule, {{ntp_features::kNtpChromeCartModuleAbandonedCartDiscountParam, "true"}, - {"discount-fetch-delay", "6h"}}); + {"discount-fetch-delay", "6h"}, + {"partner-merchant-pattern", "(foo.com)"}}); } void SetUp() override { test_shared_url_loader_factory_ = @@ -393,6 +394,7 @@ fetch_discount_worker_->Start(base::TimeDelta::FromMilliseconds(0)); task_environment_.RunUntilIdle(); + EXPECT_EQ(1, FakeCartDiscountFetcher::GetFetchCount()); } TEST_F(FetchDiscountWorkerTest, TestStart_DiscountUpdatedWithCouponDiscount) { @@ -423,6 +425,7 @@ fetch_discount_worker_->Start(base::TimeDelta::FromMilliseconds(0)); task_environment_.RunUntilIdle(); + EXPECT_EQ(1, FakeCartDiscountFetcher::GetFetchCount()); } TEST_F(FetchDiscountWorkerTest, TestStart_DiscountUpdatedClearDiscount) { @@ -451,6 +454,7 @@ fetch_discount_worker_->Start(base::TimeDelta::FromMilliseconds(0)); task_environment_.RunUntilIdle(); + EXPECT_EQ(1, FakeCartDiscountFetcher::GetFetchCount()); } TEST_F(FetchDiscountWorkerTest, TestStart_FetcherRefetched) { @@ -515,4 +519,29 @@ fetch_discount_worker_->Start(base::TimeDelta::FromMilliseconds(0)); task_environment_.RunUntilIdle(); + EXPECT_EQ(1, FakeCartDiscountFetcher::GetFetchCount()); +} + +TEST_F(FetchDiscountWorkerTest, TestFetchSkippedForNonPartnerMerchants) { + // Mock that there is a non-partner-merchant cart. + const char mock_merchant[] = "bar.com"; + const char mock_merchant_url[] = "https://www.bar.com/cart"; + const cart_db::ChromeCartContentProto mock_merchant_cart_proto = + BuildCartContentProto(mock_merchant, mock_merchant_url, + kMockMerchantATimestamp); + + CartDiscountFetcher::CartDiscountMap fake_result; + CreateCartDiscountFetcherFactory(std::move(fake_result), false); + + CartDB::KeyAndValue mockMerchantACartContentKeyAndProto = + std::make_pair(mock_merchant, mock_merchant_cart_proto); + std::vector<CartDB::KeyAndValue> loader_fake_data( + 1, mockMerchantACartContentKeyAndProto); + fake_cart_service_delegate_->SetCartLoadFakeData(loader_fake_data); + + CreateWorker(); + + fetch_discount_worker_->Start(base::TimeDelta::FromMilliseconds(0)); + task_environment_.RunUntilIdle(); + EXPECT_EQ(0, FakeCartDiscountFetcher::GetFetchCount()); }
diff --git a/chrome/browser/chrome_browser_interface_binders.cc b/chrome/browser/chrome_browser_interface_binders.cc index 1f3b5d9..a84d0fd 100644 --- a/chrome/browser/chrome_browser_interface_binders.cc +++ b/chrome/browser/chrome_browser_interface_binders.cc
@@ -94,6 +94,12 @@ #include "chrome/browser/ui/webui/reset_password/reset_password_ui.h" #endif // BUILDFLAG(FULL_SAFE_BROWSING) +#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ + BUILDFLAG(IS_CHROMEOS_ASH) +#include "chrome/browser/ui/webui/connectors_internals/connectors_internals.mojom.h" +#include "chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.h" +#endif + #if defined(OS_ANDROID) #include "chrome/browser/android/contextualsearch/contextual_search_observer.h" #include "chrome/browser/android/dom_distiller/distiller_ui_handle_android.h" @@ -682,6 +688,13 @@ RegisterWebUIControllerInterfaceBinder<federated_learning::mojom::PageHandler, FlocInternalsUI>(map); +#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ + BUILDFLAG(IS_CHROMEOS_ASH) + RegisterWebUIControllerInterfaceBinder< + connectors_internals::mojom::PageHandler, + enterprise_connectors::ConnectorsInternalsUI>(map); +#endif + #if defined(OS_ANDROID) RegisterWebUIControllerInterfaceBinder< explore_sites_internals::mojom::PageHandler,
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index be444a7..e1750948 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -1865,6 +1865,8 @@ "../ash/login/screens/offline_login_screen.h", "../ash/login/screens/os_install_screen.cc", "../ash/login/screens/os_install_screen.h", + "../ash/login/screens/os_trial_screen.cc", + "../ash/login/screens/os_trial_screen.h", "../ash/login/screens/packaged_license_screen.cc", "../ash/login/screens/packaged_license_screen.h", "../ash/login/screens/parental_handoff_screen.cc", @@ -2855,6 +2857,12 @@ "../ash/system_logs/touch_log_source.h", "../ash/system_logs/ui_hierarchy_log_source.cc", "../ash/system_logs/ui_hierarchy_log_source.h", + "../ash/tether/fake_tether_service.cc", + "../ash/tether/fake_tether_service.h", + "../ash/tether/tether_service.cc", + "../ash/tether/tether_service.h", + "../ash/tether/tether_service_factory.cc", + "../ash/tether/tether_service_factory.h", "../ash/usb/cros_usb_detector.cc", "../ash/usb/cros_usb_detector.h", "../ash/wallpaper/wallpaper_enumerator.cc", @@ -3203,12 +3211,6 @@ "startup_settings_cache.h", "system_token_cert_db_initializer.cc", "system_token_cert_db_initializer.h", - "tether/fake_tether_service.cc", - "tether/fake_tether_service.h", - "tether/tether_service.cc", - "tether/tether_service.h", - "tether/tether_service_factory.cc", - "tether/tether_service_factory.h", "throttle_observer.cc", "throttle_observer.h", "throttle_service.cc", @@ -4309,6 +4311,7 @@ "../ash/system_logs/shill_log_source_unittest.cc", "../ash/system_logs/single_debug_daemon_log_source_unittest.cc", "../ash/system_logs/single_log_file_log_source_unittest.cc", + "../ash/tether/tether_service_unittest.cc", "../ash/usb/cros_usb_detector_unittest.cc", "../ash/web_applications/help_app/help_app_discover_tab_notification_unittest.cc", "../ash/web_applications/help_app/help_app_notification_controller_unittest.cc", @@ -4429,7 +4432,6 @@ "session_length_limiter_unittest.cc", "startup_settings_cache_unittest.cc", "system_token_cert_db_initializer_unittest.cc", - "tether/tether_service_unittest.cc", "throttle_observer_unittest.cc", "throttle_service_unittest.cc", "tpm_firmware_update_unittest.cc",
diff --git a/chrome/browser/chromeos/browser_context_keyed_service_factories.cc b/chrome/browser/chromeos/browser_context_keyed_service_factories.cc index 8600c9d..8c454148 100644 --- a/chrome/browser/chromeos/browser_context_keyed_service_factories.cc +++ b/chrome/browser/chromeos/browser_context_keyed_service_factories.cc
@@ -31,6 +31,7 @@ #include "chrome/browser/ash/printing/synced_printers_manager_factory.h" #include "chrome/browser/ash/secure_channel/nearby_connector_factory.h" #include "chrome/browser/ash/smb_client/smb_service_factory.h" +#include "chrome/browser/ash/tether/tether_service_factory.h" #include "chrome/browser/ash/web_applications/crosh_loader_factory.h" #include "chrome/browser/chromeos/eche_app/eche_app_manager_factory.h" #include "chrome/browser/chromeos/extensions/file_manager/event_router_factory.h" @@ -43,7 +44,6 @@ #include "chrome/browser/chromeos/platform_keys/key_permissions/user_private_token_kpm_service_factory.h" #include "chrome/browser/chromeos/printing/cups_print_job_manager_factory.h" #include "chrome/browser/chromeos/printing/cups_printers_manager_factory.h" -#include "chrome/browser/chromeos/tether/tether_service_factory.h" #include "chrome/browser/ui/ash/calendar/calendar_keyed_service_factory.h" #include "chrome/browser/ui/ash/holding_space/holding_space_keyed_service_factory.h"
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/base_telemetry_extension_browser_test.cc b/chrome/browser/chromeos/extensions/telemetry/api/base_telemetry_extension_browser_test.cc index dee74e7..311a7e9 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/base_telemetry_extension_browser_test.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/base_telemetry_extension_browser_test.cc
@@ -42,7 +42,7 @@ "optional_permissions": [ "os.telemetry.serial_number" ], "externally_connectable": { "matches": [ - "http://www.google.com/*" + "*://www.google.com/*" ] }, "options_page": "options.html"
diff --git a/chrome/browser/chromeos/extensions/telemetry/chromeos_permission_messages_unittest.cc b/chrome/browser/chromeos/extensions/telemetry/chromeos_permission_messages_unittest.cc index ef73269aa..0f7c6e3 100644 --- a/chrome/browser/chromeos/extensions/telemetry/chromeos_permission_messages_unittest.cc +++ b/chrome/browser/chromeos/extensions/telemetry/chromeos_permission_messages_unittest.cc
@@ -83,7 +83,7 @@ "externally_connectable", extensions::DictionaryBuilder() .Set("matches", extensions::ListBuilder() - .Append("http://www.google.com/*") + .Append("*://www.google.com/*") .Build()) .Build()) .SetID(kChromeOSSystemExtensionId) // only allowlisted id
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 24d01ed5..d1053c6 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -36,7 +36,7 @@ { "name": "accessible-pdf-form", "owners": [ "ankk@microsoft.com", "mohitb@microsoft.com" ], - "expiry_milestone": 95 + "expiry_milestone": 100 }, { "name": "account-id-migration", @@ -646,7 +646,9 @@ { "name": "cellular-use-external-euicc", "owners": [ "azeemarshad", "khorimoto", "cros-connectivity@google.com" ], - "expiry_milestone": 95 + // Never expires. This used in ChromeOS to switch to removable EUICC for + // all eSIM operations. This is useful for debugging with test SIM cards. + "expiry_milestone": -1 }, { "name": "check-offline-capability", @@ -1340,12 +1342,12 @@ { "name": "enable-accessibility-live-caption", "owners": [ "abigailbklein@google.com", "evliu@google.com", "//ui/accessibility/OWNERS" ], - "expiry_milestone": 95 + "expiry_milestone": 100 }, { "name": "enable-accessibility-live-caption-soda", "owners": [ "abigailbklein@google.com", "evliu@google.com", "robsc@chromium.org", "//ui/accessibility/OWNERS" ], - "expiry_milestone": 95 + "expiry_milestone": 100 }, { "name": "enable-android-dark-search", @@ -2435,8 +2437,8 @@ }, { "name": "enable-reader-mode", - "owners": [ "katie", "dmazzoni" ], - "expiry_milestone": 95 + "owners": [ "katie", "//ui/accessibility/OWNERS" ], + "expiry_milestone": 100 }, { "name": "enable-reader-mode-in-cct", @@ -3197,7 +3199,7 @@ { "name": "forced-colors", "owners": [ "almaher@microsoft.com" ], - "expiry_milestone": 95 + "expiry_milestone": 99 }, { "name": "fractional-scroll-offsets", @@ -3894,7 +3896,7 @@ { "name": "new-canvas-2d-api", "owners": [ "aaronhk", "fserb", "juanmihd", "yiyix" ], - "expiry_milestone": 95 + "expiry_milestone": 100 }, { "name": "new-content-suggestions-feed", @@ -4275,11 +4277,6 @@ "expiry_milestone": 99 }, { - "name": "page-info-discoverability", - "owners": [ "eokoyomon", "dullweber" ], - "expiry_milestone": 95 - }, - { "name": "page-info-history", "owners": [ "eokoyomon", "dullweber" ], "expiry_milestone": 97
diff --git a/chrome/browser/flag-never-expire-list.json b/chrome/browser/flag-never-expire-list.json index 3680718..9a5323f 100644 --- a/chrome/browser/flag-never-expire-list.json +++ b/chrome/browser/flag-never-expire-list.json
@@ -18,6 +18,7 @@ "arc-native-bridge-toggle", "ash-debug-shortcuts", "ash-enable-unified-desktop", + "cellular-use-external-euicc", "dcheck-is-fatal", "disable-accelerated-2d-canvas", "disable-accelerated-mjpeg-decode",
diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc index 8fcfc67..0306c7f 100644 --- a/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chrome/browser/flags/android/chrome_feature_list.cc
@@ -99,6 +99,7 @@ &blink::features::kPrerender2, &commerce::kCommerceMerchantViewer, &commerce::kCommercePriceTracking, + &commerce::kShoppingList, &device::kWebAuthPhoneSupport, &download::features::kDownloadAutoResumptionNative, &download::features::kDownloadLater,
diff --git a/chrome/browser/focus_ring_browsertest.cc b/chrome/browser/focus_ring_browsertest.cc index da02ed5..b50b95e 100644 --- a/chrome/browser/focus_ring_browsertest.cc +++ b/chrome/browser/focus_ring_browsertest.cc
@@ -83,6 +83,8 @@ platform_suffix = "_mac"; #elif defined(OS_WIN) platform_suffix = "_win"; +#elif defined(OS_LINUX) + platform_suffix = "_linux"; #elif BUILDFLAG(IS_CHROMEOS_ASH) platform_suffix = "_chromeos"; #endif
diff --git a/chrome/browser/lacros/account_manager/account_profile_mapper.cc b/chrome/browser/lacros/account_manager/account_profile_mapper.cc index 8e363d3..89a4ec8f 100644 --- a/chrome/browser/lacros/account_manager/account_profile_mapper.cc +++ b/chrome/browser/lacros/account_manager/account_profile_mapper.cc
@@ -15,6 +15,7 @@ #include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/profiles/profile_manager.h" #include "components/account_manager_core/account.h" +#include "components/account_manager_core/account_addition_result.h" #include "google_apis/gaia/oauth2_access_token_fetcher.h" #include "google_apis/gaia/oauth2_access_token_fetcher_immediate_error.h" @@ -34,6 +35,33 @@ return it->second; } +// Adds the account specified in `result` to the profile associated with +// `profile_path`, and returns whether the operation succeeded. +bool TryAddAccountToProfile( + ProfileAttributesStorage* storage, + const base::FilePath& profile_path, + const account_manager::AccountAdditionResult& result) { + ProfileAttributesEntry* entry = + storage->GetProfileAttributesWithPath(profile_path); + if (!entry) + return false; // The profile no longer exists. + if (result.status() != + account_manager::AccountAdditionResult::Status::kSuccess) { + return false; // The OS flow failed. + } + const account_manager::Account& account = *result.account(); + if (account.key.account_type != account_manager::AccountType::kGaia) + return false; // The account is not Gaia. + const std::string& gaia_id = account.key.id; + DCHECK(!gaia_id.empty()); + auto profile_accounts = entry->GetGaiaIds(); + auto inserted = profile_accounts.insert(gaia_id); + if (!inserted.second) + return false; // The account already exists in the profile. + entry->SetGaiaIds(profile_accounts); + return true; +} + } // namespace AccountProfileMapper::AccountProfileMapper( @@ -117,6 +145,27 @@ account, oauth_consumer_name, consumer); } +void AccountProfileMapper::ShowAddAccountDialog( + const base::FilePath& profile_path, + account_manager::AccountManagerFacade::AccountAdditionSource source, + base::OnceCallback<void(const absl::optional<account_manager::Account>&)> + callback) { + if (!initialized_) { + initialization_callbacks_.push_back(base::BindOnce( + &AccountProfileMapper::ShowAddAccountDialog, weak_factory_.GetWeakPtr(), + profile_path, source, std::move(callback))); + return; + } + + DCHECK_GE(account_addition_in_progress_, 0); + ++account_addition_in_progress_; + account_manager_facade_->ShowAddAccountDialog( + source, + base::BindOnce(&AccountProfileMapper::OnShowAddAccountDialogCompleted, + weak_factory_.GetWeakPtr(), profile_path, + std::move(callback))); +} + void AccountProfileMapper::OnAccountUpserted( const account_manager::Account& account) { account_manager_facade_->GetAccounts( @@ -235,6 +284,28 @@ } } +void AccountProfileMapper::OnShowAddAccountDialogCompleted( + const base::FilePath& profile_path, + base::OnceCallback<void(const absl::optional<account_manager::Account>&)> + client_callback, + const account_manager::AccountAdditionResult& result) { + DCHECK(initialized_); + bool added_to_profile = + TryAddAccountToProfile(profile_attributes_storage_, profile_path, result); + if (added_to_profile) { + for (auto& obs : observers_) + obs.OnAccountUpserted(profile_path, result.account().value()); + } + + if (client_callback) { + std::move(client_callback) + .Run(added_to_profile ? result.account() : absl::nullopt); + } + + --account_addition_in_progress_; + DCHECK_GE(account_addition_in_progress_, 0); +} + bool AccountProfileMapper::ProfileContainsAccount( const base::FilePath& profile_path, const account_manager::AccountKey& account) const { @@ -247,6 +318,13 @@ ProfileAttributesEntry* AccountProfileMapper::MaybeGetProfileForNewAccounts() const { + // `AccountManagerFacade` may call `OnAccountUpserted()` before the + // `ShowAddAccountDialog()` callback, which may result in this function being + // called during the account addition. In this case, do not assign the new + // account here, as this will be done in `OnShowAddAccountDialogCompleted()`. + if (account_addition_in_progress_ > 0) + return nullptr; + std::vector<ProfileAttributesEntry*> entries = profile_attributes_storage_->GetAllProfilesAttributes(); // Ignore omitted profiles.
diff --git a/chrome/browser/lacros/account_manager/account_profile_mapper.h b/chrome/browser/lacros/account_manager/account_profile_mapper.h index 218d6a0..914266c 100644 --- a/chrome/browser/lacros/account_manager/account_profile_mapper.h +++ b/chrome/browser/lacros/account_manager/account_profile_mapper.h
@@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_LACROS_ACCOUNT_MANAGER_ACCOUNT_PROFILE_MAPPER_H_ #define CHROME_BROWSER_LACROS_ACCOUNT_MANAGER_ACCOUNT_PROFILE_MAPPER_H_ +#include <string> #include <vector> #include "base/callback_forward.h" @@ -15,6 +16,12 @@ #include "base/observer_list_types.h" #include "base/scoped_observation.h" #include "components/account_manager_core/account_manager_facade.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace account_manager { +struct Account; +struct AccountKey; +} // namespace account_manager namespace base { class FilePath; @@ -80,6 +87,12 @@ const account_manager::AccountKey& account, const std::string& oauth_consumer_name, OAuth2AccessTokenConsumer* consumer); + // `callback` is called with nullopt if the operation failed. + void ShowAddAccountDialog( + const base::FilePath& profile_path, + account_manager::AccountManagerFacade::AccountAdditionSource source, + base::OnceCallback<void(const absl::optional<account_manager::Account>&)> + callback); // account_manager::AccountManagerFacade::Observer: void OnAccountUpserted(const account_manager::Account& account) override; @@ -100,6 +113,13 @@ // Update the `ProfileAttributesStorage` to match the system accounts. void OnGetAccountsCompleted(const std::vector<account_manager::Account>&); + // Assigns the newly added account to the specified profile. + void OnShowAddAccountDialogCompleted( + const base::FilePath& profile_path, + base::OnceCallback<void(const absl::optional<account_manager::Account>&)> + client_callback, + const account_manager::AccountAdditionResult& result); + // Returns whether the profile at `profile_path` contains `account`. bool ProfileContainsAccount(const base::FilePath& profile_path, const account_manager::AccountKey& account) const; @@ -113,6 +133,10 @@ bool initialized_ = false; std::vector<base::OnceClosure> initialization_callbacks_; + // Number of `ShowAddAccountDialog()` calls is in progress. Accounts are not + // auto-assigned to the main profile for this flow. + int account_addition_in_progress_ = 0; + account_manager::AccountManagerFacade* const account_manager_facade_; ProfileAttributesStorage* const profile_attributes_storage_; base::ObserverList<Observer> observers_;
diff --git a/chrome/browser/lacros/account_manager/account_profile_mapper_unittest.cc b/chrome/browser/lacros/account_manager/account_profile_mapper_unittest.cc index 3c19d32..8d7583cc 100644 --- a/chrome/browser/lacros/account_manager/account_profile_mapper_unittest.cc +++ b/chrome/browser/lacros/account_manager/account_profile_mapper_unittest.cc
@@ -8,6 +8,7 @@ #include <vector> #include "base/callback.h" +#include "base/callback_forward.h" #include "base/containers/flat_map.h" #include "base/files/file_path.h" #include "base/scoped_observation.h" @@ -20,14 +21,20 @@ #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile_manager.h" #include "components/account_manager_core/account.h" +#include "components/account_manager_core/account_addition_result.h" +#include "components/account_manager_core/account_manager_facade.h" #include "components/account_manager_core/mock_account_manager_facade.h" #include "content/public/test/browser_task_environment.h" #include "google_apis/gaia/google_service_auth_error.h" #include "google_apis/gaia/oauth2_access_token_fetcher.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/abseil-cpp/absl/types/optional.h" using account_manager::Account; +using account_manager::AccountAdditionResult; +using account_manager::AccountKey; +using account_manager::AccountManagerFacade; using testing::Field; namespace { @@ -54,6 +61,13 @@ (override)); }; +MATCHER_P(OptionalAccountEqual, other, "optional<Account> equality matcher") { + if (arg == absl::nullopt && other == absl::nullopt) + return true; + return std::tie(arg->raw_email, arg->key.account_type, arg->key.id) == + std::tie(other->raw_email, other->key.account_type, other->key.id); +} + // Synthetizes a non-Gaia `Account` from an id. Account NonGaiaAccountFromID(const std::string& id) { Account account; @@ -85,10 +99,10 @@ public: AccountProfileMapperTest() : testing_profile_manager_(TestingBrowserProcess::GetGlobal()) { - CHECK(testing_profile_manager_.SetUp(base::FilePath("UserDataDir"))); + CHECK(testing_profile_manager_.SetUp(base::FilePath("."))); ON_CALL(mock_facade_, GetPersistentErrorForAccount) .WillByDefault( - [](const account_manager::AccountKey&, + [](const AccountKey&, base::OnceCallback<void(const GoogleServiceAuthError&)> callback) { std::move(callback).Run(GoogleServiceAuthError::AuthErrorNone()); @@ -121,12 +135,11 @@ // Triggers an update of the accounts and checks observer calls, and the end // state of the storage. - void TestMapperUpdate( - AccountProfileMapper* mapper, - const std::vector<account_manager::Account>& accounts_in_facade, - const AccountMapping& expected_accounts_upserted, - const AccountMapping& expected_accounts_removed, - const AccountMapping& expected_accounts_in_storage) { + void TestMapperUpdate(AccountProfileMapper* mapper, + const std::vector<Account>& accounts_in_facade, + const AccountMapping& expected_accounts_upserted, + const AccountMapping& expected_accounts_removed, + const AccountMapping& expected_accounts_in_storage) { MockAccountProfileMapperObserver mock_observer; base::ScopedObservation<AccountProfileMapper, AccountProfileMapper::Observer> @@ -183,7 +196,7 @@ for (const auto& path_accounts_pair : accounts_map) { const base::FilePath profile_path = path_accounts_pair.first; for (const std::string& gaia_id : path_accounts_pair.second) { - account_manager::AccountKey key = {gaia_id, kGaiaType}; + AccountKey key = {gaia_id, kGaiaType}; EXPECT_CALL(*mock_observer, OnAccountUpserted(profile_path, Field(&Account::key, key))); } @@ -201,7 +214,7 @@ for (const auto& path_accounts_pair : accounts_map) { const base::FilePath profile_path = path_accounts_pair.first; for (const std::string& gaia_id : path_accounts_pair.second) { - account_manager::AccountKey key = {gaia_id, kGaiaType}; + AccountKey key = {gaia_id, kGaiaType}; EXPECT_CALL(*mock_observer, OnAccountRemoved(profile_path, Field(&Account::key, key))); } @@ -242,6 +255,24 @@ }); } + // Sets an expectation that `ShowAddAccountDialog()` is called on the facade, + // and immediately returns with a new account. + void ExpectFacadeShowAddAccountDialogCalled( + AccountManagerFacade::AccountAdditionSource source, + Account new_account) { + EXPECT_CALL(mock_facade_, ShowAddAccountDialog(source, testing::_)) + .WillOnce( + [new_account](AccountManagerFacade::AccountAdditionSource, + base::OnceCallback<void(const AccountAdditionResult&)> + callback) { + std::move(callback).Run( + new_account.key.IsValid() + ? AccountAdditionResult::FromAccount(new_account) + : AccountAdditionResult::FromStatus( + AccountAdditionResult::Status::kCancelledByUser)); + }); + } + void CompleteFacadeGetAccountsGaia(const std::vector<std::string>& gaia_ids) { CompleteFacadeGetAccounts(AccountsFromGaiaIDs(gaia_ids)); } @@ -273,7 +304,7 @@ } private: - const base::FilePath main_path_ = base::FilePath("UserDataDir/Default"); + const base::FilePath main_path_ = base::FilePath("Default"); content::BrowserTaskEnvironment task_environment_; TestingProfileManager testing_profile_manager_; account_manager::MockAccountManagerFacade mock_facade_; @@ -286,7 +317,7 @@ // - returns no accounts when called on non-existing profile // - does not trigger a call to GetAccounts() on the facade. TEST_F(AccountProfileMapperTest, GetAccounts) { - base::FilePath other_path("UserDataDir/Other"); + base::FilePath other_path("Other"); std::unique_ptr<AccountProfileMapper> mapper = GetMapper({{main_path(), {"A"}}, {other_path, {"B", "C"}}}); @@ -298,16 +329,14 @@ // Non-existing profile. EXPECT_CALL(mock_callback, Run(testing::IsEmpty())); - mapper->GetAccounts(base::FilePath("UserDataDir/MissingAccount"), - mock_callback.Get()); + mapper->GetAccounts(base::FilePath("MissingAccount"), mock_callback.Get()); testing::Mock::VerifyAndClearExpectations(&mock_callback); // Existing profile. - EXPECT_CALL( - mock_callback, - Run(testing::UnorderedElementsAre( - Field(&Account::key, account_manager::AccountKey{"B", kGaiaType}), - Field(&Account::key, account_manager::AccountKey{"C", kGaiaType})))); + EXPECT_CALL(mock_callback, + Run(testing::UnorderedElementsAre( + Field(&Account::key, AccountKey{"B", kGaiaType}), + Field(&Account::key, AccountKey{"C", kGaiaType})))); mapper->GetAccounts(other_path, mock_callback.Get()); testing::Mock::VerifyAndClearExpectations(&mock_callback); @@ -330,7 +359,7 @@ // Tests that new accounts are left unassigned when there are multiple profiles. TEST_F(AccountProfileMapperTest, UpdateMulltiProfile) { - base::FilePath other_path("UserDataDir/Other"); + base::FilePath other_path("Other"); std::unique_ptr<AccountProfileMapper> mapper = GetMapper({{main_path(), {"A"}}, {other_path, {"B", "C"}}}); TestMapperUpdateGaia( @@ -345,7 +374,7 @@ // Checks that `GetPersistentErrorForAccount()` returns an error when the // account is not in this profile. TEST_F(AccountProfileMapperTest, GetPersistentErrorForAccount) { - base::FilePath other_path("UserDataDir/Other"); + base::FilePath other_path("Other"); std::unique_ptr<AccountProfileMapper> mapper = GetMapper({{main_path(), {"A"}}, {other_path, {"B"}}}); base::MockRepeatingCallback<void(const GoogleServiceAuthError&)> @@ -382,11 +411,10 @@ testing::Mock::VerifyAndClearExpectations(&accounts_callback); // Complete initialization: callback is invoked. EXPECT_CALL(error_callback, Run(GoogleServiceAuthError::AuthErrorNone())); - EXPECT_CALL( - accounts_callback, - Run(testing::UnorderedElementsAre( - Field(&Account::key, account_manager::AccountKey{"A", kGaiaType}), - Field(&Account::key, account_manager::AccountKey{"B", kGaiaType})))); + EXPECT_CALL(accounts_callback, + Run(testing::UnorderedElementsAre( + Field(&Account::key, AccountKey{"A", kGaiaType}), + Field(&Account::key, AccountKey{"B", kGaiaType})))); CompleteFacadeGetAccountsGaia({"A", "B"}); testing::Mock::VerifyAndClearExpectations(&error_callback); testing::Mock::VerifyAndClearExpectations(&accounts_callback); @@ -431,3 +459,72 @@ /*expected_accounts_in_storage=*/ {{main_path(), {"A"}}}); } + +TEST_F(AccountProfileMapperTest, ShowAddAccountDialogBeforeInit) { + std::unique_ptr<AccountProfileMapper> mapper = + GetMapperNonInitialized({{main_path(), {"A"}}}); + AccountManagerFacade::AccountAdditionSource source = + AccountManagerFacade::AccountAdditionSource::kArc; + // The facade is not called before initialization. + EXPECT_CALL(*mock_facade(), ShowAddAccountDialog(testing::_, testing::_)) + .Times(0); + mapper->ShowAddAccountDialog( + main_path(), source, + base::OnceCallback<void(const absl::optional<Account>&)>()); + testing::Mock::VerifyAndClearExpectations(mock_facade()); + // Complete initialization, and check that the facade was called. + EXPECT_CALL(*mock_facade(), ShowAddAccountDialog(source, testing::_)); + CompleteFacadeGetAccountsGaia({"A"}); + testing::Mock::VerifyAndClearExpectations(mock_facade()); +} + +TEST_F(AccountProfileMapperTest, ShowAddAccountDialog) { + base::FilePath other_path("Other"); + std::unique_ptr<AccountProfileMapper> mapper = + GetMapper({{main_path(), {"A"}}, {other_path, {"B"}}}); + base::MockOnceCallback<void(const absl::optional<Account>&)> + account_added_callback; + AccountManagerFacade::AccountAdditionSource source = + AccountManagerFacade::AccountAdditionSource::kArc; + Account account_c = AccountFromGaiaID("C"); + // Add account to existing profile. + ExpectFacadeShowAddAccountDialogCalled(source, account_c); + EXPECT_CALL(account_added_callback, + Run(OptionalAccountEqual(absl::make_optional(account_c)))); + mapper->ShowAddAccountDialog(other_path, source, + account_added_callback.Get()); + testing::Mock::VerifyAndClearExpectations(&account_added_callback); + testing::Mock::VerifyAndClearExpectations(mock_facade()); + // Add account that already exists. + ExpectFacadeShowAddAccountDialogCalled(source, account_c); + EXPECT_CALL(account_added_callback, + Run(OptionalAccountEqual(absl::optional<Account>()))); + mapper->ShowAddAccountDialog(other_path, source, + account_added_callback.Get()); + testing::Mock::VerifyAndClearExpectations(&account_added_callback); + testing::Mock::VerifyAndClearExpectations(mock_facade()); + // Add account to non-existing profile. + ExpectFacadeShowAddAccountDialogCalled(source, AccountFromGaiaID("D")); + EXPECT_CALL(account_added_callback, + Run(OptionalAccountEqual(absl::optional<Account>()))); + mapper->ShowAddAccountDialog(base::FilePath("UnknownProfile"), source, + account_added_callback.Get()); + testing::Mock::VerifyAndClearExpectations(&account_added_callback); + testing::Mock::VerifyAndClearExpectations(mock_facade()); + // Non-Gaia account. + ExpectFacadeShowAddAccountDialogCalled(source, NonGaiaAccountFromID("D")); + EXPECT_CALL(account_added_callback, + Run(OptionalAccountEqual(absl::optional<Account>()))); + mapper->ShowAddAccountDialog(other_path, source, + account_added_callback.Get()); + testing::Mock::VerifyAndClearExpectations(&account_added_callback); + testing::Mock::VerifyAndClearExpectations(mock_facade()); + // Flow aborted. + ExpectFacadeShowAddAccountDialogCalled(source, Account()); + EXPECT_CALL(account_added_callback, + Run(OptionalAccountEqual(absl::optional<Account>()))); + mapper->ShowAddAccountDialog(other_path, source, + account_added_callback.Get()); + testing::Mock::VerifyAndClearExpectations(&account_added_callback); + testing::Mock::VerifyAndClearExpectations(mock_facade()); +}
diff --git a/chrome/browser/lacros/identity_manager_lacros.cc b/chrome/browser/lacros/identity_manager_lacros.cc new file mode 100644 index 0000000..c74ea84 --- /dev/null +++ b/chrome/browser/lacros/identity_manager_lacros.cc
@@ -0,0 +1,60 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/lacros/identity_manager_lacros.h" + +#include "chromeos/lacros/lacros_service.h" + +namespace { + +using RemoteMinVersions = crosapi::mojom::IdentityManager::MethodMinVersions; + +chromeos::LacrosService* GetLacrosService(int min_version, + const std::string& function_name) { + chromeos::LacrosService* service = chromeos::LacrosService::Get(); + if (!service) + return nullptr; + int interface_version = + service->GetInterfaceVersion(crosapi::mojom::IdentityManager::Uuid_); + if (interface_version < min_version) { + DLOG(ERROR) << "Unsupported ash version for " << function_name; + return nullptr; + } + + return service; +} + +} // namespace + +IdentityManagerLacros::IdentityManagerLacros() {} + +IdentityManagerLacros::~IdentityManagerLacros() = default; + +void IdentityManagerLacros::GetAccountFullName( + const std::string& gaia_id, + crosapi::mojom::IdentityManager::GetAccountFullNameCallback callback) { + chromeos::LacrosService* service = GetLacrosService( + RemoteMinVersions::kGetAccountFullNameMinVersion, "GetAccountFullName"); + if (!service) { + std::move(callback).Run(""); + return; + } + + service->GetRemote<crosapi::mojom::IdentityManager>()->GetAccountFullName( + gaia_id, std::move(callback)); +} + +void IdentityManagerLacros::GetAccountImage( + const std::string& gaia_id, + crosapi::mojom::IdentityManager::GetAccountImageCallback callback) { + chromeos::LacrosService* service = GetLacrosService( + RemoteMinVersions::kGetAccountImageMinVersion, "GetAccountImage"); + if (!service) { + std::move(callback).Run(gfx::ImageSkia()); + return; + } + + service->GetRemote<crosapi::mojom::IdentityManager>()->GetAccountImage( + gaia_id, std::move(callback)); +}
diff --git a/chrome/browser/lacros/identity_manager_lacros.h b/chrome/browser/lacros/identity_manager_lacros.h new file mode 100644 index 0000000..24150662 --- /dev/null +++ b/chrome/browser/lacros/identity_manager_lacros.h
@@ -0,0 +1,29 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_LACROS_IDENTITY_MANAGER_LACROS_H_ +#define CHROME_BROWSER_LACROS_IDENTITY_MANAGER_LACROS_H_ + +#include "chromeos/crosapi/mojom/identity_manager.mojom.h" + +// This class can be used by lacros to access the identity manager crosapi. +// This API can be used to access properties of the identity manager which lives +// in ash, e.g. to access the name of an account that is not yet known by +// lacros. +class IdentityManagerLacros { + public: + IdentityManagerLacros(); + IdentityManagerLacros(const IdentityManagerLacros&) = delete; + IdentityManagerLacros& operator=(const IdentityManagerLacros&) = delete; + ~IdentityManagerLacros(); + + static void GetAccountFullName( + const std::string& gaia_id, + crosapi::mojom::IdentityManager::GetAccountFullNameCallback callback); + static void GetAccountImage( + const std::string& gaia_id, + crosapi::mojom::IdentityManager::GetAccountImageCallback callback); +}; + +#endif // CHROME_BROWSER_LACROS_IDENTITY_MANAGER_LACROS_H_
diff --git a/chrome/browser/media/webrtc/media_stream_permission_browsertest.cc b/chrome/browser/media/webrtc/media_stream_permission_interactive_uitest.cc similarity index 79% rename from chrome/browser/media/webrtc/media_stream_permission_browsertest.cc rename to chrome/browser/media/webrtc/media_stream_permission_interactive_uitest.cc index 5e38d7a3..854cd4b 100644 --- a/chrome/browser/media/webrtc/media_stream_permission_browsertest.cc +++ b/chrome/browser/media/webrtc/media_stream_permission_interactive_uitest.cc
@@ -71,6 +71,8 @@ HostContentSettingsMapFactory::GetForProfile(browser()->profile()); content::WebContents* tab_contents = LoadTestPageInTab(); + ASSERT_EQ(tab_contents, + browser()->tab_strip_model()->GetActiveWebContents()); EXPECT_TRUE(GetUserMediaWithSpecificConstraintsAndAcceptIfPrompted( tab_contents, constraints)); @@ -126,39 +128,34 @@ // Actual tests --------------------------------------------------------------- -// Entire test suite is flaky: https://crbug.com/1252385 -IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, - DISABLED_TestAllowingUserMedia) { +IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, TestAllowingUserMedia) { content::WebContents* tab_contents = LoadTestPageInTab(); + ASSERT_EQ(tab_contents, browser()->tab_strip_model()->GetActiveWebContents()); EXPECT_TRUE(GetUserMediaAndAccept(tab_contents)); } -// Entire test suite is flaky: https://crbug.com/1252385 -IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, - DISABLED_TestDenyingUserMedia) { +IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, TestDenyingUserMedia) { content::WebContents* tab_contents = LoadTestPageInTab(); + ASSERT_EQ(tab_contents, browser()->tab_strip_model()->GetActiveWebContents()); GetUserMediaAndDeny(tab_contents); } -// Entire test suite is flaky: https://crbug.com/1252385 -IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, - DISABLED_TestDismissingRequest) { +IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, TestDismissingRequest) { content::WebContents* tab_contents = LoadTestPageInTab(); + ASSERT_EQ(tab_contents, browser()->tab_strip_model()->GetActiveWebContents()); GetUserMediaAndDismiss(tab_contents); } -// TODO(crbug.com/1251470): Fix the issue on Lacros and enable the test. -// Entire test suite is flaky: https://crbug.com/1252385 IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, - DISABLED_TestDenyingUserMediaIncognito) { + TestDenyingUserMediaIncognito) { content::WebContents* tab_contents = LoadTestPageInIncognitoTab(); GetUserMediaAndDeny(tab_contents); } -// Entire test suite is flaky: https://crbug.com/1252385 IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, - DISABLED_TestSecureOriginDenyIsSticky) { + TestSecureOriginDenyIsSticky) { content::WebContents* tab_contents = LoadTestPageInTab(); + ASSERT_EQ(tab_contents, browser()->tab_strip_model()->GetActiveWebContents()); EXPECT_TRUE(network::IsUrlPotentiallyTrustworthy( tab_contents->GetLastCommittedURL())); @@ -166,30 +163,29 @@ GetUserMediaAndExpectAutoDenyWithoutPrompt(tab_contents); } -// Entire test suite is flaky: https://crbug.com/1252385 IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, - DISABLED_TestSecureOriginAcceptIsSticky) { + TestSecureOriginAcceptIsSticky) { content::WebContents* tab_contents = LoadTestPageInTab(); EXPECT_TRUE(network::IsUrlPotentiallyTrustworthy( tab_contents->GetLastCommittedURL())); + ASSERT_EQ(tab_contents, browser()->tab_strip_model()->GetActiveWebContents()); EXPECT_TRUE(GetUserMediaAndAccept(tab_contents)); GetUserMediaAndExpectAutoAcceptWithoutPrompt(tab_contents); } -// Entire test suite is flaky: https://crbug.com/1252385 -IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, - DISABLED_TestDismissIsNotSticky) { +IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, TestDismissIsNotSticky) { content::WebContents* tab_contents = LoadTestPageInTab(); + ASSERT_EQ(tab_contents, browser()->tab_strip_model()->GetActiveWebContents()); GetUserMediaAndDismiss(tab_contents); GetUserMediaAndDismiss(tab_contents); } -// Entire test suite is flaky: https://crbug.com/1252385 IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, - DISABLED_TestDenyingThenClearingStickyException) { + TestDenyingThenClearingStickyException) { content::WebContents* tab_contents = LoadTestPageInTab(); + ASSERT_EQ(tab_contents, browser()->tab_strip_model()->GetActiveWebContents()); GetUserMediaAndDeny(tab_contents); GetUserMediaAndExpectAutoDenyWithoutPrompt(tab_contents); @@ -201,13 +197,14 @@ settings_map->ClearSettingsForOneType( ContentSettingsType::MEDIASTREAM_CAMERA); + ASSERT_EQ(tab_contents, browser()->tab_strip_model()->GetActiveWebContents()); GetUserMediaAndDeny(tab_contents); } -// Entire test suite is flaky: https://crbug.com/1252385 IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, - DISABLED_DenyingMicDoesNotCauseStickyDenyForCameras) { + DenyingMicDoesNotCauseStickyDenyForCameras) { content::WebContents* tab_contents = LoadTestPageInTab(); + ASSERT_EQ(tab_contents, browser()->tab_strip_model()->GetActiveWebContents()); GetUserMediaWithSpecificConstraintsAndDeny(tab_contents, kAudioOnlyCallConstraints); @@ -215,10 +212,10 @@ tab_contents, kVideoOnlyCallConstraints)); } -// Entire test suite is flaky: https://crbug.com/1252385 IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, - DISABLED_DenyingCameraDoesNotCauseStickyDenyForMics) { + DenyingCameraDoesNotCauseStickyDenyForMics) { content::WebContents* tab_contents = LoadTestPageInTab(); + ASSERT_EQ(tab_contents, browser()->tab_strip_model()->GetActiveWebContents()); GetUserMediaWithSpecificConstraintsAndDeny(tab_contents, kVideoOnlyCallConstraints); @@ -226,36 +223,29 @@ tab_contents, kAudioOnlyCallConstraints)); } -// TODO(crbug.com/1204412) Disabled because the original test was only passing -// due to a bug in the code. Now that the bug is fixed, the test is not passing -// anymore. -// Entire test suite is flaky: https://crbug.com/1252385 IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, - DISABLED_DenyingCameraPermissionStopsAVStream) { + DenyingCameraPermissionStopsAVStream) { TestPermissionDenialEffectOnStream(kAudioVideoCallConstraints, ContentSettingsType::MEDIASTREAM_CAMERA, true /* should_video_stop */); } -// Entire test suite is flaky: https://crbug.com/1252385 IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, - DISABLED_DenyingMicPermissionStopsAVStream) { + DenyingMicPermissionStopsAVStream) { TestPermissionDenialEffectOnStream(kAudioVideoCallConstraints, ContentSettingsType::MEDIASTREAM_MIC, true /* should_video_stop */); } -// Entire test suite is flaky: https://crbug.com/1252385 IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, - DISABLED_DenyingCameraPermissionStopsVideoOnlyStream) { + DenyingCameraPermissionStopsVideoOnlyStream) { TestPermissionDenialEffectOnStream(kVideoOnlyCallConstraints, ContentSettingsType::MEDIASTREAM_CAMERA, true /* should_video_stop */); } -// Entire test suite is flaky: https://crbug.com/1252385 IN_PROC_BROWSER_TEST_F(MediaStreamPermissionTest, - DISABLED_DenyingMicPermissionDoesntStopVideoOnlyStream) { + DenyingMicPermissionDoesntStopVideoOnlyStream) { TestPermissionDenialEffectOnStream(kVideoOnlyCallConstraints, ContentSettingsType::MEDIASTREAM_MIC, false /* should_video_stop */);
diff --git a/chrome/browser/page_info/OWNERS b/chrome/browser/page_info/OWNERS new file mode 100644 index 0000000..7c601fd --- /dev/null +++ b/chrome/browser/page_info/OWNERS
@@ -0,0 +1 @@ +file://chrome/browser/ui/page_info/OWNERS
diff --git a/chrome/browser/page_info/about_this_site_service_factory.cc b/chrome/browser/page_info/about_this_site_service_factory.cc new file mode 100644 index 0000000..803b2ab2 --- /dev/null +++ b/chrome/browser/page_info/about_this_site_service_factory.cc
@@ -0,0 +1,52 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/page_info/about_this_site_service_factory.h" + +#include <memory> + +#include "base/feature_list.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h" +#include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h" +#include "chrome/browser/page_info/chrome_about_this_site_service_client.h" +#include "chrome/browser/profiles/profile.h" +#include "components/keyed_service/content/browser_context_dependency_manager.h" +#include "components/page_info/about_this_site_service.h" +#include "components/page_info/features.h" +#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/browser_thread.h" + +// static +page_info::AboutThisSiteService* AboutThisSiteServiceFactory::GetForProfile( + Profile* profile) { + return static_cast<page_info::AboutThisSiteService*>( + GetInstance()->GetServiceForBrowserContext(profile, /*create=*/true)); +} +// static +AboutThisSiteServiceFactory* AboutThisSiteServiceFactory::GetInstance() { + static base::NoDestructor<AboutThisSiteServiceFactory> factory; + return factory.get(); +} + +AboutThisSiteServiceFactory::AboutThisSiteServiceFactory() + : BrowserContextKeyedServiceFactory( + "AboutThisSiteServiceFactory", + BrowserContextDependencyManager::GetInstance()) { + DependsOn(OptimizationGuideKeyedServiceFactory::GetInstance()); +} + +AboutThisSiteServiceFactory::~AboutThisSiteServiceFactory() = default; + +// BrowserContextKeyedServiceFactory: +KeyedService* AboutThisSiteServiceFactory::BuildServiceInstanceFor( + content::BrowserContext* browser_context) const { + if (!base::FeatureList::IsEnabled(page_info::kPageInfoAboutThisSite)) + return nullptr; + + Profile* profile = Profile::FromBrowserContext(browser_context); + return new page_info::AboutThisSiteService( + std::make_unique<ChromeAboutThisSiteServiceClient>( + OptimizationGuideKeyedServiceFactory::GetForProfile(profile))); +}
diff --git a/chrome/browser/page_info/about_this_site_service_factory.h b/chrome/browser/page_info/about_this_site_service_factory.h new file mode 100644 index 0000000..bc51abb --- /dev/null +++ b/chrome/browser/page_info/about_this_site_service_factory.h
@@ -0,0 +1,39 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_PAGE_INFO_ABOUT_THIS_SITE_SERVICE_FACTORY_H_ +#define CHROME_BROWSER_PAGE_INFO_ABOUT_THIS_SITE_SERVICE_FACTORY_H_ + +#include "base/no_destructor.h" +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" + +class Profile; + +namespace page_info { +class AboutThisSiteService; +} + +// This factory helps construct and find the AboutThisSiteService instance for a +// Profile. +class AboutThisSiteServiceFactory : public BrowserContextKeyedServiceFactory { + public: + static page_info::AboutThisSiteService* GetForProfile(Profile* profile); + static AboutThisSiteServiceFactory* GetInstance(); + + AboutThisSiteServiceFactory(const AboutThisSiteServiceFactory&) = delete; + AboutThisSiteServiceFactory& operator=(const AboutThisSiteServiceFactory&) = + delete; + + private: + friend class base::NoDestructor<AboutThisSiteServiceFactory>; + + AboutThisSiteServiceFactory(); + ~AboutThisSiteServiceFactory() override; + + // BrowserContextKeyedServiceFactory: + KeyedService* BuildServiceInstanceFor( + content::BrowserContext* profile) const override; +}; + +#endif // CHROME_BROWSER_PAGE_INFO_ABOUT_THIS_SITE_SERVICE_FACTORY_H_
diff --git a/chrome/browser/page_info/chrome_about_this_site_service_client.cc b/chrome/browser/page_info/chrome_about_this_site_service_client.cc new file mode 100644 index 0000000..d78c39e --- /dev/null +++ b/chrome/browser/page_info/chrome_about_this_site_service_client.cc
@@ -0,0 +1,29 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/page_info/chrome_about_this_site_service_client.h" + +#include <memory> + +#include "components/optimization_guide/core/optimization_metadata.h" + +ChromeAboutThisSiteServiceClient::ChromeAboutThisSiteServiceClient( + optimization_guide::OptimizationGuideDecider* optimization_guide_decider) + : optimization_guide_decider_(optimization_guide_decider) { + if (optimization_guide_decider_) { + optimization_guide_decider_->RegisterOptimizationTypes( + {optimization_guide::proto::ABOUT_THIS_SITE}); + } +} + +ChromeAboutThisSiteServiceClient::~ChromeAboutThisSiteServiceClient() = default; + +optimization_guide::OptimizationGuideDecision +ChromeAboutThisSiteServiceClient::CanApplyOptimization( + const GURL& url, + optimization_guide::OptimizationMetadata* optimization_metadata) { + // TODO(crbug.com/1250653): Call CanApplyOptimization method of + // `optimization_guide_decider_` after proto is added. + return optimization_guide::OptimizationGuideDecision::kUnknown; +}
diff --git a/chrome/browser/page_info/chrome_about_this_site_service_client.h b/chrome/browser/page_info/chrome_about_this_site_service_client.h new file mode 100644 index 0000000..796239e9 --- /dev/null +++ b/chrome/browser/page_info/chrome_about_this_site_service_client.h
@@ -0,0 +1,34 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_PAGE_INFO_CHROME_ABOUT_THIS_SITE_SERVICE_CLIENT_H_ +#define CHROME_BROWSER_PAGE_INFO_CHROME_ABOUT_THIS_SITE_SERVICE_CLIENT_H_ + +#include "components/optimization_guide/content/browser/optimization_guide_decider.h" +#include "components/page_info/about_this_site_service.h" + +class ChromeAboutThisSiteServiceClient + : public page_info::AboutThisSiteService::Client { + public: + // `optimization_guide_decider` may be nullptr. + explicit ChromeAboutThisSiteServiceClient( + optimization_guide::OptimizationGuideDecider* optimization_guide_decider); + ~ChromeAboutThisSiteServiceClient() override; + + ChromeAboutThisSiteServiceClient(const ChromeAboutThisSiteServiceClient&) = + delete; + ChromeAboutThisSiteServiceClient& operator=( + const ChromeAboutThisSiteServiceClient&) = delete; + + // page_info::AboutThisSiteService::Client: + optimization_guide::OptimizationGuideDecision CanApplyOptimization( + const GURL& url, + optimization_guide::OptimizationMetadata* optimization_metadata) override; + + private: + optimization_guide::OptimizationGuideDecider* const + optimization_guide_decider_; +}; + +#endif // CHROME_BROWSER_PAGE_INFO_CHROME_ABOUT_THIS_SITE_SERVICE_CLIENT_H_
diff --git a/chrome/browser/policy/extension_force_install_mixin.h b/chrome/browser/policy/extension_force_install_mixin.h index 99ff4ab6..be8635cd 100644 --- a/chrome/browser/policy/extension_force_install_mixin.h +++ b/chrome/browser/policy/extension_force_install_mixin.h
@@ -43,22 +43,22 @@ #endif // BUILDFLAG(IS_CHROMEOS_ASH) -// A mixin that allows to force-install an extension/app via the device policy. +// A mixin that allows to force-install an extension/app via user or device +// policy. // // Encapsulates the following operations: // * generating a CRX file, // * generating an update manifest, // * hosting the update manifest and the CRX via an embedded test server, -// * configuring the force installation in the device policy. +// * configuring the force installation in the user/device policy. // -// Example usage (for force-installing into the sign-in profile using the device -// policy): +// Example usage (for force-installing using the user-level policy): // // class MyTestFixture : ... { // protected: // void SetUpOnMainThread() override { // ... -// force_install_mixin_.InitWithDevicePolicyCrosTestHelper(...); +// force_install_mixin_.InitWithMockPolicyProvider(...); // } // ExtensionForceInstallMixin force_install_mixin_{&mixin_host_}; // }; @@ -72,7 +72,7 @@ // * "/<extension_id>-<version>.crx" - CRX packages referred to by the update // manifests. // -// TODO(crbug.com/1090941): Add user policy, auto update. +// TODO(crbug.com/1090941): Add auto update. class ExtensionForceInstallMixin final : public InProcessBrowserTestMixin { public: // The type of the waiting mode for the force installation operation.
diff --git a/chrome/browser/policy/messaging_layer/util/heartbeat_event.cc b/chrome/browser/policy/messaging_layer/util/heartbeat_event.cc index b2c05df..4527c2e 100644 --- a/chrome/browser/policy/messaging_layer/util/heartbeat_event.cc +++ b/chrome/browser/policy/messaging_layer/util/heartbeat_event.cc
@@ -13,8 +13,6 @@ #include "build/buildflag.h" #include "chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.h" #include "components/keyed_service/core/keyed_service.h" -#include "components/policy/core/common/cloud/cloud_policy_manager.h" -#include "components/policy/core/common/cloud/cloud_policy_service.h" #include "components/reporting/proto/record_constants.pb.h" #include "components/reporting/util/status.h" #include "components/reporting/util/task_runner_context.h" @@ -27,30 +25,7 @@ } // namespace -HeartbeatEvent::CloudPolicyServiceObserver::CloudPolicyServiceObserver( - base::RepeatingCallback<void()> start_heartbeat_event) - : start_heartbeat_event_(std::move(start_heartbeat_event)) {} - -HeartbeatEvent::CloudPolicyServiceObserver::~CloudPolicyServiceObserver() = - default; - -void HeartbeatEvent::CloudPolicyServiceObserver:: - OnCloudPolicyServiceInitializationCompleted() { - std::move(start_heartbeat_event_).Run(); -} - -HeartbeatEvent::HeartbeatEvent(policy::CloudPolicyManager* manager) - : manager_(manager) { - if (!manager_->core()->service()->IsInitializationComplete()) { - // base::Unretained is safe here because cloud_policy_service_observer_ will - // be destroyed before HeartbeatEvent. - cloud_policy_service_observer_ = - std::make_unique<CloudPolicyServiceObserver>(base::BindRepeating( - &HeartbeatEvent::HandleNotification, base::Unretained(this))); - manager_->core()->service()->AddObserver( - cloud_policy_service_observer_.get()); - return; - } +HeartbeatEvent::HeartbeatEvent() { StartHeartbeatEvent(); } @@ -59,20 +34,6 @@ } void HeartbeatEvent::Shutdown() { - if (cloud_policy_service_observer_) { - manager_->core()->service()->RemoveObserver( - cloud_policy_service_observer_.get()); - cloud_policy_service_observer_.reset(); - } -} - -void HeartbeatEvent::HandleNotification() { - bool expected = false; - if (!notified_.compare_exchange_strong(expected, /*desired=*/true)) { - return; - } - Shutdown(); - StartHeartbeatEvent(); } void HeartbeatEvent::StartHeartbeatEvent() const {
diff --git a/chrome/browser/policy/messaging_layer/util/heartbeat_event.h b/chrome/browser/policy/messaging_layer/util/heartbeat_event.h index 1f9395d..480955d9 100644 --- a/chrome/browser/policy/messaging_layer/util/heartbeat_event.h +++ b/chrome/browser/policy/messaging_layer/util/heartbeat_event.h
@@ -7,56 +7,23 @@ #include "base/feature_list.h" #include "components/keyed_service/core/keyed_service.h" -#include "components/policy/core/common/cloud/cloud_policy_manager.h" -#include "components/policy/core/common/cloud/cloud_policy_service.h" namespace reporting { class HeartbeatEvent : public KeyedService { public: - class CloudPolicyServiceObserver - : public policy::CloudPolicyService::Observer { - public: - explicit CloudPolicyServiceObserver( - base::RepeatingCallback<void()> start_heartbeat_event); - ~CloudPolicyServiceObserver() override; - - void OnCloudPolicyServiceInitializationCompleted() override; - - private: - // We take a RepeatingCallback instead of a OnceCallback in case there is - // are multiple calls before we can unsubscribe from the observer list. - base::RepeatingCallback<void()> start_heartbeat_event_; - }; - - explicit HeartbeatEvent(policy::CloudPolicyManager* manager); + HeartbeatEvent(); ~HeartbeatEvent() override; // KeyedService void Shutdown() override; private: - // Passed to the CloudPolicyServiceObserver as a RepeatingCallback calls - // Shutdown to ensure the observer is removed from the observer list and then - // destroys |cloud_policy_service_observer_| before calling - // StartHeartbeatEvent. - void HandleNotification(); // Starts a self-managed ReportQueueManualTestContext running on its own // SequencedTaskRunner. Will upload ten records to the HEARTBEAT_EVENTS // Destination and delete itself. void StartHeartbeatEvent() const; - - // Holds the CloudPolicyService which knows when CloudPolicyClient is - // available. - policy::CloudPolicyManager* manager_; - - // Observer for CloudPolicyService, only used if it has not been initialized - // by the time we are called. - std::unique_ptr<CloudPolicyServiceObserver> cloud_policy_service_observer_; - - // Blocks additional calls on HandleNotification. - std::atomic<bool> notified_{false}; }; } // namespace reporting
diff --git a/chrome/browser/policy/messaging_layer/util/heartbeat_event_factory.cc b/chrome/browser/policy/messaging_layer/util/heartbeat_event_factory.cc index 711aef1..a07c58e 100644 --- a/chrome/browser/policy/messaging_layer/util/heartbeat_event_factory.cc +++ b/chrome/browser/policy/messaging_layer/util/heartbeat_event_factory.cc
@@ -4,17 +4,9 @@ #include "chrome/browser/policy/messaging_layer/util/heartbeat_event_factory.h" -#include "build/chromeos_buildflags.h" #include "chrome/browser/policy/messaging_layer/util/heartbeat_event.h" -#include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" -#if BUILDFLAG(IS_CHROMEOS_ASH) -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" -#else -#include "components/policy/core/common/cloud/user_cloud_policy_manager.h" -#endif - namespace reporting { HeartbeatEventFactory* HeartbeatEventFactory::GetInstance() { @@ -30,20 +22,7 @@ KeyedService* HeartbeatEventFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { - Profile* profile = static_cast<Profile*>(context); - -#if BUILDFLAG(IS_CHROMEOS_ASH) - policy::UserCloudPolicyManagerAsh* manager = - profile->GetUserCloudPolicyManagerAsh(); -#else - policy::UserCloudPolicyManager* manager = - profile->GetUserCloudPolicyManager(); -#endif - - if (!manager) { - return nullptr; - } - return new HeartbeatEvent(manager); + return new HeartbeatEvent(); } bool HeartbeatEventFactory::ServiceIsCreatedWithBrowserContext() const {
diff --git a/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.cc b/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.cc index 77122d3..3ff529e 100644 --- a/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.cc +++ b/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.cc
@@ -9,18 +9,12 @@ #include "base/sequenced_task_runner.h" #include "base/strings/string_number_conversions.h" #include "base/time/time.h" -#include "chrome/browser/policy/dm_token_utils.h" -#include "chrome/browser/profiles/profile_manager.h" -#include "components/policy/core/common/cloud/dm_token.h" #include "components/reporting/client/report_queue.h" #include "components/reporting/client/report_queue_configuration.h" #include "components/reporting/client/report_queue_provider.h" #include "components/reporting/proto/record_constants.pb.h" #include "components/reporting/util/status.h" #include "components/reporting/util/task_runner_context.h" -#include "content/public/browser/browser_task_traits.h" -#include "content/public/browser/browser_thread.h" -#include "third_party/abseil-cpp/absl/types/optional.h" namespace reporting { @@ -36,7 +30,10 @@ frequency_(frequency), number_of_messages_to_enqueue_(number_of_messages_to_enqueue), destination_(destination), - priority_(priority) {} + priority_(priority), + report_queue_(std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter>( + nullptr, + base::OnTaskRunnerDeleter(sequenced_task_runner))) {} ReportQueueManualTestContext::~ReportQueueManualTestContext() = default; @@ -62,30 +59,8 @@ return; } - // The DMToken must be retrieved on the UI thread. - content::GetUIThreadTaskRunner({})->PostTask( - FROM_HERE, base::BindOnce(&ReportQueueManualTestContext::GetDmToken, - base::Unretained(this))); -} - -void ReportQueueManualTestContext::GetDmToken() { - const policy::DMToken dm_token = - policy::GetDMToken(ProfileManager::GetPrimaryUserProfile()); - Schedule(&ReportQueueManualTestContext::OnDmTokenResponse, - base::Unretained(this), dm_token); -} - -void ReportQueueManualTestContext::OnDmTokenResponse(policy::DMToken dm_token) { - CheckOnValidSequence(); - if (!dm_token.is_valid()) { - Status invalid_dm_token = - Status(error::FAILED_PRECONDITION, "Cannot retrieve a valid DMToken"); - LOG(ERROR) << invalid_dm_token; - Complete(invalid_dm_token); - return; - } - dm_token_ = dm_token; - BuildReportQueue(); + Schedule(&ReportQueueManualTestContext::BuildReportQueue, + base::Unretained(this)); } void ReportQueueManualTestContext::BuildReportQueue() { @@ -93,7 +68,9 @@ ReportQueueConfiguration::PolicyCheckCallback policy_check_cb = base::BindRepeating([]() -> Status { return Status::StatusOK(); }); auto config_result = reporting::ReportQueueConfiguration::Create( - dm_token_.value(), destination_, std::move(policy_check_cb)); + // using an empty DM token cause device DM tokens are appended by default + // during event uploads + /*dm_token=*/"", destination_, std::move(policy_check_cb)); if (!config_result.ok()) { Complete(config_result.status()); return; @@ -108,14 +85,16 @@ return; } - reporting::ReportQueueProvider::CreateQueue( - std::move(config_result.ValueOrDie()), - base::BindOnce(&ReportQueueManualTestContext::OnReportQueueResponse, - base::Unretained(this))); + auto report_queue_result = + reporting::ReportQueueProvider::CreateSpeculativeQueue( + std::move(config_result.ValueOrDie())); + Schedule(&ReportQueueManualTestContext::OnReportQueueResponse, + base::Unretained(this), std::move(report_queue_result)); } void ReportQueueManualTestContext::OnReportQueueResponse( - StatusOr<std::unique_ptr<ReportQueue>> report_queue_result) { + StatusOr<std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter>> + report_queue_result) { if (!report_queue_result.ok()) { Complete(report_queue_result.status()); return;
diff --git a/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.h b/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.h index 00b3faf..f9fa66df 100644 --- a/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.h +++ b/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.h
@@ -17,10 +17,10 @@ namespace reporting { -// This is a test fixture for manually testing uploading of events. Should only -// be used when debugging or testing. It will enqueue an incrementing uint64 -// every |frequency| for the provided destination. All messages will be sent as -// FAST_BATCH. +// This is a test fixture for manually testing uploading of device events. +// Should only be used when debugging or testing. It will enqueue an +// incrementing uint64 every |frequency| for the provided destination. All +// messages will be sent as FAST_BATCH. // // This context can be used in the following way: // Start<ReportQueueManualTestContext>(base::TimeDelta::FromSeconds(1), @@ -35,12 +35,17 @@ // base::TaskTraits())); // As configured this context will create a ReportQueue and upload an event // to the FAST_BATCH priority every second for 10 seconds. +// +// This context does not support user events today, but support for user events +// may be added later, if necessary. Note however, that for user events +// respective DM token needs to be supplied. class ReportQueueManualTestContext : public TaskRunnerContext<Status> { public: using CompletionCallback = base::OnceCallback<void(Status)>; using BuildReportQueueCallback = base::OnceCallback<void( std::unique_ptr<ReportQueueConfiguration>, - base::OnceCallback<void(StatusOr<std::unique_ptr<ReportQueue>>)>)>; + base::OnceCallback<void( + StatusOr<std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter>>)>)>; ReportQueueManualTestContext( base::TimeDelta frequency, @@ -60,11 +65,10 @@ void OnStart() override; - void GetDmToken(); - void OnDmTokenResponse(policy::DMToken dm_token); void BuildReportQueue(); void OnReportQueueResponse( - StatusOr<std::unique_ptr<ReportQueue>> report_queue_result); + StatusOr<std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter>> + report_queue_result); void ScheduleEnqueue(); void Enqueue(); void OnEnqueue(Status status); @@ -92,8 +96,8 @@ // on sequence. uint64_t value_{0u}; - policy::DMToken dm_token_; - std::unique_ptr<ReportQueue> report_queue_; + // Speculative report queue used to queue events + std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter> report_queue_; }; } // namespace reporting
diff --git a/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context_unittest.cc b/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context_unittest.cc index 1049a07..98daefb 100644 --- a/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context_unittest.cc +++ b/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context_unittest.cc
@@ -4,6 +4,10 @@ #include "chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.h" +#include "base/bind.h" +#include "base/memory/scoped_refptr.h" +#include "base/sequenced_task_runner.h" +#include "base/task/task_traits.h" #include "base/task/thread_pool.h" #include "base/task_runner.h" #include "base/test/task_environment.h" @@ -11,10 +15,10 @@ #include "components/policy/core/common/cloud/dm_token.h" #include "components/reporting/client/mock_report_queue.h" #include "components/reporting/client/report_queue.h" +#include "components/reporting/client/report_queue_configuration.h" #include "components/reporting/proto/record_constants.pb.h" #include "components/reporting/util/status.h" #include "components/reporting/util/test_support_callbacks.h" -#include "content/public/test/browser_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -27,20 +31,21 @@ class ReportQueueManualTestContextTest : public testing::Test { protected: - ReportQueueManualTestContextTest() = default; + const Priority kPriority = Priority::FAST_BATCH; + const Destination kDestination = Destination::UPLOAD_EVENTS; + const uint64_t kNumberOfMessagesToEnqueue = 5; + const base::TimeDelta kMessageFrequency = base::TimeDelta::FromSeconds(1); void SetUp() override { - auto mock_report_queue = std::make_unique<reporting::MockReportQueue>(); - mock_report_queue_ = mock_report_queue.get(); - + task_runner_ = + base::ThreadPool::CreateSequencedTaskRunner(base::TaskTraits()); + mock_report_queue_ = + std::unique_ptr<reporting::MockReportQueue, base::OnTaskRunnerDeleter>( + new reporting::MockReportQueue(), + base::OnTaskRunnerDeleter(task_runner_)); auto build_report_queue_cb = base::BindOnce( - [](std::unique_ptr<ReportQueue> report_queue, - std::unique_ptr<ReportQueueConfiguration> report_queue_config, - base::OnceCallback<void(StatusOr<std::unique_ptr<ReportQueue>>)> - report_queue_cb) { - std::move(report_queue_cb).Run(std::move(report_queue)); - }, - std::move(mock_report_queue)); + &ReportQueueManualTestContextTest::BuildReportQueueCallback, + base::Unretained(this)); ReportQueueManualTestContext::SetBuildReportQueueCallbackForTests( std::move(build_report_queue_cb)); @@ -49,19 +54,28 @@ policy::DMToken::CreateValidTokenForTesting("ABCDEF")); } - const Priority priority_ = Priority::FAST_BATCH; - const Destination destination_ = Destination::UPLOAD_EVENTS; - reporting::MockReportQueue* mock_report_queue_; + void BuildReportQueueCallback( + std::unique_ptr<ReportQueueConfiguration> report_queue_config, + base::OnceCallback<void( + StatusOr<std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter>>)> + report_queue_cb) { + std::move(report_queue_cb).Run(std::move(mock_report_queue_)); + dm_token_ = std::move(report_queue_config)->dm_token(); + } - content::BrowserTaskEnvironment task_environment_{ - base::test::TaskEnvironment::TimeSource::SYSTEM_TIME}; + std::unique_ptr<reporting::MockReportQueue, base::OnTaskRunnerDeleter> + mock_report_queue_ = std::unique_ptr<reporting::MockReportQueue, + base::OnTaskRunnerDeleter>( + nullptr, + base::OnTaskRunnerDeleter(nullptr)); + + std::string dm_token_; + scoped_refptr<base::SequencedTaskRunner> task_runner_; + base::test::TaskEnvironment task_environment_; }; TEST_F(ReportQueueManualTestContextTest, - BuildsReportQueueManualTestContextAndUploadsMessages) { - uint64_t kNumberOfMessagesToEnqueue = 5; - base::TimeDelta kFrequency = base::TimeDelta::FromSeconds(1); - + BuildsReportQueueManualTestContextAndUploadsDeviceEventMessages) { EXPECT_CALL(*mock_report_queue_, AddRecord(_, _, _)) .Times(kNumberOfMessagesToEnqueue) .WillRepeatedly( @@ -71,12 +85,12 @@ test::TestEvent<Status> completion_event; Start<ReportQueueManualTestContext>( - kFrequency, kNumberOfMessagesToEnqueue, destination_, priority_, - completion_event.cb(), - base::ThreadPool::CreateSequencedTaskRunner(base::TaskTraits())); + kMessageFrequency, kNumberOfMessagesToEnqueue, kDestination, kPriority, + completion_event.cb(), task_runner_); const Status status = completion_event.result(); EXPECT_OK(status) << status; + EXPECT_THAT(dm_token_, testing::IsEmpty()); } } // namespace
diff --git a/chrome/browser/printing/print_browsertest.cc b/chrome/browser/printing/print_browsertest.cc index c025776..a6cec98 100644 --- a/chrome/browser/printing/print_browsertest.cc +++ b/chrome/browser/printing/print_browsertest.cc
@@ -375,6 +375,98 @@ std::unique_ptr<PrintSettings> snooped_settings_; }; +class TestPrintViewManagerForDLP : public TestPrintViewManager { + public: + // Used to simulate Data Leak Prevention polices and possible user actions. + enum class RestrictionLevel { + // No DLP restrictions set - printing is allowed. + kNotSet, + // The user is warned and selects "continue" - printing is allowed. + kWarnAllow, + // The user is warned and selects "cancel" - printing is not allowed. + kWarnCancel, + // Printing is blocked, no print preview is shown. + kBlock, + }; + + static TestPrintViewManagerForDLP* CreateForWebContents( + content::WebContents* web_contents, + RestrictionLevel restriction_level) { + auto manager = std::make_unique<TestPrintViewManagerForDLP>( + web_contents, restriction_level); + auto* manager_ptr = manager.get(); + web_contents->SetUserData(PrintViewManager::UserDataKey(), + std::move(manager)); + return manager_ptr; + } + + // Used by the TestPrintViewManagerForDLP to check that the correct action is + // taken based on the restriction level. + enum class PrintAllowance { + // No checks done yet to determine whether printing is allowed or not. + kUnknown, + // There are no restrictions/user allowed printing. + kAllowed, + // There are BLOCK restrictions or user canceled the printing. + kDisallowed, + }; + + TestPrintViewManagerForDLP(content::WebContents* web_contents, + RestrictionLevel restriction_level) + : TestPrintViewManager(web_contents), + restriction_level_(restriction_level) { + PrintViewManager::SetReceiverImplForTesting(this); + } + TestPrintViewManagerForDLP(const TestPrintViewManagerForDLP&) = delete; + TestPrintViewManagerForDLP& operator=(const TestPrintViewManagerForDLP&) = + delete; + ~TestPrintViewManagerForDLP() override { + PrintViewManager::SetReceiverImplForTesting(nullptr); + } + + void WaitUntilPreviewIsShownOrCancelled() { + base::RunLoop run_loop; + base::AutoReset<base::RunLoop*> auto_reset(&run_loop_, &run_loop); + run_loop.Run(); + } + + PrintAllowance GetPrintAllowance() const { return allowance_; } + + private: + bool IsPrintingRestricted() const override { + return restriction_level_ == RestrictionLevel::kBlock; + } + + bool ShouldWarnBeforePrinting() const override { + return restriction_level_ == RestrictionLevel::kWarnAllow || + restriction_level_ == RestrictionLevel::kWarnCancel; + } + + void ShowWarning( + base::OnceClosure on_print_preview_allowed_cb, + base::OnceClosure on_print_preview_rejected_cb) const override { + if (restriction_level_ == RestrictionLevel::kWarnAllow) { + std::move(on_print_preview_allowed_cb).Run(); + } else if (restriction_level_ == RestrictionLevel::kWarnCancel) { + std::move(on_print_preview_rejected_cb).Run(); + } + } + + void PrintPreviewRejectedForTesting() override { + run_loop_->Quit(); + allowance_ = PrintAllowance::kDisallowed; + } + + void PrintPreviewAllowedForTesting() override { + run_loop_->Quit(); + allowance_ = PrintAllowance::kAllowed; + } + + RestrictionLevel restriction_level_ = RestrictionLevel::kNotSet; + PrintAllowance allowance_ = PrintAllowance::kUnknown; + base::RunLoop* run_loop_ = nullptr; +}; + class PrintBrowserTest : public InProcessBrowserTest { public: PrintBrowserTest() = default; @@ -1024,6 +1116,163 @@ EXPECT_EQ(content::AreAllSitesIsolatedForTesting(), IsOopifEnabled()); } +#if BUILDFLAG(IS_CHROMEOS_ASH) +// Test that if user allows printing after being shown a warning due to DLP +// restrictions, the print preview is rendered. +IN_PROC_BROWSER_TEST_F(PrintBrowserTest, DLPWarnAllowed) { + ASSERT_TRUE(embedded_test_server()->Started()); + GURL url(embedded_test_server()->GetURL("/printing/test1.html")); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); + + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(web_contents); + // Set up the print view manager and DLP restrictions. + TestPrintViewManagerForDLP* print_view_manager = + TestPrintViewManagerForDLP::CreateForWebContents( + web_contents, + TestPrintViewManagerForDLP::RestrictionLevel::kWarnAllow); + + ASSERT_EQ(print_view_manager->GetPrintAllowance(), + TestPrintViewManagerForDLP::PrintAllowance::kUnknown); + StartPrint(browser()->tab_strip_model()->GetActiveWebContents(), + /*print_renderer=*/mojo::NullAssociatedRemote(), + /*print_preview_disabled=*/false, + /*print_only_selection=*/false); + print_view_manager->WaitUntilPreviewIsShownOrCancelled(); + ASSERT_EQ(print_view_manager->GetPrintAllowance(), + TestPrintViewManagerForDLP::PrintAllowance::kAllowed); +} + +// Test that if user cancels printing after being shown a warning due to DLP +// restrictions, the print preview is not rendered. +IN_PROC_BROWSER_TEST_F(PrintBrowserTest, DLPWarnCanceled) { + ASSERT_TRUE(embedded_test_server()->Started()); + GURL url(embedded_test_server()->GetURL("/printing/test1.html")); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); + + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(web_contents); + // Set up the print view manager and DLP restrictions. + TestPrintViewManagerForDLP* print_view_manager = + TestPrintViewManagerForDLP::CreateForWebContents( + web_contents, + TestPrintViewManagerForDLP::RestrictionLevel::kWarnCancel); + + ASSERT_EQ(print_view_manager->GetPrintAllowance(), + TestPrintViewManagerForDLP::PrintAllowance::kUnknown); + StartPrint(browser()->tab_strip_model()->GetActiveWebContents(), + /*print_renderer=*/mojo::NullAssociatedRemote(), + /*print_preview_disabled=*/false, + /*print_only_selection=*/false); + print_view_manager->WaitUntilPreviewIsShownOrCancelled(); + ASSERT_EQ(print_view_manager->GetPrintAllowance(), + TestPrintViewManagerForDLP::PrintAllowance::kDisallowed); +} + +// Test that if printing is blocked due to DLP restrictions, the print preview +// is not rendered. +IN_PROC_BROWSER_TEST_F(PrintBrowserTest, DLPBlocked) { + ASSERT_TRUE(embedded_test_server()->Started()); + GURL url(embedded_test_server()->GetURL("/printing/test1.html")); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); + + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(web_contents); + // Set up the print view manager and DLP restrictions. + TestPrintViewManagerForDLP* print_view_manager = + TestPrintViewManagerForDLP::CreateForWebContents( + web_contents, TestPrintViewManagerForDLP::RestrictionLevel::kBlock); + + ASSERT_EQ(print_view_manager->GetPrintAllowance(), + TestPrintViewManagerForDLP::PrintAllowance::kUnknown); + StartPrint(browser()->tab_strip_model()->GetActiveWebContents(), + /*print_renderer=*/mojo::NullAssociatedRemote(), + /*print_preview_disabled=*/false, + /*print_only_selection=*/false); + print_view_manager->WaitUntilPreviewIsShownOrCancelled(); + ASSERT_EQ(print_view_manager->GetPrintAllowance(), + TestPrintViewManagerForDLP::PrintAllowance::kDisallowed); +} + +// Test that if user allows printing after being shown a warning due to DLP +// restrictions, the print preview is rendered when initiated by window.print(). +IN_PROC_BROWSER_TEST_F(PrintBrowserTest, DLPWarnAllowedWithWindowDotPrint) { + ASSERT_TRUE(embedded_test_server()->Started()); + GURL url(embedded_test_server()->GetURL("/printing/test1.html")); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); + + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(web_contents); + + // Set up the print view manager and DLP restrictions. + TestPrintViewManagerForDLP* print_view_manager = + TestPrintViewManagerForDLP::CreateForWebContents( + web_contents, + TestPrintViewManagerForDLP::RestrictionLevel::kWarnAllow); + + ASSERT_EQ(print_view_manager->GetPrintAllowance(), + TestPrintViewManagerForDLP::PrintAllowance::kUnknown); + content::ExecuteScriptAsync(web_contents->GetMainFrame(), "window.print();"); + print_view_manager->WaitUntilPreviewIsShownOrCancelled(); + ASSERT_EQ(print_view_manager->GetPrintAllowance(), + TestPrintViewManagerForDLP::PrintAllowance::kAllowed); +} + +// Test that if user cancels printing after being shown a warning due to DLP +// restrictions, the print preview is not rendered when initiated by +// window.print(). +IN_PROC_BROWSER_TEST_F(PrintBrowserTest, DLPWarnCanceledWithWindowDotPrint) { + ASSERT_TRUE(embedded_test_server()->Started()); + GURL url(embedded_test_server()->GetURL("/printing/test1.html")); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); + + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(web_contents); + + // Set up the print view manager and DLP restrictions. + TestPrintViewManagerForDLP* print_view_manager = + TestPrintViewManagerForDLP::CreateForWebContents( + web_contents, + TestPrintViewManagerForDLP::RestrictionLevel::kWarnCancel); + + ASSERT_EQ(print_view_manager->GetPrintAllowance(), + TestPrintViewManagerForDLP::PrintAllowance::kUnknown); + content::ExecuteScriptAsync(web_contents->GetMainFrame(), "window.print();"); + print_view_manager->WaitUntilPreviewIsShownOrCancelled(); + ASSERT_EQ(print_view_manager->GetPrintAllowance(), + TestPrintViewManagerForDLP::PrintAllowance::kDisallowed); +} + +// Test that if printing is blocked due to DLP restrictions, the print preview +// is not rendered when initiated by window.print(). +IN_PROC_BROWSER_TEST_F(PrintBrowserTest, DLPBlockedWithWindowDotPrint) { + ASSERT_TRUE(embedded_test_server()->Started()); + GURL url(embedded_test_server()->GetURL("/printing/test1.html")); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); + + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(web_contents); + + // Set up the print view manager and DLP restrictions. + TestPrintViewManagerForDLP* print_view_manager = + TestPrintViewManagerForDLP::CreateForWebContents( + web_contents, TestPrintViewManagerForDLP::RestrictionLevel::kBlock); + + ASSERT_EQ(print_view_manager->GetPrintAllowance(), + TestPrintViewManagerForDLP::PrintAllowance::kUnknown); + content::ExecuteScriptAsync(web_contents->GetMainFrame(), "window.print();"); + print_view_manager->WaitUntilPreviewIsShownOrCancelled(); + ASSERT_EQ(print_view_manager->GetPrintAllowance(), + TestPrintViewManagerForDLP::PrintAllowance::kDisallowed); +} +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + // Printing preview a webpage with isolate-origins enabled. // Test that we will use oopif printing for this case. IN_PROC_BROWSER_TEST_F(IsolateOriginsPrintBrowserTest, OopifPrinting) {
diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc index 3989a29..1cb18d6 100644 --- a/chrome/browser/printing/print_view_manager.cc +++ b/chrome/browser/printing/print_view_manager.cc
@@ -215,19 +215,11 @@ base::OnceClosure on_print_preview_allowed_cb, base::OnceClosure on_print_preview_rejected_cb) { if (IsPrintingRestricted()) { -#if BUILDFLAG(IS_CHROMEOS_ASH) - policy::ShowDlpPrintDisabledNotification(); -#else - NOTREACHED(); -#endif + ShowBlockedNotification(); std::move(on_print_preview_rejected_cb).Run(); } else if (ShouldWarnBeforePrinting()) { -#if BUILDFLAG(IS_CHROMEOS_ASH) - policy::ShowDlpPrintWarningDialog(std::move(on_print_preview_allowed_cb), - std::move(on_print_preview_rejected_cb)); -#else - NOTREACHED(); -#endif + ShowWarning(std::move(on_print_preview_allowed_cb), + std::move(on_print_preview_rejected_cb)); } else { std::move(on_print_preview_allowed_cb).Run(); } @@ -241,6 +233,7 @@ return; } PrintPreviewDone(); + PrintPreviewRejectedForTesting(); } void PrintViewManager::RenderFrameCreated( @@ -388,6 +381,7 @@ params.is_modifiable = source_is_modifiable; PrintPreviewUI::SetInitialParams( dialog_controller->GetPrintPreviewForContents(web_contents()), params); + PrintPreviewAllowedForTesting(); } void PrintViewManager::RequestPrintPreview( @@ -421,6 +415,7 @@ PrintPreviewDialogController::PrintPreview(web_contents()); PrintPreviewUI::SetInitialParams(GetPrintPreviewDialog(web_contents()), *params); + PrintPreviewAllowedForTesting(); } void PrintViewManager::CheckForCancel(int32_t preview_ui_id, @@ -461,6 +456,33 @@ #endif } +void PrintViewManager::ShowWarning( + base::OnceClosure on_print_preview_allowed_cb, + base::OnceClosure on_print_preview_rejected_cb) const { +#if BUILDFLAG(IS_CHROMEOS_ASH) + policy::ShowDlpPrintWarningDialog(std::move(on_print_preview_allowed_cb), + std::move(on_print_preview_rejected_cb)); +#else + NOTREACHED(); +#endif +} + +void PrintViewManager::ShowBlockedNotification() const { +#if BUILDFLAG(IS_CHROMEOS_ASH) + policy::ShowDlpPrintDisabledNotification(); +#else + NOTREACHED(); +#endif +} + +void PrintViewManager::PrintPreviewRejectedForTesting() { + // Note: This is only used for testing. +} + +void PrintViewManager::PrintPreviewAllowedForTesting() { + // Note: This is only used for testing. +} + WEB_CONTENTS_USER_DATA_KEY_IMPL(PrintViewManager) } // namespace printing
diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h index 96f9566..83d6b04f 100644 --- a/chrome/browser/printing/print_view_manager.h +++ b/chrome/browser/printing/print_view_manager.h
@@ -125,10 +125,22 @@ void MaybeUnblockScriptedPreviewRPH(); // Checks whether printing is restricted due to Data Leak Protection rules. - bool IsPrintingRestricted() const; + // Virtual to allow tests to override. + virtual bool IsPrintingRestricted() const; // Checks whether printing is not advised due to Data Leak Protection rules. - bool ShouldWarnBeforePrinting() const; + // Virtual to allow tests to override. + virtual bool ShouldWarnBeforePrinting() const; + + // On ChromeOS, shows a warning dialog that will invoke one of + // |on_print_preview_allowed_cb| or |on_print_preview_rejected_cb| based on + // user input. Virtual to allow tests to override. + virtual void ShowWarning( + base::OnceClosure on_print_preview_allowed_cb, + base::OnceClosure on_print_preview_rejected_cb) const; + + // On ChromeOS, shows a notification that the printing is blocked. + void ShowBlockedNotification() const; // Checks whether printing is currently restricted and aborts print preview if // needed. There are cases when this check is performed asynchronously, so in @@ -145,6 +157,13 @@ void OnPrintPreviewRequestRejected(int render_process_id, int render_frame_id); + // Virtual method to be overridden in tests, in order to be notified whether + // the print preview is shown or not due to policies or user actions. + virtual void PrintPreviewRejectedForTesting(); + // Virtual method to be overridden in tests, in order to be notified when the + // print preview is not prevented by policies or user actions. + virtual void PrintPreviewAllowedForTesting(); + base::OnceClosure on_print_dialog_shown_callback_; // Current state of print preview for this view.
diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc index ad027be..4e8d54ea 100644 --- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc +++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
@@ -9,6 +9,7 @@ #include "build/build_config.h" #include "build/chromeos_buildflags.h" +#include "build/os_buildflags.h" #include "chrome/browser/accuracy_tips/accuracy_service_factory.h" #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" #include "chrome/browser/autocomplete/in_memory_url_index_factory.h" @@ -54,6 +55,7 @@ #include "chrome/browser/notifications/notifier_state_tracker_factory.h" #include "chrome/browser/optimization_guide/model_validator_keyed_service_factory.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h" +#include "chrome/browser/page_info/about_this_site_service_factory.h" #include "chrome/browser/page_load_metrics/observers/https_engagement_metrics/https_engagement_service_factory.h" #include "chrome/browser/page_load_metrics/page_load_metrics_memory_tracker_factory.h" #include "chrome/browser/password_manager/password_store_factory.h" @@ -154,12 +156,15 @@ #include "chrome/browser/ash/system_extensions/system_extensions_provider_factory.h" #include "chrome/browser/chromeos/browser_context_keyed_service_factories.h" #include "chrome/browser/nearby_sharing/nearby_sharing_service_factory.h" -#include "chrome/browser/policy/messaging_layer/util/heartbeat_event_factory.h" #else #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" #include "chrome/browser/profiles/gaia_info_update_service_factory.h" #endif +#if BUILDFLAG(IS_CHROMEOS) +#include "chrome/browser/policy/messaging_layer/util/heartbeat_event_factory.h" +#endif + #if defined(OS_WIN) #include "chrome/browser/profile_resetter/triggered_profile_resetter_factory.h" #endif @@ -253,6 +258,7 @@ #endif AboutSigninInternalsFactory::GetInstance(); + AboutThisSiteServiceFactory::GetInstance(); AccessContextAuditServiceFactory::GetInstance(); AccountConsistencyModeManagerFactory::GetInstance(); AccountInvestigatorFactory::GetInstance(); @@ -432,7 +438,7 @@ RendererUpdaterFactory::GetInstance(); -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) reporting::HeartbeatEventFactory::GetInstance(); #endif
diff --git a/chrome/browser/resources/BUILD.gn b/chrome/browser/resources/BUILD.gn index dec76ce..78b01ee 100644 --- a/chrome/browser/resources/BUILD.gn +++ b/chrome/browser/resources/BUILD.gn
@@ -70,6 +70,10 @@ ] } + if (is_win || is_mac || is_linux || is_chromeos_ash) { + public_deps += [ "connectors_internals:resources" ] + } + if (is_win || is_mac || is_linux || is_chromeos_lacros || is_fuchsia) { public_deps += [ "browser_switch:resources" ] }
diff --git a/chrome/browser/resources/chromeos/login/BUILD.gn b/chrome/browser/resources/chromeos/login/BUILD.gn index c7feccf7..234800ea 100644 --- a/chrome/browser/resources/chromeos/login/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/BUILD.gn
@@ -124,6 +124,7 @@ "components/buttons/oobe_icon_button.html", "components/buttons/oobe_icon_button.js", "components/common_styles/common_styles.html", + "components/common_styles/cr_card_radio_group_styles.html", "components/common_styles/oobe_flex_layout_styles.html", "components/common_styles/oobe_dialog_host_styles.html", "components/dialogs/oobe_adaptive_dialog.html",
diff --git a/chrome/browser/resources/chromeos/login/components/common_styles/BUILD.gn b/chrome/browser/resources/chromeos/login/components/common_styles/BUILD.gn index 3442db9e..531b432 100644 --- a/chrome/browser/resources/chromeos/login/components/common_styles/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/components/common_styles/BUILD.gn
@@ -9,6 +9,7 @@ is_polymer3 = true deps = [ ":common_styles.m", + ":cr_card_radio_group_styles.m", ":oobe_dialog_host_styles.m", ":oobe_flex_layout_styles.m", ] @@ -17,6 +18,7 @@ group("polymer3_elements") { public_deps = [ ":common_styles_module", + ":cr_card_radio_group_styles_module", ":oobe_dialog_host_styles_module", ":oobe_flex_layout_styles_module", ] @@ -34,6 +36,12 @@ extra_deps = [ ":oobe_dialog_host_styles_module" ] } +js_library("cr_card_radio_group_styles.m") { + sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/components/common_styles/cr_card_radio_group_styles.m.js" ] + deps = [] + extra_deps = [ ":cr_card_radio_group_styles_module" ] +} + js_library("oobe_flex_layout_styles.m") { sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/components/common_styles/oobe_flex_layout_styles.m.js" ] deps = [] @@ -46,6 +54,12 @@ html_type = "style-module" } +polymer_modulizer("cr_card_radio_group_styles") { + js_file = "cr_card_radio_group_styles.m.js" + html_file = "cr_card_radio_group_styles.html" + html_type = "style-module" +} + polymer_modulizer("oobe_dialog_host_styles") { js_file = "oobe_dialog_host_styles.m.js" html_file = "oobe_dialog_host_styles.html"
diff --git a/chrome/browser/resources/chromeos/login/components/common_styles/cr_card_radio_group_styles.html b/chrome/browser/resources/chromeos/login/components/common_styles/cr_card_radio_group_styles.html new file mode 100644 index 0000000..c2693e56 --- /dev/null +++ b/chrome/browser/resources/chromeos/login/components/common_styles/cr_card_radio_group_styles.html
@@ -0,0 +1,80 @@ +<!-- Copyright 2021 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + +<dom-module id="cr-card-radio-group-styles"> + <template> + <style> + :host { + --radio-button-height: 120px; + } + + cr-radio-group { + display: flex; + flex-direction: column; + margin-top: 8px; + } + + cr-card-radio-button { + /* Removes the highlight that appears on tap. It has sharp + * corners, which don't match the rounded corners of the card. */ + -webkit-tap-highlight-color: transparent; + border-radius: 16px; + height: var(--radio-button-height); + margin-bottom: 0; + --cr-button-edge-spacing: 0; + --cr-card-radio-button-checkmark-right: 24px; + + --cr-card-radio-button-checkmark-top: + calc(var(--radio-button-height) / 2 - 12px); + --cr-card-radio-button-height: var(--radio-button-height); + --cr-card-radio-button-margin: 0; + --cr-card-radio-button-padding: 0; + --cr-card-radio-button-width: 100%; + --cr-checked-color: var(--google-blue-500); + --cr-radio-button-ink-size: 0; + --cr-radio-group-item-padding: 0; + } + + cr-card-radio-button:not(:last-child) { + margin-bottom: 16px; + } + + .card-container { + align-items: center; + display: flex; + flex-direction: row; + /* Same height to center button content in vertical dimension. */ + height: var(--radio-button-height); + padding-bottom: 0; + padding-inline-end: 48px; + padding-inline-start: 24px; + padding-top: 0; + text-align: start; + } + + .card-icon { + --iron-icon-height: 48px; + --iron-icon-width: 48px; + } + + .card-content { + padding-inline-end: 24px; + padding-inline-start: 24px; + } + + .card-label { + color: var(--oobe-header-text-color); + font-family: var(--oobe-header-font-family); + font-size: var(--oobe-radio-card-label-font-size); + font-weight: 500; + line-height: var(--oobe-radio-card-label-line-height); + } + + .card-text { + color: var(--oobe-text-color); + line-height: 20px; + } + </style> + </template> +</dom-module>
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_icons.html b/chrome/browser/resources/chromeos/login/components/oobe_icons.html index dd67bd9..6ff78b7 100644 --- a/chrome/browser/resources/chromeos/login/components/oobe_icons.html +++ b/chrome/browser/resources/chromeos/login/components/oobe_icons.html
@@ -46,12 +46,20 @@ </svg> </iron-iconset-svg> -<iron-iconset-svg name="oobe-24" size="20"> +<iron-iconset-svg name="oobe-24" size="24"> <svg> <defs> <g id="done"> <path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"></path> </g> + <g id="os-trial-install" fill="none" fill-rule="evenodd"> + <path fill="#fff" d="M0 0h24v24H0z"></path> + <path fill="#1A73E8" clip-rule="evenodd" d="M3.6 13.7904C3.6 15.7788 5.2116 17.3904 7.2 17.3904H18C19.3248 17.3904 20.4 16.3152 20.4 14.9904C20.4 13.6656 19.3248 12.5904 18 12.5904H16.1928V11.4C16.1928 9.08039 14.3124 7.19999 11.9928 7.19999C10.0968 7.19999 8.5128 8.46479 7.9908 10.1904H7.2C5.2116 10.1904 3.6 11.802 3.6 13.7904ZM6.4548 7.87439C7.6248 6.03479 9.6576 4.79999 12 4.79999C15.252 4.79999 17.9484 7.15319 18.4932 10.2492C20.9088 10.5 22.8 12.5172 22.8 15C22.8 17.6508 20.6508 19.8 18 19.8H7.2C3.8868 19.8 1.2 17.1144 1.2 13.8C1.2 10.7412 3.4968 8.24519 6.4548 7.87439ZM15.304 12.6L13.894 11.19L12.804 12.27V9.59999H10.804V12.27L9.71398 11.19L8.30398 12.6L11.094 15.39L11.804 16.1L12.514 15.39L15.304 12.6Z"></path> + </g> + <g id="os-trial-try" fill="none" fill-rule="evenodd"> + <path fill="#fff" d="M0 0h24v24H0z"></path> + <path fill="#1A73E8" clip-rule="evenodd" d="M15.0507 11.4566h.8873v1.8113H13.2V6.02267h1.8507L12.3 2.40002 9.6 6.02267h1.8V13.2679H8.83944V11.3932C9.46056 11.0581 9.90422 10.4151 9.90422 9.64531 9.90422 8.54946 9.02577 7.65285 7.95211 7.65285 6.87845 7.65285 6 8.54946 6 9.64531c0 .76979.44366 1.41279 1.06479 1.74789v1.8747C7.06479 14.2732 7.71507 15 8.7 15h2.7v3C10.77 18.3351 10.4366 18.8378 10.4366 19.6076 10.4366 20.7125 11.3151 21.6 12.3887 21.6 13.4624 21.6 14.3408 20.7125 14.3408 19.6076c0-.7698-.5108-1.2725-1.1408-1.6076V15h2.738C16.923 15 17.7127 14.2732 17.7127 13.2679V11.4566H18.6V7.83399H15.0507V11.4566z"></path> + </g> </defs> </svg> </iron-iconset-svg> @@ -251,6 +259,14 @@ <path fill="#fff" d="M0 0h48v48H0z"></path> <path fill="#1A73E8" fill-rule="evenodd" d="M24 4C12.96 4 4 12.96 4 24s8.96 20 20 20 20-8.96 20-20S35.04 4 24 4zm-5.28 8c-3.88 0-7 3.12-7 7s3.12 7 7 7 7-3.12 7-7-3.12-7-7-7zm0 10c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zM37 25a5 5 0 11-10 0 5 5 0 0110 0zm-5 6.24c1.52 0 3.7.36 5.66 1.04C39.14 29.86 40 27.04 40 24c0-8.82-7.18-16-16-16S8 15.18 8 24c0 2.54.6 4.94 1.66 7.08 3.18-1.48 7.06-2.06 9.06-2.06.98 0 2.44.14 4.04.46-1.64.88-3.08 2.02-3.92 3.54h-.12c-2.16 0-4.8.58-6.82 1.42 2.52 2.92 6.08 4.92 10.1 5.42v-3.62c0-.98.6-1.82 1.5-2.52.34-.26.72-.48 1.12-.7.01 0 .015-.005.02-.01.005-.005.01-.01.02-.01.4-.2.84-.4 1.3-.58.92-.36 1.92-.62 2.88-.82 1.16-.24 2.28-.36 3.16-.36z"></path> </g> + <g id="os-trial-install" fill="none" fill-rule="evenodd"> + <path fill="#fff" d="M0 0h48v48H0z"></path> + <path fill="#1A73E8" clip-rule="evenodd" d="M7.20002 27.5808c0 3.9768 3.22318 7.2 7.19998 7.2H36c2.6496.0 4.8-2.1504 4.8-4.8.0-2.6496-2.1504-4.8-4.8-4.8H32.3856V22.8c0-4.6392-3.7608-8.4-8.4-8.4-3.792.0-6.96 2.5296-8.004 5.9808H14.4c-3.9768.0-7.19998 3.2232-7.19998 7.2zm5.70958-11.832C15.2496 12.0696 19.3152 9.59998 24 9.59998c6.504.0 11.8968 4.70642 12.9864 10.89842C41.8176 21 45.6 25.0344 45.6 30c0 5.3016-4.2984 9.6-9.6 9.6H14.4c-6.62638.0-11.99998-5.3712-11.99998-12 0-6.1176 4.5936-11.1096 10.50958-11.8512zM30.608 25.2l-2.82-2.82-2.18 2.16V19.2h-4v5.34l-2.18-2.16-2.82 2.82 5.58 5.58 1.42 1.42 1.42-1.42 5.58-5.58z"></path> + </g> + <g id="os-trial-try" fill="none" fill-rule="evenodd"> + <path fill="#fff" d="M0 0h48v48H0z"></path> + <path fill="#1A73E8" clip-rule="evenodd" d="M30.1014 22.9133h1.7747v3.6226H26.4V12.0453h3.7014L24.6 4.80005 19.2 12.0453h3.6V26.5359H17.6789V22.7865C18.9211 22.1163 19.8084 20.8302 19.8084 19.2906c0-2.1917-1.7569-3.9849-3.9042-3.9849-2.1473.0-3.9042 1.7932-3.9042 3.9849.0 1.5396.8873 2.8257 2.1296 3.4959v3.7494C14.1296 28.5465 15.4301 30 17.4 30h5.4v6C21.54 36.6702 20.8732 37.6755 20.8732 39.2151c0 2.2099 1.7569 3.9849 3.9043 3.9849C26.9248 43.2 28.6817 41.425 28.6817 39.2151c0-1.5396-1.0217-2.5449-2.2817-3.2151V30h5.4761c1.9698.0 3.5492-1.4535 3.5492-3.4641V22.9133H37.2V15.668H30.1014v7.2453z"></path> + </g> </defs> </svg> </iron-iconset-svg>
diff --git a/chrome/browser/resources/chromeos/login/debug/debug.js b/chrome/browser/resources/chromeos/login/debug/debug.js index 600616f..c8ff78b 100644 --- a/chrome/browser/resources/chromeos/login/debug/debug.js +++ b/chrome/browser/resources/chromeos/login/debug/debug.js
@@ -208,6 +208,10 @@ kind: ScreenKind.OTHER, }, { + id: 'os-trial', + kind: ScreenKind.OTHER, + }, + { id: 'debugging', kind: ScreenKind.OTHER, },
diff --git a/chrome/browser/resources/chromeos/login/screens/common/os_trial.html b/chrome/browser/resources/chromeos/login/screens/common/os_trial.html new file mode 100644 index 0000000..da234eb --- /dev/null +++ b/chrome/browser/resources/chromeos/login/screens/common/os_trial.html
@@ -0,0 +1,75 @@ +<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> +<link rel="import" href="chrome://oobe/custom_elements.html"> + +<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/multi_step_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/cr_card_radio_group_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/dialogs/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/hd_iron_icon.html"> + +<dom-module id="os-trial-element"> + <template> + <style include="oobe-dialog-host-styles cr-card-radio-group-styles"> + </style> + + <oobe-adaptive-dialog id="osTrialDialog" role="dialog" + aria-label$="[[i18nDynamic(locale, 'osTrialTitle')]]"> + <iron-icon slot="icon" icon="oobe-32:googleg"></iron-icon> + <h1 slot="title">[[i18nDynamic(locale, 'osTrialTitle')]]</h1> + <html-echo slot="subtitle" content="[[getSubtitleHtml_(locale)]]"> + </html-echo> + + <div slot="content" class="layout vertical landscape-vertical-centered"> + <cr-radio-group selected="{{selectedTrialOption}}"> + <cr-card-radio-button id="installButton" class="flex" name="install"> + <div class="card-container"> + <hd-iron-icon class="card-icon" + icon1x="oobe-24:os-trial-install" + icon2x="oobe-48:os-trial-install"> + </hd-iron-icon> + <div class="card-content"> + <div class="card-label"> + [[i18nDynamic(locale, 'osTrialInstallTitle')]] + </div> + <div class="card-text"> + [[i18nDynamic(locale, 'osTrialInstallSubtitle')]] + </div> + </div> + </div> + </cr-card-radio-button> + <cr-card-radio-button id="tryButton" class="flex" name="try"> + <div class="card-container"> + <hd-iron-icon class="card-icon" icon1x="oobe-24:os-trial-try" + icon2x="oobe-48:os-trial-try"> + </hd-iron-icon> + <div class="card-content"> + <div class="card-label"> + [[i18nDynamic(locale, 'osTrialTryTitle')]] + </div> + <div class="card-text"> + [[i18nDynamic(locale, 'osTrialTrySubtitle')]] + </div> + </div> + </div> + </cr-card-radio-button> + </cr-radio-group> + </div> + </div> + <div slot="back-navigation"> + <oobe-back-button id="backButton" + on-click="onBackButtonClick_"></oobe-back-button> + </div> + <div slot="bottom-buttons"> + <oobe-next-button + class="focus-on-show" id="nextButton" + inverse on-click="onNextButtonClick_"></oobe-next-button> + </div> + </oobe-adaptive-dialog> + </template> +</dom-module> \ No newline at end of file
diff --git a/chrome/browser/resources/chromeos/login/screens/common/os_trial.js b/chrome/browser/resources/chromeos/login/screens/common/os_trial.js new file mode 100644 index 0000000..b0bb4c502 --- /dev/null +++ b/chrome/browser/resources/chromeos/login/screens/common/os_trial.js
@@ -0,0 +1,73 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * @fileoverview Polymer element for OS trial screen. + */ + +(function() { + +/** + * Trial option for setting up the device. + * @enum {string} + */ +const TrialOption = { + INSTALL: 'install', + TRY: 'try', +}; + +Polymer({ + is: 'os-trial-element', + + behaviors: [ + OobeI18nBehavior, + OobeDialogHostBehavior, + LoginScreenBehavior, + ], + + properties: { + /** + * The currently selected trial option. + */ + selectedTrialOption: { + type: String, + value: TrialOption.INSTALL, + }, + }, + + ready() { + this.initializeLoginScreen('OsTrialScreen', { + resetAllowed: true, + }); + }, + + /** + * @param {string} locale + * @return {string} + * @private + */ + getSubtitleHtml_(locale) { + return this.i18nAdvanced('osTrialSubtitle'); + }, + + /** + * This is the 'on-click' event handler for the 'next' button. + * @private + */ + onNextButtonClick_() { + if (this.selectedTrialOption == TrialOption.TRY) + this.userActed('os-trial-try'); + else + this.userActed('os-trial-install'); + }, + + /** + * This is the 'on-click' event handler for the 'back' button. + * @private + */ + onBackButtonClick_() { + this.userActed('os-trial-back'); + }, +}); +})();
diff --git a/chrome/browser/resources/chromeos/login/structure/components_os_install.html b/chrome/browser/resources/chromeos/login/structure/components_os_install.html index 2abf6e05..1b24e4e 100644 --- a/chrome/browser/resources/chromeos/login/structure/components_os_install.html +++ b/chrome/browser/resources/chromeos/login/structure/components_os_install.html
@@ -5,3 +5,4 @@ <!-- Components that appear as a part of os install flow only --> <include src="../screens/common/os_install.html"> +<include src="../screens/common/os_trial.html">
diff --git a/chrome/browser/resources/chromeos/login/structure/components_os_install.js b/chrome/browser/resources/chromeos/login/structure/components_os_install.js index 1b8b6d9..0b75f9ac7 100644 --- a/chrome/browser/resources/chromeos/login/structure/components_os_install.js +++ b/chrome/browser/resources/chromeos/login/structure/components_os_install.js
@@ -5,3 +5,4 @@ // clang-format off // <include src="../screens/common/os_install.js"> +// <include src="../screens/common/os_trial.js">
diff --git a/chrome/browser/resources/chromeos/login/structure/screens_os_install.html b/chrome/browser/resources/chromeos/login/structure/screens_os_install.html index 76d14057..53deb39 100644 --- a/chrome/browser/resources/chromeos/login/structure/screens_os_install.html +++ b/chrome/browser/resources/chromeos/login/structure/screens_os_install.html
@@ -5,3 +5,5 @@ <!-- Screens that can appear in OS install mode --> <os-install-element id="os-install" class="step hidden" hidden> </os-install-element> +<os-trial-element id="os-trial" class="step hidden" hidden> +</os-trial-element>
diff --git a/chrome/browser/resources/chromeos/login/user_creation.html b/chrome/browser/resources/chromeos/login/user_creation.html index cbcedddc..19ab918 100644 --- a/chrome/browser/resources/chromeos/login/user_creation.html +++ b/chrome/browser/resources/chromeos/login/user_creation.html
@@ -18,6 +18,7 @@ <link rel="import" href="/components/buttons/oobe_back_button.html"> <link rel="import" href="/components/buttons/oobe_next_button.html"> <link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/cr_card_radio_group_styles.html"> <link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <link rel="import" href="/components/dialogs/oobe_adaptive_dialog.html"> <link rel="import" href="/components/dialogs/oobe_modal_dialog.html"> @@ -25,84 +26,7 @@ <dom-module id="user-creation-element"> <template> - <style include="oobe-dialog-host-styles"> - :host { - --radio-button-height: 120px; - } - - cr-radio-group { - display: flex; - flex-direction: column; - margin-top: 8px; - } - - cr-card-radio-button { - /* Removes the highlight that appears on tap. It has sharp - * corners, which don't match the rounded corners of the card. */ - -webkit-tap-highlight-color: transparent; - border-radius: 16px; - --cr-button-edge-spacing: 0; - --cr-card-radio-button-padding: 0; - --cr-card-radio-button-margin: 0; - --cr-checked-color: var(--google-blue-500); - --cr-radio-button-ink-size: 0; - } - - cr-card-radio-button { - height: var(--radio-button-height); - margin-bottom: 0; - --cr-card-radio-button-checkmark-top: - calc(var(--radio-button-height) / 2 - 12px); - --cr-card-radio-button-checkmark-right: 24px; - --cr-card-radio-button-height: var(--radio-button-height); - --cr-card-radio-button-width: 100%; - --cr-radio-group-item-padding: 0; - - } - - cr-card-radio-button:not(:last-child) { - margin-bottom: 16px; - } - - .card-container { - align-items: center; - display: flex; - } - - .card-container { - flex-direction: row; - /* Same height to center button content in vertical dimension. */ - height: var(--radio-button-height); - padding-bottom: 0; - padding-inline-end: 48px; - padding-inline-start: 24px; - padding-top: 0; - text-align: start; - } - - .card-content { - padding-inline-end: 24px; - padding-inline-start: 24px; - } - - .card-icon { - --iron-icon-width: 48px; - --iron-icon-height: 48px; - } - - .card-label { - color: var(--oobe-header-text-color); - font-family: var(--oobe-header-font-family); - font-size: var(--oobe-radio-card-label-font-size); - font-weight: 500; - line-height: var(--oobe-radio-card-label-line-height); - } - - .card-text { - color: var(--oobe-text-color); - line-height: 20px; - } - + <style include="oobe-dialog-host-styles cr-card-radio-group-styles"> .help-text { color: var(--oobe-subheader-text-color); margin-top: 16px;
diff --git a/chrome/browser/resources/connectors_internals/BUILD.gn b/chrome/browser/resources/connectors_internals/BUILD.gn new file mode 100644 index 0000000..34149f8 --- /dev/null +++ b/chrome/browser/resources/connectors_internals/BUILD.gn
@@ -0,0 +1,70 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//tools/grit/grit_rule.gni") +import("//tools/polymer/html_to_js.gni") +import("//tools/typescript/ts_library.gni") +import("//ui/webui/resources/tools/generate_grd.gni") + +html_to_js("web_components") { + js_files = [ + "app.ts", + "zero_trust_connector.ts", + ] +} + +copy("copy_mojo") { + deps = [ + "//chrome/browser/ui/webui/connectors_internals:mojo_bindings_webui_js", + ] + mojom_folder = + "$root_gen_dir/mojom-webui/chrome/browser/ui/webui/connectors_internals/" + sources = [ "$mojom_folder/connectors_internals.mojom-webui.js" ] + outputs = [ "$target_gen_dir/{{source_file_part}}" ] +} + +ts_library("build_ts") { + root_dir = "$target_gen_dir" + out_dir = "$target_gen_dir/tsc" + tsconfig_base = "tsconfig_base.json" + in_files = [ + "connectors_internals.mojom-webui.js", + "app.ts", + "zero_trust_connector.ts", + ] + deps = [ + "//third_party/polymer/v3_0:library", + "//ui/webui/resources:library", + ] + extra_deps = [ + ":copy_mojo", + ":web_components", + ] +} + +resources_grd_file = "$target_gen_dir/resources.grd" + +generate_grd("build_grd") { + deps = [ ":build_ts" ] + input_files = [ "index.html" ] + input_files_base_dir = rebase_path(".", "//") + manifest_files = [ "$target_gen_dir/tsconfig.manifest" ] + + grd_prefix = "connectors_internals" + out_grd = resources_grd_file +} + +grit("resources") { + enable_input_discovery_for_gn_analyze = false + source = resources_grd_file + deps = [ ":build_grd" ] + + outputs = [ + "grit/connectors_internals_resources.h", + "grit/connectors_internals_resources_map.cc", + "grit/connectors_internals_resources_map.h", + "connectors_internals_resources.pak", + ] + output_dir = "$root_gen_dir/chrome" +}
diff --git a/chrome/browser/resources/connectors_internals/OWNERS b/chrome/browser/resources/connectors_internals/OWNERS new file mode 100644 index 0000000..8d9939f --- /dev/null +++ b/chrome/browser/resources/connectors_internals/OWNERS
@@ -0,0 +1 @@ +file://chrome/browser/enterprise/connectors/OWNERS
diff --git a/chrome/browser/resources/connectors_internals/app.html b/chrome/browser/resources/connectors_internals/app.html new file mode 100644 index 0000000..6bc9fda --- /dev/null +++ b/chrome/browser/resources/connectors_internals/app.html
@@ -0,0 +1,9 @@ +<div> + <h1>Enterprise Connectors</h1> +</div> +<template is="dom-if" if="[[!isOtr]]"> + <zero-trust-connector></zero-trust-connector> +</template> +<p hidden$="[[!isOtr]]"> + Enterprise Connectors are disabled in off-the-record contexts. +</p> \ No newline at end of file
diff --git a/chrome/browser/resources/connectors_internals/app.ts b/chrome/browser/resources/connectors_internals/app.ts new file mode 100644 index 0000000..3be9345 --- /dev/null +++ b/chrome/browser/resources/connectors_internals/app.ts
@@ -0,0 +1,36 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import './strings.m.js'; +import './zero_trust_connector.js'; + +import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; +import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +class ConnectorsInternalsAppElement extends PolymerElement { + static get is() { + return 'connectors-internals-app'; + } + + static get template() { + return html`{__html_template__}`; + } + + static get properties() { + return { + isOtr: Boolean, + }; + } + + public readonly isOtr: boolean; + + constructor() { + super(); + + this.isOtr = loadTimeData.getBoolean('isOtr'); + } +} + +customElements.define( + ConnectorsInternalsAppElement.is, ConnectorsInternalsAppElement); \ No newline at end of file
diff --git a/chrome/browser/resources/connectors_internals/index.html b/chrome/browser/resources/connectors_internals/index.html new file mode 100644 index 0000000..32d7487d --- /dev/null +++ b/chrome/browser/resources/connectors_internals/index.html
@@ -0,0 +1,15 @@ +<!doctype html> +<html lang="en"> + +<head> + <meta charset="utf-8"> + <title>Connectors Internals</title> + <link rel="stylesheet" href="chrome://resources/css/text_defaults.css"> +</head> + +<body> + <connectors-internals-app></connectors-internals-app> + <script src="app.js" type="module"></script> +</body> + +</html> \ No newline at end of file
diff --git a/chrome/browser/resources/connectors_internals/tsconfig_base.json b/chrome/browser/resources/connectors_internals/tsconfig_base.json new file mode 100644 index 0000000..cbf406ef --- /dev/null +++ b/chrome/browser/resources/connectors_internals/tsconfig_base.json
@@ -0,0 +1,6 @@ +{ + "extends": "../../../../tools/typescript/tsconfig_base.json", + "compilerOptions": { + "allowJs": true + } +} \ No newline at end of file
diff --git a/chrome/browser/resources/connectors_internals/zero_trust_connector.html b/chrome/browser/resources/connectors_internals/zero_trust_connector.html new file mode 100644 index 0000000..01f10671 --- /dev/null +++ b/chrome/browser/resources/connectors_internals/zero_trust_connector.html
@@ -0,0 +1,4 @@ +<h2>Zero Trust Connector</h2> +<div class="content"> + Is Enabled: <span id="enabledString"></span> +</div> \ No newline at end of file
diff --git a/chrome/browser/resources/connectors_internals/zero_trust_connector.ts b/chrome/browser/resources/connectors_internals/zero_trust_connector.ts new file mode 100644 index 0000000..477f9685 --- /dev/null +++ b/chrome/browser/resources/connectors_internals/zero_trust_connector.ts
@@ -0,0 +1,56 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {PageHandler, PageHandlerInterface, ZeroTrustState} from './connectors_internals.mojom-webui.js'; + +interface ZeroTrustConnectorElement { + $: {enabledString: HTMLSpanElement}; +} + +class ZeroTrustConnectorElement extends PolymerElement { + static get is() { + return 'zero-trust-connector'; + } + + static get template() { + return html`{__html_template__}`; + } + + static get properties() { + return { + enabledString: String, + }; + } + + private readonly pageHandler: PageHandlerInterface; + + constructor() { + super(); + this.pageHandler = PageHandler.getRemote(); + + this.fetchZeroTrustValues().then(state => this.setZeroTrustValues(state)); + } + + private setZeroTrustValues(state: ZeroTrustState|undefined) { + if (!state) { + this.$.enabledString.innerText = 'error'; + return; + } + + this.$.enabledString.innerText = `${state.isEnabled}`; + } + + private async fetchZeroTrustValues(): Promise<ZeroTrustState|undefined> { + return this.pageHandler.getZeroTrustState().then( + (response: {state: ZeroTrustState}) => response && response.state, + (e: object) => { + console.log(`fetchZeroTrustValues failed: ${JSON.stringify(e)}`); + return undefined; + }); + } +} + +customElements.define(ZeroTrustConnectorElement.is, ZeroTrustConnectorElement); \ No newline at end of file
diff --git a/chrome/browser/resources/new_tab_page/BUILD.gn b/chrome/browser/resources/new_tab_page/BUILD.gn index 634ae31..4b10cfe 100644 --- a/chrome/browser/resources/new_tab_page/BUILD.gn +++ b/chrome/browser/resources/new_tab_page/BUILD.gn
@@ -371,6 +371,7 @@ "$target_gen_dir/icons/resources.grdp", "$target_gen_dir/modules/cart/icons/resources.grdp", "$target_gen_dir/modules/photos/icons/resources.grdp", + "$target_gen_dir/modules/photos/images/resources.grdp", "$target_gen_dir/modules/recipes_v2/icons/resources.grdp", "$target_gen_dir/new_tab_page_mojo_resources.grdp", "$target_gen_dir/realbox/icons/resources.grdp", @@ -389,6 +390,7 @@ "icons:build_grdp", "modules/cart/icons:build_grdp", "modules/photos/icons:build_grdp", + "modules/photos/images:build_grdp", "modules/recipes_v2/icons:build_grdp", "realbox:build_realbox_mojo_grdp", "realbox/icons:build_grdp",
diff --git a/chrome/browser/resources/new_tab_page/modules/photos/BUILD.gn b/chrome/browser/resources/new_tab_page/modules/photos/BUILD.gn index 7116abc4..0180665 100644 --- a/chrome/browser/resources/new_tab_page/modules/photos/BUILD.gn +++ b/chrome/browser/resources/new_tab_page/modules/photos/BUILD.gn
@@ -12,6 +12,7 @@ "../..:i18n_setup", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_auto_img", + "//ui/webui/resources/cr_elements/cr_button:cr_button.m", "//ui/webui/resources/cr_elements/cr_lazy_render:cr_lazy_render.m", ] }
diff --git a/chrome/browser/resources/new_tab_page/modules/photos/icons/BUILD.gn b/chrome/browser/resources/new_tab_page/modules/photos/icons/BUILD.gn index da8706e..8b1464d 100644 --- a/chrome/browser/resources/new_tab_page/modules/photos/icons/BUILD.gn +++ b/chrome/browser/resources/new_tab_page/modules/photos/icons/BUILD.gn
@@ -7,7 +7,12 @@ generate_grd("build_grdp") { grd_prefix = "photos" out_grd = "$target_gen_dir/resources.grdp" - input_files = [ "explore_icon.svg" ] + input_files = [ + "explore_icon.svg", + "shape_1.svg", + "shape_2.svg", + "shape_3.svg", + ] input_files_base_dir = rebase_path(".", "//") resource_path_prefix = "modules/photos/icons" }
diff --git a/chrome/browser/resources/new_tab_page/modules/photos/icons/shape_1.svg b/chrome/browser/resources/new_tab_page/modules/photos/icons/shape_1.svg new file mode 100644 index 0000000..f0735d0f --- /dev/null +++ b/chrome/browser/resources/new_tab_page/modules/photos/icons/shape_1.svg
@@ -0,0 +1 @@ +<svg width="20" height="40" viewBox="0 0 20 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20 0a20 20 0 0 0 0 40V0z" fill="#000"/></svg> \ No newline at end of file
diff --git a/chrome/browser/resources/new_tab_page/modules/photos/icons/shape_2.svg b/chrome/browser/resources/new_tab_page/modules/photos/icons/shape_2.svg new file mode 100644 index 0000000..e30dcfc --- /dev/null +++ b/chrome/browser/resources/new_tab_page/modules/photos/icons/shape_2.svg
@@ -0,0 +1 @@ +<svg width="80" height="29" viewBox="0 0 80 29" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0-11a40 40 0 0 0 80 0H0z" fill="#000"/></svg> \ No newline at end of file
diff --git a/chrome/browser/resources/new_tab_page/modules/photos/icons/shape_3.svg b/chrome/browser/resources/new_tab_page/modules/photos/icons/shape_3.svg new file mode 100644 index 0000000..72a9f32b --- /dev/null +++ b/chrome/browser/resources/new_tab_page/modules/photos/icons/shape_3.svg
@@ -0,0 +1 @@ +<svg width="40" height="26" viewBox="0 0 40 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 80A40 40 0 1 0 0 0v80z" fill="#000"/></svg> \ No newline at end of file
diff --git a/chrome/browser/resources/new_tab_page/modules/photos/images/BUILD.gn b/chrome/browser/resources/new_tab_page/modules/photos/images/BUILD.gn new file mode 100644 index 0000000..1a66c68 --- /dev/null +++ b/chrome/browser/resources/new_tab_page/modules/photos/images/BUILD.gn
@@ -0,0 +1,17 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//ui/webui/resources/tools/generate_grd.gni") + +generate_grd("build_grdp") { + grd_prefix = "photos" + out_grd = "$target_gen_dir/resources.grdp" + input_files = [ + "main_example_2x.webp", + "second_example_2x.webp", + "third_example_2x.webp", + ] + input_files_base_dir = rebase_path(".", "//") + resource_path_prefix = "modules/photos/images" +}
diff --git a/chrome/browser/resources/new_tab_page/modules/photos/images/main_example_2x.webp b/chrome/browser/resources/new_tab_page/modules/photos/images/main_example_2x.webp new file mode 100644 index 0000000..8d19160 --- /dev/null +++ b/chrome/browser/resources/new_tab_page/modules/photos/images/main_example_2x.webp Binary files differ
diff --git a/chrome/browser/resources/new_tab_page/modules/photos/images/second_example_2x.webp b/chrome/browser/resources/new_tab_page/modules/photos/images/second_example_2x.webp new file mode 100644 index 0000000..aa906c93 --- /dev/null +++ b/chrome/browser/resources/new_tab_page/modules/photos/images/second_example_2x.webp Binary files differ
diff --git a/chrome/browser/resources/new_tab_page/modules/photos/images/third_example_2x.webp b/chrome/browser/resources/new_tab_page/modules/photos/images/third_example_2x.webp new file mode 100644 index 0000000..6b4c6849 --- /dev/null +++ b/chrome/browser/resources/new_tab_page/modules/photos/images/third_example_2x.webp Binary files differ
diff --git a/chrome/browser/resources/new_tab_page/modules/photos/module.html b/chrome/browser/resources/new_tab_page/modules/photos/module.html index 6265c39..1a82cdc3 100644 --- a/chrome/browser/resources/new_tab_page/modules/photos/module.html +++ b/chrome/browser/resources/new_tab_page/modules/photos/module.html
@@ -1,8 +1,11 @@ <style> :host { /* Colors: */ - --memory-background-color: rgba(0, 0, 0, 0.1); + --memory-background-color: var(--google-grey-200); --memory-title-color: rgb(255, 255, 255); + --shape-blue-color: var(--google-blue-refresh-500); + --shape-green-color: var(--google-green-refresh-500); + --shape-yellow-color: var(--google-yellow-refresh-500); /* Other: */ --memory-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 2px 6px 2px rgba(60, 64, 67, 0.15); @@ -10,6 +13,11 @@ @media (prefers-color-scheme: dark) { :host { + /* Colors: */ + --memory-background-color: var(--google-grey-800); + --shape-blue-color: var(--google-blue-refresh-400); + --shape-green-color: var(--google-green-refresh-400); + --shape-yellow-color: var(--google-yellow-refresh-400); /* Other: */ --memory-shadow: 0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px rgba(0, 0, 0, 0.3); @@ -35,17 +43,26 @@ margin-inline-end: 4px; } + :host([show-opt-in-screen]) #memories { + margin: 0; + } + .card { border-radius: 8px; + height: 164px; + overflow: hidden; + position: relative; + } + + #memories > .card { + border-radius: 8px; display: flex; + flex-basis: 0; flex-grow: 1; flex-shrink: 1; - height: 164px; margin-inline-end: 12px; max-width: 258px; min-width: 123px; - overflow: hidden; - position: relative; } .memory { @@ -53,7 +70,7 @@ box-shadow: var(--memory-shadow); } - .memory::before { + .memory:not(.no-title)::before { background: linear-gradient(180deg, rgba(0, 0, 0, 0) 47.92%, rgb(0, 0, 0) 100%); @@ -85,6 +102,8 @@ min-height: 100%; min-width: 100%; object-fit: cover; + pointer-events: none; + position: relative; } #exploreCard { @@ -123,6 +142,155 @@ text-align: center; } + #optInCard { + display: flex; + flex: 1; + flex-direction: row; + flex-wrap: nowrap; + } + + #optInContent { + display: flex; + flex-direction: column; + justify-content: space-between; + margin: 16px; + max-width: 288px; + } + + #optInTitleText { + color: var(--cr-primary-text-color); + font-size: 22px; + font-weight: normal; + line-height: 26px; + margin: 8px 0; + } + + #optInTitleDesc { + color: var(--cr-secondary-text-color); + font-size: 12px; + line-height: 20px; + } + + #optInButton { + margin-inline-end: 8px; + } + + #optInArtwork { + display: flex; + flex-grow: 1; + flex-shrink: 1; + height: 236px; + margin-top: -46px; + max-width: 240px; + overflow: hidden; + position: relative; + right: 0; + } + + #yellowShape { + -webkit-mask-image: url(modules/photos/icons/shape_1.svg); + -webkit-mask-repeat: no-repeat; + -webkit-mask-size: 100%; + background: var(--shape-yellow-color); + height: 40px; + left: 0; + position: absolute; + top: 16px; + width: 20px; + } + + :host-context([dir='rtl']) #yellowShape { + left: auto; + right: 0; + transform: scaleX(-1); + } + + #blueShape { + -webkit-mask-image: url(modules/photos/icons/shape_2.svg); + -webkit-mask-repeat: no-repeat; + -webkit-mask-size: 100%; + background: var(--shape-blue-color); + height: 29px; + left: 110px; + position: absolute; + top: 0; + width: 80px; + } + + :host-context([dir='rtl']) #blueShape { + left: auto; + right: 104px; + } + + #greenShape { + -webkit-mask-image: url(modules/photos/icons/shape_3.svg); + -webkit-mask-repeat: no-repeat; + -webkit-mask-size: 100%; + background: var(--shape-green-color); + bottom: 0; + height: 26px; + left: 108px; + position: absolute; + width: 40px; + } + + :host-context([dir='rtl']) #greenShape { + left: auto; + right: 108px; + transform: scaleX(-1); + } + + #memoryMain { + background: url(modules/photos/images/main_example_2x.webp); + background-position: center; + background-repeat: no-repeat; + background-size: cover; + height: 160px; + left: 40px; + position: absolute; + top: 38px; + width: 120px; + } + + :host-context([dir='rtl']) #memoryMain { + left: auto; + right: 40px; + } + + #memorySecond { + background: url(modules/photos/images/second_example_2x.webp); + background-position: center; + background-repeat: no-repeat; + background-size: cover; + height: 132px; + left: 176px; + position: absolute; + top: 126px; + width: 99px; + } + + :host-context([dir='rtl']) #memorySecond { + left: auto; + right: 176px; + } + + #memoryThird { + background: url(modules/photos/images/third_example_2x.webp); + background-position: center; + background-repeat: no-repeat; + background-size: cover; + height: 100px; + left: 192px; + position: absolute; + top: 10px; + width: 75px; + } + + :host-context([dir='rtl']) #memoryThird { + left: auto; + right: 192px; + } + ntp-info-dialog a { color: var(--cr-link-color); cursor: pointer; @@ -136,7 +304,10 @@ } </style> <ntp-module-header - show-info-button on-info-button-click="onInfoButtonClick_" + chip-text="[[headerChipText_]]" + hide-menu-button="[[showOptInScreen]]" + show-info-button="[[!showOptInScreen]]" + on-info-button-click="onInfoButtonClick_" show-dismiss-button on-dismiss-button-click="onDismissButtonClick_" dismiss-text="[[i18n('modulesPhotosMemoriesHideToday')]]" on-disable-button-click="onDisableButtonClick_" @@ -144,23 +315,60 @@ [[i18n('modulesPhotosTitle')]] </ntp-module-header> <div id="memories"> - <template id="memoryRepeat" is="dom-repeat" items="[[memories]]"> - <a class="memory card" href="[[item.itemUrl.url]]"> - <img class="memory-img" is="cr-auto-img" - auto-src="[[resizeImageUrl_(item.coverUrl.url, memories.length)]]" - draggable="false"></img> - <div class="memory-title">[[item.title]]</div> - </a> + <template id="welcomeCardElement" is="dom-if" if="[[showOptInScreen]]"> + <div id="optInCard"> + <div id="optInContent"> + <div> + <h1 id="optInTitleText"> + [[i18n('modulesPhotosMemoriesWelcomeTitle')]] + </h1> + <span id="optInTitleDesc"> + [[i18n('modulesPhotosMemoriesWelcomeText')]] + </span> + </div> + <div> + <cr-button id="optInButton" class="action-button" + on-click="onOptInClick_"> + [[i18n('modulesPhotosMemoriesWelcomeButtonOptIn')]] + </cr-button> + <cr-button id="optOutButton" on-click="onOptOutClick_"> + [[i18n('modulesPhotosMemoriesWelcomeButtonOptOut')]] + </cr-button> + </div> + </div> + <div id="optInArtwork"> + <div id="yellowShape"></div> + <div id="blueShape"></div> + <div id="greenShape"></div> + <div id="memoryMain" class="memory card"> + <div class="memory-title" dir="auto"> + [[i18n('modulesPhotosMemoriesWelcomeExample')]] + </div> + </div> + <div id="memorySecond" class="memory card no-title"></div> + <div id="memoryThird" class="memory card no-title"></div> + </div> + </div> </template> - <template id="exploreCardElement" is="dom-if" if="[[showExploreMore_]]"> - <a href="https://photos.google.com" target="_blank" id="exploreCard" class="card"> - <div id="exploreIconContainer"> - <div id="exploreIcon"></div> - </div> - <div id="exploreText"> - [[i18n('modulesPhotosMemoriesExplore')]] - </div> - </a> + <template id="memoriesElement" is="dom-if" if="[[!showOptInScreen]]"> + <template id="memoryRepeat" is="dom-repeat" items="[[memories]]"> + <a class="memory card" href="[[item.itemUrl.url]]"> + <img class="memory-img" is="cr-auto-img" + auto-src="[[resizeImageUrl_(item.coverUrl.url, memories.length)]]" + draggable="false"></img> + <div class="memory-title" dir="auto">[[item.title]]</div> + </a> + </template> + <template id="exploreCardElement" is="dom-if" if="[[showExploreMore_]]"> + <a href="https://photos.google.com" target="_blank" id="exploreCard" class="card"> + <div id="exploreIconContainer"> + <div id="exploreIcon"></div> + </div> + <div id="exploreText"> + [[i18n('modulesPhotosMemoriesExplore')]] + </div> + </a> + </template> </template> </div> <cr-lazy-render id="infoDialogRender">
diff --git a/chrome/browser/resources/new_tab_page/modules/photos/module.js b/chrome/browser/resources/new_tab_page/modules/photos/module.js index f624d6c..c46c9d6 100644 --- a/chrome/browser/resources/new_tab_page/modules/photos/module.js +++ b/chrome/browser/resources/new_tab_page/modules/photos/module.js
@@ -33,11 +33,25 @@ /** @type {Array<!photos.mojom.Memory>} */ memories: Array, + /** @type {boolean} */ + showOptInScreen: { + type: Boolean, + reflectToAttribute: true, + }, + /** * @type {boolean} * @private */ - showExploreMore_: {type: Boolean, computed: 'computeShowExploreMore_()'}, + showExploreMore_: + {type: Boolean, computed: 'computeShowExploreMore_(memories)'}, + + /** + * @type {string} + * @private + */ + headerChipText_: + {type: Boolean, computed: 'computeHeaderChipText_(showOptInScreen)'}, }; } @@ -49,6 +63,15 @@ return this.memories.length === 1; } + /** + * @return {string} + * @private + */ + computeHeaderChipText_() { + return this.showOptInScreen ? loadTimeData.getString('modulesPhotosNew') : + ''; + } + /** @private */ onInfoButtonClick_() { /** @type {InfoDialogElement} */ (this.$.infoDialogRender.get()) @@ -79,6 +102,19 @@ })); } + /** @private */ + onOptInClick_() { + PhotosProxy.getHandler().onUserOptIn(true); + this.showOptInScreen = false; + } + + /** @private */ + onOptOutClick_() { + PhotosProxy.getHandler().onUserOptIn(false); + // Disable the module when user opt out. + this.onDisableButtonClick_(); + } + /** * @param {string} url * @param {number} numMemories @@ -102,10 +138,13 @@ */ async function createPhotosElement() { const {memories} = await PhotosProxy.getHandler().getMemories(); + const {showOptInScreen} = + await PhotosProxy.getHandler().shouldShowOptInScreen(); if (memories.length === 0) { return null; } const element = new PhotosModuleElement(); + element.showOptInScreen = showOptInScreen; // We show only the first 3 at most. element.memories = memories.slice(0, 3); return element;
diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resources/settings/BUILD.gn index 927df44..4930fda 100644 --- a/chrome/browser/resources/settings/BUILD.gn +++ b/chrome/browser/resources/settings/BUILD.gn
@@ -121,9 +121,9 @@ "clear_browsing_data_dialog/clear_browsing_data_browser_proxy.ts", "controls/pref_control_behavior.js", "controls/settings_boolean_control_behavior.js", - "controls/settings_idle_load.js", + "controls/settings_idle_load.ts", "downloads_page/downloads_browser_proxy.ts", - "ensure_lazy_loaded.js", + "ensure_lazy_loaded.ts", "extension_control_browser_proxy.ts", "global_scroll_target_mixin.ts", "hats_browser_proxy.ts", @@ -134,7 +134,7 @@ "metrics_browser_proxy.ts", "on_startup_page/on_startup_browser_proxy.ts", "on_startup_page/startup_urls_page_browser_proxy.ts", - "open_window_proxy.js", + "open_window_proxy.ts", "page_visibility.js", "people_page/sync_browser_proxy.js", "people_page/profile_info_browser_proxy.js", @@ -311,7 +311,7 @@ "settings_page_css.ts", "settings_shared_css.ts", "settings_vars_css.ts", - "site_favicon.js", + "site_favicon.ts", "site_settings/add_site_dialog.ts", "site_settings/all_sites.ts", "site_settings/all_sites_icons.ts", @@ -409,14 +409,12 @@ ":extension_control_browser_proxy", ":i18n_setup", ":lifetime_browser_proxy", - ":open_window_proxy", ":page_visibility", ":route", ":router", ":setting_id_param_util", ":settings", ":settings_routes", - ":site_favicon", ] } @@ -426,7 +424,6 @@ deps = [ ":i18n_setup", ":lifetime_browser_proxy", - ":open_window_proxy", "people_page:sync_browser_proxy", "prefs:prefs", "prefs:prefs_behavior", @@ -455,9 +452,6 @@ extra_deps = [ ":build_ts" ] } -js_library("open_window_proxy") { -} - js_library("page_visibility") { deps = [ "//ui/webui/resources/js:load_time_data.m" ] } @@ -492,13 +486,6 @@ deps = [ ":router" ] } -js_library("site_favicon") { - deps = [ - "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/js:icon", - ] -} - group("polymer3_elements") { public_deps = [ # Sub-folder targets @@ -555,7 +542,7 @@ "settings_vars_css.ts", "settings_page_css.ts", "settings_shared_css.ts", - "site_favicon.js", + "site_favicon.ts", ] } @@ -623,14 +610,14 @@ "controls/settings_boolean_control_behavior.js", "controls/settings_checkbox.js", "controls/settings_dropdown_menu.js", - "controls/settings_idle_load.js", + "controls/settings_idle_load.ts", "controls/settings_radio_group.js", "controls/settings_slider.js", "controls/settings_textarea.js", "controls/settings_toggle_button.js", "downloads_page/downloads_browser_proxy.ts", "downloads_page/downloads_page.ts", - "ensure_lazy_loaded.js", + "ensure_lazy_loaded.ts", "extension_control_browser_proxy.ts", "global_scroll_target_mixin.ts", "hats_browser_proxy.ts", @@ -645,7 +632,7 @@ "on_startup_page/startup_url_entry.ts", "on_startup_page/startup_urls_page_browser_proxy.ts", "on_startup_page/startup_urls_page.ts", - "open_window_proxy.js", + "open_window_proxy.ts", "page_visibility.js", "people_page/people_page.ts", "people_page/profile_info_browser_proxy.js", @@ -721,7 +708,7 @@ "settings_shared_css.ts", "settings_ui/settings_ui.ts", "settings_vars_css.ts", - "site_favicon.js", + "site_favicon.ts", "site_settings/add_site_dialog.ts", "site_settings/all_sites_icons.ts", "site_settings/all_sites.ts",
diff --git a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html index a7710eb6..b7fb9132 100644 --- a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html +++ b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html
@@ -30,7 +30,7 @@ <cr-dialog id="dialog" close-text="$i18n{close}"> <div slot="title" id="title">[[getTitle_(isEditDialog_)]]</div> <div slot="body"> - <div hidden="[[!shouldShowStorageDetails]]" id="storageDetails"> + <div hidden="[[!isAccountStoreUser]]" id="storageDetails"> [[getStorageDetailsMessage_()]] </div> <cr-input id="websiteInput" label="$i18n{editPasswordWebsiteLabel}"
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 11829439..02cb919 100644 --- a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.ts
@@ -51,7 +51,7 @@ return { entry: Object, - shouldShowStorageDetails: {type: Boolean, value: false}, + isAccountStoreUser: {type: Boolean, value: false}, /** * Saved passwords after deduplicating versions that are repeated in the @@ -110,7 +110,7 @@ }; } - shouldShowStorageDetails: boolean; + isAccountStoreUser: boolean; entry: MultiStorePasswordUiEntry; savedPasswords: Array<MultiStorePasswordUiEntry>; private usernamesForSameOrigin_: Set<string>|null;
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_device_section.html b/chrome/browser/resources/settings/autofill_page/passwords_device_section.html index ecb39158..ee3f765 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_device_section.html +++ b/chrome/browser/resources/settings/autofill_page/passwords_device_section.html
@@ -44,7 +44,7 @@ </h2> </div> <passwords-list-handler id="passwordsListHandler" allow-move-to-account-option - should-show-storage-details saved-passwords="[[savedPasswords]]"> + is-account-store-user saved-passwords="[[savedPasswords]]"> <div slot="body" class="list-frame"> <div class="list-item column-header" aria-hidden="true"> $i18n{deviceOnlyPasswordsHeading}
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_list_handler.html b/chrome/browser/resources/settings/autofill_page/passwords_list_handler.html index 23d780f..6ed6ed2b 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_list_handler.html +++ b/chrome/browser/resources/settings/autofill_page/passwords_list_handler.html
@@ -35,7 +35,7 @@ token-request-manager="[[tokenRequestManager]]" </if> entry="[[activePassword_.entry]]" saved-passwords="[[savedPasswords]]" - should-show-storage-details="[[shouldShowStorageDetails]]"> + is-account-store-user="[[isAccountStoreUser]]"> </password-edit-dialog> </template>
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_list_handler.ts b/chrome/browser/resources/settings/autofill_page/passwords_list_handler.ts index ac1a705..9039fb0 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_list_handler.ts +++ b/chrome/browser/resources/settings/autofill_page/passwords_list_handler.ts
@@ -78,10 +78,10 @@ }, /** - * Whether the edit dialog and removal notification should show + * If true, the edit dialog and removal notification show * information about which location(s) a password is stored. */ - shouldShowStorageDetails: { + isAccountStoreUser: { type: Boolean, value: false, }, @@ -148,7 +148,7 @@ } savedPasswords: Array<MultiStorePasswordUiEntry>; - shouldShowStorageDetails: boolean; + isAccountStoreUser: boolean; allowMoveToAccountOption: boolean; // <if expr="chromeos"> @@ -329,7 +329,7 @@ removedFromAccount: boolean, removedFromDevice: boolean) { assert(removedFromAccount || removedFromDevice); this.removalNotification_ = this.i18n('passwordDeleted'); - if (this.shouldShowStorageDetails) { + if (this.isAccountStoreUser) { if (removedFromAccount && removedFromDevice) { this.removalNotification_ = this.i18n('passwordDeletedFromAccountAndDevice');
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_section.html b/chrome/browser/resources/settings/autofill_page/passwords_section.html index 021f8c8..7f024f0 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_section.html +++ b/chrome/browser/resources/settings/autofill_page/passwords_section.html
@@ -173,7 +173,7 @@ <if expr="chromeos"> token-request-manager="[[tokenRequestManager_]]" </if> - should-show-storage-details="[[shouldShowStorageDetails_]]" + is-account-store-user="[[isAccountStoreUser_]]" saved-passwords="[[savedPasswords]]"> <div slot="body" class="list-frame"> <div hidden$="[[!eligibleForAccountStorage_]]"
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_section.ts b/chrome/browser/resources/settings/autofill_page/passwords_section.ts index 85ea4c7..d0948fbb 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_section.ts +++ b/chrome/browser/resources/settings/autofill_page/passwords_section.ts
@@ -195,13 +195,13 @@ }, /** - * Whether the edit dialog and removal notification should show + * If true, the edit dialog and removal notification show * information about which location(s) a password is stored. */ - shouldShowStorageDetails_: { + isAccountStoreUser_: { type: Boolean, value: false, - computed: 'computeShouldShowStorageDetails_(' + + computed: 'computeIsAccountStoreUser_(' + 'eligibleForAccountStorage_, isOptedInForAccountStorage_)', }, @@ -283,7 +283,7 @@ private numberOfDevicePasswords_: number; private hasPasswordExceptions_: boolean; private shouldShowBanner_: boolean; - private shouldShowStorageDetails_: boolean; + private isAccountStoreUser_: boolean; private shouldShowDevicePasswordsLink_: boolean; private shouldOfferTrustedVaultOptIn_: boolean; private hasLeakedCredentials_: boolean; @@ -446,7 +446,7 @@ this.hasNeverCheckedPasswords_ && !this.hasLeakedCredentials_; } - private computeShouldShowStorageDetails_(): boolean { + private computeIsAccountStoreUser_(): boolean { return this.eligibleForAccountStorage_ && this.isOptedInForAccountStorage_; }
diff --git a/chrome/browser/resources/settings/controls/BUILD.gn b/chrome/browser/resources/settings/controls/BUILD.gn index 6f57626..a534d15 100644 --- a/chrome/browser/resources/settings/controls/BUILD.gn +++ b/chrome/browser/resources/settings/controls/BUILD.gn
@@ -18,7 +18,6 @@ ":settings_boolean_control_behavior", ":settings_checkbox", ":settings_dropdown_menu", - ":settings_idle_load", ":settings_radio_group", ":settings_slider", ":settings_textarea", @@ -99,13 +98,6 @@ ] } -js_library("settings_idle_load") { - deps = [ - "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/js:assert.m", - ] -} - js_library("settings_radio_group") { deps = [ ":pref_control_behavior",
diff --git a/chrome/browser/resources/settings/controls/settings_idle_load.js b/chrome/browser/resources/settings/controls/settings_idle_load.ts similarity index 65% rename from chrome/browser/resources/settings/controls/settings_idle_load.js rename to chrome/browser/resources/settings/controls/settings_idle_load.ts index d410d09..b708dc77 100644 --- a/chrome/browser/resources/settings/controls/settings_idle_load.js +++ b/chrome/browser/resources/settings/controls/settings_idle_load.ts
@@ -13,7 +13,14 @@ import {ensureLazyLoaded} from '../ensure_lazy_loaded.js'; -/** @polymer */ +declare global { + interface Window { + // https://github.com/microsoft/TypeScript/issues/40807 + requestIdleCallback(callback: () => void): number; + cancelIdleCallback(id: number): void; + } +} + export class SettingsIdleLoadElement extends PolymerElement { static get is() { return 'settings-idle-load'; @@ -33,50 +40,39 @@ }; } - constructor() { - super(); + url: string; + private child_: Element|null = null; + private instance_: TemplateInstanceBase|null = null; + private idleCallback_: number = 0; + private loading_: Promise<Element>|null = null; - /** @private {?Element} */ - this.child_ = null; - - /** @private {?Element|?TemplateInstanceBase} */ - this.instance_ = null; - - /** @private {number} */ - this.idleCallback_ = 0; - - /** @private {?Promise<!Element>} */ - this.loading_ = null; - } - - /** @override */ connectedCallback() { super.connectedCallback(); - this.idleCallback_ = requestIdleCallback(() => { + this.idleCallback_ = window.requestIdleCallback(() => { this.get(); }); } - /** @override */ disconnectedCallback() { super.disconnectedCallback(); // No-op if callback already fired. - cancelIdleCallback(this.idleCallback_); + window.cancelIdleCallback(this.idleCallback_); } /** - * @return {!Promise<!Element>} Resolves with the stamped child element after + * @return Resolves with the stamped child element after * the lazy module has been loaded. */ - requestLazyModule_() { + private requestLazyModule_(): Promise<Element> { return new Promise((resolve, reject) => { ensureLazyLoaded().then(() => { - const template = /** @type {!HTMLTemplateElement} */ ( - this.shadowRoot.querySelector('slot') - .assignedNodes({flatten: true}) - .filter(n => n.nodeType === Node.ELEMENT_NODE)[0]); + const template = + (this.shadowRoot!.querySelector('slot')! + .assignedNodes({flatten: true}) + .filter(n => n.nodeType === Node.ELEMENT_NODE)[0]) as + HTMLTemplateElement; const TemplateClass = templatize(template, this, { mutableData: false, @@ -88,8 +84,8 @@ assert(!this.child_); this.child_ = this.instance_.root.firstElementChild; - this.parentNode.insertBefore(this.instance_.root, this); - resolve(this.child_); + this.parentNode!.insertBefore(this.instance_.root, this); + resolve(this.child_!); this.dispatchEvent( new CustomEvent('lazy-loaded', {bubbles: true, composed: true})); @@ -98,10 +94,9 @@ } /** - * @return {!Promise<!Element>} Child element which has been stamped into the - * DOM tree. + * @return Child element which has been stamped into the DOM tree. */ - get() { + get(): Promise<Element> { if (this.loading_) { return this.loading_; } @@ -110,11 +105,7 @@ return this.loading_; } - /** - * @param {string} prop - * @param {Object} value - */ - _forwardHostPropV2(prop, value) { + private _forwardHostPropV2(prop: string, value: any) { if (this.instance_) { this.instance_.forwardHostProp(prop, value); }
diff --git a/chrome/browser/resources/settings/ensure_lazy_loaded.js b/chrome/browser/resources/settings/ensure_lazy_loaded.js deleted file mode 100644 index 40bb5b1..0000000 --- a/chrome/browser/resources/settings/ensure_lazy_loaded.js +++ /dev/null
@@ -1,37 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -let lazyLoadPromise = null; - -/** @return {!Promise<void>} Resolves when the lazy load module is imported. */ -export function ensureLazyLoaded() { - if (!lazyLoadPromise) { - const script = document.createElement('script'); - script.type = 'module'; - script.src = './lazy_load.js'; - document.body.appendChild(script); - - lazyLoadPromise = Promise.all([ - 'settings-appearance-page', 'settings-autofill-section', - 'settings-password-check', 'passwords-section', - 'settings-payments-section', 'settings-clear-browsing-data-dialog', - 'settings-search-engines-page', - // <if expr="use_nss_certs"> - 'certificate-manager', - // </if> - 'settings-a11y-page', 'settings-downloads-page', - // <if expr="not chromeos"> - 'settings-languages-page', - // </if> - 'settings-reset-page', - // <if expr="not chromeos and not lacros"> - 'settings-system-page', - // </if> - // <if expr="not chromeos and not is_macosx"> - 'settings-edit-dictionary-page', - // </if> - ].map(name => customElements.whenDefined(name))); - } - return lazyLoadPromise; -}
diff --git a/chrome/browser/resources/settings/ensure_lazy_loaded.ts b/chrome/browser/resources/settings/ensure_lazy_loaded.ts new file mode 100644 index 0000000..6bc892e --- /dev/null +++ b/chrome/browser/resources/settings/ensure_lazy_loaded.ts
@@ -0,0 +1,41 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let lazyLoadPromise: Promise<void>|null = null; + +/** @return Resolves when the lazy load module is imported. */ +export function ensureLazyLoaded(): Promise<void> { + if (lazyLoadPromise === null) { + const script = document.createElement('script'); + script.type = 'module'; + script.src = './lazy_load.js'; + document.body.appendChild(script); + + lazyLoadPromise = + Promise + .all([ + 'settings-appearance-page', 'settings-autofill-section', + 'settings-password-check', 'passwords-section', + 'settings-payments-section', + 'settings-clear-browsing-data-dialog', + 'settings-search-engines-page', + // <if expr="use_nss_certs"> + 'certificate-manager', + // </if> + 'settings-a11y-page', 'settings-downloads-page', + // <if expr="not chromeos"> + 'settings-languages-page', + // </if> + 'settings-reset-page', + // <if expr="not chromeos and not lacros"> + 'settings-system-page', + // </if> + // <if expr="not chromeos and not is_macosx"> + 'settings-edit-dictionary-page', + // </if> + ].map(name => customElements.whenDefined(name))) + .then(() => {}); + } + return lazyLoadPromise!; +}
diff --git a/chrome/browser/resources/settings/open_window_proxy.js b/chrome/browser/resources/settings/open_window_proxy.js deleted file mode 100644 index 1c7b5b9..0000000 --- a/chrome/browser/resources/settings/open_window_proxy.js +++ /dev/null
@@ -1,38 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * @fileoverview A helper object used to open a URL in a new tab. - * the browser. - */ - -/** @interface */ -export class OpenWindowProxy { - /** - * Opens the specified URL in a new tab. - * @param {string} url - */ - openURL(url) {} -} - -/** @implements {OpenWindowProxy} */ -export class OpenWindowProxyImpl { - /** @override */ - openURL(url) { - window.open(url); - } - - /** @return {!OpenWindowProxy} */ - static getInstance() { - return instance || (instance = new OpenWindowProxyImpl()); - } - - /** @param {!OpenWindowProxy} obj */ - static setInstance(obj) { - instance = obj; - } -} - -/** @type {?OpenWindowProxy} */ -let instance = null;
diff --git a/chrome/browser/resources/settings/open_window_proxy.ts b/chrome/browser/resources/settings/open_window_proxy.ts new file mode 100644 index 0000000..f53646b7 --- /dev/null +++ b/chrome/browser/resources/settings/open_window_proxy.ts
@@ -0,0 +1,31 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * @fileoverview A helper object used to open a URL in a new tab. + * the browser. + */ + +export interface OpenWindowProxy { + /** + * Opens the specified URL in a new tab. + */ + openURL(url: string): void; +} + +export class OpenWindowProxyImpl implements OpenWindowProxy { + openURL(url: string) { + window.open(url); + } + + static getInstance(): OpenWindowProxy { + return instance || (instance = new OpenWindowProxyImpl()); + } + + static setInstance(obj: OpenWindowProxy) { + instance = obj; + } +} + +let instance: OpenWindowProxy|null = null;
diff --git a/chrome/browser/resources/settings/search_settings.ts b/chrome/browser/resources/settings/search_settings.ts index 9f756a5..5ad44b7 100644 --- a/chrome/browser/resources/settings/search_settings.ts +++ b/chrome/browser/resources/settings/search_settings.ts
@@ -18,7 +18,7 @@ declare global { interface Window { // https://github.com/microsoft/TypeScript/issues/40807 - requestIdleCallback(callback: () => void): void; + requestIdleCallback(callback: () => void): number; } }
diff --git a/chrome/browser/resources/settings/site_favicon.js b/chrome/browser/resources/settings/site_favicon.ts similarity index 82% rename from chrome/browser/resources/settings/site_favicon.js rename to chrome/browser/resources/settings/site_favicon.ts index 3db610ca..3ea83e79 100644 --- a/chrome/browser/resources/settings/site_favicon.js +++ b/chrome/browser/resources/settings/site_favicon.ts
@@ -28,8 +28,10 @@ }; } - /** @private */ - getBackgroundImage_() { + faviconUrl: string; + url: string; + + private getBackgroundImage_() { let backgroundImage = getFavicon(''); if (this.faviconUrl) { const url = this.ensureUrlHasScheme_(this.faviconUrl); @@ -44,11 +46,10 @@ /** * Removes the wildcard prefix from a pattern string. - * @param {string} pattern The pattern to remove the wildcard from. - * @return {string} The resulting pattern. - * @private + * @param pattern The pattern to remove the wildcard from. + * @return The resulting pattern. */ - removePatternWildcard_(pattern) { + private removePatternWildcard_(pattern: string): string { if (!pattern || pattern.length === 0) { return pattern; } @@ -65,11 +66,10 @@ /** * Ensures the URL has a scheme (assumes http if omitted). - * @param {string} url The URL with or without a scheme. - * @return {string} The URL with a scheme, or an empty string. - * @private + * @param url The URL with or without a scheme. + * @return The URL with a scheme, or an empty string. */ - ensureUrlHasScheme_(url) { + private ensureUrlHasScheme_(url: string): string { if (!url || url.length === 0) { return url; }
diff --git a/chrome/browser/share/share_ranking.cc b/chrome/browser/share/share_ranking.cc index 6b70516..9cddc40b7 100644 --- a/chrome/browser/share/share_ranking.cc +++ b/chrome/browser/share/share_ranking.cc
@@ -458,7 +458,8 @@ std::vector<ShareHistory::Target> history) { pending->all_history = history; if (pending->history_db) { - pending->history_db->GetFlatShareHistory( + auto history_db = pending->history_db; + history_db->GetFlatShareHistory( base::BindOnce(&ShareRanking::OnRankGetRecentDone, weak_factory_.GetWeakPtr(), std::move(pending)), kRecentWindowDays);
diff --git a/chrome/browser/signin/ui/android/BUILD.gn b/chrome/browser/signin/ui/android/BUILD.gn index 25fb8811..cd352a4 100644 --- a/chrome/browser/signin/ui/android/BUILD.gn +++ b/chrome/browser/signin/ui/android/BUILD.gn
@@ -176,7 +176,7 @@ "java/src/org/chromium/chrome/browser/signin/ui/account_picker/AccountPickerBottomSheetRenderTest.java", "java/src/org/chromium/chrome/browser/signin/ui/account_picker/AccountPickerBottomSheetTest.java", "java/src/org/chromium/chrome/browser/signin/ui/account_picker/AccountPickerDialogTest.java", - "java/src/org/chromium/chrome/browser/signin/ui/fre/FreUMADialogRenderTest.java", + "java/src/org/chromium/chrome/browser/signin/ui/fre/FreUMADialogTest.java", ] deps = [ ":java",
diff --git a/chrome/browser/signin/ui/android/java/res/layout/fre_uma_dialog.xml b/chrome/browser/signin/ui/android/java/res/layout/fre_uma_dialog.xml index 9717a70..7e256a27 100644 --- a/chrome/browser/signin/ui/android/java/res/layout/fre_uma_dialog.xml +++ b/chrome/browser/signin/ui/android/java/res/layout/fre_uma_dialog.xml
@@ -18,10 +18,21 @@ <TextView android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/signin_fre_uma_dialog_section_margin" + android:layout_marginBottom="10dp" android:text="@string/signin_fre_uma_dialog_title" style="@style/TextAppearance.Headline.Primary" /> + <Switch + android:id="@+id/fre_uma_dialog_switch" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + android:text="@string/usage_and_crash_reports_title" + android:checked="true" + android:gravity="start|center" + android:lineSpacingMultiplier="1.2" + style="@style/TextAppearance.TextLarge.Primary" /> + <TextView android:layout_width="match_parent" android:layout_height="wrap_content"
diff --git a/chrome/browser/signin/ui/android/java/src/org/chromium/chrome/browser/signin/ui/fre/FreUMADialogCoordinator.java b/chrome/browser/signin/ui/android/java/src/org/chromium/chrome/browser/signin/ui/fre/FreUMADialogCoordinator.java index 2325089..5bd85f9 100644 --- a/chrome/browser/signin/ui/android/java/src/org/chromium/chrome/browser/signin/ui/fre/FreUMADialogCoordinator.java +++ b/chrome/browser/signin/ui/android/java/src/org/chromium/chrome/browser/signin/ui/fre/FreUMADialogCoordinator.java
@@ -7,6 +7,7 @@ import android.content.Context; import android.view.LayoutInflater; import android.view.View; +import android.widget.Switch; import androidx.annotation.MainThread; import androidx.annotation.VisibleForTesting; @@ -24,6 +25,13 @@ * Google in the First Run Experience signin screen. */ public class FreUMADialogCoordinator { + /** + * Callback for the switch in the dialog. + */ + public interface Listener { + void onAllowCrashUploadChecked(boolean isChecked); + } + private final ModalDialogManager mDialogManager; private final PropertyModel mModel; private final View mView; @@ -32,8 +40,9 @@ * Constructs the coordinator and shows the dialog. */ @MainThread - public FreUMADialogCoordinator(Context context, ModalDialogManager modalDialogManager) { - mView = inflateFreFooterDialogView(context); + public FreUMADialogCoordinator( + Context context, ModalDialogManager modalDialogManager, Listener listener) { + mView = inflateFreFooterDialogView(context, listener); mDialogManager = modalDialogManager; mModel = new PropertyModel.Builder(ModalDialogProperties.ALL_KEYS) .with(ModalDialogProperties.CANCEL_ON_TOUCH_OUTSIDE, true) @@ -53,13 +62,15 @@ }; } - private View inflateFreFooterDialogView(Context context) { + private View inflateFreFooterDialogView(Context context, Listener listener) { View view = LayoutInflater.from(context).inflate(R.layout.fre_uma_dialog, null); view.findViewById(R.id.fre_uma_dialog_dismiss_button) .setOnClickListener(v -> mDialogManager.dismissDialog( mModel, DialogDismissalCause.ACTION_ON_CONTENT)); - + Switch umaSwitch = view.findViewById(R.id.fre_uma_dialog_switch); + umaSwitch.setOnCheckedChangeListener( + (compoundButton, isChecked) -> listener.onAllowCrashUploadChecked(isChecked)); return view; }
diff --git a/chrome/browser/signin/ui/android/java/src/org/chromium/chrome/browser/signin/ui/fre/FreUMADialogRenderTest.java b/chrome/browser/signin/ui/android/java/src/org/chromium/chrome/browser/signin/ui/fre/FreUMADialogTest.java similarity index 68% rename from chrome/browser/signin/ui/android/java/src/org/chromium/chrome/browser/signin/ui/fre/FreUMADialogRenderTest.java rename to chrome/browser/signin/ui/android/java/src/org/chromium/chrome/browser/signin/ui/fre/FreUMADialogTest.java index f5b0b7f8..fdff06666 100644 --- a/chrome/browser/signin/ui/android/java/src/org/chromium/chrome/browser/signin/ui/fre/FreUMADialogRenderTest.java +++ b/chrome/browser/signin/ui/android/java/src/org/chromium/chrome/browser/signin/ui/fre/FreUMADialogTest.java
@@ -4,9 +4,22 @@ package org.chromium.chrome.browser.signin.ui.fre; +import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.action.ViewActions.click; +import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist; +import static androidx.test.espresso.assertion.ViewAssertions.matches; +import static androidx.test.espresso.matcher.ViewMatchers.isChecked; +import static androidx.test.espresso.matcher.ViewMatchers.withId; +import static androidx.test.espresso.matcher.ViewMatchers.withText; + +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + import android.app.Activity; import androidx.test.filters.LargeTest; +import androidx.test.filters.MediumTest; import org.junit.After; import org.junit.AfterClass; @@ -16,6 +29,9 @@ import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; import org.chromium.base.test.BaseActivityTestRule; import org.chromium.base.test.params.ParameterAnnotations; @@ -27,6 +43,7 @@ import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.night_mode.ChromeNightModeTestUtils; import org.chromium.chrome.browser.signin.ui.R; +import org.chromium.chrome.browser.signin.ui.fre.FreUMADialogCoordinator.Listener; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; import org.chromium.chrome.test.util.ChromeRenderTestRule; import org.chromium.components.browser_ui.modaldialog.AppModalPresenter; @@ -45,7 +62,7 @@ @ParameterAnnotations.UseRunnerDelegate(ChromeJUnit4RunnerDelegate.class) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) @Batch(Batch.PER_CLASS) -public class FreUMADialogRenderTest { +public class FreUMADialogTest { @ClassRule public static BaseActivityTestRule<DummyUiActivity> activityTestRule = new BaseActivityTestRule<>(DummyUiActivity.class); @@ -53,9 +70,15 @@ private static Activity sActivity; @Rule + public final MockitoRule mMockitoRule = MockitoJUnit.rule(); + + @Rule public final ChromeRenderTestRule mRenderTestRule = ChromeRenderTestRule.Builder.withPublicCorpus().build(); + @Mock + private Listener mListenerMock; + private FreUMADialogCoordinator mCoordinator; @ParameterAnnotations.UseMethodParameterBefore(NightModeTestUtils.NightModeParams.class) @@ -82,7 +105,8 @@ public void setUp() { TestThreadUtils.runOnUiThreadBlocking(() -> { mCoordinator = new FreUMADialogCoordinator(sActivity, - new ModalDialogManager(new AppModalPresenter(sActivity), ModalDialogType.APP)); + new ModalDialogManager(new AppModalPresenter(sActivity), ModalDialogType.APP), + mListenerMock); }); } @@ -97,6 +121,26 @@ } @Test + @MediumTest + public void testTurningOffAllowCrashUpload() { + onView(withId(R.id.fre_uma_dialog_switch)).perform(click()); + onView(withText(org.chromium.chrome.R.string.done)).perform(click()); + + onView(withText(R.string.signin_fre_uma_dialog_title)).check(doesNotExist()); + verify(mListenerMock).onAllowCrashUploadChecked(false); + } + + @Test + @MediumTest + public void testLeavingAllowCrashUploadOn() { + onView(withId(R.id.fre_uma_dialog_switch)).check(matches(isChecked())); + onView(withText(org.chromium.chrome.R.string.done)).perform(click()); + + onView(withText(R.string.signin_fre_uma_dialog_title)).check(doesNotExist()); + verify(mListenerMock, never()).onAllowCrashUploadChecked(anyBoolean()); + } + + @Test @LargeTest @Feature("RenderTest") @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class)
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 250ac5e..6caabc0 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -645,6 +645,17 @@ ] } + if (is_win || is_linux || is_mac || is_chromeos_ash) { + sources += [ + "webui/connectors_internals/connectors_internals_page_handler.cc", + "webui/connectors_internals/connectors_internals_page_handler.h", + "webui/connectors_internals/connectors_internals_ui.cc", + "webui/connectors_internals/connectors_internals_ui.h", + ] + + deps += [ "//chrome/browser/ui/webui/connectors_internals:mojo_bindings" ] + } + if (!is_fuchsia) { deps += [ "//components/crash/core/app" ] } @@ -2492,6 +2503,8 @@ "webui/chromeos/login/oobe_ui.h", "webui/chromeos/login/os_install_screen_handler.cc", "webui/chromeos/login/os_install_screen_handler.h", + "webui/chromeos/login/os_trial_screen_handler.cc", + "webui/chromeos/login/os_trial_screen_handler.h", "webui/chromeos/login/packaged_license_screen_handler.cc", "webui/chromeos/login/packaged_license_screen_handler.h", "webui/chromeos/login/parental_handoff_screen_handler.cc",
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd index cba4e80..ae974ec 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
@@ -352,7 +352,7 @@ For more settings that relate to privacy, security, and data collection, see <ph name="BEGIN_LINK"><link></ph>Google services<ph name="END_LINK"></link></ph> </message> <message name="IDS_USAGE_AND_CRASH_REPORTS_TITLE" desc="Title for a preference that enables sending usage statistics and crash reports."> - Help improve Chrome's features and performance + Help improve Chrome\u2019s features and performance </message> <message name="IDS_USAGE_AND_CRASH_REPORTS_SUMMARY" desc="Description for 'Help improve Chrome's features and performance' preference."> Automatically sends usage statistics and crash reports to Google
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_USAGE_AND_CRASH_REPORTS_TITLE.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_USAGE_AND_CRASH_REPORTS_TITLE.png.sha1 new file mode 100644 index 0000000..13d4526 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_USAGE_AND_CRASH_REPORTS_TITLE.png.sha1
@@ -0,0 +1 @@ +639ada6881d613cba08654949a8680b1d64cfb52 \ No newline at end of file
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc index 470326a..0cba77a 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -50,6 +50,7 @@ #include "chromeos/services/multidevice_setup/multidevice_setup_service.h" #include "components/app_restore/app_launch_info.h" #include "components/app_restore/app_restore_data.h" +#include "components/app_restore/features.h" #include "components/app_restore/full_restore_save_handler.h" #include "components/app_restore/full_restore_utils.h" #include "components/app_restore/restore_data.h" @@ -104,13 +105,23 @@ // Returns true if `window` is supported in desk templates feature. bool IsWindowSupportedForDeskTemplate(aura::Window* window, Profile* user_profile) { - // For now we'll ignore ARC, crostini and lacros windows in desk template. + // For now we'll crostini and lacros windows in desk template. We'll also + // ignore ARC apps unless the flag is turned on. const ash::AppType app_type = static_cast<ash::AppType>(window->GetProperty(aura::client::kAppType)); - if (app_type != ash::AppType::BROWSER && - app_type != ash::AppType::CHROME_APP && - app_type != ash::AppType::SYSTEM_APP) { - return false; + switch (app_type) { + case ash::AppType::NON_APP: + case ash::AppType::CROSTINI_APP: + case ash::AppType::LACROS: + return false; + case ash::AppType::ARC_APP: + if (!app_restore::features::IsArcAppsForDesksTemplatesEnabled()) + return false; + break; + case ash::AppType::BROWSER: + case ash::AppType::CHROME_APP: + case ash::AppType::SYSTEM_APP: + break; } DCHECK(user_profile);
diff --git a/chrome/browser/ui/ash/shelf/arc_shelf_spinner_item_controller.cc b/chrome/browser/ui/ash/shelf/arc_shelf_spinner_item_controller.cc index de44e306..15ff594 100644 --- a/chrome/browser/ui/ash/shelf/arc_shelf_spinner_item_controller.cc +++ b/chrome/browser/ui/ash/shelf/arc_shelf_spinner_item_controller.cc
@@ -56,7 +56,7 @@ window_info_->window_id > full_restore::kArcSessionIdOffsetForRestoredLaunching) { ash::app_restore::AppRestoreArcTaskHandler::GetForProfile(observed_profile_) - ->arc_app_launch_handler() + ->full_restore_arc_app_launch_handler() ->LaunchApp(app_id()); std::move(callback).Run(ash::SHELF_ACTION_NEW_WINDOW_CREATED, {}); return;
diff --git a/chrome/browser/ui/extensions/hosted_app_browsertest.cc b/chrome/browser/ui/extensions/hosted_app_browsertest.cc index 32a822e..b83d98a2 100644 --- a/chrome/browser/ui/extensions/hosted_app_browsertest.cc +++ b/chrome/browser/ui/extensions/hosted_app_browsertest.cc
@@ -342,7 +342,8 @@ }; // Tests that "Open link in new tab" opens a link in a foreground tab. -IN_PROC_BROWSER_TEST_P(HostedOrWebAppTest, OpenLinkInNewTab) { +// TODO(crbug.com/1253366): flaky. +IN_PROC_BROWSER_TEST_P(HostedOrWebAppTest, DISABLED_OpenLinkInNewTab) { SetupAppWithURL(GURL(kExampleURL)); const GURL url("http://www.foo.com/");
diff --git a/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.cc b/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.cc index 32082467..afcd2e4 100644 --- a/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.cc +++ b/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.cc
@@ -6,10 +6,12 @@ #include "build/build_config.h" #include "chrome/browser/content_settings/chrome_content_settings_utils.h" +#include "chrome/browser/page_info/about_this_site_service_factory.h" #include "chrome/browser/permissions/permission_manager_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" #include "components/content_settings/core/common/content_settings_types.h" +#include "components/page_info/about_this_site_service.h" #include "components/permissions/permission_manager.h" #include "components/prefs/pref_service.h" #include "components/strings/grit/components_strings.h" @@ -91,6 +93,14 @@ return std::u16string(); } +std::u16string ChromePageInfoUiDelegate::GetAboutThisSiteDescription() { + if (auto* service = + AboutThisSiteServiceFactory::GetForProfile(GetProfile())) { + return service->GetAboutThisSiteDescription(site_url_); + } + return std::u16string(); +} + bool ChromePageInfoUiDelegate::ShouldShowAsk(ContentSettingsType type) { return permissions::PermissionUtil::IsGuardContentSetting(type); }
diff --git a/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.h b/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.h index db9de7e..54407171 100644 --- a/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.h +++ b/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.h
@@ -33,6 +33,9 @@ // If "allow" option is not available, return the reason why. std::u16string GetAutomaticallyBlockedReason(ContentSettingsType type); + // Returns "About this site" description for the active page. + std::u16string GetAboutThisSiteDescription(); + #if !defined(OS_ANDROID) // If PageInfo should show a link to the site or app's settings page, this // will return true and set the params to the appropriate resource IDs (IDS_*).
diff --git a/chrome/browser/ui/views/page_info/page_info_main_view.cc b/chrome/browser/ui/views/page_info/page_info_main_view.cc index a5d726f..d96fb23a 100644 --- a/chrome/browser/ui/views/page_info/page_info_main_view.cc +++ b/chrome/browser/ui/views/page_info/page_info_main_view.cc
@@ -20,6 +20,7 @@ #include "chrome/browser/ui/views/page_info/permission_toggle_row_view.h" #include "chrome/browser/vr/vr_tab_helper.h" #include "chrome/common/url_constants.h" +#include "components/page_info/features.h" #include "components/permissions/permission_util.h" #include "components/strings/grit/components_chromium_strings.h" #include "components/strings/grit/components_strings.h" @@ -86,6 +87,15 @@ permissions_view_->SetLayoutManager(std::make_unique<views::FlexLayout>()) ->SetOrientation(views::LayoutOrientation::kVertical); + if (base::FeatureList::IsEnabled(page_info::kPageInfoAboutThisSite)) { + std::u16string description = ui_delegate_->GetAboutThisSiteDescription(); + if (!description.empty()) { + layout->StartRow(views::GridLayout::kFixedSize, kColumnId); + about_this_site_section_ = + layout->AddView(CreateAboutThisSiteSection(description)); + } + } + layout->StartRow(views::GridLayout::kFixedSize, kColumnId); site_settings_view_ = layout->AddView(CreateContainerView()); @@ -263,7 +273,11 @@ // show reset button. reset_button_->SetVisible(false); UpdateResetButton(permission_info_list); - permissions_view_->AddChildView(PageInfoViewFactory::CreateSeparator()); + // 'About this site' section has separators on top and bottom. If it is shown, + // bottom separator here isn't needed anymore. + if (!about_this_site_section_) { + permissions_view_->AddChildView(PageInfoViewFactory::CreateSeparator()); + } PreferredSizeChanged(); } @@ -485,3 +499,29 @@ return header; } + +std::unique_ptr<views::View> PageInfoMainView::CreateAboutThisSiteSection( + std::u16string description) { + auto about_this_site_section = std::make_unique<views::View>(); + about_this_site_section + ->SetLayoutManager(std::make_unique<views::FlexLayout>()) + ->SetOrientation(views::LayoutOrientation::kVertical); + about_this_site_section->AddChildView(PageInfoViewFactory::CreateSeparator()); + + // TODO(crbug.com/1250653): Update with the actual strings. + auto* about_this_site_button = about_this_site_section->AddChildView( + std::make_unique<PageInfoHoverButton>( + base::BindRepeating( + [](PageInfoMainView* view) { + // TODO(crbug.com/1250653): Open 'About this site' subpage. + }, + this), + PageInfoViewFactory::GetAboutThisSiteIcon(), 0, std::u16string(), + PageInfoViewFactory::VIEW_ID_PAGE_INFO_ABOUT_THIS_SITE_BUTTON, + std::u16string(), description, + PageInfoViewFactory::GetOpenSubpageIcon())); + about_this_site_button->SetTitleText(u"About this site"); + + about_this_site_section->AddChildView(PageInfoViewFactory::CreateSeparator()); + return about_this_site_section; +}
diff --git a/chrome/browser/ui/views/page_info/page_info_main_view.h b/chrome/browser/ui/views/page_info/page_info_main_view.h index e3a77bc6..a329af5 100644 --- a/chrome/browser/ui/views/page_info/page_info_main_view.h +++ b/chrome/browser/ui/views/page_info/page_info_main_view.h
@@ -92,6 +92,11 @@ // the label depending on the number of visible permissions. void UpdateResetButton(const PermissionInfoList& permission_info_list); + // Creates 'About this site' section which contains a button that opens a + // subpage and two separators. + std::unique_ptr<views::View> CreateAboutThisSiteSection( + std::u16string description) WARN_UNUSED_RESULT; + PageInfo* presenter_; ChromePageInfoUiDelegate* ui_delegate_; @@ -117,6 +122,10 @@ // button, surrounded by separators. views::View* permissions_view_ = nullptr; + // The section that contains "About this site" button that opens a + // subpage and two separators. + views::View* about_this_site_section_ = nullptr; + // The view that contains `SecurityInformationView` and a certificate button. PageInfoSecurityContentView* security_content_view_ = nullptr;
diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.cc b/chrome/browser/ui/views/page_info/page_info_view_factory.cc index 7012c43..1884b6e 100644 --- a/chrome/browser/ui/views/page_info/page_info_view_factory.cc +++ b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
@@ -30,6 +30,7 @@ #include "ui/views/layout/box_layout.h" #include "ui/views/layout/flex_layout.h" #include "ui/views/layout/grid_layout.h" +#include "ui/views/vector_icons.h" constexpr int PageInfoViewFactory::kMinBubbleWidth; constexpr int PageInfoViewFactory::kMaxBubbleWidth; @@ -384,6 +385,12 @@ } // static +const ui::ImageModel PageInfoViewFactory::GetAboutThisSiteIcon() { + return ui::ImageModel::FromVectorIcon( + views::kInfoIcon, ui::NativeTheme::kColorId_DefaultIconColor); +} + +// static const ui::ImageModel PageInfoViewFactory::GetManagedPermissionIcon( const PageInfo::PermissionInfo& info) { const gfx::VectorIcon& managed_vector_icon =
diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.h b/chrome/browser/ui/views/page_info/page_info_view_factory.h index 08edf9a..3663bc9 100644 --- a/chrome/browser/ui/views/page_info/page_info_view_factory.h +++ b/chrome/browser/ui/views/page_info/page_info_view_factory.h
@@ -45,6 +45,7 @@ VIEW_ID_PAGE_INFO_CLOSE_BUTTON, VIEW_ID_PAGE_INFO_CURRENT_VIEW, VIEW_ID_PAGE_INFO_RESET_PERMISSIONS_BUTTON, + VIEW_ID_PAGE_INFO_ABOUT_THIS_SITE_BUTTON, }; // Creates a separator view with padding on top and bottom. Use with flex @@ -96,6 +97,9 @@ static const ui::ImageModel GetManagedPermissionIcon( const PageInfo::PermissionInfo& info); + // Returns the icon for 'About this site' button. + static const ui::ImageModel GetAboutThisSiteIcon(); + std::unique_ptr<views::View> CreateMainPageView() WARN_UNUSED_RESULT; std::unique_ptr<views::View> CreateSecurityPageView() WARN_UNUSED_RESULT; std::unique_ptr<views::View> CreatePermissionPageView(
diff --git a/chrome/browser/ui/views/side_search/side_search_browser_controller_browsertest.cc b/chrome/browser/ui/views/side_search/side_search_browser_controller_browsertest.cc index 7d267ed5..a3f96e9 100644 --- a/chrome/browser/ui/views/side_search/side_search_browser_controller_browsertest.cc +++ b/chrome/browser/ui/views/side_search/side_search_browser_controller_browsertest.cc
@@ -54,59 +54,66 @@ return {features::kSideSearch}; } - void ActivateTabAt(int index) { - browser()->tab_strip_model()->ActivateTabAt(index); + void ActivateTabAt(Browser* browser, int index) { + browser->tab_strip_model()->ActivateTabAt(index); } - void AppendTab(const std::string& url) { - chrome::AddTabAt(browser(), GURL(url), -1, true); + void AppendTab(Browser* browser, const std::string& url) { + chrome::AddTabAt(browser, GURL(url), -1, true); } - void NavigateActiveTab(const std::string& url) { - ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL(url))); + void NavigateActiveTab(Browser* browser, const std::string& url) { + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser, GURL(url))); } - void NotifyButtonClick() { - views::test::ButtonTestApi(side_panel_button()) + void NotifyButtonClick(Browser* browser) { + views::test::ButtonTestApi(GetSidePanelButtonFor(browser)) .NotifyClick(GetDummyEvent()); } - void NotifyCloseButtonClick() { - ASSERT_TRUE(side_panel()->GetVisible()); - views::test::ButtonTestApi(side_panel_close_button()) + void NotifyCloseButtonClick(Browser* browser) { + ASSERT_TRUE(GetSidePanelFor(browser)->GetVisible()); + views::test::ButtonTestApi(GetSideButtonClosePanelFor(browser)) .NotifyClick(GetDummyEvent()); } - BrowserView* browser_view() { - return BrowserView::GetBrowserViewForBrowser(browser()); + BrowserView* BrowserViewFor(Browser* browser) { + return BrowserView::GetBrowserViewForBrowser(browser); } - ToolbarButton* side_panel_button() { - return browser_view()->toolbar()->left_side_panel_button(); + ToolbarButton* GetSidePanelButtonFor(Browser* browser) { + return BrowserViewFor(browser)->toolbar()->left_side_panel_button(); } - views::ImageButton* side_panel_close_button() { + views::ImageButton* GetSideButtonClosePanelFor(Browser* browser) { return static_cast<views::ImageButton*>( - side_panel()->GetViewByID(static_cast<int>( + GetSidePanelFor(browser)->GetViewByID(static_cast<int>( SideSearchBrowserController::VIEW_ID_SIDE_PANEL_CLOSE_BUTTON))); } - SidePanel* side_panel() { - return browser_view()->left_aligned_side_panel_for_testing(); + SidePanel* GetSidePanelFor(Browser* browser) { + return BrowserViewFor(browser)->left_aligned_side_panel_for_testing(); } - void NavigateToSRPAndOpenSidePanel() { - NavigateActiveTab(kGoogleSearchURL); - EXPECT_FALSE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); + void NavigateToSRPAndNonGoogleUrl(Browser* browser) { + // The side panel button should never be visible on the Google search page. + NavigateActiveTab(browser, kGoogleSearchURL); + EXPECT_FALSE(GetSidePanelButtonFor(browser)->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser)->GetVisible()); - NavigateActiveTab(kNonGoogleURL); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); + // The side panel button should be visible if on a non-Google page and the + // current tab has previously encountered a Google search page. + NavigateActiveTab(browser, kNonGoogleURL); + EXPECT_TRUE(GetSidePanelButtonFor(browser)->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser)->GetVisible()); + } - NotifyButtonClick(); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_TRUE(side_panel()->GetVisible()); + void NavigateToSRPAndOpenSidePanel(Browser* browser) { + NavigateToSRPAndNonGoogleUrl(browser); + + NotifyButtonClick(browser); + EXPECT_TRUE(GetSidePanelButtonFor(browser)->GetVisible()); + EXPECT_TRUE(GetSidePanelFor(browser)->GetVisible()); } private: @@ -116,81 +123,81 @@ IN_PROC_BROWSER_TEST_F(SideSearchBrowserControllerTest, SidePanelButtonShowsCorrectlySingleTab) { // The side panel button should never be visible on the Google home page. - NavigateActiveTab(kGoogleSearchHomePageURL); - EXPECT_FALSE(side_panel_button()->GetVisible()); + NavigateActiveTab(browser(), kGoogleSearchHomePageURL); + EXPECT_FALSE(GetSidePanelButtonFor(browser())->GetVisible()); // If no previous Google search page has been navigated to the button should // not be visible. - NavigateActiveTab(kNonGoogleURL); - EXPECT_FALSE(side_panel_button()->GetVisible()); + NavigateActiveTab(browser(), kNonGoogleURL); + EXPECT_FALSE(GetSidePanelButtonFor(browser())->GetVisible()); // The side panel button should never be visible on the Google search page. - NavigateActiveTab(kGoogleSearchURL); - EXPECT_FALSE(side_panel_button()->GetVisible()); + NavigateActiveTab(browser(), kGoogleSearchURL); + EXPECT_FALSE(GetSidePanelButtonFor(browser())->GetVisible()); // The side panel button should be visible if on a non-Google page and the // current tab has previously encountered a Google search page. - NavigateActiveTab(kNonGoogleURL); - EXPECT_TRUE(side_panel_button()->GetVisible()); + NavigateActiveTab(browser(), kNonGoogleURL); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); // The side panel button should never be visible on the Google home page even // if it has already been navigated to a Google search page. - NavigateActiveTab(kGoogleSearchHomePageURL); - EXPECT_FALSE(side_panel_button()->GetVisible()); + NavigateActiveTab(browser(), kGoogleSearchHomePageURL); + EXPECT_FALSE(GetSidePanelButtonFor(browser())->GetVisible()); // The side panel button should be visible if on a non-Google page and the // current tab has previously encountered a Google search page. - NavigateActiveTab(kNonGoogleURL); - EXPECT_TRUE(side_panel_button()->GetVisible()); + NavigateActiveTab(browser(), kNonGoogleURL); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); } IN_PROC_BROWSER_TEST_F(SideSearchBrowserControllerTest, SidePanelButtonShowsCorrectlyMultipleTabs) { // The side panel button should never be visible on the Google home page. - AppendTab(kGoogleSearchHomePageURL); - ActivateTabAt(1); - EXPECT_FALSE(side_panel_button()->GetVisible()); + AppendTab(browser(), kGoogleSearchHomePageURL); + ActivateTabAt(browser(), 1); + EXPECT_FALSE(GetSidePanelButtonFor(browser())->GetVisible()); // Navigate to a Google search page and then to a non-Google search page. This // should show the side panel button in the toolbar. - AppendTab(kGoogleSearchURL); - ActivateTabAt(2); - EXPECT_FALSE(side_panel_button()->GetVisible()); - NavigateActiveTab(kNonGoogleURL); - EXPECT_TRUE(side_panel_button()->GetVisible()); + AppendTab(browser(), kGoogleSearchURL); + ActivateTabAt(browser(), 2); + EXPECT_FALSE(GetSidePanelButtonFor(browser())->GetVisible()); + NavigateActiveTab(browser(), kNonGoogleURL); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); // Switch back to the Google search page, the side panel button should no // longer be visible. - ActivateTabAt(1); - EXPECT_FALSE(side_panel_button()->GetVisible()); + ActivateTabAt(browser(), 1); + EXPECT_FALSE(GetSidePanelButtonFor(browser())->GetVisible()); // When switching back to the tab on the non-Google page with a previously // visited Google search page the button should be visible. - ActivateTabAt(2); - EXPECT_TRUE(side_panel_button()->GetVisible()); + ActivateTabAt(browser(), 2); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); } IN_PROC_BROWSER_TEST_F(SideSearchBrowserControllerTest, SidePanelTogglesCorrectlySingleTab) { - NavigateActiveTab(kGoogleSearchURL); - EXPECT_FALSE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); + NavigateActiveTab(browser(), kGoogleSearchURL); + EXPECT_FALSE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); // The side panel button should be visible if on a non-Google page and the // current tab has previously encountered a Google search page. - NavigateActiveTab(kNonGoogleURL); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); + NavigateActiveTab(browser(), kNonGoogleURL); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); // Toggle the side panel. - NotifyButtonClick(); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_TRUE(side_panel()->GetVisible()); + NotifyButtonClick(browser()); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_TRUE(GetSidePanelFor(browser())->GetVisible()); // Toggling the button again should close the side panel. - NotifyButtonClick(); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); + NotifyButtonClick(browser()); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); } IN_PROC_BROWSER_TEST_F(SideSearchBrowserControllerTest, @@ -199,49 +206,67 @@ // independent browser tabs such that both have the side panel ready. // Tab 1. - NavigateActiveTab(kGoogleSearchURL); - EXPECT_FALSE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); - NavigateActiveTab(kNonGoogleURL); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); + NavigateActiveTab(browser(), kGoogleSearchURL); + EXPECT_FALSE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); + NavigateActiveTab(browser(), kNonGoogleURL); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); // Tab 2. - AppendTab(kGoogleSearchURL); - ActivateTabAt(1); - EXPECT_FALSE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); - NavigateActiveTab(kNonGoogleURL); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); + AppendTab(browser(), kGoogleSearchURL); + ActivateTabAt(browser(), 1); + EXPECT_FALSE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); + NavigateActiveTab(browser(), kNonGoogleURL); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); // Show the side panel on Tab 2 and switch to Tab 1. The side panel should // still be visible. - NotifyButtonClick(); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_TRUE(side_panel()->GetVisible()); + NotifyButtonClick(browser()); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_TRUE(GetSidePanelFor(browser())->GetVisible()); - ActivateTabAt(0); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_TRUE(side_panel()->GetVisible()); + ActivateTabAt(browser(), 0); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_TRUE(GetSidePanelFor(browser())->GetVisible()); // Hide the side panel on Tab 1 and switch to Tab 2. The side panel should be // hidden after the tab switch. - NotifyButtonClick(); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); + NotifyButtonClick(browser()); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); - ActivateTabAt(1); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); + ActivateTabAt(browser(), 1); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); } IN_PROC_BROWSER_TEST_F(SideSearchBrowserControllerTest, CloseButtonClosesSidePanel) { // The close button should be visible in the toggled state. - NavigateToSRPAndOpenSidePanel(); - EXPECT_TRUE(side_panel()->GetVisible()); - NotifyCloseButtonClick(); + NavigateToSRPAndOpenSidePanel(browser()); + EXPECT_TRUE(GetSidePanelFor(browser())->GetVisible()); + NotifyCloseButtonClick(browser()); +} + +IN_PROC_BROWSER_TEST_F( + SideSearchBrowserControllerTest, + SidePanelStatePreservedWhenMovingTabsAcrossBrowserWindows) { + NavigateToSRPAndOpenSidePanel(browser()); + + Browser* browser2 = CreateBrowser(browser()->profile()); + NavigateToSRPAndNonGoogleUrl(browser2); + + std::unique_ptr<content::WebContents> web_contents = + browser2->tab_strip_model()->DetachWebContentsAtForInsertion(0); + browser()->tab_strip_model()->InsertWebContentsAt(1, std::move(web_contents), + TabStripModel::ADD_ACTIVE); + + ASSERT_EQ(1, browser()->tab_strip_model()->active_index()); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_TRUE(GetSidePanelFor(browser())->GetVisible()); } class SideSearchStatePerTabBrowserControllerTest @@ -255,6 +280,28 @@ } }; +IN_PROC_BROWSER_TEST_F( + SideSearchStatePerTabBrowserControllerTest, + SidePanelStatePreservedWhenMovingTabsAcrossBrowserWindows) { + NavigateToSRPAndOpenSidePanel(browser()); + + Browser* browser2 = CreateBrowser(browser()->profile()); + NavigateToSRPAndNonGoogleUrl(browser2); + + std::unique_ptr<content::WebContents> web_contents = + browser2->tab_strip_model()->DetachWebContentsAtForInsertion(0); + browser()->tab_strip_model()->InsertWebContentsAt(1, std::move(web_contents), + TabStripModel::ADD_ACTIVE); + + ASSERT_EQ(2, browser()->tab_strip_model()->GetTabCount()); + ASSERT_EQ(1, browser()->tab_strip_model()->active_index()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); + + ActivateTabAt(browser(), 0); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_TRUE(GetSidePanelFor(browser())->GetVisible()); +} + IN_PROC_BROWSER_TEST_F(SideSearchStatePerTabBrowserControllerTest, SidePanelTogglesCorrectlyMultipleTabs) { // Navigate to a Google search URL followed by a non-Google URL in two @@ -262,49 +309,49 @@ // side panel should respect the state-per-tab flag. // Tab 1. - NavigateActiveTab(kGoogleSearchURL); - EXPECT_FALSE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); - NavigateActiveTab(kNonGoogleURL); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); + NavigateActiveTab(browser(), kGoogleSearchURL); + EXPECT_FALSE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); + NavigateActiveTab(browser(), kNonGoogleURL); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); // Tab 2. - AppendTab(kGoogleSearchURL); - ActivateTabAt(1); - EXPECT_FALSE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); - NavigateActiveTab(kNonGoogleURL); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); + AppendTab(browser(), kGoogleSearchURL); + ActivateTabAt(browser(), 1); + EXPECT_FALSE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); + NavigateActiveTab(browser(), kNonGoogleURL); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); // Show the side panel on Tab 2 and switch to Tab 1. The side panel should // not be visible for Tab 1. - NotifyButtonClick(); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_TRUE(side_panel()->GetVisible()); + NotifyButtonClick(browser()); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_TRUE(GetSidePanelFor(browser())->GetVisible()); - ActivateTabAt(0); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); + ActivateTabAt(browser(), 0); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); // Show the side panel on Tab 1 and switch to Tab 2. The side panel should be // still be visible for Tab 2, respecting its per-tab state. - NotifyButtonClick(); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_TRUE(side_panel()->GetVisible()); + NotifyButtonClick(browser()); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_TRUE(GetSidePanelFor(browser())->GetVisible()); - ActivateTabAt(1); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_TRUE(side_panel()->GetVisible()); + ActivateTabAt(browser(), 1); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_TRUE(GetSidePanelFor(browser())->GetVisible()); // Close the side panel on Tab 2 and switch to Tab 1. The side panel should be // still be visible for Tab 1, respecting its per-tab state. - NotifyButtonClick(); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_FALSE(side_panel()->GetVisible()); + NotifyButtonClick(browser()); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_FALSE(GetSidePanelFor(browser())->GetVisible()); - ActivateTabAt(0); - EXPECT_TRUE(side_panel_button()->GetVisible()); - EXPECT_TRUE(side_panel()->GetVisible()); + ActivateTabAt(browser(), 0); + EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); + EXPECT_TRUE(GetSidePanelFor(browser())->GetVisible()); }
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index 9659a04..26a5d6a 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -301,6 +301,11 @@ #include "chrome/browser/ui/webui/sandbox/sandbox_internals_ui.h" #endif +#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ + BUILDFLAG(IS_CHROMEOS_ASH) +#include "chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.h" +#endif + #if defined(USE_NSS_CERTS) && defined(USE_AURA) #include "chrome/browser/ui/webui/certificate_viewer_ui.h" #endif @@ -1073,6 +1078,11 @@ } #endif #if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ + BUILDFLAG(IS_CHROMEOS_ASH) + if (url.host_piece() == chrome::kChromeUIConnectorsInternalsHost) + return &NewWebUI<enterprise_connectors::ConnectorsInternalsUI>; +#endif +#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ defined(OS_CHROMEOS) if (url.host_piece() == chrome::kChromeUIDiscardsHost) return &NewWebUI<DiscardsUI>;
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc index 5f76633..4b6a7963 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
@@ -76,6 +76,7 @@ #include "chrome/browser/ui/webui/chromeos/login/offline_login_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h" #include "chrome/browser/ui/webui/chromeos/login/os_install_screen_handler.h" +#include "chrome/browser/ui/webui/chromeos/login/os_trial_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/packaged_license_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/parental_handoff_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/pin_setup_screen_handler.h" @@ -553,6 +554,8 @@ if (switches::IsOsInstallAllowed()) { AddScreenHandler( std::make_unique<OsInstallScreenHandler>(js_calls_container_.get())); + AddScreenHandler( + std::make_unique<OsTrialScreenHandler>(js_calls_container_.get())); } AddScreenHandler(std::make_unique<ConsolidatedConsentScreenHandler>(
diff --git a/chrome/browser/ui/webui/chromeos/login/os_trial_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/os_trial_screen_handler.cc new file mode 100644 index 0000000..275395c --- /dev/null +++ b/chrome/browser/ui/webui/chromeos/login/os_trial_screen_handler.cc
@@ -0,0 +1,55 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/webui/chromeos/login/os_trial_screen_handler.h" + +#include "chrome/browser/ash/login/oobe_screen.h" +#include "chrome/browser/ash/login/screens/os_trial_screen.h" +#include "chrome/grit/chromium_strings.h" +#include "chrome/grit/generated_resources.h" +#include "components/login/localized_values_builder.h" + +namespace chromeos { + +// static +constexpr StaticOobeScreenId OsTrialScreenView::kScreenId; + +OsTrialScreenHandler::OsTrialScreenHandler(JSCallsContainer* js_calls_container) + : BaseScreenHandler(kScreenId, js_calls_container) { + set_user_acted_method_path("login.OsTrialScreen.userActed"); +} + +OsTrialScreenHandler::~OsTrialScreenHandler() { + if (screen_) + screen_->OnViewDestroyed(this); +} + +void OsTrialScreenHandler::DeclareLocalizedValues( + ::login::LocalizedValuesBuilder* builder) { + builder->Add("osTrialTitle", IDS_OS_TRIAL_TITLE); + builder->Add("osTrialSubtitle", IDS_OS_TRIAL_SUBTITLE); + builder->Add("osTrialInstallTitle", IDS_OS_TRIAL_INSTALL_TITLE); + builder->Add("osTrialInstallSubtitle", IDS_OS_TRIAL_INSTALL_SUBTITLE); + builder->Add("osTrialTryTitle", IDS_OS_TRIAL_TRY_TITLE); + builder->Add("osTrialTrySubtitle", IDS_OS_TRIAL_TRY_SUBTITLE); + builder->Add("osTrialNextButton", IDS_OS_TRIAL_NEXT_BUTTON); +} + +void OsTrialScreenHandler::Initialize() {} + +void OsTrialScreenHandler::Show() { + ShowScreen(kScreenId); +} + +void OsTrialScreenHandler::Bind(ash::OsTrialScreen* screen) { + screen_ = screen; + BaseScreenHandler::SetBaseScreen(screen_); +} + +void OsTrialScreenHandler::Unbind() { + screen_ = nullptr; + BaseScreenHandler::SetBaseScreen(nullptr); +} + +} // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/login/os_trial_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/os_trial_screen_handler.h new file mode 100644 index 0000000..e80b16b --- /dev/null +++ b/chrome/browser/ui/webui/chromeos/login/os_trial_screen_handler.h
@@ -0,0 +1,67 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_OS_TRIAL_SCREEN_HANDLER_H_ +#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_OS_TRIAL_SCREEN_HANDLER_H_ + +#include "chrome/browser/ash/login/screens/consolidated_consent_screen.h" + +namespace ash { +class OsTrialScreen; +} + +namespace chromeos { + +// Interface for dependency injection between OsTrialScreen and its +// WebUI representation. +class OsTrialScreenView { + public: + constexpr static StaticOobeScreenId kScreenId{"os-trial"}; + + virtual ~OsTrialScreenView() = default; + + // Shows the contents of the screen. + virtual void Show() = 0; + + // Binds |screen| to the view. + virtual void Bind(ash::OsTrialScreen* screen) = 0; + + // Unbinds the screen from the view. + virtual void Unbind() = 0; +}; + +class OsTrialScreenHandler : public BaseScreenHandler, + public OsTrialScreenView { + public: + using TView = OsTrialScreenView; + + explicit OsTrialScreenHandler(JSCallsContainer* js_calls_container); + OsTrialScreenHandler(const OsTrialScreenHandler&) = delete; + OsTrialScreenHandler& operator=(const OsTrialScreenHandler&) = delete; + ~OsTrialScreenHandler() override; + + private: + // BaseScreenHandler: + void DeclareLocalizedValues( + ::login::LocalizedValuesBuilder* builder) override; + void Initialize() override; + + // OsTrialScreenView: + void Show() override; + void Bind(ash::OsTrialScreen* screen) override; + void Unbind() override; + + ash::OsTrialScreen* screen_ = nullptr; +}; + +} // namespace chromeos + +// TODO(https://crbug.com/1164001): remove after the //chrome/browser/chromeos +// source migration is finished. +namespace ash { +using ::chromeos::OsTrialScreenHandler; +using ::chromeos::OsTrialScreenView; +} // namespace ash + +#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_OS_TRIAL_SCREEN_HANDLER_H_
diff --git a/chrome/browser/ui/webui/connectors_internals/BUILD.gn b/chrome/browser/ui/webui/connectors_internals/BUILD.gn new file mode 100644 index 0000000..fd3d4113 --- /dev/null +++ b/chrome/browser/ui/webui/connectors_internals/BUILD.gn
@@ -0,0 +1,10 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//mojo/public/tools/bindings/mojom.gni") + +mojom("mojo_bindings") { + sources = [ "connectors_internals.mojom" ] + webui_module_path = "/" +}
diff --git a/chrome/browser/ui/webui/connectors_internals/OWNERS b/chrome/browser/ui/webui/connectors_internals/OWNERS new file mode 100644 index 0000000..fb1c272 --- /dev/null +++ b/chrome/browser/ui/webui/connectors_internals/OWNERS
@@ -0,0 +1,4 @@ +file://chrome/browser/enterprise/connectors/OWNERS + +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS \ No newline at end of file
diff --git a/chrome/browser/ui/webui/connectors_internals/connectors_internals.mojom b/chrome/browser/ui/webui/connectors_internals/connectors_internals.mojom new file mode 100644 index 0000000..4941c6a --- /dev/null +++ b/chrome/browser/ui/webui/connectors_internals/connectors_internals.mojom
@@ -0,0 +1,17 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module connectors_internals.mojom; + +struct ZeroTrustState { + // Whether the connector is enabled or not. + bool is_enabled; +}; + +// Browser interface for the page. Consists of calls for data and hooks for +// interactivity. +interface PageHandler { + // Get state information about the Zero Trust connector. + GetZeroTrustState() => (ZeroTrustState state); +};
diff --git a/chrome/browser/ui/webui/connectors_internals/connectors_internals_page_handler.cc b/chrome/browser/ui/webui/connectors_internals/connectors_internals_page_handler.cc new file mode 100644 index 0000000..02327e8 --- /dev/null +++ b/chrome/browser/ui/webui/connectors_internals/connectors_internals_page_handler.cc
@@ -0,0 +1,36 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/webui/connectors_internals/connectors_internals_page_handler.h" + +#include "base/check.h" +#include "base/containers/flat_map.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/webui/connectors_internals/connectors_internals.mojom.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/receiver.h" + +namespace enterprise_connectors { + +ConnectorsInternalsPageHandler::ConnectorsInternalsPageHandler( + mojo::PendingReceiver<connectors_internals::mojom::PageHandler> receiver, + DeviceTrustService* device_trust_service, + Profile* profile) + : receiver_(this, std::move(receiver)), + device_trust_service_(device_trust_service), + profile_(profile) { + DCHECK(device_trust_service_); + DCHECK(profile_); +} + +ConnectorsInternalsPageHandler::~ConnectorsInternalsPageHandler() = default; + +void ConnectorsInternalsPageHandler::GetZeroTrustState( + GetZeroTrustStateCallback callback) { + auto state = connectors_internals::mojom::ZeroTrustState::New( + device_trust_service_->IsEnabled()); + std::move(callback).Run(std::move(state)); +} + +} // namespace enterprise_connectors
diff --git a/chrome/browser/ui/webui/connectors_internals/connectors_internals_page_handler.h b/chrome/browser/ui/webui/connectors_internals/connectors_internals_page_handler.h new file mode 100644 index 0000000..9b37c6d --- /dev/null +++ b/chrome/browser/ui/webui/connectors_internals/connectors_internals_page_handler.h
@@ -0,0 +1,45 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_WEBUI_CONNECTORS_INTERNALS_CONNECTORS_INTERNALS_PAGE_HANDLER_H_ +#define CHROME_BROWSER_UI_WEBUI_CONNECTORS_INTERNALS_CONNECTORS_INTERNALS_PAGE_HANDLER_H_ + +#include "base/macros.h" +#include "chrome/browser/enterprise/connectors/device_trust/device_trust_service.h" +#include "chrome/browser/ui/webui/connectors_internals/connectors_internals.mojom.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/receiver.h" + +class Profile; + +namespace enterprise_connectors { + +// Concrete implementation of connectors_internals::mojom::PageHandler. +class ConnectorsInternalsPageHandler + : public connectors_internals::mojom::PageHandler { + public: + ConnectorsInternalsPageHandler( + mojo::PendingReceiver<connectors_internals::mojom::PageHandler> receiver, + DeviceTrustService* device_trust_service, + Profile* profile); + + ConnectorsInternalsPageHandler(const ConnectorsInternalsPageHandler&) = + delete; + ConnectorsInternalsPageHandler& operator=( + const ConnectorsInternalsPageHandler&) = delete; + + ~ConnectorsInternalsPageHandler() override; + + private: + // connectors_internals::mojom::ConnectorsInternalsPageHandler + void GetZeroTrustState(GetZeroTrustStateCallback) override; + + mojo::Receiver<connectors_internals::mojom::PageHandler> receiver_; + DeviceTrustService* device_trust_service_; + Profile* profile_; +}; + +} // namespace enterprise_connectors + +#endif // CHROME_BROWSER_UI_WEBUI_CONNECTORS_INTERNALS_CONNECTORS_INTERNALS_PAGE_HANDLER_H_
diff --git a/chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.cc b/chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.cc new file mode 100644 index 0000000..ae4478d --- /dev/null +++ b/chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.cc
@@ -0,0 +1,52 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.h" + +#include "base/bind.h" +#include "build/build_config.h" +#include "chrome/browser/enterprise/connectors/device_trust/device_trust_service_factory.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/webui/connectors_internals/connectors_internals.mojom.h" +#include "chrome/browser/ui/webui/connectors_internals/connectors_internals_page_handler.h" +#include "chrome/browser/ui/webui/webui_util.h" +#include "chrome/common/url_constants.h" +#include "chrome/grit/browser_resources.h" +#include "chrome/grit/connectors_internals_resources.h" +#include "chrome/grit/connectors_internals_resources_map.h" +#include "content/public/browser/web_ui_data_source.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" + +namespace enterprise_connectors { + +ConnectorsInternalsUI::ConnectorsInternalsUI(content::WebUI* web_ui) + : ui::MojoWebUIController(web_ui) { + content::WebUIDataSource* source = content::WebUIDataSource::Create( + chrome::kChromeUIConnectorsInternalsHost); + + Profile* profile = Profile::FromWebUI(web_ui); + + source->AddBoolean("isOtr", profile->IsOffTheRecord()); + + webui::SetupWebUIDataSource( + source, + base::make_span(kConnectorsInternalsResources, + kConnectorsInternalsResourcesSize), + IDR_CONNECTORS_INTERNALS_INDEX_HTML); + + device_trust_service_ = DeviceTrustServiceFactory::GetForProfile(profile); + content::WebUIDataSource::Add(profile, source); +} + +WEB_UI_CONTROLLER_TYPE_IMPL(ConnectorsInternalsUI) + +ConnectorsInternalsUI::~ConnectorsInternalsUI() = default; + +void ConnectorsInternalsUI::BindInterface( + mojo::PendingReceiver<connectors_internals::mojom::PageHandler> receiver) { + page_handler_ = std::make_unique<ConnectorsInternalsPageHandler>( + std::move(receiver), device_trust_service_, Profile::FromWebUI(web_ui())); +} + +} // namespace enterprise_connectors
diff --git a/chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.h b/chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.h new file mode 100644 index 0000000..1c93f9d --- /dev/null +++ b/chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.h
@@ -0,0 +1,42 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_WEBUI_CONNECTORS_INTERNALS_CONNECTORS_INTERNALS_UI_H_ +#define CHROME_BROWSER_UI_WEBUI_CONNECTORS_INTERNALS_CONNECTORS_INTERNALS_UI_H_ + +#include <memory> + +#include "base/macros.h" +#include "chrome/browser/ui/webui/connectors_internals/connectors_internals.mojom-forward.h" +#include "chrome/browser/ui/webui/connectors_internals/connectors_internals_page_handler.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "ui/webui/mojo_web_ui_controller.h" + +namespace enterprise_connectors { + +// UI controller for chrome://connectors-internals. +class ConnectorsInternalsUI : public ui::MojoWebUIController { + public: + explicit ConnectorsInternalsUI(content::WebUI* web_ui); + + ConnectorsInternalsUI(const ConnectorsInternalsUI&) = delete; + ConnectorsInternalsUI& operator=(const ConnectorsInternalsUI&) = delete; + + ~ConnectorsInternalsUI() override; + + // Instantiates the implementor of the mojom::PageHandler mojo + // interface passing the pending receiver that will be internally bound. + void BindInterface( + mojo::PendingReceiver<connectors_internals::mojom::PageHandler> receiver); + + private: + std::unique_ptr<ConnectorsInternalsPageHandler> page_handler_; + DeviceTrustService* device_trust_service_; + + WEB_UI_CONTROLLER_TYPE_DECL(); +}; + +} // namespace enterprise_connectors + +#endif // CHROME_BROWSER_UI_WEBUI_CONNECTORS_INTERNALS_CONNECTORS_INTERNALS_UI_H_
diff --git a/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc b/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc index f953ef5..26c9578 100644 --- a/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc +++ b/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc
@@ -239,6 +239,17 @@ {"modulesPhotosMemoriesHiddenToday", IDS_NTP_MODULES_PHOTOS_MEMORIES_HIDDEN_TODAY}, {"modulesPhotosMemoriesExplore", IDS_NTP_MODULES_PHOTOS_MEMORIES_EXPLORE}, + {"modulesPhotosMemoriesWelcomeTitle", + IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TITLE}, + {"modulesPhotosMemoriesWelcomeText", + IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TEXT}, + {"modulesPhotosMemoriesWelcomeButtonOptIn", + IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_BUTTON_OPT_IN}, + {"modulesPhotosMemoriesWelcomeButtonOptOut", + IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_BUTTON_OPT_OUT}, + {"modulesPhotosMemoriesWelcomeExample", + IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_EXAMPLE}, + {"modulesPhotosNew", IDS_NTP_MODULES_PHOTOS_NEW}, {"modulesTasksInfoTitle", IDS_NTP_MODULES_SHOPPING_TASKS_INFO_TITLE}, {"modulesTasksInfoClose", IDS_NTP_MODULES_SHOPPING_TASKS_INFO_CLOSE}, {"modulesCartHeaderNew", IDS_NTP_MODULES_CART_HEADER_CHIP_NEW},
diff --git a/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc b/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc index 54f6cb6..8996508 100644 --- a/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc +++ b/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc
@@ -13,7 +13,7 @@ #include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/ash/profiles/profile_helper.h" -#include "chrome/browser/chromeos/tether/tether_service.h" +#include "chrome/browser/ash/tether/tether_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 7d331e9..dec91d2 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1632743903-1532c35d47dab49f28de77cdbc8161508b4173bd.profdata +chrome-linux-main-1632765560-6f551e1f4988ba72ac588c4fe34045e6fb0df6a7.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index bc34c8c..a3c953f 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1632722301-a892c31a95e7069d32436dcf24e7c8398296f61f.profdata +chrome-mac-main-1632743903-b40e5f2a6ade06c406fb12452a33ecf99ed5d84f.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 62eb06a..736f785 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1632733038-54f3d4b03c5c3f67de8f63c0ae179afc34d9cd39.profdata +chrome-win32-main-1632754784-dc3bb2a5aca151172536f2a0698b77c557e077ab.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index cebddd2e..168a052 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1632733038-326cf0884ab554ce1a5d23a1aed0f2f61f7009ca.profdata +chrome-win64-main-1632754784-2afb1cd8ffba11673aac6d54375a492988427e14.profdata
diff --git a/chrome/chrome_paks.gni b/chrome/chrome_paks.gni index a705634..a0bced8 100644 --- a/chrome/chrome_paks.gni +++ b/chrome/chrome_paks.gni
@@ -313,6 +313,11 @@ ] } + if (is_win || is_mac || is_linux || is_chromeos_ash) { + sources += [ "$root_gen_dir/chrome/connectors_internals_resources.pak" ] + deps += [ "//chrome/browser/resources/connectors_internals:resources" ] + } + if (is_win || is_mac || is_linux || is_chromeos_lacros || is_fuchsia) { sources += [ "$root_gen_dir/chrome/browser_switch_resources.pak" ] deps += [ "//chrome/browser/resources/browser_switch:resources" ]
diff --git a/chrome/common/chromeos/extensions/chromeos_system_extensions_manifest_handler.cc b/chrome/common/chromeos/extensions/chromeos_system_extensions_manifest_handler.cc index 7840f60..a24e8942 100644 --- a/chrome/common/chromeos/extensions/chromeos_system_extensions_manifest_handler.cc +++ b/chrome/common/chromeos/extensions/chromeos_system_extensions_manifest_handler.cc
@@ -37,7 +37,7 @@ // Verifies allowlisted origins. // TODO(b/200920331): replace google.com with OEM-specific origin. - return matches_list.front().GetString() == "http://www.google.com/*"; + return matches_list.front().GetString() == "*://www.google.com/*"; } } // namespace
diff --git a/chrome/common/webui_url_constants.cc b/chrome/common/webui_url_constants.cc index 74ef7c6c..3fa1460 100644 --- a/chrome/common/webui_url_constants.cc +++ b/chrome/common/webui_url_constants.cc
@@ -383,6 +383,11 @@ #if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ defined(OS_CHROMEOS) +const char kChromeUIConnectorsInternalsHost[] = "connectors-internals"; +#endif + +#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ + defined(OS_CHROMEOS) const char kChromeUIDiscardsHost[] = "discards"; const char kChromeUIDiscardsURL[] = "chrome://discards/"; #endif @@ -610,6 +615,10 @@ #endif #if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ defined(OS_CHROMEOS) + kChromeUIConnectorsInternalsHost, +#endif +#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ + defined(OS_CHROMEOS) kChromeUIDiscardsHost, #endif #if defined(OS_POSIX) && !defined(OS_MAC) && !defined(OS_ANDROID)
diff --git a/chrome/common/webui_url_constants.h b/chrome/common/webui_url_constants.h index f04fff8..76ac7ee 100644 --- a/chrome/common/webui_url_constants.h +++ b/chrome/common/webui_url_constants.h
@@ -326,6 +326,11 @@ #endif #if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ + defined(OS_CHROMEOS) +extern const char kChromeUIConnectorsInternalsHost[]; +#endif + +#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ defined(OS_CHROMEOS) || defined(OS_FUCHSIA) extern const char kChromeUIDiscardsHost[]; extern const char kChromeUIDiscardsURL[];
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 9bf1071..bbaa069c 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -1570,7 +1570,6 @@ "../browser/media/webrtc/capture_handle_browsertest.cc", "../browser/media/webrtc/conditional_focus_browsertest.cc", "../browser/media/webrtc/media_stream_devices_controller_browsertest.cc", - "../browser/media/webrtc/media_stream_permission_browsertest.cc", "../browser/media/webrtc/test_stats_dictionary_unittest.cc", "../browser/media/webrtc/webrtc_apprtc_browsertest.cc", "../browser/media/webrtc/webrtc_browsertest.cc", @@ -8097,6 +8096,7 @@ "../browser/extensions/omnibox_focus_interactive_test.cc", "../browser/extensions/window_open_interactive_apitest.cc", "../browser/focus_ring_browsertest.cc", + "../browser/media/webrtc/media_stream_permission_interactive_uitest.cc", "../browser/media/webrtc/webrtc_mediadevices_interactive_uitest.cc", "../browser/mouse_events_interactive_uitest.cc", "../browser/notifications/platform_notification_service_interactive_uitest.cc",
diff --git a/chrome/test/data/extensions/manifest_tests/chromeos_system_extension.json b/chrome/test/data/extensions/manifest_tests/chromeos_system_extension.json index 0d6b990..7a3c363 100644 --- a/chrome/test/data/extensions/manifest_tests/chromeos_system_extension.json +++ b/chrome/test/data/extensions/manifest_tests/chromeos_system_extension.json
@@ -16,7 +16,7 @@ "chromeos_system_extension": {}, "externally_connectable": { "matches": [ - "http://www.google.com/*" + "*://www.google.com/*" ] }, "options_page": "options.html"
diff --git a/chrome/test/data/extensions/manifest_tests/chromeos_system_extension_invalid_externally_connectable_2_origins.json b/chrome/test/data/extensions/manifest_tests/chromeos_system_extension_invalid_externally_connectable_2_origins.json index cf1da8f..a6cc4e33 100644 --- a/chrome/test/data/extensions/manifest_tests/chromeos_system_extension_invalid_externally_connectable_2_origins.json +++ b/chrome/test/data/extensions/manifest_tests/chromeos_system_extension_invalid_externally_connectable_2_origins.json
@@ -9,7 +9,7 @@ "chromeos_system_extension": {}, "externally_connectable": { "matches": [ - "http://google.com/*", + "*://google.com/*", "https://telemetry.google.com/*" ] }
diff --git a/chrome/test/data/focus_rings/focus_ring_browsertest_anchor_linux.png b/chrome/test/data/focus_rings/focus_ring_browsertest_anchor_linux.png new file mode 100644 index 0000000..0345dfb --- /dev/null +++ b/chrome/test/data/focus_rings/focus_ring_browsertest_anchor_linux.png Binary files differ
diff --git a/chrome/test/data/focus_rings/focus_ring_browsertest_button_linux.png b/chrome/test/data/focus_rings/focus_ring_browsertest_button_linux.png new file mode 100644 index 0000000..0fefeca --- /dev/null +++ b/chrome/test/data/focus_rings/focus_ring_browsertest_button_linux.png Binary files differ
diff --git a/chrome/test/data/focus_rings/focus_ring_browsertest_checkbox_linux.png b/chrome/test/data/focus_rings/focus_ring_browsertest_checkbox_linux.png new file mode 100644 index 0000000..53f39b71 --- /dev/null +++ b/chrome/test/data/focus_rings/focus_ring_browsertest_checkbox_linux.png Binary files differ
diff --git a/chrome/test/data/focus_rings/focus_ring_browsertest_dark_mode_button_linux.png b/chrome/test/data/focus_rings/focus_ring_browsertest_dark_mode_button_linux.png new file mode 100644 index 0000000..d1838aaf --- /dev/null +++ b/chrome/test/data/focus_rings/focus_ring_browsertest_dark_mode_button_linux.png Binary files differ
diff --git a/chrome/test/data/focus_rings/focus_ring_browsertest_radio_linux.png b/chrome/test/data/focus_rings/focus_ring_browsertest_radio_linux.png new file mode 100644 index 0000000..62241ce --- /dev/null +++ b/chrome/test/data/focus_rings/focus_ring_browsertest_radio_linux.png Binary files differ
diff --git a/chrome/test/data/webui/cr_components/chromeos/bluetooth/fake_bluetooth_config.js b/chrome/test/data/webui/cr_components/chromeos/bluetooth/fake_bluetooth_config.js index c10817e6..3b6a26f8 100644 --- a/chrome/test/data/webui/cr_components/chromeos/bluetooth/fake_bluetooth_config.js +++ b/chrome/test/data/webui/cr_components/chromeos/bluetooth/fake_bluetooth_config.js
@@ -54,6 +54,8 @@ this.systemProperties_ = { systemState: chromeos.bluetoothConfig.mojom.BluetoothSystemState.kDisabled, + modificationState: chromeos.bluetoothConfig.mojom + .BluetoothModificationState.kCannotModifyBluetooth, pairedDevices: [], }; @@ -232,6 +234,20 @@ } /** + * @param {!chromeos.bluetoothConfig.mojom.BluetoothModificationState} + * modificationState + */ + setModificationState(modificationState) { + this.systemProperties_.modificationState = modificationState; + this.systemProperties_ = + /** + * @type {!chromeos.bluetoothConfig.mojom.BluetoothSystemProperties} + */ + (Object.assign({}, this.systemProperties_)); + this.notifyObserversPropertiesUpdated_(); + } + + /** * Adds a list of devices to the current list of paired devices in * |systemProperties|. * @param {Array<?chromeos.bluetoothConfig.mojom.PairedBluetoothDeviceProperties>}
diff --git a/chrome/test/data/webui/new_tab_page/modules/photos/module_test.js b/chrome/test/data/webui/new_tab_page/modules/photos/module_test.js index 10e7d6b..adf67de 100644 --- a/chrome/test/data/webui/new_tab_page/modules/photos/module_test.js +++ b/chrome/test/data/webui/new_tab_page/modules/photos/module_test.js
@@ -37,12 +37,16 @@ ] }; handler.setResultFor('getMemories', Promise.resolve(data)); + handler.setResultFor( + 'shouldShowOptInScreen', Promise.resolve({showOptInScreen: false})); const module = assert(await photosDescriptor.initialize(0)); document.body.append(module); await handler.whenCalled('getMemories'); + await handler.whenCalled('shouldShowOptInScreen'); // Assert. - const items = Array.from(module.shadowRoot.querySelectorAll('.memory')); + const items = + Array.from(module.shadowRoot.querySelectorAll('#memories > .memory')); assertTrue(!!module); assertTrue(isVisible(module.$.memories)); assertEquals(2, items.length); @@ -55,8 +59,11 @@ test('module does not show without data', async () => { // Arrange. handler.setResultFor('getMemories', Promise.resolve({memories: []})); + handler.setResultFor( + 'shouldShowOptInScreen', Promise.resolve({showOptInScreen: false})); const module = await photosDescriptor.initialize(0); await handler.whenCalled('getMemories'); + await handler.whenCalled('shouldShowOptInScreen'); // Assert. assertFalse(!!module); @@ -79,9 +86,12 @@ ] }; handler.setResultFor('getMemories', Promise.resolve(data)); + handler.setResultFor( + 'shouldShowOptInScreen', Promise.resolve({showOptInScreen: false})); const module = assert(await photosDescriptor.initialize(0)); document.body.append(module); await handler.whenCalled('getMemories'); + await handler.whenCalled('shouldShowOptInScreen'); // Act. $$(module, 'ntp-module-header') @@ -108,9 +118,12 @@ ] }; handler.setResultFor('getMemories', Promise.resolve(data)); + handler.setResultFor( + 'shouldShowOptInScreen', Promise.resolve({showOptInScreen: false})); const module = assert(await photosDescriptor.initialize(0)); document.body.append(module); await handler.whenCalled('getMemories'); + await handler.whenCalled('shouldShowOptInScreen'); // Act. const dismiss = {event: null}; @@ -148,9 +161,12 @@ ] }; handler.setResultFor('getMemories', Promise.resolve(data)); + handler.setResultFor( + 'shouldShowOptInScreen', Promise.resolve({showOptInScreen: false})); const module = assert(await photosDescriptor.initialize(0)); document.body.append(module); await handler.whenCalled('getMemories'); + await handler.whenCalled('shouldShowOptInScreen'); // Act. const disable = {event: null}; @@ -174,9 +190,12 @@ }] }; handler.setResultFor('getMemories', Promise.resolve(data)); + handler.setResultFor( + 'shouldShowOptInScreen', Promise.resolve({showOptInScreen: false})); const module = assert(await photosDescriptor.initialize(0)); document.body.append(module); await handler.whenCalled('getMemories'); + await handler.whenCalled('shouldShowOptInScreen'); // Assert. assertTrue(!!$$(module, '#exploreCard')); @@ -209,12 +228,84 @@ ] }; handler.setResultFor('getMemories', Promise.resolve(data)); + handler.setResultFor( + 'shouldShowOptInScreen', Promise.resolve({showOptInScreen: false})); const module = assert(await photosDescriptor.initialize(0)); document.body.append(module); await handler.whenCalled('getMemories'); + await handler.whenCalled('shouldShowOptInScreen'); // Assert. - const items = Array.from(module.shadowRoot.querySelectorAll('.memory')); + const items = + Array.from(module.shadowRoot.querySelectorAll('#memories > .memory')); assertEquals(3, items.length); }); + + test('backend is notified when user opt out', async () => { + // Arrange. + const data = { + memories: [{ + title: 'Title 1', + id: 'key1', + coverUrl: {url: 'https://fakeurl.com/1?token=foo'} + }] + }; + handler.setResultFor('getMemories', Promise.resolve(data)); + handler.setResultFor( + 'shouldShowOptInScreen', Promise.resolve({showOptInScreen: true})); + const module = assert(await photosDescriptor.initialize(0)); + document.body.append(module); + await handler.whenCalled('getMemories'); + await handler.whenCalled('shouldShowOptInScreen'); + + // Asserts. + assertTrue(!!$$(module, '#optInCard')); + + // Act. + const disable = {event: null}; + module.addEventListener('disable-module', (e) => disable.event = e); + $$(module, '#optOutButton').click(); + + // Asserts. + assertEquals(1, handler.getCallCount('onUserOptIn')); + assertEquals(false, handler.getArgs('onUserOptIn')[0]); + assertEquals( + loadTimeData.getString('modulesPhotosMemoriesDisabled'), + disable.event.detail.message); + }); + + test('UI is updated and backend notified when user opt in', async () => { + // Arrange. + const data = { + memories: [{ + title: 'Title 1', + id: 'key1', + coverUrl: {url: 'https://fakeurl.com/1?token=foo'} + }] + }; + handler.setResultFor('getMemories', Promise.resolve(data)); + handler.setResultFor( + 'shouldShowOptInScreen', Promise.resolve({showOptInScreen: true})); + const module = assert(await photosDescriptor.initialize(0)); + document.body.append(module); + await handler.whenCalled('getMemories'); + await handler.whenCalled('shouldShowOptInScreen'); + + // Asserts. + assertTrue(!!$$(module, '#optInCard')); + + // Act. + $$(module, '#optInButton').click(); + $$(module, '#welcomeCardElement').render(); + $$(module, '#memoriesElement').render(); + $$(module, '#exploreCardElement').render(); + + // Asserts. + assertFalse(isVisible(assert($$(module, '#optInCard')))); + assertEquals(1, handler.getCallCount('onUserOptIn')); + assertEquals(true, handler.getArgs('onUserOptIn')[0]); + const items = + Array.from(module.shadowRoot.querySelectorAll('#memories > .memory')); + assertEquals(1, items.length); + }); });
diff --git a/chrome/test/data/webui/new_tab_page/new_tab_page_browsertest.js b/chrome/test/data/webui/new_tab_page/new_tab_page_browsertest.js index 47e7730a..9cf09d5 100644 --- a/chrome/test/data/webui/new_tab_page/new_tab_page_browsertest.js +++ b/chrome/test/data/webui/new_tab_page/new_tab_page_browsertest.js
@@ -24,7 +24,14 @@ } }; -TEST_F('NewTabPageAppTest', 'All', function() { +// TODO(https://crbug.com/1253309): Flaky on Linux debug builds. +GEN('#if defined(OS_LINUX) && !defined(NDEBUG)'); +GEN('#define MAYBE_NewTabPageAppTestAll DISABLED_All'); +GEN('#else'); +GEN('#define MAYBE_NewTabPageAppTestAll All'); +GEN('#endif'); + +TEST_F('NewTabPageAppTest', 'MAYBE_NewTabPageAppTestAll', function() { mocha.run(); });
diff --git a/chrome/test/data/webui/settings/BUILD.gn b/chrome/test/data/webui/settings/BUILD.gn index 999b21c..610654d 100644 --- a/chrome/test/data/webui/settings/BUILD.gn +++ b/chrome/test/data/webui/settings/BUILD.gn
@@ -135,7 +135,6 @@ #":test_extension_control_browser_proxy", ":test_lifetime_browser_proxy", - ":test_open_window_proxy", #":test_password_manager_proxy", @@ -158,13 +157,6 @@ ] } -js_library("test_open_window_proxy") { - deps = [ - "..:test_browser_proxy", - "//chrome/browser/resources/settings:settings", - ] -} - js_library("search_page_test") { deps = [ ":test_search_engines_browser_proxy",
diff --git a/chrome/test/data/webui/settings/chromeos/os_settings_page_test.js b/chrome/test/data/webui/settings/chromeos/os_settings_page_test.js index 7a9e2f791..3c7c184 100644 --- a/chrome/test/data/webui/settings/chromeos/os_settings_page_test.js +++ b/chrome/test/data/webui/settings/chromeos/os_settings_page_test.js
@@ -9,6 +9,8 @@ // #import {assert} from 'chrome://resources/js/assert.m.js'; // #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; // #import {CrSettingsPrefs, Router, routes} from 'chrome://os-settings/chromeos/os_settings.js'; +// #import {FakeBluetoothConfig} from 'chrome://test/cr_components/chromeos/bluetooth/fake_bluetooth_config.js'; +// #import {setBluetoothConfigForTesting} from 'chrome://resources/cr_components/chromeos/bluetooth/cros_bluetooth_config.js'; // #import {flushTasks} from 'chrome://test/test_util.js'; // clang-format on @@ -87,6 +89,11 @@ loadTimeData.overrideValues({ enableBluetoothRevamp: true, }); + + // Using the real CrosBluetoothConfig will crash due to no + // SessionManager. + setBluetoothConfigForTesting(new FakeBluetoothConfig()); + init(); const settingsBluetoothPage = settingsPage.$$('settings-bluetooth-page');
diff --git a/chrome/test/data/webui/settings/passwords_section_test.js b/chrome/test/data/webui/settings/passwords_section_test.js index c92c544..716afce 100644 --- a/chrome/test/data/webui/settings/passwords_section_test.js +++ b/chrome/test/data/webui/settings/passwords_section_test.js
@@ -1192,7 +1192,7 @@ assertTrue(accountPasswordDialog.$.storageDetails.hidden); // Display the message. - accountPasswordDialog.shouldShowStorageDetails = true; + accountPasswordDialog.isAccountStoreUser = true; flush(); assertFalse(accountPasswordDialog.$.storageDetails.hidden); assertEquals( @@ -1212,7 +1212,7 @@ assertTrue(devicePasswordDialog.$.storageDetails.hidden); // Display the message. - devicePasswordDialog.shouldShowStorageDetails = true; + devicePasswordDialog.isAccountStoreUser = true; flush(); assertFalse(devicePasswordDialog.$.storageDetails.hidden); assertEquals( @@ -1233,7 +1233,7 @@ assertTrue(accountAndDevicePasswordDialog.$.storageDetails.hidden); // Display the message. - accountAndDevicePasswordDialog.shouldShowStorageDetails = true; + accountAndDevicePasswordDialog.isAccountStoreUser = true; flush(); assertFalse(accountAndDevicePasswordDialog.$.storageDetails.hidden); assertEquals(
diff --git a/chrome/test/data/webui/settings/test_open_window_proxy.js b/chrome/test/data/webui/settings/test_open_window_proxy.js index 495019b..ee8aca85 100644 --- a/chrome/test/data/webui/settings/test_open_window_proxy.js +++ b/chrome/test/data/webui/settings/test_open_window_proxy.js
@@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {OpenWindowProxy} from 'chrome://settings/settings.js'; - import {TestBrowserProxy} from '../test_browser_proxy.js'; /** @implements {OpenWindowProxy} */
diff --git a/chromeos/crosapi/mojom/BUILD.gn b/chromeos/crosapi/mojom/BUILD.gn index 039d331..6f23ac15d 100644 --- a/chromeos/crosapi/mojom/BUILD.gn +++ b/chromeos/crosapi/mojom/BUILD.gn
@@ -28,6 +28,7 @@ "file_manager.mojom", "geolocation.mojom", "holding_space_service.mojom", + "identity_manager.mojom", "idle_service.mojom", "image_writer.mojom", "keystore_error.mojom",
diff --git a/chromeos/crosapi/mojom/crosapi.mojom b/chromeos/crosapi/mojom/crosapi.mojom index 447ff818..ecf3699e 100644 --- a/chromeos/crosapi/mojom/crosapi.mojom +++ b/chromeos/crosapi/mojom/crosapi.mojom
@@ -23,6 +23,7 @@ import "chromeos/crosapi/mojom/file_manager.mojom"; import "chromeos/crosapi/mojom/geolocation.mojom"; import "chromeos/crosapi/mojom/holding_space_service.mojom"; +import "chromeos/crosapi/mojom/identity_manager.mojom"; import "chromeos/crosapi/mojom/idle_service.mojom"; import "chromeos/crosapi/mojom/image_writer.mojom"; import "chromeos/crosapi/mojom/keystore_service.mojom"; @@ -76,8 +77,8 @@ // please note the milestone when you added it, to help us reason about // compatibility between the client applications and older ash-chrome binaries. // -// Next version: 51 -// Next method id: 55 +// Next version: 52 +// Next method id: 56 [Stable, Uuid="8b79c34f-2bf8-4499-979a-b17cac522c1e", RenamedFrom="crosapi.mojom.AshChromeService"] interface Crosapi { @@ -197,6 +198,11 @@ [MinVersion=27] BindHoldingSpaceService@32(pending_receiver<HoldingSpaceService> receiver); + // Binds the IdentityManager interface for reading identity information. + // Added in M96. + [MinVersion=51] + BindIdentityManager@55(pending_receiver<IdentityManager> receiver); + // Binds the IdleService interface for reading idle states. // Added in M90. [MinVersion=16]
diff --git a/chromeos/crosapi/mojom/identity_manager.mojom b/chromeos/crosapi/mojom/identity_manager.mojom new file mode 100644 index 0000000..2cd6a8e --- /dev/null +++ b/chromeos/crosapi/mojom/identity_manager.mojom
@@ -0,0 +1,19 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module crosapi.mojom; + +import "ui/gfx/image/mojom/image.mojom"; + +// This API allows lacros-chrome to access properties from the identity manager +// that lives in ash-chrome, such as account names for accounts that are not yet +// known to lacros. +[Stable, Uuid="2737cc5d-f807-4690-aec1-22091ce82565"] +interface IdentityManager { + // Returns the full_name of the account with gaia id `gaia`. + GetAccountFullName@0(string gaia) => (string full_name); + + // Returns the account_image of the account with gaia id `gaia`. + GetAccountImage@1(string gaia) => (gfx.mojom.ImageSkia? image); +};
diff --git a/chromeos/lacros/lacros_service.cc b/chromeos/lacros/lacros_service.cc index 734a0df..5caee0d6 100644 --- a/chromeos/lacros/lacros_service.cc +++ b/chromeos/lacros/lacros_service.cc
@@ -32,6 +32,7 @@ #include "chromeos/crosapi/mojom/file_manager.mojom.h" #include "chromeos/crosapi/mojom/geolocation.mojom.h" #include "chromeos/crosapi/mojom/holding_space_service.mojom.h" +#include "chromeos/crosapi/mojom/identity_manager.mojom.h" #include "chromeos/crosapi/mojom/image_writer.mojom.h" #include "chromeos/crosapi/mojom/keystore_service.mojom.h" #include "chromeos/crosapi/mojom/kiosk_session_service.mojom.h" @@ -251,6 +252,9 @@ crosapi::mojom::HoldingSpaceService, &crosapi::mojom::Crosapi::BindHoldingSpaceService, Crosapi::MethodMinVersions::kBindHoldingSpaceServiceMinVersion>(); + ConstructRemote<crosapi::mojom::IdentityManager, + &crosapi::mojom::Crosapi::BindIdentityManager, + Crosapi::MethodMinVersions::kBindIdentityManagerMinVersion>(); ConstructRemote<crosapi::mojom::IdleService, &crosapi::mojom::Crosapi::BindIdleService, Crosapi::MethodMinVersions::kBindIdleServiceMinVersion>();
diff --git a/chromeos/services/bluetooth_config/BUILD.gn b/chromeos/services/bluetooth_config/BUILD.gn index 612cbbb7..ec909f5 100644 --- a/chromeos/services/bluetooth_config/BUILD.gn +++ b/chromeos/services/bluetooth_config/BUILD.gn
@@ -44,6 +44,8 @@ "//chromeos/services/bluetooth_config/public/cpp", "//chromeos/services/bluetooth_config/public/mojom", "//components/device_event_log", + "//components/session_manager/core", + "//components/user_manager", "//device/bluetooth", "//mojo/public/cpp/bindings", ] @@ -100,6 +102,7 @@ ":in_process_bluetooth_config", "//base", "//chromeos/services/bluetooth_config/public/mojom", + "//components/session_manager/core", "//device/bluetooth", "//mojo/public/cpp/bindings", ] @@ -124,6 +127,8 @@ ":test_support", "//base", "//base/test:test_support", + "//components/session_manager/core", + "//components/user_manager:test_support", "//device/bluetooth:mocks", "//mojo/public/cpp/bindings", "//testing/gmock",
diff --git a/chromeos/services/bluetooth_config/DEPS b/chromeos/services/bluetooth_config/DEPS index 77aa110..7e2f4785 100644 --- a/chromeos/services/bluetooth_config/DEPS +++ b/chromeos/services/bluetooth_config/DEPS
@@ -1,5 +1,7 @@ include_rules = [ "+components/device_event_log", + "+components/user_manager", + "+components/session_manager/core", "+device/bluetooth", "+mojo/public", ]
diff --git a/chromeos/services/bluetooth_config/cros_bluetooth_config_unittest.cc b/chromeos/services/bluetooth_config/cros_bluetooth_config_unittest.cc index ecfff07..b6d046d0 100644 --- a/chromeos/services/bluetooth_config/cros_bluetooth_config_unittest.cc +++ b/chromeos/services/bluetooth_config/cros_bluetooth_config_unittest.cc
@@ -11,6 +11,7 @@ #include "chromeos/services/bluetooth_config/fake_bluetooth_discovery_delegate.h" #include "chromeos/services/bluetooth_config/fake_system_properties_observer.h" #include "chromeos/services/bluetooth_config/initializer_impl.h" +#include "components/session_manager/core/session_manager.h" #include "device/bluetooth/test/mock_bluetooth_adapter.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h" @@ -48,6 +49,7 @@ private: base::test::TaskEnvironment task_environment_; + session_manager::SessionManager session_manager_; scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> mock_adapter_; std::unique_ptr<CrosBluetoothConfig> cros_bluetooth_config_;
diff --git a/chromeos/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom b/chromeos/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom index 5aa64c5..f5ee8e7 100644 --- a/chromeos/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom +++ b/chromeos/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom
@@ -24,6 +24,17 @@ kEnabling }; +// State of whether Bluetooth can be modified. +enum BluetoothModificationState { + // Bluetooth cannot be turned on/off, and devices cannot be connected. E.g., + // the current session may belong to a secondary user, or the screen is + // locked. + kCannotModifyBluetooth, + + // Bluetooth settings can be modified as part of the current session. + kCanModifyBluetooth +}; + // Bluetooth device type, derived from the device's ClassOfDevice attribute. enum DeviceType { kUnknown, @@ -99,9 +110,9 @@ }; // Describes the high-level status of system Bluetooth. -// TODO(khorimoto): Add property describing modification state. struct BluetoothSystemProperties { BluetoothSystemState system_state; + BluetoothModificationState modification_state; // List of paired devices. UI surfaces should display devices in the order // indicated by this array.
diff --git a/chromeos/services/bluetooth_config/scoped_bluetooth_config_test_helper.h b/chromeos/services/bluetooth_config/scoped_bluetooth_config_test_helper.h index fe49e14..67e6cea 100644 --- a/chromeos/services/bluetooth_config/scoped_bluetooth_config_test_helper.h +++ b/chromeos/services/bluetooth_config/scoped_bluetooth_config_test_helper.h
@@ -7,6 +7,8 @@ #include "chromeos/services/bluetooth_config/initializer.h" +#include "components/session_manager/core/session_manager.h" + namespace chromeos { namespace bluetooth_config { @@ -37,6 +39,10 @@ return fake_discovery_session_manager_; } + const session_manager::SessionManager& session_manager() { + return session_manager_; + } + private: // Initializer: std::unique_ptr<AdapterStateController> CreateAdapterStateController( @@ -56,6 +62,7 @@ FakeDeviceCache* fake_device_cache_; FakeDiscoverySessionManager* fake_discovery_session_manager_; FakeDeviceOperationHandler* fake_device_operation_handler_; + session_manager::SessionManager session_manager_; }; } // namespace bluetooth_config
diff --git a/chromeos/services/bluetooth_config/system_properties_provider.cc b/chromeos/services/bluetooth_config/system_properties_provider.cc index 1d4629c..0683480a 100644 --- a/chromeos/services/bluetooth_config/system_properties_provider.cc +++ b/chromeos/services/bluetooth_config/system_properties_provider.cc
@@ -28,6 +28,7 @@ SystemPropertiesProvider::GenerateProperties() { auto properties = mojom::BluetoothSystemProperties::New(); properties->system_state = ComputeSystemState(); + properties->modification_state = ComputeModificationState(); properties->paired_devices = GetPairedDevices(); return properties; }
diff --git a/chromeos/services/bluetooth_config/system_properties_provider.h b/chromeos/services/bluetooth_config/system_properties_provider.h index 95fc93c..25e196d 100644 --- a/chromeos/services/bluetooth_config/system_properties_provider.h +++ b/chromeos/services/bluetooth_config/system_properties_provider.h
@@ -15,8 +15,6 @@ // Provides system Bluetooth properties, including Bluetooth availability and // on/off state. -// -// TODO(khorimoto): Also add other properties such as paired devices. class SystemPropertiesProvider { public: virtual ~SystemPropertiesProvider(); @@ -31,6 +29,8 @@ SystemPropertiesProvider(); virtual mojom::BluetoothSystemState ComputeSystemState() const = 0; + virtual mojom::BluetoothModificationState ComputeModificationState() + const = 0; virtual std::vector<mojom::PairedBluetoothDevicePropertiesPtr> GetPairedDevices() const = 0;
diff --git a/chromeos/services/bluetooth_config/system_properties_provider_impl.cc b/chromeos/services/bluetooth_config/system_properties_provider_impl.cc index e76ed1a..82ad352 100644 --- a/chromeos/services/bluetooth_config/system_properties_provider_impl.cc +++ b/chromeos/services/bluetooth_config/system_properties_provider_impl.cc
@@ -4,6 +4,9 @@ #include "chromeos/services/bluetooth_config/system_properties_provider_impl.h" +#include "components/session_manager/core/session_manager.h" +#include "components/user_manager/user_manager.h" + namespace chromeos { namespace bluetooth_config { @@ -14,14 +17,21 @@ device_cache_(device_cache) { adapter_state_controller_observation_.Observe(adapter_state_controller_); device_cache_observation_.Observe(device_cache_); + session_manager::SessionManager::Get()->AddObserver(this); } -SystemPropertiesProviderImpl::~SystemPropertiesProviderImpl() = default; +SystemPropertiesProviderImpl::~SystemPropertiesProviderImpl() { + session_manager::SessionManager::Get()->RemoveObserver(this); +} void SystemPropertiesProviderImpl::OnAdapterStateChanged() { NotifyPropertiesChanged(); } +void SystemPropertiesProviderImpl::OnSessionStateChanged() { + NotifyPropertiesChanged(); +} + void SystemPropertiesProviderImpl::OnPairedDevicesListChanged() { NotifyPropertiesChanged(); } @@ -36,5 +46,26 @@ return device_cache_->GetPairedDevices(); } +mojom::BluetoothModificationState +SystemPropertiesProviderImpl::ComputeModificationState() const { + // Bluetooth power setting is always mutable in login screen before any + // user logs in. The changes will affect local state preferences. + // + // Otherwise, the bluetooth setting should be mutable only if: + // * the active user is the primary user, and + // * the session is not in lock screen + // The changes will affect the primary user's preferences. + if (!session_manager::SessionManager::Get()->IsSessionStarted()) + return mojom::BluetoothModificationState::kCanModifyBluetooth; + + if (session_manager::SessionManager::Get()->IsScreenLocked()) + return mojom::BluetoothModificationState::kCannotModifyBluetooth; + + return user_manager::UserManager::Get()->GetPrimaryUser() == + user_manager::UserManager::Get()->GetActiveUser() + ? mojom::BluetoothModificationState::kCanModifyBluetooth + : mojom::BluetoothModificationState::kCannotModifyBluetooth; +} + } // namespace bluetooth_config } // namespace chromeos
diff --git a/chromeos/services/bluetooth_config/system_properties_provider_impl.h b/chromeos/services/bluetooth_config/system_properties_provider_impl.h index 21e0571b..0181b6d 100644 --- a/chromeos/services/bluetooth_config/system_properties_provider_impl.h +++ b/chromeos/services/bluetooth_config/system_properties_provider_impl.h
@@ -9,15 +9,18 @@ #include "chromeos/services/bluetooth_config/adapter_state_controller.h" #include "chromeos/services/bluetooth_config/device_cache.h" #include "chromeos/services/bluetooth_config/system_properties_provider.h" +#include "components/session_manager/core/session_manager_observer.h" namespace chromeos { namespace bluetooth_config { // SystemPropertiesProvider implementation which uses AdapterStateController as // the source of properties. -class SystemPropertiesProviderImpl : public SystemPropertiesProvider, - public AdapterStateController::Observer, - public DeviceCache::Observer { +class SystemPropertiesProviderImpl + : public SystemPropertiesProvider, + public AdapterStateController::Observer, + public session_manager::SessionManagerObserver, + public DeviceCache::Observer { public: SystemPropertiesProviderImpl(AdapterStateController* adapter_state_controller, DeviceCache* device_cache); @@ -28,12 +31,16 @@ // SystemPropertiesProvider: mojom::BluetoothSystemState ComputeSystemState() const override; + mojom::BluetoothModificationState ComputeModificationState() const override; std::vector<mojom::PairedBluetoothDevicePropertiesPtr> GetPairedDevices() const override; // AdapterStateController::Observer: void OnAdapterStateChanged() override; + // SessionManagerObserver: + void OnSessionStateChanged() override; + // DeviceCache::Observer: void OnPairedDevicesListChanged() override;
diff --git a/chromeos/services/bluetooth_config/system_properties_provider_impl_unittest.cc b/chromeos/services/bluetooth_config/system_properties_provider_impl_unittest.cc index a2923441..d459a8f 100644 --- a/chromeos/services/bluetooth_config/system_properties_provider_impl_unittest.cc +++ b/chromeos/services/bluetooth_config/system_properties_provider_impl_unittest.cc
@@ -11,6 +11,9 @@ #include "chromeos/services/bluetooth_config/fake_adapter_state_controller.h" #include "chromeos/services/bluetooth_config/fake_device_cache.h" #include "chromeos/services/bluetooth_config/fake_system_properties_observer.h" +#include "components/session_manager/core/session_manager.h" +#include "components/user_manager/fake_user_manager.h" +#include "components/user_manager/scoped_user_manager.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h" #include "testing/gtest/include/gtest/gtest.h" @@ -48,6 +51,12 @@ // testing::Test: void SetUp() override { + auto fake_user_manager = std::make_unique<user_manager::FakeUserManager>(); + fake_user_manager_ = fake_user_manager.get(); + scoped_user_manager_ = std::make_unique<user_manager::ScopedUserManager>( + std::move(fake_user_manager)); + session_manager_ = std::make_unique<session_manager::SessionManager>(); + provider_ = std::make_unique<SystemPropertiesProviderImpl>( &fake_adapter_state_controller_, &fake_device_cache_); } @@ -68,6 +77,32 @@ provider_->FlushForTesting(); } + const user_manager::User* LogIn(const std::string email) { + const AccountId account_id = AccountId::FromUserEmail(email); + const user_manager::User* user = fake_user_manager_->AddUser(account_id); + + // Create a session in SessionManager. This will also login the user in + // UserManager. + session_manager_->CreateSession(user->GetAccountId(), user->username_hash(), + /*is_child=*/false); + session_manager_->SessionStarted(); + + // Logging in doesn't set the user in UserManager as the active user if + // there already is an active user, do so manually. + SwitchActiveUser(account_id); + return user; + } + + void SwitchActiveUser(const AccountId& account_id) { + fake_user_manager_->SwitchActiveUser(account_id); + SetSessionState(session_manager::SessionState::ACTIVE); + } + + void SetSessionState(session_manager::SessionState session_state) { + session_manager_->SetSessionState(session_state); + provider_->FlushForTesting(); + } + std::unique_ptr<FakeSystemPropertiesObserver> Observe() { auto observer = std::make_unique<FakeSystemPropertiesObserver>(); provider_->Observe(observer->GeneratePendingRemote()); @@ -79,8 +114,11 @@ base::test::TaskEnvironment task_environment_; FakeAdapterStateController fake_adapter_state_controller_; FakeDeviceCache fake_device_cache_{&fake_adapter_state_controller_}; + std::unique_ptr<session_manager::SessionManager> session_manager_; + user_manager::FakeUserManager* fake_user_manager_; + std::unique_ptr<user_manager::ScopedUserManager> scoped_user_manager_; - std::unique_ptr<SystemPropertiesProvider> provider_; + std::unique_ptr<SystemPropertiesProviderImpl> provider_; }; TEST_F(SystemPropertiesProviderImplTest, SystemStateChanges) { @@ -128,6 +166,47 @@ EXPECT_EQ(2u, observer->received_properties_list()[2]->paired_devices.size()); } +TEST_F(SystemPropertiesProviderImplTest, ModificationStateChanges) { + std::unique_ptr<FakeSystemPropertiesObserver> observer = Observe(); + + // Once Observe() is called, the observer should immediately receive one + // update with the current state. Bluetooth is modifiable before any user logs + // in. + ASSERT_EQ(1u, observer->received_properties_list().size()); + EXPECT_EQ(mojom::BluetoothModificationState::kCanModifyBluetooth, + observer->received_properties_list()[0]->modification_state); + + // Log in as the first user. They should be able to modify Bluetooth. + const user_manager::User* user1 = LogIn("email1@example.com"); + ASSERT_EQ(2u, observer->received_properties_list().size()); + EXPECT_EQ(mojom::BluetoothModificationState::kCanModifyBluetooth, + observer->received_properties_list()[1]->modification_state); + + // Lock the screen. They should not be able to modify Bluetooth. + SetSessionState(session_manager::SessionState::LOCKED); + ASSERT_EQ(3u, observer->received_properties_list().size()); + EXPECT_EQ(mojom::BluetoothModificationState::kCannotModifyBluetooth, + observer->received_properties_list()[2]->modification_state); + + // Log in as a second user. They should not be able to modify Bluetooth. + LogIn("email2@example.com"); + ASSERT_EQ(4u, observer->received_properties_list().size()); + EXPECT_EQ(mojom::BluetoothModificationState::kCannotModifyBluetooth, + observer->received_properties_list()[3]->modification_state); + + // Lock the screen. They should not be able to modify Bluetooth. + SetSessionState(session_manager::SessionState::LOCKED); + ASSERT_EQ(5u, observer->received_properties_list().size()); + EXPECT_EQ(mojom::BluetoothModificationState::kCannotModifyBluetooth, + observer->received_properties_list()[4]->modification_state); + + // Switch to the first user again. They should be able to modify Bluetooth. + SwitchActiveUser(user1->GetAccountId()); + ASSERT_EQ(6u, observer->received_properties_list().size()); + EXPECT_EQ(mojom::BluetoothModificationState::kCanModifyBluetooth, + observer->received_properties_list()[5]->modification_state); +} + TEST_F(SystemPropertiesProviderImplTest, DisconnectToStopObserving) { // The initial properties list should have been received. std::unique_ptr<FakeSystemPropertiesObserver> observer = Observe();
diff --git a/components/app_restore/features.cc b/components/app_restore/features.cc index 9b114cc..0a43463 100644 --- a/components/app_restore/features.cc +++ b/components/app_restore/features.cc
@@ -4,6 +4,19 @@ #include "components/app_restore/features.h" +namespace app_restore { +namespace features { + +const base::Feature kArcAppsForDesksTemplates{ + "ArcAppsForDesksTemplates", base::FEATURE_DISABLED_BY_DEFAULT}; + +bool IsArcAppsForDesksTemplatesEnabled() { + return base::FeatureList::IsEnabled(kArcAppsForDesksTemplates); +} + +} // namespace features +} // namespace app_restore + namespace full_restore { namespace features {
diff --git a/components/app_restore/features.h b/components/app_restore/features.h index 7528a13..4c76951 100644 --- a/components/app_restore/features.h +++ b/components/app_restore/features.h
@@ -8,6 +8,18 @@ #include "base/component_export.h" #include "base/feature_list.h" +namespace app_restore { +namespace features { + +// Enables saving and launching ARC++ apps for desks templates. +COMPONENT_EXPORT(APP_RESTORE) +extern const base::Feature kArcAppsForDesksTemplates; + +COMPONENT_EXPORT(APP_RESTORE) bool IsArcAppsForDesksTemplatesEnabled(); + +} // namespace features +} // namespace app_restore + namespace full_restore { namespace features {
diff --git a/components/arc/compat_mode/DEPS b/components/arc/compat_mode/DEPS index bfebe18..03af7016 100644 --- a/components/arc/compat_mode/DEPS +++ b/components/arc/compat_mode/DEPS
@@ -10,6 +10,7 @@ "+components/strings/grit/components_strings.h", "+ui/aura", "+ui/chromeos/styles/cros_styles.h", + "+ui/color", "+ui/gfx", "+ui/strings", "+ui/views",
diff --git a/components/arc/compat_mode/arc_splash_screen_dialog_view.cc b/components/arc/compat_mode/arc_splash_screen_dialog_view.cc index 4476b9e8..009b2ae2 100644 --- a/components/arc/compat_mode/arc_splash_screen_dialog_view.cc +++ b/components/arc/compat_mode/arc_splash_screen_dialog_view.cc
@@ -20,6 +20,8 @@ #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/color/color_id.h" +#include "ui/color/color_provider.h" #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/rect.h" @@ -81,8 +83,8 @@ View::ConvertRectToTarget(parent(), this, &rect); cc::PaintFlags flags; flags.setAntiAlias(true); - flags.setColor(GetNativeTheme()->GetSystemColor( - ui::NativeTheme::kColorId_FocusedBorderColor)); + flags.setColor( + GetColorProvider()->GetColor(ui::kColorFocusableBorderFocused)); flags.setStyle(cc::PaintFlags::kStroke_Style); flags.setStrokeWidth(views::FocusRing::kDefaultHaloThickness); canvas->DrawRoundRect(rect, (*rrect).GetSimpleRadius(), flags);
diff --git a/components/arc/compat_mode/resize_confirmation_dialog_view.cc b/components/arc/compat_mode/resize_confirmation_dialog_view.cc index f9282fa..5dc298a6 100644 --- a/components/arc/compat_mode/resize_confirmation_dialog_view.cc +++ b/components/arc/compat_mode/resize_confirmation_dialog_view.cc
@@ -12,6 +12,8 @@ #include "components/arc/compat_mode/style/arc_color_provider.h" #include "components/strings/grit/components_strings.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/color/color_id.h" +#include "ui/color/color_provider.h" #include "ui/strings/grit/ui_strings.h" #include "ui/views/accessibility/view_accessibility.h" #include "ui/views/bubble/bubble_border.h" @@ -79,8 +81,8 @@ void ResizeConfirmationDialogView::OnThemeChanged() { views::BoxLayoutView::OnThemeChanged(); - do_not_ask_checkbox_->SetEnabledTextColors(GetNativeTheme()->GetSystemColor( - ui::NativeTheme::kColorId_DialogForeground)); + do_not_ask_checkbox_->SetEnabledTextColors( + GetColorProvider()->GetColor(ui::kColorDialogForeground)); } std::unique_ptr<views::View> ResizeConfirmationDialogView::MakeContentsView() {
diff --git a/components/arc/compat_mode/resize_toggle_menu.cc b/components/arc/compat_mode/resize_toggle_menu.cc index c69d53b..ecdb647 100644 --- a/components/arc/compat_mode/resize_toggle_menu.cc +++ b/components/arc/compat_mode/resize_toggle_menu.cc
@@ -16,6 +16,8 @@ #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/color/color_id.h" +#include "ui/color/color_provider.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/text_constants.h" @@ -118,18 +120,16 @@ if (!GetWidget()) return; - const auto* theme = GetNativeTheme(); + const auto* color_provider = GetColorProvider(); const auto icon_color = - is_selected_ - ? GetCrOSColor(cros_styles::ColorName::kIconColorSelection) - : theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor); + is_selected_ ? GetCrOSColor(cros_styles::ColorName::kIconColorSelection) + : color_provider->GetColor(ui::kColorLabelForeground); icon_view_->SetImage(gfx::CreateVectorIcon(icon_, icon_color)); const auto text_color = - is_selected_ - ? GetCrOSColor(cros_styles::ColorName::kTextColorSelection) - : theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor); + is_selected_ ? GetCrOSColor(cros_styles::ColorName::kTextColorSelection) + : color_provider->GetColor(ui::kColorLabelForeground); title_->SetEnabledColor(text_color); const auto background_color = @@ -138,9 +138,8 @@ background()->SetNativeControlColor(background_color); const auto border_color = - is_selected_ - ? SK_ColorTRANSPARENT - : theme->GetSystemColor(ui::NativeTheme::kColorId_MenuBorderColor); + is_selected_ ? SK_ColorTRANSPARENT + : color_provider->GetColor(ui::kColorMenuBorder); GetBorder()->set_color(border_color); }
diff --git a/components/autofill/core/browser/data_model/autofill_offer_data.cc b/components/autofill/core/browser/data_model/autofill_offer_data.cc index 8a592ca..e7d79ac 100644 --- a/components/autofill/core/browser/data_model/autofill_offer_data.cc +++ b/components/autofill/core/browser/data_model/autofill_offer_data.cc
@@ -96,14 +96,27 @@ return 0; } -bool AutofillOfferData::IsCardLinkedOffer() const { +AutofillOfferData::OfferType AutofillOfferData::GetOfferType() const { // Card-linked offers have at least one |eligible_instrument_id|. - return !eligible_instrument_id.empty(); + if (!eligible_instrument_id.empty()) + return OfferType::GPAY_CARD_LINKED_OFFER; + + // Promo code offers have the promo code field populated. + // TODO(crbug.com/1203811): When GPay-activated promo codes become available, + // create a way to differentiate them from free-listing coupon codes. + // They exist, but are not yet synced, and FLC syncing logic is ongoing. + if (!promo_code.empty()) + return OfferType::FREE_LISTING_COUPON_OFFER; + + return OfferType::UNKNOWN; +} + +bool AutofillOfferData::IsCardLinkedOffer() const { + return GetOfferType() == OfferType::GPAY_CARD_LINKED_OFFER; } bool AutofillOfferData::IsPromoCodeOffer() const { - // Promo code offers have the promo code field populated. - return !promo_code.empty(); + return GetOfferType() == OfferType::FREE_LISTING_COUPON_OFFER; } bool AutofillOfferData::IsActiveAndEligibleForOrigin(const GURL& origin) const {
diff --git a/components/autofill/core/browser/data_model/autofill_offer_data.h b/components/autofill/core/browser/data_model/autofill_offer_data.h index 7c16bb0..87efcec 100644 --- a/components/autofill/core/browser/data_model/autofill_offer_data.h +++ b/components/autofill/core/browser/data_model/autofill_offer_data.h
@@ -32,6 +32,19 @@ // promo codes. Merchants are determined by |merchant_origins|. struct AutofillOfferData { public: + // The specific type of offer. + // TODO(crbug.com/1203811): Add GPAY_PROMO_CODE_OFFER once GPay-activated + // promo codes become available, and create a way to differentiate them + // from free-listing coupon codes. + enum class OfferType { + // Default value, should not be used. + UNKNOWN, + // GPay-activated card linked offer. + GPAY_CARD_LINKED_OFFER, + // Promo code offer from the FreeListingCouponService. + FREE_LISTING_COUPON_OFFER, + }; + AutofillOfferData(); ~AutofillOfferData(); AutofillOfferData(const AutofillOfferData&); @@ -44,6 +57,10 @@ // result of first found difference. int Compare(const AutofillOfferData& other_offer_data) const; + // Returns the specific type of the offer, which will inform decisions made by + // other classes, such as UI rendering or metrics. + OfferType GetOfferType() const; + // Returns true if the current offer is a card-linked offer. bool IsCardLinkedOffer() const;
diff --git a/components/autofill/core/common/form_data.h b/components/autofill/core/common/form_data.h index 9cdec05..d01679e 100644 --- a/components/autofill/core/common/form_data.h +++ b/components/autofill/core/common/form_data.h
@@ -50,7 +50,38 @@ const FrameTokenWithPredecessor& b); }; -// Holds information about a form to be filled and/or submitted. +// Autofill represents forms and fields as FormData and FormFieldData objects. +// +// On the renderer side, there are roughly one-to-one correspondences +// - between FormData and blink::WebFormElement, and +// - between FormFieldData and blink::WebFormControlElement, +// where the Blink classes directly correspond to DOM elements. +// +// On the browser side, there are one-to-one correspondences +// - between FormData and AutofillField, and +// - between FormFieldData and FormStructure, +// where AutofillField and FormStructure hold additional information, such as +// Autofill type predictions and sectioning. +// +// A FormData is essentially a collection of FormFieldDatas with additional +// metadata. +// +// FormDatas and FormFieldDatas are used in the renderer-browser communication: +// - The renderer passes a FormData and/or FormFieldData to the browser when it +// has found a new form in the DOM, a form was submitted, etc. (see +// mojom::AutofillDriver). +// - The browser passes a FormData and/or FormFieldData to the renderer for +// preview, filling, etc. (see mojom::AutofillAgent). In the preview and +// filling cases, the browser sets the field values to the values to be +// previewed or filled. +// +// There are a few exceptions to the aforementioned one-to-one correspondences +// between Autofill's data types and Blink's: +// - Autofill only supports certain types of WebFormControlElements. +// - Autofill has the concept of an unowned form, which does not correspond to +// an existing blink::WebFormElement. +// - Autofill may move FormFieldDatas to other FormDatas across shadow/main +// DOMs and across frames. struct FormData { // Less-than relation for STL containers. Compares only members needed to // uniquely identify a form.
diff --git a/components/autofill_assistant/browser/starter.cc b/components/autofill_assistant/browser/starter.cc index b2eb64f..065d045b 100644 --- a/components/autofill_assistant/browser/starter.cc +++ b/components/autofill_assistant/browser/starter.cc
@@ -363,14 +363,16 @@ platform_delegate_->GetFeatureModuleInstalled(); bool prev_fetch_trigger_scripts_on_navigation = fetch_trigger_scripts_on_navigation_; + // Note: the feature flag must be the last thing tested in this if-statement, + // to avoid tagging tabs that otherwise don't qualify for in-cct triggering, + // which leads to pollution of our metrics. fetch_trigger_scripts_on_navigation_ = - ((base::FeatureList::IsEnabled( - features::kAutofillAssistantInCCTTriggering) && - is_custom_tab_ && platform_delegate_->GetIsTabCreatedByGSA()) || - (base::FeatureList::IsEnabled( - features::kAutofillAssistantInTabTriggering) && - !is_custom_tab_)) && - proactive_help_setting_enabled && msbb_setting_enabled; + proactive_help_setting_enabled && msbb_setting_enabled && + ((is_custom_tab_ && platform_delegate_->GetIsTabCreatedByGSA() && + base::FeatureList::IsEnabled( + features::kAutofillAssistantInCCTTriggering)) || + (!is_custom_tab_ && base::FeatureList::IsEnabled( + features::kAutofillAssistantInTabTriggering))); // If there is a pending startup, re-check that the settings are still // allowing the startup to proceed. If not, cancel the startup.
diff --git a/components/certificate_transparency/data/log_list.json b/components/certificate_transparency/data/log_list.json index 14b9f197b..a585268d 100644 --- a/components/certificate_transparency/data/log_list.json +++ b/components/certificate_transparency/data/log_list.json
@@ -1,6 +1,6 @@ { - "version": "3.42", - "log_list_timestamp": "2021-09-26T01:34:08Z", + "version": "3.43", + "log_list_timestamp": "2021-09-27T01:36:24Z", "operators": [ { "name": "Google",
diff --git a/components/media_control/browser/media_blocker.cc b/components/media_control/browser/media_blocker.cc index 523e3c5d0..00da371 100644 --- a/components/media_control/browser/media_blocker.cc +++ b/components/media_control/browser/media_blocker.cc
@@ -43,11 +43,15 @@ if (!web_contents()) return; - const std::vector<content::RenderFrameHost*> frames = - web_contents()->GetAllFrames(); - for (content::RenderFrameHost* frame : frames) { - UpdateRenderFrameMediaLoadingBlockedState(frame); - } + web_contents()->ForEachRenderFrameHost(base::BindRepeating( + [](MediaBlocker* media_blocker, + content::RenderFrameHost* render_frame_host) { + if (render_frame_host->IsRenderFrameLive()) { + media_blocker->UpdateRenderFrameMediaLoadingBlockedState( + render_frame_host); + } + }, + this)); } void MediaBlocker::UpdateRenderFrameMediaLoadingBlockedState(
diff --git a/components/media_message_center/BUILD.gn b/components/media_message_center/BUILD.gn index c36585762..106f9729 100644 --- a/components/media_message_center/BUILD.gn +++ b/components/media_message_center/BUILD.gn
@@ -39,6 +39,7 @@ "//services/media_session/public/cpp", "//skia", "//ui/accessibility", + "//ui/color", "//ui/message_center", "//ui/native_theme", "//ui/views",
diff --git a/components/media_message_center/media_notification_background_impl.cc b/components/media_message_center/media_notification_background_impl.cc index 310ebc8..f90a4c8 100644 --- a/components/media_message_center/media_notification_background_impl.cc +++ b/components/media_message_center/media_notification_background_impl.cc
@@ -10,12 +10,13 @@ #include "base/i18n/rtl.h" #include "cc/paint/paint_shader.h" #include "skia/ext/image_operations.h" +#include "ui/color/color_id.h" +#include "ui/color/color_provider.h" #include "ui/gfx/canvas.h" #include "ui/gfx/color_analysis.h" #include "ui/gfx/color_utils.h" #include "ui/gfx/scoped_canvas.h" #include "ui/gfx/skia_util.h" -#include "ui/native_theme/native_theme.h" #include "ui/views/style/typography.h" #include "ui/views/view.h" @@ -481,8 +482,7 @@ SkColor MediaNotificationBackgroundImpl::GetDefaultBackgroundColor( const views::View& owner) const { - return owner.GetNativeTheme()->GetSystemColor( - ui::NativeTheme::kColorId_BubbleBackground); + return owner.GetColorProvider()->GetColor(ui::kColorBubbleBackground); } void MediaNotificationBackgroundImpl::UpdateColorsInternal() {
diff --git a/components/media_message_center/media_notification_background_impl_unittest.cc b/components/media_message_center/media_notification_background_impl_unittest.cc index 2f05bc2b..b30537f 100644 --- a/components/media_message_center/media_notification_background_impl_unittest.cc +++ b/components/media_message_center/media_notification_background_impl_unittest.cc
@@ -14,7 +14,6 @@ #include "ui/gfx/color_analysis.h" #include "ui/gfx/color_utils.h" #include "ui/gfx/skia_util.h" -#include "ui/native_theme/test_native_theme.h" #include "ui/views/test/test_views.h" #include "ui/views/test/views_test_base.h" @@ -31,24 +30,6 @@ constexpr int kDefaultForegroundArtworkHeight = 100; -constexpr SkColor kDarkBackgroundColor = SK_ColorBLACK; - -class TestDarkTheme : public ui::TestNativeTheme { - public: - TestDarkTheme() = default; - ~TestDarkTheme() override = default; - - // ui::NativeTheme implementation. - SkColor GetSystemColorDeprecated(ColorId color_id, - ColorScheme color_scheme, - bool apply_processing) const override { - return (color_id == kColorId_BubbleBackground) - ? kDarkBackgroundColor - : ui::TestNativeTheme::GetSystemColorDeprecated( - color_id, color_scheme, apply_processing); - } -}; - SkColor GetColorFromSL(double s, double l) { return color_utils::HSLToSkColor({0.2, s, l}, SK_AlphaOPAQUE); } @@ -230,11 +211,13 @@ TEST_F(MediaNotificationBackgroundImplTest, GetBackgroundColorRespectsTheme) { std::unique_ptr<views::Widget> widget = CreateTestWidget(); + auto* theme = widget->GetNativeTheme(); + theme->set_use_dark_colors(false); auto* owner = widget->SetContentsView(std::make_unique<views::View>()); + SkColor light_background_color = background()->GetBackgroundColor(*owner); - TestDarkTheme dark_theme; - owner->SetNativeThemeForTesting(&dark_theme); - EXPECT_EQ(kDarkBackgroundColor, background()->GetBackgroundColor(*owner)); + theme->set_use_dark_colors(true); + EXPECT_NE(light_background_color, background()->GetBackgroundColor(*owner)); } // MediaNotificationBackgroundImplBlackWhiteTest will repeat these tests with a
diff --git a/components/optimization_guide/core/hints_processing_util.cc b/components/optimization_guide/core/hints_processing_util.cc index 04b6516..6720108 100644 --- a/components/optimization_guide/core/hints_processing_util.cc +++ b/components/optimization_guide/core/hints_processing_util.cc
@@ -60,6 +60,8 @@ return "PriceTracking"; case proto::OptimizationType::BLOOM_FILTER_VALIDATION: return "BloomFilterValidation"; + case proto::OptimizationType::ABOUT_THIS_SITE: + return "AboutThisSite"; } NOTREACHED(); return std::string();
diff --git a/components/optimization_guide/proto/hints.proto b/components/optimization_guide/proto/hints.proto index 7318ca2..a6fd2fe 100644 --- a/components/optimization_guide/proto/hints.proto +++ b/components/optimization_guide/proto/hints.proto
@@ -152,6 +152,8 @@ PRICE_TRACKING = 18; // This optimization does validation of bloom filter. BLOOM_FILTER_VALIDATION = 19; + // Provides 'About this site' data about the site being visited. + ABOUT_THIS_SITE = 20; } // Presents semantics for how page load URLs should be matched.
diff --git a/components/page_info/BUILD.gn b/components/page_info/BUILD.gn index 0674f0cf1..d933a85 100644 --- a/components/page_info/BUILD.gn +++ b/components/page_info/BUILD.gn
@@ -4,6 +4,8 @@ static_library("page_info") { sources = [ + "about_this_site_service.cc", + "about_this_site_service.h", "features.cc", "features.h", "page_info.cc", @@ -20,7 +22,9 @@ "//components/browsing_data/content", "//components/content_settings/browser", "//components/content_settings/core/browser", + "//components/keyed_service/core", "//components/omnibox/common", + "//components/optimization_guide/core", "//components/password_manager/core/browser", "//components/permissions", "//components/prefs",
diff --git a/components/page_info/DEPS b/components/page_info/DEPS index 9edd3601..dde4bec7 100644 --- a/components/page_info/DEPS +++ b/components/page_info/DEPS
@@ -2,6 +2,8 @@ "+components/browser_ui", "+components/browsing_data", "+components/content_settings", + "+components/keyed_service/core", + "+components/optimization_guide/core", "+components/password_manager", "+components/permissions", "+components/prefs",
diff --git a/components/page_info/about_this_site_service.cc b/components/page_info/about_this_site_service.cc new file mode 100644 index 0000000..58b3f174 --- /dev/null +++ b/components/page_info/about_this_site_service.cc
@@ -0,0 +1,36 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/page_info/about_this_site_service.h" + +#include "components/optimization_guide/core/optimization_metadata.h" +#include "url/gurl.h" + +namespace page_info { + +AboutThisSiteService::AboutThisSiteService(std::unique_ptr<Client> client) + : client_(std::move(client)) {} + +std::u16string AboutThisSiteService::GetAboutThisSiteDescription( + const GURL& url) const { + // TODO(crbug.com/1250653): Return the actual data after server-side is ready + // and proto is added. + const GURL test_gurl("https://example.com"); + if (url == test_gurl) { + return u"A domain used in illustrative examples in documents"; + } + + const GURL permissions_gurl("https://permission.site"); + if (url == permissions_gurl) { + return u"A site containing test buttons for various browser APIs, in order" + " to trigger permission dialogues and similar UI in modern " + "browsers."; + } + + return std::u16string(); +} + +AboutThisSiteService::~AboutThisSiteService() = default; + +} // namespace page_info
diff --git a/components/page_info/about_this_site_service.h b/components/page_info/about_this_site_service.h new file mode 100644 index 0000000..bd82bd5 --- /dev/null +++ b/components/page_info/about_this_site_service.h
@@ -0,0 +1,49 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_PAGE_INFO_ABOUT_THIS_SITE_SERVICE_H_ +#define COMPONENTS_PAGE_INFO_ABOUT_THIS_SITE_SERVICE_H_ + +#include <string> + +#include "components/keyed_service/core/keyed_service.h" +#include "components/optimization_guide/core/optimization_guide_decision.h" +#include "components/optimization_guide/core/optimization_metadata.h" + +class GURL; + +namespace page_info { + +// Provides "About this site" information for a web site. It includes short +// description about the website (from external source, usually from Wikipedia), +// when the website was first indexed and other data if available. +class AboutThisSiteService : public KeyedService { + public: + // Provides platform-independant access to an optimization guide service. + // OptimizationGuideService on iOS doesn't implement OptimizationGuideDecider, + // therefore the interface cannot be used in this service. + class Client { + public: + virtual optimization_guide::OptimizationGuideDecision CanApplyOptimization( + const GURL& url, + optimization_guide::OptimizationMetadata* optimization_metadata) = 0; + virtual ~Client() = default; + }; + + explicit AboutThisSiteService(std::unique_ptr<Client> client); + ~AboutThisSiteService() override; + + AboutThisSiteService(const AboutThisSiteService&) = delete; + AboutThisSiteService& operator=(const AboutThisSiteService&) = delete; + + // Returns "About this site" information for the website with |url|. + std::u16string GetAboutThisSiteDescription(const GURL& url) const; + + private: + std::unique_ptr<Client> client_; +}; + +} // namespace page_info + +#endif // COMPONENTS_PAGE_INFO_ABOUT_THIS_SITE_SERVICE_H_
diff --git a/components/performance_manager/decorators/process_hosted_content_types_aggregator.cc b/components/performance_manager/decorators/process_hosted_content_types_aggregator.cc index bf7ce6a..750e54c 100644 --- a/components/performance_manager/decorators/process_hosted_content_types_aggregator.cc +++ b/components/performance_manager/decorators/process_hosted_content_types_aggregator.cc
@@ -42,10 +42,11 @@ const FrameNode* frame_node) { auto* frame_node_impl = FrameNodeImpl::FromNode(frame_node); - // When a frame is tagged as an ad, it is a one way switch. - DCHECK(frame_node_impl->is_ad_frame()); - frame_node_impl->process_node()->add_hosted_content_type( - ProcessNode::ContentType::kAd); + // No need to handle untagging as content hosted in the past is still counted. + if (frame_node_impl->is_ad_frame()) { + frame_node_impl->process_node()->add_hosted_content_type( + ProcessNode::ContentType::kAd); + } } } // namespace performance_manager
diff --git a/components/performance_manager/decorators/process_hosted_content_types_aggregator_unittest.cc b/components/performance_manager/decorators/process_hosted_content_types_aggregator_unittest.cc index eb2d43c..574a9e2 100644 --- a/components/performance_manager/decorators/process_hosted_content_types_aggregator_unittest.cc +++ b/components/performance_manager/decorators/process_hosted_content_types_aggregator_unittest.cc
@@ -64,6 +64,12 @@ frame_node->SetIsAdFrame(true); EXPECT_TRUE( process_node->hosted_content_types().Has(ProcessNode::ContentType::kAd)); + + // Untag the frame as an ad. The process is still counted as having hosted an + // ad frame. + frame_node->SetIsAdFrame(false); + EXPECT_TRUE( + process_node->hosted_content_types().Has(ProcessNode::ContentType::kAd)); } TEST_F(ProcessHostedContentTypesAggregatorTest, ContentTypeIsPermanent) {
diff --git a/components/policy/core/common/policy_map.cc b/components/policy/core/common/policy_map.cc index 016825c..b733a68 100644 --- a/components/policy/core/common/policy_map.cc +++ b/components/policy/core/common/policy_map.cc
@@ -414,6 +414,49 @@ return clone; } +void PolicyMap::MergePolicy(const std::string& policy_name, + const PolicyMap& other, + bool using_default_precedence) { + const Entry* other_policy = other.GetUntrusted(policy_name); + if (!other_policy) + return; + + Entry* policy = GetMutableUntrusted(policy_name); + Entry other_policy_copy = other_policy->DeepCopy(); + + if (!policy) { + Set(policy_name, std::move(other_policy_copy)); + return; + } + +#if defined(OS_CHROMEOS) + const bool other_is_higher_priority = + EntryHasHigherPriority(other_policy_copy, *policy); +#else // defined(OS_CHROMEOS) + const bool other_is_higher_priority = EntryHasHigherPriority( + other_policy_copy, *policy, using_default_precedence); +#endif // defined(OS_CHROMEOS) + + Entry& higher_policy = other_is_higher_priority ? other_policy_copy : *policy; + Entry& conflicting_policy = + other_is_higher_priority ? *policy : other_policy_copy; + + const bool overwriting_default_policy = + higher_policy.source != conflicting_policy.source && + conflicting_policy.source == POLICY_SOURCE_ENTERPRISE_DEFAULT; + if (!overwriting_default_policy) { + policy->value() && *other_policy_copy.value() == *policy->value() + ? higher_policy.AddMessage(MessageType::kInfo, + IDS_POLICY_CONFLICT_SAME_VALUE) + : higher_policy.AddMessage(MessageType::kWarning, + IDS_POLICY_CONFLICT_DIFF_VALUE); + higher_policy.AddConflictingPolicy(std::move(conflicting_policy)); + } + + if (other_is_higher_priority) + *policy = std::move(other_policy_copy); +} + void PolicyMap::MergeFrom(const PolicyMap& other) { DCHECK_NE(this, &other); // Set affiliation IDs before merging policy values because user affiliation @@ -422,44 +465,28 @@ CombineIds(GetUserAffiliationIds(), other.GetUserAffiliationIds())); SetDeviceAffiliationIds( CombineIds(GetDeviceAffiliationIds(), other.GetDeviceAffiliationIds())); - // TODO(crbug.com/1234801): Extract the precedence and merging metapolicy - // values from both |PolicyMap|s here to enable setting them through CBCM. + + // Precedence metapolicies are merged before all other policies, including + // merging metapolicies, because their value affects policy overriding. + for (auto* policy : metapolicy::kPrecedence) { + // Default precedence is used during merging of precedence metapolicies to + // prevent circular dependencies. + MergePolicy(policy, other, true); + } + UpdateStoredComputedMetapolicies(); for (const auto& policy_and_entry : other) { - Entry* current_policy = GetMutableUntrusted(policy_and_entry.first); - Entry other_policy = policy_and_entry.second.DeepCopy(); - - // TODO(crbug.com/1234801): Once metapolicies are extracted above, skip them - // if they are encountered again in this loop. - if (!current_policy) { - Set(policy_and_entry.first, std::move(other_policy)); + // Skip precedence metapolicies since they have already been merged into the + // current PolicyMap. + if (std::find(std::begin(metapolicy::kPrecedence), + std::end(metapolicy::kPrecedence), policy_and_entry.first) != + std::end(metapolicy::kPrecedence)) { continue; } - const bool other_is_higher_priority = - EntryHasHigherPriority(other_policy, *current_policy); - - Entry& higher_policy = - other_is_higher_priority ? other_policy : *current_policy; - Entry& conflicting_policy = - other_is_higher_priority ? *current_policy : other_policy; - - const bool overwriting_default_policy = - higher_policy.source != conflicting_policy.source && - conflicting_policy.source == POLICY_SOURCE_ENTERPRISE_DEFAULT; - if (!overwriting_default_policy) { - current_policy->value() && - *other_policy.value() == *current_policy->value() - ? higher_policy.AddMessage(MessageType::kInfo, - IDS_POLICY_CONFLICT_SAME_VALUE) - : higher_policy.AddMessage(MessageType::kWarning, - IDS_POLICY_CONFLICT_DIFF_VALUE); - higher_policy.AddConflictingPolicy(std::move(conflicting_policy)); - } - - if (other_is_higher_priority) - *current_policy = std::move(other_policy); + // External factors, such as the values of metapolicies, are considered. + MergePolicy(policy_and_entry.first, other, false); } } @@ -533,16 +560,30 @@ bool PolicyMap::EntryHasHigherPriority(const PolicyMap::Entry& lhs, const PolicyMap::Entry& rhs) const { + return EntryHasHigherPriority(lhs, rhs, false); +} + +bool PolicyMap::EntryHasHigherPriority(const PolicyMap::Entry& lhs, + const PolicyMap::Entry& rhs, + bool using_default_precedence) const { #if defined(OS_CHROMEOS) return std::tie(lhs.level, lhs.scope, lhs.source) > std::tie(rhs.level, rhs.scope, rhs.source); #else // defined(OS_CHROMEOS) - PolicyPriorityBrowser lhs_priority = GetPriority( - lhs.source, lhs.scope, cloud_policy_overrides_platform_policy_, - cloud_user_policy_overrides_cloud_machine_policy_, is_user_affiliated_); - PolicyPriorityBrowser rhs_priority = GetPriority( - rhs.source, rhs.scope, cloud_policy_overrides_platform_policy_, - cloud_user_policy_overrides_cloud_machine_policy_, is_user_affiliated_); + PolicyPriorityBrowser lhs_priority = + using_default_precedence + ? GetPriority(lhs.source, lhs.scope, false, false, false) + : GetPriority(lhs.source, lhs.scope, + cloud_policy_overrides_platform_policy_, + cloud_user_policy_overrides_cloud_machine_policy_, + is_user_affiliated_); + PolicyPriorityBrowser rhs_priority = + using_default_precedence + ? GetPriority(rhs.source, rhs.scope, false, false, false) + : GetPriority(rhs.source, rhs.scope, + cloud_policy_overrides_platform_policy_, + cloud_user_policy_overrides_cloud_machine_policy_, + is_user_affiliated_); return std::tie(lhs.level, lhs_priority) > std::tie(rhs.level, rhs_priority); #endif // defined(OS_CHROMEOS) } @@ -571,19 +612,14 @@ return device_affiliation_ids_; } -bool PolicyMap::GetPlatformMachinePolicyBool(const std::string& policy) const { - return GetValue(policy) && GetValue(policy)->GetBool() && - Get(policy)->source == POLICY_SOURCE_PLATFORM && - Get(policy)->scope == POLICY_SCOPE_MACHINE; -} - void PolicyMap::UpdateStoredComputedMetapolicies() { cloud_policy_overrides_platform_policy_ = - GetPlatformMachinePolicyBool(key::kCloudPolicyOverridesPlatformPolicy); + GetValue(key::kCloudPolicyOverridesPlatformPolicy) && + GetValue(key::kCloudPolicyOverridesPlatformPolicy)->GetBool(); cloud_user_policy_overrides_cloud_machine_policy_ = - GetPlatformMachinePolicyBool( - key::kCloudUserPolicyOverridesCloudMachinePolicy); + GetValue(key::kCloudUserPolicyOverridesCloudMachinePolicy) && + GetValue(key::kCloudUserPolicyOverridesCloudMachinePolicy)->GetBool(); } void PolicyMap::UpdateStoredUserAffiliation() {
diff --git a/components/policy/core/common/policy_map.h b/components/policy/core/common/policy_map.h index 5d41205..75eab891 100644 --- a/components/policy/core/common/policy_map.h +++ b/components/policy/core/common/policy_map.h
@@ -247,6 +247,14 @@ // Returns a copy of |this|. PolicyMap Clone() const; + // Helper method used to merge entries corresponding to the same policy. + // Setting |using_default_precedence| to true results in external factors, + // such as the value of precedence metapolicies and user affiliation, to be + // considered during the priority check. + void MergePolicy(const std::string& policy_name, + const PolicyMap& other, + bool using_default_precedence); + // Merges policies from |other| into |this|. Existing policies are only // overridden by those in |other| if they have a higher priority, as defined // by EntryHasHigherPriority(). If a policy is contained in both maps with the @@ -266,10 +274,19 @@ // Returns true if |lhs| has higher priority than |rhs|. The priority of the // fields are |level| > |PolicyPriority| for browser and |level| > |scope| > - // |source| for OS. + // |source| for OS. External factors such as metapolicy values are considered + // by default for browser policies. bool EntryHasHigherPriority(const PolicyMap::Entry& lhs, const PolicyMap::Entry& rhs) const; + // Returns true if |lhs| has higher priority than |rhs|. The priority of the + // fields are |level| > |PolicyPriority| for browser and |level| > |scope| > + // |source| for OS. External factors such as metapolicy values and user + // affiliation are optionally considered. + bool EntryHasHigherPriority(const PolicyMap::Entry& lhs, + const PolicyMap::Entry& rhs, + bool using_default_precedence) const; + // Returns True if at least one shared ID is found in the user and device // affiliation ID sets. bool IsUserAffiliated() const; @@ -315,11 +332,6 @@ const base::RepeatingCallback<bool(const const_iterator)>& filter, bool deletion_value); - // Returns the value of a stored bool policy only if it is a machine platform - // policy. Otherwise, returns false. This is used to ensure that the set - // precedence metapolicies are platform machine policies. - bool GetPlatformMachinePolicyBool(const std::string& policy) const; - // Updates the stored state of computed metapolicies. void UpdateStoredComputedMetapolicies();
diff --git a/components/policy/core/common/policy_map_unittest.cc b/components/policy/core/common/policy_map_unittest.cc index f9dc63ce5..25471a2 100644 --- a/components/policy/core/common/policy_map_unittest.cc +++ b/components/policy/core/common/policy_map_unittest.cc
@@ -356,6 +356,108 @@ EXPECT_FALSE(b.Equals(empty)); } +#if !defined(OS_CHROMEOS) +// Policy precedence changes are not supported on Chrome OS. +TEST_F(PolicyMapTest, MergeFrom_CloudMetapolicies) { + // The two precedence metapolicies, CloudPolicyOverridesPlatformPolicy and + // CloudUserPolicyOverridesCloudMachinePolicy, are set as cloud policies in + // the incoming |policy_map_2|. + PolicyMap policy_map_1; + policy_map_1.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, + base::Value("platform_machine"), nullptr); + policy_map_1.Set(kTestPolicyName2, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_CLOUD, base::Value("cloud_user"), nullptr); + policy_map_1.Set(kTestPolicyName3, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_CLOUD, base::Value("cloud_user"), nullptr); + policy_map_1.Set(kTestPolicyName4, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, + base::Value("cloud_machine"), nullptr); + + PolicyMap policy_map_2; + // Set matching user and device affiliation IDs to allow cloud user policies + // to take precedence over cloud machine policies. + base::flat_set<std::string> affiliation_ids; + affiliation_ids.insert("a"); + policy_map_2.SetUserAffiliationIds(affiliation_ids); + policy_map_2.SetDeviceAffiliationIds(affiliation_ids); + + policy_map_2.Set(key::kCloudPolicyOverridesPlatformPolicy, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_CLOUD, base::Value(true), nullptr); + policy_map_2.Set(key::kCloudUserPolicyOverridesCloudMachinePolicy, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_CLOUD, base::Value(true), nullptr); + policy_map_2.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, + base::Value("cloud_machine"), nullptr); + policy_map_2.Set(kTestPolicyName2, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_PLATFORM, base::Value("platform_user"), + nullptr); + policy_map_2.Set(kTestPolicyName3, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, + base::Value("platform_machine"), nullptr); + policy_map_2.Set(kTestPolicyName4, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_CLOUD, base::Value("cloud_user"), nullptr); + + auto conflicting_policy_1 = policy_map_1.Get(kTestPolicyName1)->DeepCopy(); + auto conflicting_policy_2 = policy_map_2.Get(kTestPolicyName2)->DeepCopy(); + auto conflicting_policy_3 = policy_map_2.Get(kTestPolicyName3)->DeepCopy(); + auto conflicting_policy_4 = policy_map_1.Get(kTestPolicyName4)->DeepCopy(); + + policy_map_1.MergeFrom(policy_map_2); + + PolicyMap policy_map_expected; + + policy_map_expected.SetUserAffiliationIds(affiliation_ids); + policy_map_expected.SetDeviceAffiliationIds(affiliation_ids); + policy_map_expected.Set(key::kCloudPolicyOverridesPlatformPolicy, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_CLOUD, base::Value(true), nullptr); + policy_map_expected.Set(key::kCloudUserPolicyOverridesCloudMachinePolicy, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_CLOUD, base::Value(true), nullptr); + // Cloud machine overrides platform machine. + policy_map_expected.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, + base::Value("cloud_machine"), nullptr); + policy_map_expected.GetMutable(kTestPolicyName1) + ->AddMessage(PolicyMap::MessageType::kWarning, + IDS_POLICY_CONFLICT_DIFF_VALUE); + policy_map_expected.GetMutable(kTestPolicyName1) + ->AddConflictingPolicy(std::move(conflicting_policy_1)); + // Cloud user overrides platform user. + policy_map_expected.Set(kTestPolicyName2, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, + base::Value("cloud_user"), nullptr); + policy_map_expected.GetMutable(kTestPolicyName2) + ->AddMessage(PolicyMap::MessageType::kWarning, + IDS_POLICY_CONFLICT_DIFF_VALUE); + policy_map_expected.GetMutable(kTestPolicyName2) + ->AddConflictingPolicy(std::move(conflicting_policy_2)); + // Cloud user overrides platform machine. + policy_map_expected.Set(kTestPolicyName3, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, + base::Value("cloud_user"), nullptr); + policy_map_expected.GetMutable(kTestPolicyName3) + ->AddMessage(PolicyMap::MessageType::kWarning, + IDS_POLICY_CONFLICT_DIFF_VALUE); + policy_map_expected.GetMutable(kTestPolicyName3) + ->AddConflictingPolicy(std::move(conflicting_policy_3)); + // Cloud user overrides cloud machine. + policy_map_expected.Set(kTestPolicyName4, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, + base::Value("cloud_user"), nullptr); + policy_map_expected.GetMutable(kTestPolicyName4) + ->AddMessage(PolicyMap::MessageType::kWarning, + IDS_POLICY_CONFLICT_DIFF_VALUE); + policy_map_expected.GetMutable(kTestPolicyName4) + ->AddConflictingPolicy(std::move(conflicting_policy_4)); + + EXPECT_TRUE(policy_map_1.Equals(policy_map_expected)); +} +#endif // defined(OS_CHROMEOS) + TEST_F(PolicyMapTest, MergeValuesList) { std::vector<base::Value> abcd = GetListStorage<std::string>({"a", "b", "c", "d"}); @@ -1119,15 +1221,20 @@ public testing::TestWithParam< std::tuple</*cloud_policy_overrides_platform_policy=*/bool, /*cloud_user_policy_overrides_cloud_machine_policy=*/bool, - /*is_user_affiliated=*/bool>> { + /*is_user_affiliated=*/bool, + /*metapolicies_are_incoming=*/bool>> { public: - bool CloudPolicyOverridesPlatformPolicy() { return std::get<0>(GetParam()); } + bool CloudPolicyOverridesPlatformPolicy() const { + return std::get<0>(GetParam()); + } - bool CloudUserPolicyOverridesCloudMachinePolicy() { + bool CloudUserPolicyOverridesCloudMachinePolicy() const { return std::get<1>(GetParam()); } - bool IsUserAffiliated() { return std::get<2>(GetParam()); } + bool IsUserAffiliated() const { return std::get<2>(GetParam()); } + + bool MetapoliciesAreIncoming() const { return std::get<3>(GetParam()); } void PopulateExpectedPolicyMap(PolicyMap& policy_map_expected, const PolicyMap& policy_map_1, @@ -1288,6 +1395,80 @@ } #endif // !defined(OS_CHROMEOS) } + + void PopulateExpectedMetapolicyMap( + PolicyMap& policy_map_expected, + const PolicyMap& policy_map_1, + const PolicyMap& policy_map_2, + std::unique_ptr<base::ListValue> merge_list_1, + std::unique_ptr<base::ListValue> merge_list_2) { + // Platform machine overrides cloud machine because modified priorities + // don't apply to precedence metapolicies. + policy_map_expected.Set( + key::kCloudPolicyOverridesPlatformPolicy, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, + base::Value(CloudPolicyOverridesPlatformPolicy()), nullptr); + policy_map_expected.GetMutable(key::kCloudPolicyOverridesPlatformPolicy) + ->AddMessage(CloudPolicyOverridesPlatformPolicy() + ? PolicyMap::MessageType::kWarning + : PolicyMap::MessageType::kInfo, + CloudPolicyOverridesPlatformPolicy() + ? IDS_POLICY_CONFLICT_DIFF_VALUE + : IDS_POLICY_CONFLICT_SAME_VALUE); + policy_map_expected.GetMutable(key::kCloudPolicyOverridesPlatformPolicy) + ->AddConflictingPolicy( + policy_map_2.Get(key::kCloudPolicyOverridesPlatformPolicy) + ->DeepCopy()); + policy_map_expected.Set( + key::kCloudUserPolicyOverridesCloudMachinePolicy, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, + base::Value(CloudUserPolicyOverridesCloudMachinePolicy()), nullptr); + policy_map_expected + .GetMutable(key::kCloudUserPolicyOverridesCloudMachinePolicy) + ->AddMessage(CloudUserPolicyOverridesCloudMachinePolicy() + ? PolicyMap::MessageType::kWarning + : PolicyMap::MessageType::kInfo, + CloudUserPolicyOverridesCloudMachinePolicy() + ? IDS_POLICY_CONFLICT_DIFF_VALUE + : IDS_POLICY_CONFLICT_SAME_VALUE); + policy_map_expected + .GetMutable(key::kCloudUserPolicyOverridesCloudMachinePolicy) + ->AddConflictingPolicy( + policy_map_1.Get(key::kCloudUserPolicyOverridesCloudMachinePolicy) + ->DeepCopy()); +#if !defined(OS_CHROMEOS) + if (CloudPolicyOverridesPlatformPolicy()) { + // Cloud machine overrides platform machine because modified priorities + // apply to merging metapolicies. + policy_map_expected.Set(key::kPolicyListMultipleSourceMergeList, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_CLOUD, merge_list_2->Clone(), + nullptr); + policy_map_expected.GetMutable(key::kPolicyListMultipleSourceMergeList) + ->AddMessage(PolicyMap::MessageType::kWarning, + IDS_POLICY_CONFLICT_DIFF_VALUE); + policy_map_expected.GetMutable(key::kPolicyListMultipleSourceMergeList) + ->AddConflictingPolicy( + policy_map_1.Get(key::kPolicyListMultipleSourceMergeList) + ->DeepCopy()); + } else { +#endif // !defined(OS_CHROMEOS) + // Platform machine overrides cloud machine with default precedence. + policy_map_expected.Set(key::kPolicyListMultipleSourceMergeList, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_PLATFORM, merge_list_1->Clone(), + nullptr); + policy_map_expected.GetMutable(key::kPolicyListMultipleSourceMergeList) + ->AddMessage(PolicyMap::MessageType::kWarning, + IDS_POLICY_CONFLICT_DIFF_VALUE); + policy_map_expected.GetMutable(key::kPolicyListMultipleSourceMergeList) + ->AddConflictingPolicy( + policy_map_2.Get(key::kPolicyListMultipleSourceMergeList) + ->DeepCopy()); +#if !defined(OS_CHROMEOS) + } +#endif // !defined(OS_CHROMEOS) + } }; TEST_P(PolicyMapMergeTest, MergeFrom) { @@ -1299,14 +1480,17 @@ policy_map_1.SetUserAffiliationIds(affiliation_ids); policy_map_1.SetDeviceAffiliationIds(affiliation_ids); } - policy_map_1.Set(key::kCloudPolicyOverridesPlatformPolicy, - POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_PLATFORM, - base::Value(CloudPolicyOverridesPlatformPolicy()), nullptr); - policy_map_1.Set( - key::kCloudUserPolicyOverridesCloudMachinePolicy, POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, - base::Value(CloudUserPolicyOverridesCloudMachinePolicy()), nullptr); + if (!MetapoliciesAreIncoming()) { + // Metapolicies are set in the base PolicyMap. + policy_map_1.Set( + key::kCloudPolicyOverridesPlatformPolicy, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, + base::Value(CloudPolicyOverridesPlatformPolicy()), nullptr); + policy_map_1.Set( + key::kCloudUserPolicyOverridesCloudMachinePolicy, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, + base::Value(CloudUserPolicyOverridesCloudMachinePolicy()), nullptr); + } policy_map_1.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, base::Value("google.com"), nullptr); policy_map_1.Set(kTestPolicyName2, POLICY_LEVEL_MANDATORY, @@ -1329,6 +1513,17 @@ base::Value("blocked platform policy"), nullptr); PolicyMap policy_map_2; + if (MetapoliciesAreIncoming()) { + // Metapolicies are set in the incoming PolicyMap. + policy_map_2.Set( + key::kCloudPolicyOverridesPlatformPolicy, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, + base::Value(CloudPolicyOverridesPlatformPolicy()), nullptr); + policy_map_2.Set( + key::kCloudUserPolicyOverridesCloudMachinePolicy, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, + base::Value(CloudUserPolicyOverridesCloudMachinePolicy()), nullptr); + } policy_map_2.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, base::Value("chromium.org"), nullptr); @@ -1364,10 +1559,60 @@ EXPECT_TRUE(policy_map_1.Equals(policy_map_expected)); } +TEST_P(PolicyMapMergeTest, MergeFrom_Metapolicies) { + // Define the lists of policies that will be used by the merging metapolicies. + std::unique_ptr<base::ListValue> merge_list_1 = + std::make_unique<base::ListValue>(); + merge_list_1->Append(base::Value(kTestPolicyName1)); + std::unique_ptr<base::ListValue> merge_list_2 = + std::make_unique<base::ListValue>(); + merge_list_2->Append(base::Value(kTestPolicyName2)); + + PolicyMap policy_map_1; + if (IsUserAffiliated()) { + base::flat_set<std::string> affiliation_ids; + affiliation_ids.insert("12345"); + policy_map_1.SetUserAffiliationIds(affiliation_ids); + policy_map_1.SetDeviceAffiliationIds(affiliation_ids); + } + policy_map_1.Set(key::kCloudPolicyOverridesPlatformPolicy, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_PLATFORM, + base::Value(CloudPolicyOverridesPlatformPolicy()), nullptr); + policy_map_1.Set(key::kCloudUserPolicyOverridesCloudMachinePolicy, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_CLOUD, base::Value(false), nullptr); + policy_map_1.Set(key::kPolicyListMultipleSourceMergeList, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_PLATFORM, merge_list_1->Clone(), nullptr); + + PolicyMap policy_map_2; + policy_map_2.Set(key::kCloudPolicyOverridesPlatformPolicy, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_CLOUD, base::Value(false), nullptr); + policy_map_2.Set( + key::kCloudUserPolicyOverridesCloudMachinePolicy, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, + base::Value(CloudUserPolicyOverridesCloudMachinePolicy()), nullptr); + policy_map_2.Set(key::kPolicyListMultipleSourceMergeList, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_CLOUD, merge_list_2->Clone(), nullptr); + + PolicyMap policy_map_expected; + PopulateExpectedMetapolicyMap(policy_map_expected, policy_map_1, policy_map_2, + std::move(merge_list_1), + std::move(merge_list_2)); + + policy_map_1.MergeFrom(policy_map_2); + + EXPECT_TRUE(policy_map_1.Equals(policy_map_expected)); +} + INSTANTIATE_TEST_SUITE_P(PolicyMapMergeTestInstance, PolicyMapMergeTest, testing::Combine(testing::Values(false, true), testing::Values(false, true), + testing::Values(false, true), testing::Values(false, true))); #if !defined(OS_CHROMEOS)
diff --git a/components/policy/core/common/policy_service_impl_unittest.cc b/components/policy/core/common/policy_service_impl_unittest.cc index cf8939e..735599c 100644 --- a/components/policy/core/common/policy_service_impl_unittest.cc +++ b/components/policy/core/common/policy_service_impl_unittest.cc
@@ -1422,6 +1422,95 @@ EXPECT_TRUE(VerifyPolicies(chrome_namespace, expected_chrome)); } +#if !defined(OS_CHROMEOS) +// The cloud user policy merging metapolicy is not applicable in Chrome OS. +TEST_F(PolicyServiceTest, ListsPoliciesMerging_CloudMetapolicy) { + const PolicyNamespace chrome_namespace(POLICY_DOMAIN_CHROME, std::string()); + + // Initialize affiliation IDs. User and device ID is identical. + base::flat_set<std::string> affiliation_ids; + affiliation_ids.insert(kAffiliationId1); + + base::Value list1(base::Value::Type::LIST); + list1.Append(base::Value(kUrl1)); + list1.Append(base::Value(kUrl2)); + base::Value list2 = base::Value(base::Value::Type::LIST); + list2.Append(base::Value(kUrl2)); + list2.Append(base::Value(kUrl3)); + base::Value list3 = base::Value(base::Value::Type::LIST); + list2.Append(base::Value(kUrl3)); + list2.Append(base::Value(kUrl4)); + base::Value result = base::Value(base::Value::Type::LIST); + result.Append(base::Value(kUrl1)); + result.Append(base::Value(kUrl2)); + result.Append(base::Value(kUrl3)); + result.Append(base::Value(kUrl4)); + + std::unique_ptr<base::ListValue> policy = std::make_unique<base::ListValue>(); + policy->Append(base::Value(policy::key::kExtensionInstallForcelist)); + + // policy_bundle1 is treated as a machine platform bundle. + auto policy_bundle1 = std::make_unique<PolicyBundle>(); + PolicyMap& policy_map1 = policy_bundle1->Get(chrome_namespace); + PolicyMap::Entry entry_list_1(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_PLATFORM, std::move(list1), + nullptr); + policy_map1.Set(key::kExtensionInstallForcelist, entry_list_1.DeepCopy()); + + // policy_bundle2 is treated as a machine cloud bundle. In addition to the + // device affiliation IDs, the metapolicies are also defined here to simulate + // being set through CBCM. + auto policy_bundle2 = std::make_unique<PolicyBundle>(); + PolicyMap& policy_map2 = policy_bundle2->Get(chrome_namespace); + policy_map2.Set(key::kPolicyListMultipleSourceMergeList, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_CLOUD, policy->Clone(), nullptr); + policy_map2.Set(key::kCloudUserPolicyMerge, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, base::Value(true), + nullptr); + PolicyMap::Entry entry_list_2(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_CLOUD, std::move(list2), nullptr); + policy_map2.Set(key::kExtensionInstallForcelist, entry_list_2.DeepCopy()); + policy_map2.SetDeviceAffiliationIds(affiliation_ids); + + // policy_bundle3 is treated as a user cloud bundle. The user affiliation IDs + // are defined here to reflect what would happen in reality. + auto policy_bundle3 = std::make_unique<PolicyBundle>(); + PolicyMap& policy_map3 = policy_bundle3->Get(chrome_namespace); + PolicyMap::Entry entry_list_3(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_CLOUD, std::move(list3), nullptr); + policy_map3.Set(key::kExtensionInstallForcelist, entry_list_3.DeepCopy()); + policy_map3.SetUserAffiliationIds(affiliation_ids); + + // The expected_chrome PolicyMap contains the combined URLs from all three + // policy bundles. The affiliation IDs don't need to be added as they're not + // compared in the PolicyMap equality check. + PolicyMap expected_chrome; + expected_chrome.Set(key::kPolicyListMultipleSourceMergeList, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_CLOUD, policy->Clone(), nullptr); + expected_chrome.Set(key::kCloudUserPolicyMerge, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, + base::Value(true), nullptr); + expected_chrome.Set("migrated", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_PLATFORM, base::Value(15), nullptr); + + PolicyMap::Entry merged(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, + POLICY_SOURCE_MERGED, std::move(result), nullptr); + merged.AddConflictingPolicy(entry_list_3.DeepCopy()); + merged.AddConflictingPolicy(entry_list_2.DeepCopy()); + merged.AddConflictingPolicy(entry_list_1.DeepCopy()); + expected_chrome.Set(key::kExtensionInstallForcelist, std::move(merged)); + + provider0_.UpdatePolicy(std::move(policy_bundle3)); + provider1_.UpdatePolicy(std::move(policy_bundle2)); + provider2_.UpdatePolicy(std::move(policy_bundle1)); + RunUntilIdle(); + + EXPECT_TRUE(VerifyPolicies(chrome_namespace, expected_chrome)); +} +#endif // !defined(OS_CHROMEOS) + TEST_F(PolicyServiceTest, GroupPoliciesMergingDisabledForCloudUsers) { const PolicyNamespace chrome_namespace(POLICY_DOMAIN_CHROME, std::string());
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 0d9ffed8..630d17c 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -18720,9 +18720,8 @@ 'ios:88-', ], 'features': { - 'dynamic_refresh': False, + 'dynamic_refresh': True, 'per_profile': False, - 'platform_only': True, 'metapolicy_type': 'precedence', }, 'example_value': False, @@ -18754,7 +18753,6 @@ 'features': { 'dynamic_refresh': True, 'per_profile': False, - 'platform_only': True, 'metapolicy_type': 'precedence', }, 'example_value': False,
diff --git a/components/policy/tools/generate_policy_source.py b/components/policy/tools/generate_policy_source.py index e485783..4d4017c0 100755 --- a/components/policy/tools/generate_policy_source.py +++ b/components/policy/tools/generate_policy_source.py
@@ -554,9 +554,9 @@ # Declare arrays of metapolicies. f.write('// Arrays of metapolicies.\n' 'namespace metapolicy {\n\n') - f.write('extern const char* kMerge[%s];\n' % + f.write('extern const char* const kMerge[%s];\n' % len(_GetMetapoliciesOfType(policies, METAPOLICY_TYPE['merge']))) - f.write('extern const char* kPrecedence[%s];\n\n' % + f.write('extern const char* const kPrecedence[%s];\n\n' % len(_GetMetapoliciesOfType(policies, METAPOLICY_TYPE['precedence']))) f.write('} // namespace metapolicy\n\n') @@ -1292,7 +1292,7 @@ # Populate merge metapolicy array. merge_metapolicies = _GetMetapoliciesOfType(policies, METAPOLICY_TYPE['merge']) - f.write('const char* kMerge[%s] = {\n' % len(merge_metapolicies)) + f.write('const char* const kMerge[%s] = {\n' % len(merge_metapolicies)) for metapolicy in merge_metapolicies: f.write(' key::k%s,\n' % metapolicy) f.write('};\n\n') @@ -1300,7 +1300,8 @@ # Populate precedence metapolicy array. precedence_metapolicies = _GetMetapoliciesOfType( policies, METAPOLICY_TYPE['precedence']) - f.write('const char* kPrecedence[%s] = {\n' % len(precedence_metapolicies)) + f.write('const char* const kPrecedence[%s] = {\n' % + len(precedence_metapolicies)) for metapolicy in precedence_metapolicies: f.write(' key::k%s,\n' % metapolicy) f.write('};\n\n')
diff --git a/components/policy/tools/generate_policy_source_test_data.py b/components/policy/tools/generate_policy_source_test_data.py index 6e94b551..3f28248e 100644 --- a/components/policy/tools/generate_policy_source_test_data.py +++ b/components/policy/tools/generate_policy_source_test_data.py
@@ -161,8 +161,8 @@ // Arrays of metapolicies. namespace metapolicy { -extern const char* kMerge[1]; -extern const char* kPrecedence[1]; +extern const char* const kMerge[1]; +extern const char* const kPrecedence[1]; } // namespace metapolicy @@ -368,11 +368,11 @@ namespace metapolicy { -const char* kMerge[1] = { +const char* const kMerge[1] = { key::kExampleBoolMergeMetapolicy, }; -const char* kPrecedence[1] = { +const char* const kPrecedence[1] = { key::kExampleBoolPrecedenceMetapolicy, }; @@ -545,4 +545,4 @@ }; } // namespace policy -''' \ No newline at end of file +'''
diff --git a/components/security_interstitials/content/cert_logger.proto b/components/security_interstitials/content/cert_logger.proto index 29387d1..25cb78a 100644 --- a/components/security_interstitials/content/cert_logger.proto +++ b/components/security_interstitials/content/cert_logger.proto
@@ -236,6 +236,15 @@ repeated MacCertEvidenceInfo status_chain = 3; } +message WinPlatformDebugInfo { + // The ThisUpdate of AuthRoot, as reflected in the registry, in usec since + // the Windows epoch. + optional int64 authroot_this_update_time_usec = 1; + + // The Sequence Number of AuthRoot, as reflected in the registry. + optional bytes authroot_sequence_number = 2; +} + // Contains the results of verification by the trial verifier. All fields // have the same meaning as those of the same name in CertLoggerRequest. message TrialVerificationInfo { @@ -310,4 +319,7 @@ // DER encoded SignedCertificateTimestampList from the TLS extension, if // present. optional bytes sct_list = 12; + + // Debug information from CertVerifyProcWin (if it was the primary verifier). + optional WinPlatformDebugInfo win_platform_debug_info = 14; }
diff --git a/components/security_interstitials/content/certificate_error_report.cc b/components/security_interstitials/content/certificate_error_report.cc index 5e42dd2..bb18f06e 100644 --- a/components/security_interstitials/content/certificate_error_report.cc +++ b/components/security_interstitials/content/certificate_error_report.cc
@@ -168,6 +168,25 @@ } } #endif // defined(OS_APPLE) + +#if defined(OS_WIN) +void AddWinPlatformDebugInfoToReport( + const cert_verifier::mojom::WinPlatformVerifierDebugInfoPtr& + win_platform_debug_info, + chrome_browser_ssl::TrialVerificationInfo* trial_report) { + if (!win_platform_debug_info) + return; + chrome_browser_ssl::WinPlatformDebugInfo* report_info = + trial_report->mutable_win_platform_debug_info(); + report_info->set_authroot_this_update_time_usec( + win_platform_debug_info->authroot_this_update.ToDeltaSinceWindowsEpoch() + .InMicroseconds()); + report_info->mutable_authroot_sequence_number()->assign( + std::begin(win_platform_debug_info->authroot_sequence_number), + std::end(win_platform_debug_info->authroot_sequence_number)); +} +#endif // defined(OS_WIN) + #endif // BUILDFLAG(TRIAL_COMPARISON_CERT_VERIFIER_SUPPORTED) bool CertificateChainToString(const net::X509Certificate& cert, @@ -246,6 +265,10 @@ trial_report->set_mac_trust_impl( TrustImplTypeFromMojom(debug_info->mac_trust_impl)); #endif +#if defined(OS_WIN) + AddWinPlatformDebugInfoToReport(debug_info->win_platform_debug_info, + trial_report); +#endif if (!debug_info->trial_verification_time.is_null()) { trial_report->set_trial_verification_time_usec( debug_info->trial_verification_time.ToDeltaSinceWindowsEpoch()
diff --git a/components/security_interstitials/content/certificate_error_report_unittest.cc b/components/security_interstitials/content/certificate_error_report_unittest.cc index d877802..026d369 100644 --- a/components/security_interstitials/content/certificate_error_report_unittest.cc +++ b/components/security_interstitials/content/certificate_error_report_unittest.cc
@@ -389,6 +389,15 @@ debug_info->mac_trust_impl = cert_verifier::mojom::CertVerifierDebugInfo::MacTrustImplType::kMruCache; #endif +#if defined(OS_WIN) + debug_info->win_platform_debug_info = + cert_verifier::mojom::WinPlatformVerifierDebugInfo::New(); + debug_info->win_platform_debug_info->authroot_this_update = + base::Time::FromDeltaSinceWindowsEpoch( + base::TimeDelta::FromMicroseconds(8675309)); + debug_info->win_platform_debug_info->authroot_sequence_number = { + 'J', 'E', 'N', 'N', 'Y'}; +#endif base::Time time = base::Time::Now(); debug_info->trial_verification_time = time; debug_info->trial_der_verification_time = "it's just a string"; @@ -453,9 +462,22 @@ EXPECT_EQ(chrome_browser_ssl::TrialVerificationInfo::MAC_TRUST_IMPL_MRU_CACHE, trial_info.mac_trust_impl()); #else + EXPECT_FALSE(trial_info.has_mac_platform_debug_info()); EXPECT_EQ(0, trial_info.mac_combined_trust_debug_info_size()); EXPECT_FALSE(trial_info.has_mac_trust_impl()); #endif + +#if defined(OS_WIN) + ASSERT_TRUE(trial_info.has_win_platform_debug_info()); + EXPECT_EQ( + 8675309, + trial_info.win_platform_debug_info().authroot_this_update_time_usec()); + EXPECT_EQ("JENNY", + trial_info.win_platform_debug_info().authroot_sequence_number()); +#else + EXPECT_FALSE(trial_info.has_win_platform_debug_info()); +#endif + ASSERT_TRUE(trial_info.has_trial_verification_time_usec()); EXPECT_EQ(time.ToDeltaSinceWindowsEpoch().InMicroseconds(), trial_info.trial_verification_time_usec());
diff --git a/components/variations/BUILD.gn b/components/variations/BUILD.gn index 3880eae..ee47994 100644 --- a/components/variations/BUILD.gn +++ b/components/variations/BUILD.gn
@@ -16,7 +16,7 @@ import("//build/config/android/rules.gni") } -large_variation_key_size_enabled = is_chromecast +large_variation_key_size_enabled = is_chromecast || is_chromeos_lacros buildflag_header("buildflags") { header = "buildflags.h"
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 49127b9a..92f015a 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -1456,8 +1456,6 @@ "renderer_host/input/mouse_wheel_event_queue.h", "renderer_host/input/mouse_wheel_phase_handler.cc", "renderer_host/input/mouse_wheel_phase_handler.h", - "renderer_host/input/one_shot_timeout_monitor.cc", - "renderer_host/input/one_shot_timeout_monitor.h", "renderer_host/input/passthrough_touch_event_queue.cc", "renderer_host/input/passthrough_touch_event_queue.h", "renderer_host/input/render_widget_host_latency_tracker.cc",
diff --git a/content/browser/attribution_reporting/conversion_registration_browsertest.cc b/content/browser/attribution_reporting/conversion_registration_browsertest.cc index 73af8cf..3ce641c 100644 --- a/content/browser/attribution_reporting/conversion_registration_browsertest.cc +++ b/content/browser/attribution_reporting/conversion_registration_browsertest.cc
@@ -86,7 +86,7 @@ void SetUpOnMainThread() override { host_resolver()->AddRule("*", "127.0.0.1"); embedded_test_server()->ServeFilesFromSourceDirectory( - "content/test/data/conversions"); + "content/test/data/attribution_reporting"); SetupCrossSiteRedirector(embedded_test_server()); ASSERT_TRUE(embedded_test_server()->Start()); @@ -95,7 +95,7 @@ https_server_->SetSSLConfig(net::EmbeddedTestServer::CERT_TEST_NAMES); net::test_server::RegisterDefaultHandlers(https_server_.get()); https_server_->ServeFilesFromSourceDirectory( - "content/test/data/conversions"); + "content/test/data/attribution_reporting"); SetupCrossSiteRedirector(https_server_.get()); ASSERT_TRUE(https_server_->Start()); }
diff --git a/content/browser/attribution_reporting/conversion_storage_sql_migrations.h b/content/browser/attribution_reporting/conversion_storage_sql_migrations.h index d54b36a..984f516 100644 --- a/content/browser/attribution_reporting/conversion_storage_sql_migrations.h +++ b/content/browser/attribution_reporting/conversion_storage_sql_migrations.h
@@ -35,7 +35,7 @@ // >> .dump // * Replace any rows with relevant test data needed for below. // * Add newlines between statements and place in -// `content/test/data/conversions/databases/`. +// `content/test/data/attribution_reporting/databases/`. // // Add a new test to `conversion_storage_sql_migration_unittest.cc` named // "MigrateVersionNToCurrent" where N is the previous database version. Update
diff --git a/content/browser/attribution_reporting/conversion_storage_sql_migrations_unittest.cc b/content/browser/attribution_reporting/conversion_storage_sql_migrations_unittest.cc index a4b03c3..2abce27 100644 --- a/content/browser/attribution_reporting/conversion_storage_sql_migrations_unittest.cc +++ b/content/browser/attribution_reporting/conversion_storage_sql_migrations_unittest.cc
@@ -67,14 +67,14 @@ protected: // The textual contents of |file| are read from - // "content/test/data/conversions/databases/" and returned in the string - // |contents|. Returns true if the file exists and is read successfully, false - // otherwise. + // "content/test/data/attribution_reporting/databases/" and returned in the + // string |contents|. Returns true if the file exists and is read + // successfully, false otherwise. bool GetDatabaseData(const base::FilePath& file, std::string* contents) { base::FilePath source_path; base::PathService::Get(base::DIR_SOURCE_ROOT, &source_path); - source_path = - source_path.AppendASCII("content/test/data/conversions/databases"); + source_path = source_path.AppendASCII( + "content/test/data/attribution_reporting/databases"); source_path = source_path.Append(file); return base::PathExists(source_path) && base::ReadFileToString(source_path, contents);
diff --git a/content/browser/attribution_reporting/conversions_browsertest.cc b/content/browser/attribution_reporting/conversions_browsertest.cc index a565b290..d6e600b 100644 --- a/content/browser/attribution_reporting/conversions_browsertest.cc +++ b/content/browser/attribution_reporting/conversions_browsertest.cc
@@ -140,13 +140,13 @@ ASSERT_TRUE(https_server()->Start()); GURL impression_url = https_server()->GetURL( - "a.test", "/conversions/page_with_impression_creator.html"); + "a.test", "/attribution_reporting/page_with_impression_creator.html"); EXPECT_TRUE(NavigateToURL(web_contents(), impression_url)); // Create an anchor tag with impression attributes and click the link. By // default the target is set to "_top". GURL conversion_url = https_server()->GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); EXPECT_TRUE( ExecJs(web_contents(), JsReplace(R"( @@ -178,13 +178,13 @@ ASSERT_TRUE(https_server()->Start()); GURL impression_url = https_server()->GetURL( - "a.test", "/conversions/page_with_impression_creator.html"); + "a.test", "/attribution_reporting/page_with_impression_creator.html"); EXPECT_TRUE(NavigateToURL(web_contents(), impression_url)); // Create an anchor tag with impression attributes and click the link. By // default the target is set to "_top". GURL conversion_url = https_server()->GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); TestNavigationObserver observer(web_contents()); EXPECT_TRUE( ExecJs(web_contents(), @@ -221,11 +221,11 @@ ASSERT_TRUE(https_server()->Start()); GURL impression_url = https_server()->GetURL( - "a.test", "/conversions/page_with_impression_creator.html"); + "a.test", "/attribution_reporting/page_with_impression_creator.html"); EXPECT_TRUE(NavigateToURL(web_contents(), impression_url)); GURL conversion_url = https_server()->GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); // We can't use `JsReplace` directly to input the origin as it will use string // literals which shouldn't be provided in the window features string. @@ -261,7 +261,7 @@ EXPECT_TRUE(NavigateToURL(web_contents(), page_url)); GURL subframe_url = https_server()->GetURL( - "c.test", "/conversions/page_with_impression_creator.html"); + "c.test", "/attribution_reporting/page_with_impression_creator.html"); EXPECT_TRUE(ExecJs(shell(), R"( let frame= document.getElementById('test_iframe'); frame.setAttribute('allow', 'attribution-reporting');)")); @@ -270,7 +270,7 @@ // Create an impression tag in the subframe and target a popup window. GURL conversion_url = https_server()->GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); EXPECT_TRUE(ExecJs(subframe, JsReplace(R"( createImpressionTag({id: 'link', url: $1, @@ -306,11 +306,11 @@ ASSERT_TRUE(https_server()->Start()); GURL impression_url = https_server()->GetURL( - "a.test", "/conversions/page_with_impression_creator.html"); + "a.test", "/attribution_reporting/page_with_impression_creator.html"); EXPECT_TRUE(NavigateToURL(web_contents(), impression_url)); GURL conversion_url = https_server()->GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); // target="_blank" navs are rel="noopener" by default. EXPECT_TRUE( @@ -346,15 +346,16 @@ ASSERT_TRUE(https_server()->Start()); GURL impression_url = https_server()->GetURL( - "a.test", "/conversions/page_with_impression_creator.html"); + "a.test", "/attribution_reporting/page_with_impression_creator.html"); EXPECT_TRUE(NavigateToURL(web_contents(), impression_url)); // Create an anchor tag with impression attributes and click the link. By // default the target is set to "_top". GURL conversion_url = https_server()->GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); GURL conversion_dest_url = https_server()->GetURL( - "sub.b.test", "/conversions/page_with_conversion_redirect.html"); + "sub.b.test", + "/attribution_reporting/page_with_conversion_redirect.html"); EXPECT_TRUE(ExecJs( web_contents(), JsReplace(R"( @@ -389,15 +390,16 @@ ASSERT_TRUE(https_server()->Start()); GURL impression_url = https_server()->GetURL( - "a.test", "/conversions/page_with_impression_creator.html"); + "a.test", "/attribution_reporting/page_with_impression_creator.html"); EXPECT_TRUE(NavigateToURL(web_contents(), impression_url)); // Create an anchor tag with impression attributes and click the link. By // default the target is set to "_top". GURL conversion_landing_url = https_server()->GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); GURL conversion_dest_url = https_server()->GetURL( - "sub.b.test", "/conversions/page_with_conversion_redirect.html"); + "sub.b.test", + "/attribution_reporting/page_with_conversion_redirect.html"); EXPECT_TRUE(ExecJs(web_contents(), JsReplace(R"( createImpressionTag({id: 'link', @@ -414,7 +416,8 @@ // Navigate to a same domain origin that is different than the landing page // for the click and convert there. A report should still be sent. GURL conversion_url = https_server()->GetURL( - "other.b.test", "/conversions/page_with_conversion_redirect.html"); + "other.b.test", + "/attribution_reporting/page_with_conversion_redirect.html"); EXPECT_TRUE(NavigateToURL(web_contents(), conversion_url)); // Register a conversion with the original page as the reporting origin. @@ -437,11 +440,11 @@ ASSERT_TRUE(https_server()->Start()); GURL first_impression_url = https_server()->GetURL( - "a.test", "/conversions/page_with_impression_creator.html"); + "a.test", "/attribution_reporting/page_with_impression_creator.html"); EXPECT_TRUE(NavigateToURL(web_contents(), first_impression_url)); GURL second_impression_url = https_server()->GetURL( - "c.test", "/conversions/page_with_impression_creator.html"); + "c.test", "/attribution_reporting/page_with_impression_creator.html"); Shell* shell2 = Shell::CreateNewWindow(shell()->web_contents()->GetBrowserContext(), GURL(), nullptr, gfx::Size(100, 100)); @@ -449,7 +452,7 @@ // Register impressions from both windows. GURL conversion_url = https_server()->GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); url::Origin reporting_origin = url::Origin::Create(https_server()->GetURL("d.test", "/")); std::string impression_js = R"( @@ -496,11 +499,11 @@ ASSERT_TRUE(https_server()->Start()); GURL first_impression_url = https_server()->GetURL( - "a.test", "/conversions/page_with_impression_creator.html"); + "a.test", "/attribution_reporting/page_with_impression_creator.html"); EXPECT_TRUE(NavigateToURL(web_contents(), first_impression_url)); GURL second_impression_url = https_server()->GetURL( - "c.test", "/conversions/page_with_impression_creator.html"); + "c.test", "/attribution_reporting/page_with_impression_creator.html"); Shell* shell2 = Shell::CreateNewWindow(shell()->web_contents()->GetBrowserContext(), GURL(), nullptr, gfx::Size(100, 100)); @@ -508,7 +511,7 @@ // Register impressions from both windows. GURL conversion_url = https_server()->GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); url::Origin reporting_origin = url::Origin::Create(https_server()->GetURL("d.test", "/")); std::string impression_js = R"( @@ -555,13 +558,13 @@ ASSERT_TRUE(https_server()->Start()); GURL impression_url = https_server()->GetURL( - "a.test", "/conversions/page_with_impression_creator.html"); + "a.test", "/attribution_reporting/page_with_impression_creator.html"); EXPECT_TRUE(NavigateToURL(web_contents(), impression_url)); // Create an anchor tag with impression attributes and click the link. By // default the target is set to "_top". GURL conversion_url = https_server()->GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); EXPECT_TRUE( ExecJs(web_contents(), JsReplace(R"( @@ -608,12 +611,12 @@ ASSERT_TRUE(https_server()->Start()); GURL impression_url = https_server()->GetURL( - "a.test", "/conversions/page_with_impression_creator.html"); + "a.test", "/attribution_reporting/page_with_impression_creator.html"); EXPECT_TRUE(NavigateToURL(web_contents(), impression_url)); // Create an anchor tag with impression attributes. GURL conversion_url = https_server()->GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); EXPECT_TRUE( ExecJs(web_contents(), JsReplace(R"( @@ -654,12 +657,12 @@ ASSERT_TRUE(https_server()->Start()); GURL impression_url = https_server()->GetURL( - "a.test", "/conversions/page_with_impression_creator.html"); + "a.test", "/attribution_reporting/page_with_impression_creator.html"); EXPECT_TRUE(NavigateToURL(web_contents(), impression_url)); // Create an anchor tag with impression attributes. GURL conversion_url = https_server()->GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); EXPECT_TRUE( ExecJs(web_contents(), JsReplace(R"( @@ -709,11 +712,11 @@ ASSERT_TRUE(https_server()->Start()); GURL impression_url = https_server()->GetURL( - "a.test", "/conversions/page_with_impression_creator.html"); + "a.test", "/attribution_reporting/page_with_impression_creator.html"); EXPECT_TRUE(NavigateToURL(web_contents(), impression_url)); GURL conversion_url = https_server()->GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); EXPECT_TRUE( ExecJs(web_contents(), JsReplace(R"( window.attributionReporting.registerAttributionSource({ @@ -753,13 +756,13 @@ ASSERT_TRUE(https_server()->Start()); GURL impression_url = https_server()->GetURL( - "a.test", "/conversions/page_with_impression_creator.html"); + "a.test", "/attribution_reporting/page_with_impression_creator.html"); EXPECT_TRUE(NavigateToURL(web_contents(), impression_url)); // Create an anchor tag with impression attributes and click the link. By // default the target is set to "_top". GURL conversion_url = https_server()->GetURL( - "b.test", "/conversions/page_with_conversion_redirect.html"); + "b.test", "/attribution_reporting/page_with_conversion_redirect.html"); EXPECT_TRUE( ExecJs(web_contents(), JsReplace(R"(
diff --git a/content/browser/attribution_reporting/conversions_origin_trial_browsertest.cc b/content/browser/attribution_reporting/conversions_origin_trial_browsertest.cc index d5d79b7..04b9938 100644 --- a/content/browser/attribution_reporting/conversions_origin_trial_browsertest.cc +++ b/content/browser/attribution_reporting/conversions_origin_trial_browsertest.cc
@@ -33,7 +33,7 @@ namespace content { namespace { -constexpr char kBaseDataDir[] = "content/test/data/conversions/"; +constexpr char kBaseDataDir[] = "content/test/data/attribution_reporting/"; } class ConversionsOriginTrialBrowserTest : public ContentBrowserTest {
diff --git a/content/browser/attribution_reporting/impression_declaration_browsertest.cc b/content/browser/attribution_reporting/impression_declaration_browsertest.cc index b66d62e..68e5034d4 100644 --- a/content/browser/attribution_reporting/impression_declaration_browsertest.cc +++ b/content/browser/attribution_reporting/impression_declaration_browsertest.cc
@@ -141,7 +141,7 @@ void SetUpOnMainThread() override { host_resolver()->AddRule("*", "127.0.0.1"); embedded_test_server()->ServeFilesFromSourceDirectory( - "content/test/data/conversions"); + "content/test/data/attribution_reporting"); embedded_test_server()->ServeFilesFromSourceDirectory("content/test/data"); content::SetupCrossSiteRedirector(embedded_test_server()); ASSERT_TRUE(embedded_test_server()->Start()); @@ -151,7 +151,7 @@ https_server_->SetSSLConfig(net::EmbeddedTestServer::CERT_TEST_NAMES); net::test_server::RegisterDefaultHandlers(https_server_.get()); https_server_->ServeFilesFromSourceDirectory( - "content/test/data/conversions"); + "content/test/data/attribution_reporting"); https_server_->ServeFilesFromSourceDirectory("content/test/data"); SetupCrossSiteRedirector(https_server_.get()); ASSERT_TRUE(https_server_->Start());
diff --git a/content/browser/devtools/devtools_conversion_browsertest.cc b/content/browser/devtools/devtools_conversion_browsertest.cc index c3d774e..16c8b89 100644 --- a/content/browser/devtools/devtools_conversion_browsertest.cc +++ b/content/browser/devtools/devtools_conversion_browsertest.cc
@@ -33,7 +33,7 @@ void SetUpOnMainThread() override { host_resolver()->AddRule("*", "127.0.0.1"); embedded_test_server()->ServeFilesFromSourceDirectory( - "content/test/data/conversions"); + "content/test/data/attribution_reporting"); SetupCrossSiteRedirector(embedded_test_server()); ASSERT_TRUE(embedded_test_server()->Start()); @@ -42,7 +42,7 @@ https_server_->SetSSLConfig(net::EmbeddedTestServer::CERT_TEST_NAMES); net::test_server::RegisterDefaultHandlers(https_server_.get()); https_server_->ServeFilesFromSourceDirectory( - "content/test/data/conversions"); + "content/test/data/attribution_reporting"); SetupCrossSiteRedirector(https_server_.get()); ASSERT_TRUE(https_server_->Start()); }
diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index b23a020..4d6b221a 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc
@@ -1192,18 +1192,17 @@ referrer.To<content::Referrer>()); } for (auto& subframe : subframes) { - RenderFrameHostImpl* rfh_subframe = sender->FindAndVerifyChild( + FrameTreeNode* subframe_ftn = sender->FindAndVerifyChild( subframe->subframe_token, bad_message::DWNLD_INVALID_SAVABLE_RESOURCE_LINKS_RESPONSE); - if (!rfh_subframe) { + if (!subframe_ftn) { // crbug.com/541354 - Raciness when saving a dynamically changing page. continue; } EnqueueFrame(container_frame_tree_node_id, - rfh_subframe->frame_tree_node()->frame_tree_node_id(), - subframe->original_url); + subframe_ftn->frame_tree_node_id(), subframe->original_url); } CompleteSavableResourceLinksResponse();
diff --git a/content/browser/form_controls_browsertest.cc b/content/browser/form_controls_browsertest.cc index 0ced5dc5..32c5fda4 100644 --- a/content/browser/form_controls_browsertest.cc +++ b/content/browser/form_controls_browsertest.cc
@@ -70,6 +70,8 @@ platform_suffix = "_mac"; #elif defined(OS_WIN) platform_suffix = "_win"; +#elif defined(OS_LINUX) + platform_suffix = "_linux"; #elif BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) platform_suffix = "_chromeos"; #elif defined(OS_ANDROID) @@ -109,7 +111,7 @@ /* avg_abs_error_limit */ 20.f, /* max_abs_error_limit */ 120.f, /* small_error_threshold */ 0); -#elif defined(OS_ANDROID) || defined(OS_WIN) +#elif defined(OS_ANDROID) || defined(OS_WIN) || (OS_LINUX) // Different versions of android may have slight differences in rendering. // Some versions have more significant differences than others, which are // tracked separately in separate baseline image files. The less significant
diff --git a/content/browser/media/session/audio_focus_delegate_android_browsertest.cc b/content/browser/media/session/audio_focus_delegate_android_browsertest.cc index 6981055..e2619b8e 100644 --- a/content/browser/media/session/audio_focus_delegate_android_browsertest.cc +++ b/content/browser/media/session/audio_focus_delegate_android_browsertest.cc
@@ -35,7 +35,7 @@ IN_PROC_BROWSER_TEST_F(AudioFocusDelegateAndroidBrowserTest, MAYBE_OnAudioFocusChangeAfterDtorCrash) { std::unique_ptr<MockMediaSessionPlayerObserver> player_observer( - new MockMediaSessionPlayerObserver); + new MockMediaSessionPlayerObserver(media::MediaContentType::Persistent)); MediaSessionImpl* media_session = MediaSessionImpl::Get(shell()->web_contents()); @@ -47,14 +47,12 @@ ASSERT_TRUE(other_media_session); player_observer->StartNewPlayer(); - media_session->AddPlayer(player_observer.get(), 0, - media::MediaContentType::Persistent); + media_session->AddPlayer(player_observer.get(), 0); EXPECT_TRUE(media_session->IsActive()); EXPECT_FALSE(other_media_session->IsActive()); player_observer->StartNewPlayer(); - other_media_session->AddPlayer(player_observer.get(), 1, - media::MediaContentType::Persistent); + other_media_session->AddPlayer(player_observer.get(), 1); EXPECT_TRUE(media_session->IsActive()); EXPECT_TRUE(other_media_session->IsActive());
diff --git a/content/browser/media/session/audio_focus_delegate_default_browsertest.cc b/content/browser/media/session/audio_focus_delegate_default_browsertest.cc index 60aba4c..2e9e63c1 100644 --- a/content/browser/media/session/audio_focus_delegate_default_browsertest.cc +++ b/content/browser/media/session/audio_focus_delegate_default_browsertest.cc
@@ -61,8 +61,9 @@ void Run(WebContents* start_contents, WebContents* interrupt_contents, bool use_separate_group_id) { - std::unique_ptr<MockMediaSessionPlayerObserver> - player_observer(new MockMediaSessionPlayerObserver); + std::unique_ptr<MockMediaSessionPlayerObserver> player_observer( + new MockMediaSessionPlayerObserver( + nullptr, media::MediaContentType::Persistent)); MediaSessionImpl* media_session = MediaSessionImpl::Get(start_contents); EXPECT_TRUE(media_session); @@ -79,8 +80,7 @@ { std::unique_ptr<TestAudioFocusObserver> observer = CreateObserver(); - media_session->AddPlayer(player_observer.get(), 0, - media::MediaContentType::Persistent); + media_session->AddPlayer(player_observer.get(), 0); observer->WaitForGainedEvent(); } @@ -104,8 +104,7 @@ { std::unique_ptr<TestAudioFocusObserver> observer = CreateObserver(); - other_media_session->AddPlayer(player_observer.get(), 1, - media::MediaContentType::Persistent); + other_media_session->AddPlayer(player_observer.get(), 1); observer->WaitForGainedEvent(); }
diff --git a/content/browser/media/session/media_session_controller.cc b/content/browser/media/session/media_session_controller.cc index 5ece795..a8da553 100644 --- a/content/browser/media/session/media_session_controller.cc +++ b/content/browser/media/session/media_session_controller.cc
@@ -233,7 +233,7 @@ // Attempt to add a session even if we already have one. MediaSession // expects AddPlayer() to be called after OnPlaybackPaused() to reactivate // the session. - if (!media_session_->AddPlayer(this, player_id_, media_content_type_)) { + if (!media_session_->AddPlayer(this, player_id_)) { // If a session can't be created, force a pause immediately. OnSuspend(player_id_); return false; @@ -272,4 +272,8 @@ return supports_audio_output_device_switching_; } +media::MediaContentType MediaSessionController::GetMediaContentType() const { + return media_content_type_; +} + } // namespace content
diff --git a/content/browser/media/session/media_session_controller.h b/content/browser/media/session/media_session_controller.h index 5b93bd56..ab2175e 100644 --- a/content/browser/media/session/media_session_controller.h +++ b/content/browser/media/session/media_session_controller.h
@@ -73,6 +73,8 @@ bool HasVideo(int player_id) const override; std::string GetAudioOutputSinkId(int player_id) const override; bool SupportsAudioOutputDeviceSwitching(int player_id) const override; + media::MediaContentType GetMediaContentType() const override; + // Test helpers. int get_player_id_for_testing() const { return player_id_; }
diff --git a/content/browser/media/session/media_session_impl.cc b/content/browser/media/session/media_session_impl.cc index 36c44be..b1f497e 100644 --- a/content/browser/media/session/media_session_impl.cc +++ b/content/browser/media/session/media_session_impl.cc
@@ -14,7 +14,6 @@ #include "base/ranges/algorithm.h" #include "base/strings/string_util.h" #include "base/timer/timer.h" -#include "build/build_config.h" #include "components/url_formatter/url_formatter.h" #include "content/browser/media/session/audio_focus_delegate.h" #include "content/browser/media/session/media_session_controller.h" @@ -387,8 +386,9 @@ } bool MediaSessionImpl::AddPlayer(MediaSessionPlayerObserver* observer, - int player_id, - media::MediaContentType media_content_type) { + int player_id) { + media::MediaContentType media_content_type = observer->GetMediaContentType(); + if (media_content_type == media::MediaContentType::OneShot) return AddOneShotPlayer(observer, player_id); if (media_content_type == media::MediaContentType::Pepper)
diff --git a/content/browser/media/session/media_session_impl.h b/content/browser/media/session/media_session_impl.h index a3204341..731d8ad 100644 --- a/content/browser/media/session/media_session_impl.h +++ b/content/browser/media/session/media_session_impl.h
@@ -16,6 +16,7 @@ #include "base/containers/id_map.h" #include "base/macros.h" #include "base/timer/timer.h" +#include "build/build_config.h" #include "content/browser/media/session/audio_focus_delegate.h" #include "content/browser/media/session/media_session_uma_helper.h" #include "content/common/content_export.h" @@ -33,10 +34,6 @@ #include "base/android/scoped_java_ref.h" #endif // defined(OS_ANDROID) -namespace media { -enum class MediaContentType; -} // namespace media - namespace media_session { struct MediaMetadata; } // namespace media_session @@ -100,8 +97,7 @@ // player was successfully added. If it returns false, AddPlayer() should be // called again later. CONTENT_EXPORT bool AddPlayer(MediaSessionPlayerObserver* observer, - int player_id, - media::MediaContentType media_content_type); + int player_id); // Removes the given player from the current media session. Abandons audio // focus if that was the last player in the session.
diff --git a/content/browser/media/session/media_session_impl_browsertest.cc b/content/browser/media/session/media_session_impl_browsertest.cc index 20bc360..0a2fea2 100644 --- a/content/browser/media/session/media_session_impl_browsertest.cc +++ b/content/browser/media/session/media_session_impl_browsertest.cc
@@ -161,19 +161,17 @@ ContentBrowserTest::TearDownOnMainThread(); } - void StartNewPlayer(MockMediaSessionPlayerObserver* player_observer, - media::MediaContentType media_content_type) { + void StartNewPlayer(MockMediaSessionPlayerObserver* player_observer) { int player_id = player_observer->StartNewPlayer(); - bool result = AddPlayer(player_observer, player_id, media_content_type); + bool result = AddPlayer(player_observer, player_id); EXPECT_TRUE(result); } bool AddPlayer(MockMediaSessionPlayerObserver* player_observer, - int player_id, - media::MediaContentType type) { - return media_session_->AddPlayer(player_observer, player_id, type); + int player_id) { + return media_session_->AddPlayer(player_observer, player_id); } void RemovePlayer(MockMediaSessionPlayerObserver* player_observer, @@ -349,11 +347,12 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, PlayersFromSameObserverDoNotStopEachOtherInSameSession) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); EXPECT_TRUE(player_observer->IsPlaying(0)); @@ -363,13 +362,16 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, PlayersFromManyObserverDoNotStopEachOtherInSameSession) { - auto player_observer_1 = std::make_unique<MockMediaSessionPlayerObserver>(); - auto player_observer_2 = std::make_unique<MockMediaSessionPlayerObserver>(); - auto player_observer_3 = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer_1 = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); + auto player_observer_2 = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); + auto player_observer_3 = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer_1.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer_2.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer_3.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer_1.get()); + StartNewPlayer(player_observer_2.get()); + StartNewPlayer(player_observer_3.get()); ResolveAudioFocusSuccess(); EXPECT_TRUE(player_observer_1->IsPlaying(0)); @@ -379,11 +381,12 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, SuspendedMediaSessionStopsPlayers) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); SystemSuspend(true); @@ -395,11 +398,12 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ResumedMediaSessionRestartsPlayers) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); SystemSuspend(true); @@ -412,9 +416,10 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, StartedPlayerOnSuspendedSessionPlaysAlone) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); EXPECT_TRUE(player_observer->IsPlaying(0)); @@ -423,13 +428,13 @@ EXPECT_FALSE(player_observer->IsPlaying(0)); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); EXPECT_FALSE(player_observer->IsPlaying(0)); EXPECT_TRUE(player_observer->IsPlaying(1)); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_FALSE(player_observer->IsPlaying(0)); EXPECT_TRUE(player_observer->IsPlaying(1)); @@ -438,10 +443,11 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, InitialVolumeMultiplier) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); EXPECT_EQ(kDefaultVolumeMultiplier, player_observer->GetVolumeMultiplier(0)); EXPECT_EQ(kDefaultVolumeMultiplier, player_observer->GetVolumeMultiplier(1)); @@ -454,43 +460,46 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, StartDuckingReducesVolumeMultiplier) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); SystemStartDucking(); EXPECT_EQ(kDuckingVolumeMultiplier, player_observer->GetVolumeMultiplier(0)); EXPECT_EQ(kDuckingVolumeMultiplier, player_observer->GetVolumeMultiplier(1)); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_EQ(kDuckingVolumeMultiplier, player_observer->GetVolumeMultiplier(2)); } IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, StopDuckingRecoversVolumeMultiplier) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); SystemStartDucking(); SystemStopDucking(); EXPECT_EQ(kDefaultVolumeMultiplier, player_observer->GetVolumeMultiplier(0)); EXPECT_EQ(kDefaultVolumeMultiplier, player_observer->GetVolumeMultiplier(1)); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_EQ(kDefaultVolumeMultiplier, player_observer->GetVolumeMultiplier(2)); } IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, DuckingUsesConfiguredMultiplier) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); media_session_->SetDuckingVolumeMultiplier(kDifferentDuckingVolumeMultiplier); SystemStartDucking(); EXPECT_EQ(kDifferentDuckingVolumeMultiplier, @@ -509,8 +518,9 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, AddPlayerOnSuspendedFocusUnducks) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); UISuspend(); @@ -519,15 +529,15 @@ SystemStartDucking(); EXPECT_EQ(kDuckingVolumeMultiplier, player_observer->GetVolumeMultiplier(0)); - EXPECT_TRUE( - AddPlayer(player_observer.get(), 0, media::MediaContentType::Persistent)); + EXPECT_TRUE(AddPlayer(player_observer.get(), 0)); ResolveAudioFocusSuccess(); EXPECT_EQ(kDefaultVolumeMultiplier, player_observer->GetVolumeMultiplier(0)); } IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, CanRequestFocusBeforePlayerCreation) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); media_session_->RequestSystemAudioFocus(AudioFocusType::kGain); EXPECT_TRUE(IsActive()); @@ -535,15 +545,16 @@ ResolveAudioFocusSuccess(); EXPECT_TRUE(IsActive()); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_TRUE(IsActive()); } IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, StartPlayerGivesFocus) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_TRUE(IsActive()); ResolveAudioFocusSuccess(); @@ -552,9 +563,10 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, SuspendGivesAwayAudioFocus) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); SystemSuspend(true); @@ -564,9 +576,10 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, StopGivesAwayAudioFocus) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); media_session_->Stop(MediaSession::SuspendType::kUI); @@ -576,9 +589,10 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, SystemResumeGivesBackAudioFocus) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); SystemSuspend(true); @@ -589,9 +603,10 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, UIResumeGivesBackAudioFocus) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); UISuspend(); @@ -605,11 +620,12 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, RemovingLastPlayerDropsAudioFocus) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); RemovePlayer(player_observer.get(), 0); @@ -622,13 +638,16 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, RemovingLastPlayerFromManyObserversDropsAudioFocus) { - auto player_observer_1 = std::make_unique<MockMediaSessionPlayerObserver>(); - auto player_observer_2 = std::make_unique<MockMediaSessionPlayerObserver>(); - auto player_observer_3 = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer_1 = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); + auto player_observer_2 = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); + auto player_observer_3 = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer_1.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer_2.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer_3.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer_1.get()); + StartNewPlayer(player_observer_2.get()); + StartNewPlayer(player_observer_3.get()); ResolveAudioFocusSuccess(); RemovePlayer(player_observer_1.get(), 0); @@ -641,13 +660,15 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, RemovingAllPlayersFromObserversDropsAudioFocus) { - auto player_observer_1 = std::make_unique<MockMediaSessionPlayerObserver>(); - auto player_observer_2 = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer_1 = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); + auto player_observer_2 = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer_1.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer_1.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer_2.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer_2.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer_1.get()); + StartNewPlayer(player_observer_1.get()); + StartNewPlayer(player_observer_2.get()); + StartNewPlayer(player_observer_2.get()); ResolveAudioFocusSuccess(); RemovePlayers(player_observer_1.get()); @@ -658,30 +679,31 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ResumePlayGivesAudioFocus) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); RemovePlayer(player_observer.get(), 0); EXPECT_FALSE(IsActive()); - EXPECT_TRUE( - AddPlayer(player_observer.get(), 0, media::MediaContentType::Persistent)); + EXPECT_TRUE(AddPlayer(player_observer.get(), 0)); ResolveAudioFocusSuccess(); EXPECT_TRUE(IsActive()); } IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ResumeSuspendSeekAreSentOnlyOncePerPlayers) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); EXPECT_EQ(0, player_observer->received_suspend_calls()); EXPECT_EQ(0, player_observer->received_resume_calls()); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); EXPECT_EQ(0, player_observer->received_suspend_calls()); EXPECT_EQ(0, player_observer->received_resume_calls()); @@ -715,14 +737,15 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ResumeSuspendSeekAreSentOnlyOncePerPlayersAddedTwice) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); EXPECT_EQ(0, player_observer->received_suspend_calls()); EXPECT_EQ(0, player_observer->received_resume_calls()); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); EXPECT_EQ(0, player_observer->received_suspend_calls()); EXPECT_EQ(0, player_observer->received_resume_calls()); @@ -730,12 +753,9 @@ ResolveAudioFocusSuccess(); // Adding the three players above again. - EXPECT_TRUE( - AddPlayer(player_observer.get(), 0, media::MediaContentType::Persistent)); - EXPECT_TRUE( - AddPlayer(player_observer.get(), 1, media::MediaContentType::Persistent)); - EXPECT_TRUE( - AddPlayer(player_observer.get(), 2, media::MediaContentType::Persistent)); + EXPECT_TRUE(AddPlayer(player_observer.get(), 0)); + EXPECT_TRUE(AddPlayer(player_observer.get(), 1)); + EXPECT_TRUE(AddPlayer(player_observer.get(), 2)); EXPECT_EQ(0, player_observer->received_suspend_calls()); EXPECT_EQ(0, player_observer->received_resume_calls()); @@ -764,9 +784,10 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, RemovingTheSamePlayerTwiceIsANoop) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); RemovePlayer(player_observer.get(), 0); @@ -774,25 +795,28 @@ } IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, AudioFocusType) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Transient); // Starting a player with a given type should set the session to that type. - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); EXPECT_EQ(AudioFocusType::kGainTransientMayDuck, GetSessionAudioFocusType()); // Adding a player of the same type should have no effect on the type. - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); EXPECT_FALSE(HasUnresolvedAudioFocusRequest()); EXPECT_EQ(AudioFocusType::kGainTransientMayDuck, GetSessionAudioFocusType()); // Adding a player of Content type should override the current type. - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + player_observer->SetMediaContentType(media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); EXPECT_EQ(AudioFocusType::kGain, GetSessionAudioFocusType()); // Adding a player of the Transient type should have no effect on the type. - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + player_observer->SetMediaContentType(media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); EXPECT_FALSE(HasUnresolvedAudioFocusRequest()); EXPECT_EQ(AudioFocusType::kGain, GetSessionAudioFocusType()); @@ -822,13 +846,14 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsShowForContent) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); // Starting a player with a persistent type should show the media controls. - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -841,14 +866,15 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsNoShowForTransient) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Transient); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); // Starting a player with a transient type should not show the media // controls. - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -866,13 +892,14 @@ ControlsNoShowForTransientAndRoutedService) { EnsureMediaSessionService(); auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( - shell()->web_contents()->GetMainFrame()); + shell()->web_contents()->GetMainFrame(), + media::MediaContentType::Transient); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); // Starting a player with a transient type should show the media controls. - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -887,14 +914,15 @@ ControlsNoShowForTransientAndPlaybackStateNone) { EnsureMediaSessionService(); auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( - shell()->web_contents()->GetMainFrame()); + shell()->web_contents()->GetMainFrame(), + media::MediaContentType::Transient); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); // Starting a player with a transient type should not show the media // controls. - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); SetPlaybackState(blink::mojom::MediaSessionPlaybackState::NONE); @@ -911,14 +939,15 @@ ControlsShowForTransientAndPlaybackStatePaused) { EnsureMediaSessionService(); auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( - shell()->web_contents()->GetMainFrame()); + shell()->web_contents()->GetMainFrame(), + media::MediaContentType::Transient); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); // Starting a player with a transient type should show the media controls if // we have a playback state from the service. - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); SetPlaybackState(blink::mojom::MediaSessionPlaybackState::PAUSED); @@ -935,14 +964,15 @@ ControlsShowForTransientAndPlaybackStatePlaying) { EnsureMediaSessionService(); auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( - shell()->web_contents()->GetMainFrame()); + shell()->web_contents()->GetMainFrame(), + media::MediaContentType::Transient); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); // Starting a player with a transient type should show the media controls if // we have a playback state from the service. - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); SetPlaybackState(blink::mojom::MediaSessionPlaybackState::PLAYING); @@ -959,12 +989,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsHideWhenStopped) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -992,12 +1023,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsShownAcceptTransient) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1008,7 +1040,8 @@ } // Transient player join the session without affecting the controls. - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + player_observer->SetMediaContentType(media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); @@ -1026,12 +1059,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsShownAfterContentAdded) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Transient); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1042,7 +1076,8 @@ } // The controls are shown when the content player is added. - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + player_observer->SetMediaContentType(media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); { @@ -1061,12 +1096,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsStayIfOnlyOnePlayerHasBeenPaused) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1076,7 +1112,8 @@ observer.session_info()->playback_state); } - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + player_observer->SetMediaContentType(media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); @@ -1108,13 +1145,14 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsHideWhenTheLastPlayerIsRemoved) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1146,13 +1184,14 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsHideWhenAllThePlayersAreRemoved) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1173,13 +1212,14 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsNotHideWhenTheLastPlayerIsPaused) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1220,12 +1260,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, SuspendTemporaryUpdatesControls) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1252,12 +1293,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsUpdatedWhenResumed) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1286,12 +1328,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsHideWhenSessionSuspendedPermanently) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1318,12 +1361,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsHideWhenSessionStops) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1351,12 +1395,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsHideWhenSessionChangesFromContentToTransient) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1382,7 +1427,8 @@ // This should reset the session and change it to a transient, so // hide the controls. - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + player_observer->SetMediaContentType(media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1398,12 +1444,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsUpdatedWhenNewPlayerResetsSession) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1428,7 +1475,7 @@ media_session::test::MockMediaSessionMojoObserver observer(*media_session_); // This should reset the session and update the controls. - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1444,12 +1491,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsResumedWhenPlayerIsResumed) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1474,7 +1522,7 @@ media_session::test::MockMediaSessionMojoObserver observer(*media_session_); // This should resume the session and update the controls. - AddPlayer(player_observer.get(), 0, media::MediaContentType::Persistent); + AddPlayer(player_observer.get(), 0); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1490,12 +1538,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsUpdatedDueToResumeSessionAction) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1522,12 +1571,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsUpdatedDueToSuspendSessionAction) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1579,12 +1629,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsDontShowWhenOnlyOneShotIsPresent) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::OneShot); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::OneShot); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1597,7 +1648,8 @@ { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + player_observer->SetMediaContentType(media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); observer.WaitForState(MediaSessionInfo::SessionState::kActive); observer.WaitForControllable(true); @@ -1609,7 +1661,8 @@ { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + player_observer->SetMediaContentType(media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); observer.WaitForState(MediaSessionInfo::SessionState::kActive); observer.WaitForControllable(true); @@ -1621,12 +1674,13 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsHiddenAfterRemoveOneShotWithoutOtherPlayers) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::OneShot); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::OneShot); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1647,14 +1701,17 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ControlsShowAfterRemoveOneShotWithPersistentPresent) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::OneShot); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::OneShot); - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + player_observer->SetMediaContentType(media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); + player_observer->SetMediaContentType(media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1675,9 +1732,10 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, DontSuspendWhenOnlyOneShotIsPresent) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::OneShot); - StartNewPlayer(player_observer.get(), media::MediaContentType::OneShot); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); SystemSuspend(false); @@ -1690,11 +1748,14 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, SuspendWhenOneShotAndNormalArePresent) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::OneShot); - StartNewPlayer(player_observer.get(), media::MediaContentType::OneShot); - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + player_observer->SetMediaContentType(media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); + player_observer->SetMediaContentType(media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); SystemSuspend(false); @@ -1707,9 +1768,10 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, DontResumeBySystemUISuspendedSessions) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); UISuspend(); @@ -1723,9 +1785,10 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, AllowUIResumeForSystemSuspend) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); SystemSuspend(true); @@ -1740,9 +1803,10 @@ } IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ResumeSuspendFromUI) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); UISuspend(); @@ -1759,9 +1823,10 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, ResumeSuspendFromSystem) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); SystemSuspend(true); @@ -1776,15 +1841,18 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, OneShotTakesGainFocus) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::OneShot); - StartNewPlayer(player_observer.get(), media::MediaContentType::OneShot); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + player_observer->SetMediaContentType(media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); EXPECT_FALSE(HasUnresolvedAudioFocusRequest()); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + player_observer->SetMediaContentType(media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_FALSE(HasUnresolvedAudioFocusRequest()); EXPECT_EQ(AudioFocusType::kGain, @@ -1793,10 +1861,11 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, RemovingOneShotDropsFocus) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::OneShot); EXPECT_CALL(*mock_audio_focus_delegate(), AbandonAudioFocus()); - StartNewPlayer(player_observer.get(), media::MediaContentType::OneShot); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); RemovePlayer(player_observer.get(), 0); @@ -1804,14 +1873,16 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, RemovingOneShotWhileStillHavingOtherPlayersKeepsFocus) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::OneShot); EXPECT_CALL(*mock_audio_focus_delegate(), AbandonAudioFocus()) .Times(1); // Called in TearDown - StartNewPlayer(player_observer.get(), media::MediaContentType::OneShot); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + player_observer->SetMediaContentType(media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_FALSE(HasUnresolvedAudioFocusRequest()); RemovePlayer(player_observer.get(), 0); @@ -1821,12 +1892,13 @@ ActualPlaybackStateWhilePlayerPaused) { EnsureMediaSessionService(); auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( - shell()->web_contents()->GetMainFrame()); + shell()->web_contents()->GetMainFrame(), + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1875,12 +1947,13 @@ ActualPlaybackStateWhilePlayerPlaying) { EnsureMediaSessionService(); auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( - shell()->web_contents()->GetMainFrame()); + shell()->web_contents()->GetMainFrame(), + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1920,12 +1993,13 @@ ActualPlaybackStateWhilePlayerRemoved) { EnsureMediaSessionService(); auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( - shell()->web_contents()->GetMainFrame()); + shell()->web_contents()->GetMainFrame(), + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForState(MediaSessionInfo::SessionState::kActive); @@ -1972,10 +2046,11 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, UMA_Suspended_SystemTransient) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); base::HistogramTester tester; - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); SystemSuspend(true); @@ -1989,10 +2064,11 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, UMA_Suspended_SystemPermantent) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); base::HistogramTester tester; - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); SystemSuspend(false); @@ -2005,11 +2081,12 @@ } IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, UMA_Suspended_UI) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); base::HistogramTester tester; - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); UISuspend(); @@ -2023,10 +2100,11 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, UMA_Suspended_Multiple) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); base::HistogramTester tester; - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); UISuspend(); @@ -2052,10 +2130,11 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, UMA_Suspended_Crossing) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); base::HistogramTester tester; - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); UISuspend(); @@ -2078,10 +2157,11 @@ } IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, UMA_Suspended_Stop) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); base::HistogramTester tester; - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); media_session_->Stop(MediaSession::SuspendType::kUI); @@ -2108,7 +2188,8 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, UMA_ActiveTime_SimpleActivation) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); base::HistogramTester tester; MediaSessionUmaHelper* media_session_uma_helper = GetMediaSessionUMAHelper(); @@ -2116,7 +2197,7 @@ clock.SetNowTicks(base::TimeTicks::Now()); media_session_uma_helper->SetClockForTest(&clock); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); clock.Advance(base::TimeDelta::FromMilliseconds(1000)); @@ -2130,7 +2211,8 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, UMA_ActiveTime_ActivationWithUISuspension) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); base::HistogramTester tester; MediaSessionUmaHelper* media_session_uma_helper = GetMediaSessionUMAHelper(); @@ -2138,7 +2220,7 @@ clock.SetNowTicks(base::TimeTicks::Now()); media_session_uma_helper->SetClockForTest(&clock); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); clock.Advance(base::TimeDelta::FromMilliseconds(1000)); @@ -2159,7 +2241,8 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, UMA_ActiveTime_ActivationWithSystemSuspension) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); base::HistogramTester tester; MediaSessionUmaHelper* media_session_uma_helper = GetMediaSessionUMAHelper(); @@ -2167,7 +2250,7 @@ clock.SetNowTicks(base::TimeTicks::Now()); media_session_uma_helper->SetClockForTest(&clock); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); clock.Advance(base::TimeDelta::FromMilliseconds(1000)); @@ -2187,7 +2270,8 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, UMA_ActiveTime_ActivateSuspendedButNotStopped) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); base::HistogramTester tester; MediaSessionUmaHelper* media_session_uma_helper = GetMediaSessionUMAHelper(); @@ -2195,7 +2279,7 @@ clock.SetNowTicks(base::TimeTicks::Now()); media_session_uma_helper->SetClockForTest(&clock); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); clock.Advance(base::TimeDelta::FromMilliseconds(500)); SystemSuspend(true); @@ -2219,7 +2303,8 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, UMA_ActiveTime_ActivateSuspendStopTwice) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); base::HistogramTester tester; MediaSessionUmaHelper* media_session_uma_helper = GetMediaSessionUMAHelper(); @@ -2227,13 +2312,13 @@ clock.SetNowTicks(base::TimeTicks::Now()); media_session_uma_helper->SetClockForTest(&clock); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); clock.Advance(base::TimeDelta::FromMilliseconds(500)); SystemSuspend(true); media_session_->Stop(MediaSession::SuspendType::kUI); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); clock.Advance(base::TimeDelta::FromMilliseconds(5000)); SystemResume(); @@ -2248,7 +2333,8 @@ IN_PROC_BROWSER_TEST_P(MediaSessionImplParamBrowserTest, UMA_ActiveTime_MultipleActivations) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); base::HistogramTester tester; MediaSessionUmaHelper* media_session_uma_helper = GetMediaSessionUMAHelper(); @@ -2256,12 +2342,12 @@ clock.SetNowTicks(base::TimeTicks::Now()); media_session_uma_helper->SetClockForTest(&clock); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); clock.Advance(base::TimeDelta::FromMilliseconds(10000)); RemovePlayer(player_observer.get(), 0); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); clock.Advance(base::TimeDelta::FromMilliseconds(1000)); media_session_->Stop(MediaSession::SuspendType::kUI); @@ -2303,11 +2389,12 @@ // Make sure the service is routed, auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( - shell()->web_contents()->GetMainFrame()); + shell()->web_contents()->GetMainFrame(), + media::MediaContentType::Persistent); { media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); observer.WaitForExpectedMetadata(expected_metadata); @@ -2318,20 +2405,22 @@ PepperPlayerNotAddedIfFocusFailed) { SetSyncAudioFocusResult(AudioFocusDelegate::AudioFocusResult::kFailed); - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Pepper); int player_id = player_observer->StartNewPlayer(); - EXPECT_FALSE(AddPlayer(player_observer.get(), player_id, - media::MediaContentType::Pepper)); + EXPECT_FALSE(AddPlayer(player_observer.get(), player_id)); EXPECT_FALSE(media_session_->HasPepper()); } IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest, Async_RequestFailure_Gain) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); + player_observer->SetMediaContentType(media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); EXPECT_TRUE(player_observer->IsPlaying(0)); EXPECT_TRUE(player_observer->IsPlaying(1)); @@ -2351,10 +2440,12 @@ IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest, Async_RequestFailure_GainTransient) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); + player_observer->SetMediaContentType(media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); EXPECT_TRUE(player_observer->IsPlaying(0)); EXPECT_TRUE(player_observer->IsPlaying(1)); @@ -2373,10 +2464,12 @@ } IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest, Async_GainThenTransient) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); + player_observer->SetMediaContentType(media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); EXPECT_TRUE(player_observer->IsPlaying(0)); EXPECT_TRUE(player_observer->IsPlaying(1)); @@ -2391,10 +2484,12 @@ } IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest, Async_TransientThenGain) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Transient); - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); + player_observer->SetMediaContentType(media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_TRUE(player_observer->IsPlaying(0)); EXPECT_TRUE(player_observer->IsPlaying(1)); @@ -2410,9 +2505,10 @@ IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest, Async_SuspendBeforeResolve) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_TRUE(player_observer->IsPlaying(0)); SystemSuspend(true); @@ -2429,9 +2525,10 @@ } IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest, Async_ResumeBeforeResolve) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_TRUE(IsActive()); EXPECT_TRUE(player_observer->IsPlaying(0)); @@ -2454,10 +2551,11 @@ IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest, Async_RemoveBeforeResolve) { { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); EXPECT_CALL(*mock_audio_focus_delegate(), AbandonAudioFocus()); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_TRUE(player_observer->IsPlaying(0)); RemovePlayer(player_observer.get(), 0); @@ -2467,13 +2565,15 @@ } IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest, Async_StopBeforeResolve) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Transient); - StartNewPlayer(player_observer.get(), media::MediaContentType::Transient); + StartNewPlayer(player_observer.get()); ResolveAudioFocusSuccess(); EXPECT_TRUE(player_observer->IsPlaying(0)); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + player_observer->SetMediaContentType(media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_TRUE(player_observer->IsPlaying(1)); media_session_->Stop(MediaSession::SuspendType::kUI); @@ -2484,9 +2584,10 @@ } IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest, Async_Unducking_Failure) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_TRUE(IsActive()); EXPECT_TRUE(player_observer->IsPlaying(0)); @@ -2498,9 +2599,10 @@ } IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest, Async_Unducking_Inactive) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_TRUE(IsActive()); EXPECT_TRUE(player_observer->IsPlaying(0)); @@ -2513,9 +2615,10 @@ } IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest, Async_Unducking_Success) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_TRUE(IsActive()); EXPECT_TRUE(player_observer->IsPlaying(0)); @@ -2527,9 +2630,10 @@ } IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest, Async_Unducking_Suspended) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); EXPECT_TRUE(IsActive()); EXPECT_TRUE(player_observer->IsPlaying(0)); @@ -2661,9 +2765,10 @@ IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest, SinkIdChangeNotifiesObservers) { - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); - StartNewPlayer(player_observer.get(), media::MediaContentType::Persistent); + StartNewPlayer(player_observer.get()); UISetAudioSink(kExampleSinkId); EXPECT_EQ(player_observer->received_set_audio_sink_id_calls(), 1); @@ -2741,15 +2846,15 @@ /*playback_rate=*/0.0, /*duration=*/base::TimeDelta::FromSeconds(10), /*position=*/base::TimeDelta(), /*end_of_media=*/false); - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); int player_id = player_observer->StartNewPlayer(); SetPosition(player_observer.get(), player_id, expected_position); { // With one normal player we should use the position that one provides. media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - AddPlayer(player_observer.get(), player_id, - media::MediaContentType::Persistent); + AddPlayer(player_observer.get(), player_id); observer.WaitForExpectedPosition(expected_position); } @@ -2758,8 +2863,7 @@ { // If we add another player then we should become empty again. media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - AddPlayer(player_observer.get(), player_id_2, - media::MediaContentType::Persistent); + AddPlayer(player_observer.get(), player_id_2); observer.WaitForEmptyPosition(); } @@ -2777,10 +2881,11 @@ /*playback_rate=*/0.0, /*duration=*/base::TimeDelta::FromSeconds(10), /*position=*/base::TimeDelta(), /*end_of_media=*/false); - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::OneShot); int player_id = player_observer->StartNewPlayer(); SetPosition(player_observer.get(), player_id, expected_position); - AddPlayer(player_observer.get(), player_id, media::MediaContentType::OneShot); + AddPlayer(player_observer.get(), player_id); // OneShot players should be ignored for position data. media_session::test::MockMediaSessionMojoObserver observer(*media_session_); @@ -2793,10 +2898,11 @@ /*playback_rate=*/0.0, /*duration=*/base::TimeDelta::FromSeconds(10), /*position=*/base::TimeDelta(), /*end_of_media=*/false); - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Pepper); int player_id = player_observer->StartNewPlayer(); SetPosition(player_observer.get(), player_id, expected_position); - AddPlayer(player_observer.get(), player_id, media::MediaContentType::Pepper); + AddPlayer(player_observer.get(), player_id); // Pepper players should be ignored for position data. media_session::test::MockMediaSessionMojoObserver observer(*media_session_); @@ -2809,22 +2915,23 @@ /*playback_rate=*/0.0, /*duration=*/base::TimeDelta::FromSeconds(10), /*position=*/base::TimeDelta(), /*end_of_media=*/false); - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); int player_id = player_observer->StartNewPlayer(); SetPosition(player_observer.get(), player_id, expected_position); { // With one normal player we should use the position that one provides. media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - AddPlayer(player_observer.get(), player_id, - media::MediaContentType::Persistent); + AddPlayer(player_observer.get(), player_id); observer.WaitForExpectedPosition(expected_position); } { // If we add an OneShot player then we should become empty again. media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::OneShot); + player_observer->SetMediaContentType(media::MediaContentType::OneShot); + StartNewPlayer(player_observer.get()); observer.WaitForEmptyPosition(); } } @@ -2835,22 +2942,23 @@ /*playback_rate=*/0.0, /*duration=*/base::TimeDelta::FromSeconds(10), /*position=*/base::TimeDelta(), /*end_of_media=*/false); - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); int player_id = player_observer->StartNewPlayer(); SetPosition(player_observer.get(), player_id, expected_position); { // With one normal player we should use the position that one provides. media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - AddPlayer(player_observer.get(), player_id, - media::MediaContentType::Persistent); + AddPlayer(player_observer.get(), player_id); observer.WaitForExpectedPosition(expected_position); } { // If we add a Papper player then we should become empty again. media_session::test::MockMediaSessionMojoObserver observer(*media_session_); - StartNewPlayer(player_observer.get(), media::MediaContentType::Pepper); + player_observer->SetMediaContentType(media::MediaContentType::Pepper); + StartNewPlayer(player_observer.get()); observer.WaitForEmptyPosition(); } } @@ -2964,44 +3072,43 @@ EXPECT_TRUE(NavigateToURL( shell(), embedded_test_server()->GetURL("a.com", "/title1.html"))); - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); int player_1 = player_observer->StartNewPlayer(); - AddPlayer(player_observer.get(), player_1, - media::MediaContentType::Persistent); + AddPlayer(player_observer.get(), player_1); UISetAudioSink("speaker1"); EXPECT_EQ(player_observer->GetAudioOutputSinkId(player_1), "speaker1"); // When a second player has been added on the same page, it should use the // audio device previously set. int player_2 = player_observer->StartNewPlayer(); - AddPlayer(player_observer.get(), player_2, - media::MediaContentType::Persistent); + AddPlayer(player_observer.get(), player_2); EXPECT_EQ(player_observer->GetAudioOutputSinkId(player_2), "speaker1"); // Clear the players and navigate to a new page on the same origin. RemovePlayers(player_observer.get()); EXPECT_TRUE(NavigateToURL( shell(), embedded_test_server()->GetURL("a.com", "/title2.html"))); - player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); // After navigating to another page on the same origin, newly created players // should use the previously set device. player_1 = player_observer->StartNewPlayer(); - AddPlayer(player_observer.get(), player_1, - media::MediaContentType::Persistent); + AddPlayer(player_observer.get(), player_1); EXPECT_EQ(player_observer->GetAudioOutputSinkId(player_1), "speaker1"); // Clear the players and navigate to a new page on a different origin RemovePlayers(player_observer.get()); EXPECT_TRUE(NavigateToURL( shell(), embedded_test_server()->GetURL("b.com", "/title1.html"))); - player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); // After navigating to another page on a different origin, newly created // players should not use the previously set device. player_1 = player_observer->StartNewPlayer(); - AddPlayer(player_observer.get(), player_1, - media::MediaContentType::Persistent); + AddPlayer(player_observer.get(), player_1); EXPECT_NE(player_observer->GetAudioOutputSinkId(player_1), "speaker1"); } @@ -3075,18 +3182,17 @@ EXPECT_TRUE(NavigateToURL( shell(), embedded_test_server()->GetURL("a.com", "/title1.html"))); - auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + auto player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); int player_1 = player_observer->StartNewPlayer(); - AddPlayer(player_observer.get(), player_1, - media::MediaContentType::Persistent); + AddPlayer(player_observer.get(), player_1); UISetAudioSink("speaker1"); EXPECT_EQ(player_observer->GetAudioOutputSinkId(player_1), "speaker1"); // When a second player has been added on the same page, it should use the // audio device previously set. int player_2 = player_observer->StartNewPlayer(); - AddPlayer(player_observer.get(), player_2, - media::MediaContentType::Persistent); + AddPlayer(player_observer.get(), player_2); EXPECT_EQ(player_observer->GetAudioOutputSinkId(player_2), "speaker1"); // Clear the players. @@ -3102,26 +3208,26 @@ test::PrerenderTestHelper::NavigatePrimaryPage(*web_contents(), prerender_url_a); EXPECT_TRUE(host_observer_a.was_activated()); - player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); // After navigating to another page on the same origin, newly created players // should use the previously set device. player_1 = player_observer->StartNewPlayer(); - AddPlayer(player_observer.get(), player_1, - media::MediaContentType::Persistent); + AddPlayer(player_observer.get(), player_1); EXPECT_EQ(player_observer->GetAudioOutputSinkId(player_1), "speaker1"); // Clear the players and navigate to a new page on a different origin RemovePlayers(player_observer.get()); EXPECT_TRUE(NavigateToURL( shell(), embedded_test_server()->GetURL("b.com", "/title1.html"))); - player_observer = std::make_unique<MockMediaSessionPlayerObserver>(); + player_observer = std::make_unique<MockMediaSessionPlayerObserver>( + media::MediaContentType::Persistent); // After navigating to another page on a different origin, newly created // players should not use the previously set device. player_1 = player_observer->StartNewPlayer(); - AddPlayer(player_observer.get(), player_1, - media::MediaContentType::Persistent); + AddPlayer(player_observer.get(), player_1); EXPECT_NE(player_observer->GetAudioOutputSinkId(player_1), "speaker1"); }
diff --git a/content/browser/media/session/media_session_impl_service_routing_unittest.cc b/content/browser/media/session/media_session_impl_service_routing_unittest.cc index 6498d5a..b8633a5e 100644 --- a/content/browser/media/session/media_session_impl_service_routing_unittest.cc +++ b/content/browser/media/session/media_session_impl_service_routing_unittest.cc
@@ -42,8 +42,11 @@ class MockMediaSessionPlayerObserver : public MediaSessionPlayerObserver { public: MockMediaSessionPlayerObserver(RenderFrameHost* rfh, - MediaAudioVideoState audio_video_state) - : render_frame_host_(rfh), audio_video_state_(audio_video_state) {} + MediaAudioVideoState audio_video_state, + media::MediaContentType media_content_type) + : render_frame_host_(rfh), + audio_video_state_(audio_video_state), + media_content_type_(media_content_type) {} ~MockMediaSessionPlayerObserver() override = default; @@ -90,6 +93,10 @@ return false; } + media::MediaContentType GetMediaContentType() const override { + return media_content_type_; + } + RenderFrameHost* render_frame_host() const override { return render_frame_host_; } @@ -99,6 +106,8 @@ const media_session::mojom::MediaAudioVideoState audio_video_state_; + media::MediaContentType media_content_type_; + absl::optional<media_session::MediaPosition> position_; }; @@ -167,9 +176,9 @@ MediaAudioVideoState::kAudioOnly) { players_[frame] = std::make_unique<NiceMock<MockMediaSessionPlayerObserver>>( - frame, audio_video_state); + frame, audio_video_state, type); MediaSessionImpl::Get(contents()) - ->AddPlayer(players_[frame].get(), kPlayerId, type); + ->AddPlayer(players_[frame].get(), kPlayerId); } void ClearPlayersForFrame(TestRenderFrameHost* frame) {
diff --git a/content/browser/media/session/media_session_impl_uma_unittest.cc b/content/browser/media/session/media_session_impl_uma_unittest.cc index c08ab9d..6a69f4b 100644 --- a/content/browser/media/session/media_session_impl_uma_unittest.cc +++ b/content/browser/media/session/media_session_impl_uma_unittest.cc
@@ -28,8 +28,12 @@ class MockMediaSessionPlayerObserver : public MediaSessionPlayerObserver { public: - explicit MockMediaSessionPlayerObserver(RenderFrameHost* rfh) - : render_frame_host_(rfh) {} + MockMediaSessionPlayerObserver(RenderFrameHost* rfh, + media::MediaContentType media_content_type) + : render_frame_host_(rfh), media_content_type_(media_content_type) {} + explicit MockMediaSessionPlayerObserver( + media::MediaContentType media_content_type) + : MockMediaSessionPlayerObserver(nullptr, media_content_type) {} ~MockMediaSessionPlayerObserver() override = default; @@ -64,12 +68,21 @@ return false; } + media::MediaContentType GetMediaContentType() const override { + return media_content_type_; + } + + void SetMediaContentType(media::MediaContentType media_content_type) { + media_content_type_ = media_content_type; + } + RenderFrameHost* render_frame_host() const override { return render_frame_host_; } private: RenderFrameHost* render_frame_host_; + media::MediaContentType media_content_type_; }; struct ActionMappingEntry { @@ -116,9 +129,8 @@ void StartPlayer() { player_ = std::make_unique<MockMediaSessionPlayerObserver>( - contents()->GetMainFrame()); - GetSession()->AddPlayer(player_.get(), kPlayerId, - media::MediaContentType::Persistent); + contents()->GetMainFrame(), media::MediaContentType::Persistent); + GetSession()->AddPlayer(player_.get(), kPlayerId); } std::unique_ptr<base::HistogramSamples> GetHistogramSamplesSinceTestStart(
diff --git a/content/browser/media/session/media_session_impl_unittest.cc b/content/browser/media/session/media_session_impl_unittest.cc index 6b14410..a4806a88 100644 --- a/content/browser/media/session/media_session_impl_unittest.cc +++ b/content/browser/media/session/media_session_impl_unittest.cc
@@ -110,8 +110,8 @@ RenderViewHostTestHarness::SetUp(); - player_observer_ = - std::make_unique<MockMediaSessionPlayerObserver>(main_rfh()); + player_observer_ = std::make_unique<MockMediaSessionPlayerObserver>( + main_rfh(), media::MediaContentType::Persistent); mock_media_session_service_ = std::make_unique<testing::NiceMock<MockMediaSessionServiceImpl>>( main_rfh()); @@ -184,8 +184,7 @@ void StartNewPlayer() { GetMediaSession()->AddPlayer(player_observer_.get(), - player_observer_->StartNewPlayer(), - media::MediaContentType::Persistent); + player_observer_->StartNewPlayer()); } const std::set<media_session::mojom::MediaSessionAction>& default_actions() @@ -294,10 +293,11 @@ int player_id = player_observer_->StartNewPlayer(); { + player_observer_->SetMediaContentType(media::MediaContentType::Pepper); MockMediaSessionMojoObserver observer(*GetMediaSession()); - GetMediaSession()->AddPlayer(player_observer_.get(), player_id, - media::MediaContentType::Pepper); + GetMediaSession()->AddPlayer(player_observer_.get(), player_id); observer.WaitForState(MediaSessionInfo::SessionState::kActive); + player_observer_->SetMediaContentType(media::MediaContentType::Persistent); } EXPECT_TRUE(GetForceDuck(GetMediaSession())); @@ -333,8 +333,7 @@ { MockMediaSessionMojoObserver observer(*GetMediaSession()); - GetMediaSession()->AddPlayer(player_observer_.get(), player_id, - media::MediaContentType::Persistent); + GetMediaSession()->AddPlayer(player_observer_.get(), player_id); observer.WaitForPlaybackState(MediaPlaybackState::kPlaying); } @@ -718,10 +717,8 @@ ->audio_sink_id.has_value()); int player1 = player_observer_->StartNewPlayer(); int player2 = player_observer_->StartNewPlayer(); - GetMediaSession()->AddPlayer(player_observer_.get(), player1, - media::MediaContentType::Persistent); - GetMediaSession()->AddPlayer(player_observer_.get(), player2, - media::MediaContentType::Persistent); + GetMediaSession()->AddPlayer(player_observer_.get(), player1); + GetMediaSession()->AddPlayer(player_observer_.get(), player2); player_observer_->SetAudioSinkId(player1, "1"); player_observer_->SetAudioSinkId(player2, "1"); @@ -776,8 +773,7 @@ TEST_F(MediaSessionImplDurationThrottleTest, ThrottleDurationUpdate) { MockMediaSessionMojoObserver observer(*GetMediaSession()); int player_id = player_observer_->StartNewPlayer(); - GetMediaSession()->AddPlayer(player_observer_.get(), player_id, - media::MediaContentType::Persistent); + GetMediaSession()->AddPlayer(player_observer_.get(), player_id); media_session::MediaPosition pos; for (int duration = 0; duration <= GetDurationUpdateMaxAllowance(); @@ -818,8 +814,7 @@ for (int duration = 0; duration <= GetDurationUpdateMaxAllowance(); ++duration) { int player_id = player_observer_->StartNewPlayer(); - GetMediaSession()->AddPlayer(player_observer_.get(), player_id, - media::MediaContentType::Persistent); + GetMediaSession()->AddPlayer(player_observer_.get(), player_id); pos = media_session::MediaPosition( /*playback_rate=*/0.0,
diff --git a/content/browser/media/session/media_session_player_observer.h b/content/browser/media/session/media_session_player_observer.h index f45351d..b467ebb 100644 --- a/content/browser/media/session/media_session_player_observer.h +++ b/content/browser/media/session/media_session_player_observer.h
@@ -8,6 +8,10 @@ #include "base/time/time.h" #include "third_party/abseil-cpp/absl/types/optional.h" +namespace media { +enum class MediaContentType; +} + namespace media_session { struct MediaPosition; } // namespace media_session @@ -75,6 +79,8 @@ // Returns true if the |player_id| supports audio output device switching. virtual bool SupportsAudioOutputDeviceSwitching(int player_id) const = 0; + virtual media::MediaContentType GetMediaContentType() const = 0; + // Returns the RenderFrameHost this player observer belongs to. Returns // nullptr if unavailable. virtual RenderFrameHost* render_frame_host() const = 0;
diff --git a/content/browser/media/session/media_session_service_impl_browsertest.cc b/content/browser/media/session/media_session_service_impl_browsertest.cc index c047c6e..74f97ad 100644 --- a/content/browser/media/session/media_session_service_impl_browsertest.cc +++ b/content/browser/media/session/media_session_service_impl_browsertest.cc
@@ -81,6 +81,10 @@ return false; } + media::MediaContentType GetMediaContentType() const override { + return media::MediaContentType::Persistent; + } + RenderFrameHost* render_frame_host() const override { return render_frame_host_; } @@ -132,8 +136,7 @@ shell()->web_contents()->GetMainFrame()); MediaSessionImpl::Get(shell()->web_contents()) - ->AddPlayer(player_.get(), kPlayerId, - media::MediaContentType::Persistent); + ->AddPlayer(player_.get(), kPlayerId); } MediaSessionImpl* GetSession() {
diff --git a/content/browser/media/session/mock_media_session_player_observer.cc b/content/browser/media/session/mock_media_session_player_observer.cc index 2ef49f4..132f640a 100644 --- a/content/browser/media/session/mock_media_session_player_observer.cc +++ b/content/browser/media/session/mock_media_session_player_observer.cc
@@ -9,8 +9,14 @@ namespace content { MockMediaSessionPlayerObserver::MockMediaSessionPlayerObserver( - RenderFrameHost* render_frame_host) - : MediaSessionPlayerObserver(), render_frame_host_(render_frame_host) {} + RenderFrameHost* render_frame_host, + media::MediaContentType media_content_type) + : render_frame_host_(render_frame_host), + media_content_type_(media_content_type) {} + +MockMediaSessionPlayerObserver::MockMediaSessionPlayerObserver( + media::MediaContentType media_content_type) + : MockMediaSessionPlayerObserver(nullptr, media_content_type) {} MockMediaSessionPlayerObserver::~MockMediaSessionPlayerObserver() = default; @@ -206,6 +212,16 @@ return players_.at(player_id).supports_device_switching_; } +media::MediaContentType MockMediaSessionPlayerObserver::GetMediaContentType() + const { + return media_content_type_; +} + +void MockMediaSessionPlayerObserver::SetMediaContentType( + media::MediaContentType media_content_type) { + media_content_type_ = media_content_type; +} + MockMediaSessionPlayerObserver::MockPlayer::MockPlayer(bool is_playing, double volume_multiplier) : is_playing_(is_playing), volume_multiplier_(volume_multiplier) {}
diff --git a/content/browser/media/session/mock_media_session_player_observer.h b/content/browser/media/session/mock_media_session_player_observer.h index dfd3890..1051e5f5 100644 --- a/content/browser/media/session/mock_media_session_player_observer.h +++ b/content/browser/media/session/mock_media_session_player_observer.h
@@ -19,8 +19,10 @@ // MediaSessionPlayerObserver to be used in tests. class MockMediaSessionPlayerObserver : public MediaSessionPlayerObserver { public: + MockMediaSessionPlayerObserver(RenderFrameHost* render_frame_host, + media::MediaContentType media_content_type); explicit MockMediaSessionPlayerObserver( - RenderFrameHost* render_frame_host = nullptr); + media::MediaContentType media_content_type); ~MockMediaSessionPlayerObserver() override; // Implements MediaSessionPlayerObserver. @@ -43,6 +45,9 @@ bool HasVideo(int player_id) const override; std::string GetAudioOutputSinkId(int player_id) const override; bool SupportsAudioOutputDeviceSwitching(int player_id) const override; + media::MediaContentType GetMediaContentType() const override; + + void SetMediaContentType(media::MediaContentType media_content_type); // Simulate that a new player started. // Returns the player_id. @@ -104,6 +109,8 @@ int received_enter_picture_in_picture_calls_ = 0; int received_exit_picture_in_picture_calls_ = 0; int received_set_audio_sink_id_calls_ = 0; + + media::MediaContentType media_content_type_; }; } // namespace content
diff --git a/content/browser/media/session/pepper_playback_observer.cc b/content/browser/media/session/pepper_playback_observer.cc index ee47ded9..60a3bd7 100644 --- a/content/browser/media/session/pepper_playback_observer.cc +++ b/content/browser/media/session/pepper_playback_observer.cc
@@ -70,14 +70,14 @@ if (players_map_.count(id)) return; - players_map_[id] = - std::make_unique<PepperPlayerDelegate>(render_frame_host, pp_instance); - - MediaSessionImpl::Get(contents_)->AddPlayer( - players_map_[id].get(), PepperPlayerDelegate::kPlayerId, + players_map_[id] = std::make_unique<PepperPlayerDelegate>( + render_frame_host, pp_instance, base::FeatureList::IsEnabled(media::kAudioFocusDuckFlash) ? media::MediaContentType::Pepper : media::MediaContentType::OneShot); + + MediaSessionImpl::Get(contents_)->AddPlayer(players_map_[id].get(), + PepperPlayerDelegate::kPlayerId); } void PepperPlaybackObserver::PepperStopsPlayback(
diff --git a/content/browser/media/session/pepper_player_delegate.cc b/content/browser/media/session/pepper_player_delegate.cc index 95734aea..46e445e 100644 --- a/content/browser/media/session/pepper_player_delegate.cc +++ b/content/browser/media/session/pepper_player_delegate.cc
@@ -20,9 +20,13 @@ const int PepperPlayerDelegate::kPlayerId = 0; -PepperPlayerDelegate::PepperPlayerDelegate(RenderFrameHost* render_frame_host, - int32_t pp_instance) - : render_frame_host_(render_frame_host), pp_instance_(pp_instance) {} +PepperPlayerDelegate::PepperPlayerDelegate( + RenderFrameHost* render_frame_host, + int32_t pp_instance, + media::MediaContentType media_content_type) + : render_frame_host_(render_frame_host), + pp_instance_(pp_instance), + media_content_type_(media_content_type) {} PepperPlayerDelegate::~PepperPlayerDelegate() = default; @@ -123,4 +127,8 @@ return false; } +media::MediaContentType PepperPlayerDelegate::GetMediaContentType() const { + return media_content_type_; +} + } // namespace content
diff --git a/content/browser/media/session/pepper_player_delegate.h b/content/browser/media/session/pepper_player_delegate.h index ab41235..1938cf95 100644 --- a/content/browser/media/session/pepper_player_delegate.h +++ b/content/browser/media/session/pepper_player_delegate.h
@@ -20,7 +20,9 @@ // it can be used elsewhere. static const int kPlayerId; - PepperPlayerDelegate(RenderFrameHost* render_frame_host, int32_t pp_instance); + PepperPlayerDelegate(RenderFrameHost* render_frame_host, + int32_t pp_instance, + media::MediaContentType media_content_type); PepperPlayerDelegate(const PepperPlayerDelegate&) = delete; PepperPlayerDelegate& operator=(const PepperPlayerDelegate&) = delete; @@ -47,12 +49,14 @@ bool HasVideo(int player_id) const override; std::string GetAudioOutputSinkId(int player_id) const override; bool SupportsAudioOutputDeviceSwitching(int player_id) const override; + media::MediaContentType GetMediaContentType() const override; private: void SetVolume(int player_id, double volume); RenderFrameHost* render_frame_host_; int32_t pp_instance_; + const media::MediaContentType media_content_type_; }; } // namespace content
diff --git a/content/browser/native_io/native_io_manager_unittest.cc b/content/browser/native_io/native_io_manager_unittest.cc index b92abe29..f7483438 100644 --- a/content/browser/native_io/native_io_manager_unittest.cc +++ b/content/browser/native_io/native_io_manager_unittest.cc
@@ -557,14 +557,7 @@ EXPECT_EQ(delete_result.second, static_cast<uint64_t>(kTestData.size())); } -#if defined(ADDRESS_SANITIZER) -// Test is flaky under ASAN: https://crbug.com/1243689 -#define MAYBE_GetAllFiles_Empty DISABLED_GetAllFiles_Empty -#else -#define MAYBE_GetAllFiles_Empty GetAllFiles_Empty -#endif - -TEST_P(NativeIOManagerTest, MAYBE_GetAllFiles_Empty) { +TEST_P(NativeIOManagerTest, GetAllFiles_Empty) { std::vector<std::string> file_names = example_host_->GetAllFileNames(); EXPECT_EQ(0u, file_names.size()); }
diff --git a/content/browser/renderer_host/input/one_shot_timeout_monitor.cc b/content/browser/renderer_host/input/one_shot_timeout_monitor.cc deleted file mode 100644 index cfdc49f8..0000000 --- a/content/browser/renderer_host/input/one_shot_timeout_monitor.cc +++ /dev/null
@@ -1,39 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/renderer_host/input/one_shot_timeout_monitor.h" - -#include "base/trace_event/trace_event.h" - -namespace content { - -OneShotTimeoutMonitor::OneShotTimeoutMonitor(TimeoutHandler timeout_handler, - base::TimeDelta delay) - : timeout_handler_(std::move(timeout_handler)), delay_(delay) { - DCHECK(!timeout_handler_.is_null()); - Start(); -} - -OneShotTimeoutMonitor::~OneShotTimeoutMonitor() { - if (timeout_timer_.IsRunning()) - timeout_timer_.Stop(); -} - -void OneShotTimeoutMonitor::Start() { - TRACE_EVENT_ASYNC_BEGIN0("renderer_host", "OneShotTimeoutMonitor", this); - TRACE_EVENT_INSTANT0("renderer_host", "OneShotTimeoutMonitor::Start", - TRACE_EVENT_SCOPE_THREAD); - - timeout_timer_.Start(FROM_HERE, delay_, this, - &OneShotTimeoutMonitor::TimedOut); -} - -void OneShotTimeoutMonitor::TimedOut() { - TRACE_EVENT_ASYNC_END1("renderer_host", "OneShotTimeoutMonitor", this, - "result", "timed_out"); - TRACE_EVENT0("renderer_host", "OneShotTimeoutMonitor::TimeOutHandler"); - std::move(timeout_handler_).Run(); -} - -} // namespace content
diff --git a/content/browser/renderer_host/input/one_shot_timeout_monitor.h b/content/browser/renderer_host/input/one_shot_timeout_monitor.h deleted file mode 100644 index 8ca82fc..0000000 --- a/content/browser/renderer_host/input/one_shot_timeout_monitor.h +++ /dev/null
@@ -1,45 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_ONE_SHOT_TIMEOUT_MONITOR_H_ -#define CONTENT_BROWSER_RENDERER_HOST_INPUT_ONE_SHOT_TIMEOUT_MONITOR_H_ - -#include "base/callback.h" -#include "base/macros.h" -#include "base/time/time.h" -#include "base/timer/timer.h" -#include "content/common/content_export.h" - -namespace content { - -// Utility class for handling a timeout callback that can only be used once. -// This is effectively a wrapper for base::OneShotTimer that allows use of a -// base::OnceClosure. -class CONTENT_EXPORT OneShotTimeoutMonitor { - public: - typedef base::OnceClosure TimeoutHandler; - - // The timer starts upon construction. - explicit OneShotTimeoutMonitor(TimeoutHandler timeout_handler, - base::TimeDelta delay); - - OneShotTimeoutMonitor(const OneShotTimeoutMonitor&) = delete; - OneShotTimeoutMonitor& operator=(const OneShotTimeoutMonitor&) = delete; - - ~OneShotTimeoutMonitor(); - - private: - void Start(); - void TimedOut(); - - TimeoutHandler timeout_handler_; - base::TimeDelta delay_; - - // This timer runs to check if |time_when_considered_timed_out_| has past. - base::OneShotTimer timeout_timer_; -}; - -} // namespace content - -#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_ONE_SHOT_TIMEOUT_MONITOR_H_
diff --git a/content/browser/renderer_host/page_lifecycle_state_manager.cc b/content/browser/renderer_host/page_lifecycle_state_manager.cc index e0a4b33e..c256fb9 100644 --- a/content/browser/renderer_host/page_lifecycle_state_manager.cc +++ b/content/browser/renderer_host/page_lifecycle_state_manager.cc
@@ -82,12 +82,10 @@ // When a page is put into BackForwardCache, the page can run a busy loop. // Set a timeout monitor to check that the transition finishes within the // time limit. - back_forward_cache_timeout_monitor_ = - std::make_unique<OneShotTimeoutMonitor>( - base::BindOnce( - &PageLifecycleStateManager::OnBackForwardCacheTimeout, - weak_ptr_factory_.GetWeakPtr()), - kBackForwardCacheTimeoutInSeconds); + back_forward_cache_timeout_monitor_.Start( + FROM_HERE, kBackForwardCacheTimeoutInSeconds, + base::BindOnce(&PageLifecycleStateManager::OnBackForwardCacheTimeout, + weak_ptr_factory_.GetWeakPtr())); pagehide_dispatch_ = blink::mojom::PagehideDispatch::kDispatchedPersisted; } else { DCHECK(page_restore_params); @@ -241,7 +239,7 @@ render_view_host_impl_->EnforceBackForwardCacheSizeLimit(); if (last_acknowledged_state_->is_in_back_forward_cache) { - back_forward_cache_timeout_monitor_.reset(nullptr); + back_forward_cache_timeout_monitor_.Stop(); } if (test_delegate_) { @@ -255,7 +253,7 @@ void PageLifecycleStateManager::OnBackForwardCacheTimeout() { DCHECK(!last_acknowledged_state_->is_in_back_forward_cache); render_view_host_impl_->OnBackForwardCacheTimeout(); - back_forward_cache_timeout_monitor_.reset(nullptr); + back_forward_cache_timeout_monitor_.Stop(); } void PageLifecycleStateManager::SetDelegateForTesting(
diff --git a/content/browser/renderer_host/page_lifecycle_state_manager.h b/content/browser/renderer_host/page_lifecycle_state_manager.h index 30cb80a1..2a159b45 100644 --- a/content/browser/renderer_host/page_lifecycle_state_manager.h +++ b/content/browser/renderer_host/page_lifecycle_state_manager.h
@@ -7,7 +7,7 @@ #include "base/callback_forward.h" #include "base/memory/weak_ptr.h" -#include "content/browser/renderer_host/input/one_shot_timeout_monitor.h" +#include "base/timer/timer.h" #include "content/common/content_export.h" #include "content/public/common/page_visibility_state.h" #include "mojo/public/cpp/bindings/remote.h" @@ -125,7 +125,7 @@ // This is the per-page state that is sent to renderer most lately. blink::mojom::PageLifecycleStatePtr last_state_sent_to_renderer_; - std::unique_ptr<OneShotTimeoutMonitor> back_forward_cache_timeout_monitor_; + base::OneShotTimer back_forward_cache_timeout_monitor_; TestDelegate* test_delegate_{nullptr}; // NOTE: This must be the last member.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index 4efb2f5..f2212d4 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -5253,7 +5253,7 @@ frame_tree_node()->SetInsecureNavigationsSet(set); } -RenderFrameHostImpl* RenderFrameHostImpl::FindAndVerifyChild( +FrameTreeNode* RenderFrameHostImpl::FindAndVerifyChild( int32_t child_frame_routing_id, bad_message::BadMessageReason reason) { auto child_frame_or_proxy = LookupRenderFrameHostOrProxy( @@ -5261,7 +5261,7 @@ return FindAndVerifyChildInternal(child_frame_or_proxy, reason); } -RenderFrameHostImpl* RenderFrameHostImpl::FindAndVerifyChild( +FrameTreeNode* RenderFrameHostImpl::FindAndVerifyChild( const blink::FrameToken& child_frame_token, bad_message::BadMessageReason reason) { auto child_frame_or_proxy = @@ -5269,7 +5269,7 @@ return FindAndVerifyChildInternal(child_frame_or_proxy, reason); } -RenderFrameHostImpl* RenderFrameHostImpl::FindAndVerifyChildInternal( +FrameTreeNode* RenderFrameHostImpl::FindAndVerifyChildInternal( RenderFrameHostOrProxy child_frame_or_proxy, bad_message::BadMessageReason reason) { // A race can result in |child| to be nullptr. Avoid killing the renderer in @@ -5290,7 +5290,7 @@ bad_message::ReceivedBadMessage(GetProcess(), reason); return nullptr; } - return child_frame_or_proxy.GetCurrentFrameHost(); + return child_frame_or_proxy.GetFrameTreeNode(); } void RenderFrameHostImpl::UpdateTitle( @@ -6284,14 +6284,14 @@ bool has_display_none_property_changed = properties->is_display_none != - child->frame_tree_node()->frame_owner_properties().is_display_none; + child->frame_owner_properties().is_display_none; - child->frame_tree_node()->set_frame_owner_properties(*properties); + child->set_frame_owner_properties(*properties); - child->frame_tree_node()->render_manager()->OnDidUpdateFrameOwnerProperties( - *properties); + child->render_manager()->OnDidUpdateFrameOwnerProperties(*properties); if (has_display_none_property_changed) { - delegate_->DidChangeDisplayState(child, properties->is_display_none); + delegate_->DidChangeDisplayState(child->current_frame_host(), + properties->is_display_none); } } @@ -6317,8 +6317,8 @@ if (!child) return; - child->frame_tree_node()->set_csp_attribute(std::move(parsed_csp_attribute)); - child->frame_tree_node()->set_anonymous(anonymous); + child->set_csp_attribute(std::move(parsed_csp_attribute)); + child->set_anonymous(anonymous); } void RenderFrameHostImpl::DidChangeFramePolicy( @@ -6327,21 +6327,23 @@ // Ensure that a frame can only update sandbox flags or permissions policy for // its immediate children. If this is not the case, the renderer is // considered malicious and is killed. - RenderFrameHostImpl* child = FindAndVerifyChild( + FrameTreeNode* child = FindAndVerifyChild( // TODO(iclelland): Rename this message child_frame_token, bad_message::RFH_SANDBOX_FLAGS); if (!child) return; - child->frame_tree_node()->SetPendingFramePolicy(frame_policy); + child->SetPendingFramePolicy(frame_policy); // Notify the RenderFrame if it lives in a different process from its parent. // The frame's proxies in other processes also need to learn about the updated // flags and policy, but these notifications are sent later in // RenderFrameHostManager::CommitPendingFramePolicy(), when the frame // navigates and the new policies take effect. - if (child->GetSiteInstance() != GetSiteInstance()) { - child->GetAssociatedLocalFrame()->DidUpdateFramePolicy(frame_policy); + if (child->current_frame_host()->GetSiteInstance() != GetSiteInstance()) { + child->current_frame_host() + ->GetAssociatedLocalFrame() + ->DidUpdateFramePolicy(frame_policy); } }
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h index 26509d2..8dc8e9c 100644 --- a/content/browser/renderer_host/render_frame_host_impl.h +++ b/content/browser/renderer_host/render_frame_host_impl.h
@@ -2166,20 +2166,19 @@ committed_speculative_rfh_before_navigation_commit_ = true; } - // Returns the child RenderFrameHostImpl if |child_frame_routing_id| is an - // immediate child of this FrameTreeNode. |child_frame_routing_id| is - // considered untrusted, so the renderer process is killed if it refers to a - // RenderFrameHostImpl that is not a child of this node. - RenderFrameHostImpl* FindAndVerifyChild(int32_t child_frame_routing_id, - bad_message::BadMessageReason reason); + // Returns the child frame if |child_frame_routing_id| is an immediate child + // of this RenderFrameHost. |child_frame_routing_id| is considered untrusted, + // so the renderer process is killed if it refers to a RenderFrameHostImpl + // that is not a child of this node. + FrameTreeNode* FindAndVerifyChild(int32_t child_frame_routing_id, + bad_message::BadMessageReason reason); - // Returns the child RenderFrameHostImpl if |child_frame_token| is an - // immediate child of this FrameTreeNode. |child_frame_token| is considered - // untrusted, so the renderer process is killed if it refers to a - // RenderFrameHostImpl that is not a child of this node. - RenderFrameHostImpl* FindAndVerifyChild( - const blink::FrameToken& child_frame_token, - bad_message::BadMessageReason reason); + // Returns the child frame if |child_frame_token| is an immediate child of + // this RenderFrameHostImpl. |child_frame_token| is considered untrusted, so + // the renderer process is killed if it refers to a RenderFrameHostImpl that + // is not a child of this node. + FrameTreeNode* FindAndVerifyChild(const blink::FrameToken& child_frame_token, + bad_message::BadMessageReason reason); // Whether we should run the pagehide/visibilitychange handlers of the // RenderFrameHost we're navigating away from (|old_frame_host|) during the @@ -2506,7 +2505,7 @@ class DroppedInterfaceRequestLogger; class SubresourceLoaderFactoriesConfig; - RenderFrameHostImpl* FindAndVerifyChildInternal( + FrameTreeNode* FindAndVerifyChildInternal( RenderFrameHostOrProxy child_frame_or_proxy, bad_message::BadMessageReason reason);
diff --git a/content/browser/renderer_host/render_widget_targeter.cc b/content/browser/renderer_host/render_widget_targeter.cc index 09557e4..1758206e 100644 --- a/content/browser/renderer_host/render_widget_targeter.cc +++ b/content/browser/renderer_host/render_widget_targeter.cc
@@ -13,7 +13,6 @@ #include "components/viz/common/features.h" #include "components/viz/host/host_frame_sink_manager.h" #include "content/browser/compositor/surface_utils.h" -#include "content/browser/renderer_host/input/one_shot_timeout_monitor.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/public/browser/site_isolation_policy.h" @@ -316,13 +315,13 @@ async_depth_++; TracingUmaTracker tracker("Event.AsyncTargeting.ResponseTime"); - async_hit_test_timeout_ = std::make_unique<OneShotTimeoutMonitor>( + async_hit_test_timeout_.Start( + FROM_HERE, async_hit_test_timeout_delay_, base::BindOnce( &RenderWidgetTargeter::AsyncHitTestTimedOut, weak_ptr_factory_.GetWeakPtr(), target->GetWeakPtr(), target_location, last_request_target ? last_request_target->GetWeakPtr() : nullptr, - last_target_location), - async_hit_test_timeout_delay_); + last_target_location)); target_client.set_disconnect_handler(base::BindOnce( &RenderWidgetTargeter::OnInputTargetDisconnect, @@ -386,7 +385,7 @@ TargetingRequest request = std::move(request_in_flight_.value()); request_in_flight_.reset(); - async_hit_test_timeout_.reset(nullptr); + async_hit_test_timeout_.Stop(); target->host()->input_target_client().set_disconnect_handler( base::OnceClosure()); @@ -499,10 +498,10 @@ void RenderWidgetTargeter::OnInputTargetDisconnect( base::WeakPtr<RenderWidgetHostViewBase> target, const gfx::PointF& location) { - if (!async_hit_test_timeout_) + if (!async_hit_test_timeout_.IsRunning()) return; - async_hit_test_timeout_.reset(nullptr); + async_hit_test_timeout_.Stop(); TargetingRequest request = std::move(request_in_flight_.value()); request_in_flight_.reset();
diff --git a/content/browser/renderer_host/render_widget_targeter.h b/content/browser/renderer_host/render_widget_targeter.h index 6f0042b..18b6e4a 100644 --- a/content/browser/renderer_host/render_widget_targeter.h +++ b/content/browser/renderer_host/render_widget_targeter.h
@@ -9,6 +9,7 @@ #include "base/memory/weak_ptr.h" #include "base/time/time.h" +#include "base/timer/timer.h" #include "components/viz/common/surfaces/frame_sink_id.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/common/content_export.h" @@ -27,7 +28,6 @@ namespace content { class RenderWidgetHostViewBase; -class OneShotTimeoutMonitor; // TODO(sunxd): Make |RenderWidgetTargetResult| a class. Merge the booleans into // a mask to reduce the size. Make the constructor take in enums for better @@ -254,7 +254,7 @@ // process before giving up and resuming event processing. base::TimeDelta async_hit_test_timeout_delay_; - std::unique_ptr<OneShotTimeoutMonitor> async_hit_test_timeout_; + base::OneShotTimer async_hit_test_timeout_; uint64_t trace_id_;
diff --git a/content/browser/resources/BUILD.gn b/content/browser/resources/BUILD.gn index 0ac63ce..1a57420 100644 --- a/content/browser/resources/BUILD.gn +++ b/content/browser/resources/BUILD.gn
@@ -7,7 +7,7 @@ if (enable_js_type_check) { group("closure_compile") { deps = [ - "conversions:closure_compile", + "attribution_reporting:closure_compile", "histograms:closure_compile", "process:closure_compile", ]
diff --git a/content/browser/resources/conversions/BUILD.gn b/content/browser/resources/attribution_reporting/BUILD.gn similarity index 100% rename from content/browser/resources/conversions/BUILD.gn rename to content/browser/resources/attribution_reporting/BUILD.gn
diff --git a/content/browser/resources/conversions/DIR_METADATA b/content/browser/resources/attribution_reporting/DIR_METADATA similarity index 100% rename from content/browser/resources/conversions/DIR_METADATA rename to content/browser/resources/attribution_reporting/DIR_METADATA
diff --git a/content/browser/resources/conversions/OWNERS b/content/browser/resources/attribution_reporting/OWNERS similarity index 100% rename from content/browser/resources/conversions/OWNERS rename to content/browser/resources/attribution_reporting/OWNERS
diff --git a/content/browser/resources/conversions/conversion_internals.css b/content/browser/resources/attribution_reporting/conversion_internals.css similarity index 100% rename from content/browser/resources/conversions/conversion_internals.css rename to content/browser/resources/attribution_reporting/conversion_internals.css
diff --git a/content/browser/resources/conversions/conversion_internals.html b/content/browser/resources/attribution_reporting/conversion_internals.html similarity index 100% rename from content/browser/resources/conversions/conversion_internals.html rename to content/browser/resources/attribution_reporting/conversion_internals.html
diff --git a/content/browser/resources/conversions/conversion_internals.js b/content/browser/resources/attribution_reporting/conversion_internals.js similarity index 100% rename from content/browser/resources/conversions/conversion_internals.js rename to content/browser/resources/attribution_reporting/conversion_internals.js
diff --git a/content/dev_ui_content_resources.grd b/content/dev_ui_content_resources.grd index 044ea1b9..efb4025 100644 --- a/content/dev_ui_content_resources.grd +++ b/content/dev_ui_content_resources.grd
@@ -18,9 +18,9 @@ <include name="IDR_APPCACHE_INTERNALS_HTML" file="browser/resources/appcache/appcache_internals.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" /> <include name="IDR_APPCACHE_INTERNALS_JS" file="browser/resources/appcache/appcache_internals.js" flattenhtml="false" type="BINDATA" /> <include name="IDR_APPCACHE_INTERNALS_CSS" file="browser/resources/appcache/appcache_internals.css" type="BINDATA" /> - <include name="IDR_CONVERSION_INTERNALS_HTML" file="browser/resources/conversions/conversion_internals.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" /> - <include name="IDR_CONVERSION_INTERNALS_JS" file="browser/resources/conversions/conversion_internals.js" type="BINDATA" /> - <include name="IDR_CONVERSION_INTERNALS_CSS" file="browser/resources/conversions/conversion_internals.css" type="BINDATA" /> + <include name="IDR_CONVERSION_INTERNALS_HTML" file="browser/resources/attribution_reporting/conversion_internals.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" /> + <include name="IDR_CONVERSION_INTERNALS_JS" file="browser/resources/attribution_reporting/conversion_internals.js" type="BINDATA" /> + <include name="IDR_CONVERSION_INTERNALS_CSS" file="browser/resources/attribution_reporting/conversion_internals.css" type="BINDATA" /> <include name="IDR_CONVERSION_INTERNALS_MOJOM_JS" file="${root_gen_dir}/mojom-webui/content/browser/attribution_reporting/conversion_internals.mojom-webui.js" use_base_dir="false" type="BINDATA" /> <include name="IDR_GPU_BROWSER_BRIDGE_JS" file="browser/resources/gpu/browser_bridge.js" type="BINDATA" /> <include name="IDR_GPU_INFO_VIEW_JS" file="browser/resources/gpu/info_view.js" type="BINDATA" />
diff --git a/content/public/android/BUILD.gn b/content/public/android/BUILD.gn index 84568bc..8561b088 100644 --- a/content/public/android/BUILD.gn +++ b/content/public/android/BUILD.gn
@@ -99,7 +99,6 @@ "java/src/org/chromium/content/app/PrivilegedProcessService3.java", "java/src/org/chromium/content/app/PrivilegedProcessService4.java", "java/src/org/chromium/content/app/SandboxedProcessService.java", - "java/src/org/chromium/content/app/ZygotePreload.java", "java/src/org/chromium/content/browser/BrowserStartupControllerImpl.java", "java/src/org/chromium/content/browser/ChildProcessCreationParamsImpl.java", "java/src/org/chromium/content/browser/ContentChildProcessConstants.java", @@ -110,6 +109,7 @@ "java/src/org/chromium/content/common/ContentSwitchUtils.java", "java/src/org/chromium/content/common/SurfaceWrapper.java", "java/src/org/chromium/content_public/app/ChildProcessServiceFactory.java", + "java/src/org/chromium/content_public/app/ZygotePreload.java", "java/src/org/chromium/content_public/browser/BrowserStartupController.java", "java/src/org/chromium/content_public/browser/BrowserTaskExecutor.java", "java/src/org/chromium/content_public/browser/ChildProcessCreationParams.java",
diff --git a/content/public/android/java/src/org/chromium/content/app/ZygotePreload.java b/content/public/android/java/src/org/chromium/content_public/app/ZygotePreload.java similarity index 71% rename from content/public/android/java/src/org/chromium/content/app/ZygotePreload.java rename to content/public/android/java/src/org/chromium/content_public/app/ZygotePreload.java index 83067291..399fd9b 100644 --- a/content/public/android/java/src/org/chromium/content/app/ZygotePreload.java +++ b/content/public/android/java/src/org/chromium/content_public/app/ZygotePreload.java
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.content.app; +package org.chromium.content_public.app; import android.annotation.SuppressLint; import android.annotation.TargetApi; @@ -32,13 +32,20 @@ @SuppressLint("Override") @Override public void doPreload(ApplicationInfo appInfo) { - try { - // Using concatenation rather than %s to allow values to be inlined by R8. - Log.i(TAG, - "Loaded Zygote. version=" + VersionConstants.PRODUCT_VERSION - + " minSdkVersion=" + BuildConfig.MIN_SDK_VERSION - + " isBundle=" + BuildConfig.BUNDLES_SUPPORTED); + // APKs targeting pre-Q releases, like ChromePublic, have ZygotePreload in their manifests. + // Running Chrome from these APKs on Q+ creates the app zygote and performs the preload. In + // order to load the native library with the correct name prefix, the "linker + // implementation" is chosen by the LibraryLoader itself, and not overwritten here. + doPreloadCommon(appInfo); + } + protected final void doPreloadCommon(ApplicationInfo appInfo) { + // Using concatenation rather than %s to allow values to be inlined by R8. + Log.i(TAG, + "Loaded Zygote. version=" + VersionConstants.PRODUCT_VERSION + + " minSdkVersion=" + BuildConfig.MIN_SDK_VERSION + + " isBundle=" + BuildConfig.BUNDLES_SUPPORTED); + try { // The current thread time is the best approximation we have of the zygote start time // since Process.getStartUptimeMillis() is not reliable in the zygote process. This will // be the total CPU time the current thread has been running, and is reset on fork so
diff --git a/content/shell/android/shell_apk/AndroidManifest.xml.jinja2 b/content/shell/android/shell_apk/AndroidManifest.xml.jinja2 index 2722488..d89c3906 100644 --- a/content/shell/android/shell_apk/AndroidManifest.xml.jinja2 +++ b/content/shell/android/shell_apk/AndroidManifest.xml.jinja2
@@ -24,7 +24,7 @@ <application android:name="org.chromium.content_shell_apk.ContentShellApplication" android:icon="@mipmap/app_icon" - android:zygotePreloadName="org.chromium.content.app.ZygotePreload" + android:zygotePreloadName="org.chromium.content_public.app.ZygotePreload" android:label="{% block application_label %}Content Shell{% endblock %}"> <activity android:name="org.chromium.content_shell_apk.ContentShellActivity" android:launchMode="singleTask"
diff --git a/content/shell/tools/breakpad_integration_test.py b/content/shell/tools/breakpad_integration_test.py index c2457015a..da9ed28 100755 --- a/content/shell/tools/breakpad_integration_test.py +++ b/content/shell/tools/breakpad_integration_test.py
@@ -77,7 +77,7 @@ print('Failed to list dumps in android crash dir %s' % pending) -def get_android_dump(crash_dir): +def get_android_dump(options, crash_dir, symbols_dir): global failure pending = os.path.join(ANDROID_CRASH_DIR, 'pending') @@ -93,6 +93,21 @@ time.sleep(5) if len(dumps) != 1: + # TODO(crbug.com/861730): Temporary code to debug unexpected crash dumps. + minidump_stackwalk = os.path.join(options.build_dir, 'minidump_stackwalk') + failure = 'Failed to run minidump_stackwalk.' + for dump in dumps: + device.PullFile(os.path.join(pending, dump), crash_dir, as_root=True) + minidump = os.path.join(crash_dir, os.path.basename(dump)) + cmd = [minidump_stackwalk, minidump, symbols_dir] + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + stack = proc.communicate()[0] + print(stack) + + device.RunShellCommand(['rm', os.path.join(pending, dump)], + check_return=True, as_root=True) + failure = 'Expected 1 crash dump, found %d.' % len(dumps) print(dumps) raise Exception(failure) @@ -151,7 +166,7 @@ print('# Retrieve crash dump.') if platform == 'android': - minidump = get_android_dump(crash_dir) + minidump = get_android_dump(options, crash_dir, symbols_dir) else: dmp_dir = crash_dir # TODO(crbug.com/782923): This test should not reach directly into the
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index b682882..7fd5bd0 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -2348,7 +2348,7 @@ "$root_out_dir/content_shell.pak", "data/", "//media/test/data/", - "//content/test/data/conversions/databases/", + "//content/test/data/attribution_reporting/databases/", ] }
diff --git a/content/test/data/conversions/databases/README.md b/content/test/data/attribution_reporting/databases/README.md similarity index 100% rename from content/test/data/conversions/databases/README.md rename to content/test/data/attribution_reporting/databases/README.md
diff --git a/content/test/data/conversions/databases/version_1.sql b/content/test/data/attribution_reporting/databases/version_1.sql similarity index 100% rename from content/test/data/conversions/databases/version_1.sql rename to content/test/data/attribution_reporting/databases/version_1.sql
diff --git a/content/test/data/conversions/databases/version_10.sql b/content/test/data/attribution_reporting/databases/version_10.sql similarity index 100% rename from content/test/data/conversions/databases/version_10.sql rename to content/test/data/attribution_reporting/databases/version_10.sql
diff --git a/content/test/data/conversions/databases/version_11.sql b/content/test/data/attribution_reporting/databases/version_11.sql similarity index 100% rename from content/test/data/conversions/databases/version_11.sql rename to content/test/data/attribution_reporting/databases/version_11.sql
diff --git a/content/test/data/conversions/databases/version_12.sql b/content/test/data/attribution_reporting/databases/version_12.sql similarity index 100% rename from content/test/data/conversions/databases/version_12.sql rename to content/test/data/attribution_reporting/databases/version_12.sql
diff --git a/content/test/data/conversions/databases/version_13.sql b/content/test/data/attribution_reporting/databases/version_13.sql similarity index 100% rename from content/test/data/conversions/databases/version_13.sql rename to content/test/data/attribution_reporting/databases/version_13.sql
diff --git a/content/test/data/conversions/databases/version_14.sql b/content/test/data/attribution_reporting/databases/version_14.sql similarity index 100% rename from content/test/data/conversions/databases/version_14.sql rename to content/test/data/attribution_reporting/databases/version_14.sql
diff --git a/content/test/data/conversions/databases/version_2.sql b/content/test/data/attribution_reporting/databases/version_2.sql similarity index 100% rename from content/test/data/conversions/databases/version_2.sql rename to content/test/data/attribution_reporting/databases/version_2.sql
diff --git a/content/test/data/conversions/databases/version_3.sql b/content/test/data/attribution_reporting/databases/version_3.sql similarity index 100% rename from content/test/data/conversions/databases/version_3.sql rename to content/test/data/attribution_reporting/databases/version_3.sql
diff --git a/content/test/data/conversions/databases/version_4.sql b/content/test/data/attribution_reporting/databases/version_4.sql similarity index 100% rename from content/test/data/conversions/databases/version_4.sql rename to content/test/data/attribution_reporting/databases/version_4.sql
diff --git a/content/test/data/conversions/databases/version_5.sql b/content/test/data/attribution_reporting/databases/version_5.sql similarity index 100% rename from content/test/data/conversions/databases/version_5.sql rename to content/test/data/attribution_reporting/databases/version_5.sql
diff --git a/content/test/data/conversions/databases/version_6.sql b/content/test/data/attribution_reporting/databases/version_6.sql similarity index 100% rename from content/test/data/conversions/databases/version_6.sql rename to content/test/data/attribution_reporting/databases/version_6.sql
diff --git a/content/test/data/conversions/databases/version_7.sql b/content/test/data/attribution_reporting/databases/version_7.sql similarity index 100% rename from content/test/data/conversions/databases/version_7.sql rename to content/test/data/attribution_reporting/databases/version_7.sql
diff --git a/content/test/data/conversions/databases/version_8.sql b/content/test/data/attribution_reporting/databases/version_8.sql similarity index 100% rename from content/test/data/conversions/databases/version_8.sql rename to content/test/data/attribution_reporting/databases/version_8.sql
diff --git a/content/test/data/conversions/databases/version_9.sql b/content/test/data/attribution_reporting/databases/version_9.sql similarity index 100% rename from content/test/data/conversions/databases/version_9.sql rename to content/test/data/attribution_reporting/databases/version_9.sql
diff --git a/content/test/data/conversions/impression_with_origin_trial.html b/content/test/data/attribution_reporting/impression_with_origin_trial.html similarity index 100% rename from content/test/data/conversions/impression_with_origin_trial.html rename to content/test/data/attribution_reporting/impression_with_origin_trial.html
diff --git a/content/test/data/conversions/impression_with_third_party_trial.html b/content/test/data/attribution_reporting/impression_with_third_party_trial.html similarity index 100% rename from content/test/data/conversions/impression_with_third_party_trial.html rename to content/test/data/attribution_reporting/impression_with_third_party_trial.html
diff --git a/content/test/data/conversions/page_with_conversion_measurement_disabled.html b/content/test/data/attribution_reporting/page_with_conversion_measurement_disabled.html similarity index 100% rename from content/test/data/conversions/page_with_conversion_measurement_disabled.html rename to content/test/data/attribution_reporting/page_with_conversion_measurement_disabled.html
diff --git a/content/test/data/conversions/page_with_conversion_measurement_disabled.html.mock-http-headers b/content/test/data/attribution_reporting/page_with_conversion_measurement_disabled.html.mock-http-headers similarity index 100% rename from content/test/data/conversions/page_with_conversion_measurement_disabled.html.mock-http-headers rename to content/test/data/attribution_reporting/page_with_conversion_measurement_disabled.html.mock-http-headers
diff --git a/content/test/data/conversions/page_with_conversion_redirect.html b/content/test/data/attribution_reporting/page_with_conversion_redirect.html similarity index 100% rename from content/test/data/conversions/page_with_conversion_redirect.html rename to content/test/data/attribution_reporting/page_with_conversion_redirect.html
diff --git a/content/test/data/conversions/page_with_impression_creator.html b/content/test/data/attribution_reporting/page_with_impression_creator.html similarity index 100% rename from content/test/data/conversions/page_with_impression_creator.html rename to content/test/data/attribution_reporting/page_with_impression_creator.html
diff --git a/content/test/data/conversions/page_with_preload_conversion_ping.html b/content/test/data/attribution_reporting/page_with_preload_conversion_ping.html similarity index 100% rename from content/test/data/conversions/page_with_preload_conversion_ping.html rename to content/test/data/attribution_reporting/page_with_preload_conversion_ping.html
diff --git a/content/test/data/conversions/page_with_subframe_conversion.html b/content/test/data/attribution_reporting/page_with_subframe_conversion.html similarity index 100% rename from content/test/data/conversions/page_with_subframe_conversion.html rename to content/test/data/attribution_reporting/page_with_subframe_conversion.html
diff --git a/content/test/data/conversions/register_conversion.js b/content/test/data/attribution_reporting/register_conversion.js similarity index 100% rename from content/test/data/conversions/register_conversion.js rename to content/test/data/attribution_reporting/register_conversion.js
diff --git a/content/test/data/conversions/register_impression.js b/content/test/data/attribution_reporting/register_impression.js similarity index 100% rename from content/test/data/conversions/register_impression.js rename to content/test/data/attribution_reporting/register_impression.js
diff --git a/content/test/data/conversions/third_party_token_injector.js b/content/test/data/attribution_reporting/third_party_token_injector.js similarity index 100% rename from content/test/data/conversions/third_party_token_injector.js rename to content/test/data/attribution_reporting/third_party_token_injector.js
diff --git a/content/test/data/forms/form_controls_browsertest_button_linux.png b/content/test/data/forms/form_controls_browsertest_button_linux.png new file mode 100644 index 0000000..2bcd3f9 --- /dev/null +++ b/content/test/data/forms/form_controls_browsertest_button_linux.png Binary files differ
diff --git a/content/test/data/forms/form_controls_browsertest_checkbox_linux.png b/content/test/data/forms/form_controls_browsertest_checkbox_linux.png new file mode 100644 index 0000000..27342a78 --- /dev/null +++ b/content/test/data/forms/form_controls_browsertest_checkbox_linux.png Binary files differ
diff --git a/content/test/data/forms/form_controls_browsertest_color_input_linux.png b/content/test/data/forms/form_controls_browsertest_color_input_linux.png new file mode 100644 index 0000000..d1e4a43 --- /dev/null +++ b/content/test/data/forms/form_controls_browsertest_color_input_linux.png Binary files differ
diff --git a/content/test/data/forms/form_controls_browsertest_dark_mode_text_selection_linux.png b/content/test/data/forms/form_controls_browsertest_dark_mode_text_selection_linux.png new file mode 100644 index 0000000..5674219 --- /dev/null +++ b/content/test/data/forms/form_controls_browsertest_dark_mode_text_selection_linux.png Binary files differ
diff --git a/content/test/data/forms/form_controls_browsertest_input_linux.png b/content/test/data/forms/form_controls_browsertest_input_linux.png new file mode 100644 index 0000000..50ec0e1 --- /dev/null +++ b/content/test/data/forms/form_controls_browsertest_input_linux.png Binary files differ
diff --git a/content/test/data/forms/form_controls_browsertest_meter_linux.png b/content/test/data/forms/form_controls_browsertest_meter_linux.png new file mode 100644 index 0000000..7512ec6a --- /dev/null +++ b/content/test/data/forms/form_controls_browsertest_meter_linux.png Binary files differ
diff --git a/content/test/data/forms/form_controls_browsertest_multi_select_linux.png b/content/test/data/forms/form_controls_browsertest_multi_select_linux.png new file mode 100644 index 0000000..32db9a9 --- /dev/null +++ b/content/test/data/forms/form_controls_browsertest_multi_select_linux.png Binary files differ
diff --git a/content/test/data/forms/form_controls_browsertest_progress_linux.png b/content/test/data/forms/form_controls_browsertest_progress_linux.png new file mode 100644 index 0000000..d2ffc80 --- /dev/null +++ b/content/test/data/forms/form_controls_browsertest_progress_linux.png Binary files differ
diff --git a/content/test/data/forms/form_controls_browsertest_radio_linux.png b/content/test/data/forms/form_controls_browsertest_radio_linux.png new file mode 100644 index 0000000..00576c64 --- /dev/null +++ b/content/test/data/forms/form_controls_browsertest_radio_linux.png Binary files differ
diff --git a/content/test/data/forms/form_controls_browsertest_range_linux.png b/content/test/data/forms/form_controls_browsertest_range_linux.png new file mode 100644 index 0000000..b4166d8 --- /dev/null +++ b/content/test/data/forms/form_controls_browsertest_range_linux.png Binary files differ
diff --git a/content/test/data/forms/form_controls_browsertest_select_linux.png b/content/test/data/forms/form_controls_browsertest_select_linux.png new file mode 100644 index 0000000..a1f37c50 --- /dev/null +++ b/content/test/data/forms/form_controls_browsertest_select_linux.png Binary files differ
diff --git a/content/test/data/forms/form_controls_browsertest_textarea_linux.png b/content/test/data/forms/form_controls_browsertest_textarea_linux.png new file mode 100644 index 0000000..51ffb7c --- /dev/null +++ b/content/test/data/forms/form_controls_browsertest_textarea_linux.png Binary files differ
diff --git a/content/test/did_commit_navigation_interceptor.cc b/content/test/did_commit_navigation_interceptor.cc index d6a3416..2ffc823 100644 --- a/content/test/did_commit_navigation_interceptor.cc +++ b/content/test/did_commit_navigation_interceptor.cc
@@ -47,10 +47,13 @@ DidCommitNavigationInterceptor::DidCommitNavigationInterceptor( WebContents* web_contents) : WebContentsObserver(web_contents) { - for (auto* rfh : web_contents->GetAllFrames()) { - if (rfh->IsRenderFrameLive()) - RenderFrameCreated(rfh); - } + web_contents->ForEachRenderFrameHost(base::BindRepeating( + [](DidCommitNavigationInterceptor* interceptor, + RenderFrameHost* render_frame_host) { + if (render_frame_host->IsRenderFrameLive()) + interceptor->RenderFrameCreated(render_frame_host); + }, + this)); } DidCommitNavigationInterceptor::~DidCommitNavigationInterceptor() = default;
diff --git a/content/test/frame_host_interceptor.cc b/content/test/frame_host_interceptor.cc index 1ec506ae..678c0f8 100644 --- a/content/test/frame_host_interceptor.cc +++ b/content/test/frame_host_interceptor.cc
@@ -70,10 +70,13 @@ FrameHostInterceptor::FrameHostInterceptor(WebContents* web_contents) : WebContentsObserver(web_contents) { - for (auto* rfh : web_contents->GetAllFrames()) { - if (rfh->IsRenderFrameLive()) - RenderFrameCreated(rfh); - } + web_contents->ForEachRenderFrameHost(base::BindRepeating( + [](FrameHostInterceptor* interceptor, + RenderFrameHost* render_frame_host) { + if (render_frame_host->IsRenderFrameLive()) + interceptor->RenderFrameCreated(render_frame_host); + }, + this)); } FrameHostInterceptor::~FrameHostInterceptor() = default;
diff --git a/crypto/scoped_capi_types.h b/crypto/scoped_capi_types.h index 19bca169..a54dfc9 100644 --- a/crypto/scoped_capi_types.h +++ b/crypto/scoped_capi_types.h
@@ -88,6 +88,16 @@ using ScopedPCCERT_CHAIN_CONTEXT = std::unique_ptr<const CERT_CHAIN_CONTEXT, FreeCertChainContextFunctor>; +struct FreeCtlContextFunctor { + void operator()(PCCTL_CONTEXT ctl_context) const { + if (ctl_context) + CertFreeCTLContext(ctl_context); + } +}; + +using ScopedPCCTL_CONTEXT = + std::unique_ptr<const CTL_CONTEXT, FreeCtlContextFunctor>; + } // namespace crypto #endif // CRYPTO_SCOPED_CAPI_TYPES_H_
diff --git a/docs/security/faq.md b/docs/security/faq.md index 912df6a1..88ebd60 100644 --- a/docs/security/faq.md +++ b/docs/security/faq.md
@@ -715,6 +715,18 @@ If the offset is larger than a page, or if there's uncertainty about whether the offset is controllable, it is considered a security bug. +<a name="TOC-Are-stack-overflows-considered-security-bugs-"></a> +## Are stack overflows considered security bugs? + +No. Guard pages mean that stack overflows are considered unexploitable, and +are regarded as [denial of service bugs](#TOC-Are-denial-of-service-issues-considered-security-bugs-). +The only exception is if an attacker can jump over the guard pages allocated by +the operating system and avoid accessing them, e.g.: + +* A frame with a very large stack allocation. +* C variable length array with an attacker-controlled size. +* A call to `alloca()` with an attacker-controlled size. + <a name="TOC-Are-enterprise-admins-considered-privileged-"></a> ## Are enterprise admins considered privileged?
diff --git a/docs/ui/learn/bestpractices/colors.md b/docs/ui/learn/bestpractices/colors.md index b61ff77..81f6d53 100644 --- a/docs/ui/learn/bestpractices/colors.md +++ b/docs/ui/learn/bestpractices/colors.md
@@ -36,7 +36,7 @@ `SkColorSet[A]RGB(...)`, `SK_ColorBLACK`, `gfx::kGoogleGrey900`, and the like. Instead, obtain colors by requesting them (by identifier) from an appropriate theming object. `View`s in `ui/` should call -`GetNativeTheme()->GetSystemColor(id)`; `View`s in `chrome/` should call +`GetColorProvider()->GetColor(id)`; `View`s in `chrome/` should call that or `GetThemeProvider()->GetColor(id)`. |||---||| @@ -82,12 +82,10 @@ SetImage(gfx::CreateVectorIcon( vector_icons::kInfoOutlineIcon, tooltip_icon_size_, - GetNativeTheme()->GetSystemColor( + GetColorProvider()->GetColor( hovered - ? ui::NativeTheme:: - kColorId_TooltipIconHovered - : ui::NativeTheme:: - kColorId_TooltipIcon))); + ? ui::kColorHelpIconActive + : ui::kColorHelpIconInactive))); } ``` @@ -172,9 +170,8 @@ void CollapsibleListView::OnThemeChanged() { views::View::OnThemeChanged(); - const SkColor icon_color = GetNativeTheme()-> - GetSystemColor( - ui::NativeTheme::kColorId_DefaultIconColor); + const SkColor icon_color = + GetColorProvider()->GetColor(ui::kColorIcon); views::SetImageFromVectorIconWithColor( @@ -301,8 +298,7 @@ RecoveryInstallGlobalError::MenuItemIcon() { return ui::ImageModel::FromVectorIcon( kBrowserToolsUpdateIcon, - ui::NativeTheme:: - kColorId_AlertSeverityHigh); + ui::kColorAlertHighSeverity); }
diff --git a/extensions/browser/extension_host.cc b/extensions/browser/extension_host.cc index 6596a81..69fadda 100644 --- a/extensions/browser/extension_host.cc +++ b/extensions/browser/extension_host.cc
@@ -80,6 +80,7 @@ ExtensionWebContentsObserver::GetForWebContents(host_contents())-> dispatcher()->set_delegate(this); + ExtensionHostRegistry::Get(browser_context_)->ExtensionHostCreated(this); } ExtensionHost::~ExtensionHost() { @@ -418,7 +419,8 @@ } void ExtensionHost::NotifyRenderProcessReady() { - ExtensionHostRegistry::Get(browser_context_)->ExtensionHostCreated(this); + ExtensionHostRegistry::Get(browser_context_) + ->ExtensionHostRenderProcessReady(this); } void ExtensionHost::RenderFrameDeleted(content::RenderFrameHost* frame_host) {
diff --git a/extensions/browser/extension_host_registry.cc b/extensions/browser/extension_host_registry.cc index de15a24..a7e79494 100644 --- a/extensions/browser/extension_host_registry.cc +++ b/extensions/browser/extension_host_registry.cc
@@ -83,54 +83,35 @@ DCHECK(!base::Contains(extension_hosts_, extension_host)); extension_hosts_.insert(extension_host); + // Note: There's not currently any observer method corresponding to host + // creation, because most systems and listeners care about the host being + // at a certain state of readiness. This is just to start properly + // tracking the host. +} + +void ExtensionHostRegistry::ExtensionHostRenderProcessReady( + ExtensionHost* extension_host) { + DCHECK(base::Contains(extension_hosts_, extension_host)); + for (Observer& observer : observers_) { observer.OnExtensionHostCreated(extension_host->browser_context(), extension_host); } } -void ExtensionHostRegistry::ExtensionHostDestroyed( - ExtensionHost* extension_host) { - // NOTE: We don't do - // - // DCHECK(base::Contains(extension_hosts_, extension_host); - // - // because the ExtensionHostCreated() signal is only fired when the - // renderer process has been initialized, and an ExtensionHost could - // be destroyed before that happens. - extension_hosts_.erase(extension_host); - - for (Observer& observer : observers_) { - observer.OnExtensionHostDestroyed(extension_host->browser_context(), - extension_host); - } -} - void ExtensionHostRegistry::ExtensionHostCompletedFirstLoad( ExtensionHost* extension_host) { - // NOTE: We can't do + DCHECK(base::Contains(extension_hosts_, extension_host)); + + // TODO(devlin): This can unexpectedly fire when a renderer process is + // terminating. When a renderer process is terminated, it causes the + // RenderFrameHostImpl to reset its loading state, which calls + // DidStopLoading() if it was loading. Then, if the first load never + // happened, ExtensionHost will fire the DidCompleteFirstLoad() notification. // - // DCHECK(base::Contains(extension_hosts_, extension_host); - // - // For a combination of convoluted reasons, which should probably change: - // 1) ExtensionHostCreated() is triggered when the renderer process has been - // initialized, rather than in its ctor. - // 2) When a renderer process is terminated, it causes the RenderFrameHostImpl - // to reset its loading state, which calls DidStopLoading() if it was - // loading. Then, if the first load never happened, ExtensionHost will fire - // the DidCompleteFirstLoad() notification. - // - // TODO(devlin): Both of these should be fixed. Since code is relying on the - // existing semantics of ExtensionHostCreated(), we should probably just - // rename it to be more clear (e.g., OnExtensionHostReady() or similar?). - // Issue 2) is more subtle, and is probably actually a behavioral bug. We - // should probably have ExtensionHost check whether the renderer is still - // around or whether the load succeeded before notifying observers, or at - // least indicate the success in the notification. - // - // Because of these issues, we instead insert the extension host here, if we - // weren't already tracking it. - extension_hosts_.insert(extension_host); + // This is probably a behavioral bug. We should have ExtensionHost check + // whether the renderer is still around or whether the load succeeded before + // notifying observers, or at least indicate the success in the notification. for (Observer& observer : observers_) { observer.OnExtensionHostCompletedFirstLoad( @@ -140,8 +121,7 @@ void ExtensionHostRegistry::ExtensionHostDocumentElementAvailable( ExtensionHost* extension_host) { - // See note in ExtensionHostCompletedFirstLoad(). - extension_hosts_.insert(extension_host); + DCHECK(base::Contains(extension_hosts_, extension_host)); for (Observer& observer : observers_) { observer.OnExtensionHostDocumentElementAvailable( @@ -149,6 +129,17 @@ } } +void ExtensionHostRegistry::ExtensionHostDestroyed( + ExtensionHost* extension_host) { + DCHECK(base::Contains(extension_hosts_, extension_host)); + extension_hosts_.erase(extension_host); + + for (Observer& observer : observers_) { + observer.OnExtensionHostDestroyed(extension_host->browser_context(), + extension_host); + } +} + void ExtensionHostRegistry::AddObserver(Observer* observer) { observers_.AddObserver(observer); }
diff --git a/extensions/browser/extension_host_registry.h b/extensions/browser/extension_host_registry.h index 1570f561..ead281c 100644 --- a/extensions/browser/extension_host_registry.h +++ b/extensions/browser/extension_host_registry.h
@@ -31,6 +31,9 @@ // RenderProcessHost is ready. The `browser_context` is the context // associated with that host (which might be an incognito version of // ExtensionHostRegistry::browser_context_). + // TODO(devlin): Rename this to OnExtensionHostRenderProcessReady(). It's + // not sent in response to the ExtensionHost construction, so it's + // misleading. virtual void OnExtensionHostCreated( content::BrowserContext* browser_context, ExtensionHost* host) {} @@ -77,18 +80,25 @@ // Retrieves the factory instance for the ExtensionHostRegistry. static BrowserContextKeyedServiceFactory* GetFactory(); - // Called when a new ExtensionHost is created, which starts tracking the host - // (in extension_hosts_) and notifies observers. + // Called when a new ExtensionHost is created, and starts tracking the host + // in `extension_hosts_`. void ExtensionHostCreated(ExtensionHost* extension_host); - // Called when an ExtensionHost is destroyed. Stops tracking the host and - // notifies observers. - void ExtensionHostDestroyed(ExtensionHost* extension_host); + + // Called when an ExtensionHost's corresponding renderer process is ready, and + // and notifies observers. + void ExtensionHostRenderProcessReady(ExtensionHost* extension_host); + // Called when an ExtensionHost completes its first load. void ExtensionHostCompletedFirstLoad(ExtensionHost* extension_host); + // Called when an ExtensionHost has created a document element for its first // time. void ExtensionHostDocumentElementAvailable(ExtensionHost* extension_host); + // Called when an ExtensionHost is destroyed. Stops tracking the host and + // notifies observers. + void ExtensionHostDestroyed(ExtensionHost* extension_host); + void AddObserver(Observer* observer); void RemoveObserver(Observer* observer);
diff --git a/gpu/ipc/service/gpu_channel_manager.cc b/gpu/ipc/service/gpu_channel_manager.cc index 3563b36d..f05a265 100644 --- a/gpu/ipc/service/gpu_channel_manager.cc +++ b/gpu/ipc/service/gpu_channel_manager.cc
@@ -798,11 +798,9 @@ gl::GLContextAttribs attribs = gles2::GenerateGLContextAttribs( ContextCreationAttribs(), use_passthrough_decoder); -#if !defined(OS_MAC) // Disable robust resource initialization for raster decoder and compositor. // TODO(crbug.com/1192632): disable robust_resource_initialization for // SwANGLE. - // TODO(crbug.com/1238413): disable robust_resource_initialization for Mac. // TODO(crbug.com/1116174): Currently disabling robust initialization is // breaking some tests with OOP canvas. Once that's fixed remove check for // kCanvasOopRasterization feature. @@ -811,7 +809,6 @@ !base::FeatureList::IsEnabled(features::kCanvasOopRasterization)) { attribs.robust_resource_initialization = false; } -#endif attribs.can_skip_validation = !enable_angle_validation;
diff --git "a/infra/config/generated/builders/ci/Linux Builder \050core-32\051 \050goma\051/properties.textpb" "b/infra/config/generated/builders/ci/Linux Builder \050core-32\051 \050goma\051/properties.textpb" deleted file mode 100644 index 61a7d93..0000000 --- "a/infra/config/generated/builders/ci/Linux Builder \050core-32\051 \050goma\051/properties.textpb" +++ /dev/null
@@ -1,24 +0,0 @@ -{ - "$build/goma": { - "enable_ats": true, - "jobs": 500, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true - }, - "$kitchen": { - "devshell": true, - "git_auth": true - }, - "$recipe_engine/isolated": { - "server": "https://isolateserver.appspot.com" - }, - "$recipe_engine/resultdb/test_presentation": { - "column_keys": [], - "grouping_keys": [ - "status", - "v.test_suite" - ] - }, - "recipe": "chromium" -} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/TSAN Release \050core-32\051 \050goma\051/properties.textpb" "b/infra/config/generated/builders/ci/TSAN Release \050core-32\051 \050goma\051/properties.textpb" deleted file mode 100644 index 74a2d4c..0000000 --- "a/infra/config/generated/builders/ci/TSAN Release \050core-32\051 \050goma\051/properties.textpb" +++ /dev/null
@@ -1,25 +0,0 @@ -{ - "$build/goma": { - "enable_ats": true, - "jobs": 250, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true - }, - "$kitchen": { - "devshell": true, - "emulate_gce": true, - "git_auth": true - }, - "$recipe_engine/isolated": { - "server": "https://isolateserver.appspot.com" - }, - "$recipe_engine/resultdb/test_presentation": { - "column_keys": [], - "grouping_keys": [ - "status", - "v.test_suite" - ] - }, - "recipe": "chromium" -} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/TSAN Release \050core-32\051 \050reclient\051/properties.textpb" "b/infra/config/generated/builders/ci/TSAN Release \050core-32\051 \050reclient\051/properties.textpb" deleted file mode 100644 index 3371d7f..0000000 --- "a/infra/config/generated/builders/ci/TSAN Release \050core-32\051 \050reclient\051/properties.textpb" +++ /dev/null
@@ -1,26 +0,0 @@ -{ - "$build/reclient": { - "instance": "rbe-chromium-trusted", - "jobs": 250, - "metrics_project": "chromium-reclient-metrics", - "rewrapper_env": { - "RBE_cache_silo": "TSAN Release (core-32) (reclient)" - } - }, - "$kitchen": { - "devshell": true, - "emulate_gce": true, - "git_auth": true - }, - "$recipe_engine/isolated": { - "server": "https://isolateserver.appspot.com" - }, - "$recipe_engine/resultdb/test_presentation": { - "column_keys": [], - "grouping_keys": [ - "status", - "v.test_suite" - ] - }, - "recipe": "chromium" -} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/Linux Builder \050core-32\051 \050reclient\051/properties.textpb" b/infra/config/generated/builders/ci/mac-arm64-on-arm64-rel-reclient/properties.textpb similarity index 96% rename from "infra/config/generated/builders/ci/Linux Builder \050core-32\051 \050reclient\051/properties.textpb" rename to infra/config/generated/builders/ci/mac-arm64-on-arm64-rel-reclient/properties.textpb index 98bf60a..e993df8 100644 --- "a/infra/config/generated/builders/ci/Linux Builder \050core-32\051 \050reclient\051/properties.textpb" +++ b/infra/config/generated/builders/ci/mac-arm64-on-arm64-rel-reclient/properties.textpb
@@ -1,7 +1,6 @@ { "$build/reclient": { "instance": "rbe-chromium-trusted", - "jobs": 500, "metrics_project": "chromium-reclient-metrics" }, "$kitchen": {
diff --git a/infra/config/generated/builders/try/linux-rel-orchestrator/properties.textpb b/infra/config/generated/builders/try/linux-rel-orchestrator/properties.textpb index e8af8a0..c0f8d64 100644 --- a/infra/config/generated/builders/try/linux-rel-orchestrator/properties.textpb +++ b/infra/config/generated/builders/try/linux-rel-orchestrator/properties.textpb
@@ -1,7 +1,7 @@ { "$build/chromium_orchestrator": { "compilator": "linux-rel-compilator", - "compilator_watcher_git_revision": "ac4c95a90ea18c8ce70865c667a04ba18dfca1cd" + "compilator_watcher_git_revision": "ecaab12e4a31e76701a25668cb71ae964189a341" }, "$build/code_coverage": { "coverage_test_types": [
diff --git a/infra/config/generated/builders/try/win10-rel-orchestrator/properties.textpb b/infra/config/generated/builders/try/win10-rel-orchestrator/properties.textpb index 658a4c9..d42d22e 100644 --- a/infra/config/generated/builders/try/win10-rel-orchestrator/properties.textpb +++ b/infra/config/generated/builders/try/win10-rel-orchestrator/properties.textpb
@@ -1,7 +1,7 @@ { "$build/chromium_orchestrator": { "compilator": "win10-rel-compilator", - "compilator_watcher_git_revision": "ac4c95a90ea18c8ce70865c667a04ba18dfca1cd" + "compilator_watcher_git_revision": "ecaab12e4a31e76701a25668cb71ae964189a341" }, "$build/code_coverage": { "coverage_test_types": [
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index 8681f001..fd69dd2b 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -10614,183 +10614,6 @@ } } builders { - name: "Linux Builder (core-32) (goma)" - swarming_host: "chromium-swarm.appspot.com" - swarming_tags: "vpython:native-python-wrapper" - dimensions: "builderless:1" - dimensions: "cores:32" - dimensions: "cpu:x86-64" - dimensions: "os:Ubuntu-18.04" - dimensions: "pool:luci.chromium.ci" - dimensions: "ssd:0" - exe { - cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" - cipd_version: "refs/heads/main" - cmd: "luciexe" - } - properties: - '{' - ' "$build/goma": {' - ' "enable_ats": true,' - ' "jobs": 500,' - ' "rpc_extra_params": "?prod",' - ' "server_host": "goma.chromium.org",' - ' "use_luci_auth": true' - ' },' - ' "$kitchen": {' - ' "devshell": true,' - ' "git_auth": true' - ' },' - ' "$recipe_engine/isolated": {' - ' "server": "https://isolateserver.appspot.com"' - ' },' - ' "$recipe_engine/resultdb/test_presentation": {' - ' "column_keys": [],' - ' "grouping_keys": [' - ' "status",' - ' "v.test_suite"' - ' ]' - ' },' - ' "builder_group": "chromium.fyi",' - ' "recipe": "chromium"' - '}' - execution_timeout_secs: 36000 - build_numbers: YES - service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" - experiments { - key: "chromium.chromium_tests.use_gitiles_trigger" - value: 100 - } - experiments { - key: "chromium.chromium_tests.use_rdb_results" - value: 100 - } - experiments { - key: "luci.use_realms" - value: 100 - } - resultdb { - enable: true - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "ci_test_results" - test_results {} - } - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "gpu_ci_test_results" - test_results { - predicate { - test_id_regexp: "ninja://(chrome/test:|content/test:fuchsia_)telemetry_gpu_integration_test[^/]*/.+" - } - } - } - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "blink_web_tests_ci_test_results" - test_results { - predicate { - test_id_regexp: "ninja://[^/]*blink_web_tests/.+" - } - } - } - history_options { - use_invocation_timestamp: true - } - } - } - builders { - name: "Linux Builder (core-32) (reclient)" - swarming_host: "chromium-swarm.appspot.com" - swarming_tags: "vpython:native-python-wrapper" - dimensions: "builderless:1" - dimensions: "cores:32" - dimensions: "cpu:x86-64" - dimensions: "os:Ubuntu-18.04" - dimensions: "pool:luci.chromium.ci" - dimensions: "ssd:0" - exe { - cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" - cipd_version: "refs/heads/main" - cmd: "luciexe" - } - properties: - '{' - ' "$build/reclient": {' - ' "instance": "rbe-chromium-trusted",' - ' "jobs": 500,' - ' "metrics_project": "chromium-reclient-metrics"' - ' },' - ' "$kitchen": {' - ' "devshell": true,' - ' "emulate_gce": true,' - ' "git_auth": true' - ' },' - ' "$recipe_engine/isolated": {' - ' "server": "https://isolateserver.appspot.com"' - ' },' - ' "$recipe_engine/resultdb/test_presentation": {' - ' "column_keys": [],' - ' "grouping_keys": [' - ' "status",' - ' "v.test_suite"' - ' ]' - ' },' - ' "builder_group": "chromium.fyi",' - ' "recipe": "chromium"' - '}' - execution_timeout_secs: 36000 - build_numbers: YES - service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" - experiments { - key: "chromium.chromium_tests.use_gitiles_trigger" - value: 100 - } - experiments { - key: "chromium.chromium_tests.use_rdb_results" - value: 100 - } - experiments { - key: "luci.use_realms" - value: 100 - } - resultdb { - enable: true - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "ci_test_results" - test_results {} - } - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "gpu_ci_test_results" - test_results { - predicate { - test_id_regexp: "ninja://(chrome/test:|content/test:fuchsia_)telemetry_gpu_integration_test[^/]*/.+" - } - } - } - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "blink_web_tests_ci_test_results" - test_results { - predicate { - test_id_regexp: "ninja://[^/]*blink_web_tests/.+" - } - } - } - history_options { - use_invocation_timestamp: true - } - } - } - builders { name: "Linux Builder (dbg)" swarming_host: "chromium-swarm.appspot.com" swarming_tags: "vpython:native-python-wrapper" @@ -18996,187 +18819,6 @@ } } builders { - name: "TSAN Release (core-32) (goma)" - swarming_host: "chromium-swarm.appspot.com" - swarming_tags: "vpython:native-python-wrapper" - dimensions: "builderless:1" - dimensions: "cores:32" - dimensions: "cpu:x86-64" - dimensions: "os:Ubuntu-18.04" - dimensions: "pool:luci.chromium.ci" - dimensions: "ssd:0" - exe { - cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" - cipd_version: "refs/heads/main" - cmd: "luciexe" - } - properties: - '{' - ' "$build/goma": {' - ' "enable_ats": true,' - ' "jobs": 250,' - ' "rpc_extra_params": "?prod",' - ' "server_host": "goma.chromium.org",' - ' "use_luci_auth": true' - ' },' - ' "$kitchen": {' - ' "devshell": true,' - ' "emulate_gce": true,' - ' "git_auth": true' - ' },' - ' "$recipe_engine/isolated": {' - ' "server": "https://isolateserver.appspot.com"' - ' },' - ' "$recipe_engine/resultdb/test_presentation": {' - ' "column_keys": [],' - ' "grouping_keys": [' - ' "status",' - ' "v.test_suite"' - ' ]' - ' },' - ' "builder_group": "chromium.fyi",' - ' "recipe": "chromium"' - '}' - execution_timeout_secs: 36000 - build_numbers: YES - service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" - experiments { - key: "chromium.chromium_tests.use_gitiles_trigger" - value: 100 - } - experiments { - key: "chromium.chromium_tests.use_rdb_results" - value: 100 - } - experiments { - key: "luci.use_realms" - value: 100 - } - resultdb { - enable: true - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "ci_test_results" - test_results {} - } - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "gpu_ci_test_results" - test_results { - predicate { - test_id_regexp: "ninja://(chrome/test:|content/test:fuchsia_)telemetry_gpu_integration_test[^/]*/.+" - } - } - } - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "blink_web_tests_ci_test_results" - test_results { - predicate { - test_id_regexp: "ninja://[^/]*blink_web_tests/.+" - } - } - } - history_options { - use_invocation_timestamp: true - } - } - } - builders { - name: "TSAN Release (core-32) (reclient)" - swarming_host: "chromium-swarm.appspot.com" - swarming_tags: "vpython:native-python-wrapper" - dimensions: "builderless:1" - dimensions: "cores:32" - dimensions: "cpu:x86-64" - dimensions: "os:Ubuntu-18.04" - dimensions: "pool:luci.chromium.ci" - dimensions: "ssd:0" - exe { - cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" - cipd_version: "refs/heads/main" - cmd: "luciexe" - } - properties: - '{' - ' "$build/reclient": {' - ' "instance": "rbe-chromium-trusted",' - ' "jobs": 250,' - ' "metrics_project": "chromium-reclient-metrics",' - ' "rewrapper_env": {' - ' "RBE_cache_silo": "TSAN Release (core-32) (reclient)"' - ' }' - ' },' - ' "$kitchen": {' - ' "devshell": true,' - ' "emulate_gce": true,' - ' "git_auth": true' - ' },' - ' "$recipe_engine/isolated": {' - ' "server": "https://isolateserver.appspot.com"' - ' },' - ' "$recipe_engine/resultdb/test_presentation": {' - ' "column_keys": [],' - ' "grouping_keys": [' - ' "status",' - ' "v.test_suite"' - ' ]' - ' },' - ' "builder_group": "chromium.fyi",' - ' "recipe": "chromium"' - '}' - execution_timeout_secs: 36000 - build_numbers: YES - service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" - experiments { - key: "chromium.chromium_tests.use_gitiles_trigger" - value: 100 - } - experiments { - key: "chromium.chromium_tests.use_rdb_results" - value: 100 - } - experiments { - key: "luci.use_realms" - value: 100 - } - resultdb { - enable: true - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "ci_test_results" - test_results {} - } - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "gpu_ci_test_results" - test_results { - predicate { - test_id_regexp: "ninja://(chrome/test:|content/test:fuchsia_)telemetry_gpu_integration_test[^/]*/.+" - } - } - } - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "blink_web_tests_ci_test_results" - test_results { - predicate { - test_id_regexp: "ninja://[^/]*blink_web_tests/.+" - } - } - } - history_options { - use_invocation_timestamp: true - } - } - } - builders { name: "TSAN Release (deps-cache) (reclient)" swarming_host: "chromium-swarm.appspot.com" swarming_tags: "vpython:native-python-wrapper" @@ -42219,6 +41861,92 @@ } } builders { + name: "mac-arm64-on-arm64-rel-reclient" + swarming_host: "chromium-swarm.appspot.com" + swarming_tags: "vpython:native-python-wrapper" + dimensions: "builderless:1" + dimensions: "cpu:arm64" + dimensions: "os:Mac-11" + dimensions: "pool:luci.chromium.ci" + exe { + cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" + cipd_version: "refs/heads/main" + cmd: "luciexe" + } + properties: + '{' + ' "$build/reclient": {' + ' "instance": "rbe-chromium-trusted",' + ' "metrics_project": "chromium-reclient-metrics"' + ' },' + ' "$kitchen": {' + ' "devshell": true,' + ' "emulate_gce": true,' + ' "git_auth": true' + ' },' + ' "$recipe_engine/isolated": {' + ' "server": "https://isolateserver.appspot.com"' + ' },' + ' "$recipe_engine/resultdb/test_presentation": {' + ' "column_keys": [],' + ' "grouping_keys": [' + ' "status",' + ' "v.test_suite"' + ' ]' + ' },' + ' "builder_group": "chromium.fyi",' + ' "recipe": "chromium"' + '}' + execution_timeout_secs: 36000 + build_numbers: YES + service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" + experiments { + key: "chromium.chromium_tests.use_gitiles_trigger" + value: 100 + } + experiments { + key: "chromium.chromium_tests.use_rdb_results" + value: 100 + } + experiments { + key: "luci.use_realms" + value: 100 + } + resultdb { + enable: true + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "ci_test_results" + test_results {} + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "gpu_ci_test_results" + test_results { + predicate { + test_id_regexp: "ninja://(chrome/test:|content/test:fuchsia_)telemetry_gpu_integration_test[^/]*/.+" + } + } + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "blink_web_tests_ci_test_results" + test_results { + predicate { + test_id_regexp: "ninja://[^/]*blink_web_tests/.+" + } + } + } + history_options { + use_invocation_timestamp: true + } + } + description_html: "experiment reclient on mac-arm. removed after the migration. crbug.com/1252626" + } + builders { name: "mac-arm64-rel" swarming_host: "chromium-swarm.appspot.com" swarming_tags: "vpython:native-python-wrapper" @@ -72869,7 +72597,7 @@ '{' ' "$build/chromium_orchestrator": {' ' "compilator": "linux-rel-compilator",' - ' "compilator_watcher_git_revision": "ac4c95a90ea18c8ce70865c667a04ba18dfca1cd"' + ' "compilator_watcher_git_revision": "ecaab12e4a31e76701a25668cb71ae964189a341"' ' },' ' "$build/code_coverage": {' ' "coverage_test_types": [' @@ -82109,7 +81837,7 @@ '{' ' "$build/chromium_orchestrator": {' ' "compilator": "win10-rel-compilator",' - ' "compilator_watcher_git_revision": "ac4c95a90ea18c8ce70865c667a04ba18dfca1cd"' + ' "compilator_watcher_git_revision": "ecaab12e4a31e76701a25668cb71ae964189a341"' ' },' ' "$build/code_coverage": {' ' "coverage_test_types": ['
diff --git a/infra/config/generated/luci/luci-milo.cfg b/infra/config/generated/luci/luci-milo.cfg index 8d8c3f5c..fd2b7b93 100644 --- a/infra/config/generated/luci/luci-milo.cfg +++ b/infra/config/generated/luci/luci-milo.cfg
@@ -6182,6 +6182,11 @@ short_name: "re" } builders { + name: "buildbucket/luci.chromium.ci/mac-arm64-on-arm64-rel-reclient" + category: "mac" + short_name: "re" + } + builders { name: "buildbucket/luci.chromium.ci/Mac deterministic" category: "deterministic|mac" short_name: "rel" @@ -6310,16 +6315,6 @@ category: "linux" } builders { - name: "buildbucket/luci.chromium.ci/Linux Builder (core-32) (goma)" - category: "linux" - short_name: "c32g" - } - builders { - name: "buildbucket/luci.chromium.ci/Linux Builder (core-32) (reclient)" - category: "linux" - short_name: "c32r" - } - builders { name: "buildbucket/luci.chromium.ci/Comparison Linux" category: "linux" short_name: "cmp" @@ -6547,16 +6542,6 @@ short_name: "dre" } builders { - name: "buildbucket/luci.chromium.ci/TSAN Release (core-32) (goma)" - category: "linux tsan" - short_name: "rre" - } - builders { - name: "buildbucket/luci.chromium.ci/TSAN Release (core-32) (reclient)" - category: "linux tsan" - short_name: "rre" - } - builders { name: "buildbucket/luci.chromium.ci/TSAN Release (deps-cache) (reclient)" category: "linux tsan" short_name: "rre"
diff --git a/infra/config/generated/luci/luci-scheduler.cfg b/infra/config/generated/luci/luci-scheduler.cfg index acaa289..ae62a9d 100644 --- a/infra/config/generated/luci/luci-scheduler.cfg +++ b/infra/config/generated/luci/luci-scheduler.cfg
@@ -1590,28 +1590,6 @@ } } job { - id: "Linux Builder (core-32) (goma)" - realm: "ci" - schedule: "triggered" - acl_sets: "ci" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Builder (core-32) (goma)" - } -} -job { - id: "Linux Builder (core-32) (reclient)" - realm: "ci" - schedule: "triggered" - acl_sets: "ci" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "Linux Builder (core-32) (reclient)" - } -} -job { id: "Linux Builder (dbg)" realm: "ci" acl_sets: "ci" @@ -2867,28 +2845,6 @@ } } job { - id: "TSAN Release (core-32) (goma)" - realm: "ci" - schedule: "triggered" - acl_sets: "ci" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "TSAN Release (core-32) (goma)" - } -} -job { - id: "TSAN Release (core-32) (reclient)" - realm: "ci" - schedule: "triggered" - acl_sets: "ci" - buildbucket { - server: "cr-buildbucket.appspot.com" - bucket: "luci.chromium.ci" - builder: "TSAN Release (core-32) (reclient)" - } -} -job { id: "TSAN Release (deps-cache) (reclient)" realm: "ci" acl_sets: "ci" @@ -6258,6 +6214,16 @@ } } job { + id: "mac-arm64-on-arm64-rel-reclient" + realm: "ci" + acl_sets: "ci" + buildbucket { + server: "cr-buildbucket.appspot.com" + bucket: "luci.chromium.ci" + builder: "mac-arm64-on-arm64-rel-reclient" + } +} +job { id: "mac-arm64-rel" realm: "ci" acl_sets: "ci" @@ -7259,8 +7225,6 @@ triggers: "Libfuzzer Upload Windows ASan" triggers: "Linux ASan LSan Builder" triggers: "Linux Builder" - triggers: "Linux Builder (core-32) (goma)" - triggers: "Linux Builder (core-32) (reclient)" triggers: "Linux Builder (dbg)" triggers: "Linux Builder (dbg)(32)" triggers: "Linux Builder (deps-cache) (reclient)" @@ -7299,8 +7263,6 @@ triggers: "TSAN Debug" triggers: "TSAN Debug (reclient)" triggers: "TSAN Release" - triggers: "TSAN Release (core-32) (goma)" - triggers: "TSAN Release (core-32) (reclient)" triggers: "TSAN Release (deps-cache) (reclient)" triggers: "TSAN Release (g-ip) (reclient)" triggers: "TSAN Release (j-250) (reclient)" @@ -7493,6 +7455,7 @@ triggers: "mac-arm64-archive-dbg" triggers: "mac-arm64-archive-rel" triggers: "mac-arm64-on-arm64-rel" + triggers: "mac-arm64-on-arm64-rel-reclient" triggers: "mac-arm64-rel" triggers: "mac-code-coverage" triggers: "mac-hermetic-upgrade-rel"
diff --git a/infra/config/lib/builders.star b/infra/config/lib/builders.star index cfe88dc..d888199 100644 --- a/infra/config/lib/builders.star +++ b/infra/config/lib/builders.star
@@ -192,7 +192,7 @@ # Git revision of the compilator_watcher luciexe sub_build binary for chromium # orchestrators to use -compilator_watcher_git_revision = "ac4c95a90ea18c8ce70865c667a04ba18dfca1cd" +compilator_watcher_git_revision = "ecaab12e4a31e76701a25668cb71ae964189a341" ################################################################################ # Implementation details #
diff --git a/infra/config/subprojects/chromium/ci.star b/infra/config/subprojects/chromium/ci.star index a6acd4c..ef0e995 100644 --- a/infra/config/subprojects/chromium/ci.star +++ b/infra/config/subprojects/chromium/ci.star
@@ -3899,35 +3899,6 @@ ) ci.fyi_builder( - name = "Linux Builder (core-32) (goma)", - console_view_entry = consoles.console_view_entry( - category = "linux", - short_name = "c32g", - ), - cores = 32, - goma_jobs = 500, - configure_kitchen = True, - os = os.LINUX_BIONIC_SWITCH_TO_DEFAULT, - schedule = "triggered", -) - -ci.fyi_builder( - name = "Linux Builder (core-32) (reclient)", - console_view_entry = consoles.console_view_entry( - category = "linux", - short_name = "c32r", - ), - cores = 32, - goma_backend = None, - reclient_instance = rbe_instance.DEFAULT, - reclient_jobs = 500, - configure_kitchen = True, - kitchen_emulate_gce = True, - os = os.LINUX_BIONIC_SWITCH_TO_DEFAULT, - schedule = "triggered", -) - -ci.fyi_builder( name = "Linux Builder (deps-cache) (reclient)", console_view_entry = consoles.console_view_entry( category = "linux", @@ -4025,37 +3996,6 @@ ) ci.fyi_builder( - name = "TSAN Release (core-32) (goma)", - console_view_entry = consoles.console_view_entry( - category = "linux tsan", - short_name = "rre", - ), - cores = 32, - goma_jobs = 250, - configure_kitchen = True, - kitchen_emulate_gce = True, - os = os.LINUX_BIONIC_SWITCH_TO_DEFAULT, - schedule = "triggered", # triggered manually via Scheduler UI -) - -ci.fyi_builder( - name = "TSAN Release (core-32) (reclient)", - console_view_entry = consoles.console_view_entry( - category = "linux tsan", - short_name = "rre", - ), - cores = 32, - goma_backend = None, - reclient_instance = rbe_instance.DEFAULT, - reclient_jobs = 250, - reclient_rewrapper_env = {"RBE_cache_silo": "TSAN Release (core-32) (reclient)"}, - configure_kitchen = True, - kitchen_emulate_gce = True, - os = os.LINUX_BIONIC_SWITCH_TO_DEFAULT, - schedule = "triggered", # triggered manually via Scheduler UI -) - -ci.fyi_builder( name = "TSAN Release (deps-cache) (reclient)", console_view_entry = consoles.console_view_entry( category = "linux tsan", @@ -4216,6 +4156,25 @@ description_html = "experiment reclient on mac. removed after the migration. crbug.com/1244441", ) +ci.fyi_mac_builder( + name = "mac-arm64-on-arm64-rel-reclient", + builderless = True, + + # same with mac-arm64-on-arm64-rel + cores = None, # crbug.com/1245114 + cpu = cpu.ARM64, + os = os.MAC_11, + console_view_entry = consoles.console_view_entry( + category = "mac", + short_name = "re", + ), + goma_backend = None, + reclient_instance = rbe_instance.DEFAULT, + configure_kitchen = True, + kitchen_emulate_gce = True, + description_html = "experiment reclient on mac-arm. removed after the migration. crbug.com/1252626", +) + ci.fyi_builder( name = "chromeos-amd64-generic-rel (goma cache silo)", console_view_entry = consoles.console_view_entry(
diff --git a/ios/chrome/browser/credential_provider/credential_provider_service.h b/ios/chrome/browser/credential_provider/credential_provider_service.h index ecde9d8..a7839346 100644 --- a/ios/chrome/browser/credential_provider/credential_provider_service.h +++ b/ios/chrome/browser/credential_provider/credential_provider_service.h
@@ -7,8 +7,8 @@ #include "base/memory/ref_counted.h" #include "components/keyed_service/core/keyed_service.h" -#include "components/password_manager/core/browser/password_store.h" #include "components/password_manager/core/browser/password_store_consumer.h" +#include "components/password_manager/core/browser/password_store_interface.h" #include "components/prefs/pref_member.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "components/sync/driver/sync_service_observer.h" @@ -36,7 +36,7 @@ // Initializes the service. CredentialProviderService( PrefService* prefs, - scoped_refptr<password_manager::PasswordStore> password_store, + scoped_refptr<password_manager::PasswordStoreInterface> password_store, AuthenticationService* authentication_service, id<MutableCredentialStore> credential_store, signin::IdentityManager* identity_manager, @@ -114,7 +114,7 @@ void OnSavingPasswordsEnabledChanged(); // The interface for getting and manipulating a user's saved passwords. - scoped_refptr<password_manager::PasswordStore> password_store_; + scoped_refptr<password_manager::PasswordStoreInterface> password_store_; // The interface for getting the primary account identifier. AuthenticationService* authentication_service_ = nullptr;
diff --git a/ios/chrome/browser/credential_provider/credential_provider_service.mm b/ios/chrome/browser/credential_provider/credential_provider_service.mm index 335800ed..835ee42 100644 --- a/ios/chrome/browser/credential_provider/credential_provider_service.mm +++ b/ios/chrome/browser/credential_provider/credential_provider_service.mm
@@ -39,9 +39,9 @@ using password_manager::PasswordForm; using password_manager::AffiliatedMatchHelper; -using password_manager::PasswordStore; using password_manager::PasswordStoreChange; using password_manager::PasswordStoreChangeList; +using password_manager::PasswordStoreInterface; using password_manager::AffiliationService; // ASCredentialIdentityStoreError enum to report UMA metrics. Must be in sync @@ -133,7 +133,7 @@ CredentialProviderService::CredentialProviderService( PrefService* prefs, - scoped_refptr<PasswordStore> password_store, + scoped_refptr<PasswordStoreInterface> password_store, AuthenticationService* authentication_service, id<MutableCredentialStore> credential_store, signin::IdentityManager* identity_manager,
diff --git a/ios/chrome/browser/credential_provider/credential_provider_service_factory.mm b/ios/chrome/browser/credential_provider/credential_provider_service_factory.mm index d665dfb..35ba067 100644 --- a/ios/chrome/browser/credential_provider/credential_provider_service_factory.mm +++ b/ios/chrome/browser/credential_provider/credential_provider_service_factory.mm
@@ -53,8 +53,8 @@ web::BrowserState* context) const { ChromeBrowserState* browser_state = ChromeBrowserState::FromBrowserState(context); - scoped_refptr<password_manager::PasswordStore> password_store = - IOSChromePasswordStoreFactory::GetForBrowserState( + scoped_refptr<password_manager::PasswordStoreInterface> password_store = + IOSChromePasswordStoreFactory::GetInterfaceForBrowserState( browser_state, ServiceAccessType::IMPLICIT_ACCESS); AuthenticationService* authentication_service = AuthenticationServiceFactory::GetForBrowserState(browser_state);
diff --git a/ios/chrome/browser/passwords/ios_chrome_password_reuse_manager_factory.cc b/ios/chrome/browser/passwords/ios_chrome_password_reuse_manager_factory.cc index df35859..7e587ef 100644 --- a/ios/chrome/browser/passwords/ios_chrome_password_reuse_manager_factory.cc +++ b/ios/chrome/browser/passwords/ios_chrome_password_reuse_manager_factory.cc
@@ -9,7 +9,7 @@ #include "components/keyed_service/core/service_access_type.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/password_manager/core/browser/password_reuse_manager_impl.h" -#include "components/password_manager/core/browser/password_store.h" +#include "components/password_manager/core/browser/password_store_interface.h" #include "components/password_manager/core/common/password_manager_features.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" @@ -55,10 +55,11 @@ std::unique_ptr<password_manager::PasswordReuseManager> reuse_manager = std::make_unique<password_manager::PasswordReuseManagerImpl>(); - reuse_manager->Init(ChromeBrowserState::FromBrowserState(context)->GetPrefs(), - IOSChromePasswordStoreFactory::GetForBrowserState( - browser_state, ServiceAccessType::EXPLICIT_ACCESS) - .get()); + reuse_manager->Init( + ChromeBrowserState::FromBrowserState(context)->GetPrefs(), + IOSChromePasswordStoreFactory::GetInterfaceForBrowserState( + browser_state, ServiceAccessType::EXPLICIT_ACCESS) + .get()); return reuse_manager; }
diff --git a/ios/chrome/browser/passwords/password_store_observer_bridge.h b/ios/chrome/browser/passwords/password_store_observer_bridge.h index 70bfdfc..033f7ac22 100644 --- a/ios/chrome/browser/passwords/password_store_observer_bridge.h +++ b/ios/chrome/browser/passwords/password_store_observer_bridge.h
@@ -7,7 +7,7 @@ #import <Foundation/Foundation.h> -#include "components/password_manager/core/browser/password_store.h" +#include "components/password_manager/core/browser/password_store_interface.h" // Protocol to observe changes on the Password Store. @protocol PasswordStoreObserver <NSObject>
diff --git a/ios/chrome/browser/ui/ntp/BUILD.gn b/ios/chrome/browser/ui/ntp/BUILD.gn index 0d198e1..d009f221 100644 --- a/ios/chrome/browser/ui/ntp/BUILD.gn +++ b/ios/chrome/browser/ui/ntp/BUILD.gn
@@ -5,6 +5,7 @@ source_set("ntp") { sources = [ "discover_feed_delegate.h", + "discover_feed_preview_delegate.h", "new_tab_page_commands.h", "new_tab_page_content_delegate.h", "new_tab_page_controller_delegate.h", @@ -14,6 +15,7 @@ public_deps = [ ":constants", ":feature_flags", + "//ios/chrome/browser/ui/ntp/discover_feed_preview", ] deps = [ "//ios/chrome/browser/ui/util" ] }
diff --git a/ios/chrome/browser/ui/ntp/discover_feed_preview_delegate.h b/ios/chrome/browser/ui/ntp/discover_feed_preview_delegate.h new file mode 100644 index 0000000..2f2ee8a2 --- /dev/null +++ b/ios/chrome/browser/ui/ntp/discover_feed_preview_delegate.h
@@ -0,0 +1,10 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_NTP_DISCOVER_FEED_PREVIEW_DELEGATE_H_ +#define IOS_CHROME_BROWSER_UI_NTP_DISCOVER_FEED_PREVIEW_DELEGATE_H_ + +#import "ios/chrome/browser/ui/ntp/discover_feed_preview/discover_feed_preview_delegate.h" + +#endif // IOS_CHROME_BROWSER_UI_NTP_DISCOVER_FEED_PREVIEW_DELEGATE_H_
diff --git a/ios/third_party/native_closure_compiler/.gitignore b/ios/third_party/native_closure_compiler/.gitignore new file mode 100644 index 0000000..86a7c8e --- /dev/null +++ b/ios/third_party/native_closure_compiler/.gitignore
@@ -0,0 +1 @@ +compiler
diff --git a/ios/web/js_compile.gni b/ios/web/js_compile.gni index af2edf0..2c9e64c4 100644 --- a/ios/web/js_compile.gni +++ b/ios/web/js_compile.gni
@@ -2,15 +2,13 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/util/java_action.gni") - declare_args() { # Control whether the JavaScript files shipped with Chrome on iOS are # compiled with closure_compiler or not. Useful for debugging. compile_javascript = true } -closure_compiler_path = "//third_party/closure_compiler/compiler/compiler.jar" +closure_compiler_path = "//ios/third_party/native_closure_compiler/compiler" # Defines a target that create a JavaScript bundle using the closure compiler. # @@ -45,10 +43,10 @@ _target_name = target_name compile_js_target_name = target_name + "_compile_js" - java_action(compile_js_target_name) { + action(compile_js_target_name) { visibility = [ ":$_target_name" ] forward_variables_from(invoker, [ "testonly" ]) - script = closure_compiler_path + script = "//build/gn_run_binary.py" sources = invoker.sources outputs = [ "$target_gen_dir/$_target_name.js" ] @@ -60,6 +58,7 @@ } args = _additional_args + [ + rebase_path(closure_compiler_path, root_build_dir), "--compilation_level", "SIMPLE_OPTIMIZATIONS", "--js_output_file", @@ -120,10 +119,10 @@ _target_name = target_name compile_js_target_name = target_name + "_compile_js" - java_action_foreach(compile_js_target_name) { + action_foreach(compile_js_target_name) { visibility = [ ":$_target_name" ] forward_variables_from(invoker, [ "testonly" ]) - script = closure_compiler_path + script = "//build/gn_run_binary.py" sources = invoker.sources _js_modules = [] if (defined(invoker.js_modules)) { @@ -133,6 +132,7 @@ outputs = [ "$target_gen_dir/{{source_file_part}}" ] args = [ + rebase_path(closure_compiler_path, root_build_dir), "--compilation_level", "SIMPLE_OPTIMIZATIONS", "--jscomp_error=checkTypes", @@ -232,14 +232,15 @@ _target_name = target_name compile_js_target_name = target_name + "_compile_js" - java_action_foreach(compile_js_target_name) { + action_foreach(compile_js_target_name) { visibility = [ ":$_target_name" ] forward_variables_from(invoker, [ "testonly" ]) - script = closure_compiler_path + script = "//build/gn_run_binary.py" sources = invoker.sources outputs = [ "$target_gen_dir/{{source_file_part}}" ] args = [ + rebase_path(closure_compiler_path, root_build_dir), "--compilation_level", "SIMPLE_OPTIMIZATIONS", "--js",
diff --git a/ios/web/test/fakes/BUILD.gn b/ios/web/test/fakes/BUILD.gn index f7632fd..6fa1fcb1 100644 --- a/ios/web/test/fakes/BUILD.gn +++ b/ios/web/test/fakes/BUILD.gn
@@ -33,8 +33,6 @@ "crw_fake_wk_frame_info.mm", "crw_fake_wk_navigation_action.h", "crw_fake_wk_navigation_action.mm", - "crw_fake_wk_navigation_response.h", - "crw_fake_wk_navigation_response.mm", "fake_java_script_feature.h", "fake_java_script_feature.mm", "fake_navigation_manager_delegate.h",
diff --git a/ios/web/test/fakes/crw_fake_wk_navigation_response.h b/ios/web/test/fakes/crw_fake_wk_navigation_response.h deleted file mode 100644 index e75b161..0000000 --- a/ios/web/test/fakes/crw_fake_wk_navigation_response.h +++ /dev/null
@@ -1,18 +0,0 @@ -// Copyright 2017 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 IOS_WEB_TEST_FAKES_CRW_FAKE_WK_NAVIGATION_RESPONSE_H_ -#define IOS_WEB_TEST_FAKES_CRW_FAKE_WK_NAVIGATION_RESPONSE_H_ - -#import <WebKit/WebKit.h> - -// Fake WKNavigationResponse class which can be used for testing. -@interface CRWFakeWKNavigationResponse : WKNavigationResponse -// Redefined WKNavigationResponse properties as readwrite. -@property(nonatomic, getter=isForMainFrame) BOOL forMainFrame; -@property(nonatomic, copy) NSURLResponse* response; -@property(nonatomic) BOOL canShowMIMEType; -@end - -#endif // IOS_WEB_TEST_FAKES_CRW_FAKE_WK_NAVIGATION_RESPONSE_H_
diff --git a/ios/web/test/fakes/crw_fake_wk_navigation_response.mm b/ios/web/test/fakes/crw_fake_wk_navigation_response.mm deleted file mode 100644 index 084341d..0000000 --- a/ios/web/test/fakes/crw_fake_wk_navigation_response.mm +++ /dev/null
@@ -1,15 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "ios/web/test/fakes/crw_fake_wk_navigation_response.h" - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -@implementation CRWFakeWKNavigationResponse -@synthesize forMainFrame = _forMainFrame; -@synthesize response = _response; -@synthesize canShowMIMEType = _canShowMIMEType; -@end
diff --git a/ios/web/web_state/ui/crw_web_controller_unittest.mm b/ios/web/web_state/ui/crw_web_controller_unittest.mm index 4bae3da2..c1b5554 100644 --- a/ios/web/web_state/ui/crw_web_controller_unittest.mm +++ b/ios/web/web_state/ui/crw_web_controller_unittest.mm
@@ -45,7 +45,6 @@ #import "ios/web/test/fakes/crw_fake_back_forward_list.h" #import "ios/web/test/fakes/crw_fake_wk_frame_info.h" #import "ios/web/test/fakes/crw_fake_wk_navigation_action.h" -#import "ios/web/test/fakes/crw_fake_wk_navigation_response.h" #include "ios/web/test/test_url_constants.h" #import "ios/web/test/web_test_with_web_controller.h" #import "ios/web/test/wk_web_view_crash_utils.h" @@ -527,11 +526,12 @@ BOOL for_main_frame, BOOL can_show_mime_type, WKNavigationResponsePolicy* out_policy) WARN_UNUSED_RESULT { - CRWFakeWKNavigationResponse* navigation_response = - [[CRWFakeWKNavigationResponse alloc] init]; - navigation_response.response = response; - navigation_response.forMainFrame = for_main_frame; - navigation_response.canShowMIMEType = can_show_mime_type; + id navigation_response = + [OCMockObject mockForClass:[WKNavigationResponse class]]; + OCMStub([navigation_response response]).andReturn(response); + OCMStub([navigation_response isForMainFrame]).andReturn(for_main_frame); + OCMStub([navigation_response canShowMIMEType]) + .andReturn(can_show_mime_type); // Call decidePolicyForNavigationResponse and wait for decisionHandler's // callback.
diff --git a/net/BUILD.gn b/net/BUILD.gn index d6ceb47..7277466 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -4444,6 +4444,7 @@ sources += [ "base/network_change_notifier_win_unittest.cc", "base/network_interfaces_win_unittest.cc", + "cert/cert_verify_proc_win_unittest.cc", "http/http_auth_sspi_win_unittest.cc", "http/mock_sspi_library_win.cc", "http/mock_sspi_library_win.h",
diff --git a/net/cert/cert_verify_proc_mac.h b/net/cert/cert_verify_proc_mac.h index fcf882b..84ea532 100644 --- a/net/cert/cert_verify_proc_mac.h +++ b/net/cert/cert_verify_proc_mac.h
@@ -5,6 +5,8 @@ #ifndef NET_CERT_CERT_VERIFY_PROC_MAC_H_ #define NET_CERT_CERT_VERIFY_PROC_MAC_H_ +#include <vector> + #include "base/supports_user_data.h" #include "net/base/net_export.h" #include "net/cert/cert_verify_proc.h" @@ -13,11 +15,11 @@ // Performs certificate path construction and validation using OS X's // Security.framework. -class NET_EXPORT_PRIVATE CertVerifyProcMac : public CertVerifyProc { +class NET_EXPORT CertVerifyProcMac : public CertVerifyProc { public: - class ResultDebugData : public base::SupportsUserData::Data { + class NET_EXPORT ResultDebugData : public base::SupportsUserData::Data { public: - struct CertEvidenceInfo { + struct NET_EXPORT CertEvidenceInfo { CertEvidenceInfo(); ~CertEvidenceInfo(); CertEvidenceInfo(const CertEvidenceInfo&);
diff --git a/net/cert/cert_verify_proc_win.cc b/net/cert/cert_verify_proc_win.cc index e5117c4f..f3ec5d6c 100644 --- a/net/cert/cert_verify_proc_win.cc +++ b/net/cert/cert_verify_proc_win.cc
@@ -7,14 +7,19 @@ #include <algorithm> #include <memory> #include <string> -#include <vector> +#include "base/bind.h" #include "base/cxx17_backports.h" #include "base/memory/free_deleter.h" #include "base/metrics/histogram_macros.h" +#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/synchronization/lock.h" +#include "base/task/thread_pool.h" #include "base/threading/thread_local.h" +#include "base/threading/thread_task_runner_handle.h" +#include "base/win/registry.h" #include "base/win/windows_version.h" #include "crypto/capi_util.h" #include "crypto/scoped_capi_types.h" @@ -42,6 +47,8 @@ namespace { +const void* kResultDebugDataKey = &kResultDebugDataKey; + int MapSecurityError(SECURITY_STATUS err) { // There are numerous security error codes, but these are the ones we thus // far find interesting. @@ -837,8 +844,218 @@ ~ScopedThreadLocalCRLSet() { g_revocation_injector.Get().SetCRLSet(nullptr); } }; +// Helper class to determine the current version of AuthRoot, as stored in the +// registry. Because calling `RegNotifyChangeKeyValue` associates the event +// with the current thread, and `CertVerifyProc` exists to be used on +// short-lived worker threads, this class handles the thread management to +// ensure a cached, current value is always available. +class AuthRootVersionChecker { + public: + struct AuthRootVersion { + // The sequence number of the CTL. + // Note: This is sorted big endian, similar to the encoded representation, + // and not little-endian, like CRYPT_INTEGER_BLOBs are stored by Windows. + std::vector<uint8_t> sequence_number; + + // The ThisUpdate of the AuthRoot CTL. + // Note: If the AuthRoot version could not be determined, this will be the + // default time, and is_null() will return true. + base::Time this_update; + }; + + // Initializes the AuthRootVersionChecker. Note that this will open a + // registry key on the current thread, which is expected to be persistent, + // and begin monitoring for changes. This can be simplified once Windows 7 + // support is dropped. + AuthRootVersionChecker(); + + // Returns the current (potentially cached) version details from the + // AuthRoot stored in the registry (if any). + AuthRootVersion GetAuthRootVersion(); + + private: + ~AuthRootVersionChecker() = default; + + // Begins monitoring the registry for subsequent changes (e.g. to refresh + // the cached value). + void RefreshWatch(); + + // Returns true if the currently cached value may be stale and requires + // re-processing. If it returns true, the caller is responsible for calling + // `UpdateAuthRootVersion()` and `RefreshWatch()` (in any order). + bool ShouldUpdate() EXCLUSIVE_LOCKS_REQUIRED(lock_); + + // Updates the current AuthRoot version, which may block due to reading + // the registry and parsing AuthRoot. Should only be called on a worker, + // and while holding `lock_`. + void UpdateAuthRootVersion() EXCLUSIVE_LOCKS_REQUIRED(lock_); + + base::win::RegKey key_; + + // On >= Win 8, the event signalled by Windows whenever the registry has + // changed. + const base::win::ScopedHandle event_; + + base::Lock lock_; + AuthRootVersion auth_root_version_ GUARDED_BY(lock_); + + // On <= Win 7, stores the last update time of the registry key; used to + // avoid needing to constantly reparse the registry value. + base::Time last_update_ GUARDED_BY(lock_); +}; + +AuthRootVersionChecker::AuthRootVersionChecker() + : event_(CreateEvent(nullptr, FALSE, TRUE, nullptr)) { + DCHECK(event_.IsValid()); + + constexpr wchar_t kAuthRootPath[] = + L"SOFTWARE\\Microsoft\\SystemCertificates\\AuthRoot\\AutoUpdate"; + if (key_.Open(HKEY_LOCAL_MACHINE, kAuthRootPath, KEY_READ) != ERROR_SUCCESS) + return; + + // On Win 7, last_update_ is the zero time, and thus will dirty the cache. + // On Win 8+, event_ is initially signalled, simulating a dirty cache. +} + +AuthRootVersionChecker::AuthRootVersion +AuthRootVersionChecker::GetAuthRootVersion() { + base::AutoLock guard(lock_); + + if (ShouldUpdate()) { + UpdateAuthRootVersion(); + RefreshWatch(); + } + + return auth_root_version_; +} + +void AuthRootVersionChecker::RefreshWatch() { + // If the registry is corrupted, don't bother. + if (!key_.Valid()) + return; + + if (base::win::GetVersion() < base::win::Version::WIN8) { + // On Windows 7 and earlier, using RegNotifyChangeKeyValue from a worker + // thread will abandon the notification if that thread ends. Rather than + // marshalling to a persistent thread, on these versions, `ShouldUpdate()` + // just takes a less-optimized path. + return; + } + + // On Windows 8 or later, any thread can monitor the registry for changes, + // and monitoring is not abandoned if the thread ends. + DWORD flags = REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_THREAD_AGNOSTIC; + RegNotifyChangeKeyValue(key_.Handle(), FALSE, flags, event_.Get(), TRUE); +} + +bool AuthRootVersionChecker::ShouldUpdate() { + lock_.AssertAcquired(); + + // If the registry is corrupted, don't bother. + if (!key_.Valid()) + return false; + + if (base::win::GetVersion() >= base::win::Version::WIN8) { + // On Win 8+, just check if the event is signaled. + return WaitForSingleObject(event_.Get(), 0) == WAIT_OBJECT_0; + } + + // On Win 7 and earlier, check the last modification time of the registry. + // This is less efficient than using the event, but a simpler implementation + // than needing to marshal RegNotifyChangeKeyValue to a persistent thread. + FILETIME current_timestamp = {0, 0}; + LSTATUS result = RegQueryInfoKeyW(key_.Handle(), nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, ¤t_timestamp); + + // If for some reason things failed, rather than constantly querying the + // registry every time, fail closed and just use the stale value. + if (result != ERROR_SUCCESS) + return false; + + base::Time update_time = base::Time::FromFileTime(current_timestamp); + if (update_time > last_update_) { + last_update_ = update_time; + return true; + } + return false; +} + +void AuthRootVersionChecker::UpdateAuthRootVersion() { + lock_.AssertAcquired(); + + if (!key_.Valid()) + return; + + constexpr wchar_t kCtlValueName[] = L"EncodedCtl"; + + DWORD data_type = REG_BINARY; + DWORD value_size = 0; + LONG rv = key_.ReadValue(kCtlValueName, nullptr, &value_size, &data_type); + if (rv != ERROR_SUCCESS || !value_size || data_type != REG_BINARY) + return; + + std::vector<uint8_t> value(value_size); + rv = key_.ReadValue(kCtlValueName, value.data(), &value_size, &data_type); + if (rv != ERROR_SUCCESS || value_size == 0 || data_type != REG_BINARY) + return; + + value.resize(value_size); + + crypto::ScopedPCCTL_CONTEXT ctl_context( + CertCreateCTLContext(PKCS_7_ASN_ENCODING, value.data(), value.size())); + if (!ctl_context || ctl_context->pCtlInfo->SequenceNumber.cbData == 0) + return; + + auth_root_version_.sequence_number.assign( + ctl_context->pCtlInfo->SequenceNumber.pbData, + ctl_context->pCtlInfo->SequenceNumber.pbData + + ctl_context->pCtlInfo->SequenceNumber.cbData); + // Convert from Windows' little-endian representation to the expected (as + // encoded) big-endian form. + std::reverse(std::begin(auth_root_version_.sequence_number), + std::end(auth_root_version_.sequence_number)); + auth_root_version_.this_update = + base::Time::FromFileTime(ctl_context->pCtlInfo->ThisUpdate); +} + } // namespace +CertVerifyProcWin::ResultDebugData::ResultDebugData( + base::Time authroot_this_update, + std::vector<uint8_t> authroot_sequence_number) + : authroot_this_update_(authroot_this_update), + authroot_sequence_number_(std::move(authroot_sequence_number)) {} + +CertVerifyProcWin::ResultDebugData::ResultDebugData( + const ResultDebugData& other) = default; + +CertVerifyProcWin::ResultDebugData::~ResultDebugData() = default; + +// static +const CertVerifyProcWin::ResultDebugData* +CertVerifyProcWin::ResultDebugData::Get( + const base::SupportsUserData* debug_data) { + return static_cast<ResultDebugData*>( + debug_data->GetUserData(kResultDebugDataKey)); +} + +// static +void CertVerifyProcWin::ResultDebugData::Create( + base::Time authroot_this_update, + std::vector<uint8_t> authroot_sequence_number, + base::SupportsUserData* debug_data) { + debug_data->SetUserData( + kResultDebugDataKey, + std::make_unique<ResultDebugData>(authroot_this_update, + std::move(authroot_sequence_number))); +} + +std::unique_ptr<base::SupportsUserData::Data> +CertVerifyProcWin::ResultDebugData::Clone() { + return std::make_unique<ResultDebugData>(*this); +} + CertVerifyProcWin::CertVerifyProcWin() {} CertVerifyProcWin::~CertVerifyProcWin() {} @@ -1017,6 +1234,14 @@ return MapSecurityError(GetLastError()); } + // Include diagnostics about the current AuthRoot version. + static base::NoDestructor<AuthRootVersionChecker> authroot_version_checker; + AuthRootVersionChecker::AuthRootVersion authroot_version = + authroot_version_checker->GetAuthRootVersion(); + ResultDebugData::Create(std::move(authroot_version.this_update), + std::move(authroot_version.sequence_number), + verify_result); + // Perform a second check with CRLSets. Although the Revocation Provider // should have prevented invalid paths from being built, the behaviour and // timing of how a Revocation Provider is invoked is not well documented. This
diff --git a/net/cert/cert_verify_proc_win.h b/net/cert/cert_verify_proc_win.h index 49e15438..d79c788 100644 --- a/net/cert/cert_verify_proc_win.h +++ b/net/cert/cert_verify_proc_win.h
@@ -5,14 +5,58 @@ #ifndef NET_CERT_CERT_VERIFY_PROC_WIN_H_ #define NET_CERT_CERT_VERIFY_PROC_WIN_H_ +#include "stdint.h" + +#include <vector> + +#include "base/supports_user_data.h" +#include "base/time/time.h" #include "net/cert/cert_verify_proc.h" namespace net { // Performs certificate path construction and validation using Windows' // CryptoAPI. -class NET_EXPORT_PRIVATE CertVerifyProcWin : public CertVerifyProc { +class NET_EXPORT CertVerifyProcWin : public CertVerifyProc { public: + // Diagnostic data related to Windows cert validation. + class NET_EXPORT ResultDebugData : public base::SupportsUserData::Data { + public: + ResultDebugData(base::Time authroot_this_update, + std::vector<uint8_t> authroot_sequence_number); + ResultDebugData(const ResultDebugData&); + ~ResultDebugData() override; + + static const ResultDebugData* Get(const base::SupportsUserData* debug_data); + static void Create(base::Time authroot_this_update, + std::vector<uint8_t> authroot_sequence_number, + base::SupportsUserData* debug_data); + + // base::SupportsUserData::Data implementation: + std::unique_ptr<Data> Clone() override; + + // The ThisUpdate field from the AuthRoot store in the registry. Note, + // if a user has not received any AuthRoot updates, such as updates being + // disabled or connectivity issues for WinHTTP, this will return a + // `base::Time` that `is_null()`. Specifically, if a user is running with + // the RTM version of AuthRoot (e.g. as stored in crypt32.dll), this will + // not be filled. + const base::Time& authroot_this_update() const { + return authroot_this_update_; + } + + // The Sequence Number from the AuthRoot store in the registry. See the + // remarks in `authroot_this_update()` for situations where this may not + // be filled. + const std::vector<uint8_t>& authroot_sequence_number() const { + return authroot_sequence_number_; + } + + private: + base::Time authroot_this_update_; + std::vector<uint8_t> authroot_sequence_number_; + }; + CertVerifyProcWin(); bool SupportsAdditionalTrustAnchors() const override;
diff --git a/net/cert/cert_verify_proc_win_unittest.cc b/net/cert/cert_verify_proc_win_unittest.cc new file mode 100644 index 0000000..7f5d3f4 --- /dev/null +++ b/net/cert/cert_verify_proc_win_unittest.cc
@@ -0,0 +1,118 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/cert/cert_verify_proc_win.h" + +#include <memory> + +#include "base/cxx17_backports.h" +#include "base/files/file_path.h" +#include "base/memory/scoped_refptr.h" +#include "net/base/net_errors.h" +#include "net/cert/cert_verifier.h" +#include "net/cert/cert_verify_result.h" +#include "net/cert/crl_set.h" +#include "net/cert/test_root_certs.h" +#include "net/cert/x509_certificate.h" +#include "net/log/net_log_with_source.h" +#include "net/test/cert_test_util.h" +#include "net/test/gtest_util.h" +#include "net/test/test_data_directory.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace net { + +namespace { + +using net::test::IsError; +using net::test::IsOk; + +// Tests that Windows debug data for the AuthRoot version is provided for +// successful certificate validations (in this case, using `ScopedTestRoot`). +TEST(CertVerifyProcWinTest, ReadsAuthRootVersionSuccessfulValidation) { + scoped_refptr<X509Certificate> root = + ImportCertFromFile(GetTestCertsDirectory(), "root_ca_cert.pem"); + ASSERT_TRUE(root); + ScopedTestRoot test_root(root.get()); + + scoped_refptr<X509Certificate> cert = + ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"); + ASSERT_TRUE(cert); + + scoped_refptr<CertVerifyProc> verify_proc = + base::MakeRefCounted<CertVerifyProcWin>(); + + int flags = 0; + CertVerifyResult verify_result; + int error = verify_proc->Verify( + cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), + /*sct_list=*/std::string(), flags, CRLSet::BuiltinCRLSet().get(), + CertificateList(), &verify_result, NetLogWithSource()); + + EXPECT_THAT(error, IsOk()); + + const CertVerifyProcWin::ResultDebugData* win_debug_data = + CertVerifyProcWin::ResultDebugData::Get(&verify_result); + ASSERT_TRUE(win_debug_data); + + // Unfortunately, it's not possible to use something like + // `registry_util::RegistryOverrideManager` to provide a fully fake CTL + // (e.g. created by `CryptMsgEncodeAndSignCTL`), as CryptoAPI will still + // attempt to validate the CTL and fail chain building if it is not able to. + // While it's possible to check in a Microsoft-signed CTL as a resource and + // use that to override, that still leaves a fair amount of dependency on + // platform-specific behaviours. + // Given the lack of easy substitution, the current test merely ensures that + // DebugData is attached, but can't check that the values are sensible (e.g. + // `!authroot_this_update().is_null()`), because the system that the test is + // running on may not have populated the AuthRoot registry. However, the + // following lines reflect "expected" results for a system with AuthRoot. + // EXPECT_FALSE(win_debug_data->authroot_this_update().is_null()); + // EXPECT_FALSE(win_debug_data->authroot_sequence_number().empty()); +} + +// Tests that Windows debug data for the AuthRoot version is still provided +// even if certificate validation fails early (e.g. for an untrusted CA). This +// information should be available regardless of the verification result. +TEST(CertVerifyProcWinTest, ReadsAuthRootVersionFailedValidation) { + scoped_refptr<X509Certificate> cert = + ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"); + ASSERT_TRUE(cert); + + scoped_refptr<CertVerifyProc> verify_proc = + base::MakeRefCounted<CertVerifyProcWin>(); + + int flags = 0; + CertVerifyResult verify_result; + int error = verify_proc->Verify( + cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), + /*sct_list=*/std::string(), flags, CRLSet::BuiltinCRLSet().get(), + CertificateList(), &verify_result, NetLogWithSource()); + + EXPECT_THAT(error, IsError(ERR_CERT_AUTHORITY_INVALID)); + + const CertVerifyProcWin::ResultDebugData* win_debug_data = + CertVerifyProcWin::ResultDebugData::Get(&verify_result); + ASSERT_TRUE(win_debug_data); + + // Unfortunately, it's not possible to use something like + // `registry_util::RegistryOverrideManager` to provide a fully fake CTL + // (e.g. created by `CryptMsgEncodeAndSignCTL`), as CryptoAPI will still + // attempt to validate the CTL and fail chain building if it is not able to. + // While it's possible to check in a Microsoft-signed CTL as a resource and + // use that to override, that still leaves a fair amount of dependency on + // platform-specific behaviours. + // Given the lack of easy substitution, the current test merely ensures that + // DebugData is attached, but can't check that the values are sensible (e.g. + // `!authroot_this_update().is_null()`), because the system that the test is + // running on may not have populated the AuthRoot registry. However, the + // following lines reflect "expected" results for a system with AuthRoot. + // EXPECT_FALSE(win_debug_data->authroot_this_update().is_null()); + // EXPECT_FALSE(win_debug_data->authroot_sequence_number().empty()); +} + +} // namespace + +} // namespace net \ No newline at end of file
diff --git a/services/cert_verifier/public/mojom/trial_comparison_cert_verifier.mojom b/services/cert_verifier/public/mojom/trial_comparison_cert_verifier.mojom index 010d03e..14d2e7f 100644 --- a/services/cert_verifier/public/mojom/trial_comparison_cert_verifier.mojom +++ b/services/cert_verifier/public/mojom/trial_comparison_cert_verifier.mojom
@@ -41,6 +41,15 @@ array<MacCertEvidenceInfo> status_chain; }; +[EnableIf=is_win] +struct WinPlatformVerifierDebugInfo { + // The ThisUpdate date for AuthRoot, as reflected in the registry. + mojo_base.mojom.Time authroot_this_update; + + // The sequence number for AuthRoot, as reflected in the registry. + array<uint8> authroot_sequence_number; +}; + // Contains additional debugging data about the verification. This information // does not change the meaning of the results. struct CertVerifierDebugInfo { @@ -64,6 +73,9 @@ [EnableIf=is_mac] MacPlatformVerifierDebugInfo? mac_platform_debug_info; + [EnableIf=is_win] + WinPlatformVerifierDebugInfo? win_platform_debug_info; + // The time as seen by CertVerifyProcBuiltin, in raw timestamp and in // exploded & encoded GeneralizedTime string. mojo_base.mojom.Time trial_verification_time;
diff --git a/services/cert_verifier/trial_comparison_cert_verifier_mojo.cc b/services/cert_verifier/trial_comparison_cert_verifier_mojo.cc index a57a05e..bfa49524 100644 --- a/services/cert_verifier/trial_comparison_cert_verifier_mojo.cc +++ b/services/cert_verifier/trial_comparison_cert_verifier_mojo.cc
@@ -18,6 +18,10 @@ #include "net/cert/internal/trust_store_mac.h" #endif +#if defined(OS_WIN) +#include "net/cert/cert_verify_proc_win.h" +#endif + namespace { #if defined(OS_MAC) @@ -98,6 +102,7 @@ const net::CertVerifyResult& trial_result) { mojom::CertVerifierDebugInfoPtr debug_info = mojom::CertVerifierDebugInfo::New(); + #if defined(OS_MAC) auto* mac_platform_debug_info = net::CertVerifyProcMac::ResultDebugData::Get(&primary_result); @@ -125,7 +130,21 @@ debug_info->mac_trust_impl = TrustImplTypeToMojom(mac_trust_debug_info->trust_impl()); } -#endif +#endif // defined(OS_MAC) + +#if defined(OS_WIN) + auto* win_platform_debug_info = + net::CertVerifyProcWin::ResultDebugData::Get(&primary_result); + if (win_platform_debug_info) { + debug_info->win_platform_debug_info = + mojom::WinPlatformVerifierDebugInfo::New(); + debug_info->win_platform_debug_info->authroot_this_update = + win_platform_debug_info->authroot_this_update(); + debug_info->win_platform_debug_info->authroot_sequence_number = + win_platform_debug_info->authroot_sequence_number(); + } +#endif // defined(OS_WIN) + auto* cert_verify_proc_builtin_debug_data = net::CertVerifyProcBuiltinResultDebugData::Get(&trial_result); if (cert_verify_proc_builtin_debug_data) {
diff --git a/services/cert_verifier/trial_comparison_cert_verifier_mojo_unittest.cc b/services/cert_verifier/trial_comparison_cert_verifier_mojo_unittest.cc index 50b772f..2a6ef513 100644 --- a/services/cert_verifier/trial_comparison_cert_verifier_mojo_unittest.cc +++ b/services/cert_verifier/trial_comparison_cert_verifier_mojo_unittest.cc
@@ -19,6 +19,9 @@ #include "net/cert/cert_verify_proc_mac.h" #include "net/cert/internal/trust_store_mac.h" #endif +#if defined(OS_WIN) +#include "net/cert/cert_verify_proc_win.h" +#endif struct ReceivedReport { std::string hostname; @@ -104,6 +107,8 @@ net::CertVerifyResult trial_result; trial_result.verified_cert = chain2; + base::Time time = base::Time::Now(); + #if defined(OS_MAC) constexpr uint32_t kExpectedTrustResult = 4; constexpr int32_t kExpectedResultCode = -12345; @@ -131,8 +136,12 @@ mac_trust_debug_info->UpdateTrustDebugInfo( kExpectedTrustDebugInfo, net::TrustStoreMac::TrustImplType::kSimple); #endif +#if defined(OS_WIN) + std::vector<uint8_t> authroot_sequence{'T', 'E', 'S', 'T'}; + net::CertVerifyProcWin::ResultDebugData::Create(time, authroot_sequence, + &primary_result); +#endif - base::Time time = base::Time::Now(); net::der::GeneralizedTime der_time; der_time.year = 2019; der_time.month = 9; @@ -194,6 +203,14 @@ cert_verifier::mojom::CertVerifierDebugInfo::MacTrustImplType::kSimple, report.debug_info->mac_trust_impl); #endif +#if defined(OS_WIN) + ASSERT_TRUE(report.debug_info->win_platform_debug_info); + EXPECT_EQ(time, + report.debug_info->win_platform_debug_info->authroot_this_update); + EXPECT_EQ( + authroot_sequence, + report.debug_info->win_platform_debug_info->authroot_sequence_number); +#endif EXPECT_EQ(time, report.debug_info->trial_verification_time); EXPECT_EQ("20190927221108Z", report.debug_info->trial_der_verification_time);
diff --git a/services/device/generic_sensor/platform_sensor_provider_linux.cc b/services/device/generic_sensor/platform_sensor_provider_linux.cc index 95d89dc..e4f5d46 100644 --- a/services/device/generic_sensor/platform_sensor_provider_linux.cc +++ b/services/device/generic_sensor/platform_sensor_provider_linux.cc
@@ -27,9 +27,7 @@ } // namespace PlatformSensorProviderLinux::PlatformSensorProviderLinux() - : sensor_nodes_enumerated_(false), - sensor_nodes_enumeration_started_(false), - blocking_task_runner_(base::ThreadPool::CreateSequencedTaskRunner( + : blocking_task_runner_(base::ThreadPool::CreateSequencedTaskRunner( kBlockingTaskRunnerTraits)), sensor_device_manager_(nullptr, base::OnTaskRunnerDeleter(blocking_task_runner_)) { @@ -45,16 +43,16 @@ CreateSensorCallback callback) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (!sensor_nodes_enumerated_) { - if (!sensor_nodes_enumeration_started_) { - // Unretained() is safe because the deletion of |sensor_device_manager_| - // is scheduled on |blocking_task_runner_| when - // PlatformSensorProviderLinux is deleted. - sensor_nodes_enumeration_started_ = blocking_task_runner_->PostTask( - FROM_HERE, - base::BindOnce(&SensorDeviceManager::Start, - base::Unretained(sensor_device_manager_.get()))); - } + if (enumeration_status_ == SensorEnumerationState::kNotEnumerated) { + // Unretained() is safe because the deletion of |sensor_device_manager_| + // is scheduled on |blocking_task_runner_| when + // PlatformSensorProviderLinux is deleted. + const bool will_run = blocking_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&SensorDeviceManager::Start, + base::Unretained(sensor_device_manager_.get()))); + if (will_run) + enumeration_status_ = SensorEnumerationState::kEnumerationStarted; return; } @@ -138,8 +136,8 @@ void PlatformSensorProviderLinux::OnSensorNodesEnumerated() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK(!sensor_nodes_enumerated_); - sensor_nodes_enumerated_ = true; + DCHECK_NE(enumeration_status_, SensorEnumerationState::kEnumerationFinished); + enumeration_status_ = SensorEnumerationState::kEnumerationFinished; ProcessStoredRequests(); }
diff --git a/services/device/generic_sensor/platform_sensor_provider_linux.h b/services/device/generic_sensor/platform_sensor_provider_linux.h index 24dfe0a8..e7af9f2 100644 --- a/services/device/generic_sensor/platform_sensor_provider_linux.h +++ b/services/device/generic_sensor/platform_sensor_provider_linux.h
@@ -68,11 +68,16 @@ void OnDeviceRemoved(mojom::SensorType type, const std::string& device_node) override; - // Set to true when enumeration is ready. - bool sensor_nodes_enumerated_; + enum class SensorEnumerationState : uint8_t { + // Original state. + kNotEnumerated, - // Set to true when |sensor_device_manager_| has already started enumeration. - bool sensor_nodes_enumeration_started_; + // |sensor_device_manager_| has started to enumerate sensors. + kEnumerationStarted, + + // Sensor enumeration has finished. + kEnumerationFinished + } enumeration_status_ = SensorEnumerationState::kNotEnumerated; // Stores all available sensor devices by type. SensorDeviceMap sensor_devices_by_type_;
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 3d98214..3b79dc80 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -11,16 +11,6 @@ "all" ] }, - "Linux Builder (core-32) (goma)": { - "additional_compile_targets": [ - "all" - ] - }, - "Linux Builder (core-32) (reclient)": { - "additional_compile_targets": [ - "all" - ] - }, "Linux Builder (deps-cache) (reclient)": { "additional_compile_targets": [ "all" @@ -473,16 +463,6 @@ "chromium_builder_asan" ] }, - "TSAN Release (core-32) (goma)": { - "additional_compile_targets": [ - "chromium_builder_asan" - ] - }, - "TSAN Release (core-32) (reclient)": { - "additional_compile_targets": [ - "chromium_builder_asan" - ] - }, "TSAN Release (deps-cache) (reclient)": { "additional_compile_targets": [ "chromium_builder_asan" @@ -87772,6 +87752,28 @@ } ] }, + "mac-arm64-on-arm64-rel-reclient": { + "additional_compile_targets": [ + "all" + ], + "scripts": [ + { + "name": "check_static_initializers", + "script": "check_static_initializers.py", + "swarming": {} + }, + { + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, + { + "name": "webkit_lint", + "script": "blink_lint_expectations.py", + "swarming": {} + } + ] + }, "mac-code-coverage": { "gtest_tests": [ {
diff --git a/testing/buildbot/filters/fuchsia.content_unittests.filter b/testing/buildbot/filters/fuchsia.content_unittests.filter index 22da1d2..a960f6a 100644 --- a/testing/buildbot/filters/fuchsia.content_unittests.filter +++ b/testing/buildbot/filters/fuchsia.content_unittests.filter
@@ -43,9 +43,6 @@ -RenderWidgetHostViewAuraTest.SyntheticFlingCancelAtTouchpadScrollBegin -RenderWidgetHostViewAuraTest.TimerBasedWheelEventPhaseInfo -# Flaky, https://crbug.com/884250. --ReferrerSanitizerTest.SanitizesPolicyForNonEmptyReferrers - # TODO(crbug.com/1231509): These tests require # OSExchangeDataProviderFactory::CreateProvider to be implemented. -WebContentsViewAuraTest.DragDropFiles
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index 7db4f1280..44b7a50 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -869,7 +869,6 @@ "label": "//content/test:fuchsia_telemetry_gpu_integration_test", "script": "//testing/scripts/run_gpu_integration_test_as_googletest.py", "type": "script", - "python3": True, }, "gcm_unit_tests": { "label": "//google_apis/gcm:gcm_unit_tests", @@ -1696,7 +1695,6 @@ "label": "//chrome/test:telemetry_gpu_integration_test", "script": "//testing/scripts/run_gpu_integration_test_as_googletest.py", "type": "script", - "python3": True, }, "telemetry_gpu_integration_test_android_chrome": { "args": [ @@ -1705,7 +1703,6 @@ "label": "//chrome/test:telemetry_gpu_integration_test_android_chrome", "script": "//testing/scripts/run_gpu_integration_test_as_googletest.py", "type": "script", - "python3": True, }, "telemetry_gpu_integration_test_android_webview": { "args": [ @@ -1714,7 +1711,6 @@ "label": "//chrome/test:telemetry_gpu_integration_test_android_webview", "script": "//testing/scripts/run_gpu_integration_test_as_googletest.py", "type": "script", - "python3": True, }, "telemetry_gpu_integration_test_scripts_only": { "label": "//chrome/test:telemetry_gpu_integration_test_scripts_only",
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 887f539d..94201e8 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -2461,26 +2461,6 @@ 'all' ], }, - 'Linux Builder (core-32) (goma)': { - # Copied from - # https://source.chromium.org/chromium/chromium/src/+/main:testing/buildbot/waterfalls.pyl;l=4844-4854;drc=75f767e92e86611728189739fb26f4e2cdf212d9 - 'mixins': [ - 'isolate_profile_data', - ], - 'additional_compile_targets': [ - 'all' - ], - }, - 'Linux Builder (core-32) (reclient)': { - # Copied from - # https://source.chromium.org/chromium/chromium/src/+/main:testing/buildbot/waterfalls.pyl;l=4844-4854;drc=75f767e92e86611728189739fb26f4e2cdf212d9 - 'mixins': [ - 'isolate_profile_data', - ], - 'additional_compile_targets': [ - 'all' - ], - }, 'Linux Builder (deps-cache) (reclient)': { # Copied from # https://source.chromium.org/chromium/chromium/src/+/main:testing/buildbot/waterfalls.pyl;l=4844-4854;drc=75f767e92e86611728189739fb26f4e2cdf212d9 @@ -2582,16 +2562,6 @@ 'chromium_builder_asan', ], }, - 'TSAN Release (core-32) (goma)': { - 'additional_compile_targets': [ - 'chromium_builder_asan', - ], - }, - 'TSAN Release (core-32) (reclient)': { - 'additional_compile_targets': [ - 'chromium_builder_asan', - ], - }, 'TSAN Release (deps-cache) (reclient)': { 'additional_compile_targets': [ 'chromium_builder_asan', @@ -3346,6 +3316,15 @@ 'isolated_scripts': 'wpt_web_tests_input', }, }, + # TODO(crbug.com/1252626): remove this after the migration. + 'mac-arm64-on-arm64-rel-reclient': { + 'additional_compile_targets': [ + 'all', + ], + 'test_suites': { + 'scripts': 'chromium_mac_scripts', + } + }, 'mac-code-coverage': { 'mixins': [ 'isolate_profile_data',
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 77c590f4..216ebfa 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -688,21 +688,6 @@ ] } ], - "ArcUseHighMemoryDalvikProfile": [ - { - "platforms": [ - "chromeos" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "ArcUseHighMemoryDalvikProfile" - ] - } - ] - } - ], "ArcVmMemorySize": [ { "platforms": [ @@ -800,47 +785,6 @@ ] } ], - "AutoScreenBrightness": [ - { - "platforms": [ - "chromeos" - ], - "experiments": [ - { - "name": "Enabled_11062019", - "params": { - "auto_brightness_als_horizon_seconds": "3", - "brightness_sample_delay_seconds": "3", - "brightness_step_size": "1.5", - "enabled": "true", - "model_als_horizon_seconds": "3", - "model_brightness_step_size": "2.0", - "model_curve": "2", - "user_adjustment_effect": "1" - }, - "enable_features": [ - "AutoScreenBrightness" - ] - }, - { - "name": "Enabled_11102019", - "params": { - "auto_brightness_als_horizon_seconds": "3", - "brightness_sample_delay_seconds": "3", - "brightness_step_size": "1.5", - "enabled": "true", - "model_als_horizon_seconds": "3", - "model_brightness_step_size": "2.0", - "model_curve": "2", - "user_adjustment_effect": "1" - }, - "enable_features": [ - "AutoScreenBrightness" - ] - } - ] - } - ], "AutocompleteFilterForMeaningfulNames": [ { "platforms": [ @@ -862,33 +806,6 @@ ] } ], - "AutofillAPIServer": [ - { - "platforms": [ - "android", - "android_weblayer", - "android_webview", - "chromeos", - "chromeos_lacros", - "ios", - "linux", - "mac", - "windows" - ], - "experiments": [ - { - "name": "API_Enabled", - "params": { - "autofill-server-url": "https://content-autofill.googleapis.com/" - }, - "enable_features": [ - "AutofillServerCommunication", - "AutofillUseApi" - ] - } - ] - } - ], "AutofillAddressProfileSavePrompt": [ { "platforms": [ @@ -2646,29 +2563,6 @@ ] } ], - "DataCompressionProxyPromoVisibility": [ - { - "platforms": [ - "android", - "android_weblayer" - ], - "experiments": [ - { - "name": "Enabled", - "params": { - "availability": "any", - "event_trigger": "name:data_saver_milestone_promo_iph_would_have_triggered;comparator:<2;window:90;storage:360", - "event_used": "name:data_saver_milestone_promo;comparator:<2;window:90;storage:360", - "session_rate": "==0", - "x_milestone_promo_data_savings_in_megabytes": "1024;100" - }, - "enable_features": [ - "IPH_DataSaverMilestonePromo" - ] - } - ] - } - ], "DataReductionProxyFREPromo": [ { "platforms": [ @@ -2698,6 +2592,21 @@ ] } ], + "DefaultEnableGpuRasterization": [ + { + "platforms": [ + "linux" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "DefaultEnableGpuRasterization" + ] + } + ] + } + ], "DefaultPassthroughCommandDecoder": [ { "platforms": [ @@ -3399,57 +3308,6 @@ ] } ], - "FeedActionsUpload": [ - { - "platforms": [ - "android" - ], - "experiments": [ - { - "name": "Enabled", - "params": { - "availability": "any", - "event_trigger": "name:iph_feed_header_menu_triggered;comparator:==0;window:360;storage:360", - "event_used": "name:feed_header_menu_clicked;comparator:==0;window:360;storage:360", - "session_rate": "==0" - }, - "enable_features": [ - "IPH_FeedHeaderMenu" - ] - } - ] - } - ], - "FeedPrivacyNoticeCardAtSecondPosition": [ - { - "platforms": [ - "android" - ], - "experiments": [ - { - "name": "Enabled_20201207", - "enable_features": [ - "InterestFeedV1ClickAndViewActionsConditionalUpload" - ] - } - ] - } - ], - "FeedPrivacyNoticeCardAutoDismiss": [ - { - "platforms": [ - "android" - ], - "experiments": [ - { - "name": "Enabled_20210119", - "enable_features": [ - "InterestFeedNoticeCardAutoDismiss" - ] - } - ] - } - ], "FeedPullToRefresh": [ { "platforms": [ @@ -3525,21 +3383,6 @@ ] } ], - "FillingPasswordsFromAnyOrigin": [ - { - "platforms": [ - "android" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "FillingPasswordsFromAnyOrigin" - ] - } - ] - } - ], "FirstInputDelayWithoutEventListener": [ { "platforms": [ @@ -5765,34 +5608,6 @@ ] } ], - "OutOfBlinkCors": [ - { - "platforms": [ - "android", - "android_weblayer", - "android_webview", - "chromeos", - "chromeos_lacros", - "ios", - "linux", - "mac", - "windows" - ], - "experiments": [ - { - "name": "Enabled", - "params": { - "extra-safelisted-request-headers": "x-googapps-allowed-domains", - "extra-safelisted-request-headers-for-enterprise": "x-googapps-allowed-domains" - }, - "enable_features": [ - "ExtraSafelistedRequestHeadersForOutOfBlinkCors", - "OutOfBlinkCors" - ] - } - ] - } - ], "OverlayPrioritizationExtended": [ { "platforms": [
diff --git a/third_party/abseil-cpp/absl/flags/BUILD.gn b/third_party/abseil-cpp/absl/flags/BUILD.gn index d2f9f18f..a47248b 100644 --- a/third_party/abseil-cpp/absl/flags/BUILD.gn +++ b/third_party/abseil-cpp/absl/flags/BUILD.gn
@@ -114,17 +114,8 @@ ] } -config("absl_flag_internal_config") { - if (is_clang) { - # TODO(crbug.com/1251757): Figure out what to do with this. - cflags = [ "-Wno-unused-value" ] - } -} - - absl_source_set("flag_internal") { sources = [ "internal/flag.cc" ] - public_configs = [ ":absl_flag_internal_config" ] public = [ "internal/flag.h", "internal/sequence_lock.h",
diff --git a/third_party/android_deps/build.gradle b/third_party/android_deps/build.gradle index 295430f..e1d4f444 100644 --- a/third_party/android_deps/build.gradle +++ b/third_party/android_deps/build.gradle
@@ -114,7 +114,7 @@ // Upstream guava introduced versions with -android suffix starting with version // 22 to remove incompatible code with android. Thus we keep two jars, one for // the full guava and one that supports android. - compile 'com.google.guava:guava:30.1-android' + compile 'com.google.guava:guava:31.0-android' // Needed by androidx. compile 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3'
diff --git a/third_party/android_deps/libs/com_google_guava_guava_android/3pp/fetch.py b/third_party/android_deps/libs/com_google_guava_guava_android/3pp/fetch.py index 5a5bd83d..80b3c366 100755 --- a/third_party/android_deps/libs/com_google_guava_guava_android/3pp/fetch.py +++ b/third_party/android_deps/libs/com_google_guava_guava_android/3pp/fetch.py
@@ -12,9 +12,9 @@ import json import os -_FILE_URL = 'https://repo.maven.apache.org/maven2/com/google/guava/guava/30.1-android/guava-30.1-android.jar' -_FILE_NAME = 'guava-30.1-android.jar' -_FILE_VERSION = '30.1-android' +_FILE_URL = 'https://repo.maven.apache.org/maven2/com/google/guava/guava/31.0-android/guava-31.0-android.jar' +_FILE_NAME = 'guava-31.0-android.jar' +_FILE_VERSION = '31.0-android' def do_latest():
diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc index 5eb02def..8f97fb5b 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc
@@ -3255,8 +3255,13 @@ return nullptr; } CSSValueList* parsed_values = CSSValueList::CreateSpaceSeparated(); - if (row_or_column_value) - parsed_values->Append(*row_or_column_value); + if (row_or_column_value) { + CSSValueID value = row_or_column_value->GetValueID(); + if (value == CSSValueID::kColumn || + (value == CSSValueID::kRow && !dense_algorithm)) { + parsed_values->Append(*row_or_column_value); + } + } if (dense_algorithm) parsed_values->Append(*dense_algorithm); return parsed_values; @@ -3269,7 +3274,6 @@ CSSValueList* list = CSSValueList::CreateSpaceSeparated(); switch (style.GetGridAutoFlow()) { case kAutoFlowRow: - case kAutoFlowRowDense: list->Append(*CSSIdentifierValue::Create(CSSValueID::kRow)); break; case kAutoFlowColumn: @@ -3277,7 +3281,8 @@ list->Append(*CSSIdentifierValue::Create(CSSValueID::kColumn)); break; default: - NOTREACHED(); + // Do nothing. + break; } switch (style.GetGridAutoFlow()) {
diff --git a/third_party/blink/renderer/core/css/style_engine.cc b/third_party/blink/renderer/core/css/style_engine.cc index 7d942f41..09d2b15 100644 --- a/third_party/blink/renderer/core/css/style_engine.cc +++ b/third_party/blink/renderer/core/css/style_engine.cc
@@ -2670,6 +2670,15 @@ FontSelectorClient::Trace(visitor); } +namespace { + +inline bool MayHaveFlatTreeChildren(const Element& element) { + return element.firstChild() || IsShadowHost(element) || + element.IsActiveSlot(); +} + +} // namespace + void StyleEngine::MarkForLayoutTreeChangesAfterDetach() { if (!parent_for_detached_subtree_) return; @@ -2687,7 +2696,8 @@ // flag will be cause the element to be marked for layout tree rebuild // traversal during style recalc to make sure we revisit whitespace text // nodes. - if (!layout_object->WhitespaceChildrenMayChange()) { + if (!layout_object->WhitespaceChildrenMayChange() && + MayHaveFlatTreeChildren(*layout_object_element)) { layout_object->SetWhitespaceChildrenMayChange(true); layout_object_element->MarkAncestorsWithChildNeedsStyleRecalc(); }
diff --git a/third_party/blink/renderer/core/css/style_engine_test.cc b/third_party/blink/renderer/core/css/style_engine_test.cc index 8a347a8..27444979 100644 --- a/third_party/blink/renderer/core/css/style_engine_test.cc +++ b/third_party/blink/renderer/core/css/style_engine_test.cc
@@ -2237,7 +2237,7 @@ GetDocument().getElementById("f1")->firstChild()->remove(); - EXPECT_TRUE(d1->firstChild()->ChildNeedsStyleRecalc()); + EXPECT_FALSE(d1->firstChild()->ChildNeedsStyleRecalc()); EXPECT_FALSE(d1->firstChild()->ChildNeedsReattachLayoutTree()); EXPECT_FALSE(d1->firstChild()->NeedsReattachLayoutTree()); EXPECT_TRUE(d1->ChildNeedsStyleRecalc()); @@ -2253,7 +2253,7 @@ GetDocument().getElementById("f2")->firstChild()->remove(); - EXPECT_TRUE(d2->firstChild()->ChildNeedsStyleRecalc()); + EXPECT_FALSE(d2->firstChild()->ChildNeedsStyleRecalc()); EXPECT_FALSE(d2->firstChild()->ChildNeedsReattachLayoutTree()); EXPECT_FALSE(d2->firstChild()->NeedsReattachLayoutTree()); EXPECT_TRUE(d2->ChildNeedsStyleRecalc()); @@ -4765,4 +4765,18 @@ EXPECT_FALSE(GetParentForDetachedSubtree()); } +TEST_F(StyleEngineTest, EmptyDetachParent) { + GetDocument().body()->setInnerHTML(R"HTML( + <span id="parent"><b>A</b> <i>B</i></span> + )HTML"); + UpdateAllLifecyclePhases(); + + auto* parent = GetDocument().getElementById("parent"); + parent->setInnerHTML(""); + + ASSERT_TRUE(parent->GetLayoutObject()); + EXPECT_FALSE(parent->GetLayoutObject()->WhitespaceChildrenMayChange()); + EXPECT_FALSE(GetDocument().NeedsLayoutTreeUpdate()); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/streams/readable_stream.cc b/third_party/blink/renderer/core/streams/readable_stream.cc index 1b3079f..cf650e294 100644 --- a/third_party/blink/renderer/core/streams/readable_stream.cc +++ b/third_party/blink/renderer/core/streams/readable_stream.cc
@@ -396,6 +396,11 @@ v8::Local<v8::Value> ReadRejected(v8::Local<v8::Value>) { is_reading_ = false; + if (is_shutting_down_) { + // This function can be called during shutdown when the lock is released. + // Exit early in that case. + return Undefined(); + } ReadableError(Readable()->GetStoredError(script_state_->GetIsolate())); return Undefined(); }
diff --git a/third_party/blink/renderer/modules/native_io/native_io_file_manager.cc b/third_party/blink/renderer/modules/native_io/native_io_file_manager.cc index 757976d..7a580d7d 100644 --- a/third_party/blink/renderer/modules/native_io/native_io_file_manager.cc +++ b/third_party/blink/renderer/modules/native_io/native_io_file_manager.cc
@@ -769,6 +769,10 @@ DCHECK(storage_access_allowed_.value()) << "called even though storage access was denied"; + ScriptState* script_state = resolver->GetScriptState(); + if (!script_state->ContextIsValid()) + return; + if (!backend_.is_bound()) { blink::RejectNativeIOWithError( resolver, mojom::blink::NativeIOError::New( @@ -788,6 +792,10 @@ DCHECK(storage_access_allowed_.value()) << "called even though storage access was denied"; + ScriptState* script_state = resolver->GetScriptState(); + if (!script_state->ContextIsValid()) + return; + if (!backend_.is_bound()) { blink::RejectNativeIOWithError( resolver, mojom::blink::NativeIOError::New( @@ -808,6 +816,10 @@ DCHECK(storage_access_allowed_.value()) << "called even though storage access was denied"; + ScriptState* script_state = resolver->GetScriptState(); + if (!script_state->ContextIsValid()) + return; + if (!backend_.is_bound()) { blink::RejectNativeIOWithError( resolver, mojom::blink::NativeIOError::New( @@ -827,6 +839,10 @@ DCHECK(storage_access_allowed_.value()) << "called even though storage access was denied"; + ScriptState* script_state = resolver->GetScriptState(); + if (!script_state->ContextIsValid()) + return; + if (!backend_.is_bound()) { blink::RejectNativeIOWithError( resolver, mojom::blink::NativeIOError::New(
diff --git a/third_party/blink/renderer/modules/nfc/ndef_message.cc b/third_party/blink/renderer/modules/nfc/ndef_message.cc index 6d6154d..295e932 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_message.cc +++ b/third_party/blink/renderer/modules/nfc/ndef_message.cc
@@ -8,16 +8,28 @@ #include "third_party/blink/renderer/bindings/modules/v8/v8_ndef_message_init.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_ndef_record_init.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_union_arraybuffer_arraybufferview_ndefmessageinit_string.h" -#include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/modules/nfc/ndef_record.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" +#include "third_party/blink/renderer/platform/bindings/script_state.h" namespace blink { +namespace { + +// Spec-defined maximum recursion depth for NDEF messages. +// https://w3c.github.io/web-nfc/#creating-ndef-message +constexpr uint8_t kMaxRecursionDepth = 32; + +constexpr char kRecursionLimitExceededErrorMessage[] = + "NDEFMessage recursion limit exceeded."; + +} // namespace + // static -NDEFMessage* NDEFMessage::Create(const ExecutionContext* execution_context, +NDEFMessage* NDEFMessage::Create(const ScriptState* script_state, const NDEFMessageInit* init, ExceptionState& exception_state, + uint8_t records_depth, bool is_embedded) { // https://w3c.github.io/web-nfc/#creating-ndef-message @@ -29,10 +41,15 @@ return nullptr; } + if (++records_depth > kMaxRecursionDepth) { + exception_state.ThrowTypeError(kRecursionLimitExceededErrorMessage); + return nullptr; + } + NDEFMessage* message = MakeGarbageCollected<NDEFMessage>(); for (const NDEFRecordInit* record_init : init->records()) { - NDEFRecord* record = NDEFRecord::Create(execution_context, record_init, - exception_state, is_embedded); + NDEFRecord* record = NDEFRecord::Create( + script_state, record_init, exception_state, records_depth, is_embedded); if (exception_state.HadException()) return nullptr; DCHECK(record); @@ -42,7 +59,7 @@ } // static -NDEFMessage* NDEFMessage::Create(const ExecutionContext* execution_context, +NDEFMessage* NDEFMessage::Create(const ScriptState* script_state, const V8NDEFMessageSource* source, ExceptionState& exception_state) { DCHECK(source); @@ -84,13 +101,14 @@ return message; } case V8NDEFMessageSource::ContentType::kNDEFMessageInit: { - return Create(execution_context, source->GetAsNDEFMessageInit(), - exception_state); + return Create(script_state, source->GetAsNDEFMessageInit(), + exception_state, + /*records_depth=*/0U); } case V8NDEFMessageSource::ContentType::kString: { NDEFMessage* message = MakeGarbageCollected<NDEFMessage>(); message->records_.push_back(MakeGarbageCollected<NDEFRecord>( - execution_context, source->GetAsString())); + script_state, source->GetAsString())); return message; } } @@ -101,12 +119,18 @@ // static NDEFMessage* NDEFMessage::CreateAsPayloadOfSmartPoster( - const ExecutionContext* execution_context, + const ScriptState* script_state, const NDEFMessageInit* init, - ExceptionState& exception_state) { + ExceptionState& exception_state, + uint8_t records_depth) { // NDEFMessageInit#records is a required field. DCHECK(init->hasRecords()); + if (++records_depth > kMaxRecursionDepth) { + exception_state.ThrowTypeError(kRecursionLimitExceededErrorMessage); + return nullptr; + } + NDEFMessage* payload_message = MakeGarbageCollected<NDEFMessage>(); bool has_url_record = false; @@ -150,8 +174,9 @@ } else { // No restriction on other record types. } - NDEFRecord* record = NDEFRecord::Create( - execution_context, record_init, exception_state, /*is_embedded=*/true); + NDEFRecord* record = + NDEFRecord::Create(script_state, record_init, exception_state, + records_depth, /*is_embedded=*/true); if (exception_state.HadException()) return nullptr; DCHECK(record);
diff --git a/third_party/blink/renderer/modules/nfc/ndef_message.h b/third_party/blink/renderer/modules/nfc/ndef_message.h index 4dcfeccb..15bfdd8 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_message.h +++ b/third_party/blink/renderer/modules/nfc/ndef_message.h
@@ -5,6 +5,8 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_MESSAGE_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_MESSAGE_H_ +#include <stdint.h> + #include "services/device/public/mojom/nfc.mojom-blink-forward.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_typedefs.h" #include "third_party/blink/renderer/modules/modules_export.h" @@ -14,9 +16,9 @@ namespace blink { class ExceptionState; -class ExecutionContext; class NDEFMessageInit; class NDEFRecord; +class ScriptState; class MODULES_EXPORT NDEFMessage final : public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -24,16 +26,18 @@ public: // |is_embedded| indicates if this message serves as payload for a parent // record. - static NDEFMessage* Create(const ExecutionContext*, + static NDEFMessage* Create(const ScriptState*, const NDEFMessageInit*, ExceptionState&, + uint8_t records_depth = 0U, bool is_embedded = false); - static NDEFMessage* Create(const ExecutionContext* execution_context, + static NDEFMessage* Create(const ScriptState*, const V8NDEFMessageSource* source, ExceptionState& exception_state); - static NDEFMessage* CreateAsPayloadOfSmartPoster(const ExecutionContext*, + static NDEFMessage* CreateAsPayloadOfSmartPoster(const ScriptState*, const NDEFMessageInit*, - ExceptionState&); + ExceptionState&, + uint8_t records_depth); NDEFMessage(); explicit NDEFMessage(const device::mojom::blink::NDEFMessage&);
diff --git a/third_party/blink/renderer/modules/nfc/ndef_message.idl b/third_party/blink/renderer/modules/nfc/ndef_message.idl index 557c976..3b5a84f 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_message.idl +++ b/third_party/blink/renderer/modules/nfc/ndef_message.idl
@@ -9,6 +9,6 @@ SecureContext, Exposed=Window ] interface NDEFMessage { - [CallWith=ExecutionContext, RaisesException] constructor(NDEFMessageInit messageInit); + [CallWith=ScriptState, RaisesException] constructor(NDEFMessageInit messageInit); readonly attribute FrozenArray<NDEFRecord> records; };
diff --git a/third_party/blink/renderer/modules/nfc/ndef_reader.cc b/third_party/blink/renderer/modules/nfc/ndef_reader.cc index 02c74599..fa743d8e 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_reader.cc +++ b/third_party/blink/renderer/modules/nfc/ndef_reader.cc
@@ -236,7 +236,7 @@ // Step 11.2: Run "create NDEF message", if this throws an exception, // reject p with that exception and abort these steps. NDEFMessage* ndef_message = - NDEFMessage::Create(DomWindow(), write_message, exception_state); + NDEFMessage::Create(script_state, write_message, exception_state); if (exception_state.HadException()) { return ScriptPromise(); }
diff --git a/third_party/blink/renderer/modules/nfc/ndef_reading_event.cc b/third_party/blink/renderer/modules/nfc/ndef_reading_event.cc index 9561458..8053f234 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_reading_event.cc +++ b/third_party/blink/renderer/modules/nfc/ndef_reading_event.cc
@@ -7,15 +7,17 @@ #include "third_party/blink/renderer/bindings/modules/v8/v8_ndef_reading_event_init.h" #include "third_party/blink/renderer/modules/nfc/ndef_message.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" +#include "third_party/blink/renderer/platform/bindings/script_state.h" namespace blink { // static -NDEFReadingEvent* NDEFReadingEvent::Create(const AtomicString& event_type, +NDEFReadingEvent* NDEFReadingEvent::Create(const ScriptState* script_state, + const AtomicString& event_type, const NDEFReadingEventInit* init, ExceptionState& exception_state) { - NDEFMessage* message = - NDEFMessage::Create(nullptr, init->message(), exception_state); + NDEFMessage* message = NDEFMessage::Create( + script_state, init->message(), exception_state, /*records_depth=*/0U); if (exception_state.HadException()) return nullptr; DCHECK(message);
diff --git a/third_party/blink/renderer/modules/nfc/ndef_reading_event.h b/third_party/blink/renderer/modules/nfc/ndef_reading_event.h index 87146a5..b60bee9 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_reading_event.h +++ b/third_party/blink/renderer/modules/nfc/ndef_reading_event.h
@@ -14,12 +14,14 @@ class ExceptionState; class NDEFMessage; class NDEFReadingEventInit; +class ScriptState; class NDEFReadingEvent final : public Event { DEFINE_WRAPPERTYPEINFO(); public: - static NDEFReadingEvent* Create(const AtomicString&, + static NDEFReadingEvent* Create(const ScriptState*, + const AtomicString&, const NDEFReadingEventInit*, ExceptionState&);
diff --git a/third_party/blink/renderer/modules/nfc/ndef_reading_event.idl b/third_party/blink/renderer/modules/nfc/ndef_reading_event.idl index 84432047..ce64e18 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_reading_event.idl +++ b/third_party/blink/renderer/modules/nfc/ndef_reading_event.idl
@@ -10,7 +10,7 @@ SecureContext, Exposed=Window ] interface NDEFReadingEvent : Event { - [RaisesException] constructor(DOMString type, NDEFReadingEventInit eventInitDict); + [CallWith=ScriptState, RaisesException] constructor(DOMString type, NDEFReadingEventInit eventInitDict); readonly attribute DOMString serialNumber; [SameObject] readonly attribute NDEFMessage message; };
diff --git a/third_party/blink/renderer/modules/nfc/ndef_record.cc b/third_party/blink/renderer/modules/nfc/ndef_record.cc index c526a87..c402b71d 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_record.cc +++ b/third_party/blink/renderer/modules/nfc/ndef_record.cc
@@ -4,9 +4,15 @@ #include "third_party/blink/renderer/modules/nfc/ndef_record.h" +#include "base/notreached.h" #include "services/device/public/mojom/nfc.mojom-blink.h" +#include "third_party/blink/renderer/bindings/core/v8/idl_types.h" +#include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_typedefs.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_union_arraybuffer_arraybufferview.h" +#include "third_party/blink/renderer/bindings/modules/v8/v8_ndef_message_init.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_ndef_record_init.h" -#include "third_party/blink/renderer/bindings/modules/v8/v8_union_arraybuffer_arraybufferview_ndefmessageinit_string.h" +#include "third_party/blink/renderer/bindings/modules/v8/v8_typedefs.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" @@ -15,10 +21,12 @@ #include "third_party/blink/renderer/core/typed_arrays/dom_data_view.h" #include "third_party/blink/renderer/modules/nfc/ndef_message.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" +#include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/network/http_parsers.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/wtf/text/ascii_ctype.h" #include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h" +#include "v8/include/v8.h" namespace blink { @@ -31,10 +39,33 @@ return data; } -bool GetBytesOfBufferSource(const V8NDEFRecordDataSource* buffer_source, +// Retrieves a RecordInit's |data| as a v8::Local<V8::Value> or creates a new +// v8::Undefined if |data| is not set. +// This is necessary because an empty v8::Local<V8::Value> as created in an +// empty ScriptValue will cause calls to v8::Value methods such as IsString() +// to crash. +v8::Local<v8::Value> GetPayloadDataOrUndefined( + v8::Isolate* isolate, + const NDEFRecordInit& record_init) { + return record_init.hasData() ? record_init.data().V8Value() + : v8::Undefined(isolate).As<v8::Value>(); +} + +// This reproduces the V8 type checks from +// V8UnionArrayBufferOrArrayBufferView::Create() without attempting the V8 -> +// native conversions that can trigger exceptions. We just want to know if the +// V8 type is potentially convertible to a V8BufferSource. +bool MaybeIsBufferSource(const ScriptValue& script_value) { + if (script_value.IsEmpty()) + return false; + const auto v8_value = script_value.V8Value(); + return v8_value->IsArrayBuffer() || v8_value->IsSharedArrayBuffer() || + v8_value->IsArrayBufferView(); +} + +bool GetBytesOfBufferSource(const V8BufferSource* buffer_source, WTF::Vector<uint8_t>* target, ExceptionState& exception_state) { - DCHECK(buffer_source->IsV8BufferSource()); DOMArrayPiece array_piece; if (buffer_source->IsArrayBuffer()) { array_piece = DOMArrayPiece(buffer_source->GetAsArrayBuffer()); @@ -133,15 +164,13 @@ return document_language; } -static NDEFRecord* CreateTextRecord(const ExecutionContext* execution_context, +static NDEFRecord* CreateTextRecord(const ScriptState* script_state, const String& id, const NDEFRecordInit& record, ExceptionState& exception_state) { // https://w3c.github.io/web-nfc/#mapping-string-to-ndef - if ( - !record.hasData() || - !(record.data()->IsString() || record.data()->IsV8BufferSource()) - ) { + if (!record.hasData() || !(record.data().V8Value()->IsString() || + MaybeIsBufferSource(record.data()))) { exception_state.ThrowTypeError( "The data for 'text' NDEFRecords must be a String or a BufferSource."); return nullptr; @@ -153,7 +182,7 @@ if (record.hasLang()) { language = record.lang(); } else { - language = getDocumentLanguage(execution_context); + language = getDocumentLanguage(ExecutionContext::From(script_state)); } // Bits 0 to 5 define the length of the language tag @@ -164,36 +193,37 @@ return nullptr; } - const auto* data = record.data(); const String& encoding_label = record.getEncodingOr("utf-8"); WTF::Vector<uint8_t> bytes; - switch (data->GetContentType()) { - case V8NDEFRecordDataSource::ContentType::kArrayBuffer: - case V8NDEFRecordDataSource::ContentType::kArrayBufferView: - if (encoding_label != "utf-8" && encoding_label != "utf-16" && - encoding_label != "utf-16be" && encoding_label != "utf-16le") { - exception_state.ThrowTypeError( - "Encoding must be either \"utf-8\", \"utf-16\", \"utf-16be\", or " - "\"utf-16le\"."); - return nullptr; - } - if (!GetBytesOfBufferSource(data, &bytes, exception_state)) { - return nullptr; - } - break; - case V8NDEFRecordDataSource::ContentType::kNDEFMessageInit: - NOTREACHED(); - break; - case V8NDEFRecordDataSource::ContentType::kString: - if (encoding_label != "utf-8") { - exception_state.ThrowTypeError( - "A DOMString data source is always encoded as \"utf-8\" so other " - "encodings are not allowed."); - return nullptr; - } - StringUTF8Adaptor utf8_string(data->GetAsString()); - bytes.Append(utf8_string.data(), utf8_string.size()); - break; + + if (MaybeIsBufferSource(record.data())) { + if (encoding_label != "utf-8" && encoding_label != "utf-16" && + encoding_label != "utf-16be" && encoding_label != "utf-16le") { + exception_state.ThrowTypeError( + "Encoding must be either \"utf-8\", \"utf-16\", \"utf-16be\", or " + "\"utf-16le\"."); + return nullptr; + } + auto* buffer_source = NativeValueTraits<V8BufferSource>::NativeValue( + script_state->GetIsolate(), record.data().V8Value(), exception_state); + if (exception_state.HadException()) + return nullptr; + if (!GetBytesOfBufferSource(buffer_source, &bytes, exception_state)) + return nullptr; + } else if (record.data().V8Value()->IsString()) { + if (encoding_label != "utf-8") { + exception_state.ThrowTypeError( + "A DOMString data source is always encoded as \"utf-8\" so other " + "encodings are not allowed."); + return nullptr; + } + const String data = NativeValueTraits<IDLString>::NativeValue( + script_state->GetIsolate(), record.data().V8Value(), exception_state); + if (exception_state.HadException()) + return nullptr; + bytes = GetUTF8DataFromString(data); + } else { + NOTREACHED(); } return MakeGarbageCollected<NDEFRecord>(id, encoding_label, language, @@ -201,20 +231,25 @@ } // Create a 'url' record or an 'absolute-url' record. -static NDEFRecord* CreateUrlRecord(const String& id, - const NDEFRecordInit& record, - ExceptionState& exception_state) { +NDEFRecord* CreateUrlRecord(const ScriptState* script_state, + const String& id, + const NDEFRecordInit& record, + ExceptionState& exception_state) { // https://w3c.github.io/web-nfc/#mapping-url-to-ndef - if ( - !record.hasData() || !record.data()->IsString() - ) { + // No need to check mediaType according to the spec. + if (!record.hasData() || !record.data().V8Value()->IsString()) { + // https://github.com/w3c/web-nfc/issues/623 + // This check could be removed if we threw a TypeError instead of a + // SyntaxError below. exception_state.ThrowTypeError( "The data for url NDEFRecord must be a String."); return nullptr; } - - // No need to check mediaType according to the spec. - const String& url = record.data()->GetAsString(); + auto* isolate = script_state->GetIsolate(); + const String& url = NativeValueTraits<IDLString>::NativeValue( + isolate, GetPayloadDataOrUndefined(isolate, record), exception_state); + if (exception_state.HadException()) + return nullptr; if (!KURL(NullURL(), url).IsValid()) { exception_state.ThrowDOMException(DOMExceptionCode::kSyntaxError, "Cannot parse data for url record."); @@ -226,17 +261,16 @@ record.recordType(), id, GetUTF8DataFromString(url)); } -static NDEFRecord* CreateMimeRecord(const String& id, - const NDEFRecordInit& record, - ExceptionState& exception_state) { +NDEFRecord* CreateMimeRecord(const ScriptState* script_state, + const String& id, + const NDEFRecordInit& record, + ExceptionState& exception_state) { // https://w3c.github.io/web-nfc/#mapping-binary-data-to-ndef - if ( - !record.hasData() || !record.data()->IsV8BufferSource() - ) { - exception_state.ThrowTypeError( - "The data for 'mime' NDEFRecord must be a BufferSource."); + auto* isolate = script_state->GetIsolate(); + auto* buffer_source = NativeValueTraits<V8BufferSource>::NativeValue( + isolate, GetPayloadDataOrUndefined(isolate, record), exception_state); + if (exception_state.HadException()) return nullptr; - } // ExtractMIMETypeFromMediaType() ignores parameters of the MIME type. String mime_type; @@ -247,51 +281,45 @@ } WTF::Vector<uint8_t> bytes; - if (!GetBytesOfBufferSource(record.data(), &bytes, exception_state)) { + if (!GetBytesOfBufferSource(buffer_source, &bytes, exception_state)) return nullptr; - } return MakeGarbageCollected<NDEFRecord>(id, mime_type, bytes); } -static NDEFRecord* CreateUnknownRecord(const String& id, - const NDEFRecordInit& record, - ExceptionState& exception_state) { - if ( - !record.hasData() || !record.data()->IsV8BufferSource() - ) { - exception_state.ThrowTypeError( - "The data for 'unknown' NDEFRecord must be a BufferSource."); +NDEFRecord* CreateUnknownRecord(const ScriptState* script_state, + const String& id, + const NDEFRecordInit& record, + ExceptionState& exception_state) { + auto* isolate = script_state->GetIsolate(); + auto* buffer_source = NativeValueTraits<V8BufferSource>::NativeValue( + isolate, GetPayloadDataOrUndefined(isolate, record), exception_state); + if (exception_state.HadException()) return nullptr; - } WTF::Vector<uint8_t> bytes; - if (!GetBytesOfBufferSource(record.data(), &bytes, exception_state)) { + if (!GetBytesOfBufferSource(buffer_source, &bytes, exception_state)) return nullptr; - } return MakeGarbageCollected<NDEFRecord>( device::mojom::blink::NDEFRecordTypeCategory::kStandardized, "unknown", id, bytes); } -static NDEFRecord* CreateSmartPosterRecord( - const ExecutionContext* execution_context, - const String& id, - const NDEFRecordInit& record, - ExceptionState& exception_state) { +NDEFRecord* CreateSmartPosterRecord(const ScriptState* script_state, + const String& id, + const NDEFRecordInit& record, + uint8_t records_depth, + ExceptionState& exception_state) { // https://w3c.github.io/web-nfc/#dfn-map-smart-poster-to-ndef - if ( - !record.hasData() || !record.data()->IsNDEFMessageInit() - ) { - exception_state.ThrowTypeError( - "The data for 'smart-poster' NDEFRecord must be an NDEFMessageInit."); + auto* isolate = script_state->GetIsolate(); + auto* ndef_message_init = NativeValueTraits<NDEFMessageInit>::NativeValue( + isolate, GetPayloadDataOrUndefined(isolate, record), exception_state); + if (exception_state.HadException()) return nullptr; - } NDEFMessage* payload_message = NDEFMessage::CreateAsPayloadOfSmartPoster( - execution_context, record.data()->GetAsNDEFMessageInit(), - exception_state); + script_state, ndef_message_init, exception_state, records_depth); if (exception_state.HadException()) return nullptr; DCHECK(payload_message); @@ -301,39 +329,45 @@ "smart-poster", id, payload_message); } -static NDEFRecord* CreateExternalRecord( - const ExecutionContext* execution_context, - const String& id, - const NDEFRecordInit& record, - ExceptionState& exception_state) { - const String& record_type = record.recordType(); - +NDEFRecord* CreateExternalRecord(const ScriptState* script_state, + const String& id, + const NDEFRecordInit& record, + uint8_t records_depth, + ExceptionState& exception_state) { // https://w3c.github.io/web-nfc/#dfn-map-external-data-to-ndef + if (record.hasData()) { - switch (record.data()->GetContentType()) { - case V8NDEFRecordDataSource::ContentType::kArrayBuffer: - case V8NDEFRecordDataSource::ContentType::kArrayBufferView: { - Vector<uint8_t> bytes; - if (!GetBytesOfBufferSource(record.data(), &bytes, exception_state)) { - return nullptr; - } - return MakeGarbageCollected<NDEFRecord>( - device::mojom::blink::NDEFRecordTypeCategory::kExternal, - record_type, id, bytes); - } - case V8NDEFRecordDataSource::ContentType::kNDEFMessageInit: { - NDEFMessage* payload_message = NDEFMessage::Create( - execution_context, record.data()->GetAsNDEFMessageInit(), - exception_state, /*is_embedded=*/true); - if (exception_state.HadException()) - return nullptr; - DCHECK(payload_message); - return MakeGarbageCollected<NDEFRecord>( - device::mojom::blink::NDEFRecordTypeCategory::kExternal, - record_type, id, payload_message); - } - case V8NDEFRecordDataSource::ContentType::kString: - break; + const String& record_type = record.recordType(); + + if (MaybeIsBufferSource(record.data())) { + auto* buffer_source = NativeValueTraits<V8BufferSource>::NativeValue( + script_state->GetIsolate(), record.data().V8Value(), exception_state); + if (exception_state.HadException()) + return nullptr; + + Vector<uint8_t> bytes; + if (!GetBytesOfBufferSource(buffer_source, &bytes, exception_state)) + return nullptr; + + return MakeGarbageCollected<NDEFRecord>( + device::mojom::blink::NDEFRecordTypeCategory::kExternal, record_type, + id, bytes); + } else if (record.data().IsObject()) { + auto* ndef_message_init = NativeValueTraits<NDEFMessageInit>::NativeValue( + script_state->GetIsolate(), record.data().V8Value(), exception_state); + if (exception_state.HadException()) + return nullptr; + + NDEFMessage* payload_message = NDEFMessage::Create( + script_state, ndef_message_init, exception_state, + /*records_depth=*/records_depth, /*is_embedded=*/true); + if (exception_state.HadException()) + return nullptr; + DCHECK(payload_message); + + return MakeGarbageCollected<NDEFRecord>( + device::mojom::blink::NDEFRecordTypeCategory::kExternal, record_type, + id, payload_message); } } @@ -343,38 +377,45 @@ return nullptr; } -static NDEFRecord* CreateLocalRecord(const ExecutionContext* execution_context, - const String& id, - const NDEFRecordInit& record, - ExceptionState& exception_state) { - const String& record_type = record.recordType(); - +NDEFRecord* CreateLocalRecord(const ScriptState* script_state, + const String& id, + const NDEFRecordInit& record, + uint8_t records_depth, + ExceptionState& exception_state) { // https://w3c.github.io/web-nfc/#dfn-map-local-type-to-ndef + if (record.hasData()) { - switch (record.data()->GetContentType()) { - case V8NDEFMessageSource::ContentType::kArrayBuffer: - case V8NDEFMessageSource::ContentType::kArrayBufferView: { - Vector<uint8_t> bytes; - if (!GetBytesOfBufferSource(record.data(), &bytes, exception_state)) { - return nullptr; - } - return MakeGarbageCollected<NDEFRecord>( - device::mojom::blink::NDEFRecordTypeCategory::kLocal, record_type, - id, bytes); - } - case V8NDEFMessageSource::ContentType::kNDEFMessageInit: { - NDEFMessage* payload_message = NDEFMessage::Create( - execution_context, record.data()->GetAsNDEFMessageInit(), - exception_state, /*is_embedded=*/true); - if (exception_state.HadException()) - return nullptr; - DCHECK(payload_message); - return MakeGarbageCollected<NDEFRecord>( - device::mojom::blink::NDEFRecordTypeCategory::kLocal, record_type, - id, payload_message); - } - case V8NDEFMessageSource::ContentType::kString: - break; + const String& record_type = record.recordType(); + + if (MaybeIsBufferSource(record.data())) { + auto* buffer_source = NativeValueTraits<V8BufferSource>::NativeValue( + script_state->GetIsolate(), record.data().V8Value(), exception_state); + if (exception_state.HadException()) + return nullptr; + + Vector<uint8_t> bytes; + if (!GetBytesOfBufferSource(buffer_source, &bytes, exception_state)) + return nullptr; + + return MakeGarbageCollected<NDEFRecord>( + device::mojom::blink::NDEFRecordTypeCategory::kLocal, record_type, id, + bytes); + } else if (record.data().IsObject()) { + auto* ndef_message_init = NativeValueTraits<NDEFMessageInit>::NativeValue( + script_state->GetIsolate(), record.data().V8Value(), exception_state); + if (exception_state.HadException()) + return nullptr; + + NDEFMessage* payload_message = NDEFMessage::Create( + script_state, ndef_message_init, exception_state, + /*records_depth=*/records_depth, /*is_embedded=*/true); + if (exception_state.HadException()) + return nullptr; + DCHECK(payload_message); + + return MakeGarbageCollected<NDEFRecord>( + device::mojom::blink::NDEFRecordTypeCategory::kLocal, record_type, id, + payload_message); } } @@ -387,9 +428,18 @@ } // namespace // static -NDEFRecord* NDEFRecord::Create(const ExecutionContext* execution_context, +NDEFRecord* NDEFRecord::CreateForBindings(const ScriptState* script_state, + const NDEFRecordInit* record, + ExceptionState& exception_state) { + return Create(script_state, record, exception_state, /*records_depth=*/0U, + /*is_embedded=*/false); +} + +// static +NDEFRecord* NDEFRecord::Create(const ScriptState* script_state, const NDEFRecordInit* record, ExceptionState& exception_state, + uint8_t records_depth, bool is_embedded) { // https://w3c.github.io/web-nfc/#creating-ndef-record const String& record_type = record->recordType(); @@ -419,18 +469,18 @@ device::mojom::blink::NDEFRecordTypeCategory::kStandardized, record_type, /*id=*/String(), WTF::Vector<uint8_t>()); } else if (record_type == "text") { - return CreateTextRecord(execution_context, id, *record, exception_state); + return CreateTextRecord(script_state, id, *record, exception_state); } else if (record_type == "url" || record_type == "absolute-url") { - return CreateUrlRecord(id, *record, exception_state); + return CreateUrlRecord(script_state, id, *record, exception_state); } else if (record_type == "mime") { - return CreateMimeRecord(id, *record, exception_state); + return CreateMimeRecord(script_state, id, *record, exception_state); } else if (record_type == "unknown") { - return CreateUnknownRecord(id, *record, exception_state); + return CreateUnknownRecord(script_state, id, *record, exception_state); } else if (record_type == "smart-poster") { - return CreateSmartPosterRecord(execution_context, id, *record, + return CreateSmartPosterRecord(script_state, id, *record, records_depth, exception_state); } else if (IsValidExternalType(record_type)) { - return CreateExternalRecord(execution_context, id, *record, + return CreateExternalRecord(script_state, id, *record, records_depth, exception_state); } else if (IsValidLocalType(record_type)) { if (!is_embedded) { @@ -439,7 +489,8 @@ "of another record (smart-poster, external, or local)."); return nullptr; } - return CreateLocalRecord(execution_context, id, *record, exception_state); + return CreateLocalRecord(script_state, id, *record, records_depth, + exception_state); } exception_state.ThrowTypeError("Invalid NDEFRecord type."); @@ -490,12 +541,11 @@ lang_(lang), payload_data_(std::move(data)) {} -NDEFRecord::NDEFRecord(const ExecutionContext* execution_context, - const String& text) +NDEFRecord::NDEFRecord(const ScriptState* script_state, const String& text) : category_(device::mojom::blink::NDEFRecordTypeCategory::kStandardized), record_type_("text"), encoding_("utf-8"), - lang_(getDocumentLanguage(execution_context)), + lang_(getDocumentLanguage(ExecutionContext::From(script_state))), payload_data_(GetUTF8DataFromString(text)) {} NDEFRecord::NDEFRecord(const String& id,
diff --git a/third_party/blink/renderer/modules/nfc/ndef_record.h b/third_party/blink/renderer/modules/nfc/ndef_record.h index 0d11d3f..e309c4d2 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_record.h +++ b/third_party/blink/renderer/modules/nfc/ndef_record.h
@@ -5,6 +5,8 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_RECORD_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_RECORD_H_ +#include <stdint.h> + #include "services/device/public/mojom/nfc.mojom-blink-forward.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/renderer/modules/modules_export.h" @@ -17,20 +19,27 @@ class DOMDataView; class ExceptionState; -class ExecutionContext; class NDEFMessage; class NDEFRecordInit; +class ScriptState; class MODULES_EXPORT NDEFRecord final : public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); public: + // This function is only supposed to be used by the automatically generated + // bindings code. Use Create() instead. + static NDEFRecord* CreateForBindings(const ScriptState*, + const NDEFRecordInit*, + ExceptionState&); + // |is_embedded| indicates if this record is within the context of a parent // record. - static NDEFRecord* Create(const ExecutionContext*, + static NDEFRecord* Create(const ScriptState*, const NDEFRecordInit*, ExceptionState&, - bool is_embedded = false); + uint8_t records_depth, + bool is_embedded); explicit NDEFRecord(device::mojom::NDEFRecordTypeCategory, const String& record_type, @@ -54,7 +63,7 @@ // Only for constructing "text" type record from just a text. The type // category will be device::mojom::NDEFRecordTypeCategory::kStandardized. // Called by NDEFMessage. - explicit NDEFRecord(const ExecutionContext*, const String&); + explicit NDEFRecord(const ScriptState*, const String&); // Only for constructing "mime" type record. The type category will be // device::mojom::NDEFRecordTypeCategory::kStandardized.
diff --git a/third_party/blink/renderer/modules/nfc/ndef_record.idl b/third_party/blink/renderer/modules/nfc/ndef_record.idl index 0d6af2eb..13d71e2 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_record.idl +++ b/third_party/blink/renderer/modules/nfc/ndef_record.idl
@@ -9,7 +9,7 @@ SecureContext, Exposed=Window ] interface NDEFRecord { - [CallWith=ExecutionContext, RaisesException] constructor(NDEFRecordInit recordInit); + [CallWith=ScriptState, ImplementedAs=CreateForBindings, RaisesException] constructor(NDEFRecordInit recordInit); readonly attribute USVString recordType; readonly attribute USVString? mediaType; readonly attribute USVString? id;
diff --git a/third_party/blink/renderer/modules/nfc/ndef_record_init.idl b/third_party/blink/renderer/modules/nfc/ndef_record_init.idl index 135130b..e90af67 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_record_init.idl +++ b/third_party/blink/renderer/modules/nfc/ndef_record_init.idl
@@ -2,12 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://w3c.github.io/web-nfc/#idl-def-ndefrecorddatasource - -typedef (DOMString or BufferSource or NDEFMessageInit) NDEFRecordDataSource; - // https://w3c.github.io/web-nfc/#dom-ndefrecordinit - dictionary NDEFRecordInit { required USVString recordType; USVString mediaType; @@ -16,5 +11,5 @@ USVString encoding; USVString lang; - NDEFRecordDataSource data; + any data; // DOMString or BufferSource or NDEFMessageInit };
diff --git a/third_party/blink/renderer/platform/bindings/wrapper_type_info.cc b/third_party/blink/renderer/platform/bindings/wrapper_type_info.cc index 15d7102..5f51dd7 100644 --- a/third_party/blink/renderer/platform/bindings/wrapper_type_info.cc +++ b/third_party/blink/renderer/platform/bindings/wrapper_type_info.cc
@@ -49,18 +49,4 @@ return v8_template; } -void WrapperTypeInfo::Trace(Visitor* visitor, const void* impl) const { - switch (wrapper_class_id) { - case WrapperTypeInfo::kNodeClassId: - case WrapperTypeInfo::kObjectClassId: - visitor->Trace(reinterpret_cast<const ScriptWrappable*>(impl)); - break; - case WrapperTypeInfo::kCustomWrappableId: - visitor->Trace(reinterpret_cast<const CustomWrappable*>(impl)); - break; - default: - NOTREACHED(); - } -} - } // namespace blink
diff --git a/third_party/blink/renderer/platform/bindings/wrapper_type_info.h b/third_party/blink/renderer/platform/bindings/wrapper_type_info.h index 240f9e1..f38ff5e 100644 --- a/third_party/blink/renderer/platform/bindings/wrapper_type_info.h +++ b/third_party/blink/renderer/platform/bindings/wrapper_type_info.h
@@ -138,10 +138,6 @@ kInheritFromActiveScriptWrappable; } - // Garbage collection support for when the type depends the WrapperTypeInfo - // object. - void Trace(Visitor*, const void*) const; - // This field must be the first member of the struct WrapperTypeInfo. // See also static_assert() in .cpp file. const gin::GinEmbedder gin_embedder;
diff --git a/third_party/blink/tools/blinkpy/w3c/directory_owners_extractor.py b/third_party/blink/tools/blinkpy/w3c/directory_owners_extractor.py index f6d20ae..8fb3d09a 100644 --- a/third_party/blink/tools/blinkpy/w3c/directory_owners_extractor.py +++ b/third_party/blink/tools/blinkpy/w3c/directory_owners_extractor.py
@@ -168,18 +168,17 @@ # dirmd starts with an absolute directory path, `dir_path`, traverses all # parent directories and stops at `root_path` to find the first available DIR_METADATA # file. `root_path` is the web_tests directory. - print(self.executive) json_data = self.executive.run_command([ self.finder.path_from_depot_tools_base('dirmd'), 'compute', '-root', root_path, dir_path ]) - print(json_data) try: data = json.loads(json_data) except ValueError: return None - relative_path = self.filesystem.relpath(dir_path, root_path) + relative_path = self.filesystem.relpath( + dir_path, self.finder.chromium_base()) return WPTDirMetadata(data, relative_path)
diff --git a/third_party/blink/tools/blinkpy/w3c/directory_owners_extractor_unittest.py b/third_party/blink/tools/blinkpy/w3c/directory_owners_extractor_unittest.py index 19e75e7..c732f5a 100644 --- a/third_party/blink/tools/blinkpy/w3c/directory_owners_extractor_unittest.py +++ b/third_party/blink/tools/blinkpy/w3c/directory_owners_extractor_unittest.py
@@ -178,7 +178,7 @@ def test_is_wpt_notify_enabled_true(self): data = ( - '{"dirs":{"a/b":{"monorail":' + '{"dirs":{"third_party/blink/web_tests/a/b":{"monorail":' '{"component":"foo"},"teamEmail":"bar","wpt":{"notify":"YES"}}}}') self.host.executive = MockExecutive(output=data) extractor = DirectoryOwnersExtractor(self.host) @@ -189,7 +189,7 @@ def test_is_wpt_notify_enabled_false(self): data = ( - '{"dirs":{"a/b":{"monorail":' + '{"dirs":{"third_party/blink/web_tests/a/b":{"monorail":' '{"component":"foo"},"teamEmail":"bar","wpt":{"notify":"NO"}}}}') self.host.executive = MockExecutive(output=data) extractor = DirectoryOwnersExtractor(self.host) @@ -208,7 +208,7 @@ def test_extract_component(self): data = ( - '{"dirs":{"a/b":{"monorail":' + '{"dirs":{"third_party/blink/web_tests/a/b":{"monorail":' '{"component":"foo"},"teamEmail":"bar","wpt":{"notify":"YES"}}}}') self.host.executive = MockExecutive(output=data) extractor = DirectoryOwnersExtractor(self.host) @@ -219,7 +219,7 @@ def test_read_dir_metadata_success(self): data = ( - '{"dirs":{"a/b":{"monorail":' + '{"dirs":{"third_party/blink/web_tests/a/b":{"monorail":' '{"component":"foo"},"teamEmail":"bar","wpt":{"notify":"YES"}}}}') self.host.executive = MockExecutive(output=data) extractor = DirectoryOwnersExtractor(self.host) @@ -251,8 +251,8 @@ class WPTDirMetadataTest(unittest.TestCase): def test_WPTDirMetadata_empty_content(self): - empty_data = '{"dirs":{"a/b":{}}}' - wpt_dir_metadata = WPTDirMetadata(json.loads(empty_data), 'a/b') + empty_data = '{"dirs":{"third_party/blink/web_tests/a/b":{}}}' + wpt_dir_metadata = WPTDirMetadata(json.loads(empty_data), 'third_party/blink/web_tests/a/b') self.assertEqual(wpt_dir_metadata.team_email, None) self.assertEqual(wpt_dir_metadata.should_notify, None) self.assertEqual(wpt_dir_metadata.component, None)
diff --git a/third_party/blink/tools/blinkpy/w3c/import_notifier.py b/third_party/blink/tools/blinkpy/w3c/import_notifier.py index dbcbb056..09b00277 100644 --- a/third_party/blink/tools/blinkpy/w3c/import_notifier.py +++ b/third_party/blink/tools/blinkpy/w3c/import_notifier.py
@@ -258,9 +258,17 @@ self.finder.web_tests_dir(), directory) owners_file = self.host.filesystem.join(full_directory, 'OWNERS') metadata_file = self.host.filesystem.join(full_directory, - 'WPT_METADATA') - is_wpt_notify_enabled = self.owners_extractor.is_wpt_notify_enabled( - metadata_file) + 'DIR_METADATA') + is_wpt_notify_enabled = False + try: + is_wpt_notify_enabled = self.owners_extractor.is_wpt_notify_enabled( + metadata_file) + except KeyError: + _log.info('KeyError when parsing %s' % metadata_file) + + if not is_wpt_notify_enabled: + _log.info("WPT-NOTIFY disabled in %s." % full_directory) + continue owners = self.owners_extractor.extract_owners(owners_file) # owners may be empty but not None. @@ -298,16 +306,8 @@ components, labels=['Test-WebTest']) _log.info(unicode(bug)) - - if is_wpt_notify_enabled: - _log.info( - "WPT-NOTIFY enabled in this directory; adding the bug to the pending list." - ) - bugs.append(bug) - else: - _log.info( - "WPT-NOTIFY disabled in this directory; discarding the bug." - ) + _log.info("WPT-NOTIFY enabled in %s; adding the bug to the pending list." % full_directory) + bugs.append(bug) return bugs def format_commit_list(self, imported_commits, directory):
diff --git a/third_party/blink/tools/blinkpy/w3c/import_notifier_unittest.py b/third_party/blink/tools/blinkpy/w3c/import_notifier_unittest.py index a961b8f0..77ee480 100644 --- a/third_party/blink/tools/blinkpy/w3c/import_notifier_unittest.py +++ b/third_party/blink/tools/blinkpy/w3c/import_notifier_unittest.py
@@ -281,7 +281,7 @@ self.host.filesystem.write_text_file( MOCK_WEB_TESTS + 'external/wpt/bar/OWNERS', 'test@chromium.org') - data = ('{"dirs":{"external/wpt/foo":{"monorail":{"component":' + data = ('{"dirs":{"third_party/blink/web_tests/external/wpt/foo":{"monorail":{"component":' '"Blink>Infra>Ecosystem"},"teamEmail":"email","wpt":{' '"notify":"YES"}}}}')
diff --git a/third_party/blink/tools/blinkpy/web_tests/port/fuchsia.py b/third_party/blink/tools/blinkpy/web_tests/port/fuchsia.py index d7b9b41b..6467e69 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/fuchsia.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/fuchsia.py
@@ -182,11 +182,11 @@ def cleanup(self): try: - if self._target: - self._target.Stop() - finally: if self._pkg_repo: self._pkg_repo.__exit__(None, None, None) + finally: + if self._target: + self._target.Stop() class FuchsiaPort(base.Port):
diff --git a/third_party/blink/web_tests/NeverFixTests b/third_party/blink/web_tests/NeverFixTests index d054f545..023710a2 100644 --- a/third_party/blink/web_tests/NeverFixTests +++ b/third_party/blink/web_tests/NeverFixTests
@@ -1096,6 +1096,8 @@ external/wpt/appmanifest/shortcuts-member/shortcuts-member-skip-for-undefined-url-manual.html [ Skip ] external/wpt/audio-output/setSinkId-manual.https.html [ Skip ] external/wpt/battery-status/battery-charging-manual.https.html [ Skip ] +external/wpt/battery-status/battery-discharging-manual.https.html [ Skip ] +external/wpt/battery-status/battery-full-manual.https.html [ Skip ] external/wpt/battery-status/battery-plugging-in-manual.https.html [ Skip ] external/wpt/battery-status/battery-unplugging-manual.https.html [ Skip ] external/wpt/clipboard-apis/async-navigator-clipboard-basics.https.html [ Skip ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 7fd37b4..6812b3d 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -1380,8 +1380,6 @@ crbug.com/1225630 virtual/layout_ng_block_frag/fast/multicol/infinite-height-causing-fractional-row-height-crash.html [ Skip ] crbug.com/1225630 virtual/layout_ng_block_frag/fast/multicol/infinitely-tall-content-in-outer-crash.html [ Skip ] crbug.com/1225630 virtual/layout_ng_block_frag/fast/multicol/insane-column-count-and-padding-nested-crash.html [ Skip ] -crbug.com/1066626 virtual/layout_ng_block_frag/fast/multicol/layers-split-across-columns.html [ Failure ] -crbug.com/1066626 virtual/layout_ng_block_frag/fast/multicol/mixed-opacity-fixed-test.html [ Failure ] crbug.com/1079031 virtual/layout_ng_block_frag/fast/multicol/mixed-opacity-test.html [ Crash Failure ] crbug.com/1225630 virtual/layout_ng_block_frag/fast/multicol/nested-very-tall-inside-short-crash.html [ Skip ] crbug.com/1242348 virtual/layout_ng_block_frag/fast/multicol/tall-line-in-short-block.html [ Failure ] @@ -5084,8 +5082,6 @@ # Sheriff 2019-12-02 crbug.com/1029528 [ Linux ] http/tests/devtools/network/oopif-content.js [ Failure Pass ] -crbug.com/833100 [ Mac ] external/wpt/battery-status/battery-full-manual.https.html [ Failure Pass ] - crbug.com/1031345 media/controls/overlay-play-button-tap-to-hide.html [ Pass Timeout ] # Temporary SkiaRenderer regressions @@ -6258,7 +6254,6 @@ external/wpt/css/css-transforms/2d-rotate-001.html [ Failure ] external/wpt/css/css-transforms/css-skew-002.html [ Failure ] -external/wpt/css/css-transforms/css-transforms-transformlist.html [ Failure ] external/wpt/css/css-transforms/group/svg-transform-nested-009.html [ Failure ] external/wpt/css/css-transforms/rotate_45deg.html [ Failure ] external/wpt/css/css-transforms/skew-test1.html [ Failure ]
diff --git a/third_party/blink/web_tests/external/wpt/battery-status/battery-discharging-manual.https-expected.txt b/third_party/blink/web_tests/external/wpt/battery-status/battery-discharging-manual.https-expected.txt deleted file mode 100644 index 6057a79e..0000000 --- a/third_party/blink/web_tests/external/wpt/battery-status/battery-discharging-manual.https-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Battery Test: battery neither empty or full, charger unplugged in assert_false: charging must be set to false expected false got true -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/css/css-grid/grid-layout-properties-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-grid/grid-layout-properties-expected.txt index 780654b..9194f23 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-grid/grid-layout-properties-expected.txt +++ b/third_party/blink/web_tests/external/wpt/css/css-grid/grid-layout-properties-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 140 tests; 119 PASS, 21 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 140 tests; 121 PASS, 19 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS display: grid PASS display: inline-grid PASS grid-template-columns @@ -63,8 +63,8 @@ PASS grid-auto-flow.initial PASS grid-auto-flow.row PASS grid-auto-flow.column -FAIL grid-auto-flow.dense assert_equals: dense expected "dense" but got "row dense" -FAIL grid-auto-flow.row dense assert_equals: row dense expected "dense" but got "row dense" +PASS grid-auto-flow.dense +PASS grid-auto-flow.row dense PASS grid-auto-flow.column dense PASS grid-auto-flow.reset PASS grid-row-start
diff --git a/third_party/blink/web_tests/external/wpt/css/css-grid/parsing/grid-auto-flow-computed-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-grid/parsing/grid-auto-flow-computed-expected.txt deleted file mode 100644 index 4d03b54..0000000 --- a/third_party/blink/web_tests/external/wpt/css/css-grid/parsing/grid-auto-flow-computed-expected.txt +++ /dev/null
@@ -1,10 +0,0 @@ -This is a testharness.js-based test. -PASS Property grid-auto-flow value 'row' -PASS Property grid-auto-flow value 'column' -FAIL Property grid-auto-flow value 'row dense' assert_equals: expected "dense" but got "row dense" -PASS Property grid-auto-flow value 'column dense' -FAIL Property grid-auto-flow value 'dense row' assert_equals: expected "dense" but got "row dense" -PASS Property grid-auto-flow value 'dense column' -FAIL Property grid-auto-flow value 'dense' assert_equals: expected "dense" but got "row dense" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/css/css-grid/parsing/grid-auto-flow-valid-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-grid/parsing/grid-auto-flow-valid-expected.txt deleted file mode 100644 index d2139ff..0000000 --- a/third_party/blink/web_tests/external/wpt/css/css-grid/parsing/grid-auto-flow-valid-expected.txt +++ /dev/null
@@ -1,10 +0,0 @@ -This is a testharness.js-based test. -PASS e.style['grid-auto-flow'] = "row" should set the property value -PASS e.style['grid-auto-flow'] = "column" should set the property value -FAIL e.style['grid-auto-flow'] = "row dense" should set the property value assert_equals: serialization should be canonical expected "dense" but got "row dense" -FAIL e.style['grid-auto-flow'] = "dense row" should set the property value assert_equals: serialization should be canonical expected "dense" but got "row dense" -PASS e.style['grid-auto-flow'] = "dense" should set the property value -PASS e.style['grid-auto-flow'] = "column dense" should set the property value -PASS e.style['grid-auto-flow'] = "dense column" should set the property value -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/grid-auto-flow.html b/third_party/blink/web_tests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/grid-auto-flow.html index 4447afe..d01d025 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/grid-auto-flow.html +++ b/third_party/blink/web_tests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/grid-auto-flow.html
@@ -19,7 +19,7 @@ ]); runUnsupportedPropertyTests('grid-auto-flow', [ - 'row dense', 'column dense', + 'column dense', ]); </script>
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NDEFMessage_recursion-limit.https.window.js b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFMessage_recursion-limit.https.window.js new file mode 100644 index 0000000..49a6952 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFMessage_recursion-limit.https.window.js
@@ -0,0 +1,156 @@ +'use strict'; + +test(() => { + let recordInit = {recordType: 'w3.org:ExternalRecord'}; + const messageInit = {records: [recordInit]}; + recordInit.data = messageInit; + + assert_throws_js(TypeError, () => { + new NDEFMessage(messageInit); + }, 'Creating a recursive NDEFMessage throws a TypeError'); + assert_throws_js(TypeError, () => { + new NDEFRecord(recordInit); + }, 'Creating a recursive NDEFRecord throws a TypeError'); + assert_throws_js(TypeError, () => { + new NDEFReadingEvent('message', {message: messageInit}); + }, 'Creating a recursive NDEFReadingEvent throws a TypeError'); +}, 'NDEFRecord and NDEFMessage cycle in external records'); + +test(() => { + let recordInit = {recordType: ':local'}; + const messageInit = {records: [recordInit]}; + recordInit.data = messageInit; + + const externalRecordMessageInit = { + records: [{recordType: 'w3.org:ExternalRecord', data: messageInit}] + }; + + assert_throws_js(TypeError, () => { + new NDEFMessage(externalRecordMessageInit); + }, 'Creating a recursive NDEFMessage throws a TypeError'); + assert_throws_js(TypeError, () => { + new NDEFRecord(externalRecordMessageInit.records[0]); + }, 'Creating a recursive NDEFRecord throws a TypeError'); + assert_throws_js(TypeError, () => { + new NDEFReadingEvent('message', {message: externalRecordMessageInit}); + }, 'Creating a recursive NDEFReadingEvent throws a TypeError'); +}, 'NDEFRecord and NDEFMessage cycle in local records'); + +test(() => { + let recordInit = {recordType: 'smart-poster'}; + const messageInit = { + records: [ + // Smart poster records require an URL record. Add it here so we can be + // sure a TypeError is being thrown because of the recursion limit, not + // the lack of a mandatory record. + {recordType: 'url', data: 'https://w3.org'}, recordInit + ] + }; + recordInit.data = messageInit; + + assert_throws_js(TypeError, () => { + new NDEFMessage(messageInit); + }, 'Creating a recursive NDEFMessage throws a TypeError'); + assert_throws_js(TypeError, () => { + new NDEFRecord(recordInit); + }, 'Creating a recursive NDEFRecord throws a TypeError'); + assert_throws_js(TypeError, () => { + new NDEFReadingEvent('message', {message: messageInit}); + }, 'Creating a recursive NDEFReadingEvent throws a TypeError'); +}, 'NDEFRecord and NDEFMessage cycle in smart poster records'); + +function makeSmartPosterMessageInit(innerMessageInit) { + const innerRecords = innerMessageInit.records; + return { + records: [{ + recordType: 'smart-poster', + data: { + records: + [{recordType: 'url', data: 'https://w3.org'}].concat(innerRecords) + } + }] + }; +} + +// Creates an NDEFMessageInit with nested records except for the innermost +// one, which is an empty record. +function makeRecursiveMessageInit(innerRecordType, maxDepth) { + function innerHelper(value) { + if (++value > maxDepth) { + return {records: [{recordType: 'empty'}]}; + } + + return {records: [{recordType: innerRecordType, data: innerHelper(value)}]}; + } + + return innerHelper(0); +} + +// Maximum number of chained NDEFMessages according to the spec. +const MAX_NESTING_LEVEL = 32; + +test(() => { + // makeRecursiveMessageInit(..., N) will cause N NDEFMessages to be created + // when it is parsed. The calls are passed to an outer NDEFMessage + // constructor, so we end up with N+1 NDEFMessage objects. The spec allows + // up to 32 NDEFMessages in the same chain, and we have 33 here. + assert_throws_js(TypeError, () => { + new NDEFMessage( + makeRecursiveMessageInit('w3.org:ExternalRecord', MAX_NESTING_LEVEL)); + }, 'Creating a recursive NDEFMessage throws a TypeError'); + assert_throws_js(TypeError, () => { + new NDEFReadingEvent('message', { + message: + makeRecursiveMessageInit('w3.org:ExternalRecord', MAX_NESTING_LEVEL) + }); + }, 'Creating a recursive NDEFReadingEvent throws a TypeError'); + + // Here we call makeRecursiveMessageInit() with a smaller number than above + // because there is a smart poster wrapping everything that also creates an + // NDEFMessage. + assert_throws_js(TypeError, () => { + const innerMessageInit = makeRecursiveMessageInit( + 'w3.org:ExternalRecord', MAX_NESTING_LEVEL - 1); + new NDEFMessage(makeSmartPosterMessageInit(innerMessageInit)); + }, 'Creating a recursive NDEFMessage throws a TypeError'); + assert_throws_js(TypeError, () => { + const innerMessageInit = + makeRecursiveMessageInit(':local', MAX_NESTING_LEVEL - 1); + new NDEFMessage(makeSmartPosterMessageInit(innerMessageInit)); + }, 'Creating a recursive NDEFMessage throws a TypeError'); + assert_throws_js(TypeError, () => { + const innerMessageInit = makeRecursiveMessageInit( + 'w3.org:ExternalRecord', MAX_NESTING_LEVEL - 1); + new NDEFReadingEvent( + 'message', {message: makeSmartPosterMessageInit(innerMessageInit)}); + }, 'Creating a recursive NDEFMessage throws a TypeError'); + assert_throws_js(TypeError, () => { + const innerMessageInit = + makeRecursiveMessageInit(':local', MAX_NESTING_LEVEL - 1); + new NDEFReadingEvent( + 'message', {message: makeSmartPosterMessageInit(innerMessageInit)}); + }, 'Creating a recursive NDEFMessage throws a TypeError'); +}, 'Create too many nested NDEFMessages'); + +// See above for explanations about the counts passed to +// makeRecursiveMessageInit(). +test(() => { + new NDEFMessage( + makeRecursiveMessageInit('w3.org:ExternalRecord', MAX_NESTING_LEVEL - 1)); + new NDEFReadingEvent('message', { + message: + makeRecursiveMessageInit('w3.org:ExternalRecord', MAX_NESTING_LEVEL - 1) + }); + + let innerMessageInit; + + innerMessageInit = + makeRecursiveMessageInit('w3.org:ExternalRecord', MAX_NESTING_LEVEL - 2); + new NDEFMessage(makeSmartPosterMessageInit(innerMessageInit)); + new NDEFReadingEvent( + 'message', {message: makeSmartPosterMessageInit(innerMessageInit)}); + innerMessageInit = makeRecursiveMessageInit(':local', MAX_NESTING_LEVEL - 2); + new NDEFMessage(makeSmartPosterMessageInit(innerMessageInit)); + new NDEFReadingEvent( + 'message', {message: makeSmartPosterMessageInit(innerMessageInit)}); +}, 'Nest maximum number of NDEFMessages')
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReadingEvent_constructor.https.window.js b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReadingEvent_constructor.https.window.js index 418a8a6..d812dbaf 100644 --- a/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReadingEvent_constructor.https.window.js +++ b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReadingEvent_constructor.https.window.js
@@ -53,5 +53,5 @@ assert_equals(event.message.records[0].recordType, 'text', 'recordType'); assert_equals(event.message.records[0].mediaType, null, 'mediaType'); assert_equals(event.message.records[0].encoding, 'utf-8', 'encoding'); - assert_equals(event.message.records[0].lang, null, 'lang is not set'); -}, 'NDEFReadingEvent constructor does not set NDEFRecord#lang for any text records it embeds'); + assert_equals(event.message.records[0].lang, 'en', 'lang'); +}, 'NDEFReadingEvent constructor sets NDEFRecord#lang for the text records it embeds');
diff --git a/third_party/blink/web_tests/fast/css-grid-layout/grid-auto-flow-get-set-expected.txt b/third_party/blink/web_tests/fast/css-grid-layout/grid-auto-flow-get-set-expected.txt index 403709e..31af5bc 100644 --- a/third_party/blink/web_tests/fast/css-grid-layout/grid-auto-flow-get-set-expected.txt +++ b/third_party/blink/web_tests/fast/css-grid-layout/grid-auto-flow-get-set-expected.txt
@@ -5,11 +5,11 @@ Test getting grid-auto-flow set through CSS PASS window.getComputedStyle(gridAutoFlowColumnSparse, '').getPropertyValue('grid-auto-flow') is 'column' PASS window.getComputedStyle(gridAutoFlowRowSparse, '').getPropertyValue('grid-auto-flow') is 'row' -PASS window.getComputedStyle(gridAutoFlowDense, '').getPropertyValue('grid-auto-flow') is 'row dense' +PASS window.getComputedStyle(gridAutoFlowDense, '').getPropertyValue('grid-auto-flow') is 'dense' PASS window.getComputedStyle(gridAutoFlowColumnDense, '').getPropertyValue('grid-auto-flow') is 'column dense' -PASS window.getComputedStyle(gridAutoFlowRowDense, '').getPropertyValue('grid-auto-flow') is 'row dense' +PASS window.getComputedStyle(gridAutoFlowRowDense, '').getPropertyValue('grid-auto-flow') is 'dense' PASS window.getComputedStyle(gridAutoFlowDenseColumn, '').getPropertyValue('grid-auto-flow') is 'column dense' -PASS window.getComputedStyle(gridAutoFlowDenseRow, '').getPropertyValue('grid-auto-flow') is 'row dense' +PASS window.getComputedStyle(gridAutoFlowDenseRow, '').getPropertyValue('grid-auto-flow') is 'dense' PASS window.getComputedStyle(gridAutoFlowInherit, '').getPropertyValue('grid-auto-flow') is 'column' PASS window.getComputedStyle(gridAutoFlowNoInherit, '').getPropertyValue('grid-auto-flow') is 'row' @@ -34,12 +34,12 @@ PASS window.getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is 'column' PASS element.style.gridAutoFlow is 'column dense' PASS window.getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is 'column dense' -PASS element.style.gridAutoFlow is 'row dense' -PASS window.getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is 'row dense' +PASS element.style.gridAutoFlow is 'dense' +PASS window.getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is 'dense' PASS element.style.gridAutoFlow is 'column dense' PASS window.getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is 'column dense' -PASS element.style.gridAutoFlow is 'row dense' -PASS window.getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is 'row dense' +PASS element.style.gridAutoFlow is 'dense' +PASS window.getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is 'dense' PASS element.style.gridAutoFlow is 'row' PASS window.getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is 'row'
diff --git a/third_party/blink/web_tests/fast/css-grid-layout/grid-auto-flow-get-set.html b/third_party/blink/web_tests/fast/css-grid-layout/grid-auto-flow-get-set.html index 53beeea..a32c988 100644 --- a/third_party/blink/web_tests/fast/css-grid-layout/grid-auto-flow-get-set.html +++ b/third_party/blink/web_tests/fast/css-grid-layout/grid-auto-flow-get-set.html
@@ -83,11 +83,11 @@ debug("Test getting grid-auto-flow set through CSS"); checkGridAutoFlowSetCSSValue("gridAutoFlowColumnSparse", "column"); checkGridAutoFlowSetCSSValue("gridAutoFlowRowSparse", "row"); - checkGridAutoFlowSetCSSValue("gridAutoFlowDense", "row dense"); + checkGridAutoFlowSetCSSValue("gridAutoFlowDense", "dense"); checkGridAutoFlowSetCSSValue("gridAutoFlowColumnDense", "column dense"); - checkGridAutoFlowSetCSSValue("gridAutoFlowRowDense", "row dense"); + checkGridAutoFlowSetCSSValue("gridAutoFlowRowDense", "dense"); checkGridAutoFlowSetCSSValue("gridAutoFlowDenseColumn", "column dense"); - checkGridAutoFlowSetCSSValue("gridAutoFlowDenseRow", "row dense"); + checkGridAutoFlowSetCSSValue("gridAutoFlowDenseRow", "dense"); checkGridAutoFlowSetCSSValue("gridAutoFlowInherit", "column"); checkGridAutoFlowSetCSSValue("gridAutoFlowNoInherit", "row"); @@ -110,9 +110,9 @@ debug("Test getting and setting grid-auto-flow through JS"); checkGridAutoFlowSetJSValue("column", "column", "column"); checkGridAutoFlowSetJSValue("column dense", "column dense", "column dense"); - checkGridAutoFlowSetJSValue("row dense", "row dense", "row dense"); + checkGridAutoFlowSetJSValue("row dense", "dense", "dense"); checkGridAutoFlowSetJSValue("dense column", "column dense", "column dense"); - checkGridAutoFlowSetJSValue("dense row", "row dense", "row dense"); + checkGridAutoFlowSetJSValue("dense row", "dense", "dense"); checkGridAutoFlowSetJSValue("row", "row", "row"); debug("");
diff --git a/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set-expected.txt b/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set-expected.txt index e6b5409..3acf233 100644 --- a/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set-expected.txt +++ b/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set-expected.txt
@@ -48,7 +48,7 @@ PASS window.getComputedStyle(gridWithAutoFlowDenseRow, '').getPropertyValue('grid-template-columns') is "none" PASS window.getComputedStyle(gridWithAutoFlowDenseRow, '').getPropertyValue('grid-template-rows') is "none" PASS window.getComputedStyle(gridWithAutoFlowDenseRow, '').getPropertyValue('grid-template-areas') is "none" -PASS window.getComputedStyle(gridWithAutoFlowDenseRow, '').getPropertyValue('grid-auto-flow') is "row dense" +PASS window.getComputedStyle(gridWithAutoFlowDenseRow, '').getPropertyValue('grid-auto-flow') is "dense" PASS window.getComputedStyle(gridWithAutoFlowDenseRow, '').getPropertyValue('grid-auto-columns') is "auto" PASS window.getComputedStyle(gridWithAutoFlowDenseRow, '').getPropertyValue('grid-auto-rows') is "auto" PASS window.getComputedStyle(gridWithAutoFlowAndAutoRowsAndColumns, '').getPropertyValue('grid-template-columns') is "20px" @@ -84,7 +84,7 @@ PASS window.getComputedStyle(gridWithColumnsAndDenseAutoFlow, '').getPropertyValue('grid-template-columns') is "10px" PASS window.getComputedStyle(gridWithColumnsAndDenseAutoFlow, '').getPropertyValue('grid-template-rows') is "none" PASS window.getComputedStyle(gridWithColumnsAndDenseAutoFlow, '').getPropertyValue('grid-template-areas') is "none" -PASS window.getComputedStyle(gridWithColumnsAndDenseAutoFlow, '').getPropertyValue('grid-auto-flow') is "row dense" +PASS window.getComputedStyle(gridWithColumnsAndDenseAutoFlow, '').getPropertyValue('grid-auto-flow') is "dense" PASS window.getComputedStyle(gridWithColumnsAndDenseAutoFlow, '').getPropertyValue('grid-auto-columns') is "auto" PASS window.getComputedStyle(gridWithColumnsAndDenseAutoFlow, '').getPropertyValue('grid-auto-rows') is "auto" PASS window.getComputedStyle(gridWithRowsAndAutoFlowAndAutoColumns, '').getPropertyValue('grid-template-columns') is "none" @@ -225,7 +225,7 @@ PASS element.style.gridTemplateRows is "initial" PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none" PASS element.style.gridTemplateAreas is "initial" -PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "row dense" +PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "dense" PASS element.style.gridAutoFlow is "row dense" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "auto" PASS element.style.gridAutoColumns is "initial"
diff --git a/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set.html b/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set.html index 1c9c4d2..d834bb77 100644 --- a/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set.html +++ b/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set.html
@@ -147,14 +147,14 @@ testGridDefinitionsValues(document.getElementById("gridColumnsAndAutoFlow"), "10px", "none", "none", "row", "auto", "auto"); testGridDefinitionsValues(document.getElementById("gridWithAutoFlowAndAutoRows"), "none", "none", "none", "row", "auto", "10px"); testGridDefinitionsValues(document.getElementById("gridWithAutoFlowColumnDense"), "none", "none", "none", "column dense", "auto", "auto"); - testGridDefinitionsValues(document.getElementById("gridWithAutoFlowDenseRow"), "none", "none", "none", "row dense", "auto", "auto"); + testGridDefinitionsValues(document.getElementById("gridWithAutoFlowDenseRow"), "none", "none", "none", "dense", "auto", "auto"); testGridDefinitionsValues(document.getElementById("gridWithAutoFlowAndAutoRowsAndColumns"), "20px", "none", "none", "row", "auto", "10px"); testGridDefinitionsValues(document.getElementById("gridWithAutoFlowAndMultipleAutoTracks"), "100px 50px", "none", "none", "row", "auto", "20px 10px"); testGridDefinitionsValues(document.getElementById("gridWithRowsAndAutoFlow"), "none", "10px", "none", "column", "auto", "auto"); testGridDefinitionsValues(document.getElementById("gridWithRowsNoneAndAutoFlowAndAutoColumn"), "none", "none", "none", "column", "10px", "auto"); testGridDefinitionsValues(document.getElementById("gridWithRowsAndAutoFlowDenseColumn"), "none", "10px", "none", "column dense", "auto", "auto"); - testGridDefinitionsValues(document.getElementById("gridWithColumnsAndDenseAutoFlow"), "10px", "none", "none", "row dense", "auto", "auto"); + testGridDefinitionsValues(document.getElementById("gridWithColumnsAndDenseAutoFlow"), "10px", "none", "none", "dense", "auto", "auto"); testGridDefinitionsValues(document.getElementById("gridWithRowsAndAutoFlowAndAutoColumns"), "none", "20px", "none", "column", "10px", "auto"); testGridDefinitionsValues(document.getElementById("gridWithRowsAndAutoFlowAndMultipleAutoTracks"), "none", "100px 50px", "none", "column", "20px 10px", "auto"); @@ -180,7 +180,7 @@ debug("Test getting and setting 'grid' shorthand through JS"); testGridDefinitionsSetJSValues("20px / 10px", "10px", "20px", "none", "row", "auto", "auto", "10px", "20px", "none", "initial", "initial", "initial"); testGridDefinitionsSetJSValues("[line] 'a' 20px / 10px", "10px", "[line] 20px", "\"a\"", "row", "auto", "auto", "10px", "[line] 20px", "\"a\"", "initial", "initial", "initial"); - testGridDefinitionsSetJSValues("auto-flow dense 20px / none", "none", "none", "none", "row dense", "auto", "20px", "none", "initial", "initial", "row dense", "initial", "20px"); + testGridDefinitionsSetJSValues("auto-flow dense 20px / none", "none", "none", "none", "dense", "auto", "20px", "none", "initial", "initial", "row dense", "initial", "20px"); testGridDefinitionsSetJSValues("20px / auto-flow 10px", "none", "20px", "none", "column", "10px", "auto", "initial", "20px", "initial", "column", "10px", "initial"); testGridDefinitionsSetJSValues("none / auto-flow dense 20px", "none", "none", "none", "column dense", "20px", "auto", "initial", "none", "initial", "column dense", "20px", "initial"); testGridDefinitionsSetJSValues("10px / auto-flow 20px", "none", "10px", "none", "column", "20px", "auto", "initial", "10px", "initial", "column", "20px", "initial");
diff --git a/third_party/blink/web_tests/fast/multicol/layers-split-across-columns-expected.html b/third_party/blink/web_tests/fast/multicol/layers-split-across-columns-expected.html new file mode 100644 index 0000000..ee3f772 --- /dev/null +++ b/third_party/blink/web_tests/fast/multicol/layers-split-across-columns-expected.html
@@ -0,0 +1,91 @@ +<!DOCTYPE html> +<style> + .container { + margin-right: 4px; + position: absolute; + will-change: transform; + } + .multicol { + width: 110px; + height: 150px; + border: 5px solid black; + } + .multicol > div { + float: left; + width: 50px; + height: 50px; + } + + .row1_left { background-color: black; } + .row1_right { background-color: #0000b0; } + .row2_left { background-color: #0000f0; } + .row2_right { background-color: #000090; } + .row3_left { background-color: #0000d0; } + .row3_right { background-color: black; } + + .row1_right, + .row2_right, + .row3_right { + margin-left: 10px; + } + + #opacity .row1_right, + #opacity .row2_left, + #opacity .row2_right, + #opacity .row3_left { + opacity: 0.99; + } + + .pos1 { left: 10px; top: 10px; } + .pos2 { left: 150px; top: 10px; } + .pos3 { left: 10px; top: 200px; } + .pos4 { left: 150px; top: 200px; } +</style> + +<div class="container pos1"> + Overflow: + <div class="multicol"> + <div class="row1_left"></div> + <div class="row1_right"></div> + <div class="row2_left"></div> + <div class="row2_right"></div> + <div class="row3_left"></div> + <div class="row3_right"></div> + </div> +</div> + +<div class="container pos2"> + Transforms: + <div class="multicol"> + <div class="row1_left"></div> + <div class="row1_right"></div> + <div class="row2_left"></div> + <div class="row2_right"></div> + <div class="row3_left"></div> + <div class="row3_right"></div> + </div> +</div> + +<div class="container pos3"> + Relative Pos.: + <div class="multicol"> + <div class="row1_left"></div> + <div class="row1_right"></div> + <div class="row2_left"></div> + <div class="row2_right"></div> + <div class="row3_left"></div> + <div class="row3_right"></div> + </div> +</div> + +<div class="container pos4" id="opacity"> + Opacity: + <div class="multicol"> + <div class="row1_left"></div> + <div class="row1_right"></div> + <div class="row2_left"></div> + <div class="row2_right"></div> + <div class="row3_left"></div> + <div class="row3_right"></div> + </div> +</div>
diff --git a/third_party/blink/web_tests/fast/multicol/layers-split-across-columns.html b/third_party/blink/web_tests/fast/multicol/layers-split-across-columns.html index d2615f4..06f4285 100644 --- a/third_party/blink/web_tests/fast/multicol/layers-split-across-columns.html +++ b/third_party/blink/web_tests/fast/multicol/layers-split-across-columns.html
@@ -1,74 +1,83 @@ <!DOCTYPE html> <style> -.container { width:120px; position: absolute; } -.multicol { -moz-column-width:50px; -moz-column-gap:10px; -webkit-column-width:50px; -webkit-column-gap:10px; column-width:50px; column-gap:10px; column-fill:auto; height:150px; border:5px solid black; } -.block { width:50px; height:50px } -.block:hover { background-color: maroon !important; } -.layer { height:200px; width:50px } -.line2 { position: absolute; top: 343px; left: 8px; } -.pos1 { left: 10px; top: 10px; } -.pos2 { left: 150px; top: 10px; } -.pos3 { left: 10px; top: 200px; } -.pos4 { left: 150px; top: 200px; } + .container { + width: 120px; + position: absolute; + will-change: transform; + } + .multicol { + columns: 2; + column-gap: 10px; + column-fill: auto; + height: 150px; + border: 5px solid black; + } + .block { + width: 50px; + height: 50px; + } + .layer { + width: 50px; + height: 200px; + } + .pos1 { left: 10px; top: 10px; } + .pos2 { left: 150px; top: 10px; } + .pos3 { left: 10px; top: 200px; } + .pos4 { left: 150px; top: 200px; } </style> + <div class="container pos1"> -Overflow: -<div class="multicol"> -<div class="block" style="background-color:black"></div> -<div style="overflow:clip;" class="layer"> -<div class="block" style="background-color: #0000f0"></div> -<div class="block" style="background-color: #0000d0"></div> -<div class="block" style="background-color: #0000b0"></div> -<div class="block" style="background-color: #000090"></div> -</div> -<div class="block" style="background-color:black"></div> -</div> + Overflow: + <div class="multicol"> + <div class="block" style="background-color:black"></div> + <div style="overflow:clip;" class="layer"> + <div class="block" style="background-color: #0000f0"></div> + <div class="block" style="background-color: #0000d0"></div> + <div class="block" style="background-color: #0000b0"></div> + <div class="block" style="background-color: #000090"></div> + </div> + <div class="block" style="background-color:black"></div> + </div> </div> <div class="container pos2"> -Transforms: - -<div class="multicol"> -<div class="block" style="background-color:black"></div> -<div style="margin-left: -100px; transform: translate(100px, 0);" class="layer"> -<div class="block" style="background-color: #0000f0"></div> -<div class="block" style="background-color: #0000d0"></div> -<div class="block" style="background-color: #0000b0"></div> -<div class="block" style="background-color: #000090"></div> -</div> -<div class="block" style="background-color:black"></div> -</div> -</div> + Transforms: + <div class="multicol"> + <div class="block" style="background-color:black"></div> + <div style="margin-left: -100px; transform: translate(100px, 0);" class="layer"> + <div class="block" style="background-color: #0000f0"></div> + <div class="block" style="background-color: #0000d0"></div> + <div class="block" style="background-color: #0000b0"></div> + <div class="block" style="background-color: #000090"></div> + </div> + <div class="block" style="background-color:black"></div> + </div> </div> <div class="container pos3"> -Relative Pos.: -<div class="multicol"> -<div class="block" style="background-color:black"></div> -<div style="position:relative; margin-left:-100px; left:100px" class="layer"> -<div class="block" style="background-color: #0000f0"></div> -<div class="block" style="background-color: #0000d0"></div> -<div class="block" style="background-color: #0000b0"></div> -<div class="block" style="background-color: #000090"></div> -</div> -<div class="block" style="background-color:black"></div> -</div> + Relative Pos.: + <div class="multicol"> + <div class="block" style="background-color:black"></div> + <div style="position:relative; margin-left:-100px; left:100px" class="layer"> + <div class="block" style="background-color: #0000f0"></div> + <div class="block" style="background-color: #0000d0"></div> + <div class="block" style="background-color: #0000b0"></div> + <div class="block" style="background-color: #000090"></div> + </div> + <div class="block" style="background-color:black"></div> + </div> </div> <div class="container pos4"> -Opacity: - -<div class="multicol"> -<div class="block" style="background-color:black"></div> -<div style="opacity:0.99;" class="layer"> -<!-- The extra s below force the creation of transparency layers in Skia to work - around optimizations that would cause blending differences between the test and the - expectation. --> -<div class="block" style="background-color: #0000f0"> </div> -<div class="block" style="background-color: #0000d0"> </div> -<div class="block" style="background-color: #0000b0"> </div> -<div class="block" style="background-color: #000090"> </div> -</div> -<div class="block" style="background-color:black"></div> -</div> + Opacity: + <div class="multicol"> + <div class="block" style="background-color:black"></div> + <div style="opacity:0.99;" class="layer"> + <div class="block" style="background-color: #0000f0"></div> + <div class="block" style="background-color: #0000d0"></div> + <div class="block" style="background-color: #0000b0"></div> + <div class="block" style="background-color: #000090"></div> + </div> + <div class="block" style="background-color:black"></div> + </div> </div>
diff --git a/third_party/blink/web_tests/fast/multicol/mixed-opacity-fixed-test-expected.html b/third_party/blink/web_tests/fast/multicol/mixed-opacity-fixed-test-expected.html index f3662d9..9db766b1 100644 --- a/third_party/blink/web_tests/fast/multicol/mixed-opacity-fixed-test-expected.html +++ b/third_party/blink/web_tests/fast/multicol/mixed-opacity-fixed-test-expected.html
@@ -1,9 +1,10 @@ -<div style="position:relative; width:420px; border:2px solid black; height:200px"> -<div style="opacity:0.5;position:relative"> -<div style="height:200px;background-color:green;position:absolute;width:200px;left:0;top:0"></div> -<div style="height:200px;background-color:green;position:absolute;width:200px;right:0;top:0"></div> -<div style="position:fixed;height:98px;width:98px;background-color:lightgray; left:170px; top:220px;background-color:green;border:1px solid lime"> -</div> -</div> -</div> +<!DOCTYPE html> +<div style="position:absolute; will-change:transform; contain:strict; height:500px;"> + <div style="position:relative; width:420px; border:2px solid black; height:200px;"> + <div style="opacity:0.5;"> + <div style="height:200px; background:green; position:absolute; width:200px; left:0; top:0;"></div> + <div style="height:200px; background:green; position:absolute; width:200px; right:0; top:0;"></div> + <div style="position:fixed; height:98px; width:98px; left:170px; top:220px; background:green; border:1px solid lime;"></div> + </div> + </div> </div>
diff --git a/third_party/blink/web_tests/fast/multicol/mixed-opacity-fixed-test.html b/third_party/blink/web_tests/fast/multicol/mixed-opacity-fixed-test.html index d67bf17..10f1b9a 100644 --- a/third_party/blink/web_tests/fast/multicol/mixed-opacity-fixed-test.html +++ b/third_party/blink/web_tests/fast/multicol/mixed-opacity-fixed-test.html
@@ -1,8 +1,9 @@ -<div style="position:relative; -webkit-column-count:2; -webkit-column-width:200px; -webkit-column-gap:20px; column-count:2; column-width:200px; column-gap:20px; column-fill:auto; width:420px; height:200px; border:2px solid black;"> -<div style="opacity:0.5"> -<div style="height:400px;background-color:green"></div> -<div style="position:fixed;height:98px;width:98px;background-color:lightgray; left:170px; top:220px;background-color:green;border:1px solid lime"> -</div> -</div> -</div> +<!DOCTYPE html> +<div style="position:absolute; will-change:transform; contain:strict; height:500px;"> + <div style="columns:2; column-gap:20px; column-fill:auto; width:420px; height:200px; border:2px solid black;"> + <div style="opacity:0.5;"> + <div style="height:400px; background:green;"></div> + <div style="position:fixed; height:98px; width:98px; left:170px; top:220px; background:green; border:1px solid lime;"></div> + </div> + </div> </div>
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/fast/multicol/layers-split-across-columns-expected.png b/third_party/blink/web_tests/flag-specific/highdpi/fast/multicol/layers-split-across-columns-expected.png deleted file mode 100644 index 0bb28a5d..0000000 --- a/third_party/blink/web_tests/flag-specific/highdpi/fast/multicol/layers-split-across-columns-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/multicol/layers-split-across-columns-expected.png b/third_party/blink/web_tests/platform/linux/fast/multicol/layers-split-across-columns-expected.png deleted file mode 100644 index 698dfa9..0000000 --- a/third_party/blink/web_tests/platform/linux/fast/multicol/layers-split-across-columns-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/layout_ng_block_frag/fast/multicol/layers-split-across-columns-expected.png b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_block_frag/fast/multicol/layers-split-across-columns-expected.png deleted file mode 100644 index 698dfa9..0000000 --- a/third_party/blink/web_tests/platform/linux/virtual/layout_ng_block_frag/fast/multicol/layers-split-across-columns-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/multicol/layers-split-across-columns-expected.png b/third_party/blink/web_tests/platform/mac/fast/multicol/layers-split-across-columns-expected.png deleted file mode 100644 index 86cf379..0000000 --- a/third_party/blink/web_tests/platform/mac/fast/multicol/layers-split-across-columns-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/multicol/layers-split-across-columns-expected.png b/third_party/blink/web_tests/platform/win/fast/multicol/layers-split-across-columns-expected.png deleted file mode 100644 index 608b610..0000000 --- a/third_party/blink/web_tests/platform/win/fast/multicol/layers-split-across-columns-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/dav1d/generate_configs.py b/third_party/dav1d/generate_configs.py index c65b9f9f..817d6d7 100755 --- a/third_party/dav1d/generate_configs.py +++ b/third_party/dav1d/generate_configs.py
@@ -101,19 +101,17 @@ return target_env -def CopyConfigsAndCleanup(config_dir, dest_dir): +def CopyConfigs(src_dir, dest_dir): if not os.path.exists(dest_dir): os.makedirs(dest_dir) - shutil.copy(os.path.join(config_dir, 'config.h'), dest_dir) + shutil.copy(os.path.join(src_dir, 'config.h'), dest_dir) # The .asm file will not be present for all configurations. - asm_file = os.path.join(config_dir, 'config.asm') + asm_file = os.path.join(src_dir, 'config.asm') if os.path.exists(asm_file): shutil.copy(asm_file, dest_dir) - shutil.rmtree(config_dir) - def GenerateConfig(config_dir, env, special_args=[]): temp_dir = tempfile.mkdtemp() @@ -146,7 +144,9 @@ [(r'(%define STACK_ALIGNMENT \d{1,2})', r'; \1 -- Stack alignment is controlled by Chromium')]) - CopyConfigsAndCleanup(temp_dir, config_dir) + CopyConfigs(temp_dir, config_dir) + + shutil.rmtree(temp_dir) def GenerateWindowsArm64Config(src_dir):
diff --git a/third_party/freetype/README.chromium b/third_party/freetype/README.chromium index 0cafbe1f..6f1fd41a 100644 --- a/third_party/freetype/README.chromium +++ b/third_party/freetype/README.chromium
@@ -1,7 +1,7 @@ Name: FreeType URL: http://www.freetype.org/ -Version: VER-2-11-0-94-ga29e02005 -Revision: a29e020059ca6f73a212ec76af94b22a694ad765 +Version: VER-2-11-0-97-g12ef831fc +Revision: 12ef831fc314518bff45278008a568608501a8e4 CPEPrefix: cpe:/a:freetype:freetype:2.10.4 License: Custom license "inspired by the BSD, Artistic, and IJG (Independent JPEG Group) licenses"
diff --git a/third_party/glide/gif_encoder/BUILD.gn b/third_party/glide/gif_encoder/BUILD.gn new file mode 100644 index 0000000..fb5dff8a --- /dev/null +++ b/third_party/glide/gif_encoder/BUILD.gn
@@ -0,0 +1,18 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + +assert(is_android) + +android_library("gif_encoder_java") { + sources = [ + "java/com/bumptech/glide/gifencoder/AnimatedGifEncoder.java", + "java/com/bumptech/glide/gifencoder/LZWEncoder.java", + "java/com/bumptech/glide/gifencoder/NeuQuant.java", + ] + deps = [ + "//third_party/androidx:androidx_annotation_annotation_java", + ] +}
diff --git a/third_party/glide/gif_encoder/LICENSE b/third_party/glide/gif_encoder/LICENSE new file mode 100644 index 0000000..0bdc525 --- /dev/null +++ b/third_party/glide/gif_encoder/LICENSE
@@ -0,0 +1,25 @@ +License for AnimatedGifEncoder.java and LZWEncoder.java + +No copyright asserted on the source code of this class. May be used for any +purpose, however, refer to the Unisys LZW patent for restrictions on use of +the associated LZWEncoder class. Please forward any corrections to +kweiner@fmsware.com. + +----------------------------------------------------------------------------- +License for NeuQuant.java + +Copyright (c) 1994 Anthony Dekker + +NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See +"Kohonen neural networks for optimal colour quantization" in "Network: +Computation in Neural Systems" Vol. 5 (1994) pp 351-367. for a discussion of +the algorithm. + +Any party obtaining a copy of these files from the author, directly or +indirectly, is granted, free of charge, a full and unrestricted irrevocable, +world-wide, paid up, royalty-free, nonexclusive right and license to deal in +this software and documentation files (the "Software"), including without +limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons who +receive copies from any such party to do so, with the only requirement being +that this copyright notice remain intact. \ No newline at end of file
diff --git a/third_party/glide/gif_encoder/OWNERS b/third_party/glide/gif_encoder/OWNERS new file mode 100644 index 0000000..a60ab48 --- /dev/null +++ b/third_party/glide/gif_encoder/OWNERS
@@ -0,0 +1,2 @@ +gujen@google.com +sebsg@chromium.org \ No newline at end of file
diff --git a/third_party/glide/gif_encoder/README.chromium b/third_party/glide/gif_encoder/README.chromium new file mode 100644 index 0000000..43ce333 --- /dev/null +++ b/third_party/glide/gif_encoder/README.chromium
@@ -0,0 +1,17 @@ +Name: Android GIF Encoder +URL: https://github.com/bumptech/glide/tree/master/third_party/gif_encoder +Version: a7b254c42888db691b7339b2165abcd462473fcf +License: Notice +License File: LICENSE +License Android Compatible: yes +Security Critical: yes +CPEPrefix: unknown + +Description: + This contains the GIF encoder classes from the Glide library, which were themselves based on the + GIF encoding logic found here: http://java2s.com/Code/Java/2D-Graphics-GUI/AnimatedGifEncoder.htm. + The README.third_party file in the Glide repo has more info. + +Local Modifications: +- Changed the name of the top-level package from "com.bumptech.glide.gifencoder" to + "org.chromium.third_party.glide.gif_encoder" to avoid potential conflicts with the Glide library. \ No newline at end of file
diff --git a/third_party/glide/gif_encoder/java/com/bumptech/glide/gifencoder/AnimatedGifEncoder.java b/third_party/glide/gif_encoder/java/com/bumptech/glide/gifencoder/AnimatedGifEncoder.java new file mode 100644 index 0000000..fd8c313 --- /dev/null +++ b/third_party/glide/gif_encoder/java/com/bumptech/glide/gifencoder/AnimatedGifEncoder.java
@@ -0,0 +1,580 @@ +package org.chromium.third_party.glide.gif_encoder; + +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Color; +import android.util.Log; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.io.BufferedOutputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +/** + * Class AnimatedGifEncoder - Encodes a GIF file consisting of one or more + * frames. + * + * <pre> + * Example: + * AnimatedGifEncoder e = new AnimatedGifEncoder(); + * e.start(outputFileName); + * e.setDelay(1000); // 1 frame per sec + * e.addFrame(image1); + * e.addFrame(image2); + * e.addFrame(image3, 100, 100); // set position of the frame + * e.finish(); + * </pre> + * + * No copyright asserted on the source code of this class. May be used for any + * purpose, however, refer to the Unisys LZW patent for restrictions on use of + * the associated LZWEncoder class. Please forward any corrections to + * kweiner@fmsware.com. + * + * @author Kevin Weiner, FM Software + * @version 1.03 November 2003 + * + */ + +public class AnimatedGifEncoder { + private static final String TAG = "AnimatedGifEncoder"; + + // The minimum % of an images pixels that must be transparent for us to set a transparent index + // automatically. + private static final double MIN_TRANSPARENT_PERCENTAGE = 4d; + + private int width; // image size + + private int height; + + private int fixedWidth; // set by setSize() + + private int fixedHeight; + + private Integer transparent = null; // transparent color if given + + private int transIndex; // transparent index in color table + + private int repeat = -1; // no repeat + + private int delay = 0; // frame delay (hundredths) + + private boolean started = false; // ready to output frames + + private OutputStream out; + + private Bitmap image; // current frame + + private byte[] pixels; // BGR byte array from frame + + private byte[] indexedPixels; // converted frame indexed to palette + + private int colorDepth; // number of bit planes + + private byte[] colorTab; // RGB palette + + private boolean[] usedEntry = new boolean[256]; // active palette entries + + private int palSize = 7; // color table size (bits-1) + + private int dispose = -1; // disposal code (-1 = use default) + + private boolean closeStream = false; // close stream when finished + + private boolean firstFrame = true; + + private boolean sizeSet = false; // if false, get size from first frame + + private int sample = 10; // default sample interval for quantizer + + private boolean hasTransparentPixels; + + /** + * Sets the delay time between each frame, or changes it for subsequent frames + * (applies to last frame added). + * + * @param ms + * int delay time in milliseconds + */ + public void setDelay(int ms) { + delay = Math.round(ms / 10.0f); + } + + /** + * Sets the GIF frame disposal code for the last added frame and any + * subsequent frames. Default is 0 if no transparent color has been set, + * otherwise 2. + * + * @param code + * int disposal code. + */ + public void setDispose(int code) { + if (code >= 0) { + dispose = code; + } + } + + /** + * Sets the number of times the set of GIF frames should be played. Default is + * 1; 0 means play indefinitely. Must be invoked before the first image is + * added. + * + * @param iter + * int number of iterations. + */ + public void setRepeat(int iter) { + if (iter >= 0) { + repeat = iter; + } + } + + /** + * Sets the transparent color for the last added frame and any subsequent + * frames. Since all colors are subject to modification in the quantization + * process, the color in the final palette for each frame closest to the given + * color becomes the transparent color for that frame. May be set to null to + * indicate no transparent color. + * + * @param color + * Color to be treated as transparent on display. + */ + public void setTransparent(int color) { + transparent = color; + } + + /** + * Adds next GIF frame. The frame is not written immediately, but is actually + * deferred until the next frame is received so that timing data can be + * inserted. Invoking <code>finish()</code> flushes all frames. If + * <code>setSize</code> was invoked, the size is used for all subsequent frames. + * Otherwise, the actual size of the image is used for each frames. + * + * @param im + * BufferedImage containing frame to write. + * @return true if successful. + */ + public boolean addFrame(@Nullable Bitmap im) { + return addFrame(im, 0, 0); + } + + /** + * Adds next GIF frame to the specified position. The frame is not written immediately, but is + * actually deferred until the next frame is received so that timing data can be inserted. + * Invoking <code>finish()</code> flushes all frames. If <code>setSize</code> was invoked, the + * size is used for all subsequent frames. Otherwise, the actual size of the image is used for + * each frame. + * + * See page 11 of http://giflib.sourceforge.net/gif89.txt for the position of the frame + * + * @param im + * BufferedImage containing frame to write. + * @param x + * Column number, in pixels, of the left edge of the image, with respect to the left + * edge of the Logical Screen. + * @param y + * Row number, in pixels, of the top edge of the image with respect to the top edge of + * the Logical Screen. + * @return true if successful. + */ + public boolean addFrame(@Nullable Bitmap im, int x, int y) { + if ((im == null) || !started) { + return false; + } + boolean ok = true; + try { + if (sizeSet) { + setFrameSize(fixedWidth, fixedHeight); + } else { + setFrameSize(im.getWidth(), im.getHeight()); + } + image = im; + getImagePixels(); // convert to correct format if necessary + analyzePixels(); // build color table & map pixels + if (firstFrame) { + writeLSD(); // logical screen descriptor + writePalette(); // global color table + if (repeat >= 0) { + // use NS app extension to indicate reps + writeNetscapeExt(); + } + } + writeGraphicCtrlExt(); // write graphic control extension + writeImageDesc(x, y); // image descriptor + if (!firstFrame) { + writePalette(); // local color table + } + writePixels(); // encode and write pixel data + firstFrame = false; + } catch (IOException e) { + ok = false; + } + + return ok; + } + + /** + * Flushes any pending data and closes output file. If writing to an + * OutputStream, the stream is not closed. + */ + public boolean finish() { + if (!started) + return false; + boolean ok = true; + started = false; + try { + out.write(0x3b); // GIF trailer + out.flush(); + if (closeStream) { + out.close(); + } + } catch (IOException e) { + ok = false; + } + + // reset for subsequent use + transIndex = 0; + out = null; + image = null; + pixels = null; + indexedPixels = null; + colorTab = null; + closeStream = false; + firstFrame = true; + + return ok; + } + + /** + * Sets frame rate in frames per second. Equivalent to + * <code>setDelay(1000/fps)</code>. + * + * @param fps + * float frame rate (frames per second) + */ + public void setFrameRate(float fps) { + if (fps != 0f) { + delay = Math.round(100f / fps); + } + } + + /** + * Sets quality of color quantization (conversion of images to the maximum 256 + * colors allowed by the GIF specification). Lower values (minimum = 1) + * produce better colors, but slow processing significantly. 10 is the + * default, and produces good color mapping at reasonable speeds. Values + * greater than 20 do not yield significant improvements in speed. + * + * @param quality int greater than 0. + */ + public void setQuality(int quality) { + if (quality < 1) + quality = 1; + sample = quality; + } + + /** + * Sets the fixed GIF frame size for all the frames. + * This should be called before start. + * + * @param w + * int frame width. + * @param h + * int frame width. + */ + public void setSize(int w, int h) { + if (started) { + return; + } + + fixedWidth = w; + fixedHeight = h; + if (fixedWidth < 1) { + fixedWidth = 320; + } + if (fixedHeight < 1) { + fixedHeight = 240; + } + + sizeSet = true; + } + + /** + * Sets current GIF frame size. + * + * @param w + * int frame width. + * @param h + * int frame width. + */ + private void setFrameSize(int w, int h) { + width = w; + height = h; + } + + /** + * Initiates GIF file creation on the given stream. The stream is not closed + * automatically. + * + * @param os + * OutputStream on which GIF images are written. + * @return false if initial write failed. + */ + public boolean start(@Nullable OutputStream os) { + if (os == null) + return false; + boolean ok = true; + closeStream = false; + out = os; + try { + writeString("GIF89a"); // header + } catch (IOException e) { + ok = false; + } + return started = ok; + } + + /** + * Initiates writing of a GIF file with the specified name. + * + * @param file + * String containing output file name. + * @return false if open or initial write failed. + */ + public boolean start(@NonNull String file) { + boolean ok; + try { + out = new BufferedOutputStream(new FileOutputStream(file)); + ok = start(out); + closeStream = true; + } catch (IOException e) { + ok = false; + } + return started = ok; + } + + /** + * Analyzes image colors and creates color map. + */ + private void analyzePixels() { + int len = pixels.length; + int nPix = len / 3; + indexedPixels = new byte[nPix]; + NeuQuant nq = new NeuQuant(pixels, len, sample); + // initialize quantizer + colorTab = nq.process(); // create reduced palette + // convert map from BGR to RGB + for (int i = 0; i < colorTab.length; i += 3) { + byte temp = colorTab[i]; + colorTab[i] = colorTab[i + 2]; + colorTab[i + 2] = temp; + usedEntry[i / 3] = false; + } + // map image pixels to new palette + int k = 0; + for (int i = 0; i < nPix; i++) { + int index = nq.map(pixels[k++] & 0xff, pixels[k++] & 0xff, pixels[k++] & 0xff); + usedEntry[index] = true; + indexedPixels[i] = (byte) index; + } + pixels = null; + colorDepth = 8; + palSize = 7; + // get closest match to transparent color if specified + if (transparent != null) { + transIndex = findClosest(transparent); + } else if (hasTransparentPixels) { + transIndex = findClosest(Color.TRANSPARENT); + } + } + + /** + * Returns index of palette color closest to c + * + */ + private int findClosest(int color) { + if (colorTab == null) + return -1; + int r = Color.red(color); + int g = Color.green(color); + int b = Color.blue(color); + int minpos = 0; + int dmin = 256 * 256 * 256; + int len = colorTab.length; + for (int i = 0; i < len;) { + int dr = r - (colorTab[i++] & 0xff); + int dg = g - (colorTab[i++] & 0xff); + int db = b - (colorTab[i] & 0xff); + int d = dr * dr + dg * dg + db * db; + int index = i / 3; + if (usedEntry[index] && (d < dmin)) { + dmin = d; + minpos = index; + } + i++; + } + return minpos; + } + + /** + * Extracts image pixels into byte array "pixels" + */ + private void getImagePixels() { + int w = image.getWidth(); + int h = image.getHeight(); + + if ((w != width) || (h != height)) { + // create new image with right size/format + Bitmap temp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(temp); + canvas.drawBitmap(temp, 0, 0, null); + image = temp; + } + int[] pixelsInt = new int[w * h]; + image.getPixels(pixelsInt, 0, w, 0, 0, w, h); + + // The algorithm requires 3 bytes per pixel as RGB. + pixels = new byte[pixelsInt.length * 3]; + + int pixelsIndex = 0; + hasTransparentPixels = false; + int totalTransparentPixels = 0; + for (final int pixel : pixelsInt) { + if (pixel == Color.TRANSPARENT) { + totalTransparentPixels++; + } + pixels[pixelsIndex++] = (byte) (pixel & 0xFF); + pixels[pixelsIndex++] = (byte) ((pixel >> 8) & 0xFF); + pixels[pixelsIndex++] = (byte) ((pixel >> 16) & 0xFF); + } + + double transparentPercentage = 100 * totalTransparentPixels / (double) pixelsInt.length; + // Assume images with greater where more than n% of the pixels are transparent actually have + // transparency. See issue #214. + hasTransparentPixels = transparentPercentage > MIN_TRANSPARENT_PERCENTAGE; + if (Log.isLoggable(TAG, Log.DEBUG)) { + Log.d(TAG, "got pixels for frame with " + transparentPercentage + + "% transparent pixels"); + } + } + + /** + * Writes Graphic Control Extension + */ + private void writeGraphicCtrlExt() throws IOException { + out.write(0x21); // extension introducer + out.write(0xf9); // GCE label + out.write(4); // data block size + int transp, disp; + if (transparent == null && !hasTransparentPixels) { + transp = 0; + disp = 0; // dispose = no action + } else { + transp = 1; + disp = 2; // force clear if using transparent color + } + if (dispose >= 0) { + disp = dispose & 7; // user override + } + disp <<= 2; + + // packed fields + out.write(0 | // 1:3 reserved + disp | // 4:6 disposal + 0 | // 7 user input - 0 = none + transp); // 8 transparency flag + + writeShort(delay); // delay x 1/100 sec + out.write(transIndex); // transparent color index + out.write(0); // block terminator + } + + /** + * Writes Image Descriptor + */ + private void writeImageDesc(int x, int y) throws IOException { + out.write(0x2c); // image separator + writeShort(x); // image position + writeShort(y); + writeShort(width); // image size + writeShort(height); + // packed fields + if (firstFrame) { + // no LCT - GCT is used for first (or only) frame + out.write(0); + } else { + // specify normal LCT + out.write(0x80 | // 1 local color table 1=yes + 0 | // 2 interlace - 0=no + 0 | // 3 sorted - 0=no + 0 | // 4-5 reserved + palSize); // 6-8 size of color table + } + } + + /** + * Writes Logical Screen Descriptor + */ + private void writeLSD() throws IOException { + // logical screen size + writeShort(width); + writeShort(height); + // packed fields + out.write((0x80 | // 1 : global color table flag = 1 (gct used) + 0x70 | // 2-4 : color resolution = 7 + 0x00 | // 5 : gct sort flag = 0 + palSize)); // 6-8 : gct size + + out.write(0); // background color index + out.write(0); // pixel aspect ratio - assume 1:1 + } + + /** + * Writes Netscape application extension to define repeat count. + */ + private void writeNetscapeExt() throws IOException { + out.write(0x21); // extension introducer + out.write(0xff); // app extension label + out.write(11); // block size + writeString("NETSCAPE" + "2.0"); // app id + auth code + out.write(3); // sub-block size + out.write(1); // loop sub-block id + writeShort(repeat); // loop count (extra iterations, 0=repeat forever) + out.write(0); // block terminator + } + + /** + * Writes color table + */ + private void writePalette() throws IOException { + out.write(colorTab, 0, colorTab.length); + int n = (3 * 256) - colorTab.length; + for (int i = 0; i < n; i++) { + out.write(0); + } + } + + /** + * Encodes and writes pixel data + */ + private void writePixels() throws IOException { + LZWEncoder encoder = new LZWEncoder(width, height, indexedPixels, colorDepth); + encoder.encode(out); + } + + /** + * Write 16-bit value to output stream, LSB first + */ + private void writeShort(int value) throws IOException { + out.write(value & 0xff); + out.write((value >> 8) & 0xff); + } + + /** + * Writes string to output stream + */ + private void writeString(String s) throws IOException { + for (int i = 0; i < s.length(); i++) { + out.write((byte) s.charAt(i)); + } + } +} \ No newline at end of file
diff --git a/third_party/glide/gif_encoder/java/com/bumptech/glide/gifencoder/LZWEncoder.java b/third_party/glide/gif_encoder/java/com/bumptech/glide/gifencoder/LZWEncoder.java new file mode 100644 index 0000000..fed3330 --- /dev/null +++ b/third_party/glide/gif_encoder/java/com/bumptech/glide/gifencoder/LZWEncoder.java
@@ -0,0 +1,296 @@ +package org.chromium.third_party.glide.gif_encoder; + +import java.io.IOException; +import java.io.OutputStream; + +// ============================================================================== +// Adapted from Jef Poskanzer's Java port by way of J. M. G. Elliott. +// K Weiner 12/00 +class LZWEncoder { + + private static final int EOF = -1; + + private int imgW, imgH; + + private byte[] pixAry; + + private int initCodeSize; + + private int remaining; + + private int curPixel; + + // GIFCOMPR.C - GIF Image compression routines + // + // Lempel-Ziv compression based on 'compress'. GIF modifications by + // David Rowley (mgardi@watdcsu.waterloo.edu) + + // General DEFINEs + + static final int BITS = 12; + + static final int HSIZE = 5003; // 80% occupancy + + // GIF Image compression - modified 'compress' + // + // Based on: compress.c - File compression ala IEEE Computer, June 1984. + // + // By Authors: Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas) + // Jim McKie (decvax!mcvax!jim) + // Steve Davies (decvax!vax135!petsd!peora!srd) + // Ken Turkowski (decvax!decwrl!turtlevax!ken) + // James A. Woods (decvax!ihnp4!ames!jaw) + // Joe Orost (decvax!vax135!petsd!joe) + + int n_bits; // number of bits/code + + int maxbits = BITS; // user settable max # bits/code + + int maxcode; // maximum code, given n_bits + + int maxmaxcode = 1 << BITS; // should NEVER generate this code + + int[] htab = new int[HSIZE]; + + int[] codetab = new int[HSIZE]; + + int hsize = HSIZE; // for dynamic table sizing + + int free_ent = 0; // first unused entry + + // block compression parameters -- after all codes are used up, + // and compression rate changes, start over. + boolean clear_flg = false; + + // Algorithm: use open addressing double hashing (no chaining) on the + // prefix code / next character combination. We do a variant of Knuth's + // algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime + // secondary probe. Here, the modular division first probe is gives way + // to a faster exclusive-or manipulation. Also do block compression with + // an adaptive reset, whereby the code table is cleared when the compression + // ratio decreases, but after the table fills. The variable-length output + // codes are re-sized at this point, and a special CLEAR code is generated + // for the decompressor. Late addition: construct the table according to + // file size for noticeable speed improvement on small files. Please direct + // questions about this implementation to ames!jaw. + + int g_init_bits; + + int ClearCode; + + int EOFCode; + + // output + // + // Output the given code. + // Inputs: + // code: A n_bits-bit integer. If == -1, then EOF. This assumes + // that n_bits =< wordsize - 1. + // Outputs: + // Outputs code to the file. + // Assumptions: + // Chars are 8 bits long. + // Algorithm: + // Maintain a BITS character long buffer (so that 8 codes will + // fit in it exactly). Use the VAX insv instruction to insert each + // code in turn. When the buffer fills up empty it and start over. + + int cur_accum = 0; + + int cur_bits = 0; + + int masks[] = {0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, + 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF}; + + // Number of characters so far in this 'packet' + int a_count; + + // Define the storage for the packet accumulator + byte[] accum = new byte[256]; + + // ---------------------------------------------------------------------------- + LZWEncoder(int width, int height, byte[] pixels, int color_depth) { + imgW = width; + imgH = height; + pixAry = pixels; + initCodeSize = Math.max(2, color_depth); + } + + // Add a character to the end of the current packet, and if it is 254 + // characters, flush the packet to disk. + void char_out(byte c, OutputStream outs) throws IOException { + accum[a_count++] = c; + if (a_count >= 254) + flush_char(outs); + } + + // Clear out the hash table + + // table clear for block compress + void cl_block(OutputStream outs) throws IOException { + cl_hash(hsize); + free_ent = ClearCode + 2; + clear_flg = true; + + output(ClearCode, outs); + } + + // reset code table + void cl_hash(int hsize) { + for (int i = 0; i < hsize; ++i) + htab[i] = -1; + } + + void compress(int init_bits, OutputStream outs) throws IOException { + int fcode; + int i /* = 0 */; + int c; + int ent; + int disp; + int hsize_reg; + int hshift; + + // Set up the globals: g_init_bits - initial number of bits + g_init_bits = init_bits; + + // Set up the necessary values + clear_flg = false; + n_bits = g_init_bits; + maxcode = MAXCODE(n_bits); + + ClearCode = 1 << (init_bits - 1); + EOFCode = ClearCode + 1; + free_ent = ClearCode + 2; + + a_count = 0; // clear packet + + ent = nextPixel(); + + hshift = 0; + for (fcode = hsize; fcode < 65536; fcode *= 2) + ++hshift; + hshift = 8 - hshift; // set hash code range bound + + hsize_reg = hsize; + cl_hash(hsize_reg); // clear hash table + + output(ClearCode, outs); + + outer_loop: + while ((c = nextPixel()) != EOF) { + fcode = (c << maxbits) + ent; + i = (c << hshift) ^ ent; // xor hashing + + if (htab[i] == fcode) { + ent = codetab[i]; + continue; + } else if (htab[i] >= 0) // non-empty slot + { + disp = hsize_reg - i; // secondary hash (after G. Knott) + if (i == 0) + disp = 1; + do { + if ((i -= disp) < 0) + i += hsize_reg; + + if (htab[i] == fcode) { + ent = codetab[i]; + continue outer_loop; + } + } while (htab[i] >= 0); + } + output(ent, outs); + ent = c; + if (free_ent < maxmaxcode) { + codetab[i] = free_ent++; // code -> hashtable + htab[i] = fcode; + } else + cl_block(outs); + } + // Put out the final code. + output(ent, outs); + output(EOFCode, outs); + } + + // ---------------------------------------------------------------------------- + void encode(OutputStream os) throws IOException { + os.write(initCodeSize); // write "initial code size" byte + + remaining = imgW * imgH; // reset navigation variables + curPixel = 0; + + compress(initCodeSize + 1, os); // compress and write the pixel data + + os.write(0); // write block terminator + } + + // Flush the packet to disk, and reset the accumulator + void flush_char(OutputStream outs) throws IOException { + if (a_count > 0) { + outs.write(a_count); + outs.write(accum, 0, a_count); + a_count = 0; + } + } + + final int MAXCODE(int n_bits) { + return (1 << n_bits) - 1; + } + + // ---------------------------------------------------------------------------- + // Return the next pixel from the image + // ---------------------------------------------------------------------------- + private int nextPixel() { + if (remaining == 0) + return EOF; + + --remaining; + + byte pix = pixAry[curPixel++]; + + return pix & 0xff; + } + + void output(int code, OutputStream outs) throws IOException { + cur_accum &= masks[cur_bits]; + + if (cur_bits > 0) + cur_accum |= (code << cur_bits); + else + cur_accum = code; + + cur_bits += n_bits; + + while (cur_bits >= 8) { + char_out((byte) (cur_accum & 0xff), outs); + cur_accum >>= 8; + cur_bits -= 8; + } + + // If the next entry is going to be too big for the code size, + // then increase it, if possible. + if (free_ent > maxcode || clear_flg) { + if (clear_flg) { + maxcode = MAXCODE(n_bits = g_init_bits); + clear_flg = false; + } else { + ++n_bits; + if (n_bits == maxbits) + maxcode = maxmaxcode; + else + maxcode = MAXCODE(n_bits); + } + } + + if (code == EOFCode) { + // At EOF, write the rest of the buffer. + while (cur_bits > 0) { + char_out((byte) (cur_accum & 0xff), outs); + cur_accum >>= 8; + cur_bits -= 8; + } + + flush_char(outs); + } + } +} \ No newline at end of file
diff --git a/third_party/glide/gif_encoder/java/com/bumptech/glide/gifencoder/NeuQuant.java b/third_party/glide/gif_encoder/java/com/bumptech/glide/gifencoder/NeuQuant.java new file mode 100644 index 0000000..3d2c2cd --- /dev/null +++ b/third_party/glide/gif_encoder/java/com/bumptech/glide/gifencoder/NeuQuant.java
@@ -0,0 +1,506 @@ +package org.chromium.third_party.glide.gif_encoder; + +/* + * NeuQuant Neural-Net Quantization Algorithm + * ------------------------------------------ + * + * Copyright (c) 1994 Anthony Dekker + * + * NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See + * "Kohonen neural networks for optimal colour quantization" in "Network: + * Computation in Neural Systems" Vol. 5 (1994) pp 351-367. for a discussion of + * the algorithm. + * + * Any party obtaining a copy of these files from the author, directly or + * indirectly, is granted, free of charge, a full and unrestricted irrevocable, + * world-wide, paid up, royalty-free, nonexclusive right and license to deal in + * this software and documentation files (the "Software"), including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons who + * receive copies from any such party to do so, with the only requirement being + * that this copyright notice remain intact. + */ + +// Ported to Java 12/00 K Weiner +class NeuQuant { + + protected static final int netsize = 256; /* number of colours used */ + + /* four primes near 500 - assume no image has a length so large */ + /* that it is divisible by all four primes */ + protected static final int prime1 = 499; + + protected static final int prime2 = 491; + + protected static final int prime3 = 487; + + protected static final int prime4 = 503; + + protected static final int minpicturebytes = (3 * prime4); + + /* minimum size for input image */ + + /* + * Program Skeleton ---------------- [select samplefac in range 1..30] [read + * image from input file] pic = (unsigned char*) malloc(3*width*height); + * initnet(pic,3*width*height,samplefac); learn(); unbiasnet(); [write output + * image header, using writecolourmap(f)] inxbuild(); write output image using + * inxsearch(b,g,r) + */ + + /* + * Network Definitions ------------------- + */ + + protected static final int maxnetpos = (netsize - 1); + + protected static final int netbiasshift = 4; /* bias for colour values */ + + protected static final int ncycles = 100; /* no. of learning cycles */ + + /* defs for freq and bias */ + protected static final int intbiasshift = 16; /* bias for fractions */ + + protected static final int intbias = (((int) 1) << intbiasshift); + + protected static final int gammashift = 10; /* gamma = 1024 */ + + protected static final int gamma = (((int) 1) << gammashift); + + protected static final int betashift = 10; + + protected static final int beta = (intbias >> betashift); /* beta = 1/1024 */ + + protected static final int betagamma = (intbias << (gammashift - betashift)); + + /* defs for decreasing radius factor */ + protected static final int initrad = (netsize >> 3); /* + * for 256 cols, radius + * starts + */ + + protected static final int radiusbiasshift = 6; /* at 32.0 biased by 6 bits */ + + protected static final int radiusbias = (((int) 1) << radiusbiasshift); + + protected static final int initradius = (initrad * radiusbias); /* + * and + * decreases + * by a + */ + + protected static final int radiusdec = 30; /* factor of 1/30 each cycle */ + + /* defs for decreasing alpha factor */ + protected static final int alphabiasshift = 10; /* alpha starts at 1.0 */ + + protected static final int initalpha = (((int) 1) << alphabiasshift); + + protected int alphadec; /* biased by 10 bits */ + + /* radbias and alpharadbias used for radpower calculation */ + protected static final int radbiasshift = 8; + + protected static final int radbias = (((int) 1) << radbiasshift); + + protected static final int alpharadbshift = (alphabiasshift + radbiasshift); + + protected static final int alpharadbias = (((int) 1) << alpharadbshift); + + /* + * Types and Global Variables -------------------------- + */ + + protected byte[] thepicture; /* the input image itself */ + + protected int lengthcount; /* lengthcount = H*W*3 */ + + protected int samplefac; /* sampling factor 1..30 */ + + // typedef int pixel[4]; /* BGRc */ + protected int[][] network; /* the network itself - [netsize][4] */ + + protected int[] netindex = new int[256]; + + /* for network lookup - really 256 */ + + protected int[] bias = new int[netsize]; + + /* bias and freq arrays for learning */ + protected int[] freq = new int[netsize]; + + protected int[] radpower = new int[initrad]; + + /* radpower for precomputation */ + + /* + * Initialise network in range (0,0,0) to (255,255,255) and set parameters + * ----------------------------------------------------------------------- + */ + public NeuQuant(byte[] thepic, int len, int sample) { + + int i; + int[] p; + + thepicture = thepic; + lengthcount = len; + samplefac = sample; + + network = new int[netsize][]; + for (i = 0; i < netsize; i++) { + network[i] = new int[4]; + p = network[i]; + p[0] = p[1] = p[2] = (i << (netbiasshift + 8)) / netsize; + freq[i] = intbias / netsize; /* 1/netsize */ + bias[i] = 0; + } + } + + public byte[] colorMap() { + byte[] map = new byte[3 * netsize]; + int[] index = new int[netsize]; + for (int i = 0; i < netsize; i++) + index[network[i][3]] = i; + int k = 0; + for (int i = 0; i < netsize; i++) { + int j = index[i]; + map[k++] = (byte) (network[j][0]); + map[k++] = (byte) (network[j][1]); + map[k++] = (byte) (network[j][2]); + } + return map; + } + + /* + * Insertion sort of network and building of netindex[0..255] (to do after + * unbias) + * ------------------------------------------------------------------------------- + */ + public void inxbuild() { + + int i, j, smallpos, smallval; + int[] p; + int[] q; + int previouscol, startpos; + + previouscol = 0; + startpos = 0; + for (i = 0; i < netsize; i++) { + p = network[i]; + smallpos = i; + smallval = p[1]; /* index on g */ + /* find smallest in i..netsize-1 */ + for (j = i + 1; j < netsize; j++) { + q = network[j]; + if (q[1] < smallval) { /* index on g */ + smallpos = j; + smallval = q[1]; /* index on g */ + } + } + q = network[smallpos]; + /* swap p (i) and q (smallpos) entries */ + if (i != smallpos) { + j = q[0]; + q[0] = p[0]; + p[0] = j; + j = q[1]; + q[1] = p[1]; + p[1] = j; + j = q[2]; + q[2] = p[2]; + p[2] = j; + j = q[3]; + q[3] = p[3]; + p[3] = j; + } + /* smallval entry is now in position i */ + if (smallval != previouscol) { + netindex[previouscol] = (startpos + i) >> 1; + for (j = previouscol + 1; j < smallval; j++) + netindex[j] = i; + previouscol = smallval; + startpos = i; + } + } + netindex[previouscol] = (startpos + maxnetpos) >> 1; + for (j = previouscol + 1; j < 256; j++) + netindex[j] = maxnetpos; /* really 256 */ + } + + /* + * Main Learning Loop ------------------ + */ + public void learn() { + + int i, j, b, g, r; + int radius, rad, alpha, step, delta, samplepixels; + byte[] p; + int pix, lim; + + if (lengthcount < minpicturebytes) + samplefac = 1; + alphadec = 30 + ((samplefac - 1) / 3); + p = thepicture; + pix = 0; + lim = lengthcount; + samplepixels = lengthcount / (3 * samplefac); + delta = samplepixels / ncycles; + alpha = initalpha; + radius = initradius; + + rad = radius >> radiusbiasshift; + if (rad <= 1) + rad = 0; + for (i = 0; i < rad; i++) + radpower[i] = alpha * (((rad * rad - i * i) * radbias) / (rad * rad)); + + // fprintf(stderr,"beginning 1D learning: initial radius=%d\n", rad); + + if (lengthcount < minpicturebytes) + step = 3; + else if ((lengthcount % prime1) != 0) + step = 3 * prime1; + else { + if ((lengthcount % prime2) != 0) + step = 3 * prime2; + else { + if ((lengthcount % prime3) != 0) + step = 3 * prime3; + else + step = 3 * prime4; + } + } + + i = 0; + while (i < samplepixels) { + b = (p[pix + 0] & 0xff) << netbiasshift; + g = (p[pix + 1] & 0xff) << netbiasshift; + r = (p[pix + 2] & 0xff) << netbiasshift; + j = contest(b, g, r); + + altersingle(alpha, j, b, g, r); + if (rad != 0) + alterneigh(rad, j, b, g, r); /* alter neighbours */ + + pix += step; + if (pix >= lim) + pix -= lengthcount; + + i++; + if (delta == 0) + delta = 1; + if (i % delta == 0) { + alpha -= alpha / alphadec; + radius -= radius / radiusdec; + rad = radius >> radiusbiasshift; + if (rad <= 1) + rad = 0; + for (j = 0; j < rad; j++) + radpower[j] = alpha * (((rad * rad - j * j) * radbias) / (rad * rad)); + } + } + // fprintf(stderr,"finished 1D learning: final alpha=%f + // !\n",((float)alpha)/initalpha); + } + + /* + * Search for BGR values 0..255 (after net is unbiased) and return colour + * index + * ---------------------------------------------------------------------------- + */ + public int map(int b, int g, int r) { + + int i, j, dist, a, bestd; + int[] p; + int best; + + bestd = 1000; /* biggest possible dist is 256*3 */ + best = -1; + i = netindex[g]; /* index on g */ + j = i - 1; /* start at netindex[g] and work outwards */ + + while ((i < netsize) || (j >= 0)) { + if (i < netsize) { + p = network[i]; + dist = p[1] - g; /* inx key */ + if (dist >= bestd) + i = netsize; /* stop iter */ + else { + i++; + if (dist < 0) + dist = -dist; + a = p[0] - b; + if (a < 0) + a = -a; + dist += a; + if (dist < bestd) { + a = p[2] - r; + if (a < 0) + a = -a; + dist += a; + if (dist < bestd) { + bestd = dist; + best = p[3]; + } + } + } + } + if (j >= 0) { + p = network[j]; + dist = g - p[1]; /* inx key - reverse dif */ + if (dist >= bestd) + j = -1; /* stop iter */ + else { + j--; + if (dist < 0) + dist = -dist; + a = p[0] - b; + if (a < 0) + a = -a; + dist += a; + if (dist < bestd) { + a = p[2] - r; + if (a < 0) + a = -a; + dist += a; + if (dist < bestd) { + bestd = dist; + best = p[3]; + } + } + } + } + } + return (best); + } + + public byte[] process() { + learn(); + unbiasnet(); + inxbuild(); + return colorMap(); + } + + /* + * Unbias network to give byte values 0..255 and record position i to prepare + * for sort + * ----------------------------------------------------------------------------------- + */ + public void unbiasnet() { + + int i, j; + + for (i = 0; i < netsize; i++) { + network[i][0] >>= netbiasshift; + network[i][1] >>= netbiasshift; + network[i][2] >>= netbiasshift; + network[i][3] = i; /* record colour no */ + } + } + + /* + * Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in + * radpower[|i-j|] + * --------------------------------------------------------------------------------- + */ + protected void alterneigh(int rad, int i, int b, int g, int r) { + + int j, k, lo, hi, a, m; + int[] p; + + lo = i - rad; + if (lo < -1) + lo = -1; + hi = i + rad; + if (hi > netsize) + hi = netsize; + + j = i + 1; + k = i - 1; + m = 1; + while ((j < hi) || (k > lo)) { + a = radpower[m++]; + if (j < hi) { + p = network[j++]; + try { + p[0] -= (a * (p[0] - b)) / alpharadbias; + p[1] -= (a * (p[1] - g)) / alpharadbias; + p[2] -= (a * (p[2] - r)) / alpharadbias; + } catch (Exception e) { + } // prevents 1.3 miscompilation + } + if (k > lo) { + p = network[k--]; + try { + p[0] -= (a * (p[0] - b)) / alpharadbias; + p[1] -= (a * (p[1] - g)) / alpharadbias; + p[2] -= (a * (p[2] - r)) / alpharadbias; + } catch (Exception e) { + } + } + } + } + + /* + * Move neuron i towards biased (b,g,r) by factor alpha + * ---------------------------------------------------- + */ + protected void altersingle(int alpha, int i, int b, int g, int r) { + + /* alter hit neuron */ + int[] n = network[i]; + n[0] -= (alpha * (n[0] - b)) / initalpha; + n[1] -= (alpha * (n[1] - g)) / initalpha; + n[2] -= (alpha * (n[2] - r)) / initalpha; + } + + /* + * Search for biased BGR values ---------------------------- + */ + protected int contest(int b, int g, int r) { + + /* finds closest neuron (min dist) and updates freq */ + /* finds best neuron (min dist-bias) and returns position */ + /* for frequently chosen neurons, freq[i] is high and bias[i] is negative */ + /* bias[i] = gamma*((1/netsize)-freq[i]) */ + + int i, dist, a, biasdist, betafreq; + int bestpos, bestbiaspos, bestd, bestbiasd; + int[] n; + + bestd = ~(((int) 1) << 31); + bestbiasd = bestd; + bestpos = -1; + bestbiaspos = bestpos; + + for (i = 0; i < netsize; i++) { + n = network[i]; + dist = n[0] - b; + if (dist < 0) + dist = -dist; + a = n[1] - g; + if (a < 0) + a = -a; + dist += a; + a = n[2] - r; + if (a < 0) + a = -a; + dist += a; + if (dist < bestd) { + bestd = dist; + bestpos = i; + } + biasdist = dist - ((bias[i]) >> (intbiasshift - netbiasshift)); + if (biasdist < bestbiasd) { + bestbiasd = biasdist; + bestbiaspos = i; + } + betafreq = (freq[i] >> betashift); + freq[i] -= betafreq; + bias[i] += (betafreq << gammashift); + } + freq[bestpos] += beta; + bias[bestpos] -= betagamma; + return (bestbiaspos); + } +} \ No newline at end of file
diff --git a/tools/cr/cr/base/context.py b/tools/cr/cr/base/context.py index 8508328..1becf07 100644 --- a/tools/cr/cr/base/context.py +++ b/tools/cr/cr/base/context.py
@@ -169,15 +169,16 @@ Overrides CR_DRY_RUN """ ) - parser.add_argument( - '-v', '--verbose', dest='CR_VERBOSE', - action='count', default=None, - help=""" + parser.add_argument('-v', + '--verbose', + dest='CR_VERBOSE', + action='count', + default=0, + help=""" Print information about commands being performed. Repeating multiple times increases the verbosity level. Overrides CR_VERBOSE - """ - ) + """) @property def args(self): @@ -209,8 +210,8 @@ @property def verbose(self): if self.autocompleting: - return False - return self.Find('CR_VERBOSE') or self.dry_run + return 0 + return self.Find('CR_VERBOSE') or (self.dry_run and 1 or 0) @property def dry_run(self):
diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec index 5096876..2bb997e 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec
@@ -158,6 +158,10 @@ "includes": [1420], "structures": [1440], }, + "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/connectors_internals/resources.grd": { + "META": {"sizes": {"includes": [25]}}, + "includes": [1475], + }, "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/downloads/downloads_resources.grd": { "META": {"sizes": {"includes": [50],}}, "includes": [1480],
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 1f6376b2..7cfc0cc6 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -275,8 +275,6 @@ 'Libfuzzer Upload Linux UBSan': 'libfuzzer_ubsan_release_bot', 'Libfuzzer Upload Mac ASan': 'libfuzzer_mac_asan_shared_release_bot', 'Libfuzzer Upload Windows ASan': 'libfuzzer_windows_asan_release_bot', - 'Linux Builder (core-32) (goma)': 'gpu_tests_release_bot', - 'Linux Builder (core-32) (reclient)': 'gpu_tests_release_bot_reclient', 'Linux Builder (deps-cache) (reclient)': 'gpu_tests_release_bot_reclient', 'Linux Builder (j-500) (g-ip) (reclient)': 'gpu_tests_release_bot_reclient', 'Linux Builder (j-500) (reclient)': 'gpu_tests_release_bot_reclient', @@ -298,8 +296,6 @@ 'Site Isolation Android': 'android_release_bot_minimal_symbols_arm64', 'TSAN Debug (reclient)': 'tsan_disable_nacl_debug_bot_reclient', - 'TSAN Release (core-32) (goma)': 'tsan_disable_nacl_release_bot', - 'TSAN Release (core-32) (reclient)': 'tsan_disable_nacl_release_bot_reclient', 'TSAN Release (deps-cache) (reclient)': 'tsan_disable_nacl_release_bot_reclient', 'TSAN Release (j-250) (reclient)': 'tsan_disable_nacl_release_bot_reclient', 'TSAN Release (g-ip) (reclient)': 'tsan_disable_nacl_release_bot_reclient', @@ -363,6 +359,8 @@ 'linux-wpt-identity-fyi-rel': 'release_bot_minimal_symbols', 'linux-wpt-input-fyi-rel': 'release_bot_minimal_symbols', 'mac-arm64-on-arm64-rel': 'mac_arm64_release_bot', + # TODO(crbug.com/1252626): remove this after the migration. + 'mac-arm64-on-arm64-rel-reclient': 'mac_arm64_release_bot_reclient', 'mac-code-coverage': 'clang_code_coverage', 'mac-hermetic-upgrade-rel': 'release_bot', 'mac-paeverywhere-x64-fyi-dbg': 'debug_bot_paeverywhere_x64', @@ -2550,6 +2548,10 @@ 'release_bot', 'arm64', ], + 'mac_arm64_release_bot_reclient': [ + 'release_bot_reclient', 'arm64', + ], + 'mac_arm64_release_trybot': [ 'release_trybot', 'arm64', ],
diff --git a/tools/mb/mb_config_expectations/chromium.fyi.json b/tools/mb/mb_config_expectations/chromium.fyi.json index 5d0abe0..ba98dcb 100644 --- a/tools/mb/mb_config_expectations/chromium.fyi.json +++ b/tools/mb/mb_config_expectations/chromium.fyi.json
@@ -175,27 +175,6 @@ "use_libfuzzer": true } }, - "Linux Builder (core-32) (goma)": { - "gn_args": { - "dcheck_always_on": false, - "ffmpeg_branding": "Chrome", - "is_component_build": false, - "is_debug": false, - "proprietary_codecs": true, - "use_goma": true - } - }, - "Linux Builder (core-32) (reclient)": { - "gn_args": { - "dcheck_always_on": false, - "ffmpeg_branding": "Chrome", - "is_component_build": false, - "is_debug": false, - "proprietary_codecs": true, - "use_rbe": true, - "use_remoteexec": true - } - }, "Linux Builder (deps-cache) (reclient)": { "gn_args": { "dcheck_always_on": false, @@ -337,27 +316,6 @@ "use_remoteexec": true } }, - "TSAN Release (core-32) (goma)": { - "gn_args": { - "dcheck_always_on": false, - "enable_nacl": false, - "is_component_build": false, - "is_debug": false, - "is_tsan": true, - "use_goma": true - } - }, - "TSAN Release (core-32) (reclient)": { - "gn_args": { - "dcheck_always_on": false, - "enable_nacl": false, - "is_component_build": false, - "is_debug": false, - "is_tsan": true, - "use_rbe": true, - "use_remoteexec": true - } - }, "TSAN Release (deps-cache) (reclient)": { "gn_args": { "dcheck_always_on": false, @@ -1158,6 +1116,16 @@ "use_goma": true } }, + "mac-arm64-on-arm64-rel-reclient": { + "gn_args": { + "dcheck_always_on": false, + "is_component_build": false, + "is_debug": false, + "target_cpu": "arm64", + "use_rbe": true, + "use_remoteexec": true + } + }, "mac-code-coverage": { "gn_args": { "dcheck_always_on": false,
diff --git a/tools/metrics/histograms/metadata/histogram_suffixes_list.xml b/tools/metrics/histograms/metadata/histogram_suffixes_list.xml index 20ab30f..d0be602 100644 --- a/tools/metrics/histograms/metadata/histogram_suffixes_list.xml +++ b/tools/metrics/histograms/metadata/histogram_suffixes_list.xml
@@ -11189,6 +11189,8 @@ </histogram_suffixes> <histogram_suffixes name="OptimizationGuide_OptimizationTypes" separator="."> + <suffix name="AboutThisSite" + label="Provides 'About this site' data about the site being visited"/> <suffix name="BloomFilterValidation" label="Validates bloom filer allowlist/blocklist based hints"/> <suffix name="CompressPublicImages" label="Compresses public images"/>
diff --git a/tools/metrics/histograms/metadata/navigation/histograms.xml b/tools/metrics/histograms/metadata/navigation/histograms.xml index 10c480e8..792acba 100644 --- a/tools/metrics/histograms/metadata/navigation/histograms.xml +++ b/tools/metrics/histograms/metadata/navigation/histograms.xml
@@ -1026,7 +1026,7 @@ </histogram> <histogram name="Navigation.OnBeforeUnloadOverheadTime" units="ms" - expires_after="M89"> + expires_after="M110"> <owner>clamy@chromium.org</owner> <owner>nasko@chromium.org</owner> <summary>
diff --git a/tools/perf/core/path_util.py b/tools/perf/core/path_util.py index 9964fbc..43efdd3 100644 --- a/tools/perf/core/path_util.py +++ b/tools/perf/core/path_util.py
@@ -27,6 +27,10 @@ os.path.dirname(__file__), '..', '..', '..')) +def GetDeviceInteractionDir(): + return os.path.join(GetChromiumSrcDir(), 'third_party', 'catapult', 'devil') + + def GetTelemetryDir(): return os.path.join( GetChromiumSrcDir(), 'third_party', 'catapult', 'telemetry') @@ -66,6 +70,12 @@ return os.path.join(GetChromiumSrcDir(), 'tools', 'variations') +def AddDeviceInteractionToPath(): + device_interaction_path = GetDeviceInteractionDir() + if device_interaction_path not in sys.path: + sys.path.insert(1, device_interaction_path) + + def AddTelemetryToPath(): telemetry_path = GetTelemetryDir() if telemetry_path not in sys.path:
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 57602a4..1e5915e 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -17,8 +17,8 @@ "remote_path": "perfetto_binaries/trace_processor_shell/linux_arm64/49b4b5dcbc312d8d2c3751cf29238b8efeb4e494/trace_processor_shell" }, "linux": { - "hash": "af5144ebded815e04e9efaeec665e7b89556e34c", - "remote_path": "perfetto_binaries/trace_processor_shell/linux/18d0bcdb5c126006c04dfeceff3801aeaa10689f/trace_processor_shell" + "hash": "4c53f46be25d1c851c5f42b1413fbf1ee16434de", + "remote_path": "perfetto_binaries/trace_processor_shell/linux/501a9ac7a54f1754cdcd8d1a7a32de6748fffd57/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/tools/perf/core/results_processor/command_line.py b/tools/perf/core/results_processor/command_line.py index b72be46..51c3ef4 100644 --- a/tools/perf/core/results_processor/command_line.py +++ b/tools/perf/core/results_processor/command_line.py
@@ -99,6 +99,22 @@ '--is-unittest', action='store_true', help='Is running inside a unittest.') + group.add_argument( + '--fetch-device-data', + action='store_true', + help='Android-specific argument to enable fetching data from a device.') + group.add_argument( + '--device-data-path', + dest='device_data_path', + help=('Android-specific argument for --fetch-data-device. Use this to ' + 'specify the path on device to pull data from using adb.')) + group.add_argument( + '--local-data-path', + dest='local_data_path', + default=os.environ.get('ISOLATED_OUTDIR'), + help=('Android-specific argument for --fetch-data-device. Use this to ' + 'override the local copy path. Defaults to ISOLATED_OUTDIR ' + 'environment variable.')) return parser
diff --git a/tools/perf/core/results_processor/processor.py b/tools/perf/core/results_processor/processor.py index 9e41ada..30d57bd5 100644 --- a/tools/perf/core/results_processor/processor.py +++ b/tools/perf/core/results_processor/processor.py
@@ -29,6 +29,13 @@ from core.results_processor import util from core.tbmv3 import trace_processor +# The import error below is mysterious: it produces no detailed error message, +# while appending a proper sys.path does not help. +from core import path_util +path_util.AddDeviceInteractionToPath() +from devil.android import device_utils # pylint: disable=import-error +from devil.android.sdk import adb_wrapper # pylint: disable=import-error + from tracing.trace_data import trace_data from tracing.value.diagnostics import all_diagnostics from tracing.value.diagnostics import generic_set @@ -115,6 +122,9 @@ print('View results at file://', output_file, sep='') + if options.fetch_device_data: + PullDeviceArtifacts(options.device_data_path, options.local_data_path) + return GenerateExitCode(test_results) @@ -455,6 +465,28 @@ del artifacts[MEASUREMENTS_NAME] +def PullDeviceArtifacts(device_path, local_path): + """Pull files from on-device path using `adb` + + Args: + device_path: (string) absolute path to the file/folder on-device to pull. + local_path: (string) absolute path to local destination. + + Raises: + device_errors.AdbCommandFailedError + """ + if not device_path: + logging.warning('No path to data specified to pull from device. ' + 'Skipping.') + return + + devices = adb_wrapper.PersistentShell.Devices() + # Each docker host in chrome-swarming has one device attached, so we'll use + # the first AdbWrapper instance as the assumed attached device in question + utils = device_utils.DeviceUtils(devices[0]) + utils.PullFile(device_path, local_path) + + def main(args=None): """Entry point for the standalone version of the results_processor script.""" parser = command_line.ArgumentParser(standalone=True)
diff --git a/ui/accelerated_widget_mac/ca_transaction_observer.h b/ui/accelerated_widget_mac/ca_transaction_observer.h index 44de148..bfcbe49e 100644 --- a/ui/accelerated_widget_mac/ca_transaction_observer.h +++ b/ui/accelerated_widget_mac/ca_transaction_observer.h
@@ -68,6 +68,9 @@ static CATransactionCoordinator& Get(); + CATransactionCoordinator(const CATransactionCoordinator&) = delete; + CATransactionCoordinator& operator=(const CATransactionCoordinator&) = delete; + void Synchronize(); void DisableForTesting() { disabled_for_testing_ = true; } @@ -90,8 +93,6 @@ bool disabled_for_testing_ = false; base::ObserverList<PreCommitObserver>::Unchecked pre_commit_observers_; std::set<scoped_refptr<PostCommitObserver>> post_commit_observers_; - - DISALLOW_COPY_AND_ASSIGN(CATransactionCoordinator); }; } // namespace ui
diff --git a/ui/accelerated_widget_mac/window_resize_helper_mac.cc b/ui/accelerated_widget_mac/window_resize_helper_mac.cc index 972d9114..776761a3 100644 --- a/ui/accelerated_widget_mac/window_resize_helper_mac.cc +++ b/ui/accelerated_widget_mac/window_resize_helper_mac.cc
@@ -66,6 +66,9 @@ const EventTimedWaitCallback& event_timed_wait_callback, const scoped_refptr<base::SingleThreadTaskRunner>& target_task_runner); + PumpableTaskRunner(const PumpableTaskRunner&) = delete; + PumpableTaskRunner& operator=(const PumpableTaskRunner&) = delete; + // Enqueue WrappedTask and post it to |target_task_runner_|. bool EnqueueAndPostWrappedTask(const base::Location& from_here, std::unique_ptr<WrappedTask> task, @@ -106,8 +109,6 @@ EventTimedWaitCallback event_timed_wait_callback_; scoped_refptr<base::SingleThreadTaskRunner> target_task_runner_; - - DISALLOW_COPY_AND_ASSIGN(PumpableTaskRunner); }; base::LazyInstance<WindowResizeHelperMac>::Leaky g_window_resize_helper =
diff --git a/ui/accelerated_widget_mac/window_resize_helper_mac.h b/ui/accelerated_widget_mac/window_resize_helper_mac.h index e58276662..9f672088 100644 --- a/ui/accelerated_widget_mac/window_resize_helper_mac.h +++ b/ui/accelerated_widget_mac/window_resize_helper_mac.h
@@ -47,6 +47,9 @@ public: static WindowResizeHelperMac* Get(); + WindowResizeHelperMac(const WindowResizeHelperMac&) = delete; + WindowResizeHelperMac& operator=(const WindowResizeHelperMac&) = delete; + // Initializes the pumpable task_runner(), providing it with the task runner // for UI thread tasks. task_runner() will be null before Init() is called, // and WaitForSingleTaskToRun() will immediately return false. @@ -77,8 +80,6 @@ // The task runner to which the helper will post tasks. This also maintains // the task queue and does the actual work for WaitForSingleTaskToRun. scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - - DISALLOW_COPY_AND_ASSIGN(WindowResizeHelperMac); }; } // namespace ui
diff --git a/ui/accessibility/ax_action_handler_registry.h b/ui/accessibility/ax_action_handler_registry.h index ac719a0d..172b2a3 100644 --- a/ui/accessibility/ax_action_handler_registry.h +++ b/ui/accessibility/ax_action_handler_registry.h
@@ -49,6 +49,9 @@ // Get the single instance of this class. static AXActionHandlerRegistry* GetInstance(); + AXActionHandlerRegistry(const AXActionHandlerRegistry&) = delete; + AXActionHandlerRegistry& operator=(const AXActionHandlerRegistry&) = delete; + // Gets the frame id based on an ax tree id. FrameID GetFrameID(const AXTreeID& ax_tree_id); @@ -98,8 +101,6 @@ // Tracks all observers. base::ObserverList<AXActionHandlerObserver> observers_; - - DISALLOW_COPY_AND_ASSIGN(AXActionHandlerRegistry); }; } // namespace ui
diff --git a/ui/accessibility/ax_node_position_unittest.cc b/ui/accessibility/ax_node_position_unittest.cc index 9d4e189..a7368e02 100644 --- a/ui/accessibility/ax_node_position_unittest.cc +++ b/ui/accessibility/ax_node_position_unittest.cc
@@ -168,10 +168,13 @@ ExpandToEnclosingTextBoundaryTestParam> { public: AXPositionExpandToEnclosingTextBoundaryTestWithParam() = default; - ~AXPositionExpandToEnclosingTextBoundaryTestWithParam() override = default; - DISALLOW_COPY_AND_ASSIGN( - AXPositionExpandToEnclosingTextBoundaryTestWithParam); + AXPositionExpandToEnclosingTextBoundaryTestWithParam( + const AXPositionExpandToEnclosingTextBoundaryTestWithParam&) = delete; + AXPositionExpandToEnclosingTextBoundaryTestWithParam& operator=( + const AXPositionExpandToEnclosingTextBoundaryTestWithParam&) = delete; + + ~AXPositionExpandToEnclosingTextBoundaryTestWithParam() override = default; }; // Used by AXPositionCreatePositionAtTextBoundaryTestWithParam.
diff --git a/ui/accessibility/platform/atk_util_auralinux.h b/ui/accessibility/platform/atk_util_auralinux.h index e0e8ba6a..c964a7d 100644 --- a/ui/accessibility/platform/atk_util_auralinux.h +++ b/ui/accessibility/platform/atk_util_auralinux.h
@@ -40,6 +40,9 @@ AtkUtilAuraLinux() = default; + AtkUtilAuraLinux(const AtkUtilAuraLinux&) = delete; + AtkUtilAuraLinux& operator=(const AtkUtilAuraLinux&) = delete; + void InitializeAsync(); void InitializeForTesting(); @@ -62,8 +65,6 @@ void PlatformInitializeAsync(); bool at_spi_ready_ = false; - - DISALLOW_COPY_AND_ASSIGN(AtkUtilAuraLinux); }; } // namespace ui
diff --git a/ui/accessibility/platform/ax_platform_node.h b/ui/accessibility/platform/ax_platform_node.h index ff80e81c8..b0408dc8 100644 --- a/ui/accessibility/platform/ax_platform_node.h +++ b/ui/accessibility/platform/ax_platform_node.h
@@ -45,6 +45,9 @@ // Return the AXPlatformNode at the root of the tree for a native window. static AXPlatformNode* FromNativeWindow(gfx::NativeWindow native_window); + AXPlatformNode(const AXPlatformNode&) = delete; + AXPlatformNode& operator=(const AXPlatformNode&) = delete; + // Provide a function that returns the AXPlatformNode at the root of the // tree for a native window. static void RegisterNativeWindowHandler(NativeWindowHandlerCallback handler); @@ -140,8 +143,6 @@ static gfx::NativeViewAccessible popup_focus_override_; bool is_primary_web_contents_for_window_ = false; - - DISALLOW_COPY_AND_ASSIGN(AXPlatformNode); }; namespace testing {
diff --git a/ui/accessibility/platform/ax_platform_node_mac.h b/ui/accessibility/platform/ax_platform_node_mac.h index bd5762a..248aed7 100644 --- a/ui/accessibility/platform/ax_platform_node_mac.h +++ b/ui/accessibility/platform/ax_platform_node_mac.h
@@ -20,6 +20,9 @@ public: AXPlatformNodeMac(); + AXPlatformNodeMac(const AXPlatformNodeMac&) = delete; + AXPlatformNodeMac& operator=(const AXPlatformNodeMac&) = delete; + // AXPlatformNode. gfx::NativeViewAccessible GetNativeViewAccessible() override; void NotifyAccessibilityEvent(ax::mojom::Event event_type) override; @@ -44,8 +47,6 @@ ~AXPlatformNodeMac() override; base::scoped_nsobject<AXPlatformNodeCocoa> native_node_; - - DISALLOW_COPY_AND_ASSIGN(AXPlatformNodeMac); }; // Convenience function to determine whether an internal object role should
diff --git a/ui/android/handle_view_resources.h b/ui/android/handle_view_resources.h index 2848434..f6bc58e 100644 --- a/ui/android/handle_view_resources.h +++ b/ui/android/handle_view_resources.h
@@ -20,6 +20,10 @@ class UI_ANDROID_EXPORT HandleViewResources { public: HandleViewResources(); + + HandleViewResources(const HandleViewResources&) = delete; + HandleViewResources& operator=(const HandleViewResources&) = delete; + void LoadIfNecessary(const JavaRef<jobject>& context); const SkBitmap& GetBitmap(ui::TouchHandleOrientation orientation); float GetDrawableHorizontalPaddingRatio() const; @@ -30,8 +34,6 @@ SkBitmap center_bitmap_; float drawable_horizontal_padding_ratio_; bool loaded_ = false; - - DISALLOW_COPY_AND_ASSIGN(HandleViewResources); }; } // namespace ui
diff --git a/ui/android/resources/resource_manager_impl_unittest.cc b/ui/android/resources/resource_manager_impl_unittest.cc index 564c9db..11431ba 100644 --- a/ui/android/resources/resource_manager_impl_unittest.cc +++ b/ui/android/resources/resource_manager_impl_unittest.cc
@@ -76,11 +76,11 @@ public: MockUIResourceManager() {} + MockUIResourceManager(const MockUIResourceManager&) = delete; + MockUIResourceManager& operator=(const MockUIResourceManager&) = delete; + MOCK_METHOD1(CreateUIResource, cc::UIResourceId(cc::UIResourceClient*)); MOCK_METHOD1(DeleteUIResource, void(cc::UIResourceId)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockUIResourceManager); }; } // namespace
diff --git a/ui/android/run_all_unittests.cc b/ui/android/run_all_unittests.cc index ee92090..b1ed2c3 100644 --- a/ui/android/run_all_unittests.cc +++ b/ui/android/run_all_unittests.cc
@@ -19,6 +19,9 @@ public: UIAndroidTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} + UIAndroidTestSuite(const UIAndroidTestSuite&) = delete; + UIAndroidTestSuite& operator=(const UIAndroidTestSuite&) = delete; + protected: void Initialize() override { base::TestSuite::Initialize(); @@ -32,9 +35,6 @@ ui::ResourceBundle::CleanupSharedInstance(); base::TestSuite::Shutdown(); } - - private: - DISALLOW_COPY_AND_ASSIGN(UIAndroidTestSuite); }; } // namespace
diff --git a/ui/android/view_android.h b/ui/android/view_android.h index e4f8fcb..f492a0e 100644 --- a/ui/android/view_android.h +++ b/ui/android/view_android.h
@@ -106,6 +106,10 @@ explicit ViewAndroid(LayoutType layout_type); ViewAndroid(); + + ViewAndroid(const ViewAndroid&) = delete; + ViewAndroid& operator=(const ViewAndroid&) = delete; + virtual ~ViewAndroid(); void UpdateFrameInfo(const FrameInfo& frame_info); @@ -313,8 +317,6 @@ CopyViewCallback copy_view_callback_; bool controls_resize_view_ = false; - - DISALLOW_COPY_AND_ASSIGN(ViewAndroid); }; } // namespace ui
diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc index 755fdad2..3488d05 100644 --- a/ui/aura/demo/demo_main.cc +++ b/ui/aura/demo/demo_main.cc
@@ -53,6 +53,9 @@ public: explicit DemoWindowDelegate(SkColor color) : color_(color) {} + DemoWindowDelegate(const DemoWindowDelegate&) = delete; + DemoWindowDelegate& operator=(const DemoWindowDelegate&) = delete; + // Overridden from WindowDelegate: gfx::Size GetMinimumSize() const override { return gfx::Size(); } @@ -98,8 +101,6 @@ private: SkColor color_; gfx::Rect window_bounds_; - - DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate); }; class DemoWindowParentingClient : public aura::client::WindowParentingClient { @@ -139,13 +140,15 @@ explicit Observer(base::OnceClosure quit_closure) : quit_closure_(std::move(quit_closure)) {} + Observer(const Observer&) = delete; + Observer& operator=(const Observer&) = delete; + void OnHostCloseRequested(aura::WindowTreeHost* host) override { std::move(quit_closure_).Run(); } private: base::OnceClosure quit_closure_; - DISALLOW_COPY_AND_ASSIGN(Observer); }; base::RunLoop run_loop;
diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc index 40932c4..26555d7 100644 --- a/ui/aura/gestures/gesture_recognizer_unittest.cc +++ b/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -417,6 +417,10 @@ double_click_(false) { } + GestureEventSynthDelegate(const GestureEventSynthDelegate&) = delete; + GestureEventSynthDelegate& operator=(const GestureEventSynthDelegate&) = + delete; + void Reset() { mouse_enter_ = false; mouse_exit_ = false; @@ -464,8 +468,6 @@ bool mouse_release_; bool mouse_move_; bool double_click_; - - DISALLOW_COPY_AND_ASSIGN(GestureEventSynthDelegate); }; class TimedEvents { @@ -650,29 +652,31 @@ public: GestureRecognizerTest() {} + GestureRecognizerTest(const GestureRecognizerTest&) = delete; + GestureRecognizerTest& operator=(const GestureRecognizerTest&) = delete; + void SetUp() override { AuraTestBase::SetUp(); ui::GestureConfiguration::GetInstance()->set_show_press_delay_in_ms(2); ui::GestureConfiguration::GetInstance()->set_long_press_time_in_ms(3); } - - private: - DISALLOW_COPY_AND_ASSIGN(GestureRecognizerTest); }; class GestureRecognizerWithSwitchTest : public GestureRecognizerTest { public: GestureRecognizerWithSwitchTest() {} + GestureRecognizerWithSwitchTest(const GestureRecognizerWithSwitchTest&) = + delete; + GestureRecognizerWithSwitchTest& operator=( + const GestureRecognizerWithSwitchTest&) = delete; + void SetUp() override { GestureRecognizerTest::SetUp(); base::CommandLine::ForCurrentProcess()->AppendSwitch( switches::kCompensateForUnstablePinchZoom); ui::GestureConfiguration::GetInstance()->set_min_pinch_update_span_delta(5); } - - private: - DISALLOW_COPY_AND_ASSIGN(GestureRecognizerWithSwitchTest); }; // Verify that we do not crash when removing a window during a cancel touch @@ -4262,6 +4266,11 @@ public: GestureEventDeleteWindowOnLongPress() : window_(nullptr) {} + GestureEventDeleteWindowOnLongPress( + const GestureEventDeleteWindowOnLongPress&) = delete; + GestureEventDeleteWindowOnLongPress& operator=( + const GestureEventDeleteWindowOnLongPress&) = delete; + void set_window(aura::Window** window) { window_ = window; } void OnGestureEvent(ui::GestureEvent* gesture) override { @@ -4274,7 +4283,6 @@ private: aura::Window** window_; - DISALLOW_COPY_AND_ASSIGN(GestureEventDeleteWindowOnLongPress); }; // Check that deleting the window in response to a long press gesture doesn't
diff --git a/ui/aura/native_window_occlusion_tracker_unittest.cc b/ui/aura/native_window_occlusion_tracker_unittest.cc index c3e34f0..3fb91bcf 100644 --- a/ui/aura/native_window_occlusion_tracker_unittest.cc +++ b/ui/aura/native_window_occlusion_tracker_unittest.cc
@@ -88,6 +88,11 @@ public: NativeWindowOcclusionTrackerTest() {} + NativeWindowOcclusionTrackerTest(const NativeWindowOcclusionTrackerTest&) = + delete; + NativeWindowOcclusionTrackerTest& operator=( + const NativeWindowOcclusionTrackerTest&) = delete; + TestNativeWindow* native_win() { return native_win_.get(); } HWND CreateNativeWindow(DWORD style, DWORD ex_style) { @@ -128,8 +133,6 @@ private: std::unique_ptr<TestNativeWindow> native_win_; - - DISALLOW_COPY_AND_ASSIGN(NativeWindowOcclusionTrackerTest); }; TEST_F(NativeWindowOcclusionTrackerTest, VisibleOpaqueWindow) {
diff --git a/ui/aura/native_window_occlusion_tracker_win.h b/ui/aura/native_window_occlusion_tracker_win.h index b61da102..cebe857 100644 --- a/ui/aura/native_window_occlusion_tracker_win.h +++ b/ui/aura/native_window_occlusion_tracker_win.h
@@ -47,6 +47,11 @@ static void DeleteInstanceForTesting(); + NativeWindowOcclusionTrackerWin(const NativeWindowOcclusionTrackerWin&) = + delete; + NativeWindowOcclusionTrackerWin& operator=( + const NativeWindowOcclusionTrackerWin&) = delete; + // Enables notifying the host of |window| via SetNativeWindowOcclusionState() // when the occlusion state has been computed. void Enable(Window* window); @@ -87,6 +92,10 @@ // thread. static void DeleteInstanceForTesting(base::WaitableEvent* done_event); + WindowOcclusionCalculator(const WindowOcclusionCalculator&) = delete; + WindowOcclusionCalculator& operator=(const WindowOcclusionCalculator&) = + delete; + void EnableOcclusionTrackingForWindow(HWND hwnd); void DisableOcclusionTrackingForWindow(HWND hwnd); @@ -251,8 +260,6 @@ SEQUENCE_CHECKER(sequence_checker_); base::WeakPtrFactory<WindowOcclusionCalculator> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(WindowOcclusionCalculator); }; NativeWindowOcclusionTrackerWin(); @@ -307,8 +314,6 @@ bool display_on_ = true; base::WeakPtrFactory<NativeWindowOcclusionTrackerWin> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(NativeWindowOcclusionTrackerWin); }; } // namespace aura
diff --git a/ui/aura/native_window_occlusion_tracker_win_interactive_test.cc b/ui/aura/native_window_occlusion_tracker_win_interactive_test.cc index ec48c6c..3cf4e1b 100644 --- a/ui/aura/native_window_occlusion_tracker_win_interactive_test.cc +++ b/ui/aura/native_window_occlusion_tracker_win_interactive_test.cc
@@ -115,6 +115,12 @@ // start of the test here since a new process is launched for each test. mojo::core::Init(); } + + NativeWindowOcclusionTrackerTest(const NativeWindowOcclusionTrackerTest&) = + delete; + NativeWindowOcclusionTrackerTest& operator=( + const NativeWindowOcclusionTrackerTest&) = delete; + void SetUp() override { if (gl::GetGLImplementation() == gl::kGLImplementationNone) gl::GLSurfaceTestSupport::InitializeOneOff(); @@ -186,8 +192,6 @@ private: base::test::ScopedFeatureList scoped_feature_list_; std::unique_ptr<TestNativeWindow> native_win_; - - DISALLOW_COPY_AND_ASSIGN(NativeWindowOcclusionTrackerTest); }; // Simple test completely covering an aura window with a native window.
diff --git a/ui/aura/test/aura_test_utils.cc b/ui/aura/test/aura_test_utils.cc index 544c262..26fe92e 100644 --- a/ui/aura/test/aura_test_utils.cc +++ b/ui/aura/test/aura_test_utils.cc
@@ -17,6 +17,9 @@ public: explicit WindowTreeHostTestApi(WindowTreeHost* host) : host_(host) {} + WindowTreeHostTestApi(const WindowTreeHostTestApi&) = delete; + WindowTreeHostTestApi& operator=(const WindowTreeHostTestApi&) = delete; + const gfx::Point& last_cursor_request_position_in_host() { return host_->last_cursor_request_position_in_host_; } @@ -29,8 +32,6 @@ private: WindowTreeHost* host_; - - DISALLOW_COPY_AND_ASSIGN(WindowTreeHostTestApi); }; const gfx::Point& QueryLatestMousePositionRequestInHost(WindowTreeHost* host) {
diff --git a/ui/aura/test/run_all_unittests.cc b/ui/aura/test/run_all_unittests.cc index fc1f8a3..5a12493 100644 --- a/ui/aura/test/run_all_unittests.cc +++ b/ui/aura/test/run_all_unittests.cc
@@ -22,6 +22,9 @@ public: AuraTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} + AuraTestSuite(const AuraTestSuite&) = delete; + AuraTestSuite& operator=(const AuraTestSuite&) = delete; + void DestroyEnv() { env_.reset(); } void CreateEnv() { env_ = aura::Env::CreateInstance(); } @@ -42,7 +45,6 @@ private: std::unique_ptr<aura::Env> env_; - DISALLOW_COPY_AND_ASSIGN(AuraTestSuite); }; namespace aura {
diff --git a/ui/aura/test/test_window_delegate.h b/ui/aura/test/test_window_delegate.h index a1ddd2c8..fcb8e9c 100644 --- a/ui/aura/test/test_window_delegate.h +++ b/ui/aura/test/test_window_delegate.h
@@ -106,14 +106,15 @@ public: explicit MaskedWindowDelegate(const gfx::Rect mask_rect); + MaskedWindowDelegate(const MaskedWindowDelegate&) = delete; + MaskedWindowDelegate& operator=(const MaskedWindowDelegate&) = delete; + // Overridden from TestWindowDelegate: bool HasHitTestMask() const override; void GetHitTestMask(SkPath* mask) const override; private: gfx::Rect mask_rect_; - - DISALLOW_COPY_AND_ASSIGN(MaskedWindowDelegate); }; // Keeps track of mouse/key events. @@ -121,6 +122,9 @@ public: EventCountDelegate(); + EventCountDelegate(const EventCountDelegate&) = delete; + EventCountDelegate& operator=(const EventCountDelegate&) = delete; + // Overridden from TestWindowDelegate: void OnKeyEvent(ui::KeyEvent* event) override; void OnMouseEvent(ui::MouseEvent* event) override; @@ -150,8 +154,6 @@ int key_press_count_; int key_release_count_; int gesture_count_; - - DISALLOW_COPY_AND_ASSIGN(EventCountDelegate); }; } // namespace test
diff --git a/ui/aura/test/ui_controls_factory_aurawin.cc b/ui/aura/test/ui_controls_factory_aurawin.cc index 35a0fb1..e12f2b6 100644 --- a/ui/aura/test/ui_controls_factory_aurawin.cc +++ b/ui/aura/test/ui_controls_factory_aurawin.cc
@@ -29,6 +29,9 @@ public: UIControlsWin() {} + UIControlsWin(const UIControlsWin&) = delete; + UIControlsWin& operator=(const UIControlsWin&) = delete; + // UIControlsAura overrides: bool SendKeyPress(gfx::NativeWindow native_window, ui::KeyboardCode key, @@ -84,9 +87,6 @@ bool SendTouchEvents(int action, int num, int x, int y) override { return ui_controls::internal::SendTouchEventsImpl(action, num, x, y); } - - private: - DISALLOW_COPY_AND_ASSIGN(UIControlsWin); }; } // namespace
diff --git a/ui/aura/test/window_event_dispatcher_test_api.h b/ui/aura/test/window_event_dispatcher_test_api.h index bcb6bbe..11bb5cc 100644 --- a/ui/aura/test/window_event_dispatcher_test_api.h +++ b/ui/aura/test/window_event_dispatcher_test_api.h
@@ -17,6 +17,10 @@ public: explicit WindowEventDispatcherTestApi(WindowEventDispatcher* dispatcher); + WindowEventDispatcherTestApi(const WindowEventDispatcherTestApi&) = delete; + WindowEventDispatcherTestApi& operator=(const WindowEventDispatcherTestApi&) = + delete; + bool HoldingPointerMoves() const; // If pointer moves are being held, this method waits until they're @@ -25,8 +29,6 @@ private: WindowEventDispatcher* dispatcher_; - - DISALLOW_COPY_AND_ASSIGN(WindowEventDispatcherTestApi); }; } // namespace test
diff --git a/ui/aura/test/window_test_api.h b/ui/aura/test/window_test_api.h index 6771fd74..2f8f1aa5 100644 --- a/ui/aura/test/window_test_api.h +++ b/ui/aura/test/window_test_api.h
@@ -15,6 +15,9 @@ public: explicit WindowTestApi(Window* window); + WindowTestApi(const WindowTestApi&) = delete; + WindowTestApi& operator=(const WindowTestApi&) = delete; + bool OwnsLayer() const; bool ContainsMouse() const; @@ -25,8 +28,6 @@ private: Window* window_; - - DISALLOW_COPY_AND_ASSIGN(WindowTestApi); }; } // namespace test
diff --git a/ui/aura/window_event_dispatcher_unittest.cc b/ui/aura/window_event_dispatcher_unittest.cc index 4b5931d..bb93010 100644 --- a/ui/aura/window_event_dispatcher_unittest.cc +++ b/ui/aura/window_event_dispatcher_unittest.cc
@@ -534,6 +534,9 @@ : wait_until_event_(ui::ET_UNKNOWN), last_touch_may_cause_scrolling_(false) {} + EventFilterRecorder(const EventFilterRecorder&) = delete; + EventFilterRecorder& operator=(const EventFilterRecorder&) = delete; + const Events& events() const { return events_; } const EventLocations& mouse_locations() const { return mouse_locations_; } @@ -605,8 +608,6 @@ EventLocations gesture_locations_; EventFlags mouse_event_flags_; bool last_touch_may_cause_scrolling_; - - DISALLOW_COPY_AND_ASSIGN(EventFilterRecorder); }; // Converts an EventType to a string. @@ -1930,6 +1931,11 @@ bool* has_valid_root) : got_destroying_(got_destroying), has_valid_root_(has_valid_root) {} + ValidRootDuringDestructionWindowObserver( + const ValidRootDuringDestructionWindowObserver&) = delete; + ValidRootDuringDestructionWindowObserver& operator=( + const ValidRootDuringDestructionWindowObserver&) = delete; + // WindowObserver: void OnWindowDestroying(aura::Window* window) override { *got_destroying_ = true; @@ -1939,8 +1945,6 @@ private: bool* got_destroying_; bool* has_valid_root_; - - DISALLOW_COPY_AND_ASSIGN(ValidRootDuringDestructionWindowObserver); }; } // namespace @@ -2953,6 +2957,9 @@ AsyncWindowDelegate(WindowEventDispatcher* dispatcher) : dispatcher_(dispatcher), window_(nullptr) {} + AsyncWindowDelegate(const AsyncWindowDelegate&) = delete; + AsyncWindowDelegate& operator=(const AsyncWindowDelegate&) = delete; + void set_window(Window* window) { window_ = window; } private: @@ -2968,8 +2975,6 @@ WindowEventDispatcher* dispatcher_; Window* window_; - - DISALLOW_COPY_AND_ASSIGN(AsyncWindowDelegate); }; // Tests that gesture events dispatched through the asynchronous flow have
diff --git a/ui/aura/window_occlusion_tracker.h b/ui/aura/window_occlusion_tracker.h index 5d79a499..73a44d1e3 100644 --- a/ui/aura/window_occlusion_tracker.h +++ b/ui/aura/window_occlusion_tracker.h
@@ -131,6 +131,9 @@ SkRegion occluded_region; }; + WindowOcclusionTracker(const WindowOcclusionTracker&) = delete; + WindowOcclusionTracker& operator=(const WindowOcclusionTracker&) = delete; + // Start tracking the occlusion state of |window|. void Track(Window* window); @@ -401,8 +404,6 @@ // values. If the occlusion tracker is not computing for a specific window // (most of the time it is not), this will be nullptr. Window* target_occlusion_window_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(WindowOcclusionTracker); }; } // namespace aura
diff --git a/ui/aura/window_occlusion_tracker_unittest.cc b/ui/aura/window_occlusion_tracker_unittest.cc index f8426ec..af30968 100644 --- a/ui/aura/window_occlusion_tracker_unittest.cc +++ b/ui/aura/window_occlusion_tracker_unittest.cc
@@ -80,6 +80,10 @@ public: WindowOcclusionTrackerTest() = default; + WindowOcclusionTrackerTest(const WindowOcclusionTrackerTest&) = delete; + WindowOcclusionTrackerTest& operator=(const WindowOcclusionTrackerTest&) = + delete; + #if defined(OS_WIN) void SetUp() override { // Native Window Occlusion calculation runs in the background and can @@ -135,8 +139,6 @@ private: base::test::ScopedFeatureList scoped_feature_list_; - - DISALLOW_COPY_AND_ASSIGN(WindowOcclusionTrackerTest); }; SkRegion SkRegionFromSkIRects(std::initializer_list<SkIRect> rects) { @@ -1105,6 +1107,9 @@ ResizeWindowObserver(Window* window_to_resize) : window_to_resize_(window_to_resize) {} + ResizeWindowObserver(const ResizeWindowObserver&) = delete; + ResizeWindowObserver& operator=(const ResizeWindowObserver&) = delete; + void OnWindowBoundsChanged(Window* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, @@ -1114,8 +1119,6 @@ private: Window* const window_to_resize_; - - DISALLOW_COPY_AND_ASSIGN(ResizeWindowObserver); }; } // namespace @@ -1368,13 +1371,14 @@ public: ObserverChangingWindowBounds() = default; + ObserverChangingWindowBounds(const ObserverChangingWindowBounds&) = delete; + ObserverChangingWindowBounds& operator=(const ObserverChangingWindowBounds&) = + delete; + // WindowObserver: void OnWindowParentChanged(Window* window, Window* parent) override { window->SetBounds(gfx::Rect(1, 2, 3, 4)); } - - private: - DISALLOW_COPY_AND_ASSIGN(ObserverChangingWindowBounds); }; } // namespace @@ -1571,6 +1575,11 @@ explicit WindowDelegateHidingWindowIfOccluded(Window* other_window) : other_window_(other_window) {} + WindowDelegateHidingWindowIfOccluded( + const WindowDelegateHidingWindowIfOccluded&) = delete; + WindowDelegateHidingWindowIfOccluded& operator=( + const WindowDelegateHidingWindowIfOccluded&) = delete; + // MockWindowDelegate: void OnWindowOcclusionChanged( Window::OcclusionState occlusion_state) override { @@ -1581,14 +1590,17 @@ private: Window* other_window_; - - DISALLOW_COPY_AND_ASSIGN(WindowDelegateHidingWindowIfOccluded); }; class WindowDelegateWithQueuedExpectation : public MockWindowDelegate { public: WindowDelegateWithQueuedExpectation() = default; + WindowDelegateWithQueuedExpectation( + const WindowDelegateWithQueuedExpectation&) = delete; + WindowDelegateWithQueuedExpectation& operator=( + const WindowDelegateWithQueuedExpectation&) = delete; + void set_queued_expectation(Window::OcclusionState occlusion_state, const SkRegion& occluded_region) { queued_expected_occlusion_state_ = occlusion_state; @@ -1611,8 +1623,6 @@ Window::OcclusionState queued_expected_occlusion_state_ = Window::OcclusionState::UNKNOWN; SkRegion queued_expected_occluded_region_ = SkRegion(); - - DISALLOW_COPY_AND_ASSIGN(WindowDelegateWithQueuedExpectation); }; } // namespace @@ -1658,6 +1668,10 @@ public: WindowDelegateDeletingWindow() = default; + WindowDelegateDeletingWindow(const WindowDelegateDeletingWindow&) = delete; + WindowDelegateDeletingWindow& operator=(const WindowDelegateDeletingWindow&) = + delete; + void set_other_window(Window* other_window) { other_window_ = other_window; } // MockWindowDelegate: @@ -1672,8 +1686,6 @@ private: Window* other_window_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(WindowDelegateDeletingWindow); }; } // namespace @@ -1728,6 +1740,11 @@ public: WindowDelegateChangingWindowVisibility() = default; + WindowDelegateChangingWindowVisibility( + const WindowDelegateChangingWindowVisibility&) = delete; + WindowDelegateChangingWindowVisibility& operator=( + const WindowDelegateChangingWindowVisibility&) = delete; + void set_window_to_update(Window* window) { window_to_update_ = window; } // MockWindowDelegate: @@ -1752,8 +1769,6 @@ private: Window* window_to_update_ = nullptr; int num_occlusion_change_ = 0; - - DISALLOW_COPY_AND_ASSIGN(WindowDelegateChangingWindowVisibility); }; } // namespace @@ -1919,6 +1934,10 @@ public: WindowDelegateHidingWindow() = default; + WindowDelegateHidingWindow(const WindowDelegateHidingWindow&) = delete; + WindowDelegateHidingWindow& operator=(const WindowDelegateHidingWindow&) = + delete; + void set_window_to_update(Window* window) { window_to_update_ = window; } // MockWindowDelegate: @@ -1933,8 +1952,6 @@ private: Window* window_to_update_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(WindowDelegateHidingWindow); }; class WindowDelegateAddingAndHidingChild : public MockWindowDelegate { @@ -1942,6 +1959,11 @@ explicit WindowDelegateAddingAndHidingChild(WindowOcclusionTrackerTest* test) : test_(test) {} + WindowDelegateAddingAndHidingChild( + const WindowDelegateAddingAndHidingChild&) = delete; + WindowDelegateAddingAndHidingChild& operator=( + const WindowDelegateAddingAndHidingChild&) = delete; + void set_queued_expectation(Window::OcclusionState occlusion_state, const SkRegion& occluded_region) { queued_expected_occlusion_state_ = occlusion_state; @@ -1978,8 +2000,6 @@ Window::OcclusionState queued_expected_occlusion_state_ = Window::OcclusionState::UNKNOWN; SkRegion queued_expected_occluded_region_ = SkRegion(); - - DISALLOW_COPY_AND_ASSIGN(WindowDelegateAddingAndHidingChild); }; } // namespace
diff --git a/ui/aura/window_tree_host_platform_unittest.cc b/ui/aura/window_tree_host_platform_unittest.cc index df2d628..78e4545 100644 --- a/ui/aura/window_tree_host_platform_unittest.cc +++ b/ui/aura/window_tree_host_platform_unittest.cc
@@ -42,12 +42,12 @@ CreateCompositor(); } + TestWindowTreeHost(const TestWindowTreeHost&) = delete; + TestWindowTreeHost& operator=(const TestWindowTreeHost&) = delete; + ui::PlatformWindow* platform_window() { return WindowTreeHostPlatform::platform_window(); } - - private: - DISALLOW_COPY_AND_ASSIGN(TestWindowTreeHost); }; // WindowTreeHostObserver that tracks calls to
diff --git a/ui/aura/window_tree_host_unittest.cc b/ui/aura/window_tree_host_unittest.cc index ffb292b..5f57bf6 100644 --- a/ui/aura/window_tree_host_unittest.cc +++ b/ui/aura/window_tree_host_unittest.cc
@@ -181,8 +181,8 @@ CreateCompositor(); } - private: - DISALLOW_COPY_AND_ASSIGN(TestWindowTreeHost); + TestWindowTreeHost(const TestWindowTreeHost&) = delete; + TestWindowTreeHost& operator=(const TestWindowTreeHost&) = delete; }; TEST_F(WindowTreeHostTest, LostCaptureDuringTearDown) {
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc index a188a27..b331431 100644 --- a/ui/aura/window_unittest.cc +++ b/ui/aura/window_unittest.cc
@@ -195,6 +195,9 @@ WindowTest() : max_separation_(0) { } + WindowTest(const WindowTest&) = delete; + WindowTest& operator=(const WindowTest&) = delete; + void SetUp() override { AuraTestBase::SetUp(); // TODO: there needs to be an easier way to do this. @@ -212,8 +215,6 @@ private: float max_separation_; - - DISALLOW_COPY_AND_ASSIGN(WindowTest); }; // Used for verifying destruction methods are invoked. @@ -224,6 +225,10 @@ destroyed_count_(0), in_destroying_(false) {} + DestroyTrackingDelegateImpl(const DestroyTrackingDelegateImpl&) = delete; + DestroyTrackingDelegateImpl& operator=(const DestroyTrackingDelegateImpl&) = + delete; + void clear_destroying_count() { destroying_count_ = 0; } int destroying_count() const { return destroying_count_; } @@ -248,8 +253,6 @@ int destroying_count_; int destroyed_count_; bool in_destroying_; - - DISALLOW_COPY_AND_ASSIGN(DestroyTrackingDelegateImpl); }; // Used to verify that when OnWindowDestroying is invoked the parent is also @@ -261,6 +264,9 @@ : parent_delegate_(parent_delegate) { } + ChildWindowDelegateImpl(const ChildWindowDelegateImpl&) = delete; + ChildWindowDelegateImpl& operator=(const ChildWindowDelegateImpl&) = delete; + void OnWindowDestroying(Window* window) override { EXPECT_TRUE(parent_delegate_->in_destroying()); DestroyTrackingDelegateImpl::OnWindowDestroying(window); @@ -268,8 +274,6 @@ private: DestroyTrackingDelegateImpl* parent_delegate_; - - DISALLOW_COPY_AND_ASSIGN(ChildWindowDelegateImpl); }; // Used to verify that a Window is removed from its parent when @@ -278,6 +282,9 @@ public: DestroyOrphanDelegate() : window_(nullptr) {} + DestroyOrphanDelegate(const DestroyOrphanDelegate&) = delete; + DestroyOrphanDelegate& operator=(const DestroyOrphanDelegate&) = delete; + void set_window(Window* window) { window_ = window; } void OnWindowDestroyed(Window* window) override { @@ -286,7 +293,6 @@ private: Window* window_; - DISALLOW_COPY_AND_ASSIGN(DestroyOrphanDelegate); }; // Used in verifying mouse capture. @@ -296,6 +302,10 @@ ResetCounts(); } + CaptureWindowDelegateImpl(const CaptureWindowDelegateImpl&) = delete; + CaptureWindowDelegateImpl& operator=(const CaptureWindowDelegateImpl&) = + delete; + void ResetCounts() { capture_changed_event_count_ = 0; capture_lost_count_ = 0; @@ -329,8 +339,6 @@ int mouse_event_count_; int touch_event_count_; int gesture_event_count_; - - DISALLOW_COPY_AND_ASSIGN(CaptureWindowDelegateImpl); }; // Keeps track of the location of the gesture. @@ -338,6 +346,10 @@ public: GestureTrackPositionDelegate() {} + GestureTrackPositionDelegate(const GestureTrackPositionDelegate&) = delete; + GestureTrackPositionDelegate& operator=(const GestureTrackPositionDelegate&) = + delete; + void OnGestureEvent(ui::GestureEvent* event) override { position_ = event->location(); event->StopPropagation(); @@ -347,8 +359,6 @@ private: gfx::Point position_; - - DISALLOW_COPY_AND_ASSIGN(GestureTrackPositionDelegate); }; base::TimeTicks getTime() { @@ -359,14 +369,16 @@ public: SelfEventHandlingWindowDelegate() {} + SelfEventHandlingWindowDelegate(const SelfEventHandlingWindowDelegate&) = + delete; + SelfEventHandlingWindowDelegate& operator=( + const SelfEventHandlingWindowDelegate&) = delete; + bool ShouldDescendIntoChildForEventHandling( Window* child, const gfx::Point& location) override { return false; } - - private: - DISALLOW_COPY_AND_ASSIGN(SelfEventHandlingWindowDelegate); }; // The delegate deletes itself when the window is being destroyed. @@ -374,13 +386,14 @@ public: DestroyWindowDelegate() {} + DestroyWindowDelegate(const DestroyWindowDelegate&) = delete; + DestroyWindowDelegate& operator=(const DestroyWindowDelegate&) = delete; + private: ~DestroyWindowDelegate() override {} // Overridden from WindowDelegate. void OnWindowDestroyed(Window* window) override { delete this; } - - DISALLOW_COPY_AND_ASSIGN(DestroyWindowDelegate); }; void OffsetBounds(Window* window, int horizontal, int vertical) { @@ -786,14 +799,16 @@ public: AddedToRootWindowObserver() : called_(false) {} + AddedToRootWindowObserver(const AddedToRootWindowObserver&) = delete; + AddedToRootWindowObserver& operator=(const AddedToRootWindowObserver&) = + delete; + void OnWindowAddedToRootWindow(Window* window) override { called_ = true; } bool called() const { return called_; } private: bool called_; - - DISALLOW_COPY_AND_ASSIGN(AddedToRootWindowObserver); }; TEST_F(WindowTest, WindowAddedToRootWindowShouldNotifyChildAndNotParent) { @@ -1362,6 +1377,10 @@ public: MouseEnterExitWindowDelegate() : entered_(false), exited_(false) {} + MouseEnterExitWindowDelegate(const MouseEnterExitWindowDelegate&) = delete; + MouseEnterExitWindowDelegate& operator=(const MouseEnterExitWindowDelegate&) = + delete; + void OnMouseEvent(ui::MouseEvent* event) override { switch (event->type()) { case ui::ET_MOUSE_ENTERED: @@ -1389,8 +1408,6 @@ private: bool entered_; bool exited_; - - DISALLOW_COPY_AND_ASSIGN(MouseEnterExitWindowDelegate); }; // Verifies that the WindowDelegate receives MouseExit and MouseEnter events for @@ -1643,6 +1660,9 @@ hidden_(0) { } + VisibilityWindowDelegate(const VisibilityWindowDelegate&) = delete; + VisibilityWindowDelegate& operator=(const VisibilityWindowDelegate&) = delete; + int shown() const { return shown_; } int hidden() const { return hidden_; } void Clear() { @@ -1660,8 +1680,6 @@ private: int shown_; int hidden_; - - DISALLOW_COPY_AND_ASSIGN(VisibilityWindowDelegate); }; // Verifies show/hide propagate correctly to children and the layer. @@ -2847,6 +2865,10 @@ public: BoundsChangedWindowObserver() : root_set_(false) {} + BoundsChangedWindowObserver(const BoundsChangedWindowObserver&) = delete; + BoundsChangedWindowObserver& operator=(const BoundsChangedWindowObserver&) = + delete; + void OnWindowBoundsChanged(Window* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, @@ -2858,8 +2880,6 @@ private: bool root_set_; - - DISALLOW_COPY_AND_ASSIGN(BoundsChangedWindowObserver); }; TEST_F(WindowTest, RootWindowSetWhenReparenting) { @@ -2923,6 +2943,9 @@ public: OwningWindowDelegate() {} + OwningWindowDelegate(const OwningWindowDelegate&) = delete; + OwningWindowDelegate& operator=(const OwningWindowDelegate&) = delete; + void SetOwnedWindow(Window* window) { owned_window_.reset(window); } @@ -2931,8 +2954,6 @@ private: std::unique_ptr<Window> owned_window_; - - DISALLOW_COPY_AND_ASSIGN(OwningWindowDelegate); }; // Creates a window with two child windows. When the first child window is @@ -3011,6 +3032,9 @@ public: BoundsChangeDelegate() : bounds_changed_(false) {} + BoundsChangeDelegate(const BoundsChangeDelegate&) = delete; + BoundsChangeDelegate& operator=(const BoundsChangeDelegate&) = delete; + void clear_bounds_changed() { bounds_changed_ = false; } bool bounds_changed() const { return bounds_changed_; @@ -3025,8 +3049,6 @@ private: // Was OnBoundsChanged() invoked? bool bounds_changed_; - - DISALLOW_COPY_AND_ASSIGN(BoundsChangeDelegate); }; // Verifies the delegate is notified when the actual bounds of the layer @@ -3112,6 +3134,10 @@ public: AddChildNotificationsObserver() : added_count_(0), removed_count_(0) {} + AddChildNotificationsObserver(const AddChildNotificationsObserver&) = delete; + AddChildNotificationsObserver& operator=( + const AddChildNotificationsObserver&) = delete; + std::string CountStringAndReset() { std::string result = base::NumberToString(added_count_) + " " + base::NumberToString(removed_count_); @@ -3129,8 +3155,6 @@ private: int added_count_; int removed_count_; - - DISALLOW_COPY_AND_ASSIGN(AddChildNotificationsObserver); }; // Assertions around when root window notifications are sent.
diff --git a/ui/aura_extra/window_occlusion_impl_unittest_win.cc b/ui/aura_extra/window_occlusion_impl_unittest_win.cc index 11d3313..6c28eb3 100644 --- a/ui/aura_extra/window_occlusion_impl_unittest_win.cc +++ b/ui/aura_extra/window_occlusion_impl_unittest_win.cc
@@ -29,6 +29,9 @@ const std::vector<EvaluatorArgs>& evaluator_args_list) : args_list_(evaluator_args_list) {} + MockNativeWindowIterator(const MockNativeWindowIterator&) = delete; + MockNativeWindowIterator& operator=(const MockNativeWindowIterator&) = delete; + void Iterate(WindowEvaluator* evaluator) override { for (EvaluatorArgs args : args_list_) { if (!evaluator->EvaluateWindow(args.is_relevant, args.window_rect, @@ -39,8 +42,6 @@ private: std::vector<EvaluatorArgs> args_list_; - - DISALLOW_COPY_AND_ASSIGN(MockNativeWindowIterator); }; // Test implementation of WindowBoundsDelegate using a flat_map of aura::Window @@ -49,6 +50,10 @@ public: MockWindowBoundsDelegateImpl() = default; + MockWindowBoundsDelegateImpl(const MockWindowBoundsDelegateImpl&) = delete; + MockWindowBoundsDelegateImpl& operator=(const MockWindowBoundsDelegateImpl&) = + delete; + // WindowBoundsDelegate implementation: gfx::Rect GetBoundsInPixels(aura::WindowTreeHost* window) override { return root_window_bounds_[window]; @@ -61,8 +66,6 @@ private: base::flat_map<aura::WindowTreeHost*, gfx::Rect> root_window_bounds_; - - DISALLOW_COPY_AND_ASSIGN(MockWindowBoundsDelegateImpl); }; // The int argument here is an offset in pixels for tests that need to offset @@ -75,6 +78,9 @@ public: WindowOcclusionWinTest() {} + WindowOcclusionWinTest(const WindowOcclusionWinTest&) = delete; + WindowOcclusionWinTest& operator=(const WindowOcclusionWinTest&) = delete; + void TearDown() override { Clear(); aura::test::AuraTestBase::TearDown(); @@ -125,8 +131,6 @@ std::vector<std::unique_ptr<aura::WindowTreeHost>> window_tree_hosts_; std::unique_ptr<MockWindowBoundsDelegateImpl> mock_bounds_delegate_ = std::make_unique<MockWindowBoundsDelegateImpl>(); - - DISALLOW_COPY_AND_ASSIGN(WindowOcclusionWinTest); }; // An aura window completely covered by a native window should be occluded. @@ -421,6 +425,9 @@ public: EnumWindowsTest() {} + EnumWindowsTest(const EnumWindowsTest&) = delete; + EnumWindowsTest& operator=(const EnumWindowsTest&) = delete; + void TearDown() override { window_tree_hosts_.clear(); aura::test::AuraTestBase::TearDown(); @@ -445,8 +452,6 @@ std::vector<std::unique_ptr<aura::WindowTreeHost>> window_tree_hosts_; MockWindowEvaluator evaluator_; - - DISALLOW_COPY_AND_ASSIGN(EnumWindowsTest); }; TEST_F(EnumWindowsTest, EnumWindowsGoesFrontToBack) {
diff --git a/ui/aura_extra/window_occlusion_impl_win.h b/ui/aura_extra/window_occlusion_impl_win.h index 02aca6fd..52c9ea42 100644 --- a/ui/aura_extra/window_occlusion_impl_win.h +++ b/ui/aura_extra/window_occlusion_impl_win.h
@@ -35,6 +35,10 @@ class AURA_EXTRA_EXPORT WindowEvaluator { public: WindowEvaluator() {} + + WindowEvaluator(const WindowEvaluator&) = delete; + WindowEvaluator& operator=(const WindowEvaluator&) = delete; + // Called by NativeWindowIterator::Iterate and processes the metadata for a // single window. It is assumed that this is called in reverse z-order // (topmost window first, bottom window last). |is_relevant| describes if the @@ -46,8 +50,6 @@ virtual bool EvaluateWindow(bool is_relevant, const gfx::Rect& window_rect_in_pixels, HWND hwnd) = 0; - - DISALLOW_COPY_AND_ASSIGN(WindowEvaluator); }; // Interface to enumerate through all the native windows. Overriden in tests to @@ -68,6 +70,10 @@ public: WindowsDesktopWindowIterator(); + WindowsDesktopWindowIterator(const WindowsDesktopWindowIterator&) = delete; + WindowsDesktopWindowIterator& operator=(const WindowsDesktopWindowIterator&) = + delete; + // NativeWindowIterator: void Iterate(WindowEvaluator* evaluator) override; @@ -79,8 +85,6 @@ static BOOL CALLBACK EnumWindowsOcclusionCallback(HWND hwnd, LPARAM lParam); WindowEvaluator* evaluator_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(WindowsDesktopWindowIterator); }; // Returns true if we are interested in |hwnd| for purposes of occlusion
diff --git a/ui/base/accelerators/global_media_keys_listener_win_interactive_test.cc b/ui/base/accelerators/global_media_keys_listener_win_interactive_test.cc index 5643471..95008a2 100644 --- a/ui/base/accelerators/global_media_keys_listener_win_interactive_test.cc +++ b/ui/base/accelerators/global_media_keys_listener_win_interactive_test.cc
@@ -74,6 +74,11 @@ GlobalMediaKeysListenerWinInteractiveTest() : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} + GlobalMediaKeysListenerWinInteractiveTest( + const GlobalMediaKeysListenerWinInteractiveTest&) = delete; + GlobalMediaKeysListenerWinInteractiveTest& operator=( + const GlobalMediaKeysListenerWinInteractiveTest&) = delete; + protected: void SendKeyDown(KeyboardCode code) { INPUT input; @@ -96,8 +101,6 @@ private: base::test::TaskEnvironment task_environment_; DWORD time_stamp_ = 0; - - DISALLOW_COPY_AND_ASSIGN(GlobalMediaKeysListenerWinInteractiveTest); }; TEST_F(GlobalMediaKeysListenerWinInteractiveTest, SimplePlayPauseTest) {
diff --git a/ui/base/cocoa/bubble_closer_unittest.mm b/ui/base/cocoa/bubble_closer_unittest.mm index 199ecc7..991df0d 100644 --- a/ui/base/cocoa/bubble_closer_unittest.mm +++ b/ui/base/cocoa/bubble_closer_unittest.mm
@@ -18,6 +18,9 @@ BubbleCloserTest() = default; + BubbleCloserTest(const BubbleCloserTest&) = delete; + BubbleCloserTest& operator=(const BubbleCloserTest&) = delete; + void SetUp() override { CocoaTest::SetUp(); bubble_window_.reset([[NSWindow alloc] @@ -61,8 +64,6 @@ base::scoped_nsobject<NSWindow> bubble_window_; std::unique_ptr<BubbleCloser> bubble_closer_; int click_outside_count_ = 0; - - DISALLOW_COPY_AND_ASSIGN(BubbleCloserTest); }; // Test for lifetime issues around NSEvent monitors.
diff --git a/ui/base/cocoa/menu_controller_unittest.mm b/ui/base/cocoa/menu_controller_unittest.mm index 71496c0..03435f7 100644 --- a/ui/base/cocoa/menu_controller_unittest.mm +++ b/ui/base/cocoa/menu_controller_unittest.mm
@@ -53,6 +53,10 @@ explicit TestSimpleMenuModelVisibility(SimpleMenuModel::Delegate* delegate) : SimpleMenuModel(delegate) {} + TestSimpleMenuModelVisibility(const TestSimpleMenuModelVisibility&) = delete; + TestSimpleMenuModelVisibility& operator=( + const TestSimpleMenuModelVisibility&) = delete; + // SimpleMenuModel: bool IsVisibleAt(int index) const override { return items_[ValidateItemIndex(index)].visible; @@ -88,8 +92,6 @@ } ItemVector items_; - - DISALLOW_COPY_AND_ASSIGN(TestSimpleMenuModelVisibility); }; // A menu delegate that counts the number of times certain things are called @@ -98,6 +100,9 @@ public: Delegate() {} + Delegate(const Delegate&) = delete; + Delegate& operator=(const Delegate&) = delete; + bool IsCommandIdChecked(int command_id) const override { return false; } bool IsCommandIdEnabled(int command_id) const override { ++enable_count_; @@ -135,9 +140,6 @@ bool did_show_ = false; bool did_close_ = false; bool auto_close_ = true; - - private: - DISALLOW_COPY_AND_ASSIGN(Delegate); }; // Just like Delegate, except the items are treated as "dynamic" so updates to @@ -175,6 +177,9 @@ [controller_ setDeallocCalled:did_dealloc]; } + OwningDelegate(const OwningDelegate&) = delete; + OwningDelegate& operator=(const OwningDelegate&) = delete; + MenuControllerCocoa* controller() { return controller_; } // Delegate: @@ -199,8 +204,6 @@ bool* did_delete_; SimpleMenuModel model_; base::scoped_nsobject<WatchedLifetimeMenuController> controller_; - - DISALLOW_COPY_AND_ASSIGN(OwningDelegate); }; // Menu model that returns a gfx::FontList object for one of the items in the
diff --git a/ui/base/cocoa/text_services_context_menu.h b/ui/base/cocoa/text_services_context_menu.h index 4a95d5a5..7a9651c 100644 --- a/ui/base/cocoa/text_services_context_menu.h +++ b/ui/base/cocoa/text_services_context_menu.h
@@ -54,6 +54,9 @@ explicit TextServicesContextMenu(Delegate* delegate); + TextServicesContextMenu(const TextServicesContextMenu&) = delete; + TextServicesContextMenu& operator=(const TextServicesContextMenu&) = delete; + // Methods for speaking. static void SpeakText(const std::u16string& text); static void StopSpeaking(); @@ -83,10 +86,8 @@ ui::SimpleMenuModel bidi_submenu_model_; Delegate* delegate_; // Weak. - - DISALLOW_COPY_AND_ASSIGN(TextServicesContextMenu); }; } // namespace ui -#endif // UI_BASE_COCOA_TEXT_SERVICES_CONTEXT_MENU_H_ \ No newline at end of file +#endif // UI_BASE_COCOA_TEXT_SERVICES_CONTEXT_MENU_H_
diff --git a/ui/base/cocoa/weak_ptr_nsobject_unittest.mm b/ui/base/cocoa/weak_ptr_nsobject_unittest.mm index ca6ce2a..9d34f0c9 100644 --- a/ui/base/cocoa/weak_ptr_nsobject_unittest.mm +++ b/ui/base/cocoa/weak_ptr_nsobject_unittest.mm
@@ -15,12 +15,13 @@ public: ScopedFoo() : factory_(this) {} + ScopedFoo(const ScopedFoo&) = delete; + ScopedFoo& operator=(const ScopedFoo&) = delete; + WeakPtrNSObject* GetWeakPtr() { return factory_.handle(); } private: WeakPtrNSObjectFactory<ScopedFoo> factory_; - - DISALLOW_COPY_AND_ASSIGN(ScopedFoo); }; } // namespace
diff --git a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h index bb9bb75..03a41967 100644 --- a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h +++ b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h
@@ -51,6 +51,9 @@ void* platform_data, float cursor_image_scale_factor); + BitmapCursorOzone(const BitmapCursorOzone&) = delete; + BitmapCursorOzone& operator=(const BitmapCursorOzone&) = delete; + mojom::CursorType type() const { return type_; } const gfx::Point& hotspot(); const SkBitmap& bitmap(); @@ -78,8 +81,6 @@ void* const platform_data_ = nullptr; float cursor_image_scale_factor_ = 1.f; - - DISALLOW_COPY_AND_ASSIGN(BitmapCursorOzone); }; // CursorFactory implementation for bitmapped cursors.
diff --git a/ui/base/ime/ash/component_extension_ime_manager_unittest.cc b/ui/base/ime/ash/component_extension_ime_manager_unittest.cc index aa3f87c5..d289039 100644 --- a/ui/base/ime/ash/component_extension_ime_manager_unittest.cc +++ b/ui/base/ime/ash/component_extension_ime_manager_unittest.cc
@@ -20,6 +20,11 @@ public: ComponentExtensionIMEManagerTest() : mock_delegate_(NULL) {} + ComponentExtensionIMEManagerTest(const ComponentExtensionIMEManagerTest&) = + delete; + ComponentExtensionIMEManagerTest& operator=( + const ComponentExtensionIMEManagerTest&) = delete; + virtual void SetUp() { ime_list_.clear(); @@ -124,10 +129,6 @@ MockComponentExtIMEManagerDelegate* mock_delegate_; std::unique_ptr<ComponentExtensionIMEManager> component_ext_mgr_; std::vector<ComponentExtensionIME> ime_list_; - - private: - - DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManagerTest); }; TEST_F(ComponentExtensionIMEManagerTest, LoadComponentExtensionIMETest) {
diff --git a/ui/base/ime/ash/input_method_ash_unittest.cc b/ui/base/ime/ash/input_method_ash_unittest.cc index bd8aec4..830c11c 100644 --- a/ui/base/ime/ash/input_method_ash_unittest.cc +++ b/ui/base/ime/ash/input_method_ash_unittest.cc
@@ -118,6 +118,10 @@ expected_cursor_position_(expected_cursor_position), expected_anchor_position_(expected_anchor_position) {} + SetSurroundingTextVerifier(const SetSurroundingTextVerifier&) = delete; + SetSurroundingTextVerifier& operator=(const SetSurroundingTextVerifier&) = + delete; + void Verify(const std::string& text, uint32_t cursor_pos, uint32_t anchor_pos) { @@ -130,8 +134,6 @@ const std::string expected_surrounding_text_; const uint32_t expected_cursor_position_; const uint32_t expected_anchor_position_; - - DISALLOW_COPY_AND_ASSIGN(SetSurroundingTextVerifier); }; class TestInputMethodManager @@ -140,6 +142,9 @@ public: TestState() { Reset(); } + TestState(const TestState&) = delete; + TestState& operator=(const TestState&) = delete; + // InputMethodManager::State: void ChangeInputMethodToJpKeyboard() override { is_jp_kbd_ = true; @@ -171,8 +176,6 @@ private: bool is_jp_kbd_ = false; bool is_jp_ime_ = false; - - DISALLOW_COPY_AND_ASSIGN(TestState); }; private: @@ -183,13 +186,14 @@ state_ = scoped_refptr<TestState>(new TestState()); } + TestInputMethodManager(const TestInputMethodManager&) = delete; + TestInputMethodManager& operator=(const TestInputMethodManager&) = delete; + TestState* state() { return state_.get(); } scoped_refptr<InputMethodManager::State> GetActiveIMEState() override { return scoped_refptr<InputMethodManager::State>(state_.get()); } - - DISALLOW_COPY_AND_ASSIGN(TestInputMethodManager); }; class NiceMockIMEEngine : public ash::MockIMEEngineHandler {
diff --git a/ui/base/ime/ash/input_method_manager.h b/ui/base/ime/ash/input_method_manager.h index e24e4d3..ffba548 100644 --- a/ui/base/ime/ash/input_method_manager.h +++ b/ui/base/ime/ash/input_method_manager.h
@@ -115,6 +115,8 @@ // bar. class ImeMenuObserver { public: + ImeMenuObserver& operator=(const ImeMenuObserver&) = delete; + virtual ~ImeMenuObserver() = default; // Called when the IME menu is activated or deactivated. @@ -126,8 +128,6 @@ // is called. virtual void ImeMenuItemsChanged(const std::string& engine_id, const std::vector<MenuItem>& items) = 0; - - DISALLOW_ASSIGN(ImeMenuObserver); }; class State : public base::RefCounted<InputMethodManager::State> {
diff --git a/ui/base/ime/ash/mock_input_method_manager.h b/ui/base/ime/ash/mock_input_method_manager.h index c45aaca..68a8e8ae 100644 --- a/ui/base/ime/ash/mock_input_method_manager.h +++ b/ui/base/ime/ash/mock_input_method_manager.h
@@ -26,6 +26,9 @@ public: State(); + State(const State&) = delete; + State& operator=(const State&) = delete; + scoped_refptr<InputMethodManager::State> Clone() const override; void AddInputMethodExtension( const std::string& extension_id, @@ -82,11 +85,13 @@ InputMethodManager::UIStyle ui_style_ = InputMethodManager::UIStyle::kNormal; - - DISALLOW_COPY_AND_ASSIGN(State); }; MockInputMethodManager(); + + MockInputMethodManager(const MockInputMethodManager&) = delete; + MockInputMethodManager& operator=(const MockInputMethodManager&) = delete; + ~MockInputMethodManager() override; // InputMethodManager: @@ -141,8 +146,6 @@ private: scoped_refptr<State> state_; uint32_t features_enabled_state_; - - DISALLOW_COPY_AND_ASSIGN(MockInputMethodManager); }; } // namespace input_method
diff --git a/ui/base/ime/input_method_base_unittest.cc b/ui/base/ime/input_method_base_unittest.cc index be87548..98b9d2f 100644 --- a/ui/base/ime/input_method_base_unittest.cc +++ b/ui/base/ime/input_method_base_unittest.cc
@@ -23,6 +23,9 @@ public: ClientChangeVerifier() = default; + ClientChangeVerifier(const ClientChangeVerifier&) = delete; + ClientChangeVerifier& operator=(const ClientChangeVerifier&) = delete; + // Expects that focused text input client will not be changed. void ExpectClientDoesNotChange() { previous_client_ = nullptr; @@ -105,8 +108,6 @@ bool on_will_change_focused_client_called_ = false; bool on_did_change_focused_client_called_ = false; bool on_text_input_state_changed_ = false; - - DISALLOW_COPY_AND_ASSIGN(ClientChangeVerifier); }; class InputMethodBaseTest : public testing::Test {
diff --git a/ui/base/ime/input_method_minimal_unittest.cc b/ui/base/ime/input_method_minimal_unittest.cc index 9315f35..42e7846 100644 --- a/ui/base/ime/input_method_minimal_unittest.cc +++ b/ui/base/ime/input_method_minimal_unittest.cc
@@ -38,6 +38,10 @@ }; class InputMethodMinimalTest : public testing::Test { + public: + InputMethodMinimalTest(const InputMethodMinimalTest&) = delete; + InputMethodMinimalTest& operator=(const InputMethodMinimalTest&) = delete; + protected: InputMethodMinimalTest() = default; ~InputMethodMinimalTest() override = default; @@ -51,8 +55,6 @@ std::unique_ptr<InputMethodMinimal> input_method_minimal_; std::unique_ptr<InputMethodDelegateForTesting> delegate_; - - DISALLOW_COPY_AND_ASSIGN(InputMethodMinimalTest); }; TEST_F(InputMethodMinimalTest, StopPropagationTest) {
diff --git a/ui/base/ime/linux/fake_input_method_context.h b/ui/base/ime/linux/fake_input_method_context.h index b4ef26e1..e18f012 100644 --- a/ui/base/ime/linux/fake_input_method_context.h +++ b/ui/base/ime/linux/fake_input_method_context.h
@@ -17,6 +17,9 @@ public: FakeInputMethodContext(); + FakeInputMethodContext(const FakeInputMethodContext&) = delete; + FakeInputMethodContext& operator=(const FakeInputMethodContext&) = delete; + // Overriden from ui::LinuxInputMethodContext bool DispatchKeyEvent(const ui::KeyEvent& key_event) override; bool IsPeekKeyEvent(const ui::KeyEvent& key_event) override; @@ -26,9 +29,6 @@ void SetCursorLocation(const gfx::Rect& rect) override; void SetSurroundingText(const std::u16string& text, const gfx::Range& selection_range) override; - - private: - DISALLOW_COPY_AND_ASSIGN(FakeInputMethodContext); }; } // namespace ui
diff --git a/ui/base/ime/linux/input_method_auralinux.cc b/ui/base/ime/linux/input_method_auralinux.cc index 316216e..618320d 100644 --- a/ui/base/ime/linux/input_method_auralinux.cc +++ b/ui/base/ime/linux/input_method_auralinux.cc
@@ -475,6 +475,15 @@ !is_sync_mode_ && client && client->HasCompositionText()); } +void InputMethodAuraLinux::OnSetPreeditRegion( + const gfx::Range& range, + const std::vector<ImeTextSpan>& spans) { + auto* text_input_client = GetTextInputClient(); + if (!text_input_client) + return; + text_input_client->SetCompositionFromExistingText(range, spans); +} + // Overridden from InputMethodBase. void InputMethodAuraLinux::OnWillChangeFocusedClient(
diff --git a/ui/base/ime/linux/input_method_auralinux.h b/ui/base/ime/linux/input_method_auralinux.h index 9aa424d..f792af3e 100644 --- a/ui/base/ime/linux/input_method_auralinux.h +++ b/ui/base/ime/linux/input_method_auralinux.h
@@ -42,6 +42,8 @@ void OnPreeditChanged(const CompositionText& composition_text) override; void OnPreeditEnd() override; void OnPreeditStart() override {} + void OnSetPreeditRegion(const gfx::Range& range, + const std::vector<ImeTextSpan>& spans) override; protected: // Overridden from InputMethodBase.
diff --git a/ui/base/ime/linux/input_method_auralinux_unittest.cc b/ui/base/ime/linux/input_method_auralinux_unittest.cc index de8626a..8d06483 100644 --- a/ui/base/ime/linux/input_method_auralinux_unittest.cc +++ b/ui/base/ime/linux/input_method_auralinux_unittest.cc
@@ -66,6 +66,11 @@ eat_key_(false), focused_(false) {} + LinuxInputMethodContextForTesting(const LinuxInputMethodContextForTesting&) = + delete; + LinuxInputMethodContextForTesting& operator=( + const LinuxInputMethodContextForTesting&) = delete; + void SetSyncMode(bool is_sync_mode) { is_sync_mode_ = is_sync_mode; } void SetEatKey(bool eat_key) { eat_key_ = eat_key; } @@ -155,8 +160,6 @@ bool eat_key_; bool focused_; gfx::Rect cursor_position_; - - DISALLOW_COPY_AND_ASSIGN(LinuxInputMethodContextForTesting); }; class LinuxInputMethodContextFactoryForTesting @@ -164,15 +167,17 @@ public: LinuxInputMethodContextFactoryForTesting() {} + LinuxInputMethodContextFactoryForTesting( + const LinuxInputMethodContextFactoryForTesting&) = delete; + LinuxInputMethodContextFactoryForTesting& operator=( + const LinuxInputMethodContextFactoryForTesting&) = delete; + std::unique_ptr<LinuxInputMethodContext> CreateInputMethodContext( LinuxInputMethodContextDelegate* delegate, bool is_simple) const override { return std::unique_ptr<ui::LinuxInputMethodContext>( new LinuxInputMethodContextForTesting(delegate)); } - - private: - DISALLOW_COPY_AND_ASSIGN(LinuxInputMethodContextFactoryForTesting); }; class InputMethodDelegateForTesting : public internal::InputMethodDelegate { @@ -280,6 +285,10 @@ }; class InputMethodAuraLinuxTest : public testing::Test { + public: + InputMethodAuraLinuxTest(const InputMethodAuraLinuxTest&) = delete; + InputMethodAuraLinuxTest& operator=(const InputMethodAuraLinuxTest&) = delete; + protected: InputMethodAuraLinuxTest() : factory_(nullptr), @@ -329,8 +338,6 @@ LinuxInputMethodContextForTesting* context_; LinuxInputMethodContextForTesting* context_simple_; TestResult* test_result_; - - DISALLOW_COPY_AND_ASSIGN(InputMethodAuraLinuxTest); }; TEST_F(InputMethodAuraLinuxTest, BasicSyncModeTest) {
diff --git a/ui/base/ime/linux/linux_input_method_context.h b/ui/base/ime/linux/linux_input_method_context.h index 77cefc3..7bd85a1 100644 --- a/ui/base/ime/linux/linux_input_method_context.h +++ b/ui/base/ime/linux/linux_input_method_context.h
@@ -19,6 +19,7 @@ struct CompositionText; class KeyEvent; +struct ImeTextSpan; // An interface of input method context for input method frameworks on // GNU/Linux and likes. @@ -73,6 +74,11 @@ // Prepares things for a new composition session. virtual void OnPreeditStart() = 0; + + // Sets the composition from the current text in the text input client. + // |range| is in UTF-16 code range. + virtual void OnSetPreeditRegion(const gfx::Range& range, + const std::vector<ImeTextSpan>& spans) = 0; }; } // namespace ui
diff --git a/ui/base/ime/mojom/ime_mojom_traits_unittest.cc b/ui/base/ime/mojom/ime_mojom_traits_unittest.cc index 3b1f587..dc95d15a 100644 --- a/ui/base/ime/mojom/ime_mojom_traits_unittest.cc +++ b/ui/base/ime/mojom/ime_mojom_traits_unittest.cc
@@ -22,6 +22,9 @@ public: IMEStructTraitsTest() {} + IMEStructTraitsTest(const IMEStructTraitsTest&) = delete; + IMEStructTraitsTest& operator=(const IMEStructTraitsTest&) = delete; + protected: mojo::Remote<mojom::IMEStructTraitsTest> GetTraitsTestRemote() { mojo::Remote<mojom::IMEStructTraitsTest> remote; @@ -39,8 +42,6 @@ base::test::TaskEnvironment task_environment_; // A MessageLoop is needed for // Mojo IPC to work. mojo::ReceiverSet<mojom::IMEStructTraitsTest> traits_test_receivers_; - - DISALLOW_COPY_AND_ASSIGN(IMEStructTraitsTest); }; } // namespace
diff --git a/ui/base/ime/win/input_method_win_tsf.cc b/ui/base/ime/win/input_method_win_tsf.cc index d280bd4d..6222701 100644 --- a/ui/base/ime/win/input_method_win_tsf.cc +++ b/ui/base/ime/win/input_method_win_tsf.cc
@@ -15,6 +15,9 @@ public: TSFEventObserver() = default; + TSFEventObserver(const TSFEventObserver&) = delete; + TSFEventObserver& operator=(const TSFEventObserver&) = delete; + // Returns true if we know for sure that a candidate window (or IME suggest, // etc.) is open. bool IsCandidatePopupOpen() const { return is_candidate_popup_open_; } @@ -27,8 +30,6 @@ private: // True if we know for sure that a candidate window is open. bool is_candidate_popup_open_ = false; - - DISALLOW_COPY_AND_ASSIGN(TSFEventObserver); }; InputMethodWinTSF::InputMethodWinTSF(internal::InputMethodDelegate* delegate,
diff --git a/ui/base/ime/win/on_screen_keyboard_display_manager_input_pane.cc b/ui/base/ime/win/on_screen_keyboard_display_manager_input_pane.cc index c8f8cf8..7f4580aa 100644 --- a/ui/base/ime/win/on_screen_keyboard_display_manager_input_pane.cc +++ b/ui/base/ime/win/on_screen_keyboard_display_manager_input_pane.cc
@@ -26,6 +26,9 @@ const scoped_refptr<base::SingleThreadTaskRunner> task_runner) : main_task_runner_(task_runner) {} + VirtualKeyboardInputPane(const VirtualKeyboardInputPane&) = delete; + VirtualKeyboardInputPane& operator=(const VirtualKeyboardInputPane&) = delete; + void InitVirtualKeyboardInputPaneInstance( base::WeakPtr<OnScreenKeyboardDisplayManagerInputPane> input_pane_weak_ptr) { @@ -202,8 +205,6 @@ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; base::WeakPtr<OnScreenKeyboardDisplayManagerInputPane> keyboard_input_pane_weak_ptr_; - - DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardInputPane); }; OnScreenKeyboardDisplayManagerInputPane::
diff --git a/ui/base/ime/win/on_screen_keyboard_display_manager_unittest.cc b/ui/base/ime/win/on_screen_keyboard_display_manager_unittest.cc index 946634b..fd89c6f 100644 --- a/ui/base/ime/win/on_screen_keyboard_display_manager_unittest.cc +++ b/ui/base/ime/win/on_screen_keyboard_display_manager_unittest.cc
@@ -49,6 +49,9 @@ MockInputPane() = default; + MockInputPane(const MockInputPane&) = delete; + MockInputPane& operator=(const MockInputPane&) = delete; + IFACEMETHODIMP TryShow(boolean*) override { if (showing_) return S_OK; @@ -106,11 +109,13 @@ bool showing_ = false; Microsoft::WRL::ComPtr<InputPaneEventHandler> show_handler_; Microsoft::WRL::ComPtr<InputPaneEventHandler> hide_handler_; - - DISALLOW_COPY_AND_ASSIGN(MockInputPane); }; class OnScreenKeyboardTest : public ::testing::Test { + public: + OnScreenKeyboardTest(const OnScreenKeyboardTest&) = delete; + OnScreenKeyboardTest& operator=(const OnScreenKeyboardTest&) = delete; + protected: OnScreenKeyboardTest() : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} @@ -133,8 +138,6 @@ private: base::test::TaskEnvironment task_environment_; - - DISALLOW_COPY_AND_ASSIGN(OnScreenKeyboardTest); }; // This test validates the on screen keyboard path (tabtip.exe) which is read
diff --git a/ui/base/ime/win/tsf_event_router.h b/ui/base/ime/win/tsf_event_router.h index 2d3ac06..355c064 100644 --- a/ui/base/ime/win/tsf_event_router.h +++ b/ui/base/ime/win/tsf_event_router.h
@@ -21,6 +21,9 @@ public: TSFEventRouterObserver() {} + TSFEventRouterObserver(const TSFEventRouterObserver&) = delete; + TSFEventRouterObserver& operator=(const TSFEventRouterObserver&) = delete; + // Called when the number of currently opened candidate windows changes. virtual void OnCandidateWindowCountChanged(size_t window_count) {} @@ -36,9 +39,6 @@ protected: virtual ~TSFEventRouterObserver() {} - - private: - DISALLOW_COPY_AND_ASSIGN(TSFEventRouterObserver); }; // This class monitors TSF related events and forwards them to given
diff --git a/ui/base/ime/win/tsf_input_scope.cc b/ui/base/ime/win/tsf_input_scope.cc index b4b60b58..a3b2f8c 100644 --- a/ui/base/ime/win/tsf_input_scope.cc +++ b/ui/base/ime/win/tsf_input_scope.cc
@@ -36,6 +36,9 @@ : input_scopes_(input_scopes), ref_count_(0) {} + TSFInputScope(const TSFInputScope&) = delete; + TSFInputScope& operator=(const TSFInputScope&) = delete; + // ITfInputScope: IFACEMETHODIMP_(ULONG) AddRef() override { return InterlockedIncrement(&ref_count_); @@ -98,8 +101,6 @@ // The reference count of this instance. volatile ULONG ref_count_; - - DISALLOW_COPY_AND_ASSIGN(TSFInputScope); }; typedef HRESULT (WINAPI *SetInputScopesFunc)(HWND window_handle,
diff --git a/ui/base/ime/win/tsf_text_store_unittest.cc b/ui/base/ime/win/tsf_text_store_unittest.cc index 7ad0f2b..c9872d8a 100644 --- a/ui/base/ime/win/tsf_text_store_unittest.cc +++ b/ui/base/ime/win/tsf_text_store_unittest.cc
@@ -484,6 +484,10 @@ explicit SyncRequestLockTestCallback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + SyncRequestLockTestCallback(const SyncRequestLockTestCallback&) = delete; + SyncRequestLockTestCallback& operator=(const SyncRequestLockTestCallback&) = + delete; + HRESULT LockGranted1(DWORD flags) { EXPECT_TRUE(HasReadLock()); EXPECT_FALSE(HasReadWriteLock()); @@ -533,9 +537,6 @@ EXPECT_EQ(TS_E_SYNCHRONOUS, result); return S_OK; } - - private: - DISALLOW_COPY_AND_ASSIGN(SyncRequestLockTestCallback); }; TEST_F(TSFTextStoreTest, SynchronousRequestLockTest) { @@ -577,6 +578,10 @@ explicit AsyncRequestLockTestCallback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store), state_(0) {} + AsyncRequestLockTestCallback(const AsyncRequestLockTestCallback&) = delete; + AsyncRequestLockTestCallback& operator=(const AsyncRequestLockTestCallback&) = + delete; + HRESULT LockGranted1(DWORD flags) { EXPECT_EQ(0, state_); state_ = 1; @@ -636,8 +641,6 @@ private: int state_; - - DISALLOW_COPY_AND_ASSIGN(AsyncRequestLockTestCallback); }; TEST_F(TSFTextStoreTest, AsynchronousRequestLockTest) { @@ -659,6 +662,11 @@ explicit RequestLockTextChangeTestCallback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store), state_(0) {} + RequestLockTextChangeTestCallback(const RequestLockTextChangeTestCallback&) = + delete; + RequestLockTextChangeTestCallback& operator=( + const RequestLockTextChangeTestCallback&) = delete; + HRESULT LockGranted1(DWORD flags) { EXPECT_EQ(0, state_); state_ = 1; @@ -720,8 +728,6 @@ private: int state_; - - DISALLOW_COPY_AND_ASSIGN(RequestLockTextChangeTestCallback); }; TEST_F(TSFTextStoreTest, RequestLockOnTextChangeTest) { @@ -856,6 +862,9 @@ explicit SetGetTextTestCallback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + SetGetTextTestCallback(const SetGetTextTestCallback&) = delete; + SetGetTextTestCallback& operator=(const SetGetTextTestCallback&) = delete; + HRESULT ReadLockGranted(DWORD flags) { SetTextTest(0, 0, L"", TF_E_NOLOCK); @@ -1027,9 +1036,6 @@ return S_OK; } - - private: - DISALLOW_COPY_AND_ASSIGN(SetGetTextTestCallback); }; TEST_F(TSFTextStoreTest, SetGetTextTest) { @@ -1060,6 +1066,11 @@ explicit InsertTextAtSelectionTestCallback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + InsertTextAtSelectionTestCallback(const InsertTextAtSelectionTestCallback&) = + delete; + InsertTextAtSelectionTestCallback& operator=( + const InsertTextAtSelectionTestCallback&) = delete; + HRESULT ReadLockGranted(DWORD flags) { const wchar_t kBuffer[] = L"0123456789"; @@ -1116,9 +1127,6 @@ return S_OK; } - - private: - DISALLOW_COPY_AND_ASSIGN(InsertTextAtSelectionTestCallback); }; TEST_F(TSFTextStoreTest, InsertTextAtSelectionTest) { @@ -1142,6 +1150,9 @@ explicit ScenarioTestCallback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + ScenarioTestCallback(const ScenarioTestCallback&) = delete; + ScenarioTestCallback& operator=(const ScenarioTestCallback&) = delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"abc", S_OK); SetTextTest(1, 2, L"xyz", S_OK); @@ -1304,7 +1315,6 @@ private: bool has_composition_text_; - DISALLOW_COPY_AND_ASSIGN(ScenarioTestCallback); }; TEST_F(TSFTextStoreTest, ScenarioTest) { @@ -1353,6 +1363,9 @@ : TSFTextStoreTestCallback(text_store), layout_prepared_character_num_(0) {} + GetTextExtTestCallback(const GetTextExtTestCallback&) = delete; + GetTextExtTestCallback& operator=(const GetTextExtTestCallback&) = delete; + HRESULT LockGranted(DWORD flags) { SetInternalState(u"0123456789012", 0, 0, 0); layout_prepared_character_num_ = 13; @@ -1419,8 +1432,6 @@ private: uint32_t layout_prepared_character_num_; bool has_composition_text_; - - DISALLOW_COPY_AND_ASSIGN(GetTextExtTestCallback); }; TEST_F(TSFTextStoreTest, GetTextExtTest) { @@ -1521,6 +1532,9 @@ explicit KeyEventTestCallback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + KeyEventTestCallback(const KeyEventTestCallback&) = delete; + KeyEventTestCallback& operator=(const KeyEventTestCallback&) = delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"a", S_OK); @@ -1652,9 +1666,6 @@ text_store_->OnKeyTraceUp(66u, 3145729u); return S_OK; } - - private: - DISALLOW_COPY_AND_ASSIGN(KeyEventTestCallback); }; TEST_F(TSFTextStoreTest, KeyEventTest) { @@ -1707,6 +1718,11 @@ explicit AccessibilityEventTestCallback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + AccessibilityEventTestCallback(const AccessibilityEventTestCallback&) = + delete; + AccessibilityEventTestCallback& operator=( + const AccessibilityEventTestCallback&) = delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"a", S_OK); @@ -1754,9 +1770,6 @@ EXPECT_EQ(0u, range.start()); EXPECT_EQ(1u, range.end()); } - - private: - DISALLOW_COPY_AND_ASSIGN(AccessibilityEventTestCallback); }; TEST_F(TSFTextStoreTest, AccessibilityEventTest) { @@ -1802,6 +1815,10 @@ explicit DiffingAlgorithmTestCallback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + DiffingAlgorithmTestCallback(const DiffingAlgorithmTestCallback&) = delete; + DiffingAlgorithmTestCallback& operator=(const DiffingAlgorithmTestCallback&) = + delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"", S_OK); GetTextTest(0, -1, L"", 0); @@ -2295,9 +2312,6 @@ GetSelectionTest(4, 4); return S_OK; } - - private: - DISALLOW_COPY_AND_ASSIGN(DiffingAlgorithmTestCallback); }; TEST_F(TSFTextStoreTest, DiffingAlgorithmTest) { @@ -2480,6 +2494,9 @@ explicit RegressionTestCallback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + RegressionTestCallback(const RegressionTestCallback&) = delete; + RegressionTestCallback& operator=(const RegressionTestCallback&) = delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"a", S_OK); GetTextTest(0, -1, L"a", 1); @@ -2706,9 +2723,6 @@ EXPECT_EQ(u"e", text); SetHasCompositionText(false); } - - private: - DISALLOW_COPY_AND_ASSIGN(RegressionTestCallback); }; TEST_F(TSFTextStoreTest, RegressionTest) { @@ -2778,6 +2792,9 @@ explicit RegressionTest2Callback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + RegressionTest2Callback(const RegressionTest2Callback&) = delete; + RegressionTest2Callback& operator=(const RegressionTest2Callback&) = delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"abc", S_OK); SetSelectionTest(3, 3, S_OK); @@ -2844,9 +2861,6 @@ EXPECT_EQ(u"DE", text); SetHasCompositionText(false); } - - private: - DISALLOW_COPY_AND_ASSIGN(RegressionTest2Callback); }; TEST_F(TSFTextStoreTest, RegressionTest2) { @@ -2885,6 +2899,9 @@ explicit RegressionTest3Callback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + RegressionTest3Callback(const RegressionTest3Callback&) = delete; + RegressionTest3Callback& operator=(const RegressionTest3Callback&) = delete; + HRESULT LockGranted1(DWORD flags) { GetTextTest(0, -1, L"", 0); SetTextTest(0, 0, L"a", S_OK); @@ -2946,9 +2963,6 @@ EXPECT_EQ(0u, composition.selection.end()); ASSERT_EQ(0u, composition.ime_text_spans.size()); } - - private: - DISALLOW_COPY_AND_ASSIGN(RegressionTest3Callback); }; TEST_F(TSFTextStoreTest, RegressionTest3) { @@ -2985,6 +2999,9 @@ explicit RegressionTest4Callback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + RegressionTest4Callback(const RegressionTest4Callback&) = delete; + RegressionTest4Callback& operator=(const RegressionTest4Callback&) = delete; + HRESULT LockGranted1(DWORD flags) { GetTextTest(0, -1, L"", 0); SetTextTest(0, 0, L"a", S_OK); @@ -3044,9 +3061,6 @@ EXPECT_EQ(u"a", text); SetHasCompositionText(false); } - - private: - DISALLOW_COPY_AND_ASSIGN(RegressionTest4Callback); }; TEST_F(TSFTextStoreTest, RegressionTest4) { @@ -3083,6 +3097,9 @@ explicit RegressionTest5Callback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + RegressionTest5Callback(const RegressionTest5Callback&) = delete; + RegressionTest5Callback& operator=(const RegressionTest5Callback&) = delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"aa", S_OK); GetTextTest(0, -1, L"aa", 2); @@ -3188,9 +3205,6 @@ EXPECT_EQ(u"aa", text); SetHasCompositionText(false); } - - private: - DISALLOW_COPY_AND_ASSIGN(RegressionTest5Callback); }; TEST_F(TSFTextStoreTest, RegressionTest5) { @@ -3233,6 +3247,9 @@ explicit RegressionTest6Callback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + RegressionTest6Callback(const RegressionTest6Callback&) = delete; + RegressionTest6Callback& operator=(const RegressionTest6Callback&) = delete; + HRESULT LockGranted1(DWORD flags) { EXPECT_EQ(false, *new_text_inserted()); SetTextTest(0, 0, L"a", S_OK); @@ -3287,9 +3304,6 @@ EXPECT_EQ(u"a", text); SetHasCompositionText(false); } - - private: - DISALLOW_COPY_AND_ASSIGN(RegressionTest6Callback); }; TEST_F(TSFTextStoreTest, RegressionTest6) { @@ -3322,6 +3336,10 @@ explicit UnderlineStyleTestCallback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + UnderlineStyleTestCallback(const UnderlineStyleTestCallback&) = delete; + UnderlineStyleTestCallback& operator=(const UnderlineStyleTestCallback&) = + delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"a", S_OK); @@ -3363,9 +3381,6 @@ composition.ime_text_spans[0].underline_style); SetHasCompositionText(true); } - - private: - DISALLOW_COPY_AND_ASSIGN(UnderlineStyleTestCallback); }; TEST_F(TSFTextStoreTest, UnderlineStyleTest) { @@ -3393,6 +3408,9 @@ explicit RegressionTest7Callback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + RegressionTest7Callback(const RegressionTest7Callback&) = delete; + RegressionTest7Callback& operator=(const RegressionTest7Callback&) = delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"aaaa", S_OK); SetSelectionTest(0, 4, S_OK); @@ -3454,9 +3472,6 @@ EXPECT_EQ(u"a", text); SetHasCompositionText(false); } - - private: - DISALLOW_COPY_AND_ASSIGN(RegressionTest7Callback); }; TEST_F(TSFTextStoreTest, RegressionTest7) { @@ -3496,6 +3511,9 @@ explicit RegressionTest8Callback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + RegressionTest8Callback(const RegressionTest8Callback&) = delete; + RegressionTest8Callback& operator=(const RegressionTest8Callback&) = delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"bbbb", S_OK); SetSelectionTest(0, 4, S_OK); @@ -3545,9 +3563,6 @@ } void ClearCompositionText2() { EXPECT_EQ(false, *has_composition_range()); } - - private: - DISALLOW_COPY_AND_ASSIGN(RegressionTest8Callback); }; TEST_F(TSFTextStoreTest, RegressionTest8) { @@ -3583,6 +3598,9 @@ explicit RegressionTest9Callback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + RegressionTest9Callback(const RegressionTest9Callback&) = delete; + RegressionTest9Callback& operator=(const RegressionTest9Callback&) = delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"a", S_OK); SetSelectionTest(1, 1, S_OK); @@ -3681,9 +3699,6 @@ GetTextTest(0, -1, L"abbcc", 5); return S_OK; } - - private: - DISALLOW_COPY_AND_ASSIGN(RegressionTest9Callback); }; TEST_F(TSFTextStoreTest, RegressionTest9) { @@ -3731,6 +3746,9 @@ explicit RegressionTest10Callback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + RegressionTest10Callback(const RegressionTest10Callback&) = delete; + RegressionTest10Callback& operator=(const RegressionTest10Callback&) = delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"abcd", S_OK); SetSelectionTest(0, 4, S_OK); @@ -3819,9 +3837,6 @@ GetSelectionTest(4, 4); return S_OK; } - - private: - DISALLOW_COPY_AND_ASSIGN(RegressionTest10Callback); }; TEST_F(TSFTextStoreTest, RegressionTest10) { @@ -3881,6 +3896,9 @@ explicit RegressionTest11Callback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + RegressionTest11Callback(const RegressionTest11Callback&) = delete; + RegressionTest11Callback& operator=(const RegressionTest11Callback&) = delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"abcd", S_OK); SetSelectionTest(0, 4, S_OK); @@ -3923,9 +3941,6 @@ ResetCompositionStateTest(); return S_OK; } - - private: - DISALLOW_COPY_AND_ASSIGN(RegressionTest11Callback); }; TEST_F(TSFTextStoreTest, RegressionTest11) { @@ -3982,6 +3997,9 @@ explicit RegressionTest12Callback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + RegressionTest12Callback(const RegressionTest12Callback&) = delete; + RegressionTest12Callback& operator=(const RegressionTest12Callback&) = delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"a", S_OK); SetSelectionTest(1, 1, S_OK); @@ -4003,9 +4021,6 @@ return S_OK; } - - private: - DISALLOW_COPY_AND_ASSIGN(RegressionTest12Callback); }; TEST_F(TSFTextStoreTest, RegressionTest12) { @@ -4135,6 +4150,9 @@ explicit MultipleSetTextCallback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + MultipleSetTextCallback(const MultipleSetTextCallback&) = delete; + MultipleSetTextCallback& operator=(const MultipleSetTextCallback&) = delete; + HRESULT LockGranted1(DWORD flags) { SetTextRange(0, 6); SetTextBuffer(u"123456"); @@ -4177,9 +4195,6 @@ *composition_start() = 5; return S_OK; } - - private: - DISALLOW_COPY_AND_ASSIGN(MultipleSetTextCallback); }; TEST_F(TSFTextStoreTest, MultipleSetText) { @@ -4222,6 +4237,11 @@ explicit TextInputClientReentrancyTestCallback(TSFTextStore* text_store) : TSFTextStoreTestCallback(text_store) {} + TextInputClientReentrancyTestCallback( + const TextInputClientReentrancyTestCallback&) = delete; + TextInputClientReentrancyTestCallback& operator=( + const TextInputClientReentrancyTestCallback&) = delete; + HRESULT LockGranted1(DWORD flags) { SetTextTest(0, 0, L"a", S_OK); SetSelectionTest(0, 1, S_OK); @@ -4293,9 +4313,6 @@ *edit_flag() = false; return S_OK; } - - private: - DISALLOW_COPY_AND_ASSIGN(TextInputClientReentrancyTestCallback); }; TEST_F(TSFTextStoreTest, TextInputClientReentrancTest) {
diff --git a/ui/base/l10n/formatter.h b/ui/base/l10n/formatter.h index 63b7e6b..cb45b57 100644 --- a/ui/base/l10n/formatter.h +++ b/ui/base/l10n/formatter.h
@@ -43,6 +43,8 @@ TWO_UNITS_COUNT // Enum size counter, not a unit pair. Must be last. }; + Formatter() = delete; + Formatter(const Pluralities& sec_pluralities, const Pluralities& min_pluralities, const Pluralities& hour_pluralities, @@ -63,6 +65,9 @@ const Pluralities& day_hour_pluralities1, const Pluralities& day_hour_pluralities2); + Formatter(const Formatter&) = delete; + Formatter& operator=(const Formatter&) = delete; + void Format(Unit unit, int value, icu::UnicodeString* formatted_string) const; void Format(TwoUnits units, @@ -82,8 +87,6 @@ std::unique_ptr<icu::MessageFormat> simple_format_[UNIT_COUNT]; std::unique_ptr<icu::MessageFormat> detailed_format_[TWO_UNITS_COUNT][2]; - - DISALLOW_IMPLICIT_CONSTRUCTORS(Formatter); }; // Class to hold all Formatters, intended to be used in a global LazyInstance.
diff --git a/ui/base/l10n/l10n_util_unittest.cc b/ui/base/l10n/l10n_util_unittest.cc index 32d69ce6..7347d4d 100644 --- a/ui/base/l10n/l10n_util_unittest.cc +++ b/ui/base/l10n/l10n_util_unittest.cc
@@ -42,12 +42,14 @@ class StringWrapper { public: explicit StringWrapper(const std::u16string& string) : string_(string) {} + + StringWrapper(const StringWrapper&) = delete; + StringWrapper& operator=(const StringWrapper&) = delete; + const std::u16string& string() const { return string_; } private: std::u16string string_; - - DISALLOW_COPY_AND_ASSIGN(StringWrapper); }; } // namespace
diff --git a/ui/base/l10n/l10n_util_win.cc b/ui/base/l10n/l10n_util_win.cc index fec321f..d9b0e1d 100644 --- a/ui/base/l10n/l10n_util_win.cc +++ b/ui/base/l10n/l10n_util_win.cc
@@ -24,13 +24,16 @@ class OverrideLocaleHolder { public: OverrideLocaleHolder() {} + + OverrideLocaleHolder(const OverrideLocaleHolder&) = delete; + OverrideLocaleHolder& operator=(const OverrideLocaleHolder&) = delete; + const std::vector<std::string>& value() const { return value_; } void swap_value(std::vector<std::string>* override_value) { value_.swap(*override_value); } private: std::vector<std::string> value_; - DISALLOW_COPY_AND_ASSIGN(OverrideLocaleHolder); }; base::LazyInstance<OverrideLocaleHolder>::DestructorAtExit
diff --git a/ui/base/l10n/time_format.h b/ui/base/l10n/time_format.h index 66533d5..05f7c27 100644 --- a/ui/base/l10n/time_format.h +++ b/ui/base/l10n/time_format.h
@@ -33,6 +33,10 @@ LENGTH_COUNT // Enum size counter, not a length. Must be last. }; + TimeFormat() = delete; + TimeFormat(const TimeFormat&) = delete; + TimeFormat& operator=(const TimeFormat&) = delete; + // Equivalent to SimpleWithMonthAndYear(format, length, delta, false); static std::u16string Simple(Format format, Length length, @@ -111,9 +115,6 @@ // time once at the beginning and pass it for each computation. static std::u16string RelativeDate(const base::Time& time, const base::Time* optional_midnight_today); - - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(TimeFormat); }; } // namespace ui
diff --git a/ui/base/metadata/metadata_cache.h b/ui/base/metadata/metadata_cache.h index 24fe0c79..704938fb 100644 --- a/ui/base/metadata/metadata_cache.h +++ b/ui/base/metadata/metadata_cache.h
@@ -27,6 +27,9 @@ public: MetaDataCache(); + MetaDataCache(const MetaDataCache&) = delete; + MetaDataCache& operator=(const MetaDataCache&) = delete; + static MetaDataCache* GetInstance(); void AddClassMetaData(std::unique_ptr<ClassMetaData> class_data); @@ -36,8 +39,6 @@ ~MetaDataCache(); std::vector<ClassMetaData*> class_data_cache_; - - DISALLOW_COPY_AND_ASSIGN(MetaDataCache); }; // These functions are rarely called directly, rather they are called from
diff --git a/ui/base/models/button_menu_item_model.h b/ui/base/models/button_menu_item_model.h index f77bca4..7cadc0e 100644 --- a/ui/base/models/button_menu_item_model.h +++ b/ui/base/models/button_menu_item_model.h
@@ -48,6 +48,10 @@ }; ButtonMenuItemModel(int string_id, ButtonMenuItemModel::Delegate* delegate); + + ButtonMenuItemModel(const ButtonMenuItemModel&) = delete; + ButtonMenuItemModel& operator=(const ButtonMenuItemModel&) = delete; + ~ButtonMenuItemModel(); // Adds a button that will emit |command_id|. All buttons created through @@ -116,8 +120,6 @@ std::vector<Item> items_; Delegate* delegate_; - - DISALLOW_COPY_AND_ASSIGN(ButtonMenuItemModel); }; } // namespace ui
diff --git a/ui/base/models/list_model.h b/ui/base/models/list_model.h index ed5217d9..3be6fea 100644 --- a/ui/base/models/list_model.h +++ b/ui/base/models/list_model.h
@@ -27,6 +27,10 @@ using ItemList = std::vector<std::unique_ptr<ItemType>>; ListModel() {} + + ListModel(const ListModel&) = delete; + ListModel& operator=(const ListModel&) = delete; + ~ListModel() {} // Adds |item| at the |index| into |items_|. Returns a raw pointer. @@ -138,8 +142,6 @@ private: ItemList items_; base::ObserverList<ListModelObserver>::Unchecked observers_; - - DISALLOW_COPY_AND_ASSIGN(ListModel<ItemType>); }; } // namespace ui
diff --git a/ui/base/models/list_model_unittest.cc b/ui/base/models/list_model_unittest.cc index b5917bf..1bc62f2 100644 --- a/ui/base/models/list_model_unittest.cc +++ b/ui/base/models/list_model_unittest.cc
@@ -18,11 +18,13 @@ public: explicit FooItem(int id) : id_(id) {} + FooItem(const FooItem&) = delete; + FooItem& operator=(const FooItem&) = delete; + int id() const { return id_; } private: int id_; - DISALLOW_COPY_AND_ASSIGN(FooItem); }; class ListModelTest : public testing::Test, @@ -35,6 +37,9 @@ changed_count_(0) { } + ListModelTest(const ListModelTest&) = delete; + ListModelTest& operator=(const ListModelTest&) = delete; + void ExpectCountsEqual(size_t added_count, size_t removed_count, size_t moved_count, @@ -68,8 +73,6 @@ size_t removed_count_; size_t moved_count_; size_t changed_count_; - - DISALLOW_COPY_AND_ASSIGN(ListModelTest); }; TEST_F(ListModelTest, Add) {
diff --git a/ui/base/models/tree_node_iterator.h b/ui/base/models/tree_node_iterator.h index 931e2606..582ca2bc 100644 --- a/ui/base/models/tree_node_iterator.h +++ b/ui/base/models/tree_node_iterator.h
@@ -48,6 +48,9 @@ positions_.emplace(node, 0); } + TreeNodeIterator(const TreeNodeIterator&) = delete; + TreeNodeIterator& operator=(const TreeNodeIterator&) = delete; + // Returns true if there are more descendants. bool has_next() const { return !positions_.empty(); } @@ -94,8 +97,6 @@ base::stack<Position<NodeType>> positions_; PruneCallback prune_; - - DISALLOW_COPY_AND_ASSIGN(TreeNodeIterator); }; } // namespace ui
diff --git a/ui/base/models/tree_node_model.h b/ui/base/models/tree_node_model.h index deaef15..d6690a7f9 100644 --- a/ui/base/models/tree_node_model.h +++ b/ui/base/models/tree_node_model.h
@@ -192,12 +192,13 @@ TreeNodeWithValue(const std::u16string& title, const ValueType& value) : ParentType(title), value(value) {} + TreeNodeWithValue(const TreeNodeWithValue&) = delete; + TreeNodeWithValue& operator=(const TreeNodeWithValue&) = delete; + ValueType value; private: using ParentType = TreeNode<TreeNodeWithValue<ValueType>>; - - DISALLOW_COPY_AND_ASSIGN(TreeNodeWithValue); }; // TreeNodeModel --------------------------------------------------------------
diff --git a/ui/base/prediction/empty_filter_unittests.cc b/ui/base/prediction/empty_filter_unittests.cc index 1c73f069..002589d 100644 --- a/ui/base/prediction/empty_filter_unittests.cc +++ b/ui/base/prediction/empty_filter_unittests.cc
@@ -15,9 +15,10 @@ public: explicit EmptyFilterTest() {} - void SetUp() override { filter_ = std::make_unique<EmptyFilter>(); } + EmptyFilterTest(const EmptyFilterTest&) = delete; + EmptyFilterTest& operator=(const EmptyFilterTest&) = delete; - DISALLOW_COPY_AND_ASSIGN(EmptyFilterTest); + void SetUp() override { filter_ = std::make_unique<EmptyFilter>(); } }; // Test the Clone function of the filter
diff --git a/ui/base/prediction/kalman_predictor_unittest.cc b/ui/base/prediction/kalman_predictor_unittest.cc index 9ae1a76..1ffc8e6 100644 --- a/ui/base/prediction/kalman_predictor_unittest.cc +++ b/ui/base/prediction/kalman_predictor_unittest.cc
@@ -43,12 +43,13 @@ public: explicit KalmanPredictorTest() {} + KalmanPredictorTest(const KalmanPredictorTest&) = delete; + KalmanPredictorTest& operator=(const KalmanPredictorTest&) = delete; + void SetUp() override { predictor_ = std::make_unique<KalmanPredictor>( KalmanPredictor::PredictionOptions::kNone); } - - DISALLOW_COPY_AND_ASSIGN(KalmanPredictorTest); }; // Test the a single axle kalman filter behavior with preset datas.
diff --git a/ui/base/prediction/least_squares_predictor_unittest.cc b/ui/base/prediction/least_squares_predictor_unittest.cc index 5d1749b..7c87aa8 100644 --- a/ui/base/prediction/least_squares_predictor_unittest.cc +++ b/ui/base/prediction/least_squares_predictor_unittest.cc
@@ -13,11 +13,12 @@ public: explicit LSQPredictorTest() {} + LSQPredictorTest(const LSQPredictorTest&) = delete; + LSQPredictorTest& operator=(const LSQPredictorTest&) = delete; + void SetUp() override { predictor_ = std::make_unique<LeastSquaresPredictor>(); } - - DISALLOW_COPY_AND_ASSIGN(LSQPredictorTest); }; TEST_F(LSQPredictorTest, ShouldHasPrediction) {
diff --git a/ui/base/prediction/linear_predictor_unittest.cc b/ui/base/prediction/linear_predictor_unittest.cc index 7d85d832..0b33329 100644 --- a/ui/base/prediction/linear_predictor_unittest.cc +++ b/ui/base/prediction/linear_predictor_unittest.cc
@@ -15,24 +15,29 @@ public: explicit LinearPredictorFirstOrderTest() {} + LinearPredictorFirstOrderTest(const LinearPredictorFirstOrderTest&) = delete; + LinearPredictorFirstOrderTest& operator=( + const LinearPredictorFirstOrderTest&) = delete; + void SetUp() override { predictor_ = std::make_unique<LinearPredictor>( LinearPredictor::EquationOrder::kFirstOrder); } - - DISALLOW_COPY_AND_ASSIGN(LinearPredictorFirstOrderTest); }; class LinearPredictorSecondOrderTest : public InputPredictorTest { public: explicit LinearPredictorSecondOrderTest() {} + LinearPredictorSecondOrderTest(const LinearPredictorSecondOrderTest&) = + delete; + LinearPredictorSecondOrderTest& operator=( + const LinearPredictorSecondOrderTest&) = delete; + void SetUp() override { predictor_ = std::make_unique<LinearPredictor>( LinearPredictor::EquationOrder::kSecondOrder); } - - DISALLOW_COPY_AND_ASSIGN(LinearPredictorSecondOrderTest); }; // Test if the output name of the predictor is taking account of the
diff --git a/ui/base/prediction/linear_resampling_unittest.cc b/ui/base/prediction/linear_resampling_unittest.cc index 9ab31aa8..848a44b 100644 --- a/ui/base/prediction/linear_resampling_unittest.cc +++ b/ui/base/prediction/linear_resampling_unittest.cc
@@ -16,6 +16,9 @@ public: explicit LinearResamplingTest() {} + LinearResamplingTest(const LinearResamplingTest&) = delete; + LinearResamplingTest& operator=(const LinearResamplingTest&) = delete; + void SetUp() override { predictor_ = std::make_unique<LinearResampling>(); } void ValidatePredictorFrameBased( @@ -62,8 +65,6 @@ } base::test::ScopedFeatureList feature_list; - - DISALLOW_COPY_AND_ASSIGN(LinearResamplingTest); }; // Test if the output name of the predictor is taking account of the
diff --git a/ui/base/prediction/one_euro_filter_unittests.cc b/ui/base/prediction/one_euro_filter_unittests.cc index 3e74f03..3c72784 100644 --- a/ui/base/prediction/one_euro_filter_unittests.cc +++ b/ui/base/prediction/one_euro_filter_unittests.cc
@@ -15,9 +15,10 @@ public: explicit OneEuroFilterTest() {} - void SetUp() override { filter_ = std::make_unique<OneEuroFilter>(1, 1); } + OneEuroFilterTest(const OneEuroFilterTest&) = delete; + OneEuroFilterTest& operator=(const OneEuroFilterTest&) = delete; - DISALLOW_COPY_AND_ASSIGN(OneEuroFilterTest); + void SetUp() override { filter_ = std::make_unique<OneEuroFilter>(1, 1); } }; TEST_F(OneEuroFilterTest, TestClone) {
diff --git a/ui/base/prediction/prediction_metrics_handler_unittest.cc b/ui/base/prediction/prediction_metrics_handler_unittest.cc index 47c08628..e8933464 100644 --- a/ui/base/prediction/prediction_metrics_handler_unittest.cc +++ b/ui/base/prediction/prediction_metrics_handler_unittest.cc
@@ -30,14 +30,16 @@ public: explicit PredictionMetricsHandlerTest() {} + PredictionMetricsHandlerTest(const PredictionMetricsHandlerTest&) = delete; + PredictionMetricsHandlerTest& operator=(const PredictionMetricsHandlerTest&) = + delete; + void SetUp() override { metrics_handler_ = std::make_unique<PredictionMetricsHandler>( "Event.InputEventPrediction.Scroll"); histogram_tester_ = std::make_unique<base::HistogramTester>(); } - DISALLOW_COPY_AND_ASSIGN(PredictionMetricsHandlerTest); - int GetInterpolatedEventForPredictedEvent(const base::TimeTicks& timestamp, gfx::PointF* interpolated) { return metrics_handler_->GetInterpolatedEventForPredictedEvent(
diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h index 21274f6..098b912 100644 --- a/ui/base/resource/resource_bundle.h +++ b/ui/base/resource/resource_bundle.h
@@ -191,6 +191,9 @@ // Return the global resource loader instance. static ResourceBundle& GetSharedInstance(); + ResourceBundle(const ResourceBundle&) = delete; + ResourceBundle& operator=(const ResourceBundle&) = delete; + // Loads a secondary locale data pack using the given file region. void LoadSecondaryLocaleDataWithPakFileRegion( base::File pak_file, @@ -525,8 +528,6 @@ std::string loaded_locale_; SEQUENCE_CHECKER(sequence_checker_); - - DISALLOW_COPY_AND_ASSIGN(ResourceBundle); }; } // namespace ui
diff --git a/ui/base/test/run_all_unittests.cc b/ui/base/test/run_all_unittests.cc index 9cd9552..71ef7bb 100644 --- a/ui/base/test/run_all_unittests.cc +++ b/ui/base/test/run_all_unittests.cc
@@ -28,13 +28,13 @@ public: UIBaseTestSuite(int argc, char** argv); + UIBaseTestSuite(const UIBaseTestSuite&) = delete; + UIBaseTestSuite& operator=(const UIBaseTestSuite&) = delete; + protected: // base::TestSuite: void Initialize() override; void Shutdown() override; - - private: - DISALLOW_COPY_AND_ASSIGN(UIBaseTestSuite); }; UIBaseTestSuite::UIBaseTestSuite(int argc, char** argv)
diff --git a/ui/base/test/ui_controls_internal_win.cc b/ui/base/test/ui_controls_internal_win.cc index e674e131..43a8591 100644 --- a/ui/base/test/ui_controls_internal_win.cc +++ b/ui/base/test/ui_controls_internal_win.cc
@@ -54,6 +54,9 @@ static void CreateForMouseMove(base::OnceClosure callback, const gfx::Point& screen_point); + InputDispatcher(const InputDispatcher&) = delete; + InputDispatcher& operator=(const InputDispatcher&) = delete; + private: // Generic message InputDispatcher(base::OnceClosure callback, @@ -129,8 +132,6 @@ const gfx::Point expected_mouse_location_; base::WeakPtrFactory<InputDispatcher> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(InputDispatcher); }; // static
diff --git a/ui/base/test/ui_controls_mac.mm b/ui/base/test/ui_controls_mac.mm index 198fb82..a4bc36f5 100644 --- a/ui/base/test/ui_controls_mac.mm +++ b/ui/base/test/ui_controls_mac.mm
@@ -217,6 +217,9 @@ } } + MockNSEventClassMethods(const MockNSEventClassMethods&) = delete; + MockNSEventClassMethods& operator=(const MockNSEventClassMethods&) = delete; + private: MockNSEventClassMethods() : mouse_location_swizzler_([NSEvent class], @@ -228,8 +231,6 @@ base::mac::ScopedObjCClassSwizzler mouse_location_swizzler_; base::mac::ScopedObjCClassSwizzler pressed_mouse_buttons_swizzler_; - - DISALLOW_COPY_AND_ASSIGN(MockNSEventClassMethods); }; } // namespace
diff --git a/ui/base/user_activity/user_activity_detector_unittest.cc b/ui/base/user_activity/user_activity_detector_unittest.cc index 1d41d62b..b6887cf1 100644 --- a/ui/base/user_activity/user_activity_detector_unittest.cc +++ b/ui/base/user_activity/user_activity_detector_unittest.cc
@@ -27,6 +27,9 @@ public: TestUserActivityObserver() : num_invocations_(0) {} + TestUserActivityObserver(const TestUserActivityObserver&) = delete; + TestUserActivityObserver& operator=(const TestUserActivityObserver&) = delete; + int num_invocations() const { return num_invocations_; } void reset_stats() { num_invocations_ = 0; } @@ -36,8 +39,6 @@ private: // Number of times that OnUserActivity() has been called. int num_invocations_; - - DISALLOW_COPY_AND_ASSIGN(TestUserActivityObserver); }; // A test implementation of PlatformEventSource that we can instantiate to make
diff --git a/ui/base/user_activity/user_activity_observer.h b/ui/base/user_activity/user_activity_observer.h index a83c8af..2e732c2 100644 --- a/ui/base/user_activity/user_activity_observer.h +++ b/ui/base/user_activity/user_activity_observer.h
@@ -18,6 +18,9 @@ // Implementations should register themselves with UserActivityDetector. class COMPONENT_EXPORT(UI_BASE) UserActivityObserver { public: + UserActivityObserver(const UserActivityObserver&) = delete; + UserActivityObserver& operator=(const UserActivityObserver&) = delete; + // Invoked periodically while the user is active (i.e. generating input // events). |event| is the event that triggered the notification; it may // be NULL in some cases (e.g. testing or synthetic invocations). @@ -26,8 +29,6 @@ protected: UserActivityObserver() {} virtual ~UserActivityObserver() {} - - DISALLOW_COPY_AND_ASSIGN(UserActivityObserver); }; } // namespace ui
diff --git a/ui/base/win/hwnd_subclass.cc b/ui/base/win/hwnd_subclass.cc index db2dbe7..ac3b4276 100644 --- a/ui/base/win/hwnd_subclass.cc +++ b/ui/base/win/hwnd_subclass.cc
@@ -49,6 +49,9 @@ base::LeakySingletonTraits<HWNDSubclassFactory>>::get(); } + HWNDSubclassFactory(const HWNDSubclassFactory&) = delete; + HWNDSubclassFactory& operator=(const HWNDSubclassFactory&) = delete; + // Returns a non-null HWNDSubclass corresponding to the HWND |target|. Creates // one if none exists. Retains ownership of the returned pointer. HWNDSubclass* GetHwndSubclassForTarget(HWND target) { @@ -72,8 +75,6 @@ HWNDSubclassFactory() {} std::vector<std::unique_ptr<HWNDSubclass>> hwnd_subclasses_; - - DISALLOW_COPY_AND_ASSIGN(HWNDSubclassFactory); }; // static
diff --git a/ui/base/win/lock_state.cc b/ui/base/win/lock_state.cc index 995c384..69b7908 100644 --- a/ui/base/win/lock_state.cc +++ b/ui/base/win/lock_state.cc
@@ -50,6 +50,9 @@ base::Unretained(this))), screen_locked_(IsSessionLocked()) {} + SessionLockedObserver(const SessionLockedObserver&) = delete; + SessionLockedObserver& operator=(const SessionLockedObserver&) = delete; + bool IsLocked() const { return screen_locked_; } private: @@ -63,8 +66,6 @@ } SessionChangeObserver session_change_observer_; bool screen_locked_; - - DISALLOW_COPY_AND_ASSIGN(SessionLockedObserver); }; } // namespace
diff --git a/ui/base/x/selection_owner.h b/ui/base/x/selection_owner.h index 23bd058..35470b3 100644 --- a/ui/base/x/selection_owner.h +++ b/ui/base/x/selection_owner.h
@@ -79,6 +79,10 @@ const scoped_refptr<base::RefCountedMemory>& data, int offset, base::TimeTicks timeout); + + IncrementalTransfer(const IncrementalTransfer&) = delete; + IncrementalTransfer& operator=(const IncrementalTransfer&) = delete; + ~IncrementalTransfer(); // Move-only class. @@ -104,9 +108,6 @@ // Time when the transfer should be aborted because the selection requestor // is taking too long to notify us that we can send the next chunk. base::TimeTicks timeout; - - private: - DISALLOW_COPY_AND_ASSIGN(IncrementalTransfer); }; // Attempts to convert the selection to |target|. If the conversion is
diff --git a/ui/base/x/x11_menu_list.h b/ui/base/x/x11_menu_list.h index f0327944..2dcbcaa 100644 --- a/ui/base/x/x11_menu_list.h +++ b/ui/base/x/x11_menu_list.h
@@ -24,6 +24,9 @@ public: static XMenuList* GetInstance(); + XMenuList(const XMenuList&) = delete; + XMenuList& operator=(const XMenuList&) = delete; + // Checks if |menu| has _NET_WM_WINDOW_TYPE property set to // "_NET_WM_WINDOW_TYPE_MENU" atom and if so caches it. void MaybeRegisterMenu(x11::Window menu); @@ -41,7 +44,6 @@ std::vector<x11::Window> menus_; x11::Atom menu_type_atom_; - DISALLOW_COPY_AND_ASSIGN(XMenuList); }; } // namespace ui
diff --git a/ui/compositor/callback_layer_animation_observer_unittest.cc b/ui/compositor/callback_layer_animation_observer_unittest.cc index 18c1c05..75bfaac 100644 --- a/ui/compositor/callback_layer_animation_observer_unittest.cc +++ b/ui/compositor/callback_layer_animation_observer_unittest.cc
@@ -104,6 +104,11 @@ public: TestCallbacksThatExplicitlyDeletesObserver(); + TestCallbacksThatExplicitlyDeletesObserver( + const TestCallbacksThatExplicitlyDeletesObserver&) = delete; + TestCallbacksThatExplicitlyDeletesObserver& operator=( + const TestCallbacksThatExplicitlyDeletesObserver&) = delete; + void set_observer_to_delete_in_animation_started( CallbackLayerAnimationObserver* observer) { observer_to_delete_in_animation_started_ = observer; @@ -127,8 +132,6 @@ // The observer to delete, if non-NULL, in AnimationsEnded(). CallbackLayerAnimationObserver* observer_to_delete_in_animation_ended_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(TestCallbacksThatExplicitlyDeletesObserver); }; TestCallbacksThatExplicitlyDeletesObserver:: @@ -269,13 +272,15 @@ public: CallbackLayerAnimationObserverTestOverwrite(); + CallbackLayerAnimationObserverTestOverwrite( + const CallbackLayerAnimationObserverTestOverwrite&) = delete; + CallbackLayerAnimationObserverTestOverwrite& operator=( + const CallbackLayerAnimationObserverTestOverwrite&) = delete; + protected: void AnimationStarted(const CallbackLayerAnimationObserver& observer); std::unique_ptr<CallbackLayerAnimationObserver> CreateAnimationObserver(); - - private: - DISALLOW_COPY_AND_ASSIGN(CallbackLayerAnimationObserverTestOverwrite); }; CallbackLayerAnimationObserverTestOverwrite::
diff --git a/ui/compositor/canvas_painter_unittest.cc b/ui/compositor/canvas_painter_unittest.cc index f6cfccf6..858657c 100644 --- a/ui/compositor/canvas_painter_unittest.cc +++ b/ui/compositor/canvas_painter_unittest.cc
@@ -37,6 +37,9 @@ public: CanvasPainterTest() : device_scale_factor_(GetParam()) {} + CanvasPainterTest(const CanvasPainterTest&) = delete; + CanvasPainterTest& operator=(const CanvasPainterTest&) = delete; + float device_scale_factor() const { return device_scale_factor_; } const gfx::Size& pixel_output_size(const CanvasPainter& painter) const { @@ -71,8 +74,6 @@ private: float device_scale_factor_; - - DISALLOW_COPY_AND_ASSIGN(CanvasPainterTest); }; TEST_P(CanvasPainterTest, Initialization) {
diff --git a/ui/compositor/closure_animation_observer.h b/ui/compositor/closure_animation_observer.h index 60b1341..91fcb25 100644 --- a/ui/compositor/closure_animation_observer.h +++ b/ui/compositor/closure_animation_observer.h
@@ -19,6 +19,9 @@ public: explicit ClosureAnimationObserver(base::OnceClosure closure); + ClosureAnimationObserver(const ClosureAnimationObserver&) = delete; + ClosureAnimationObserver& operator=(const ClosureAnimationObserver&) = delete; + private: ~ClosureAnimationObserver() override; @@ -26,8 +29,6 @@ void OnImplicitAnimationsCompleted() override; base::OnceClosure closure_; - - DISALLOW_COPY_AND_ASSIGN(ClosureAnimationObserver); }; } // namespace ui
diff --git a/ui/compositor/layer_animation_element.h b/ui/compositor/layer_animation_element.h index 13ff9577e..ef9b151d 100644 --- a/ui/compositor/layer_animation_element.h +++ b/ui/compositor/layer_animation_element.h
@@ -73,6 +73,8 @@ LayerAnimationElement(AnimatableProperties properties, base::TimeDelta duration); + LayerAnimationElement& operator=(const LayerAnimationElement&) = delete; + virtual ~LayerAnimationElement(); static std::string AnimatablePropertiesToString( @@ -254,8 +256,6 @@ double last_progressed_fraction_; base::WeakPtrFactory<LayerAnimationElement> weak_ptr_factory_{this}; - - DISALLOW_ASSIGN(LayerAnimationElement); }; } // namespace ui
diff --git a/ui/compositor/layer_animator_unittest.cc b/ui/compositor/layer_animator_unittest.cc index c415c84..ba11c14 100644 --- a/ui/compositor/layer_animator_unittest.cc +++ b/ui/compositor/layer_animator_unittest.cc
@@ -119,6 +119,10 @@ notify_when_animator_destructed_(notify_when_animator_destructed) { } + TestImplicitAnimationObserver(const TestImplicitAnimationObserver&) = delete; + TestImplicitAnimationObserver& operator=( + const TestImplicitAnimationObserver&) = delete; + bool animations_completed() const { return animations_completed_; } void set_animations_completed(bool completed) { animations_completed_ = completed; @@ -160,8 +164,6 @@ bool notify_when_animator_destructed_; base::OnceClosure quit_wait_loop_; - - DISALLOW_COPY_AND_ASSIGN(TestImplicitAnimationObserver); }; // When notified that an animation has ended, stops all other animations. @@ -170,6 +172,11 @@ explicit DeletingLayerAnimationObserver(LayerAnimator* animator) : animator_(animator) {} + DeletingLayerAnimationObserver(const DeletingLayerAnimationObserver&) = + delete; + DeletingLayerAnimationObserver& operator=( + const DeletingLayerAnimationObserver&) = delete; + void OnLayerAnimationEnded(LayerAnimationSequence* sequence) override { animator_->StopAnimating(); } @@ -182,8 +189,6 @@ private: LayerAnimator* animator_; - - DISALLOW_COPY_AND_ASSIGN(DeletingLayerAnimationObserver); }; // When notified that an animation has started, aborts all animations. @@ -194,6 +199,11 @@ LayerAnimator* animator) : animator_(animator) {} + AbortAnimationsOnStartedLayerAnimationObserver( + const AbortAnimationsOnStartedLayerAnimationObserver&) = delete; + AbortAnimationsOnStartedLayerAnimationObserver& operator=( + const AbortAnimationsOnStartedLayerAnimationObserver&) = delete; + void OnLayerAnimationStarted(LayerAnimationSequence* sequence) override { animator_->AbortAllAnimations(); } @@ -206,8 +216,6 @@ private: LayerAnimator* animator_; - - DISALLOW_COPY_AND_ASSIGN(AbortAnimationsOnStartedLayerAnimationObserver); }; class LayerAnimatorDestructionObserver { @@ -239,6 +247,9 @@ : LayerAnimator(base::TimeDelta::FromSeconds(0)), destruction_observer_(nullptr) {} + TestLayerAnimator(const TestLayerAnimator&) = delete; + TestLayerAnimator& operator=(const TestLayerAnimator&) = delete; + void SetDestructionObserver( LayerAnimatorDestructionObserver* observer) { destruction_observer_ = observer; @@ -259,8 +270,6 @@ private: LayerAnimatorDestructionObserver* destruction_observer_; - - DISALLOW_COPY_AND_ASSIGN(TestLayerAnimator); }; // The test layer animation sequence updates a live instances count when it is @@ -296,6 +305,11 @@ explicit CountCheckingLayerAnimationObserver(LayerAnimationObserver* observer) : observer_(observer) {} + CountCheckingLayerAnimationObserver( + const CountCheckingLayerAnimationObserver&) = delete; + CountCheckingLayerAnimationObserver& operator=( + const CountCheckingLayerAnimationObserver&) = delete; + void OnLayerAnimationStarted(LayerAnimationSequence* sequence) override { ++started_count_; EXPECT_LE(started_count_, attached_sequence_count_); @@ -375,8 +389,6 @@ // The number of animation sequences that completed successfully. int successful_count_ = 0; - - DISALLOW_COPY_AND_ASSIGN(CountCheckingLayerAnimationObserver); }; } // namespace test @@ -2926,12 +2938,13 @@ public: AnimatorOwner() : animator_(CreateDefaultTestAnimator()) {} + AnimatorOwner(const AnimatorOwner&) = delete; + AnimatorOwner& operator=(const AnimatorOwner&) = delete; + LayerAnimator* animator() { return animator_.get(); } private: scoped_refptr<LayerAnimator> animator_; - - DISALLOW_COPY_AND_ASSIGN(AnimatorOwner); }; class DeletingObserver : public LayerAnimationObserver {
diff --git a/ui/compositor/layer_owner.h b/ui/compositor/layer_owner.h index 0277d61..c5f46de2 100644 --- a/ui/compositor/layer_owner.h +++ b/ui/compositor/layer_owner.h
@@ -31,6 +31,10 @@ }; explicit LayerOwner(std::unique_ptr<Layer> layer = nullptr); + + LayerOwner(const LayerOwner&) = delete; + LayerOwner& operator=(const LayerOwner&) = delete; + virtual ~LayerOwner(); void AddObserver(Observer* observer); @@ -77,8 +81,6 @@ Layer* layer_ = nullptr; base::ObserverList<Observer>::Unchecked observers_; - - DISALLOW_COPY_AND_ASSIGN(LayerOwner); }; } // namespace ui
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc index 6a8d4c69..ca0b9c15 100644 --- a/ui/compositor/layer_unittest.cc +++ b/ui/compositor/layer_unittest.cc
@@ -376,6 +376,9 @@ public: TestCompositorObserver() = default; + TestCompositorObserver(const TestCompositorObserver&) = delete; + TestCompositorObserver& operator=(const TestCompositorObserver&) = delete; + bool committed() const { return committed_; } bool notified() const { return started_ && ended_; } @@ -400,8 +403,6 @@ bool committed_ = false; bool started_ = false; bool ended_ = false; - - DISALLOW_COPY_AND_ASSIGN(TestCompositorObserver); }; class TestCompositorAnimationObserver : public CompositorAnimationObserver { @@ -2842,6 +2843,11 @@ LayerRemovingLayerAnimationObserver(Layer* root, Layer* child) : root_(root), child_(child) {} + LayerRemovingLayerAnimationObserver( + const LayerRemovingLayerAnimationObserver&) = delete; + LayerRemovingLayerAnimationObserver& operator=( + const LayerRemovingLayerAnimationObserver&) = delete; + // LayerAnimationObserver: void OnLayerAnimationEnded(LayerAnimationSequence* sequence) override { root_->Remove(child_); @@ -2856,8 +2862,6 @@ private: Layer* root_; Layer* child_; - - DISALLOW_COPY_AND_ASSIGN(LayerRemovingLayerAnimationObserver); }; // Verifies that empty LayerAnimators are not left behind when removing child
diff --git a/ui/compositor/test/draw_waiter_for_test.h b/ui/compositor/test/draw_waiter_for_test.h index fe1119c..683978c 100644 --- a/ui/compositor/test/draw_waiter_for_test.h +++ b/ui/compositor/test/draw_waiter_for_test.h
@@ -20,6 +20,9 @@ // potential for re-entrancy). class DrawWaiterForTest : public CompositorObserver { public: + DrawWaiterForTest(const DrawWaiterForTest&) = delete; + DrawWaiterForTest& operator=(const DrawWaiterForTest&) = delete; + // Waits for a draw to be issued by the compositor. If the test times out // here, there may be a logic error in the compositor code causing it // not to draw. @@ -51,8 +54,6 @@ std::unique_ptr<base::RunLoop> wait_run_loop_; WaitEvent wait_event_; - - DISALLOW_COPY_AND_ASSIGN(DrawWaiterForTest); }; } // namespace ui
diff --git a/ui/compositor/test/in_process_context_provider.h b/ui/compositor/test/in_process_context_provider.h index be191f5..6a9243b 100644 --- a/ui/compositor/test/in_process_context_provider.h +++ b/ui/compositor/test/in_process_context_provider.h
@@ -52,6 +52,9 @@ gpu::ImageFactory* image_factory, bool support_locking); + InProcessContextProvider(const InProcessContextProvider&) = delete; + InProcessContextProvider& operator=(const InProcessContextProvider&) = delete; + // viz::ContextProvider / viz::RasterContextProvider implementation. void AddRef() const override; void Release() const override; @@ -118,8 +121,6 @@ base::Lock context_lock_; base::ObserverList<viz::ContextLostObserver>::Unchecked observers_; - - DISALLOW_COPY_AND_ASSIGN(InProcessContextProvider); }; } // namespace ui
diff --git a/ui/compositor/test/layer_animation_observer_test_api.h b/ui/compositor/test/layer_animation_observer_test_api.h index 7705275..bd613d4 100644 --- a/ui/compositor/test/layer_animation_observer_test_api.h +++ b/ui/compositor/test/layer_animation_observer_test_api.h
@@ -16,6 +16,10 @@ public: explicit LayerAnimationObserverTestApi(LayerAnimationObserver* observer); + LayerAnimationObserverTestApi(const LayerAnimationObserverTestApi&) = delete; + LayerAnimationObserverTestApi& operator=( + const LayerAnimationObserverTestApi&) = delete; + // Wrappers for LayerAnimationObserver. void AttachedToSequence(LayerAnimationSequence* sequence); void DetachedFromSequence(LayerAnimationSequence* sequence, @@ -24,8 +28,6 @@ private: // The instance to provide internal access to. LayerAnimationObserver* observer_; - - DISALLOW_COPY_AND_ASSIGN(LayerAnimationObserverTestApi); }; } // namespace test
diff --git a/ui/compositor/test/multi_layer_animator_test_controller_delegate.h b/ui/compositor/test/multi_layer_animator_test_controller_delegate.h index ebd0bf100..22854e6 100644 --- a/ui/compositor/test/multi_layer_animator_test_controller_delegate.h +++ b/ui/compositor/test/multi_layer_animator_test_controller_delegate.h
@@ -16,15 +16,17 @@ class MultiLayerAnimatorTestControllerDelegate { public: + MultiLayerAnimatorTestControllerDelegate( + const MultiLayerAnimatorTestControllerDelegate&) = delete; + MultiLayerAnimatorTestControllerDelegate& operator=( + const MultiLayerAnimatorTestControllerDelegate&) = delete; + // Get a list of all the LayerAnimator's used by the animation. virtual std::vector<ui::LayerAnimator*> GetLayerAnimators() = 0; protected: MultiLayerAnimatorTestControllerDelegate() {} virtual ~MultiLayerAnimatorTestControllerDelegate() {} - - private: - DISALLOW_COPY_AND_ASSIGN(MultiLayerAnimatorTestControllerDelegate); }; } // namespace test
diff --git a/ui/compositor/test/test_compositor_host_android.cc b/ui/compositor/test/test_compositor_host_android.cc index 291324f0..a17a0be 100644 --- a/ui/compositor/test/test_compositor_host_android.cc +++ b/ui/compositor/test/test_compositor_host_android.cc
@@ -30,14 +30,16 @@ viz::LocalSurfaceId()); } + TestCompositorHostAndroid(const TestCompositorHostAndroid&) = delete; + TestCompositorHostAndroid& operator=(const TestCompositorHostAndroid&) = + delete; + // Overridden from TestCompositorHost: void Show() override { compositor_->SetVisible(true); } ui::Compositor* GetCompositor() override { return compositor_.get(); } private: std::unique_ptr<ui::Compositor> compositor_; - - DISALLOW_COPY_AND_ASSIGN(TestCompositorHostAndroid); }; TestCompositorHost* TestCompositorHost::Create(
diff --git a/ui/compositor/test/test_compositor_host_mac.mm b/ui/compositor/test/test_compositor_host_mac.mm index 0a89e46c..643cf58 100644 --- a/ui/compositor/test/test_compositor_host_mac.mm +++ b/ui/compositor/test/test_compositor_host_mac.mm
@@ -58,25 +58,29 @@ // NSAutoreleasePool set up and initialized prior to execution and drained upon // exit. The tests will leak otherwise. class FoundationHost { + public: + FoundationHost(const FoundationHost&) = delete; + FoundationHost& operator=(const FoundationHost&) = delete; + protected: FoundationHost() { pool_ = [[NSAutoreleasePool alloc] init]; } virtual ~FoundationHost() { [pool_ drain]; } private: NSAutoreleasePool* pool_; - DISALLOW_COPY_AND_ASSIGN(FoundationHost); }; // Tests that use the AppKit framework need to have the NSApplication // initialized prior to doing anything with display objects such as windows, // views, or controls. class AppKitHost : public FoundationHost { + public: + AppKitHost(const AppKitHost&) = delete; + AppKitHost& operator=(const AppKitHost&) = delete; + protected: AppKitHost() { [NSApplication sharedApplication]; } ~AppKitHost() override {} - - private: - DISALLOW_COPY_AND_ASSIGN(AppKitHost); }; class TestAcceleratedWidgetMacNSView : public AcceleratedWidgetMacNSView {
diff --git a/ui/compositor/transform_animation_curve_adapter.h b/ui/compositor/transform_animation_curve_adapter.h index 6f12dd3..655d004 100644 --- a/ui/compositor/transform_animation_curve_adapter.h +++ b/ui/compositor/transform_animation_curve_adapter.h
@@ -28,6 +28,9 @@ TransformAnimationCurveAdapter(const TransformAnimationCurveAdapter& other); + TransformAnimationCurveAdapter& operator=( + const TransformAnimationCurveAdapter&) = delete; + ~TransformAnimationCurveAdapter() override; // TransformAnimationCurve implementation. @@ -46,8 +49,6 @@ gfx::DecomposedTransform decomposed_initial_value_; gfx::DecomposedTransform decomposed_target_value_; base::TimeDelta duration_; - - DISALLOW_ASSIGN(TransformAnimationCurveAdapter); }; } // namespace ui
diff --git a/ui/compositor_extra/shadow_unittest.cc b/ui/compositor_extra/shadow_unittest.cc index 10e6bfe..0451b4b1 100644 --- a/ui/compositor_extra/shadow_unittest.cc +++ b/ui/compositor_extra/shadow_unittest.cc
@@ -33,6 +33,10 @@ } class ShadowTest : public testing::Test { + public: + ShadowTest(const ShadowTest&) = delete; + ShadowTest& operator=(const ShadowTest&) = delete; + protected: ShadowTest() {} ~ShadowTest() override {} @@ -48,8 +52,6 @@ private: base::TestDiscardableMemoryAllocator discardable_memory_allocator_; - - DISALLOW_COPY_AND_ASSIGN(ShadowTest); }; // Test if the proper content bounds is calculated based on the current style.
diff --git a/ui/display/display_layout_unittest.cc b/ui/display/display_layout_unittest.cc index 5b59d7d..cb9e7b5 100644 --- a/ui/display/display_layout_unittest.cc +++ b/ui/display/display_layout_unittest.cc
@@ -169,8 +169,8 @@ public: TwoDisplays() = default; - private: - DISALLOW_COPY_AND_ASSIGN(TwoDisplays); + TwoDisplays(const TwoDisplays&) = delete; + TwoDisplays& operator=(const TwoDisplays&) = delete; }; } // namespace @@ -521,8 +521,10 @@ public: TwoDisplaysBottomRightReference() = default; - private: - DISALLOW_COPY_AND_ASSIGN(TwoDisplaysBottomRightReference); + TwoDisplaysBottomRightReference(const TwoDisplaysBottomRightReference&) = + delete; + TwoDisplaysBottomRightReference& operator=( + const TwoDisplaysBottomRightReference&) = delete; }; } // namespace
diff --git a/ui/display/fake/fake_display_snapshot.h b/ui/display/fake/fake_display_snapshot.h index e928ed1..c44fe143 100644 --- a/ui/display/fake/fake_display_snapshot.h +++ b/ui/display/fake/fake_display_snapshot.h
@@ -140,6 +140,10 @@ const gfx::ColorSpace& color_space, uint32_t bits_per_channel, const gfx::HDRStaticMetadata& hdr_static_metadata); + + FakeDisplaySnapshot(const FakeDisplaySnapshot&) = delete; + FakeDisplaySnapshot& operator=(const FakeDisplaySnapshot&) = delete; + ~FakeDisplaySnapshot() override; // Creates a display snapshot from the provided |spec| string. Returns null if @@ -148,9 +152,6 @@ static std::unique_ptr<DisplaySnapshot> CreateFromSpec( int64_t id, const std::string& spec); - - private: - DISALLOW_COPY_AND_ASSIGN(FakeDisplaySnapshot); }; } // namespace display
diff --git a/ui/display/ios/screen_ios.mm b/ui/display/ios/screen_ios.mm index dd04890..91c9ce1 100644 --- a/ui/display/ios/screen_ios.mm +++ b/ui/display/ios/screen_ios.mm
@@ -22,6 +22,9 @@ ProcessDisplayChanged(display, true /* is_primary */); } + ScreenIos(const ScreenIos&) = delete; + ScreenIos& operator=(const ScreenIos&) = delete; + gfx::Point GetCursorScreenPoint() override { NOTIMPLEMENTED(); return gfx::Point(0, 0); @@ -45,9 +48,6 @@ return [[UIScreen screens] count]; #endif } - - private: - DISALLOW_COPY_AND_ASSIGN(ScreenIos); }; } // namespace
diff --git a/ui/display/manager/display_configurator.h b/ui/display/manager/display_configurator.h index abe9afc..cacb272 100644 --- a/ui/display/manager/display_configurator.h +++ b/ui/display/manager/display_configurator.h
@@ -163,6 +163,10 @@ const gfx::Size& size); DisplayConfigurator(); + + DisplayConfigurator(const DisplayConfigurator&) = delete; + DisplayConfigurator& operator=(const DisplayConfigurator&) = delete; + ~DisplayConfigurator() override; MultipleDisplayState display_state() const { return current_display_state_; } @@ -435,8 +439,6 @@ // This must be the last variable. base::WeakPtrFactory<DisplayConfigurator> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); }; } // namespace display
diff --git a/ui/display/util/edid_parser_unittest.cc b/ui/display/util/edid_parser_unittest.cc index 7ca2c7a..45182b1aa 100644 --- a/ui/display/util/edid_parser_unittest.cc +++ b/ui/display/util/edid_parser_unittest.cc
@@ -752,10 +752,10 @@ GetParam().edid_blob, GetParam().edid_blob + GetParam().edid_blob_length)) {} - const EdidParser parser_; + EDIDParserTest(const EDIDParserTest&) = delete; + EDIDParserTest& operator=(const EDIDParserTest&) = delete; - private: - DISALLOW_COPY_AND_ASSIGN(EDIDParserTest); + const EdidParser parser_; }; TEST_P(EDIDParserTest, ParseEdids) {
diff --git a/ui/display/win/screen_win_unittest.cc b/ui/display/win/screen_win_unittest.cc index 7ce1b81..0097cc3 100644 --- a/ui/display/win/screen_win_unittest.cc +++ b/ui/display/win/screen_win_unittest.cc
@@ -195,6 +195,10 @@ }; class ScreenWinTest : public testing::Test { + public: + ScreenWinTest(const ScreenWinTest&) = delete; + ScreenWinTest& operator=(const ScreenWinTest&) = delete; + protected: ScreenWinTest() = default; @@ -219,8 +223,6 @@ private: std::unique_ptr<TestScreenWinManager> screen_win_initializer_; - - DISALLOW_COPY_AND_ASSIGN(ScreenWinTest); }; // Single Display of 1.0 Device Scale Factor. @@ -228,6 +230,10 @@ public: ScreenWinTestSingleDisplay1x() = default; + ScreenWinTestSingleDisplay1x(const ScreenWinTestSingleDisplay1x&) = delete; + ScreenWinTestSingleDisplay1x& operator=(const ScreenWinTestSingleDisplay1x&) = + delete; + void SetUpScreen(TestScreenWinInitializer* initializer) override { initializer->AddMonitor(gfx::Rect(0, 0, 1920, 1200), gfx::Rect(0, 0, 1920, 1100), @@ -242,8 +248,6 @@ private: HWND fake_hwnd_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ScreenWinTestSingleDisplay1x); }; void expect_point_f_eq(gfx::PointF val1, gfx::PointF val2) { @@ -403,6 +407,11 @@ public: ScreenWinTestSingleDisplay1_25x() = default; + ScreenWinTestSingleDisplay1_25x(const ScreenWinTestSingleDisplay1_25x&) = + delete; + ScreenWinTestSingleDisplay1_25x& operator=( + const ScreenWinTestSingleDisplay1_25x&) = delete; + void SetUpScreen(TestScreenWinInitializer* initializer) override { initializer->AddMonitor(gfx::Rect(0, 0, 1920, 1200), gfx::Rect(0, 0, 1920, 1100), @@ -417,8 +426,6 @@ private: HWND fake_hwnd_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ScreenWinTestSingleDisplay1_25x); }; } // namespace @@ -559,6 +566,11 @@ public: ScreenWinTestSingleDisplay1_5x() = default; + ScreenWinTestSingleDisplay1_5x(const ScreenWinTestSingleDisplay1_5x&) = + delete; + ScreenWinTestSingleDisplay1_5x& operator=( + const ScreenWinTestSingleDisplay1_5x&) = delete; + void SetUpScreen(TestScreenWinInitializer* initializer) override { initializer->AddMonitor(gfx::Rect(0, 0, 1920, 1200), gfx::Rect(0, 0, 1920, 1100), @@ -573,8 +585,6 @@ private: HWND fake_hwnd_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ScreenWinTestSingleDisplay1_5x); }; } // namespace @@ -715,6 +725,10 @@ public: ScreenWinTestSingleDisplay2x() = default; + ScreenWinTestSingleDisplay2x(const ScreenWinTestSingleDisplay2x&) = delete; + ScreenWinTestSingleDisplay2x& operator=(const ScreenWinTestSingleDisplay2x&) = + delete; + void SetUpScreen(TestScreenWinInitializer* initializer) override { initializer->AddMonitor(gfx::Rect(0, 0, 1920, 1200), gfx::Rect(0, 0, 1920, 1100), @@ -729,8 +743,6 @@ private: HWND fake_hwnd_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ScreenWinTestSingleDisplay2x); }; } // namespace @@ -866,6 +878,10 @@ public: ScreenWinTestTwoDisplays1x() = default; + ScreenWinTestTwoDisplays1x(const ScreenWinTestTwoDisplays1x&) = delete; + ScreenWinTestTwoDisplays1x& operator=(const ScreenWinTestTwoDisplays1x&) = + delete; + void SetUpScreen(TestScreenWinInitializer* initializer) override { initializer->AddMonitor(gfx::Rect(0, 0, 1920, 1200), gfx::Rect(0, 0, 1920, 1100), @@ -891,8 +907,6 @@ private: HWND fake_hwnd_left_ = nullptr; HWND fake_hwnd_right_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ScreenWinTestTwoDisplays1x); }; } // namespace @@ -1139,6 +1153,10 @@ public: ScreenWinTestTwoDisplays2x() = default; + ScreenWinTestTwoDisplays2x(const ScreenWinTestTwoDisplays2x&) = delete; + ScreenWinTestTwoDisplays2x& operator=(const ScreenWinTestTwoDisplays2x&) = + delete; + void SetUpScreen(TestScreenWinInitializer* initializer) override { initializer->AddMonitor(gfx::Rect(0, 0, 1920, 1200), gfx::Rect(0, 0, 1920, 1100), @@ -1164,8 +1182,6 @@ private: HWND fake_hwnd_left_ = nullptr; HWND fake_hwnd_right_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ScreenWinTestTwoDisplays2x); }; } // namespace @@ -1439,6 +1455,10 @@ public: ScreenWinTestManyDisplays1x() = default; + ScreenWinTestManyDisplays1x(const ScreenWinTestManyDisplays1x&) = delete; + ScreenWinTestManyDisplays1x& operator=(const ScreenWinTestManyDisplays1x&) = + delete; + void SetUpScreen(TestScreenWinInitializer* initializer) override { initializer->AddMonitor(gfx::Rect(0, 0, 640, 480), gfx::Rect(0, 0, 640, 380), @@ -1479,8 +1499,6 @@ private: std::vector<HWND> fake_hwnds_; - - DISALLOW_COPY_AND_ASSIGN(ScreenWinTestManyDisplays1x); }; } // namespace @@ -1873,6 +1891,10 @@ public: ScreenWinTestManyDisplays2x() = default; + ScreenWinTestManyDisplays2x(const ScreenWinTestManyDisplays2x&) = delete; + ScreenWinTestManyDisplays2x& operator=(const ScreenWinTestManyDisplays2x&) = + delete; + void SetUpScreen(TestScreenWinInitializer* initializer) override { initializer->AddMonitor(gfx::Rect(0, 0, 640, 480), gfx::Rect(0, 0, 640, 380), @@ -1913,8 +1935,6 @@ private: std::vector<HWND> fake_hwnds_; - - DISALLOW_COPY_AND_ASSIGN(ScreenWinTestManyDisplays2x); }; } // namespace @@ -2321,6 +2341,10 @@ public: ScreenWinTestTwoDisplays1x2x() = default; + ScreenWinTestTwoDisplays1x2x(const ScreenWinTestTwoDisplays1x2x&) = delete; + ScreenWinTestTwoDisplays1x2x& operator=(const ScreenWinTestTwoDisplays1x2x&) = + delete; + void SetUpScreen(TestScreenWinInitializer* initializer) override { initializer->AddMonitor(gfx::Rect(0, 0, 1920, 1200), gfx::Rect(0, 0, 1920, 1100), @@ -2346,8 +2370,6 @@ private: HWND fake_hwnd_left_ = nullptr; HWND fake_hwnd_right_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ScreenWinTestTwoDisplays1x2x); }; } // namespace @@ -2613,6 +2635,11 @@ public: ScreenWinTestTwoDisplays1_5x1x() = default; + ScreenWinTestTwoDisplays1_5x1x(const ScreenWinTestTwoDisplays1_5x1x&) = + delete; + ScreenWinTestTwoDisplays1_5x1x& operator=( + const ScreenWinTestTwoDisplays1_5x1x&) = delete; + void SetUpScreen(TestScreenWinInitializer* initializer) override { initializer->AddMonitor(gfx::Rect(0, 0, 800, 600), gfx::Rect(0, 0, 800, 550), @@ -2638,8 +2665,6 @@ private: HWND fake_hwnd_left_ = nullptr; HWND fake_hwnd_right_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ScreenWinTestTwoDisplays1_5x1x); }; } // namespace @@ -2900,6 +2925,10 @@ public: ScreenWinTestTwoDisplays2x1x() = default; + ScreenWinTestTwoDisplays2x1x(const ScreenWinTestTwoDisplays2x1x&) = delete; + ScreenWinTestTwoDisplays2x1x& operator=(const ScreenWinTestTwoDisplays2x1x&) = + delete; + void SetUpScreen(TestScreenWinInitializer* initializer) override { initializer->AddMonitor(gfx::Rect(0, 0, 1920, 1200), gfx::Rect(0, 0, 1920, 1100), @@ -2925,8 +2954,6 @@ private: HWND fake_hwnd_left_ = nullptr; HWND fake_hwnd_right_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ScreenWinTestTwoDisplays2x1x); }; } // namespace @@ -3192,6 +3219,11 @@ public: ScreenWinTestTwoDisplays2x1xVirtualized() = default; + ScreenWinTestTwoDisplays2x1xVirtualized( + const ScreenWinTestTwoDisplays2x1xVirtualized&) = delete; + ScreenWinTestTwoDisplays2x1xVirtualized& operator=( + const ScreenWinTestTwoDisplays2x1xVirtualized&) = delete; + void SetUpScreen(TestScreenWinInitializer* initializer) override { initializer->AddMonitor(gfx::Rect(0, 0, 3200, 1600), gfx::Rect(0, 0, 3200, 1500), @@ -3217,8 +3249,6 @@ private: HWND fake_hwnd_left_ = nullptr; HWND fake_hwnd_right_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ScreenWinTestTwoDisplays2x1xVirtualized); }; } // namespace @@ -3482,6 +3512,11 @@ public: ScreenWinUninitializedForced1x() = default; + ScreenWinUninitializedForced1x(const ScreenWinUninitializedForced1x&) = + delete; + ScreenWinUninitializedForced1x& operator=( + const ScreenWinUninitializedForced1x&) = delete; + void SetUp() override { testing::Test::SetUp(); base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( @@ -3492,9 +3527,6 @@ Display::ResetForceDeviceScaleFactorForTesting(); testing::Test::TearDown(); } - - private: - DISALLOW_COPY_AND_ASSIGN(ScreenWinUninitializedForced1x); }; } // namespace @@ -3590,6 +3622,11 @@ public: ScreenWinUninitializedForced2x() = default; + ScreenWinUninitializedForced2x(const ScreenWinUninitializedForced2x&) = + delete; + ScreenWinUninitializedForced2x& operator=( + const ScreenWinUninitializedForced2x&) = delete; + void SetUp() override { testing::Test::SetUp(); base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( @@ -3600,9 +3637,6 @@ Display::ResetForceDeviceScaleFactorForTesting(); testing::Test::TearDown(); } - - private: - DISALLOW_COPY_AND_ASSIGN(ScreenWinUninitializedForced2x); }; } // namespace @@ -3697,6 +3731,11 @@ public: ScreenWinTestTwoDisplaysOneInternal() = default; + ScreenWinTestTwoDisplaysOneInternal( + const ScreenWinTestTwoDisplaysOneInternal&) = delete; + ScreenWinTestTwoDisplaysOneInternal& operator=( + const ScreenWinTestTwoDisplaysOneInternal&) = delete; + void SetUpScreen(TestScreenWinInitializer* initializer) override { initializer->AddMonitor(gfx::Rect(0, 0, 1920, 1200), gfx::Rect(0, 0, 1920, 1100), L"primary", 1.0, @@ -3704,9 +3743,6 @@ initializer->AddMonitor(gfx::Rect(1920, 0, 800, 600), gfx::Rect(1920, 0, 800, 600), L"secondary", 1.0); } - - private: - DISALLOW_COPY_AND_ASSIGN(ScreenWinTestTwoDisplaysOneInternal); }; } // namespace
diff --git a/ui/events/blink/fling_booster.h b/ui/events/blink/fling_booster.h index bf87340..3e23e9c7 100644 --- a/ui/events/blink/fling_booster.h +++ b/ui/events/blink/fling_booster.h
@@ -20,6 +20,9 @@ public: FlingBooster() = default; + FlingBooster(const FlingBooster&) = delete; + FlingBooster& operator=(const FlingBooster&) = delete; + gfx::Vector2dF GetVelocityForFlingStart( const blink::WebGestureEvent& gesture_start); void ObserveGestureEvent(const blink::WebGestureEvent& gesture_event); @@ -55,8 +58,6 @@ // as a boost. This is used to calculate the velocity; if it's too slow we'll // avoid boosting. base::TimeTicks previous_boosting_scroll_timestamp_; - - DISALLOW_COPY_AND_ASSIGN(FlingBooster); }; } // namespace ui
diff --git a/ui/events/cocoa/events_mac_unittest.mm b/ui/events/cocoa/events_mac_unittest.mm index 201cc6c..529fd31 100644 --- a/ui/events/cocoa/events_mac_unittest.mm +++ b/ui/events/cocoa/events_mac_unittest.mm
@@ -32,6 +32,9 @@ public: EventsMacTest() {} + EventsMacTest(const EventsMacTest&) = delete; + EventsMacTest& operator=(const EventsMacTest&) = delete; + gfx::Point Flip(gfx::Point window_location) { NSRect window_frame = [test_window() frame]; CGFloat content_height = @@ -81,9 +84,6 @@ protected: const gfx::Point default_location_ = gfx::Point(10, 20); - - private: - DISALLOW_COPY_AND_ASSIGN(EventsMacTest); }; // Trackpad scroll sequences below determined empirically on OSX 10.11 (linking
diff --git a/ui/events/devices/device_data_manager_unittest.cc b/ui/events/devices/device_data_manager_unittest.cc index 043e775..88a03a0 100644 --- a/ui/events/devices/device_data_manager_unittest.cc +++ b/ui/events/devices/device_data_manager_unittest.cc
@@ -63,6 +63,10 @@ public: TestInputDeviceEventObserver() = default; + TestInputDeviceEventObserver(const TestInputDeviceEventObserver&) = delete; + TestInputDeviceEventObserver& operator=(const TestInputDeviceEventObserver&) = + delete; + int on_touch_device_associations_changed_call_count() const { return on_touch_device_associations_changed_call_count_; } @@ -74,8 +78,6 @@ private: int on_touch_device_associations_changed_call_count_ = 0; - - DISALLOW_COPY_AND_ASSIGN(TestInputDeviceEventObserver); }; } // namespace
diff --git a/ui/events/devices/x11/device_data_manager_x11.h b/ui/events/devices/x11/device_data_manager_x11.h index e8d49bb..f1ac54f1 100644 --- a/ui/events/devices/x11/device_data_manager_x11.h +++ b/ui/events/devices/x11/device_data_manager_x11.h
@@ -122,6 +122,9 @@ // Returns the DeviceDataManagerX11 singleton. static DeviceDataManagerX11* GetInstance(); + DeviceDataManagerX11(const DeviceDataManagerX11&) = delete; + DeviceDataManagerX11& operator=(const DeviceDataManagerX11&) = delete; + // Returns if XInput2 is available on the system. bool IsXInput2Available() const; @@ -400,8 +403,6 @@ std::map<x11::Input::DeviceId, ui::InputDevice> blocked_keyboard_devices_; std::vector<uint8_t> button_map_; - - DISALLOW_COPY_AND_ASSIGN(DeviceDataManagerX11); }; } // namespace ui
diff --git a/ui/events/devices/x11/device_list_cache_x11.h b/ui/events/devices/x11/device_list_cache_x11.h index a953a05..d8d58d2a 100644 --- a/ui/events/devices/x11/device_list_cache_x11.h +++ b/ui/events/devices/x11/device_list_cache_x11.h
@@ -30,6 +30,9 @@ public: static DeviceListCacheX11* GetInstance(); + DeviceListCacheX11(const DeviceListCacheX11&) = delete; + DeviceListCacheX11& operator=(const DeviceListCacheX11&) = delete; + void UpdateDeviceList(x11::Connection* connection); // Returns the list of devices associated with |display|. Uses the old X11 @@ -51,8 +54,6 @@ bool updated_ = false; XDeviceList x_dev_list_; XIDeviceList xi_dev_list_; - - DISALLOW_COPY_AND_ASSIGN(DeviceListCacheX11); }; } // namespace ui
diff --git a/ui/events/devices/x11/touch_factory_x11.h b/ui/events/devices/x11/touch_factory_x11.h index 065c4f93..ecf2362 100644 --- a/ui/events/devices/x11/touch_factory_x11.h +++ b/ui/events/devices/x11/touch_factory_x11.h
@@ -40,6 +40,9 @@ // Returns the TouchFactory singleton. static TouchFactory* GetInstance(); + TouchFactory(const TouchFactory&) = delete; + TouchFactory& operator=(const TouchFactory&) = delete; + // Sets the touch devices from the command line. static void SetTouchDeviceListFromCommandLine(); @@ -158,8 +161,6 @@ // The status of the touch screens devices themselves. bool touch_screens_enabled_; - - DISALLOW_COPY_AND_ASSIGN(TouchFactory); }; } // namespace ui
diff --git a/ui/events/event.h b/ui/events/event.h index 0eba272..296227d 100644 --- a/ui/events/event.h +++ b/ui/events/event.h
@@ -59,6 +59,9 @@ public: explicit DispatcherApi(Event* event) : event_(event) {} + DispatcherApi(const DispatcherApi&) = delete; + DispatcherApi& operator=(const DispatcherApi&) = delete; + void set_target(EventTarget* target) { event_->target_ = target; } void set_phase(EventPhase phase) { event_->phase_ = phase; } @@ -69,8 +72,6 @@ private: Event* event_; - - DISALLOW_COPY_AND_ASSIGN(DispatcherApi); }; void SetNativeEvent(const PlatformEvent& event); @@ -478,6 +479,9 @@ public: explicit DispatcherApi(MouseEvent* event) : event_(event) {} + DispatcherApi(const DispatcherApi&) = delete; + DispatcherApi& operator=(const DispatcherApi&) = delete; + // TODO(eirage): convert this to builder pattern. void set_movement(const gfx::Vector2dF& movement) { event_->movement_ = movement; @@ -486,8 +490,6 @@ private: MouseEvent* event_; - - DISALLOW_COPY_AND_ASSIGN(DispatcherApi); }; // Conveniences to quickly test what button is down
diff --git a/ui/events/event_processor_unittest.cc b/ui/events/event_processor_unittest.cc index 47df9bb..e4528ea 100644 --- a/ui/events/event_processor_unittest.cc +++ b/ui/events/event_processor_unittest.cc
@@ -27,12 +27,13 @@ public: SelfDestroyingEventProcessor() {} + SelfDestroyingEventProcessor(const SelfDestroyingEventProcessor&) = delete; + SelfDestroyingEventProcessor& operator=(const SelfDestroyingEventProcessor&) = + delete; + protected: EventDispatchDetails PostDispatchEvent(EventTarget* target, const Event& event) override; - - private: - DISALLOW_COPY_AND_ASSIGN(SelfDestroyingEventProcessor); }; class SelfDestroyingTestEventTarget : public TestEventTarget { @@ -40,14 +41,16 @@ SelfDestroyingTestEventTarget() : processor_(new SelfDestroyingEventProcessor()) {} + SelfDestroyingTestEventTarget(const SelfDestroyingTestEventTarget&) = delete; + SelfDestroyingTestEventTarget& operator=( + const SelfDestroyingTestEventTarget&) = delete; + TestEventProcessor* processor() { return processor_.get(); } void DestroyProcessor() { processor_.reset(); } private: std::unique_ptr<SelfDestroyingEventProcessor> processor_; - - DISALLOW_COPY_AND_ASSIGN(SelfDestroyingTestEventTarget); }; EventDispatchDetails SelfDestroyingEventProcessor::PostDispatchEvent(
diff --git a/ui/events/event_target.h b/ui/events/event_target.h index cb75daa0..f13e4af 100644 --- a/ui/events/event_target.h +++ b/ui/events/event_target.h
@@ -28,14 +28,19 @@ public: explicit DispatcherApi(EventTarget* target) : target_(target) {} + DispatcherApi(const DispatcherApi&) = delete; + DispatcherApi& operator=(const DispatcherApi&) = delete; + private: DispatcherApi(); EventTarget* target_; - - DISALLOW_COPY_AND_ASSIGN(DispatcherApi); }; EventTarget(); + + EventTarget(const EventTarget&) = delete; + EventTarget& operator=(const EventTarget&) = delete; + virtual ~EventTarget(); virtual bool CanAcceptEvent(const Event& event) = 0; @@ -127,8 +132,6 @@ EventHandlerPriorityList pre_target_list_; EventHandlerList post_target_list_; EventHandler* target_handler_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(EventTarget); }; } // namespace ui
diff --git a/ui/events/gesture_detection/gesture_configuration.h b/ui/events/gesture_detection/gesture_configuration.h index 7171361..22fd8ca 100644 --- a/ui/events/gesture_detection/gesture_configuration.h +++ b/ui/events/gesture_detection/gesture_configuration.h
@@ -16,6 +16,9 @@ // Returns the singleton GestureConfiguration. static GestureConfiguration* GetInstance(); + GestureConfiguration(const GestureConfiguration&) = delete; + GestureConfiguration& operator=(const GestureConfiguration&) = delete; + // Ordered alphabetically ignoring underscores. float default_radius() const { return default_radius_; } void set_default_radius(float radius) { @@ -256,8 +259,6 @@ bool swipe_enabled_; bool two_finger_tap_enabled_; VelocityTracker::Strategy velocity_tracker_strategy_; - - DISALLOW_COPY_AND_ASSIGN(GestureConfiguration); }; } // namespace ui
diff --git a/ui/events/gesture_detection/gesture_provider.cc b/ui/events/gesture_detection/gesture_provider.cc index cc4dbf0..ce167c4 100644 --- a/ui/events/gesture_detection/gesture_provider.cc +++ b/ui/events/gesture_detection/gesture_provider.cc
@@ -121,6 +121,9 @@ max_diameter_before_show_press_(0), show_press_event_sent_(false) {} + GestureListenerImpl(const GestureListenerImpl&) = delete; + GestureListenerImpl& operator=(const GestureListenerImpl&) = delete; + void OnTouchEvent(const MotionEvent& event) { const bool in_scale_gesture = IsScaleGestureDetectionInProgress(); snap_scroll_controller_.SetSnapScrollMode(event, in_scale_gesture); @@ -838,7 +841,6 @@ // The scroll focus point is set to the first touch down point when scroll // begins and is later updated based on the delta of touch points. gfx::PointF scroll_focus_point_; - DISALLOW_COPY_AND_ASSIGN(GestureListenerImpl); }; // GestureProvider
diff --git a/ui/events/keycodes/keysym_to_unicode.cc b/ui/events/keycodes/keysym_to_unicode.cc index 6b26e68..2d8be131 100644 --- a/ui/events/keycodes/keysym_to_unicode.cc +++ b/ui/events/keycodes/keysym_to_unicode.cc
@@ -820,6 +820,9 @@ } } + KeySymToUnicode(const KeySymToUnicode&) = delete; + KeySymToUnicode& operator=(const KeySymToUnicode&) = delete; + uint16_t UnicodeFromKeySym(uint32_t keysym) const { // Latin-1 characters have the same representation. if ((0x0020 <= keysym && keysym <= 0x007e) || @@ -842,8 +845,6 @@ private: typedef std::unordered_map<uint32_t, uint16_t> KeySymToUnicodeMap; KeySymToUnicodeMap keysym_to_unicode_map_; - - DISALLOW_COPY_AND_ASSIGN(KeySymToUnicode); }; static base::LazyInstance<KeySymToUnicode>::Leaky g_keysym_to_unicode =
diff --git a/ui/events/mobile_scroller.cc b/ui/events/mobile_scroller.cc index 19bcc5c..1de9f66 100644 --- a/ui/events/mobile_scroller.cc +++ b/ui/events/mobile_scroller.cc
@@ -43,6 +43,9 @@ viscous_fluid_normalize_ = 1.0f / ApplyViscosity(1.0f); } + ViscosityConstants(const ViscosityConstants&) = delete; + ViscosityConstants& operator=(const ViscosityConstants&) = delete; + float ApplyViscosity(float x) { x *= viscous_fluid_scale_; if (x < 1.0f) { @@ -60,8 +63,6 @@ // This controls the intensity of the viscous fluid effect. float viscous_fluid_scale_; float viscous_fluid_normalize_; - - DISALLOW_COPY_AND_ASSIGN(ViscosityConstants); }; struct SplineConstants { @@ -109,6 +110,9 @@ spline_position_[NUM_SAMPLES] = spline_time_[NUM_SAMPLES] = 1.0f; } + SplineConstants(const SplineConstants&) = delete; + SplineConstants& operator=(const SplineConstants&) = delete; + void CalculateCoefficients(float t, float* distance_coef, float* velocity_coef) { @@ -130,8 +134,6 @@ float spline_position_[NUM_SAMPLES + 1]; float spline_time_[NUM_SAMPLES + 1]; - - DISALLOW_COPY_AND_ASSIGN(SplineConstants); }; float ComputeDeceleration(float friction) {
diff --git a/ui/events/ozone/chromeos/cursor_controller.h b/ui/events/ozone/chromeos/cursor_controller.h index d8eca70..623affd 100644 --- a/ui/events/ozone/chromeos/cursor_controller.h +++ b/ui/events/ozone/chromeos/cursor_controller.h
@@ -49,6 +49,9 @@ static CursorController* GetInstance(); + CursorController(const CursorController&) = delete; + CursorController& operator=(const CursorController&) = delete; + void AddCursorObserver(CursorObserver* observer); void RemoveCursorObserver(CursorObserver* observer); @@ -94,8 +97,6 @@ base::ObserverList<CursorObserver>::Unchecked cursor_observers_; mutable base::Lock cursor_observers_lock_; - - DISALLOW_COPY_AND_ASSIGN(CursorController); }; } // namespace ui
diff --git a/ui/events/ozone/device/device_event.h b/ui/events/ozone/device/device_event.h index bc17a64..a79e1cdc 100644 --- a/ui/events/ozone/device/device_event.h +++ b/ui/events/ozone/device/device_event.h
@@ -26,6 +26,9 @@ DeviceEvent(DeviceType type, ActionType action, const base::FilePath& path); + DeviceEvent(const DeviceEvent&) = delete; + DeviceEvent& operator=(const DeviceEvent&) = delete; + DeviceType device_type() const { return device_type_; } ActionType action_type() const { return action_type_; } base::FilePath path() const { return path_; } @@ -34,8 +37,6 @@ DeviceType device_type_; ActionType action_type_; base::FilePath path_; - - DISALLOW_COPY_AND_ASSIGN(DeviceEvent); }; } // namespace ui
diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc b/ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc index 2e44211..8858b35 100644 --- a/ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc +++ b/ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc
@@ -61,6 +61,10 @@ public: EventConverterEvdevImplTest() {} + EventConverterEvdevImplTest(const EventConverterEvdevImplTest&) = delete; + EventConverterEvdevImplTest& operator=(const EventConverterEvdevImplTest&) = + delete; + // Overridden from testing::Test: void SetUp() override { // Set up pipe to satisfy message pump (unused). @@ -143,8 +147,6 @@ std::vector<std::unique_ptr<ui::Event>> dispatched_events_; base::ScopedFD events_out_; - - DISALLOW_COPY_AND_ASSIGN(EventConverterEvdevImplTest); }; TEST_F(EventConverterEvdevImplTest, KeyPress) {
diff --git a/ui/events/ozone/evdev/gamepad_event_converter_evdev_unittest.cc b/ui/events/ozone/evdev/gamepad_event_converter_evdev_unittest.cc index bec806d..0660fd02 100644 --- a/ui/events/ozone/evdev/gamepad_event_converter_evdev_unittest.cc +++ b/ui/events/ozone/evdev/gamepad_event_converter_evdev_unittest.cc
@@ -91,6 +91,11 @@ public: GamepadEventConverterEvdevTest() {} + GamepadEventConverterEvdevTest(const GamepadEventConverterEvdevTest&) = + delete; + GamepadEventConverterEvdevTest& operator=( + const GamepadEventConverterEvdevTest&) = delete; + // Overriden from testing::Test: void SetUp() override { device_manager_ = ui::CreateDeviceManagerForTest(); @@ -127,8 +132,6 @@ std::unique_ptr<ui::KeyboardLayoutEngine> keyboard_layout_engine_; std::unique_ptr<ui::EventFactoryEvdev> event_factory_; std::unique_ptr<ui::DeviceEventDispatcherEvdev> dispatcher_; - - DISALLOW_COPY_AND_ASSIGN(GamepadEventConverterEvdevTest); }; struct ExpectedEvent {
diff --git a/ui/events/ozone/evdev/input_injector_evdev_unittest.cc b/ui/events/ozone/evdev/input_injector_evdev_unittest.cc index f7bfaf993..1af3c39 100644 --- a/ui/events/ozone/evdev/input_injector_evdev_unittest.cc +++ b/ui/events/ozone/evdev/input_injector_evdev_unittest.cc
@@ -75,6 +75,9 @@ public: InputInjectorEvdevTest(); + InputInjectorEvdevTest(const InputInjectorEvdevTest&) = delete; + InputInjectorEvdevTest& operator=(const InputInjectorEvdevTest&) = delete; + protected: void SimulateMouseClick(int x, int y, EventFlags button, int count); void ExpectClick(int x, int y, int button, int count); @@ -91,9 +94,6 @@ base::test::SingleThreadTaskEnvironment task_environment_; base::RunLoop run_loop_; - - private: - DISALLOW_COPY_AND_ASSIGN(InputInjectorEvdevTest); }; InputInjectorEvdevTest::InputInjectorEvdevTest()
diff --git a/ui/events/ozone/evdev/stylus_button_event_converter_evdev_unittest.cc b/ui/events/ozone/evdev/stylus_button_event_converter_evdev_unittest.cc index 4e42956..da1979f 100644 --- a/ui/events/ozone/evdev/stylus_button_event_converter_evdev_unittest.cc +++ b/ui/events/ozone/evdev/stylus_button_event_converter_evdev_unittest.cc
@@ -112,6 +112,11 @@ public: StylusButtonEventConverterEvdevTest() {} + StylusButtonEventConverterEvdevTest( + const StylusButtonEventConverterEvdevTest&) = delete; + StylusButtonEventConverterEvdevTest& operator=( + const StylusButtonEventConverterEvdevTest&) = delete; + // Overridden from testing::Test: void SetUp() override { device_manager_ = ui::CreateDeviceManagerForTest(); @@ -162,8 +167,6 @@ std::vector<std::unique_ptr<ui::Event>> dispatched_events_; base::ScopedFD events_out_; - - DISALLOW_COPY_AND_ASSIGN(StylusButtonEventConverterEvdevTest); }; TEST_F(StylusButtonEventConverterEvdevTest, DellActivePenSingleClick) {
diff --git a/ui/events/ozone/evdev/tablet_event_converter_evdev_unittest.cc b/ui/events/ozone/evdev/tablet_event_converter_evdev_unittest.cc index ecf263f..30913fb 100644 --- a/ui/events/ozone/evdev/tablet_event_converter_evdev_unittest.cc +++ b/ui/events/ozone/evdev/tablet_event_converter_evdev_unittest.cc
@@ -212,6 +212,10 @@ public: TabletEventConverterEvdevTest() {} + TabletEventConverterEvdevTest(const TabletEventConverterEvdevTest&) = delete; + TabletEventConverterEvdevTest& operator=( + const TabletEventConverterEvdevTest&) = delete; + // Overridden from testing::Test: void SetUp() override { cursor_ = std::make_unique<ui::MockTabletCursorEvdev>(); @@ -274,8 +278,6 @@ std::vector<std::unique_ptr<ui::Event>> dispatched_events_; base::ScopedFD events_out_; - - DISALLOW_COPY_AND_ASSIGN(TabletEventConverterEvdevTest); }; #define EPSILON 20
diff --git a/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc b/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc index 31c3a30..9967f69 100644 --- a/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc +++ b/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc
@@ -238,6 +238,10 @@ public: TouchEventConverterEvdevTest() {} + TouchEventConverterEvdevTest(const TouchEventConverterEvdevTest&) = delete; + TouchEventConverterEvdevTest& operator=(const TouchEventConverterEvdevTest&) = + delete; + // Overridden from testing::Test: void SetUp() override { // By default, tests disable single-cancel and enable palm on touch_major == @@ -335,7 +339,6 @@ dispatched_events_.push_back(params); } std::vector<GenericEventParams> dispatched_events_; - DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdevTest); }; TEST_F(TouchEventConverterEvdevTest, NoEvents) {
diff --git a/ui/events/ozone/evdev/touch_filter/heuristic_stylus_palm_detection_filter_unittest.cc b/ui/events/ozone/evdev/touch_filter/heuristic_stylus_palm_detection_filter_unittest.cc index b720ee4..f7aba7b 100644 --- a/ui/events/ozone/evdev/touch_filter/heuristic_stylus_palm_detection_filter_unittest.cc +++ b/ui/events/ozone/evdev/touch_filter/heuristic_stylus_palm_detection_filter_unittest.cc
@@ -17,6 +17,12 @@ class HeuristicStylusPalmDetectionFilterTest : public testing::Test { public: HeuristicStylusPalmDetectionFilterTest() = default; + + HeuristicStylusPalmDetectionFilterTest( + const HeuristicStylusPalmDetectionFilterTest&) = delete; + HeuristicStylusPalmDetectionFilterTest& operator=( + const HeuristicStylusPalmDetectionFilterTest&) = delete; + void SetUp() override { shared_palm_state = std::make_unique<SharedPalmDetectionFilterState>(); palm_detection_filter_ = @@ -39,8 +45,6 @@ std::unique_ptr<PalmDetectionFilter> palm_detection_filter_; std::vector<InProgressTouchEvdev> touches_; base::TimeTicks test_start_time_; - - DISALLOW_COPY_AND_ASSIGN(HeuristicStylusPalmDetectionFilterTest); }; class HeuristicStylusPalmDetectionFilterDeathTest
diff --git a/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_unittest.cc b/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_unittest.cc index 4f446df..5e3b390 100644 --- a/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_unittest.cc +++ b/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_unittest.cc
@@ -28,6 +28,12 @@ class NeuralStylusPalmDetectionFilterTest : public testing::Test { public: NeuralStylusPalmDetectionFilterTest() = default; + + NeuralStylusPalmDetectionFilterTest( + const NeuralStylusPalmDetectionFilterTest&) = delete; + NeuralStylusPalmDetectionFilterTest& operator=( + const NeuralStylusPalmDetectionFilterTest&) = delete; + void SetUp() override { shared_palm_state = std::make_unique<SharedPalmDetectionFilterState>(); model_ = new testing::StrictMock<MockNeuralModel>; @@ -62,7 +68,6 @@ MockNeuralModel* model_; NeuralStylusPalmDetectionFilterModelConfig model_config_; std::unique_ptr<PalmDetectionFilter> palm_detection_filter_; - DISALLOW_COPY_AND_ASSIGN(NeuralStylusPalmDetectionFilterTest); }; class NeuralStylusPalmDetectionFilterDeathTest
diff --git a/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_util_unittest.cc b/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_util_unittest.cc index 0e1ea1b..519fbf3 100644 --- a/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_util_unittest.cc +++ b/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter_util_unittest.cc
@@ -21,6 +21,11 @@ public: NeuralStylusPalmDetectionFilterUtilTest() = default; + NeuralStylusPalmDetectionFilterUtilTest( + const NeuralStylusPalmDetectionFilterUtilTest&) = delete; + NeuralStylusPalmDetectionFilterUtilTest& operator=( + const NeuralStylusPalmDetectionFilterUtilTest&) = delete; + void SetUp() override { EXPECT_TRUE( CapabilitiesToDeviceInfo(kNocturneTouchScreen, &nocturne_touchscreen_)); @@ -36,8 +41,6 @@ InProgressTouchEvdev touch_; EventDeviceInfo nocturne_touchscreen_; NeuralStylusPalmDetectionFilterModelConfig model_config_; - - DISALLOW_COPY_AND_ASSIGN(NeuralStylusPalmDetectionFilterUtilTest); }; TEST_F(NeuralStylusPalmDetectionFilterUtilTest, DistilledNocturneTest) {
diff --git a/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_report_filter_unittest.cc b/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_report_filter_unittest.cc index d9531e2..b58879ea 100644 --- a/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_report_filter_unittest.cc +++ b/ui/events/ozone/evdev/touch_filter/neural_stylus_palm_report_filter_unittest.cc
@@ -21,6 +21,10 @@ public: NeuralStylusReportFilterTest() = default; + NeuralStylusReportFilterTest(const NeuralStylusReportFilterTest&) = delete; + NeuralStylusReportFilterTest& operator=(const NeuralStylusReportFilterTest&) = + delete; + void SetUp() override { shared_palm_state = std::make_unique<SharedPalmDetectionFilterState>(); palm_detection_filter_ = @@ -35,8 +39,6 @@ std::unique_ptr<SharedPalmDetectionFilterState> shared_palm_state; std::unique_ptr<PalmDetectionFilter> palm_detection_filter_; EventDeviceInfo nocturne_touchscreen_info_, nocturne_stylus_info_; - - DISALLOW_COPY_AND_ASSIGN(NeuralStylusReportFilterTest); }; TEST_F(NeuralStylusReportFilterTest, TestSetsToZero) {
diff --git a/ui/events/ozone/evdev/touch_filter/open_palm_detection_filter_unittest.cc b/ui/events/ozone/evdev/touch_filter/open_palm_detection_filter_unittest.cc index bbf6824..0d69d5e5 100644 --- a/ui/events/ozone/evdev/touch_filter/open_palm_detection_filter_unittest.cc +++ b/ui/events/ozone/evdev/touch_filter/open_palm_detection_filter_unittest.cc
@@ -17,6 +17,10 @@ public: OpenPalmDetectionFilterTest() = default; + OpenPalmDetectionFilterTest(const OpenPalmDetectionFilterTest&) = delete; + OpenPalmDetectionFilterTest& operator=(const OpenPalmDetectionFilterTest&) = + delete; + void SetUp() override { shared_palm_state = std::make_unique<SharedPalmDetectionFilterState>(); palm_detection_filter_ = @@ -26,8 +30,6 @@ protected: std::unique_ptr<SharedPalmDetectionFilterState> shared_palm_state; std::unique_ptr<PalmDetectionFilter> palm_detection_filter_; - - DISALLOW_COPY_AND_ASSIGN(OpenPalmDetectionFilterTest); }; TEST_F(OpenPalmDetectionFilterTest, TestSetsToZero) {
diff --git a/ui/events/ozone/evdev/touch_filter/palm_detection_filter_factory_unittest.cc b/ui/events/ozone/evdev/touch_filter/palm_detection_filter_factory_unittest.cc index be6af2e6..43edd14f 100644 --- a/ui/events/ozone/evdev/touch_filter/palm_detection_filter_factory_unittest.cc +++ b/ui/events/ozone/evdev/touch_filter/palm_detection_filter_factory_unittest.cc
@@ -27,6 +27,11 @@ public: PalmDetectionFilterFactoryTest() = default; + PalmDetectionFilterFactoryTest(const PalmDetectionFilterFactoryTest&) = + delete; + PalmDetectionFilterFactoryTest& operator=( + const PalmDetectionFilterFactoryTest&) = delete; + void SetUp() override { EXPECT_TRUE( CapabilitiesToDeviceInfo(kEveTouchScreen, &eve_touchscreen_info_)); @@ -46,8 +51,6 @@ nocturne_touchscreen_info_, nocturne_stylus_info_, kohaku_touchscreen_info_; SharedPalmDetectionFilterState shared_palm_state_; - - DISALLOW_COPY_AND_ASSIGN(PalmDetectionFilterFactoryTest); }; class PalmDetectionFilterFactoryDeathTest
diff --git a/ui/events/ozone/evdev/touch_filter/palm_model/onedevice_train_palm_detection_filter_model.h b/ui/events/ozone/evdev/touch_filter/palm_model/onedevice_train_palm_detection_filter_model.h index d4c9872..d37dd83f 100644 --- a/ui/events/ozone/evdev/touch_filter/palm_model/onedevice_train_palm_detection_filter_model.h +++ b/ui/events/ozone/evdev/touch_filter/palm_model/onedevice_train_palm_detection_filter_model.h
@@ -22,12 +22,16 @@ OneDeviceTrainNeuralStylusPalmDetectionFilterModel(); explicit OneDeviceTrainNeuralStylusPalmDetectionFilterModel( const std::vector<float>& radius_poly); + + OneDeviceTrainNeuralStylusPalmDetectionFilterModel( + const OneDeviceTrainNeuralStylusPalmDetectionFilterModel&) = delete; + OneDeviceTrainNeuralStylusPalmDetectionFilterModel& operator=( + const OneDeviceTrainNeuralStylusPalmDetectionFilterModel&) = delete; + float Inference(const std::vector<float>& features) const override; const NeuralStylusPalmDetectionFilterModelConfig& config() const override; - DISALLOW_COPY_AND_ASSIGN(OneDeviceTrainNeuralStylusPalmDetectionFilterModel); - private: NeuralStylusPalmDetectionFilterModelConfig config_; };
diff --git a/ui/events/ozone/gamepad/gamepad_provider_ozone.h b/ui/events/ozone/gamepad/gamepad_provider_ozone.h index 2c1878c..d46aa8d 100644 --- a/ui/events/ozone/gamepad/gamepad_provider_ozone.h +++ b/ui/events/ozone/gamepad/gamepad_provider_ozone.h
@@ -25,6 +25,9 @@ // Get the GamepadProviderOzone instance. static GamepadProviderOzone* GetInstance(); + GamepadProviderOzone(const GamepadProviderOzone&) = delete; + GamepadProviderOzone& operator=(const GamepadProviderOzone&) = delete; + // Dispatch GamepadDevicesUpdate event when gamepad device is connected or // disconnected. This function must be called on UI thread. void DispatchGamepadDevicesUpdated( @@ -62,8 +65,6 @@ // List of current connected gamepad events. std::vector<GamepadDevice> gamepad_devices_; - - DISALLOW_COPY_AND_ASSIGN(GamepadProviderOzone); }; } // namespace ui
diff --git a/ui/events/scoped_target_handler_unittest.cc b/ui/events/scoped_target_handler_unittest.cc index 57246979..49913b5 100644 --- a/ui/events/scoped_target_handler_unittest.cc +++ b/ui/events/scoped_target_handler_unittest.cc
@@ -23,11 +23,11 @@ public: TestEventTargetIterator() {} + TestEventTargetIterator(const TestEventTargetIterator&) = delete; + TestEventTargetIterator& operator=(const TestEventTargetIterator&) = delete; + // EventTargetIterator: EventTarget* GetNextTarget() override { return nullptr; } - -private: - DISALLOW_COPY_AND_ASSIGN(TestEventTargetIterator); }; // An EventTarget that holds ownership of its target and delegate EventHandlers.
diff --git a/ui/events/test/event_generator.cc b/ui/events/test/event_generator.cc index df028ef..8803a8d 100644 --- a/ui/events/test/event_generator.cc +++ b/ui/events/test/event_generator.cc
@@ -43,6 +43,9 @@ public: TestTickClock() = default; + TestTickClock(const TestTickClock&) = delete; + TestTickClock& operator=(const TestTickClock&) = delete; + // Unconditionally returns a tick count that is 1ms later than the previous // call, starting at 1ms. base::TimeTicks NowTicks() const override { @@ -53,8 +56,6 @@ private: mutable base::TimeTicks ticks_; - - DISALLOW_COPY_AND_ASSIGN(TestTickClock); }; namespace { @@ -78,8 +79,8 @@ /* force */ 0.0f), flags) {} - private: - DISALLOW_COPY_AND_ASSIGN(TestTouchEvent); + TestTouchEvent(const TestTouchEvent&) = delete; + TestTouchEvent& operator=(const TestTouchEvent&) = delete; }; const int kAllButtonMask = ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON;
diff --git a/ui/events/test/events_test_utils.h b/ui/events/test/events_test_utils.h index 9a20496..aa9abe1 100644 --- a/ui/events/test/events_test_utils.h +++ b/ui/events/test/events_test_utils.h
@@ -85,6 +85,9 @@ public: explicit EventTargetTestApi(EventTarget* target); + EventTargetTestApi(const EventTargetTestApi&) = delete; + EventTargetTestApi& operator=(const EventTargetTestApi&) = delete; + ui::EventHandlerList GetPreTargetHandlers() { ui::EventHandlerList list; target_->GetPreTargetHandlers(&list); @@ -95,22 +98,21 @@ EventTargetTestApi(); EventTarget* target_; - - DISALLOW_COPY_AND_ASSIGN(EventTargetTestApi); }; class EventSourceTestApi { public: explicit EventSourceTestApi(EventSource* event_source); + EventSourceTestApi(const EventSourceTestApi&) = delete; + EventSourceTestApi& operator=(const EventSourceTestApi&) = delete; + EventDispatchDetails SendEventToSink(Event* event) WARN_UNUSED_RESULT; private: EventSourceTestApi(); EventSource* event_source_; - - DISALLOW_COPY_AND_ASSIGN(EventSourceTestApi); }; } // namespace ui
diff --git a/ui/events/win/media_keyboard_hook_win_interactive_test.cc b/ui/events/win/media_keyboard_hook_win_interactive_test.cc index cd2d756..747cc4e 100644 --- a/ui/events/win/media_keyboard_hook_win_interactive_test.cc +++ b/ui/events/win/media_keyboard_hook_win_interactive_test.cc
@@ -19,6 +19,11 @@ MediaKeyboardHookWinInteractiveTest() : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} + MediaKeyboardHookWinInteractiveTest( + const MediaKeyboardHookWinInteractiveTest&) = delete; + MediaKeyboardHookWinInteractiveTest& operator=( + const MediaKeyboardHookWinInteractiveTest&) = delete; + protected: void SetUp() override { keyboard_hook_ = KeyboardHook::CreateMediaKeyboardHook(base::BindRepeating( @@ -86,8 +91,6 @@ base::RunLoop key_event_wait_loop_; uint32_t num_key_events_to_wait_for_ = 0; DWORD time_stamp_ = 0; - - DISALLOW_COPY_AND_ASSIGN(MediaKeyboardHookWinInteractiveTest); }; // Test that we catch the different media key events.
diff --git a/ui/events/x/events_x_utils.cc b/ui/events/x/events_x_utils.cc index e1397bc..86902388 100644 --- a/ui/events/x/events_x_utils.cc +++ b/ui/events/x/events_x_utils.cc
@@ -48,6 +48,9 @@ return base::Singleton<XModifierStateWatcher>::get(); } + XModifierStateWatcher(const XModifierStateWatcher&) = delete; + XModifierStateWatcher& operator=(const XModifierStateWatcher&) = delete; + x11::KeyButMask StateFromKeyboardCode(ui::KeyboardCode keyboard_code) { switch (keyboard_code) { case ui::VKEY_CONTROL: @@ -93,8 +96,6 @@ XModifierStateWatcher() = default; unsigned int state_{}; - - DISALLOW_COPY_AND_ASSIGN(XModifierStateWatcher); }; // Detects if a touch event is a driver-generated 'special event'.
diff --git a/ui/gfx/android/android_surface_control_compat.h b/ui/gfx/android/android_surface_control_compat.h index 9fea00b7..d5eee6f 100644 --- a/ui/gfx/android/android_surface_control_compat.h +++ b/ui/gfx/android/android_surface_control_compat.h
@@ -68,6 +68,9 @@ Surface(const Surface& parent, const char* name); Surface(ANativeWindow* parent, const char* name); + Surface(const Surface&) = delete; + Surface& operator=(const Surface&) = delete; + ASurfaceControl* surface() const { return surface_; } private: @@ -76,8 +79,6 @@ ASurfaceControl* surface_ = nullptr; ASurfaceControl* owned_surface_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(Surface); }; struct GFX_EXPORT SurfaceStats {
diff --git a/ui/gfx/android/view_configuration.cc b/ui/gfx/android/view_configuration.cc index 49da336..6397809 100644 --- a/ui/gfx/android/view_configuration.cc +++ b/ui/gfx/android/view_configuration.cc
@@ -49,6 +49,9 @@ env, j_view_configuration_helper_)); } + ViewConfigurationData(const ViewConfigurationData&) = delete; + ViewConfigurationData& operator=(const ViewConfigurationData&) = delete; + ~ViewConfigurationData() {} void SynchronizedUpdate(float maximum_fling_velocity, @@ -120,9 +123,6 @@ int touch_slop_in_dips_; int double_tap_slop_in_dips_; int min_scaling_span_in_dips_; - - private: - DISALLOW_COPY_AND_ASSIGN(ViewConfigurationData); }; // Leaky to allow access from any thread.
diff --git a/ui/gfx/animation/animation_container.h b/ui/gfx/animation/animation_container.h index 1bbf40a..fc80028 100644 --- a/ui/gfx/animation/animation_container.h +++ b/ui/gfx/animation/animation_container.h
@@ -34,6 +34,9 @@ public: AnimationContainer(); + AnimationContainer(const AnimationContainer&) = delete; + AnimationContainer& operator=(const AnimationContainer&) = delete; + // Invoked by Animation when it needs to start. Starts the timer if necessary. // NOTE: This is invoked by Animation for you, you shouldn't invoke this // directly. @@ -112,8 +115,6 @@ bool has_custom_animation_runner_ = false; AnimationContainerObserver* observer_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(AnimationContainer); }; } // namespace gfx
diff --git a/ui/gfx/animation/animation_container_unittest.cc b/ui/gfx/animation/animation_container_unittest.cc index d01fc3e..81335cc 100644 --- a/ui/gfx/animation/animation_container_unittest.cc +++ b/ui/gfx/animation/animation_container_unittest.cc
@@ -26,6 +26,11 @@ empty_(false) { } + FakeAnimationContainerObserver(const FakeAnimationContainerObserver&) = + delete; + FakeAnimationContainerObserver& operator=( + const FakeAnimationContainerObserver&) = delete; + int progressed_count() const { return progressed_count_; } bool empty() const { return empty_; } @@ -43,8 +48,6 @@ int progressed_count_; bool empty_; - - DISALLOW_COPY_AND_ASSIGN(FakeAnimationContainerObserver); }; class TestAnimation : public LinearAnimation { @@ -52,12 +55,12 @@ explicit TestAnimation(AnimationDelegate* delegate) : LinearAnimation(base::TimeDelta::FromMilliseconds(20), 20, delegate) {} + TestAnimation(const TestAnimation&) = delete; + TestAnimation& operator=(const TestAnimation&) = delete; + void AnimateToState(double state) override {} using LinearAnimation::duration; - - private: - DISALLOW_COPY_AND_ASSIGN(TestAnimation); }; } // namespace
diff --git a/ui/gfx/animation/linear_animation.h b/ui/gfx/animation/linear_animation.h index 629778c1..d313ecd 100644 --- a/ui/gfx/animation/linear_animation.h +++ b/ui/gfx/animation/linear_animation.h
@@ -34,6 +34,9 @@ int frame_rate, AnimationDelegate* delegate); + LinearAnimation(const LinearAnimation&) = delete; + LinearAnimation& operator=(const LinearAnimation&) = delete; + // Gets the value for the current state, according to the animation curve in // use. This class provides only for a linear relationship, however subclasses // can override this to provide others. @@ -80,8 +83,6 @@ // If true, we're in end. This is used to determine if the animation should // be advanced to the end from AnimationStopped. bool in_end_; - - DISALLOW_COPY_AND_ASSIGN(LinearAnimation); }; } // namespace gfx
diff --git a/ui/gfx/animation/test_animation_delegate.h b/ui/gfx/animation/test_animation_delegate.h index 32af452..99da5562 100644 --- a/ui/gfx/animation/test_animation_delegate.h +++ b/ui/gfx/animation/test_animation_delegate.h
@@ -17,6 +17,9 @@ public: TestAnimationDelegate() = default; + TestAnimationDelegate(const TestAnimationDelegate&) = delete; + TestAnimationDelegate& operator=(const TestAnimationDelegate&) = delete; + virtual void AnimationEnded(const Animation* animation) { finished_ = true; if (base::RunLoop::IsRunningOnCurrentThread()) @@ -34,8 +37,6 @@ private: bool canceled_ = false; bool finished_ = false; - - DISALLOW_COPY_AND_ASSIGN(TestAnimationDelegate); }; } // namespace gfx
diff --git a/ui/gfx/animation/tween.cc b/ui/gfx/animation/tween.cc index ade58e8..928f5dd 100644 --- a/ui/gfx/animation/tween.cc +++ b/ui/gfx/animation/tween.cc
@@ -89,6 +89,15 @@ case ACCEL_20_DECEL_60: return gfx::CubicBezier(0.2, 0, 0.4, 1).Solve(state); + + case ACCEL_80_DECEL_20: + return gfx::CubicBezier(0.8, 0, 0.8, 1).Solve(state); + + case ACCEL_0_40_DECEL_100: + return gfx::CubicBezier(0, 0.4, 0, 1).Solve(state); + + case ACCEL_0_80_DECEL_80: + return gfx::CubicBezier(0, 0.8, 0.2, 1).Solve(state); } NOTREACHED();
diff --git a/ui/gfx/animation/tween.h b/ui/gfx/animation/tween.h index c2daf2ee..45bca30 100644 --- a/ui/gfx/animation/tween.h +++ b/ui/gfx/animation/tween.h
@@ -67,8 +67,21 @@ ACCEL_LIN_DECEL_100, // Pulling a small to medium element into a place that // has very fast deceleration. ACCEL_20_DECEL_60, // Moving a small, low emphasis or responsive elements. + ACCEL_80_DECEL_20, // Slow in and fast out with ease. + + // ACCEL_0_<1>_DECEL_<2> where <1> and <2> are used to express the + // acceleration and deceleration speeds. The corresponding cubic bezier + // curve parameters would be ( 0, 0.01 * <1>, 1 - 0.01 * <2>, 1 ). + ACCEL_0_40_DECEL_100, // Specialized curve with an emphasized deceleration + // drift. + ACCEL_0_80_DECEL_80, // Variant of ACCEL_0_40_DECEL_100 which drops in + // value faster, but flattens out into the drift + // sooner. }; + Tween(const Tween&) = delete; + Tween& operator=(const Tween&) = delete; + // Returns the value based on the tween type. |state| is from 0-1. static double CalculateValue(Type type, double state); @@ -124,8 +137,6 @@ private: Tween(); ~Tween(); - - DISALLOW_COPY_AND_ASSIGN(Tween); }; } // namespace gfx
diff --git a/ui/gfx/bidi_line_iterator_unittest.cc b/ui/gfx/bidi_line_iterator_unittest.cc index 94100d1..8a8f392 100644 --- a/ui/gfx/bidi_line_iterator_unittest.cc +++ b/ui/gfx/bidi_line_iterator_unittest.cc
@@ -16,12 +16,13 @@ public: BiDiLineIteratorTest() = default; + BiDiLineIteratorTest(const BiDiLineIteratorTest&) = delete; + BiDiLineIteratorTest& operator=(const BiDiLineIteratorTest&) = delete; + BiDiLineIterator* iterator() { return &iterator_; } private: BiDiLineIterator iterator_; - - DISALLOW_COPY_AND_ASSIGN(BiDiLineIteratorTest); }; TEST_P(BiDiLineIteratorTest, OnlyLTR) {
diff --git a/ui/gfx/codec/png_codec.cc b/ui/gfx/codec/png_codec.cc index 40053ba..169299bc 100644 --- a/ui/gfx/codec/png_codec.cc +++ b/ui/gfx/codec/png_codec.cc
@@ -58,6 +58,9 @@ height(0), done(false) {} + PngDecoderState(const PngDecoderState&) = delete; + PngDecoderState& operator=(const PngDecoderState&) = delete; + PNGCodec::ColorFormat output_format; int output_channels; @@ -78,9 +81,6 @@ // Set to true when we've found the end of the data. bool done; - - private: - DISALLOW_COPY_AND_ASSIGN(PngDecoderState); }; // User transform (passed to libpng) which converts a row decoded by libpng to
diff --git a/ui/gfx/codec/png_codec.h b/ui/gfx/codec/png_codec.h index dc55eac..f5d4eb9 100644 --- a/ui/gfx/codec/png_codec.h +++ b/ui/gfx/codec/png_codec.h
@@ -53,6 +53,9 @@ std::string text; }; + PNGCodec(const PNGCodec&) = delete; + PNGCodec& operator=(const PNGCodec&) = delete; + // Encodes the given raw 'input' data, with each pixel being represented as // given in 'format'. The encoded PNG data will be written into the supplied // vector and true will be returned on success. On failure (false), the @@ -122,9 +125,6 @@ // otherwise. static bool Decode(const unsigned char* input, size_t input_size, SkBitmap* bitmap); - - private: - DISALLOW_COPY_AND_ASSIGN(PNGCodec); }; } // namespace gfx
diff --git a/ui/gfx/font_fallback_linux.cc b/ui/gfx/font_fallback_linux.cc index 32de1e6..5f3240c 100644 --- a/ui/gfx/font_fallback_linux.cc +++ b/ui/gfx/font_fallback_linux.cc
@@ -116,6 +116,9 @@ : locale_(locale), font_(font) {} FallbackFontKey(const FallbackFontKey&) = default; + + FallbackFontKey& operator=(const FallbackFontKey&) = delete; + ~FallbackFontKey() = default; bool operator<(const FallbackFontKey& other) const { @@ -131,8 +134,6 @@ private: std::string locale_; Font font_; - - DISALLOW_ASSIGN(FallbackFontKey); }; class FallbackFontEntry { @@ -152,6 +153,8 @@ font_params_(other.font_params_), charset_(FcCharSetCopy(other.charset_)) {} + FallbackFontEntry& operator=(const FallbackFontEntry&) = delete; + ~FallbackFontEntry() { FcCharSetDestroy(charset_); } const base::FilePath& font_path() const { return font_path_; } @@ -173,8 +176,6 @@ // Font code points coverage. FcCharSet* charset_; - - DISALLOW_ASSIGN(FallbackFontEntry); }; using FallbackFontEntries = std::vector<FallbackFontEntry>;
diff --git a/ui/gfx/font_fallback_unittest.cc b/ui/gfx/font_fallback_unittest.cc index 2d16b025..236ba7c 100644 --- a/ui/gfx/font_fallback_unittest.cc +++ b/ui/gfx/font_fallback_unittest.cc
@@ -58,6 +58,9 @@ public: GetFallbackFontTest() = default; + GetFallbackFontTest(const GetFallbackFontTest&) = delete; + GetFallbackFontTest& operator=(const GetFallbackFontTest&) = delete; + static std::string ParamInfoToString( ::testing::TestParamInfo<FallbackFontTestParamInfo> param_info) { const FallbackFontTestCase& test_case = std::get<0>(param_info.param); @@ -142,8 +145,6 @@ // Needed to bypass DCHECK in GetFallbackFont. base::test::TaskEnvironment task_environment_{ base::test::TaskEnvironment::MainThreadType::UI}; - - DISALLOW_COPY_AND_ASSIGN(GetFallbackFontTest); }; } // namespace
diff --git a/ui/gfx/font_fallback_win.cc b/ui/gfx/font_fallback_win.cc index 4674258..753b511 100644 --- a/ui/gfx/font_fallback_win.cc +++ b/ui/gfx/font_fallback_win.cc
@@ -112,6 +112,9 @@ public: static CachedFontLinkSettings* GetInstance(); + CachedFontLinkSettings(const CachedFontLinkSettings&) = delete; + CachedFontLinkSettings& operator=(const CachedFontLinkSettings&) = delete; + // Returns the linked fonts list correspond to |font|. Returned value will // never be null. const std::vector<Font>* GetLinkedFonts(const Font& font); @@ -127,8 +130,6 @@ // Map from font names to vectors of linked fonts. std::map<std::string, std::vector<Font> > cached_linked_fonts_; - - DISALLOW_COPY_AND_ASSIGN(CachedFontLinkSettings); }; // static
diff --git a/ui/gfx/font_fallback_win_unittest.cc b/ui/gfx/font_fallback_win_unittest.cc index 4d522c4..b3b68b3 100644 --- a/ui/gfx/font_fallback_win_unittest.cc +++ b/ui/gfx/font_fallback_win_unittest.cc
@@ -20,12 +20,13 @@ public: FontFallbackWinTest() = default; + FontFallbackWinTest(const FontFallbackWinTest&) = delete; + FontFallbackWinTest& operator=(const FontFallbackWinTest&) = delete; + private: // Needed to bypass DCHECK in GetFallbackFont. base::test::TaskEnvironment task_environment_{ base::test::TaskEnvironment::MainThreadType::UI}; - - DISALLOW_COPY_AND_ASSIGN(FontFallbackWinTest); }; } // namespace
diff --git a/ui/gfx/font_render_params_win.cc b/ui/gfx/font_render_params_win.cc index de51807..1369f8a 100644 --- a/ui/gfx/font_render_params_win.cc +++ b/ui/gfx/font_render_params_win.cc
@@ -52,6 +52,9 @@ return base::Singleton<CachedFontRenderParams>::get(); } + CachedFontRenderParams(const CachedFontRenderParams&) = delete; + CachedFontRenderParams& operator=(const CachedFontRenderParams&) = delete; + const FontRenderParams& GetParams() { if (params_) return *params_; @@ -98,8 +101,6 @@ std::unique_ptr<FontRenderParams> params_; std::unique_ptr<SingletonHwndObserver> singleton_hwnd_observer_; - - DISALLOW_COPY_AND_ASSIGN(CachedFontRenderParams); }; } // namespace
diff --git a/ui/gfx/font_unittest.cc b/ui/gfx/font_unittest.cc index 63872ad..c71929d 100644 --- a/ui/gfx/font_unittest.cc +++ b/ui/gfx/font_unittest.cc
@@ -24,6 +24,9 @@ public: FontTest() = default; + FontTest(const FontTest&) = delete; + FontTest& operator=(const FontTest&) = delete; + protected: void SetUp() override { #if defined(OS_WIN) @@ -34,9 +37,6 @@ win::ResetSystemFontsForTesting(); #endif } - - private: - DISALLOW_COPY_AND_ASSIGN(FontTest); }; TEST_F(FontTest, DefaultFont) {
diff --git a/ui/gfx/geometry/cubic_bezier.h b/ui/gfx/geometry/cubic_bezier.h index 7b82c94..5709888 100644 --- a/ui/gfx/geometry/cubic_bezier.h +++ b/ui/gfx/geometry/cubic_bezier.h
@@ -17,6 +17,8 @@ CubicBezier(double p1x, double p1y, double p2x, double p2y); CubicBezier(const CubicBezier& other); + CubicBezier& operator=(const CubicBezier&) = delete; + double SampleCurveX(double t) const { // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule. return ((ax_ * t + bx_) * t + cx_) * t; @@ -98,8 +100,6 @@ // may have multiple values for t for some values of x in [0, 1]. bool monotonically_increasing_; #endif - - DISALLOW_ASSIGN(CubicBezier); }; } // namespace gfx
diff --git a/ui/gfx/geometry/mojom/geometry_mojom_traits_unittest.cc b/ui/gfx/geometry/mojom/geometry_mojom_traits_unittest.cc index 380eee8..d2c5959 100644 --- a/ui/gfx/geometry/mojom/geometry_mojom_traits_unittest.cc +++ b/ui/gfx/geometry/mojom/geometry_mojom_traits_unittest.cc
@@ -21,6 +21,9 @@ public: GeometryStructTraitsTest() {} + GeometryStructTraitsTest(const GeometryStructTraitsTest&) = delete; + GeometryStructTraitsTest& operator=(const GeometryStructTraitsTest&) = delete; + protected: mojo::Remote<mojom::GeometryTraitsTestService> GetTraitsTestRemote() { mojo::Remote<mojom::GeometryTraitsTestService> remote; @@ -87,8 +90,6 @@ base::test::TaskEnvironment task_environment_; mojo::ReceiverSet<GeometryTraitsTestService> traits_test_receivers_; - - DISALLOW_COPY_AND_ASSIGN(GeometryStructTraitsTest); }; } // namespace
diff --git a/ui/gfx/icon_util.h b/ui/gfx/icon_util.h index 375baa0..22b2e72 100644 --- a/ui/gfx/icon_util.h +++ b/ui/gfx/icon_util.h
@@ -79,6 +79,11 @@ // The number of elements in kIconDimensions <= kMediumIconSize. static const size_t kNumIconDimensionsUpToMediumSize; + // Prevent clients from instantiating objects of that class. + IconUtil() = delete; + IconUtil(const IconUtil&) = delete; + IconUtil& operator=(const IconUtil&) = delete; + // Given an SkBitmap object, the function converts the bitmap to a Windows // icon and returns the corresponding HICON handle. If the function cannot // convert the bitmap, NULL is returned. @@ -262,10 +267,6 @@ // A helper function of CreateSkBitmapFromHICON. static SkBitmap CreateSkBitmapFromHICONHelper(HICON icon, const gfx::Size& s); - - // Prevent clients from instantiating objects of that class by declaring the - // ctor/dtor as private. - DISALLOW_IMPLICIT_CONSTRUCTORS(IconUtil); }; #endif // UI_GFX_ICON_UTIL_H_
diff --git a/ui/gfx/image/canvas_image_source.cc b/ui/gfx/image/canvas_image_source.cc index a1e3e9b..13274ed 100644 --- a/ui/gfx/image/canvas_image_source.cc +++ b/ui/gfx/image/canvas_image_source.cc
@@ -25,6 +25,9 @@ image_(image), insets_(insets) {} + PaddedImageSource(const PaddedImageSource&) = delete; + PaddedImageSource& operator=(const PaddedImageSource&) = delete; + // CanvasImageSource: void Draw(Canvas* canvas) override { canvas->DrawImageInt(image_, insets_.left(), insets_.top()); @@ -33,8 +36,6 @@ private: const ImageSkia image_; const Insets insets_; - - DISALLOW_COPY_AND_ASSIGN(PaddedImageSource); }; } // namespace
diff --git a/ui/gfx/image/image.cc b/ui/gfx/image/image.cc index f26fdbd..8852ae9 100644 --- a/ui/gfx/image/image.cc +++ b/ui/gfx/image/image.cc
@@ -248,6 +248,9 @@ { } + ImageStorage(const ImageStorage&) = delete; + ImageStorage& operator=(const ImageStorage&) = delete; + Image::RepresentationType default_representation_type() const { DCHECK(IsOnValidSequence()); return default_representation_type_; @@ -317,8 +320,6 @@ // All the representations of an Image. Size will always be at least one, with // more for any converted representations. mutable RepresentationMap representations_; - - DISALLOW_COPY_AND_ASSIGN(ImageStorage); }; } // namespace internal
diff --git a/ui/gfx/image/image_family.h b/ui/gfx/image/image_family.h index 3d0890a4..f874426 100644 --- a/ui/gfx/image/image_family.h +++ b/ui/gfx/image/image_family.h
@@ -99,6 +99,14 @@ ImageFamily(); ImageFamily(ImageFamily&& other); + + // Even though the Images in the family are copyable (reference-counted), the + // family itself should not be implicitly copied, as it would result in a + // shallow clone of the entire map and updates to many reference counts. + // ImageFamily can be explicitly Clone()d, but std::move is preferred. + ImageFamily(const ImageFamily&) = delete; + ImageFamily& operator=(const ImageFamily&) = delete; + ~ImageFamily(); ImageFamily& operator=(ImageFamily&& other); @@ -169,12 +177,6 @@ // Map from (aspect ratio, width) to image. std::map<MapKey, gfx::Image> map_; - - // Even though the Images in the family are copyable (reference-counted), the - // family itself should not be implicitly copied, as it would result in a - // shallow clone of the entire map and updates to many reference counts. - // ImageFamily can be explicitly Clone()d, but std::move is preferred. - DISALLOW_COPY_AND_ASSIGN(ImageFamily); }; } // namespace gfx
diff --git a/ui/gfx/image/image_mac_unittest.mm b/ui/gfx/image/image_mac_unittest.mm index ddb44cd..226b61dc 100644 --- a/ui/gfx/image/image_mac_unittest.mm +++ b/ui/gfx/image/image_mac_unittest.mm
@@ -79,8 +79,8 @@ gfx::ImageSkia::SetSupportedScales(gfx::test::Get1xAnd2xScales()); } - private: - DISALLOW_COPY_AND_ASSIGN(ImageMacTest); + ImageMacTest(const ImageMacTest&) = delete; + ImageMacTest& operator=(const ImageMacTest&) = delete; }; namespace gt = gfx::test;
diff --git a/ui/gfx/image/image_skia.cc b/ui/gfx/image/image_skia.cc index 31dfdf5d..a32df29 100644 --- a/ui/gfx/image/image_skia.cc +++ b/ui/gfx/image/image_skia.cc
@@ -88,6 +88,9 @@ const gfx::Size& size); ImageSkiaStorage(std::unique_ptr<ImageSkiaSource> source, float scale); + ImageSkiaStorage(const ImageSkiaStorage&) = delete; + ImageSkiaStorage& operator=(const ImageSkiaStorage&) = delete; + bool has_source() const { return source_ != nullptr; } std::vector<gfx::ImageSkiaRep>& image_reps() { return image_reps_; } const gfx::Size& size() const { return size_; } @@ -150,8 +153,6 @@ // This isn't using SEQUENCE_CHECKER() macros because we use the sequence // checker outside of DCHECKs to make branching decisions. base::SequenceChecker sequence_checker_; // nocheck - - DISALLOW_COPY_AND_ASSIGN(ImageSkiaStorage); }; ImageSkiaStorage::ImageSkiaStorage(std::unique_ptr<ImageSkiaSource> source,
diff --git a/ui/gfx/image/image_skia_operations.cc b/ui/gfx/image/image_skia_operations.cc index cf62a331..a16a38a2 100644 --- a/ui/gfx/image/image_skia_operations.cc +++ b/ui/gfx/image/image_skia_operations.cc
@@ -64,6 +64,10 @@ second_(second), source_name_(source_name) { } + + BinaryImageSource(const BinaryImageSource&) = delete; + BinaryImageSource& operator=(const BinaryImageSource&) = delete; + ~BinaryImageSource() override {} // gfx::ImageSkiaSource overrides: @@ -107,8 +111,6 @@ // The name of a class that implements the BinaryImageSource. // The subclass is responsible for managing the memory. const char* source_name_; - - DISALLOW_COPY_AND_ASSIGN(BinaryImageSource); }; class BlendingImageSource : public BinaryImageSource {
diff --git a/ui/gfx/image/image_skia_unittest.cc b/ui/gfx/image/image_skia_unittest.cc index 129b0332..12b19b9 100644 --- a/ui/gfx/image/image_skia_unittest.cc +++ b/ui/gfx/image/image_skia_unittest.cc
@@ -110,6 +110,9 @@ can_modify_(false) { } + TestOnThread(const TestOnThread&) = delete; + TestOnThread& operator=(const TestOnThread&) = delete; + void Run() override { can_read_ = image_skia_->CanRead(); can_modify_ = image_skia_->CanModify(); @@ -131,8 +134,6 @@ bool can_read_; bool can_modify_; - - DISALLOW_COPY_AND_ASSIGN(TestOnThread); }; } // namespace test
diff --git a/ui/gfx/linux/native_pixmap_dmabuf.h b/ui/gfx/linux/native_pixmap_dmabuf.h index 208fcbed..86df9e59 100644 --- a/ui/gfx/linux/native_pixmap_dmabuf.h +++ b/ui/gfx/linux/native_pixmap_dmabuf.h
@@ -27,6 +27,9 @@ gfx::BufferFormat format, gfx::NativePixmapHandle handle); + NativePixmapDmaBuf(const NativePixmapDmaBuf&) = delete; + NativePixmapDmaBuf& operator=(const NativePixmapDmaBuf&) = delete; + // NativePixmap: bool AreDmaBufFdsValid() const override; int GetDmaBufFd(size_t plane) const override; @@ -58,8 +61,6 @@ gfx::Size size_; gfx::BufferFormat format_; gfx::NativePixmapHandle handle_; - - DISALLOW_COPY_AND_ASSIGN(NativePixmapDmaBuf); }; } // namespace gfx
diff --git a/ui/gfx/mac/coordinate_conversion_unittest.mm b/ui/gfx/mac/coordinate_conversion_unittest.mm index 348a2ff..23f078a 100644 --- a/ui/gfx/mac/coordinate_conversion_unittest.mm +++ b/ui/gfx/mac/coordinate_conversion_unittest.mm
@@ -36,14 +36,16 @@ public: MacCoordinateConversionTest() {} + MacCoordinateConversionTest(const MacCoordinateConversionTest&) = delete; + MacCoordinateConversionTest& operator=(const MacCoordinateConversionTest&) = + delete; + // Overridden from testing::Test: void SetUp() override; void TearDown() override; private: std::unique_ptr<base::mac::ScopedObjCClassSwizzler> swizzle_frame_; - - DISALLOW_COPY_AND_ASSIGN(MacCoordinateConversionTest); }; void MacCoordinateConversionTest::SetUp() {
diff --git a/ui/gfx/mac/display_icc_profiles.h b/ui/gfx/mac/display_icc_profiles.h index 371f6e4b..565bb0c 100644 --- a/ui/gfx/mac/display_icc_profiles.h +++ b/ui/gfx/mac/display_icc_profiles.h
@@ -33,6 +33,9 @@ public: static DisplayICCProfiles* GetInstance(); + DisplayICCProfiles(const DisplayICCProfiles&) = delete; + DisplayICCProfiles& operator=(const DisplayICCProfiles&) = delete; + // This will return null if |color_space| does not correspond to a display. base::ScopedCFTypeRef<CFDataRef> GetDataForColorSpace( const ColorSpace& color_space); @@ -51,7 +54,6 @@ base::flat_map<ColorSpace, base::ScopedCFTypeRef<CFDataRef>> map_; bool needs_update_ = true; - DISALLOW_COPY_AND_ASSIGN(DisplayICCProfiles); }; } // namespace gfx
diff --git a/ui/gfx/mojom/mojom_traits_unittest.cc b/ui/gfx/mojom/mojom_traits_unittest.cc index 78479528..96fb0ca5 100644 --- a/ui/gfx/mojom/mojom_traits_unittest.cc +++ b/ui/gfx/mojom/mojom_traits_unittest.cc
@@ -36,6 +36,9 @@ public: StructTraitsTest() {} + StructTraitsTest(const StructTraitsTest&) = delete; + StructTraitsTest& operator=(const StructTraitsTest&) = delete; + protected: mojo::Remote<mojom::TraitsTestService> GetTraitsTestRemote() { mojo::Remote<mojom::TraitsTestService> remote; @@ -67,8 +70,6 @@ base::test::TaskEnvironment task_environment_; mojo::ReceiverSet<TraitsTestService> traits_test_receivers_; - - DISALLOW_COPY_AND_ASSIGN(StructTraitsTest); }; } // namespace
diff --git a/ui/gfx/native_pixmap.h b/ui/gfx/native_pixmap.h index f40d753..04132d5 100644 --- a/ui/gfx/native_pixmap.h +++ b/ui/gfx/native_pixmap.h
@@ -26,6 +26,9 @@ public: NativePixmap() {} + NativePixmap(const NativePixmap&) = delete; + NativePixmap& operator=(const NativePixmap&) = delete; + virtual bool AreDmaBufFdsValid() const = 0; virtual int GetDmaBufFd(size_t plane) const = 0; virtual uint32_t GetDmaBufPitch(size_t plane) const = 0; @@ -89,8 +92,6 @@ private: friend class base::RefCountedThreadSafe<NativePixmap>; - - DISALLOW_COPY_AND_ASSIGN(NativePixmap); }; } // namespace gfx
diff --git a/ui/gfx/paint_vector_icon_unittest.cc b/ui/gfx/paint_vector_icon_unittest.cc index 773d960..ff7bd2e 100644 --- a/ui/gfx/paint_vector_icon_unittest.cc +++ b/ui/gfx/paint_vector_icon_unittest.cc
@@ -28,6 +28,9 @@ public: MockCanvas(int width, int height) : SkCanvas(width, height) {} + MockCanvas(const MockCanvas&) = delete; + MockCanvas& operator=(const MockCanvas&) = delete; + // SkCanvas overrides: void onDrawPath(const SkPath& path, const SkPaint& paint) override { paths_.push_back(path); @@ -37,8 +40,6 @@ private: std::vector<SkPath> paths_; - - DISALLOW_COPY_AND_ASSIGN(MockCanvas); }; // Tests that a relative move to command (R_MOVE_TO) after a close command
diff --git a/ui/gfx/platform_font_ios.h b/ui/gfx/platform_font_ios.h index 0308622..70af745 100644 --- a/ui/gfx/platform_font_ios.h +++ b/ui/gfx/platform_font_ios.h
@@ -17,6 +17,9 @@ PlatformFontIOS(const std::string& font_name, int font_size); + PlatformFontIOS(const PlatformFontIOS&) = delete; + PlatformFontIOS& operator=(const PlatformFontIOS&) = delete; + // Overridden from PlatformFont: Font DeriveFont(int size_delta, int style, @@ -60,8 +63,6 @@ int ascent_; int cap_height_; int average_width_; - - DISALLOW_COPY_AND_ASSIGN(PlatformFontIOS); }; } // namespace gfx
diff --git a/ui/gfx/platform_font_mac.h b/ui/gfx/platform_font_mac.h index baf3ea96..b4e09f61 100644 --- a/ui/gfx/platform_font_mac.h +++ b/ui/gfx/platform_font_mac.h
@@ -45,6 +45,9 @@ int font_size_pixels, const absl::optional<FontRenderParams>& params); + PlatformFontMac(const PlatformFontMac&) = delete; + PlatformFontMac& operator=(const PlatformFontMac&) = delete; + // Overridden from PlatformFont: Font DeriveFont(int size_delta, int style, @@ -111,8 +114,6 @@ // Details about how the font should be rendered. FontRenderParams render_params_; - - DISALLOW_COPY_AND_ASSIGN(PlatformFontMac); }; } // namespace gfx
diff --git a/ui/gfx/platform_font_skia.h b/ui/gfx/platform_font_skia.h index 3a1643ae..7a92f59 100644 --- a/ui/gfx/platform_font_skia.h +++ b/ui/gfx/platform_font_skia.h
@@ -30,6 +30,9 @@ int font_size_pixels, const absl::optional<FontRenderParams>& params); + PlatformFontSkia(const PlatformFontSkia&) = delete; + PlatformFontSkia& operator=(const PlatformFontSkia&) = delete; + // Initials the default PlatformFont. Returns true if this is successful, or // false if fonts resources are not available. If this returns false, the // calling service should shut down. @@ -111,8 +114,6 @@ // A font description string of the format used by FontList. static std::string* default_font_description_; - - DISALLOW_COPY_AND_ASSIGN(PlatformFontSkia); }; } // namespace gfx
diff --git a/ui/gfx/range/mojom/range_mojom_traits_unittest.cc b/ui/gfx/range/mojom/range_mojom_traits_unittest.cc index 26976d2..ba49cb8 100644 --- a/ui/gfx/range/mojom/range_mojom_traits_unittest.cc +++ b/ui/gfx/range/mojom/range_mojom_traits_unittest.cc
@@ -19,6 +19,9 @@ public: RangeStructTraitsTest() {} + RangeStructTraitsTest(const RangeStructTraitsTest&) = delete; + RangeStructTraitsTest& operator=(const RangeStructTraitsTest&) = delete; + protected: mojo::Remote<mojom::RangeTraitsTestService> GetTraitsTestRemote() { mojo::Remote<mojom::RangeTraitsTestService> remote; @@ -38,8 +41,6 @@ base::test::TaskEnvironment task_environment_; mojo::ReceiverSet<RangeTraitsTestService> traits_test_receivers_; - - DISALLOW_COPY_AND_ASSIGN(RangeStructTraitsTest); }; } // namespace
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc index afefce2..e378c6c6 100644 --- a/ui/gfx/render_text_harfbuzz.cc +++ b/ui/gfx/render_text_harfbuzz.cc
@@ -429,6 +429,9 @@ AdvanceLine(); } + HarfBuzzLineBreaker(const HarfBuzzLineBreaker&) = delete; + HarfBuzzLineBreaker& operator=(const HarfBuzzLineBreaker&) = delete; + // Constructs a single line for |text_| using |run_list_|. void ConstructSingleLine() { for (size_t i = 0; i < run_list_.size(); i++) { @@ -760,8 +763,6 @@ // The current RTL run segments, to be applied by |UpdateRTLSegmentRanges()|. std::vector<SegmentHandle> rtl_segments_; - - DISALLOW_COPY_AND_ASSIGN(HarfBuzzLineBreaker); }; // Applies a forced text rendering direction if specified by a command-line
diff --git a/ui/gfx/render_text_harfbuzz.h b/ui/gfx/render_text_harfbuzz.h index 4f8ac47..64a823d 100644 --- a/ui/gfx/render_text_harfbuzz.h +++ b/ui/gfx/render_text_harfbuzz.h
@@ -33,6 +33,10 @@ // Construct the run with |template_font| since determining the details of a // default-constructed gfx::Font is expensive, but it will always be replaced. explicit TextRunHarfBuzz(const Font& template_font); + + TextRunHarfBuzz(const TextRunHarfBuzz&) = delete; + TextRunHarfBuzz& operator=(const TextRunHarfBuzz&) = delete; + ~TextRunHarfBuzz(); // Returns the corresponding glyph range of the given character range. @@ -142,9 +146,6 @@ FontParams font_params; ShapeOutput shape; float preceding_run_widths = 0.0; - - private: - DISALLOW_COPY_AND_ASSIGN(TextRunHarfBuzz); }; // Manages the list of TextRunHarfBuzz and its logical <-> visual index mapping.
diff --git a/ui/gfx/render_text_test_api.h b/ui/gfx/render_text_test_api.h index b794efb..e7a7b33f 100644 --- a/ui/gfx/render_text_test_api.h +++ b/ui/gfx/render_text_test_api.h
@@ -18,6 +18,9 @@ public: RenderTextTestApi(RenderText* render_text) : render_text_(render_text) {} + RenderTextTestApi(const RenderTextTestApi&) = delete; + RenderTextTestApi& operator=(const RenderTextTestApi&) = delete; + static const cc::PaintFlags& GetRendererPaint( internal::SkiaTextRenderer* renderer) { return renderer->flags_; @@ -118,8 +121,6 @@ private: RenderText* render_text_; - - DISALLOW_COPY_AND_ASSIGN(RenderTextTestApi); }; } // namespace test
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc index a4fa898..629bb25d 100644 --- a/ui/gfx/render_text_unittest.cc +++ b/ui/gfx/render_text_unittest.cc
@@ -378,6 +378,9 @@ stride_(stride), row_count_(row_count) {} + TestRectangleBuffer(const TestRectangleBuffer&) = delete; + TestRectangleBuffer& operator=(const TestRectangleBuffer&) = delete; + // Test if any values in the rectangular area are anything other than |color|. void EnsureSolidRect(SkColor color, int left, @@ -413,8 +416,6 @@ const SkColor* buffer_; int stride_; int row_count_; - - DISALLOW_COPY_AND_ASSIGN(TestRectangleBuffer); }; } // namespace @@ -430,6 +431,9 @@ test_api_(new test::RenderTextTestApi(render_text_.get())), renderer_(canvas()) {} + RenderTextTest(const RenderTextTest&) = delete; + RenderTextTest& operator=(const RenderTextTest&) = delete; + protected: const cc::PaintFlags& GetRendererPaint() { return test::RenderTextTestApi::GetRendererPaint(renderer()); @@ -658,8 +662,6 @@ std::vector<TextLog> text_log_; Canvas canvas_; TestSkiaTextRenderer renderer_; - - DISALLOW_COPY_AND_ASSIGN(RenderTextTest); }; TEST_F(RenderTextTest, DefaultStyles) {
diff --git a/ui/gfx/system_fonts_win.cc b/ui/gfx/system_fonts_win.cc index ffb7a543..0ed4445 100644 --- a/ui/gfx/system_fonts_win.cc +++ b/ui/gfx/system_fonts_win.cc
@@ -39,6 +39,9 @@ return instance.get(); } + SystemFonts(const SystemFonts&) = delete; + SystemFonts& operator=(const SystemFonts&) = delete; + void ResetForTesting() { SystemFonts::is_initialized_ = false; SystemFonts::adjust_font_callback_ = nullptr; @@ -232,8 +235,6 @@ // Minimum size callback. static GetMinimumFontSizeCallback get_minimum_font_size_callback_; - - DISALLOW_COPY_AND_ASSIGN(SystemFonts); }; // static
diff --git a/ui/gfx/system_fonts_win_unittest.cc b/ui/gfx/system_fonts_win_unittest.cc index 77559e2..9e736b9 100644 --- a/ui/gfx/system_fonts_win_unittest.cc +++ b/ui/gfx/system_fonts_win_unittest.cc
@@ -19,6 +19,9 @@ public: SystemFontsWinTest() = default; + SystemFontsWinTest(const SystemFontsWinTest&) = delete; + SystemFontsWinTest& operator=(const SystemFontsWinTest&) = delete; + protected: void SetUp() override { #if defined(OS_WIN) @@ -29,9 +32,6 @@ win::ResetSystemFontsForTesting(); #endif } - - private: - DISALLOW_COPY_AND_ASSIGN(SystemFontsWinTest); }; LOGFONT CreateLOGFONT(const wchar_t* name, LONG height) {
diff --git a/ui/gfx/test/run_all_unittests.cc b/ui/gfx/test/run_all_unittests.cc index aa8b9eb2..e0b546da 100644 --- a/ui/gfx/test/run_all_unittests.cc +++ b/ui/gfx/test/run_all_unittests.cc
@@ -34,6 +34,9 @@ GfxTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) { } + GfxTestSuite(const GfxTestSuite&) = delete; + GfxTestSuite& operator=(const GfxTestSuite&) = delete; + protected: void Initialize() override { base::TestSuite::Initialize(); @@ -68,8 +71,6 @@ private: base::TestDiscardableMemoryAllocator discardable_memory_allocator; - - DISALLOW_COPY_AND_ASSIGN(GfxTestSuite); }; } // namespace
diff --git a/ui/gfx/text_elider.cc b/ui/gfx/text_elider.cc index 01b0d8d..211da2e1 100644 --- a/ui/gfx/text_elider.cc +++ b/ui/gfx/text_elider.cc
@@ -337,6 +337,9 @@ suppressed_(false), output_(output) {} + RectangleString(const RectangleString&) = delete; + RectangleString& operator=(const RectangleString&) = delete; + // Perform deferred initializations following creation. Must be called // before any input can be added via AddString(). void Init() { output_->clear(); } @@ -395,8 +398,6 @@ // String onto which the output is accumulated. std::u16string* output_; - - DISALLOW_COPY_AND_ASSIGN(RectangleString); }; void RectangleString::AddString(const std::u16string& input) { @@ -498,6 +499,9 @@ wrap_behavior_(wrap_behavior), lines_(lines) {} + RectangleText(const RectangleText&) = delete; + RectangleText& operator=(const RectangleText&) = delete; + // Perform deferred initializations following creation. Must be called // before any input can be added via AddString(). void Init() { lines_->clear(); } @@ -578,8 +582,6 @@ // Indicates whether the very first word was truncated. bool first_word_truncated_ = false; - - DISALLOW_COPY_AND_ASSIGN(RectangleText); }; void RectangleText::AddString(const std::u16string& input) {
diff --git a/ui/gfx/text_elider.h b/ui/gfx/text_elider.h index c3774db..200ad046 100644 --- a/ui/gfx/text_elider.h +++ b/ui/gfx/text_elider.h
@@ -46,6 +46,9 @@ bool elide_at_beginning, absl::optional<bool> elide_whitespace = absl::nullopt); + StringSlicer(const StringSlicer&) = delete; + StringSlicer& operator=(const StringSlicer&) = delete; + // Cuts |text_| to be at most |length| UTF-16 code units long. If // |elide_in_middle_| is true, the middle of the string is removed to leave // equal-length pieces from the beginning and end of the string; otherwise, @@ -72,8 +75,6 @@ // How whitespace around an elision point is handled. const bool elide_whitespace_; - - DISALLOW_COPY_AND_ASSIGN(StringSlicer); }; // Elides |text| to fit the |available_pixel_width| with the specified behavior.
diff --git a/ui/gfx/vector_icon_types.h b/ui/gfx/vector_icon_types.h index 6dc9842..d4ffcdd 100644 --- a/ui/gfx/vector_icon_types.h +++ b/ui/gfx/vector_icon_types.h
@@ -88,13 +88,13 @@ struct VectorIconRep { VectorIconRep() = default; + VectorIconRep(const VectorIconRep&) = delete; + VectorIconRep& operator=(const VectorIconRep&) = delete; + const PathElement* path = nullptr; // The length of |path|. size_t path_size = 0u; - - private: - DISALLOW_COPY_AND_ASSIGN(VectorIconRep); }; // A vector icon that stores one or more representations to be used for various @@ -102,6 +102,9 @@ struct VectorIcon { VectorIcon() = default; + VectorIcon(const VectorIcon&) = delete; + VectorIcon& operator=(const VectorIcon&) = delete; + bool is_empty() const { return !reps; } const VectorIconRep* const reps = nullptr; @@ -113,9 +116,6 @@ const char* name = nullptr; bool operator<(const VectorIcon& other) const; - - private: - DISALLOW_COPY_AND_ASSIGN(VectorIcon); }; } // namespace gfx
diff --git a/ui/gfx/win/crash_id_helper.h b/ui/gfx/win/crash_id_helper.h index c3c57c9..649e203 100644 --- a/ui/gfx/win/crash_id_helper.h +++ b/ui/gfx/win/crash_id_helper.h
@@ -32,6 +32,9 @@ public: static CrashIdHelper* Get(); + CrashIdHelper(const CrashIdHelper&) = delete; + CrashIdHelper& operator=(const CrashIdHelper&) = delete; + // Registers the thread used for logging. static void RegisterMainThread(base::PlatformThreadId thread_id); @@ -80,8 +83,6 @@ crash_reporter::CrashKeyString<128> debugging_crash_key_{"widget-id"}; static base::PlatformThreadId main_thread_id_; - - DISALLOW_COPY_AND_ASSIGN(CrashIdHelper); }; } // namespace gfx
diff --git a/ui/gfx/win/rendering_window_manager.h b/ui/gfx/win/rendering_window_manager.h index 720820f..dd729b1 100644 --- a/ui/gfx/win/rendering_window_manager.h +++ b/ui/gfx/win/rendering_window_manager.h
@@ -26,6 +26,9 @@ // The first call to GetInstance() should happen on the UI thread. static RenderingWindowManager* GetInstance(); + RenderingWindowManager(const RenderingWindowManager&) = delete; + RenderingWindowManager& operator=(const RenderingWindowManager&) = delete; + void RegisterParent(HWND parent); // Registers |child| as child window for |parent|. Allows the GPU process to // draw into the |child| HWND instead of |parent|. This will fail and do @@ -43,8 +46,6 @@ friend class base::NoDestructor<RenderingWindowManager>; RenderingWindowManager(); - RenderingWindowManager(const RenderingWindowManager&) = delete; - RenderingWindowManager& operator=(const RenderingWindowManager&) = delete; ~RenderingWindowManager(); // UI thread task runner.
diff --git a/ui/gfx/win/singleton_hwnd.h b/ui/gfx/win/singleton_hwnd.h index d987f31..36daf552 100644 --- a/ui/gfx/win/singleton_hwnd.h +++ b/ui/gfx/win/singleton_hwnd.h
@@ -26,6 +26,9 @@ public: static SingletonHwnd* GetInstance(); + SingletonHwnd(const SingletonHwnd&) = delete; + SingletonHwnd& operator=(const SingletonHwnd&) = delete; + // Windows callback for WM_* notifications. BOOL ProcessWindowMessage(HWND window, UINT message, @@ -47,8 +50,6 @@ // List of registered observers. base::ObserverList<SingletonHwndObserver, true>::Unchecked observer_list_; - - DISALLOW_COPY_AND_ASSIGN(SingletonHwnd); }; } // namespace gfx
diff --git a/ui/gfx/win/text_analysis_source.h b/ui/gfx/win/text_analysis_source.h index 4d3723fc..93ce417 100644 --- a/ui/gfx/win/text_analysis_source.h +++ b/ui/gfx/win/text_analysis_source.h
@@ -36,6 +36,9 @@ // are an error - it is only public because a WRL helper function creates the // objects. TextAnalysisSource(); + + TextAnalysisSource& operator=(const TextAnalysisSource&) = delete; + // IDWriteTextAnalysisSource: HRESULT STDMETHODCALLTYPE GetLocaleName(UINT32 text_position, UINT32* text_length, @@ -67,8 +70,6 @@ std::wstring locale_name_; Microsoft::WRL::ComPtr<IDWriteNumberSubstitution> number_substitution_; DWRITE_READING_DIRECTION reading_direction_; - - DISALLOW_ASSIGN(TextAnalysisSource); }; } // namespace win
diff --git a/ui/gfx/win/text_analysis_source_unittest.cc b/ui/gfx/win/text_analysis_source_unittest.cc index ed77d2d..78862180 100644 --- a/ui/gfx/win/text_analysis_source_unittest.cc +++ b/ui/gfx/win/text_analysis_source_unittest.cc
@@ -37,11 +37,11 @@ number_substitution.Get(), kReadingDirection); } + TextAnalysisSourceTest(const TextAnalysisSourceTest&) = delete; + TextAnalysisSourceTest& operator=(const TextAnalysisSourceTest&) = delete; + protected: mswr::ComPtr<IDWriteTextAnalysisSource> source_; - - private: - DISALLOW_COPY_AND_ASSIGN(TextAnalysisSourceTest); }; TEST_F(TextAnalysisSourceTest, TestGetLocaleName) {
diff --git a/ui/gfx/x/x11_atom_cache.h b/ui/gfx/x/x11_atom_cache.h index 851fe884..063b4387 100644 --- a/ui/gfx/x/x11_atom_cache.h +++ b/ui/gfx/x/x11_atom_cache.h
@@ -34,6 +34,9 @@ public: static X11AtomCache* GetInstance(); + X11AtomCache(const X11AtomCache&) = delete; + X11AtomCache& operator=(const X11AtomCache&) = delete; + private: friend Atom GetAtom(const std::string& atom_name); friend struct base::DefaultSingletonTraits<X11AtomCache>; @@ -49,8 +52,6 @@ // Using std::map, as it is possible for thousands of atoms to be registered. mutable std::map<std::string, Atom> cached_atoms_; - - DISALLOW_COPY_AND_ASSIGN(X11AtomCache); }; } // namespace x11
diff --git a/ui/gfx/x/x11_window_event_manager.h b/ui/gfx/x/x11_window_event_manager.h index 46faa04..50e5855b 100644 --- a/ui/gfx/x/x11_window_event_manager.h +++ b/ui/gfx/x/x11_window_event_manager.h
@@ -43,6 +43,9 @@ public: static XWindowEventManager* GetInstance(); + XWindowEventManager(const XWindowEventManager&) = delete; + XWindowEventManager& operator=(const XWindowEventManager&) = delete; + private: friend struct base::DefaultSingletonTraits<XWindowEventManager>; friend class XScopedEventSelector; @@ -70,8 +73,6 @@ // destroyed before any XScopedEventSelector, the |event_manager_| will become // invalidated. base::WeakPtrFactory<XWindowEventManager> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(XWindowEventManager); }; } // namespace x11
diff --git a/ui/gl/android/surface_texture.h b/ui/gl/android/surface_texture.h index b2ad7af..2600a53 100644 --- a/ui/gl/android/surface_texture.h +++ b/ui/gl/android/surface_texture.h
@@ -24,6 +24,9 @@ public: static scoped_refptr<SurfaceTexture> Create(int texture_id); + SurfaceTexture(const SurfaceTexture&) = delete; + SurfaceTexture& operator=(const SurfaceTexture&) = delete; + // Set the listener callback, which will be invoked on the same thread that // is being called from here for registration. // Note: Since callbacks come in from Java objects that might outlive objects @@ -80,8 +83,6 @@ // Java SurfaceTexture instance. base::android::ScopedJavaGlobalRef<jobject> j_surface_texture_; - - DISALLOW_COPY_AND_ASSIGN(SurfaceTexture); }; } // namespace gl
diff --git a/ui/gl/android/surface_texture_listener.h b/ui/gl/android/surface_texture_listener.h index bedfb33..875caca 100644 --- a/ui/gl/android/surface_texture_listener.h +++ b/ui/gl/android/surface_texture_listener.h
@@ -23,6 +23,10 @@ // Listener class for all the callbacks from android SurfaceTexture. class GL_EXPORT SurfaceTextureListener { public: + SurfaceTextureListener() = delete; + SurfaceTextureListener(const SurfaceTextureListener&) = delete; + SurfaceTextureListener& operator=(const SurfaceTextureListener&) = delete; + // Destroy this listener. void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); @@ -48,8 +52,6 @@ scoped_refptr<base::SingleThreadTaskRunner> browser_loop_; bool use_any_thread_; - - DISALLOW_IMPLICIT_CONSTRUCTORS(SurfaceTextureListener); }; } // namespace gl
diff --git a/ui/gl/direct_composition_child_surface_win.h b/ui/gl/direct_composition_child_surface_win.h index 9240ae2..daf0432 100644 --- a/ui/gl/direct_composition_child_surface_win.h +++ b/ui/gl/direct_composition_child_surface_win.h
@@ -37,6 +37,11 @@ bool force_full_damage, bool force_full_damage_always); + DirectCompositionChildSurfaceWin(const DirectCompositionChildSurfaceWin&) = + delete; + DirectCompositionChildSurfaceWin& operator=( + const DirectCompositionChildSurfaceWin&) = delete; + // GLSurfaceEGL implementation. bool Initialize(GLSurfaceFormat format) override; void Destroy() override; @@ -159,8 +164,6 @@ base::TimeDelta last_vsync_interval_; base::WeakPtrFactory<DirectCompositionChildSurfaceWin> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(DirectCompositionChildSurfaceWin); }; } // namespace gl
diff --git a/ui/gl/direct_composition_surface_win.h b/ui/gl/direct_composition_surface_win.h index 219e3e6..d3885c0 100644 --- a/ui/gl/direct_composition_surface_win.h +++ b/ui/gl/direct_composition_surface_win.h
@@ -53,6 +53,10 @@ VSyncCallback vsync_callback, const DirectCompositionSurfaceWin::Settings& settings); + DirectCompositionSurfaceWin(const DirectCompositionSurfaceWin&) = delete; + DirectCompositionSurfaceWin& operator=(const DirectCompositionSurfaceWin&) = + delete; + // Returns true if direct composition is supported. We prefer to use direct // composition even without hardware overlays, because it allows us to bypass // blitting by DWM to the window redirection surface by using a flip mode swap @@ -216,8 +220,6 @@ Microsoft::WRL::ComPtr<ID3D11Device> d3d11_device_; Microsoft::WRL::ComPtr<IDCompositionDevice2> dcomp_device_; - - DISALLOW_COPY_AND_ASSIGN(DirectCompositionSurfaceWin); }; } // namespace gl
diff --git a/ui/gl/dual_gpu_state.h b/ui/gl/dual_gpu_state.h index 98b7192..c9da6bb 100644 --- a/ui/gl/dual_gpu_state.h +++ b/ui/gl/dual_gpu_state.h
@@ -15,6 +15,9 @@ class GL_EXPORT DualGPUState { public: + DualGPUState(const DualGPUState&) = delete; + DualGPUState& operator=(const DualGPUState&) = delete; + void RegisterHighPerformanceContext(GLContext* context); void RemoveHighPerformanceContext(GLContext* context); @@ -29,8 +32,6 @@ virtual void CancelDelayedSwitchToLowPowerGPU() = 0; base::flat_set<GLContext*> contexts_; - - DISALLOW_COPY_AND_ASSIGN(DualGPUState); }; } // namespace gl
diff --git a/ui/gl/dual_gpu_state_mac.h b/ui/gl/dual_gpu_state_mac.h index 72848ef..85fba0e 100644 --- a/ui/gl/dual_gpu_state_mac.h +++ b/ui/gl/dual_gpu_state_mac.h
@@ -24,6 +24,9 @@ public: static DualGPUStateMac* GetInstance(); + DualGPUStateMac(const DualGPUStateMac&) = delete; + DualGPUStateMac& operator=(const DualGPUStateMac&) = delete; + private: friend base::NoDestructor<DualGPUStateMac>; @@ -40,8 +43,6 @@ CGLPixelFormatObj discrete_pixelformat_ = nullptr; base::CancelableOnceClosure cancelable_delay_callback_; - - DISALLOW_COPY_AND_ASSIGN(DualGPUStateMac); }; } // namespace gl
diff --git a/ui/gl/gl_context.h b/ui/gl/gl_context.h index 09c57f3..3fe89479 100644 --- a/ui/gl/gl_context.h +++ b/ui/gl/gl_context.h
@@ -114,6 +114,9 @@ public: explicit GLContext(GLShareGroup* share_group); + GLContext(const GLContext&) = delete; + GLContext& operator=(const GLContext&) = delete; + static int32_t TotalGLContexts(); static bool SwitchableGPUsSupported(); @@ -337,13 +340,15 @@ std::map<uint64_t, std::unique_ptr<GLFence>> backpressure_fences_; uint64_t next_backpressure_fence_ = 0; #endif - - DISALLOW_COPY_AND_ASSIGN(GLContext); }; class GL_EXPORT GLContextReal : public GLContext { public: explicit GLContextReal(GLShareGroup* share_group); + + GLContextReal(const GLContextReal&) = delete; + GLContextReal& operator=(const GLContextReal&) = delete; + scoped_refptr<GPUTimingClient> CreateGPUTimingClient() override; const gfx::ExtensionSet& GetExtensions() override; @@ -361,7 +366,6 @@ std::string extensions_string_; gfx::ExtensionSet extensions_; bool extensions_initialized_ = false; - DISALLOW_COPY_AND_ASSIGN(GLContextReal); }; // Wraps GLContext in scoped_refptr and tries to initializes it. Returns a
diff --git a/ui/gl/gl_context_cgl.h b/ui/gl/gl_context_cgl.h index de70cd9..40c54d6 100644 --- a/ui/gl/gl_context_cgl.h +++ b/ui/gl/gl_context_cgl.h
@@ -23,6 +23,9 @@ public: explicit GLContextCGL(GLShareGroup* share_group); + GLContextCGL(const GLContextCGL&) = delete; + GLContextCGL& operator=(const GLContextCGL&) = delete; + // Implement GLContext. bool Initialize(GLSurface* compatible_surface, const GLContextAttribs& attribs) override; @@ -55,8 +58,6 @@ // Debugging for https://crbug.com/863817 bool has_switched_gpus_ = false; - - DISALLOW_COPY_AND_ASSIGN(GLContextCGL); }; } // namespace gl
diff --git a/ui/gl/gl_context_egl.h b/ui/gl/gl_context_egl.h index 5d2d0507..44b744b 100644 --- a/ui/gl/gl_context_egl.h +++ b/ui/gl/gl_context_egl.h
@@ -25,6 +25,9 @@ public: explicit GLContextEGL(GLShareGroup* share_group); + GLContextEGL(const GLContextEGL&) = delete; + GLContextEGL& operator=(const GLContextEGL&) = delete; + // Implement GLContext. bool Initialize(GLSurface* compatible_surface, const GLContextAttribs& attribs) override; @@ -53,8 +56,6 @@ bool lost_ = false; std::map<gfx::ColorSpace, std::unique_ptr<YUVToRGBConverter>> yuv_to_rgb_converters_; - - DISALLOW_COPY_AND_ASSIGN(GLContextEGL); }; } // namespace gl
diff --git a/ui/gl/gl_context_glx.h b/ui/gl/gl_context_glx.h index cad557a..8c16e1e 100644 --- a/ui/gl/gl_context_glx.h +++ b/ui/gl/gl_context_glx.h
@@ -21,6 +21,9 @@ public: explicit GLContextGLX(GLShareGroup* share_group); + GLContextGLX(const GLContextGLX&) = delete; + GLContextGLX& operator=(const GLContextGLX&) = delete; + // Implement GLContext. bool Initialize(GLSurface* compatible_surface, const GLContextAttribs& attribs) override; @@ -39,8 +42,6 @@ void* context_ = nullptr; x11::Connection* connection_ = nullptr; unsigned int graphics_reset_status_ = 0; // GL_NO_ERROR - - DISALLOW_COPY_AND_ASSIGN(GLContextGLX); }; } // namespace gl
diff --git a/ui/gl/gl_context_stub.h b/ui/gl/gl_context_stub.h index f3cfa8f7..1ff781f 100644 --- a/ui/gl/gl_context_stub.h +++ b/ui/gl/gl_context_stub.h
@@ -20,6 +20,9 @@ GLContextStub(); explicit GLContextStub(GLShareGroup* share_group); + GLContextStub(const GLContextStub&) = delete; + GLContextStub& operator=(const GLContextStub&) = delete; + // Implement GLContext. bool Initialize(GLSurface* compatible_surface, const GLContextAttribs& attribs) override; @@ -49,8 +52,6 @@ bool use_stub_api_; std::string version_str_; unsigned int graphics_reset_status_ = 0; // GL_NO_ERROR - - DISALLOW_COPY_AND_ASSIGN(GLContextStub); }; } // namespace gl
diff --git a/ui/gl/gl_image.h b/ui/gl/gl_image.h index 228951e..25555c5 100644 --- a/ui/gl/gl_image.h +++ b/ui/gl/gl_image.h
@@ -53,6 +53,9 @@ public: GLImage() = default; + GLImage(const GLImage&) = delete; + GLImage& operator=(const GLImage&) = delete; + // Get the size of the image. virtual gfx::Size GetSize(); @@ -174,8 +177,6 @@ private: friend class base::RefCounted<GLImage>; - - DISALLOW_COPY_AND_ASSIGN(GLImage); }; } // namespace gl
diff --git a/ui/gl/gl_image_ahardwarebuffer.h b/ui/gl/gl_image_ahardwarebuffer.h index 50c609e..15b212a 100644 --- a/ui/gl/gl_image_ahardwarebuffer.h +++ b/ui/gl/gl_image_ahardwarebuffer.h
@@ -25,6 +25,9 @@ public: explicit GLImageAHardwareBuffer(const gfx::Size& size); + GLImageAHardwareBuffer(const GLImageAHardwareBuffer&) = delete; + GLImageAHardwareBuffer& operator=(const GLImageAHardwareBuffer&) = delete; + // Create an EGLImage from a given Android hardware buffer. bool Initialize(AHardwareBuffer* buffer, bool preserved); @@ -59,8 +62,6 @@ base::android::ScopedHardwareBufferHandle handle_; unsigned internal_format_ = GL_RGBA; unsigned data_type_ = GL_UNSIGNED_BYTE; - - DISALLOW_COPY_AND_ASSIGN(GLImageAHardwareBuffer); }; } // namespace gl
diff --git a/ui/gl/gl_image_d3d.h b/ui/gl/gl_image_d3d.h index fba31d13..e7c2581 100644 --- a/ui/gl/gl_image_d3d.h +++ b/ui/gl/gl_image_d3d.h
@@ -36,6 +36,9 @@ size_t plane_index = 0, Microsoft::WRL::ComPtr<IDXGISwapChain1> swap_chain = nullptr); + GLImageD3D(const GLImageD3D&) = delete; + GLImageD3D& operator=(const GLImageD3D&) = delete; + // Safe downcast. Returns nullptr on failure. static GLImageD3D* FromGLImage(GLImage* image); @@ -91,8 +94,6 @@ ~GLImageD3D() override; void* egl_image_ = nullptr; // EGLImageKHR - - DISALLOW_COPY_AND_ASSIGN(GLImageD3D); }; } // namespace gl
diff --git a/ui/gl/gl_image_egl.h b/ui/gl/gl_image_egl.h index 18d59d4..4184e7cd 100644 --- a/ui/gl/gl_image_egl.h +++ b/ui/gl/gl_image_egl.h
@@ -19,6 +19,9 @@ public: explicit GLImageEGL(const gfx::Size& size); + GLImageEGL(const GLImageEGL&) = delete; + GLImageEGL& operator=(const GLImageEGL&) = delete; + // Overridden from GLImage: gfx::Size GetSize() override; BindOrCopy ShouldBindOrCopy() override; @@ -47,9 +50,6 @@ void* egl_image_ /* EGLImageKHR */; const gfx::Size size_; base::ThreadChecker thread_checker_; - - private: - DISALLOW_COPY_AND_ASSIGN(GLImageEGL); }; } // namespace gl
diff --git a/ui/gl/gl_image_egl_pixmap.h b/ui/gl/gl_image_egl_pixmap.h index 24205d6..ff00b70 100644 --- a/ui/gl/gl_image_egl_pixmap.h +++ b/ui/gl/gl_image_egl_pixmap.h
@@ -22,6 +22,9 @@ public: GLImageEGLPixmap(const gfx::Size& size, gfx::BufferFormat format); + GLImageEGLPixmap(const GLImageEGLPixmap&) = delete; + GLImageEGLPixmap& operator=(const GLImageEGLPixmap&) = delete; + bool Initialize(x11::Pixmap pixmap); // Overridden from GLImage: @@ -46,8 +49,6 @@ const gfx::Size size_; gfx::BufferFormat format_; EGLDisplay display_; - - DISALLOW_COPY_AND_ASSIGN(GLImageEGLPixmap); }; } // namespace gl
diff --git a/ui/gl/gl_image_glx.h b/ui/gl/gl_image_glx.h index f97b786..1255330 100644 --- a/ui/gl/gl_image_glx.h +++ b/ui/gl/gl_image_glx.h
@@ -19,6 +19,9 @@ public: GLImageGLX(const gfx::Size& size, gfx::BufferFormat format); + GLImageGLX(const GLImageGLX&) = delete; + GLImageGLX& operator=(const GLImageGLX&) = delete; + bool Initialize(x11::Pixmap pixmap); // Overridden from GLImage: @@ -53,8 +56,6 @@ uint32_t glx_pixmap_; const gfx::Size size_; gfx::BufferFormat format_; - - DISALLOW_COPY_AND_ASSIGN(GLImageGLX); }; } // namespace gl
diff --git a/ui/gl/gl_image_glx_native_pixmap.h b/ui/gl/gl_image_glx_native_pixmap.h index 35b7cc5e..0033204 100644 --- a/ui/gl/gl_image_glx_native_pixmap.h +++ b/ui/gl/gl_image_glx_native_pixmap.h
@@ -18,6 +18,10 @@ class GL_EXPORT GLImageGLXNativePixmap : public GLImageGLX { public: GLImageGLXNativePixmap(const gfx::Size& size, gfx::BufferFormat format); + + GLImageGLXNativePixmap(const GLImageGLXNativePixmap&) = delete; + GLImageGLXNativePixmap& operator=(const GLImageGLXNativePixmap&) = delete; + bool Initialize(scoped_refptr<gfx::NativePixmap> pixmap); protected: @@ -25,8 +29,6 @@ private: scoped_refptr<gfx::NativePixmap> native_pixmap_; - - DISALLOW_COPY_AND_ASSIGN(GLImageGLXNativePixmap); }; } // namespace gl
diff --git a/ui/gl/gl_image_io_surface.h b/ui/gl/gl_image_io_surface.h index e0b062b..cc0027c 100644 --- a/ui/gl/gl_image_io_surface.h +++ b/ui/gl/gl_image_io_surface.h
@@ -31,6 +31,9 @@ static GLImageIOSurface* Create(const gfx::Size& size, unsigned internalformat); + GLImageIOSurface(const GLImageIOSurface&) = delete; + GLImageIOSurface& operator=(const GLImageIOSurface&) = delete; + // Initialize to wrap of |io_surface|. The format of the plane to wrap is // specified in |format|. The index of the plane to wrap is // |io_surface_plane|. If |format| is a multi-planar format (e.g, @@ -130,8 +133,6 @@ gfx::ColorSpace color_space_for_yuv_to_rgb_ = gfx::ColorSpace::CreateREC601(); bool disable_in_use_by_window_server_ = false; - - DISALLOW_COPY_AND_ASSIGN(GLImageIOSurface); }; } // namespace gl
diff --git a/ui/gl/gl_image_memory.h b/ui/gl/gl_image_memory.h index ae30660..3c58eaf 100644 --- a/ui/gl/gl_image_memory.h +++ b/ui/gl/gl_image_memory.h
@@ -23,6 +23,9 @@ public: explicit GLImageMemory(const gfx::Size& size); + GLImageMemory(const GLImageMemory&) = delete; + GLImageMemory& operator=(const GLImageMemory&) = delete; + bool Initialize(const unsigned char* memory, gfx::BufferFormat format, size_t stride); @@ -73,8 +76,6 @@ base::WeakPtr<GLSurface> original_surface_; size_t buffer_bytes_ = 0; int memcpy_tasks_ = 0; - - DISALLOW_COPY_AND_ASSIGN(GLImageMemory); }; } // namespace gl
diff --git a/ui/gl/gl_image_ref_counted_memory.h b/ui/gl/gl_image_ref_counted_memory.h index 02923210..947b7cc 100644 --- a/ui/gl/gl_image_ref_counted_memory.h +++ b/ui/gl/gl_image_ref_counted_memory.h
@@ -22,6 +22,9 @@ public: explicit GLImageRefCountedMemory(const gfx::Size& size); + GLImageRefCountedMemory(const GLImageRefCountedMemory&) = delete; + GLImageRefCountedMemory& operator=(const GLImageRefCountedMemory&) = delete; + bool Initialize(base::RefCountedMemory* ref_counted_memory, gfx::BufferFormat format); @@ -35,8 +38,6 @@ private: scoped_refptr<base::RefCountedMemory> ref_counted_memory_; - - DISALLOW_COPY_AND_ASSIGN(GLImageRefCountedMemory); }; } // namespace gl
diff --git a/ui/gl/gl_image_shared_memory.h b/ui/gl/gl_image_shared_memory.h index bc64241..8c51ec3 100644 --- a/ui/gl/gl_image_shared_memory.h +++ b/ui/gl/gl_image_shared_memory.h
@@ -22,6 +22,9 @@ public: explicit GLImageSharedMemory(const gfx::Size& size); + GLImageSharedMemory(const GLImageSharedMemory&) = delete; + GLImageSharedMemory& operator=(const GLImageSharedMemory&) = delete; + bool Initialize(const base::UnsafeSharedMemoryRegion& shared_memory_region, gfx::GenericSharedMemoryId shared_memory_id, gfx::BufferFormat format, @@ -39,8 +42,6 @@ private: base::WritableSharedMemoryMapping shared_memory_mapping_; gfx::GenericSharedMemoryId shared_memory_id_; - - DISALLOW_COPY_AND_ASSIGN(GLImageSharedMemory); }; } // namespace gl
diff --git a/ui/gl/gl_image_surface_texture.h b/ui/gl/gl_image_surface_texture.h index eceb7bc..58b1d75 100644 --- a/ui/gl/gl_image_surface_texture.h +++ b/ui/gl/gl_image_surface_texture.h
@@ -22,6 +22,9 @@ public: explicit GLImageSurfaceTexture(const gfx::Size& size); + GLImageSurfaceTexture(const GLImageSurfaceTexture&) = delete; + GLImageSurfaceTexture& operator=(const GLImageSurfaceTexture&) = delete; + bool Initialize(SurfaceTexture* surface_texture); // Overridden from GLImage: @@ -54,8 +57,6 @@ const gfx::Size size_; GLint texture_id_; base::ThreadChecker thread_checker_; - - DISALLOW_COPY_AND_ASSIGN(GLImageSurfaceTexture); }; } // namespace gl
diff --git a/ui/gl/gl_share_group.h b/ui/gl/gl_share_group.h index 9ca5025..f403f15 100644 --- a/ui/gl/gl_share_group.h +++ b/ui/gl/gl_share_group.h
@@ -21,6 +21,9 @@ public: GLShareGroup(); + GLShareGroup(const GLShareGroup&) = delete; + GLShareGroup& operator=(const GLShareGroup&) = delete; + // These two should only be called from the constructor and destructor of // GLContext. void AddContext(GLContext* context); @@ -60,8 +63,6 @@ #if defined(OS_APPLE) int renderer_id_; #endif - - DISALLOW_COPY_AND_ASSIGN(GLShareGroup); }; } // namespace gl
diff --git a/ui/gl/gl_surface.h b/ui/gl/gl_surface.h index 705d067..5f1a61a 100644 --- a/ui/gl/gl_surface.h +++ b/ui/gl/gl_surface.h
@@ -55,6 +55,9 @@ public: GLSurface(); + GLSurface(const GLSurface&) = delete; + GLSurface& operator=(const GLSurface&) = delete; + // Non-virtual initialization, this always calls Initialize with a // default GLSurfaceFormat. Subclasses should override the format- // specific Initialize method below and interpret the default format @@ -345,8 +348,6 @@ friend class base::RefCounted<GLSurface>; friend class GLContext; - - DISALLOW_COPY_AND_ASSIGN(GLSurface); }; // Implementation of GLSurface that forwards all calls through to another @@ -355,6 +356,9 @@ public: explicit GLSurfaceAdapter(GLSurface* surface); + GLSurfaceAdapter(const GLSurfaceAdapter&) = delete; + GLSurfaceAdapter& operator=(const GLSurfaceAdapter&) = delete; + bool Initialize(GLSurfaceFormat format) override; void PrepareToDestroy(bool have_context) override; void Destroy() override; @@ -450,8 +454,6 @@ private: scoped_refptr<GLSurface> surface_; - - DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); }; // Wraps GLSurface in scoped_refptr and tries to initializes it. Returns a
diff --git a/ui/gl/gl_surface_egl.h b/ui/gl/gl_surface_egl.h index 45d0d928..a272128 100644 --- a/ui/gl/gl_surface_egl.h +++ b/ui/gl/gl_surface_egl.h
@@ -92,6 +92,9 @@ public: GLSurfaceEGL(); + GLSurfaceEGL(const GLSurfaceEGL&) = delete; + GLSurfaceEGL& operator=(const GLSurfaceEGL&) = delete; + // Implement GLSurface. EGLDisplay GetDisplay() override; EGLConfig GetConfig() override; @@ -138,7 +141,6 @@ GLSurfaceFormat format_; private: - DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGL); static bool InitializeOneOffCommon(); static bool initialized_; }; @@ -150,6 +152,9 @@ NativeViewGLSurfaceEGL(EGLNativeWindowType window, std::unique_ptr<gfx::VSyncProvider> vsync_provider); + NativeViewGLSurfaceEGL(const NativeViewGLSurfaceEGL&) = delete; + NativeViewGLSurfaceEGL& operator=(const NativeViewGLSurfaceEGL&) = delete; + // Implement GLSurface. bool Initialize(GLSurfaceFormat format) override; bool SupportsSwapTimestamps() const override; @@ -255,8 +260,6 @@ bool vsync_enabled_ = true; std::unique_ptr<GLSurfacePresentationHelper> presentation_helper_; - - DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceEGL); }; // Encapsulates a pbuffer EGL surface. @@ -264,6 +267,9 @@ public: explicit PbufferGLSurfaceEGL(const gfx::Size& size); + PbufferGLSurfaceEGL(const PbufferGLSurfaceEGL&) = delete; + PbufferGLSurfaceEGL& operator=(const PbufferGLSurfaceEGL&) = delete; + // Implement GLSurface. bool Initialize(GLSurfaceFormat format) override; void Destroy() override; @@ -283,8 +289,6 @@ private: gfx::Size size_; EGLSurface surface_; - - DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceEGL); }; // SurfacelessEGL is used as Offscreen surface when platform supports @@ -294,6 +298,9 @@ public: explicit SurfacelessEGL(const gfx::Size& size); + SurfacelessEGL(const SurfacelessEGL&) = delete; + SurfacelessEGL& operator=(const SurfacelessEGL&) = delete; + // Implement GLSurface. bool Initialize(GLSurfaceFormat format) override; void Destroy() override; @@ -313,7 +320,6 @@ private: gfx::Size size_; - DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); }; } // namespace gl
diff --git a/ui/gl/gl_surface_egl_x11_gles2.h b/ui/gl/gl_surface_egl_x11_gles2.h index 17c4d07..48316d3 100644 --- a/ui/gl/gl_surface_egl_x11_gles2.h +++ b/ui/gl/gl_surface_egl_x11_gles2.h
@@ -21,6 +21,11 @@ public: explicit NativeViewGLSurfaceEGLX11GLES2(x11::Window window); + NativeViewGLSurfaceEGLX11GLES2(const NativeViewGLSurfaceEGLX11GLES2&) = + delete; + NativeViewGLSurfaceEGLX11GLES2& operator=( + const NativeViewGLSurfaceEGLX11GLES2&) = delete; + // NativeViewGLSurfaceEGL overrides. EGLConfig GetConfig() override; void Destroy() override; @@ -43,8 +48,6 @@ void OnEvent(const x11::Event& xev) override; x11::Window parent_window_; - - DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceEGLX11GLES2); }; } // namespace gl
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc index d38bee9..4b414604 100644 --- a/ui/gl/gl_surface_glx.cc +++ b/ui/gl/gl_surface_glx.cc
@@ -164,6 +164,9 @@ return g_video_sync_thread; } + SGIVideoSyncThread(const SGIVideoSyncThread&) = delete; + SGIVideoSyncThread& operator=(const SGIVideoSyncThread&) = delete; + x11::Connection* GetConnection() { DCHECK(task_runner()->BelongsToCurrentThread()); return GetConnectionImpl(); @@ -221,8 +224,6 @@ GLXContext context_ = nullptr; THREAD_CHECKER(thread_checker_); - - DISALLOW_COPY_AND_ASSIGN(SGIVideoSyncThread); }; class SGIVideoSyncProviderThreadShim {
diff --git a/ui/gl/gl_surface_glx.h b/ui/gl/gl_surface_glx.h index 4cdb554..cd82737 100644 --- a/ui/gl/gl_surface_glx.h +++ b/ui/gl/gl_surface_glx.h
@@ -34,6 +34,9 @@ public: GLSurfaceGLX(); + GLSurfaceGLX(const GLSurfaceGLX&) = delete; + GLSurfaceGLX& operator=(const GLSurfaceGLX&) = delete; + static bool InitializeOneOff(); static bool InitializeExtensionSettingsOneOff(); static void ShutdownOneOff(); @@ -64,7 +67,6 @@ ~GLSurfaceGLX() override; private: - DISALLOW_COPY_AND_ASSIGN(GLSurfaceGLX); static bool initialized_; }; @@ -73,6 +75,9 @@ public: explicit NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window); + NativeViewGLSurfaceGLX(const NativeViewGLSurfaceGLX&) = delete; + NativeViewGLSurfaceGLX& operator=(const NativeViewGLSurfaceGLX&) = delete; + // Implement GLSurfaceGLX. bool Initialize(GLSurfaceFormat format) override; void Destroy() override; @@ -134,8 +139,6 @@ std::unique_ptr<gfx::VSyncProvider> vsync_provider_; std::unique_ptr<GLSurfacePresentationHelper> presentation_helper_; - - DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceGLX); }; // A surface used to render to an offscreen pbuffer. @@ -143,6 +146,11 @@ public: explicit UnmappedNativeViewGLSurfaceGLX(const gfx::Size& size); + UnmappedNativeViewGLSurfaceGLX(const UnmappedNativeViewGLSurfaceGLX&) = + delete; + UnmappedNativeViewGLSurfaceGLX& operator=( + const UnmappedNativeViewGLSurfaceGLX&) = delete; + // Implement GLSurfaceGLX. bool Initialize(GLSurfaceFormat format) override; void Destroy() override; @@ -164,8 +172,6 @@ // GLXDrawable for the window. x11::Glx::Window glx_window_; - - DISALLOW_COPY_AND_ASSIGN(UnmappedNativeViewGLSurfaceGLX); }; } // namespace gl
diff --git a/ui/gl/gl_surface_glx_x11.h b/ui/gl/gl_surface_glx_x11.h index c4dfd8d..ba41e0c3 100644 --- a/ui/gl/gl_surface_glx_x11.h +++ b/ui/gl/gl_surface_glx_x11.h
@@ -21,6 +21,9 @@ public: explicit GLSurfaceGLXX11(gfx::AcceleratedWidget window); + GLSurfaceGLXX11(const GLSurfaceGLXX11&) = delete; + GLSurfaceGLXX11& operator=(const GLSurfaceGLXX11&) = delete; + protected: ~GLSurfaceGLXX11() override; @@ -30,9 +33,6 @@ // x11::EventObserver: void OnEvent(const x11::Event& event) override; - - private: - DISALLOW_COPY_AND_ASSIGN(GLSurfaceGLXX11); }; } // namespace gl
diff --git a/ui/gl/gl_surface_presentation_helper.h b/ui/gl/gl_surface_presentation_helper.h index 3c293c11..26096a39 100644 --- a/ui/gl/gl_surface_presentation_helper.h +++ b/ui/gl/gl_surface_presentation_helper.h
@@ -54,6 +54,11 @@ // For using fixed VSync provider. GLSurfacePresentationHelper(const base::TimeTicks timebase, const base::TimeDelta interval); + + GLSurfacePresentationHelper(const GLSurfacePresentationHelper&) = delete; + GLSurfacePresentationHelper& operator=(const GLSurfacePresentationHelper&) = + delete; + ~GLSurfacePresentationHelper(); void OnMakeCurrent(GLContext* context, GLSurface* surface); @@ -113,8 +118,6 @@ bool update_vsync_pending_ = false; base::WeakPtrFactory<GLSurfacePresentationHelper> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(GLSurfacePresentationHelper); }; } // namespace gl
diff --git a/ui/gl/gl_version_info.h b/ui/gl/gl_version_info.h index 7c822cd..9f9a668 100644 --- a/ui/gl/gl_version_info.h +++ b/ui/gl/gl_version_info.h
@@ -19,6 +19,9 @@ const char* renderer_str, const gfx::ExtensionSet& exts); + GLVersionInfo(const GLVersionInfo&) = delete; + GLVersionInfo& operator=(const GLVersionInfo&) = delete; + bool IsAtLeastGL(unsigned major, unsigned minor) const { return !is_es && (major_version > major || (major_version == major && minor_version >= minor)); @@ -87,8 +90,6 @@ void ParseDriverInfo(const char* version_str); void ExtractDriverVendorANGLE(const char* renderer_str); bool IsES3Capable(const gfx::ExtensionSet& extensions) const; - - DISALLOW_COPY_AND_ASSIGN(GLVersionInfo); }; } // namespace gl
diff --git a/ui/gl/gpu_switching_manager.h b/ui/gl/gpu_switching_manager.h index a82d4d4c..caaea0db 100644 --- a/ui/gl/gpu_switching_manager.h +++ b/ui/gl/gpu_switching_manager.h
@@ -19,6 +19,9 @@ // Getter for the singleton. This will return NULL on failure. static GpuSwitchingManager* GetInstance(); + GpuSwitchingManager(const GpuSwitchingManager&) = delete; + GpuSwitchingManager& operator=(const GpuSwitchingManager&) = delete; + void AddObserver(GpuSwitchingObserver* observer); void RemoveObserver(GpuSwitchingObserver* observer); @@ -51,8 +54,6 @@ virtual ~GpuSwitchingManager(); base::ObserverList<GpuSwitchingObserver>::Unchecked observer_list_; - - DISALLOW_COPY_AND_ASSIGN(GpuSwitchingManager); }; } // namespace ui
diff --git a/ui/gl/gpu_timing.cc b/ui/gl/gpu_timing.cc index 788cf38f..f2a03a3 100644 --- a/ui/gl/gpu_timing.cc +++ b/ui/gl/gpu_timing.cc
@@ -105,6 +105,9 @@ public: QueryResult() {} + QueryResult(const QueryResult&) = delete; + QueryResult& operator=(const QueryResult&) = delete; + bool IsAvailable() const { return available_; } int64_t GetDelta() const { return end_value_ - start_value_; } int64_t GetStartValue() const { return start_value_; } @@ -120,13 +123,15 @@ bool available_ = false; int64_t start_value_ = 0; int64_t end_value_ = 0; - - DISALLOW_COPY_AND_ASSIGN(QueryResult); }; class TimerQuery : public base::RefCounted<TimerQuery> { public: explicit TimerQuery(uint32_t next_id); + + TimerQuery(const TimerQuery&) = delete; + TimerQuery& operator=(const TimerQuery&) = delete; + virtual void Destroy() = 0; // Returns true when UpdateQueryResults() is ready to be called. @@ -144,7 +149,6 @@ protected: friend class base::RefCounted<TimerQuery>; virtual ~TimerQuery(); - DISALLOW_COPY_AND_ASSIGN(TimerQuery); }; TimerQuery::TimerQuery(uint32_t next_id)
diff --git a/ui/gl/gpu_timing.h b/ui/gl/gpu_timing.h index 9b4f862..3a45559f 100644 --- a/ui/gl/gpu_timing.h +++ b/ui/gl/gpu_timing.h
@@ -60,6 +60,9 @@ kTimerTypeDisjoint // EXT_disjoint_timer_query }; + GPUTiming(const GPUTiming&) = delete; + GPUTiming& operator=(const GPUTiming&) = delete; + protected: friend std::default_delete<GPUTiming>; friend class GLContextReal; @@ -70,8 +73,6 @@ virtual ~GPUTiming(); virtual scoped_refptr<GPUTimingClient> CreateGPUTimingClient() = 0; - - DISALLOW_COPY_AND_ASSIGN(GPUTiming); }; // Class to compute the amount of time it takes to fully @@ -129,6 +130,9 @@ public: explicit GPUTimingClient(GPUTimingImpl* gpu_timing = nullptr); + GPUTimingClient(const GPUTimingClient&) = delete; + GPUTimingClient& operator=(const GPUTimingClient&) = delete; + std::unique_ptr<GPUTimer> CreateGPUTimer(bool prefer_elapsed_time); bool IsAvailable(); @@ -156,8 +160,6 @@ GPUTimingImpl* gpu_timing_; GPUTiming::TimerType timer_type_ = GPUTiming::kTimerTypeInvalid; uint32_t disjoint_counter_ = 0; - - DISALLOW_COPY_AND_ASSIGN(GPUTimingClient); }; } // namespace gl
diff --git a/ui/gl/init/gl_factory_android.cc b/ui/gl/init/gl_factory_android.cc index 78dc4c99..73fd52a 100644 --- a/ui/gl/init/gl_factory_android.cc +++ b/ui/gl/init/gl_factory_android.cc
@@ -30,6 +30,9 @@ public: explicit GLNonOwnedContext(GLShareGroup* share_group); + GLNonOwnedContext(const GLNonOwnedContext&) = delete; + GLNonOwnedContext& operator=(const GLNonOwnedContext&) = delete; + // Implement GLContext. bool Initialize(GLSurface* compatible_surface, const GLContextAttribs& attribs) override; @@ -43,8 +46,6 @@ private: EGLDisplay display_; - - DISALLOW_COPY_AND_ASSIGN(GLNonOwnedContext); }; GLNonOwnedContext::GLNonOwnedContext(GLShareGroup* share_group)
diff --git a/ui/gl/init/gl_factory_mac.cc b/ui/gl/init/gl_factory_mac.cc index 6dc31e3..4f77730 100644 --- a/ui/gl/init/gl_factory_mac.cc +++ b/ui/gl/init/gl_factory_mac.cc
@@ -36,6 +36,9 @@ public: explicit NoOpGLSurface(const gfx::Size& size) : size_(size) {} + NoOpGLSurface(const NoOpGLSurface&) = delete; + NoOpGLSurface& operator=(const NoOpGLSurface&) = delete; + // Implement GLSurface. bool Initialize(GLSurfaceFormat format) override { return true; } void Destroy() override {} @@ -55,8 +58,6 @@ private: gfx::Size size_; - - DISALLOW_COPY_AND_ASSIGN(NoOpGLSurface); }; } // namespace
diff --git a/ui/gl/shader_tracking.h b/ui/gl/shader_tracking.h index 7fb7b58a..3fa126e5 100644 --- a/ui/gl/shader_tracking.h +++ b/ui/gl/shader_tracking.h
@@ -19,6 +19,9 @@ public: static ShaderTracking* GetInstance(); + ShaderTracking(const ShaderTracking&) = delete; + ShaderTracking& operator=(const ShaderTracking&) = delete; + static const size_t kMaxShaderSize = 1024; void GetShaders(std::string* shader0, std::string* shader1); @@ -33,8 +36,6 @@ mutable base::Lock lock_; std::string shaders_[2]; - - DISALLOW_COPY_AND_ASSIGN(ShaderTracking); }; } // namespace gl
diff --git a/ui/gl/shared_gl_fence_egl.h b/ui/gl/shared_gl_fence_egl.h index 9acdd3ce..145a49c 100644 --- a/ui/gl/shared_gl_fence_egl.h +++ b/ui/gl/shared_gl_fence_egl.h
@@ -28,6 +28,9 @@ public: SharedGLFenceEGL(); + SharedGLFenceEGL(const SharedGLFenceEGL&) = delete; + SharedGLFenceEGL& operator=(const SharedGLFenceEGL&) = delete; + // Issues a ServerWait on the |egl_fence_|. void ServerWait(); @@ -44,8 +47,6 @@ // GLApi on which all the consumers for this object should be on. gl::GLApi* gl_api_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(SharedGLFenceEGL); }; } // namespace gl
diff --git a/ui/gl/test/run_all_unittests.cc b/ui/gl/test/run_all_unittests.cc index c17cbcd..f6d26f80 100644 --- a/ui/gl/test/run_all_unittests.cc +++ b/ui/gl/test/run_all_unittests.cc
@@ -28,6 +28,9 @@ GlTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) { } + GlTestSuite(const GlTestSuite&) = delete; + GlTestSuite& operator=(const GlTestSuite&) = delete; + protected: void Initialize() override { base::TestSuite::Initialize(); @@ -63,8 +66,6 @@ private: std::unique_ptr<base::test::TaskEnvironment> task_environment_; - - DISALLOW_COPY_AND_ASSIGN(GlTestSuite); }; } // namespace
diff --git a/ui/gl/vsync_thread_win.h b/ui/gl/vsync_thread_win.h index fd516d12..388057a 100644 --- a/ui/gl/vsync_thread_win.h +++ b/ui/gl/vsync_thread_win.h
@@ -30,6 +30,9 @@ public: static VSyncThreadWin* GetInstance(); + VSyncThreadWin(const VSyncThreadWin&) = delete; + VSyncThreadWin& operator=(const VSyncThreadWin&) = delete; + // These methods are not rentrancy safe, and shouldn't be called inside // VSyncObserver::OnVSync. It's safe to assume that these can be called only // from the main thread. @@ -57,8 +60,6 @@ base::Lock lock_; bool GUARDED_BY(lock_) is_idle_ = true; base::flat_set<VSyncObserver*> GUARDED_BY(lock_) observers_; - - DISALLOW_COPY_AND_ASSIGN(VSyncThreadWin); }; } // namespace gl
diff --git a/ui/gtk/native_theme_gtk.h b/ui/gtk/native_theme_gtk.h index acaabda..abd4a9e 100644 --- a/ui/gtk/native_theme_gtk.h +++ b/ui/gtk/native_theme_gtk.h
@@ -26,6 +26,9 @@ public: static NativeThemeGtk* instance(); + NativeThemeGtk(const NativeThemeGtk&) = delete; + NativeThemeGtk& operator=(const NativeThemeGtk&) = delete; + // ui::NativeThemeBase: void PaintArrowButton(cc::PaintCanvas* canvas, const gfx::Rect& rect, @@ -91,8 +94,6 @@ mutable absl::optional<SkColor> color_cache_[kColorId_NumColors]; ScopedCssProvider theme_css_override_; - - DISALLOW_COPY_AND_ASSIGN(NativeThemeGtk); }; } // namespace gtk
diff --git a/ui/gtk/printing/print_dialog_gtk.h b/ui/gtk/printing/print_dialog_gtk.h index bbdef2e..70edd2c3 100644 --- a/ui/gtk/printing/print_dialog_gtk.h +++ b/ui/gtk/printing/print_dialog_gtk.h
@@ -33,6 +33,9 @@ static printing::PrintDialogGtkInterface* CreatePrintDialog( PrintingContextLinux* context); + PrintDialogGtk(const PrintDialogGtk&) = delete; + PrintDialogGtk& operator=(const PrintDialogGtk&) = delete; + // printing::PrintDialogGtkInterface implementation. void UseDefaultSettings() override; void UpdateSettings( @@ -81,8 +84,6 @@ GtkPrinter* printer_ = nullptr; base::FilePath path_to_pdf_; - - DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk); }; #endif // UI_GTK_PRINTING_PRINT_DIALOG_GTK_H_
diff --git a/ui/gtk/select_file_dialog_impl.h b/ui/gtk/select_file_dialog_impl.h index 987919a..0fd23ecd 100644 --- a/ui/gtk/select_file_dialog_impl.h +++ b/ui/gtk/select_file_dialog_impl.h
@@ -47,6 +47,9 @@ Listener* listener, std::unique_ptr<ui::SelectFilePolicy> policy); + SelectFileDialogImpl(const SelectFileDialogImpl&) = delete; + SelectFileDialogImpl& operator=(const SelectFileDialogImpl&) = delete; + // Returns true if the SelectFileDialog class returned by // NewSelectFileDialogImplKDE will actually work. static bool CheckKDEDialogWorksOnUIThread(std::string& kdialog_version); @@ -90,8 +93,6 @@ // file so that we can display future dialogs with the same starting path. static base::FilePath* last_saved_path_; static base::FilePath* last_opened_path_; - - DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl); }; } // namespace gtk
diff --git a/ui/gtk/select_file_dialog_impl_gtk.h b/ui/gtk/select_file_dialog_impl_gtk.h index 6db083d..9fe38bc7 100644 --- a/ui/gtk/select_file_dialog_impl_gtk.h +++ b/ui/gtk/select_file_dialog_impl_gtk.h
@@ -22,6 +22,9 @@ SelectFileDialogImplGTK(Listener* listener, std::unique_ptr<ui::SelectFilePolicy> policy); + SelectFileDialogImplGTK(const SelectFileDialogImplGTK&) = delete; + SelectFileDialogImplGTK& operator=(const SelectFileDialogImplGTK&) = delete; + protected: ~SelectFileDialogImplGTK() override; @@ -143,8 +146,6 @@ // The set of all parent windows for which we are currently running dialogs. std::set<aura::Window*> parents_; - - DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImplGTK); }; } // namespace gtk
diff --git a/ui/gtk/select_file_dialog_impl_kde.cc b/ui/gtk/select_file_dialog_impl_kde.cc index 972d5c0..ff597fc 100644 --- a/ui/gtk/select_file_dialog_impl_kde.cc +++ b/ui/gtk/select_file_dialog_impl_kde.cc
@@ -49,6 +49,9 @@ base::nix::DesktopEnvironment desktop, const std::string& kdialog_version); + SelectFileDialogImplKDE(const SelectFileDialogImplKDE&) = delete; + SelectFileDialogImplKDE& operator=(const SelectFileDialogImplKDE&) = delete; + protected: ~SelectFileDialogImplKDE() override; @@ -181,8 +184,6 @@ scoped_refptr<base::SequencedTaskRunner> pipe_task_runner_; SEQUENCE_CHECKER(sequence_checker_); - - DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImplKDE); }; // static
diff --git a/ui/latency/mojom/mojom_traits_unittest.cc b/ui/latency/mojom/mojom_traits_unittest.cc index 32bb2f6..e364041 100644 --- a/ui/latency/mojom/mojom_traits_unittest.cc +++ b/ui/latency/mojom/mojom_traits_unittest.cc
@@ -19,6 +19,9 @@ public: StructTraitsTest() {} + StructTraitsTest(const StructTraitsTest&) = delete; + StructTraitsTest& operator=(const StructTraitsTest&) = delete; + protected: mojo::Remote<mojom::TraitsTestService> GetTraitsTestRemote() { mojo::Remote<mojom::TraitsTestService> remote; @@ -35,7 +38,6 @@ base::test::TaskEnvironment task_environment_; mojo::ReceiverSet<TraitsTestService> traits_test_receivers_; - DISALLOW_COPY_AND_ASSIGN(StructTraitsTest); }; } // namespace
diff --git a/ui/message_center/message_center.h b/ui/message_center/message_center.h index 3c0f4de8..402eec5 100644 --- a/ui/message_center/message_center.h +++ b/ui/message_center/message_center.h
@@ -67,6 +67,9 @@ // Destroys the global message_center object. static void Shutdown(); + MessageCenter(const MessageCenter&) = delete; + MessageCenter& operator=(const MessageCenter&) = delete; + // Management of the observer list. virtual void AddObserver(MessageCenterObserver* observer) = 0; virtual void RemoveObserver(MessageCenterObserver* observer) = 0; @@ -240,9 +243,6 @@ MessageCenter(); virtual ~MessageCenter(); - - private: - DISALLOW_COPY_AND_ASSIGN(MessageCenter); }; } // namespace message_center
diff --git a/ui/message_center/message_center_impl_unittest.cc b/ui/message_center/message_center_impl_unittest.cc index 1cec285a..3a2c02b 100644 --- a/ui/message_center/message_center_impl_unittest.cc +++ b/ui/message_center/message_center_impl_unittest.cc
@@ -46,6 +46,9 @@ DCHECK(!target_id.empty()); } + CheckObserver(const CheckObserver&) = delete; + CheckObserver& operator=(const CheckObserver&) = delete; + void OnNotificationUpdated(const std::string& notification_id) override { EXPECT_TRUE(message_center_->FindVisibleNotificationById(target_id_)); } @@ -53,8 +56,6 @@ private: MessageCenter* message_center_; std::string target_id_; - - DISALLOW_COPY_AND_ASSIGN(CheckObserver); }; class RemoveObserver : public MessageCenterObserver { @@ -65,6 +66,9 @@ DCHECK(!target_id.empty()); } + RemoveObserver(const RemoveObserver&) = delete; + RemoveObserver& operator=(const RemoveObserver&) = delete; + void OnNotificationUpdated(const std::string& notification_id) override { message_center_->RemoveNotification(target_id_, false); } @@ -72,8 +76,6 @@ private: MessageCenter* message_center_; std::string target_id_; - - DISALLOW_COPY_AND_ASSIGN(RemoveObserver); }; class TestAddObserver : public MessageCenterObserver { @@ -114,6 +116,10 @@ log_ += "Close_"; log_ += (by_user ? "by_user_" : "programmatically_"); } + + TestDelegate(const TestDelegate&) = delete; + TestDelegate& operator=(const TestDelegate&) = delete; + void Click(const absl::optional<int>& button_index, const absl::optional<std::u16string>& reply) override { if (button_index) { @@ -134,8 +140,6 @@ private: ~TestDelegate() override = default; std::string log_; - - DISALLOW_COPY_AND_ASSIGN(TestDelegate); }; class DeleteOnCloseDelegate : public NotificationDelegate { @@ -169,6 +173,9 @@ public: MessageCenterImplTest() = default; + MessageCenterImplTest(const MessageCenterImplTest&) = delete; + MessageCenterImplTest& operator=(const MessageCenterImplTest&) = delete; + void SetUp() override { MessageCenter::Initialize(std::make_unique<FakeLockScreenController>()); message_center_ = MessageCenter::Get(); @@ -259,8 +266,6 @@ std::unique_ptr<base::test::SingleThreadTaskEnvironment> task_environment_; std::unique_ptr<base::RunLoop> run_loop_; base::RepeatingClosure closure_; - - DISALLOW_COPY_AND_ASSIGN(MessageCenterImplTest); }; namespace {
diff --git a/ui/message_center/public/cpp/notification_delegate.h b/ui/message_center/public/cpp/notification_delegate.h index 7f47613..7a53eedc 100644 --- a/ui/message_center/public/cpp/notification_delegate.h +++ b/ui/message_center/public/cpp/notification_delegate.h
@@ -60,6 +60,10 @@ public: explicit ThunkNotificationDelegate(base::WeakPtr<NotificationObserver> impl); + ThunkNotificationDelegate(const ThunkNotificationDelegate&) = delete; + ThunkNotificationDelegate& operator=(const ThunkNotificationDelegate&) = + delete; + // NotificationDelegate: void Close(bool by_user) override; void Click(const absl::optional<int>& button_index, @@ -72,8 +76,6 @@ private: base::WeakPtr<NotificationObserver> impl_; - - DISALLOW_COPY_AND_ASSIGN(ThunkNotificationDelegate); }; // A simple notification delegate which invokes the passed closure when the body @@ -94,6 +96,11 @@ explicit HandleNotificationClickDelegate( const base::RepeatingClosure& closure); + HandleNotificationClickDelegate(const HandleNotificationClickDelegate&) = + delete; + HandleNotificationClickDelegate& operator=( + const HandleNotificationClickDelegate&) = delete; + // Overrides the callback with one that handles clicks on a button or on the // body. void SetCallback(const ButtonClickCallback& callback); @@ -111,8 +118,6 @@ private: ButtonClickCallback callback_; - - DISALLOW_COPY_AND_ASSIGN(HandleNotificationClickDelegate); }; } // namespace message_center
diff --git a/ui/message_center/test/run_all_unittests.cc b/ui/message_center/test/run_all_unittests.cc index 6ce2137..0375180 100644 --- a/ui/message_center/test/run_all_unittests.cc +++ b/ui/message_center/test/run_all_unittests.cc
@@ -22,6 +22,9 @@ public: MessageCenterTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} + MessageCenterTestSuite(const MessageCenterTestSuite&) = delete; + MessageCenterTestSuite& operator=(const MessageCenterTestSuite&) = delete; + protected: void Initialize() override { gl::GLSurfaceTestSupport::InitializeOneOff(); @@ -43,8 +46,6 @@ private: base::TestDiscardableMemoryAllocator discardable_memory_allocator_; - - DISALLOW_COPY_AND_ASSIGN(MessageCenterTestSuite); }; } // namespace
diff --git a/ui/native_theme/native_theme.h b/ui/native_theme/native_theme.h index d76b3d2..01c9991 100644 --- a/ui/native_theme/native_theme.h +++ b/ui/native_theme/native_theme.h
@@ -329,6 +329,9 @@ TrackbarExtraParams trackbar; }; + NativeTheme(const NativeTheme&) = delete; + NativeTheme& operator=(const NativeTheme&) = delete; + // Return the size of the part. virtual gfx::Size GetPartSize(Part part, State state, @@ -576,8 +579,6 @@ PreferredContrast preferred_contrast_ = PreferredContrast::kNoPreference; SEQUENCE_CHECKER(sequence_checker_); - - DISALLOW_COPY_AND_ASSIGN(NativeTheme); }; } // namespace ui
diff --git a/ui/native_theme/native_theme_android.h b/ui/native_theme/native_theme_android.h index 864bd90..1e3097f 100644 --- a/ui/native_theme/native_theme_android.h +++ b/ui/native_theme/native_theme_android.h
@@ -14,6 +14,9 @@ // Android implementation of native theme support. class NativeThemeAndroid : public NativeThemeBase { public: + NativeThemeAndroid(const NativeThemeAndroid&) = delete; + NativeThemeAndroid& operator=(const NativeThemeAndroid&) = delete; + // NativeThemeBase: gfx::Size GetPartSize(Part part, State state, @@ -49,8 +52,6 @@ private: NativeThemeAndroid(); ~NativeThemeAndroid() override; - - DISALLOW_COPY_AND_ASSIGN(NativeThemeAndroid); }; } // namespace ui
diff --git a/ui/native_theme/native_theme_aura.h b/ui/native_theme/native_theme_aura.h index fd2f9dc..3f3980f9 100644 --- a/ui/native_theme/native_theme_aura.h +++ b/ui/native_theme/native_theme_aura.h
@@ -20,6 +20,10 @@ explicit NativeThemeAura(bool use_overlay_scrollbars, bool should_only_use_dark_colors); + + NativeThemeAura(const NativeThemeAura&) = delete; + NativeThemeAura& operator=(const NativeThemeAura&) = delete; + ~NativeThemeAura() override; static NativeThemeAura* web_instance(); @@ -77,8 +81,6 @@ const cc::PaintFlags& flags); bool use_overlay_scrollbars_; - - DISALLOW_COPY_AND_ASSIGN(NativeThemeAura); }; } // namespace ui
diff --git a/ui/native_theme/native_theme_base.h b/ui/native_theme/native_theme_base.h index 1a36bbd..9f39be9 100644 --- a/ui/native_theme/native_theme_base.h +++ b/ui/native_theme/native_theme_base.h
@@ -22,6 +22,9 @@ // Theme support for non-Windows toolkits. class NATIVE_THEME_EXPORT NativeThemeBase : public NativeTheme { public: + NativeThemeBase(const NativeThemeBase&) = delete; + NativeThemeBase& operator=(const NativeThemeBase&) = delete; + // NativeTheme implementation: gfx::Size GetPartSize(Part part, State state, @@ -303,8 +306,6 @@ // The length of the arrow buttons, 0 means no buttons are drawn. int scrollbar_button_length_ = 14; - - DISALLOW_COPY_AND_ASSIGN(NativeThemeBase); }; } // namespace ui
diff --git a/ui/native_theme/native_theme_mac.h b/ui/native_theme/native_theme_mac.h index ef14dda..40d4381e 100644 --- a/ui/native_theme/native_theme_mac.h +++ b/ui/native_theme/native_theme_mac.h
@@ -33,6 +33,9 @@ COUNT }; + NativeThemeMac(const NativeThemeMac&) = delete; + NativeThemeMac& operator=(const NativeThemeMac&) = delete; + // Adjusts an SkColor based on the current system control tint. For example, // if the current tint is "graphite", this function maps the provided value to // an appropriate gray. @@ -165,8 +168,6 @@ // contrast. std::unique_ptr<NativeTheme::ColorSchemeNativeThemeObserver> color_scheme_observer_; - - DISALLOW_COPY_AND_ASSIGN(NativeThemeMac); }; // Mac implementation of native theme support for web controls.
diff --git a/ui/native_theme/native_theme_win.h b/ui/native_theme/native_theme_win.h index 71142c1..7cb873f 100644 --- a/ui/native_theme/native_theme_win.h +++ b/ui/native_theme/native_theme_win.h
@@ -51,6 +51,9 @@ LAST }; + NativeThemeWin(const NativeThemeWin&) = delete; + NativeThemeWin& operator=(const NativeThemeWin&) = delete; + // Closes cached theme handles so we can unload the DLL or update our UI // for a theme change. static void CloseHandles(); @@ -216,8 +219,6 @@ // contrast, preferred color scheme, and preferred contrast. std::unique_ptr<NativeTheme::ColorSchemeNativeThemeObserver> color_scheme_observer_; - - DISALLOW_COPY_AND_ASSIGN(NativeThemeWin); }; } // namespace ui
diff --git a/ui/ozone/common/gl_surface_egl_readback.h b/ui/ozone/common/gl_surface_egl_readback.h index c4ab56d..011af66f 100644 --- a/ui/ozone/common/gl_surface_egl_readback.h +++ b/ui/ozone/common/gl_surface_egl_readback.h
@@ -25,6 +25,9 @@ public: GLSurfaceEglReadback(); + GLSurfaceEglReadback(const GLSurfaceEglReadback&) = delete; + GLSurfaceEglReadback& operator=(const GLSurfaceEglReadback&) = delete; + // GLSurface implementation. bool Resize(const gfx::Size& size, float scale_factor, @@ -50,8 +53,6 @@ private: scoped_refptr<base::SingleThreadTaskRunner> task_runner_; std::unique_ptr<uint8_t[]> pixels_; - - DISALLOW_COPY_AND_ASSIGN(GLSurfaceEglReadback); }; } // namespace ui
diff --git a/ui/ozone/platform/cast/gl_surface_cast.h b/ui/ozone/platform/cast/gl_surface_cast.h index 41ffb23..08a74425 100644 --- a/ui/ozone/platform/cast/gl_surface_cast.h +++ b/ui/ozone/platform/cast/gl_surface_cast.h
@@ -24,6 +24,9 @@ public: GLSurfaceCast(gfx::AcceleratedWidget widget, GLOzoneEglCast* parent); + GLSurfaceCast(const GLSurfaceCast&) = delete; + GLSurfaceCast& operator=(const GLSurfaceCast&) = delete; + // gl::GLSurface: bool SupportsSwapBuffersWithBounds() override; gfx::SwapResult SwapBuffersWithBounds(const std::vector<gfx::Rect>& rects, @@ -52,9 +55,6 @@ GLOzoneEglCast* parent_; bool supports_swap_buffer_with_bounds_; bool uses_triple_buffering_; - - private: - DISALLOW_COPY_AND_ASSIGN(GLSurfaceCast); }; } // namespace ui
diff --git a/ui/ozone/platform/cast/surface_factory_cast.cc b/ui/ozone/platform/cast/surface_factory_cast.cc index cc959d0f..80c021b 100644 --- a/ui/ozone/platform/cast/surface_factory_cast.cc +++ b/ui/ozone/platform/cast/surface_factory_cast.cc
@@ -51,6 +51,9 @@ public: CastPixmap() {} + CastPixmap(const CastPixmap&) = delete; + CastPixmap& operator=(const CastPixmap&) = delete; + bool AreDmaBufFdsValid() const override { return false; } int GetDmaBufFd(size_t plane) const override { return -1; } uint32_t GetDmaBufPitch(size_t plane) const override { return 0; } @@ -84,8 +87,6 @@ private: ~CastPixmap() override {} - - DISALLOW_COPY_AND_ASSIGN(CastPixmap); }; } // namespace
diff --git a/ui/ozone/platform/drm/gpu/drm_device.h b/ui/ozone/platform/drm/gpu/drm_device.h index f4a2cd9b..265587b3 100644 --- a/ui/ozone/platform/drm/gpu/drm_device.h +++ b/ui/ozone/platform/drm/gpu/drm_device.h
@@ -78,6 +78,9 @@ bool is_primary_device, std::unique_ptr<GbmDevice> gbm_device); + DrmDevice(const DrmDevice&) = delete; + DrmDevice& operator=(const DrmDevice&) = delete; + bool is_primary_device() const { return is_primary_device_; } bool is_atomic() const { return is_atomic_; } @@ -282,8 +285,6 @@ bool allow_addfb2_modifiers_ = false; const std::unique_ptr<GbmDevice> gbm_; - - DISALLOW_COPY_AND_ASSIGN(DrmDevice); }; } // namespace ui
diff --git a/ui/ozone/platform/drm/gpu/drm_framebuffer.cc b/ui/ozone/platform/drm/gpu/drm_framebuffer.cc index 2c57764..75a6f72 100644 --- a/ui/ozone/platform/drm/gpu/drm_framebuffer.cc +++ b/ui/ozone/platform/drm/gpu/drm_framebuffer.cc
@@ -13,45 +13,26 @@ #include "ui/gfx/linux/gbm_buffer.h" #include "ui/ozone/platform/drm/common/drm_util.h" #include "ui/ozone/platform/drm/gpu/drm_device.h" -#include "ui/ozone/platform/drm/gpu/hardware_display_plane.h" #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" namespace { // Some Display Controllers (e.g. Intel Gen 9.5) don't support AR/B30 // framebuffers, only XR/B30; this function indicates if an opaque format should // be used instead of the non-opaque |buffer_format| for AddFramebuffer2(). -// -// Some Intel Gens (5~8) support AR24 with different modifiers than XR24 so -// this additionally checks that the requested format+modifier combination is -// valid on the non-opaque framebuffer before forcing to opaque. bool ForceUsingOpaqueFormatWorkaround( const scoped_refptr<ui::DrmDevice>& drm_device, - uint32_t drm_fourcc, - uint64_t drm_modifier) { - constexpr uint32_t kFallbackARGBFormats[] = { - DRM_FORMAT_ARGB8888, DRM_FORMAT_ARGB2101010, DRM_FORMAT_ABGR2101010, - DRM_FORMAT_RGBA1010102, DRM_FORMAT_BGRA1010102}; - - // Check that the format is supported for opaque fallback. - const bool is_fallback_format_with_alpha = - base::Contains(kFallbackARGBFormats, drm_fourcc); - if (!is_fallback_format_with_alpha) + uint32_t drm_fourcc) { + constexpr uint32_t kHighBitDepthARGBFormats[] = { + DRM_FORMAT_ARGB2101010, DRM_FORMAT_ABGR2101010, DRM_FORMAT_RGBA1010102, + DRM_FORMAT_BGRA1010102}; + const bool is_high_bit_depth_format_with_alpha = + base::Contains(kHighBitDepthARGBFormats, drm_fourcc); + if (!is_high_bit_depth_format_with_alpha) return false; - // Check if the format is supported at all. const std::vector<uint32_t>& supported_formats = drm_device->plane_manager()->GetSupportedFormats(); - if (!base::Contains(supported_formats, drm_fourcc)) - return true; - - // If it is supported, check if it's supported with the given modifier. - for (const auto& plane : drm_device->plane_manager()->planes()) { - if (base::Contains(plane->ModifiersForFormat(drm_fourcc), drm_modifier)) { - return false; - } - } - - return true; + return !base::Contains(supported_formats, drm_fourcc); } } // namespace @@ -76,10 +57,10 @@ const auto buffer_format = GetBufferFormatFromFourCCFormat(params.format); const uint32_t opaque_format = GetFourCCFormatForOpaqueFramebuffer(buffer_format); - const auto drm_format = ForceUsingOpaqueFormatWorkaround( - drm_device, params.format, params.modifier) - ? opaque_format - : params.format; + const auto drm_format = + ForceUsingOpaqueFormatWorkaround(drm_device, params.format) + ? opaque_format + : params.format; uint32_t framebuffer_id = 0; if (!drm_device->AddFramebuffer2(params.width, params.height, drm_format,
diff --git a/ui/ozone/platform/drm/gpu/drm_overlay_validator_unittest.cc b/ui/ozone/platform/drm/gpu/drm_overlay_validator_unittest.cc index 8c612b66..5dc1b0c 100644 --- a/ui/ozone/platform/drm/gpu/drm_overlay_validator_unittest.cc +++ b/ui/ozone/platform/drm/gpu/drm_overlay_validator_unittest.cc
@@ -49,6 +49,9 @@ public: DrmOverlayValidatorTest() = default; + DrmOverlayValidatorTest(const DrmOverlayValidatorTest&) = delete; + DrmOverlayValidatorTest& operator=(const DrmOverlayValidatorTest&) = delete; + void SetUp() override; void TearDown() override; @@ -124,8 +127,6 @@ private: void SetupControllers(); - - DISALLOW_COPY_AND_ASSIGN(DrmOverlayValidatorTest); }; void DrmOverlayValidatorTest::SetUp() {
diff --git a/ui/ozone/platform/drm/gpu/drm_window_unittest.cc b/ui/ozone/platform/drm/gpu/drm_window_unittest.cc index 0270ec0..b28d2c4 100644 --- a/ui/ozone/platform/drm/gpu/drm_window_unittest.cc +++ b/ui/ozone/platform/drm/gpu/drm_window_unittest.cc
@@ -76,6 +76,9 @@ public: DrmWindowTest() = default; + DrmWindowTest(const DrmWindowTest&) = delete; + DrmWindowTest& operator=(const DrmWindowTest&) = delete; + void SetUp() override; void TearDown() override; @@ -118,8 +121,6 @@ struct CrtcState { std::vector<PlaneState> planes; }; - - DISALLOW_COPY_AND_ASSIGN(DrmWindowTest); }; void DrmWindowTest::SetUp() {
diff --git a/ui/ozone/platform/drm/gpu/gbm_pixmap.h b/ui/ozone/platform/drm/gpu/gbm_pixmap.h index a2e9872..d942bb0 100644 --- a/ui/ozone/platform/drm/gpu/gbm_pixmap.h +++ b/ui/ozone/platform/drm/gpu/gbm_pixmap.h
@@ -24,6 +24,9 @@ std::unique_ptr<GbmBuffer> buffer, scoped_refptr<DrmFramebuffer> framebuffer); + GbmPixmap(const GbmPixmap&) = delete; + GbmPixmap& operator=(const GbmPixmap&) = delete; + // NativePixmap: bool AreDmaBufFdsValid() const override; int GetDmaBufFd(size_t plane) const override; @@ -59,8 +62,6 @@ GbmSurfaceFactory* const surface_manager_; const std::unique_ptr<GbmBuffer> buffer_; const scoped_refptr<DrmFramebuffer> framebuffer_; - - DISALLOW_COPY_AND_ASSIGN(GbmPixmap); }; } // namespace ui
diff --git a/ui/ozone/platform/drm/gpu/gbm_surfaceless.h b/ui/ozone/platform/drm/gpu/gbm_surfaceless.h index 93b9f0d..8eec0de0 100644 --- a/ui/ozone/platform/drm/gpu/gbm_surfaceless.h +++ b/ui/ozone/platform/drm/gpu/gbm_surfaceless.h
@@ -37,6 +37,9 @@ std::unique_ptr<DrmWindowProxy> window, gfx::AcceleratedWidget widget); + GbmSurfaceless(const GbmSurfaceless&) = delete; + GbmSurfaceless& operator=(const GbmSurfaceless&) = delete; + void QueueOverlayPlane(DrmOverlayPlane plane); // gl::GLSurface: @@ -129,8 +132,6 @@ bool requires_gl_flush_on_swap_buffers_ = false; base::WeakPtrFactory<GbmSurfaceless> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(GbmSurfaceless); }; } // namespace ui
diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_unittest.cc b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_unittest.cc index c002804..bc60b9b 100644 --- a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_unittest.cc +++ b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_unittest.cc
@@ -64,6 +64,11 @@ public: HardwareDisplayPlaneManagerTest() = default; + HardwareDisplayPlaneManagerTest(const HardwareDisplayPlaneManagerTest&) = + delete; + HardwareDisplayPlaneManagerTest& operator=( + const HardwareDisplayPlaneManagerTest&) = delete; + void InitializeDrmState(size_t crtc_count, size_t planes_per_crtc); uint64_t GetObjectPropertyValue(uint32_t object_id, @@ -101,9 +106,6 @@ std::map<uint32_t, std::string> property_names_; bool use_atomic_ = false; - - private: - DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlaneManagerTest); }; void HardwareDisplayPlaneManagerTest::SetUp() { @@ -1175,12 +1177,9 @@ // If DRM supports high-bitdepth formats with Alpha, there's no need for // opaque decaying. Note that we have to support all |kFourCCFormats|. - std::vector<drm_format_modifier> drm_format_modifiers; - drm_format_modifiers.push_back( - {/*formats=*/3, /*offset=*/0, /*pad=*/0, DRM_FORMAT_MOD_LINEAR}); fake_drm_->SetPropertyBlob(ui::MockDrmDevice::AllocateInFormatsBlob( kInFormatsBlobPropId, {DRM_FORMAT_ARGB2101010, DRM_FORMAT_ABGR2101010}, - {drm_format_modifiers})); + {})); fake_drm_->InitializeState(crtc_properties_, connector_properties_, plane_properties_, property_names_, use_atomic_); @@ -1240,6 +1239,11 @@ protected: HardwareDisplayPlaneManagerPlanesReadyTest() = default; + HardwareDisplayPlaneManagerPlanesReadyTest( + const HardwareDisplayPlaneManagerPlanesReadyTest&) = delete; + HardwareDisplayPlaneManagerPlanesReadyTest& operator=( + const HardwareDisplayPlaneManagerPlanesReadyTest&) = delete; + void SetUp() override { auto gbm_device = std::make_unique<ui::MockGbmDevice>(); fake_drm_ = new ui::MockDrmDevice(std::move(gbm_device)); @@ -1289,9 +1293,6 @@ ui::DrmOverlayPlaneList planes_without_fences_; ui::DrmOverlayPlaneList planes_with_fences_; - - private: - DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlaneManagerPlanesReadyTest); }; void HardwareDisplayPlaneManagerPlanesReadyTest::RequestPlanesReady(
diff --git a/ui/ozone/platform/drm/gpu/mock_drm_device.h b/ui/ozone/platform/drm/gpu/mock_drm_device.h index 0c2d823f..5cd81b4 100644 --- a/ui/ozone/platform/drm/gpu/mock_drm_device.h +++ b/ui/ozone/platform/drm/gpu/mock_drm_device.h
@@ -58,6 +58,9 @@ explicit MockDrmDevice(std::unique_ptr<GbmDevice> gbm_device); + MockDrmDevice(const MockDrmDevice&) = delete; + MockDrmDevice& operator=(const MockDrmDevice&) = delete; + static ScopedDrmPropertyBlobPtr AllocateInFormatsBlob( uint32_t id, const std::vector<uint32_t>& supported_formats, @@ -268,8 +271,6 @@ uint64_t system_watermark_limitations_ = std::numeric_limits<uint64_t>::max(); base::flat_map<uint64_t /*modifier*/, int /*overhead*/> modifiers_overhead_; - - DISALLOW_COPY_AND_ASSIGN(MockDrmDevice); }; } // namespace ui
diff --git a/ui/ozone/platform/drm/gpu/page_flip_request.h b/ui/ozone/platform/drm/gpu/page_flip_request.h index c7fb160..03adde0 100644 --- a/ui/ozone/platform/drm/gpu/page_flip_request.h +++ b/ui/ozone/platform/drm/gpu/page_flip_request.h
@@ -22,6 +22,9 @@ PageFlipRequest(const base::TimeDelta& refresh_interval); + PageFlipRequest(const PageFlipRequest&) = delete; + PageFlipRequest& operator=(const PageFlipRequest&) = delete; + // Takes ownership of the swap completion callback to allow // asynchronous notification of completion. // @@ -45,8 +48,6 @@ PresentationOnceCallback callback_; int page_flip_count_ = 0; const base::TimeDelta refresh_interval_; - - DISALLOW_COPY_AND_ASSIGN(PageFlipRequest); }; } // namespace ui
diff --git a/ui/ozone/platform/drm/host/host_drm_device.h b/ui/ozone/platform/drm/host/host_drm_device.h index 8307dec2..cdbdfac 100644 --- a/ui/ozone/platform/drm/host/host_drm_device.h +++ b/ui/ozone/platform/drm/host/host_drm_device.h
@@ -36,6 +36,9 @@ public: explicit HostDrmDevice(DrmCursor* cursor); + HostDrmDevice(const HostDrmDevice&) = delete; + HostDrmDevice& operator=(const HostDrmDevice&) = delete; + void SetDisplayManager(DrmDisplayHostManager* display_manager); void OnGpuServiceLaunchedOnProcessThread( @@ -124,8 +127,6 @@ bool connected_ = false; base::ObserverList<GpuThreadObserver>::Unchecked gpu_thread_observers_; - - DISALLOW_COPY_AND_ASSIGN(HostDrmDevice); }; } // namespace ui
diff --git a/ui/ozone/platform/flatland/flatland_screen.cc b/ui/ozone/platform/flatland/flatland_screen.cc index 7569a13c..23a07066 100644 --- a/ui/ozone/platform/flatland/flatland_screen.cc +++ b/ui/ozone/platform/flatland/flatland_screen.cc
@@ -14,71 +14,22 @@ // TODO(crbug.com/1242052): Integrate with platform APIs for screen enumeration // and management, when available. -FlatlandScreen::FlatlandScreen() : weak_factory_(this) {} +FlatlandScreen::FlatlandScreen() + : displays_({display::Display::GetDefaultDisplay()}) {} FlatlandScreen::~FlatlandScreen() = default; -void FlatlandScreen::OnWindowAdded(int32_t window_id) { - // Ensure that |window_id| is greater than the id of all other windows. This - // allows pushing the new entry to the end of the list while keeping it - // sorted. - DCHECK(displays_.empty() || (window_id > displays_.back().id())); - displays_.push_back(display::Display(window_id)); - - for (auto& observer : observers_) - observer.OnDisplayAdded(displays_.back()); -} - -void FlatlandScreen::OnWindowRemoved(int32_t window_id) { - auto display_it = std::find_if(displays_.begin(), displays_.end(), - [window_id](display::Display& display) { - return display.id() == window_id; - }); - DCHECK(display_it != displays_.end()); - display::Display removed_display = *display_it; - displays_.erase(display_it); - - for (auto& observer : observers_) { - observer.OnDisplayRemoved(removed_display); - observer.OnDidRemoveDisplays(); - } -} - -void FlatlandScreen::OnWindowBoundsChanged(int32_t window_id, - gfx::Rect bounds) { - auto display_it = std::find_if(displays_.begin(), displays_.end(), - [window_id](display::Display& display) { - return display.id() == window_id; - }); - DCHECK(display_it != displays_.end()); - display_it->set_bounds(bounds); -} - -base::WeakPtr<FlatlandScreen> FlatlandScreen::GetWeakPtr() { - return weak_factory_.GetWeakPtr(); -} - const std::vector<display::Display>& FlatlandScreen::GetAllDisplays() const { return displays_; } display::Display FlatlandScreen::GetPrimaryDisplay() const { - // There is no primary display. - return display::Display(); + return displays_[0]; } display::Display FlatlandScreen::GetDisplayForAcceleratedWidget( gfx::AcceleratedWidget widget) const { - auto display_it = std::find_if(displays_.begin(), displays_.end(), - [widget](const display::Display& display) { - return display.id() == widget; - }); - if (display_it == displays_.end()) { - NOTREACHED(); - return display::Display(); - } - - return *display_it; + return displays_[0]; } gfx::Point FlatlandScreen::GetCursorScreenPoint() const { @@ -94,22 +45,16 @@ display::Display FlatlandScreen::GetDisplayNearestPoint( const gfx::Point& point) const { - NOTIMPLEMENTED_LOG_ONCE(); - return display::Display(); + return displays_[0]; } display::Display FlatlandScreen::GetDisplayMatching( const gfx::Rect& match_rect) const { - NOTIMPLEMENTED_LOG_ONCE(); - return display::Display(); + return displays_[0]; } -void FlatlandScreen::AddObserver(display::DisplayObserver* observer) { - observers_.AddObserver(observer); -} +void FlatlandScreen::AddObserver(display::DisplayObserver* observer) {} -void FlatlandScreen::RemoveObserver(display::DisplayObserver* observer) { - observers_.RemoveObserver(observer); -} +void FlatlandScreen::RemoveObserver(display::DisplayObserver* observer) {} } // namespace ui
diff --git a/ui/ozone/platform/flatland/flatland_screen.h b/ui/ozone/platform/flatland/flatland_screen.h index 39d4dc6..c8235b88 100644 --- a/ui/ozone/platform/flatland/flatland_screen.h +++ b/ui/ozone/platform/flatland/flatland_screen.h
@@ -23,13 +23,6 @@ FlatlandScreen(const FlatlandScreen&) = delete; FlatlandScreen& operator=(const FlatlandScreen&) = delete; - // Processes window state change events for the FlatlandWindow |window_id_|. - void OnWindowAdded(int32_t window_id); - void OnWindowRemoved(int32_t window_id); - void OnWindowBoundsChanged(int32_t window_id, gfx::Rect bounds); - - base::WeakPtr<FlatlandScreen> GetWeakPtr(); - // display::Screen implementation. const std::vector<display::Display>& GetAllDisplays() const override; display::Display GetPrimaryDisplay() const override; @@ -46,13 +39,7 @@ void RemoveObserver(display::DisplayObserver* observer) override; private: - using DisplayVector = std::vector<display::Display>; - - DisplayVector displays_; - - base::ObserverList<display::DisplayObserver> observers_; - - base::WeakPtrFactory<FlatlandScreen> weak_factory_; + std::vector<display::Display> displays_; }; } // namespace ui
diff --git a/ui/ozone/platform/flatland/flatland_window.cc b/ui/ozone/platform/flatland/flatland_window.cc index 849ad44e..8d12f75 100644 --- a/ui/ozone/platform/flatland/flatland_window.cc +++ b/ui/ozone/platform/flatland/flatland_window.cc
@@ -213,11 +213,6 @@ bounds_ = gfx::Rect(ceilf(width * device_pixel_ratio_), ceilf(height * device_pixel_ratio_)); - // Update this window's Screen's dimensions to match the new size. - FlatlandScreen* screen = manager_->screen(); - if (screen) - screen->OnWindowBoundsChanged(window_id_, bounds_); - // TODO(crbug.com/1230150): Handle zero size scenario. // Translate the node by half of the view dimensions to put it in the center
diff --git a/ui/ozone/platform/flatland/flatland_window_manager.cc b/ui/ozone/platform/flatland/flatland_window_manager.cc index 1c4bc855f..e032b1c 100644 --- a/ui/ozone/platform/flatland/flatland_window_manager.cc +++ b/ui/ozone/platform/flatland/flatland_window_manager.cc
@@ -23,24 +23,17 @@ std::unique_ptr<PlatformScreen> FlatlandWindowManager::CreateScreen() { DCHECK(windows_.IsEmpty()); - auto screen = std::make_unique<FlatlandScreen>(); - screen_ = screen->GetWeakPtr(); - return screen; + return std::make_unique<FlatlandScreen>(); } int32_t FlatlandWindowManager::AddWindow(FlatlandWindow* window) { - int32_t id = windows_.Add(window); - if (screen_) - screen_->OnWindowAdded(id); - return id; + return windows_.Add(window); } void FlatlandWindowManager::RemoveWindow(int32_t window_id, FlatlandWindow* window) { DCHECK_EQ(window, windows_.Lookup(window_id)); windows_.Remove(window_id); - if (screen_) - screen_->OnWindowRemoved(window_id); } FlatlandWindow* FlatlandWindowManager::GetWindow(int32_t window_id) {
diff --git a/ui/ozone/platform/flatland/flatland_window_manager.h b/ui/ozone/platform/flatland/flatland_window_manager.h index 389f82e..2b6ca564 100644 --- a/ui/ozone/platform/flatland/flatland_window_manager.h +++ b/ui/ozone/platform/flatland/flatland_window_manager.h
@@ -46,14 +46,10 @@ // Called by FlatlandWindow destructor to unregister |window|. void RemoveWindow(int32_t window_id, FlatlandWindow* window); - FlatlandScreen* screen() { return screen_.get(); } - FlatlandWindow* GetWindow(int32_t window_id); private: base::IDMap<FlatlandWindow*> windows_; - - base::WeakPtr<FlatlandScreen> screen_; }; } // namespace ui
diff --git a/ui/ozone/platform/headless/headless_surface_factory.cc b/ui/ozone/platform/headless/headless_surface_factory.cc index d207c4a..4d0cf76 100644 --- a/ui/ozone/platform/headless/headless_surface_factory.cc +++ b/ui/ozone/platform/headless/headless_surface_factory.cc
@@ -110,6 +110,9 @@ explicit FileGLSurface(const base::FilePath& location) : location_(location) {} + FileGLSurface(const FileGLSurface&) = delete; + FileGLSurface& operator=(const FileGLSurface&) = delete; + private: ~FileGLSurface() override = default; @@ -135,14 +138,15 @@ } base::FilePath location_; - - DISALLOW_COPY_AND_ASSIGN(FileGLSurface); }; class TestPixmap : public gfx::NativePixmap { public: explicit TestPixmap(gfx::BufferFormat format) : format_(format) {} + TestPixmap(const TestPixmap&) = delete; + TestPixmap& operator=(const TestPixmap&) = delete; + bool AreDmaBufFdsValid() const override { return false; } int GetDmaBufFd(size_t plane) const override { return -1; } uint32_t GetDmaBufPitch(size_t plane) const override { return 0; } @@ -177,8 +181,6 @@ ~TestPixmap() override {} gfx::BufferFormat format_; - - DISALLOW_COPY_AND_ASSIGN(TestPixmap); }; class GLOzoneEGLHeadless : public GLOzoneEGL {
diff --git a/ui/ozone/platform/scenic/scenic_screen.cc b/ui/ozone/platform/scenic/scenic_screen.cc index 82b7c55..082472e 100644 --- a/ui/ozone/platform/scenic/scenic_screen.cc +++ b/ui/ozone/platform/scenic/scenic_screen.cc
@@ -11,73 +11,22 @@ namespace ui { -// TODO(crbug.com/1242052): Integrate with platform APIs for screen enumeration -// and management, when available. - -ScenicScreen::ScenicScreen() : weak_factory_(this) {} +ScenicScreen::ScenicScreen() + : displays_({display::Display::GetDefaultDisplay()}) {} ScenicScreen::~ScenicScreen() = default; -void ScenicScreen::OnWindowAdded(int32_t window_id) { - // Ensure that |window_id| is greater than the id of all other windows. This - // allows pushing the new entry to the end of the list while keeping it - // sorted. - DCHECK(displays_.empty() || (window_id > displays_.back().id())); - displays_.push_back(display::Display(window_id)); - - for (auto& observer : observers_) - observer.OnDisplayAdded(displays_.back()); -} - -void ScenicScreen::OnWindowRemoved(int32_t window_id) { - auto display_it = std::find_if(displays_.begin(), displays_.end(), - [window_id](display::Display& display) { - return display.id() == window_id; - }); - DCHECK(display_it != displays_.end()); - display::Display removed_display = *display_it; - displays_.erase(display_it); - - for (auto& observer : observers_) { - observer.OnDisplayRemoved(removed_display); - observer.OnDidRemoveDisplays(); - } -} - -void ScenicScreen::OnWindowBoundsChanged(int32_t window_id, gfx::Rect bounds) { - auto display_it = std::find_if(displays_.begin(), displays_.end(), - [window_id](display::Display& display) { - return display.id() == window_id; - }); - DCHECK(display_it != displays_.end()); - display_it->set_bounds(bounds); -} - -base::WeakPtr<ScenicScreen> ScenicScreen::GetWeakPtr() { - return weak_factory_.GetWeakPtr(); -} - const std::vector<display::Display>& ScenicScreen::GetAllDisplays() const { return displays_; } display::Display ScenicScreen::GetPrimaryDisplay() const { - // There is no primary display. - return display::Display(); + return displays_[0]; } display::Display ScenicScreen::GetDisplayForAcceleratedWidget( gfx::AcceleratedWidget widget) const { - auto display_it = std::find_if(displays_.begin(), displays_.end(), - [widget](const display::Display& display) { - return display.id() == widget; - }); - if (display_it == displays_.end()) { - NOTREACHED(); - return display::Display(); - } - - return *display_it; + return displays_[0]; } gfx::Point ScenicScreen::GetCursorScreenPoint() const { @@ -93,22 +42,16 @@ display::Display ScenicScreen::GetDisplayNearestPoint( const gfx::Point& point) const { - NOTIMPLEMENTED_LOG_ONCE(); - return display::Display(); + return displays_[0]; } display::Display ScenicScreen::GetDisplayMatching( const gfx::Rect& match_rect) const { - NOTIMPLEMENTED_LOG_ONCE(); - return display::Display(); + return displays_[0]; } -void ScenicScreen::AddObserver(display::DisplayObserver* observer) { - observers_.AddObserver(observer); -} +void ScenicScreen::AddObserver(display::DisplayObserver* observer) {} -void ScenicScreen::RemoveObserver(display::DisplayObserver* observer) { - observers_.RemoveObserver(observer); -} +void ScenicScreen::RemoveObserver(display::DisplayObserver* observer) {} } // namespace ui
diff --git a/ui/ozone/platform/scenic/scenic_screen.h b/ui/ozone/platform/scenic/scenic_screen.h index 268bfbc..84f3469 100644 --- a/ui/ozone/platform/scenic/scenic_screen.h +++ b/ui/ozone/platform/scenic/scenic_screen.h
@@ -25,13 +25,6 @@ ~ScenicScreen() override; - // Processes window state change events for the ScenicWindow |window_id_|. - void OnWindowAdded(int32_t window_id); - void OnWindowRemoved(int32_t window_id); - void OnWindowBoundsChanged(int32_t window_id, gfx::Rect bounds); - - base::WeakPtr<ScenicScreen> GetWeakPtr(); - // display::Screen implementation. const std::vector<display::Display>& GetAllDisplays() const override; display::Display GetPrimaryDisplay() const override; @@ -48,13 +41,7 @@ void RemoveObserver(display::DisplayObserver* observer) override; private: - using DisplayVector = std::vector<display::Display>; - - DisplayVector displays_; - - base::ObserverList<display::DisplayObserver> observers_; - - base::WeakPtrFactory<ScenicScreen> weak_factory_; + std::vector<display::Display> displays_; }; } // namespace ui
diff --git a/ui/ozone/platform/scenic/scenic_window.cc b/ui/ozone/platform/scenic/scenic_window.cc index e97dc59..2692347 100644 --- a/ui/ozone/platform/scenic/scenic_window.cc +++ b/ui/ozone/platform/scenic/scenic_window.cc
@@ -356,11 +356,6 @@ bounds_ = gfx::Rect(ceilf(width * device_pixel_ratio_), ceilf(height * device_pixel_ratio_)); - // Update this window's Screen's dimensions to match the new size. - ScenicScreen* screen = manager_->screen(); - if (screen) - screen->OnWindowBoundsChanged(window_id_, bounds_); - // Update the root node to be shown, or hidden, based on the View state. // If the root node is not visible then skip resizing content, etc. if (!UpdateRootNodeVisibility())
diff --git a/ui/ozone/platform/scenic/scenic_window_manager.cc b/ui/ozone/platform/scenic/scenic_window_manager.cc index 6a0a177b..945d7f0 100644 --- a/ui/ozone/platform/scenic/scenic_window_manager.cc +++ b/ui/ozone/platform/scenic/scenic_window_manager.cc
@@ -26,9 +26,7 @@ std::unique_ptr<PlatformScreen> ScenicWindowManager::CreateScreen() { DCHECK(windows_.IsEmpty()); - auto screen = std::make_unique<ScenicScreen>(); - screen_ = screen->GetWeakPtr(); - return screen; + return std::make_unique<ScenicScreen>(); } fuchsia::ui::scenic::Scenic* ScenicWindowManager::GetScenic() { @@ -43,18 +41,13 @@ } int32_t ScenicWindowManager::AddWindow(ScenicWindow* window) { - int32_t id = windows_.Add(window); - if (screen_) - screen_->OnWindowAdded(id); - return id; + return windows_.Add(window); } void ScenicWindowManager::RemoveWindow(int32_t window_id, ScenicWindow* window) { DCHECK_EQ(window, windows_.Lookup(window_id)); windows_.Remove(window_id); - if (screen_) - screen_->OnWindowRemoved(window_id); } ScenicWindow* ScenicWindowManager::GetWindow(int32_t window_id) {
diff --git a/ui/ozone/platform/scenic/scenic_window_manager.h b/ui/ozone/platform/scenic/scenic_window_manager.h index dc88955..51a2ec1 100644 --- a/ui/ozone/platform/scenic/scenic_window_manager.h +++ b/ui/ozone/platform/scenic/scenic_window_manager.h
@@ -54,15 +54,11 @@ // Called by ScenicWindow destructor to unregister |window|. void RemoveWindow(int32_t window_id, ScenicWindow* window); - ScenicScreen* screen() { return screen_.get(); } - ScenicWindow* GetWindow(int32_t window_id); private: base::IDMap<ScenicWindow*> windows_; - base::WeakPtr<ScenicScreen> screen_; - fuchsia::ui::scenic::ScenicPtr scenic_; };
diff --git a/ui/ozone/platform/scenic/sysmem_buffer_collection.h b/ui/ozone/platform/scenic/sysmem_buffer_collection.h index bef972c..840af37 100644 --- a/ui/ozone/platform/scenic/sysmem_buffer_collection.h +++ b/ui/ozone/platform/scenic/sysmem_buffer_collection.h
@@ -45,6 +45,9 @@ SysmemBufferCollection(); explicit SysmemBufferCollection(gfx::SysmemBufferCollectionId id); + SysmemBufferCollection(const SysmemBufferCollection&) = delete; + SysmemBufferCollection& operator=(const SysmemBufferCollection&) = delete; + // Initializes the buffer collection and registers it with Vulkan using the // specified |vk_device|. If |token_handle| is null then a new collection // collection is created. |size| may be empty. In that case |token_handle| @@ -149,8 +152,6 @@ bool is_protected_ = false; base::OnceClosure on_deleted_; - - DISALLOW_COPY_AND_ASSIGN(SysmemBufferCollection); }; } // namespace ui
diff --git a/ui/ozone/platform/wayland/BUILD.gn b/ui/ozone/platform/wayland/BUILD.gn index f8d75d7..0ca9d55 100644 --- a/ui/ozone/platform/wayland/BUILD.gn +++ b/ui/ozone/platform/wayland/BUILD.gn
@@ -225,6 +225,7 @@ "//third_party/wayland-protocols:presentation_time_protocol", "//third_party/wayland-protocols:primary_selection_protocol", "//third_party/wayland-protocols:relative_pointer_protocol", + "//third_party/wayland-protocols:text_input_extension_protocol", "//third_party/wayland-protocols:text_input_protocol", "//third_party/wayland-protocols:viewporter_protocol", "//third_party/wayland-protocols:wayland_drm_protocol", @@ -364,6 +365,8 @@ "test/mock_xdg_shell.h", "test/mock_xdg_surface.cc", "test/mock_xdg_surface.h", + "test/mock_zcr_extended_text_input.cc", + "test/mock_zcr_extended_text_input.h", "test/mock_zwp_linux_dmabuf.cc", "test/mock_zwp_linux_dmabuf.h", "test/mock_zwp_text_input.cc", @@ -418,6 +421,8 @@ "test/test_wayland_server_thread.h", "test/test_xdg_popup.cc", "test/test_xdg_popup.h", + "test/test_zcr_text_input_extension.cc", + "test/test_zcr_text_input_extension.h", "test/test_zwp_linux_buffer_params.cc", "test/test_zwp_linux_buffer_params.h", "test/test_zwp_linux_explicit_synchronization.cc", @@ -445,6 +450,7 @@ "//third_party/wayland-protocols:linux_explicit_synchronization_protocol", "//third_party/wayland-protocols:presentation_time_protocol", "//third_party/wayland-protocols:primary_selection_protocol", + "//third_party/wayland-protocols:text_input_extension_protocol", "//third_party/wayland-protocols:text_input_protocol", "//third_party/wayland-protocols:viewporter_protocol", "//third_party/wayland-protocols:xdg_shell_protocol", @@ -488,6 +494,7 @@ "//third_party/wayland-protocols:cursor_shapes_protocol", "//third_party/wayland-protocols:keyboard_extension_protocol", "//third_party/wayland-protocols:linux_dmabuf_protocol", + "//third_party/wayland-protocols:text_input_extension_protocol", "//third_party/wayland-protocols:text_input_protocol", "//third_party/wayland-protocols:xdg_shell_protocol", "//ui/base",
diff --git a/ui/ozone/platform/wayland/common/wayland_object.cc b/ui/ozone/platform/wayland/common/wayland_object.cc index 1fea999..02e4845 100644 --- a/ui/ozone/platform/wayland/common/wayland_object.cc +++ b/ui/ozone/platform/wayland/common/wayland_object.cc
@@ -21,6 +21,7 @@ #include <presentation-time-client-protocol.h> #include <primary-selection-unstable-v1-client-protocol.h> #include <relative-pointer-unstable-v1-client-protocol.h> +#include <text-input-extension-unstable-v1-client-protocol.h> #include <text-input-unstable-v1-client-protocol.h> #include <viewporter-client-protocol.h> #include <wayland-client-core.h> @@ -147,6 +148,8 @@ IMPLEMENT_WAYLAND_OBJECT_TRAITS(zcr_extended_drag_v1) IMPLEMENT_WAYLAND_OBJECT_TRAITS(zcr_extended_drag_source_v1) IMPLEMENT_WAYLAND_OBJECT_TRAITS(zcr_extended_drag_offer_v1) +IMPLEMENT_WAYLAND_OBJECT_TRAITS(zcr_extended_text_input_v1) +IMPLEMENT_WAYLAND_OBJECT_TRAITS(zcr_text_input_extension_v1) IMPLEMENT_WAYLAND_OBJECT_TRAITS(zcr_blending_v1) IMPLEMENT_WAYLAND_OBJECT_TRAITS(zcr_alpha_compositing_v1) IMPLEMENT_WAYLAND_OBJECT_TRAITS(zwp_idle_inhibit_manager_v1)
diff --git a/ui/ozone/platform/wayland/common/wayland_object.h b/ui/ozone/platform/wayland/common/wayland_object.h index 6aafd59..d7778f4 100644 --- a/ui/ozone/platform/wayland/common/wayland_object.h +++ b/ui/ozone/platform/wayland/common/wayland_object.h
@@ -146,6 +146,8 @@ DECLARE_WAYLAND_OBJECT_TRAITS(zcr_extended_drag_v1) DECLARE_WAYLAND_OBJECT_TRAITS(zcr_extended_drag_source_v1) DECLARE_WAYLAND_OBJECT_TRAITS(zcr_extended_drag_offer_v1) +DECLARE_WAYLAND_OBJECT_TRAITS(zcr_extended_text_input_v1) +DECLARE_WAYLAND_OBJECT_TRAITS(zcr_text_input_extension_v1) DECLARE_WAYLAND_OBJECT_TRAITS(zwp_idle_inhibit_manager_v1) DECLARE_WAYLAND_OBJECT_TRAITS(zwp_idle_inhibitor_v1) DECLARE_WAYLAND_OBJECT_TRAITS(zwp_linux_buffer_release_v1)
diff --git a/ui/ozone/platform/wayland/gpu/gbm_pixmap_wayland.h b/ui/ozone/platform/wayland/gpu/gbm_pixmap_wayland.h index 91d3cc7..b69ed891 100644 --- a/ui/ozone/platform/wayland/gpu/gbm_pixmap_wayland.h +++ b/ui/ozone/platform/wayland/gpu/gbm_pixmap_wayland.h
@@ -25,6 +25,9 @@ public: explicit GbmPixmapWayland(WaylandBufferManagerGpu* buffer_manager); + GbmPixmapWayland(const GbmPixmapWayland&) = delete; + GbmPixmapWayland& operator=(const GbmPixmapWayland&) = delete; + // Creates a buffer object and initializes the pixmap buffer. // |visible_area_size| represents a 'visible size', i.e., a buffer // of size |size| may actually contain visible data only in the @@ -92,8 +95,6 @@ // Size of the visible area of the buffer. gfx::Size visible_area_size_; - - DISALLOW_COPY_AND_ASSIGN(GbmPixmapWayland); }; } // namespace ui
diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h index 1c088c1..fc5cdd79 100644 --- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h +++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h
@@ -33,6 +33,9 @@ GbmSurfacelessWayland(WaylandBufferManagerGpu* buffer_manager, gfx::AcceleratedWidget widget); + GbmSurfacelessWayland(const GbmSurfacelessWayland&) = delete; + GbmSurfacelessWayland& operator=(const GbmSurfacelessWayland&) = delete; + void QueueOverlayPlane(OverlayPlane plane, BufferId buffer_id); // gl::GLSurface: @@ -153,8 +156,6 @@ float surface_scale_factor_ = 1.f; base::WeakPtrFactory<GbmSurfacelessWayland> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(GbmSurfacelessWayland); }; } // namespace ui
diff --git a/ui/ozone/platform/wayland/gpu/gl_surface_wayland.h b/ui/ozone/platform/wayland/gpu/gl_surface_wayland.h index d6822ad..e38a0201 100644 --- a/ui/ozone/platform/wayland/gpu/gl_surface_wayland.h +++ b/ui/ozone/platform/wayland/gpu/gl_surface_wayland.h
@@ -31,6 +31,9 @@ GLSurfaceWayland(WaylandEglWindowPtr egl_window, WaylandWindow* window); + GLSurfaceWayland(const GLSurfaceWayland&) = delete; + GLSurfaceWayland& operator=(const GLSurfaceWayland&) = delete; + // gl::GLSurface: bool Resize(const gfx::Size& size, float scale_factor, @@ -53,8 +56,6 @@ WaylandWindow* const window_; float scale_factor_ = 1.f; - - DISALLOW_COPY_AND_ASSIGN(GLSurfaceWayland); }; } // namespace ui
diff --git a/ui/ozone/platform/wayland/host/shell_popup_wrapper.cc b/ui/ozone/platform/wayland/host/shell_popup_wrapper.cc index a4fa384..3a7d04d 100644 --- a/ui/ozone/platform/wayland/host/shell_popup_wrapper.cc +++ b/ui/ozone/platform/wayland/host/shell_popup_wrapper.cc
@@ -5,6 +5,7 @@ #include "ui/ozone/platform/wayland/host/shell_popup_wrapper.h" #include "base/check_op.h" +#include "base/command_line.h" #include "base/debug/stack_trace.h" #include "base/environment.h" #include "base/logging.h" @@ -18,6 +19,7 @@ #include "ui/ozone/platform/wayland/host/wayland_serial_tracker.h" #include "ui/ozone/platform/wayland/host/wayland_toplevel_window.h" #include "ui/ozone/platform/wayland/host/wayland_window.h" +#include "ui/ozone/public/ozone_switches.h" #include "ui/platform_window/platform_window_init_properties.h" namespace ui { @@ -65,6 +67,10 @@ void ShellPopupWrapper::GrabIfPossible(WaylandConnection* connection, WaylandWindow* parent_window) { + base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); + if (!cmd_line->HasSwitch(switches::kUseWaylandExplicitGrab)) + return; + // When drag process starts, as described the protocol - // https://goo.gl/1Mskq3, the client must have an active implicit grab. If // we try to create a popup and grab it, it will be immediately dismissed.
diff --git a/ui/ozone/platform/wayland/host/wayland_connection.cc b/ui/ozone/platform/wayland/host/wayland_connection.cc index c93bd97..25c1f34 100644 --- a/ui/ozone/platform/wayland/host/wayland_connection.cc +++ b/ui/ozone/platform/wayland/host/wayland_connection.cc
@@ -80,6 +80,7 @@ constexpr uint32_t kMaxWpPresentationVersion = 1; constexpr uint32_t kMaxWpViewporterVersion = 1; constexpr uint32_t kMaxTextInputManagerVersion = 1; +constexpr uint32_t kMaxTextInputExtensionVersion = 1; constexpr uint32_t kMaxExplicitSyncVersion = 2; constexpr uint32_t kMaxAlphaCompositingVersion = 1; constexpr uint32_t kMaxXdgDecorationVersion = 1; @@ -566,6 +567,11 @@ LOG(ERROR) << "Failed to bind to zwp_text_input_manager_v1 global"; return; } + } else if (!connection->text_input_extension_v1_ && + strcmp(interface, "zcr_text_input_extension_v1") == 0) { + connection->text_input_extension_v1_ = + wl::Bind<zcr_text_input_extension_v1>( + registry, name, std::min(version, kMaxTextInputExtensionVersion)); } else if (!connection->xdg_decoration_manager_ && strcmp(interface, "zxdg_decoration_manager_v1") == 0) { connection->xdg_decoration_manager_ =
diff --git a/ui/ozone/platform/wayland/host/wayland_connection.h b/ui/ozone/platform/wayland/host/wayland_connection.h index e148bda..32d3aa9 100644 --- a/ui/ozone/platform/wayland/host/wayland_connection.h +++ b/ui/ozone/platform/wayland/host/wayland_connection.h
@@ -131,6 +131,9 @@ zwp_text_input_manager_v1* text_input_manager_v1() const { return text_input_manager_v1_.get(); } + zcr_text_input_extension_v1* text_input_extension_v1() const { + return text_input_extension_v1_.get(); + } zwp_linux_explicit_synchronization_v1* linux_explicit_synchronization_v1() const { return linux_explicit_synchronization_.get(); @@ -347,6 +350,7 @@ wl::Object<zcr_alpha_compositing_v1> alpha_compositing_; wl::Object<zcr_keyboard_extension_v1> keyboard_extension_v1_; wl::Object<zwp_text_input_manager_v1> text_input_manager_v1_; + wl::Object<zcr_text_input_extension_v1> text_input_extension_v1_; wl::Object<zwp_linux_explicit_synchronization_v1> linux_explicit_synchronization_; wl::Object<zxdg_decoration_manager_v1> xdg_decoration_manager_;
diff --git a/ui/ozone/platform/wayland/host/wayland_data_device_base.h b/ui/ozone/platform/wayland/host/wayland_data_device_base.h index a074cf4a..55a63aa 100644 --- a/ui/ozone/platform/wayland/host/wayland_data_device_base.h +++ b/ui/ozone/platform/wayland/host/wayland_data_device_base.h
@@ -37,6 +37,10 @@ }; explicit WaylandDataDeviceBase(WaylandConnection* connection); + + WaylandDataDeviceBase(const WaylandDataDeviceBase&) = delete; + WaylandDataDeviceBase& operator=(const WaylandDataDeviceBase&) = delete; + virtual ~WaylandDataDeviceBase(); // Sets the delegate instance responsible for handling section events. @@ -97,8 +101,6 @@ // Before blocking on read(), make sure server has written data on the pipe. base::OnceClosure deferred_read_closure_; wl::Object<wl_callback> deferred_read_callback_; - - DISALLOW_COPY_AND_ASSIGN(WaylandDataDeviceBase); }; } // namespace ui
diff --git a/ui/ozone/platform/wayland/host/wayland_event_source_unittest.cc b/ui/ozone/platform/wayland/host/wayland_event_source_unittest.cc index 0f541d3a..77994d52 100644 --- a/ui/ozone/platform/wayland/host/wayland_event_source_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_event_source_unittest.cc
@@ -27,6 +27,9 @@ public: WaylandEventSourceTest() {} + WaylandEventSourceTest(const WaylandEventSourceTest&) = delete; + WaylandEventSourceTest& operator=(const WaylandEventSourceTest&) = delete; + void SetUp() override { WaylandTest::SetUp(); @@ -50,9 +53,6 @@ } WaylandPointer::Delegate* pointer_delegate_ = nullptr; - - private: - DISALLOW_COPY_AND_ASSIGN(WaylandEventSourceTest); }; // Verify WaylandEventSource properly manages its internal state as pointer
diff --git a/ui/ozone/platform/wayland/host/wayland_input_method_context.cc b/ui/ozone/platform/wayland/host/wayland_input_method_context.cc index 5a25d9cc..7c8e9bd 100644 --- a/ui/ozone/platform/wayland/host/wayland_input_method_context.cc +++ b/ui/ozone/platform/wayland/host/wayland_input_method_context.cc
@@ -88,6 +88,36 @@ return false; } +// Returns ImeTextSpan style to be assigned. Maybe nullopt if it is not +// supported. +absl::optional<std::pair<ImeTextSpan::Type, ImeTextSpan::Thickness>> +ConvertStyle(uint32_t style) { + switch (style) { + case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_DEFAULT: + return absl::make_optional(std::make_pair(ImeTextSpan::Type::kComposition, + ImeTextSpan::Thickness::kNone)); + case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_HIGHLIGHT: + return absl::make_optional(std::make_pair( + ImeTextSpan::Type::kComposition, ImeTextSpan::Thickness::kThick)); + case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_UNDERLINE: + return absl::make_optional(std::make_pair(ImeTextSpan::Type::kComposition, + ImeTextSpan::Thickness::kThin)); + case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_SELECTION: + return absl::make_optional(std::make_pair(ImeTextSpan::Type::kSuggestion, + ImeTextSpan::Thickness::kNone)); + case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_INCORRECT: + return absl::make_optional( + std::make_pair(ImeTextSpan::Type::kMisspellingSuggestion, + ImeTextSpan::Thickness::kNone)); + case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_NONE: + case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_ACTIVE: + case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_INACTIVE: + default: + VLOG(1) << "Unsupported style. Skipped: " << style; + } + return absl::nullopt; +} + } // namespace WaylandInputMethodContext::WaylandInputMethodContext( @@ -121,7 +151,8 @@ if (use_ozone_wayland_vkb && !is_simple_ && !text_input_ && connection_->text_input_manager_v1()) { text_input_ = std::make_unique<ZWPTextInputWrapperV1>( - connection_, this, connection_->text_input_manager_v1()); + connection_, this, connection_->text_input_manager_v1(), + connection_->text_input_extension_v1()); } } @@ -222,6 +253,7 @@ return; surrounding_text_ = text_utf8; + selection_range_utf8_ = selection_range_utf8; if (text_utf8.size() <= kWaylandMessageDataMaxLength) { // We separate this case to run the function simpler and faster since this @@ -297,38 +329,15 @@ auto start_offset = OffsetFromUTF8Offset(text, span.index); if (!start_offset) continue; - text_span.start_offset = *start_offset; auto end_offset = OffsetFromUTF8Offset(text, span.index + span.length); if (!end_offset) continue; - text_span.end_offset = *end_offset; - bool supported = true; - switch (span.style) { - case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_DEFAULT: - break; - case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_HIGHLIGHT: - text_span.thickness = ImeTextSpan::Thickness::kThick; - break; - case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_UNDERLINE: - text_span.thickness = ImeTextSpan::Thickness::kThin; - break; - case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_SELECTION: - text_span.type = ImeTextSpan::Type::kSuggestion; - break; - case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_INCORRECT: - text_span.type = ImeTextSpan::Type::kMisspellingSuggestion; - break; - case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_NONE: - case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_ACTIVE: - case ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_INACTIVE: - default: - VLOG(1) << "Unsupported style. Skipped: " << span.style; - supported = false; - break; - } - if (!supported) + auto style = ConvertStyle(span.style); + if (!style.has_value()) continue; - composition_text.ime_text_spans.push_back(std::move(text_span)); + composition_text.ime_text_spans.emplace_back( + /* type= */ style->first, *start_offset, *end_offset, + /* thickness = */ style->second); } if (preedit_cursor < 0) { @@ -407,6 +416,67 @@ #endif } +void WaylandInputMethodContext::OnSetPreeditRegion( + int32_t index, + uint32_t length, + const std::vector<SpanStyle>& spans) { + // |index| and |length| are expected to be in UTF8. |index| is relative to the + // current cursor position. + if (surrounding_text_.empty() || !selection_range_utf8_.IsValid()) { + LOG(ERROR) << "SetSurroundingText should run before OnSetPreeditRegion."; + return; + } + + // Validation of index and length. + if (index < 0 && + selection_range_utf8_.end() < static_cast<uint32_t>(-index)) { + LOG(ERROR) << "Invalid starting point is specified"; + return; + } + size_t begin_utf8 = static_cast<size_t>( + static_cast<ssize_t>(selection_range_utf8_.end()) + index); + size_t end_utf8 = begin_utf8 + length; + if (end_utf8 > surrounding_text_.size()) { + LOG(ERROR) << "Too long preedit range is specified"; + return; + } + + std::vector<size_t> offsets = {begin_utf8, end_utf8}; + for (const auto& span : spans) { + offsets.push_back(begin_utf8 + span.index); + offsets.push_back(begin_utf8 + span.index + span.length); + } + base::UTF8ToUTF16AndAdjustOffsets(surrounding_text_, &offsets); + if (offsets[0] == std::u16string::npos || + offsets[1] == std::u16string::npos) { + LOG(ERROR) << "Invalid range is specified"; + return; + } + + std::vector<ui::ImeTextSpan> ime_text_spans; + for (size_t i = 0; i < spans.size(); ++i) { + size_t begin_span = offsets[i * 2 + 2]; + size_t end_span = offsets[i * 2 + 3]; + if (begin_span == std::u16string::npos || end_span == std::u16string::npos) + continue; + if (begin_span < offsets[0] || end_span < offsets[0] || + begin_span > offsets[1] || end_span > offsets[1]) { + // Out of composition range. + continue; + } + + auto style = ConvertStyle(spans[i].style); + if (!style.has_value()) + continue; + ime_text_spans.emplace_back(/* type= */ style->first, + begin_span - offsets[0], end_span - offsets[0], + /* thickness = */ style->second); + } + + ime_delegate_->OnSetPreeditRegion(gfx::Range(offsets[0], offsets[1]), + ime_text_spans); +} + void WaylandInputMethodContext::OnKeyboardFocusedWindowChanged() { MaybeUpdateActivated(); }
diff --git a/ui/ozone/platform/wayland/host/wayland_input_method_context.h b/ui/ozone/platform/wayland/host/wayland_input_method_context.h index 35223af..640376b 100644 --- a/ui/ozone/platform/wayland/host/wayland_input_method_context.h +++ b/ui/ozone/platform/wayland/host/wayland_input_method_context.h
@@ -11,6 +11,7 @@ #include "base/strings/string_piece.h" #include "ui/base/ime/character_composer.h" #include "ui/base/ime/linux/linux_input_method_context.h" +#include "ui/gfx/range/range.h" #include "ui/ozone/platform/wayland/host/wayland_keyboard.h" #include "ui/ozone/platform/wayland/host/wayland_window_observer.h" #include "ui/ozone/platform/wayland/host/zwp_text_input_wrapper.h" @@ -59,6 +60,9 @@ void OnCommitString(base::StringPiece text) override; void OnDeleteSurroundingText(int32_t index, uint32_t length) override; void OnKeysym(uint32_t keysym, uint32_t state, uint32_t modifiers) override; + void OnSetPreeditRegion(int32_t index, + uint32_t length, + const std::vector<SpanStyle>& spans) override; private: void UpdatePreeditText(const std::u16string& preedit_text); @@ -91,6 +95,8 @@ size_t surrounding_text_offset_ = 0; // The string in SetSurroundingText. std::string surrounding_text_; + // The selection range in UTF-8 offsets in the |surrounding_text_|. + gfx::Range selection_range_utf8_ = gfx::Range::InvalidRange(); }; } // namespace ui
diff --git a/ui/ozone/platform/wayland/host/wayland_input_method_context_unittest.cc b/ui/ozone/platform/wayland/host/wayland_input_method_context_unittest.cc index 5fe35a0..c9bff9c 100644 --- a/ui/ozone/platform/wayland/host/wayland_input_method_context_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_input_method_context_unittest.cc
@@ -6,9 +6,11 @@ #include <wayland-server.h> #include <memory> +#include "base/i18n/break_iterator.h" #include "base/strings/utf_string_conversions.h" #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/ime/linux/linux_input_method_context.h" #include "ui/events/event.h" #include "ui/gfx/range/range.h" @@ -16,6 +18,7 @@ #include "ui/ozone/platform/wayland/host/wayland_input_method_context_factory.h" #include "ui/ozone/platform/wayland/host/wayland_window.h" #include "ui/ozone/platform/wayland/test/mock_surface.h" +#include "ui/ozone/platform/wayland/test/mock_zcr_extended_text_input.h" #include "ui/ozone/platform/wayland/test/mock_zwp_text_input.h" #include "ui/ozone/platform/wayland/test/test_wayland_server_thread.h" #include "ui/ozone/platform/wayland/test/wayland_test.h" @@ -27,6 +30,19 @@ using ::testing::Values; namespace ui { +namespace { + +// Returns the number of grapheme clusters in the text. +absl::optional<size_t> CountGraphemeCluster(base::StringPiece16 text) { + base::i18n::BreakIterator iter(text, + base::i18n::BreakIterator::BREAK_CHARACTER); + if (!iter.Init()) + return absl::nullopt; + size_t result = 0; + while (iter.Advance()) + ++result; + return result; +} class TestInputMethodContextDelegate : public LinuxInputMethodContextDelegate { public: @@ -49,19 +65,29 @@ on_delete_surrounding_text_range_ = gfx::Range(index, index + length); } - bool was_on_commit_called() { return was_on_commit_called_; } + void OnSetPreeditRegion(const gfx::Range& range, + const std::vector<ImeTextSpan>& spans) override { + was_on_set_preedit_region_called_ = true; + } - bool was_on_preedit_changed_called() { + bool was_on_commit_called() const { return was_on_commit_called_; } + + bool was_on_preedit_changed_called() const { return was_on_preedit_changed_called_; } - absl::optional<gfx::Range> on_delete_surrounding_text_range() { + bool was_on_set_preedit_region_called() const { + return was_on_set_preedit_region_called_; + } + + absl::optional<gfx::Range> on_delete_surrounding_text_range() const { return on_delete_surrounding_text_range_; } private: bool was_on_commit_called_ = false; bool was_on_preedit_changed_called_ = false; + bool was_on_set_preedit_region_called_ = false; absl::optional<gfx::Range> on_delete_surrounding_text_range_; }; @@ -93,9 +119,13 @@ connection_->wayland_window_manager()->SetKeyboardFocusedWindow(nullptr); zwp_text_input_ = server_.text_input_manager_v1()->text_input(); - ASSERT_TRUE(connection_->text_input_manager_v1()); ASSERT_TRUE(zwp_text_input_); + + zcr_extended_text_input_ = + server_.text_input_extension_v1()->extended_text_input(); + ASSERT_TRUE(connection_->text_input_extension_v1()); + ASSERT_TRUE(zcr_extended_text_input_); } protected: @@ -103,6 +133,7 @@ input_method_context_delegate_; std::unique_ptr<WaylandInputMethodContext> input_method_context_; wl::MockZwpTextInput* zwp_text_input_ = nullptr; + wl::MockZcrExtendedTextInput* zcr_extended_text_input_ = nullptr; }; TEST_P(WaylandInputMethodContextTest, ActivateDeactivate) { @@ -327,6 +358,93 @@ EXPECT_TRUE(input_method_context_delegate_->was_on_commit_called()); } +TEST_P(WaylandInputMethodContextTest, OnSetPreeditRegion_Success) { + constexpr char16_t text[] = u"abcあdef"; + const gfx::Range range(3, 4); // あ is selected. + + // SetSurroundingText should be called in UTF-8. + EXPECT_CALL(*zwp_text_input_, + SetSurroundingText("abcあdef", gfx::Range(3, 6))); + input_method_context_->SetSurroundingText(text, range); + connection_->ScheduleFlush(); + Sync(); + Mock::VerifyAndClearExpectations(zwp_text_input_); + + // Specify "cあd" as a new preedit region. + zcr_extended_text_input_v1_send_set_preedit_region( + zcr_extended_text_input_->resource(), -4, 5); + Sync(); + EXPECT_TRUE( + input_method_context_delegate_->was_on_set_preedit_region_called()); +} + +TEST_P(WaylandInputMethodContextTest, OnSetPreeditRegion_NoSurroundingText) { + // If no surrounding text is set yet, set_preedit_region would fail. + zcr_extended_text_input_v1_send_set_preedit_region( + zcr_extended_text_input_->resource(), -1, 3); + Sync(); + EXPECT_FALSE( + input_method_context_delegate_->was_on_set_preedit_region_called()); +} + +// The range is represented in UTF-16 code points, so it is independent from +// grapheme clusters. +TEST_P(WaylandInputMethodContextTest, + OnSetPreeditRegion_GraphemeClusterIndependeceSimple) { + // Single code point representation of é. + constexpr char16_t u16_text[] = u"\u00E9"; + constexpr char u8_text[] = "\xC3\xA9"; // In UTF-8 encode. + + const gfx::Range u16_range(0, 1); + const gfx::Range u8_range(0, 2); + + // Double check the text has one grapheme cluster. + ASSERT_EQ(1u, CountGraphemeCluster(u16_text)); + + // SetSurroundingText should be called in UTF-8. + EXPECT_CALL(*zwp_text_input_, SetSurroundingText(u8_text, u8_range)); + input_method_context_->SetSurroundingText(u16_text, u16_range); + connection_->ScheduleFlush(); + Sync(); + Mock::VerifyAndClearExpectations(zwp_text_input_); + + // Specify the whole range as a new preedit region. + zcr_extended_text_input_v1_send_set_preedit_region( + zcr_extended_text_input_->resource(), + -static_cast<int32_t>(u8_range.length()), u8_range.length()); + Sync(); + EXPECT_TRUE( + input_method_context_delegate_->was_on_set_preedit_region_called()); +} + +TEST_P(WaylandInputMethodContextTest, + OnSetPreeditRegion_GraphemeClusterIndependeceCombined) { + // Decomposed code point representation of é. + constexpr char16_t u16_text[] = u"\u0065\u0301"; + constexpr char u8_text[] = "\x65\xCC\x81"; // In UTF-8 encode. + + const gfx::Range u16_range(0, 2); + const gfx::Range u8_range(0, 3); + + // Double check the text has one grapheme cluster. + ASSERT_EQ(1u, CountGraphemeCluster(u16_text)); + + // SetSurroundingText should be called in UTF-8. + EXPECT_CALL(*zwp_text_input_, SetSurroundingText(u8_text, u8_range)); + input_method_context_->SetSurroundingText(u16_text, u16_range); + connection_->ScheduleFlush(); + Sync(); + Mock::VerifyAndClearExpectations(zwp_text_input_); + + // Specify the whole range as a new preedit region. + zcr_extended_text_input_v1_send_set_preedit_region( + zcr_extended_text_input_->resource(), + -static_cast<int32_t>(u8_range.length()), u8_range.length()); + Sync(); + EXPECT_TRUE( + input_method_context_delegate_->was_on_set_preedit_region_called()); +} + INSTANTIATE_TEST_SUITE_P(XdgVersionStableTest, WaylandInputMethodContextTest, Values(wl::ServerConfig{ @@ -336,4 +454,5 @@ Values(wl::ServerConfig{ .shell_version = wl::ShellVersion::kV6})); +} // namespace } // namespace ui
diff --git a/ui/ozone/platform/wayland/host/wayland_keyboard_unittest.cc b/ui/ozone/platform/wayland/host/wayland_keyboard_unittest.cc index e43925c84..ec8ef4f 100644 --- a/ui/ozone/platform/wayland/host/wayland_keyboard_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_keyboard_unittest.cc
@@ -36,6 +36,9 @@ public: WaylandKeyboardTest() {} + WaylandKeyboardTest(const WaylandKeyboardTest&) = delete; + WaylandKeyboardTest& operator=(const WaylandKeyboardTest&) = delete; + void SetUp() override { WaylandTest::SetUp(); @@ -108,8 +111,6 @@ std::unique_ptr<xkb_keymap, ui::XkbKeymapDeleter> xkb_keymap_; std::unique_ptr<xkb_state, ui::XkbStateDeleter> xkb_state_; #endif - - DISALLOW_COPY_AND_ASSIGN(WaylandKeyboardTest); }; ACTION_P(CloneEvent, ptr) {
diff --git a/ui/ozone/platform/wayland/host/wayland_output.h b/ui/ozone/platform/wayland/host/wayland_output.h index 0beb4f4..fcf87cee 100644 --- a/ui/ozone/platform/wayland/host/wayland_output.h +++ b/ui/ozone/platform/wayland/host/wayland_output.h
@@ -40,6 +40,10 @@ }; WaylandOutput(uint32_t output_id, wl_output* output); + + WaylandOutput(const WaylandOutput&) = delete; + WaylandOutput& operator=(const WaylandOutput&) = delete; + ~WaylandOutput(); void Initialize(Delegate* delegate); @@ -93,8 +97,6 @@ gfx::Rect rect_in_physical_pixels_; Delegate* delegate_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(WaylandOutput); }; } // namespace ui
diff --git a/ui/ozone/platform/wayland/host/wayland_pointer_unittest.cc b/ui/ozone/platform/wayland/host/wayland_pointer_unittest.cc index 6a0108e7..30428f6 100644 --- a/ui/ozone/platform/wayland/host/wayland_pointer_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_pointer_unittest.cc
@@ -38,6 +38,9 @@ public: WaylandPointerTest() {} + WaylandPointerTest(const WaylandPointerTest&) = delete; + WaylandPointerTest& operator=(const WaylandPointerTest&) = delete; + void SetUp() override { WaylandTest::SetUp(); @@ -58,9 +61,6 @@ protected: wl::MockPointer* pointer_; - - private: - DISALLOW_COPY_AND_ASSIGN(WaylandPointerTest); }; void SendAxisEvents(struct wl_resource* resource,
diff --git a/ui/ozone/platform/wayland/host/wayland_subsurface.cc b/ui/ozone/platform/wayland/host/wayland_subsurface.cc index 8ba4ed8..1ff7728 100644 --- a/ui/ozone/platform/wayland/host/wayland_subsurface.cc +++ b/ui/ozone/platform/wayland/host/wayland_subsurface.cc
@@ -6,6 +6,7 @@ #include <cstdint> +#include "ui/gfx/geometry/rect.h" #include "ui/ozone/platform/wayland/common/wayland_util.h" #include "ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h" #include "ui/ozone/platform/wayland/host/wayland_connection.h" @@ -13,17 +14,15 @@ namespace { +// Returns DIP bounds of the subsurface relative to the parent surface. gfx::Rect AdjustSubsurfaceBounds(const gfx::Rect& bounds_px, const gfx::Rect& parent_bounds_px, - float ui_scale, - int32_t parent_buffer_scale) { - // TODO(fangzhoug): Verify the correctness of using ui_scale here, and in - // other ozone wayland files. - // Currently, the subsurface tree is at most 1 depth, gpu already sees buffer - // bounds in the root_surface-local coordinates. So translation is not - // needed for now. - const auto bounds_dip = gfx::ScaleToRoundedRect(bounds_px, 1.0 / ui_scale); - return gfx::ScaleToRoundedRect(bounds_dip, ui_scale / parent_buffer_scale); + int32_t buffer_scale) { + const auto bounds_dip = + gfx::ScaleToEnclosingRect(bounds_px, 1.0 / buffer_scale); + const auto parent_bounds_dip = + gfx::ScaleToEnclosingRect(parent_bounds_px, 1.0 / buffer_scale); + return wl::TranslateBoundsToParentCoordinates(bounds_dip, parent_bounds_dip); } } // namespace @@ -67,26 +66,6 @@ return !!subsurface_; } -void WaylandSubsurface::UpdateOpaqueRegion() { - gfx::Rect region_px = - enable_blend_ ? gfx::Rect() : gfx::Rect(bounds_px_.size()); - wayland_surface()->SetOpaqueRegion({region_px}); -} - -void WaylandSubsurface::SetBounds(const gfx::Rect& bounds) { - if (bounds_px_ == bounds) - return; - - bounds_px_ = bounds; - if (IsVisible()) { - // Translate location from screen to surface coordinates. - auto bounds_px = - AdjustSubsurfaceBounds(bounds_px_, parent_->GetBounds(), - parent_->ui_scale(), parent_->window_scale()); - wl_subsurface_set_position(subsurface_.get(), bounds_px.x(), bounds_px.y()); - } -} - void WaylandSubsurface::CreateSubsurface() { DCHECK(parent_); @@ -94,15 +73,7 @@ DCHECK(subcompositor); subsurface_ = wayland_surface()->CreateSubsurface(parent_->root_surface()); - // Chromium positions quads in display::Display coordinates in physical - // pixels, but Wayland requires them to be in local surface coordinates a.k.a - // relative to parent window. - auto bounds_px = - AdjustSubsurfaceBounds(bounds_px_, parent_->GetBounds(), - parent_->ui_scale(), parent_->window_scale()); - DCHECK(subsurface_); - wl_subsurface_set_position(subsurface_.get(), bounds_px.x(), bounds_px.y()); wl_subsurface_set_sync(subsurface_.get()); // Subsurfaces don't need to trap input events. Its display rect is fully @@ -117,27 +88,23 @@ } void WaylandSubsurface::ConfigureAndShowSurface( - gfx::OverlayTransform transform, - const gfx::Rect& bounds_rect, + const gfx::Rect& bounds_px, + const gfx::Rect& parent_bounds_px, int32_t buffer_scale, - bool enable_blend, const WaylandSurface* reference_below, - const WaylandSurface* reference_above, - gfx::OverlayPriorityHint priority_hint) { - wayland_surface()->SetBufferTransform(transform); - wayland_surface()->SetSurfaceBufferScale(buffer_scale); - wayland_surface()->SetOverlayPriority(priority_hint); - - auto old_bounds = bounds_px_; - SetBounds(bounds_rect); - - if (old_bounds != bounds_px_ || enable_blend_ != enable_blend) { - enable_blend_ = enable_blend; - UpdateOpaqueRegion(); - } - + const WaylandSurface* reference_above) { Show(); + // Chromium positions quads in display::Display coordinates in physical + // pixels, but Wayland requires them to be in local surface coordinates a.k.a + // relative to parent window. + auto bounds_dip_in_parent_surface = + AdjustSubsurfaceBounds(bounds_px, parent_bounds_px, buffer_scale); + wl_subsurface_set_position(subsurface_.get(), + bounds_dip_in_parent_surface.x(), + bounds_dip_in_parent_surface.y()); + + // Setup the stacking order of this subsurface. DCHECK(!reference_above || !reference_below); if (reference_below) { wl_subsurface_place_above(subsurface_.get(), reference_below->surface());
diff --git a/ui/ozone/platform/wayland/host/wayland_subsurface.h b/ui/ozone/platform/wayland/host/wayland_subsurface.h index dc8d1f81..f4a8808 100644 --- a/ui/ozone/platform/wayland/host/wayland_subsurface.h +++ b/ui/ozone/platform/wayland/host/wayland_subsurface.h
@@ -5,10 +5,7 @@ #ifndef UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_SUBSURFACE_H_ #define UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_SUBSURFACE_H_ -#include "ui/gfx/geometry/rect.h" #include "ui/gfx/native_widget_types.h" -#include "ui/gfx/overlay_priority_hint.h" -#include "ui/gfx/overlay_transform.h" #include "ui/ozone/platform/wayland/common/wayland_object.h" #include "ui/ozone/platform/wayland/host/wayland_surface.h" @@ -27,35 +24,23 @@ wl_surface* surface() const { return wayland_surface_.surface(); } WaylandSurface* wayland_surface() { return &wayland_surface_; } - gfx::Rect bounds_px() { return bounds_px_; } - bool IsOpaque() const { return !enable_blend_; } gfx::AcceleratedWidget GetWidget() const; - // Sets up wl_surface and wl_subsurface. Allows an overlay to be shown - // correctly once a wl_buffer is attached. - // |transform|: specifies the wl_surface buffer_transform. - // |bounds_rect|: The contents of the source rectangle are scaled to the - // destination size (wp_viewport.dst), used to specify opaque region. - // |enable_blend|: whether the wl_surface will be transluscent. + // Sets up wl_subsurface by setting the surface location coordinates and the + // stacking order of this subsurface. + // |bounds_px|: The pixel bounds of this subsurface content in + // display::Display coordinates used by chrome. + // |parent_bounds_px|: Same as |bounds_px| but for the parent surface. + // |buffer_scale|: the scale factor of the next attached buffer. // |reference_below| & |reference_above|: this subsurface is taken from the // subsurface stack and inserted back to be immediately below/above the // reference subsurface. - // |buffer_scale|: the scale factor of the next attached buffer. - // |priority_hint|: specifies the augmented_surface_set_overlay_priority. - // - // The coordinate transformations from buffer pixel coordinates up to the - // surface-local coordinates happen in the following order: - // 1. buffer_transform - // 2. buffer_scale - // 3. crop and scale of viewport - void ConfigureAndShowSurface(gfx::OverlayTransform transform, - const gfx::Rect& bounds_rect, + void ConfigureAndShowSurface(const gfx::Rect& bounds_px, + const gfx::Rect& parent_bounds_px, int32_t buffer_scale, - bool enable_blend, const WaylandSurface* reference_below, - const WaylandSurface* reference_above, - gfx::OverlayPriorityHint priority_hint); + const WaylandSurface* reference_above); // Assigns wl_subsurface role to the wl_surface so it is visible when a // wl_buffer is attached. @@ -67,11 +52,6 @@ private: // Helper of Show(). It does the role-assigning to wl_surface. void CreateSubsurface(); - void SetBounds(const gfx::Rect& bounds); - - // Tells wayland compositor to update the opaque region according to - // |enable_blend_| and |bounds_px_|. - void UpdateOpaqueRegion(); WaylandSurface wayland_surface_; wl::Object<wl_subsurface> subsurface_; @@ -80,10 +60,6 @@ // |parent_| refers to the WaylandWindow whose wl_surface is the parent to // this subsurface. WaylandWindow* const parent_; - - // Pixel bounds within the display to position this subsurface. - gfx::Rect bounds_px_; - bool enable_blend_ = true; }; } // namespace ui
diff --git a/ui/ozone/platform/wayland/host/wayland_touch_unittest.cc b/ui/ozone/platform/wayland/host/wayland_touch_unittest.cc index e560947..63f096a7c 100644 --- a/ui/ozone/platform/wayland/host/wayland_touch_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_touch_unittest.cc
@@ -34,6 +34,9 @@ public: WaylandTouchTest() {} + WaylandTouchTest(const WaylandTouchTest&) = delete; + WaylandTouchTest& operator=(const WaylandTouchTest&) = delete; + void SetUp() override { WaylandTest::SetUp(); @@ -56,9 +59,6 @@ } wl::TestTouch* touch_; - - private: - DISALLOW_COPY_AND_ASSIGN(WaylandTouchTest); }; TEST_P(WaylandTouchTest, KeypressAndMotion) {
diff --git a/ui/ozone/platform/wayland/host/wayland_window.cc b/ui/ozone/platform/wayland/host/wayland_window.cc index 5f1f9c2..60ee278 100644 --- a/ui/ozone/platform/wayland/host/wayland_window.cc +++ b/ui/ozone/platform/wayland/host/wayland_window.cc
@@ -793,15 +793,25 @@ reference_above = (*std::next(iter))->wayland_surface(); } (*iter)->ConfigureAndShowSurface( - (*overlay_iter)->transform, (*overlay_iter)->bounds_rect, - root_surface()->buffer_scale(), (*overlay_iter)->enable_blend, - nullptr, reference_above, (*overlay_iter)->priority_hint); + (*overlay_iter)->bounds_rect, (*split)->bounds_rect, + root_surface()->buffer_scale(), nullptr, reference_above); + + (*iter)->wayland_surface()->SetBufferTransform( + (*overlay_iter)->transform); + (*iter)->wayland_surface()->SetSurfaceBufferScale( + root_surface()->buffer_scale()); (*iter)->wayland_surface()->SetViewportSource( (*overlay_iter)->crop_rect); - (*iter)->wayland_surface()->SetOpacity((*overlay_iter)->opacity); - (*iter)->wayland_surface()->SetBlending((*overlay_iter)->enable_blend); + (*iter)->wayland_surface()->SetOverlayPriority( + (*overlay_iter)->priority_hint); (*iter)->wayland_surface()->SetViewportDestination( (*overlay_iter)->bounds_rect.size()); + gfx::Rect region_px = + (*overlay_iter)->enable_blend + ? gfx::Rect() + : gfx::Rect((*overlay_iter)->bounds_rect.size()); + (*iter)->wayland_surface()->SetOpaqueRegion({region_px}); + (*iter)->wayland_surface()->SetOpacity((*overlay_iter)->opacity); connection_->buffer_manager_host()->CommitBufferInternal( (*iter)->wayland_surface(), (*overlay_iter)->buffer_id, (*overlay_iter)->damage_region, @@ -831,15 +841,25 @@ reference_below = (*std::prev(iter))->wayland_surface(); } (*iter)->ConfigureAndShowSurface( - (*overlay_iter)->transform, (*overlay_iter)->bounds_rect, - root_surface()->buffer_scale(), (*overlay_iter)->enable_blend, - reference_below, nullptr, (*overlay_iter)->priority_hint); + (*overlay_iter)->bounds_rect, (*split)->bounds_rect, + root_surface()->buffer_scale(), reference_below, nullptr); + + (*iter)->wayland_surface()->SetBufferTransform( + (*overlay_iter)->transform); + (*iter)->wayland_surface()->SetSurfaceBufferScale( + root_surface()->buffer_scale()); (*iter)->wayland_surface()->SetViewportSource( (*overlay_iter)->crop_rect); - (*iter)->wayland_surface()->SetOpacity((*overlay_iter)->opacity); - (*iter)->wayland_surface()->SetBlending((*overlay_iter)->enable_blend); + (*iter)->wayland_surface()->SetOverlayPriority( + (*overlay_iter)->priority_hint); (*iter)->wayland_surface()->SetViewportDestination( (*overlay_iter)->bounds_rect.size()); + gfx::Rect region_px = + (*overlay_iter)->enable_blend + ? gfx::Rect() + : gfx::Rect((*overlay_iter)->bounds_rect.size()); + (*iter)->wayland_surface()->SetOpaqueRegion({region_px}); + (*iter)->wayland_surface()->SetOpacity((*overlay_iter)->opacity); connection_->buffer_manager_host()->CommitBufferInternal( (*iter)->wayland_surface(), (*overlay_iter)->buffer_id, (*overlay_iter)->damage_region, @@ -881,18 +901,23 @@ // to apply viewport.destination is made at commit time. Right now PIP // would have incorrect size b/c it is fullscreen overlay scheduled at // z_order=0. - primary_subsurface_->ConfigureAndShowSurface( - (*split)->transform, (*split)->bounds_rect, - root_surface()->buffer_scale(), (*split)->enable_blend, nullptr, - nullptr, (*split)->priority_hint); + primary_subsurface_->wayland_surface()->SetBufferTransform( + (*split)->transform); + primary_subsurface_->wayland_surface()->SetSurfaceBufferScale( + root_surface()->buffer_scale()); primary_subsurface_->wayland_surface()->SetViewportSource( (*split)->crop_rect); - primary_subsurface_->wayland_surface()->SetOpacity((*split)->opacity); - primary_subsurface_->wayland_surface()->SetBlending((*split)->enable_blend); + primary_subsurface_->wayland_surface()->SetOverlayPriority( + (*split)->priority_hint); primary_subsurface_->wayland_surface()->SetViewportDestination( (*split)->crop_rect == gfx::RectF(1.f, 1.f) ? gfx::Size() : (*split)->bounds_rect.size()); + gfx::Rect region_px = (*split)->enable_blend + ? gfx::Rect() + : gfx::Rect((*split)->bounds_rect.size()); + primary_subsurface_->wayland_surface()->SetOpaqueRegion({region_px}); + primary_subsurface_->wayland_surface()->SetOpacity((*split)->opacity); connection_->buffer_manager_host()->CommitBufferInternal( primary_subsurface_->wayland_surface(), (*split)->buffer_id, (*split)->damage_region,
diff --git a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc index 73008857..e36b197 100644 --- a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc
@@ -19,6 +19,7 @@ #include "base/nix/xdg_util.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_command_line.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/cursor/mojom/cursor_type.mojom-shared.h" @@ -50,6 +51,7 @@ #include "ui/ozone/platform/wayland/test/test_wayland_server_thread.h" #include "ui/ozone/platform/wayland/test/wayland_test.h" #include "ui/ozone/public/mojom/wayland/wayland_overlay_config.mojom.h" +#include "ui/ozone/public/ozone_switches.h" #include "ui/ozone/test/mock_platform_window_delegate.h" #include "ui/platform_window/platform_window.h" #include "ui/platform_window/platform_window_init_properties.h" @@ -138,6 +140,9 @@ EF_LEFT_MOUSE_BUTTON | EF_RIGHT_MOUSE_BUTTON, EF_LEFT_MOUSE_BUTTON) {} + WaylandWindowTest(const WaylandWindowTest&) = delete; + WaylandWindowTest& operator=(const WaylandWindowTest&) = delete; + void SetUp() override { WaylandTest::SetUp(); @@ -277,9 +282,6 @@ wl::MockXdgSurface* xdg_surface_; MouseEvent test_mouse_event_; - - private: - DISALLOW_COPY_AND_ASSIGN(WaylandWindowTest); }; TEST_P(WaylandWindowTest, SetTitle) { @@ -2705,123 +2707,146 @@ // Tests that a popup window is created using the serial of button press // events as required by the Wayland protocol spec. TEST_P(WaylandWindowTest, CreatesPopupOnButtonPressSerial) { - wl_seat_send_capabilities( - server_.seat()->resource(), - WL_SEAT_CAPABILITY_POINTER | WL_SEAT_CAPABILITY_KEYBOARD); + for (bool use_explicit_grab : {false, true}) { + base::test::ScopedCommandLine command_line_; + if (use_explicit_grab) { + command_line_.GetProcessCommandLine()->AppendSwitch( + switches::kUseWaylandExplicitGrab); + } - Sync(); + wl_seat_send_capabilities( + server_.seat()->resource(), + WL_SEAT_CAPABILITY_POINTER | WL_SEAT_CAPABILITY_KEYBOARD); - constexpr uint32_t enter_serial = 1; - constexpr uint32_t button_press_serial = 2; - constexpr uint32_t button_release_serial = 3; + Sync(); - wl::MockSurface* toplevel_surface = server_.GetObject<wl::MockSurface>( - window_->root_surface()->GetSurfaceId()); - struct wl_array empty; - wl_array_init(&empty); - wl_keyboard_send_enter(server_.seat()->keyboard()->resource(), enter_serial, - toplevel_surface->resource(), &empty); + constexpr uint32_t enter_serial = 1; + constexpr uint32_t button_press_serial = 2; + constexpr uint32_t button_release_serial = 3; - // Send two events - button down and button up. - wl_pointer_send_button(server_.seat()->pointer()->resource(), - button_press_serial, 1002, BTN_LEFT, - WL_POINTER_BUTTON_STATE_PRESSED); - wl_pointer_send_button(server_.seat()->pointer()->resource(), - button_release_serial, 1004, BTN_LEFT, - WL_POINTER_BUTTON_STATE_RELEASED); - Sync(); + wl::MockSurface* toplevel_surface = server_.GetObject<wl::MockSurface>( + window_->root_surface()->GetSurfaceId()); + struct wl_array empty; + wl_array_init(&empty); + wl_keyboard_send_enter(server_.seat()->keyboard()->resource(), enter_serial, + toplevel_surface->resource(), &empty); - // Create a popup window and verify the client used correct serial. - MockPlatformWindowDelegate delegate; - EXPECT_CALL(delegate, GetMenuType()) - .WillOnce(Return(MenuType::kRootContextMenu)); - auto popup = CreateWaylandWindowWithParams( - PlatformWindowType::kMenu, window_->GetWidget(), gfx::Rect(0, 0, 50, 50), - &delegate); - ASSERT_TRUE(popup); + // Send two events - button down and button up. + wl_pointer_send_button(server_.seat()->pointer()->resource(), + button_press_serial, 1002, BTN_LEFT, + WL_POINTER_BUTTON_STATE_PRESSED); + wl_pointer_send_button(server_.seat()->pointer()->resource(), + button_release_serial, 1004, BTN_LEFT, + WL_POINTER_BUTTON_STATE_RELEASED); + Sync(); - Sync(); + // Create a popup window and verify the client used correct serial. + MockPlatformWindowDelegate delegate; + EXPECT_CALL(delegate, GetMenuType()) + .WillOnce(Return(MenuType::kRootContextMenu)); + auto popup = CreateWaylandWindowWithParams( + PlatformWindowType::kMenu, window_->GetWidget(), + gfx::Rect(0, 0, 50, 50), &delegate); + ASSERT_TRUE(popup); - auto* test_popup = GetTestXdgPopupByWindow(popup.get()); - ASSERT_TRUE(test_popup); - EXPECT_NE(test_popup->grab_serial(), button_release_serial); - EXPECT_EQ(test_popup->grab_serial(), button_press_serial); + Sync(); + + auto* test_popup = GetTestXdgPopupByWindow(popup.get()); + ASSERT_TRUE(test_popup); + if (use_explicit_grab) { + EXPECT_NE(test_popup->grab_serial(), button_release_serial); + EXPECT_EQ(test_popup->grab_serial(), button_press_serial); + } else { + EXPECT_EQ(test_popup->grab_serial(), 0U); + } + } } // Tests that a popup window is created using the serial of touch down events // as required by the Wayland protocol spec. TEST_P(WaylandWindowTest, CreatesPopupOnTouchDownSerial) { - wl_seat_send_capabilities( - server_.seat()->resource(), - WL_SEAT_CAPABILITY_TOUCH | WL_SEAT_CAPABILITY_KEYBOARD); + for (bool use_explicit_grab : {false, true}) { + base::test::ScopedCommandLine command_line_; + if (use_explicit_grab) { + command_line_.GetProcessCommandLine()->AppendSwitch( + switches::kUseWaylandExplicitGrab); + } + wl_seat_send_capabilities( + server_.seat()->resource(), + WL_SEAT_CAPABILITY_TOUCH | WL_SEAT_CAPABILITY_KEYBOARD); - Sync(); + Sync(); - constexpr uint32_t enter_serial = 1; - constexpr uint32_t touch_down_serial = 2; - constexpr uint32_t touch_up_serial = 3; + constexpr uint32_t enter_serial = 1; + constexpr uint32_t touch_down_serial = 2; + constexpr uint32_t touch_up_serial = 3; - wl::MockSurface* toplevel_surface = server_.GetObject<wl::MockSurface>( - window_->root_surface()->GetSurfaceId()); - struct wl_array empty; - wl_array_init(&empty); - wl_keyboard_send_enter(server_.seat()->keyboard()->resource(), enter_serial, - toplevel_surface->resource(), &empty); + wl::MockSurface* toplevel_surface = server_.GetObject<wl::MockSurface>( + window_->root_surface()->GetSurfaceId()); + struct wl_array empty; + wl_array_init(&empty); + wl_keyboard_send_enter(server_.seat()->keyboard()->resource(), enter_serial, + toplevel_surface->resource(), &empty); - // Send two events - touch down and touch up. - wl_touch_send_down(server_.seat()->touch()->resource(), touch_down_serial, 0, - surface_->resource(), 0 /* id */, wl_fixed_from_int(50), - wl_fixed_from_int(100)); - wl_touch_send_up(server_.seat()->touch()->resource(), touch_up_serial, 1000, - 0 /* id */); + // Send two events - touch down and touch up. + wl_touch_send_down(server_.seat()->touch()->resource(), touch_down_serial, + 0, surface_->resource(), 0 /* id */, + wl_fixed_from_int(50), wl_fixed_from_int(100)); + wl_touch_send_up(server_.seat()->touch()->resource(), touch_up_serial, 1000, + 0 /* id */); - Sync(); + Sync(); - // Create a popup window and verify the client used correct serial. - MockPlatformWindowDelegate delegate; - EXPECT_CALL(delegate, GetMenuType()) - .WillRepeatedly(Return(MenuType::kRootContextMenu)); - auto popup = CreateWaylandWindowWithParams( - PlatformWindowType::kMenu, window_->GetWidget(), gfx::Rect(0, 0, 50, 50), - &delegate); - ASSERT_TRUE(popup); + // Create a popup window and verify the client used correct serial. + MockPlatformWindowDelegate delegate; + EXPECT_CALL(delegate, GetMenuType()) + .WillRepeatedly(Return(MenuType::kRootContextMenu)); + auto popup = CreateWaylandWindowWithParams( + PlatformWindowType::kMenu, window_->GetWidget(), + gfx::Rect(0, 0, 50, 50), &delegate); + ASSERT_TRUE(popup); - Sync(); + Sync(); - auto* test_popup = GetTestXdgPopupByWindow(popup.get()); - ASSERT_TRUE(test_popup); + auto* test_popup = GetTestXdgPopupByWindow(popup.get()); + ASSERT_TRUE(test_popup); - // Touch events are the exception. We can't use the serial that was sent - // before the "up" event. Otherwise, some compositors may dismiss popups. - // Thus, no serial must be used. - EXPECT_EQ(test_popup->grab_serial(), 0U); + // Touch events are the exception. We can't use the serial that was sent + // before the "up" event. Otherwise, some compositors may dismiss popups. + // Thus, no serial must be used. + EXPECT_EQ(test_popup->grab_serial(), 0U); - popup->Hide(); + popup->Hide(); - // Send a single down event now. - wl_touch_send_down(server_.seat()->touch()->resource(), touch_down_serial, 0, - surface_->resource(), 0 /* id */, wl_fixed_from_int(50), - wl_fixed_from_int(100)); + // Send a single down event now. + wl_touch_send_down(server_.seat()->touch()->resource(), touch_down_serial, + 0, surface_->resource(), 0 /* id */, + wl_fixed_from_int(50), wl_fixed_from_int(100)); - Sync(); + Sync(); - popup->Show(false); + popup->Show(false); - Sync(); + Sync(); - test_popup = GetTestXdgPopupByWindow(popup.get()); - ASSERT_TRUE(test_popup); + test_popup = GetTestXdgPopupByWindow(popup.get()); + ASSERT_TRUE(test_popup); - uint32_t expected_serial = touch_down_serial; + uint32_t expected_serial = touch_down_serial; #if !BUILDFLAG(IS_CHROMEOS_LACROS) - auto env = base::Environment::Create(); - if (base::nix::GetDesktopEnvironment(env.get()) == - base::nix::DESKTOP_ENVIRONMENT_GNOME) { - // We do not grab with touch events on gnome shell. - expected_serial = 0u; - } + auto env = base::Environment::Create(); + if (base::nix::GetDesktopEnvironment(env.get()) == + base::nix::DESKTOP_ENVIRONMENT_GNOME) { + // We do not grab with touch events on gnome shell. + expected_serial = 0u; + } #endif // !BUILDFLAG(IS_CHROMEOS_LACROS) - EXPECT_EQ(test_popup->grab_serial(), expected_serial); + if (use_explicit_grab) { + EXPECT_EQ(test_popup->grab_serial(), expected_serial); + } else { + EXPECT_EQ(test_popup->grab_serial(), 0U); + } + } } // Tests nested menu windows get the topmost window in the stack of windows @@ -2964,8 +2989,8 @@ wayland_subsurface->wayland_surface()->GetSurfaceId()); EXPECT_TRUE(mock_surface_subsurface); wayland_subsurface->ConfigureAndShowSurface( - gfx::OVERLAY_TRANSFORM_NONE, subsurface_bounds, 1 /*buffer_scale*/, true, - nullptr, nullptr, gfx::OverlayPriorityHint::kNone); + subsurface_bounds, gfx::Rect(0, 0, 640, 480) /*parent_bounds_px*/, + 1 /*buffer_scale*/, nullptr, nullptr); connection_->ScheduleFlush(); Sync();
diff --git a/ui/ozone/platform/wayland/host/zwp_text_input_wrapper.h b/ui/ozone/platform/wayland/host/zwp_text_input_wrapper.h index 4e16f2e3..24a5f6a 100644 --- a/ui/ozone/platform/wayland/host/zwp_text_input_wrapper.h +++ b/ui/ozone/platform/wayland/host/zwp_text_input_wrapper.h
@@ -54,6 +54,17 @@ // for normal text input operations, which should be done with // commit_string, delete_surrounding_text, etc. virtual void OnKeysym(uint32_t key, uint32_t state, uint32_t modifiers) = 0; + + // Called when a new preedit region is specified. The region is specified + // by |index| and |length| on the surrounding text sent do wayland compositor + // in advance. |index| is relative to the current caret position, and |length| + // is the preedit length. Both are measured in UTF-8 bytes. + // |spans| are representing the text spanning for the new preedit. All its + // indices and length are relative to the beginning of the new preedit, + // and measured in UTF-8 bytes. + virtual void OnSetPreeditRegion(int32_t index, + uint32_t length, + const std::vector<SpanStyle>& spans) = 0; }; // A wrapper around different versions of wayland text input protocols.
diff --git a/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v1.cc b/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v1.cc index a0ba69c..a745a73 100644 --- a/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v1.cc +++ b/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v1.cc
@@ -16,7 +16,8 @@ ZWPTextInputWrapperV1::ZWPTextInputWrapperV1( WaylandConnection* connection, ZWPTextInputWrapperClient* client, - zwp_text_input_manager_v1* text_input_manager) + zwp_text_input_manager_v1* text_input_manager, + zcr_text_input_extension_v1* text_input_extension) : connection_(connection), client_(client) { static constexpr zwp_text_input_v1_listener text_input_listener = { &OnEnter, // text_input_enter, @@ -34,11 +35,27 @@ &OnTextDirection, // text_input_text_direction }; + static constexpr zcr_extended_text_input_v1_listener + extended_text_input_listener = { + &OnSetPreeditRegion, // extended_text_input_set_preedit_region, + }; + auto* text_input = zwp_text_input_manager_v1_create_text_input(text_input_manager); obj_ = wl::Object<zwp_text_input_v1>(text_input); - zwp_text_input_v1_add_listener(text_input, &text_input_listener, this); + + if (text_input_extension) { + auto* extended_text_input = + zcr_text_input_extension_v1_get_extended_text_input( + text_input_extension, obj_.get()); + if (extended_text_input) { + extended_obj_ = + wl::Object<zcr_extended_text_input_v1>(extended_text_input); + zcr_extended_text_input_v1_add_listener( + extended_text_input, &extended_text_input_listener, this); + } + } } ZWPTextInputWrapperV1::~ZWPTextInputWrapperV1() = default; @@ -203,4 +220,16 @@ NOTIMPLEMENTED_LOG_ONCE(); } +// static +void ZWPTextInputWrapperV1::OnSetPreeditRegion( + void* data, + struct zcr_extended_text_input_v1* extended_text_input, + int32_t index, + uint32_t length) { + auto* self = static_cast<ZWPTextInputWrapperV1*>(data); + auto spans = std::move(self->spans_); + self->ResetInputEventState(); + self->client_->OnSetPreeditRegion(index, length, spans); +} + } // namespace ui
diff --git a/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v1.h b/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v1.h index 8c9140c..588854e 100644 --- a/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v1.h +++ b/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v1.h
@@ -9,6 +9,7 @@ #include <string> #include <vector> +#include <text-input-extension-unstable-v1-client-protocol.h> #include <text-input-unstable-v1-client-protocol.h> #include "ui/ozone/platform/wayland/common/wayland_object.h" @@ -28,7 +29,8 @@ public: ZWPTextInputWrapperV1(WaylandConnection* connection, ZWPTextInputWrapperClient* client, - zwp_text_input_manager_v1* text_input_manager); + zwp_text_input_manager_v1* text_input_manager, + zcr_text_input_extension_v1* text_input_extension); ZWPTextInputWrapperV1(const ZWPTextInputWrapperV1&) = delete; ZWPTextInputWrapperV1& operator=(const ZWPTextInputWrapperV1&) = delete; ~ZWPTextInputWrapperV1() override; @@ -100,8 +102,16 @@ uint32_t serial, uint32_t direction); + // zcr_extended_text_input_v1_listener + static void OnSetPreeditRegion( + void* data, + struct zcr_extended_text_input_v1* extended_text_input, + int32_t index, + uint32_t length); + WaylandConnection* const connection_; wl::Object<zwp_text_input_v1> obj_; + wl::Object<zcr_extended_text_input_v1> extended_obj_; ZWPTextInputWrapperClient* const client_; std::vector<ZWPTextInputWrapperClient::SpanStyle> spans_;
diff --git a/ui/ozone/platform/wayland/test/mock_zcr_extended_text_input.cc b/ui/ozone/platform/wayland/test/mock_zcr_extended_text_input.cc new file mode 100644 index 0000000..dd812db9 --- /dev/null +++ b/ui/ozone/platform/wayland/test/mock_zcr_extended_text_input.cc
@@ -0,0 +1,19 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/ozone/platform/wayland/test/mock_zcr_extended_text_input.h" + +namespace wl { + +const struct zcr_extended_text_input_v1_interface + kMockZcrExtendedTextInputV1Impl = { + &DestroyResource, // destroy +}; + +MockZcrExtendedTextInput::MockZcrExtendedTextInput(wl_resource* resource) + : ServerObject(resource) {} + +MockZcrExtendedTextInput::~MockZcrExtendedTextInput() = default; + +} // namespace wl
diff --git a/ui/ozone/platform/wayland/test/mock_zcr_extended_text_input.h b/ui/ozone/platform/wayland/test/mock_zcr_extended_text_input.h new file mode 100644 index 0000000..edc231a --- /dev/null +++ b/ui/ozone/platform/wayland/test/mock_zcr_extended_text_input.h
@@ -0,0 +1,34 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_OZONE_PLATFORM_WAYLAND_TEST_MOCK_ZCR_EXTENDED_TEXT_INPUT_H_ +#define UI_OZONE_PLATFORM_WAYLAND_TEST_MOCK_ZCR_EXTENDED_TEXT_INPUT_H_ + +#include <text-input-extension-unstable-v1-server-protocol.h> + +#include "ui/ozone/platform/wayland/test/server_object.h" + +struct wl_resource; + +namespace wl { + +extern const struct zcr_extended_text_input_v1_interface + kMockZcrExtendedTextInputV1Impl; + +// Manage zcr_extended_text_input_v1. +class MockZcrExtendedTextInput : public ServerObject { + public: + explicit MockZcrExtendedTextInput(wl_resource* resource); + MockZcrExtendedTextInput(const MockZcrExtendedTextInput&) = delete; + MockZcrExtendedTextInput& operator=(const MockZcrExtendedTextInput&) = delete; + ~MockZcrExtendedTextInput() override; + + // Currently, no mock method is needed. + // If you're adding new APIs, please see also mock_zwp_text_input.h as + // reference. +}; + +} // namespace wl + +#endif // UI_OZONE_PLATFORM_WAYLAND_TEST_MOCK_ZWP_TEXT_INPUT_H_
diff --git a/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc b/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc index 7a90ea7..ca31127 100644 --- a/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc +++ b/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc
@@ -86,6 +86,8 @@ if (!xdg_shell_.Initialize(display_.get())) return false; } + if (!zcr_text_input_extension_v1_.Initialize(display_.get())) + return false; if (!zwp_text_input_manager_v1_.Initialize(display_.get())) return false; if (!zwp_linux_explicit_synchronization_v1_.Initialize(display_.get()))
diff --git a/ui/ozone/platform/wayland/test/test_wayland_server_thread.h b/ui/ozone/platform/wayland/test/test_wayland_server_thread.h index e8ce95a..991671b 100644 --- a/ui/ozone/platform/wayland/test/test_wayland_server_thread.h +++ b/ui/ozone/platform/wayland/test/test_wayland_server_thread.h
@@ -26,6 +26,7 @@ #include "ui/ozone/platform/wayland/test/test_seat.h" #include "ui/ozone/platform/wayland/test/test_subcompositor.h" #include "ui/ozone/platform/wayland/test/test_viewporter.h" +#include "ui/ozone/platform/wayland/test/test_zcr_text_input_extension.h" #include "ui/ozone/platform/wayland/test/test_zwp_linux_explicit_synchronization.h" #include "ui/ozone/platform/wayland/test/test_zwp_text_input_manager.h" @@ -101,6 +102,9 @@ TestSeat* seat() { return &seat_; } MockXdgShell* xdg_shell() { return &xdg_shell_; } TestOutput* output() { return &output_; } + TestZcrTextInputExtensionV1* text_input_extension_v1() { + return &zcr_text_input_extension_v1_; + } TestZwpTextInputManagerV1* text_input_manager_v1() { return &zwp_text_input_manager_v1_; } @@ -149,6 +153,7 @@ TestSeat seat_; MockXdgShell xdg_shell_; MockZxdgShellV6 zxdg_shell_v6_; + TestZcrTextInputExtensionV1 zcr_text_input_extension_v1_; TestZwpTextInputManagerV1 zwp_text_input_manager_v1_; TestZwpLinuxExplicitSynchronizationV1 zwp_linux_explicit_synchronization_v1_; MockZwpLinuxDmabufV1 zwp_linux_dmabuf_v1_;
diff --git a/ui/ozone/platform/wayland/test/test_zcr_text_input_extension.cc b/ui/ozone/platform/wayland/test/test_zcr_text_input_extension.cc new file mode 100644 index 0000000..b5a29f9 --- /dev/null +++ b/ui/ozone/platform/wayland/test/test_zcr_text_input_extension.cc
@@ -0,0 +1,42 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/ozone/platform/wayland/test/test_zcr_text_input_extension.h" + +#include <wayland-server-core.h> + +#include "ui/ozone/platform/wayland/test/mock_zcr_extended_text_input.h" + +namespace wl { + +namespace { + +constexpr uint32_t kTextInputExtensionVersion = 1; + +void GetExtendedTextInput(struct wl_client* client, + struct wl_resource* resource, + uint32_t id, + struct wl_resource* text_input_resource) { + wl_resource* text_resource = CreateResourceWithImpl<MockZcrExtendedTextInput>( + client, &zcr_extended_text_input_v1_interface, + wl_resource_get_version(resource), &kMockZcrExtendedTextInputV1Impl, id); + GetUserDataAs<TestZcrTextInputExtensionV1>(resource)->set_extended_text_input( + GetUserDataAs<MockZcrExtendedTextInput>(text_resource)); +} + +} // namespace + +const struct zcr_text_input_extension_v1_interface + kTestZcrTextInputExtensionV1Impl = { + &GetExtendedTextInput, // get_extended_text_input +}; + +TestZcrTextInputExtensionV1::TestZcrTextInputExtensionV1() + : GlobalObject(&zcr_text_input_extension_v1_interface, + &kTestZcrTextInputExtensionV1Impl, + kTextInputExtensionVersion) {} + +TestZcrTextInputExtensionV1::~TestZcrTextInputExtensionV1() = default; + +} // namespace wl
diff --git a/ui/ozone/platform/wayland/test/test_zcr_text_input_extension.h b/ui/ozone/platform/wayland/test/test_zcr_text_input_extension.h new file mode 100644 index 0000000..c0eff20 --- /dev/null +++ b/ui/ozone/platform/wayland/test/test_zcr_text_input_extension.h
@@ -0,0 +1,41 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZCR_TEXT_INPUT_EXTENSION_H_ +#define UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZCR_TEXT_INPUT_EXTENSION_H_ + +#include <text-input-extension-unstable-v1-server-protocol.h> + +#include "ui/ozone/platform/wayland/test/global_object.h" + +namespace wl { + +extern const struct zcr_text_input_extension_v1_interface + kTestZcrTextInputExtensionV1Impl; + +class MockZcrExtendedTextInput; + +// Manage zcr_text_input_extension_v1 object. +class TestZcrTextInputExtensionV1 : public GlobalObject { + public: + TestZcrTextInputExtensionV1(); + TestZcrTextInputExtensionV1(const TestZcrTextInputExtensionV1&) = delete; + TestZcrTextInputExtensionV1& operator=(const TestZcrTextInputExtensionV1&) = + delete; + ~TestZcrTextInputExtensionV1() override; + + void set_extended_text_input(MockZcrExtendedTextInput* extended_text_input) { + extended_text_input_ = extended_text_input; + } + MockZcrExtendedTextInput* extended_text_input() const { + return extended_text_input_; + } + + private: + MockZcrExtendedTextInput* extended_text_input_; +}; + +} // namespace wl + +#endif // UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZWP_TEXT_INPUT_EXTENSION_H_
diff --git a/ui/ozone/platform/x11/gl_surface_egl_readback_x11.h b/ui/ozone/platform/x11/gl_surface_egl_readback_x11.h index b80211e..7459e00 100644 --- a/ui/ozone/platform/x11/gl_surface_egl_readback_x11.h +++ b/ui/ozone/platform/x11/gl_surface_egl_readback_x11.h
@@ -15,6 +15,9 @@ public: explicit GLSurfaceEglReadbackX11(gfx::AcceleratedWidget window); + GLSurfaceEglReadbackX11(const GLSurfaceEglReadbackX11&) = delete; + GLSurfaceEglReadbackX11& operator=(const GLSurfaceEglReadbackX11&) = delete; + // gl::GLSurface: bool Initialize(gl::GLSurfaceFormat format) override; void Destroy() override; @@ -29,8 +32,6 @@ x11::Connection* const connection_; x11::GraphicsContext window_graphics_context_{}; x11::VisualId visual_{}; - - DISALLOW_COPY_AND_ASSIGN(GLSurfaceEglReadbackX11); }; } // namespace ui
diff --git a/ui/ozone/public/ozone_switches.cc b/ui/ozone/public/ozone_switches.cc index 1a09a81..5482bd4 100644 --- a/ui/ozone/public/ozone_switches.cc +++ b/ui/ozone/public/ozone_switches.cc
@@ -18,6 +18,10 @@ // Disable wayland input method editor. const char kDisableWaylandIme[] = "disable-wayland-ime"; +// Use explicit grab when opening popup windows. +// See https://crbug.com/1220274 +const char kUseWaylandExplicitGrab[] = "use-wayland-explicit-grab"; + // Disable explicit DMA-fences const char kDisableExplicitDmaFences[] = "disable-explicit-dma-fences";
diff --git a/ui/ozone/public/ozone_switches.h b/ui/ozone/public/ozone_switches.h index efc2689a..22ce3f85 100644 --- a/ui/ozone/public/ozone_switches.h +++ b/ui/ozone/public/ozone_switches.h
@@ -18,6 +18,8 @@ COMPONENT_EXPORT(OZONE_BASE) extern const char kDisableWaylandIme[]; +COMPONENT_EXPORT(OZONE_BASE) extern const char kUseWaylandExplicitGrab[]; + COMPONENT_EXPORT(OZONE_BASE) extern const char kDisableExplicitDmaFences[]; COMPONENT_EXPORT(OZONE_BASE)
diff --git a/ui/ozone/public/surface_factory_ozone.h b/ui/ozone/public/surface_factory_ozone.h index 5393bae..31a851b 100644 --- a/ui/ozone/public/surface_factory_ozone.h +++ b/ui/ozone/public/surface_factory_ozone.h
@@ -68,6 +68,9 @@ // modes (See comments below for descriptions). class COMPONENT_EXPORT(OZONE_BASE) SurfaceFactoryOzone { public: + SurfaceFactoryOzone(const SurfaceFactoryOzone&) = delete; + SurfaceFactoryOzone& operator=(const SurfaceFactoryOzone&) = delete; + // Returns a list of allowed GL implementations. The default implementation // will be the first item. virtual std::vector<gl::GLImplementationParts> GetAllowedGLImplementations(); @@ -199,9 +202,6 @@ protected: SurfaceFactoryOzone(); virtual ~SurfaceFactoryOzone(); - - private: - DISALLOW_COPY_AND_ASSIGN(SurfaceFactoryOzone); }; } // namespace ui
diff --git a/ui/shell_dialogs/run_all_unittests.cc b/ui/shell_dialogs/run_all_unittests.cc index 89ed969..3e61cddf 100644 --- a/ui/shell_dialogs/run_all_unittests.cc +++ b/ui/shell_dialogs/run_all_unittests.cc
@@ -22,13 +22,13 @@ public: ShellDialogsTestSuite(int argc, char** argv); + ShellDialogsTestSuite(const ShellDialogsTestSuite&) = delete; + ShellDialogsTestSuite& operator=(const ShellDialogsTestSuite&) = delete; + protected: // base::TestSuite: void Initialize() override; void Shutdown() override; - - private: - DISALLOW_COPY_AND_ASSIGN(ShellDialogsTestSuite); }; ShellDialogsTestSuite::ShellDialogsTestSuite(int argc, char** argv)
diff --git a/ui/shell_dialogs/select_file_dialog.h b/ui/shell_dialogs/select_file_dialog.h index 78fc062..0348600 100644 --- a/ui/shell_dialogs/select_file_dialog.h +++ b/ui/shell_dialogs/select_file_dialog.h
@@ -113,6 +113,9 @@ Listener* listener, std::unique_ptr<SelectFilePolicy> policy); + SelectFileDialog(const SelectFileDialog&) = delete; + SelectFileDialog& operator=(const SelectFileDialog&) = delete; + // Holds information about allowed extensions on a file save dialog. struct SHELL_DIALOGS_EXPORT FileTypeInfo { FileTypeInfo(); @@ -240,8 +243,6 @@ virtual bool HasMultipleFileTypeChoicesImpl() = 0; std::unique_ptr<SelectFilePolicy> select_file_policy_; - - DISALLOW_COPY_AND_ASSIGN(SelectFileDialog); }; SelectFileDialog* CreateSelectFileDialog(
diff --git a/ui/shell_dialogs/select_file_dialog_android.h b/ui/shell_dialogs/select_file_dialog_android.h index f985e69..47395a9 100644 --- a/ui/shell_dialogs/select_file_dialog_android.h +++ b/ui/shell_dialogs/select_file_dialog_android.h
@@ -19,6 +19,9 @@ static SelectFileDialogImpl* Create(Listener* listener, std::unique_ptr<SelectFilePolicy> policy); + SelectFileDialogImpl(const SelectFileDialogImpl&) = delete; + SelectFileDialogImpl& operator=(const SelectFileDialogImpl&) = delete; + void OnFileSelected(JNIEnv* env, const base::android::JavaParamRef<jobject>& java_object, const base::android::JavaParamRef<jstring>& filepath, @@ -65,8 +68,6 @@ bool HasMultipleFileTypeChoicesImpl() override; base::android::ScopedJavaGlobalRef<jobject> java_object_; - - DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl); }; } // namespace ui
diff --git a/ui/shell_dialogs/select_file_dialog_mac.h b/ui/shell_dialogs/select_file_dialog_mac.h index acc71b65..b110fc2 100644 --- a/ui/shell_dialogs/select_file_dialog_mac.h +++ b/ui/shell_dialogs/select_file_dialog_mac.h
@@ -31,6 +31,9 @@ SelectFileDialogImpl(Listener* listener, std::unique_ptr<ui::SelectFilePolicy> policy); + SelectFileDialogImpl(const SelectFileDialogImpl&) = delete; + SelectFileDialogImpl& operator=(const SelectFileDialogImpl&) = delete; + // BaseShellDialog implementation. bool IsRunning(gfx::NativeWindow parent_window) const override; void ListenerDestroyed() override; @@ -53,6 +56,10 @@ // Struct to store data associated with a file dialog while it is showing. struct DialogData { DialogData(gfx::NativeWindow parent_window_, void* params_); + + DialogData(const DialogData&) = delete; + DialogData& operator=(const DialogData&) = delete; + ~DialogData(); // The parent window for the panel. Weak, used only for comparisons. @@ -63,9 +70,6 @@ // Bridge to the Cocoa NSSavePanel. mojo::Remote<remote_cocoa::mojom::SelectFileDialog> select_file_dialog; - - private: - DISALLOW_COPY_AND_ASSIGN(DialogData); }; ~SelectFileDialogImpl() override; @@ -85,7 +89,6 @@ bool hasMultipleFileTypeChoices_; base::WeakPtrFactory<SelectFileDialogImpl> weak_factory_; - DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl); }; } // namespace ui
diff --git a/ui/shell_dialogs/select_file_dialog_win.cc b/ui/shell_dialogs/select_file_dialog_win.cc index 00e3605..06f9f11 100644 --- a/ui/shell_dialogs/select_file_dialog_win.cc +++ b/ui/shell_dialogs/select_file_dialog_win.cc
@@ -157,6 +157,9 @@ std::unique_ptr<ui::SelectFilePolicy> policy, const ExecuteSelectFileCallback& execute_select_file_callback); + SelectFileDialogImpl(const SelectFileDialogImpl&) = delete; + SelectFileDialogImpl& operator=(const SelectFileDialogImpl&) = delete; + // BaseShellDialog implementation: bool IsRunning(gfx::NativeWindow owning_window) const override; void ListenerDestroyed() override; @@ -197,8 +200,6 @@ bool has_multiple_file_type_choices_; ExecuteSelectFileCallback execute_select_file_callback_; - - DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl); }; SelectFileDialogImpl::SelectFileDialogImpl(
diff --git a/ui/snapshot/snapshot_async.h b/ui/snapshot/snapshot_async.h index 951055a4..2bd697c 100644 --- a/ui/snapshot/snapshot_async.h +++ b/ui/snapshot/snapshot_async.h
@@ -21,6 +21,10 @@ // ui::GrabWindowSnapshot callback. class SnapshotAsync { public: + SnapshotAsync() = delete; + SnapshotAsync(const SnapshotAsync&) = delete; + SnapshotAsync& operator=(const SnapshotAsync&) = delete; + static void ScaleCopyOutputResult( GrabWindowSnapshotAsyncCallback callback, const gfx::Size& target_size, @@ -29,9 +33,6 @@ static void RunCallbackWithCopyOutputResult( GrabWindowSnapshotAsyncCallback callback, std::unique_ptr<viz::CopyOutputResult> result); - - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(SnapshotAsync); }; } // namespace ui
diff --git a/ui/views/accessibility/view_ax_platform_node_delegate_unittest.cc b/ui/views/accessibility/view_ax_platform_node_delegate_unittest.cc index 7f489e3..cdb157b 100644 --- a/ui/views/accessibility/view_ax_platform_node_delegate_unittest.cc +++ b/ui/views/accessibility/view_ax_platform_node_delegate_unittest.cc
@@ -77,6 +77,9 @@ public: TestTableModel() = default; + TestTableModel(const TestTableModel&) = delete; + TestTableModel& operator=(const TestTableModel&) = delete; + // ui::TableModel: int RowCount() override { return 10; } @@ -96,9 +99,6 @@ } void SetObserver(ui::TableModelObserver* observer) override {} - - private: - DISALLOW_COPY_AND_ASSIGN(TestTableModel); }; class ViewAXPlatformNodeDelegateTest : public ViewsTestBase {
diff --git a/ui/views/accessibility/view_ax_platform_node_delegate_win_unittest.cc b/ui/views/accessibility/view_ax_platform_node_delegate_win_unittest.cc index 1e6ebdc..f71ccbb 100644 --- a/ui/views/accessibility/view_ax_platform_node_delegate_win_unittest.cc +++ b/ui/views/accessibility/view_ax_platform_node_delegate_win_unittest.cc
@@ -552,6 +552,9 @@ public: TestTableModel() = default; + TestTableModel(const TestTableModel&) = delete; + TestTableModel& operator=(const TestTableModel&) = delete; + // ui::TableModel: int RowCount() override { return 3; } @@ -569,9 +572,6 @@ } void SetObserver(ui::TableModelObserver* observer) override {} - - private: - DISALLOW_COPY_AND_ASSIGN(TestTableModel); }; } // namespace
diff --git a/ui/views/accessible_pane_view.cc b/ui/views/accessible_pane_view.cc index f3d4bc2..90e717f 100644 --- a/ui/views/accessible_pane_view.cc +++ b/ui/views/accessible_pane_view.cc
@@ -25,6 +25,10 @@ explicit AccessiblePaneViewFocusSearch(AccessiblePaneView* pane_view) : FocusSearch(pane_view, true, true), accessible_pane_view_(pane_view) {} + AccessiblePaneViewFocusSearch(const AccessiblePaneViewFocusSearch&) = delete; + AccessiblePaneViewFocusSearch& operator=( + const AccessiblePaneViewFocusSearch&) = delete; + protected: View* GetParent(View* v) override { return accessible_pane_view_->ContainsForFocusSearch(root(), v) @@ -40,7 +44,6 @@ private: AccessiblePaneView* accessible_pane_view_; - DISALLOW_COPY_AND_ASSIGN(AccessiblePaneViewFocusSearch); }; AccessiblePaneView::AccessiblePaneView()
diff --git a/ui/views/animation/bounds_animator_unittest.cc b/ui/views/animation/bounds_animator_unittest.cc index 44ab379..4054b4a 100644 --- a/ui/views/animation/bounds_animator_unittest.cc +++ b/ui/views/animation/bounds_animator_unittest.cc
@@ -62,6 +62,9 @@ public: TestView() = default; + TestView(const TestView&) = delete; + TestView& operator=(const TestView&) = delete; + void OnDidSchedulePaint(const gfx::Rect& r) override { ++repaint_count_; @@ -79,8 +82,6 @@ private: gfx::Rect dirty_rect_; int repaint_count_ = 0; - - DISALLOW_COPY_AND_ASSIGN(TestView); }; class RTLAnimationTestDelegate : public gfx::AnimationDelegate { @@ -146,6 +147,9 @@ RecreateAnimator(/*use_transforms=*/false); } + BoundsAnimatorTest(const BoundsAnimatorTest&) = delete; + BoundsAnimatorTest& operator=(const BoundsAnimatorTest&) = delete; + TestView* parent() { return &parent_; } TestView* child() { return child_; } BoundsAnimator* animator() { return animator_.get(); } @@ -198,8 +202,6 @@ TestView parent_; TestView* child_; // Owned by |parent_|. std::unique_ptr<BoundsAnimator> animator_; - - DISALLOW_COPY_AND_ASSIGN(BoundsAnimatorTest); }; // Checks animate view to.
diff --git a/ui/views/animation/ink_drop_highlight_observer.h b/ui/views/animation/ink_drop_highlight_observer.h index c463f50..6a101f0 100644 --- a/ui/views/animation/ink_drop_highlight_observer.h +++ b/ui/views/animation/ink_drop_highlight_observer.h
@@ -16,6 +16,9 @@ // Observer to attach to an InkDropHighlight animation. class VIEWS_EXPORT InkDropHighlightObserver { public: + InkDropHighlightObserver(const InkDropHighlightObserver&) = delete; + InkDropHighlightObserver& operator=(const InkDropHighlightObserver&) = delete; + // An animation for the given |animation_type| has started. virtual void AnimationStarted( InkDropHighlight::AnimationType animation_type) = 0; @@ -31,9 +34,6 @@ protected: InkDropHighlightObserver() = default; virtual ~InkDropHighlightObserver() = default; - - private: - DISALLOW_COPY_AND_ASSIGN(InkDropHighlightObserver); }; } // namespace views
diff --git a/ui/views/animation/ink_drop_impl.cc b/ui/views/animation/ink_drop_impl.cc index f375837..a5b2734f 100644 --- a/ui/views/animation/ink_drop_impl.cc +++ b/ui/views/animation/ink_drop_impl.cc
@@ -79,6 +79,9 @@ public: DestroyingHighlightState() : HighlightState(nullptr) {} + DestroyingHighlightState(const DestroyingHighlightState&) = delete; + DestroyingHighlightState& operator=(const DestroyingHighlightState&) = delete; + // InkDropImpl::HighlightState: void Enter() override {} void ShowOnHoverChanged() override {} @@ -88,9 +91,6 @@ void AnimationStarted(InkDropState ink_drop_state) override {} void AnimationEnded(InkDropState ink_drop_state, InkDropAnimationEndedReason reason) override {} - - private: - DISALLOW_COPY_AND_ASSIGN(DestroyingHighlightState); }; // @@ -105,6 +105,10 @@ NoAutoHighlightHiddenState(HighlightStateFactory* state_factory, base::TimeDelta animation_duration); + NoAutoHighlightHiddenState(const NoAutoHighlightHiddenState&) = delete; + NoAutoHighlightHiddenState& operator=(const NoAutoHighlightHiddenState&) = + delete; + // InkDropImpl::HighlightState: void Enter() override; void ShowOnHoverChanged() override; @@ -122,8 +126,6 @@ // The fade out animation duration. base::TimeDelta animation_duration_; - - DISALLOW_COPY_AND_ASSIGN(NoAutoHighlightHiddenState); }; // Animates the highlight to visible upon entering this state. Transitions to a @@ -134,6 +136,10 @@ NoAutoHighlightVisibleState(HighlightStateFactory* state_factory, base::TimeDelta animation_duration); + NoAutoHighlightVisibleState(const NoAutoHighlightVisibleState&) = delete; + NoAutoHighlightVisibleState& operator=(const NoAutoHighlightVisibleState&) = + delete; + // InkDropImpl::HighlightState: void Enter() override; void Exit() override {} @@ -152,8 +158,6 @@ // The fade in animation duration. base::TimeDelta animation_duration_; - - DISALLOW_COPY_AND_ASSIGN(NoAutoHighlightVisibleState); }; // NoAutoHighlightHiddenState definition @@ -262,6 +266,11 @@ HideHighlightOnRippleHiddenState(HighlightStateFactory* state_factory, base::TimeDelta animation_duration); + HideHighlightOnRippleHiddenState(const HideHighlightOnRippleHiddenState&) = + delete; + HideHighlightOnRippleHiddenState& operator=( + const HideHighlightOnRippleHiddenState&) = delete; + // InkDropImpl::NoAutoHighlightHiddenState: void ShowOnHoverChanged() override; void OnHoverChanged() override; @@ -283,8 +292,6 @@ // The timer used to delay the highlight fade in after an ink drop ripple // animation. std::unique_ptr<base::OneShotTimer> highlight_after_ripple_timer_; - - DISALLOW_COPY_AND_ASSIGN(HideHighlightOnRippleHiddenState); }; // Extends the base visible state to hide the highlight when the ripple becomes @@ -295,11 +302,13 @@ HideHighlightOnRippleVisibleState(HighlightStateFactory* state_factory, base::TimeDelta animation_duration); + HideHighlightOnRippleVisibleState(const HideHighlightOnRippleVisibleState&) = + delete; + HideHighlightOnRippleVisibleState& operator=( + const HideHighlightOnRippleVisibleState&) = delete; + // InkDropImpl::NoAutoHighlightVisibleState: void AnimationStarted(InkDropState ink_drop_state) override; - - private: - DISALLOW_COPY_AND_ASSIGN(HideHighlightOnRippleVisibleState); }; // HideHighlightOnRippleHiddenState definition @@ -418,11 +427,13 @@ ShowHighlightOnRippleHiddenState(HighlightStateFactory* state_factory, base::TimeDelta animation_duration); + ShowHighlightOnRippleHiddenState(const ShowHighlightOnRippleHiddenState&) = + delete; + ShowHighlightOnRippleHiddenState& operator=( + const ShowHighlightOnRippleHiddenState&) = delete; + // InkDropImpl::NoAutoHighlightHiddenState: void AnimationStarted(InkDropState ink_drop_state) override; - - private: - DISALLOW_COPY_AND_ASSIGN(ShowHighlightOnRippleHiddenState); }; // Extends the base visible state to hide the highlight when the ripple becomes @@ -433,15 +444,17 @@ ShowHighlightOnRippleVisibleState(HighlightStateFactory* state_factory, base::TimeDelta animation_duration); + ShowHighlightOnRippleVisibleState(const ShowHighlightOnRippleVisibleState&) = + delete; + ShowHighlightOnRippleVisibleState& operator=( + const ShowHighlightOnRippleVisibleState&) = delete; + // InkDropImpl::NoAutoHighlightVisibleState: void ShowOnHoverChanged() override; void OnHoverChanged() override; void ShowOnFocusChanged() override; void OnFocusChanged() override; void AnimationStarted(InkDropState ink_drop_state) override; - - private: - DISALLOW_COPY_AND_ASSIGN(ShowHighlightOnRippleVisibleState); }; // ShowHighlightOnRippleHiddenState definition
diff --git a/ui/views/animation/ink_drop_impl.h b/ui/views/animation/ink_drop_impl.h index 2b02ad120..5e61f5f 100644 --- a/ui/views/animation/ink_drop_impl.h +++ b/ui/views/animation/ink_drop_impl.h
@@ -164,6 +164,9 @@ HighlightStateFactory(AutoHighlightMode highlight_mode, InkDropImpl* ink_drop); + HighlightStateFactory(const HighlightStateFactory&) = delete; + HighlightStateFactory& operator=(const HighlightStateFactory&) = delete; + // Returns the initial state. std::unique_ptr<HighlightState> CreateStartState(); @@ -181,8 +184,6 @@ // The ink drop to invoke highlight changes on. InkDropImpl* ink_drop_; - - DISALLOW_COPY_AND_ASSIGN(HighlightStateFactory); }; class DestroyingHighlightState;
diff --git a/ui/views/animation/ink_drop_mask.h b/ui/views/animation/ink_drop_mask.h index 1e6aecf..e998cc4d 100644 --- a/ui/views/animation/ink_drop_mask.h +++ b/ui/views/animation/ink_drop_mask.h
@@ -44,6 +44,9 @@ public: PathInkDropMask(const gfx::Size& layer_size, const SkPath& path); + PathInkDropMask(const PathInkDropMask&) = delete; + PathInkDropMask& operator=(const PathInkDropMask&) = delete; + private: FRIEND_TEST_ALL_PREFIXES(InkDropMaskTest, PathInkDropMaskPaintsTriangle); @@ -51,8 +54,6 @@ void OnPaintLayer(const ui::PaintContext& context) override; SkPath path_; - - DISALLOW_COPY_AND_ASSIGN(PathInkDropMask); }; } // namespace views
diff --git a/ui/views/animation/ink_drop_observer.h b/ui/views/animation/ink_drop_observer.h index b91833d..4cc2a5d 100644 --- a/ui/views/animation/ink_drop_observer.h +++ b/ui/views/animation/ink_drop_observer.h
@@ -15,6 +15,9 @@ // Observer to attach to an InkDrop. class VIEWS_EXPORT InkDropObserver { public: + InkDropObserver(const InkDropObserver&) = delete; + InkDropObserver& operator=(const InkDropObserver&) = delete; + // Called when the animation of the current InkDrop has started. This // includes the ripple or highlight animation. Note: this is not guaranteed to // be notified, as the notification is dependent on the subclass @@ -32,9 +35,6 @@ protected: InkDropObserver() = default; virtual ~InkDropObserver() = default; - - private: - DISALLOW_COPY_AND_ASSIGN(InkDropObserver); }; } // namespace views
diff --git a/ui/views/animation/ink_drop_ripple_observer.h b/ui/views/animation/ink_drop_ripple_observer.h index fc534e5..4a5b9c6 100644 --- a/ui/views/animation/ink_drop_ripple_observer.h +++ b/ui/views/animation/ink_drop_ripple_observer.h
@@ -16,6 +16,9 @@ // Observer to attach to an InkDropRipple. class VIEWS_EXPORT InkDropRippleObserver { public: + InkDropRippleObserver(const InkDropRippleObserver&) = delete; + InkDropRippleObserver& operator=(const InkDropRippleObserver&) = delete; + // An animation for the given |ink_drop_state| has started. virtual void AnimationStarted(InkDropState ink_drop_state) = 0; @@ -30,9 +33,6 @@ protected: InkDropRippleObserver() = default; virtual ~InkDropRippleObserver() = default; - - private: - DISALLOW_COPY_AND_ASSIGN(InkDropRippleObserver); }; } // namespace views
diff --git a/ui/views/animation/test/ink_drop_impl_test_api.h b/ui/views/animation/test/ink_drop_impl_test_api.h index 95c1932..8f26c01 100644 --- a/ui/views/animation/test/ink_drop_impl_test_api.h +++ b/ui/views/animation/test/ink_drop_impl_test_api.h
@@ -39,6 +39,11 @@ explicit AccessFactoryOnExitHighlightState( InkDropImpl::HighlightStateFactory* state_factory); + AccessFactoryOnExitHighlightState( + const AccessFactoryOnExitHighlightState&) = delete; + AccessFactoryOnExitHighlightState& operator=( + const AccessFactoryOnExitHighlightState&) = delete; + // HighlightState: void Exit() override; void ShowOnHoverChanged() override; @@ -48,9 +53,6 @@ void AnimationStarted(InkDropState ink_drop_state) override; void AnimationEnded(InkDropState ink_drop_state, InkDropAnimationEndedReason reason) override; - - private: - DISALLOW_COPY_AND_ASSIGN(AccessFactoryOnExitHighlightState); }; // Highlight state that attempts to set a new highlight state during Exit(). @@ -62,6 +64,10 @@ explicit SetStateOnExitHighlightState( InkDropImpl::HighlightStateFactory* state_factory); + SetStateOnExitHighlightState(const SetStateOnExitHighlightState&) = delete; + SetStateOnExitHighlightState& operator=( + const SetStateOnExitHighlightState&) = delete; + // HighlightState: void Exit() override; void ShowOnHoverChanged() override; @@ -71,12 +77,13 @@ void AnimationStarted(InkDropState ink_drop_state) override; void AnimationEnded(InkDropState ink_drop_state, InkDropAnimationEndedReason reason) override; - - private: - DISALLOW_COPY_AND_ASSIGN(SetStateOnExitHighlightState); }; explicit InkDropImplTestApi(InkDropImpl* ink_drop); + + InkDropImplTestApi(const InkDropImplTestApi&) = delete; + InkDropImplTestApi& operator=(const InkDropImplTestApi&) = delete; + ~InkDropImplTestApi() override; // Ensures that |ink_drop_|->ShouldHighlight() returns the same value as @@ -104,8 +111,6 @@ private: // The InkDrop to provide internal access to. InkDropImpl* ink_drop_; - - DISALLOW_COPY_AND_ASSIGN(InkDropImplTestApi); }; } // namespace test
diff --git a/ui/views/background.cc b/ui/views/background.cc index f9a8fad..8d3aebae 100644 --- a/ui/views/background.cc +++ b/ui/views/background.cc
@@ -31,14 +31,14 @@ public: explicit SolidBackground(SkColor color) { SetNativeControlColor(color); } + SolidBackground(const SolidBackground&) = delete; + SolidBackground& operator=(const SolidBackground&) = delete; + void Paint(gfx::Canvas* canvas, View* view) const override { // Fill the background. Note that we don't constrain to the bounds as // canvas is already clipped for us. canvas->DrawColor(get_color()); } - - private: - DISALLOW_COPY_AND_ASSIGN(SolidBackground); }; // RoundedRectBackground is a filled solid colored background that has @@ -49,6 +49,9 @@ SetNativeControlColor(color); } + RoundedRectBackground(const RoundedRectBackground&) = delete; + RoundedRectBackground& operator=(const RoundedRectBackground&) = delete; + void Paint(gfx::Canvas* canvas, View* view) const override { cc::PaintFlags flags; flags.setAntiAlias(true); @@ -59,8 +62,6 @@ private: float radius_; - - DISALLOW_COPY_AND_ASSIGN(RoundedRectBackground); }; // ThemedVectorIconBackground is an image drawn on the view's background using @@ -75,6 +76,10 @@ OnViewThemeChanged(view); } + ThemedVectorIconBackground(const ThemedVectorIconBackground&) = delete; + ThemedVectorIconBackground& operator=(const ThemedVectorIconBackground&) = + delete; + // ViewObserver: void OnViewThemeChanged(View* view) override { view->SchedulePaint(); } void OnViewIsDeleting(View* view) override { @@ -89,8 +94,6 @@ private: const ui::ThemedVectorIcon icon_; base::ScopedObservation<View, ViewObserver> observation_{this}; - - DISALLOW_COPY_AND_ASSIGN(ThemedVectorIconBackground); }; // ThemedSolidBackground is a solid background that stays in sync with a view's
diff --git a/ui/views/border.cc b/ui/views/border.cc index 12ae9361..6a8c3e6 100644 --- a/ui/views/border.cc +++ b/ui/views/border.cc
@@ -29,6 +29,9 @@ public: SolidSidedBorder(const gfx::Insets& insets, SkColor color); + SolidSidedBorder(const SolidSidedBorder&) = delete; + SolidSidedBorder& operator=(const SolidSidedBorder&) = delete; + // Overridden from Border: void Paint(const View& view, gfx::Canvas* canvas) override; gfx::Insets GetInsets() const override; @@ -36,8 +39,6 @@ private: const gfx::Insets insets_; - - DISALLOW_COPY_AND_ASSIGN(SolidSidedBorder); }; SolidSidedBorder::SolidSidedBorder(const gfx::Insets& insets, SkColor color) @@ -83,6 +84,9 @@ const gfx::Insets& paint_insets, SkColor color); + RoundedRectBorder(const RoundedRectBorder&) = delete; + RoundedRectBorder& operator=(const RoundedRectBorder&) = delete; + // Overridden from Border: void Paint(const View& view, gfx::Canvas* canvas) override; gfx::Insets GetInsets() const override; @@ -92,8 +96,6 @@ const int thickness_; const int corner_radius_; const gfx::Insets paint_insets_; - - DISALLOW_COPY_AND_ASSIGN(RoundedRectBorder); }; RoundedRectBorder::RoundedRectBorder(int thickness, @@ -131,6 +133,9 @@ public: explicit EmptyBorder(const gfx::Insets& insets); + EmptyBorder(const EmptyBorder&) = delete; + EmptyBorder& operator=(const EmptyBorder&) = delete; + // Overridden from Border: void Paint(const View& view, gfx::Canvas* canvas) override; gfx::Insets GetInsets() const override; @@ -138,8 +143,6 @@ private: const gfx::Insets insets_; - - DISALLOW_COPY_AND_ASSIGN(EmptyBorder); }; EmptyBorder::EmptyBorder(const gfx::Insets& insets) : insets_(insets) {} @@ -158,6 +161,9 @@ public: ExtraInsetsBorder(std::unique_ptr<Border> border, const gfx::Insets& insets); + ExtraInsetsBorder(const ExtraInsetsBorder&) = delete; + ExtraInsetsBorder& operator=(const ExtraInsetsBorder&) = delete; + // Overridden from Border: void Paint(const View& view, gfx::Canvas* canvas) override; gfx::Insets GetInsets() const override; @@ -166,8 +172,6 @@ private: std::unique_ptr<Border> border_; const gfx::Insets extra_insets_; - - DISALLOW_COPY_AND_ASSIGN(ExtraInsetsBorder); }; ExtraInsetsBorder::ExtraInsetsBorder(std::unique_ptr<Border> border, @@ -194,6 +198,9 @@ public: BorderPainter(std::unique_ptr<Painter> painter, const gfx::Insets& insets); + BorderPainter(const BorderPainter&) = delete; + BorderPainter& operator=(const BorderPainter&) = delete; + // Overridden from Border: void Paint(const View& view, gfx::Canvas* canvas) override; gfx::Insets GetInsets() const override; @@ -202,8 +209,6 @@ private: std::unique_ptr<Painter> painter_; const gfx::Insets insets_; - - DISALLOW_COPY_AND_ASSIGN(BorderPainter); }; BorderPainter::BorderPainter(std::unique_ptr<Painter> painter,
diff --git a/ui/views/border_unittest.cc b/ui/views/border_unittest.cc index 62ce80a..dfdd6e5c 100644 --- a/ui/views/border_unittest.cc +++ b/ui/views/border_unittest.cc
@@ -60,6 +60,9 @@ MockCanvas(int width, int height) : SkCanvas(width, height) {} + MockCanvas(const MockCanvas&) = delete; + MockCanvas& operator=(const MockCanvas&) = delete; + // Return calls in sorted order. std::vector<DrawRectCall> draw_rect_calls() { return std::vector<DrawRectCall>(draw_rect_calls_.begin(), @@ -105,8 +108,6 @@ // Stores the onDrawPaint calls in chronological order. std::vector<SkPaint> draw_paint_calls_; SkRect last_clip_bounds_; - - DISALLOW_COPY_AND_ASSIGN(MockCanvas); }; // Simple Painter that will be used to test BorderPainter. @@ -114,6 +115,9 @@ public: MockPainter() = default; + MockPainter(const MockPainter&) = delete; + MockPainter& operator=(const MockPainter&) = delete; + // Gets the canvas given to the last call to Paint(). gfx::Canvas* given_canvas() const { return given_canvas_; } @@ -135,8 +139,6 @@ private: gfx::Canvas* given_canvas_ = nullptr; gfx::Size given_size_; - - DISALLOW_COPY_AND_ASSIGN(MockPainter); }; } // namespace
diff --git a/ui/views/bubble/bubble_border.h b/ui/views/bubble/bubble_border.h index e361c84..c95a651 100644 --- a/ui/views/bubble/bubble_border.h +++ b/ui/views/bubble/bubble_border.h
@@ -262,13 +262,14 @@ public: explicit BubbleBackground(BubbleBorder* border) : border_(border) {} + BubbleBackground(const BubbleBackground&) = delete; + BubbleBackground& operator=(const BubbleBackground&) = delete; + // Overridden from Background: void Paint(gfx::Canvas* canvas, View* view) const override; private: BubbleBorder* border_; - - DISALLOW_COPY_AND_ASSIGN(BubbleBackground); }; } // namespace views
diff --git a/ui/views/bubble/bubble_dialog_delegate_view.cc b/ui/views/bubble/bubble_dialog_delegate_view.cc index 264d0a0..6c65c84 100644 --- a/ui/views/bubble/bubble_dialog_delegate_view.cc +++ b/ui/views/bubble/bubble_dialog_delegate_view.cc
@@ -88,6 +88,9 @@ public: BubbleWidget() = default; + BubbleWidget(const BubbleWidget&) = delete; + BubbleWidget& operator=(const BubbleWidget&) = delete; + // Widget: const ui::ThemeProvider* GetThemeProvider() const override { // TODO(pbos): Could this use Widget::parent() instead of anchor_widget()? @@ -106,9 +109,6 @@ return Widget::GetPrimaryWindowWidget(); return bubble_delegate->anchor_widget()->GetPrimaryWindowWidget(); } - - private: - DISALLOW_COPY_AND_ASSIGN(BubbleWidget); }; // The frame view for bubble dialog widgets. These are not user-sizable so have @@ -119,12 +119,12 @@ explicit BubbleDialogFrameView(const gfx::Insets& title_margins) : BubbleFrameView(title_margins, gfx::Insets()) {} + BubbleDialogFrameView(const BubbleDialogFrameView&) = delete; + BubbleDialogFrameView& operator=(const BubbleDialogFrameView&) = delete; + // View: gfx::Size GetMinimumSize() const override { return gfx::Size(); } gfx::Size GetMaximumSize() const override { return gfx::Size(); } - - private: - DISALLOW_COPY_AND_ASSIGN(BubbleDialogFrameView); }; bool CustomShadowsSupported() {
diff --git a/ui/views/bubble/bubble_frame_view_unittest.cc b/ui/views/bubble/bubble_frame_view_unittest.cc index afe2521..c280c1b 100644 --- a/ui/views/bubble/bubble_frame_view_unittest.cc +++ b/ui/views/bubble/bubble_frame_view_unittest.cc
@@ -968,12 +968,13 @@ widget_.Show(); } + TestAnchor(const TestAnchor&) = delete; + TestAnchor& operator=(const TestAnchor&) = delete; + Widget& widget() { return widget_; } private: Widget widget_; - - DISALLOW_COPY_AND_ASSIGN(TestAnchor); }; // BubbleDialogDelegate with no margins to test width snapping. @@ -988,8 +989,8 @@ GetWidget()->Show(); } - private: - DISALLOW_COPY_AND_ASSIGN(TestWidthSnapDelegate); + TestWidthSnapDelegate(const TestWidthSnapDelegate&) = delete; + TestWidthSnapDelegate& operator=(const TestWidthSnapDelegate&) = delete; }; } // namespace
diff --git a/ui/views/bubble/footnote_container_view.cc b/ui/views/bubble/footnote_container_view.cc index 96bcbead..ba360a6c 100644 --- a/ui/views/bubble/footnote_container_view.cc +++ b/ui/views/bubble/footnote_container_view.cc
@@ -29,6 +29,12 @@ : radius_(radius) { SetNativeControlColor(color); } + + HalfRoundedRectBackground() = delete; + HalfRoundedRectBackground(const HalfRoundedRectBackground&) = delete; + HalfRoundedRectBackground& operator=(const HalfRoundedRectBackground&) = + delete; + ~HalfRoundedRectBackground() override = default; // Background: @@ -47,8 +53,6 @@ private: float radius_; - - DISALLOW_IMPLICIT_CONSTRUCTORS(HalfRoundedRectBackground); }; } // namespace
diff --git a/ui/views/bubble/footnote_container_view.h b/ui/views/bubble/footnote_container_view.h index 148d49c..536be21 100644 --- a/ui/views/bubble/footnote_container_view.h +++ b/ui/views/bubble/footnote_container_view.h
@@ -17,9 +17,15 @@ public: METADATA_HEADER(FootnoteContainerView); + FootnoteContainerView() = delete; + FootnoteContainerView(const gfx::Insets& margins, std::unique_ptr<View> child_view, float corner_radius); + + FootnoteContainerView(const FootnoteContainerView&) = delete; + FootnoteContainerView& operator=(const FootnoteContainerView&) = delete; + ~FootnoteContainerView() override; void SetCornerRadius(float corner_radius); @@ -33,8 +39,6 @@ void ResetBorder(); float corner_radius_; - - DISALLOW_IMPLICIT_CONSTRUCTORS(FootnoteContainerView); }; } // namespace views
diff --git a/ui/views/cocoa/bridged_native_widget_interactive_uitest.mm b/ui/views/cocoa/bridged_native_widget_interactive_uitest.mm index 08bdeb1..fc5d9a2 100644 --- a/ui/views/cocoa/bridged_native_widget_interactive_uitest.mm +++ b/ui/views/cocoa/bridged_native_widget_interactive_uitest.mm
@@ -26,6 +26,10 @@ public: BridgedNativeWidgetUITest() = default; + BridgedNativeWidgetUITest(const BridgedNativeWidgetUITest&) = delete; + BridgedNativeWidgetUITest& operator=(const BridgedNativeWidgetUITest&) = + delete; + // testing::Test: void SetUp() override { SetUpForInteractiveTests(); @@ -60,9 +64,6 @@ protected: std::unique_ptr<Widget> widget_; - - private: - DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidgetUITest); }; // Tests for correct fullscreen tracking, regardless of whether it is initiated
diff --git a/ui/views/cocoa/bridged_native_widget_unittest.mm b/ui/views/cocoa/bridged_native_widget_unittest.mm index 313ffb7..9c4d7dd 100644 --- a/ui/views/cocoa/bridged_native_widget_unittest.mm +++ b/ui/views/cocoa/bridged_native_widget_unittest.mm
@@ -298,6 +298,10 @@ public: explicit MockNativeWidgetMac(internal::NativeWidgetDelegate* delegate) : NativeWidgetMac(delegate) {} + + MockNativeWidgetMac(const MockNativeWidgetMac&) = delete; + MockNativeWidgetMac& operator=(const MockNativeWidgetMac&) = delete; + using NativeWidgetMac::GetInProcessNSWindowBridge; using NativeWidgetMac::GetNSWindowHost; @@ -330,9 +334,6 @@ void ReorderNativeViews() override { // Called via Widget::Init to set the content view. No-op in these tests. } - - private: - DISALLOW_COPY_AND_ASSIGN(MockNativeWidgetMac); }; // Helper test base to construct a NativeWidgetNSWindowBridge with a valid @@ -348,6 +349,10 @@ explicit BridgedNativeWidgetTestBase(SkipInitialization tag) : native_widget_mac_(nullptr) {} + BridgedNativeWidgetTestBase(const BridgedNativeWidgetTestBase&) = delete; + BridgedNativeWidgetTestBase& operator=(const BridgedNativeWidgetTestBase&) = + delete; + remote_cocoa::NativeWidgetNSWindowBridge* bridge() { return native_widget_mac_->GetInProcessNSWindowBridge(); } @@ -420,8 +425,6 @@ private: TestViewsDelegate test_views_delegate_; - - DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidgetTestBase); }; class BridgedNativeWidgetTest : public BridgedNativeWidgetTestBase, @@ -861,6 +864,10 @@ BridgedNativeWidgetInitTest() : BridgedNativeWidgetTestBase(SkipInitialization()) {} + BridgedNativeWidgetInitTest(const BridgedNativeWidgetInitTest&) = delete; + BridgedNativeWidgetInitTest& operator=(const BridgedNativeWidgetInitTest&) = + delete; + // Prepares a new |window_| and |widget_| for a call to PerformInit(). void CreateNewWidgetToInit() { widget_ = std::make_unique<Widget>(); @@ -877,9 +884,6 @@ init_params.shadow_type = shadow_type_; widget_->Init(std::move(init_params)); } - - private: - DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidgetInitTest); }; // Test that NativeWidgetNSWindowBridge remains sane if Init() is never called.
diff --git a/ui/views/cocoa/cocoa_mouse_capture_unittest.mm b/ui/views/cocoa/cocoa_mouse_capture_unittest.mm index 23909bd..2785ba5 100644 --- a/ui/views/cocoa/cocoa_mouse_capture_unittest.mm +++ b/ui/views/cocoa/cocoa_mouse_capture_unittest.mm
@@ -39,6 +39,9 @@ explicit TestCaptureDelegate(NSWindow* window) : event_count_(0), capture_lost_count_(0), window_(window) {} + TestCaptureDelegate(const TestCaptureDelegate&) = delete; + TestCaptureDelegate& operator=(const TestCaptureDelegate&) = delete; + void Acquire() { mouse_capture_ = std::make_unique<CocoaMouseCapture>(this); } bool IsActive() { return mouse_capture_ && mouse_capture_->IsActive(); } void SimulateDestroy() { mouse_capture_.reset(); } @@ -56,8 +59,6 @@ int event_count_; int capture_lost_count_; NSWindow* window_; - - DISALLOW_COPY_AND_ASSIGN(TestCaptureDelegate); }; } // namespace
diff --git a/ui/views/cocoa/drag_drop_client_mac_unittest.mm b/ui/views/cocoa/drag_drop_client_mac_unittest.mm index 9966491..78e1377 100644 --- a/ui/views/cocoa/drag_drop_client_mac_unittest.mm +++ b/ui/views/cocoa/drag_drop_client_mac_unittest.mm
@@ -126,6 +126,9 @@ public: DragDropView() = default; + DragDropView(const DragDropView&) = delete; + DragDropView& operator=(const DragDropView&) = delete; + void set_formats(int formats) { formats_ = formats; } // View: @@ -149,14 +152,15 @@ private: // Drop formats accepted by this View object. int formats_ = 0; - - DISALLOW_COPY_AND_ASSIGN(DragDropView); }; class DragDropClientMacTest : public WidgetTest { public: DragDropClientMacTest() : widget_(new Widget) {} + DragDropClientMacTest(const DragDropClientMacTest&) = delete; + DragDropClientMacTest& operator=(const DragDropClientMacTest&) = delete; + DragDropClientMac* drag_drop_client() { return ns_window_host_->drag_drop_client(); } @@ -213,9 +217,6 @@ NativeWidgetMacNSWindowHost* ns_window_host_ = nullptr; DragDropView* target_ = nullptr; base::scoped_nsobject<MockDraggingInfo> dragging_info_; - - private: - DISALLOW_COPY_AND_ASSIGN(DragDropClientMacTest); }; // Tests if the drag and drop target receives the dropped data. @@ -311,14 +312,14 @@ public: DragDropCloseView() {} + DragDropCloseView(const DragDropCloseView&) = delete; + DragDropCloseView& operator=(const DragDropCloseView&) = delete; + // View: DragOperation OnPerformDrop(const ui::DropTargetEvent& event) override { GetWidget()->CloseNow(); return DragOperation::kMove; } - - private: - DISALLOW_COPY_AND_ASSIGN(DragDropCloseView); }; // Tests that closing Widget on OnPerformDrop does not crash.
diff --git a/ui/views/context_menu_controller.h b/ui/views/context_menu_controller.h index 4dfe2fb..907eeca 100644 --- a/ui/views/context_menu_controller.h +++ b/ui/views/context_menu_controller.h
@@ -32,6 +32,9 @@ public: ContextMenuController(); + ContextMenuController(const ContextMenuController&) = delete; + ContextMenuController& operator=(const ContextMenuController&) = delete; + // Invoked to show the context menu for |source|. |point| is in screen // coordinates. This method also prevents reentrant calls. void ShowContextMenuForView(View* source, @@ -54,8 +57,6 @@ bool is_opening_ = false; base::WeakPtrFactory<ContextMenuController> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(ContextMenuController); }; } // namespace views
diff --git a/ui/views/controls/button/button.h b/ui/views/controls/button/button.h index 05edd2c..4edc0f3 100644 --- a/ui/views/controls/button/button.h +++ b/ui/views/controls/button/button.h
@@ -113,6 +113,9 @@ METADATA_HEADER(Button); + Button(const Button&) = delete; + Button& operator=(const Button&) = delete; + ~Button() override; static const Button* AsButton(const View* view); @@ -347,8 +350,6 @@ base::CallbackListSubscription enabled_changed_subscription_{ AddEnabledChangedCallback(base::BindRepeating(&Button::OnEnabledChanged, base::Unretained(this)))}; - - DISALLOW_COPY_AND_ASSIGN(Button); }; BEGIN_VIEW_BUILDER(VIEWS_EXPORT, Button, View)
diff --git a/ui/views/controls/button/image_button_unittest.cc b/ui/views/controls/button/image_button_unittest.cc index cf3c931..c9fa7ea 100644 --- a/ui/views/controls/button/image_button_unittest.cc +++ b/ui/views/controls/button/image_button_unittest.cc
@@ -22,6 +22,9 @@ public: Parent() = default; + Parent(const Parent&) = delete; + Parent& operator=(const Parent&) = delete; + void ChildPreferredSizeChanged(views::View* view) override { pref_size_changed_calls_++; } @@ -30,8 +33,6 @@ private: int pref_size_changed_calls_ = 0; - - DISALLOW_COPY_AND_ASSIGN(Parent); }; } // namespace
diff --git a/ui/views/controls/button/label_button_label_unittest.cc b/ui/views/controls/button/label_button_label_unittest.cc index 809efa5..ac48a8c791 100644 --- a/ui/views/controls/button/label_button_label_unittest.cc +++ b/ui/views/controls/button/label_button_label_unittest.cc
@@ -24,6 +24,9 @@ : LabelButtonLabel(std::u16string(), views::style::CONTEXT_BUTTON), last_color_(last_color) {} + TestLabel(const TestLabel&) = delete; + TestLabel& operator=(const TestLabel&) = delete; + // LabelButtonLabel: void OnDidSchedulePaint(const gfx::Rect& r) override { LabelButtonLabel::OnDidSchedulePaint(r); @@ -32,8 +35,6 @@ private: SkColor* last_color_; - - DISALLOW_COPY_AND_ASSIGN(TestLabel); }; } // namespace @@ -42,6 +43,9 @@ public: LabelButtonLabelTest() = default; + LabelButtonLabelTest(const LabelButtonLabelTest&) = delete; + LabelButtonLabelTest& operator=(const LabelButtonLabelTest&) = delete; + void SetUp() override { ViewsTestBase::SetUp(); @@ -68,9 +72,6 @@ SkColor last_color_ = gfx::kPlaceholderColor; std::unique_ptr<views::Widget> widget_; TestLabel* label_; - - private: - DISALLOW_COPY_AND_ASSIGN(LabelButtonLabelTest); }; // Test that LabelButtonLabel reacts properly to themed and overridden colors.
diff --git a/ui/views/controls/button/label_button_unittest.cc b/ui/views/controls/button/label_button_unittest.cc index 1c0854e..23787c2 100644 --- a/ui/views/controls/button/label_button_unittest.cc +++ b/ui/views/controls/button/label_button_unittest.cc
@@ -60,19 +60,22 @@ int button_context = style::CONTEXT_BUTTON) : LabelButton(Button::PressedCallback(), text, button_context) {} + TestLabelButton(const TestLabelButton&) = delete; + TestLabelButton& operator=(const TestLabelButton&) = delete; + using LabelButton::GetVisualState; using LabelButton::image; using LabelButton::label; using LabelButton::OnThemeChanged; - - private: - DISALLOW_COPY_AND_ASSIGN(TestLabelButton); }; class LabelButtonTest : public test::WidgetTest { public: LabelButtonTest() = default; + LabelButtonTest(const LabelButtonTest&) = delete; + LabelButtonTest& operator=(const LabelButtonTest&) = delete; + // testing::Test: void SetUp() override { WidgetTest::SetUp(); @@ -129,8 +132,6 @@ private: Widget* test_widget_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(LabelButtonTest); }; TEST_F(LabelButtonTest, FocusBehavior) { @@ -763,6 +764,9 @@ public: InkDropLabelButtonTest() = default; + InkDropLabelButtonTest(const InkDropLabelButtonTest&) = delete; + InkDropLabelButtonTest& operator=(const InkDropLabelButtonTest&) = delete; + // ViewsTestBase: void SetUp() override { ViewsTestBase::SetUp(); @@ -798,9 +802,6 @@ // Weak ptr, |button_| owns the instance. test::TestInkDrop* test_ink_drop_ = nullptr; - - private: - DISALLOW_COPY_AND_ASSIGN(InkDropLabelButtonTest); }; TEST_F(InkDropLabelButtonTest, HoverStateAfterMouseEnterAndExitEvents) {
diff --git a/ui/views/controls/button/menu_button_controller.h b/ui/views/controls/button/menu_button_controller.h index 0e0182e..017d86e 100644 --- a/ui/views/controls/button/menu_button_controller.h +++ b/ui/views/controls/button/menu_button_controller.h
@@ -43,6 +43,10 @@ MenuButtonController(Button* button, Button::PressedCallback callback, std::unique_ptr<ButtonControllerDelegate> delegate); + + MenuButtonController(const MenuButtonController&) = delete; + MenuButtonController& operator=(const MenuButtonController&) = delete; + ~MenuButtonController() override; // view::ButtonController @@ -119,8 +123,6 @@ base::CallbackListSubscription state_changed_subscription_; base::WeakPtrFactory<MenuButtonController> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(MenuButtonController); }; } // namespace views
diff --git a/ui/views/controls/button/radio_button_unittest.cc b/ui/views/controls/button/radio_button_unittest.cc index f7b2e94..0fc4a9c0 100644 --- a/ui/views/controls/button/radio_button_unittest.cc +++ b/ui/views/controls/button/radio_button_unittest.cc
@@ -23,6 +23,9 @@ public: RadioButtonTest() = default; + RadioButtonTest(const RadioButtonTest&) = delete; + RadioButtonTest& operator=(const RadioButtonTest&) = delete; + void SetUp() override { ViewsTestBase::SetUp(); @@ -49,8 +52,6 @@ private: View* button_container_ = nullptr; std::unique_ptr<Widget> widget_; - - DISALLOW_COPY_AND_ASSIGN(RadioButtonTest); }; TEST_F(RadioButtonTest, Basics) {
diff --git a/ui/views/controls/combobox/combobox_unittest.cc b/ui/views/controls/combobox/combobox_unittest.cc index d4202b5..26e722d 100644 --- a/ui/views/controls/combobox/combobox_unittest.cc +++ b/ui/views/controls/combobox/combobox_unittest.cc
@@ -206,6 +206,9 @@ public: ComboboxTest() = default; + ComboboxTest(const ComboboxTest&) = delete; + ComboboxTest& operator=(const ComboboxTest&) = delete; + void TearDown() override { widget_.reset(); ViewsTestBase::TearDown(); @@ -287,9 +290,6 @@ int menu_show_count_ = 0; std::unique_ptr<ui::test::EventGenerator> event_generator_; - - private: - DISALLOW_COPY_AND_ASSIGN(ComboboxTest); }; #if defined(OS_MAC)
diff --git a/ui/views/controls/editable_combobox/editable_combobox_unittest.cc b/ui/views/controls/editable_combobox/editable_combobox_unittest.cc index b73ef727..5d540d2 100644 --- a/ui/views/controls/editable_combobox/editable_combobox_unittest.cc +++ b/ui/views/controls/editable_combobox/editable_combobox_unittest.cc
@@ -76,6 +76,9 @@ public: EditableComboboxTest() { views::test::DisableMenuClosureAnimations(); } + EditableComboboxTest(const EditableComboboxTest&) = delete; + EditableComboboxTest& operator=(const EditableComboboxTest&) = delete; + void SetUp() override; void TearDown() override; @@ -133,9 +136,6 @@ int change_count_ = 0; std::unique_ptr<ui::test::EventGenerator> event_generator_; - - private: - DISALLOW_COPY_AND_ASSIGN(EditableComboboxTest); }; void EditableComboboxTest::SetUp() {
diff --git a/ui/views/controls/image_view_unittest.cc b/ui/views/controls/image_view_unittest.cc index b0c7360..ee7e8a73 100644 --- a/ui/views/controls/image_view_unittest.cc +++ b/ui/views/controls/image_view_unittest.cc
@@ -47,6 +47,9 @@ public: ImageViewTest() = default; + ImageViewTest(const ImageViewTest&) = delete; + ImageViewTest& operator=(const ImageViewTest&) = delete; + // ViewsTestBase: void SetUp() override { ViewsTestBase::SetUp(); @@ -86,8 +89,6 @@ private: ImageView* image_view_ = nullptr; Widget widget_; - - DISALLOW_COPY_AND_ASSIGN(ImageViewTest); }; // Test the image origin of the internal ImageSkia is correct when it is
diff --git a/ui/views/controls/label_unittest.cc b/ui/views/controls/label_unittest.cc index 9b1011e..9814268 100644 --- a/ui/views/controls/label_unittest.cc +++ b/ui/views/controls/label_unittest.cc
@@ -63,6 +63,9 @@ public: TestLabel() : Label(u"TestLabel") { SizeToPreferredSize(); } + TestLabel(const TestLabel&) = delete; + TestLabel& operator=(const TestLabel&) = delete; + int schedule_paint_count() const { return schedule_paint_count_; } void SimulatePaint() { @@ -82,8 +85,6 @@ private: int schedule_paint_count_ = 0; - - DISALLOW_COPY_AND_ASSIGN(TestLabel); }; // A test utility function to set the application default text direction. @@ -145,6 +146,9 @@ LabelSelectionTest() = default; + LabelSelectionTest(const LabelSelectionTest&) = delete; + LabelSelectionTest& operator=(const LabelSelectionTest&) = delete; + // LabelTest overrides: void SetUp() override { LabelTest::SetUp(); @@ -234,8 +238,6 @@ private: std::unique_ptr<ui::test::EventGenerator> event_generator_; - - DISALLOW_COPY_AND_ASSIGN(LabelSelectionTest); }; TEST_F(LabelTest, Metadata) {
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc index 9871e3a..03c402f 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc
@@ -361,6 +361,9 @@ pixels_per_second_ = MenuItemView::pref_menu_height() * 20; } + MenuScrollTask(const MenuScrollTask&) = delete; + MenuScrollTask& operator=(const MenuScrollTask&) = delete; + void Update(const MenuController::MenuPart& part) { if (!part.is_scroll()) { StopScrolling(); @@ -424,8 +427,6 @@ // Y-coordinate of submenu_view_ when scrolling started. int start_y_ = 0; - - DISALLOW_COPY_AND_ASSIGN(MenuScrollTask); }; // MenuController:SelectByCharDetails ----------------------------------------
diff --git a/ui/views/controls/menu/menu_controller.h b/ui/views/controls/menu/menu_controller.h index a9d4625b7..76add191 100644 --- a/ui/views/controls/menu/menu_controller.h +++ b/ui/views/controls/menu/menu_controller.h
@@ -369,6 +369,9 @@ // Creates a MenuController. See |for_drop_| member for details on |for_drop|. MenuController(bool for_drop, internal::MenuControllerDelegate* delegate); + MenuController(const MenuController&) = delete; + MenuController& operator=(const MenuController&) = delete; + ~MenuController() override; // Invokes AcceleratorPressed() on the hot tracked view if there is one. @@ -811,8 +814,6 @@ // Currently showing alerted menu items. Updated when submenus open and close. base::flat_set<MenuItemView*> alerted_items_; - - DISALLOW_COPY_AND_ASSIGN(MenuController); }; } // namespace views
diff --git a/ui/views/controls/menu/menu_controller_unittest.cc b/ui/views/controls/menu/menu_controller_unittest.cc index 346f92b..de7de2e0 100644 --- a/ui/views/controls/menu/menu_controller_unittest.cc +++ b/ui/views/controls/menu/menu_controller_unittest.cc
@@ -168,6 +168,9 @@ public: TestEventHandler() = default; + TestEventHandler(const TestEventHandler&) = delete; + TestEventHandler& operator=(const TestEventHandler&) = delete; + void OnTouchEvent(ui::TouchEvent* event) override { switch (event->type()) { case ui::ET_TOUCH_PRESSED: @@ -186,7 +189,6 @@ private: int outstanding_touches_ = 0; - DISALLOW_COPY_AND_ASSIGN(TestEventHandler); }; // A test widget that counts gesture events. @@ -194,13 +196,15 @@ public: GestureTestWidget() = default; + GestureTestWidget(const GestureTestWidget&) = delete; + GestureTestWidget& operator=(const GestureTestWidget&) = delete; + void OnGestureEvent(ui::GestureEvent* event) override { ++gesture_count_; } int gesture_count() const { return gesture_count_; } private: int gesture_count_ = 0; - DISALLOW_COPY_AND_ASSIGN(GestureTestWidget); }; #if defined(USE_AURA)
diff --git a/ui/views/controls/menu/menu_host_root_view.h b/ui/views/controls/menu/menu_host_root_view.h index 8554831..0fcb471 100644 --- a/ui/views/controls/menu/menu_host_root_view.h +++ b/ui/views/controls/menu/menu_host_root_view.h
@@ -25,6 +25,9 @@ MenuHostRootView(Widget* widget, SubmenuView* submenu); + MenuHostRootView(const MenuHostRootView&) = delete; + MenuHostRootView& operator=(const MenuHostRootView&) = delete; + void ClearSubmenu() { submenu_ = nullptr; } // Overridden from View: @@ -53,8 +56,6 @@ // The SubmenuView we contain. SubmenuView* submenu_; - - DISALLOW_COPY_AND_ASSIGN(MenuHostRootView); }; } // namespace views
diff --git a/ui/views/controls/menu/menu_item_view.cc b/ui/views/controls/menu/menu_item_view.cc index 6bbf680..23c49fc 100644 --- a/ui/views/controls/menu/menu_item_view.cc +++ b/ui/views/controls/menu/menu_item_view.cc
@@ -78,13 +78,13 @@ SetEnabled(false); } + EmptyMenuMenuItem(const EmptyMenuMenuItem&) = delete; + EmptyMenuMenuItem& operator=(const EmptyMenuMenuItem&) = delete; + std::u16string GetTooltipText(const gfx::Point& p) const override { // Empty menu items shouldn't have a tooltip. return std::u16string(); } - - private: - DISALLOW_COPY_AND_ASSIGN(EmptyMenuMenuItem); }; // VerticalSeparator ----------------------------------------------------------
diff --git a/ui/views/controls/menu/menu_item_view.h b/ui/views/controls/menu/menu_item_view.h index c325e90..391ffb98 100644 --- a/ui/views/controls/menu/menu_item_view.h +++ b/ui/views/controls/menu/menu_item_view.h
@@ -124,6 +124,9 @@ // shown to the user, rather its use as the parent for all menu items. explicit MenuItemView(MenuDelegate* delegate = nullptr); + MenuItemView(const MenuItemView&) = delete; + MenuItemView& operator=(const MenuItemView&) = delete; + // Overridden from View: std::u16string GetTooltipText(const gfx::Point& p) const override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override; @@ -648,8 +651,6 @@ // Whether this menu item is rendered differently to draw attention to it. bool is_alerted_ = false; - - DISALLOW_COPY_AND_ASSIGN(MenuItemView); }; } // namespace views
diff --git a/ui/views/controls/menu/menu_runner_cocoa_unittest.mm b/ui/views/controls/menu/menu_runner_cocoa_unittest.mm index 4c5472f..ba8f47e 100644 --- a/ui/views/controls/menu/menu_runner_cocoa_unittest.mm +++ b/ui/views/controls/menu/menu_runner_cocoa_unittest.mm
@@ -31,6 +31,9 @@ public: TestModel() : ui::SimpleMenuModel(&delegate_), delegate_(this) {} + TestModel(const TestModel&) = delete; + TestModel& operator=(const TestModel&) = delete; + void set_checked_command(int command) { checked_command_ = command; } void set_menu_open_callback(base::OnceClosure callback) { @@ -44,6 +47,10 @@ bool IsCommandIdChecked(int command_id) const override { return command_id == model_->checked_command_; } + + Delegate(const Delegate&) = delete; + Delegate& operator=(const Delegate&) = delete; + bool IsCommandIdEnabled(int command_id) const override { return true; } void ExecuteCommand(int command_id, int event_flags) override {} @@ -64,16 +71,12 @@ private: TestModel* model_; - - DISALLOW_COPY_AND_ASSIGN(Delegate); }; private: int checked_command_ = -1; Delegate delegate_; base::OnceClosure menu_open_callback_; - - DISALLOW_COPY_AND_ASSIGN(TestModel); }; enum class MenuType { NATIVE, VIEWS };
diff --git a/ui/views/controls/menu/menu_runner_impl.h b/ui/views/controls/menu/menu_runner_impl.h index cbb37dd..dc2dcc67 100644 --- a/ui/views/controls/menu/menu_runner_impl.h +++ b/ui/views/controls/menu/menu_runner_impl.h
@@ -38,6 +38,9 @@ public: explicit MenuRunnerImpl(MenuItemView* menu); + MenuRunnerImpl(const MenuRunnerImpl&) = delete; + MenuRunnerImpl& operator=(const MenuRunnerImpl&) = delete; + bool IsRunning() const override; void Release() override; void RunMenuAt(Widget* parent, @@ -96,8 +99,6 @@ // Used to detect deletion of |this| when notifying delegate of success. base::WeakPtrFactory<MenuRunnerImpl> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(MenuRunnerImpl); }; } // namespace internal
diff --git a/ui/views/controls/menu/menu_runner_impl_adapter.h b/ui/views/controls/menu/menu_runner_impl_adapter.h index 139cec05..12275ea 100644 --- a/ui/views/controls/menu/menu_runner_impl_adapter.h +++ b/ui/views/controls/menu/menu_runner_impl_adapter.h
@@ -27,6 +27,9 @@ MenuRunnerImplAdapter(ui::MenuModel* menu_model, base::RepeatingClosure on_menu_closed_callback); + MenuRunnerImplAdapter(const MenuRunnerImplAdapter&) = delete; + MenuRunnerImplAdapter& operator=(const MenuRunnerImplAdapter&) = delete; + // MenuRunnerImplInterface: bool IsRunning() const override; void Release() override; @@ -44,8 +47,6 @@ std::unique_ptr<MenuModelAdapter> menu_model_adapter_; MenuRunnerImpl* impl_; - - DISALLOW_COPY_AND_ASSIGN(MenuRunnerImplAdapter); }; } // namespace internal
diff --git a/ui/views/controls/menu/menu_runner_impl_cocoa.h b/ui/views/controls/menu/menu_runner_impl_cocoa.h index 3cfdc47..6d0815e 100644 --- a/ui/views/controls/menu/menu_runner_impl_cocoa.h +++ b/ui/views/controls/menu/menu_runner_impl_cocoa.h
@@ -28,6 +28,9 @@ MenuRunnerImplCocoa(ui::MenuModel* menu, base::RepeatingClosure on_menu_closed_callback); + MenuRunnerImplCocoa(const MenuRunnerImplCocoa&) = delete; + MenuRunnerImplCocoa& operator=(const MenuRunnerImplCocoa&) = delete; + bool IsRunning() const override; void Release() override; void RunMenuAt(Widget* parent, @@ -61,8 +64,6 @@ // Invoked before RunMenuAt() returns, except upon a Release(). base::RepeatingClosure on_menu_closed_callback_; - - DISALLOW_COPY_AND_ASSIGN(MenuRunnerImplCocoa); }; } // namespace internal
diff --git a/ui/views/controls/menu/menu_runner_unittest.cc b/ui/views/controls/menu/menu_runner_unittest.cc index 00d09bb..7139c73 100644 --- a/ui/views/controls/menu/menu_runner_unittest.cc +++ b/ui/views/controls/menu/menu_runner_unittest.cc
@@ -354,6 +354,9 @@ public: MenuRunnerWidgetTest() = default; + MenuRunnerWidgetTest(const MenuRunnerWidgetTest&) = delete; + MenuRunnerWidgetTest& operator=(const MenuRunnerWidgetTest&) = delete; + Widget* widget() { return widget_; } EventCountView* event_count_view() { return event_count_view_; } @@ -394,8 +397,6 @@ Widget* widget_ = nullptr; EventCountView* event_count_view_ = nullptr; std::unique_ptr<MenuLauncherEventHandler> consumer_; - - DISALLOW_COPY_AND_ASSIGN(MenuRunnerWidgetTest); }; // Tests that when a mouse press launches a menu, that the target widget does
diff --git a/ui/views/controls/menu/menu_scroll_view_container.h b/ui/views/controls/menu/menu_scroll_view_container.h index c942a56..8ba937e 100644 --- a/ui/views/controls/menu/menu_scroll_view_container.h +++ b/ui/views/controls/menu/menu_scroll_view_container.h
@@ -24,6 +24,9 @@ explicit MenuScrollViewContainer(SubmenuView* content_view); + MenuScrollViewContainer(const MenuScrollViewContainer&) = delete; + MenuScrollViewContainer& operator=(const MenuScrollViewContainer&) = delete; + // Returns the buttons for scrolling up/down. View* scroll_down_button() const { return scroll_down_button_; } View* scroll_up_button() const { return scroll_up_button_; } @@ -80,8 +83,6 @@ // Corner radius of the background. int corner_radius_ = 0; - - DISALLOW_COPY_AND_ASSIGN(MenuScrollViewContainer); }; } // namespace views
diff --git a/ui/views/controls/menu/menu_separator.h b/ui/views/controls/menu/menu_separator.h index 73d160b..a8a59a54 100644 --- a/ui/views/controls/menu/menu_separator.h +++ b/ui/views/controls/menu/menu_separator.h
@@ -22,6 +22,9 @@ ui::MenuSeparatorType type = ui::MenuSeparatorType::NORMAL_SEPARATOR) : type_(type) {} + MenuSeparator(const MenuSeparator&) = delete; + MenuSeparator& operator=(const MenuSeparator&) = delete; + // View overrides. void OnPaint(gfx::Canvas* canvas) override; gfx::Size CalculatePreferredSize() const override; @@ -34,8 +37,6 @@ private: // The type of the separator. ui::MenuSeparatorType type_; - - DISALLOW_COPY_AND_ASSIGN(MenuSeparator); }; } // namespace views
diff --git a/ui/views/controls/native/native_view_host_aura_unittest.cc b/ui/views/controls/native/native_view_host_aura_unittest.cc index 1831040..411eb19 100644 --- a/ui/views/controls/native/native_view_host_aura_unittest.cc +++ b/ui/views/controls/native/native_view_host_aura_unittest.cc
@@ -97,6 +97,9 @@ public: NativeViewHostAuraTest() = default; + NativeViewHostAuraTest(const NativeViewHostAuraTest&) = delete; + NativeViewHostAuraTest& operator=(const NativeViewHostAuraTest&) = delete; + NativeViewHostAura* native_host() { return static_cast<NativeViewHostAura*>(GetNativeWrapper()); } @@ -123,8 +126,6 @@ private: std::unique_ptr<Widget> child_; - - DISALLOW_COPY_AND_ASSIGN(NativeViewHostAuraTest); }; // Verifies NativeViewHostAura stops observing native view on destruction.
diff --git a/ui/views/controls/native/native_view_host_mac_unittest.mm b/ui/views/controls/native/native_view_host_mac_unittest.mm index 60282b7..d325c36 100644 --- a/ui/views/controls/native/native_view_host_mac_unittest.mm +++ b/ui/views/controls/native/native_view_host_mac_unittest.mm
@@ -59,6 +59,9 @@ public: NativeViewHostMacTest() = default; + NativeViewHostMacTest(const NativeViewHostMacTest&) = delete; + NativeViewHostMacTest& operator=(const NativeViewHostMacTest&) = delete; + // testing::Test: void TearDown() override { // On Aura, the compositor is destroyed when the WindowTreeHost provided by @@ -88,9 +91,6 @@ protected: base::scoped_nsobject<NSView> native_view_; - - private: - DISALLOW_COPY_AND_ASSIGN(NativeViewHostMacTest); }; // Test destroying the top level widget before destroying the NativeViewHost.
diff --git a/ui/views/controls/native/native_view_host_unittest.cc b/ui/views/controls/native/native_view_host_unittest.cc index ebd7d31..bc10a25 100644 --- a/ui/views/controls/native/native_view_host_unittest.cc +++ b/ui/views/controls/native/native_view_host_unittest.cc
@@ -18,13 +18,13 @@ public: NativeViewHostTest() = default; + NativeViewHostTest(const NativeViewHostTest&) = delete; + NativeViewHostTest& operator=(const NativeViewHostTest&) = delete; + void SetUp() override { ViewsTestBase::SetUp(); CreateTopLevel(); } - - private: - DISALLOW_COPY_AND_ASSIGN(NativeViewHostTest); }; namespace { @@ -35,6 +35,11 @@ public: NativeViewHierarchyChangedTestView() = default; + NativeViewHierarchyChangedTestView( + const NativeViewHierarchyChangedTestView&) = delete; + NativeViewHierarchyChangedTestView& operator=( + const NativeViewHierarchyChangedTestView&) = delete; + void ResetCount() { notification_count_ = 0; } int notification_count() const { return notification_count_; } @@ -47,8 +52,6 @@ private: int notification_count_ = 0; - - DISALLOW_COPY_AND_ASSIGN(NativeViewHierarchyChangedTestView); }; aura::Window* GetNativeParent(aura::Window* window) { @@ -59,6 +62,10 @@ public: ViewHierarchyChangedTestHost() = default; + ViewHierarchyChangedTestHost(const ViewHierarchyChangedTestHost&) = delete; + ViewHierarchyChangedTestHost& operator=(const ViewHierarchyChangedTestHost&) = + delete; + void ResetParentChanges() { num_parent_changes_ = 0; } int num_parent_changes() const { return num_parent_changes_; } @@ -77,8 +84,6 @@ private: int num_parent_changes_ = 0; - - DISALLOW_COPY_AND_ASSIGN(ViewHierarchyChangedTestHost); }; } // namespace
diff --git a/ui/views/controls/scroll_view.h b/ui/views/controls/scroll_view.h index d648305..9bb7567 100644 --- a/ui/views/controls/scroll_view.h +++ b/ui/views/controls/scroll_view.h
@@ -464,6 +464,10 @@ // height of each row. FixedRowHeightScrollHelper(int top_margin, int row_height); + FixedRowHeightScrollHelper(const FixedRowHeightScrollHelper&) = delete; + FixedRowHeightScrollHelper& operator=(const FixedRowHeightScrollHelper&) = + delete; + protected: // Calculates the bounds of the row from the top margin and row height. RowInfo GetRowInfo(int y) override; @@ -471,8 +475,6 @@ private: int top_margin_; int row_height_; - - DISALLOW_COPY_AND_ASSIGN(FixedRowHeightScrollHelper); }; } // namespace views
diff --git a/ui/views/controls/scroll_view_unittest.cc b/ui/views/controls/scroll_view_unittest.cc index ed85fa7..84c6d50 100644 --- a/ui/views/controls/scroll_view_unittest.cc +++ b/ui/views/controls/scroll_view_unittest.cc
@@ -263,6 +263,9 @@ public: ScrollViewTest() = default; + ScrollViewTest(const ScrollViewTest&) = delete; + ScrollViewTest& operator=(const ScrollViewTest&) = delete; + void SetUp() override { ViewsTestBase::SetUp(); scroll_view_ = std::make_unique<ScrollView>(); @@ -304,9 +307,6 @@ } std::unique_ptr<ScrollView> scroll_view_; - - private: - DISALLOW_COPY_AND_ASSIGN(ScrollViewTest); }; // Test harness that includes a Widget to help test ui::Event handling. @@ -318,6 +318,9 @@ WidgetScrollViewTest() = default; + WidgetScrollViewTest(const WidgetScrollViewTest&) = delete; + WidgetScrollViewTest& operator=(const WidgetScrollViewTest&) = delete; + // Call this before adding the ScrollView to test with overlay scrollbars. void SetUseOverlayScrollers() { use_overlay_scrollers_ = true; } @@ -403,8 +406,6 @@ #if defined(OS_MAC) std::unique_ptr<ui::test::ScopedPreferredScrollerStyle> scroller_style_; #endif - - DISALLOW_COPY_AND_ASSIGN(WidgetScrollViewTest); }; constexpr int WidgetScrollViewTest::kDefaultHeight; @@ -429,6 +430,11 @@ } } + WidgetScrollViewTestRTLAndLayers(const WidgetScrollViewTestRTLAndLayers&) = + delete; + WidgetScrollViewTestRTLAndLayers& operator=( + const WidgetScrollViewTestRTLAndLayers&) = delete; + bool IsTestingRtl() const { return GetParam() == UiConfig::kRtl || GetParam() == UiConfig::kRtlWithLayers; @@ -457,8 +463,6 @@ private: base::test::ScopedRestoreICUDefaultLocale locale_; base::test::ScopedFeatureList layer_config_; - - DISALLOW_COPY_AND_ASSIGN(WidgetScrollViewTestRTLAndLayers); }; std::string UiConfigToString(const testing::TestParamInfo<UiConfig>& info) {
diff --git a/ui/views/controls/tabbed_pane/tabbed_pane_accessibility_mac_unittest.mm b/ui/views/controls/tabbed_pane/tabbed_pane_accessibility_mac_unittest.mm index 845b1d6..e6febe2 100644 --- a/ui/views/controls/tabbed_pane/tabbed_pane_accessibility_mac_unittest.mm +++ b/ui/views/controls/tabbed_pane/tabbed_pane_accessibility_mac_unittest.mm
@@ -44,6 +44,11 @@ public: TabbedPaneAccessibilityMacTest() = default; + TabbedPaneAccessibilityMacTest(const TabbedPaneAccessibilityMacTest&) = + delete; + TabbedPaneAccessibilityMacTest& operator=( + const TabbedPaneAccessibilityMacTest&) = delete; + // WidgetTest: void SetUp() override { WidgetTest::SetUp(); @@ -85,9 +90,6 @@ protected: Widget* widget_ = nullptr; TabbedPane* tabbed_pane_ = nullptr; - - private: - DISALLOW_COPY_AND_ASSIGN(TabbedPaneAccessibilityMacTest); }; // Test the Tab's a11y information compared to a Cocoa NSTabViewItem.
diff --git a/ui/views/controls/tabbed_pane/tabbed_pane_unittest.cc b/ui/views/controls/tabbed_pane/tabbed_pane_unittest.cc index 94d40e05..0bee6888 100644 --- a/ui/views/controls/tabbed_pane/tabbed_pane_unittest.cc +++ b/ui/views/controls/tabbed_pane/tabbed_pane_unittest.cc
@@ -108,6 +108,9 @@ public: TabbedPaneWithWidgetTest() = default; + TabbedPaneWithWidgetTest(const TabbedPaneWithWidgetTest&) = delete; + TabbedPaneWithWidgetTest& operator=(const TabbedPaneWithWidgetTest&) = delete; + void SetUp() override { ViewsTestBase::SetUp(); auto tabbed_pane = std::make_unique<TabbedPane>(); @@ -146,9 +149,6 @@ std::unique_ptr<Widget> widget_; TabbedPane* tabbed_pane_; - - private: - DISALLOW_COPY_AND_ASSIGN(TabbedPaneWithWidgetTest); }; // Tests the preferred size and layout when tabs are aligned horizontally.
diff --git a/ui/views/controls/table/table_view.cc b/ui/views/controls/table/table_view.cc index 6eb54fa..8accf6d 100644 --- a/ui/views/controls/table/table_view.cc +++ b/ui/views/controls/table/table_view.cc
@@ -143,6 +143,9 @@ public: HighlightPathGenerator() = default; + HighlightPathGenerator(const HighlightPathGenerator&) = delete; + HighlightPathGenerator& operator=(const HighlightPathGenerator&) = delete; + // HighlightPathGenerator: SkPath GetHighlightPath(const views::View* view) override { if (!PlatformStyle::kTableViewSupportsKeyboardNavigationByCell) @@ -159,9 +162,6 @@ bounds.set_x(table->GetMirroredXForRect(bounds)); return SkPath().addRect(gfx::RectToSkRect(bounds)); } - - private: - DISALLOW_COPY_AND_ASSIGN(HighlightPathGenerator); }; TableView::TableView() : weak_factory_(this) {
diff --git a/ui/views/controls/table/table_view_unittest.cc b/ui/views/controls/table/table_view_unittest.cc index 7e75acd..d9900d2 100644 --- a/ui/views/controls/table/table_view_unittest.cc +++ b/ui/views/controls/table/table_view_unittest.cc
@@ -42,6 +42,9 @@ public: explicit TableViewTestHelper(TableView* table) : table_(table) {} + TableViewTestHelper(const TableViewTestHelper&) = delete; + TableViewTestHelper& operator=(const TableViewTestHelper&) = delete; + std::string GetPaintRegion(const gfx::Rect& bounds) { TableView::PaintRegion region(table_->GetPaintRegion(bounds)); return "rows=" + base::NumberToString(region.min_row) + " " + @@ -135,8 +138,6 @@ private: TableView* table_; - - DISALLOW_COPY_AND_ASSIGN(TableViewTestHelper); }; namespace { @@ -162,6 +163,9 @@ public: TestTableModel2(); + TestTableModel2(const TestTableModel2&) = delete; + TestTableModel2& operator=(const TestTableModel2&) = delete; + // Adds a new row at index |row| with values |c1_value| and |c2_value|. void AddRow(int row, int c1_value, int c2_value); @@ -199,8 +203,6 @@ // The data. std::vector<std::vector<int>> rows_; - - DISALLOW_COPY_AND_ASSIGN(TestTableModel2); }; TestTableModel2::TestTableModel2() { @@ -425,6 +427,9 @@ public: TableViewTest() = default; + TableViewTest(const TableViewTest&) = delete; + TableViewTest& operator=(const TableViewTest&) = delete; + void SetUp() override { ViewsTestBase::SetUp(); @@ -614,8 +619,6 @@ const int y = (row + 0.5) * table_->GetRowHeight(); return table_->GetBoundsInScreen().origin() + gfx::Vector2d(5, y); } - - DISALLOW_COPY_AND_ASSIGN(TableViewTest); }; INSTANTIATE_TEST_SUITE_P(All, TableViewTest, testing::Values(false, true)); @@ -1142,6 +1145,9 @@ public: TableGrouperImpl() = default; + TableGrouperImpl(const TableGrouperImpl&) = delete; + TableGrouperImpl& operator=(const TableGrouperImpl&) = delete; + void SetRanges(const std::vector<int>& ranges) { ranges_ = ranges; } // TableGrouper overrides: @@ -1162,8 +1168,6 @@ private: std::vector<int> ranges_; - - DISALLOW_COPY_AND_ASSIGN(TableGrouperImpl); }; } // namespace @@ -1248,6 +1252,9 @@ public: TableViewObserverImpl() = default; + TableViewObserverImpl(const TableViewObserverImpl&) = delete; + TableViewObserverImpl& operator=(const TableViewObserverImpl&) = delete; + int GetChangedCountAndClear() { const int count = selection_changed_count_; selection_changed_count_ = 0; @@ -1259,8 +1266,6 @@ private: int selection_changed_count_ = 0; - - DISALLOW_COPY_AND_ASSIGN(TableViewObserverImpl); }; } // namespace @@ -2140,6 +2145,9 @@ public: TableViewFocusTest() = default; + TableViewFocusTest(const TableViewFocusTest&) = delete; + TableViewFocusTest& operator=(const TableViewFocusTest&) = delete; + protected: WidgetDelegate* GetWidgetDelegate(Widget* widget) override; @@ -2149,8 +2157,6 @@ private: std::unique_ptr<RemoveFocusChangeListenerDelegate> delegate_; - - DISALLOW_COPY_AND_ASSIGN(TableViewFocusTest); }; WidgetDelegate* TableViewFocusTest::GetWidgetDelegate(Widget* widget) {
diff --git a/ui/views/controls/textfield/textfield_model.h b/ui/views/controls/textfield/textfield_model.h index a928d28..b796dcc 100644 --- a/ui/views/controls/textfield/textfield_model.h +++ b/ui/views/controls/textfield/textfield_model.h
@@ -62,6 +62,10 @@ }; explicit TextfieldModel(Delegate* delegate); + + TextfieldModel(const TextfieldModel&) = delete; + TextfieldModel& operator=(const TextfieldModel&) = delete; + virtual ~TextfieldModel(); // Edit related methods. @@ -358,8 +362,6 @@ // 2) new edit is added. (redo history is cleared) // 3) redone all undone edits. EditHistory::iterator current_edit_; - - DISALLOW_COPY_AND_ASSIGN(TextfieldModel); }; } // namespace views
diff --git a/ui/views/controls/textfield/textfield_model_unittest.cc b/ui/views/controls/textfield/textfield_model_unittest.cc index ab12368..53f4c21 100644 --- a/ui/views/controls/textfield/textfield_model_unittest.cc +++ b/ui/views/controls/textfield/textfield_model_unittest.cc
@@ -41,6 +41,9 @@ public: TextfieldModelTest() = default; + TextfieldModelTest(const TextfieldModelTest&) = delete; + TextfieldModelTest& operator=(const TextfieldModelTest&) = delete; + // ::testing::Test: void TearDown() override { // Clear kill buffer used for "Yank" text editing command so that no state @@ -77,9 +80,6 @@ } bool composition_text_confirmed_or_cleared_ = false; - - private: - DISALLOW_COPY_AND_ASSIGN(TextfieldModelTest); }; TEST_F(TextfieldModelTest, EditString) {
diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc index 9a8a5a4..58f385f 100644 --- a/ui/views/controls/textfield/textfield_unittest.cc +++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -93,8 +93,8 @@ GestureEventForTest(int x, int y, ui::GestureEventDetails details) : GestureEvent(x, y, ui::EF_NONE, base::TimeTicks(), details) {} - private: - DISALLOW_COPY_AND_ASSIGN(GestureEventForTest); + GestureEventForTest(const GestureEventForTest&) = delete; + GestureEventForTest& operator=(const GestureEventForTest&) = delete; }; // This controller will happily destroy the target field passed on @@ -105,6 +105,10 @@ target_->set_controller(this); } + TextfieldDestroyerController(const TextfieldDestroyerController&) = delete; + TextfieldDestroyerController& operator=(const TextfieldDestroyerController&) = + delete; + Textfield* target() { return target_.get(); } // TextfieldController: @@ -118,8 +122,6 @@ private: std::unique_ptr<Textfield> target_; - - DISALLOW_COPY_AND_ASSIGN(TextfieldDestroyerController); }; // Class that focuses a textfield when it sees a KeyDown event. @@ -129,6 +131,9 @@ SetFocusBehavior(FocusBehavior::ALWAYS); } + TextfieldFocuser(const TextfieldFocuser&) = delete; + TextfieldFocuser& operator=(const TextfieldFocuser&) = delete; + void set_consume(bool consume) { consume_ = consume; } // View: @@ -140,8 +145,6 @@ private: bool consume_ = true; Textfield* textfield_; - - DISALLOW_COPY_AND_ASSIGN(TextfieldFocuser); }; class MockInputMethod : public ui::InputMethodBase {
diff --git a/ui/views/controls/tree/tree_view_unittest.cc b/ui/views/controls/tree/tree_view_unittest.cc index 14f6fa1..4217ea0 100644 --- a/ui/views/controls/tree/tree_view_unittest.cc +++ b/ui/views/controls/tree/tree_view_unittest.cc
@@ -87,6 +87,9 @@ Add(model_.GetRoot(), 2, "c"); } + TreeViewTest(const TreeViewTest&) = delete; + TreeViewTest& operator=(const TreeViewTest&) = delete; + // ViewsTestBase void SetUp() override; void TearDown() override; @@ -157,8 +160,6 @@ // Keeps a record of all accessibility events that have been fired on the tree // view. AccessibilityEventsVector accessibility_events_; - - DISALLOW_COPY_AND_ASSIGN(TreeViewTest); }; void TreeViewTest::SetUp() {
diff --git a/ui/views/corewm/desktop_capture_controller_unittest.cc b/ui/views/corewm/desktop_capture_controller_unittest.cc index d04c5bac..95b78ca 100644 --- a/ui/views/corewm/desktop_capture_controller_unittest.cc +++ b/ui/views/corewm/desktop_capture_controller_unittest.cc
@@ -33,6 +33,9 @@ public: DesktopViewInputTest() = default; + DesktopViewInputTest(const DesktopViewInputTest&) = delete; + DesktopViewInputTest& operator=(const DesktopViewInputTest&) = delete; + void OnGestureEvent(ui::GestureEvent* event) override { received_gesture_event_ = true; return View::OnGestureEvent(event); @@ -45,8 +48,6 @@ private: bool received_gesture_event_ = false; - - DISALLOW_COPY_AND_ASSIGN(DesktopViewInputTest); }; views::Widget* CreateWidget() {
diff --git a/ui/views/corewm/test/tooltip_aura_test_api.h b/ui/views/corewm/test/tooltip_aura_test_api.h index cd9327a..0ce0b50 100644 --- a/ui/views/corewm/test/tooltip_aura_test_api.h +++ b/ui/views/corewm/test/tooltip_aura_test_api.h
@@ -31,6 +31,9 @@ explicit TooltipAuraTestApi(TooltipAura* tooltip_aura) : tooltip_aura_(tooltip_aura) {} + TooltipAuraTestApi(const TooltipAuraTestApi&) = delete; + TooltipAuraTestApi& operator=(const TooltipAuraTestApi&) = delete; + gfx::RenderText* GetRenderText(); void GetAccessibleNodeData(ui::AXNodeData* node_data); @@ -40,8 +43,6 @@ private: TooltipAura* tooltip_aura_; - - DISALLOW_COPY_AND_ASSIGN(TooltipAuraTestApi); }; } // namespace test
diff --git a/ui/views/event_monitor_unittest.cc b/ui/views/event_monitor_unittest.cc index fdd1db1..15adbcbe 100644 --- a/ui/views/event_monitor_unittest.cc +++ b/ui/views/event_monitor_unittest.cc
@@ -42,6 +42,9 @@ public: EventMonitorTest() = default; + EventMonitorTest(const EventMonitorTest&) = delete; + EventMonitorTest& operator=(const EventMonitorTest&) = delete; + // testing::Test: void SetUp() override { WidgetTest::SetUp(); @@ -61,9 +64,6 @@ Widget* widget_ = nullptr; std::unique_ptr<ui::test::EventGenerator> generator_; TestEventObserver observer_; - - private: - DISALLOW_COPY_AND_ASSIGN(EventMonitorTest); }; TEST_F(EventMonitorTest, ShouldReceiveAppEventsWhileInstalled) { @@ -136,6 +136,10 @@ this, context, {ui::ET_MOUSE_PRESSED, ui::ET_MOUSE_RELEASED}); } + DeleteOtherOnEventObserver(const DeleteOtherOnEventObserver&) = delete; + DeleteOtherOnEventObserver& operator=(const DeleteOtherOnEventObserver&) = + delete; + bool DidDelete() const { return !observer_to_delete_; } void set_monitor_to_delete( @@ -151,8 +155,6 @@ private: std::unique_ptr<EventMonitor> monitor_; std::unique_ptr<DeleteOtherOnEventObserver> observer_to_delete_; - - DISALLOW_COPY_AND_ASSIGN(DeleteOtherOnEventObserver); }; } // namespace
diff --git a/ui/views/examples/bubble_example.cc b/ui/views/examples/bubble_example.cc index 2af8602..09cb92e 100644 --- a/ui/views/examples/bubble_example.cc +++ b/ui/views/examples/bubble_example.cc
@@ -74,15 +74,15 @@ DialogDelegate::SetButtons(ui::DIALOG_BUTTON_NONE); } + ExampleBubble(const ExampleBubble&) = delete; + ExampleBubble& operator=(const ExampleBubble&) = delete; + protected: void Init() override { SetLayoutManager(std::make_unique<BoxLayout>( BoxLayout::Orientation::kVertical, gfx::Insets(50))); AddChildView(std::make_unique<Label>(GetArrowName(arrow()))); } - - private: - DISALLOW_COPY_AND_ASSIGN(ExampleBubble); }; } // namespace
diff --git a/ui/views/examples/dialog_example.cc b/ui/views/examples/dialog_example.cc index 6e783f3..2860f49a 100644 --- a/ui/views/examples/dialog_example.cc +++ b/ui/views/examples/dialog_example.cc
@@ -48,6 +48,9 @@ WidgetDelegate::SetModalType(parent_->GetModalType()); } + Delegate(const Delegate&) = delete; + Delegate& operator=(const Delegate&) = delete; + void InitDelegate() { this->SetLayoutManager(std::make_unique<FillLayout>()); auto body = std::make_unique<Label>(parent_->body_->GetText()); @@ -72,8 +75,6 @@ private: DialogExample* parent_; - - DISALLOW_COPY_AND_ASSIGN(Delegate); }; class DialogExample::Bubble : public Delegate<BubbleDialogDelegateView> { @@ -84,11 +85,11 @@ set_close_on_deactivate(!parent->persistent_bubble_->GetChecked()); } + Bubble(const Bubble&) = delete; + Bubble& operator=(const Bubble&) = delete; + // BubbleDialogDelegateView: void Init() override { InitDelegate(); } - - private: - DISALLOW_COPY_AND_ASSIGN(Bubble); }; class DialogExample::Dialog : public Delegate<DialogDelegateView> { @@ -100,8 +101,8 @@ SetCanResize(true); } - private: - DISALLOW_COPY_AND_ASSIGN(Dialog); + Dialog(const Dialog&) = delete; + Dialog& operator=(const Dialog&) = delete; }; DialogExample::DialogExample()
diff --git a/ui/views/examples/menu_example.cc b/ui/views/examples/menu_example.cc index 13e36e7..c6f987e 100644 --- a/ui/views/examples/menu_example.cc +++ b/ui/views/examples/menu_example.cc
@@ -33,6 +33,9 @@ public: ExampleMenuModel(); + ExampleMenuModel(const ExampleMenuModel&) = delete; + ExampleMenuModel& operator=(const ExampleMenuModel&) = delete; + // ui::SimpleMenuModel::Delegate: bool IsCommandIdChecked(int command_id) const override; bool IsCommandIdEnabled(int command_id) const override; @@ -57,8 +60,6 @@ std::unique_ptr<ui::SimpleMenuModel> submenu_; std::set<int> checked_fruits_; int current_encoding_command_id_ = COMMAND_SELECT_ASCII; - - DISALLOW_COPY_AND_ASSIGN(ExampleMenuModel); }; class ExampleMenuButton : public MenuButton {
diff --git a/ui/views/examples/multiline_example.cc b/ui/views/examples/multiline_example.cc index b5887e7..d6e1571 100644 --- a/ui/views/examples/multiline_example.cc +++ b/ui/views/examples/multiline_example.cc
@@ -69,6 +69,9 @@ SetBorder(CreateSolidBorder(2, SK_ColorGRAY)); } + RenderTextView(const RenderTextView&) = delete; + RenderTextView& operator=(const RenderTextView&) = delete; + void OnPaint(gfx::Canvas* canvas) override { View::OnPaint(canvas); render_text_->Draw(canvas); @@ -126,8 +129,6 @@ } std::unique_ptr<gfx::RenderText> render_text_; - - DISALLOW_COPY_AND_ASSIGN(RenderTextView); }; MultilineExample::MultilineExample()
diff --git a/ui/views/examples/scroll_view_example.cc b/ui/views/examples/scroll_view_example.cc index a930d97..400c35d7 100644 --- a/ui/views/examples/scroll_view_example.cc +++ b/ui/views/examples/scroll_view_example.cc
@@ -54,6 +54,9 @@ layout_manager->SetDefaultFlex(1); } + ScrollableView(const ScrollableView&) = delete; + ScrollableView& operator=(const ScrollableView&) = delete; + void SetColor(SkColor from, SkColor to) { from_color_ = from; to_color_ = to; @@ -70,8 +73,6 @@ private: SkColor from_color_; SkColor to_color_; - - DISALLOW_COPY_AND_ASSIGN(ScrollableView); }; ScrollViewExample::ScrollViewExample()
diff --git a/ui/views/examples/throbber_example.cc b/ui/views/examples/throbber_example.cc index 4d90b9e8..6f532d8 100644 --- a/ui/views/examples/throbber_example.cc +++ b/ui/views/examples/throbber_example.cc
@@ -25,6 +25,9 @@ throbber_->Start(); } + ThrobberView(const ThrobberView&) = delete; + ThrobberView& operator=(const ThrobberView&) = delete; + // View:: gfx::Size CalculatePreferredSize() const override { return gfx::Size(width(), height()); @@ -53,8 +56,6 @@ private: Throbber* throbber_; bool is_checked_ = false; - - DISALLOW_COPY_AND_ASSIGN(ThrobberView); }; } // namespace
diff --git a/ui/views/layout/fill_layout_unittest.cc b/ui/views/layout/fill_layout_unittest.cc index 6eeecbfd..26b1aa7 100644 --- a/ui/views/layout/fill_layout_unittest.cc +++ b/ui/views/layout/fill_layout_unittest.cc
@@ -25,6 +25,9 @@ SetHostSize(kDefaultHostWidth, kDefaultHostHeight); } + FillLayoutTest(const FillLayoutTest&) = delete; + FillLayoutTest& operator=(const FillLayoutTest&) = delete; + protected: // Convenience function to get the preferred size from |layout_|. gfx::Size GetPreferredSize() const { @@ -56,9 +59,6 @@ FillLayout* layout_ = nullptr; std::unique_ptr<View> host_; - - private: - DISALLOW_COPY_AND_ASSIGN(FillLayoutTest); }; } // namespace
diff --git a/ui/views/layout/flex_layout.cc b/ui/views/layout/flex_layout.cc index e7d7d643..a7891551 100644 --- a/ui/views/layout/flex_layout.cc +++ b/ui/views/layout/flex_layout.cc
@@ -39,6 +39,12 @@ // Layout information for a specific child view in a proposed layout. struct FlexChildData { explicit FlexChildData(const FlexSpecification& flex) : flex(flex) {} + + // Copying this struct would be expensive and they only ever live in a vector + // in Layout (see below) so we'll only allow move semantics. + FlexChildData(const FlexChildData&) = delete; + FlexChildData& operator=(const FlexChildData&) = delete; + FlexChildData(FlexChildData&& other) = default; std::string ToString() const { @@ -58,11 +64,6 @@ NormalizedInsets internal_padding; NormalizedRect actual_bounds; FlexSpecification flex; - - private: - // Copying this struct would be expensive and they only ever live in a vector - // in Layout (see below) so we'll only allow move semantics. - DISALLOW_COPY_AND_ASSIGN(FlexChildData); }; template <typename T> @@ -264,6 +265,10 @@ // Represents a specific stored layout given a set of size bounds. struct FlexLayout::FlexLayoutData { FlexLayoutData() = default; + + FlexLayoutData(const FlexLayoutData&) = delete; + FlexLayoutData& operator=(const FlexLayoutData&) = delete; + ~FlexLayoutData() = default; size_t num_children() const { return child_data.size(); } @@ -293,9 +298,6 @@ NormalizedSize total_size; NormalizedInsets interior_margin; NormalizedInsets host_insets; - - private: - DISALLOW_COPY_AND_ASSIGN(FlexLayoutData); }; FlexLayout::PropertyHandler::PropertyHandler(FlexLayout* layout)
diff --git a/ui/views/layout/grid_layout_unittest.cc b/ui/views/layout/grid_layout_unittest.cc index f377f401..2f6fe61 100644 --- a/ui/views/layout/grid_layout_unittest.cc +++ b/ui/views/layout/grid_layout_unittest.cc
@@ -59,6 +59,9 @@ public: LayoutOnAddView() { SetPreferredSize(gfx::Size(10, 10)); } + LayoutOnAddView(const LayoutOnAddView&) = delete; + LayoutOnAddView& operator=(const LayoutOnAddView&) = delete; + void set_target_size(const gfx::Size& target_size) { target_size_ = target_size; } @@ -79,8 +82,6 @@ private: gfx::Size target_size_; - - DISALLOW_COPY_AND_ASSIGN(LayoutOnAddView); }; // A view with fixed circumference that trades height for width.
diff --git a/ui/views/mouse_watcher.cc b/ui/views/mouse_watcher.cc index 65bb3692..567aa36 100644 --- a/ui/views/mouse_watcher.cc +++ b/ui/views/mouse_watcher.cc
@@ -36,6 +36,9 @@ ui::ET_MOUSE_DRAGGED}); } + Observer(const Observer&) = delete; + Observer& operator=(const Observer&) = delete; + // ui::EventObserver: void OnEvent(const ui::Event& event) override { using EventType = MouseWatcherHost::EventType; @@ -95,8 +98,6 @@ // A factory that is used to construct a delayed callback to the listener. base::WeakPtrFactory<Observer> notify_listener_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(Observer); }; MouseWatcherListener::~MouseWatcherListener() = default;
diff --git a/ui/views/selection_controller.h b/ui/views/selection_controller.h index 31ec3486..eab4c8a4 100644 --- a/ui/views/selection_controller.h +++ b/ui/views/selection_controller.h
@@ -38,6 +38,9 @@ // |delegate| must be non-null. explicit SelectionController(SelectionControllerDelegate* delegate); + SelectionController(const SelectionController&) = delete; + SelectionController& operator=(const SelectionController&) = delete; + // Handle mouse events forwarded by |delegate_|. |handled| specifies whether // the event has already been handled by the |delegate_|. If |handled| is // true, the mouse event is just used to update the internal state without @@ -109,8 +112,6 @@ // Whether the selection clipboard is handled. bool handles_selection_clipboard_; - - DISALLOW_COPY_AND_ASSIGN(SelectionController); }; } // namespace views
diff --git a/ui/views/style/platform_style.h b/ui/views/style/platform_style.h index e4da90e..70d9595e 100644 --- a/ui/views/style/platform_style.h +++ b/ui/views/style/platform_style.h
@@ -25,6 +25,10 @@ // Cross-platform API for providing platform-specific styling for toolkit-views. class VIEWS_EXPORT PlatformStyle { public: + PlatformStyle() = delete; + PlatformStyle(const PlatformStyle&) = delete; + PlatformStyle& operator=(const PlatformStyle&) = delete; + // Whether the ok button is in the leading position (left in LTR) in a // typical Cancel/OK button group. static const bool kIsOkButtonLeading; @@ -93,9 +97,6 @@ // pairs on other platforms. static gfx::Range RangeToDeleteBackwards(const std::u16string& text, size_t cursor_position); - - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformStyle); }; } // namespace views
diff --git a/ui/views/test/button_test_api.h b/ui/views/test/button_test_api.h index cbf33ae..6c08121 100644 --- a/ui/views/test/button_test_api.h +++ b/ui/views/test/button_test_api.h
@@ -21,12 +21,13 @@ public: explicit ButtonTestApi(Button* button) : button_(button) {} + ButtonTestApi(const ButtonTestApi&) = delete; + ButtonTestApi& operator=(const ButtonTestApi&) = delete; + void NotifyClick(const ui::Event& event); private: Button* button_; - - DISALLOW_COPY_AND_ASSIGN(ButtonTestApi); }; } // namespace test
diff --git a/ui/views/test/combobox_test_api.cc b/ui/views/test/combobox_test_api.cc index 4bfae58..58b467d7 100644 --- a/ui/views/test/combobox_test_api.cc +++ b/ui/views/test/combobox_test_api.cc
@@ -25,6 +25,10 @@ public: explicit TestMenuRunnerHandler(int* show_counter) : show_counter_(show_counter) {} + + TestMenuRunnerHandler(const TestMenuRunnerHandler&) = delete; + TestMenuRunnerHandler& operator=(const TestMenuRunnerHandler&) = delete; + void RunMenuAt(Widget* parent, MenuButtonController* button_controller, const gfx::Rect& bounds, @@ -36,8 +40,6 @@ private: int* show_counter_; - - DISALLOW_COPY_AND_ASSIGN(TestMenuRunnerHandler); }; } // namespace
diff --git a/ui/views/test/combobox_test_api.h b/ui/views/test/combobox_test_api.h index 74a8ca7..1a2c5fc3 100644 --- a/ui/views/test/combobox_test_api.h +++ b/ui/views/test/combobox_test_api.h
@@ -25,6 +25,9 @@ public: explicit ComboboxTestApi(Combobox* combobox) : combobox_(combobox) {} + ComboboxTestApi(const ComboboxTestApi&) = delete; + ComboboxTestApi& operator=(const ComboboxTestApi&) = delete; + // Activates the Combobox menu item at |index|, as if selected by the user. void PerformActionAt(int index); @@ -39,8 +42,6 @@ private: Combobox* combobox_; - - DISALLOW_COPY_AND_ASSIGN(ComboboxTestApi); }; } // namespace test
diff --git a/ui/views/test/desktop_window_tree_host_win_test_api.h b/ui/views/test/desktop_window_tree_host_win_test_api.h index 463f8f7..46cc015 100644 --- a/ui/views/test/desktop_window_tree_host_win_test_api.h +++ b/ui/views/test/desktop_window_tree_host_win_test_api.h
@@ -25,6 +25,11 @@ public: explicit DesktopWindowTreeHostWinTestApi(DesktopWindowTreeHostWin* host); + DesktopWindowTreeHostWinTestApi(const DesktopWindowTreeHostWinTestApi&) = + delete; + DesktopWindowTreeHostWinTestApi& operator=( + const DesktopWindowTreeHostWinTestApi&) = delete; + void EnsureAXSystemCaretCreated(); ui::AXSystemCaretWin* GetAXSystemCaret(); gfx::NativeViewAccessible GetNativeViewAccessible(); @@ -35,8 +40,6 @@ private: DesktopWindowTreeHostWin* host_; - - DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostWinTestApi); }; } // namespace test
diff --git a/ui/views/test/test_views.h b/ui/views/test/test_views.h index f28772aa..4a23fd1e 100644 --- a/ui/views/test/test_views.h +++ b/ui/views/test/test_views.h
@@ -73,13 +73,14 @@ public: explicit CloseWidgetView(ui::EventType event_type); + CloseWidgetView(const CloseWidgetView&) = delete; + CloseWidgetView& operator=(const CloseWidgetView&) = delete; + // ui::EventHandler override: void OnEvent(ui::Event* event) override; private: const ui::EventType event_type_; - - DISALLOW_COPY_AND_ASSIGN(CloseWidgetView); }; // A view that keeps track of the events it receives, optionally consuming them. @@ -128,11 +129,11 @@ public: ResizeAwareParentView(); + ResizeAwareParentView(const ResizeAwareParentView&) = delete; + ResizeAwareParentView& operator=(const ResizeAwareParentView&) = delete; + // Overridden from View: void ChildPreferredSizeChanged(View* child) override; - - private: - DISALLOW_COPY_AND_ASSIGN(ResizeAwareParentView); }; } // namespace views
diff --git a/ui/views/touchui/touch_selection_menu_runner_views.h b/ui/views/touchui/touch_selection_menu_runner_views.h index 9dc8fe44..8765a22 100644 --- a/ui/views/touchui/touch_selection_menu_runner_views.h +++ b/ui/views/touchui/touch_selection_menu_runner_views.h
@@ -42,6 +42,11 @@ }; TouchSelectionMenuRunnerViews(); + + TouchSelectionMenuRunnerViews(const TouchSelectionMenuRunnerViews&) = delete; + TouchSelectionMenuRunnerViews& operator=( + const TouchSelectionMenuRunnerViews&) = delete; + ~TouchSelectionMenuRunnerViews() override; protected: @@ -66,8 +71,6 @@ // A pointer to the currently running menu, or |nullptr| if no menu is // running. The menu manages its own lifetime and deletes itself when closed. TouchSelectionMenuViews* menu_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(TouchSelectionMenuRunnerViews); }; } // namespace views
diff --git a/ui/views/touchui/touch_selection_menu_views.h b/ui/views/touchui/touch_selection_menu_views.h index 33ea54ac..d3c325a 100644 --- a/ui/views/touchui/touch_selection_menu_views.h +++ b/ui/views/touchui/touch_selection_menu_views.h
@@ -28,6 +28,9 @@ ui::TouchSelectionMenuClient* client, aura::Window* context); + TouchSelectionMenuViews(const TouchSelectionMenuViews&) = delete; + TouchSelectionMenuViews& operator=(const TouchSelectionMenuViews&) = delete; + void ShowMenu(const gfx::Rect& anchor_rect, const gfx::Size& handle_image_size); @@ -64,8 +67,6 @@ TouchSelectionMenuRunnerViews* owner_; ui::TouchSelectionMenuClient* const client_; - - DISALLOW_COPY_AND_ASSIGN(TouchSelectionMenuViews); }; } // namespace views
diff --git a/ui/views/view_model.h b/ui/views/view_model.h index 47e7d08..f215aa6 100644 --- a/ui/views/view_model.h +++ b/ui/views/view_model.h
@@ -112,7 +112,10 @@ template <class T> class ViewModelT : public ViewModelBase { public: - ViewModelT<T>() = default; + ViewModelT() = default; + + ViewModelT(const ViewModelT&) = delete; + ViewModelT& operator=(const ViewModelT&) = delete; // Adds |view| to this model. This does not add |view| to a view hierarchy, // only to this model. @@ -120,9 +123,6 @@ // Returns the view at the specified index. T* view_at(int index) const { return static_cast<T*>(ViewAtBase(index)); } - - private: - DISALLOW_COPY_AND_ASSIGN(ViewModelT<T>); }; // ViewModel is a collection of views with no specfic type. If all views have
diff --git a/ui/views/view_model_utils.h b/ui/views/view_model_utils.h index e37b582f..7a83c28 100644 --- a/ui/views/view_model_utils.h +++ b/ui/views/view_model_utils.h
@@ -15,6 +15,10 @@ class VIEWS_EXPORT ViewModelUtils { public: + ViewModelUtils() = delete; + ViewModelUtils(const ViewModelUtils&) = delete; + ViewModelUtils& operator=(const ViewModelUtils&) = delete; + // Sets the bounds of each view to its ideal bounds. static void SetViewBoundsToIdealBounds(const ViewModelBase& model); @@ -27,9 +31,6 @@ bool is_horizontal, int x, int y); - - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(ViewModelUtils); }; } // namespace views
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc index f5fce77..15b9646a 100644 --- a/ui/views/view_unittest.cc +++ b/ui/views/view_unittest.cc
@@ -2209,14 +2209,15 @@ EXPECT_TRUE(widget_.GetFocusManager()); } + TestViewWidget(const TestViewWidget&) = delete; + TestViewWidget& operator=(const TestViewWidget&) = delete; + TestView* view() { return view_; } Widget* widget() { return &widget_; } private: TestView* view_; Widget widget_; - - DISALLOW_COPY_AND_ASSIGN(TestViewWidget); }; } // namespace @@ -3839,6 +3840,9 @@ public: TestLayerAnimator(); + TestLayerAnimator(const TestLayerAnimator&) = delete; + TestLayerAnimator& operator=(const TestLayerAnimator&) = delete; + const gfx::Rect& last_bounds() const { return last_bounds_; } // LayerAnimator. @@ -3849,8 +3853,6 @@ private: gfx::Rect last_bounds_; - - DISALLOW_COPY_AND_ASSIGN(TestLayerAnimator); }; TestLayerAnimator::TestLayerAnimator() @@ -4326,6 +4328,9 @@ public: PaintTrackingView() = default; + PaintTrackingView(const PaintTrackingView&) = delete; + PaintTrackingView& operator=(const PaintTrackingView&) = delete; + bool painted() const { return painted_; } void set_painted(bool value) { painted_ = value; } @@ -4333,8 +4338,6 @@ private: bool painted_ = false; - - DISALLOW_COPY_AND_ASSIGN(PaintTrackingView); }; // Makes sure child views with layers aren't painted when paint starts at an @@ -4932,6 +4935,9 @@ public: PaintLayerView() = default; + PaintLayerView(const PaintLayerView&) = delete; + PaintLayerView& operator=(const PaintLayerView&) = delete; + void PaintChildren(const PaintInfo& info) override { last_paint_info_ = std::make_unique<PaintInfo>(info); View::PaintChildren(info); @@ -4943,8 +4949,6 @@ private: std::unique_ptr<PaintInfo> last_paint_info_; - - DISALLOW_COPY_AND_ASSIGN(PaintLayerView); }; } // namespace @@ -5258,6 +5262,9 @@ SetBounds(0, 0, 100, 100); } + NoLayerWhenHiddenView(const NoLayerWhenHiddenView&) = delete; + NoLayerWhenHiddenView& operator=(const NoLayerWhenHiddenView&) = delete; + bool was_hidden() const { return was_hidden_; } // View: @@ -5276,8 +5283,6 @@ private: bool was_hidden_ = false; RemovedFromWidgetCallback removed_from_widget_; - - DISALLOW_COPY_AND_ASSIGN(NoLayerWhenHiddenView); }; // Test that Views can safely manipulate Layers during Widget closure. @@ -5798,6 +5803,9 @@ public: TestParentView() = default; + TestParentView(const TestParentView&) = delete; + TestParentView& operator=(const TestParentView&) = delete; + void Reset() { received_layer_change_notification_ = false; layer_change_count_ = 0; @@ -5822,8 +5830,6 @@ // Contains the number of OnChildLayerChanged() notifications for a child. int layer_change_count_ = 0; - - DISALLOW_COPY_AND_ASSIGN(TestParentView); }; // Tests the following cases.
diff --git a/ui/views/view_unittest_mac.mm b/ui/views/view_unittest_mac.mm index 811868e..6676270 100644 --- a/ui/views/view_unittest_mac.mm +++ b/ui/views/view_unittest_mac.mm
@@ -51,6 +51,9 @@ public: ThreeFingerSwipeView() = default; + ThreeFingerSwipeView(const ThreeFingerSwipeView&) = delete; + ThreeFingerSwipeView& operator=(const ThreeFingerSwipeView&) = delete; + // View: void OnGestureEvent(ui::GestureEvent* event) override { EXPECT_EQ(ui::ET_GESTURE_SWIPE, event->details().type()); @@ -81,8 +84,6 @@ private: absl::optional<gfx::Point> last_swipe_gesture_; - - DISALLOW_COPY_AND_ASSIGN(ThreeFingerSwipeView); }; } // namespace @@ -91,6 +92,9 @@ public: ViewMacTest() = default; + ViewMacTest(const ViewMacTest&) = delete; + ViewMacTest& operator=(const ViewMacTest&) = delete; + absl::optional<gfx::Point> SwipeGestureVector(int dx, int dy) { base::scoped_nsobject<FakeSwipeEvent> swipe_event( [[FakeSwipeEvent alloc] init]); @@ -128,8 +132,6 @@ private: Widget* widget_ = nullptr; ThreeFingerSwipeView* view_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(ViewMacTest); }; // Three-finger swipes send immediate events and they cannot be tracked.
diff --git a/ui/views/widget/ax_native_widget_mac_unittest.mm b/ui/views/widget/ax_native_widget_mac_unittest.mm index bf2974b1..04694ca 100644 --- a/ui/views/widget/ax_native_widget_mac_unittest.mm +++ b/ui/views/widget/ax_native_widget_mac_unittest.mm
@@ -49,6 +49,10 @@ class FlexibleRoleTestView : public View { public: explicit FlexibleRoleTestView(ax::mojom::Role role) : role_(role) {} + + FlexibleRoleTestView(const FlexibleRoleTestView&) = delete; + FlexibleRoleTestView& operator=(const FlexibleRoleTestView&) = delete; + void set_role(ax::mojom::Role role) { role_ = role; } // Add a child view and resize to fit the child. @@ -74,8 +78,6 @@ private: ax::mojom::Role role_; bool mouse_was_pressed_ = false; - - DISALLOW_COPY_AND_ASSIGN(FlexibleRoleTestView); }; class TestLabelButton : public LabelButton { @@ -85,25 +87,25 @@ label()->SetSize(gfx::Size(1, 1)); } - using LabelButton::label; + TestLabelButton(const TestLabelButton&) = delete; + TestLabelButton& operator=(const TestLabelButton&) = delete; - private: - DISALLOW_COPY_AND_ASSIGN(TestLabelButton); + using LabelButton::label; }; class TestWidgetDelegate : public test::TestDesktopWidgetDelegate { public: TestWidgetDelegate() = default; + TestWidgetDelegate(const TestWidgetDelegate&) = delete; + TestWidgetDelegate& operator=(const TestWidgetDelegate&) = delete; + static constexpr char16_t kAccessibleWindowTitle[] = u"My Accessible Window"; // WidgetDelegate: std::u16string GetAccessibleWindowTitle() const override { return kAccessibleWindowTitle; } - - private: - DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate); }; constexpr char16_t TestWidgetDelegate::kAccessibleWindowTitle[]; @@ -115,6 +117,9 @@ public: AXNativeWidgetMacTest() = default; + AXNativeWidgetMacTest(const AXNativeWidgetMacTest&) = delete; + AXNativeWidgetMacTest& operator=(const AXNativeWidgetMacTest&) = delete; + void SetUp() override { test::WidgetTest::SetUp(); widget_delegate_.InitWidget(CreateParams(Widget::InitParams::TYPE_WINDOW)); @@ -150,8 +155,6 @@ private: TestWidgetDelegate widget_delegate_; - - DISALLOW_COPY_AND_ASSIGN(AXNativeWidgetMacTest); }; } // namespace @@ -769,15 +772,15 @@ public: TestComboboxModel() = default; + TestComboboxModel(const TestComboboxModel&) = delete; + TestComboboxModel& operator=(const TestComboboxModel&) = delete; + // ui::ComboboxModel: int GetItemCount() const override { return 2; } std::u16string GetItemAt(int index) const override { return index == 0 ? base::SysNSStringToUTF16(kTestStringValue) : u"Second Item"; } - - private: - DISALLOW_COPY_AND_ASSIGN(TestComboboxModel); }; // Test a11y attributes of Comboboxes.
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc index a7f3e2f..43cbc49 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -156,6 +156,11 @@ return native_window; } + DesktopNativeWidgetTopLevelHandler( + const DesktopNativeWidgetTopLevelHandler&) = delete; + DesktopNativeWidgetTopLevelHandler& operator=( + const DesktopNativeWidgetTopLevelHandler&) = delete; + // aura::WindowObserver overrides void OnWindowDestroying(aura::Window* window) override { window->RemoveObserver(this); @@ -197,8 +202,6 @@ Widget* top_level_widget_ = nullptr; aura::Window* child_window_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetTopLevelHandler); }; class DesktopNativeWidgetAuraWindowParentingClient
diff --git a/ui/views/widget/native_widget_aura.h b/ui/views/widget/native_widget_aura.h index fac71091..37d3185b 100644 --- a/ui/views/widget/native_widget_aura.h +++ b/ui/views/widget/native_widget_aura.h
@@ -47,6 +47,9 @@ public: explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate); + NativeWidgetAura(const NativeWidgetAura&) = delete; + NativeWidgetAura& operator=(const NativeWidgetAura&) = delete; + // Called internally by NativeWidgetAura and DesktopNativeWidgetAura to // associate |native_widget| with |window|. static void RegisterNativeWidgetForWindow( @@ -260,8 +263,6 @@ // The following factory is used for calls to close the NativeWidgetAura // instance. base::WeakPtrFactory<NativeWidgetAura> close_widget_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura); }; } // namespace views
diff --git a/ui/views/widget/native_widget_aura_unittest.cc b/ui/views/widget/native_widget_aura_unittest.cc index d123806..de02d82 100644 --- a/ui/views/widget/native_widget_aura_unittest.cc +++ b/ui/views/widget/native_widget_aura_unittest.cc
@@ -371,6 +371,9 @@ public: TestWidget() = default; + TestWidget(const TestWidget&) = delete; + TestWidget& operator=(const TestWidget&) = delete; + // Returns true if the size changes to a non-empty size, and then to another // size. bool did_size_change_more_than_once() const { @@ -388,8 +391,6 @@ private: bool did_size_change_more_than_once_ = false; gfx::Size last_size_; - - DISALLOW_COPY_AND_ASSIGN(TestWidget); }; // Verifies the size of the widget doesn't change more than once during Init if @@ -476,6 +477,9 @@ public: GestureTrackingView() = default; + GestureTrackingView(const GestureTrackingView&) = delete; + GestureTrackingView& operator=(const GestureTrackingView&) = delete; + void set_consume_gesture_event(bool value) { consume_gesture_event_ = value; } void clear_got_gesture_event() { got_gesture_event_ = false; } @@ -494,8 +498,6 @@ // Dictates what OnGestureEvent() returns. bool consume_gesture_event_ = true; - - DISALLOW_COPY_AND_ASSIGN(GestureTrackingView); }; // Verifies a capture isn't set on touch press and that the view that gets
diff --git a/ui/views/widget/native_widget_mac_interactive_uitest.mm b/ui/views/widget/native_widget_mac_interactive_uitest.mm index e28d988..12b3667 100644 --- a/ui/views/widget/native_widget_mac_interactive_uitest.mm +++ b/ui/views/widget/native_widget_mac_interactive_uitest.mm
@@ -31,6 +31,11 @@ NativeWidgetMacInteractiveUITest() = default; + NativeWidgetMacInteractiveUITest(const NativeWidgetMacInteractiveUITest&) = + delete; + NativeWidgetMacInteractiveUITest& operator=( + const NativeWidgetMacInteractiveUITest&) = delete; + // WidgetTest: void SetUp() override { SetUpForInteractiveTests(); @@ -46,9 +51,6 @@ std::unique_ptr<Observer> observer_; int activation_count_ = 0; int deactivation_count_ = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(NativeWidgetMacInteractiveUITest); }; class NativeWidgetMacInteractiveUITest::Observer : public TestWidgetObserver { @@ -56,6 +58,9 @@ Observer(NativeWidgetMacInteractiveUITest* parent, Widget* widget) : TestWidgetObserver(widget), parent_(parent) {} + Observer(const Observer&) = delete; + Observer& operator=(const Observer&) = delete; + void OnWidgetActivationChanged(Widget* widget, bool active) override { if (active) parent_->activation_count_++; @@ -65,8 +70,6 @@ private: NativeWidgetMacInteractiveUITest* parent_; - - DISALLOW_COPY_AND_ASSIGN(Observer); }; // Test that showing a window causes it to attain global keyWindow status. @@ -180,8 +183,8 @@ SetAnchorView(parent->GetContentsView()); } - private: - DISALLOW_COPY_AND_ASSIGN(TestBubbleView); + TestBubbleView(const TestBubbleView&) = delete; + TestBubbleView& operator=(const TestBubbleView&) = delete; }; } // namespace
diff --git a/ui/views/widget/native_widget_mac_unittest.mm b/ui/views/widget/native_widget_mac_unittest.mm index a89b4d8..a81ff11d 100644 --- a/ui/views/widget/native_widget_mac_unittest.mm +++ b/ui/views/widget/native_widget_mac_unittest.mm
@@ -100,6 +100,10 @@ ->GetInProcessNSWindowBridge(); } + BridgedNativeWidgetTestApi(const BridgedNativeWidgetTestApi&) = delete; + BridgedNativeWidgetTestApi& operator=(const BridgedNativeWidgetTestApi&) = + delete; + // Simulate a frame swap from the compositor. void SimulateFrameSwap(const gfx::Size& size) { const float kScaleFactor = 1.0f; @@ -121,8 +125,6 @@ private: remote_cocoa::NativeWidgetNSWindowBridge* bridge_; - - DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidgetTestApi); }; // Custom native_widget to create a NativeWidgetMacTestWindow. @@ -131,6 +133,10 @@ explicit TestWindowNativeWidgetMac(Widget* delegate) : NativeWidgetMac(delegate) {} + TestWindowNativeWidgetMac(const TestWindowNativeWidgetMac&) = delete; + TestWindowNativeWidgetMac& operator=(const TestWindowNativeWidgetMac&) = + delete; + protected: // NativeWidgetMac: void PopulateCreateWindowParams( @@ -151,9 +157,6 @@ backing:NSBackingStoreBuffered defer:NO] autorelease]; } - - private: - DISALLOW_COPY_AND_ASSIGN(TestWindowNativeWidgetMac); }; // Tests for parts of NativeWidgetMac not covered by NativeWidgetNSWindowBridge, @@ -162,6 +165,9 @@ public: NativeWidgetMacTest() = default; + NativeWidgetMacTest(const NativeWidgetMacTest&) = delete; + NativeWidgetMacTest& operator=(const NativeWidgetMacTest&) = delete; + // Make an NSWindow with a close button and a title bar to use as a parent. // This NSWindow is backed by a widget that is not exposed to the caller. // To destroy the Widget, the native NSWindow must be closed. @@ -201,15 +207,15 @@ FocusManager* GetFocusManager(NativeWidgetMac* native_widget) const { return native_widget->focus_manager_; } - - private: - DISALLOW_COPY_AND_ASSIGN(NativeWidgetMacTest); }; class WidgetChangeObserver : public TestWidgetObserver { public: explicit WidgetChangeObserver(Widget* widget) : TestWidgetObserver(widget) {} + WidgetChangeObserver(const WidgetChangeObserver&) = delete; + WidgetChangeObserver& operator=(const WidgetChangeObserver&) = delete; + void WaitForVisibleCounts(int gained, int lost) { if (gained_visible_count_ >= gained && lost_visible_count_ >= lost) return; @@ -243,8 +249,6 @@ int target_gained_visible_count_ = 0; int target_lost_visible_count_ = 0; base::RunLoop* run_loop_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(WidgetChangeObserver); }; // This class gives public access to the protected ctor of @@ -264,6 +268,9 @@ CustomTooltipView(const std::u16string& tooltip, View* tooltip_handler) : tooltip_(tooltip), tooltip_handler_(tooltip_handler) {} + CustomTooltipView(const CustomTooltipView&) = delete; + CustomTooltipView& operator=(const CustomTooltipView&) = delete; + // View: std::u16string GetTooltipText(const gfx::Point& p) const override { return tooltip_; @@ -276,8 +283,6 @@ private: std::u16string tooltip_; View* tooltip_handler_; // Weak - - DISALLOW_COPY_AND_ASSIGN(CustomTooltipView); }; // A Widget subclass that exposes counts to calls made to OnMouseEvent(). @@ -388,6 +393,9 @@ public: PaintCountView() { SetBounds(0, 0, 100, 100); } + PaintCountView(const PaintCountView&) = delete; + PaintCountView& operator=(const PaintCountView&) = delete; + // View: void OnPaint(gfx::Canvas* canvas) override { EXPECT_TRUE(GetWidget()->IsVisible()); @@ -413,8 +421,6 @@ int paint_count_ = 0; int target_paint_count_ = 0; base::RunLoop* run_loop_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(PaintCountView); }; @@ -566,6 +572,9 @@ SetBounds(x, 0, 100, 300); } + CursorView(const CursorView&) = delete; + CursorView& operator=(const CursorView&) = delete; + // View: gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override { return cursor_; @@ -573,8 +582,6 @@ private: NSCursor* cursor_; - - DISALLOW_COPY_AND_ASSIGN(CursorView); }; // Test for Widget::SetCursor(). There is no Widget::GetCursor(), so this uses @@ -1756,6 +1763,10 @@ CustomTitleWidgetDelegate(Widget* widget) : widget_(widget), should_show_title_(true) {} + CustomTitleWidgetDelegate(const CustomTitleWidgetDelegate&) = delete; + CustomTitleWidgetDelegate& operator=(const CustomTitleWidgetDelegate&) = + delete; + void set_title(const std::u16string& title) { title_ = title; } void set_should_show_title(bool show) { should_show_title_ = show; } @@ -1769,8 +1780,6 @@ Widget* widget_; std::u16string title_; bool should_show_title_; - - DISALLOW_COPY_AND_ASSIGN(CustomTitleWidgetDelegate); }; // Test that undocumented title-hiding API we're using does the job. @@ -2119,6 +2128,10 @@ public: NativeWidgetMacViewsOrderTest() {} + NativeWidgetMacViewsOrderTest(const NativeWidgetMacViewsOrderTest&) = delete; + NativeWidgetMacViewsOrderTest& operator=( + const NativeWidgetMacViewsOrderTest&) = delete; + protected: class NativeHostHolder { public: @@ -2130,6 +2143,9 @@ return holder; } + NativeHostHolder(const NativeHostHolder&) = delete; + NativeHostHolder& operator=(const NativeHostHolder&) = delete; + NSView* view() const { return view_.get(); } NativeViewHost* host() const { return host_; } @@ -2139,8 +2155,6 @@ NativeViewHost* const host_; base::scoped_nsobject<NSView> view_; - - DISALLOW_COPY_AND_ASSIGN(NativeHostHolder); }; // testing::Test: @@ -2183,9 +2197,6 @@ View* native_host_parent_ = nullptr; std::vector<std::unique_ptr<NativeHostHolder>> hosts_; base::scoped_nsobject<NSArray<NSView*>> starting_subviews_; - - private: - DISALLOW_COPY_AND_ASSIGN(NativeWidgetMacViewsOrderTest); }; // Test that NativeViewHost::Attach()/Detach() method saves the NativeView
diff --git a/ui/views/widget/root_view_unittest.cc b/ui/views/widget/root_view_unittest.cc index ca6d598..4c57656 100644 --- a/ui/views/widget/root_view_unittest.cc +++ b/ui/views/widget/root_view_unittest.cc
@@ -443,6 +443,9 @@ explicit RemoveViewOnEvent(ui::EventType remove_event_type) : remove_event_type_(remove_event_type) {} + RemoveViewOnEvent(const RemoveViewOnEvent&) = delete; + RemoveViewOnEvent& operator=(const RemoveViewOnEvent&) = delete; + void OnEvent(ui::Event* event) override { if (event->type() == remove_event_type_) parent()->RemoveChildView(this); @@ -451,8 +454,6 @@ private: // The event type which causes the view to remove itself. ui::EventType remove_event_type_; - - DISALLOW_COPY_AND_ASSIGN(RemoveViewOnEvent); }; // View class which generates a nested event the first time it gets an event of @@ -463,6 +464,9 @@ NestedEventOnEvent(ui::EventType nested_event_type, View* root_view) : nested_event_type_(nested_event_type), root_view_(root_view) {} + NestedEventOnEvent(const NestedEventOnEvent&) = delete; + NestedEventOnEvent& operator=(const NestedEventOnEvent&) = delete; + void OnEvent(ui::Event* event) override { if (event->type() == nested_event_type_) { ui::MouseEvent exit_event(ui::ET_MOUSE_EXITED, gfx::Point(), gfx::Point(), @@ -479,8 +483,6 @@ ui::EventType nested_event_type_; // root view of this view; owned by widget. View* root_view_; - - DISALLOW_COPY_AND_ASSIGN(NestedEventOnEvent); }; } // namespace
diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h index ae08499..6a370ed 100644 --- a/ui/views/widget/widget.h +++ b/ui/views/widget/widget.h
@@ -402,6 +402,10 @@ Widget(); explicit Widget(InitParams params); + + Widget(const Widget&) = delete; + Widget& operator=(const Widget&) = delete; + ~Widget() override; // Creates a decorated window Widget with the specified properties. The @@ -1268,8 +1272,6 @@ native_theme_observation_{this}; base::WeakPtrFactory<Widget> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(Widget); }; } // namespace views
diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc index f6c79b5..931df20 100644 --- a/ui/views/widget/widget_interactive_uitest.cc +++ b/ui/views/widget/widget_interactive_uitest.cc
@@ -1328,6 +1328,9 @@ public: CaptureLostState() = default; + CaptureLostState(const CaptureLostState&) = delete; + CaptureLostState& operator=(const CaptureLostState&) = delete; + bool GetAndClearGotCaptureLost() { bool value = got_capture_lost_; got_capture_lost_ = false; @@ -1338,8 +1341,6 @@ private: bool got_capture_lost_ = false; - - DISALLOW_COPY_AND_ASSIGN(CaptureLostState); }; // Used to verify OnMouseCaptureLost() has been invoked. @@ -1348,6 +1349,10 @@ explicit CaptureLostTrackingWidget(CaptureLostState* capture_lost_state) : capture_lost_state_(capture_lost_state) {} + CaptureLostTrackingWidget(const CaptureLostTrackingWidget&) = delete; + CaptureLostTrackingWidget& operator=(const CaptureLostTrackingWidget&) = + delete; + // Widget: void OnMouseCaptureLost() override { capture_lost_state_->OnMouseCaptureLost(); @@ -1357,8 +1362,6 @@ private: // Weak. Stores whether OnMouseCaptureLost has been invoked for this widget. CaptureLostState* capture_lost_state_; - - DISALLOW_COPY_AND_ASSIGN(CaptureLostTrackingWidget); }; } // namespace @@ -1939,6 +1942,11 @@ public: WidgetInputMethodInteractiveTest() = default; + WidgetInputMethodInteractiveTest(const WidgetInputMethodInteractiveTest&) = + delete; + WidgetInputMethodInteractiveTest& operator=( + const WidgetInputMethodInteractiveTest&) = delete; + // testing::Test: void SetUp() override { DesktopWidgetTestInteractive::SetUp(); @@ -1959,8 +1967,6 @@ private: Widget* deactivate_widget_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(WidgetInputMethodInteractiveTest); }; #if defined(OS_MAC)
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc index 19af290..c90aa823 100644 --- a/ui/views/widget/widget_unittest.cc +++ b/ui/views/widget/widget_unittest.cc
@@ -1859,14 +1859,15 @@ public: MousePressEventConsumer() = default; + MousePressEventConsumer(const MousePressEventConsumer&) = delete; + MousePressEventConsumer& operator=(const MousePressEventConsumer&) = delete; + private: // ui::EventHandler: void OnMouseEvent(ui::MouseEvent* event) override { if (event->type() == ui::ET_MOUSE_PRESSED) event->SetHandled(); } - - DISALLOW_COPY_AND_ASSIGN(MousePressEventConsumer); }; } // namespace @@ -2010,6 +2011,9 @@ public: explicit ClosingEventObserver(Widget* widget) : widget_(widget) {} + ClosingEventObserver(const ClosingEventObserver&) = delete; + ClosingEventObserver& operator=(const ClosingEventObserver&) = delete; + // ui::EventObserver: void OnEvent(const ui::Event& event) override { // Guard against attempting to close the widget twice. @@ -2020,14 +2024,15 @@ private: Widget* widget_; - - DISALLOW_COPY_AND_ASSIGN(ClosingEventObserver); }; class ClosingView : public View { public: explicit ClosingView(Widget* widget) : widget_(widget) {} + ClosingView(const ClosingView&) = delete; + ClosingView& operator=(const ClosingView&) = delete; + // View: void OnEvent(ui::Event* event) override { // Guard against closing twice and writing to freed memory. @@ -2040,8 +2045,6 @@ private: Widget* widget_; - - DISALLOW_COPY_AND_ASSIGN(ClosingView); }; // Ensures that when multiple objects are intercepting OS-level events, that one @@ -3330,6 +3333,10 @@ public: WidgetChildDestructionTest() = default; + WidgetChildDestructionTest(const WidgetChildDestructionTest&) = delete; + WidgetChildDestructionTest& operator=(const WidgetChildDestructionTest&) = + delete; + // Creates a top level and a child, destroys the child and verifies the views // of the child are destroyed before the views of the parent. void RunDestroyChildWidgetsTest(bool top_level_has_desktop_native_widget_aura, @@ -3370,9 +3377,6 @@ EXPECT_EQ("child", destroyed[0]); EXPECT_EQ("parent", destroyed[1]); } - - private: - DISALLOW_COPY_AND_ASSIGN(WidgetChildDestructionTest); }; // See description of RunDestroyChildWidgetsTest(). Parent uses @@ -3834,6 +3838,9 @@ public: ScaleFactorView() = default; + ScaleFactorView(const ScaleFactorView&) = delete; + ScaleFactorView& operator=(const ScaleFactorView&) = delete; + // Overridden from ui::LayerDelegate: void OnDeviceScaleFactorChanged(float old_device_scale_factor, float new_device_scale_factor) override { @@ -3846,8 +3853,6 @@ private: float last_scale_factor_ = 0.f; - - DISALLOW_COPY_AND_ASSIGN(ScaleFactorView); }; } // namespace @@ -4023,12 +4028,12 @@ public: TestFocusRules() = default; + TestFocusRules(const TestFocusRules&) = delete; + TestFocusRules& operator=(const TestFocusRules&) = delete; + bool SupportsChildActivation(const aura::Window* window) const override { return true; } - - private: - DISALLOW_COPY_AND_ASSIGN(TestFocusRules); }; void InitControllers() {
diff --git a/ui/views/window/dialog_client_view_unittest.cc b/ui/views/window/dialog_client_view_unittest.cc index 0e76649..0624becf 100644 --- a/ui/views/window/dialog_client_view_unittest.cc +++ b/ui/views/window/dialog_client_view_unittest.cc
@@ -37,6 +37,9 @@ public: DialogClientViewTest() = default; + DialogClientViewTest(const DialogClientViewTest&) = delete; + DialogClientViewTest& operator=(const DialogClientViewTest&) = delete; + // testing::Test: void SetUp() override { WidgetTest::SetUp(); @@ -175,8 +178,6 @@ gfx::Size preferred_size_; gfx::Size min_size_; gfx::Size max_size_; - - DISALLOW_COPY_AND_ASSIGN(DialogClientViewTest); }; TEST_F(DialogClientViewTest, UpdateButtons) {
diff --git a/ui/views/window/window_button_order_provider.h b/ui/views/window/window_button_order_provider.h index a6c65a1e..4e9d8d7 100644 --- a/ui/views/window/window_button_order_provider.h +++ b/ui/views/window/window_button_order_provider.h
@@ -23,6 +23,10 @@ public: static WindowButtonOrderProvider* GetInstance(); + WindowButtonOrderProvider(const WindowButtonOrderProvider&) = delete; + WindowButtonOrderProvider& operator=(const WindowButtonOrderProvider&) = + delete; + const std::vector<views::FrameButton>& leading_buttons() const { return leading_buttons_; } @@ -47,8 +51,6 @@ // arrangement of a trailing minimize, maximize, close, will be set. std::vector<views::FrameButton> leading_buttons_; std::vector<views::FrameButton> trailing_buttons_; - - DISALLOW_COPY_AND_ASSIGN(WindowButtonOrderProvider); }; } // namespace views
diff --git a/ui/views_content_client/views_content_client_main_parts_aura.h b/ui/views_content_client/views_content_client_main_parts_aura.h index 62a1e8c..db16e24 100644 --- a/ui/views_content_client/views_content_client_main_parts_aura.h +++ b/ui/views_content_client/views_content_client_main_parts_aura.h
@@ -17,6 +17,12 @@ namespace ui { class ViewsContentClientMainPartsAura : public ViewsContentClientMainParts { + public: + ViewsContentClientMainPartsAura(const ViewsContentClientMainPartsAura&) = + delete; + ViewsContentClientMainPartsAura& operator=( + const ViewsContentClientMainPartsAura&) = delete; + protected: ViewsContentClientMainPartsAura( const content::MainFunctionParams& content_params, @@ -29,8 +35,6 @@ private: std::unique_ptr<::wm::WMState> wm_state_; - - DISALLOW_COPY_AND_ASSIGN(ViewsContentClientMainPartsAura); }; } // namespace ui
diff --git a/ui/web_dialogs/web_dialog_ui.h b/ui/web_dialogs/web_dialog_ui.h index c340581..a0be1e0 100644 --- a/ui/web_dialogs/web_dialog_ui.h +++ b/ui/web_dialogs/web_dialog_ui.h
@@ -31,6 +31,9 @@ WebDialogUIBase(content::WebUI* web_ui); + WebDialogUIBase(const WebDialogUIBase&) = delete; + WebDialogUIBase& operator=(const WebDialogUIBase&) = delete; + // Close the dialog, passing the specified arguments to the close handler. void CloseDialog(const base::ListValue* args); @@ -48,8 +51,6 @@ void OnDialogClosed(const base::ListValue* args); content::WebUI* web_ui_; - - DISALLOW_COPY_AND_ASSIGN(WebDialogUIBase); }; // Displays file URL contents inside a modal web dialog.
diff --git a/ui/webui/resources/cr_elements/shared_vars_css.html b/ui/webui/resources/cr_elements/shared_vars_css.html index b14a6a92..8673290 100644 --- a/ui/webui/resources/cr_elements/shared_vars_css.html +++ b/ui/webui/resources/cr_elements/shared_vars_css.html
@@ -39,6 +39,8 @@ --google-blue-refresh-100: rgb(var(--google-blue-refresh-100-rgb)); --google-blue-refresh-300-rgb: 138, 180, 248; /* #8ab4f8 */ --google-blue-refresh-300: rgb(var(--google-blue-refresh-300-rgb)); + --google-blue-refresh-400-rgb: 102, 157, 246; /* #669df6 */ + --google-blue-refresh-400: rgb(var(--google-blue-refresh-400-rgb)); --google-blue-refresh-500-rgb: 66, 133, 244; /* #4285f4 */ --google-blue-refresh-500: rgb(var(--google-blue-refresh-500-rgb)); --google-blue-refresh-700-rgb: 25, 103, 210; /* #1966d2 */ @@ -46,6 +48,10 @@ --google-green-refresh-300-rgb: 129, 201, 149; /* #81c995 */ --google-green-refresh-300: rgb(var(--google-green-refresh-300-rgb)); + --google-green-refresh-400-rgb: 91, 185, 116; /* #5bb974 */ + --google-green-refresh-400: rgb(var(--google-green-refresh-400-rgb)); + --google-green-refresh-500-rgb: 52, 168, 83; /* #34a853 */ + --google-green-refresh-500: rgb(var(--google-green-refresh-500-rgb)); --google-green-refresh-700-rgb: 24, 128, 56; /* #188038 */ --google-green-refresh-700: rgb(var(--google-green-refresh-700-rgb)); @@ -65,6 +71,10 @@ --google-yellow-refresh-300-rgb: 253, 214, 51; /* #fdd633 */ --google-yellow-refresh-300: rgb(var(--google-yellow-refresh-300-rgb)); + --google-yellow-refresh-400-rgb: 252, 201, 52; /* #fcc934 */ + --google-yellow-refresh-400: rgb(var(--google-yellow-refresh-400-rgb)); + --google-yellow-refresh-500-rgb: 251, 188, 4; /* #fbbc04 */ + --google-yellow-refresh-500: rgb(var(--google-yellow-refresh-500-rgb)); --cr-primary-text-color: var(--google-grey-900); --cr-secondary-text-color: var(--google-grey-refresh-700);
diff --git a/ui/wm/core/base_focus_rules.h b/ui/wm/core/base_focus_rules.h index 52caf7f2..5d13668 100644 --- a/ui/wm/core/base_focus_rules.h +++ b/ui/wm/core/base_focus_rules.h
@@ -14,6 +14,10 @@ // A set of basic focus and activation rules. Specializations should most likely // subclass this and call up to these methods rather than reimplementing them. class WM_CORE_EXPORT BaseFocusRules : public FocusRules { + public: + BaseFocusRules(const BaseFocusRules&) = delete; + BaseFocusRules& operator=(const BaseFocusRules&) = delete; + protected: BaseFocusRules(); ~BaseFocusRules() override; @@ -42,8 +46,6 @@ GetToplevelWindow(const_cast<const aura::Window*>(window))); } const aura::Window* GetActivatableWindow(const aura::Window* window) const; - - DISALLOW_COPY_AND_ASSIGN(BaseFocusRules); }; } // namespace wm
diff --git a/ui/wm/core/capture_controller.h b/ui/wm/core/capture_controller.h index 8166b8bc..7b5d98ee 100644 --- a/ui/wm/core/capture_controller.h +++ b/ui/wm/core/capture_controller.h
@@ -94,6 +94,10 @@ }; explicit ScopedCaptureClient(aura::Window* root); + + ScopedCaptureClient(const ScopedCaptureClient&) = delete; + ScopedCaptureClient& operator=(const ScopedCaptureClient&) = delete; + ~ScopedCaptureClient() override; // Overridden from aura::WindowObserver: @@ -105,8 +109,6 @@ // RootWindow this ScopedCaptureClient was create for. aura::Window* root_window_; - - DISALLOW_COPY_AND_ASSIGN(ScopedCaptureClient); }; } // namespace wm
diff --git a/ui/wm/core/capture_controller_unittest.cc b/ui/wm/core/capture_controller_unittest.cc index 4bceb69..586dbd46 100644 --- a/ui/wm/core/capture_controller_unittest.cc +++ b/ui/wm/core/capture_controller_unittest.cc
@@ -57,6 +57,9 @@ public: CaptureControllerTest() {} + CaptureControllerTest(const CaptureControllerTest&) = delete; + CaptureControllerTest& operator=(const CaptureControllerTest&) = delete; + void SetUp() override { AuraTestBase::SetUp(); capture_controller_ = std::make_unique<ScopedCaptureClient>(root_window()); @@ -106,8 +109,6 @@ std::unique_ptr<ScopedCaptureClient> capture_controller_; std::unique_ptr<aura::WindowTreeHost> second_host_; std::unique_ptr<ScopedCaptureClient> second_capture_controller_; - - DISALLOW_COPY_AND_ASSIGN(CaptureControllerTest); }; // Makes sure that internal details that are set on mouse down (such as @@ -206,6 +207,11 @@ public: GestureEventDeleteWindowOnScrollEnd() {} + GestureEventDeleteWindowOnScrollEnd( + const GestureEventDeleteWindowOnScrollEnd&) = delete; + GestureEventDeleteWindowOnScrollEnd& operator=( + const GestureEventDeleteWindowOnScrollEnd&) = delete; + void SetWindow(std::unique_ptr<aura::Window> window) { window_ = std::move(window); } @@ -221,7 +227,6 @@ private: std::unique_ptr<aura::Window> window_; - DISALLOW_COPY_AND_ASSIGN(GestureEventDeleteWindowOnScrollEnd); }; // Tests a scenario when a window gets deleted while a capture is being set on
diff --git a/ui/wm/core/cursor_manager.cc b/ui/wm/core/cursor_manager.cc index 94f24dd..7b44176 100644 --- a/ui/wm/core/cursor_manager.cc +++ b/ui/wm/core/cursor_manager.cc
@@ -30,6 +30,9 @@ mouse_events_enabled_(true), visible_on_mouse_events_enabled_(true) {} + CursorState(const CursorState&) = delete; + CursorState& operator=(const CursorState&) = delete; + gfx::NativeCursor cursor() const { return cursor_; } void set_cursor(gfx::NativeCursor cursor) { cursor_ = cursor; } @@ -68,8 +71,6 @@ // The visibility to set when mouse events are enabled. bool visible_on_mouse_events_enabled_; - - DISALLOW_COPY_AND_ASSIGN(CursorState); }; } // namespace internal
diff --git a/ui/wm/core/default_activation_client.cc b/ui/wm/core/default_activation_client.cc index 4f7615bf..c4eb476 100644 --- a/ui/wm/core/default_activation_client.cc +++ b/ui/wm/core/default_activation_client.cc
@@ -20,6 +20,9 @@ root_window_->AddObserver(this); } + Deleter(const Deleter&) = delete; + Deleter& operator=(const Deleter&) = delete; + private: ~Deleter() override {} @@ -33,8 +36,6 @@ DefaultActivationClient* client_; aura::Window* root_window_; - - DISALLOW_COPY_AND_ASSIGN(Deleter); }; ////////////////////////////////////////////////////////////////////////////////
diff --git a/ui/wm/core/default_activation_client.h b/ui/wm/core/default_activation_client.h index 1da55c21..26d9cb45 100644 --- a/ui/wm/core/default_activation_client.h +++ b/ui/wm/core/default_activation_client.h
@@ -28,6 +28,9 @@ public: explicit DefaultActivationClient(aura::Window* root_window); + DefaultActivationClient(const DefaultActivationClient&) = delete; + DefaultActivationClient& operator=(const DefaultActivationClient&) = delete; + // Overridden from ActivationClient: void AddObserver(ActivationChangeObserver* observer) override; void RemoveObserver(ActivationChangeObserver* observer) override; @@ -61,8 +64,6 @@ aura::Window* last_active_; base::ObserverList<ActivationChangeObserver>::Unchecked observers_; - - DISALLOW_COPY_AND_ASSIGN(DefaultActivationClient); }; } // namespace wm
diff --git a/ui/wm/core/focus_controller_unittest.cc b/ui/wm/core/focus_controller_unittest.cc index 73264191..2b12d52 100644 --- a/ui/wm/core/focus_controller_unittest.cc +++ b/ui/wm/core/focus_controller_unittest.cc
@@ -482,6 +482,9 @@ public: TestFocusRules() : focus_restriction_(nullptr) {} + TestFocusRules(const TestFocusRules&) = delete; + TestFocusRules& operator=(const TestFocusRules&) = delete; + // Restricts focus and activation to this window and its child hierarchy. void set_focus_restriction(aura::Window* focus_restriction) { focus_restriction_ = focus_restriction; @@ -527,12 +530,14 @@ } aura::Window* focus_restriction_; - - DISALLOW_COPY_AND_ASSIGN(TestFocusRules); }; // Common infrastructure shared by all FocusController test types. class FocusControllerTestBase : public aura::test::AuraTestBase { + public: + FocusControllerTestBase(const FocusControllerTestBase&) = delete; + FocusControllerTestBase& operator=(const FocusControllerTestBase&) = delete; + protected: FocusControllerTestBase() {} @@ -638,12 +643,15 @@ private: std::unique_ptr<FocusController> focus_controller_; TestFocusRules* test_focus_rules_; - - DISALLOW_COPY_AND_ASSIGN(FocusControllerTestBase); }; // Test base for tests where focus is directly set to a target window. class FocusControllerDirectTestBase : public FocusControllerTestBase { + public: + FocusControllerDirectTestBase(const FocusControllerDirectTestBase&) = delete; + FocusControllerDirectTestBase& operator=( + const FocusControllerDirectTestBase&) = delete; + protected: FocusControllerDirectTestBase() {} @@ -1192,9 +1200,6 @@ ""); } } - - private: - DISALLOW_COPY_AND_ASSIGN(FocusControllerDirectTestBase); }; // Focus and Activation changes via ActivationClient API. @@ -1202,6 +1207,9 @@ public: FocusControllerApiTest() {} + FocusControllerApiTest(const FocusControllerApiTest&) = delete; + FocusControllerApiTest& operator=(const FocusControllerApiTest&) = delete; + private: // Overridden from FocusControllerTestBase: void FocusWindowDirect(aura::Window* window) override { FocusWindow(window); } @@ -1217,8 +1225,6 @@ const override { return ActivationChangeObserver::ActivationReason::ACTIVATION_CLIENT; } - - DISALLOW_COPY_AND_ASSIGN(FocusControllerApiTest); }; // Focus and Activation changes via input events. @@ -1226,6 +1232,10 @@ public: FocusControllerMouseEventTest() {} + FocusControllerMouseEventTest(const FocusControllerMouseEventTest&) = delete; + FocusControllerMouseEventTest& operator=( + const FocusControllerMouseEventTest&) = delete; + // Tests that a handled mouse or gesture event does not trigger a window // activation. void IgnoreHandledEvent() { @@ -1266,8 +1276,6 @@ const override { return ActivationChangeObserver::ActivationReason::INPUT_EVENT; } - - DISALLOW_COPY_AND_ASSIGN(FocusControllerMouseEventTest); }; class FocusControllerMouseEnterEventTest @@ -1309,6 +1317,11 @@ public: FocusControllerGestureEventTest() {} + FocusControllerGestureEventTest(const FocusControllerGestureEventTest&) = + delete; + FocusControllerGestureEventTest& operator=( + const FocusControllerGestureEventTest&) = delete; + private: // Overridden from FocusControllerTestBase: void FocusWindowDirect(aura::Window* window) override { @@ -1330,14 +1343,18 @@ const override { return ActivationChangeObserver::ActivationReason::INPUT_EVENT; } - - DISALLOW_COPY_AND_ASSIGN(FocusControllerGestureEventTest); }; // Test base for tests where focus is implicitly set to a window as the result // of a disposition change to the focused window or the hierarchy that contains // it. class FocusControllerImplicitTestBase : public FocusControllerTestBase { + public: + FocusControllerImplicitTestBase(const FocusControllerImplicitTestBase&) = + delete; + FocusControllerImplicitTestBase& operator=( + const FocusControllerImplicitTestBase&) = delete; + protected: explicit FocusControllerImplicitTestBase(bool parent) : parent_(parent) {} @@ -1461,8 +1478,6 @@ // instead of to the window. This verifies that changes occurring in the // hierarchy that contains the window affect the window's focus. bool parent_; - - DISALLOW_COPY_AND_ASSIGN(FocusControllerImplicitTestBase); }; // Focus and Activation changes in response to window visibility changes. @@ -1470,6 +1485,9 @@ public: FocusControllerHideTest() : FocusControllerImplicitTestBase(false) {} + FocusControllerHideTest(const FocusControllerHideTest&) = delete; + FocusControllerHideTest& operator=(const FocusControllerHideTest&) = delete; + protected: FocusControllerHideTest(bool parent) : FocusControllerImplicitTestBase(parent) {} @@ -1478,9 +1496,6 @@ void ChangeWindowDisposition(aura::Window* window) override { GetDispositionWindow(window)->Hide(); } - - private: - DISALLOW_COPY_AND_ASSIGN(FocusControllerHideTest); }; // Focus and Activation changes in response to window parent visibility @@ -1489,6 +1504,10 @@ public: FocusControllerParentHideTest() : FocusControllerHideTest(true) {} + FocusControllerParentHideTest(const FocusControllerParentHideTest&) = delete; + FocusControllerParentHideTest& operator=( + const FocusControllerParentHideTest&) = delete; + // The parent window's visibility change should not change its transient child // window's modality property. void TransientChildWindowActivationTest() { @@ -1508,9 +1527,6 @@ EXPECT_EQ(ui::MODAL_TYPE_NONE, w1->GetProperty(aura::client::kModalKey)); EXPECT_EQ(ui::MODAL_TYPE_WINDOW, w11->GetProperty(aura::client::kModalKey)); } - - private: - DISALLOW_COPY_AND_ASSIGN(FocusControllerParentHideTest); }; // Focus and Activation changes in response to window destruction. @@ -1518,6 +1534,11 @@ public: FocusControllerDestructionTest() : FocusControllerImplicitTestBase(false) {} + FocusControllerDestructionTest(const FocusControllerDestructionTest&) = + delete; + FocusControllerDestructionTest& operator=( + const FocusControllerDestructionTest&) = delete; + protected: FocusControllerDestructionTest(bool parent) : FocusControllerImplicitTestBase(parent) {} @@ -1526,9 +1547,6 @@ void ChangeWindowDisposition(aura::Window* window) override { delete GetDispositionWindow(window); } - - private: - DISALLOW_COPY_AND_ASSIGN(FocusControllerDestructionTest); }; // Focus and Activation changes in response to window parent destruction. @@ -1538,8 +1556,10 @@ FocusControllerParentDestructionTest() : FocusControllerDestructionTest(true) {} - private: - DISALLOW_COPY_AND_ASSIGN(FocusControllerParentDestructionTest); + FocusControllerParentDestructionTest( + const FocusControllerParentDestructionTest&) = delete; + FocusControllerParentDestructionTest& operator=( + const FocusControllerParentDestructionTest&) = delete; }; // Focus and Activation changes in response to window removal. @@ -1547,6 +1567,10 @@ public: FocusControllerRemovalTest() : FocusControllerImplicitTestBase(false) {} + FocusControllerRemovalTest(const FocusControllerRemovalTest&) = delete; + FocusControllerRemovalTest& operator=(const FocusControllerRemovalTest&) = + delete; + protected: FocusControllerRemovalTest(bool parent) : FocusControllerImplicitTestBase(parent) {} @@ -1564,8 +1588,6 @@ private: std::unique_ptr<aura::Window> window_owner_; - - DISALLOW_COPY_AND_ASSIGN(FocusControllerRemovalTest); }; // Focus and Activation changes in response to window parent removal. @@ -1573,8 +1595,10 @@ public: FocusControllerParentRemovalTest() : FocusControllerRemovalTest(true) {} - private: - DISALLOW_COPY_AND_ASSIGN(FocusControllerParentRemovalTest); + FocusControllerParentRemovalTest(const FocusControllerParentRemovalTest&) = + delete; + FocusControllerParentRemovalTest& operator=( + const FocusControllerParentRemovalTest&) = delete; }; #define FOCUS_CONTROLLER_TEST(TESTCLASS, TESTNAME) \
diff --git a/ui/wm/core/shadow_controller.cc b/ui/wm/core/shadow_controller.cc index 591abd7a..9c281f1 100644 --- a/ui/wm/core/shadow_controller.cc +++ b/ui/wm/core/shadow_controller.cc
@@ -75,6 +75,9 @@ // Returns the singleton instance for the specified Env. static Impl* GetInstance(aura::Env* env); + Impl(const Impl&) = delete; + Impl& operator=(const Impl&) = delete; + void set_delegate(std::unique_ptr<ShadowControllerDelegate> delegate) { delegate_ = std::move(delegate); } @@ -132,8 +135,6 @@ observation_manager_{this}; std::unique_ptr<ShadowControllerDelegate> delegate_; - - DISALLOW_COPY_AND_ASSIGN(Impl); }; // static
diff --git a/ui/wm/core/transient_window_manager_unittest.cc b/ui/wm/core/transient_window_manager_unittest.cc index 3d53f251..e56deb5 100644 --- a/ui/wm/core/transient_window_manager_unittest.cc +++ b/ui/wm/core/transient_window_manager_unittest.cc
@@ -376,6 +376,10 @@ : name_(name), results_(results) {} + DestroyedTrackingDelegate(const DestroyedTrackingDelegate&) = delete; + DestroyedTrackingDelegate& operator=(const DestroyedTrackingDelegate&) = + delete; + void OnWindowDestroyed(aura::Window* window) override { results_->push_back(name_); } @@ -383,8 +387,6 @@ private: const std::string name_; std::vector<std::string>* results_; - - DISALLOW_COPY_AND_ASSIGN(DestroyedTrackingDelegate); }; } // namespace
diff --git a/ui/wm/core/window_animations_unittest.cc b/ui/wm/core/window_animations_unittest.cc index 97ea0e1..61e497d 100644 --- a/ui/wm/core/window_animations_unittest.cc +++ b/ui/wm/core/window_animations_unittest.cc
@@ -50,8 +50,8 @@ public: WindowAnimationsTest() {} - private: - DISALLOW_COPY_AND_ASSIGN(WindowAnimationsTest); + WindowAnimationsTest(const WindowAnimationsTest&) = delete; + WindowAnimationsTest& operator=(const WindowAnimationsTest&) = delete; }; TEST_F(WindowAnimationsTest, LayerTargetVisibility) {
diff --git a/ui/wm/test/run_all_unittests.cc b/ui/wm/test/run_all_unittests.cc index 5d3bb4e..dae2928 100644 --- a/ui/wm/test/run_all_unittests.cc +++ b/ui/wm/test/run_all_unittests.cc
@@ -22,6 +22,9 @@ public: WMTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} + WMTestSuite(const WMTestSuite&) = delete; + WMTestSuite& operator=(const WMTestSuite&) = delete; + protected: void Initialize() override { base::TestSuite::Initialize(); @@ -47,7 +50,6 @@ private: std::unique_ptr<aura::Env> env_; base::TestDiscardableMemoryAllocator discardable_memory_allocator_; - DISALLOW_COPY_AND_ASSIGN(WMTestSuite); }; int main(int argc, char** argv) {
diff --git a/ui/wm/test/testing_cursor_client_observer.h b/ui/wm/test/testing_cursor_client_observer.h index 7b669e8..40764fa 100644 --- a/ui/wm/test/testing_cursor_client_observer.h +++ b/ui/wm/test/testing_cursor_client_observer.h
@@ -15,6 +15,11 @@ class TestingCursorClientObserver : public aura::client::CursorClientObserver { public: TestingCursorClientObserver(); + + TestingCursorClientObserver(const TestingCursorClientObserver&) = delete; + TestingCursorClientObserver& operator=(const TestingCursorClientObserver&) = + delete; + void reset(); bool is_cursor_visible() const { return cursor_visibility_; } @@ -31,8 +36,6 @@ bool did_visibility_change_; ui::CursorSize cursor_size_; bool did_cursor_size_change_; - - DISALLOW_COPY_AND_ASSIGN(TestingCursorClientObserver); }; } // namespace wm
diff --git a/url/url_util.cc b/url/url_util.cc index 42bb76c..0500f4e7 100644 --- a/url/url_util.cc +++ b/url/url_util.cc
@@ -217,6 +217,13 @@ CharsetConverter* charset_converter, CanonOutput* output, Parsed* output_parsed) { + // Trim leading C0 control characters and spaces. + int begin = 0; + TrimURL(spec, &begin, &spec_len); + DCHECK(0 <= begin && begin <= spec_len); + spec += begin; + spec_len -= begin; + output->ReserveSizeIfNeeded(spec_len); // Remove any whitespace from the middle of the relative URL if necessary.
diff --git a/url/url_util_unittest.cc b/url/url_util_unittest.cc index 00a2053..50537de 100644 --- a/url/url_util_unittest.cc +++ b/url/url_util_unittest.cc
@@ -5,7 +5,10 @@ #include <stddef.h> #include "base/cxx17_backports.h" +#include "base/strings/string_piece.h" +#include "testing/gtest/include/gtest/gtest-message.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "url/third_party/mozilla/url_parse.h" #include "url/url_canon.h" #include "url/url_canon_stdstring.h" @@ -535,4 +538,52 @@ } } +namespace { +absl::optional<std::string> CanonicalizeSpec(base::StringPiece spec, + bool trim_path_end) { + std::string canonicalized; + StdStringCanonOutput output(&canonicalized); + Parsed parsed; + if (!Canonicalize(spec.data(), spec.size(), trim_path_end, + /*charset_converter=*/nullptr, &output, &parsed)) { + return {}; + } + output.Complete(); // Must be called before string is used. + return canonicalized; +} +} // namespace + +#ifdef OS_WIN +// Regression test for https://crbug.com/1252658. +TEST_F(URLUtilTest, TestCanonicalizeWindowsPathWithLeadingNUL) { + auto PrefixWithNUL = [](std::string&& s) -> std::string { return '\0' + s; }; + EXPECT_EQ(CanonicalizeSpec(PrefixWithNUL("w:"), /*trim_path_end=*/false), + absl::make_optional("file:///W:")); + EXPECT_EQ(CanonicalizeSpec(PrefixWithNUL("\\\\server\\share"), + /*trim_path_end=*/false), + absl::make_optional("file://server/share")); +} +#endif + +TEST_F(URLUtilTest, TestCanonicalizeIdempotencyWithLeadingControlCharacters) { + std::string spec = "_w:"; + // Loop over all C0 control characters and the space character. + for (char c = '\0'; c <= ' '; c++) { + SCOPED_TRACE(testing::Message() << "c: " << c); + + // Overwrite the first character of `spec` with a C0 control character. Note + // that replacing the first character with NUL will change the length! + spec[0] = c; + + for (bool trim_path_end : {false, true}) { + SCOPED_TRACE(testing::Message() << "trim_path_end: " << trim_path_end); + + absl::optional<std::string> canonicalized = + CanonicalizeSpec(spec, trim_path_end); + ASSERT_TRUE(canonicalized); + EXPECT_EQ(canonicalized, CanonicalizeSpec(*canonicalized, trim_path_end)); + } + } +} + } // namespace url