diff --git a/DEPS b/DEPS index c072f231..180d6ee 100644 --- a/DEPS +++ b/DEPS
@@ -300,7 +300,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': 'fd2d32a6282569004008fd9d1633c2dc48b0dac4', + 'skia_revision': '24bebce2d9a1735f8454a65b0ab11df0966b2893', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -308,11 +308,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': '7e82111481aed32c26bfa84c80ca38b9ffe2c9e8', + 'angle_revision': '6f959e07eaef58e231556c3348295484497f6aa2', # 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': 'a62e8dbc3467471953e0d81192b3ef94e5d40549', + 'swiftshader_revision': '28718d8b4108d69d239542ab58f1a3e40c97fbb2', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. @@ -371,7 +371,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': '730ebc3ef2f306b4c6b5aa08771aee7da9d29f93', + 'catapult_revision': '24f1d14730fb61fefd8ee5c12d09c2c811c0c54b', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling CrossBench # and whatever else without interference from each other. @@ -427,7 +427,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': '074ddbc10f503bb621459de9e647c804b5a2de19', + 'dawn_revision': '0aa34f27b2438d5888771a1fce133b42e9ef0fb3', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -803,7 +803,7 @@ 'src/clank': { 'url': Var('chrome_git') + '/clank/internal/apps.git' + '@' + - '761f59cca813520136f9eb680123235e26600f55', + '98b46e88d8c57dc46cf70a10b621f94c444811f6', 'condition': 'checkout_android and checkout_src_internal', }, @@ -812,7 +812,7 @@ }, 'src/ios/third_party/earl_grey2/src': { - 'url': Var('chromium_git') + '/external/github.com/google/EarlGrey.git' + '@' + '13ec07fbd9cba87f3c103dd0ea53c08af8b5f4c4', + 'url': Var('chromium_git') + '/external/github.com/google/EarlGrey.git' + '@' + '88ee16bd9915655a25bde242c41390cb428db4f8', 'condition': 'checkout_ios', }, @@ -832,7 +832,7 @@ }, 'src/ios/third_party/material_components_ios/src': { - 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '3f5a80e035fb9186dada8882915cb22a71faac16', + 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '0c637e0da8688956a3754e25f42378eaf523a367', 'condition': 'checkout_ios', }, @@ -992,7 +992,7 @@ 'packages': [ { 'package': 'chromium/third_party/androidx', - 'version': 'WSxa-08AqOZaGLllD6rcid2GJdSU7ZlzpyvpeiwJgr8C', + 'version': 'vv6gLGjLJt8gQ6SLVQS20u4Lm3OhOfUab6d6-cWG5KAC', }, ], 'condition': 'checkout_android', @@ -1227,13 +1227,13 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '42515353c9edfe0ef0b7318fe81b59a530ba3d3c', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '541638fd2318e0c03df51cd70b8ac6e9f7273fbb', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), 'src/third_party/devtools-frontend-internal': { - 'url': Var('chrome_git') + '/devtools/devtools-internal.git' + '@' + 'ee938f364b24b8ed6ec335deffc617253593812b', + 'url': Var('chrome_git') + '/devtools/devtools-internal.git' + '@' + '00bc059b66ca9cc921898189bb3761b5ed168410', 'condition': 'checkout_src_internal', }, @@ -1700,7 +1700,7 @@ Var('pdfium_git') + '/pdfium.git' + '@' + Var('pdfium_revision'), 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '287c9bfb7d7107806ee430453f2e8db09fe9ed8a', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'f18d5dceede0c5bc68675a4fbf964b467c919511', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1975,7 +1975,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': Var('chrome_git') + '/chrome/src-internal.git@e77bdeb901c402c9d1a8d784210caee582d22e56', + 'url': Var('chrome_git') + '/chrome/src-internal.git@e2884cc98ad66ed6dce799398d0a98f0f8d217db', 'condition': 'checkout_src_internal', }, @@ -4043,7 +4043,7 @@ # grepping. 'src/chrome/installer/mac/internal': { 'url': Var('chrome_git') + '/chrome/installer/mac/internal.git' + '@' + - 'bfca440a36e60367df7082099e6a0b8908685a16', + 'bbf0e77abbfb043d4122eb61353e9121cfd47602', 'condition': 'checkout_src_internal', }, @@ -4174,7 +4174,7 @@ 'src/ios_internal': { 'url': '{chrome_git}/chrome/ios_internal.git' + '@' + - '2e3f1b52155d0d2041583593d52072332a2c2c56', + 'aaa2cf2cd15e36f17cda40981de43f76ebc86e7d', 'condition': 'checkout_ios and checkout_src_internal', },
diff --git a/android_webview/nonembedded/component_updater/aw_component_updater_configurator.cc b/android_webview/nonembedded/component_updater/aw_component_updater_configurator.cc index 0bea723..b3ec6db 100644 --- a/android_webview/nonembedded/component_updater/aw_component_updater_configurator.cc +++ b/android_webview/nonembedded/component_updater/aw_component_updater_configurator.cc
@@ -92,7 +92,8 @@ } std::string AwComponentUpdaterConfigurator::GetChannel() const { - return version_info::GetChannelString(version_info::android::GetChannel()); + return std::string( + version_info::GetChannelString(version_info::android::GetChannel())); } std::string AwComponentUpdaterConfigurator::GetLang() const {
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index ef6be23..e4ff10d 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc
@@ -991,7 +991,7 @@ // Requires jelly-colors flag to also be enabled. BASE_FEATURE(kFirmwareUpdateJelly, "FirmwareUpdateJelly", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); // Enables first party Vietnamese input method. BASE_FEATURE(kFirstPartyVietnameseInput,
diff --git a/ash/constants/ash_pref_names.cc b/ash/constants/ash_pref_names.cc index ca8d0d4..d19f4b8 100644 --- a/ash/constants/ash_pref_names.cc +++ b/ash/constants/ash_pref_names.cc
@@ -1010,6 +1010,11 @@ // A boolean pref indicating whether the microphone is allowed to be used. const char kUserMicrophoneAllowed[] = "ash.user.microphone_allowed"; +// A boolean pref indicating whether a user has enabled the speak-on-mute +// detection. +const char kUserSpeakOnMuteDetectionEnabled[] = + "ash.user.speak_on_mute_detection_enabled"; + // A boolean pref indicating whether the geolocation is allowed for the user. const char kUserGeolocationAllowed[] = "ash.user.geolocation_allowed"; // An enum pref indicating whether the geolocation is allowed outside user @@ -1243,6 +1248,10 @@ // pair entry point. const char kUserPairedWithFastPair[] = "ash.user.paired_with_fast_pair"; +// A list pref that contains predefined automation configured by policy +// administrators. +const char kAppLaunchAutomation[] = "ash.app_launch_automation"; + // A boolean pref that controls whether the user is allowed to use the Desk // Templates feature - including creating Desks templates and using predefined // Desks templates.
diff --git a/ash/constants/ash_pref_names.h b/ash/constants/ash_pref_names.h index 97205814..f883b8c 100644 --- a/ash/constants/ash_pref_names.h +++ b/ash/constants/ash_pref_names.h
@@ -467,6 +467,8 @@ COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kUserCameraAllowed[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kUserMicrophoneAllowed[]; +COMPONENT_EXPORT(ASH_CONSTANTS) +extern const char kUserSpeakOnMuteDetectionEnabled[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kUserGeolocationAllowed[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kDeviceGeolocationAllowed[]; COMPONENT_EXPORT(ASH_CONSTANTS) @@ -569,6 +571,7 @@ COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kUserPairedWithFastPair[]; +COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kAppLaunchAutomation[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kDeskTemplatesEnabled[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kPreconfiguredDeskTemplates[];
diff --git a/ash/style/color_palette_controller_unittest.cc b/ash/style/color_palette_controller_unittest.cc index 3e3a097..e84bc15 100644 --- a/ash/style/color_palette_controller_unittest.cc +++ b/ash/style/color_palette_controller_unittest.cc
@@ -332,7 +332,7 @@ results, testing::UnorderedElementsAre( Sample(ColorScheme::kTonalSpot, SkColorSetRGB(0xff, 0xb3, 0xae)), - Sample(ColorScheme::kExpressive, SkColorSetRGB(0xa0, 0xd4, 0x8f)))); + Sample(ColorScheme::kExpressive, SkColorSetRGB(0xc8, 0xbf, 0xff)))); } TEST_F(ColorPaletteControllerTest, GenerateSampleScheme_AllValues_Teal) {
diff --git a/ash/style/system_dialog_delegate_view.cc b/ash/style/system_dialog_delegate_view.cc index b2357aaa..16bc87ed 100644 --- a/ash/style/system_dialog_delegate_view.cc +++ b/ash/style/system_dialog_delegate_view.cc
@@ -27,7 +27,6 @@ #include "ui/views/layout/flex_layout.h" #include "ui/views/layout/flex_layout_types.h" #include "ui/views/layout/flex_layout_view.h" -#include "ui/views/layout/layout_types.h" #include "ui/views/view_class_properties.h" namespace ash { @@ -240,6 +239,16 @@ button_container_->SetCancelText(cancel_text); } +void SystemDialogDelegateView::SetAdditionalContentCrossAxisAlignment( + views::LayoutAlignment alignment) { + DCHECK(additional_content_); + auto* cross_aligment = + additional_content_->GetProperty(views::kCrossAxisAlignmentKey); + if (!cross_aligment || *cross_aligment != alignment) { + additional_content_->SetProperty(views::kCrossAxisAlignmentKey, alignment); + } +} + gfx::Size SystemDialogDelegateView::GetMinimumSize() const { return kMinimumDialogSize; }
diff --git a/ash/style/system_dialog_delegate_view.h b/ash/style/system_dialog_delegate_view.h index 5c51117..141fc62f 100644 --- a/ash/style/system_dialog_delegate_view.h +++ b/ash/style/system_dialog_delegate_view.h
@@ -12,6 +12,7 @@ #include "base/functional/callback_forward.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/gfx/vector_icon_types.h" +#include "ui/views/layout/layout_types.h" #include "ui/views/metadata/view_factory.h" #include "ui/views/widget/widget_delegate.h" @@ -100,6 +101,10 @@ return raw_ptr; } + // Sets the cross axis alignment of current additional content which is center + // aligned by default. + void SetAdditionalContentCrossAxisAlignment(views::LayoutAlignment alignment); + // views::WidgetDelegateView: gfx::Size GetMinimumSize() const override; gfx::Size GetMaximumSize() const override; @@ -156,6 +161,8 @@ VIEW_BUILDER_PROPERTY(base::OnceClosure, CloseCallback) VIEW_BUILDER_VIEW_TYPE_PROPERTY(views::View, AdditionalContentView) VIEW_BUILDER_VIEW_TYPE_PROPERTY(views::View, AdditionalViewInButtonRow) +VIEW_BUILDER_PROPERTY(views::LayoutAlignment, + AdditionalContentCrossAxisAlignment) END_VIEW_BUILDER } // namespace ash
diff --git a/ash/system/privacy_hub/privacy_hub_controller.cc b/ash/system/privacy_hub/privacy_hub_controller.cc index 47404ac..3d94ef5b 100644 --- a/ash/system/privacy_hub/privacy_hub_controller.cc +++ b/ash/system/privacy_hub/privacy_hub_controller.cc
@@ -25,6 +25,7 @@ void PrivacyHubController::RegisterProfilePrefs(PrefRegistrySimple* registry) { registry->RegisterBooleanPref(prefs::kUserCameraAllowed, true); registry->RegisterBooleanPref(prefs::kUserMicrophoneAllowed, true); + registry->RegisterBooleanPref(prefs::kUserSpeakOnMuteDetectionEnabled, false); registry->RegisterBooleanPref(prefs::kUserGeolocationAllowed, true); }
diff --git a/ash/user_education/holding_space_tour/holding_space_tour_controller.cc b/ash/user_education/holding_space_tour/holding_space_tour_controller.cc index dd43041..6bce25d 100644 --- a/ash/user_education/holding_space_tour/holding_space_tour_controller.cc +++ b/ash/user_education/holding_space_tour/holding_space_tour_controller.cc
@@ -15,16 +15,20 @@ #include "ash/public/cpp/holding_space/holding_space_model.h" #include "ash/public/cpp/holding_space/holding_space_util.h" #include "ash/public/cpp/wallpaper/wallpaper_controller.h" +#include "ash/root_window_controller.h" #include "ash/shelf/shelf.h" #include "ash/shell.h" #include "ash/system/holding_space/holding_space_tray.h" #include "ash/system/status_area_widget.h" #include "ash/user_education/user_education_types.h" #include "ash/wallpaper/wallpaper_drag_drop_delegate.h" +#include "ash/wallpaper/wallpaper_view.h" +#include "ash/wallpaper/wallpaper_widget_controller.h" #include "base/check_op.h" #include "base/containers/cxx20_erase_vector.h" #include "base/files/file_path.h" #include "base/pickle.h" +#include "base/scoped_observation.h" #include "components/user_education/common/tutorial_description.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/aura/client/drag_drop_client.h" @@ -32,8 +36,14 @@ #include "ui/base/clipboard/custom_data_helper.h" #include "ui/base/dragdrop/drop_target_event.h" #include "ui/base/dragdrop/mojom/drag_drop_types.mojom.h" +#include "ui/chromeos/styles/cros_tokens_color_mappings.h" +#include "ui/color/color_provider.h" +#include "ui/compositor/layer.h" +#include "ui/compositor/layer_owner.h" #include "ui/display/display.h" #include "ui/display/screen.h" +#include "ui/views/view.h" +#include "ui/views/view_observer.h" #include "ui/wm/core/coordinate_conversion.h" namespace ash { @@ -90,6 +100,73 @@ GetDisplayNearestPoint(location_in_screen).id())); } +WallpaperView* GetWallpaperViewNearestPoint( + const gfx::Point& location_in_screen) { + return RootWindowController::ForWindow( + GetRootWindowForDisplayId( + GetDisplayNearestPoint(location_in_screen).id())) + ->wallpaper_widget_controller() + ->wallpaper_view(); +} + +// Highlight ------------------------------------------------------------------- + +// A class which adds a highlight layer to the region above the associated +// `view`. On destruction, the highlight layer is automatically removed from +// the associated `view`. It is not required for the associated `view` to +// outlive its highlight. +class Highlight : public ui::LayerOwner, public views::ViewObserver { + public: + explicit Highlight(views::View* view) + : ui::LayerOwner(std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR)) { + // The associated `view` must have a layer to support layer regions. + CHECK(view->layer()); + + // Name the highlight layer so it is easy to identify in debugging/testing. + layer()->SetName(HoldingSpaceTourController::kHighlightLayerName); + + // Initialize highlight layer properties. + layer()->SetFillsBoundsOpaquely(false); + OnViewThemeChanged(view); + OnViewBoundsChanged(view); + + // Add the highlight layer to the region above `view` layers so that it is + // always shown on top of the `view`. + view->AddLayerToRegion(layer(), views::LayerRegion::kAbove); + + // Observe the `view` to keep the highlight layer in sync. + view_observation_.Observe(view); + } + + Highlight(const Highlight&) = delete; + Highlight& operator=(const Highlight&) = delete; + ~Highlight() override = default; + + private: + // views::ViewObserver: + void OnViewBoundsChanged(views::View* view) override { + // Match the highlight layer bounds to the associated `view`. Note that + // because the highlight layer was added to the region above `view` layers, + // the highlight layer and `view` layer are siblings and so share the same + // coordinate system. + layer()->SetBounds(view->layer()->bounds()); + } + + void OnViewIsDeleting(views::View* view) override { + view_observation_.Reset(); + } + + void OnViewThemeChanged(views::View* view) override { + layer()->SetColor(SkColorSetA( + view->GetColorProvider()->GetColor(cros_tokens::kCrosSysPrimaryLight), + 0.4f * SK_AlphaOPAQUE)); + } + + // Observe the associated view in order to keep the highlight layer in sync. + base::ScopedObservation<views::View, views::ViewObserver> view_observation_{ + this}; +}; + // DragDropDelegate ------------------------------------------------------------ // An implementation of the singleton drag-and-drop delegate, owned by the @@ -117,6 +194,12 @@ void OnDragEntered(const ui::OSExchangeData& data, const gfx::Point& location_in_screen) override { + // Highlight the wallpaper when `data` is dragged over it so that the user + // better understands the wallpaper is a drop target. + CHECK(!wallpaper_highlight_); + wallpaper_highlight_ = std::make_unique<Highlight>( + GetWallpaperViewNearestPoint(location_in_screen)); + // If the `drag_drop_observer_` already exists, we are already observing the // current drag-and-drop sequence and can no-op here. if (drag_drop_observer_) { @@ -147,14 +230,29 @@ : ui::DragDropTypes::DragOperation::DRAG_NONE; } + void OnDragExited() override { + // When `data` is dragged out of the wallpaper, remove the highlight which + // was used to indicate the wallpaper was a drop target. + CHECK(wallpaper_highlight_); + wallpaper_highlight_.reset(); + } + ui::mojom::DragOperation OnDrop( const ui::OSExchangeData& data, const gfx::Point& location_in_screen) override { + // When `data` is dropped on the wallpaper, remove the highlight which was + // used to indicate the wallpaper was a drop target. + CHECK(wallpaper_highlight_); + wallpaper_highlight_.reset(); + + // No-op if no holding space `client` is registered since we will be unable + // to handle the dropped `data`. HoldingSpaceClient* const client = HoldingSpaceController::Get()->client(); if (!client) { return ui::mojom::DragOperation::kNone; } + // No-op if the dropped `data` does not contain any unpinned files. const std::vector<base::FilePath> unpinned_file_paths = ExtractUnpinnedFilePaths(data); if (unpinned_file_paths.empty()) { @@ -250,6 +348,10 @@ // while an observed drag-and-drop sequence is in progress. std::unique_ptr<HoldingSpaceController::ScopedForceShowInShelf> force_holding_space_show_in_shelf_; + + // Used to highlight the wallpaper when data is dragged over it so that the + // user better understands the wallpaper is a drop target. + std::unique_ptr<Highlight> wallpaper_highlight_; }; } // namespace
diff --git a/ash/user_education/holding_space_tour/holding_space_tour_controller.h b/ash/user_education/holding_space_tour/holding_space_tour_controller.h index 244b7a2..b757611 100644 --- a/ash/user_education/holding_space_tour/holding_space_tour_controller.h +++ b/ash/user_education/holding_space_tour/holding_space_tour_controller.h
@@ -19,6 +19,10 @@ class ASH_EXPORT HoldingSpaceTourController : public UserEducationFeatureController { public: + // Names for layers so they are easy to distinguish in debugging/testing. + static constexpr char kHighlightLayerName[] = + "HoldingSpaceTourController::Highlight"; + HoldingSpaceTourController(); HoldingSpaceTourController(const HoldingSpaceTourController&) = delete; HoldingSpaceTourController& operator=(const HoldingSpaceTourController&) =
diff --git a/ash/user_education/holding_space_tour/holding_space_tour_controller_unittest.cc b/ash/user_education/holding_space_tour/holding_space_tour_controller_unittest.cc index 5ee5c91..0347fca 100644 --- a/ash/user_education/holding_space_tour/holding_space_tour_controller_unittest.cc +++ b/ash/user_education/holding_space_tour/holding_space_tour_controller_unittest.cc
@@ -21,6 +21,7 @@ #include "ash/public/cpp/holding_space/mock_holding_space_client.h" #include "ash/public/cpp/shelf_types.h" #include "ash/public/cpp/test/shell_test_api.h" +#include "ash/root_window_controller.h" #include "ash/session/session_controller_impl.h" #include "ash/shelf/shelf.h" #include "ash/shell.h" @@ -29,6 +30,8 @@ #include "ash/test/test_widget_builder.h" #include "ash/user_education/user_education_ash_test_base.h" #include "ash/user_education/user_education_types.h" +#include "ash/wallpaper/wallpaper_view.h" +#include "ash/wallpaper/wallpaper_widget_controller.h" #include "base/pickle.h" #include "base/strings/strcat.h" #include "base/test/bind.h" @@ -41,6 +44,8 @@ #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/dragdrop/os_exchange_data_provider.h" +#include "ui/chromeos/styles/cros_tokens_color_mappings.h" +#include "ui/compositor/layer.h" #include "ui/display/display.h" #include "ui/events/test/event_generator.h" #include "ui/views/view.h" @@ -72,6 +77,12 @@ return Shelf::ForWindow(GetRootWindowForDisplayId(display_id)); } +WallpaperView* GetWallpaperViewForDisplayId(int64_t display_id) { + return RootWindowController::ForWindow(GetRootWindowForDisplayId(display_id)) + ->wallpaper_widget_controller() + ->wallpaper_view(); +} + std::unique_ptr<HoldingSpaceImage> CreateHoldingSpaceImage( HoldingSpaceItem::Type type, const base::FilePath& file_path) { @@ -107,6 +118,38 @@ .BuildOwnsNativeWidget(); } +bool HasWallpaperHighlight(int64_t display_id) { + auto* const wallpaper_view = GetWallpaperViewForDisplayId(display_id); + + bool has_wallpaper_highlight = false; + bool below_wallpaper_view_layer = true; + + for (const auto* wallpaper_layer : wallpaper_view->GetLayersInOrder()) { + if (wallpaper_layer == wallpaper_view->layer()) { + below_wallpaper_view_layer = false; + continue; + } + + if (wallpaper_layer->name() != + HoldingSpaceTourController::kHighlightLayerName) { + continue; + } + + has_wallpaper_highlight = true; + + // Add failures if the highlight layer is not configured as expected. + EXPECT_FALSE(below_wallpaper_view_layer); + EXPECT_EQ(wallpaper_layer->type(), ui::LAYER_SOLID_COLOR); + EXPECT_EQ(wallpaper_layer->bounds(), wallpaper_view->layer()->bounds()); + EXPECT_EQ(wallpaper_layer->background_color(), + SkColorSetA(wallpaper_view->GetColorProvider()->GetColor( + cros_tokens::kCrosSysPrimaryLight), + 0.4f * SK_AlphaOPAQUE)); + } + + return has_wallpaper_highlight; +} + void FlushMessageLoop() { base::RunLoop run_loop; base::SequencedTaskRunner::GetCurrentDefault()->PostTask( @@ -331,6 +374,11 @@ EXPECT_EQ(secondary_tray->GetVisible(), drag_files_app_data()); EXPECT_FALSE(secondary_shelf->IsVisible()); + // Expect the wallpaper on the primary display to be highlighted if and only + // if Files app data was dragged. + EXPECT_EQ(HasWallpaperHighlight(primary_display_id), drag_files_app_data()); + EXPECT_FALSE(HasWallpaperHighlight(secondary_display_id)); + // Drag the data to a position just outside the `secondary_widget` so that the // cursor is over the wallpaper on the secondary display. MoveMouseTo(secondary_widget.get()); @@ -344,6 +392,11 @@ EXPECT_EQ(secondary_tray->GetVisible(), drag_files_app_data()); EXPECT_FALSE(primary_shelf->IsVisible()); + // Expect the wallpaper on the secondary display to be highlighted if and only + // if Files app data was dragged. + EXPECT_EQ(HasWallpaperHighlight(secondary_display_id), drag_files_app_data()); + EXPECT_FALSE(HasWallpaperHighlight(primary_display_id)); + // Conditionally cancel the drop depending on test parameterization. if (!complete_drop()) { PressAndReleaseKey(ui::VKEY_ESCAPE); @@ -379,6 +432,10 @@ EXPECT_EQ(primary_tray->GetVisible(), complete_drop_of_files_app_data); EXPECT_EQ(secondary_tray->GetVisible(), complete_drop_of_files_app_data); + // Expect no wallpaper to be highlighted. + EXPECT_FALSE(HasWallpaperHighlight(primary_display_id)); + EXPECT_FALSE(HasWallpaperHighlight(secondary_display_id)); + // If Files app data was dropped, the holding space bubble should be visible // on the secondary display. if (complete_drop_of_files_app_data) {
diff --git a/ash/webui/common/resources/network/apn_list.js b/ash/webui/common/resources/network/apn_list.js index f597e78..9605527 100644 --- a/ash/webui/common/resources/network/apn_list.js +++ b/ash/webui/common/resources/network/apn_list.js
@@ -135,8 +135,7 @@ return this.i18n('apnSettingsCustomApnsErrorMessage'); } - // TODO(b/162365553): Use real string when finalized. - return 'Can\'t connect to network.'; + return this.i18n('apnSettingsDatabaseApnsErrorMessage'); } /**
diff --git a/ash/webui/personalization_app/resources/js/ambient/ambient_preview_small_element.html b/ash/webui/personalization_app/resources/js/ambient/ambient_preview_small_element.html index bf997c10..9e7d6e8 100644 --- a/ash/webui/personalization_app/resources/js/ambient/ambient_preview_small_element.html +++ b/ash/webui/personalization_app/resources/js/ambient/ambient_preview_small_element.html
@@ -67,6 +67,7 @@ } #buttonContainer .spinner { + --paper-spinner-color: var(--cros-sys-primary, --cros-button-label-color-primary); height: 20px; width: 20px; }
diff --git a/ash/webui/personalization_app/search/search.mojom b/ash/webui/personalization_app/search/search.mojom index 04b8a38..f046a0fc 100644 --- a/ash/webui/personalization_app/search/search.mojom +++ b/ash/webui/personalization_app/search/search.mojom
@@ -23,6 +23,7 @@ kDarkModeSchedule = 401, kDarkModeTurnOff = 402, kDarkModeTurnOn = 403, + kDynamicColor = 404, kKeyboardBacklight = 500, };
diff --git a/ash/webui/personalization_app/search/search_tag_registry.cc b/ash/webui/personalization_app/search/search_tag_registry.cc index 7caf916..42d335d 100644 --- a/ash/webui/personalization_app/search/search_tag_registry.cc +++ b/ash/webui/personalization_app/search/search_tag_registry.cc
@@ -262,6 +262,27 @@ {&GetDarkModeOffSearchConcept(), !dark_mode_on}}; } +const SearchConcept& GetDynamicColorSearchConcept() { + static const base::NoDestructor<const SearchConcept> search_concept({ + .id = mojom::SearchConceptId::kDynamicColor, + .message_id = IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR, + .alternate_message_ids = + { + IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT1, + IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT2, + IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT3, + IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT4, + IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT5, + IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT6, + IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT7, + IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT8, + IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT9, + }, + .relative_url = "", + }); + return *search_concept; +} + const SearchConcept& GetKeyboardBacklightSearchConcept() { static const base::NoDestructor<const SearchConcept> search_concept({ .id = mojom::SearchConceptId::kKeyboardBacklight, @@ -330,6 +351,10 @@ updates[&GetKeyboardBacklightSearchConcept()] = true; } + if (::ash::features::IsPersonalizationJellyEnabled()) { + updates[&GetDynamicColorSearchConcept()] = true; + } + if (IsAmbientModeAllowed()) { updates[&GetAmbientSearchConcept()] = true; updates.merge(GetAmbientPrefChangedUpdates(
diff --git a/ash/webui/shortcut_customization_ui/resources/common/icons.html b/ash/webui/shortcut_customization_ui/resources/common/icons.html index 5ddb8da..b409537 100644 --- a/ash/webui/shortcut_customization_ui/resources/common/icons.html +++ b/ash/webui/shortcut_customization_ui/resources/common/icons.html
@@ -9,9 +9,9 @@ <g id="delete" width="20" height="20" viewBox="0 0 20 20"> <path d="M13 3V2H7V3H3V5H4V16C4 17.1 4.9 18 6 18H14C15.1 18 16 17.1 16 16V5H17V3H13ZM14 16H6V5H14V16Z"/> </g> - <g id="lock" width="12" height="16" viewBox="0 0 12 16" fill="none"> - <path d="M7.75 10.5C7.75 11.4665 6.9665 12.25 6 12.25C5.0335 12.25 4.25 11.4665 4.25 10.5C4.25 9.5335 5.0335 8.75 6 8.75C6.9665 8.75 7.75 9.5335 7.75 10.5Z" fill="#5F6368"/> - <path fill-rule="evenodd" clip-rule="evenodd" d="M10 5H9.5V3C9.5 1.34315 7.65685 0 6 0C4.34315 0 2.5 1.34315 2.5 3V5H2C0.895431 5 0 5.89543 0 7V14C0 15.1046 0.895431 16 2 16H10C11.1046 16 12 15.1046 12 14V7C12 5.89543 11.1046 5 10 5ZM8 3.5V5H4V3.5C4 3 4.5 1.5 6 1.5C7.5 1.5 8 3 8 3.5ZM2 7V14H10V7H2Z" fill="#5F6368"/> + <g id="lock" width="12" height="16" viewBox="0 0 12 16"> + <path d="M7.75 10.5C7.75 11.4665 6.9665 12.25 6 12.25C5.0335 12.25 4.25 11.4665 4.25 10.5C4.25 9.5335 5.0335 8.75 6 8.75C6.9665 8.75 7.75 9.5335 7.75 10.5Z"/> + <path fill-rule="evenodd" clip-rule="evenodd" d="M10 5H9.5V3C9.5 1.34315 7.65685 0 6 0C4.34315 0 2.5 1.34315 2.5 3V5H2C0.895431 5 0 5.89543 0 7V14C0 15.1046 0.895431 16 2 16H10C11.1046 16 12 15.1046 12 14V7C12 5.89543 11.1046 5 10 5ZM8 3.5V5H4V3.5C4 3 4.5 1.5 6 1.5C7.5 1.5 8 3 8 3.5ZM2 7V14H10V7H2Z"/> </g> <g id="edit" width="20" height="20" viewBox="0 0 20 20"> <path fill-rule="evenodd" clip-rule="evenodd" d="M15.41 1.935L14.06 0.585C13.28 -0.195 12.01 -0.195 11.23 0.585L8.4 3.405L0 11.815V15.995H4.18L15.41 4.765C16.2 3.985 16.2 2.715 15.41 1.935ZM2 13.995V12.635L9.82 4.815L11.23 6.225L3.41 14.055L2 13.995Z"/>
diff --git a/ash/webui/shortcut_customization_ui/resources/css/shortcut_customization_shared.css b/ash/webui/shortcut_customization_ui/resources/css/shortcut_customization_shared.css index 72abc96..1c25ff86 100644 --- a/ash/webui/shortcut_customization_ui/resources/css/shortcut_customization_shared.css +++ b/ash/webui/shortcut_customization_ui/resources/css/shortcut_customization_shared.css
@@ -15,6 +15,8 @@ --shortcuts-font-family-default: "Google Sans", Roboto, sans-serif; --shortcuts-font-size-default: 13px; + + --shortcuts-lock-icon-color: var(--cros-icon-color-secondary); } :host-context(body.jelly-enabled) {
diff --git a/ash/webui/shortcut_customization_ui/resources/js/accelerator_view.html b/ash/webui/shortcut_customization_ui/resources/js/accelerator_view.html index dbd36c9c..84bc06c 100644 --- a/ash/webui/shortcut_customization_ui/resources/js/accelerator_view.html +++ b/ash/webui/shortcut_customization_ui/resources/js/accelerator_view.html
@@ -32,6 +32,10 @@ iron-icon { --iron-icon-width: 16px; } + + iron-icon[icon='shortcut-customization:lock'] { + --iron-icon-fill-color: var(--shortcuts-lock-icon-color); + } </style> <div id="container" class="flex-row" tabindex$="[[getTabIndex()]]">
diff --git a/ash/webui/shortcut_customization_ui/resources/js/text_accelerator.html b/ash/webui/shortcut_customization_ui/resources/js/text_accelerator.html index 9ccd9eb..d0c26c613 100644 --- a/ash/webui/shortcut_customization_ui/resources/js/text_accelerator.html +++ b/ash/webui/shortcut_customization_ui/resources/js/text_accelerator.html
@@ -25,6 +25,10 @@ --iron-icon-height: 16px; --iron-icon-fill-color: var(--cros-text-color-secondary); } + + iron-icon[icon='shortcut-customization:lock'] { + --iron-icon-fill-color: var(--shortcuts-lock-icon-color); + } </style> <div class="container">
diff --git a/ash/wm/desks/cros_next_desk_icon_button.cc b/ash/wm/desks/cros_next_desk_icon_button.cc index 47db15e..9fd8b51 100644 --- a/ash/wm/desks/cros_next_desk_icon_button.cc +++ b/ash/wm/desks/cros_next_desk_icon_button.cc
@@ -160,7 +160,7 @@ IsPointOnButton(bar_view_->last_dragged_item_screen_location()))) { new_focus_color_id = ui::kColorAshFocusRing; } else if (state_ == State::kActive && paint_as_active_) { - new_focus_color_id = kColorAshCurrentDeskColor; + new_focus_color_id = cros_tokens::kCrosSysTertiary; } else { new_focus_color_id = absl::nullopt; }
diff --git a/ash/wm/desks/desk_bar_view_base.cc b/ash/wm/desks/desk_bar_view_base.cc index e4ce74b..54da7d5 100644 --- a/ash/wm/desks/desk_bar_view_base.cc +++ b/ash/wm/desks/desk_bar_view_base.cc
@@ -5,6 +5,7 @@ #include "ash/wm/desks/desk_bar_view_base.h" #include "ash/keyboard/ui/keyboard_ui_controller.h" +#include "ash/public/cpp/saved_desk_delegate.h" #include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/window_properties.h" #include "ash/resources/vector_icons/vector_icons.h" @@ -30,9 +31,11 @@ #include "chromeos/constants/chromeos_features.h" #include "ui/base/l10n/l10n_util.h" #include "ui/events/devices/device_data_manager.h" +#include "ui/events/event_observer.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/text_elider.h" #include "ui/views/background.h" +#include "ui/views/event_monitor.h" #include "ui/views/highlight_border.h" #include "ui/wm/core/window_animations.h" @@ -42,7 +45,7 @@ OverviewHighlightController* GetHighlightController() { auto* overview_controller = Shell::Get()->overview_controller(); - DCHECK(overview_controller->InOverviewSession()); + CHECK(overview_controller->InOverviewSession()); return overview_controller->overview_session()->highlight_controller(); } @@ -64,6 +67,11 @@ settings.SetTweenType(gfx::Tween::ACCEL_20_DECEL_60); } +gfx::Rect GetGestureEventScreenRect(const ui::Event& event) { + CHECK(event.IsGestureEvent()); + return event.AsGestureEvent()->details().bounding_box(); +} + } // namespace // ----------------------------------------------------------------------------- @@ -97,22 +105,13 @@ const gfx::Size zero_state_new_desk_button_size = zero_state_new_desk_button->GetPreferredSize(); - // The presenter is shutdown early in the overview destruction process to - // prevent calls to the model. Some animations on the desk bar may still - // call this function past shutdown start. In this case we just continue - // as if the saved desk UI should be hidden. - OverviewSession* session = bar_view_->overview_grid()->overview_session(); - const bool should_show_saved_desk_library = - saved_desk_util::IsSavedDesksEnabled() && session && - !session->is_shutting_down() && - session->saved_desk_presenter()->should_show_saved_desk_library(); auto* zero_state_library_button = bar_view_->zero_state_library_button(); const gfx::Size zero_state_library_button_size = - should_show_saved_desk_library + bar_view_->ShouldShowLibraryUi() ? zero_state_library_button->GetPreferredSize() : gfx::Size(); const int width_for_zero_state_library_button = - should_show_saved_desk_library + bar_view_->ShouldShowLibraryUi() ? zero_state_library_button_size.width() + kDeskBarZeroStateButtonSpacing : 0; @@ -144,7 +143,7 @@ kDeskBarZeroStateButtonSpacing, kDeskBarZeroStateY), zero_state_library_button_size)); - zero_state_library_button->SetVisible(should_show_saved_desk_library); + zero_state_library_button->SetVisible(bar_view_->ShouldShowLibraryUi()); } return; } @@ -253,21 +252,12 @@ const gfx::Size new_desk_button_size = new_desk_button->GetPreferredSize(); - // The presenter is shutdown early in the overview destruction process to - // prevent calls to the model. Some animations on the desk bar may still - // call this function past shutdown start. In this case we just continue - // as if the saved desk UI should be hidden. - OverviewSession* session = bar_view_->overview_grid()->overview_session(); - const bool should_show_saved_desk_library = - saved_desk_util::IsSavedDesksEnabled() && session && - !session->is_shutting_down() && - session->saved_desk_presenter()->should_show_saved_desk_library(); auto* library_button = bar_view_->library_button(); const gfx::Size library_button_size = - should_show_saved_desk_library ? library_button->GetPreferredSize() - : gfx::Size(); + bar_view_->ShouldShowLibraryUi() ? library_button->GetPreferredSize() + : gfx::Size(); const int width_for_library_button = - should_show_saved_desk_library + bar_view_->ShouldShowLibraryUi() ? library_button_size.width() + kDeskBarZeroStateButtonSpacing : 0; @@ -296,7 +286,7 @@ kDeskBarZeroStateButtonSpacing, kDeskBarZeroStateY), library_button_size)); - library_button->SetVisible(should_show_saved_desk_library); + library_button->SetVisible(bar_view_->ShouldShowLibraryUi()); } return; } @@ -401,6 +391,62 @@ int width_ = 0; }; +// ----------------------------------------------------------------------------- +// DeskBarHoverObserver: + +class DeskBarHoverObserver : public ui::EventObserver { + public: + DeskBarHoverObserver(DeskBarViewBase* owner, aura::Window* widget_window) + : owner_(owner), + event_monitor_(views::EventMonitor::CreateWindowMonitor( + this, + widget_window, + {ui::ET_MOUSE_PRESSED, ui::ET_MOUSE_DRAGGED, ui::ET_MOUSE_RELEASED, + ui::ET_MOUSE_MOVED, ui::ET_MOUSE_ENTERED, ui::ET_MOUSE_EXITED, + ui::ET_GESTURE_LONG_PRESS, ui::ET_GESTURE_LONG_TAP, + ui::ET_GESTURE_TAP, ui::ET_GESTURE_TAP_DOWN})) {} + + DeskBarHoverObserver(const DeskBarHoverObserver&) = delete; + DeskBarHoverObserver& operator=(const DeskBarHoverObserver&) = delete; + + ~DeskBarHoverObserver() override = default; + + // ui::EventObserver: + void OnEvent(const ui::Event& event) override { + switch (event.type()) { + case ui::ET_MOUSE_PRESSED: + case ui::ET_MOUSE_DRAGGED: + case ui::ET_MOUSE_RELEASED: + case ui::ET_MOUSE_MOVED: + case ui::ET_MOUSE_ENTERED: + case ui::ET_MOUSE_EXITED: + owner_->OnHoverStateMayHaveChanged(); + break; + + case ui::ET_GESTURE_LONG_PRESS: + case ui::ET_GESTURE_LONG_TAP: + owner_->OnGestureTap(GetGestureEventScreenRect(event), + /*is_long_gesture=*/true); + break; + + case ui::ET_GESTURE_TAP: + case ui::ET_GESTURE_TAP_DOWN: + owner_->OnGestureTap(GetGestureEventScreenRect(event), + /*is_long_gesture=*/false); + break; + + default: + NOTREACHED(); + break; + } + } + + private: + raw_ptr<DeskBarViewBase, ExperimentalAsh> owner_; + + std::unique_ptr<views::EventMonitor> event_monitor_; +}; + DeskBarViewBase::DeskBarViewBase(aura::Window* root, Type type) : type_(type), state_(GetPerferredState(type)), root_(root) { CHECK(root && root->IsRootWindow()); @@ -651,7 +697,7 @@ const gfx::Insets insets = (type_ == Type::kOverview) ? overview_grid_->GetGridInsets() : gfx::Insets::TLBR(0, 0, 0, 0); - DCHECK(insets.left() == insets.right()); + CHECK(insets.left() == insets.right()); const int horizontal_padding = std::max(kDeskBarScrollViewMinimumHorizontalPadding, insets.left()); left_scroll_button_->SetBounds( @@ -707,6 +753,9 @@ if (it != mini_views_.end()) { ScrollToShowViewIfNecessary(*it); } + + hover_observer_ = std::make_unique<DeskBarHoverObserver>( + this, GetWidget()->GetNativeWindow()); } bool DeskBarViewBase::IsZeroState() const { @@ -789,7 +838,7 @@ } void DeskBarViewBase::NudgeDeskName(int desk_index) { - DCHECK_LT(desk_index, static_cast<int>(mini_views_.size())); + CHECK_LT(desk_index, static_cast<int>(mini_views_.size())); auto* name_view = mini_views_[desk_index]->desk_name_view(); name_view->RequestFocus(); @@ -864,27 +913,25 @@ if (!saved_desk_util::IsSavedDesksEnabled()) { return; } - if (type_ != Type::kOverview) { - return; - } - const bool should_show_ui = overview_grid_->overview_session() - ->saved_desk_presenter() - ->should_show_saved_desk_library(); const bool is_zero_state = IsZeroState(); - zero_state_library_button_->SetVisible(should_show_ui && is_zero_state); - expanded_state_library_button_->SetVisible(should_show_ui && !is_zero_state); + zero_state_library_button_->SetVisible(ShouldShowLibraryUi() && + is_zero_state); + expanded_state_library_button_->SetVisible(ShouldShowLibraryUi() && + !is_zero_state); - // Removes the button from the tabbing order if it becomes invisible. - auto* highlight_controller = GetHighlightController(); - if (!zero_state_library_button_->GetVisible()) { - highlight_controller->OnViewDestroyingOrDisabling( - zero_state_library_button_); - } - if (!expanded_state_library_button_->GetVisible()) { - highlight_controller->OnViewDestroyingOrDisabling( - expanded_state_library_button_->GetInnerButton()); + if (type_ == Type::kOverview) { + // Removes the button from the tabbing order if it becomes invisible. + auto* highlight_controller = GetHighlightController(); + if (!zero_state_library_button_->GetVisible()) { + highlight_controller->OnViewDestroyingOrDisabling( + zero_state_library_button_); + } + if (!expanded_state_library_button_->GetVisible()) { + highlight_controller->OnViewDestroyingOrDisabling( + expanded_state_library_button_->GetInnerButton()); + } } const int begin_x = GetFirstMiniViewXOffset(); @@ -909,25 +956,18 @@ if (!saved_desk_util::IsSavedDesksEnabled()) { return; } - if (type_ != Type::kOverview) { - return; - } - - const bool should_show_ui = overview_grid_->overview_session() - ->saved_desk_presenter() - ->should_show_saved_desk_library(); library_button_label_->SetVisible( - should_show_ui && + ShouldShowLibraryUi() && (library_button_->state() == CrOSNextDeskIconButton::State::kActive)); // If the visibility of the library button doesn't change, return early. - if (library_button_->GetVisible() == should_show_ui) { + if (library_button_->GetVisible() == ShouldShowLibraryUi()) { return; } - library_button_->SetVisible(should_show_ui); - if (should_show_ui) { + library_button_->SetVisible(ShouldShowLibraryUi()); + if (ShouldShowLibraryUi()) { if (overview_grid_->IsShowingSavedDeskLibrary()) { library_button_->UpdateState(CrOSNextDeskIconButton::State::kActive); } else { @@ -949,6 +989,38 @@ begin_x - GetFirstMiniViewXOffset()); } +void DeskBarViewBase::OnHoverStateMayHaveChanged() { + for (auto* mini_view : mini_views_) { + mini_view->UpdateDeskButtonVisibility(); + } +} + +void DeskBarViewBase::OnGestureTap(const gfx::Rect& screen_rect, + bool is_long_gesture) { + for (auto* mini_view : mini_views_) { + mini_view->OnWidgetGestureTap(screen_rect, is_long_gesture); + } +} + +bool DeskBarViewBase::ShouldShowLibraryUi() { + // Only update visibility when needed. This will save a lot of repeated work. + if (library_ui_visibility_ == LibraryUiVisibility::kToBeChecked) { + if (!saved_desk_util::IsSavedDesksEnabled() || + Shell::Get()->tablet_mode_controller()->InTabletMode()) { + library_ui_visibility_ = LibraryUiVisibility::kHidden; + } else { + auto* desk_model = Shell::Get()->saved_desk_delegate()->GetDeskModel(); + CHECK(desk_model); + size_t saved_desk_count = desk_model->GetDeskTemplateEntryCount() + + desk_model->GetSaveAndRecallDeskEntryCount(); + library_ui_visibility_ = saved_desk_count ? LibraryUiVisibility::kVisible + : LibraryUiVisibility::kHidden; + } + } + + return library_ui_visibility_ == LibraryUiVisibility::kVisible; +} + void DeskBarViewBase::UpdateDeskIconButtonState( CrOSNextDeskIconButton* button, CrOSNextDeskIconButton::State target_state) { @@ -1128,7 +1200,7 @@ } } - DCHECK_LT(i, mini_views_size); + CHECK_LT(i, mini_views_size); if ((position - mini_view_bounds.x()) < mini_view_bounds.width() / 2) { adjusted_position = mini_view_bounds.x(); } else {
diff --git a/ash/wm/desks/desk_bar_view_base.h b/ash/wm/desks/desk_bar_view_base.h index b5bdbf0..fe633b4 100644 --- a/ash/wm/desks/desk_bar_view_base.h +++ b/ash/wm/desks/desk_bar_view_base.h
@@ -25,6 +25,8 @@ namespace ash { +class DeskBarHoverObserver; + // Base class for desk bar views, including desk bar view within overview and // desk bar view for the desk button. class ASH_EXPORT DeskBarViewBase : public views::View, @@ -40,6 +42,18 @@ kExpanded, }; + enum class LibraryUiVisibility { + // Library UI visibility is yet to checked or needs an update. The bar will + // check all prerequisites and the desk model. + kToBeChecked, + + // Library UI should be visible. + kVisible, + + // Library UI should be hidden. + kHidden, + }; + DeskBarViewBase(const DeskBarViewBase&) = delete; DeskBarViewBase& operator=(const DeskBarViewBase&) = delete; @@ -129,6 +143,10 @@ return library_button_label_; } + void set_library_ui_visibility(LibraryUiVisibility library_ui_visibility) { + library_ui_visibility_ = library_ui_visibility; + } + // views::View: const char* GetClassName() const override; void Layout() override; @@ -139,7 +157,7 @@ // bar was created. This should only be called after this view has been added // to a widget, as it needs to call `GetWidget()` when it's performing a // layout. - virtual void Init(); + void Init(); // Returns true if it is currently in zero state. bool IsZeroState() const; @@ -201,6 +219,15 @@ // this function, and rename this function by removing the prefix CrOSNext. void UpdateLibraryButtonVisibilityCrOSNext(); + // Updates the visibility state of the close buttons on all the mini_views as + // a result of mouse and gesture events. + void OnHoverStateMayHaveChanged(); + void OnGestureTap(const gfx::Rect& screen_rect, bool is_long_gesture); + + // Indicates if it should show the library UI in the bar. This will only query + // the desk model when needed. + bool ShouldShowLibraryUi(); + // Called to update state of `button` and apply the scale animation to the // button. For the new desk button, this is called when the make the new desk // button a drop target for the window being dragged or at the end of the @@ -232,6 +259,7 @@ protected: friend class DeskBarScrollViewLayout; + friend class DesksTestApi; DeskBarViewBase(aura::Window* root, Type type); ~DeskBarViewBase() override; @@ -299,6 +327,11 @@ // view. bool dragged_item_over_bar_ = false; + // This controls whether or not to show the library UI, e.g. the library + // button. + LibraryUiVisibility library_ui_visibility_ = + LibraryUiVisibility::kToBeChecked; + // The `OverviewGrid` that contains this object if this is a `Type::kOverview` // bar, nullptr otherwise. raw_ptr<OverviewGrid, ExperimentalAsh> overview_grid_ = nullptr; @@ -348,6 +381,10 @@ raw_ptr<ScrollArrowButton, ExperimentalAsh> left_scroll_button_ = nullptr; raw_ptr<ScrollArrowButton, ExperimentalAsh> right_scroll_button_ = nullptr; + // Observes mouse events on the desk bar widget and updates the states of the + // mini_views accordingly. + std::unique_ptr<DeskBarHoverObserver> hover_observer_; + // ScrollView callback subscriptions. base::CallbackListSubscription on_contents_scrolled_subscription_; base::CallbackListSubscription on_contents_scroll_ended_subscription_;
diff --git a/ash/wm/desks/desk_mini_view.cc b/ash/wm/desks/desk_mini_view.cc index 454bba7..685b1105 100644 --- a/ash/wm/desks/desk_mini_view.cc +++ b/ash/wm/desks/desk_mini_view.cc
@@ -31,6 +31,8 @@ #include "ui/accessibility/ax_node_data.h" #include "ui/aura/window.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/chromeos/styles/cros_tokens_color_mappings.h" +#include "ui/color/color_id.h" #include "ui/compositor/layer.h" #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/insets.h" @@ -240,7 +242,10 @@ new_focus_color_id = ui::kColorAshFocusRing; } else if (desk_->is_active() && owner_bar_->overview_grid() && !owner_bar_->overview_grid()->IsShowingSavedDeskLibrary()) { - new_focus_color_id = kColorAshCurrentDeskColor; + new_focus_color_id = + chromeos::features::IsJellyrollEnabled() + ? cros_tokens::kCrosSysTertiary + : static_cast<ui::ColorId>(kColorAshCurrentDeskColor); } else { new_focus_color_id = absl::nullopt; }
diff --git a/ash/wm/desks/desks_test_api.cc b/ash/wm/desks/desks_test_api.cc index ebc7972..770784a 100644 --- a/ash/wm/desks/desks_test_api.cc +++ b/ash/wm/desks/desks_test_api.cc
@@ -9,8 +9,12 @@ #include "ash/wm/desks/cros_next_desk_icon_button.h" #include "ash/wm/desks/desk.h" #include "ash/wm/desks/desk_action_context_menu.h" +#include "ash/wm/desks/desk_bar_controller.h" +#include "ash/wm/desks/desk_bar_view.h" +#include "ash/wm/desks/desk_bar_view_base.h" #include "ash/wm/desks/desk_mini_view.h" #include "ash/wm/desks/desk_preview_view.h" +#include "ash/wm/desks/desks_controller.h" #include "ash/wm/desks/desks_restore_util.h" #include "ash/wm/desks/expanded_desks_bar_button.h" #include "ash/wm/desks/legacy_desk_bar_view.h" @@ -24,40 +28,52 @@ namespace { -const LegacyDeskBarView* GetDesksBarView() { +const DeskBarViewBase* GetDeskBarView(DeskBarViewBase::Type type) { auto* root_window = Shell::GetPrimaryRootWindow(); - auto* overview_controller = Shell::Get()->overview_controller(); - DCHECK(overview_controller->InOverviewSession()); - return overview_controller->overview_session() - ->GetGridWithRootWindow(root_window) - ->desks_bar_view(); + if (type == DeskBarViewBase::Type::kOverview) { + auto* overview_controller = Shell::Get()->overview_controller(); + CHECK(overview_controller->InOverviewSession()); + return overview_controller->overview_session() + ->GetGridWithRootWindow(root_window) + ->desks_bar_view(); + } else { + auto* desk_bar_controller = DesksController::Get()->desk_bar_controller(); + CHECK(desk_bar_controller); + return desk_bar_controller->GetDeskBarView(root_window); + } } } // namespace // static -ScrollArrowButton* DesksTestApi::GetDesksBarLeftScrollButton() { - return GetDesksBarView()->left_scroll_button_; +ScrollArrowButton* DesksTestApi::GetDeskBarLeftScrollButton( + DeskBarViewBase::Type type) { + return GetDeskBarView(type)->left_scroll_button_; } // static -ScrollArrowButton* DesksTestApi::GetDesksBarRightScrollButton() { - return GetDesksBarView()->right_scroll_button_; +ScrollArrowButton* DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type type) { + return GetDeskBarView(type)->right_scroll_button_; } // static -views::ScrollView* DesksTestApi::GetDesksBarScrollView() { - return GetDesksBarView()->scroll_view_; +views::ScrollView* DesksTestApi::GetDeskBarScrollView( + DeskBarViewBase::Type type) { + return GetDeskBarView(type)->scroll_view_; } // static -const DeskMiniView* DesksTestApi::GetDesksBarDragView() { - return GetDesksBarView()->drag_view_; +const DeskMiniView* DesksTestApi::GetDeskBarDragView( + DeskBarViewBase::Type type) { + return GetDeskBarView(type)->drag_view_; } // static -DeskActionContextMenu* DesksTestApi::GetContextMenuForDesk(int index) { - return GetDesksBarView()->mini_views()[index]->context_menu_.get(); +DeskActionContextMenu* DesksTestApi::GetContextMenuForDesk( + DeskBarViewBase::Type type, + int index) { + return GetDeskBarView(type)->mini_views()[index]->context_menu_.get(); } // static @@ -68,13 +84,17 @@ } // static -const ui::SimpleMenuModel& DesksTestApi::GetContextMenuModelForDesk(int index) { - return GetContextMenuForDesk(index)->context_menu_model_; +const ui::SimpleMenuModel& DesksTestApi::GetContextMenuModelForDesk( + DeskBarViewBase::Type type, + int index) { + return GetContextMenuForDesk(type, index)->context_menu_model_; } // static -views::View* DesksTestApi::GetHighlightOverlayForDeskPreview(int index) { - return GetDesksBarView() +views::View* DesksTestApi::GetHighlightOverlayForDeskPreview( + DeskBarViewBase::Type type, + int index) { + return GetDeskBarView(type) ->mini_views()[index] ->desk_preview() ->highlight_overlay_; @@ -108,22 +128,23 @@ } // static -bool DesksTestApi::IsContextMenuRunningForDesk(int index) { - return GetContextMenuForDesk(index)->context_menu_runner_->IsRunning(); +bool DesksTestApi::IsContextMenuRunningForDesk(DeskBarViewBase::Type type, + int index) { + return GetContextMenuForDesk(type, index)->context_menu_runner_->IsRunning(); } // static -bool DesksTestApi::IsDesksBarLeftGradientVisible() { +bool DesksTestApi::IsDeskBarLeftGradientVisible(DeskBarViewBase::Type type) { const auto& gradient_mask = - GetDesksBarView()->scroll_view_->layer()->gradient_mask(); + GetDeskBarView(type)->scroll_view_->layer()->gradient_mask(); return !gradient_mask.IsEmpty() && cc::MathUtil::IsWithinEpsilon(gradient_mask.steps()[0].fraction, 0.f); } // static -bool DesksTestApi::IsDesksBarRightGradientVisible() { +bool DesksTestApi::IsDeskBarRightGradientVisible(DeskBarViewBase::Type type) { const auto& gradient_mask = - GetDesksBarView()->scroll_view_->layer()->gradient_mask(); + GetDeskBarView(type)->scroll_view_->layer()->gradient_mask(); return !gradient_mask.IsEmpty() && cc::MathUtil::IsWithinEpsilon( gradient_mask.steps()[gradient_mask.step_count() - 1].fraction,
diff --git a/ash/wm/desks/desks_test_api.h b/ash/wm/desks/desks_test_api.h index 5e0835d6..d09f171 100644 --- a/ash/wm/desks/desks_test_api.h +++ b/ash/wm/desks/desks_test_api.h
@@ -5,6 +5,7 @@ #ifndef ASH_WM_DESKS_DESKS_TEST_API_H_ #define ASH_WM_DESKS_DESKS_TEST_API_H_ +#include "ash/wm/desks/desk_bar_view_base.h" #include "base/time/clock.h" #include "third_party/skia/include/core/SkColor.h" @@ -39,24 +40,33 @@ DesksTestApi() = delete; // Getters for elements inside the desks. - static ScrollArrowButton* GetDesksBarLeftScrollButton(); - static ScrollArrowButton* GetDesksBarRightScrollButton(); - static views::ScrollView* GetDesksBarScrollView(); - static const DeskMiniView* GetDesksBarDragView(); - static DeskActionContextMenu* GetContextMenuForDesk(int index); + static ScrollArrowButton* GetDeskBarLeftScrollButton( + DeskBarViewBase::Type type); + static ScrollArrowButton* GetDeskBarRightScrollButton( + DeskBarViewBase::Type type); + static views::ScrollView* GetDeskBarScrollView(DeskBarViewBase::Type type); + static const DeskMiniView* GetDeskBarDragView(DeskBarViewBase::Type type); + static DeskActionContextMenu* GetContextMenuForDesk( + DeskBarViewBase::Type type, + int index); static views::LabelButton* GetCloseAllUndoToastDismissButton(); - static const ui::SimpleMenuModel& GetContextMenuModelForDesk(int index); - static views::View* GetHighlightOverlayForDeskPreview(int index); + static const ui::SimpleMenuModel& GetContextMenuModelForDesk( + DeskBarViewBase::Type type, + int index); + static views::View* GetHighlightOverlayForDeskPreview( + DeskBarViewBase::Type type, + int index); static ui::LayerTreeOwner* GetMirroredContentsLayerTreeForRootAndDesk( aura::Window* root, Desk* desk); static bool HasVerticalDotsButton(); static bool DesksControllerHasDesk(Desk* desk); static bool DesksControllerCanUndoDeskRemoval(); - static bool IsContextMenuRunningForDesk(int index); + static bool IsContextMenuRunningForDesk(DeskBarViewBase::Type type, + int index); - static bool IsDesksBarLeftGradientVisible(); - static bool IsDesksBarRightGradientVisible(); + static bool IsDeskBarLeftGradientVisible(DeskBarViewBase::Type type); + static bool IsDeskBarRightGradientVisible(DeskBarViewBase::Type type); // Resets `first_day_visited_` and `last_day_visited_` of `desk` for testing // to the current date.
diff --git a/ash/wm/desks/desks_unittests.cc b/ash/wm/desks/desks_unittests.cc index 740dcaa..072f317 100644 --- a/ash/wm/desks/desks_unittests.cc +++ b/ash/wm/desks/desks_unittests.cc
@@ -49,6 +49,7 @@ #include "ash/wm/desks/desk_action_view.h" #include "ash/wm/desks/desk_animation_base.h" #include "ash/wm/desks/desk_bar_controller.h" +#include "ash/wm/desks/desk_bar_view_base.h" #include "ash/wm/desks/desk_mini_view.h" #include "ash/wm/desks/desk_name_view.h" #include "ash/wm/desks/desk_preview_view.h" @@ -526,6 +527,18 @@ loop.Run(); } + void OpenDeskButtonDeskBar() { + auto* root = Shell::Get()->GetPrimaryRootWindow(); + auto* desk_bar_controller = DesksController::Get()->desk_bar_controller(); + desk_bar_controller->CreateDeskBar(root); + desk_bar_controller->ShowDeskBar(root); + } + + void CloseDeskButtonDeskBar() { + auto* desk_bar_controller = DesksController::Get()->desk_bar_controller(); + desk_bar_controller->DestroyAllDeskBars(); + } + private: base::test::ScopedFeatureList scoped_feature_list_; }; @@ -661,7 +674,8 @@ auto* new_desk_button = GetExpandedStateInnerNewDeskButton(desks_bar_view); EXPECT_TRUE(new_desk_button->GetEnabled()); - auto* scroll_right_button = DesksTestApi::GetDesksBarRightScrollButton(); + auto* scroll_right_button = DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview); // Click many times on the expanded new desk button and expect only the max // number of desks will be created, and the button is no longer enabled. @@ -829,7 +843,8 @@ auto* new_desk_button = GetExpandedStateInnerNewDeskButton(desks_bar_view); EXPECT_TRUE(new_desk_button->GetEnabled()); - auto* scroll_right_button = DesksTestApi::GetDesksBarRightScrollButton(); + auto* scroll_right_button = DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview); // Gesture tap multiple times on the new desk button until it's disabled, // and verify the button state. @@ -2224,7 +2239,8 @@ ASSERT_TRUE(desks_bar_view); auto* event_generator = GetEventGenerator(); - auto* scroll_right_button = DesksTestApi::GetDesksBarRightScrollButton(); + auto* scroll_right_button = DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview); for (int i = 0; i != 3; ++i) { ClickOnView(scroll_right_button, event_generator); } @@ -2452,7 +2468,8 @@ ASSERT_TRUE(desks_bar_view); const auto* new_desk_button = GetExpandedStateInnerNewDeskButton(desks_bar_view); - auto* scroll_right_button = DesksTestApi::GetDesksBarRightScrollButton(); + auto* scroll_right_button = DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview); // Tests that with one or two desks, the new desk button has an enabled state // and color. @@ -5549,7 +5566,8 @@ // As desks are added, we will scroll the desks bar to keep the "new desk" // button in view. - auto* scroll_right_button = DesksTestApi::GetDesksBarRightScrollButton(); + auto* scroll_right_button = DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview); // Click on the new desk button until the max number of desks is created. Each // time a new desk is created the new desk's name view should have focus, be @@ -5747,29 +5765,50 @@ // Left scroll button should be hidden and right scroll button should be // visible while at the start position. event_generator->MoveMouseWheel(x_scroll_delta, 0); - EXPECT_FALSE(DesksTestApi::GetDesksBarLeftScrollButton()->GetVisible()); - EXPECT_TRUE(DesksTestApi::GetDesksBarRightScrollButton()->GetVisible()); + EXPECT_FALSE( + DesksTestApi::GetDeskBarLeftScrollButton(DeskBarViewBase::Type::kOverview) + ->GetVisible()); + EXPECT_TRUE(DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview) + ->GetVisible()); // Click the right scroll button until it reaches to the right most of the // scroll view. Then verify the left scroll button is visible. - if (DesksTestApi::GetDesksBarRightScrollButton()->GetVisible()) - ClickOnView(DesksTestApi::GetDesksBarRightScrollButton(), event_generator); - EXPECT_TRUE(DesksTestApi::GetDesksBarLeftScrollButton()->GetVisible()); + if (DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview) + ->GetVisible()) { + ClickOnView(DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview), + event_generator); + } + EXPECT_TRUE( + DesksTestApi::GetDeskBarLeftScrollButton(DeskBarViewBase::Type::kOverview) + ->GetVisible()); // Click the left scroll button until it reaches to the right most of the // scroll view. In this case, it will scroll back to the start position and // left scroll button should be hidden and right scroll button should be // visible. - if (DesksTestApi::GetDesksBarLeftScrollButton()->GetVisible()) - ClickOnView(DesksTestApi::GetDesksBarLeftScrollButton(), event_generator); - EXPECT_TRUE(DesksTestApi::GetDesksBarRightScrollButton()->GetVisible()); + if (DesksTestApi::GetDeskBarLeftScrollButton(DeskBarViewBase::Type::kOverview) + ->GetVisible()) { + ClickOnView(DesksTestApi::GetDeskBarLeftScrollButton( + DeskBarViewBase::Type::kOverview), + event_generator); + } + EXPECT_TRUE(DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview) + ->GetVisible()); // Left scroll button should be visible and right scroll button should be // hidden while at the end position. event_generator->MoveMouseTo(desks_bar->GetBoundsInScreen().CenterPoint()); event_generator->MoveMouseWheel(-x_scroll_delta, 0); - EXPECT_TRUE(DesksTestApi::GetDesksBarLeftScrollButton()->GetVisible()); - EXPECT_FALSE(DesksTestApi::GetDesksBarRightScrollButton()->GetVisible()); + EXPECT_TRUE( + DesksTestApi::GetDeskBarLeftScrollButton(DeskBarViewBase::Type::kOverview) + ->GetVisible()); + EXPECT_FALSE(DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview) + ->GetVisible()); } TEST_P(DesksTest, GradientsVisibility) { @@ -5784,16 +5823,21 @@ auto* desks_bar = GetOverviewGridForRoot(Shell::GetPrimaryRootWindow())->desks_bar_view(); - auto* left_button = DesksTestApi::GetDesksBarLeftScrollButton(); - auto* right_button = DesksTestApi::GetDesksBarRightScrollButton(); + auto* left_button = DesksTestApi::GetDeskBarLeftScrollButton( + DeskBarViewBase::Type::kOverview); + auto* right_button = DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview); // Only right graident is visible while at the first page. - auto* scroll_view = DesksTestApi::GetDesksBarScrollView(); + auto* scroll_view = + DesksTestApi::GetDeskBarScrollView(DeskBarViewBase::Type::kOverview); EXPECT_EQ(0, scroll_view->GetVisibleRect().x()); EXPECT_FALSE(left_button->GetVisible()); - EXPECT_FALSE(DesksTestApi::IsDesksBarLeftGradientVisible()); + EXPECT_FALSE(DesksTestApi::IsDeskBarLeftGradientVisible( + DeskBarViewBase::Type::kOverview)); EXPECT_TRUE(right_button->GetVisible()); - EXPECT_TRUE(DesksTestApi::IsDesksBarRightGradientVisible()); + EXPECT_TRUE(DesksTestApi::IsDeskBarRightGradientVisible( + DeskBarViewBase::Type::kOverview)); // Both left and right gradients should be visible while during scroll. const gfx::Point center_point = desks_bar->bounds().CenterPoint(); @@ -5807,9 +5851,11 @@ scroll_view->OnGestureEvent(&scroll_update); EXPECT_TRUE(scroll_view->is_scrolling()); EXPECT_TRUE(left_button->GetVisible()); - EXPECT_TRUE(DesksTestApi::IsDesksBarLeftGradientVisible()); + EXPECT_TRUE(DesksTestApi::IsDeskBarLeftGradientVisible( + DeskBarViewBase::Type::kOverview)); EXPECT_TRUE(right_button->GetVisible()); - EXPECT_TRUE(DesksTestApi::IsDesksBarRightGradientVisible()); + EXPECT_TRUE(DesksTestApi::IsDeskBarRightGradientVisible( + DeskBarViewBase::Type::kOverview)); // The gradient should be hidden if the corresponding scroll button is // invisible even though it is during scroll. @@ -5820,9 +5866,11 @@ scroll_view->OnGestureEvent(&second_scroll_update); EXPECT_TRUE(scroll_view->is_scrolling()); EXPECT_FALSE(left_button->GetVisible()); - EXPECT_FALSE(DesksTestApi::IsDesksBarLeftGradientVisible()); + EXPECT_FALSE(DesksTestApi::IsDeskBarLeftGradientVisible( + DeskBarViewBase::Type::kOverview)); EXPECT_TRUE(right_button->GetVisible()); - EXPECT_TRUE(DesksTestApi::IsDesksBarRightGradientVisible()); + EXPECT_TRUE(DesksTestApi::IsDeskBarRightGradientVisible( + DeskBarViewBase::Type::kOverview)); ui::GestureEvent scroll_end( center_point.x(), center_point.y(), ui::EF_NONE, base::TimeTicks::Now(), @@ -5830,18 +5878,22 @@ scroll_view->OnGestureEvent(&scroll_end); EXPECT_FALSE(scroll_view->is_scrolling()); EXPECT_FALSE(left_button->GetVisible()); - EXPECT_FALSE(DesksTestApi::IsDesksBarLeftGradientVisible()); + EXPECT_FALSE(DesksTestApi::IsDeskBarLeftGradientVisible( + DeskBarViewBase::Type::kOverview)); EXPECT_TRUE(right_button->GetVisible()); - EXPECT_TRUE(DesksTestApi::IsDesksBarRightGradientVisible()); + EXPECT_TRUE(DesksTestApi::IsDeskBarRightGradientVisible( + DeskBarViewBase::Type::kOverview)); // Only right gradient should be shown at the middle page when it is not // during scroll even though the left scroll button is visible. auto* event_generator = GetEventGenerator(); ClickOnView(right_button, event_generator); EXPECT_TRUE(left_button->GetVisible()); - EXPECT_FALSE(DesksTestApi::IsDesksBarLeftGradientVisible()); + EXPECT_FALSE(DesksTestApi::IsDeskBarLeftGradientVisible( + DeskBarViewBase::Type::kOverview)); EXPECT_TRUE(right_button->GetVisible()); - EXPECT_TRUE(DesksTestApi::IsDesksBarRightGradientVisible()); + EXPECT_TRUE(DesksTestApi::IsDeskBarRightGradientVisible( + DeskBarViewBase::Type::kOverview)); // Only the left gradient should be shown at the last page. while (right_button->GetVisible()) @@ -5850,9 +5902,11 @@ EXPECT_EQ(scroll_view->contents()->bounds().width() - scroll_view->width(), scroll_view->GetVisibleRect().x()); EXPECT_TRUE(left_button->GetVisible()); - EXPECT_TRUE(DesksTestApi::IsDesksBarLeftGradientVisible()); + EXPECT_TRUE(DesksTestApi::IsDeskBarLeftGradientVisible( + DeskBarViewBase::Type::kOverview)); EXPECT_FALSE(right_button->GetVisible()); - EXPECT_FALSE(DesksTestApi::IsDesksBarRightGradientVisible()); + EXPECT_FALSE(DesksTestApi::IsDeskBarRightGradientVisible( + DeskBarViewBase::Type::kOverview)); } // Tests the behavior when long press on the scroll buttons. @@ -5870,7 +5924,8 @@ auto* desks_bar = GetOverviewGridForRoot(Shell::GetPrimaryRootWindow())->desks_bar_view(); - views::ScrollView* scroll_view = DesksTestApi::GetDesksBarScrollView(); + views::ScrollView* scroll_view = + DesksTestApi::GetDeskBarScrollView(DeskBarViewBase::Type::kOverview); const int page_size = scroll_view->width(); const auto mini_views = desks_bar->mini_views(); const int mini_view_width = mini_views[0]->bounds().width(); @@ -5881,9 +5936,10 @@ desks_in_one_page++; int current_index = 0; - ScrollArrowButton* left_button = DesksTestApi::GetDesksBarLeftScrollButton(); - ScrollArrowButton* right_button = - DesksTestApi::GetDesksBarRightScrollButton(); + ScrollArrowButton* left_button = DesksTestApi::GetDeskBarLeftScrollButton( + DeskBarViewBase::Type::kOverview); + ScrollArrowButton* right_button = DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview); // At first, left scroll button is hidden and right scroll button is visible. EXPECT_FALSE(left_button->GetVisible()); @@ -5990,8 +6046,9 @@ // Move the focus to the mini view's associated preview view. SendKey(ui::VKEY_TAB); EXPECT_TRUE( - DesksTestApi::GetDesksBarScrollView()->GetVisibleRect().Contains( - mini_views[i]->bounds())); + DesksTestApi::GetDeskBarScrollView(DeskBarViewBase::Type::kOverview) + ->GetVisibleRect() + .Contains(mini_views[i]->bounds())); // Move the focus to the mini view's associated name view. SendKey(ui::VKEY_TAB); } @@ -6003,8 +6060,9 @@ // Move the focus to previous mini view's name view. SendKey(ui::VKEY_LEFT); EXPECT_TRUE( - DesksTestApi::GetDesksBarScrollView()->GetVisibleRect().Contains( - mini_views[i - 1]->bounds())); + DesksTestApi::GetDeskBarScrollView(DeskBarViewBase::Type::kOverview) + ->GetVisibleRect() + .Contains(mini_views[i - 1]->bounds())); } } @@ -6469,7 +6527,8 @@ EXPECT_TRUE(new_desk_button->GetVisible()); EXPECT_TRUE(new_desk_button->GetEnabled()); - auto* scroll_right_button = DesksTestApi::GetDesksBarRightScrollButton(); + auto* scroll_right_button = DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview); for (size_t i = 1; i < desks_util::GetMaxNumberOfDesks(); i++) { ClickOnView(new_desk_button, event_generator); @@ -6917,7 +6976,8 @@ auto* desks_bar = GetOverviewGridForRoot(Shell::GetPrimaryRootWindow())->desks_bar_view(); - views::ScrollView* scroll_view = DesksTestApi::GetDesksBarScrollView(); + views::ScrollView* scroll_view = + DesksTestApi::GetDeskBarScrollView(DeskBarViewBase::Type::kOverview); const int page_size = scroll_view->width(); auto mini_views = desks_bar->mini_views(); const int mini_view_width = mini_views[0]->bounds().width(); @@ -6928,9 +6988,10 @@ desks_in_one_page++; int current_index = 0; - ScrollArrowButton* left_button = DesksTestApi::GetDesksBarLeftScrollButton(); - ScrollArrowButton* right_button = - DesksTestApi::GetDesksBarRightScrollButton(); + ScrollArrowButton* left_button = DesksTestApi::GetDeskBarLeftScrollButton( + DeskBarViewBase::Type::kOverview); + ScrollArrowButton* right_button = DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview); // At first, left scroll button is hidden and right scroll button is visible. EXPECT_FALSE(left_button->GetVisible()); @@ -7092,7 +7153,8 @@ // Drag the second desk away from the desk bar. StartDragDeskPreview(mini_view_2, event_generator); - EXPECT_EQ(DesksTestApi::GetDesksBarDragView(), mini_view_2); + EXPECT_EQ(DesksTestApi::GetDeskBarDragView(DeskBarViewBase::Type::kOverview), + mini_view_2); event_generator->MoveMouseBy(0, desks_bar_view->height()); @@ -7101,9 +7163,11 @@ // Drop the desk and drag first desk. event_generator->ReleaseLeftButton(); - EXPECT_EQ(DesksTestApi::GetDesksBarDragView(), mini_view_2); + EXPECT_EQ(DesksTestApi::GetDeskBarDragView(DeskBarViewBase::Type::kOverview), + mini_view_2); StartDragDeskPreview(mini_view_1, event_generator); - EXPECT_EQ(DesksTestApi::GetDesksBarDragView(), mini_view_1); + EXPECT_EQ(DesksTestApi::GetDeskBarDragView(DeskBarViewBase::Type::kOverview), + mini_view_1); } // Tests that dragging desk is ended in two cases: (1) removing a dragged desk. @@ -7564,7 +7628,8 @@ ASSERT_LT(index, desks_bar_view->mini_views().size()); // Run the context menu command for closing a desk with all of its windows. - auto* menu_controller = DesksTestApi::GetContextMenuForDesk(index); + auto* menu_controller = DesksTestApi::GetContextMenuForDesk( + DeskBarViewBase::Type::kOverview, index); menu_controller->ExecuteCommand( static_cast<int>(DeskActionContextMenu::CommandId::kCloseAll), /*event_flags=*/0); @@ -7893,8 +7958,10 @@ // We need to open the context menu to trigger state change for the combine // desks option in the context menu. OpenContextMenuForMiniView(0); - EXPECT_FALSE(DesksTestApi::GetContextMenuModelForDesk(0).IsVisibleAt( - DeskActionContextMenu::CommandId::kCombineDesks)); + EXPECT_FALSE( + DesksTestApi::GetContextMenuModelForDesk(DeskBarViewBase::Type::kOverview, + 0) + .IsVisibleAt(DeskActionContextMenu::CommandId::kCombineDesks)); event_generator->ClickLeftButton(); // Add a window and check to see if that makes the context option visible for @@ -7913,8 +7980,10 @@ event_generator->MoveMouseTo(desk_preview_view_center); EXPECT_TRUE(combine_desks_button->GetVisible()); OpenContextMenuForMiniView(0); - EXPECT_TRUE(DesksTestApi::GetContextMenuModelForDesk(0).IsVisibleAt( - DeskActionContextMenu::CommandId::kCombineDesks)); + EXPECT_TRUE( + DesksTestApi::GetContextMenuModelForDesk(DeskBarViewBase::Type::kOverview, + 0) + .IsVisibleAt(DeskActionContextMenu::CommandId::kCombineDesks)); } // Tests that the shortcut to close all (Ctrl + Shift + W) on a desk mini view @@ -8056,7 +8125,8 @@ // The highlight overlay should start out invisible. views::View* highlight_overlay = - DesksTestApi::GetHighlightOverlayForDeskPreview(0); + DesksTestApi::GetHighlightOverlayForDeskPreview( + DeskBarViewBase::Type::kOverview, 0); ASSERT_FALSE(highlight_overlay->GetVisible()); // Open the context menu for the first desk and check that highlight overlay @@ -8239,7 +8309,8 @@ int undo_toast_expired_count = 0; for (const auto& test_case : kTestCases) { SCOPED_TRACE(test_case.scope_trace); - auto* menu_controller = DesksTestApi::GetContextMenuForDesk(0); + auto* menu_controller = DesksTestApi::GetContextMenuForDesk( + DeskBarViewBase::Type::kOverview, 0); menu_controller->ExecuteCommand( static_cast<int>(DeskActionContextMenu::CommandId::kCloseAll), /*event_flags=*/0); @@ -8307,7 +8378,8 @@ auto* event_generator = GetEventGenerator(); LongGestureTap(desk_preview_view_center, event_generator); - EXPECT_TRUE(DesksTestApi::IsContextMenuRunningForDesk(0)); + EXPECT_TRUE(DesksTestApi::IsContextMenuRunningForDesk( + DeskBarViewBase::Type::kOverview, 0)); } // Tests that desks can be closed in quick succession while still saving the @@ -8434,7 +8506,8 @@ // Scroll all the way to the right to ensure that the new button is visible. auto* event_generator = GetEventGenerator(); - auto* scroll_right_button = DesksTestApi::GetDesksBarRightScrollButton(); + auto* scroll_right_button = DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kOverview); for (int i = 0; i != 3; ++i) ClickOnView(scroll_right_button, event_generator); @@ -8687,6 +8760,13 @@ .has_saved_desks = true, .bar_widget_bounds_expected = {0, 446, 800, 98}, .bar_view_bounds_expected = {0, 0, 800, 98}}, + {.test_name = "single desk + bottom shelf", + .desks = {0}, + .active_desk = 0, + .shelf_alignment = ShelfAlignment::kBottom, + .has_saved_desks = false, + .bar_widget_bounds_expected = {0, 446, 800, 98}, + .bar_view_bounds_expected = {0, 0, 800, 98}}, {.test_name = "single desk + left shelf + saved desks", .desks = {0}, .active_desk = 0, @@ -8712,7 +8792,6 @@ auto* root = Shell::Get()->GetPrimaryRootWindow(); auto* desks_controller = DesksController::Get(); - auto desk_bar_controller = std::make_unique<DeskBarController>(); Shelf* shelf = GetPrimaryShelf(); for (const auto& test : tests) { @@ -8738,8 +8817,9 @@ // Create the desk bar then verify the bar and its child UI have expected // appearance. - desk_bar_controller->CreateDeskBar(root); - auto* desk_bar_view = desk_bar_controller->GetDeskBarView(root); + OpenDeskButtonDeskBar(); + auto* desk_bar_view = + desks_controller->desk_bar_controller()->GetDeskBarView(root); auto* desk_bar_widget = desk_bar_view->GetWidget(); EXPECT_THAT(desk_bar_widget->GetWindowBoundsInScreen(), test.bar_widget_bounds_expected); @@ -8750,9 +8830,16 @@ auto* new_desk_button = desk_bar_view->new_desk_button(); EXPECT_THAT(new_desk_button->state(), CrOSNextDeskIconButton::State::kExpanded); + EXPECT_TRUE(new_desk_button->GetVisible()); + EXPECT_THAT(new_desk_button->GetEnabled(), + desks_controller->CanCreateDesks()); auto* library_button = desk_bar_view->library_button(); EXPECT_THAT(library_button->state(), CrOSNextDeskIconButton::State::kExpanded); + EXPECT_THAT(library_button->GetVisible(), test.has_saved_desks); + EXPECT_TRUE(library_button->GetEnabled()); + + CloseDeskButtonDeskBar(); } // Reset to clean state, i.e. only 1 desk and no saved desks. @@ -8763,6 +8850,67 @@ } } +// Tests that desk button desk bar shows the scroll arrow buttons when overflow +// happens. +TEST_P(DeskButtonTest, DeskBarScrollLayout) { + UpdateDisplay("600x400"); + + auto* desks_controller = DesksController::Get(); + while (desks_controller->CanCreateDesks()) { + NewDesk(); + } + + OpenDeskButtonDeskBar(); + + auto* left_scroll_button = DesksTestApi::GetDeskBarLeftScrollButton( + DeskBarViewBase::Type::kDeskButton); + auto* right_scroll_button = DesksTestApi::GetDeskBarRightScrollButton( + DeskBarViewBase::Type::kDeskButton); + EXPECT_FALSE(left_scroll_button->GetVisible()); + EXPECT_TRUE(right_scroll_button->GetVisible()); + + auto* event_generator = GetEventGenerator(); + while (right_scroll_button->GetVisible()) { + ClickOnView(right_scroll_button, event_generator); + EXPECT_TRUE(left_scroll_button->GetVisible()); + } + + while (left_scroll_button->GetVisible()) { + ClickOnView(left_scroll_button, event_generator); + EXPECT_TRUE(right_scroll_button->GetVisible()); + } + + CloseDeskButtonDeskBar(); +} + +TEST_P(DeskButtonTest, DeskBarHoverBasic) { + auto window_1 = CreateAppWindow(gfx::Rect(0, 0, 100, 100)); + auto window_2 = CreateAppWindow(gfx::Rect(0, 0, 100, 100)); + + NewDesk(); + + auto* desks_controller = DesksController::Get(); + desks_controller->SendToDeskAtIndex(window_1.get(), 0); + desks_controller->SendToDeskAtIndex(window_2.get(), 1); + + OpenDeskButtonDeskBar(); + + for (int i = 0; i < desks_controller->GetNumberOfDesks(); i++) { + auto* event_generator = GetEventGenerator(); + auto* mini_view = desks_controller->desk_bar_controller() + ->GetDeskBarView(Shell::GetPrimaryRootWindow()) + ->mini_views()[i]; + event_generator->MoveMouseTo( + mini_view->desk_preview()->GetBoundsInScreen().CenterPoint()); + EXPECT_TRUE( + mini_view->desk_action_view()->combine_desks_button()->GetVisible()); + EXPECT_TRUE( + mini_view->desk_action_view()->close_all_button()->GetVisible()); + } + + CloseDeskButtonDeskBar(); +} + // TODO(afakhry): Add more tests: // - Always on top windows are not tracked by any desk. // - Reusing containers when desks are removed and created.
diff --git a/ash/wm/desks/desks_util.cc b/ash/wm/desks/desks_util.cc index 4f808a22..3e8be4d 100644 --- a/ash/wm/desks/desks_util.cc +++ b/ash/wm/desks/desks_util.cc
@@ -158,8 +158,8 @@ DCHECK(context); for (const auto& desk : DesksController::Get()->desks()) { - if (desk.get()->container_id() == - GetDeskContainerForContext(context)->GetId()) { + if (auto* context_desk = GetDeskContainerForContext(context); + context_desk && desk.get()->container_id() == context_desk->GetId()) { return desk.get(); } }
diff --git a/ash/wm/desks/legacy_desk_bar_view.cc b/ash/wm/desks/legacy_desk_bar_view.cc index 83fe100..7cec79f 100644 --- a/ash/wm/desks/legacy_desk_bar_view.cc +++ b/ash/wm/desks/legacy_desk_bar_view.cc
@@ -4,68 +4,31 @@ #include "ash/wm/desks/legacy_desk_bar_view.h" -#include <iterator> -#include <utility> - -#include "ash/keyboard/ui/keyboard_ui_controller.h" -#include "ash/public/cpp/shell_window_ids.h" -#include "ash/public/cpp/window_properties.h" -#include "ash/resources/vector_icons/vector_icons.h" #include "ash/shell.h" -#include "ash/strings/grit/ash_strings.h" -#include "ash/style/ash_color_id.h" #include "ash/utility/haptics_util.h" -#include "ash/wm/desks/desk_action_view.h" -#include "ash/wm/desks/desk_drag_proxy.h" -#include "ash/wm/desks/desk_mini_view.h" #include "ash/wm/desks/desk_mini_view_animations.h" #include "ash/wm/desks/desk_name_view.h" #include "ash/wm/desks/desk_preview_view.h" -#include "ash/wm/desks/desks_constants.h" #include "ash/wm/desks/desks_util.h" -#include "ash/wm/desks/expanded_desks_bar_button.h" -#include "ash/wm/desks/scroll_arrow_button.h" -#include "ash/wm/desks/templates/saved_desk_presenter.h" -#include "ash/wm/desks/templates/saved_desk_util.h" -#include "ash/wm/desks/zero_state_button.h" #include "ash/wm/overview/overview_controller.h" -#include "ash/wm/overview/overview_grid.h" #include "ash/wm/overview/overview_highlight_controller.h" #include "ash/wm/overview/overview_session.h" -#include "ash/wm/overview/overview_utils.h" -#include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/check.h" -#include "base/containers/contains.h" -#include "base/functional/bind.h" -#include "base/i18n/rtl.h" #include "base/ranges/algorithm.h" #include "chromeos/constants/chromeos_features.h" -#include "third_party/skia/include/core/SkColor.h" #include "ui/aura/window.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/events/devices/device_data_manager.h" +#include "ui/compositor/layer.h" #include "ui/events/devices/haptic_touchpad_effects.h" -#include "ui/events/devices/input_device.h" #include "ui/events/event_observer.h" #include "ui/events/types/event_type.h" -#include "ui/gfx/text_elider.h" -#include "ui/views/background.h" -#include "ui/views/controls/button/button.h" #include "ui/views/event_monitor.h" #include "ui/views/highlight_border.h" -#include "ui/views/widget/unique_widget_ptr.h" #include "ui/views/widget/widget.h" #include "ui/wm/core/cursor_manager.h" -#include "ui/wm/core/window_animations.h" namespace ash { namespace { -gfx::Rect GetGestureEventScreenRect(const ui::Event& event) { - DCHECK(event.IsGestureEvent()); - return event.AsGestureEvent()->details().bounding_box(); -} - OverviewHighlightController* GetHighlightController() { auto* overview_controller = Shell::Get()->overview_controller(); DCHECK(overview_controller->InOverviewSession()); @@ -75,62 +38,6 @@ } // namespace // ----------------------------------------------------------------------------- -// DeskBarHoverObserver: - -class DeskBarHoverObserver : public ui::EventObserver { - public: - DeskBarHoverObserver(LegacyDeskBarView* owner, aura::Window* widget_window) - : owner_(owner), - event_monitor_(views::EventMonitor::CreateWindowMonitor( - this, - widget_window, - {ui::ET_MOUSE_PRESSED, ui::ET_MOUSE_DRAGGED, ui::ET_MOUSE_RELEASED, - ui::ET_MOUSE_MOVED, ui::ET_MOUSE_ENTERED, ui::ET_MOUSE_EXITED, - ui::ET_GESTURE_LONG_PRESS, ui::ET_GESTURE_LONG_TAP, - ui::ET_GESTURE_TAP, ui::ET_GESTURE_TAP_DOWN})) {} - - DeskBarHoverObserver(const DeskBarHoverObserver&) = delete; - DeskBarHoverObserver& operator=(const DeskBarHoverObserver&) = delete; - - ~DeskBarHoverObserver() override = default; - - // ui::EventObserver: - void OnEvent(const ui::Event& event) override { - switch (event.type()) { - case ui::ET_MOUSE_PRESSED: - case ui::ET_MOUSE_DRAGGED: - case ui::ET_MOUSE_RELEASED: - case ui::ET_MOUSE_MOVED: - case ui::ET_MOUSE_ENTERED: - case ui::ET_MOUSE_EXITED: - owner_->OnHoverStateMayHaveChanged(); - break; - - case ui::ET_GESTURE_LONG_PRESS: - case ui::ET_GESTURE_LONG_TAP: - owner_->OnGestureTap(GetGestureEventScreenRect(event), - /*is_long_gesture=*/true); - break; - - case ui::ET_GESTURE_TAP: - case ui::ET_GESTURE_TAP_DOWN: - owner_->OnGestureTap(GetGestureEventScreenRect(event), - /*is_long_gesture=*/false); - break; - - default: - NOTREACHED(); - break; - } - } - - private: - raw_ptr<LegacyDeskBarView, ExperimentalAsh> owner_; - - std::unique_ptr<views::EventMonitor> event_monitor_; -}; - -// ----------------------------------------------------------------------------- // LegacyDeskBarView: LegacyDeskBarView::LegacyDeskBarView(OverviewGrid* overview_grid) @@ -146,27 +53,6 @@ } } -void LegacyDeskBarView::Init() { - DeskBarViewBase::Init(); - - // TODO(b/278946144): Migrate `DeskBarHoverObserver` to use base class. - hover_observer_ = std::make_unique<DeskBarHoverObserver>( - this, GetWidget()->GetNativeWindow()); -} - -void LegacyDeskBarView::OnHoverStateMayHaveChanged() { - for (auto* mini_view : mini_views_) { - mini_view->UpdateDeskButtonVisibility(); - } -} - -void LegacyDeskBarView::OnGestureTap(const gfx::Rect& screen_rect, - bool is_long_gesture) { - for (auto* mini_view : mini_views_) { - mini_view->OnWidgetGestureTap(screen_rect, is_long_gesture); - } -} - void LegacyDeskBarView::SetDragDetails(const gfx::Point& screen_location, bool dragged_item_over_bar) { last_dragged_item_screen_location_ = screen_location;
diff --git a/ash/wm/desks/legacy_desk_bar_view.h b/ash/wm/desks/legacy_desk_bar_view.h index b356822..4a2f54d 100644 --- a/ash/wm/desks/legacy_desk_bar_view.h +++ b/ash/wm/desks/legacy_desk_bar_view.h
@@ -6,26 +6,18 @@ #define ASH_WM_DESKS_LEGACY_DESK_BAR_VIEW_H_ #include <memory> -#include <vector> #include "ash/ash_export.h" #include "ash/wm/desks/cros_next_default_desk_button.h" #include "ash/wm/desks/cros_next_desk_icon_button.h" #include "ash/wm/desks/desk_bar_view_base.h" -#include "ash/wm/desks/desks_controller.h" -#include "ash/wm/desks/templates/saved_desk_metrics_util.h" -#include "base/callback_list.h" -#include "base/memory/raw_ptr.h" -#include "ui/views/controls/scroll_view.h" +#include "ash/wm/desks/desk_drag_proxy.h" +#include "ash/wm/desks/desk_mini_view.h" +#include "ash/wm/overview/overview_grid.h" #include "ui/views/view.h" namespace ash { -class DeskBarHoverObserver; -class DeskDragProxy; -class DeskMiniView; -class OverviewGrid; - // A bar that resides at the top portion of the overview, which contains desk // mini views, the new desk button, the library button, and the scroll arrow // buttons. @@ -38,13 +30,6 @@ ~LegacyDeskBarView() override; - void Init() override; - - // Updates the visibility state of the close buttons on all the mini_views as - // a result of mouse and gesture events. - void OnHoverStateMayHaveChanged(); - void OnGestureTap(const gfx::Rect& screen_rect, bool is_long_gesture); - // Called when an item is being dragged in overview mode to update whether it // is currently intersecting with this view, and the |screen_location| of the // current drag position. @@ -135,18 +120,12 @@ CrOSNextDeskIconButton::State target_state) override; private: - friend class DesksTestApi; - // If drag a desk over a scroll button (i.e., the desk intersects the button), // scroll the desk bar. If the desk is dropped or leaves the button, end // scroll. Return true if the scroll is triggered. Return false if the scroll // is ended. bool MaybeScrollByDraggedDesk(); - // Observes mouse events on the desk bar widget and updates the states of the - // mini_views accordingly. - std::unique_ptr<DeskBarHoverObserver> hover_observer_; - // Drag proxy for the dragged desk. std::unique_ptr<DeskDragProxy> drag_proxy_; };
diff --git a/ash/wm/desks/templates/saved_desk_presenter.cc b/ash/wm/desks/templates/saved_desk_presenter.cc index d8ef710..5e5d3e9 100644 --- a/ash/wm/desks/templates/saved_desk_presenter.cc +++ b/ash/wm/desks/templates/saved_desk_presenter.cc
@@ -13,6 +13,7 @@ #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "ash/wm/desks/desk.h" +#include "ash/wm/desks/desk_bar_view_base.h" #include "ash/wm/desks/desks_controller.h" #include "ash/wm/desks/desks_util.h" #include "ash/wm/desks/legacy_desk_bar_view.h" @@ -319,11 +320,6 @@ auto* desk_model = GetDeskModel(); desk_model_observation_.Observe(desk_model); - - should_show_saved_desk_library_ = - !Shell::Get()->tablet_mode_controller()->InTabletMode() && - (GetEntryCount(DeskTemplateType::kTemplate) + - GetEntryCount(DeskTemplateType::kSaveAndRecall)) > 0u; } SavedDeskPresenter::~SavedDeskPresenter() = default; @@ -361,10 +357,6 @@ const bool in_tablet_mode = Shell::Get()->tablet_mode_controller()->InTabletMode(); - const bool has_saved_desks = - (GetEntryCount(DeskTemplateType::kTemplate) + - GetEntryCount(DeskTemplateType::kSaveAndRecall)) > 0u; - for (auto& overview_grid : overview_session_->grid_list()) { const bool is_showing_library = overview_grid->IsShowingSavedDeskLibrary(); @@ -373,13 +365,13 @@ overview_grid->HideSavedDeskLibrary(/*exit_overview=*/false); } - // The functions below reach into this class to determine whether the - // buttons should be shown or not. If we are already showing saved desk - // library, they should not go away (unless we're in tablet mode). - should_show_saved_desk_library_ = - !in_tablet_mode && (is_showing_library || has_saved_desks); - if (LegacyDeskBarView* desks_bar_view = overview_grid->desks_bar_view()) { + // Library UI needs an update. If it's currently in the library page, keep + // the UI visible. + desks_bar_view->set_library_ui_visibility( + (!in_tablet_mode && is_showing_library) + ? DeskBarViewBase::LibraryUiVisibility::kVisible + : DeskBarViewBase::LibraryUiVisibility::kToBeChecked); desks_bar_view->UpdateLibraryButtonVisibility(); desks_bar_view->UpdateButtonsForSavedDeskGrid(); overview_grid->UpdateSaveDeskButtons(); @@ -493,7 +485,7 @@ if (result.status != desks_storage::DeskModel::GetAllEntriesStatus::kOk) return; - // This updates `should_show_saved_desk_library_`. + // This updates UI for saved desk library. UpdateUIForSavedDeskLibrary(); for (auto& overview_grid : overview_session_->grid_list()) { @@ -732,7 +724,7 @@ if (new_entries.empty()) return; - // This updates `should_show_saved_desk_library_`. + // This updates UI for saved desk library. UpdateUIForSavedDeskLibrary(); for (auto& overview_grid : overview_session_->grid_list()) { @@ -750,7 +742,7 @@ if (uuids.empty()) return; - // This updates `should_show_saved_desk_library_`. + // This updates UI for saved desk library. UpdateUIForSavedDeskLibrary(); for (auto& overview_grid : overview_session_->grid_list()) {
diff --git a/ash/wm/desks/templates/saved_desk_presenter.h b/ash/wm/desks/templates/saved_desk_presenter.h index 080172d..54476745 100644 --- a/ash/wm/desks/templates/saved_desk_presenter.h +++ b/ash/wm/desks/templates/saved_desk_presenter.h
@@ -38,10 +38,6 @@ SavedDeskPresenter& operator=(const SavedDeskPresenter&) = delete; ~SavedDeskPresenter() override; - bool should_show_saved_desk_library() { - return should_show_saved_desk_library_; - } - // Retrieve the current and max count for a given saved desk type. Note that // these are snapshots of the model state, which may not match the current UI // state. @@ -56,8 +52,7 @@ // Update UI for saved desk library. More specifically, it updates the // visibility of the library button, save desk button, and the saved desk - // grid. The grid contents are not updated. It also updates - // `should_show_saved_desk_library_`. + // grid. The grid contents are not updated. void UpdateUIForSavedDeskLibrary(); // Calls the DeskModel to get all the saved desk entries, with a callback to @@ -143,10 +138,6 @@ desks_storage::DeskModelObserver> desk_model_observation_{this}; - // If the user has at least one saved desk entry, the saved desk library - // should be shown. Otherwise, it should be invisible. - bool should_show_saved_desk_library_ = false; - // Test closure that runs after the UI has been updated async after a call to // the model. base::OnceClosure on_update_ui_closure_for_testing_;
diff --git a/ash/wm/desks/templates/saved_desk_util.cc b/ash/wm/desks/templates/saved_desk_util.cc index 1b25b82e..f1d64d1 100644 --- a/ash/wm/desks/templates/saved_desk_util.cc +++ b/ash/wm/desks/templates/saved_desk_util.cc
@@ -37,6 +37,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { registry->RegisterBooleanPref(prefs::kDeskTemplatesEnabled, false); + registry->RegisterListPref(prefs::kAppLaunchAutomation); } bool AreDesksTemplatesEnabled() {
diff --git a/ash/wm/overview/overview_item.cc b/ash/wm/overview/overview_item.cc index e8ca47c..01191b2c 100644 --- a/ash/wm/overview/overview_item.cc +++ b/ash/wm/overview/overview_item.cc
@@ -350,12 +350,12 @@ return; } - // Do not animate if the resulting bounds does not change. The original - // window may change bounds so we still need to call `SetItemBounds()` to - // update the window transform. + // Do not animate if the resulting bounds does not change or current animation + // is still in progress. The original window may change bounds so we still + // need to call `SetItemBounds()` to update the window transform. OverviewAnimationType new_animation_type = animation_type; - if (target_bounds == target_bounds_ && - !GetWindow()->layer()->GetAnimator()->is_animating()) { + if (GetWindow()->layer()->GetAnimator()->is_animating() || + target_bounds == target_bounds_) { new_animation_type = OVERVIEW_ANIMATION_NONE; } @@ -1326,6 +1326,11 @@ } void OverviewItem::UpdateHeaderLayout(OverviewAnimationType animation_type) { + if (chromeos::features::IsJellyrollEnabled()) { + UpdateHeaderLayoutCrOSNext(animation_type); + return; + } + aura::Window* widget_window = item_widget_->GetNativeWindow(); ScopedOverviewAnimationSettings animation_settings(animation_type, widget_window); @@ -1350,6 +1355,52 @@ widget_window->SetTransform(label_transform); } +void OverviewItem::UpdateHeaderLayoutCrOSNext( + OverviewAnimationType animation_type) { + gfx::RectF current_item_bounds(item_widget_->GetWindowBoundsInScreen()); + gfx::RectF target_item_bounds = target_bounds_; + wm::TranslateRectFromScreen(root_window_, &target_item_bounds); + + aura::Window* widget_window = item_widget_->GetNativeWindow(); + if (current_item_bounds.IsEmpty()) { + widget_window->SetBounds(ToStableSizeRoundedRect(target_item_bounds)); + return; + } + + const gfx::Transform item_bounds_transform = + gfx::TransformBetweenRects(target_item_bounds, current_item_bounds); + widget_window->SetBounds(ToStableSizeRoundedRect(target_item_bounds)); + widget_window->SetTransform(item_bounds_transform); + + ScopedOverviewAnimationSettings item_animation_settings(animation_type, + widget_window); + // Create a start animation observer if this is an enter overview layout + // animation. + if (animation_type == OVERVIEW_ANIMATION_LAYOUT_OVERVIEW_ITEMS_ON_ENTER || + animation_type == OVERVIEW_ANIMATION_ENTER_FROM_HOME_LAUNCHER) { + auto enter_observer = std::make_unique<EnterAnimationObserver>(); + item_animation_settings.AddObserver(enter_observer.get()); + Shell::Get()->overview_controller()->AddEnterAnimationObserver( + std::move(enter_observer)); + } + widget_window->SetTransform(gfx::Transform()); + + // Since header view is a child of the overview item view, the bounds + // animation is appled to the header as well when it's applied to the overview + // item. However, when calculating the target bounds for the window, it's + // always assumed that the header's height is 40, there's a gap between the + // header and the window during the animation. In order to neutralize the gap, + // apply the reversed vertical transform to the header separately. + ui::Layer* header_layer = overview_item_view_->header_view()->layer(); + float vertical_scale = item_bounds_transform.To2dScale().y(); + gfx::Transform vertical_reverse_transform = + gfx::Transform::MakeScale(1.f, 1.f / vertical_scale); + header_layer->SetTransform(vertical_reverse_transform); + ScopedOverviewAnimationSettings header_animation_settings( + animation_type, header_layer->GetAnimator()); + header_layer->SetTransform(gfx::Transform()); +} + OverviewAnimationType OverviewItem::GetExitOverviewAnimationTypeForMinimizedWindow( OverviewEnterExitType type) {
diff --git a/ash/wm/overview/overview_item.h b/ash/wm/overview/overview_item.h index 7ec4fa0..14b14303 100644 --- a/ash/wm/overview/overview_item.h +++ b/ash/wm/overview/overview_item.h
@@ -311,6 +311,11 @@ // from the current bounds to the new bounds as per the |animation_type|. void UpdateHeaderLayout(OverviewAnimationType animation_type); + // Updates the bounds of `item_widget` if the feature flag Jellyroll is + // enabled. Once the feature is fully launched, this function will be renamed + // to `UpdateHeaderLayout` and the function above should be removed. + void UpdateHeaderLayoutCrOSNext(OverviewAnimationType animation_type); + // Animates opacity of the |transform_window_| and its caption to |opacity| // using |animation_type|. void AnimateOpacity(float opacity, OverviewAnimationType animation_type);
diff --git a/ash/wm/overview/overview_session_unittest.cc b/ash/wm/overview/overview_session_unittest.cc index 3bb39df2..b6a59737 100644 --- a/ash/wm/overview/overview_session_unittest.cc +++ b/ash/wm/overview/overview_session_unittest.cc
@@ -2590,6 +2590,9 @@ ASSERT_TRUE(drop_target_item); EXPECT_TRUE(GetShadowBounds(drop_target_item).IsEmpty()); + window1->layer()->GetAnimator()->StopAnimating(); + window2->layer()->GetAnimator()->StopAnimating(); + generator->MoveMouseTo(start_drag); generator->ReleaseLeftButton(); EXPECT_TRUE(window1->layer()->GetAnimator()->is_animating());
diff --git a/ash/wm/overview/overview_utils.cc b/ash/wm/overview/overview_utils.cc index 76c4c78..257ac82d 100644 --- a/ash/wm/overview/overview_utils.cc +++ b/ash/wm/overview/overview_utils.cc
@@ -346,8 +346,7 @@ ->highlight_controller(); DCHECK(highlight_controller); - if (highlight_controller->IsFocusHighlightVisible()) - highlight_controller->MoveHighlightToView(target_view); + highlight_controller->MoveHighlightToView(target_view); } void UpdateOverviewHighlightForFocusAndSpokenFeedback( @@ -360,10 +359,9 @@ ->overview_session() ->highlight_controller(); DCHECK(highlight_controller); - - if (highlight_controller->IsFocusHighlightVisible() || - a11y_controller->spoken_feedback().enabled()) { - highlight_controller->MoveHighlightToView(target_view); + DCHECK(a11y_controller); + if (a11y_controller->spoken_feedback().enabled()) { + UpdateOverviewHighlightForFocus(target_view); } }
diff --git a/base/BUILD.gn b/base/BUILD.gn index 5334be8..f27ebd6 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -501,6 +501,8 @@ "metrics/histogram_macros_local.h", "metrics/histogram_samples.cc", "metrics/histogram_samples.h", + "metrics/histogram_shared_memory.cc", + "metrics/histogram_shared_memory.h", "metrics/histogram_snapshot_manager.cc", "metrics/histogram_snapshot_manager.h", "metrics/metrics_hashes.cc", @@ -3191,6 +3193,7 @@ "metrics/histogram_functions_unittest.cc", "metrics/histogram_macros_unittest.cc", "metrics/histogram_samples_unittest.cc", + "metrics/histogram_shared_memory_unittest.cc", "metrics/histogram_snapshot_manager_unittest.cc", "metrics/histogram_threadsafe_unittest.cc", "metrics/histogram_unittest.cc",
diff --git a/base/android/orderfile/orderfile_call_graph_instrumentation.cc b/base/android/orderfile/orderfile_call_graph_instrumentation.cc index ea27f15..3bb90b59 100644 --- a/base/android/orderfile/orderfile_call_graph_instrumentation.cc +++ b/base/android/orderfile/orderfile_call_graph_instrumentation.cc
@@ -240,26 +240,26 @@ // This can get very large as it constructs the whole data structure in // memory before dumping it to the file. - Value root(Value::Type::DICT); uint32_t total_calls_count = g_calls_count.load(std::memory_order_relaxed); - root.SetStringKey("total_calls_count", - base::StringPrintf("%" PRIu32, total_calls_count)); - Value call_graph(Value::Type::LIST); + auto root = base::Value::Dict().Set( + "total_calls_count", base::StringPrintf("%" PRIu32, total_calls_count)); + auto call_graph = base::Value::List(); for (size_t i = 0; i < kMaxElements; i++) { auto caller_index = callee_map[i].load(std::memory_order_relaxed) * kTotalBuckets; - if (!caller_index) + if (!caller_index) { // This callee was never called. continue; + } - Value callee_element(Value::Type::DICT); uint32_t callee_offset = i * 4; - callee_element.SetStringKey("index", - base::StringPrintf("%" PRIuS, caller_index)); - callee_element.SetStringKey("callee_offset", - base::StringPrintf("%" PRIu32, callee_offset)); + auto callee_element = + base::Value::Dict() + .Set("index", base::StringPrintf("%" PRIuS, caller_index)) + .Set("callee_offset", + base::StringPrintf("%" PRIu32, callee_offset)); std::string offset_str; - Value callers_list(Value::Type::LIST); + auto callers_list = base::Value::List(); for (size_t j = 0; j < kTotalBuckets; j++) { uint32_t caller_offset = g_caller_offset[caller_index + j].load(std::memory_order_relaxed); @@ -274,21 +274,23 @@ // The count can only be 0 for the misses bucket. Otherwise, // if |caller_offset| is set then the count must be >= 1. CHECK_EQ(count || j == kMissesBucketIndex, true); - if (!count) + if (!count) { // No misses. continue; + } - Value caller_count(Value::Type::DICT); - caller_count.SetStringKey("caller_offset", - base::StringPrintf("%" PRIu32, caller_offset)); - caller_count.SetStringKey("count", base::StringPrintf("%" PRIu32, count)); + auto caller_count = + base::Value::Dict() + .Set("caller_offset", + base::StringPrintf("%" PRIu32, caller_offset)) + .Set("count", base::StringPrintf("%" PRIu32, count)); callers_list.Append(std::move(caller_count)); } - callee_element.SetKey("caller_and_count", std::move(callers_list)); + callee_element.Set("caller_and_count", std::move(callers_list)); call_graph.Append(std::move(callee_element)); } - root.SetKey("call_graph", std::move(call_graph)); + root.Set("call_graph", std::move(call_graph)); std::string output_js; if (!JSONWriter::Write(root, &output_js)) { LOG(FATAL) << "Error getting JSON string";
diff --git a/base/check.cc b/base/check.cc index 18964aaf..6fae35d 100644 --- a/base/check.cc +++ b/base/check.cc
@@ -180,7 +180,7 @@ CheckError CheckError::DCheckOp(char* log_message_str, const base::Location& location) { auto* const log_message = new DCheckLogMessage( - location.file_name(), location.line_number(), LOGGING_FATAL); + location.file_name(), location.line_number(), LOGGING_DCHECK); log_message->stream() << log_message_str; free(log_message_str); return CheckError(log_message);
diff --git a/base/metrics/histogram_shared_memory.cc b/base/metrics/histogram_shared_memory.cc new file mode 100644 index 0000000..67bf4be --- /dev/null +++ b/base/metrics/histogram_shared_memory.cc
@@ -0,0 +1,62 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/metrics/histogram_shared_memory.h" + +#include "base/memory/shared_memory_mapping.h" + +namespace base { + +HistogramSharedMemory::HistogramSharedMemory() = default; +HistogramSharedMemory::~HistogramSharedMemory() = default; +HistogramSharedMemory::HistogramSharedMemory(HistogramSharedMemory&& other) = + default; +HistogramSharedMemory& HistogramSharedMemory::operator=( + HistogramSharedMemory&& other) = default; + +// static +absl::optional<HistogramSharedMemory> HistogramSharedMemory::Create( + int unique_process_id, + const HistogramSharedMemoryConfig& config) { + auto shared_memory_region = + base::WritableSharedMemoryRegion::Create(config.memory_size_bytes); + if (!shared_memory_region.IsValid()) { + return absl::nullopt; + } + + auto shared_memory_mapping = shared_memory_region.Map(); + if (!shared_memory_mapping.IsValid()) { + return absl::nullopt; + } + + auto metrics_allocator = + std::make_unique<base::WritableSharedPersistentMemoryAllocator>( + std::move(shared_memory_mapping), + static_cast<uint64_t>(unique_process_id), config.allocator_name); + + return HistogramSharedMemory{std::move(shared_memory_region), + std::move(metrics_allocator)}; +} + +bool HistogramSharedMemory::IsValid() const { + return region_.IsValid() && allocator_ != nullptr; +} + +base::WritableSharedMemoryRegion HistogramSharedMemory::TakeRegion() { + return std::move(region_); +} + +std::unique_ptr<base::WritableSharedPersistentMemoryAllocator> +HistogramSharedMemory::TakeAllocator() { + return std::move(allocator_); +} + +HistogramSharedMemory::HistogramSharedMemory( + base::WritableSharedMemoryRegion region, + std::unique_ptr<base::WritableSharedPersistentMemoryAllocator> allocator) + : region_(std::move(region)), allocator_(std::move(allocator)) { + CHECK(IsValid()); +} + +} // namespace base
diff --git a/base/metrics/histogram_shared_memory.h b/base/metrics/histogram_shared_memory.h new file mode 100644 index 0000000..d174492 --- /dev/null +++ b/base/metrics/histogram_shared_memory.h
@@ -0,0 +1,70 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_METRICS_HISTOGRAM_SHARED_MEMORY_H_ +#define BASE_METRICS_HISTOGRAM_SHARED_MEMORY_H_ + +#include "base/base_export.h" +#include "base/memory/writable_shared_memory_region.h" +#include "base/metrics/persistent_memory_allocator.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace base { + +// Configuration with which to create a histogram shared memory region and +// allocator. +struct BASE_EXPORT HistogramSharedMemoryConfig { + base::StringPiece allocator_name; + size_t memory_size_bytes; +}; + +// Helper structure to create and return a shared memory region and a histogram +// allocator over top of it. Once returned it is expected that the caller will +// move both the memory regions and the allocator out of the struct and into +// it's own appropriate state variables. Note that the memory region must +// outlive the allocator. +class BASE_EXPORT HistogramSharedMemory { + public: + HistogramSharedMemory(); + ~HistogramSharedMemory(); + + // Move operations are supported. + HistogramSharedMemory(HistogramSharedMemory&& other); + HistogramSharedMemory& operator=(HistogramSharedMemory&& other); + + // Copy operations are NOT supported. + HistogramSharedMemory(const HistogramSharedMemory&) = delete; + HistogramSharedMemory& operator=(const HistogramSharedMemory&) = delete; + + // Factory to initialize a shared memory region for |unique_process_id| + // based on |config|. + static absl::optional<HistogramSharedMemory> Create( + int unique_process_id, + const HistogramSharedMemoryConfig& config); + + // Returns true if the memory region and allocator are valid. + bool IsValid() const; + + // Returns, and transfers ownership of, the memory region to the caller. + base::WritableSharedMemoryRegion TakeRegion(); + + // Returns, and transfers ownership of, the memory allocator to the caller. + std::unique_ptr<base::WritableSharedPersistentMemoryAllocator> + TakeAllocator(); + + private: + // Internal constructor. + HistogramSharedMemory( + base::WritableSharedMemoryRegion region, + std::unique_ptr<base::WritableSharedPersistentMemoryAllocator> allocator); + + // The shared memory region. + base::WritableSharedMemoryRegion region_; + + // The shared memory allocator. + std::unique_ptr<base::WritableSharedPersistentMemoryAllocator> allocator_; +}; + +} // namespace base +#endif // BASE_METRICS_HISTOGRAM_SHARED_MEMORY_H_
diff --git a/base/metrics/histogram_shared_memory_unittest.cc b/base/metrics/histogram_shared_memory_unittest.cc new file mode 100644 index 0000000..cfea625 --- /dev/null +++ b/base/metrics/histogram_shared_memory_unittest.cc
@@ -0,0 +1,21 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/metrics/histogram_shared_memory.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace base { + +TEST(HistogramSharedMemory, Default) { + HistogramSharedMemory default_constructed; + EXPECT_FALSE(default_constructed.IsValid()); +} + +TEST(HistogramSharedMemory, Create) { + auto memory = HistogramSharedMemory::Create(1234, {"Test", 1 << 20}); + ASSERT_TRUE(memory.has_value()); + EXPECT_TRUE(memory->IsValid()); +} + +} // namespace base
diff --git a/base/values.cc b/base/values.cc index 7bf83e1..6ea1223 100644 --- a/base/values.cc +++ b/base/values.cc
@@ -1156,22 +1156,6 @@ return GetDict().Set(key, std::move(value)); } -Value* Value::SetStringKey(StringPiece key, StringPiece value) { - return GetDict().Set(key, value); -} - -Value* Value::SetStringKey(StringPiece key, StringPiece16 value) { - return GetDict().Set(key, value); -} - -Value* Value::SetStringKey(StringPiece key, const char* value) { - return GetDict().Set(key, value); -} - -Value* Value::SetStringKey(StringPiece key, std::string&& value) { - return GetDict().Set(key, std::move(value)); -} - bool Value::RemoveKey(StringPiece key) { return GetDict().Remove(key); }
diff --git a/base/values.h b/base/values.h index bbc59a0..84c85b1 100644 --- a/base/values.h +++ b/base/values.h
@@ -766,20 +766,6 @@ // DEPRECATED: Prefer `Value::Dict::Set()`. Value* SetKey(StringPiece key, Value&& value); - // `Set<Type>Key` looks up `key` in the underlying dictionary and associates a - // corresponding Value() constructed from the second parameter. Compared to - // `SetKey()`, this avoids un-necessary temporary `Value()` creation, as well - // ambiguities in the value type. - // - // DEPRECATED: Prefer `Value::Dict::Set()`. - Value* SetStringKey(StringPiece key, StringPiece val); - // DEPRECATED: Prefer `Value::Dict::Set()`. - Value* SetStringKey(StringPiece key, StringPiece16 val); - // DEPRECATED: Prefer `Value::Dict::Set()`. - Value* SetStringKey(StringPiece key, const char* val); - // DEPRECATED: Prefer `Value::Dict::Set()`. - Value* SetStringKey(StringPiece key, std::string&& val); - // This attempts to remove the value associated with `key`. In case of // failure, e.g. the key does not exist, false is returned and the underlying // dictionary is not changed. In case of success, `key` is deleted from the
diff --git a/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java b/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java index 53e926e6..13c7c5d6 100644 --- a/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java +++ b/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java
@@ -237,8 +237,12 @@ @SuppressLint("SetWorldReadable") private static boolean copyIfModified(File src, File dest) throws IOException { long lastModified = src.lastModified(); - if (dest.exists() && dest.lastModified() == lastModified) { - return false; + if (dest.exists()) { + if (dest.lastModified() == lastModified) { + return false; + } + // Files are read-only, so need to explicitly delete. + dest.delete(); } Log.i(TAG, "Copying " + src + " -> " + dest); FileInputStream istream = new FileInputStream(src); @@ -247,7 +251,8 @@ istream.close(); ostream.close(); dest.setReadable(true, false); - dest.setExecutable(true, false); + dest.setWritable(false, false); // Required as of Android U. + dest.setExecutable(true, false); dest.setLastModified(lastModified); return true; }
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn index e72218c..a0db274 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn
@@ -1196,7 +1196,10 @@ "-ObjC", ] - configs += [ "//build/config/compiler:wexit_time_destructors" ] + configs += [ + "//build/config/compiler:enable_arc", + "//build/config/compiler:wexit_time_destructors", + ] } mac_framework_bundle("chrome_framework") {
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index 7d0f3fa..21bafe27 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -296,6 +296,7 @@ "//chrome/android/webapk/libs/common:splash_java", "//chrome/android/webapk/libs/runtime_library:webapk_service_aidl_java", "//chrome/browser/accessibility/hierarchysnapshotter/android:java", + "//chrome/browser/android/auxiliary_search/proto:proto_java", "//chrome/browser/android/browserservices/intents:java", "//chrome/browser/android/browserservices/metrics:java", "//chrome/browser/android/browserservices/verification:java", @@ -563,7 +564,6 @@ "//mojo/public/java/system:system_impl_java", "//mojo/public/mojom/base:base_java", "//net/android:net_java", - "//services/audio/public/java:audio_feature_list_java", "//services/data_decoder/public/cpp/android:safe_json_java", "//services/device/public/java:device_feature_list_java", "//services/device/public/mojom:mojom_java", @@ -880,6 +880,7 @@ "//chrome/android/webapk/libs/common:common_java", "//chrome/android/webapk/libs/common:splash_java", "//chrome/android/webapk/test:junit_test_support", + "//chrome/browser/android/auxiliary_search/proto:proto_java", "//chrome/browser/android/browserservices/intents:java", "//chrome/browser/android/browserservices/intents:junit", "//chrome/browser/android/browserservices/metrics:java", @@ -3258,6 +3259,7 @@ "java/src/org/chromium/chrome/browser/autofill/settings/AutofillPaymentMethodsDelegate.java", "java/src/org/chromium/chrome/browser/autofill/settings/AutofillProfileBridge.java", "java/src/org/chromium/chrome/browser/autofill/settings/VirtualCardEnrollmentFields.java", + "java/src/org/chromium/chrome/browser/auxiliary_search/AuxiliarySearchBridge.java", "java/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTask.java", "java/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskScheduler.java", "java/src/org/chromium/chrome/browser/background_sync/GooglePlayServicesChecker.java",
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index 05103a64..6188ad5 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -159,6 +159,7 @@ "java/src/org/chromium/chrome/browser/autofill/settings/AutofillVirtualCardUnenrollmentDialog.java", "java/src/org/chromium/chrome/browser/autofill/settings/CreditCardNumberFormattingTextWatcher.java", "java/src/org/chromium/chrome/browser/autofill/settings/VirtualCardEnrollmentFields.java", + "java/src/org/chromium/chrome/browser/auxiliary_search/AuxiliarySearchBridge.java", "java/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTask.java", "java/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskScheduler.java", "java/src/org/chromium/chrome/browser/background_sync/GooglePlayServicesChecker.java", @@ -172,6 +173,7 @@ "java/src/org/chromium/chrome/browser/bookmarks/BookmarkDelegate.java", "java/src/org/chromium/chrome/browser/bookmarks/BookmarkFeatures.java", "java/src/org/chromium/chrome/browser/bookmarks/BookmarkFolderRow.java", + "java/src/org/chromium/chrome/browser/bookmarks/BookmarkImageFetcher.java", "java/src/org/chromium/chrome/browser/bookmarks/BookmarkItemRow.java", "java/src/org/chromium/chrome/browser/bookmarks/BookmarkListEntry.java", "java/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerCoordinator.java",
diff --git a/chrome/android/chrome_junit_test_java_sources.gni b/chrome/android/chrome_junit_test_java_sources.gni index 6b0f8f57..dc13555 100644 --- a/chrome/android/chrome_junit_test_java_sources.gni +++ b/chrome/android/chrome_junit_test_java_sources.gni
@@ -1,4 +1,5 @@ chrome_junit_test_java_sources = [ + "java/src/org/chromium/chrome/browser/auxiliary_search/AuxiliarySearchBridgeTest.java", "java/src/org/chromium/chrome/browser/segmentation_platform/ContextualPageActionControllerTest.java", "java/src/org/chromium/chrome/browser/segmentation_platform/PriceTrackingActionProviderTest.java", "java/src/org/chromium/chrome/browser/segmentation_platform/ReaderModeActionProviderTest.java", @@ -44,6 +45,7 @@ "junit/src/org/chromium/chrome/browser/base/SplitPreloaderTest.java", "junit/src/org/chromium/chrome/browser/bookmarks/AddToBookmarksToolbarButtonControllerUnitTest.java", "junit/src/org/chromium/chrome/browser/bookmarks/BasicBookmarkQueryHandlerTest.java", + "junit/src/org/chromium/chrome/browser/bookmarks/BookmarkImageFetcherTest.java", "junit/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerCoordinatorTest.java", "junit/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerMediatorTest.java", "junit/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerViewBinderTest.java",
diff --git a/chrome/android/features/tab_ui/java/res/values/colors.xml b/chrome/android/features/tab_ui/java/res/values/colors.xml index b6f6aa2..2ea6f05 100644 --- a/chrome/android/features/tab_ui/java/res/values/colors.xml +++ b/chrome/android/features/tab_ui/java/res/values/colors.xml
@@ -18,28 +18,28 @@ <!-- Incognito colors for theme refactor 2021. --> <!-- TODO(https://crbug.com/1223976): Use semantic colors for incognito. --> <color name="incognito_tab_action_button_color">@color/baseline_neutral_variant_200</color> - <color name="incognito_tab_action_button_selected_color">@color/baseline_primary_800</color> + <color name="incognito_tab_action_button_selected_color">@color/baseline_primary_20</color> <color name="incognito_tab_bg_color">@color/default_bg_color_dark_elev_4_baseline</color> - <color name="incognito_tab_bg_selected_color">@color/baseline_primary_200</color> + <color name="incognito_tab_bg_selected_color">@color/baseline_primary_80</color> <color name="incognito_tab_group_hovered_bg_color">@color/default_bg_color_dark_elev_1_baseline</color> - <color name="incognito_tab_group_hovered_bg_selected_color">@color/baseline_primary_200_alpha_10</color> + <color name="incognito_tab_group_hovered_bg_selected_color">@color/baseline_primary_80_alpha_10</color> <color name="incognito_tab_title_color">@color/baseline_neutral_100</color> - <color name="incognito_tab_title_selected_color">@color/baseline_primary_800</color> + <color name="incognito_tab_title_selected_color">@color/baseline_primary_20</color> <color name="incognito_tab_thumbnail_placeholder_color">@color/baseline_neutral_variant_200_alpha_15</color> - <color name="incognito_tab_thumbnail_placeholder_selected_color">@color/baseline_primary_100</color> + <color name="incognito_tab_thumbnail_placeholder_selected_color">@color/baseline_primary_90</color> <color name="incognito_tab_tile_number_color">@color/baseline_neutral_100</color> - <color name="incognito_tab_tile_number_selected_color">@color/baseline_primary_800</color> + <color name="incognito_tab_tile_number_selected_color">@color/baseline_primary_20</color> <color name="incognito_tab_grid_dialog_background_color">@color/baseline_neutral_900</color> - <color name="incognito_tab_grid_dialog_ungroup_bar_bg_hovered_color">@color/baseline_primary_200</color> + <color name="incognito_tab_grid_dialog_ungroup_bar_bg_hovered_color">@color/baseline_primary_80</color> - <color name="incognito_tab_grid_dialog_ungroup_bar_text_color">@color/baseline_primary_200</color> + <color name="incognito_tab_grid_dialog_ungroup_bar_text_color">@color/baseline_primary_80</color> <color name="incognito_tab_grid_dialog_ungroup_bar_text_hovered_color">@color/modern_white</color> <color name="incognito_tab_selection_editor_toolbar_bg_color">@color/toolbar_background_primary_dark</color>
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/IncognitoReauthPromoMessageServiceUnitTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/IncognitoReauthPromoMessageServiceUnitTest.java index d6fe824..8e0230d 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/IncognitoReauthPromoMessageServiceUnitTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/IncognitoReauthPromoMessageServiceUnitTest.java
@@ -369,7 +369,8 @@ mMessageObserverMock)); doNothing().when(mMessageObserverMock).messageInvalidate(MessageType.FOR_TESTING); IncognitoReauthManager.setIsIncognitoReauthFeatureAvailableForTesting(/*isAvailable=*/true); - when(mReauthenticatorBridgeMock.canUseAuthentication()).thenReturn(true); + when(mReauthenticatorBridgeMock.canUseAuthenticationWithBiometricOrScreenLock()) + .thenReturn(true); doAnswer(invocation -> { Callback<Boolean> callback = invocation.getArgument(0); callback.onResult(true); @@ -391,7 +392,8 @@ mIncognitoReauthPromoMessageService.review(); IncognitoReauthPromoMessageService.setIsPromoEnabledForTesting(false); - verify(mReauthenticatorBridgeMock, times(1)).canUseAuthentication(); + verify(mReauthenticatorBridgeMock, times(1)) + .canUseAuthenticationWithBiometricOrScreenLock(); verify(mReauthenticatorBridgeMock, times(1)) .reauthenticate(notNull(), /*useLastValidReauth=*/eq(false)); verify(mPrefServiceMock, times(1))
diff --git a/chrome/android/java/res/drawable/ic_incognito_reauth_promo_icon.xml b/chrome/android/java/res/drawable/ic_incognito_reauth_promo_icon.xml index 9f6b32d..5bf19a3 100644 --- a/chrome/android/java/res/drawable/ic_incognito_reauth_promo_icon.xml +++ b/chrome/android/java/res/drawable/ic_incognito_reauth_promo_icon.xml
@@ -20,10 +20,10 @@ android:pathData="M43,26C40.817,26 39,27.828 39,30.143V36H47V30.143C47,27.828 45.183,26 43,26Z" android:strokeWidth="2" android:fillColor="#00000000" - android:strokeColor="@color/baseline_primary_200"/> + android:strokeColor="@color/baseline_primary_80"/> <path android:pathData="M50,33C51.105,33 52,33.895 52,35V45C52,46.105 51.105,47 50,47H36C34.895,47 34,46.105 34,45V35C34,33.895 34.895,33 36,33H50ZM43,42C41.895,42 41,41.105 41,40C41,38.895 41.895,38 43,38C44.105,38 45,38.895 45,40C45,41.105 44.105,42 43,42Z" - android:fillColor="@color/baseline_primary_200" + android:fillColor="@color/baseline_primary_80" android:fillType="evenOdd"/> <path android:pathData="M8.25,24.584H33.75V26.001H8.25V24.584Z"
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/AutofillPaymentMethodsFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/AutofillPaymentMethodsFragment.java index d9ca58a..7254a4f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/AutofillPaymentMethodsFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/AutofillPaymentMethodsFragment.java
@@ -142,17 +142,13 @@ if (ChromeFeatureList.isEnabled( ChromeFeatureList.AUTOFILL_ENABLE_PAYMENTS_MANDATORY_REAUTH)) { if (mReauthenticatorBridge == null) { - // The DeviceAuthRequester value also determines canUseAuthentication() underlying - // logic. Here we set a value to ensure it checks biometric only (exclude screen - // lock). - // TODO(crbug.com/1434875): Update when we split canUseAuthentication() function. mReauthenticatorBridge = ReauthenticatorBridge.create( DeviceAuthRequester.PAYMENT_METHODS_REAUTH_IN_SETTINGS); } // We don't show the Reauth toggle when Autofill credit card is disabled or the device // doesn't have biometric auth. if (PersonalDataManager.isAutofillCreditCardEnabled() - && mReauthenticatorBridge.canUseAuthentication()) { + && mReauthenticatorBridge.canUseAuthenticationWithBiometric()) { ChromeSwitchPreference mandatoryReauthSwitch = new ChromeSwitchPreference(getStyledContext(), null); mandatoryReauthSwitch.setTitle(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/auxiliary_search/AuxiliarySearchBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/auxiliary_search/AuxiliarySearchBridge.java new file mode 100644 index 0000000..79b12e9 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/auxiliary_search/AuxiliarySearchBridge.java
@@ -0,0 +1,60 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.auxiliary_search; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; + +import com.google.protobuf.InvalidProtocolBufferException; + +import org.chromium.base.annotations.NativeMethods; +import org.chromium.chrome.browser.auxiliary_search.AuxiliarySearchGroupProto.AuxiliarySearchGroup; +import org.chromium.chrome.browser.flags.ChromeFeatureList; +import org.chromium.chrome.browser.profiles.Profile; + +/** + * Java bridge to provide information for the auxiliary search. + */ +public class AuxiliarySearchBridge { + private long mNativeBridge; + + /** + * Constructs a bridge for the auxiliary search provider. + * + * @param profile The Profile to retrieve the corresponding information. + */ + public AuxiliarySearchBridge(@NonNull Profile profile) { + if (!ChromeFeatureList.isEnabled(ChromeFeatureList.ANDROID_APP_INTEGRATION) + || profile.isOffTheRecord()) { + mNativeBridge = 0; + } else { + mNativeBridge = AuxiliarySearchBridgeJni.get().getForProfile(profile); + } + } + + /** + * @return AuxiliarySearchGroup, which is necessary for the auxiliary search. + */ + public @Nullable AuxiliarySearchGroup getSearchableData() { + if (mNativeBridge != 0) { + try { + return AuxiliarySearchGroup.parseFrom( + AuxiliarySearchBridgeJni.get().getSearchableData(mNativeBridge)); + + } catch (InvalidProtocolBufferException e) { + } + } + + return null; + } + + @NativeMethods + @VisibleForTesting + public interface Natives { + long getForProfile(Profile profile); + byte[] getSearchableData(long nativeAuxiliarySearchProvider); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/auxiliary_search/AuxiliarySearchBridgeTest.java b/chrome/android/java/src/org/chromium/chrome/browser/auxiliary_search/AuxiliarySearchBridgeTest.java new file mode 100644 index 0000000..4e0af8af --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/auxiliary_search/AuxiliarySearchBridgeTest.java
@@ -0,0 +1,101 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.auxiliary_search; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.verify; + +import androidx.test.filters.SmallTest; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.robolectric.annotation.Config; + +import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.base.test.util.JniMocker; +import org.chromium.chrome.browser.auxiliary_search.AuxiliarySearchGroupProto.AuxiliarySearchGroup; +import org.chromium.chrome.browser.flags.ChromeFeatureList; +import org.chromium.chrome.browser.profiles.Profile; +import org.chromium.chrome.test.util.browser.Features; + +/** + * Unit tests for {@link AuxiliarySearchBridge} + */ +@RunWith(BaseRobolectricTestRunner.class) +@Config(manifest = Config.NONE) +@Features.EnableFeatures({ChromeFeatureList.ANDROID_APP_INTEGRATION}) +public final class AuxiliarySearchBridgeTest { + private static final String TAB_TITLE = "tab"; + private static final String BOOKMAEK_TITLE = "bookmark"; + private static final String TAB_URL = "https://tab.google.com"; + private static final String BOOKMAEK_URL = "https://bookmark.google.com"; + private static final long FAKE_NATIVE_PROVIDER = 1; + + @Mock + private AuxiliarySearchBridge.Natives mMockAuxiliarySearchBridgeJni; + @Mock + private Profile mProfile; + + @Rule + public JniMocker mJniMocker = new JniMocker(); + @Rule + public TestRule mProcessor = new Features.JUnitProcessor(); + + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); + mJniMocker.mock(AuxiliarySearchBridgeJni.TEST_HOOKS, mMockAuxiliarySearchBridgeJni); + } + + @After + public void tearDown() {} + + @Test + @SmallTest + public void getForProfileTest() { + doReturn(false).when(mProfile).isOffTheRecord(); + AuxiliarySearchBridge bridge = new AuxiliarySearchBridge(mProfile); + + verify(mMockAuxiliarySearchBridgeJni).getForProfile(mProfile); + } + + @Test + @SmallTest + public void getSearchableDataTest() { + doReturn(false).when(mProfile).isOffTheRecord(); + + var tab = + AuxiliarySearchGroup.Entry.newBuilder().setTitle(TAB_TITLE).setUrl(TAB_URL).build(); + var bookmark = AuxiliarySearchGroup.Entry.newBuilder() + .setTitle(BOOKMAEK_TITLE) + .setUrl(BOOKMAEK_URL) + .build(); + var proto = AuxiliarySearchGroup.newBuilder().addTabs(tab).addBookmarks(bookmark).build(); + + doReturn(FAKE_NATIVE_PROVIDER).when(mMockAuxiliarySearchBridgeJni).getForProfile(mProfile); + doReturn(proto.toByteArray()) + .when(mMockAuxiliarySearchBridgeJni) + .getSearchableData(FAKE_NATIVE_PROVIDER); + + AuxiliarySearchBridge bridge = new AuxiliarySearchBridge(mProfile); + verify(mMockAuxiliarySearchBridgeJni).getForProfile(mProfile); + + AuxiliarySearchGroup group = bridge.getSearchableData(); + + assertEquals(group.getTabsCount(), 1); + assertEquals(group.getBookmarksCount(), 1); + assertEquals(group.getTabs(0).getTitle(), TAB_TITLE); + assertEquals(group.getTabs(0).getUrl(), TAB_URL); + assertEquals(group.getBookmarks(0).getTitle(), BOOKMAEK_TITLE); + assertEquals(group.getBookmarks(0).getUrl(), BOOKMAEK_URL); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/auxiliary_search/OWNERS b/chrome/android/java/src/org/chromium/chrome/browser/auxiliary_search/OWNERS new file mode 100644 index 0000000..603b9cf --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/auxiliary_search/OWNERS
@@ -0,0 +1 @@ +file://components/omnibox/browser/android/OWNERS
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkImageFetcher.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkImageFetcher.java new file mode 100644 index 0000000..fc26b8f --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkImageFetcher.java
@@ -0,0 +1,158 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.bookmarks; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; +import android.util.Pair; + +import org.chromium.base.Callback; +import org.chromium.chrome.R; +import org.chromium.chrome.browser.ui.favicon.FaviconUtils; +import org.chromium.components.bookmarks.BookmarkId; +import org.chromium.components.bookmarks.BookmarkItem; +import org.chromium.components.browser_ui.widget.RoundedIconGenerator; +import org.chromium.components.favicon.LargeIconBridge; +import org.chromium.components.image_fetcher.ImageFetcher; + +import java.util.Iterator; + +/** Class which encapsulates fetching images for bookmarks. */ +public class BookmarkImageFetcher { + private final Context mContext; + private final BookmarkModel mBookmarkModel; + private final ImageFetcher mImageFetcher; + private final LargeIconBridge mLargeIconBridge; + private final int mFaviconFetchSize; + + private RoundedIconGenerator mRoundedIconGenerator; + private int mImageSize; + private int mFaviconSize; + + /** + * @param context The context used to create drawables. + * @param bookmarkModel The bookmark model used to query information on bookmarks. + * @param imageFetcher The image fetcher used to fetch images. + * @param largeIconBridge The large icon fetcher used to fetch favicons. + * @param roundedIconGenerator Generates fallback images for bookmark favicons. + * @param imageSize The size when fetching an image. Used for scaling. + * @param faviconSize The size when fetching a favicon. Used for scaling. + */ + public BookmarkImageFetcher(Context context, BookmarkModel bookmarkModel, + ImageFetcher imageFetcher, LargeIconBridge largeIconBridge, + RoundedIconGenerator roundedIconGenerator, int imageSize, int faviconSize) { + mContext = context; + mBookmarkModel = bookmarkModel; + mImageFetcher = imageFetcher; + mLargeIconBridge = largeIconBridge; + mFaviconFetchSize = + mContext.getResources().getDimensionPixelSize(R.dimen.default_favicon_min_size); + mRoundedIconGenerator = roundedIconGenerator; + mImageSize = imageSize; + mFaviconSize = faviconSize; + } + + /** + * Setup the properties required for fetching. + * @param roundedIconGenerator Generates fallback images for bookmark favicons. + * @param imageSize The size when fetching an image. Used for scaling. + * @param faviconSize The size when fetching a favicon. Used for scaling. + */ + public void setupFetchProperties( + RoundedIconGenerator roundedIconGenerator, int imageSize, int faviconSize) { + mRoundedIconGenerator = roundedIconGenerator; + mImageSize = imageSize; + mFaviconSize = faviconSize; + } + + /** + * Returns the first two images for the given folder. + * @param folder The folder to fetch the images for. + * @param callback The callback to receive the images. + */ + public void fetchFirstTwoImagesForFolder( + BookmarkItem folder, Callback<Pair<Drawable, Drawable>> callback) { + fetchFirstTwoImagesForFolderImpl(mBookmarkModel.getChildIds(folder.getId()).iterator(), + /*firstDrawable=*/null, /*secondDrawable=*/null, callback); + } + + /** + * Returns a drawable with the image for the given bookmark. If none is found, then it falls + * back to the favicon + * @param item The bookmark to fetch the image for. + * @param callback The callback to receive the image. + */ + public void fetchImageForBookmarkWithFaviconFallback( + BookmarkItem item, Callback<Drawable> callback) { + fetchImageForBookmark(item, drawable -> { + if (drawable == null) { + fetchFaviconForBookmark(item, callback); + } else { + callback.onResult(drawable); + } + }); + } + + /** + * Fetches a favicon for the given bookmarkid. + * @param item The bookmark to fetch the image for. + * @param callback The callback to receive the favicon. + */ + public void fetchFaviconForBookmark(BookmarkItem item, Callback<Drawable> callback) { + mLargeIconBridge.getLargeIconForUrl(item.getUrl(), mFaviconFetchSize, + (Bitmap icon, int fallbackColor, boolean isFallbackColorDefault, int iconType) -> { + callback.onResult(FaviconUtils.getIconDrawableWithoutFilter(icon, item.getUrl(), + fallbackColor, mRoundedIconGenerator, mContext.getResources(), + mFaviconSize)); + }); + } + + private void fetchImageForBookmark(BookmarkItem item, Callback<Drawable> callback) { + final Callback<Bitmap> bookmarkImageCallback = (image) -> { + if (image == null) { + callback.onResult(null); + } else { + callback.onResult(new BitmapDrawable(mContext.getResources(), image)); + } + }; + + mBookmarkModel.getImageUrlForBookmark(item.getUrl(), (imageUrl) -> { + if (imageUrl == null) { + callback.onResult(null); + return; + } + + mImageFetcher.fetchImage( + ImageFetcher.Params.create(imageUrl, ImageFetcher.POWER_BOOKMARKS_CLIENT_NAME, + mImageSize, mImageSize), + bookmarkImageCallback); + }); + } + + private void fetchFirstTwoImagesForFolderImpl(Iterator<BookmarkId> childIdIterator, + Drawable firstDrawable, Drawable secondDrawable, + Callback<Pair<Drawable, Drawable>> callback) { + if (!childIdIterator.hasNext() || (firstDrawable != null && secondDrawable != null)) { + callback.onResult(new Pair<>(firstDrawable, secondDrawable)); + return; + } + + BookmarkId id = childIdIterator.next(); + BookmarkItem item = mBookmarkModel.getBookmarkById(id); + fetchImageForBookmark(item, drawable -> { + Drawable newFirstDrawable = firstDrawable; + Drawable newSecondDrawable = secondDrawable; + if (newFirstDrawable == null) { + newFirstDrawable = drawable; + } else { + newSecondDrawable = drawable; + } + fetchFirstTwoImagesForFolderImpl( + childIdIterator, newFirstDrawable, newSecondDrawable, callback); + }); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkItemRow.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkItemRow.java index 4631e38..3e875070 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkItemRow.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkItemRow.java
@@ -48,8 +48,7 @@ super(context, attrs); final @BookmarkRowDisplayPref int displayPref = BookmarkUiPrefs.getDisplayPrefForLegacy(); - mIconGenerator = - BookmarkUtils.getRoundedIconGenerator(getContext(), getResources(), displayPref); + mIconGenerator = BookmarkUtils.getRoundedIconGenerator(getContext(), displayPref); mFetchFaviconSize = BookmarkUtils.getFaviconFetchSize(getResources()); mDisplayFaviconSize = BookmarkUtils.getFaviconDisplaySize(getResources(), displayPref); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerMediator.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerMediator.java index 247fc45..fc8f17b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerMediator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerMediator.java
@@ -8,9 +8,6 @@ import android.content.Context; import android.content.res.Resources; -import android.graphics.Bitmap; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.Pair; @@ -18,7 +15,6 @@ import androidx.annotation.VisibleForTesting; import androidx.recyclerview.widget.RecyclerView; -import org.chromium.base.Callback; import org.chromium.base.ObserverList; import org.chromium.base.metrics.RecordUserAction; import org.chromium.base.supplier.ObservableSupplierImpl; @@ -35,13 +31,11 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksReader; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.browser.ui.favicon.FaviconUtils; import org.chromium.chrome.browser.ui.native_page.BasicNativePage; import org.chromium.chrome.browser.ui.signin.SyncPromoController.SyncPromoState; import org.chromium.components.bookmarks.BookmarkId; import org.chromium.components.bookmarks.BookmarkItem; import org.chromium.components.bookmarks.BookmarkType; -import org.chromium.components.browser_ui.widget.RoundedIconGenerator; import org.chromium.components.browser_ui.widget.dragreorder.DragReorderableRecyclerViewAdapter; import org.chromium.components.browser_ui.widget.dragreorder.DragReorderableRecyclerViewAdapter.DragListener; import org.chromium.components.browser_ui.widget.dragreorder.DragReorderableRecyclerViewAdapter.DraggabilityProvider; @@ -280,6 +274,12 @@ private final BookmarkUiPrefs.Observer mBookmarkUiPrefsObserver = new Observer() { @Override public void onBookmarkRowDisplayPrefChanged(@BookmarkRowDisplayPref int displayPref) { + Resources res = mContext.getResources(); + mBookmarkImageFetcher.setupFetchProperties( + BookmarkUtils.getRoundedIconGenerator(mContext, displayPref), + BookmarkUtils.getDisplayIconSize(res, displayPref), + BookmarkUtils.getFaviconDisplaySize(res, displayPref)); + mModelList.clear(); if (getCurrentUiMode() == BookmarkUiMode.SEARCHING) { search(mSearchText); @@ -319,11 +319,8 @@ private final BookmarkQueryHandler mBookmarkQueryHandler; private final ModelList mModelList; private final BookmarkUiPrefs mBookmarkUiPrefs; - private final RoundedIconGenerator mIconGenerator; - private final int mFetchFaviconSize; - private final int mDisplayFaviconSize; private final Runnable mHideKeyboardRunnable; - private final ImageFetcher mImageFetcher; + private final BookmarkImageFetcher mBookmarkImageFetcher; // Whether this instance has been destroyed. private boolean mIsDestroyed; @@ -378,15 +375,14 @@ mBookmarkUiPrefs = bookmarkUiPrefs; mBookmarkUiPrefs.addObserver(mBookmarkUiPrefsObserver); mHideKeyboardRunnable = hideKeyboardRunnable; - mImageFetcher = imageFetcher; + Resources res = mContext.getResources(); final @BookmarkRowDisplayPref int displayPref = mBookmarkUiPrefs.getBookmarkRowDisplayPref(); - mIconGenerator = BookmarkUtils.getRoundedIconGenerator( - mContext, mContext.getResources(), displayPref); - mFetchFaviconSize = BookmarkUtils.getFaviconFetchSize(mContext.getResources()); - mDisplayFaviconSize = - BookmarkUtils.getFaviconDisplaySize(mContext.getResources(), displayPref); + mBookmarkImageFetcher = new BookmarkImageFetcher(mContext, mBookmarkModel, imageFetcher, + mLargeIconBridge, BookmarkUtils.getRoundedIconGenerator(mContext, displayPref), + BookmarkUtils.getDisplayIconSize(res, displayPref), + BookmarkUtils.getFaviconDisplaySize(res, displayPref)); // Previously we were waiting for BookmarkModel to be loaded, but it's not necessary. PartnerBookmarksReader.addFaviconUpdateObserver(this); @@ -1070,9 +1066,9 @@ // TODO(crbug.com/1440863): Support reading list special placeholder case. model.set(ImprovedBookmarkRowProperties.FOLDER_DRAWABLES, new Pair<>(null, null)); - // TODO(crbug.com/1444251): Extract fetching logic to standalone class. - resolveFolderDrawables(model, /*primaryDrawable=*/null, /*secondaryDrawable=*/null, - mBookmarkModel.getChildIds(item.getId()), /*index=*/0); + mBookmarkImageFetcher.fetchFirstTwoImagesForFolder(item, imagePair -> { + model.set(ImprovedBookmarkRowProperties.FOLDER_DRAWABLES, imagePair); + }); } else { model.set(ImprovedBookmarkRowProperties.BOOKMARK_DRAWABLE, @@ -1080,73 +1076,15 @@ } } else { if (useImages) { - // TODO(crbug.com/1444251): Extract fetching logic to standalone class. - getBookmarkDrawable(item.getId(), (drawable) -> { - if (drawable == null) { - resolveFaviconForBookmark(item, model); - } else { - model.set(ImprovedBookmarkRowProperties.BOOKMARK_DRAWABLE, drawable); - } + mBookmarkImageFetcher.fetchImageForBookmarkWithFaviconFallback(item, image -> { + model.set(ImprovedBookmarkRowProperties.BOOKMARK_DRAWABLE, image); }); } else { - resolveFaviconForBookmark(item, model); - } - } - } - - private void resolveFolderDrawables(PropertyModel model, Drawable primaryDrawable, - Drawable secondaryDrawable, List<BookmarkId> childIds, int index) { - if (index == childIds.size() || (primaryDrawable != null && secondaryDrawable != null)) { - model.set(ImprovedBookmarkRowProperties.FOLDER_DRAWABLES, - new Pair<>(primaryDrawable, secondaryDrawable)); - return; - } - - BookmarkItem item = mBookmarkModel.getBookmarkById(childIds.get(index)); - getBookmarkDrawable(childIds.get(index), (drawable) -> { - Drawable newPrimaryDrawable = primaryDrawable; - Drawable newSecondaryDrawable = secondaryDrawable; - if (newPrimaryDrawable == null) { - newPrimaryDrawable = drawable; - } else { - newSecondaryDrawable = drawable; - } - resolveFolderDrawables( - model, newPrimaryDrawable, newSecondaryDrawable, childIds, index + 1); - }); - } - - private void getBookmarkDrawable(BookmarkId id, Callback<BitmapDrawable> callback) { - BookmarkItem item = mBookmarkModel.getBookmarkById(id); - mBookmarkModel.getImageUrlForBookmark(item.getUrl(), (imageUrl) -> { - if (imageUrl == null) { - callback.onResult(null); - return; - } - - Resources res = mContext.getResources(); - int size = BookmarkUtils.getDisplayIconSize( - res, mBookmarkUiPrefs.getBookmarkRowDisplayPref()); - mImageFetcher.fetchImage(ImageFetcher.Params.create(imageUrl, - ImageFetcher.POWER_BOOKMARKS_CLIENT_NAME, size, size), - (image) -> { - if (image == null) { - callback.onResult(null); - } else { - callback.onResult(new BitmapDrawable(res, image)); - } - }); - }); - } - - private void resolveFaviconForBookmark(BookmarkItem item, PropertyModel model) { - mLargeIconBridge.getLargeIconForUrl(item.getUrl(), mFetchFaviconSize, - (Bitmap icon, int fallbackColor, boolean isFallbackColorDefault, int iconType) -> { - Drawable iconDrawable = FaviconUtils.getIconDrawableWithoutFilter(icon, - item.getUrl(), fallbackColor, mIconGenerator, mContext.getResources(), - mDisplayFaviconSize); - model.set(ImprovedBookmarkRowProperties.BOOKMARK_DRAWABLE, iconDrawable); + mBookmarkImageFetcher.fetchFaviconForBookmark(item, image -> { + model.set(ImprovedBookmarkRowProperties.BOOKMARK_DRAWABLE, image); }); + } + } } @VisibleForTesting @@ -1254,6 +1192,7 @@ } // Testing methods. + /** Whether to prevent the bookmark model from fully loading for testing. */ static void preventLoadingForTesting(boolean preventLoading) { sPreventLoadingForTesting = preventLoading;
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 ea42ab0..d67b6b1 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
@@ -667,14 +667,15 @@ /** Returns the RoundedIconGenerator with the appropriate size. */ public static RoundedIconGenerator getRoundedIconGenerator( - Context context, Resources resources, @BookmarkRowDisplayPref int displayPref) { + Context context, @BookmarkRowDisplayPref int displayPref) { + Resources res = context.getResources(); boolean visual = displayPref == BookmarkRowDisplayPref.VISUAL; - int displayIconSize = getDisplayIconSize(resources, displayPref); + int displayIconSize = getDisplayIconSize(res, displayPref); return visual ? new RoundedIconGenerator(displayIconSize, displayIconSize, displayIconSize / 2, context.getColor(R.color.default_favicon_background_color), - getDisplayTextSize(resources, displayPref)) + getDisplayTextSize(res, displayPref)) : FaviconUtils.createCircularIconGenerator(context); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineDetector.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineDetector.java index 3649903e..370d2210c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineDetector.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineDetector.java
@@ -4,8 +4,10 @@ package org.chromium.chrome.browser.offlinepages.indicator; +import android.content.Context; import android.os.Handler; import android.os.SystemClock; +import android.provider.Settings; import androidx.annotation.VisibleForTesting; @@ -66,6 +68,7 @@ // True if the network is offline as detected by the connectivity detector. private boolean mIsOfflineLastReportedByConnectivityDetector; + private Context mContext; private Handler mHandler; private Runnable mUpdateOfflineStatusIndicatorDelayedRunnable; @@ -96,6 +99,12 @@ // from "online" to "offline" or when we are notified that the device is online" at the end. private long mTimeWhenLastOnline; + // Last time airplane mode switched from "on" to "off". Updated when we detect that airplane + // mode changed. + private long mTimeWhenAirplaneModeToggledOff; + + private boolean mInAirplaneMode; + // Set to true if adb console logging should be enabled. private static final boolean sLoggingEnabled = VersionInfo.isCanaryBuild() || VersionInfo.isDevBuild() || VersionInfo.isLocalBuild(); @@ -104,12 +113,17 @@ /** * Constructs the offline indicator. - * @param callback The {@link callback} is invoked when the connectivity status is stable and - * has changed. + * @param isOfflineCallback The {@link Callback} is invoked when the connectivity status is + * stable and has changed. + * @param isForegroundCallback The {@link Callback} is invoked when the application state + * changes. + * @param context The {@link Context} used to resolve device settings. */ - OfflineDetector(Callback<Boolean> isOfflineCallback, Callback<Boolean> isForegroundCallback) { + OfflineDetector(Callback<Boolean> isOfflineCallback, Callback<Boolean> isForegroundCallback, + Context context) { mIsOfflineCallback = isOfflineCallback; mIsForegroundCallback = isForegroundCallback; + mContext = context; mHandler = new Handler(); mStatusIndicatorWaitOnSwitchOnlineToOfflineDurationMs = STATUS_INDICATOR_WAIT_ON_SWITCH_ONLINE_TO_OFFLINE_DEFAULT_DURATION_MS; @@ -128,11 +142,13 @@ // Connection state has not changed since |mUpdateOfflineStatusIndicatorDelayedRunnable| // was posted. + boolean wasEffectivelyOffline = mIsEffectivelyOffline; + mIsEffectivelyOffline = + mIsOfflineLastReportedByConnectivityDetector && !mInAirplaneMode; if (mIsEffectivelyOfflineInitialized - && mIsOfflineLastReportedByConnectivityDetector == mIsEffectivelyOffline) { + && wasEffectivelyOffline == mIsEffectivelyOffline) { return; } - mIsEffectivelyOffline = mIsOfflineLastReportedByConnectivityDetector; mIsEffectivelyOfflineInitialized = true; mIsOfflineCallback.onResult(mIsEffectivelyOffline); if (sLoggingEnabled) { @@ -159,18 +175,18 @@ mIsOfflineLastReportedByConnectivityDetector; mIsOfflineLastReportedByConnectivityDetector = (connectionState != ConnectionState.VALIDATED); + boolean wasInAirplaneMode = mInAirplaneMode; + mInAirplaneMode = Settings.System.getInt(mContext.getContentResolver(), + Settings.Global.AIRPLANE_MODE_ON, 0) + != 0; + if (mConnectivityDetectorInitialized && previousLastReportedStateByOfflineDetector - == mIsOfflineLastReportedByConnectivityDetector) { + == mIsOfflineLastReportedByConnectivityDetector + && wasInAirplaneMode == mInAirplaneMode) { return; } - if (sLoggingEnabled) { - logToAdbConsoleNow("Received connection change state message."); - Log.i(TAG, "onConnectionStateChanged(): previousLastReportedStateByOfflineDetector: %b", - previousLastReportedStateByOfflineDetector); - } - if (mIsOfflineLastReportedByConnectivityDetector) { mTimeWhenLastOfflineNotificationReceived = getElapsedTime(); } @@ -185,8 +201,18 @@ mTimeWhenLastOnline = getElapsedTime(); } + if (wasInAirplaneMode && !mInAirplaneMode) { + mTimeWhenAirplaneModeToggledOff = getElapsedTime(); + } + mConnectivityDetectorInitialized = true; + if (sLoggingEnabled) { + logToAdbConsoleNow("Received connection change state message."); + Log.i(TAG, "onConnectionStateChanged(): previousLastReportedStateByOfflineDetector: %b", + previousLastReportedStateByOfflineDetector); + } + updateState(); } @@ -197,12 +223,16 @@ + " getElapsedTime: %d," + " mTimeWhenLastOfflineNotificationReceived: %d," + " mTimeWhenLastOnline: %d," + + " mTimeWhenAirplaneModeToggledOff: %d" + " mApplicationState: %d," + " mIsOfflineLastReportedByConnectivityDetector: %b," + + " mInAirplaneMode: %b" + " mIsEffectivelyOffline: %b", mConnectivityDetectorInitialized, mTimeWhenLastForegrounded, getElapsedTime(), - mTimeWhenLastOfflineNotificationReceived, mTimeWhenLastOnline, mApplicationState, - mIsOfflineLastReportedByConnectivityDetector, mIsEffectivelyOffline); + mTimeWhenLastOfflineNotificationReceived, mTimeWhenLastOnline, + mTimeWhenAirplaneModeToggledOff, mApplicationState, + mIsOfflineLastReportedByConnectivityDetector, mInAirplaneMode, + mIsEffectivelyOffline); } /* @@ -275,6 +305,8 @@ final long timeSinceOfflineNotificationReceived = getElapsedTime() - mTimeWhenLastOfflineNotificationReceived; final long timeSinceLastOnline = getElapsedTime() - mTimeWhenLastOnline; + final long timeSinceAirplaneModeToggledOff = + getElapsedTime() - mTimeWhenAirplaneModeToggledOff; final long timeNeededForForeground = STATUS_INDICATOR_WAIT_ON_OFFLINE_DURATION_MS - timeSinceLastForeground; @@ -287,29 +319,42 @@ ? mStatusIndicatorWaitOnSwitchOnlineToOfflineDurationMs - timeSinceLastOnline : 0; + final long timeNeededAfterConnectionChangeFromAirplaneToOffline = + mTimeWhenAirplaneModeToggledOff > 0 + ? mStatusIndicatorWaitOnSwitchOnlineToOfflineDurationMs + - timeSinceAirplaneModeToggledOff + : 0; + assert mUpdateOfflineStatusIndicatorDelayedRunnable != null; logToAdbConsoleNow("Running updateState"); Log.i(TAG, "updateState(): timeSinceLastForeground: %d," + " timeSinceOfflineNotificationReceived: %d, timeSinceLastOnline: %d," - + " timeNeededForForeground: %d, timeNeededForOffline: %d", + + " timeNeededForForeground: %d, timeNeededForOffline: %d" + + " timeSinceAirplaneModeToggledOff: %d" + + " timeNeededAfterConnectionChangeFromOnlineToOffline: %d" + + " timeNeededAfterConnectionChangeFromAirplaneToOffline: %d", timeSinceLastForeground, timeSinceOfflineNotificationReceived, timeSinceLastOnline, - timeNeededForForeground, timeNeededForOffline); + timeNeededForForeground, timeNeededForOffline, timeSinceAirplaneModeToggledOff, + timeNeededAfterConnectionChangeFromOnlineToOffline, + timeNeededAfterConnectionChangeFromAirplaneToOffline); // If the connection is online, report the state immediately. Alternatively, if the app has // been in foreground and connection has been offline for sufficient time, then report the // state immediately. if (!mIsOfflineLastReportedByConnectivityDetector || (timeNeededForForeground <= 0 && timeNeededForOffline <= 0 - && timeNeededAfterConnectionChangeFromOnlineToOffline <= 0)) { + && timeNeededAfterConnectionChangeFromOnlineToOffline <= 0 + && timeNeededAfterConnectionChangeFromAirplaneToOffline <= 0)) { mUpdateOfflineStatusIndicatorDelayedRunnable.run(); return; } // Wait before calling |mUpdateOfflineStatusIndicatorDelayedRunnable|. mHandler.postDelayed(mUpdateOfflineStatusIndicatorDelayedRunnable, - Math.max(Math.max(timeNeededForForeground, timeNeededForOffline), - timeNeededAfterConnectionChangeFromOnlineToOffline)); + Math.max(Math.max(Math.max(timeNeededForForeground, timeNeededForOffline), + timeNeededAfterConnectionChangeFromOnlineToOffline), + timeNeededAfterConnectionChangeFromAirplaneToOffline)); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerV2.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerV2.java index 013cd628..9734f0c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerV2.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerV2.java
@@ -4,6 +4,7 @@ package org.chromium.chrome.browser.offlinepages.indicator; +import android.annotation.SuppressLint; import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Handler; @@ -57,6 +58,7 @@ public static final String OFFLINE_INDICATOR_SHOWN_DURATION_V2 = "OfflineIndicator.ShownDurationV2"; + @SuppressLint("StaticFieldLeak") private static OfflineDetector sMockOfflineDetector; private static Supplier<Long> sMockElapsedTimeSupplier; private static OfflineIndicatorMetricsDelegate sMockOfflineIndicatorMetricsDelegate; @@ -120,7 +122,7 @@ } else { mOfflineDetector = new OfflineDetector((Boolean offline) -> onConnectionStateChanged(offline), - (Boolean isForeground) -> onApplicationStateChanged(isForeground)); + (Boolean isForeground) -> onApplicationStateChanged(isForeground), mContext); } // Initializes the application state.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/settings/AutofillPaymentMethodsFragmentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/settings/AutofillPaymentMethodsFragmentTest.java index 42e956cb..0f55a70 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/settings/AutofillPaymentMethodsFragmentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/settings/AutofillPaymentMethodsFragmentTest.java
@@ -302,7 +302,7 @@ @Policies.Add({ @Policies.Item(key = "AutofillCreditCardEnabled", string = "false") }) public void testMandatoryReauthToggle_notShownWhenAutofillDisabled() throws Exception { // Simulate the user can authenticate with biometric. - when(mReauthenticatorMock.canUseAuthentication()).thenReturn(true); + when(mReauthenticatorMock.canUseAuthenticationWithBiometric()).thenReturn(true); SettingsActivity activity = mSettingsActivityTestRule.startSettingsActivity(); @@ -317,7 +317,7 @@ @Features.EnableFeatures({ChromeFeatureList.AUTOFILL_ENABLE_PAYMENTS_MANDATORY_REAUTH}) public void testMandatoryReauthToggle_notShownWhenBiometricIsDisabled() throws Exception { // Simulate the user can't authenticate with biometric. - when(mReauthenticatorMock.canUseAuthentication()).thenReturn(false); + when(mReauthenticatorMock.canUseAuthenticationWithBiometric()).thenReturn(false); SettingsActivity activity = mSettingsActivityTestRule.startSettingsActivity(); @@ -336,7 +336,7 @@ getPrefService().setBoolean(Pref.AUTOFILL_PAYMENT_METHODS_MANDATORY_REAUTH, true); }); // Simulate the user can authenticate with biometric, so that Reauth toggle can be shown. - when(mReauthenticatorMock.canUseAuthentication()).thenReturn(true); + when(mReauthenticatorMock.canUseAuthenticationWithBiometric()).thenReturn(true); SettingsActivity activity = mSettingsActivityTestRule.startSettingsActivity(); @@ -360,7 +360,7 @@ getPrefService().setBoolean(Pref.AUTOFILL_PAYMENT_METHODS_MANDATORY_REAUTH, false); }); // Simulate the user can authenticate with biometric, so that Reauth toggle can be shown. - when(mReauthenticatorMock.canUseAuthentication()).thenReturn(true); + when(mReauthenticatorMock.canUseAuthenticationWithBiometric()).thenReturn(true); SettingsActivity activity = mSettingsActivityTestRule.startSettingsActivity(); @@ -390,7 +390,7 @@ getPrefService().setBoolean(Pref.AUTOFILL_PAYMENT_METHODS_MANDATORY_REAUTH, true); }); // Simulate the user can authenticate with biometric, so that Reauth toggle can be shown. - when(mReauthenticatorMock.canUseAuthentication()).thenReturn(true); + when(mReauthenticatorMock.canUseAuthenticationWithBiometric()).thenReturn(true); SettingsActivity activity = mSettingsActivityTestRule.startSettingsActivity(); @@ -421,7 +421,7 @@ getPrefService().setBoolean(Pref.AUTOFILL_PAYMENT_METHODS_MANDATORY_REAUTH, true); }); // Simulate the user can authenticate with biometric, so that Reauth toggle can be shown. - when(mReauthenticatorMock.canUseAuthentication()).thenReturn(true); + when(mReauthenticatorMock.canUseAuthenticationWithBiometric()).thenReturn(true); SettingsActivity activity = mSettingsActivityTestRule.startSettingsActivity(); @@ -455,7 +455,7 @@ getPrefService().setBoolean(Pref.AUTOFILL_PAYMENT_METHODS_MANDATORY_REAUTH, true); }); // Simulate the user can authenticate with biometric, so that Reauth toggle can be shown. - when(mReauthenticatorMock.canUseAuthentication()).thenReturn(true); + when(mReauthenticatorMock.canUseAuthenticationWithBiometric()).thenReturn(true); SettingsActivity activity = mSettingsActivityTestRule.startSettingsActivity(); @@ -521,7 +521,7 @@ getPrefService().setBoolean(Pref.AUTOFILL_PAYMENT_METHODS_MANDATORY_REAUTH, false); }); // Simulate the user can authenticate with biometric, so that Reauth toggle can be shown. - when(mReauthenticatorMock.canUseAuthentication()).thenReturn(true); + when(mReauthenticatorMock.canUseAuthenticationWithBiometric()).thenReturn(true); SettingsActivity activity = mSettingsActivityTestRule.startSettingsActivity();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesTest.java index 0eff452..cdc4471 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesTest.java
@@ -7,10 +7,11 @@ import static org.hamcrest.core.IsEqual.equalTo; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.endsWith; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -26,25 +27,27 @@ import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; -import org.junit.ClassRule; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.MockitoAnnotations; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CriteriaHelper; +import org.chromium.base.test.util.JniMocker; import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.omnibox.LocationBarLayout; import org.chromium.chrome.browser.omnibox.suggestions.AutocompleteController; +import org.chromium.chrome.browser.omnibox.suggestions.AutocompleteControllerJni; import org.chromium.chrome.browser.omnibox.suggestions.AutocompleteControllerProvider; import org.chromium.chrome.browser.omnibox.suggestions.AutocompleteCoordinator; import org.chromium.chrome.browser.omnibox.suggestions.carousel.BaseCarouselSuggestionView; -import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; @@ -84,23 +87,19 @@ private static final String SEARCH_QUERY = "related search query"; private static final int MV_TILE_CAROUSEL_MATCH_POSITION = 1; - @ClassRule - public static final ChromeTabbedActivityTestRule sActivityTestRule = + public final @Rule ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); - @Mock - private Profile mProfile; - - @Mock - private AutocompleteController mController; - - @Captor - private ArgumentCaptor<AutocompleteController.OnSuggestionsReceivedListener> mListener; + public @Rule MockitoRule mMockitoRule = MockitoJUnit.rule(); + public @Rule JniMocker mJniMocker = new JniMocker(); + private @Mock AutocompleteController.Natives mAutocompleteControllerJniMock; + private @Captor ArgumentCaptor<AutocompleteController> mAutocompleteControllerCaptor; private ChromeTabbedActivity mActivity; private LocationBarLayout mLocationBarLayout; private AutocompleteCoordinator mAutocomplete; + private AutocompleteController mController; private EmbeddedTestServer mTestServer; private Tab mTab; private SuggestionInfo<BaseCarouselSuggestionView> mCarousel; @@ -112,36 +111,32 @@ private SuggestTile mTile3; @BeforeClass - public static void setUpClass() throws Exception { - sActivityTestRule.startMainActivityOnBlankPage(); - sActivityTestRule.waitForActivityNativeInitializationComplete(); - } + public static void setUpClass() throws Exception {} @Before public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - AutocompleteControllerProvider.setControllerForTesting(mController); - mActivity = sActivityTestRule.getActivity(); + mJniMocker.mock(AutocompleteControllerJni.TEST_HOOKS, mAutocompleteControllerJniMock); + doReturn(1L).when(mAutocompleteControllerJniMock).create(any(), any()); + + mActivityTestRule.startMainActivityOnBlankPage(); + mActivityTestRule.waitForActivityNativeInitializationComplete(); + + verify(mAutocompleteControllerJniMock, times(1)) + .create(mAutocompleteControllerCaptor.capture(), any()); + mController = mAutocompleteControllerCaptor.getValue(); + + mActivity = mActivityTestRule.getActivity(); mOmnibox = new OmniboxTestUtils(mActivity); mLocationBarLayout = mActivity.findViewById(R.id.location_bar); mAutocomplete = mLocationBarLayout.getAutocompleteCoordinator(); mTab = mActivity.getActivityTab(); - mStartUrl = sActivityTestRule.getTestServer().getURL(START_PAGE_LOCATION); + mStartUrl = mActivityTestRule.getTestServer().getURL(START_PAGE_LOCATION); ChromeTabUtils.waitForInteractable(mTab); ChromeTabUtils.loadUrlOnUiThread(mTab, mStartUrl); ChromeTabUtils.waitForTabPageLoaded(mTab, null); - // clang-format off - TestThreadUtils.runOnUiThreadBlocking(() -> { - mAutocomplete.setAutocompleteProfile(mProfile); - }); - // clang-format on - - verify(mController).addOnSuggestionsReceivedListener(mListener.capture()); - setUpSuggestionsToShow(); - focusOmniboxAndWaitForSuggestions(); mCarousel = mOmnibox.findSuggestionWithType(OmniboxSuggestionUiType.TILE_NAVSUGGEST); } @@ -157,15 +152,15 @@ */ private void setUpSuggestionsToShow() { // Set up basic AutocompleteResult hosting a MostVisitedTiles suggestion. - mTestServer = sActivityTestRule.getTestServer(); + mTestServer = mActivityTestRule.getTestServer(); mTile1 = new SuggestTile("About", new GURL(mTestServer.getURL("/echo/tile1.html")), false); mTile2 = new SuggestTile( "Happy Server", new GURL(mTestServer.getURL("/echo/tile2.html")), false); mTile3 = new SuggestTile( "Test Server", new GURL(mTestServer.getURL("/echo/tile3.html")), false); - AutocompleteResult autocompleteResult = AutocompleteResult.fromCache( - null, GroupsInfo.newBuilder().putGroupConfigs(1, SECTION_2_WITH_HEADER).build()); + AutocompleteResult autocompleteResult = spy(AutocompleteResult.fromCache( + null, GroupsInfo.newBuilder().putGroupConfigs(1, SECTION_2_WITH_HEADER).build())); AutocompleteMatchBuilder builder = new AutocompleteMatchBuilder(); // First suggestion is the current content of the Omnibox. @@ -190,17 +185,11 @@ autocompleteResult.getSuggestionsList().add(builder.build()); builder.reset(); - doAnswer(invocation -> { - mListener.getValue().onSuggestionsReceived(autocompleteResult, mStartUrl, true); - return null; - }) - .when(mController) - .startZeroSuggest(endsWith(START_PAGE_LOCATION), any(), anyInt(), any()); - } + doReturn(true).when(autocompleteResult).verifyCoherency(anyInt(), anyInt()); - private void focusOmniboxAndWaitForSuggestions() { - ChromeTabUtils.waitForInteractable(mTab); mOmnibox.requestFocus(); + TestThreadUtils.runOnUiThreadBlocking( + () -> { mController.onSuggestionsReceived(autocompleteResult, mStartUrl, true); }); mOmnibox.checkSuggestionsShown(); } @@ -319,6 +308,7 @@ final int tileToDelete = 2; ModalDialogManager manager = mAutocomplete.getModalDialogManagerForTest(); longClickTileAtPosition(tileToDelete); + verify(mAutocompleteControllerJniMock, times(1)).stop(anyLong(), /* clear?=*/eq(false)); // Wait for the delete dialog to come up... CriteriaHelper.pollUiThread(() -> { @@ -332,8 +322,9 @@ // ... and go away. CriteriaHelper.pollUiThread(() -> { return manager.getCurrentDialogForTest() == null; }); - verify(mController, times(1)) - .deleteMatchElement(eq(MV_TILE_CAROUSEL_MATCH_POSITION), eq(tileToDelete)); + verify(mAutocompleteControllerJniMock, times(1)) + .deleteMatchElement( + anyLong(), eq(MV_TILE_CAROUSEL_MATCH_POSITION), eq(tileToDelete)); } @Test @@ -353,6 +344,7 @@ // ... and go away. CriteriaHelper.pollUiThread(() -> { return manager.getCurrentDialogForTest() == null; }); - verify(mController, never()).deleteMatchElement(anyInt(), anyInt()); + verify(mAutocompleteControllerJniMock, never()) + .deleteMatchElement(anyLong(), anyInt(), anyInt()); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/Fido2CredentialRequestTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/Fido2CredentialRequestTest.java index 13dae927..de1dd22 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/Fido2CredentialRequestTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/Fido2CredentialRequestTest.java
@@ -44,6 +44,7 @@ import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.base.test.util.Features.EnableFeatures; import org.chromium.base.test.util.JniMocker; import org.chromium.blink.mojom.AuthenticatorAttachment; import org.chromium.blink.mojom.AuthenticatorStatus; @@ -62,6 +63,7 @@ import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule; import org.chromium.chrome.test.util.browser.Features; +import org.chromium.components.payments.PaymentFeatureList; import org.chromium.components.webauthn.AuthenticatorImpl; import org.chromium.components.webauthn.Fido2Api; import org.chromium.components.webauthn.Fido2ApiCallHelper; @@ -1338,11 +1340,11 @@ @Test @SmallTest + @EnableFeatures(PaymentFeatureList.SECURE_PAYMENT_CONFIRMATION) public void testGetAssertion_securePaymentConfirmation_canReplaceClientDataJson() { mIntentSender.setNextResultIntent( Fido2ApiTestHelper.createSuccessfulGetAssertionIntentWithUvm()); - Fido2ApiTestHelper.setSecurePaymentConfirmationEnabled(mMocker); String clientDataJson = "520"; Fido2ApiTestHelper.mockClientDataJson(mMocker, clientDataJson); @@ -1364,11 +1366,11 @@ @Test @SmallTest + @EnableFeatures(PaymentFeatureList.SECURE_PAYMENT_CONFIRMATION) public void testGetAssertion_securePaymentConfirmation_clientDataJsonCannotBeEmpty() { mIntentSender.setNextResultIntent( Fido2ApiTestHelper.createSuccessfulGetAssertionIntentWithUvm()); - Fido2ApiTestHelper.setSecurePaymentConfirmationEnabled(mMocker); Fido2ApiTestHelper.mockClientDataJson(mMocker, null); mFrameHost.setLastCommittedURL(new GURL("https://www.chromium.org/pay")); @@ -1388,6 +1390,7 @@ @Test @SmallTest + @EnableFeatures(PaymentFeatureList.SECURE_PAYMENT_CONFIRMATION) public void testGetAssertion_securePaymentConfirmation_buildClientDataJsonParameters() { mIntentSender.setNextResultIntent( Fido2ApiTestHelper.createSuccessfulGetAssertionIntentWithUvm()); @@ -1395,8 +1398,6 @@ GURL topUrl = new GURL("https://www.chromium.org/pay"); mFrameHost.setLastCommittedURL(topUrl); - Fido2ApiTestHelper.setSecurePaymentConfirmationEnabled(mMocker); - // ClientDataJsonImplJni is mocked directly instead of using // Fido2ApiTestHelper.mockClientDataJson so that it can be used to verify the call arguments // below.
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/bookmarks/BookmarkImageFetcherTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/bookmarks/BookmarkImageFetcherTest.java new file mode 100644 index 0000000..e8aa3f7 --- /dev/null +++ b/chrome/android/junit/src/org/chromium/chrome/browser/bookmarks/BookmarkImageFetcherTest.java
@@ -0,0 +1,213 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.bookmarks; + +import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import android.app.Activity; +import android.graphics.Bitmap; +import android.graphics.Color; +import android.graphics.drawable.Drawable; +import android.util.Pair; + +import androidx.recyclerview.widget.RecyclerView; +import androidx.test.ext.junit.rules.ActivityScenarioRule; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; +import org.robolectric.annotation.Config; + +import org.chromium.base.Callback; +import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.base.test.util.Batch; +import org.chromium.base.test.util.JniMocker; +import org.chromium.chrome.test.util.browser.Features; +import org.chromium.components.bookmarks.BookmarkId; +import org.chromium.components.bookmarks.BookmarkItem; +import org.chromium.components.bookmarks.BookmarkType; +import org.chromium.components.browser_ui.widget.RoundedIconGenerator; +import org.chromium.components.browser_ui.widget.selectable_list.SelectableListLayout; +import org.chromium.components.browser_ui.widget.selectable_list.SelectionDelegate; +import org.chromium.components.favicon.IconType; +import org.chromium.components.favicon.LargeIconBridge; +import org.chromium.components.favicon.LargeIconBridge.LargeIconCallback; +import org.chromium.components.image_fetcher.ImageFetcher; +import org.chromium.ui.base.TestActivity; +import org.chromium.url.GURL; +import org.chromium.url.JUnitTestGURLs; + +import java.util.Arrays; + +/** Unit tests for {@link BookmarkImageFetcher}. */ +@Batch(Batch.UNIT_TESTS) +@RunWith(BaseRobolectricTestRunner.class) +@Config(manifest = Config.NONE) +public class BookmarkImageFetcherTest { + @Rule + public MockitoRule mMockitoRule = MockitoJUnit.rule(); + @Rule + public ActivityScenarioRule<TestActivity> mActivityScenarioRule = + new ActivityScenarioRule<>(TestActivity.class); + @Rule + public TestRule mFeaturesProcessorRule = new Features.JUnitProcessor(); + @Rule + public JniMocker mJniMocker = new JniMocker(); + + @Mock + private BookmarkModel mBookmarkModel; + @Mock + private BookmarkOpener mBookmarkOpener; + @Mock + private SelectableListLayout<BookmarkId> mSelectableListLayout; + @Mock + private SelectionDelegate<BookmarkId> mSelectionDelegate; + @Mock + private RecyclerView mRecyclerView; + @Mock + private LargeIconBridge mLargeIconBridge; + @Mock + private RoundedIconGenerator mIconGenerator; + @Mock + private ImageFetcher mImageFetcher; + @Mock + private Callback<Drawable> mDrawableCallback; + @Mock + private Callback<Pair<Drawable, Drawable>> mFolderDrawablesCallback; + + @Captor + private ArgumentCaptor<Drawable> mDrawableCaptor; + @Captor + private ArgumentCaptor<Pair<Drawable, Drawable>> mFolderDrawablesCaptor; + + private final BookmarkId mFolderId = new BookmarkId(/*id=*/1, BookmarkType.NORMAL); + private final BookmarkId mBookmarkId1 = new BookmarkId(/*id=*/2, BookmarkType.NORMAL); + private final BookmarkId mBookmarkId2 = new BookmarkId(/*id=*/3, BookmarkType.NORMAL); + private final BookmarkId mReadingListFolderId = + new BookmarkId(/*id=*/5, BookmarkType.READING_LIST); + private final BookmarkId mReadingListId = new BookmarkId(/*id=*/6, BookmarkType.READING_LIST); + + private final BookmarkItem mFolderItem = + new BookmarkItem(mFolderId, "Folder", null, true, null, true, false, 0, false); + private final BookmarkItem mBookmarkItem1 = new BookmarkItem(mBookmarkId1, "Bookmark1", + JUnitTestGURLs.getGURL(JUnitTestGURLs.EXAMPLE_URL), false, mFolderId, true, false, 0, + false); + private final BookmarkItem mBookmarkItem2 = new BookmarkItem(mBookmarkId2, "Bookmark1", + JUnitTestGURLs.getGURL(JUnitTestGURLs.EXAMPLE_URL), false, mFolderId, true, false, 0, + false); + private final Bitmap mBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); + + private Activity mActivity; + private BookmarkImageFetcher mBookmarkImageFetcher; + + @Before + public void setUp() { + mActivityScenarioRule.getScenario().onActivity((activity) -> { + mActivity = spy(activity); + + // Setup BookmarkModel. + doReturn(true).when(mBookmarkModel).doesBookmarkExist(any()); + doReturn(Arrays.asList(mBookmarkId1, mBookmarkId2)) + .when(mBookmarkModel) + .getChildIds(mFolderId); + doReturn(mFolderItem).when(mBookmarkModel).getBookmarkById(mFolderId); + doReturn(mBookmarkItem1).when(mBookmarkModel).getBookmarkById(mBookmarkId1); + doReturn(mBookmarkItem2).when(mBookmarkModel).getBookmarkById(mBookmarkId2); + + // Setup LargeIconBridge. + doAnswer(invocation -> { + LargeIconCallback cb = invocation.getArgument(2); + cb.onLargeIconAvailable(mBitmap, Color.GREEN, false, IconType.FAVICON); + return null; + }) + .when(mLargeIconBridge) + .getLargeIconForUrl(any(), anyInt(), any()); + + // Setup image fetching. + doAnswer((invocation) -> { + Callback<GURL> callback = invocation.getArgument(1); + callback.onResult(JUnitTestGURLs.getGURL(JUnitTestGURLs.EXAMPLE_URL)); + return null; + }) + .when(mBookmarkModel) + .getImageUrlForBookmark(any(), any()); + doAnswer((invocation) -> { + Callback<Bitmap> callback = invocation.getArgument(1); + callback.onResult(mBitmap); + return null; + }) + .when(mImageFetcher) + .fetchImage(any(), any()); + + mBookmarkImageFetcher = new BookmarkImageFetcher(mActivity, mBookmarkModel, + mImageFetcher, mLargeIconBridge, mIconGenerator, 1, 1); + mBookmarkImageFetcher.setupFetchProperties(mIconGenerator, 100, 100); + }); + } + + @Test + public void testFetchFirstTwoImagesForFolder() { + mBookmarkImageFetcher.fetchFirstTwoImagesForFolder(mFolderItem, mFolderDrawablesCallback); + verify(mFolderDrawablesCallback).onResult(mFolderDrawablesCaptor.capture()); + + Pair<Drawable, Drawable> drawables = mFolderDrawablesCaptor.getValue(); + assertNotNull(drawables.first); + assertNotNull(drawables.second); + } + + @Test + public void testFetchImageForBookmarkWithFaviconFallback() { + mBookmarkImageFetcher.fetchImageForBookmarkWithFaviconFallback( + mBookmarkItem1, mDrawableCallback); + verify(mDrawableCallback).onResult(mDrawableCaptor.capture()); + // There shouldn't be any interaction with large icon bridge since an image was found. + verify(mLargeIconBridge, times(0)).getLargeIconForUrl(any(), anyInt(), any()); + + assertNotNull(mDrawableCaptor.getValue()); + } + + @Test + public void testFetchImageForBookmarkWithFaviconFallback_fallbackToFavicon() { + doAnswer((invocation) -> { + Callback<GURL> callback = invocation.getArgument(1); + callback.onResult(null); + return null; + }) + .when(mBookmarkModel) + .getImageUrlForBookmark(any(), any()); + + mBookmarkImageFetcher.fetchImageForBookmarkWithFaviconFallback( + mBookmarkItem1, mDrawableCallback); + verify(mDrawableCallback).onResult(mDrawableCaptor.capture()); + // There shouldn't be any interaction with large icon bridge since an image was found. + verify(mLargeIconBridge).getLargeIconForUrl(any(), anyInt(), any()); + + assertNotNull(mDrawableCaptor.getValue()); + } + + @Test + public void testFetchFaviconForBookmark() { + mBookmarkImageFetcher.fetchFaviconForBookmark(mBookmarkItem1, mDrawableCallback); + verify(mDrawableCallback).onResult(mDrawableCaptor.capture()); + // There shouldn't be any interaction with large icon bridge since an image was found. + verify(mLargeIconBridge).getLargeIconForUrl(any(), anyInt(), any()); + + assertNotNull(mDrawableCaptor.getValue()); + } +}
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineDetectorUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineDetectorUnitTest.java index 5eb1fb1..3068461 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineDetectorUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineDetectorUnitTest.java
@@ -8,13 +8,19 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.chromium.chrome.browser.offlinepages.indicator.OfflineDetector.STATUS_INDICATOR_WAIT_ON_OFFLINE_DURATION_MS; import static org.chromium.chrome.browser.offlinepages.indicator.OfflineDetector.STATUS_INDICATOR_WAIT_ON_SWITCH_ONLINE_TO_OFFLINE_DEFAULT_DURATION_MS; import static org.chromium.chrome.browser.offlinepages.indicator.OfflineDetector.setMockElapsedTimeSupplier; +import android.app.Application; +import android.content.ContentResolver; import android.os.Handler; +import android.provider.Settings; + +import androidx.test.core.app.ApplicationProvider; import org.junit.After; import org.junit.Before; @@ -48,9 +54,14 @@ private int mIsForegroundNotificationsReceivedByObserver; private boolean mLastNotificationReceivedIsForeground; + private ContentResolver mContentResolver; + private Application mContext; + @Before public void setUp() { MockitoAnnotations.initMocks(this); + mContext = ApplicationProvider.getApplicationContext(); + mContentResolver = mContext.getContentResolver(); mElapsedTimeMs = 0; OfflineDetector.setMockElapsedTimeSupplier(() -> mElapsedTimeMs); @@ -59,13 +70,14 @@ mOfflineDetector = new OfflineDetector((Boolean offline) -> onConnectionStateChanged(offline), - (Boolean isForeground) -> onApplicationStateChanged(isForeground)); + (Boolean isForeground) -> onApplicationStateChanged(isForeground), mContext); mOfflineDetector.setHandlerForTesting(mHandler); } @After public void tearDown() { OfflineDetector.setMockElapsedTimeSupplier(null); + Settings.System.putInt(mContentResolver, Settings.Global.AIRPLANE_MODE_ON, 0); } /** @@ -463,6 +475,112 @@ mOfflineDetector.isApplicationForeground()); } + @Test + public void testAirplaneModeToOffline() { + changeApplicationStateToBackground(false); + + // Simulate offline + airplane mode. + Settings.System.putInt(mContentResolver, Settings.Global.AIRPLANE_MODE_ON, 1); + changeConnectionState(true); + assertEquals(1, mIsOfflineNotificationsReceivedByObserver); + assertFalse(mLastNotificationReceivedIsOffline); + + // Advance time by a long duration (10 minutes). + advanceTimeByMs(10 * 60 * 1000); + + // Simulate airplane mode change to false, while still offline. + final ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class); + Settings.System.putInt(mContentResolver, Settings.Global.AIRPLANE_MODE_ON, 0); + changeConnectionState(true); + + // Offline status shouldn't be communicated until + // SWITCH_ONLINE_TO_OFFLINE_DEFAULT_DURATION_MS elapses. + verify(mHandler).postDelayed(captor.capture(), + eq(STATUS_INDICATOR_WAIT_ON_SWITCH_ONLINE_TO_OFFLINE_DEFAULT_DURATION_MS)); + + assertEquals("Extra notification received even though device just changed to offline", 1, + mIsOfflineNotificationsReceivedByObserver); + assertFalse("Extra notification received even though device just changed to offline", + mLastNotificationReceivedIsOffline); + + // Verify offline status is communicated if time elaspses. + advanceTimeByMs(STATUS_INDICATOR_WAIT_ON_SWITCH_ONLINE_TO_OFFLINE_DEFAULT_DURATION_MS); + captor.getValue().run(); + + assertEquals("Notification count not updated after connection changed to offline", 2, + mIsOfflineNotificationsReceivedByObserver); + assertTrue("Notification not received after connection changed to offline", + mLastNotificationReceivedIsOffline); + } + + @Test + public void testAirplaneModeToOnline() { + changeApplicationStateToBackground(false); + + // Advance time by a long duration (10 minutes). + advanceTimeByMs(10 * 60 * 1000); + + final ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class); + + // Start online. + changeConnectionState(true); + assertEquals(1, mIsOfflineNotificationsReceivedByObserver); + assertFalse(mLastNotificationReceivedIsOffline); + + verify(mHandler).postDelayed( + captor.capture(), eq(STATUS_INDICATOR_WAIT_ON_OFFLINE_DURATION_MS)); + + // Advance time by a long duration (10 minutes). + advanceTimeByMs(10 * 60 * 1000); + + // Simulate offline + airplane mode. + Settings.System.putInt(mContentResolver, Settings.Global.AIRPLANE_MODE_ON, 1); + changeConnectionState(true); + + // #updateState will still run again since connection state has changed. + verify(mHandler, times(2)) + .postDelayed(captor.capture(), eq(STATUS_INDICATOR_WAIT_ON_OFFLINE_DURATION_MS)); + + // Advance time after which runnable will execute + advanceTimeByMs(STATUS_INDICATOR_WAIT_ON_OFFLINE_DURATION_MS); + captor.getValue().run(); + + // Effective offline status hasn't changed. + assertEquals("Effective offline status didn't change", 1, + mIsOfflineNotificationsReceivedByObserver); + assertFalse(mLastNotificationReceivedIsOffline); + + // Advance time by a long duration (10 minutes). + advanceTimeByMs(10 * 60 * 1000); + + // Simulate airplane mode change to false, while still offline. + Settings.System.putInt(mContentResolver, Settings.Global.AIRPLANE_MODE_ON, 0); + changeConnectionState(true); + + // Offline status shouldn't be communicated until + // SWITCH_ONLINE_TO_OFFLINE_DEFAULT_DURATION_MS elapses. + verify(mHandler).postDelayed(captor.capture(), + eq(STATUS_INDICATOR_WAIT_ON_SWITCH_ONLINE_TO_OFFLINE_DEFAULT_DURATION_MS)); + + assertEquals("Extra notification received even though device just changed to offline", 1, + mIsOfflineNotificationsReceivedByObserver); + assertFalse("Extra notification received even though device just changed to offline", + mLastNotificationReceivedIsOffline); + + // Change to online before + // |STATUS_INDICATOR_WAIT_ON_SWITCH_ONLINE_TO_OFFLINE_DEFAULT_DURATION_MS| duration is over. + // This should cancel the callbacks. + changeConnectionState(false); + + // Advance time after which the offline state should be notified. + advanceTimeByMs(STATUS_INDICATOR_WAIT_ON_SWITCH_ONLINE_TO_OFFLINE_DEFAULT_DURATION_MS); + captor.getValue().run(); + assertEquals("Extra notification received even though device is now online", 1, + mIsOfflineNotificationsReceivedByObserver); + assertFalse("Extra notification received even though device is now online", + mLastNotificationReceivedIsOffline); + } + private void changeConnectionState(boolean offline) { final int state = offline ? ConnectionState.NO_INTERNET : ConnectionState.VALIDATED; mOfflineDetector.onConnectionStateChanged(state);
diff --git a/chrome/app/BUILD.gn b/chrome/app/BUILD.gn index 648bb44..8942610 100644 --- a/chrome/app/BUILD.gn +++ b/chrome/app/BUILD.gn
@@ -225,6 +225,7 @@ if (is_mac) { sources += [ "chrome_main_mac.mm" ] + configs += [ "//build/config/compiler:enable_arc" ] deps += [ "//chrome:chrome_framework" ] }
diff --git a/chrome/app/chrome_crash_reporter_client_mac.mm b/chrome/app/chrome_crash_reporter_client_mac.mm index 0120284..7bcb6c9b 100644 --- a/chrome/app/chrome_crash_reporter_client_mac.mm +++ b/chrome/app/chrome_crash_reporter_client_mac.mm
@@ -15,10 +15,14 @@ #include "components/policy/policy_constants.h" #include "components/version_info/version_info.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( bool* breakpad_enabled) { - base::ScopedCFTypeRef<CFStringRef> key( - base::SysUTF8ToCFStringRef(policy::key::kMetricsReportingEnabled)); + base::ScopedCFTypeRef<CFStringRef> key = + base::SysUTF8ToCFStringRef(policy::key::kMetricsReportingEnabled); Boolean key_valid; Boolean metrics_reporting_enabled = CFPreferencesGetAppBooleanValue(key, kCFPreferencesCurrentApplication, &key_valid);
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc index c5a7618..0141f1f 100644 --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc
@@ -396,14 +396,14 @@ bool HandleVersionSwitches(const base::CommandLine& command_line) { #if !BUILDFLAG(IS_MAC) if (command_line.HasSwitch(switches::kProductVersion)) { - printf("%s\n", version_info::GetVersionNumber().c_str()); + printf("%s\n", version_info::GetVersionNumber().data()); return true; } #endif if (command_line.HasSwitch(switches::kVersion)) { - printf("%s %s %s\n", version_info::GetProductName().c_str(), - version_info::GetVersionNumber().c_str(), + printf("%s %s %s\n", version_info::GetProductName().data(), + version_info::GetVersionNumber().data(), chrome::GetChannelName(chrome::WithExtendedStable(true)).c_str()); return true; }
diff --git a/chrome/app/chrome_main_mac.mm b/chrome/app/chrome_main_mac.mm index 4e8089de..5aa09f5 100644 --- a/chrome/app/chrome_main_mac.mm +++ b/chrome/app/chrome_main_mac.mm
@@ -20,13 +20,17 @@ #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + void SetUpBundleOverrides() { @autoreleasepool { base::apple::SetOverrideFrameworkBundlePath( chrome::GetFrameworkBundlePath()); NSBundle* base_bundle = chrome::OuterAppBundle(); - base::mac::SetBaseBundleID([[base_bundle bundleIdentifier] UTF8String]); + base::mac::SetBaseBundleID(base_bundle.bundleIdentifier.UTF8String); base::FilePath child_exe_path = chrome::GetFrameworkBundlePath().Append("Helpers").Append(
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index f12f3f7..5afea40 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -7071,7 +7071,7 @@ <ph name="MODULE_TITLE">$1<ex>Office Chairs</ex></ph> hidden </message> <message name="IDS_NTP_MODULES_DISABLE_TOAST_MESSAGE" desc="Text shown in the toast confirming a module has been disabled."> - You won't see <ph name="MODULE_NAME">$1<ex>shopping suggestions</ex></ph> again on this page + You won't see <ph name="MODULE_NAME">$1<ex>shopping suggestions</ex></ph> on this page again </message> <message name="IDS_NTP_MODULES_DISMISS_BUTTON_TEXT" desc="Text shown on the disable button of an NTP module."> Hide <ph name="MODULE_TITLE">$1<ex>Office Chairs</ex></ph>
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_DISABLE_TOAST_MESSAGE.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_DISABLE_TOAST_MESSAGE.png.sha1 index ed8713d..bf44010 100644 --- a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_DISABLE_TOAST_MESSAGE.png.sha1 +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_DISABLE_TOAST_MESSAGE.png.sha1
@@ -1 +1 @@ -5753fcb2013176f4edd19dcc404883854dbc1d81 \ No newline at end of file +5186f16582d0d5f13b2e1239e664d5aa9d15079a \ No newline at end of file
diff --git a/chrome/app/os_settings_strings.grdp b/chrome/app/os_settings_strings.grdp index 2597dfd..941bac3f 100644 --- a/chrome/app/os_settings_strings.grdp +++ b/chrome/app/os_settings_strings.grdp
@@ -5282,6 +5282,12 @@ <message name="IDS_OS_SETTINGS_PRIVACY_HUB_HW_MICROPHONE_TOGGLE_TOOLTIP" desc="Tooltip to display in the Privacy Hub subpage when the hardware microphone switch is engaged."> To turn on microphone access, turn on the physical microphone switch on your device </message> + <message name="IDS_OS_SETTINGS_PRIVACY_HUB_SPEAK_ON_MUTE_DETECTION_TOGGLE_TITLE" desc="The title of the toggle to enable/disable microphone from the privacy hub."> + Mute nudge + </message> + <message name="IDS_OS_SETTINGS_PRIVACY_HUB_SPEAK_ON_MUTE_DETECTION_TOGGLE_SUBTEXT" desc="Sub-label for the microphone access toggle in the Privacy controls (aka Privacy Hub) os-settings page."> + You'll get notified if you talk while your mic is muted when using certain apps, like video chat apps. Audio never leaves your device. + </message> <message name="IDS_OS_SETTINGS_PRIVACY_HUB_GEOLOCATION_TOGGLE_TITLE" desc="The title of the toggle to enable/disable geolocation from the privacy hub."> Location access </message>
diff --git a/chrome/app/os_settings_strings_grdp/IDS_OS_SETTINGS_PRIVACY_HUB_SPEAK_ON_MUTE_DETECTION_TOGGLE_SUBTEXT.png.sha1 b/chrome/app/os_settings_strings_grdp/IDS_OS_SETTINGS_PRIVACY_HUB_SPEAK_ON_MUTE_DETECTION_TOGGLE_SUBTEXT.png.sha1 new file mode 100644 index 0000000..f8214f8 --- /dev/null +++ b/chrome/app/os_settings_strings_grdp/IDS_OS_SETTINGS_PRIVACY_HUB_SPEAK_ON_MUTE_DETECTION_TOGGLE_SUBTEXT.png.sha1
@@ -0,0 +1 @@ +569855b265648375594d212e265d5253c3090a67 \ No newline at end of file
diff --git a/chrome/app/os_settings_strings_grdp/IDS_OS_SETTINGS_PRIVACY_HUB_SPEAK_ON_MUTE_DETECTION_TOGGLE_TITLE.png.sha1 b/chrome/app/os_settings_strings_grdp/IDS_OS_SETTINGS_PRIVACY_HUB_SPEAK_ON_MUTE_DETECTION_TOGGLE_TITLE.png.sha1 new file mode 100644 index 0000000..f8214f8 --- /dev/null +++ b/chrome/app/os_settings_strings_grdp/IDS_OS_SETTINGS_PRIVACY_HUB_SPEAK_ON_MUTE_DETECTION_TOGGLE_TITLE.png.sha1
@@ -0,0 +1 @@ +569855b265648375594d212e265d5253c3090a67 \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index a42c5ad..31b0a6c8 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -489,6 +489,8 @@ "enterprise/connectors/interstitials/enterprise_warn_page.h", "enterprise/profile_management/saml_response_parser.cc", "enterprise/profile_management/saml_response_parser.h", + "enterprise/reporting/legacy_tech/legacy_tech_report_generator.cc", + "enterprise/reporting/legacy_tech/legacy_tech_report_generator.h", "enterprise/reporting/legacy_tech/legacy_tech_report_policy_handler.cc", "enterprise/reporting/legacy_tech/legacy_tech_report_policy_handler.h", "enterprise/reporting/legacy_tech/legacy_tech_url_matcher.cc", @@ -2090,6 +2092,7 @@ "//components/enterprise/browser/identifiers", "//components/enterprise/common/proto:connectors_proto", "//components/enterprise/common/proto:extensions_workflow_events_proto", + "//components/enterprise/common/proto:legacy_tech_events_proto", "//components/enterprise/content", "//components/error_page/common", "//components/error_page/content/browser", @@ -2381,7 +2384,6 @@ "//printing/buildflags", "//rlz/buildflags", "//services/audio/public/cpp", - "//services/audio/public/cpp:audio_features", "//services/cert_verifier:lib", "//services/data_decoder/public/cpp", "//services/device/public/cpp:device_features", @@ -2534,6 +2536,8 @@ "android/android_theme_resources.h", "android/autocomplete/tab_matcher_android.cc", "android/autocomplete/tab_matcher_android.h", + "android/auxiliary_search/auxiliary_search_provider.cc", + "android/auxiliary_search/auxiliary_search_provider.h", "android/background_sync_launcher_android.cc", "android/background_sync_launcher_android.h", "android/background_tab_manager.cc", @@ -3254,6 +3258,7 @@ ":usage_stats_proto", "//cc/slim", "//chrome/android:jni_headers", + "//chrome/browser/android/auxiliary_search/proto", "//chrome/browser/android/httpclient:android", "//chrome/browser/android/httpclient:jni_headers", "//chrome/browser/android/messages:jni_headers",
diff --git a/chrome/browser/android/auxiliary_search/DIR_METADATA b/chrome/browser/android/auxiliary_search/DIR_METADATA new file mode 100644 index 0000000..07a4669 --- /dev/null +++ b/chrome/browser/android/auxiliary_search/DIR_METADATA
@@ -0,0 +1,3 @@ +monorail { + component: "UI>Browser>Omnibox" +}
diff --git a/chrome/browser/android/auxiliary_search/OWNERS b/chrome/browser/android/auxiliary_search/OWNERS new file mode 100644 index 0000000..603b9cf --- /dev/null +++ b/chrome/browser/android/auxiliary_search/OWNERS
@@ -0,0 +1 @@ +file://components/omnibox/browser/android/OWNERS
diff --git a/chrome/browser/android/auxiliary_search/auxiliary_search_provider.cc b/chrome/browser/android/auxiliary_search/auxiliary_search_provider.cc new file mode 100644 index 0000000..52172b091 --- /dev/null +++ b/chrome/browser/android/auxiliary_search/auxiliary_search_provider.cc
@@ -0,0 +1,81 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/android/auxiliary_search/auxiliary_search_provider.h" + +#include "base/android/jni_android.h" +#include "base/android/jni_array.h" +#include "base/memory/singleton.h" +#include "chrome/android/chrome_jni_headers/AuxiliarySearchBridge_jni.h" +#include "chrome/browser/android/auxiliary_search/proto/auxiliary_search_group.pb.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_android.h" +#include "chrome/browser/profiles/profile_keyed_service_factory.h" + +using base::android::ToJavaByteArray; + +namespace { + +class AuxiliarySearchProviderFactory : public ProfileKeyedServiceFactory { + public: + static AuxiliarySearchProvider* GetForProfile(Profile* profile) { + return static_cast<AuxiliarySearchProvider*>( + GetInstance()->GetServiceForBrowserContext(profile, true)); + } + + static AuxiliarySearchProviderFactory* GetInstance() { + return base::Singleton<AuxiliarySearchProviderFactory>::get(); + } + + AuxiliarySearchProviderFactory() + : ProfileKeyedServiceFactory( + "AuxiliarySearchProvider", + ProfileSelections::Builder() + .WithRegular(ProfileSelection::kRedirectedToOriginal) + .WithGuest(ProfileSelection::kNone) + .Build()) {} + + private: + // ProfileKeyedServiceFactory overrides + KeyedService* BuildServiceInstanceFor( + content::BrowserContext* context) const override { + Profile* profile = Profile::FromBrowserContext(context); + DCHECK(!profile->IsOffTheRecord()); + + return new AuxiliarySearchProvider(profile); + } +}; + +} // namespace + +AuxiliarySearchProvider::AuxiliarySearchProvider(Profile* profile) + : profile_(profile) {} + +AuxiliarySearchProvider::~AuxiliarySearchProvider() = default; + +base::android::ScopedJavaLocalRef<jbyteArray> +AuxiliarySearchProvider::GetSearchableData(JNIEnv* env) const { + auxiliary_search::AuxiliarySearchGroup group; + std::string serialized_group; + + // TODO(crbug.com/1445112): read the tabs and bookmarks and fill in the + // |group|. + + if (!group.SerializeToString(&serialized_group)) { + serialized_group.clear(); + } + + return ToJavaByteArray(env, serialized_group); +} + +// static +jlong JNI_AuxiliarySearchBridge_GetForProfile( + JNIEnv* env, + const base::android::JavaParamRef<jobject>& j_profile) { + Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); + DCHECK(profile); + + return reinterpret_cast<intptr_t>( + AuxiliarySearchProviderFactory::GetForProfile(profile)); +}
diff --git a/chrome/browser/android/auxiliary_search/auxiliary_search_provider.h b/chrome/browser/android/auxiliary_search/auxiliary_search_provider.h new file mode 100644 index 0000000..fe4e79cf --- /dev/null +++ b/chrome/browser/android/auxiliary_search/auxiliary_search_provider.h
@@ -0,0 +1,30 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ANDROID_AUXILIARY_SEARCH_AUXILIARY_SEARCH_PROVIDER_H_ +#define CHROME_BROWSER_ANDROID_AUXILIARY_SEARCH_AUXILIARY_SEARCH_PROVIDER_H_ + +#include <jni.h> + +#include "base/android/scoped_java_ref.h" +#include "components/keyed_service/core/keyed_service.h" + +class Profile; + +// AuxiliarySearchProvider is responsible for providing the necessary +// information for the auxiliary search.. +class AuxiliarySearchProvider : public KeyedService { + public: + explicit AuxiliarySearchProvider(Profile* profile); + + base::android::ScopedJavaLocalRef<jbyteArray> GetSearchableData( + JNIEnv* env) const; + + private: + ~AuxiliarySearchProvider() override; + + raw_ptr<Profile> profile_; +}; + +#endif // CHROME_BROWSER_ANDROID_AUXILIARY_SEARCH_AUXILIARY_SEARCH_PROVIDER_H_
diff --git a/chrome/browser/android/auxiliary_search/proto/BUILD.gn b/chrome/browser/android/auxiliary_search/proto/BUILD.gn new file mode 100644 index 0000000..29cc255 --- /dev/null +++ b/chrome/browser/android/auxiliary_search/proto/BUILD.gn
@@ -0,0 +1,18 @@ +# Copyright 2023 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") +import("//third_party/protobuf/proto_library.gni") + +_proto_files = [ "auxiliary_search_group.proto" ] + +proto_library("proto") { + sources = _proto_files + proto_in_dir = "." +} + +proto_java_library("proto_java") { + proto_path = "." + sources = _proto_files +}
diff --git a/chrome/browser/android/auxiliary_search/proto/auxiliary_search_group.proto b/chrome/browser/android/auxiliary_search/proto/auxiliary_search_group.proto new file mode 100644 index 0000000..0824e12 --- /dev/null +++ b/chrome/browser/android/auxiliary_search/proto/auxiliary_search_group.proto
@@ -0,0 +1,21 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +syntax = 'proto2'; + +option optimize_for = LITE_RUNTIME; +option java_package = 'org.chromium.chrome.browser.auxiliary_search'; +option java_outer_classname = 'AuxiliarySearchGroupProto'; + +package auxiliary_search; + +// Contains information about the tabs and bookmarks. +message AuxiliarySearchGroup { + message Entry { + optional string title = 1; + optional string url = 2; + } + repeated Entry tabs = 1; + repeated Entry bookmarks = 2; +}
diff --git a/chrome/browser/apps/app_service/webapk/webapk_install_task.cc b/chrome/browser/apps/app_service/webapk/webapk_install_task.cc index 8fc0138..b800239 100644 --- a/chrome/browser/apps/app_service/webapk/webapk_install_task.cc +++ b/chrome/browser/apps/app_service/webapk/webapk_install_task.cc
@@ -294,7 +294,8 @@ std::unique_ptr<webapk::WebApk> webapk = std::make_unique<webapk::WebApk>(); webapk->set_manifest_url(registrar.GetAppManifestUrl(app_id_).spec()); webapk->set_requester_application_package(kRequesterPackageName); - webapk->set_requester_application_version(version_info::GetVersionNumber()); + webapk->set_requester_application_version( + std::string(version_info::GetVersionNumber())); LoadWebApkInfo(std::move(webapk)); } @@ -563,7 +564,8 @@ } webapk->set_requester_application_package(kRequesterPackageName); - webapk->set_requester_application_version(version_info::GetVersionNumber()); + webapk->set_requester_application_version( + std::string(version_info::GetVersionNumber())); LoadWebApkInfo(std::move(webapk)); }
diff --git a/chrome/browser/ash/BUILD.gn b/chrome/browser/ash/BUILD.gn index 40b73fb..9866686 100644 --- a/chrome/browser/ash/BUILD.gn +++ b/chrome/browser/ash/BUILD.gn
@@ -2372,6 +2372,8 @@ "policy/external_data/user_cloud_external_data_manager.h", "policy/handlers/adb_sideloading_allowance_mode_policy_handler.cc", "policy/handlers/adb_sideloading_allowance_mode_policy_handler.h", + "policy/handlers/app_launch_automation_policy_handler.cc", + "policy/handlers/app_launch_automation_policy_handler.h", "policy/handlers/bluetooth_policy_handler.cc", "policy/handlers/bluetooth_policy_handler.h", "policy/handlers/configuration_policy_handler_ash.cc",
diff --git a/chrome/browser/ash/accessibility/accessibility_manager_browsertest.cc b/chrome/browser/ash/accessibility/accessibility_manager_browsertest.cc index d6cc9d1d..406ace3 100644 --- a/chrome/browser/ash/accessibility/accessibility_manager_browsertest.cc +++ b/chrome/browser/ash/accessibility/accessibility_manager_browsertest.cc
@@ -899,7 +899,7 @@ ChromeVoxPanelMultipleDisplays) { // Start with two displays, the non-primary one is active for new windows. display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) - .UpdateDisplay("600x600,800x800"); + .UpdateDisplay("600x550,800x750"); auto root_windows = ash::Shell::GetAllRootWindows(); ASSERT_EQ(2u, root_windows.size()); ASSERT_EQ(ash::Shell::GetPrimaryRootWindow(), root_windows[0]);
diff --git a/chrome/browser/ash/accessibility/select_to_speak_browsertest.cc b/chrome/browser/ash/accessibility/select_to_speak_browsertest.cc index 9d3028c..9974f68 100644 --- a/chrome/browser/ash/accessibility/select_to_speak_browsertest.cc +++ b/chrome/browser/ash/accessibility/select_to_speak_browsertest.cc
@@ -317,7 +317,7 @@ ShellTestApi shell_test_api; display::test::DisplayManagerTestApi(shell_test_api.display_manager()) - .UpdateDisplay("1+0-800x800,801+1-800x800"); + .UpdateDisplay("1+0-800x700,801+1-800x700"); ASSERT_EQ(2u, shell_test_api.display_manager()->GetNumDisplays()); display::test::DisplayManagerTestApi display_manager_test_api( shell_test_api.display_manager());
diff --git a/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc b/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc index f718b0d..044884af 100644 --- a/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc +++ b/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc
@@ -1479,10 +1479,10 @@ Shell::GetAllRootWindowControllers(); EXPECT_EQ(1U, root_controllers.size()); - // Make two displays, each 800 by 800, side by side. + // Make two displays, each 800 by 700, side by side. ShellTestApi shell_test_api; display::test::DisplayManagerTestApi(shell_test_api.display_manager()) - .UpdateDisplay("800x800,801+0-800x800"); + .UpdateDisplay("800x700,801+0-800x700"); ASSERT_EQ(2u, shell_test_api.display_manager()->GetNumDisplays()); display::test::DisplayManagerTestApi display_manager_test_api( shell_test_api.display_manager()); @@ -1512,7 +1512,7 @@ params.parent = root_window; // This is the right edge of the screen. - params.bounds = {1550, 0, 50, 700}; + params.bounds = {1550, 0, 50, 600}; widget->Init(std::move(params)); views::View* view = new views::View();
diff --git a/chrome/browser/ash/app_list/app_list_client_impl_browsertest.cc b/chrome/browser/ash/app_list/app_list_client_impl_browsertest.cc index cf250f1..14343f10 100644 --- a/chrome/browser/ash/app_list/app_list_client_impl_browsertest.cc +++ b/chrome/browser/ash/app_list/app_list_client_impl_browsertest.cc
@@ -549,7 +549,7 @@ OpenSearchResultOnPrimaryDisplay) { display::test::DisplayManagerTestApi display_manager( ash::ShellTestApi().display_manager()); - display_manager.UpdateDisplay("400x300,500x500"); + display_manager.UpdateDisplay("400x300,500x400"); const display::Display& primary_display = display::Screen::GetScreen()->GetPrimaryDisplay(); @@ -616,7 +616,7 @@ OpenSearchResultOnSecondaryDisplay) { display::test::DisplayManagerTestApi display_manager( ash::ShellTestApi().display_manager()); - display_manager.UpdateDisplay("400x300,500x500"); + display_manager.UpdateDisplay("400x300,500x400"); const display::Display& secondary_display = display_manager.GetSecondaryDisplay();
diff --git a/chrome/browser/ash/app_mode/kiosk_external_updater.cc b/chrome/browser/ash/app_mode/kiosk_external_updater.cc index 1f353fb..be7c99a 100644 --- a/chrome/browser/ash/app_mode/kiosk_external_updater.cc +++ b/chrome/browser/ash/app_mode/kiosk_external_updater.cc
@@ -350,8 +350,9 @@ // Check minimum browser version. if (!min_browser_version.empty() && - !ShouldUpdateForHigherVersion(min_browser_version, - version_info::GetVersionNumber(), true)) { + !ShouldUpdateForHigherVersion( + min_browser_version, std::string(version_info::GetVersionNumber()), + true)) { external_updates_[app_id].error = l10n_util::GetStringFUTF16( IDS_KIOSK_EXTERNAL_UPDATE_REQUIRE_HIGHER_BROWSER_VERSION, base::UTF8ToUTF16(min_browser_version));
diff --git a/chrome/browser/ash/cryptauth/client_app_metadata_provider_service.cc b/chrome/browser/ash/cryptauth/client_app_metadata_provider_service.cc index d63b7e1..78efa5d 100644 --- a/chrome/browser/ash/cryptauth/client_app_metadata_provider_service.cc +++ b/chrome/browser/ash/cryptauth/client_app_metadata_provider_service.cc
@@ -332,8 +332,8 @@ metadata.set_locale(ChromeContentBrowserClient().GetApplicationLocale()); metadata.set_device_os_version(base::GetLinuxDistro()); metadata.set_device_os_version_code(SoftwareVersionCodeAsInt64()); - metadata.set_device_os_release(version_info::GetVersionNumber()); - metadata.set_device_os_codename(version_info::GetProductName()); + metadata.set_device_os_release(std::string(version_info::GetVersionNumber())); + metadata.set_device_os_codename(std::string(version_info::GetProductName())); // device_display_diagonal_mils is unused because it only applies to // phones/tablets. @@ -423,7 +423,7 @@ int64_t ClientAppMetadataProviderService::SoftwareVersionCodeAsInt64() { static const int64_t version_code = - ConvertVersionCodeToInt64(version_info::GetVersionNumber()); + ConvertVersionCodeToInt64(std::string(version_info::GetVersionNumber())); return version_code; }
diff --git a/chrome/browser/ash/cryptauth/gcm_device_info_provider_impl.cc b/chrome/browser/ash/cryptauth/gcm_device_info_provider_impl.cc index 06b7fd5c..abceb697 100644 --- a/chrome/browser/ash/cryptauth/gcm_device_info_provider_impl.cc +++ b/chrome/browser/ash/cryptauth/gcm_device_info_provider_impl.cc
@@ -53,7 +53,7 @@ const { static const base::NoDestructor<cryptauth::GcmDeviceInfo> gcm_device_info([] { static const google::protobuf::int64 kSoftwareVersionCode = - HashStringToInt64(version_info::GetLastChange()); + HashStringToInt64(std::string(version_info::GetLastChange())); cryptauth::GcmDeviceInfo gcm_device_info; @@ -61,7 +61,7 @@ CryptAuthDeviceIdProviderImpl::GetInstance()->GetDeviceId()); gcm_device_info.set_device_type(cryptauth::CHROME); gcm_device_info.set_device_software_version( - version_info::GetVersionNumber()); + std::string(version_info::GetVersionNumber())); gcm_device_info.set_device_software_version_code(kSoftwareVersionCode); gcm_device_info.set_locale( ChromeContentBrowserClient().GetApplicationLocale());
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_service.cc index 4e09a32..ce7f466 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service.cc +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service.cc
@@ -181,16 +181,14 @@ if (!GetAccountId().is_valid()) { PA_LOG(ERROR) << "Empty user account. Auth attempt failed."; - SmartLockMetricsRecorder::RecordAuthResultUnlockFailure( - SmartLockMetricsRecorder::SmartLockAuthResultFailureReason:: - kEmptyUserAccount); + RecordAuthResult(SmartLockMetricsRecorder:: + SmartLockAuthResultFailureReason::kEmptyUserAccount); return false; } if (GetAccountId() != account_id) { - SmartLockMetricsRecorder::RecordAuthResultUnlockFailure( - SmartLockMetricsRecorder::SmartLockAuthResultFailureReason:: - kInvalidAccoundId); + RecordAuthResult(SmartLockMetricsRecorder:: + SmartLockAuthResultFailureReason::kInvalidAccoundId); PA_LOG(ERROR) << "Check failed: " << GetAccountId().Serialize() << " vs " << account_id.Serialize(); @@ -199,7 +197,7 @@ auth_attempt_ = std::make_unique<EasyUnlockAuthAttempt>(account_id); if (!auth_attempt_->Start()) { - SmartLockMetricsRecorder::RecordAuthResultUnlockFailure( + RecordAuthResult( SmartLockMetricsRecorder::SmartLockAuthResultFailureReason:: kAuthAttemptCannotStart); auth_attempt_.reset(); @@ -465,7 +463,7 @@ // TODO(crbug.com/1171972): Deprecate the AuthMethodChoice metric. SmartLockMetricsRecorder::RecordSmartLockUnlockAuthMethodChoice( SmartLockMetricsRecorder::SmartLockAuthMethodChoice::kSmartLock); - SmartLockMetricsRecorder::RecordAuthResultUnlockSuccess(); + RecordAuthResult(/*failure_reason=*/absl::nullopt); RecordEasyUnlockScreenUnlockDuration(base::TimeTicks::Now() - lock_screen_last_shown_timestamp_); } else { @@ -738,6 +736,19 @@ } } +void EasyUnlockService::RecordAuthResult( + absl::optional<SmartLockMetricsRecorder::SmartLockAuthResultFailureReason> + failure_reason) { + if (failure_reason.has_value()) { + SmartLockMetricsRecorder::RecordAuthResultUnlockFailure( + failure_reason.value()); + feature_usage_metrics_->RecordUsage(/*success=*/false); + } else { + SmartLockMetricsRecorder::RecordAuthResultUnlockSuccess(); + feature_usage_metrics_->RecordUsage(/*success=*/true); + } +} + void EasyUnlockService::ResetSmartLockState() { smart_lock_state_.reset(); auth_attempt_.reset(); @@ -828,14 +839,10 @@ void EasyUnlockService::StartFeatureUsageMetrics() { feature_usage_metrics_ = std::make_unique<SmartLockFeatureUsageMetrics>(multidevice_setup_client_); - - SmartLockMetricsRecorder::SetUsageRecorderInstance( - feature_usage_metrics_.get()); } void EasyUnlockService::StopFeatureUsageMetrics() { feature_usage_metrics_.reset(); - SmartLockMetricsRecorder::SetUsageRecorderInstance(nullptr); } void EasyUnlockService::UpdateAppState() {
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 2e98482..f8daf47b 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service.h +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service.h
@@ -23,6 +23,7 @@ #include "chromeos/ash/services/device_sync/public/cpp/device_sync_client.h" #include "chromeos/ash/services/multidevice_setup/public/cpp/multidevice_setup_client.h" #include "components/keyed_service/core/keyed_service.h" +#include "third_party/abseil-cpp/absl/types/optional.h" class AccountId; class Profile; @@ -203,6 +204,10 @@ // Exposes the profile to which the service is attached to subclasses. Profile* profile() const { return profile_; } + void RecordAuthResult( + absl::optional<SmartLockMetricsRecorder::SmartLockAuthResultFailureReason> + failure_reason); + // Resets the Smart Lock state set by this service. void ResetSmartLockState();
diff --git a/chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics.h b/chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics.h index c0a865609..47c71b9 100644 --- a/chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics.h +++ b/chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics.h
@@ -18,8 +18,7 @@ // Tracks Smart Lock feature usage for the Standard Feature Usage Logging // (SFUL) framework. class SmartLockFeatureUsageMetrics - : public feature_usage::FeatureUsageMetrics::Delegate, - public SmartLockMetricsRecorder::UsageRecorder { + : public feature_usage::FeatureUsageMetrics::Delegate { public: SmartLockFeatureUsageMetrics( multidevice_setup::MultiDeviceSetupClient* multi_device_setup_client); @@ -29,8 +28,7 @@ delete; ~SmartLockFeatureUsageMetrics() override; - // SmartLockMetricsRecorder::UsageRecorder: - void RecordUsage(bool success) override; + void RecordUsage(bool success); private: // feature_usage::FeatureUsageMetrics::Delegate:
diff --git a/chrome/browser/ash/login/oobe_quick_start/connectivity/target_device_connection_broker_impl.cc b/chrome/browser/ash/login/oobe_quick_start/connectivity/target_device_connection_broker_impl.cc index 738d376..60e2828 100644 --- a/chrome/browser/ash/login/oobe_quick_start/connectivity/target_device_connection_broker_impl.cc +++ b/chrome/browser/ash/login/oobe_quick_start/connectivity/target_device_connection_broker_impl.cc
@@ -475,6 +475,13 @@ void TargetDeviceConnectionBrokerImpl::OnIncomingConnectionInitiated( const std::string& endpoint_id, const std::vector<uint8_t>& endpoint_info) { + if (is_resume_after_update_) { + QS_LOG(INFO) << "Skipped manual verification and will attempt an " + "\"automatic handshake\": endpoint_id=" + << endpoint_id; + return; + } + QS_LOG(INFO) << "Incoming Nearby Connection Initiated: endpoint_id=" << endpoint_id << " use_pin_authentication=" << use_pin_authentication_; @@ -510,7 +517,7 @@ &TargetDeviceConnectionBrokerImpl::OnConnectionAuthenticated, weak_ptr_factory_.GetWeakPtr())); - if (use_pin_authentication_) { + if (use_pin_authentication_ && !is_resume_after_update_) { QS_LOG(INFO) << "Pin authentication completed!"; connection_->MarkConnectionAuthenticated(); } else {
diff --git a/chrome/browser/ash/login/oobe_quick_start/connectivity/target_device_connection_broker_impl_unittest.cc b/chrome/browser/ash/login/oobe_quick_start/connectivity/target_device_connection_broker_impl_unittest.cc index dbe5744..4388159 100644 --- a/chrome/browser/ash/login/oobe_quick_start/connectivity/target_device_connection_broker_impl_unittest.cc +++ b/chrome/browser/ash/login/oobe_quick_start/connectivity/target_device_connection_broker_impl_unittest.cc
@@ -320,7 +320,7 @@ kEndpointId, kAuthenticationToken); } - void CreateConnectionBroker() { + void CreateConnectionBroker(bool is_resume_after_update = false) { auto connection_factory = std::make_unique<FakeConnection::Factory>(); connection_factory_ = connection_factory.get(); connection_broker_ = std::make_unique<TargetDeviceConnectionBrokerImpl>( @@ -328,7 +328,7 @@ std::move(connection_factory), mojo::SharedRemote<mojom::QuickStartDecoder>( fake_quick_start_decoder_->GetRemote()), - false); + is_resume_after_update); } void FinishFetchingBluetoothAdapter() { @@ -423,12 +423,7 @@ TargetDeviceConnectionBroker::SharedSecret expected_shared_secret = GetSecondarySharedSecret(); - connection_broker_ = - ash::quick_start::TargetDeviceConnectionBrokerFactory::Create( - fake_nearby_connections_manager_.GetWeakPtr(), - mojo::SharedRemote<mojom::QuickStartDecoder>( - fake_quick_start_decoder_->GetRemote()), - /*is_resume_after_update=*/true); + CreateConnectionBroker(/*is_resume_after_update=*/true); ASSERT_EQ(expected_random_session_id, GetRandomSessionId().ToString()); ASSERT_EQ(expected_shared_secret, GetSharedSecret()); } @@ -871,4 +866,52 @@ EXPECT_TRUE(start_advertising_callback_success_); } +TEST_F(TargetDeviceConnectionBrokerImplTest, + HandshakeInitiatedWhenResumeAfterUpdate_UseQRCodeAuthentication) { + ResumeAfterUpdate(); + FinishFetchingBluetoothAdapter(); + connection_broker_->StartAdvertising(&connection_lifecycle_listener_, + /* use_pin_authentication= */ false, + base::DoNothing()); + ASSERT_FALSE(connection_lifecycle_listener_.qr_code_data_); + NearbyConnectionsManager::IncomingConnectionListener* + incoming_connection_listener = + fake_nearby_connections_manager_.GetAdvertisingListener(); + ASSERT_TRUE(incoming_connection_listener); + incoming_connection_listener->OnIncomingConnectionInitiated( + kEndpointId, std::vector<uint8_t>()); + // On the first attempt to resume the connection after an update, no QR code + // or PIN should be generated on connection initiated. + EXPECT_FALSE(connection_lifecycle_listener_.qr_code_data_); + incoming_connection_listener->OnIncomingConnectionAccepted( + kEndpointId, std::vector<uint8_t>(), &fake_nearby_connection_); + + ASSERT_TRUE(connection()); + EXPECT_TRUE(connection()->WasHandshakeInitiated()); +} + +TEST_F(TargetDeviceConnectionBrokerImplTest, + HandshakeInitiatedWhenResumeAfterUpdate_UsePinAuthentication) { + ResumeAfterUpdate(); + FinishFetchingBluetoothAdapter(); + connection_broker_->StartAdvertising(&connection_lifecycle_listener_, + /* use_pin_authentication= */ true, + base::DoNothing()); + ASSERT_FALSE(connection_lifecycle_listener_.pin_); + NearbyConnectionsManager::IncomingConnectionListener* + incoming_connection_listener = + fake_nearby_connections_manager_.GetAdvertisingListener(); + ASSERT_TRUE(incoming_connection_listener); + incoming_connection_listener->OnIncomingConnectionInitiated( + kEndpointId, std::vector<uint8_t>()); + // On the first attempt to resume the connection after an update, no QR code + // or PIN should be generated on connection initiated. + EXPECT_FALSE(connection_lifecycle_listener_.pin_); + incoming_connection_listener->OnIncomingConnectionAccepted( + kEndpointId, std::vector<uint8_t>(), &fake_nearby_connection_); + + ASSERT_TRUE(connection()); + EXPECT_TRUE(connection()->WasHandshakeInitiated()); +} + } // namespace ash::quick_start
diff --git a/chrome/browser/ash/policy/handlers/app_launch_automation_policy_handler.cc b/chrome/browser/ash/policy/handlers/app_launch_automation_policy_handler.cc new file mode 100644 index 0000000..58cfc77 --- /dev/null +++ b/chrome/browser/ash/policy/handlers/app_launch_automation_policy_handler.cc
@@ -0,0 +1,45 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/policy/handlers/app_launch_automation_policy_handler.h" + +#include "ash/constants/ash_pref_names.h" +#include "base/values.h" +#include "chrome/common/pref_names.h" +#include "components/policy/core/common/schema.h" +#include "components/policy/policy_constants.h" +#include "components/prefs/pref_value_map.h" + +namespace policy { + +AppLaunchAutomationPolicyHandler::AppLaunchAutomationPolicyHandler( + const Schema& chrome_schema) + : SchemaValidatingPolicyHandler( + key::kAppLaunchAutomation, + chrome_schema.GetKnownProperty(key::kAppLaunchAutomation), + SCHEMA_ALLOW_UNKNOWN) {} + +AppLaunchAutomationPolicyHandler::~AppLaunchAutomationPolicyHandler() = default; + +bool AppLaunchAutomationPolicyHandler::CheckPolicySettings( + const PolicyMap& policies, + PolicyErrorMap* errors) { + // TODO(b/268538092): Validate app launch automation policy value. + return true; +} + +void AppLaunchAutomationPolicyHandler::ApplyPolicySettings( + const PolicyMap& policies, + PrefValueMap* prefs) { + std::unique_ptr<base::Value> policy_value; + if (!CheckAndGetValue(policies, /*errors=*/nullptr, &policy_value) || + !policy_value || !policy_value->is_list()) { + return; + } + + prefs->SetValue(ash::prefs::kAppLaunchAutomation, + base::Value::FromUniquePtrValue(std::move(policy_value))); +} + +} // namespace policy
diff --git a/chrome/browser/ash/policy/handlers/app_launch_automation_policy_handler.h b/chrome/browser/ash/policy/handlers/app_launch_automation_policy_handler.h new file mode 100644 index 0000000..2acdd93e2 --- /dev/null +++ b/chrome/browser/ash/policy/handlers/app_launch_automation_policy_handler.h
@@ -0,0 +1,36 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_POLICY_HANDLERS_APP_LAUNCH_AUTOMATION_POLICY_HANDLER_H_ +#define CHROME_BROWSER_ASH_POLICY_HANDLERS_APP_LAUNCH_AUTOMATION_POLICY_HANDLER_H_ + +#include "components/policy/core/browser/configuration_policy_handler.h" + +namespace policy { + +class Schema; + +// This class observes the user setting `AppLaunchAutomation` which allows +// administrators to configure automation for launching apps. +class AppLaunchAutomationPolicyHandler : public SchemaValidatingPolicyHandler { + public: + explicit AppLaunchAutomationPolicyHandler(const Schema& chrome_schema); + + AppLaunchAutomationPolicyHandler(const AppLaunchAutomationPolicyHandler&) = + delete; + AppLaunchAutomationPolicyHandler& operator=( + const AppLaunchAutomationPolicyHandler&) = delete; + + ~AppLaunchAutomationPolicyHandler() override; + + // SchemaValidatingPolicyHandler: + bool CheckPolicySettings(const PolicyMap& policies, + PolicyErrorMap* errors) override; + void ApplyPolicySettings(const PolicyMap& policies, + PrefValueMap* prefs) override; +}; + +} // namespace policy + +#endif // CHROME_BROWSER_ASH_POLICY_HANDLERS_APP_LAUNCH_AUTOMATION_POLICY_HANDLER_H_
diff --git a/chrome/browser/ash/policy/reporting/os_updates/os_updates_reporter.cc b/chrome/browser/ash/policy/reporting/os_updates/os_updates_reporter.cc index 3c472d4..f0e9ff4b 100644 --- a/chrome/browser/ash/policy/reporting/os_updates/os_updates_reporter.cc +++ b/chrome/browser/ash/policy/reporting/os_updates/os_updates_reporter.cc
@@ -87,7 +87,7 @@ record.set_current_os_version(os_version.value_or("0.0.0.0")); record.set_current_channel( - version_info::GetChannelString(chrome::GetChannel())); + std::string(version_info::GetChannelString(chrome::GetChannel()))); record.set_event_timestamp_sec(base::Time::Now().ToTimeT());
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 2738371..b07a991c 100644 --- a/chrome/browser/ash/policy/status_collector/device_status_collector.cc +++ b/chrome/browser/ash/policy/status_collector/device_status_collector.cc
@@ -2266,7 +2266,7 @@ bool DeviceStatusCollector::GetVersionInfo( em::DeviceStatusReportRequest* status) { status->set_os_version(os_version_); - status->set_browser_version(version_info::GetVersionNumber()); + status->set_browser_version(std::string(version_info::GetVersionNumber())); status->set_is_lacros_primary_browser( crosapi::browser_util::IsLacrosPrimaryBrowser()); status->set_channel(ConvertToProtoChannel(chrome::GetChannel()));
diff --git a/chrome/browser/ash/web_applications/eche_app_integration_browsertest.cc b/chrome/browser/ash/web_applications/eche_app_integration_browsertest.cc index ff7b7ce..659d06c 100644 --- a/chrome/browser/ash/web_applications/eche_app_integration_browsertest.cc +++ b/chrome/browser/ash/web_applications/eche_app_integration_browsertest.cc
@@ -89,7 +89,7 @@ gfx::Size min_size(240, 240); display::test::DisplayManagerTestApi display_manager_test( ash::Shell::Get()->display_manager()); - display_manager_test.UpdateDisplay("400x400"); + display_manager_test.UpdateDisplay("400x350"); WaitForTestSystemAppInstall(); Browser* browser;
diff --git a/chrome/browser/ash/web_applications/help_app/help_app_notification_controller_unittest.cc b/chrome/browser/ash/web_applications/help_app/help_app_notification_controller_unittest.cc index 4e98b10..71b6b7e9 100644 --- a/chrome/browser/ash/web_applications/help_app/help_app_notification_controller_unittest.cc +++ b/chrome/browser/ash/web_applications/help_app/help_app_notification_controller_unittest.cc
@@ -56,15 +56,15 @@ builder.SetProfileName("user@gmail.com"); std::unique_ptr<TestingProfile> profile = builder.Build(); // Set profile creation version, otherwise it defaults to 1.0.0.0. - ChromeVersionService::SetVersion(profile->GetPrefs(), - version_info::GetVersionNumber()); + ChromeVersionService::SetVersion( + profile->GetPrefs(), std::string(version_info::GetVersionNumber())); return profile; } std::unique_ptr<TestingProfile> CreateChildProfile() { std::unique_ptr<TestingProfile> profile = CreateRegularProfile(); - ChromeVersionService::SetVersion(profile->GetPrefs(), - version_info::GetVersionNumber()); + ChromeVersionService::SetVersion( + profile->GetPrefs(), std::string(version_info::GetVersionNumber())); profile->SetIsSupervisedProfile(); return profile; }
diff --git a/chrome/browser/ash/web_applications/personalization_app/personalization_app_wallpaper_provider_impl.cc b/chrome/browser/ash/web_applications/personalization_app/personalization_app_wallpaper_provider_impl.cc index edc4e663..a427d3f 100644 --- a/chrome/browser/ash/web_applications/personalization_app/personalization_app_wallpaper_provider_impl.cc +++ b/chrome/browser/ash/web_applications/personalization_app/personalization_app_wallpaper_provider_impl.cc
@@ -1009,10 +1009,13 @@ bool is_same_unit_id = info.unit_id.has_value() && proto_image.unit_id() == info.unit_id.value(); bool is_same_url = info.location.rfind(proto_image.image_url(), 0) == 0; - if (is_same_url || is_same_unit_id) { + if (is_same_url) { backend_image = &proto_image; break; } + if (is_same_unit_id) { + backend_image = &proto_image; + } } }
diff --git a/chrome/browser/autofill/autofill_server_browsertest.cc b/chrome/browser/autofill/autofill_server_browsertest.cc index b009de4..4cb6634e 100644 --- a/chrome/browser/autofill/autofill_server_browsertest.cc +++ b/chrome/browser/autofill/autofill_server_browsertest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <string> + #include "base/base64url.h" #include "base/base_switches.h" #include "base/command_line.h" @@ -225,7 +227,7 @@ "</script>"; AutofillPageQueryRequest query; - query.set_client_version(GetProductNameAndVersionForUserAgent()); + query.set_client_version(std::string(GetProductNameAndVersionForUserAgent())); auto* query_form = query.add_forms(); query_form->set_signature(15916856893790176210U); @@ -249,7 +251,8 @@ AutofillUploadRequest request; AutofillUploadContents* upload = request.mutable_upload(); upload->set_submission(true); - upload->set_client_version(GetProductNameAndVersionForUserAgent()); + upload->set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload->set_form_signature(15916856893790176210U); upload->set_autofill_used(false); @@ -319,7 +322,7 @@ "</form>"; AutofillPageQueryRequest query; - query.set_client_version(GetProductNameAndVersionForUserAgent()); + query.set_client_version(std::string(GetProductNameAndVersionForUserAgent())); auto* query_form = query.add_forms(); query_form->set_signature(8900697631820480876U);
diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc index 0d96e40..b249926 100644 --- a/chrome/browser/chrome_browser_main_win.cc +++ b/chrome/browser/chrome_browser_main_win.cc
@@ -391,9 +391,10 @@ local_state->GetString(prefs::kShortcutMigrationVersion)); if (!last_version_migrated.IsValid() || last_version_migrated < kLastVersionNeedingMigration) { - shell_integration::win::MigrateTaskbarPins(base::BindOnce( - &PrefService::SetString, base::Unretained(local_state), - prefs::kShortcutMigrationVersion, version_info::GetVersionNumber())); + shell_integration::win::MigrateTaskbarPins( + base::BindOnce(&PrefService::SetString, base::Unretained(local_state), + prefs::kShortcutMigrationVersion, + std::string(version_info::GetVersionNumber()))); } } }
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 6d864a0..1027d6c 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -2216,7 +2216,7 @@ } void ChromeContentBrowserClient::OverrideNavigationParams( - SiteInstance* site_instance, + absl::optional<GURL> source_process_site_url, ui::PageTransition* transition, bool* is_renderer_initiated, content::Referrer* referrer, @@ -2224,10 +2224,10 @@ DCHECK(transition); DCHECK(is_renderer_initiated); DCHECK(referrer); - // While using SiteInstance::GetSiteURL() is unreliable and the wrong thing to - // use for making security decisions 99.44% of the time, for detecting the NTP - // it is reliable and the correct way. See http://crbug.com/624410. - if (site_instance && search::IsNTPURL(site_instance->GetSiteURL()) && + // IsNTPURL only looks at the origin of the parameter, so it is safe to use + // the effective site URL for the source process. + if (source_process_site_url && + search::IsNTPURL(source_process_site_url.value()) && ui::PageTransitionCoreTypeIs(*transition, ui::PAGE_TRANSITION_LINK)) { // Clicks on tiles of the new tab page should be treated as if a user // clicked on a bookmark. This is consistent with native implementations @@ -6765,7 +6765,7 @@ } std::string ChromeContentBrowserClient::GetProduct() { - return version_info::GetProductNameAndVersionForUserAgent(); + return std::string(version_info::GetProductNameAndVersionForUserAgent()); } std::string ChromeContentBrowserClient::GetUserAgent() {
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 29958cf..cc8969d 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h
@@ -207,7 +207,7 @@ bool CanCommitURL(content::RenderProcessHost* process_host, const GURL& url) override; void OverrideNavigationParams( - content::SiteInstance* site_instance, + absl::optional<GURL> source_process_site_url, ui::PageTransition* transition, bool* is_renderer_initiated, content::Referrer* referrer,
diff --git a/chrome/browser/chrome_content_browser_client_unittest.cc b/chrome/browser/chrome_content_browser_client_unittest.cc index 3db84f2..b41958d0 100644 --- a/chrome/browser/chrome_content_browser_client_unittest.cc +++ b/chrome/browser/chrome_content_browser_client_unittest.cc
@@ -238,15 +238,13 @@ content::Referrer referrer = content::Referrer(); absl::optional<url::Origin> initiator_origin = absl::nullopt; - scoped_refptr<content::SiteInstance> site_instance = - content::SiteInstance::CreateForURL(browser()->profile(), - GURL("chrome-search://remote-ntp")); + GURL remote_ntp_url("chrome-search://remote-ntp"); transition = ui::PAGE_TRANSITION_LINK; is_renderer_initiated = true; // The origin is a placeholder to test that |initiator_origin| is set to // absl::nullopt and is not meant to represent what would happen in practice. initiator_origin = url::Origin::Create(GURL("https://www.example.com")); - client.OverrideNavigationParams(site_instance.get(), &transition, + client.OverrideNavigationParams(remote_ntp_url, &transition, &is_renderer_initiated, &referrer, &initiator_origin); EXPECT_TRUE(ui::PageTransitionCoreTypeIs(ui::PAGE_TRANSITION_AUTO_BOOKMARK, @@ -254,34 +252,29 @@ EXPECT_FALSE(is_renderer_initiated); EXPECT_EQ(absl::nullopt, initiator_origin); - site_instance = content::SiteInstance::CreateForURL( - browser()->profile(), GURL("chrome://new-tab-page")); transition = ui::PAGE_TRANSITION_LINK; is_renderer_initiated = true; initiator_origin = url::Origin::Create(GURL("https://www.example.com")); - client.OverrideNavigationParams(site_instance.get(), &transition, - &is_renderer_initiated, &referrer, - &initiator_origin); + client.OverrideNavigationParams(GURL(chrome::kChromeUINewTabPageURL), + &transition, &is_renderer_initiated, + &referrer, &initiator_origin); EXPECT_TRUE(ui::PageTransitionCoreTypeIs(ui::PAGE_TRANSITION_AUTO_BOOKMARK, transition)); EXPECT_FALSE(is_renderer_initiated); EXPECT_EQ(absl::nullopt, initiator_origin); // No change for transitions that are not PAGE_TRANSITION_LINK. - site_instance = content::SiteInstance::CreateForURL( - browser()->profile(), GURL("chrome://new-tab-page")); transition = ui::PAGE_TRANSITION_TYPED; - client.OverrideNavigationParams(site_instance.get(), &transition, - &is_renderer_initiated, &referrer, - &initiator_origin); + client.OverrideNavigationParams(GURL(chrome::kChromeUINewTabPageURL), + &transition, &is_renderer_initiated, + &referrer, &initiator_origin); EXPECT_TRUE( ui::PageTransitionCoreTypeIs(ui::PAGE_TRANSITION_TYPED, transition)); // No change for transitions on a non-NTP page. - site_instance = content::SiteInstance::CreateForURL( - browser()->profile(), GURL("https://www.example.com")); + GURL example_url("https://www.example.com"); transition = ui::PAGE_TRANSITION_LINK; - client.OverrideNavigationParams(site_instance.get(), &transition, + client.OverrideNavigationParams(example_url, &transition, &is_renderer_initiated, &referrer, &initiator_origin); EXPECT_TRUE(
diff --git a/chrome/browser/companion/core/features.cc b/chrome/browser/companion/core/features.cc index c6444eb..5459415 100644 --- a/chrome/browser/companion/core/features.cc +++ b/chrome/browser/companion/core/features.cc
@@ -23,7 +23,7 @@ constexpr base::FeatureParam<std::string> kImageUploadURLForCompanion{ &kSidePanelCompanion, "companion-image-upload-url", - "https://www.example.com"}; + "https://lens.google.com/upload"}; constexpr base::FeatureParam<bool> kEnableOpenCompanionForImageSearch{ &kSidePanelCompanion, "open-companion-for-image-search", true}; constexpr base::FeatureParam<bool> kEnableOpenCompanionForWebSearch{
diff --git a/chrome/browser/device_reauth/android/java/src/org/chromium/chrome/browser/device_reauth/ReauthenticatorBridge.java b/chrome/browser/device_reauth/android/java/src/org/chromium/chrome/browser/device_reauth/ReauthenticatorBridge.java index efb9955..4e075d4 100644 --- a/chrome/browser/device_reauth/android/java/src/org/chromium/chrome/browser/device_reauth/ReauthenticatorBridge.java +++ b/chrome/browser/device_reauth/android/java/src/org/chromium/chrome/browser/device_reauth/ReauthenticatorBridge.java
@@ -25,13 +25,23 @@ } /** - * Checks if authentication can be used. Note that whether check is specific to biometric - * authentication or biometric + screen lock is based on DeviceAuthRequester. + * Checks if biometric authentication can be used. * * @return Whether authentication can be used. */ - public boolean canUseAuthentication() { - return ReauthenticatorBridgeJni.get().canUseAuthentication(mNativeReauthenticatorBridge); + public boolean canUseAuthenticationWithBiometric() { + return ReauthenticatorBridgeJni.get().canUseAuthenticationWithBiometric( + mNativeReauthenticatorBridge); + } + + /** + * Checks if biometric or screen lock authentication can be used. + * + * @return Whether authentication can be used. + */ + public boolean canUseAuthenticationWithBiometricOrScreenLock() { + return ReauthenticatorBridgeJni.get().canUseAuthenticationWithBiometricOrScreenLock( + mNativeReauthenticatorBridge); } /** @@ -75,7 +85,8 @@ @NativeMethods interface Natives { long create(ReauthenticatorBridge reauthenticatorBridge, int requester); - boolean canUseAuthentication(long nativeReauthenticatorBridge); + boolean canUseAuthenticationWithBiometric(long nativeReauthenticatorBridge); + boolean canUseAuthenticationWithBiometricOrScreenLock(long nativeReauthenticatorBridge); void reauthenticate(long nativeReauthenticatorBridge, boolean useLastValidAuth); } }
diff --git a/chrome/browser/device_reauth/android/reauthenticator_bridge.cc b/chrome/browser/device_reauth/android/reauthenticator_bridge.cc index 1fc5a36..77b55aaf 100644 --- a/chrome/browser/device_reauth/android/reauthenticator_bridge.cc +++ b/chrome/browser/device_reauth/android/reauthenticator_bridge.cc
@@ -34,13 +34,14 @@ } } -bool ReauthenticatorBridge::CanUseAuthentication(JNIEnv* env) { - if (!authenticator_) { - return false; - } - return requester_ == device_reauth::DeviceAuthRequester::kIncognitoReauthPage - ? authenticator_->CanAuthenticateWithBiometricOrScreenLock() - : authenticator_->CanAuthenticateWithBiometrics(); +bool ReauthenticatorBridge::CanUseAuthenticationWithBiometric(JNIEnv* env) { + return authenticator_ && authenticator_->CanAuthenticateWithBiometrics(); +} + +bool ReauthenticatorBridge::CanUseAuthenticationWithBiometricOrScreenLock( + JNIEnv* env) { + return authenticator_ && + authenticator_->CanAuthenticateWithBiometricOrScreenLock(); } void ReauthenticatorBridge::Reauthenticate(JNIEnv* env,
diff --git a/chrome/browser/device_reauth/android/reauthenticator_bridge.h b/chrome/browser/device_reauth/android/reauthenticator_bridge.h index f129d660..82567601 100644 --- a/chrome/browser/device_reauth/android/reauthenticator_bridge.h +++ b/chrome/browser/device_reauth/android/reauthenticator_bridge.h
@@ -22,8 +22,12 @@ ReauthenticatorBridge(const ReauthenticatorBridge&) = delete; ReauthenticatorBridge& operator=(const ReauthenticatorBridge&) = delete; - // Called by Java to check if authentication can be used. - bool CanUseAuthentication(JNIEnv* env); + // Called by Java to check if biometric authentication can be used. + bool CanUseAuthenticationWithBiometric(JNIEnv* env); + + // Called by Java to check if biometric or screen lock authentication can be + // used. + bool CanUseAuthenticationWithBiometricOrScreenLock(JNIEnv* env); // Called by Java to start authentication. void Reauthenticate(JNIEnv* env, bool use_last_valid_auth);
diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc index 4a550b5..9645b12 100644 --- a/chrome/browser/diagnostics/recon_diagnostics.cc +++ b/chrome/browser/diagnostics/recon_diagnostics.cc
@@ -297,7 +297,7 @@ VersionTest& operator=(const VersionTest&) = delete; bool ExecuteImpl(DiagnosticsModel::Observer* observer) override { - std::string current_version = version_info::GetVersionNumber(); + std::string current_version(version_info::GetVersionNumber()); if (current_version.empty()) { RecordFailure(DIAG_RECON_EMPTY_VERSION, "Empty Version"); return true;
diff --git a/chrome/browser/download/android/java/res/drawable/ic_incognito_download_message.xml b/chrome/browser/download/android/java/res/drawable/ic_incognito_download_message.xml index 6908049b..7ccf32e3 100644 --- a/chrome/browser/download/android/java/res/drawable/ic_incognito_download_message.xml +++ b/chrome/browser/download/android/java/res/drawable/ic_incognito_download_message.xml
@@ -5,6 +5,6 @@ android:viewportHeight="17"> <path android:pathData="M14,6H10V0H4V6H0L7,13L14,6V6ZM0,15V17H14V15H0V15Z" - android:fillColor="@color/baseline_primary_200" + android:fillColor="@color/baseline_primary_80" android:fillType="evenOdd"/> </vector>
diff --git a/chrome/browser/download/download_history.cc b/chrome/browser/download/download_history.cc index a1298292..a7e136d 100644 --- a/chrome/browser/download/download_history.cc +++ b/chrome/browser/download/download_history.cc
@@ -58,6 +58,10 @@ #include "chrome/browser/extensions/api/downloads/downloads_api.h" #endif +#if !BUILDFLAG(IS_ANDROID) +#include "chrome/browser/download/download_item_web_app_data.h" +#endif + using history::DownloadState; namespace { @@ -140,16 +144,25 @@ "DownloadItem DownloadHistoryData"; history::DownloadRow GetDownloadRow(download::DownloadItem* item) { - std::string by_ext_id, by_ext_name; + std::string by_ext_or_web_app_id, by_ext_name; + bool is_by_web_app = false; #if BUILDFLAG(ENABLE_EXTENSIONS) extensions::DownloadedByExtension* by_ext = extensions::DownloadedByExtension::Get(item); if (by_ext) { - by_ext_id = by_ext->id(); + by_ext_or_web_app_id = by_ext->id(); by_ext_name = by_ext->name(); } #endif +#if !BUILDFLAG(IS_ANDROID) + DownloadItemWebAppData* web_app_data = DownloadItemWebAppData::Get(item); + if (web_app_data) { + by_ext_or_web_app_id = web_app_data->id(); + is_by_web_app = true; + } +#endif + history::DownloadRow download; download.current_path = item->GetFullPath(); download.target_path = item->GetTargetFilePath(); @@ -178,8 +191,9 @@ download.opened = item->GetOpened(); download.last_access_time = item->GetLastAccessTime(); download.transient = item->IsTransient(); - download.by_ext_id = by_ext_id; + download.by_ext_or_web_app_id = by_ext_or_web_app_id; download.by_ext_name = by_ext_name; + download.is_by_web_app = is_by_web_app; download.download_slice_info = history::GetHistoryDownloadSliceInfos(*item); TruncatedDataUrlAtTheEndIfNeeded(&download.url_chain); return download; @@ -221,8 +235,9 @@ (previous->opened != current.opened) || (previous->last_access_time != current.last_access_time) || (previous->transient != current.transient) || - (previous->by_ext_id != current.by_ext_id) || + (previous->by_ext_or_web_app_id != current.by_ext_or_web_app_id) || (previous->by_ext_name != current.by_ext_name) || + (previous->is_by_web_app != current.is_by_web_app) || (previous->download_slice_info != current.download_slice_info)) { return ShouldUpdateHistoryResult::UPDATE; } @@ -435,15 +450,26 @@ history_reason)) { OnDownloadUpdated(notifier_.GetManager(), item); } + bool should_update_observers = false; #if BUILDFLAG(ENABLE_EXTENSIONS) - if (!row.by_ext_id.empty() && !row.by_ext_name.empty()) { + if (!row.by_ext_or_web_app_id.empty() && !row.is_by_web_app && + !row.by_ext_name.empty()) { SCOPED_UMA_HISTOGRAM_TIMER( "Download.LoadHistoryDownloads.AddExtensionInfoAndNotifyTime"); - new extensions::DownloadedByExtension(item, row.by_ext_id, + new extensions::DownloadedByExtension(item, row.by_ext_or_web_app_id, row.by_ext_name); - item->UpdateObservers(); + should_update_observers = true; } #endif +#if !BUILDFLAG(IS_ANDROID) + if (!row.by_ext_or_web_app_id.empty() && row.is_by_web_app) { + new DownloadItemWebAppData(item, row.by_ext_or_web_app_id); + should_update_observers = true; + } +#endif + if (should_update_observers) { + item->UpdateObservers(); + } DCHECK_EQ(DownloadHistoryData::PERSISTED, DownloadHistoryData::Get(item)->state()); }
diff --git a/chrome/browser/download/download_history_unittest.cc b/chrome/browser/download/download_history_unittest.cc index df2e9f1..d857bb2 100644 --- a/chrome/browser/download/download_history_unittest.cc +++ b/chrome/browser/download/download_history_unittest.cc
@@ -41,6 +41,10 @@ #include "chrome/browser/extensions/api/downloads/downloads_api.h" #endif +#if !BUILDFLAG(IS_ANDROID) +#include "chrome/browser/download/download_item_web_app_data.h" +#endif + using testing::_; using testing::DoAll; using testing::Invoke; @@ -466,8 +470,15 @@ .WillRepeatedly(Return(&item(index))); EXPECT_CALL(item(index), IsTemporary()).WillRepeatedly(Return(false)); #if BUILDFLAG(ENABLE_EXTENSIONS) - new extensions::DownloadedByExtension(&item(index), row->by_ext_id, - row->by_ext_name); + if (!row->is_by_web_app) { + new extensions::DownloadedByExtension( + &item(index), row->by_ext_or_web_app_id, row->by_ext_name); + } +#endif +#if !BUILDFLAG(IS_ANDROID) + if (!row->by_ext_or_web_app_id.empty() && row->is_by_web_app) { + new DownloadItemWebAppData(&item(index), row->by_ext_or_web_app_id); + } #endif std::vector<download::DownloadItem*> items; @@ -989,4 +1000,26 @@ EXPECT_TRUE(DownloadHistory::IsPersisted(&item(1))); } +#if !BUILDFLAG(IS_ANDROID) +// Test that web app id is inserted into history. +TEST_F(DownloadHistoryTest, ByWebAppId) { + // Create a fresh item not from download DB + CreateDownloadHistory({}); + + history::DownloadRow row; + row.by_ext_or_web_app_id = "by_web_app_id"; + row.is_by_web_app = true; + InitBasicItem(FILE_PATH_LITERAL("/foo/bar.pdf"), "http://example.com/bar.pdf", + "http://example.com/referrer.html", + download::DownloadItem::COMPLETE, &row); + + EXPECT_CALL(item(0), IsDone()).WillRepeatedly(Return(true)); + + CallOnDownloadCreated(0); + ExpectDownloadCreated(row); + EXPECT_TRUE(DownloadHistory::IsPersisted(&item(0))); + EXPECT_NE(DownloadItemWebAppData::Get(&item(0)), nullptr); +} +#endif + } // anonymous namespace
diff --git a/chrome/browser/enterprise/connectors/connectors_service.cc b/chrome/browser/enterprise/connectors/connectors_service.cc index 500879b..8dcb5bf 100644 --- a/chrome/browser/enterprise/connectors/connectors_service.cc +++ b/chrome/browser/enterprise/connectors/connectors_service.cc
@@ -75,7 +75,8 @@ base::FilePath browser_id; if (base::PathService::Get(base::DIR_EXE, &browser_id)) browser_proto->set_browser_id(browser_id.AsUTF8Unsafe()); - browser_proto->set_chrome_version(version_info::GetVersionNumber()); + browser_proto->set_chrome_version( + std::string(version_info::GetVersionNumber())); if (include_device_info) browser_proto->set_machine_user(policy::GetOSUsername()); }
diff --git a/chrome/browser/enterprise/connectors/device_trust/common/metrics_utils.cc b/chrome/browser/enterprise/connectors/device_trust/common/metrics_utils.cc index dde02c1..e1afa355 100644 --- a/chrome/browser/enterprise/connectors/device_trust/common/metrics_utils.cc +++ b/chrome/browser/enterprise/connectors/device_trust/common/metrics_utils.cc
@@ -46,6 +46,31 @@ } } +bool ContainsPolicyLevel(const std::set<DTCPolicyLevel>& levels, + const DTCPolicyLevel& level) { + return levels.find(level) != levels.end(); +} + +DTAttestationPolicyLevel GetAttestationPolicyLevel( + const std::set<DTCPolicyLevel>& levels) { + if (levels.empty()) { + return DTAttestationPolicyLevel::kNone; + } + + if (ContainsPolicyLevel(levels, DTCPolicyLevel::kBrowser)) { + if (ContainsPolicyLevel(levels, DTCPolicyLevel::kUser)) { + return DTAttestationPolicyLevel::kUserAndBrowser; + } + return DTAttestationPolicyLevel::kBrowser; + } + + if (ContainsPolicyLevel(levels, DTCPolicyLevel::kUser)) { + return DTAttestationPolicyLevel::kUser; + } + + return DTAttestationPolicyLevel::kUnknown; +} + } // namespace void LogAttestationFunnelStep(DTAttestationFunnelStep step) { @@ -55,6 +80,13 @@ VLOG(1) << "Device Trust attestation step: " << static_cast<int>(step); } +void LogAttestationPolicyLevel(const std::set<DTCPolicyLevel>& levels) { + static constexpr char kAttestationPolicyLevelHistogram[] = + "Enterprise.DeviceTrust.Attestation.PolicyLevel"; + base::UmaHistogramEnumeration(kAttestationPolicyLevelHistogram, + GetAttestationPolicyLevel(levels)); +} + void LogAttestationResult(DTAttestationResult result) { static constexpr char kAttestationResultHistogram[] = "Enterprise.DeviceTrust.Attestation.Result";
diff --git a/chrome/browser/enterprise/connectors/device_trust/common/metrics_utils.h b/chrome/browser/enterprise/connectors/device_trust/common/metrics_utils.h index 071ebbcb..1355a20 100644 --- a/chrome/browser/enterprise/connectors/device_trust/common/metrics_utils.h +++ b/chrome/browser/enterprise/connectors/device_trust/common/metrics_utils.h
@@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_ENTERPRISE_CONNECTORS_DEVICE_TRUST_COMMON_METRICS_UTILS_H_ #define CHROME_BROWSER_ENTERPRISE_CONNECTORS_DEVICE_TRUST_COMMON_METRICS_UTILS_H_ +#include <set> + #include "base/time/time.h" #include "chrome/browser/enterprise/connectors/device_trust/common/common_types.h" @@ -33,6 +35,19 @@ kMaxValue = kFailedToCreateResponse }; +// Policy levels that are enabled for the Device Trust connector which determine +// the result of the challenge response in the attestation flow. These values +// are persisted to logs and should not be renumbered. Please update the +// DTAttestationPolicyLevel enum in enums.xml when adding a new step here. +enum class DTAttestationPolicyLevel { + kNone = 0, + kUnknown = 1, + kBrowser = 2, + kUser = 3, + kUserAndBrowser = 4, + kMaxValue = kUserAndBrowser +}; + #if BUILDFLAG(IS_CHROMEOS_ASH) // Possible origins of the Device Trust connector attestation flow on ChromeOS. // These values are persisted to logs and should not be renumbered. Please @@ -46,6 +61,8 @@ void LogAttestationFunnelStep(DTAttestationFunnelStep step); +void LogAttestationPolicyLevel(const std::set<DTCPolicyLevel>& levels); + void LogAttestationResult(DTAttestationResult result); void LogDeviceTrustResponse(const DeviceTrustResponse& response,
diff --git a/chrome/browser/enterprise/connectors/device_trust/navigation_throttle.cc b/chrome/browser/enterprise/connectors/device_trust/navigation_throttle.cc index beb7d40..17ec610 100644 --- a/chrome/browser/enterprise/connectors/device_trust/navigation_throttle.cc +++ b/chrome/browser/enterprise/connectors/device_trust/navigation_throttle.cc
@@ -177,6 +177,7 @@ // Because BuildChallengeResponse() may run the resume callback // synchronously, this call is deferred to ensure that this method returns // DEFER before `resume_navigation_callback` is invoked. + LogAttestationPolicyLevel(levels); base::SequencedTaskRunner::GetCurrentDefault()->PostTask( FROM_HERE, base::BindOnce(
diff --git a/chrome/browser/enterprise/connectors/device_trust/navigation_throttle_unittest.cc b/chrome/browser/enterprise/connectors/device_trust/navigation_throttle_unittest.cc index 2be63c64..dcb7c6c 100644 --- a/chrome/browser/enterprise/connectors/device_trust/navigation_throttle_unittest.cc +++ b/chrome/browser/enterprise/connectors/device_trust/navigation_throttle_unittest.cc
@@ -64,6 +64,8 @@ "Enterprise.DeviceTrust.Attestation.Funnel"; constexpr char kHandshakeResultHistogram[] = "Enterprise.DeviceTrust.Handshake.Result"; +constexpr char kPolicyLevelsHistogramName[] = + "Enterprise.DeviceTrust.Attestation.PolicyLevel"; scoped_refptr<net::HttpResponseHeaders> GetHeaderChallenge( const std::string& challenge) { @@ -141,6 +143,9 @@ EXPECT_EQ(NavigationThrottle::DEFER, throttle->WillStartRequest().action()); histogram_tester_.ExpectUniqueSample( kFunnelHistogramName, DTAttestationFunnelStep::kChallengeReceived, 1); + histogram_tester_.ExpectUniqueSample( + kPolicyLevelsHistogramName, DTAttestationPolicyLevel::kUserAndBrowser, + 1); run_loop.Run(); histogram_tester_.ExpectTotalCount( base::StringPrintf(kLatencyHistogramName, @@ -305,7 +310,8 @@ EXPECT_EQ(NavigationThrottle::DEFER, throttle->WillStartRequest().action()); histogram_tester_.ExpectUniqueSample( kFunnelHistogramName, DTAttestationFunnelStep::kChallengeReceived, 1); - + histogram_tester_.ExpectUniqueSample( + kPolicyLevelsHistogramName, DTAttestationPolicyLevel::kUserAndBrowser, 1); task_environment_.FastForwardBy(kTimeoutTime); run_loop.Run();
diff --git a/chrome/browser/enterprise/connectors/device_trust/prefs.h b/chrome/browser/enterprise/connectors/device_trust/prefs.h index e23e08e..10eb84d6e 100644 --- a/chrome/browser/enterprise/connectors/device_trust/prefs.h +++ b/chrome/browser/enterprise/connectors/device_trust/prefs.h
@@ -10,17 +10,14 @@ namespace enterprise_connectors { -// Pref that maps to the "ContextAwareAccessSignalsAllowlistPref" policy. -// TODO(b/279840937): Clean up the "ContextAwareAccessSignalsAllowlistPref" -// policy and references of this pref. +// Pref that maps to the "ContextAwareAccessSignalsAllowlist" policy. +// TODO(b/279840937): Clean up this policy and its references. extern const char kContextAwareAccessSignalsAllowlistPref[]; -// TODO(b/279077254): Pref that maps to the -// "UserContextAwareAccessSignalsAllowlistPref" policy. +// Pref that maps to the "UserContextAwareAccessSignalsAllowlist" policy. extern const char kUserContextAwareAccessSignalsAllowlistPref[]; -// TODO(b/279077254): Pref that maps to the -// "BrowserContextAwareAccessSignalsAllowlistPref" policy. +// Pref that maps to the "BrowserContextAwareAccessSignalsAllowlist" policy. extern const char kBrowserContextAwareAccessSignalsAllowlistPref[]; // Registers the device trust connectors profile preferences.
diff --git a/chrome/browser/enterprise/connectors/reporting/crash_reporting_context.cc b/chrome/browser/enterprise/connectors/reporting/crash_reporting_context.cc index 2b3ae16c..58ca9f2 100644 --- a/chrome/browser/enterprise/connectors/reporting/crash_reporting_context.cc +++ b/chrome/browser/enterprise/connectors/reporting/crash_reporting_context.cc
@@ -159,10 +159,10 @@ } absl::optional<ReportingSettings> settings = reporting_client->GetReportingSettings(); - const std::string version = version_info::GetVersionNumber(); - const std::string channel = - version_info::GetChannelString(chrome::GetChannel()); - const std::string platform = version_info::GetOSType(); + const std::string version(version_info::GetVersionNumber()); + const std::string channel( + version_info::GetChannelString(chrome::GetChannel())); + const std::string platform(version_info::GetOSType()); int64_t latest_creation_time = -1;
diff --git a/chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_report_generator.cc b/chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_report_generator.cc new file mode 100644 index 0000000..c2fc151 --- /dev/null +++ b/chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_report_generator.cc
@@ -0,0 +1,49 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_report_generator.h" + +namespace enterprise_reporting { + +LegacyTechReportGenerator::LegacyTechData::LegacyTechData() = default; +LegacyTechReportGenerator::LegacyTechData::LegacyTechData( + const std::string& type, + const base::Time& timestamp, + const GURL& url, + const std::string& matched_url, + const std::string& filename, + uint64_t line, + uint64_t column) + : type(type), + timestamp(timestamp), + url(url), + matched_url(matched_url), + filename(filename), + line(line), + column(column) {} +LegacyTechReportGenerator::LegacyTechData::~LegacyTechData() = default; + +LegacyTechReportGenerator::LegacyTechReportGenerator() = default; +LegacyTechReportGenerator::~LegacyTechReportGenerator() = default; + +std::vector<std::unique_ptr<LegacyTechEvent>> +LegacyTechReportGenerator::Generate(const RealTimeReportGenerator::Data& data) { + const LegacyTechData& legacy_tech_data = + static_cast<const LegacyTechData&>(data); + std::unique_ptr<LegacyTechEvent> report = std::make_unique<LegacyTechEvent>(); + report->set_feature_id(legacy_tech_data.type); + // Blur timestamp for privacy. + report->set_event_timestamp_millis( + legacy_tech_data.timestamp.UTCMidnight().ToJavaTime()); + report->set_url(legacy_tech_data.url.spec()); + report->set_allowlisted_url_match(legacy_tech_data.matched_url); + report->set_filename(legacy_tech_data.filename); + report->set_column(legacy_tech_data.column); + report->set_line(legacy_tech_data.line); + std::vector<std::unique_ptr<LegacyTechEvent>> reports; + reports.push_back(std::move(report)); + return reports; +} + +} // namespace enterprise_reporting
diff --git a/chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_report_generator.h b/chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_report_generator.h new file mode 100644 index 0000000..0145b5e --- /dev/null +++ b/chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_report_generator.h
@@ -0,0 +1,53 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ENTERPRISE_REPORTING_LEGACY_TECH_LEGACY_TECH_REPORT_GENERATOR_H_ +#define CHROME_BROWSER_ENTERPRISE_REPORTING_LEGACY_TECH_LEGACY_TECH_REPORT_GENERATOR_H_ + +#include <memory> +#include <string> +#include <vector> + +#include "base/memory/raw_ptr.h" +#include "base/time/time.h" +#include "components/enterprise/browser/reporting/real_time_report_generator.h" +#include "components/enterprise/common/proto/legacy_tech_events.pb.h" +#include "url/gurl.h" + +namespace enterprise_reporting { + +class LegacyTechReportGenerator { + public: + struct LegacyTechData : public RealTimeReportGenerator::Data { + LegacyTechData(); + LegacyTechData(const std::string& type, + const base::Time& timestamp, + const GURL& url, + const std::string& matched_url, + const std::string& filename, + uint64_t line, + uint64_t column); + ~LegacyTechData(); + std::string type; + base::Time timestamp; + GURL url; + std::string matched_url; + std::string filename; + uint64_t line; + uint64_t column; + }; + + LegacyTechReportGenerator(); + LegacyTechReportGenerator(const LegacyTechReportGenerator&) = delete; + LegacyTechReportGenerator& operator=(const LegacyTechReportGenerator&) = + delete; + ~LegacyTechReportGenerator(); + + std::vector<std::unique_ptr<LegacyTechEvent>> Generate( + const RealTimeReportGenerator::Data& data); +}; + +} // namespace enterprise_reporting + +#endif // CHROME_BROWSER_ENTERPRISE_REPORTING_LEGACY_TECH_LEGACY_TECH_REPORT_GENERATOR_H_
diff --git a/chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_report_generator_unittest.cc b/chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_report_generator_unittest.cc new file mode 100644 index 0000000..7ec06cd --- /dev/null +++ b/chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_report_generator_unittest.cc
@@ -0,0 +1,58 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_report_generator.h" + +#include "base/time/time.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" + +namespace enterprise_reporting { + +namespace { +base::Time::Exploded kTestDate = { + 2023, 5, 4, 4, // May. 4, 2023, Thu + 22, 10, 15, 0 // 22:10:15.000 +}; + +base::Time::Exploded kTestDateInMidnight = { + 2023, 5, 4, 4, // May. 4, 2023, Thu + 0, 0, 0, 0 // 00:00:00.000 +}; + +} // namespace + +class LegacyTechGeneratorTest : public ::testing::Test { + public: + LegacyTechGeneratorTest() = default; + ~LegacyTechGeneratorTest() override = default; +}; + +TEST_F(LegacyTechGeneratorTest, Test) { + LegacyTechReportGenerator::LegacyTechData data = { + /*type=*/"type", + /*timestamp=*/base::Time(), + /*url=*/GURL("https://www.example.com/path"), + /*matched_url=*/"www.example.com", + /*filename=*/"filename.js", + /*line=*/10, + /*column=*/42}; + ASSERT_TRUE(base::Time::FromUTCExploded(kTestDate, &data.timestamp)); + + LegacyTechReportGenerator generator; + auto reports = generator.Generate(data); + ASSERT_EQ(1u, reports.size()); + + EXPECT_EQ(data.type, reports[0]->feature_id()); + EXPECT_EQ(data.url.spec(), reports[0]->url()); + EXPECT_EQ(data.matched_url, reports[0]->allowlisted_url_match()); + EXPECT_EQ(data.filename, reports[0]->filename()); + EXPECT_EQ(data.column, reports[0]->column()); + EXPECT_EQ(data.line, reports[0]->line()); + base::Time midnight; + ASSERT_TRUE(base::Time::FromUTCExploded(kTestDateInMidnight, &midnight)); + EXPECT_EQ(midnight.ToJavaTime(), reports[0]->event_timestamp_millis()); +} + +} // namespace enterprise_reporting
diff --git a/chrome/browser/extensions/api/automation/automation_apitest.cc b/chrome/browser/extensions/api/automation/automation_apitest.cc index a7ed23f5..91584c53 100644 --- a/chrome/browser/extensions/api/automation/automation_apitest.cc +++ b/chrome/browser/extensions/api/automation/automation_apitest.cc
@@ -528,11 +528,11 @@ IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopHitTestPrimaryDisplay) { ash::ShellTestApi shell_test_api; - // Create two displays, both 800x800px, next to each other. The primary + // Create two displays, both 800x750px, next to each other. The primary // display has top left corner at (0, 0), and the secondary display has // top left corner at (801, 0). display::test::DisplayManagerTestApi(shell_test_api.display_manager()) - .UpdateDisplay("800x800,801+0-800x800"); + .UpdateDisplay("800x750,801+0-800x750"); // Ensure it worked. By default InProcessBrowserTest uses just one display. ASSERT_EQ(2u, shell_test_api.display_manager()->GetNumDisplays()); display::test::DisplayManagerTestApi display_manager_test_api( @@ -545,11 +545,11 @@ IN_PROC_BROWSER_TEST_F(AutomationApiTest, DesktopHitTestSecondaryDisplay) { ash::ShellTestApi shell_test_api; - // Create two displays, both 800x800px, next to each other. The primary + // Create two displays, both 800x750px, next to each other. The primary // display has top left corner at (0, 0), and the secondary display has // top left corner at (801, 0). display::test::DisplayManagerTestApi(shell_test_api.display_manager()) - .UpdateDisplay("800x800,801+0-800x800"); + .UpdateDisplay("800x750,801+0-800x750"); // Ensure it worked. By default InProcessBrowserTest uses just one display. ASSERT_EQ(2u, shell_test_api.display_manager()->GetNumDisplays()); display::test::DisplayManagerTestApi display_manager_test_api(
diff --git a/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc b/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc index 740c3383..2cb48d26 100644 --- a/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc +++ b/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc
@@ -60,11 +60,11 @@ } std::string GetOAuth2MintTokenFlowVersion() { - return version_info::GetVersionNumber(); + return std::string(version_info::GetVersionNumber()); } std::string GetOAuth2MintTokenFlowChannel() { - return version_info::GetChannelString(chrome::GetChannel()); + return std::string(version_info::GetChannelString(chrome::GetChannel())); } void RecordFunctionResult(const IdentityGetAuthTokenError& error,
diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc index 426b7c2..861457c 100644 --- a/chrome/browser/extensions/api/settings_private/prefs_util.cc +++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -956,6 +956,8 @@ settings_api::PrefType::PREF_TYPE_BOOLEAN; (*s_allowlist)[ash::prefs::kUserMicrophoneAllowed] = settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_allowlist)[ash::prefs::kUserSpeakOnMuteDetectionEnabled] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; (*s_allowlist)[ash::prefs::kUserGeolocationAllowed] = settings_api::PrefType::PREF_TYPE_BOOLEAN; #else
diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.cc b/chrome/browser/extensions/chrome_extensions_browser_client.cc index e4847f02..a077ee3 100644 --- a/chrome/browser/extensions/chrome_extensions_browser_client.cc +++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc
@@ -403,7 +403,7 @@ last_version = base::Version(last_version_str); } - std::string current_version_str = version_info::GetVersionNumber(); + std::string current_version_str(version_info::GetVersionNumber()); const base::Version& current_version = version_info::GetVersion(); pref_service->SetString(pref_names::kLastChromeVersion, current_version_str);
diff --git a/chrome/browser/extensions/install_observer.h b/chrome/browser/extensions/install_observer.h index 94b57f9..ddc65a9 100644 --- a/chrome/browser/extensions/install_observer.h +++ b/chrome/browser/extensions/install_observer.h
@@ -71,10 +71,6 @@ const std::string& extension_id, bool success) {} - // Called if the extension fails to install. - virtual void OnInstallFailure(content::BrowserContext* context, - const std::string& extension_id) {} - // Called when the app list is reordered. If |extension_id| is set, it // indicates the extension ID that was re-ordered. virtual void OnAppsReordered(
diff --git a/chrome/browser/extensions/install_tracker.cc b/chrome/browser/extensions/install_tracker.cc index e10c677..f31c3118 100644 --- a/chrome/browser/extensions/install_tracker.cc +++ b/chrome/browser/extensions/install_tracker.cc
@@ -113,8 +113,6 @@ void InstallTracker::OnInstallFailure( const std::string& extension_id) { RemoveActiveInstall(extension_id); - for (auto& observer : observers_) - observer.OnInstallFailure(browser_context_, extension_id); } void InstallTracker::Shutdown() {
diff --git a/chrome/browser/extensions/preinstalled_apps.cc b/chrome/browser/extensions/preinstalled_apps.cc index a07c733..6dd8739 100644 --- a/chrome/browser/extensions/preinstalled_apps.cc +++ b/chrome/browser/extensions/preinstalled_apps.cc
@@ -89,7 +89,7 @@ // Pre-installed apps are only installed on profile creation or a new // chrome download. bool is_new_profile = profile_->WasCreatedByVersionOrLater( - version_info::GetVersionNumber()); + std::string(version_info::GetVersionNumber())); if (is_new_profile && preinstalled_apps_enabled_) { new_install_state = kAlreadyInstalledPreinstalledApps; perform_new_installation_ = true;
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index c9ebecc..667cd742 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -38,7 +38,9 @@ const char kAccessiblePDFFormDescription[] = "Enables accessibility support for PDF forms."; -const char kPdfUseSkiaRendererName[] = "Use Skia Renderer"; +const char kPdfUseSkiaRendererName[] = + "Use Skia Renderer. This flag will have no effect if the renderer choice " + "is controlled by an enterprise policy."; const char kPdfUseSkiaRendererDescription[] = "Use Skia as the PDF renderer."; #endif
diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc index 84f3ca07..69245457 100644 --- a/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chrome/browser/flags/android/chrome_feature_list.cc
@@ -64,7 +64,6 @@ #include "content/public/common/content_features.h" #include "device/fido/features.h" #include "media/base/media_switches.h" -#include "services/audio/public/cpp/audio_features.h" #include "services/device/public/cpp/device_features.h" #include "services/network/public/cpp/features.h" #include "third_party/blink/public/common/features.h" @@ -107,7 +106,6 @@ &features::kGenericSensorExtraClasses, &features::kBackForwardCache, &features::kBackForwardTransitions, - &features::kBlockMidiByDefault, &features::kHttpsOnlyMode, &features::kMetricsSettingsAndroid, &features::kNetworkServiceInProcess,
diff --git a/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthManager.java b/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthManager.java index 9e5a33e8..56d91126 100644 --- a/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthManager.java +++ b/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthManager.java
@@ -56,7 +56,7 @@ */ public void startReauthenticationFlow( @NonNull IncognitoReauthCallback incognitoReauthCallback) { - if (!mReauthenticatorBridge.canUseAuthentication() + if (!mReauthenticatorBridge.canUseAuthenticationWithBiometricOrScreenLock() || !isIncognitoReauthFeatureAvailable()) { incognitoReauthCallback.onIncognitoReauthNotPossible(); return;
diff --git a/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthManagerTest.java b/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthManagerTest.java index bf13085..35c0b3e 100644 --- a/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthManagerTest.java +++ b/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthManagerTest.java
@@ -50,7 +50,8 @@ public void testIncognitoReauthManager_WhenCantUseAuthentication_FiresCallbackWithNotPossible() { IncognitoReauthManager.setIsIncognitoReauthFeatureAvailableForTesting(true); - when(mReauthenticatorBridgeMock.canUseAuthentication()).thenReturn(false); + when(mReauthenticatorBridgeMock.canUseAuthenticationWithBiometricOrScreenLock()) + .thenReturn(false); mIncognitoReauthManager.startReauthenticationFlow(mIncognitoReauthCallbackMock); verify(mIncognitoReauthCallbackMock).onIncognitoReauthNotPossible(); @@ -61,7 +62,8 @@ @MediumTest public void testIncognitoReauthManager_WhenFeatureDisabled_FiresCallbackWithNotPossible() { IncognitoReauthManager.setIsIncognitoReauthFeatureAvailableForTesting(false); - when(mReauthenticatorBridgeMock.canUseAuthentication()).thenReturn(false); + when(mReauthenticatorBridgeMock.canUseAuthenticationWithBiometricOrScreenLock()) + .thenReturn(false); mIncognitoReauthManager.startReauthenticationFlow(mIncognitoReauthCallbackMock); verify(mIncognitoReauthCallbackMock).onIncognitoReauthNotPossible(); @@ -73,7 +75,8 @@ public void testIncognitoReauthManager_WhenReauthenticationSucceeded_FiresCallbackWithSuccess() { IncognitoReauthManager.setIsIncognitoReauthFeatureAvailableForTesting(true); - when(mReauthenticatorBridgeMock.canUseAuthentication()).thenReturn(true); + when(mReauthenticatorBridgeMock.canUseAuthenticationWithBiometricOrScreenLock()) + .thenReturn(true); doAnswer(invocationOnMock -> { Callback<Boolean> callback = invocationOnMock.getArgument(0); callback.onResult(true); @@ -91,7 +94,8 @@ @MediumTest public void testIncognitoReauthManager_WhenReauthenticationFailed_FiresCallbackWithFailed() { IncognitoReauthManager.setIsIncognitoReauthFeatureAvailableForTesting(true); - when(mReauthenticatorBridgeMock.canUseAuthentication()).thenReturn(true); + when(mReauthenticatorBridgeMock.canUseAuthenticationWithBiometricOrScreenLock()) + .thenReturn(true); doAnswer(invocationOnMock -> { Callback<Boolean> callback = invocationOnMock.getArgument(0); callback.onResult(false);
diff --git a/chrome/browser/media/android/cdm/media_drm_origin_id_manager.cc b/chrome/browser/media/android/cdm/media_drm_origin_id_manager.cc index 469dcd9..4eaf24143 100644 --- a/chrome/browser/media/android/cdm/media_drm_origin_id_manager.cc +++ b/chrome/browser/media/android/cdm/media_drm_origin_id_manager.cc
@@ -7,6 +7,8 @@ #include <memory> #include <utility> +#include "base/android/build_info.h" +#include "base/check.h" #include "base/feature_list.h" #include "base/functional/bind.h" #include "base/json/values_util.h" @@ -41,18 +43,36 @@ // { // "origin_ids": [ $origin_id, ... ] // "expirable_token": $expiration_time, +// "last_provisioning_attempt_time": $last_provisioning_attempt_time, // } // // If specified, "expirable_token" is stored as a string representing the // int64_t (base::NumberToString()) form of the number of microseconds since // Windows epoch (1601-01-01 00:00:00 UTC). It is the latest time that this // code should attempt to pre-provision more origins on some devices. +// +// "last_provisioning_attempt_time" is only used on Android R due to bugs in +// the OS. The OS can get into a weird state where provisioning attempts crash, +// although rebooting the device is expected to clear this condition. However, +// as the code attempts to pre-provision some origin IDs if needed shortly +// after launch, this can result in Chrome randomly crashing every time it is +// started. "last_provisioning_attempt_time" is a time like "expirable_token" +// and represents the last time a provisioning attempt was made (roughly, as +// the attempt is posted as a delayed task). If set, another attempt at +// provisioning won't be made until |kProvisioningDelta| has passed. If +// provisioning returns, then provisioning doesn't crash, so this value is +// cleared and provisioning can be checked every time Chrome starts. +// Note that this does not affect requests for an origin. If a page needs one, +// then provisioning will be attempted. This may still crash. +// TODO(b/253295050): Remove this workaround if Android R patched to fix this. namespace { const char kMediaDrmOriginIds[] = "media.media_drm_origin_ids"; const char kExpirableToken[] = "expirable_token"; const char kOriginIds[] = "origin_ids"; +const char kLastProvisioningAttemptTimeToken[] = + "last_provisioning_attempt_time"; // The maximum number of origin IDs to pre-provision. Chosen to be small to // minimize provisioning server load. @@ -65,6 +85,9 @@ // "expirable_token" is only good for 24 hours. constexpr base::TimeDelta kExpirationDelta = base::Hours(24); +// Only try provisioning once a week (Android R only due to crashes). +constexpr base::TimeDelta kProvisioningDelta = base::Days(7); + // Time to wait before attempting pre-provisioning at startup (if enabled). constexpr base::TimeDelta kStartupDelay = base::Minutes(1); @@ -90,6 +113,57 @@ origin_id_dict.Remove(kExpirableToken); } +// On Android R a bug in the OS can cause MediaDrm::getProvisionRequest() +// to crash. As this runs shortly after startup, Chrome will be unusable +// if that happens. So use |kLastProvisioningAttemptTimeToken| to keep track of +// the last attempt to pre-provision, and don't try again within +// |kProvisioningDelta|. Value is cleared if provisioning returns, so on devices +// without the crash things will work as normal. +// TODO(b/253295050): Remove this workaround if Android R patched to fix this. + +bool IsAndroidR() { + return base::android::BuildInfo::GetInstance()->sdk_int() == + base::android::SDK_VERSION_R; +} + +bool ShouldAttemptProvisioning(base::Value::Dict& origin_id_dict) { + DVLOG(3) << __func__; + DCHECK(IsAndroidR()); + + const base::Value* token_value = + origin_id_dict.Find(kLastProvisioningAttemptTimeToken); + if (token_value) { + auto last_provisioning_attempt_time = base::ValueToTime(*token_value); + if (last_provisioning_attempt_time) { + if (base::Time::Now() < + last_provisioning_attempt_time.value() + kProvisioningDelta) { + // Last provisioning attempt is within |kProvisioningDelta|, so return + // false so that provisioning is not attempted. + return false; + } + } + } + + // Either no value or it's too old, so return true to try a provisioning + // attempt. + return true; +} + +void SetLastProvisioningTime(base::Value::Dict& origin_id_dict) { + DVLOG(3) << __func__; + DCHECK(IsAndroidR()); + + origin_id_dict.Set(kLastProvisioningAttemptTimeToken, + base::TimeToValue(base::Time::Now())); +} + +void RemoveLastProvisioningTime(base::Value::Dict& origin_id_dict) { + DVLOG(3) << __func__; + DCHECK(IsAndroidR()); + + origin_id_dict.Remove(kLastProvisioningAttemptTimeToken); +} + // On devices that don't support per-application provisioning attempts to // pre-provision more origin IDs should only happen if an origin ID was // requested recently and failed. This code checks that the time saved in @@ -345,13 +419,29 @@ // posted task won't do anything). |kMediaDrmPreprovisioningAtStartup| is also // used by testing so that it can check pre-provisioning directly. if (base::FeatureList::IsEnabled(media::kMediaDrmPreprovisioningAtStartup)) { + // Special handling for Android R due to a bug in the OS can cause + // MediaDrm::getProvisionRequest() to crash. We check here so that if the + // preference is updated it should be persisted before provisioning is + // actually attempted after |kStartupDelay|. + bool should_attempt_provisioning = true; + if (IsAndroidR()) { + ScopedDictPrefUpdate update(pref_service_, kMediaDrmOriginIds); + should_attempt_provisioning = ShouldAttemptProvisioning(*update); + if (should_attempt_provisioning) { + // Provisioning will be attempted, so record the current time. + SetLastProvisioningTime(*update); + } + } + // Running this after a delay of |kStartupDelay| in order to not do too much // extra work when the profile is loaded. - base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask( - FROM_HERE, - base::BindOnce(&MediaDrmOriginIdManager::PreProvisionIfNecessary, - weak_factory_.GetWeakPtr()), - kStartupDelay); + if (should_attempt_provisioning) { + base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask( + FROM_HERE, + base::BindOnce(&MediaDrmOriginIdManager::PreProvisionIfNecessary, + weak_factory_.GetWeakPtr()), + kStartupDelay); + } } // In order to determine how devices are pre-provisioning origin IDs, post a @@ -510,6 +600,13 @@ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(is_provisioning_); + // On Android R, clear |kLastProvisioningAttemptTimeToken| as provisioning() + // didn't crash. + if (IsAndroidR()) { + ScopedDictPrefUpdate update(pref_service_, kMediaDrmOriginIds); + RemoveLastProvisioningTime(*update); + } + if (!origin_id) { // Unable to provision an origin ID, most likely due to being unable to // connect to a provisioning server. Set up a NetworkObserver to detect when
diff --git a/chrome/browser/media/capture_access_handler_base.cc b/chrome/browser/media/capture_access_handler_base.cc index d88e629..a9a858c 100644 --- a/chrome/browser/media/capture_access_handler_base.cc +++ b/chrome/browser/media/capture_access_handler_base.cc
@@ -300,8 +300,7 @@ return target_web_contents == web_contents->GetOutermostWebContents(); } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } void CaptureAccessHandlerBase::UpdateVideoScreenCaptureStatus(
diff --git a/chrome/browser/media/cdm_pref_service_helper.cc b/chrome/browser/media/cdm_pref_service_helper.cc index 46c0f42c..24af18b 100644 --- a/chrome/browser/media/cdm_pref_service_helper.cc +++ b/chrome/browser/media/cdm_pref_service_helper.cc
@@ -177,22 +177,19 @@ ScopedDictPrefUpdate update(user_prefs, prefs::kMediaCdmOriginData); std::vector<std::string> origins_to_delete; - for (auto key_value : *update) { - const std::string& origin = key_value.first; - + for (auto [origin, origin_value] : *update) { // Null filter indicates that we should delete everything. if (filter && !filter.Run(GURL(origin))) continue; - const base::Value& origin_dict = key_value.second; - if (!origin_dict.is_dict()) { + auto* origin_dict = origin_value.GetIfDict(); + if (!origin_dict) { DVLOG(ERROR) << "Could not parse the preference data. Removing entry."; origins_to_delete.push_back(origin); continue; } - std::unique_ptr<CdmPrefData> cdm_pref_data = - FromDictValue(origin_dict.GetDict()); + std::unique_ptr<CdmPrefData> cdm_pref_data = FromDictValue(*origin_dict); if (!cdm_pref_data) { origins_to_delete.push_back(origin); @@ -204,8 +201,8 @@ origins_to_delete.push_back(origin); } else if (TimeIsBetween(cdm_pref_data->client_token_creation_time(), start, end)) { - key_value.second.RemoveKey(kClientToken); - key_value.second.RemoveKey(kClientTokenCreationTime); + origin_dict->Remove(kClientToken); + origin_dict->Remove(kClientTokenCreationTime); } }
diff --git a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc index b14dd26..72b5054 100644 --- a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc +++ b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
@@ -347,8 +347,7 @@ return "persistent-license"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } std::string IsSupportedByKeySystem(
diff --git a/chrome/browser/media/history/media_history_images_table.cc b/chrome/browser/media/history/media_history_images_table.cc index 262d255..8ff3cce 100644 --- a/chrome/browser/media/history/media_history_images_table.cc +++ b/chrome/browser/media/history/media_history_images_table.cc
@@ -122,8 +122,7 @@ } } - NOTREACHED(); - return absl::nullopt; + NOTREACHED_NORETURN(); } } // namespace media_history
diff --git a/chrome/browser/media/history/media_history_table_base.cc b/chrome/browser/media/history/media_history_table_base.cc index d1b81e82..5a2ee30 100644 --- a/chrome/browser/media/history/media_history_table_base.cc +++ b/chrome/browser/media/history/media_history_table_base.cc
@@ -68,8 +68,7 @@ } bool MediaHistoryTableBase::DeleteURL(const GURL& url) { - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } } // namespace media_history
diff --git a/chrome/browser/media/protected_media_identifier_permission_context.cc b/chrome/browser/media/protected_media_identifier_permission_context.cc index 0db0258..859f3e8 100644 --- a/chrome/browser/media/protected_media_identifier_permission_context.cc +++ b/chrome/browser/media/protected_media_identifier_permission_context.cc
@@ -31,6 +31,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include <utility> +#include "ash/constants/ash_switches.h" #include "base/metrics/histogram_macros.h" #include "chrome/browser/ash/settings/cros_settings.h" #include "chromeos/ash/components/settings/cros_settings_names.h" @@ -66,8 +67,7 @@ << embedding_origin.spec() << ")"; if (!requesting_origin.is_valid() || !embedding_origin.is_valid() || - !IsProtectedMediaIdentifierEnabled( - Profile::FromBrowserContext(browser_context()))) { + !IsProtectedMediaIdentifierEnabled()) { return CONTENT_SETTING_BLOCK; } @@ -127,13 +127,12 @@ // TODO(xhwang): We should consolidate the "protected content" related pref // across platforms. -// static bool ProtectedMediaIdentifierPermissionContext:: - IsProtectedMediaIdentifierEnabled(Profile* profile) { + IsProtectedMediaIdentifierEnabled() const { #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) + Profile* profile = Profile::FromBrowserContext(browser_context()); // Identifier is not allowed in incognito or guest mode. - if (profile != nullptr && - (profile->IsOffTheRecord() || profile->IsGuestSession())) { + if (profile->IsOffTheRecord() || profile->IsGuestSession()) { DVLOG(1) << "Protected media identifier disabled in incognito or guest " "mode."; return false;
diff --git a/chrome/browser/media/protected_media_identifier_permission_context.h b/chrome/browser/media/protected_media_identifier_permission_context.h index 47530f80..07d26d0 100644 --- a/chrome/browser/media/protected_media_identifier_permission_context.h +++ b/chrome/browser/media/protected_media_identifier_permission_context.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ #define CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ -#include "chrome/browser/profiles/profile.h" #include "components/permissions/permission_context_base.h" #include "components/permissions/permission_request_id.h" @@ -30,12 +29,6 @@ const GURL& requesting_origin, const GURL& embedding_origin) const override; - // Returns whether "Protected content" is enabled based on factors other than - // what 'ContentSettingsType::PROTECTED_MEDIA_IDENTIFIER' is set to. For - // example, it can be disabled by a switch in the content settings page, in - // incognito or guest mode, or by the device policy. - static bool IsProtectedMediaIdentifierEnabled(Profile* profile = nullptr); - private: friend class ProtectedMediaIdentifierPermissionContextTest; static bool IsOriginAllowed(const GURL& origin); @@ -43,6 +36,12 @@ void UpdateTabContext(const permissions::PermissionRequestID& id, const GURL& requesting_frame, bool allowed) override; + + // Returns whether "Protected content" is enabled based on factors other + // than the protected media identifier content setting itself. For example, + // it can be disabled by a switch in content settings, in incognito or guest + // mode, or by the device policy. + bool IsProtectedMediaIdentifierEnabled() const; }; #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_
diff --git a/chrome/browser/media/protected_media_identifier_permission_context_unittest.cc b/chrome/browser/media/protected_media_identifier_permission_context_unittest.cc index ed4b821e..9aa6861 100644 --- a/chrome/browser/media/protected_media_identifier_permission_context_unittest.cc +++ b/chrome/browser/media/protected_media_identifier_permission_context_unittest.cc
@@ -11,55 +11,22 @@ #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) - -#if BUILDFLAG(IS_CHROMEOS) -#include "chromeos/dbus/constants/dbus_switches.h" // nogncheck - -#if BUILDFLAG(IS_CHROMEOS_ASH) -#include "chrome/browser/ash/settings/scoped_cros_settings_test_helper.h" -#include "chrome/browser/ash/settings/stub_cros_settings_provider.h" -#include "chromeos/ash/components/settings/cros_settings_names.h" -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - -#endif // BUILDFLAG(IS_CHROMEOS) - -#include "chrome/browser/profiles/profile_testing_helper.h" -#endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) - class ProtectedMediaIdentifierPermissionContextTest : public testing::Test { public: ProtectedMediaIdentifierPermissionContextTest() : requesting_origin_("https://example.com"), requesting_sub_domain_origin_("https://subdomain.example.com") { command_line_ = scoped_command_line_.GetProcessCommandLine(); -#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) - profile_testing_helper_.SetUp(); -#endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) -#if BUILDFLAG(IS_CHROMEOS_ASH) - settings_helper_.ReplaceDeviceSettingsProviderWithStub(); -#endif } bool IsOriginAllowed(const GURL& origin) { return ProtectedMediaIdentifierPermissionContext::IsOriginAllowed(origin); } - bool IsProtectedMediaIdentifierEnabled(Profile* profile = nullptr) { - return ProtectedMediaIdentifierPermissionContext:: - IsProtectedMediaIdentifierEnabled(profile); - } - GURL requesting_origin_; GURL requesting_sub_domain_origin_; base::test::ScopedCommandLine scoped_command_line_; -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) - ProfileTestingHelper profile_testing_helper_; -#endif -#if BUILDFLAG(IS_CHROMEOS_ASH) - ash::ScopedCrosSettingsTestHelper settings_helper_; -#endif raw_ptr<base::CommandLine> command_line_; }; @@ -105,51 +72,3 @@ // The request should no longer need to ask for permission ASSERT_TRUE(IsOriginAllowed(requesting_sub_domain_origin_)); } - -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) -TEST_F(ProtectedMediaIdentifierPermissionContextTest, - ProtectedMediaIdentifierOnDifferentProfiles) { - ASSERT_FALSE(IsProtectedMediaIdentifierEnabled( - profile_testing_helper_.incognito_profile())); - - ASSERT_FALSE(IsProtectedMediaIdentifierEnabled( - profile_testing_helper_.guest_profile())); - - ASSERT_TRUE(IsProtectedMediaIdentifierEnabled( - profile_testing_helper_.regular_profile())); -} -#endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) - -#if BUILDFLAG(IS_CHROMEOS) -TEST_F(ProtectedMediaIdentifierPermissionContextTest, - ProtectedMediaIdentifierDisabledOnDevMode) { - command_line_->AppendSwitch(chromeos::switches::kSystemDevMode); - - // The protected media identifier should not be enabled if the system is on - // dev mode. - ASSERT_FALSE(IsProtectedMediaIdentifierEnabled()); -} - -TEST_F(ProtectedMediaIdentifierPermissionContextTest, - ProtectedMediaIdentifierEnabledOnDevModeWithAllowinRASwitch) { - command_line_->AppendSwitch(chromeos::switches::kSystemDevMode); - command_line_->AppendSwitch(switches::kAllowRAInDevMode); - - // As long as `kAllowRAInDevMode` is appended, then even if system is on dev - // mode, the protected media identifier should be enabled. - ASSERT_TRUE(IsProtectedMediaIdentifierEnabled()); -} - -#if BUILDFLAG(IS_CHROMEOS_ASH) -TEST_F(ProtectedMediaIdentifierPermissionContextTest, - ProtectedMediaIdentifierWithAttestationForContentSwitch) { - settings_helper_.SetBoolean(ash::kAttestationForContentProtectionEnabled, - true); - ASSERT_TRUE(IsProtectedMediaIdentifierEnabled()); - - settings_helper_.SetBoolean(ash::kAttestationForContentProtectionEnabled, - false); - ASSERT_FALSE(IsProtectedMediaIdentifierEnabled()); -} -#endif // BUILDFLAG(IS_CHROMEOS_ASH) -#endif // BUILDFLAG(IS_CHROMEOS)
diff --git a/chrome/browser/media/router/chrome_media_router_factory.cc b/chrome/browser/media/router/chrome_media_router_factory.cc index 28513642..0b4bd2bf 100644 --- a/chrome/browser/media/router/chrome_media_router_factory.cc +++ b/chrome/browser/media/router/chrome_media_router_factory.cc
@@ -68,10 +68,7 @@ KeyedService* ChromeMediaRouterFactory::BuildServiceInstanceFor( BrowserContext* context) const { - if (!MediaRouterEnabled(context)) { - NOTREACHED(); - return nullptr; - } + CHECK(MediaRouterEnabled(context)); MediaRouterBase* media_router = nullptr; #if BUILDFLAG(IS_ANDROID) media_router = new MediaRouterAndroid();
diff --git a/chrome/browser/media/router/discovery/access_code/access_code_media_sink_util.cc b/chrome/browser/media/router/discovery/access_code/access_code_media_sink_util.cc index dfba5f3..b7c2c4de 100644 --- a/chrome/browser/media/router/discovery/access_code/access_code_media_sink_util.cc +++ b/chrome/browser/media/router/discovery/access_code/access_code_media_sink_util.cc
@@ -256,10 +256,8 @@ return AccessCodeCastAddSinkResult::kProfileSyncError; case AddSinkResultCode::INTERNAL_MEDIA_ROUTER_ERROR: return AccessCodeCastAddSinkResult::kInternalMediaRouterError; - default: - NOTREACHED(); - return AccessCodeCastAddSinkResult::kUnknownError; } + NOTREACHED_NORETURN(); } absl::optional<net::IPEndPoint> GetIPEndPointFromValueDict(
diff --git a/chrome/browser/media/router/discovery/dial/dial_service_impl.cc b/chrome/browser/media/router/discovery/dial/dial_service_impl.cc index a66e96b9..b5da7be 100644 --- a/chrome/browser/media/router/discovery/dial/dial_service_impl.cc +++ b/chrome/browser/media/router/discovery/dial/dial_service_impl.cc
@@ -8,6 +8,7 @@ #include <algorithm> #include <set> +#include <string> #include <utility> #include <vector> @@ -125,9 +126,9 @@ "USER-AGENT: %s/%s %s\r\n" "\r\n", kDialRequestAddress, kDialRequestPort, kDialMaxResponseDelaySecs, - kDialSearchType, version_info::GetProductName().c_str(), - version_info::GetVersionNumber().c_str(), - version_info::GetOSType().c_str())); + kDialSearchType, version_info::GetProductName().data(), + version_info::GetVersionNumber().data(), + version_info::GetOSType().data())); // 1500 is a good MTU value for most Ethernet LANs. DCHECK_LE(request.size(), 1500U); return request;
diff --git a/chrome/browser/media/router/discovery/dial/parsed_dial_app_info.cc b/chrome/browser/media/router/discovery/dial/parsed_dial_app_info.cc index 329831d7..e98e5f4f3 100644 --- a/chrome/browser/media/router/discovery/dial/parsed_dial_app_info.cc +++ b/chrome/browser/media/router/discovery/dial/parsed_dial_app_info.cc
@@ -17,8 +17,7 @@ case DialAppState::kStopped: return "stopped"; } - NOTREACHED(); - return "unknown"; + NOTREACHED_NORETURN(); } ParsedDialAppInfo::ParsedDialAppInfo() = default;
diff --git a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.cc b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.cc index dff3588..0185beb 100644 --- a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.cc +++ b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.cc
@@ -75,8 +75,7 @@ case MediaRouterChannelError::PING_TIMEOUT: return "PING_TIMEOUT"; case MediaRouterChannelError::TOTAL_COUNT: - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } }
diff --git a/chrome/browser/media/router/providers/cast/cast_app_discovery_service.cc b/chrome/browser/media/router/providers/cast/cast_app_discovery_service.cc index e5f7808..e3ad0aa46 100644 --- a/chrome/browser/media/router/providers/cast/cast_app_discovery_service.cc +++ b/chrome/browser/media/router/providers/cast/cast_app_discovery_service.cc
@@ -250,8 +250,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } } // namespace media_router
diff --git a/chrome/browser/media/router/providers/cast/cast_session_client_impl.cc b/chrome/browser/media/router/providers/cast/cast_session_client_impl.cc index aa21941..70761dc1 100644 --- a/chrome/browser/media/router/providers/cast/cast_session_client_impl.cc +++ b/chrome/browser/media/router/providers/cast/cast_session_client_impl.cc
@@ -28,21 +28,21 @@ // Traverses a JSON value, recursively removing any dict entries whose value is // null. void RemoveNullFields(base::Value& value) { - if (value.is_list()) { - for (auto& item : value.GetList()) { + if (auto* list = value.GetIfList()) { + for (auto& item : *list) { RemoveNullFields(item); } - } else if (value.is_dict()) { + } else if (auto* dict = value.GetIfDict()) { std::vector<std::string> to_remove; - for (auto pair : value.GetDict()) { - if (pair.second.is_none()) { - to_remove.push_back(pair.first); + for (auto [key, val] : *dict) { + if (val.is_none()) { + to_remove.push_back(key); } else { - RemoveNullFields(pair.second); + RemoveNullFields(val); } } for (const auto& key : to_remove) { - value.RemoveKey(key); + dict->Remove(key); } } }
diff --git a/chrome/browser/media/router/providers/cast/chrome_cast_message_handler.cc b/chrome/browser/media/router/providers/cast/chrome_cast_message_handler.cc index b24dbb75..3d53090f 100644 --- a/chrome/browser/media/router/providers/cast/chrome_cast_message_handler.cc +++ b/chrome/browser/media/router/providers/cast/chrome_cast_message_handler.cc
@@ -36,7 +36,8 @@ new cast_channel::CastMessageHandler( cast_channel::CastSocketService::GetInstance(), base::BindRepeating(&ParseJsonFromIoThread), - embedder_support::GetUserAgent(), version_info::GetVersionNumber(), + embedder_support::GetUserAgent(), + std::string(version_info::GetVersionNumber()), g_browser_process->GetApplicationLocale()); return instance; }
diff --git a/chrome/browser/media/webrtc/capture_policy_utils.cc b/chrome/browser/media/webrtc/capture_policy_utils.cc index 7cd9845c1..49ec149 100644 --- a/chrome/browser/media/webrtc/capture_policy_utils.cc +++ b/chrome/browser/media/webrtc/capture_policy_utils.cc
@@ -251,8 +251,7 @@ media_types, [capture_level](const DesktopMediaList::Type& type) { switch (type) { case DesktopMediaList::Type::kNone: - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); // SameOrigin is more restrictive than just Tabs, so as long as // at least SameOrigin is allowed, these entries should stay. // They should be filtered later by the caller.
diff --git a/chrome/browser/media/webrtc/conditional_focus_browsertest.cc b/chrome/browser/media/webrtc/conditional_focus_browsertest.cc index 2108a8e..3d04800b 100644 --- a/chrome/browser/media/webrtc/conditional_focus_browsertest.cc +++ b/chrome/browser/media/webrtc/conditional_focus_browsertest.cc
@@ -49,8 +49,7 @@ case FocusEnumValue::kNoFocusChange: return "no-focus-change"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } enum class Tab { kUnknownTab, kCapturingTab, kCapturedTab };
diff --git a/chrome/browser/media/webrtc/desktop_capture_access_handler.cc b/chrome/browser/media/webrtc/desktop_capture_access_handler.cc index 820e6a2..af3d5a5 100644 --- a/chrome/browser/media/webrtc/desktop_capture_access_handler.cc +++ b/chrome/browser/media/webrtc/desktop_capture_access_handler.cc
@@ -134,8 +134,7 @@ content::DesktopMediaID::Type media_type) { switch (media_type) { case content::DesktopMediaID::TYPE_NONE: - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); case content::DesktopMediaID::TYPE_SCREEN: return allowed_capture_level >= AllowedScreenCaptureLevel::kDesktop; case content::DesktopMediaID::TYPE_WINDOW:
diff --git a/chrome/browser/media/webrtc/media_stream_capture_indicator.cc b/chrome/browser/media/webrtc/media_stream_capture_indicator.cc index e4b7c148..1cb1001 100644 --- a/chrome/browser/media/webrtc/media_stream_capture_indicator.cc +++ b/chrome/browser/media/webrtc/media_stream_capture_indicator.cc
@@ -127,8 +127,7 @@ case blink::mojom::MediaStreamType::NO_SERVICE: case blink::mojom::MediaStreamType::NUM_MEDIA_TYPES: - NOTREACHED(); - return nullptr; + NOTREACHED_NORETURN(); } } @@ -380,8 +379,7 @@ case blink::mojom::MediaStreamType::NO_SERVICE: case blink::mojom::MediaStreamType::NUM_MEDIA_TYPES: - NOTREACHED(); - return video_stream_count_; + NOTREACHED_NORETURN(); } }
diff --git a/chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm b/chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm index 09430ea..4ec8d0b 100644 --- a/chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm +++ b/chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm
@@ -106,8 +106,7 @@ case AVAuthorizationStatusAuthorized: return SystemPermission::kAllowed; default: - NOTREACHED(); - return SystemPermission::kAllowed; + NOTREACHED_NORETURN(); } }
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_common.cc b/chrome/browser/media/webrtc/webrtc_event_log_manager_common.cc index 39490ec..591f814 100644 --- a/chrome/browser/media/webrtc/webrtc_event_log_manager_common.cc +++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_common.cc
@@ -450,8 +450,7 @@ } } - NOTREACHED(); - return false; // Appease compiler. + NOTREACHED_NORETURN(); } bool GzippedLogFileWriter::Finalize() { @@ -583,8 +582,7 @@ return result; } - NOTREACHED(); - return Result::ERROR_ENCOUNTERED; // Appease compiler. + NOTREACHED_NORETURN(); } bool GzipLogCompressor::CreateFooter(std::string* output) {
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest_helpers.cc b/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest_helpers.cc index e543b09c..0c783f4 100644 --- a/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest_helpers.cc +++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest_helpers.cc
@@ -27,8 +27,7 @@ std::make_unique<GzipLogCompressorFactory>( std::make_unique<PerfectGzipEstimator::Factory>())); } - NOTREACHED(); - return nullptr; // Appease compiler. + NOTREACHED_NORETURN(); } #if BUILDFLAG(IS_POSIX)
diff --git a/chrome/browser/media/webrtc/webrtc_getdisplaymedia_browsertest.cc b/chrome/browser/media/webrtc/webrtc_getdisplaymedia_browsertest.cc index ad073923..db25787b 100644 --- a/chrome/browser/media/webrtc/webrtc_getdisplaymedia_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_getdisplaymedia_browsertest.cc
@@ -130,8 +130,7 @@ case DisplaySurfaceType::kScreen: return "screen"; } - NOTREACHED(); - return "error"; + NOTREACHED_NORETURN(); } void RunGetDisplayMedia(content::WebContents* tab, @@ -857,8 +856,7 @@ case DisplaySurfaceType::kScreen: return "MediaStreamTrack"; } - NOTREACHED(); - return "Error"; + NOTREACHED_NORETURN(); } protected:
diff --git a/chrome/browser/media/webrtc/webrtc_text_log_handler.cc b/chrome/browser/media/webrtc/webrtc_text_log_handler.cc index b058c94..6c9748ac 100644 --- a/chrome/browser/media/webrtc/webrtc_text_log_handler.cc +++ b/chrome/browser/media/webrtc/webrtc_text_log_handler.cc
@@ -401,8 +401,7 @@ case LoggingState::STOPPED: return "stopped"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); }; std::string error_message_with_state =
diff --git a/chrome/browser/new_tab_page/modules/history_clusters/cart/cart_processor.cc b/chrome/browser/new_tab_page/modules/history_clusters/cart/cart_processor.cc index 3c74344..fd312432 100644 --- a/chrome/browser/new_tab_page/modules/history_clusters/cart/cart_processor.cc +++ b/chrome/browser/new_tab_page/modules/history_clusters/cart/cart_processor.cc
@@ -15,6 +15,9 @@ #include "ui/base/l10n/time_format.h" namespace { +constexpr char kGoogleDomain[] = "google.com"; +constexpr char kGoogleStoreHost[] = "store.google.com"; + std::string eTLDPlusOne(const GURL& url) { return net::registry_controlled_domains::GetDomainAndRegistry( url, net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); @@ -59,6 +62,14 @@ CartProcessor::~CartProcessor() = default; +bool CartProcessor::IsCartAssociatedWithVisitURL(CartDB::KeyAndValue& cart, + GURL visit_url) { + if (cart.first == kGoogleDomain && visit_url.host() != kGoogleStoreHost) { + return false; + } + return cart.first == eTLDPlusOne(visit_url); +} + void CartProcessor::GetCartForCluster( history_clusters::mojom::ClusterPtr cluster, ntp::history_clusters::mojom::PageHandler::GetCartForClusterCallback @@ -95,7 +106,7 @@ } for (auto cart : carts) { for (auto& visit : cluster->visits) { - if (cart.first == eTLDPlusOne(visit->normalized_url)) { + if (IsCartAssociatedWithVisitURL(cart, visit->normalized_url)) { std::move(callback).Run(CartToMojom(cart)); return; }
diff --git a/chrome/browser/new_tab_page/modules/history_clusters/cart/cart_processor.h b/chrome/browser/new_tab_page/modules/history_clusters/cart/cart_processor.h index 59b0abb..5c33a42b 100644 --- a/chrome/browser/new_tab_page/modules/history_clusters/cart/cart_processor.h +++ b/chrome/browser/new_tab_page/modules/history_clusters/cart/cart_processor.h
@@ -20,6 +20,10 @@ CartProcessor& operator=(const CartProcessor&) = delete; ~CartProcessor(); + // Check if `cart` is associated with the `visit_url`. + static bool IsCartAssociatedWithVisitURL(CartDB::KeyAndValue& cart, + GURL visit_url); + // Get the most relevant cart for the given `cluster`. void GetCartForCluster( history_clusters::mojom::ClusterPtr cluster,
diff --git a/chrome/browser/new_tab_page/modules/history_clusters/cart/cart_processor_unittest.cc b/chrome/browser/new_tab_page/modules/history_clusters/cart/cart_processor_unittest.cc index 069ca1e..2665ba7 100644 --- a/chrome/browser/new_tab_page/modules/history_clusters/cart/cart_processor_unittest.cc +++ b/chrome/browser/new_tab_page/modules/history_clusters/cart/cart_processor_unittest.cc
@@ -302,3 +302,94 @@ ASSERT_FALSE(cart_mojom); } + +TEST_F(CartProcessorTest, TestCartAndVisitURLAssociation) { + cart_db::ChromeCartContentProto cart_proto; + cart_proto.set_key("google.com"); + CartDB::KeyAndValue google_cart = {"google.com", cart_proto}; + + ASSERT_FALSE(CartProcessor::IsCartAssociatedWithVisitURL( + google_cart, GURL("https://www.google.com/search?q=foo"))); + ASSERT_TRUE(CartProcessor::IsCartAssociatedWithVisitURL( + google_cart, GURL("https://store.google.com/"))); +} + +TEST_F(CartProcessorTest, TestNotMatchGoogleCartForNonGoogleStoreVisits) { + // Create a fake cluster with google.com visits that are not from + // store.google.com. + auto cluster_mojom = history_clusters::mojom::Cluster::New(); + auto visit_mojom = history_clusters::mojom::URLVisit::New(); + visit_mojom->normalized_url = GURL("https://www.google.com/search?q=foo"); + cluster_mojom->visits.push_back(std::move(visit_mojom)); + + // Mock a Google store cart. + MockCartService& cart_service = mock_cart_service(); + cart_db::ChromeCartContentProto cart_proto; + cart_proto.set_key("google.com"); + std::vector<CartDB::KeyAndValue> carts = {{"google.com", cart_proto}}; + EXPECT_CALL(cart_service, LoadAllActiveCarts(testing::_)) + .Times(1) + .WillOnce(testing::WithArgs<0>( + testing::Invoke([&carts](CartDB::LoadCallback callback) -> void { + std::move(callback).Run(true, carts); + }))); + EXPECT_CALL(cart_service, IsCartEnabled()) + .Times(1) + .WillOnce(testing::Return(true)); + + // Capture the cart mojom that is finally returned. + ntp::history_clusters::cart::mojom::CartPtr cart_mojom; + base::MockCallback< + ntp::history_clusters::mojom::PageHandler::GetCartForClusterCallback> + callback; + EXPECT_CALL(callback, Run(testing::_)) + .Times(1) + .WillOnce(testing::Invoke( + [&cart_mojom](ntp::history_clusters::cart::mojom::CartPtr cart) { + cart_mojom = std::move(cart); + })); + + cart_processor().GetCartForCluster(std::move(cluster_mojom), callback.Get()); + + ASSERT_FALSE(cart_mojom); +} + +TEST_F(CartProcessorTest, TestOnlyMatchGoogleCartForGoogleStore) { + // Create a fake cluster with store.google.com visit. + auto cluster_mojom = history_clusters::mojom::Cluster::New(); + auto visit_mojom = history_clusters::mojom::URLVisit::New(); + visit_mojom->normalized_url = GURL("https://store.google.com/"); + cluster_mojom->visits.push_back(std::move(visit_mojom)); + + // Mock a Google store cart. + MockCartService& cart_service = mock_cart_service(); + cart_db::ChromeCartContentProto cart_proto; + cart_proto.set_key("google.com"); + std::vector<CartDB::KeyAndValue> carts = {{"google.com", cart_proto}}; + EXPECT_CALL(cart_service, LoadAllActiveCarts(testing::_)) + .Times(1) + .WillOnce(testing::WithArgs<0>( + testing::Invoke([&carts](CartDB::LoadCallback callback) -> void { + std::move(callback).Run(true, carts); + }))); + EXPECT_CALL(cart_service, IsCartEnabled()) + .Times(1) + .WillOnce(testing::Return(true)); + + // Capture the cart mojom that is finally returned. + ntp::history_clusters::cart::mojom::CartPtr cart_mojom; + base::MockCallback< + ntp::history_clusters::mojom::PageHandler::GetCartForClusterCallback> + callback; + EXPECT_CALL(callback, Run(testing::_)) + .Times(1) + .WillOnce(testing::Invoke( + [&cart_mojom](ntp::history_clusters::cart::mojom::CartPtr cart) { + cart_mojom = std::move(cart); + })); + + cart_processor().GetCartForCluster(std::move(cluster_mojom), callback.Get()); + + ASSERT_TRUE(cart_mojom); + ASSERT_EQ(cart_mojom->domain, "google.com"); +}
diff --git a/chrome/browser/new_tab_page/modules/history_clusters/ranking/history_clusters_module_ranking_signals.cc b/chrome/browser/new_tab_page/modules/history_clusters/ranking/history_clusters_module_ranking_signals.cc index bb1cc01..28de49c 100644 --- a/chrome/browser/new_tab_page/modules/history_clusters/ranking/history_clusters_module_ranking_signals.cc +++ b/chrome/browser/new_tab_page/modules/history_clusters/ranking/history_clusters_module_ranking_signals.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/new_tab_page/modules/history_clusters/ranking/history_clusters_module_ranking_signals.h" +#include "chrome/browser/new_tab_page/modules/history_clusters/cart/cart_processor.h" #include "components/commerce/core/proto/cart_db_content.pb.h" #include "components/history_clusters/core/history_clusters_util.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" @@ -37,7 +38,8 @@ visit.normalized_url, net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); for (auto cart : active_carts) { - if (cart.first == visit_tld) { + if (CartProcessor::IsCartAssociatedWithVisitURL(cart, + visit.normalized_url)) { cart_tlds.insert(visit_tld); } }
diff --git a/chrome/browser/pdf/BUILD.gn b/chrome/browser/pdf/BUILD.gn index a8827d8a..f881466 100644 --- a/chrome/browser/pdf/BUILD.gn +++ b/chrome/browser/pdf/BUILD.gn
@@ -21,9 +21,12 @@ "//build:chromeos_buildflags", "//chrome/browser:browser_process", "//chrome/browser:resources", + "//chrome/browser/pdf:pdf_pref_names", + "//chrome/browser/profiles:profile", "//chrome/browser/resources/pdf:resources", "//chrome/common", "//components/pdf/browser:interceptors", + "//components/prefs", "//components/services/screen_ai/buildflags", "//components/zoom", "//content/public/browser",
diff --git a/chrome/browser/pdf/DEPS b/chrome/browser/pdf/DEPS index ddb4f1e..502b0d5 100644 --- a/chrome/browser/pdf/DEPS +++ b/chrome/browser/pdf/DEPS
@@ -1,4 +1,5 @@ include_rules = [ + "+chrome/browser/profiles/profile.h", "+pdf/pdf_features.h", ]
diff --git a/chrome/browser/pdf/chrome_pdf_stream_delegate.cc b/chrome/browser/pdf/chrome_pdf_stream_delegate.cc index 31f6b512..080e5b6 100644 --- a/chrome/browser/pdf/chrome_pdf_stream_delegate.cc +++ b/chrome/browser/pdf/chrome_pdf_stream_delegate.cc
@@ -7,12 +7,16 @@ #include <string> #include <utility> +#include "base/check.h" #include "base/feature_list.h" #include "base/memory/weak_ptr.h" #include "base/no_destructor.h" #include "base/numerics/safe_conversions.h" +#include "chrome/browser/pdf/pdf_pref_names.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/grit/pdf_resources.h" #include "components/pdf/browser/pdf_stream_delegate.h" +#include "components/prefs/pref_service.h" #include "content/public/browser/web_contents_user_data.h" #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h" #include "extensions/common/api/mime_handler.mojom.h" @@ -30,6 +34,24 @@ namespace { +// Determines whether the PDF viewer should use Skia renderer based on the +// user's choice, the enterprise policy and the finch experiment. The priority +// hierarchy is: enterprise policy > user choice > finch experiment. +bool ShouldEnableSkiaRenderer(content::WebContents* contents) { + CHECK(contents); + const PrefService* prefs = + Profile::FromBrowserContext(contents->GetBrowserContext())->GetPrefs(); + + // When the enterprise policy is set. + if (prefs->IsManagedPreference(prefs::kPdfUseSkiaRendererEnabled)) { + return prefs->GetBoolean(prefs::kPdfUseSkiaRendererEnabled); + } + + // When the enterprise policy is not set, use finch/feature flag choice. + return base::FeatureList::IsEnabled( + chrome_pdf::features::kPdfUseSkiaRenderer); +} + // Associates a `pdf::PdfStreamDelegate::StreamInfo` with a `WebContents`. // `ChromePdfStreamDelegate::MapToOriginalUrl()` initializes this in // `PdfNavigationThrottle`, and then `ChromePdfStreamDelegate::GetStreamInfo()` @@ -87,12 +109,7 @@ stream->pdf_plugin_attributes()->background_color); info.full_frame = !stream->embedded(); info.allow_javascript = stream->pdf_plugin_attributes()->allow_javascript; - - // TODO(crbug.com/1440430): Set `info.use_skia` based on both the feature - // flag and the enterprise policy once the policy is available for the Skia - // finch experiment. - info.use_skia = - base::FeatureList::IsEnabled(chrome_pdf::features::kPdfUseSkiaRenderer); + info.use_skia = ShouldEnableSkiaRenderer(contents); #if BUILDFLAG(ENABLE_PRINT_PREVIEW) } else if (stream_url.GetWithEmptyPath() == chrome::kChromeUIUntrustedPrintURL) { @@ -102,8 +119,7 @@ info.background_color = gfx::kGoogleGrey300; info.full_frame = false; info.allow_javascript = false; - info.use_skia = - base::FeatureList::IsEnabled(chrome_pdf::features::kPdfUseSkiaRenderer); + info.use_skia = ShouldEnableSkiaRenderer(contents); #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) } else { return absl::nullopt;
diff --git a/chrome/browser/pdf/pdf_pref_names.cc b/chrome/browser/pdf/pdf_pref_names.cc index afa8782c..6997fb9e 100644 --- a/chrome/browser/pdf/pdf_pref_names.cc +++ b/chrome/browser/pdf/pdf_pref_names.cc
@@ -10,4 +10,7 @@ const char kPdfLocalFileAccessAllowedForDomains[] = "pdf_local_file_access_allowed_for_domains"; +// Boolean pref to control whether to use Skia renderer in the PDF viewer +const char kPdfUseSkiaRendererEnabled[] = "pdf.enable_skia"; + } // namespace prefs
diff --git a/chrome/browser/pdf/pdf_pref_names.h b/chrome/browser/pdf/pdf_pref_names.h index 00261ce..bc64f89 100644 --- a/chrome/browser/pdf/pdf_pref_names.h +++ b/chrome/browser/pdf/pdf_pref_names.h
@@ -8,6 +8,7 @@ namespace prefs { extern const char kPdfLocalFileAccessAllowedForDomains[]; +extern const char kPdfUseSkiaRendererEnabled[]; } // namespace prefs
diff --git a/chrome/browser/permissions/chrome_permissions_client.cc b/chrome/browser/permissions/chrome_permissions_client.cc index dfc443d..dece582 100644 --- a/chrome/browser/permissions/chrome_permissions_client.cc +++ b/chrome/browser/permissions/chrome_permissions_client.cc
@@ -275,7 +275,8 @@ auto prompt_parameters = permissions::PermissionHatsTriggerHelper::PromptParametersForHaTS( request_type, action, prompt_disposition, prompt_disposition_reason, - gesture_type, version_info::GetChannelString(chrome::GetChannel()), + gesture_type, + std::string(version_info::GetChannelString(chrome::GetChannel())), is_post_prompt ? permissions::kOnPromptResolved : permissions::kOnPromptAppearing, prompt_display_duration,
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index 3a78d25..616be98 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -165,6 +165,7 @@ #include "chrome/browser/ash/login/users/avatar/user_image_prefs.h" #include "chrome/browser/ash/platform_keys/key_permissions/key_permissions_policy_handler.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_pref_names.h" +#include "chrome/browser/ash/policy/handlers/app_launch_automation_policy_handler.h" #include "chrome/browser/ash/policy/handlers/configuration_policy_handler_ash.h" #include "chrome/browser/ash/policy/handlers/lacros_availability_policy_handler.h" #include "chrome/browser/ash/policy/handlers/lacros_selection_policy_handler.h" @@ -571,6 +572,9 @@ { key::kPdfLocalFileAccessAllowedForDomains, prefs::kPdfLocalFileAccessAllowedForDomains, base::Value::Type::LIST}, + { key::kPdfUseSkiaRendererEnabled, + prefs::kPdfUseSkiaRendererEnabled, + base::Value::Type::BOOLEAN }, #endif // BUILDFLAG(ENABLE_PDF) { key::kPolicyRefreshRate, policy_prefs::kUserPolicyRefreshRate, @@ -1883,6 +1887,11 @@ prefs::kOutOfProcessSystemDnsResolutionEnabled, base::Value::Type::BOOLEAN }, #endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA) + { key::kGoogleSearchSidePanelEnabled, + prefs::kGoogleSearchSidePanelEnabled, + base::Value::Type::BOOLEAN }, +#endif // BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA) }; // clang-format on @@ -1990,6 +1999,14 @@ key::kContextAwareAccessSignalsAllowlist, enterprise_connectors::kContextAwareAccessSignalsAllowlistPref, chrome_schema)); +#if !BUILDFLAG(IS_FUCHSIA) + handlers->AddHandler( + std::make_unique< + enterprise_connectors::EnterpriseConnectorsPolicyHandler>( + key::kUserContextAwareAccessSignalsAllowlist, + enterprise_connectors::kUserContextAwareAccessSignalsAllowlistPref, + chrome_schema)); +#endif // !BUILDFLAG(IS_FUCHSIA) handlers->AddHandler(std::make_unique<GuestModePolicyHandler>()); handlers->AddHandler(std::make_unique<headless::HeadlessModePolicyHandler>()); @@ -2214,6 +2231,12 @@ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) handlers->AddHandler(std::make_unique<LocalSyncPolicyHandler>()); handlers->AddHandler(std::make_unique<ThemeColorPolicyHandler>()); + handlers->AddHandler( + std::make_unique< + enterprise_connectors::EnterpriseConnectorsPolicyHandler>( + key::kBrowserContextAwareAccessSignalsAllowlist, + enterprise_connectors::kBrowserContextAwareAccessSignalsAllowlistPref, + chrome_schema)); #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_CHROMEOS) @@ -2435,6 +2458,8 @@ key::kDeviceWilcoDtcConfiguration)); handlers->AddHandler(std::make_unique<ExternalDataPolicyHandler>( key::kCrostiniAnsiblePlaybook)); + handlers->AddHandler( + std::make_unique<AppLaunchAutomationPolicyHandler>(chrome_schema)); handlers->AddHandler(std::make_unique<ExternalDataPolicyHandler>( key::kPreconfiguredDeskTemplates)); handlers->AddHandler(std::make_unique<SimpleSchemaValidatingPolicyHandler>(
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 774dacc..89b9707 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -1526,6 +1526,7 @@ #if BUILDFLAG(ENABLE_PDF) registry->RegisterListPref(prefs::kPdfLocalFileAccessAllowedForDomains, base::Value::List()); + registry->RegisterBooleanPref(prefs::kPdfUseSkiaRendererEnabled, true); #endif // BUILDFLAG(ENABLE_PDF) #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc index 95cd7d23..1d4caba 100644 --- a/chrome/browser/printing/print_view_manager_base.cc +++ b/chrome/browser/printing/print_view_manager_base.cc
@@ -1192,7 +1192,7 @@ &PrintViewManagerBase::ScriptedPrintReply, weak_ptr_factory_.GetWeakPtr(), std::move(callback), render_process_host->GetID()); #if BUILDFLAG(IS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING) - ModuleDatabase::GetInstance()->DisableThirdPartyBlocking(); + ModuleDatabase::DisableThirdPartyBlocking(); #endif std::unique_ptr<PrinterQuery> printer_query =
diff --git a/chrome/browser/profile_resetter/resettable_settings_snapshot.cc b/chrome/browser/profile_resetter/resettable_settings_snapshot.cc index 0a22530..1a1974e 100644 --- a/chrome/browser/profile_resetter/resettable_settings_snapshot.cc +++ b/chrome/browser/profile_resetter/resettable_settings_snapshot.cc
@@ -244,7 +244,7 @@ g_browser_process->GetApplicationLocale()); AddPair(list, l10n_util::GetStringUTF16(IDS_VERSION_UI_USER_AGENT), embedder_support::GetUserAgent()); - std::string version = version_info::GetVersionNumber(); + std::string version(version_info::GetVersionNumber()); version += chrome::GetChannelName(chrome::WithExtendedStable(true)); AddPair(list, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
diff --git a/chrome/browser/profiles/chrome_version_service.cc b/chrome/browser/profiles/chrome_version_service.cc index bf99f54..8cd5806 100644 --- a/chrome/browser/profiles/chrome_version_service.cc +++ b/chrome/browser/profiles/chrome_version_service.cc
@@ -33,7 +33,7 @@ // If this is a new profile set version to current version, otherwise // (pre-existing profile), leave pref at default value (1.0.0.0) to // avoid any first-run behavior. - std::string version = version_info::GetVersionNumber(); + std::string version(version_info::GetVersionNumber()); if (prefs->FindPreference(prefs::kProfileCreatedByVersion)-> IsDefaultValue() && is_new_profile) { SetVersion(prefs, version);
diff --git a/chrome/browser/resources/settings/chromeos/os_page_availability.ts b/chrome/browser/resources/settings/chromeos/os_page_availability.ts index bc5edae..335859b 100644 --- a/chrome/browser/resources/settings/chromeos/os_page_availability.ts +++ b/chrome/browser/resources/settings/chromeos/os_page_availability.ts
@@ -27,44 +27,25 @@ * overriding load time data within tests. */ export function createPageAvailability(): OsPageAvailability { - if (isGuest()) { - return { - apps: true, - bluetooth: true, - crostini: true, - dateTime: true, - device: true, - files: false, - internet: true, - kerberos: isKerberosEnabled(), - multidevice: false, - osAccessibility: true, - osLanguages: true, - osPeople: false, - osPrinting: true, - osPrivacy: true, - osReset: isPowerwashAllowed(), - osSearch: true, - personalization: false, - }; - } + const isGuestMode = isGuest(); + return { apps: true, bluetooth: true, crostini: true, dateTime: true, device: true, - files: true, + files: !isGuestMode, internet: true, kerberos: isKerberosEnabled(), - multidevice: true, + multidevice: !isGuestMode, osAccessibility: true, osLanguages: true, - osPeople: true, + osPeople: !isGuestMode, osPrinting: true, osPrivacy: true, osReset: isPowerwashAllowed(), osSearch: true, - personalization: true, + personalization: !isGuestMode, }; }
diff --git a/chrome/browser/resources/settings/chromeos/os_printing_page/cups_add_printer_manually_dialog.ts b/chrome/browser/resources/settings/chromeos/os_printing_page/cups_add_printer_manually_dialog.ts index e979326..0948b43 100644 --- a/chrome/browser/resources/settings/chromeos/os_printing_page/cups_add_printer_manually_dialog.ts +++ b/chrome/browser/resources/settings/chromeos/os_printing_page/cups_add_printer_manually_dialog.ts
@@ -25,7 +25,6 @@ import {getTemplate} from './cups_add_printer_manually_dialog.html.js'; import {getErrorText, isNameAndAddressValid} from './cups_printer_dialog_util.js'; import {CupsPrinterInfo, CupsPrintersBrowserProxy, CupsPrintersBrowserProxyImpl, PrinterMakeModel, PrinterSetupResult} from './cups_printers_browser_proxy.js'; -import {PrinterStatusReason} from './printer_status.js'; function getEmptyPrinter(): object { return { @@ -44,7 +43,6 @@ }, printerProtocol: 'ipp', printerQueue: 'ipp/print', - printerStatusReason: PrinterStatusReason.UNKNOWN_REASON, printServerUri: '', }; }
diff --git a/chrome/browser/resources/settings/chromeos/os_printing_page/cups_printers_browser_proxy.ts b/chrome/browser/resources/settings/chromeos/os_printing_page/cups_printers_browser_proxy.ts index 59cea0b4..44b50d6 100644 --- a/chrome/browser/resources/settings/chromeos/os_printing_page/cups_printers_browser_proxy.ts +++ b/chrome/browser/resources/settings/chromeos/os_printing_page/cups_printers_browser_proxy.ts
@@ -9,7 +9,7 @@ import {sendWithPromise} from 'chrome://resources/js/cr.js'; -import {PrinterStatus, PrinterStatusReason} from './printer_status.js'; +import {PrinterStatus} from './printer_status.js'; /** * Note: |printerPPDPath| refers to a PPD retrieved from the user at the @@ -33,7 +33,6 @@ }; printerProtocol: string; printerQueue: string; - printerStatusReason: PrinterStatusReason; printServerUri: string; }
diff --git a/chrome/browser/resources/settings/chromeos/os_printing_page/cups_settings_add_printer_dialog.ts b/chrome/browser/resources/settings/chromeos/os_printing_page/cups_settings_add_printer_dialog.ts index 831dd16..ced8e5c 100644 --- a/chrome/browser/resources/settings/chromeos/os_printing_page/cups_settings_add_printer_dialog.ts +++ b/chrome/browser/resources/settings/chromeos/os_printing_page/cups_settings_add_printer_dialog.ts
@@ -26,7 +26,6 @@ import {CupsPrinterInfo} from './cups_printers_browser_proxy.js'; import {getTemplate} from './cups_settings_add_printer_dialog.html.js'; -import {PrinterStatusReason} from './printer_status.js'; /** * Different dialogs in add printer flow. @@ -58,7 +57,6 @@ }, printerProtocol: 'ipp', printerQueue: 'ipp/print', - printerStatusReason: PrinterStatusReason.UNKNOWN_REASON, printServerUri: '', }; }
diff --git a/chrome/browser/resources/settings/chromeos/os_privacy_page/privacy_hub_subpage.html b/chrome/browser/resources/settings/chromeos/os_privacy_page/privacy_hub_subpage.html index a030914..a21030a 100644 --- a/chrome/browser/resources/settings/chromeos/os_privacy_page/privacy_hub_subpage.html +++ b/chrome/browser/resources/settings/chromeos/os_privacy_page/privacy_hub_subpage.html
@@ -73,6 +73,18 @@ </div> </div> +<template is="dom-if" if="[[showSpeakOnMuteDetectionPage_]]" restamp> + <settings-toggle-button + class="settings-box" + pref="{{prefs.ash.user.speak_on_mute_detection_enabled}}" + id="speakonmuteDetectionToggle" + label="$i18n{speakOnMuteDetectionToggleTitle}" + sub-label="$i18n{speakOnMuteDetectionToggleSubtext}" + deep-link-focus-id$="[[Setting.kSpeakOnMuteDetectionOnOff]]" + learn-more-url="$i18n{speakOnMuteDetectionLearnMoreURL}"> + </settings-toggle-button> +</template> + <!-- Location toggle is not to be shown in dogfooded version of Privacy Hub --> <template is="dom-if" if="[[showPrivacyHubMVPPage_]]" restamp> <settings-toggle-button
diff --git a/chrome/browser/resources/settings/chromeos/os_privacy_page/privacy_hub_subpage.ts b/chrome/browser/resources/settings/chromeos/os_privacy_page/privacy_hub_subpage.ts index fa842b85..5b9d03f 100644 --- a/chrome/browser/resources/settings/chromeos/os_privacy_page/privacy_hub_subpage.ts +++ b/chrome/browser/resources/settings/chromeos/os_privacy_page/privacy_hub_subpage.ts
@@ -105,6 +105,17 @@ }, /** + * Whether the part of speak-on-mute detection should be displayed. + */ + showSpeakOnMuteDetectionPage_: { + type: Boolean, + readOnly: true, + value: () => { + return loadTimeData.getBoolean('showSpeakOnMuteDetectionPage'); + }, + }, + + /** * Used by DeepLinkingMixin to focus this page's deep links. */ supportedSettingIds: { @@ -112,6 +123,7 @@ value: () => new Set<Setting>([ Setting.kCameraOnOff, Setting.kMicrophoneOnOff, + Setting.kSpeakOnMuteDetectionOnOff, Setting.kGeolocationOnOff, Setting.kUsageStatsAndCrashReports, ]), @@ -127,6 +139,7 @@ private microphoneHardwareToggleActive_: boolean; private shouldDisableMicrophoneToggle_: boolean; private showPrivacyHubMVPPage_: boolean; + private showSpeakOnMuteDetectionPage_: boolean; constructor() { super();
diff --git a/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.html b/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.html index e538d1fb..98e66cb 100644 --- a/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.html +++ b/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.html
@@ -130,24 +130,32 @@ </div> <div class="flex">$i18n{secondaryUserBannerText}</div> </div> - <os-settings-section page-title="$i18n{internetPageTitle}" - section="internet"> - <settings-internet-page prefs="{{prefs}}"> - </settings-internet-page> - </os-settings-section> - <os-settings-section page-title="$i18n{bluetoothPageTitle}" - section="bluetooth"> - <os-settings-bluetooth-page prefs="{{prefs}}"> - </os-settings-bluetooth-page> - </os-settings-section> - <template is="dom-if" if="[[!isGuestMode_]]" restamp> + <template is="dom-if" + if="[[shouldStampPage_(pageAvailability.internet)]]" restamp> + <os-settings-section page-title="$i18n{internetPageTitle}" + section="internet"> + <settings-internet-page prefs="{{prefs}}"> + </settings-internet-page> + </os-settings-section> + </template> + <template is="dom-if" + if="[[shouldStampPage_(pageAvailability.bluetooth)]]" restamp> + <os-settings-section page-title="$i18n{bluetoothPageTitle}" + section="bluetooth"> + <os-settings-bluetooth-page prefs="{{prefs}}"> + </os-settings-bluetooth-page> + </os-settings-section> + </template> + <template is="dom-if" + if="[[shouldStampPage_(pageAvailability.multidevice)]]" restamp> <os-settings-section page-title="$i18n{multidevicePageTitle}" section="multidevice"> <settings-multidevice-page prefs="{{prefs}}"> </settings-multidevice-page> </os-settings-section> </template> - <template is="dom-if" if="[[!isGuestMode_]]" restamp> + <template is="dom-if" + if="[[shouldStampPage_(pageAvailability.osPeople)]]" restamp> <os-settings-section page-title="$i18n{osPeoplePageTitle}" section="osPeople"> <os-settings-people-page prefs="{{prefs}}" @@ -162,43 +170,59 @@ <settings-kerberos-page></settings-kerberos-page> </os-settings-section> </template> - <os-settings-section page-title="$i18n{devicePageTitle}" - section="device"> - <settings-device-page prefs="{{prefs}}"> - </settings-device-page> - </os-settings-section> - <template is="dom-if" if="[[!isGuestMode_]]" restamp> + <template is="dom-if" + if="[[shouldStampPage_(pageAvailability.device)]]" restamp> + <os-settings-section page-title="$i18n{devicePageTitle}" + section="device"> + <settings-device-page prefs="{{prefs}}"> + </settings-device-page> + </os-settings-section> + </template> + <template is="dom-if" + if="[[shouldStampPage_(pageAvailability.personalization)]]" restamp> <os-settings-section page-title="$i18n{personalizationPageTitle}" section="personalization"> <settings-personalization-page prefs="{{prefs}}"> </settings-personalization-page> </os-settings-section> </template> - <os-settings-section page-title="$i18n{osSearchPageTitle}" - section="osSearch"> - <os-settings-search-page prefs="{{prefs}}"> - </os-settings-search-page> - </os-settings-section> - <os-settings-section page-title="$i18n{privacyPageTitle}" - section="osPrivacy"> - <os-settings-privacy-page prefs="{{prefs}}"> - </os-settings-privacy-page> - </os-settings-section> - <os-settings-section page-title="$i18n{appsPageTitle}" section="apps"> - <os-settings-apps-page - prefs="{{prefs}}" - android-apps-info="[[androidAppsInfo]]" - have-play-store-app="[[havePlayStoreApp]]" - show-android-apps="[[showAndroidApps]]" - show-arcvm-manage-usb="[[showArcvmManageUsb]]" - show-plugin-vm="[[showPluginVm]]"> - </os-settings-apps-page> - </os-settings-section> - <os-settings-section page-title="$i18n{a11yPageTitle}" - section="osAccessibility"> - <os-settings-a11y-page prefs="{{prefs}}"> - </os-settings-a11y-page> - </os-settings-section> + <template is="dom-if" + if="[[shouldStampPage_(pageAvailability.osSearch)]]" restamp> + <os-settings-section page-title="$i18n{osSearchPageTitle}" + section="osSearch"> + <os-settings-search-page prefs="{{prefs}}"> + </os-settings-search-page> + </os-settings-section> + </template> + <template is="dom-if" + if="[[shouldStampPage_(pageAvailability.osPrivacy)]]" restamp> + <os-settings-section page-title="$i18n{privacyPageTitle}" + section="osPrivacy"> + <os-settings-privacy-page prefs="{{prefs}}"> + </os-settings-privacy-page> + </os-settings-section> + </template> + <template is="dom-if" + if="[[shouldStampPage_(pageAvailability.apps)]]" restamp> + <os-settings-section page-title="$i18n{appsPageTitle}" section="apps"> + <os-settings-apps-page + prefs="{{prefs}}" + android-apps-info="[[androidAppsInfo]]" + have-play-store-app="[[havePlayStoreApp]]" + show-android-apps="[[showAndroidApps]]" + show-arcvm-manage-usb="[[showArcvmManageUsb]]" + show-plugin-vm="[[showPluginVm]]"> + </os-settings-apps-page> + </os-settings-section> + </template> + <template is="dom-if" + if="[[shouldStampPage_(pageAvailability.osAccessibility)]]" restamp> + <os-settings-section page-title="$i18n{a11yPageTitle}" + section="osAccessibility"> + <os-settings-a11y-page prefs="{{prefs}}"> + </os-settings-a11y-page> + </os-settings-section> + </template> </div> </template> @@ -221,33 +245,46 @@ <div id="advancedPage" hidden$="[[!showAdvancedPage_( currentRoute_, hasExpandedSection_, advancedToggleExpanded)]]"> - <os-settings-section page-title="$i18n{dateTimePageTitle}" - section="dateTime"> - <settings-date-time-page prefs="{{prefs}}"> - </settings-date-time-page> - </os-settings-section> - <os-settings-section page-title="$i18n{osLanguagesPageTitle}" - section="osLanguages"> - <os-settings-languages-section prefs="{{prefs}}"> - </os-settings-languages-section> - </os-settings-section> - <template is="dom-if" if="[[!isGuestMode_]]"> + <template is="dom-if" + if="[[shouldStampPage_(pageAvailability.dateTime)]]" restamp> + <os-settings-section page-title="$i18n{dateTimePageTitle}" + section="dateTime"> + <settings-date-time-page prefs="{{prefs}}"> + </settings-date-time-page> + </os-settings-section> + </template> + <template is="dom-if" + if="[[shouldStampPage_(pageAvailability.osLanguages)]]" restamp> + <os-settings-section page-title="$i18n{osLanguagesPageTitle}" + section="osLanguages"> + <os-settings-languages-section prefs="{{prefs}}"> + </os-settings-languages-section> + </os-settings-section> + </template> + <template is="dom-if" + if="[[shouldStampPage_(pageAvailability.files)]]" restamp> <os-settings-section page-title="$i18n{filesPageTitle}" section="files"> <os-settings-files-page prefs="{{prefs}}"> </os-settings-files-page> </os-settings-section> </template> - <os-settings-section page-title="$i18n{printingPageTitle}" - section="osPrinting"> - <os-settings-printing-page prefs="{{prefs}}"> - </os-settings-printing-page> - </os-settings-section> - <os-settings-section page-title="$i18n{crostiniPageTitle}" - section="crostini"> - <settings-crostini-page prefs="{{prefs}}"> - </settings-crostini-page> - </os-settings-section> + <template is="dom-if" + if="[[shouldStampPage_(pageAvailability.osPrinting)]]" restamp> + <os-settings-section page-title="$i18n{printingPageTitle}" + section="osPrinting"> + <os-settings-printing-page prefs="{{prefs}}"> + </os-settings-printing-page> + </os-settings-section> + </template> + <template is="dom-if" restamp + if="[[shouldStampPage_(pageAvailability.crostini)]]"> + <os-settings-section page-title="$i18n{crostiniPageTitle}" + section="crostini"> + <settings-crostini-page prefs="{{prefs}}"> + </settings-crostini-page> + </os-settings-section> + </template> <template is="dom-if" if="[[shouldStampPage_(pageAvailability.osReset)]]" restamp> <os-settings-section page-title="$i18n{resetPageTitle}"
diff --git a/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.ts b/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.ts index 6417023..d44a020f4 100644 --- a/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.ts +++ b/chrome/browser/resources/settings/chromeos/os_settings_page/os_settings_page.ts
@@ -82,16 +82,6 @@ androidAppsInfo: Object, /** - * Whether the user is in guest mode. - */ - isGuestMode_: { - type: Boolean, - value: () => { - return loadTimeData.getBoolean('isGuest'); - }, - }, - - /** * Dictionary defining page availability. */ pageAvailability: {
diff --git a/chrome/browser/sessions/session_restore_interactive_uitest.cc b/chrome/browser/sessions/session_restore_interactive_uitest.cc index 8434f9a..884fcd7 100644 --- a/chrome/browser/sessions/session_restore_interactive_uitest.cc +++ b/chrome/browser/sessions/session_restore_interactive_uitest.cc
@@ -22,6 +22,7 @@ #include "components/sessions/content/content_test_helper.h" #include "content/public/browser/render_widget_host_view.h" #include "content/public/test/browser_test.h" +#include "ui/views/widget/widget_interactive_uitest_utils.h" class SessionRestoreInteractiveTest : public InProcessBrowserTest { public: @@ -171,7 +172,12 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreInteractiveTest, MAYBE_RestoreMinimizedWindow) { // Minimize the window. + views::test::PropertyWaiter minimize_waiter( + base::BindRepeating(&ui::BaseWindow::IsMinimized, + base::Unretained(browser()->window())), + true); browser()->window()->Minimize(); + EXPECT_TRUE(minimize_waiter.Wait()); // Restart and session restore the tabs. Browser* restored = QuitBrowserAndRestore(browser()); @@ -201,7 +207,12 @@ CreateBrowser(browser()->profile()); // Minimize the first browser window. + views::test::PropertyWaiter minimize_waiter( + base::BindRepeating(&ui::BaseWindow::IsMinimized, + base::Unretained(browser()->window())), + true); browser()->window()->Minimize(); + EXPECT_TRUE(minimize_waiter.Wait()); EXPECT_EQ(2u, BrowserList::GetInstance()->size());
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index a23a2830..67dc4a2 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc
@@ -35,6 +35,7 @@ #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" #include "chrome/browser/new_tab_page/chrome_colors/chrome_colors_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/search/background/ntp_custom_background_service.h" #include "chrome/browser/themes/browser_theme_pack.h" #include "chrome/browser/themes/custom_theme_supplier.h" #include "chrome/browser/themes/theme_properties.h" @@ -51,6 +52,7 @@ #include "chrome/common/pref_names.h" #include "components/infobars/content/content_infobar_manager.h" #include "components/prefs/pref_service.h" +#include "components/search/ntp_features.h" #include "content/public/browser/notification_service.h" #include "extensions/browser/extension_file_task_runner.h" #include "extensions/browser/extension_prefs.h" @@ -578,6 +580,9 @@ SwapThemeSupplier(nullptr); ClearThemePrefs(); + if (base::FeatureList::IsEnabled(ntp_features::kCustomizeChromeSidePanel)) { + NtpCustomBackgroundService::ResetProfilePrefs(profile_); + } // Disable extension after modifying the prefs so that unloading the extension // doesn't trigger |ClearAllThemeData| again. @@ -815,6 +820,9 @@ void ThemeService::SetThemePrefsForExtension( const extensions::Extension* extension) { ClearThemePrefs(); + if (base::FeatureList::IsEnabled(ntp_features::kCustomizeChromeSidePanel)) { + NtpCustomBackgroundService::ResetProfilePrefs(profile_); + } profile_->GetPrefs()->SetString(prefs::kCurrentThemeID, extension->id());
diff --git a/chrome/browser/themes/theme_service_unittest.cc b/chrome/browser/themes/theme_service_unittest.cc index edfa0dc..8902a73 100644 --- a/chrome/browser/themes/theme_service_unittest.cc +++ b/chrome/browser/themes/theme_service_unittest.cc
@@ -36,6 +36,7 @@ #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile_manager.h" +#include "components/search/ntp_features.h" #include "components/supervised_user/core/common/buildflags.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "content/public/test/test_utils.h" @@ -141,6 +142,8 @@ ASSERT_TRUE(registry_); theme_service_ = ThemeServiceFactory::GetForProfile(profile()); ASSERT_TRUE(theme_service_); + pref_service_ = profile_->GetPrefs(); + ASSERT_TRUE(pref_service_); } ThemeScoper LoadUnpackedTheme(const std::string& source_file_path = @@ -197,6 +200,7 @@ protected: ui::TestNativeTheme test_native_theme_; raw_ptr<extensions::ExtensionRegistry> registry_ = nullptr; + raw_ptr<PrefService> pref_service_ = nullptr; raw_ptr<ThemeService> theme_service_ = nullptr; }; @@ -528,6 +532,7 @@ TEST_F(ThemeServiceTest, BuildFromColorTest) { // Set theme from color. + theme_service_->UseDefaultTheme(); EXPECT_TRUE(theme_service_->UsingDefaultTheme()); EXPECT_FALSE(theme_service_->UsingAutogeneratedTheme()); theme_service_->BuildAutogeneratedThemeFromColor( @@ -541,7 +546,7 @@ EXPECT_FALSE(theme_service_->UsingDefaultTheme()); EXPECT_FALSE(theme_service_->UsingAutogeneratedTheme()); base::FilePath path = - profile_->GetPrefs()->GetFilePath(prefs::kCurrentThemePackFilename); + pref_service_->GetFilePath(prefs::kCurrentThemePackFilename); EXPECT_FALSE(path.empty()); theme_service_->BuildAutogeneratedThemeFromColor( @@ -549,7 +554,7 @@ EXPECT_FALSE(theme_service_->UsingDefaultTheme()); EXPECT_TRUE(theme_service_->UsingAutogeneratedTheme()); EXPECT_EQ(ThemeService::kAutogeneratedThemeID, theme_service_->GetThemeID()); - path = profile_->GetPrefs()->GetFilePath(prefs::kCurrentThemePackFilename); + path = pref_service_->GetFilePath(prefs::kCurrentThemePackFilename); EXPECT_TRUE(path.empty()); } @@ -575,6 +580,30 @@ EXPECT_FALSE(service_->IsExtensionEnabled(scoper.extension_id())); } +// Test that setting theme to default resets the NTP theme as well. +TEST_F(ThemeServiceTest, UseDefaultTheme_DisableNtpThemeTest) { + // Turn on Customize Chrome Side Panel. + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature( + ntp_features::kCustomizeChromeSidePanel); + + base::Value::Dict test_background_info; + test_background_info.Set("test_data", "foo"); + pref_service_->SetDict(prefs::kNtpCustomBackgroundDict, + std::move(test_background_info)); + + const base::Value::Dict& background_info_with_theme = + pref_service_->GetDict(prefs::kNtpCustomBackgroundDict); + const base::Value* test_data = background_info_with_theme.Find("test_data"); + EXPECT_NE(test_data, nullptr); + EXPECT_NE(test_data->GetIfString(), nullptr); + + theme_service_->UseDefaultTheme(); + const base::Value::Dict& background_info_without_theme = + pref_service_->GetDict(prefs::kNtpCustomBackgroundDict); + EXPECT_EQ(background_info_without_theme.Find("test_data"), nullptr); +} + TEST_P(ColorProviderTest, OmniboxContrast) { #if BUILDFLAG(IS_WIN) // TODO(crbug.com/1336315): Windows platform high contrast colors are not @@ -668,7 +697,7 @@ EXPECT_FALSE(theme_service_->UsingPolicyTheme()); // Setting a blank policy color shouldn't cause any theme updates. - profile_->GetPrefs()->ClearPref(prefs::kPolicyThemeColor); + pref_service_->ClearPref(prefs::kPolicyThemeColor); EXPECT_TRUE(theme_service_->UsingDefaultTheme()); EXPECT_FALSE(theme_service_->UsingAutogeneratedTheme()); EXPECT_FALSE(theme_service_->UsingPolicyTheme());
diff --git a/chrome/browser/ui/android/omnibox/java/res/values/colors.xml b/chrome/browser/ui/android/omnibox/java/res/values/colors.xml index dfc3b22..e80b5934 100644 --- a/chrome/browser/ui/android/omnibox/java/res/values/colors.xml +++ b/chrome/browser/ui/android/omnibox/java/res/values/colors.xml
@@ -41,7 +41,7 @@ <color name="url_bar_primary_text_incognito">@color/default_text_color_light</color> <color name="url_bar_secondary_text_incognito">@color/default_text_color_secondary_light</color> - <color name="text_highlight_color_incognito">@color/baseline_primary_200_alpha_20</color> + <color name="text_highlight_color_incognito">@color/baseline_primary_80_alpha_20</color> <color name="omnibox_suggestion_bg_incognito">@color/default_bg_color_dark</color> <color name="omnibox_dropdown_bg_incognito">@color/default_bg_color_dark_elev_1_baseline</color>
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java index 2284eb70..e2fa649 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java
@@ -216,7 +216,8 @@ } @CalledByNative - private void onSuggestionsReceived(@NonNull AutocompleteResult autocompleteResult, + @VisibleForTesting + public void onSuggestionsReceived(@NonNull AutocompleteResult autocompleteResult, @NonNull String inlineAutocompleteText, boolean isFinal) { mAutocompleteResult = autocompleteResult; // Notify callbacks of suggestions. @@ -348,7 +349,7 @@ @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) @NativeMethods - interface Natives { + public interface Natives { void start(long nativeAutocompleteControllerAndroid, String text, int cursorPosition, String desiredTld, String currentUrl, int pageClassification, boolean preventInlineAutocomplete, boolean preferKeyword,
diff --git a/chrome/browser/ui/ash/capture_mode/recording_service_browsertest.cc b/chrome/browser/ui/ash/capture_mode/recording_service_browsertest.cc index 90ac821..f9bb1d2c 100644 --- a/chrome/browser/ui/ash/capture_mode/recording_service_browsertest.cc +++ b/chrome/browser/ui/ash/capture_mode/recording_service_browsertest.cc
@@ -215,7 +215,7 @@ IN_PROC_BROWSER_TEST_F(RecordingServiceBrowserTest, RecordWindowMultiDisplay) { display::test::DisplayManagerTestApi(ash::ShellTestApi().display_manager()) - .UpdateDisplay("300x200,301+0-400x400"); + .UpdateDisplay("300x200,301+0-400x350"); ash::CaptureModeTestApi capture_mode_test_api; capture_mode_test_api.StartForWindow(/*for_video=*/true);
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc index 2df6bf8..5f5bc4ee 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -413,7 +413,7 @@ } std::string ChromeShellDelegate::GetVersionString() { - return version_info::GetVersionNumber(); + return std::string(version_info::GetVersionNumber()); } void ChromeShellDelegate::ShouldExitFullscreenBeforeLock(
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_browsertest.cc b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_browsertest.cc index 1cbef73..c2b9d910f 100644 --- a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_browsertest.cc +++ b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_browsertest.cc
@@ -1079,7 +1079,7 @@ display::DisplayManager* display_manager = ash::Shell::Get()->display_manager(); display::test::DisplayManagerTestApi(display_manager) - .UpdateDisplay("0+0-800x800,801+0-800x800"); + .UpdateDisplay("0+0-800x700,801+0-800x700"); display::Displays displays = display_manager->active_display_list(); aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); EXPECT_EQ(displays.size(), 2U); @@ -1128,7 +1128,7 @@ display::DisplayManager* display_manager = ash::Shell::Get()->display_manager(); display::test::DisplayManagerTestApi(display_manager) - .UpdateDisplay("800x800,801+0-800x800"); + .UpdateDisplay("800x700,801+0-800x700"); display::Displays displays = display_manager->active_display_list(); aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); EXPECT_EQ(displays.size(), 2U);
diff --git a/chrome/browser/ui/autofill/risk_util.cc b/chrome/browser/ui/autofill/risk_util.cc index a772a22..fdbc2faf 100644 --- a/chrome/browser/ui/autofill/risk_util.cc +++ b/chrome/browser/ui/autofill/risk_util.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ui/autofill/risk_util.h" #include <memory> +#include <string> #include "base/base64.h" #include "base/functional/bind.h" @@ -101,7 +102,7 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); risk::GetFingerprint(obfuscated_gaia_id, window_bounds, web_contents, - version_info::GetVersionNumber(), charset, + std::string(version_info::GetVersionNumber()), charset, accept_languages, install_time, g_browser_process->GetApplicationLocale(), embedder_support::GetUserAgent(),
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc index 7ff296a..8a476df 100644 --- a/chrome/browser/ui/browser_navigator_browsertest.cc +++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -1990,10 +1990,10 @@ BrowserNavigatorTest::SetScreenInstance(); #else mock_screen_.Init(); - mock_screen_.display_list().AddDisplay({1, gfx::Rect(0, 0, 800, 800)}, + mock_screen_.display_list().AddDisplay({1, gfx::Rect(0, 0, 800, 700)}, display::DisplayList::Type::PRIMARY); mock_screen_.display_list().AddDisplay( - {2, gfx::Rect(800, 0, 800, 800)}, + {2, gfx::Rect(800, 0, 800, 700)}, display::DisplayList::Type::NOT_PRIMARY); ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays()); #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -2004,7 +2004,7 @@ // This has to happen later than `SetScreenInstance` as the Ash shell does // not exist yet. display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) - .UpdateDisplay("0+0-800x800,800+0-800x800"); + .UpdateDisplay("0+0-800x700,800+0-800x700"); ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays()); #endif // BUILDFLAG(IS_CHROMEOS_ASH) }
diff --git a/chrome/browser/ui/color/BUILD.gn b/chrome/browser/ui/color/BUILD.gn index e27675d..3dba3ad2 100644 --- a/chrome/browser/ui/color/BUILD.gn +++ b/chrome/browser/ui/color/BUILD.gn
@@ -103,6 +103,8 @@ "//chrome/app_shim", "//components/upload_list", ] + + configs += [ "//build/config/compiler:enable_arc" ] } if (is_win) {
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc index ff9471b1..4cbb2039 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc
@@ -791,14 +791,14 @@ void SetUp() { #if BUILDFLAG(IS_CHROMEOS_ASH) display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) - .UpdateDisplay("0+0-800x800,800+0-800x800"); + .UpdateDisplay("100+100-801x802,901+0-802x803"); #elif BUILDFLAG(IS_MAC) virtual_display_mac_util_ = std::make_unique<display::test::VirtualDisplayMacUtil>(); display_id_ = virtual_display_mac_util_->AddDisplay( 1, display::test::VirtualDisplayMacUtil::k1680x1050); #else - screen_.display_list().AddDisplay({2, gfx::Rect(800, 0, 800, 800)}, + screen_.display_list().AddDisplay({2, gfx::Rect(901, 0, 802, 803)}, display::DisplayList::Type::NOT_PRIMARY); #endif // BUILDFLAG(IS_CHROMEOS_ASH) ASSERT_GE(display::Screen::GetScreen()->GetNumDisplays(), 2); @@ -815,7 +815,7 @@ void RemoveSecondDisplay() { #if BUILDFLAG(IS_CHROMEOS_ASH) display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) - .UpdateDisplay("0+0-800x800"); + .UpdateDisplay("100+100-801x802"); #elif BUILDFLAG(IS_MAC) virtual_display_mac_util_->RemoveDisplay(display_id_); #else
diff --git a/chrome/browser/ui/extensions/application_launch_browsertest.cc b/chrome/browser/ui/extensions/application_launch_browsertest.cc index de119937..8d13f25 100644 --- a/chrome/browser/ui/extensions/application_launch_browsertest.cc +++ b/chrome/browser/ui/extensions/application_launch_browsertest.cc
@@ -22,7 +22,7 @@ display::DisplayManager* display_manager = ash::Shell::Get()->display_manager(); display::test::DisplayManagerTestApi display_manager_test(display_manager); - display_manager_test.UpdateDisplay("800x800,801+0-800x800"); + display_manager_test.UpdateDisplay("800x750,801+0-800x750"); int64_t display1 = screen->GetPrimaryDisplay().id(); int64_t display2 = display_manager_test.GetSecondaryDisplay().id(); EXPECT_EQ(2, screen->GetNumDisplays());
diff --git a/chrome/browser/ui/global_media_controls/media_notification_service.cc b/chrome/browser/ui/global_media_controls/media_notification_service.cc index c28edd3..5c98ba69 100644 --- a/chrome/browser/ui/global_media_controls/media_notification_service.cc +++ b/chrome/browser/ui/global_media_controls/media_notification_service.cc
@@ -110,7 +110,7 @@ MediaNotificationService::MediaNotificationService(Profile* profile, bool show_from_all_profiles) - : receiver_(this) { + : profile_(profile), receiver_(this) { item_manager_ = global_media_controls::MediaItemManager::Create(); absl::optional<base::UnguessableToken> source_id; @@ -299,9 +299,10 @@ } else if (HasActiveControllableSessionForWebContents(contents)) { item_id = GetActiveControllableSessionForWebContents(contents); } else { - auto presentation_item = - supplemental_device_picker_producer_->GetNotificationItem(); - item_id = presentation_item->id(); + const SupplementalDevicePickerItem& supplemental_item = + supplemental_device_picker_producer_->GetOrCreateNotificationItem( + content::MediaSession::GetSourceId(profile_)); + item_id = supplemental_item.id(); DCHECK(presentation_request_notification_producer_->GetWebContents() == contents); }
diff --git a/chrome/browser/ui/global_media_controls/media_notification_service.h b/chrome/browser/ui/global_media_controls/media_notification_service.h index 3074e57..595875fb 100644 --- a/chrome/browser/ui/global_media_controls/media_notification_service.h +++ b/chrome/browser/ui/global_media_controls/media_notification_service.h
@@ -157,6 +157,8 @@ std::string GetActiveControllableSessionForWebContents( content::WebContents* web_contents) const; + const raw_ptr<Profile> profile_; + std::unique_ptr<global_media_controls::MediaItemManager> item_manager_; std::unique_ptr<global_media_controls::MediaSessionItemProducer>
diff --git a/chrome/browser/ui/global_media_controls/media_notification_service_unittest.cc b/chrome/browser/ui/global_media_controls/media_notification_service_unittest.cc index ebdec2f8..80dafff 100644 --- a/chrome/browser/ui/global_media_controls/media_notification_service_unittest.cc +++ b/chrome/browser/ui/global_media_controls/media_notification_service_unittest.cc
@@ -259,8 +259,9 @@ base::RunLoop().RunUntilIdle(); auto notification_id = service() - ->supplemental_device_picker_producer_->GetNotificationItem() - ->id(); + ->supplemental_device_picker_producer_ + ->GetOrCreateNotificationItem(base::UnguessableToken::Create()) + .id(); EXPECT_FALSE(notification_id.empty()); auto item = service() ->presentation_request_notification_producer_
diff --git a/chrome/browser/ui/global_media_controls/supplemental_device_picker_producer.cc b/chrome/browser/ui/global_media_controls/supplemental_device_picker_producer.cc index 73bd272d..029891c8 100644 --- a/chrome/browser/ui/global_media_controls/supplemental_device_picker_producer.cc +++ b/chrome/browser/ui/global_media_controls/supplemental_device_picker_producer.cc
@@ -130,9 +130,12 @@ item_manager_->HideDialog(); } -base::WeakPtr<SupplementalDevicePickerItem> -SupplementalDevicePickerProducer::GetNotificationItem() { - return item_ ? item_->GetWeakPtr() : nullptr; +const SupplementalDevicePickerItem& +SupplementalDevicePickerProducer::GetOrCreateNotificationItem( + const base::UnguessableToken& source_id) { + CreateItem(source_id); + CHECK(item_); + return *item_; } mojo::PendingRemote<global_media_controls::mojom::DevicePickerProvider>
diff --git a/chrome/browser/ui/global_media_controls/supplemental_device_picker_producer.h b/chrome/browser/ui/global_media_controls/supplemental_device_picker_producer.h index 86cc0ad..cf52a82 100644 --- a/chrome/browser/ui/global_media_controls/supplemental_device_picker_producer.h +++ b/chrome/browser/ui/global_media_controls/supplemental_device_picker_producer.h
@@ -75,8 +75,11 @@ observer) override; void HideMediaUI() override; - // Returns the item managed by `this`. May be null. - base::WeakPtr<SupplementalDevicePickerItem> GetNotificationItem(); + // Returns the item managed by `this`. Creates one if it doesn't already + // exist. `source_id` is the per-Profile MediaSession source ID used for + // distinguishing callers. + const SupplementalDevicePickerItem& GetOrCreateNotificationItem( + const base::UnguessableToken& source_id); // Returns a remote bound to `this`. mojo::PendingRemote<global_media_controls::mojom::DevicePickerProvider>
diff --git a/chrome/browser/ui/global_media_controls/supplemental_device_picker_producer_unittest.cc b/chrome/browser/ui/global_media_controls/supplemental_device_picker_producer_unittest.cc index 8f10e7bc..e76cc59 100644 --- a/chrome/browser/ui/global_media_controls/supplemental_device_picker_producer_unittest.cc +++ b/chrome/browser/ui/global_media_controls/supplemental_device_picker_producer_unittest.cc
@@ -67,7 +67,6 @@ TEST_F(SupplementalDevicePickerProducerTest, ShowItem) { std::string id = ShowItem(); EXPECT_TRUE(notification_producer_.GetMediaItem(id)); - EXPECT_TRUE(notification_producer_.GetNotificationItem()); EXPECT_FALSE(notification_producer_.HasFrozenItems()); EXPECT_FALSE(notification_producer_.IsItemActivelyPlaying(id)); } @@ -76,7 +75,6 @@ std::string id = ShowItem(); notification_producer_.HideItem(); EXPECT_TRUE(notification_producer_.GetMediaItem(id)); - EXPECT_TRUE(notification_producer_.GetNotificationItem()); EXPECT_TRUE(notification_producer_.GetActiveControllableItemIds().empty()); } @@ -84,10 +82,16 @@ std::string id = ShowItem(); notification_producer_.DeleteItem(); EXPECT_FALSE(notification_producer_.GetMediaItem(id)); - EXPECT_FALSE(notification_producer_.GetNotificationItem()); EXPECT_TRUE(notification_producer_.GetActiveControllableItemIds().empty()); } +TEST_F(SupplementalDevicePickerProducerTest, GetOrCreateNotificationItem) { + const SupplementalDevicePickerItem& supplemental_item = + notification_producer_.GetOrCreateNotificationItem( + base::UnguessableToken::Create()); + EXPECT_FALSE(supplemental_item.id().empty()); +} + TEST_F(SupplementalDevicePickerProducerTest, OnMediaDialogOpened) { std::unique_ptr<MockDevicePickerObserver> observer = CreateObserver(); EXPECT_CALL(*observer, OnMediaUIOpened);
diff --git a/chrome/browser/ui/search/new_tab_page_navigation_throttle_browsertest.cc b/chrome/browser/ui/search/new_tab_page_navigation_throttle_browsertest.cc index 97486d3..979b6237 100644 --- a/chrome/browser/ui/search/new_tab_page_navigation_throttle_browsertest.cc +++ b/chrome/browser/ui/search/new_tab_page_navigation_throttle_browsertest.cc
@@ -135,6 +135,60 @@ EXPECT_EQ(chrome::kChromeUINewTabPageThirdPartyURL, NavigateToNewTabPage()); } +class OverrideNavigationParamsObserver : public content::WebContentsObserver { + public: + explicit OverrideNavigationParamsObserver(content::WebContents* contents) + : WebContentsObserver(contents) {} + + // WebContentsObserver overrides: + void DidFinishNavigation(content::NavigationHandle* handle) override { + EXPECT_TRUE(handle); + + // Check the values that are changed in OverrideNavigationParams. + EXPECT_EQ(absl::nullopt, handle->GetInitiatorOrigin()); + EXPECT_FALSE(handle->IsRendererInitiated()); + ui::PageTransitionCoreTypeIs(handle->GetPageTransition(), + ui::PAGE_TRANSITION_AUTO_BOOKMARK); + } +}; + +// Check that ChromeContentBrowserClient::OverrideNavigationParams behaves +// correctly when navigating from a custom 3P NTP with an HTTPS scheme. +// OverrideNavigationParams changes the params on renderer initiated navigations +// from the NTP. It identifies a page as an NTP by using the site URL, not the +// lock URL, of the initiator process. +IN_PROC_BROWSER_TEST_F(NewTabPageNavigationThrottleTest, + OverrideNavigationParams_ThirdPartyNTP) { + ASSERT_TRUE(https_test_server()->Start()); + std::string ntp_url = + https_test_server()->GetURL("/instant_extended.html").spec(); + SetNewTabPage(ntp_url); + EXPECT_EQ(ntp_url, NavigateToNewTabPage()); + + const GURL page_url = https_test_server()->GetURL("/simple.html"); + auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); + OverrideNavigationParamsObserver observer(web_contents); + EXPECT_TRUE(content::NavigateToURLFromRenderer(web_contents, page_url)); +} + +// Check that ChromeContentBrowserClient::OverrideNavigationParams behaves +// correctly when navigating from a chrome:// NTP. +// OverrideNavigationParams changes the params on renderer initiated navigations +// from the NTP. It identifies a page as an NTP by using the site URL, not the +// lock URL, of the initiator process. This test uses a chrome:// URL for the +// NTP, so the lock and site URLs are the same. +IN_PROC_BROWSER_TEST_F(NewTabPageNavigationThrottleTest, + OverrideNavigationParams_ChromeURLNTP) { + ASSERT_TRUE(https_test_server()->Start()); + SetNewTabPage(chrome::kChromeUINewTabPageThirdPartyURL); + EXPECT_EQ(chrome::kChromeUINewTabPageThirdPartyURL, NavigateToNewTabPage()); + + const GURL page_url = https_test_server()->GetURL("/simple.html"); + auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); + OverrideNavigationParamsObserver observer(web_contents); + EXPECT_TRUE(content::NavigateToURLFromRenderer(web_contents, page_url)); +} + class NewTabPageNavigationThrottlePrerenderTest : public NewTabPageNavigationThrottleTest { public:
diff --git a/chrome/browser/ui/side_panel/companion/companion_utils.cc b/chrome/browser/ui/side_panel/companion/companion_utils.cc index b413cecb..71d60d7 100644 --- a/chrome/browser/ui/side_panel/companion/companion_utils.cc +++ b/chrome/browser/ui/side_panel/companion/companion_utils.cc
@@ -23,6 +23,13 @@ return base::FeatureList::IsEnabled(features::kSidePanelCompanion); } +bool IsCompanionFeatureEnabledByPolicy(PrefService* pref_service) { + if (!pref_service) { + return false; + } + return pref_service->GetBoolean(prefs::kGoogleSearchSidePanelEnabled); +} + bool IsSearchInCompanionSidePanelSupported(const Browser* browser) { if (!browser) { return false; @@ -31,7 +38,8 @@ DCHECK(profile); return search::DefaultSearchProviderIsGoogle(profile) && !profile->IsOffTheRecord() && browser->is_type_normal() && - IsCompanionFeatureEnabled(); + IsCompanionFeatureEnabled() && + IsCompanionFeatureEnabledByPolicy(profile->GetPrefs()); } bool IsSearchWebInCompanionSidePanelSupported(const Browser* browser) {
diff --git a/chrome/browser/ui/side_panel/companion/companion_utils.h b/chrome/browser/ui/side_panel/companion/companion_utils.h index 472db06..f9cd344 100644 --- a/chrome/browser/ui/side_panel/companion/companion_utils.h +++ b/chrome/browser/ui/side_panel/companion/companion_utils.h
@@ -17,6 +17,10 @@ // Returns true if the companion feature is enabled. bool IsCompanionFeatureEnabled(); +// Returns true if the companion policy is enabled. The policy can change +// dynamically, so callers should not cache the returned results. +bool IsCompanionFeatureEnabledByPolicy(PrefService* pref_service); + // Returns true if browser is valid, DSE is Google, and the side panel companion // feature is enabled. bool IsSearchInCompanionSidePanelSupported(const Browser* browser);
diff --git a/chrome/browser/ui/side_panel/side_panel_prefs.cc b/chrome/browser/ui/side_panel/side_panel_prefs.cc index 645200f..1f248d28 100644 --- a/chrome/browser/ui/side_panel/side_panel_prefs.cc +++ b/chrome/browser/ui/side_panel/side_panel_prefs.cc
@@ -27,6 +27,7 @@ features::kSidePanelCompanionDefaultPinned), user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); } + registry->RegisterBooleanPref(prefs::kGoogleSearchSidePanelEnabled, true); } } // namespace side_panel_prefs
diff --git a/chrome/browser/ui/startup/first_run_service_unittest.cc b/chrome/browser/ui/startup/first_run_service_unittest.cc index 519ec162..e6b0a58 100644 --- a/chrome/browser/ui/startup/first_run_service_unittest.cc +++ b/chrome/browser/ui/startup/first_run_service_unittest.cc
@@ -224,7 +224,7 @@ [](const ::testing::TestParamInfo<FirstRunFieldTrialTestParams>& params) { return base::StringPrintf( "%02.0fpctEntropy%s", params.param.entropy_value * 100, - version_info::GetChannelString(params.param.channel).c_str()); + version_info::GetChannelString(params.param.channel).data()); }); // Tests to verify the logic for synthetic trial registration that we use to
diff --git a/chrome/browser/ui/tabs/saved_tab_groups/local_tab_group_listener.cc b/chrome/browser/ui/tabs/saved_tab_groups/local_tab_group_listener.cc index b216826e..57df760 100644 --- a/chrome/browser/ui/tabs/saved_tab_groups/local_tab_group_listener.cc +++ b/chrome/browser/ui/tabs/saved_tab_groups/local_tab_group_listener.cc
@@ -241,6 +241,23 @@ void LocalTabGroupListener::RemoveWebContentsFromSync( content::WebContents* contents) { - contents->Close(); web_contents_to_tab_id_map_.erase(contents); + + Browser* const browser = + SavedTabGroupUtils::GetBrowserWithTabGroupId(local_id_); + CHECK(browser); + CHECK(browser->tab_strip_model()); + int model_index = browser->tab_strip_model()->GetIndexOfWebContents(contents); + CHECK(model_index != TabStripModel::kNoTab); + + // Unload listeners can delay or prevent a tab closing. Remove the tab from + // the group first so the local and saved groups can be consistent even if + // this happens. + browser->tab_strip_model()->RemoveFromGroup({model_index}); + + // Removing the tab from the group may have moved the tab to maintain group + // contiguity. Find the tab again and close it. + model_index = browser->tab_strip_model()->GetIndexOfWebContents(contents); + browser->tab_strip_model()->CloseWebContentsAt( + model_index, TabCloseTypes::CLOSE_CREATE_HISTORICAL_TAB); }
diff --git a/chrome/browser/ui/test/popup_multiscreen_interactive_uitest.cc b/chrome/browser/ui/test/popup_multiscreen_interactive_uitest.cc index a058388..a8c969da 100644 --- a/chrome/browser/ui/test/popup_multiscreen_interactive_uitest.cc +++ b/chrome/browser/ui/test/popup_multiscreen_interactive_uitest.cc
@@ -83,7 +83,7 @@ } #if BUILDFLAG(IS_CHROMEOS_ASH) display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) - .UpdateDisplay("100+100-801x802,901+100-802x802"); + .UpdateDisplay("100+100-801x802,901+100-802x803"); return true; #elif BUILDFLAG(IS_MAC) if (display::test::VirtualDisplayMacUtil::IsAPIAvailable()) {
diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash_browsertest.cc b/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash_browsertest.cc index f2087afa..4babce1 100644 --- a/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash_browsertest.cc +++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash_browsertest.cc
@@ -343,7 +343,7 @@ display::DisplayManager* display_manager = ash::ShellTestApi().display_manager(); display::test::DisplayManagerTestApi(display_manager) - .UpdateDisplay("800x800"); + .UpdateDisplay("800x700"); const extensions::Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched"); @@ -383,7 +383,7 @@ // Create an app with content specifications on the secondary display. The // window is placed where the user specified. display::test::DisplayManagerTestApi(display_manager) - .UpdateDisplay("800x800,800+0-800x800"); + .UpdateDisplay("800x700,800+0-800x700"); { const gfx::Rect specified_bounds(810, 10, 600, 400); extensions::AppWindow::BoundsSpecification content_spec;
diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc index 5870c87..4327473 100644 --- a/chrome/browser/ui/views/chrome_views_delegate.cc +++ b/chrome/browser/ui/views/chrome_views_delegate.cc
@@ -210,5 +210,5 @@ } std::string ChromeViewsDelegate::GetApplicationName() { - return version_info::GetProductName(); + return std::string(version_info::GetProductName()); }
diff --git a/chrome/browser/ui/views/download/bubble/download_bubble_partial_view.cc b/chrome/browser/ui/views/download/bubble/download_bubble_partial_view.cc index cca926ef5..366b3cba 100644 --- a/chrome/browser/ui/views/download/bubble/download_bubble_partial_view.cc +++ b/chrome/browser/ui/views/download/bubble/download_bubble_partial_view.cc
@@ -47,13 +47,14 @@ public: METADATA_HEADER(SuppressBubbleSettingRow); - SuppressBubbleSettingRow(Browser* browser, - bool should_show_settings_link, - DownloadBubbleUIController* bubble_controller, - DownloadBubbleNavigationHandler* navigation_handler) - : browser_(browser), - bubble_controller_(bubble_controller), - navigation_handler_(navigation_handler) { + SuppressBubbleSettingRow( + base::WeakPtr<Browser> browser, + bool should_show_settings_link, + base::WeakPtr<DownloadBubbleUIController> bubble_controller, + base::WeakPtr<DownloadBubbleNavigationHandler> navigation_handler) + : browser_(std::move(browser)), + bubble_controller_(std::move(bubble_controller)), + navigation_handler_(std::move(navigation_handler)) { // Because this view appears directly below the download rows, we want to // use the same insets for consistency. SetBorder(views::CreateEmptyBorder(GetLayoutInsets(DOWNLOAD_ROW))); @@ -144,20 +145,24 @@ private: void CheckboxClicked() { - download::SetDownloadBubblePartialViewEnabled(browser_->profile(), - !checkbox_->GetChecked()); - settings_text_->SetVisible(true); - navigation_handler_->ResizeDialog(); + if (navigation_handler_) { + download::SetDownloadBubblePartialViewEnabled(browser_->profile(), + !checkbox_->GetChecked()); + settings_text_->SetVisible(true); + navigation_handler_->ResizeDialog(); + } } void SettingsLinkClicked() { - bubble_controller_->RecordDownloadBubbleInteraction(); - chrome::ShowSettingsSubPage(browser_, chrome::kDownloadsSubPage); + if (bubble_controller_ && browser_) { + bubble_controller_->RecordDownloadBubbleInteraction(); + chrome::ShowSettingsSubPage(browser_.get(), chrome::kDownloadsSubPage); + } } - raw_ptr<Browser> browser_ = nullptr; - raw_ptr<DownloadBubbleUIController> bubble_controller_ = nullptr; - raw_ptr<DownloadBubbleNavigationHandler> navigation_handler_ = nullptr; + base::WeakPtr<Browser> browser_ = nullptr; + base::WeakPtr<DownloadBubbleUIController> bubble_controller_ = nullptr; + base::WeakPtr<DownloadBubbleNavigationHandler> navigation_handler_ = nullptr; raw_ptr<views::Checkbox> checkbox_ = nullptr; std::unique_ptr<CheckboxTargeter> targeter_; raw_ptr<views::View> labels_wrapper_ = nullptr; @@ -192,9 +197,9 @@ // static std::unique_ptr<DownloadBubblePartialView> DownloadBubblePartialView::Create( - Browser* browser, - DownloadBubbleUIController* bubble_controller, - DownloadBubbleNavigationHandler* navigation_handler, + base::WeakPtr<Browser> browser, + base::WeakPtr<DownloadBubbleUIController> bubble_controller, + base::WeakPtr<DownloadBubbleNavigationHandler> navigation_handler, std::vector<DownloadUIModel::DownloadUIModelPtr> rows, base::OnceClosure on_interacted_closure) { if (rows.empty()) { @@ -202,14 +207,15 @@ } return base::WrapUnique(new DownloadBubblePartialView( - browser, bubble_controller, navigation_handler, std::move(rows), + std::move(browser), std::move(bubble_controller), + std::move(navigation_handler), std::move(rows), std::move(on_interacted_closure))); } DownloadBubblePartialView::DownloadBubblePartialView( - Browser* browser, - DownloadBubbleUIController* bubble_controller, - DownloadBubbleNavigationHandler* navigation_handler, + base::WeakPtr<Browser> browser, + base::WeakPtr<DownloadBubbleUIController> bubble_controller, + base::WeakPtr<DownloadBubbleNavigationHandler> navigation_handler, std::vector<DownloadUIModel::DownloadUIModelPtr> rows, base::OnceClosure on_interacted_closure) : on_interacted_closure_(std::move(on_interacted_closure)) { @@ -231,7 +237,8 @@ } AddChildView(DownloadBubbleRowListView::CreateWithScroll( - /*is_partial_view=*/true, browser, bubble_controller, navigation_handler, + /*is_partial_view=*/true, std::move(browser), + std::move(bubble_controller), std::move(navigation_handler), std::move(rows), preferred_width)); if (setting_row) {
diff --git a/chrome/browser/ui/views/download/bubble/download_bubble_partial_view.h b/chrome/browser/ui/views/download/bubble/download_bubble_partial_view.h index ef93adc2..fd2f9ff8 100644 --- a/chrome/browser/ui/views/download/bubble/download_bubble_partial_view.h +++ b/chrome/browser/ui/views/download/bubble/download_bubble_partial_view.h
@@ -25,9 +25,9 @@ METADATA_HEADER(DownloadBubblePartialView); static std::unique_ptr<DownloadBubblePartialView> Create( - Browser* browser, - DownloadBubbleUIController* bubble_controller, - DownloadBubbleNavigationHandler* navigation_handler, + base::WeakPtr<Browser> browser, + base::WeakPtr<DownloadBubbleUIController> bubble_controller, + base::WeakPtr<DownloadBubbleNavigationHandler> navigation_handler, std::vector<DownloadUIModel::DownloadUIModelPtr> rows, base::OnceClosure on_interacted_closure); @@ -47,9 +47,9 @@ private: DownloadBubblePartialView( - Browser* browser, - DownloadBubbleUIController* bubble_controller, - DownloadBubbleNavigationHandler* navigation_handler, + base::WeakPtr<Browser> browser, + base::WeakPtr<DownloadBubbleUIController> bubble_controller, + base::WeakPtr<DownloadBubbleNavigationHandler> navigation_handler, std::vector<DownloadUIModel::DownloadUIModelPtr> rows, base::OnceClosure on_interacted_closure);
diff --git a/chrome/browser/ui/views/download/bubble/download_bubble_row_list_view.cc b/chrome/browser/ui/views/download/bubble/download_bubble_row_list_view.cc index e1612a7..1f88324 100644 --- a/chrome/browser/ui/views/download/bubble/download_bubble_row_list_view.cc +++ b/chrome/browser/ui/views/download/bubble/download_bubble_row_list_view.cc
@@ -38,9 +38,9 @@ // static std::unique_ptr<views::View> DownloadBubbleRowListView::CreateWithScroll( bool is_partial_view, - Browser* browser, - DownloadBubbleUIController* bubble_controller, - DownloadBubbleNavigationHandler* navigation_handler, + base::WeakPtr<Browser> browser, + base::WeakPtr<DownloadBubbleUIController> bubble_controller, + base::WeakPtr<DownloadBubbleNavigationHandler> navigation_handler, std::vector<DownloadUIModel::DownloadUIModelPtr> rows, int fixed_width) { auto row_list_view = @@ -49,8 +49,8 @@ // raw pointer is safe as the toolbar owns the bubble, which owns an // individual row view. row_list_view->AddChildView(std::make_unique<DownloadBubbleRowView>( - std::move(model), row_list_view.get(), bubble_controller, - navigation_handler, browser, fixed_width)); + std::move(model), row_list_view.get(), std::move(bubble_controller), + std::move(navigation_handler), browser, fixed_width)); } auto scroll_view = std::make_unique<views::ScrollView>(); @@ -63,11 +63,12 @@ return scroll_view; } -DownloadBubbleRowListView::DownloadBubbleRowListView(bool is_partial_view, - Browser* browser) +DownloadBubbleRowListView::DownloadBubbleRowListView( + bool is_partial_view, + base::WeakPtr<Browser> browser) : is_partial_view_(is_partial_view), creation_time_(base::Time::Now()), - browser_(browser) { + browser_(std::move(browser)) { SetOrientation(views::LayoutOrientation::kVertical); SetNotifyEnterExitOnChild(true); if (IsIncognitoInfoRowEnabled()) { @@ -127,6 +128,9 @@ } bool DownloadBubbleRowListView::IsIncognitoInfoRowEnabled() { + if (!browser_) { + return false; + } Profile* profile = browser_->profile(); return download::IsDownloadBubbleV2Enabled(profile) && profile->IsOffTheRecord();
diff --git a/chrome/browser/ui/views/download/bubble/download_bubble_row_list_view.h b/chrome/browser/ui/views/download/bubble/download_bubble_row_list_view.h index 9861923..429299a 100644 --- a/chrome/browser/ui/views/download/bubble/download_bubble_row_list_view.h +++ b/chrome/browser/ui/views/download/bubble/download_bubble_row_list_view.h
@@ -25,13 +25,14 @@ static std::unique_ptr<views::View> CreateWithScroll( bool is_partial_view, - Browser* browser, - DownloadBubbleUIController* bubble_controller, - DownloadBubbleNavigationHandler* navigation_handler, + base::WeakPtr<Browser> browser, + base::WeakPtr<DownloadBubbleUIController> bubble_controller, + base::WeakPtr<DownloadBubbleNavigationHandler> navigation_handler, std::vector<DownloadUIModel::DownloadUIModelPtr> rows, int fixed_width); - DownloadBubbleRowListView(bool is_partial_view, Browser* browser); + DownloadBubbleRowListView(bool is_partial_view, + base::WeakPtr<Browser> browser); ~DownloadBubbleRowListView() override; DownloadBubbleRowListView(const DownloadBubbleRowListView&) = delete; DownloadBubbleRowListView& operator=(const DownloadBubbleRowListView&) = @@ -42,7 +43,7 @@ bool is_partial_view_; base::Time creation_time_; - raw_ptr<Browser> browser_ = nullptr; + base::WeakPtr<Browser> browser_ = nullptr; raw_ptr<views::ImageView> info_icon_ = nullptr; };
diff --git a/chrome/browser/ui/views/download/bubble/download_bubble_row_view.cc b/chrome/browser/ui/views/download/bubble/download_bubble_row_view.cc index 972027a..c061a754 100644 --- a/chrome/browser/ui/views/download/bubble/download_bubble_row_view.cc +++ b/chrome/browser/ui/views/download/bubble/download_bubble_row_view.cc
@@ -169,6 +169,9 @@ // If either of mode or state changes, or if it is the initial setup, // we might need to change UI. + if (!browser_) { + return false; + } ui_info_ = model_->GetBubbleUIInfo( download::IsDownloadBubbleV2Enabled(browser_->profile())); return true; @@ -305,7 +308,8 @@ } // For downloads in incognito mode. - if (bubble_controller_->ShouldShowIncognitoIcon(model_.get())) { + if (bubble_controller_ && + bubble_controller_->ShouldShowIncognitoIcon(model_.get())) { if (last_overridden_icon_ == &kIncognitoIcon) { return; } @@ -317,7 +321,8 @@ } // For downloads in guest sessions. - if (bubble_controller_->ShouldShowGuestIcon(model_.get())) { + if (bubble_controller_ && + bubble_controller_->ShouldShowGuestIcon(model_.get())) { if (last_overridden_icon_ == &kUserAccountAvatarIcon) { return; } @@ -349,18 +354,18 @@ DownloadBubbleRowView::DownloadBubbleRowView( DownloadUIModel::DownloadUIModelPtr model, DownloadBubbleRowListView* row_list_view, - DownloadBubbleUIController* bubble_controller, - DownloadBubbleNavigationHandler* navigation_handler, - Browser* browser, + base::WeakPtr<DownloadBubbleUIController> bubble_controller, + base::WeakPtr<DownloadBubbleNavigationHandler> navigation_handler, + base::WeakPtr<Browser> browser, int fixed_width) : model_(std::move(model)), context_menu_( std::make_unique<DownloadShelfContextMenuView>(model_->GetWeakPtr(), bubble_controller)), row_list_view_(row_list_view), - bubble_controller_(bubble_controller), - navigation_handler_(navigation_handler), - browser_(browser), + bubble_controller_(std::move(bubble_controller)), + navigation_handler_(std::move(navigation_handler)), + browser_(std::move(browser)), inkdrop_container_( AddChildView(std::make_unique<views::InkDropContainerView>())), accessible_alert_in_progress_timer_( @@ -650,6 +655,9 @@ } void DownloadBubbleRowView::OnMainButtonPressed() { + if (!bubble_controller_ || !navigation_handler_) { + return; + } bubble_controller_->RecordDownloadBubbleInteraction(); if (ui_info_.has_subpage) { DownloadItemWarningData::AddWarningActionEvent( @@ -704,6 +712,9 @@ } void DownloadBubbleRowView::UpdateProgressBar() { + if (!navigation_handler_) { + return; + } if (ui_info_.has_progress_bar) { if (!progress_bar_->GetVisible()) { progress_bar_->SetVisible(true); @@ -765,12 +776,17 @@ if (!model_->GetEphemeralWarningUiShownTime().has_value() && model_->IsEphemeralWarning()) { model_->SetEphemeralWarningUiShownTime(base::Time::Now()); - bubble_controller_->ScheduleCancelForEphemeralWarning( - model_->GetDownloadItem()->GetGuid()); + if (bubble_controller_) { + bubble_controller_->ScheduleCancelForEphemeralWarning( + model_->GetDownloadItem()->GetGuid()); + } } } void DownloadBubbleRowView::OnDownloadUpdated() { + if (!navigation_handler_) { + return; + } UpdateRow(/*initial_setup=*/false); // Resize is needed because the height of the row can change when the text // (primary_label_ or secondary_label_) is updated. @@ -783,6 +799,9 @@ } void DownloadBubbleRowView::OnDownloadDestroyed(const ContentId& id) { + if (!navigation_handler_) { + return; + } // This will return ownership and destroy this object at the end of the // method. std::unique_ptr<DownloadBubbleRowView> row_view_ptr = @@ -798,15 +817,14 @@ DownloadCommands::Command command, const std::u16string& button_string) { // base::Unretained is fine as DownloadBubbleRowView owns the discard button - // and the model, and has an ownership ancestry in - // DownloadToolbarButtonView, which also owns bubble_controller. So, if the - // discard button is alive, so should be its parents and their owned fields. + // and the model. So, if the discard button is alive, so should be its parents + // and their owned fields. views::MdTextButton* button = main_button_holder_->AddChildView(std::make_unique<views::MdTextButton>( base::BindRepeating( &DownloadBubbleUIController::ProcessDownloadButtonPress, - base::Unretained(bubble_controller_), - base::Unretained(model_.get()), command, /*is_main_view=*/true), + bubble_controller_, base::Unretained(model_.get()), command, + /*is_main_view=*/true), button_string)); button->SetMaxSize(gfx::Size(0, kDownloadButtonHeight)); button->SetProperty(views::kMarginsKey, kRowInterElementPadding); @@ -819,8 +837,8 @@ views::ImageButton* quick_action = quick_action_holder_->AddChildView( views::CreateVectorImageButton(base::BindRepeating( &DownloadBubbleUIController::ProcessDownloadButtonPress, - base::Unretained(bubble_controller_), base::Unretained(model_.get()), - command, /*is_main_view=*/true))); + bubble_controller_, base::Unretained(model_.get()), command, + /*is_main_view=*/true))); InstallCircleHighlightPathGenerator(quick_action); quick_action->SetBorder( views::CreateEmptyBorder(GetLayoutInsets(DOWNLOAD_ICON))); @@ -981,11 +999,14 @@ // The only accelerator we registered is for copy, so we know that's what // `accelerator` contains. If DCHECKs are enabled, we can confirm that. #if DCHECK_IS_ON() - BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); - ui::Accelerator registered_accelerator; - if (browser_view && - browser_view->GetAccelerator(IDC_COPY, ®istered_accelerator)) { - DCHECK(accelerator == registered_accelerator); + if (browser_) { + BrowserView* browser_view = + BrowserView::GetBrowserViewForBrowser(browser_.get()); + ui::Accelerator registered_accelerator; + if (browser_view && + browser_view->GetAccelerator(IDC_COPY, ®istered_accelerator)) { + DCHECK(accelerator == registered_accelerator); + } } #endif @@ -1007,7 +1028,11 @@ void DownloadBubbleRowView::RegisterAccelerators( views::FocusManager* focus_manager) { - BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); + if (!browser_) { + return; + } + BrowserView* browser_view = + BrowserView::GetBrowserViewForBrowser(browser_.get()); if (!browser_view) { return; } @@ -1023,7 +1048,11 @@ void DownloadBubbleRowView::UnregisterAccelerators( views::FocusManager* focus_manager) { - BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); + if (!browser_) { + return; + } + BrowserView* browser_view = + BrowserView::GetBrowserViewForBrowser(browser_.get()); if (!browser_view) { return; }
diff --git a/chrome/browser/ui/views/download/bubble/download_bubble_row_view.h b/chrome/browser/ui/views/download/bubble/download_bubble_row_view.h index dc9fa74f..a4f0acc0 100644 --- a/chrome/browser/ui/views/download/bubble/download_bubble_row_view.h +++ b/chrome/browser/ui/views/download/bubble/download_bubble_row_view.h
@@ -43,9 +43,9 @@ explicit DownloadBubbleRowView( DownloadUIModel::DownloadUIModelPtr model, DownloadBubbleRowListView* row_list_view, - DownloadBubbleUIController* bubble_controller, - DownloadBubbleNavigationHandler* navigation_handler, - Browser* browser, + base::WeakPtr<DownloadBubbleUIController> bubble_controller, + base::WeakPtr<DownloadBubbleNavigationHandler> navigation_handler, + base::WeakPtr<Browser> browser, int fixed_width); DownloadBubbleRowView(const DownloadBubbleRowView&) = delete; DownloadBubbleRowView& operator=(const DownloadBubbleRowView&) = delete; @@ -214,11 +214,11 @@ raw_ptr<DownloadBubbleRowListView> row_list_view_ = nullptr; // Controller for keeping track of downloads. - raw_ptr<DownloadBubbleUIController> bubble_controller_ = nullptr; + base::WeakPtr<DownloadBubbleUIController> bubble_controller_ = nullptr; - raw_ptr<DownloadBubbleNavigationHandler> navigation_handler_ = nullptr; + base::WeakPtr<DownloadBubbleNavigationHandler> navigation_handler_ = nullptr; - raw_ptr<Browser> browser_ = nullptr; + base::WeakPtr<Browser> browser_ = nullptr; download::DownloadItemMode mode_; download::DownloadItem::DownloadState state_;
diff --git a/chrome/browser/ui/views/download/bubble/download_bubble_row_view_unittest.cc b/chrome/browser/ui/views/download/bubble/download_bubble_row_view_unittest.cc index 7face1d3..c41218c 100644 --- a/chrome/browser/ui/views/download/bubble/download_bubble_row_view_unittest.cc +++ b/chrome/browser/ui/views/download/bubble/download_bubble_row_view_unittest.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ui/views/download/bubble/download_bubble_row_view.h" #include "chrome/app/chrome_command_ids.h" +#include "chrome/browser/download/bubble/download_bubble_ui_controller.h" #include "chrome/browser/download/download_item_model.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/frame/browser_view.h" @@ -47,15 +48,15 @@ DownloadToolbarButtonView* button = browser_view()->toolbar()->download_button(); row_list_view_ = std::make_unique<DownloadBubbleRowListView>( - /*is_partial_view=*/true, browser()); + /*is_partial_view=*/true, browser()->AsWeakPtr()); const int bubble_width = ChromeLayoutProvider::Get()->GetDistanceMetric( views::DISTANCE_BUBBLE_PREFERRED_WIDTH); row_view_ = std::make_unique<DownloadBubbleRowView>( DownloadItemModel::Wrap( &download_item_, std::make_unique<DownloadUIModel::BubbleStatusTextBuilder>()), - row_list_view_.get(), button->bubble_controller(), button, browser(), - bubble_width); + row_list_view_.get(), button->bubble_controller()->GetWeakPtr(), + button->GetWeakPtr(), browser()->AsWeakPtr(), bubble_width); } void FastForward(base::TimeDelta time) {
diff --git a/chrome/browser/ui/views/download/bubble/download_bubble_security_view_unittest.cc b/chrome/browser/ui/views/download/bubble/download_bubble_security_view_unittest.cc index 0d7b590..1b3aded 100644 --- a/chrome/browser/ui/views/download/bubble/download_bubble_security_view_unittest.cc +++ b/chrome/browser/ui/views/download/bubble/download_bubble_security_view_unittest.cc
@@ -93,13 +93,13 @@ bubble_delegate_)); row_list_view_ = std::make_unique<DownloadBubbleRowListView>( - /*is_partial_view=*/true, browser_.get()); + /*is_partial_view=*/true, browser_->AsWeakPtr()); const int bubble_width = ChromeLayoutProvider::Get()->GetDistanceMetric( views::DISTANCE_BUBBLE_PREFERRED_WIDTH); row_view_ = std::make_unique<DownloadBubbleRowView>( DownloadItemModel::Wrap(&download_item_), row_list_view_.get(), - bubble_controller_.get(), bubble_navigator_.get(), browser_.get(), - bubble_width); + bubble_controller_->GetWeakPtr(), bubble_navigator_->GetWeakPtr(), + browser_->AsWeakPtr(), bubble_width); } void TearDown() override {
diff --git a/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc b/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc index 17da9b6..e1256a9 100644 --- a/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc +++ b/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc
@@ -405,7 +405,7 @@ std::unique_ptr<views::View> DownloadToolbarButtonView::GetPrimaryView() { if (is_primary_partial_view_) { return DownloadBubblePartialView::Create( - browser_, bubble_controller_.get(), this, + browser_->AsWeakPtr(), bubble_controller_->GetWeakPtr(), GetWeakPtr(), bubble_controller_->GetPartialView(), base::BindOnce(&DownloadToolbarButtonView::DeactivateAutoClose, base::Unretained(this))); @@ -413,7 +413,8 @@ std::unique_ptr<views::View> rows_with_scroll = DownloadBubbleRowListView::CreateWithScroll( - /*is_partial_view=*/false, browser_, bubble_controller_.get(), this, + /*is_partial_view=*/false, browser_->AsWeakPtr(), + bubble_controller_->GetWeakPtr(), GetWeakPtr(), bubble_controller_->GetMainView(), ChromeLayoutProvider::Get()->GetDistanceMetric( views::DISTANCE_BUBBLE_PREFERRED_WIDTH));
diff --git a/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc b/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc index c73a12a..669e5ba 100644 --- a/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc +++ b/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc
@@ -28,9 +28,9 @@ DownloadShelfContextMenuView::DownloadShelfContextMenuView( base::WeakPtr<DownloadUIModel> download_ui_model, - DownloadBubbleUIController* bubble_controller) + base::WeakPtr<DownloadBubbleUIController> bubble_controller) : DownloadShelfContextMenu(download_ui_model), - bubble_controller_(bubble_controller) {} + bubble_controller_(std::move(bubble_controller)) {} DownloadShelfContextMenuView::~DownloadShelfContextMenuView() = default;
diff --git a/chrome/browser/ui/views/download/download_shelf_context_menu_view.h b/chrome/browser/ui/views/download/download_shelf_context_menu_view.h index 9c72aea..ff24f90 100644 --- a/chrome/browser/ui/views/download/download_shelf_context_menu_view.h +++ b/chrome/browser/ui/views/download/download_shelf_context_menu_view.h
@@ -31,8 +31,9 @@ explicit DownloadShelfContextMenuView(DownloadItemView* download_item_view); explicit DownloadShelfContextMenuView( base::WeakPtr<DownloadUIModel> download_ui_model); - DownloadShelfContextMenuView(base::WeakPtr<DownloadUIModel> download_ui_model, - DownloadBubbleUIController* bubble_controller); + DownloadShelfContextMenuView( + base::WeakPtr<DownloadUIModel> download_ui_model, + base::WeakPtr<DownloadBubbleUIController> bubble_controller); DownloadShelfContextMenuView(const DownloadShelfContextMenuView&) = delete; DownloadShelfContextMenuView& operator=(const DownloadShelfContextMenuView&) = delete; @@ -61,7 +62,7 @@ raw_ptr<DownloadItemView> download_item_view_ = nullptr; // Use this instead of DownloadItemView to submit download for feedback. - raw_ptr<DownloadBubbleUIController> bubble_controller_ = nullptr; + base::WeakPtr<DownloadBubbleUIController> bubble_controller_ = nullptr; base::OnceClosure on_menu_will_show_callback_;
diff --git a/chrome/browser/ui/views/omnibox/omnibox_row_view.cc b/chrome/browser/ui/views/omnibox/omnibox_row_view.cc index 4720ecc..bbad2d2 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_row_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_row_view.cc
@@ -16,6 +16,7 @@ #include "chrome/browser/ui/views/omnibox/omnibox_mouse_enter_exit_handler.h" #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" #include "components/omnibox/browser/omnibox_edit_model.h" +#include "components/omnibox/browser/omnibox_field_trial.h" #include "components/omnibox/browser/omnibox_popup_selection.h" #include "components/omnibox/browser/omnibox_prefs.h" #include "components/omnibox/browser/suggestion_group_util.h" @@ -55,7 +56,10 @@ SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kHorizontal)); // This is the designer-provided spacing that matches the NTP Realbox. - layout->set_between_child_spacing(8); + // TODO(khalidpeer): Update this spacing for realbox per CR23 guidelines. + const int spacing_between_label_and_icon = + OmniboxFieldTrial::IsChromeRefreshSuggestIconsEnabled() ? 0 : 8; + layout->set_between_child_spacing(spacing_between_label_and_icon); header_label_ = AddChildView(std::make_unique<views::Label>()); header_label_->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT); @@ -82,6 +86,8 @@ header->GetHeaderSelection(); }, base::Unretained(this))); + views::FocusRing::Get(header_toggle_button_) + ->SetOutsetFocusRingDisabled(true); if (row_view_->pref_service_) { pref_change_registrar_.Init(row_view_->pref_service_); @@ -100,7 +106,11 @@ // TODO(tommycli): Our current design calls for uppercase text here, but // it seems like an open question what should happen for non-Latin locales. // Moreover, it seems unusual to do case conversion in Views in general. - header_label_->SetText(base::i18n::ToUpper(header_text_)); + std::u16string header_str = header_text_; + if (!OmniboxFieldTrial::IsChromeRefreshSuggestIconsEnabled()) { + header_str = base::i18n::ToUpper(header_str); + } + header_label_->SetText(header_str); if (row_view_->pref_service_) { suggestion_group_hidden_ = @@ -114,7 +124,8 @@ // views::View: gfx::Insets GetInsets() const override { // Makes the header height roughly the same as the single-line row height. - constexpr int vertical = 6; + const int vertical = + OmniboxFieldTrial::IsChromeRefreshSuggestIconsEnabled() ? 8 : 6; // Aligns the header text with the icons of ordinary matches. The assumed // small icon width here is lame, but necessary, since it's not explicitly @@ -177,11 +188,17 @@ views::InkDrop::Get(header_toggle_button_)->SetBaseColor(icon_color); int dip_size = GetLayoutConstant(LOCATION_BAR_ICON_SIZE); - const gfx::ImageSkia arrow_down = - gfx::CreateVectorIcon(omnibox::kChevronIcon, dip_size, icon_color); + const gfx::ImageSkia arrow_down = gfx::CreateVectorIcon( + OmniboxFieldTrial::IsChromeRefreshSuggestIconsEnabled() + ? omnibox::kArrowDownChromeRefreshIcon + : omnibox::kChevronIcon, + dip_size, icon_color); const gfx::ImageSkia arrow_up = - gfx::ImageSkiaOperations::CreateRotatedImage( - arrow_down, SkBitmapOperations::ROTATION_180_CW); + OmniboxFieldTrial::IsChromeRefreshSuggestIconsEnabled() + ? gfx::CreateVectorIcon(omnibox::kArrowUpChromeRefreshIcon, + dip_size, icon_color) + : gfx::ImageSkiaOperations::CreateRotatedImage( + arrow_down, SkBitmapOperations::ROTATION_180_CW); // The "untoggled" button state corresponds with the group being shown. // The button's action is therefore to Hide the group, when clicked. @@ -205,7 +222,10 @@ // It's a little hokey that we're stealing the logic for the background // color from OmniboxResultView. If we start doing this is more than just // one place, we should introduce a more elegant abstraction here. - SetBackground(OmniboxResultView::GetPopupCellBackground(this, part_state)); + if (!OmniboxFieldTrial::IsChromeRefreshSuggestIconsEnabled()) { + SetBackground( + OmniboxResultView::GetPopupCellBackground(this, part_state)); + } } views::Button* header_toggle_button() const { return header_toggle_button_; } @@ -366,8 +386,10 @@ gfx::Insets OmniboxRowView::GetInsets() const { // A visible header means this is the start of a new section. Give the section // that just ended an extra 4dp of padding. https://crbug.com/1076646 - if (line_ != 0 && header_view_ && header_view_->GetVisible()) + if (line_ != 0 && header_view_ && header_view_->GetVisible() && + !OmniboxFieldTrial::IsChromeRefreshSuggestIconsEnabled()) { return gfx::Insets::TLBR(4, 0, 0, 0); + } return gfx::Insets(); }
diff --git a/chrome/browser/ui/views/permissions/permission_prompt_bubble_base_view_browsertest.cc b/chrome/browser/ui/views/permissions/permission_prompt_bubble_base_view_browsertest.cc index 5b12b45..3c10c9d2 100644 --- a/chrome/browser/ui/views/permissions/permission_prompt_bubble_base_view_browsertest.cc +++ b/chrome/browser/ui/views/permissions/permission_prompt_bubble_base_view_browsertest.cc
@@ -54,13 +54,6 @@ #include "ui/views/test/ax_event_counter.h" #include "ui/views/test/button_test_api.h" -// To run the pixel tests of this file run: browser_tests -// --gtest_filter=BrowserUiTest.Invoke --test-launcher-interactive -// --enable-pixel-output-in-tests --ui=<test name e.g. -// PermissionPromptBubbleBaseViewBrowserTest>.* -// -// Check go/brapp-desktop-pixel-tests for more info. - namespace { // Test implementation of PermissionUiSelector that always returns a canned // decision. @@ -95,13 +88,11 @@ public: PermissionPromptBubbleBaseViewBrowserTest() { if (GetParam()) { - feature_list_.InitWithFeatures( - {permissions::features::kPermissionChip}, - {permissions::features::kPermissionStorageAccessAPI}); + feature_list_.InitWithFeatures({permissions::features::kPermissionChip}, + {}); } else { - feature_list_.InitWithFeatures( - {}, {permissions::features::kPermissionChip, - permissions::features::kPermissionStorageAccessAPI}); + feature_list_.InitWithFeatures({}, + {permissions::features::kPermissionChip}); } } @@ -210,17 +201,6 @@ } permissions::PermissionRequestManager* manager = test_api_->manager(); content::RenderFrameHost* source_frame = GetActiveMainFrame(); - - // Pixel verification for storage_access test checks a permission - // request prompt that has an origin and port. Because these tests run - // on localhost, the port changes, and the test pixel verification - // fails. We need a fixed URL, so the Gold image used in the pixel test - // always matches with the output of the test. - if (it->type == ContentSettingsType::STORAGE_ACCESS) { - test_api_->manager()->set_embedding_origin_for_testing( - GURL("https://test.com")); - } - switch (it->type) { case ContentSettingsType::PROTOCOL_HANDLERS: manager->AddRequest(source_frame, MakeRegisterProtocolHandlerRequest()); @@ -412,9 +392,14 @@ ShowAndVerifyUi(); } +// TODO(crbug.com/1232028): Pixel verification for storage_access test checks +// permission request prompt that has origin and port. Because these tests run +// on localhost, the port constantly changes its value and hence test pixel +// verification fails. Host wants to access storage from the site in which it's +// embedded. // Host wants to access storage from the site in which it's embedded. IN_PROC_BROWSER_TEST_P(PermissionPromptBubbleBaseViewBrowserTest, - InvokeUi_storage_access) { + DISABLED_InvokeUi_storage_access) { ShowAndVerifyUi(); } @@ -436,39 +421,6 @@ ShowAndVerifyUi(); } -// Test fixture to test the Storage Access prompt with the new Google UI. -// -// We have created a new test fixture for the new Google UI so we can have a -// test for the new and old prompt UI and avoid adding unnecessary Gold images. -// If were to add a new parameter to |PermissionPromptBubbleBaseViewBrowserTest| -// to toggle the PermissionStorageAccessAPI, we would have to add extra Gold -// images for each of the other eleven tests, even though this flag only affects -// the SAA prompt. -class SAAEnabledPermissionPromptBubbleViewBrowserTest - : public PermissionPromptBubbleBaseViewBrowserTest { - public: - SAAEnabledPermissionPromptBubbleViewBrowserTest() { - if (GetParam()) { - feature_list_.InitWithFeatures( - {permissions::features::kPermissionStorageAccessAPI, - permissions::features::kPermissionChip}, - {}); - } else { - feature_list_.InitWithFeatures( - {permissions::features::kPermissionStorageAccessAPI}, - {permissions::features::kPermissionChip}); - } - } - base::test::ScopedFeatureList feature_list_; -}; - -// Host wants to access storage from the site in which it's embedded. Prompt -// with new Google UI. -IN_PROC_BROWSER_TEST_P(SAAEnabledPermissionPromptBubbleViewBrowserTest, - InvokeUi_storage_access) { - ShowAndVerifyUi(); -} - class QuietUIPromoBrowserTest : public PermissionPromptBubbleBaseViewBrowserTest { public: @@ -1039,9 +991,6 @@ PermissionPromptBubbleBaseViewBrowserTest, ::testing::Values(false, true)); INSTANTIATE_TEST_SUITE_P(All, - SAAEnabledPermissionPromptBubbleViewBrowserTest, - ::testing::Values(false, true)); -INSTANTIATE_TEST_SUITE_P(All, PermissionPromptBubbleBaseViewQuietUiBrowserTest, ::testing::Values(false, true)); INSTANTIATE_TEST_SUITE_P(All,
diff --git a/chrome/browser/ui/views/side_panel/read_anything/read_anything_font_combobox.cc b/chrome/browser/ui/views/side_panel/read_anything/read_anything_font_combobox.cc index 4416730..711e403 100644 --- a/chrome/browser/ui/views/side_panel/read_anything/read_anything_font_combobox.cc +++ b/chrome/browser/ui/views/side_panel/read_anything/read_anything_font_combobox.cc
@@ -55,7 +55,6 @@ } void ReadAnythingFontCombobox::FontNameChangedCallback() { - UpdateFont(); if (delegate_) delegate_->OnFontChoiceChanged(GetSelectedIndex().value()); }
diff --git a/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_button.cc b/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_button.cc index cd254929..055126e8 100644 --- a/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_button.cc +++ b/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_button.cc
@@ -89,10 +89,6 @@ menu_model_->SetSelectedBackgroundColorId(selected_color); } -void ReadAnythingMenuButton::SetFont(const std::string& font_name) { - menu_model_->SetLabelFontList(font_name); -} - BEGIN_METADATA(ReadAnythingMenuButton, MenuButton) ADD_PROPERTY_METADATA(ReadAnythingMenuModel*, MenuModel) END_METADATA
diff --git a/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_button.h b/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_button.h index 04730fe5..82147ae 100644 --- a/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_button.h +++ b/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_button.h
@@ -40,8 +40,6 @@ ui::ColorId foreground_color, ui::ColorId selected_color); - void SetFont(const std::string& font_name); - private: void ButtonPressed();
diff --git a/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_model.cc b/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_model.cc index bb85419..86c41aaa 100644 --- a/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_model.cc +++ b/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_model.cc
@@ -3,7 +3,6 @@ // found in the LICENSE file. #include "chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_model.h" -#include "chrome/common/accessibility/read_anything_constants.h" /////////////////////////////////////////////////////////////////////////////// // ReadAnythingMenuModel @@ -51,19 +50,3 @@ size_t index) { return selected_color_id_; } - -const gfx::FontList* ReadAnythingMenuModel::GetLabelFontListAt( - size_t index) const { - if (font_.has_value()) { - return &font_.value(); - } - - return nullptr; -} - -void ReadAnythingMenuModel::SetLabelFontList(const std::string& font_string) { - std::vector<std::string> font_names = { - font_string, string_constants::kReadAnythingDefaultFontName}; - font_ = gfx::FontList(font_names, gfx::Font::FontStyle::NORMAL, - kMenuLabelFontSizePx, gfx::Font::Weight::NORMAL); -}
diff --git a/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_model.h b/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_model.h index 36aaef9..177e799f 100644 --- a/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_model.h +++ b/chrome/browser/ui/views/side_panel/read_anything/read_anything_menu_model.h
@@ -5,10 +5,8 @@ #ifndef CHROME_BROWSER_UI_VIEWS_SIDE_PANEL_READ_ANYTHING_READ_ANYTHING_MENU_MODEL_H_ #define CHROME_BROWSER_UI_VIEWS_SIDE_PANEL_READ_ANYTHING_READ_ANYTHING_MENU_MODEL_H_ -#include "base/strings/utf_string_conversions.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/models/simple_menu_model.h" -#include "ui/gfx/font_list.h" /////////////////////////////////////////////////////////////////////////////// // ReadAnythingMenuModel @@ -50,17 +48,12 @@ selected_color_id_ = selected_color; } - void SetLabelFontList(const std::string& font_string); - - const gfx::FontList* GetLabelFontListAt(size_t index) const override; - private: absl::optional<size_t> selected_index_ = absl::nullopt; base::RepeatingClosure callback_; absl::optional<ui::ColorId> foreground_color_id_; absl::optional<ui::ColorId> submenu_background_color_id_; absl::optional<ui::ColorId> selected_color_id_; - absl::optional<gfx::FontList> font_ = absl::nullopt; }; #endif // CHROME_BROWSER_UI_VIEWS_SIDE_PANEL_READ_ANYTHING_READ_ANYTHING_MENU_MODEL_H_
diff --git a/chrome/browser/ui/views/side_panel/read_anything/read_anything_model.cc b/chrome/browser/ui/views/side_panel/read_anything/read_anything_model.cc index 0d1ceb5..7410af13 100644 --- a/chrome/browser/ui/views/side_panel/read_anything/read_anything_model.cc +++ b/chrome/browser/ui/views/side_panel/read_anything/read_anything_model.cc
@@ -288,25 +288,6 @@ return base::UTF16ToUTF8(font_choices_[index].name); } -// This method uses the text from the drop down at |index| and constructs a -// FontList to be used by the |ReadAnythingFontCombobox::MenuModel| to make -// each option to display in its associated font. -// This text is not visible to the user. -// We add the default font to have a back-up font and a set size in case -// the chosen font does not work for some reason. -// E.g. User chooses 'Serif', this method returns {'Serif, Sans-serif'}. -std::vector<std::string> ReadAnythingFontModel::GetLabelFontNameAt( - size_t index) { - std::string font_label = base::UTF16ToUTF8(GetDropDownTextAt(index)); - std::vector<std::string> font_vector = { - font_label, string_constants::kReadAnythingDefaultFontName}; - return font_vector; -} - -absl::optional<int> ReadAnythingFontModel::GetLabelFontSize() { - return kMenuLabelFontSizePx; -} - absl::optional<ui::ColorId> ReadAnythingFontModel::GetDropdownForegroundColorIdAt(size_t index) const { return foreground_color_id_;
diff --git a/chrome/browser/ui/views/side_panel/read_anything/read_anything_model.h b/chrome/browser/ui/views/side_panel/read_anything/read_anything_model.h index 6bb7ab9..32f7796 100644 --- a/chrome/browser/ui/views/side_panel/read_anything/read_anything_model.h +++ b/chrome/browser/ui/views/side_panel/read_anything/read_anything_model.h
@@ -63,8 +63,6 @@ void SetDefaultLanguage(const std::string& lang); size_t GetFontNameIndex(std::string font_name); void SetSelectedIndex(size_t index); - std::vector<std::string> GetLabelFontNameAt(size_t index) override; - absl::optional<int> GetLabelFontSize() override; size_t GetSelectedIndex() { return selected_index_; } ReadAnythingFont GetFontLoggingValue() { return font_choices_[selected_index_].enum_value;
diff --git a/chrome/browser/ui/views/side_panel/read_anything/read_anything_model_unittest.cc b/chrome/browser/ui/views/side_panel/read_anything/read_anything_model_unittest.cc index d1ae696..9a91d78 100644 --- a/chrome/browser/ui/views/side_panel/read_anything/read_anything_model_unittest.cc +++ b/chrome/browser/ui/views/side_panel/read_anything/read_anything_model_unittest.cc
@@ -230,21 +230,6 @@ EXPECT_EQ("STIX Two Text", GetFontModel()->GetFontNameAt(4)); } -TEST_F(ReadAnythingModelTest, LabelFontListModelGetsCurrentFontList) { - InitModel(); - std::string default_font = string_constants::kReadAnythingDefaultFontName; - - const std::vector<std::string> expected_fonts = { - "Poppins", "Sans-serif", "Serif", "Comic Neue", - "Lexend Deca", "EB Garamond", "STIX Two Text"}; - - for (size_t i = 0; i < expected_fonts.size(); i++) { - auto retrieved_fonts = GetFontModel()->GetLabelFontNameAt(i); - EXPECT_EQ(expected_fonts[i], retrieved_fonts[0]); - EXPECT_EQ(default_font, retrieved_fonts[1]); - } -} - TEST_F(ReadAnythingModelTest, DefaultIndexSetOnSetSelectedFontByIndex) { InitModel(); size_t testIndex = 2; @@ -275,27 +260,4 @@ EXPECT_EQ(color_info.selected_dropdown_color_id, GetFontModel()->GetDropdownSelectedBackgroundColorIdAt(0).value()); } - -TEST_F(ReadAnythingModelTest, GetLabelFontList_DoesNotCrashBeforeSet) { - ReadAnythingColorsModel* color_model = model_->GetColorsModel(); - EXPECT_EQ(nullptr, color_model->GetLabelFontListAt(0)); - - ReadAnythingLineSpacingModel* line_spacing_model = - model_->GetLineSpacingModel(); - EXPECT_EQ(nullptr, line_spacing_model->GetLabelFontListAt(0)); - - ReadAnythingLetterSpacingModel* letter_spacing_model = - model_->GetLetterSpacingModel(); - EXPECT_EQ(nullptr, letter_spacing_model->GetLabelFontListAt(0)); -} - -TEST_F(ReadAnythingModelTest, GetLabelFontList_GetsCorrectFontList) { - ReadAnythingColorsModel* color_model = model_->GetColorsModel(); - color_model->SetLabelFontList("Arial"); - - const gfx::FontList* font_list = color_model->GetLabelFontListAt(0); - EXPECT_EQ(2, (int)font_list->GetFonts().size()); - EXPECT_EQ("Arial", font_list->GetPrimaryFont().GetFontName()); -} - #endif // !defined(ADDRESS_SANITIZER)
diff --git a/chrome/browser/ui/views/side_panel/read_anything/read_anything_toolbar_view.cc b/chrome/browser/ui/views/side_panel/read_anything/read_anything_toolbar_view.cc index 51b42800..82dbe69 100644 --- a/chrome/browser/ui/views/side_panel/read_anything/read_anything_toolbar_view.cc +++ b/chrome/browser/ui/views/side_panel/read_anything/read_anything_toolbar_view.cc
@@ -214,11 +214,6 @@ letter_spacing_button_->SetIcon(kReadAnythingLetterSpacingIcon, kIconSize, foreground_color_id, focus_ring_color_id); - // Update fonts. - colors_button_->SetFont(font_name); - line_spacing_button_->SetFont(font_name); - letter_spacing_button_->SetFont(font_name); - // Update the background colors for the dropdowns. colors_button_->SetDropdownColorIds(dropdown_color_id, foreground_color_id, selected_dropdown_color_id);
diff --git a/chrome/browser/ui/views/side_panel/search_companion/companion_page_browsertest.cc b/chrome/browser/ui/views/side_panel/search_companion/companion_page_browsertest.cc index ec9d7b6..ebc3292 100644 --- a/chrome/browser/ui/views/side_panel/search_companion/companion_page_browsertest.cc +++ b/chrome/browser/ui/views/side_panel/search_companion/companion_page_browsertest.cc
@@ -16,14 +16,17 @@ #include "chrome/browser/companion/core/features.h" #include "chrome/browser/companion/core/mojom/companion.mojom.h" #include "chrome/browser/companion/core/proto/companion_url_params.pb.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/side_panel/companion/companion_tab_helper.h" +#include "chrome/browser/ui/side_panel/companion/companion_utils.h" #include "chrome/browser/ui/side_panel/side_panel_enums.h" #include "chrome/browser/ui/ui_features.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/side_panel/search_companion/search_companion_side_panel_coordinator.h" #include "chrome/browser/ui/views/side_panel/side_panel_coordinator.h" #include "chrome/browser/ui/views/side_panel/side_panel_entry.h" +#include "chrome/common/pref_names.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/ukm/test_ukm_recorder.h" @@ -216,6 +219,13 @@ nav_observer.Wait(); } + void WaitForMainPageToBeLoaded(const std::string& relative_url) { + // Wait for the navigations in the frame to complete. + + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), + CreateUrl(kHost, relative_url))); + } + ::testing::AssertionResult ExecJs(const std::string& code) { // Execute test in iframe. content::RenderFrameHost* iframe = @@ -234,6 +244,7 @@ std::unique_ptr<net::test_server::HttpResponse> InspectRequest( const net::test_server::HttpRequest& request) { + requests_received_on_server_++; const GURL& url = request.GetURL(); std::string query_proto; @@ -325,6 +336,10 @@ ukm_recorder->ExpectEntryMetric(entry, metric_name, expected_value); } + size_t requests_received_on_server() const { + return requests_received_on_server_; + } + protected: base::test::ScopedFeatureList feature_list_; net::EmbeddedTestServer page_url_server_{net::EmbeddedTestServer::TYPE_HTTPS}; @@ -333,6 +348,7 @@ std::unique_ptr<base::HistogramTester> histogram_tester_; absl::optional<companion::proto::CompanionUrlParams> last_proto_from_url_load_; + size_t requests_received_on_server_ = 0; }; IN_PROC_BROWSER_TEST_F(CompanionPageBrowserTest, InitialNavigationWithoutMsbb) { @@ -345,6 +361,7 @@ WaitForCompanionToBeLoaded(); EXPECT_EQ(side_panel_coordinator()->GetCurrentEntryId(), SidePanelEntry::Id::kSearchCompanion); + EXPECT_EQ(1u, requests_received_on_server()); // Inspect the URL from the proto. auto proto = GetLastCompanionProtoFromUrlLoad(); @@ -360,6 +377,7 @@ side_panel_coordinator()->Show(SidePanelEntry::Id::kSearchCompanion); WaitForCompanionToBeLoaded(); + EXPECT_EQ(1u, requests_received_on_server()); EXPECT_EQ(side_panel_coordinator()->GetCurrentEntryId(), SidePanelEntry::Id::kSearchCompanion); @@ -736,3 +754,94 @@ &ukm_recorder, ukm::builders::Companion_PageView::kOpenTriggerName, static_cast<int>(SidePanelOpenTrigger::kPinnedEntryToolbarButton)); } + +class CompanionPagePolicyBrowserTest : public CompanionPageBrowserTest { + public: + void EnableCompanionByPolicy(bool enable_companion_by_policy) { + browser()->profile()->GetPrefs()->SetBoolean( + prefs::kGoogleSearchSidePanelEnabled, enable_companion_by_policy); + } +}; + +IN_PROC_BROWSER_TEST_F(CompanionPagePolicyBrowserTest, + SubsequentNavigationWithPolicyDefault) { + EXPECT_TRUE(companion::IsCompanionFeatureEnabled()); + + // Load a page on the active tab and open companion side panel + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), CreateUrl(kHost, kRelativeUrl1))); + side_panel_coordinator()->Show(SidePanelEntry::Id::kSearchCompanion); + + WaitForCompanionToBeLoaded(); + EXPECT_EQ(side_panel_coordinator()->GetCurrentEntryId(), + SidePanelEntry::Id::kSearchCompanion); + EXPECT_EQ(1u, requests_received_on_server()); +} + +IN_PROC_BROWSER_TEST_F( + CompanionPagePolicyBrowserTest, + SubsequentNavigationWithPolicyEnabledFollowedbyDisabled) { + EXPECT_TRUE(companion::IsCompanionFeatureEnabled()); + + // Load a page on the active tab and open companion side panel + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), CreateUrl(kHost, kRelativeUrl1))); + side_panel_coordinator()->Show(SidePanelEntry::Id::kSearchCompanion); + + WaitForCompanionToBeLoaded(); + EXPECT_EQ(side_panel_coordinator()->GetCurrentEntryId(), + SidePanelEntry::Id::kSearchCompanion); + EXPECT_EQ(1u, requests_received_on_server()); + + // Disable companion by policy. CSC should not be shown anymore. + EnableCompanionByPolicy(false); + EXPECT_TRUE(companion::IsCompanionFeatureEnabled()); + WaitForMainPageToBeLoaded(kRelativeUrl2); + side_panel_coordinator()->Show(SidePanelEntry::Id::kSearchCompanion); + EXPECT_FALSE(side_panel_coordinator()->GetCurrentEntryId().has_value()); +} + +IN_PROC_BROWSER_TEST_F(CompanionPagePolicyBrowserTest, + PRE_SubsequentNavigationWithPolicyDisabled) { + EnableCompanionByPolicy(false); +} + +IN_PROC_BROWSER_TEST_F(CompanionPagePolicyBrowserTest, + SubsequentNavigationWithPolicyDisabled) { + EXPECT_TRUE(companion::IsCompanionFeatureEnabled()); + // Load a page on the active tab and open companion side panel + WaitForMainPageToBeLoaded(kRelativeUrl1); + side_panel_coordinator()->Show(SidePanelEntry::Id::kSearchCompanion); + + EXPECT_FALSE(side_panel_coordinator()->GetCurrentEntryId().has_value()); + EXPECT_EQ(0u, requests_received_on_server()); +} + +IN_PROC_BROWSER_TEST_F( + CompanionPagePolicyBrowserTest, + PRE_SubsequentNavigationWithPolicyDisabledFollowedbyEnabled) { + EnableCompanionByPolicy(false); +} +IN_PROC_BROWSER_TEST_F( + CompanionPagePolicyBrowserTest, + SubsequentNavigationWithPolicyDisabledFollowedbyEnabled) { + // Load a page on the active tab and open companion side panel + EXPECT_TRUE(companion::IsCompanionFeatureEnabled()); + WaitForMainPageToBeLoaded(kRelativeUrl1); + side_panel_coordinator()->Show(SidePanelEntry::Id::kSearchCompanion); + EXPECT_FALSE(side_panel_coordinator()->GetCurrentEntryId().has_value()); + EXPECT_EQ(0u, requests_received_on_server()); + + // Enable companion by policy and that should enable the feature. + EnableCompanionByPolicy(true); + EXPECT_TRUE(companion::IsCompanionFeatureEnabled()); + // Load a page on the active tab and open companion side panel + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), CreateUrl(kHost, kRelativeUrl1))); + side_panel_coordinator()->Show(SidePanelEntry::Id::kSearchCompanion); + + WaitForCompanionToBeLoaded(); + EXPECT_EQ(side_panel_coordinator()->GetCurrentEntryId(), + SidePanelEntry::Id::kSearchCompanion); + EXPECT_EQ(1u, requests_received_on_server()); +}
diff --git a/chrome/browser/ui/views/side_panel/search_companion/search_companion_side_panel_coordinator.cc b/chrome/browser/ui/views/side_panel/search_companion/search_companion_side_panel_coordinator.cc index 5c58962..1cbb6e8e 100644 --- a/chrome/browser/ui/views/side_panel/search_companion/search_companion_side_panel_coordinator.cc +++ b/chrome/browser/ui/views/side_panel/search_companion/search_companion_side_panel_coordinator.cc
@@ -10,6 +10,7 @@ #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/side_panel/companion/companion_tab_helper.h" +#include "chrome/browser/ui/side_panel/companion/companion_utils.h" #include "chrome/browser/ui/side_panel/side_panel_enums.h" #include "chrome/browser/ui/ui_features.h" #include "chrome/browser/ui/views/frame/browser_view.h" @@ -17,7 +18,10 @@ #include "chrome/browser/ui/views/side_panel/side_panel_entry.h" #include "chrome/browser/ui/views/side_panel/side_panel_toolbar_container.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" +#include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" +#include "components/prefs/pref_registry_simple.h" +#include "components/prefs/pref_service.h" #include "components/vector_icons/vector_icons.h" SearchCompanionSidePanelCoordinator::SearchCompanionSidePanelCoordinator( @@ -27,30 +31,51 @@ // TODO(b/269331995): Localize menu item label. name_(l10n_util::GetStringUTF16(IDS_SIDE_PANEL_COMPANION_TITLE)), #if BUILDFLAG(GOOGLE_CHROME_BRANDING) - icon_(vector_icons::kGoogleGLogoIcon) { + icon_(vector_icons::kGoogleGLogoIcon), #else - icon_(vector_icons::kSearchIcon) { + icon_(vector_icons::kSearchIcon), #endif + pref_service_(browser->profile()->GetPrefs()) { if (auto* template_url_service = TemplateURLServiceFactory::GetForProfile(browser->profile())) { template_url_service_observation_.Observe(template_url_service); } // Only start observing tab changes if google is the default search provider. dsp_is_google_ = search::DefaultSearchProviderIsGoogle(browser_->profile()); - if (dsp_is_google_) { + csc_enabled_via_policy_ = + companion::IsCompanionFeatureEnabledByPolicy(pref_service_); + if (DoCompanionRuntimeChecksPass()) { browser_->tab_strip_model()->AddObserver(this); CreateAndRegisterEntriesForExistingWebContents(browser_->tab_strip_model()); } + + pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); + pref_change_registrar_->Init(pref_service_); + pref_change_registrar_->Add( + prefs::kGoogleSearchSidePanelEnabled, + base::BindRepeating( + &SearchCompanionSidePanelCoordinator::OnPolicyPrefChanged, + base::Unretained(this))); } SearchCompanionSidePanelCoordinator::~SearchCompanionSidePanelCoordinator() = default; // static -bool SearchCompanionSidePanelCoordinator::IsSupported(Profile* profile, - bool include_dsp_check) { - return !profile->IsIncognitoProfile() && !profile->IsGuestSession() && - (!include_dsp_check || search::DefaultSearchProviderIsGoogle(profile)); +bool SearchCompanionSidePanelCoordinator::IsSupported( + Profile* profile, + bool include_runtime_checks) { + if (profile->IsIncognitoProfile() || profile->IsGuestSession()) { + return false; + } + + if (include_runtime_checks) { + if (!search::DefaultSearchProviderIsGoogle(profile) || + !companion::IsCompanionFeatureEnabledByPolicy(profile->GetPrefs())) { + return false; + } + } + return true; } bool SearchCompanionSidePanelCoordinator::Show( @@ -68,12 +93,12 @@ return true; } -BrowserView* SearchCompanionSidePanelCoordinator::GetBrowserView() { +BrowserView* SearchCompanionSidePanelCoordinator::GetBrowserView() const { return BrowserView::GetBrowserViewForBrowser(&GetBrowser()); } -std::u16string -SearchCompanionSidePanelCoordinator::GetTooltipForToolbarButton() { +std::u16string SearchCompanionSidePanelCoordinator::GetTooltipForToolbarButton() + const { return l10n_util::GetStringUTF16(IDS_SIDE_PANEL_COMPANION_TOOLBAR_TOOLTIP); } @@ -117,23 +142,31 @@ } void SearchCompanionSidePanelCoordinator::OnTemplateURLServiceChanged() { + bool was_csc_enabled = DoCompanionRuntimeChecksPass(); + dsp_is_google_ = search::DefaultSearchProviderIsGoogle(browser_->profile()); + if (was_csc_enabled == DoCompanionRuntimeChecksPass()) { + return; + } + + UpdateCompanionAvailabilityInSidePanel(); +} + +void SearchCompanionSidePanelCoordinator:: + UpdateCompanionAvailabilityInSidePanel() { BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); if (!browser_view) { return; } SidePanelToolbarContainer* container = browser_view->toolbar()->side_panel_container(); - bool dsp_was_google = dsp_is_google_; - dsp_is_google_ = search::DefaultSearchProviderIsGoogle(browser_->profile()); - // Update existence of companion entry points based on changes to the default - // search provider. - if (dsp_is_google_ && !dsp_was_google) { + // Update existence of companion entry points based on changes. + if (DoCompanionRuntimeChecksPass()) { container->AddPinnedEntryButtonFor(SidePanelEntry::Id::kSearchCompanion, name(), icon()); browser_->tab_strip_model()->AddObserver(this); CreateAndRegisterEntriesForExistingWebContents(browser_->tab_strip_model()); - } else if (!dsp_is_google_ && dsp_was_google) { + } else { container->RemovePinnedEntryButtonFor(SidePanelEntry::Id::kSearchCompanion); browser_->tab_strip_model()->RemoveObserver(this); DeregisterEntriesForExistingWebContents(browser_->tab_strip_model()); @@ -144,4 +177,22 @@ template_url_service_observation_.Reset(); } +void SearchCompanionSidePanelCoordinator::OnPolicyPrefChanged() { + if (!pref_service_) { + return; + } + + bool was_csc_enabled = DoCompanionRuntimeChecksPass(); + csc_enabled_via_policy_ = + companion::IsCompanionFeatureEnabledByPolicy(pref_service_); + if (was_csc_enabled == DoCompanionRuntimeChecksPass()) { + return; + } + UpdateCompanionAvailabilityInSidePanel(); +} + +bool SearchCompanionSidePanelCoordinator::DoCompanionRuntimeChecksPass() const { + return dsp_is_google_ && csc_enabled_via_policy_; +} + WEB_CONTENTS_USER_DATA_KEY_IMPL(SearchCompanionSidePanelCoordinator);
diff --git a/chrome/browser/ui/views/side_panel/search_companion/search_companion_side_panel_coordinator.h b/chrome/browser/ui/views/side_panel/search_companion/search_companion_side_panel_coordinator.h index 011a6dd..4926708 100644 --- a/chrome/browser/ui/views/side_panel/search_companion/search_companion_side_panel_coordinator.h +++ b/chrome/browser/ui/views/side_panel/search_companion/search_companion_side_panel_coordinator.h
@@ -19,6 +19,7 @@ #include "components/search_engines/template_url_service_observer.h" class Browser; +class PrefService; class Profile; // SearchCompanionSidePanelCoordinator handles the creation and registration of @@ -35,13 +36,15 @@ const SearchCompanionSidePanelCoordinator&) = delete; ~SearchCompanionSidePanelCoordinator() override; - static bool IsSupported(Profile* profile, bool include_dsp_check = true); + // If `include_runtime_checks` is true, then the method returns true if the + // runtime checks also return true. + static bool IsSupported(Profile* profile, bool include_runtime_checks); bool Show(SidePanelOpenTrigger side_panel_open_trigger); - BrowserView* GetBrowserView(); - std::u16string GetTooltipForToolbarButton(); + BrowserView* GetBrowserView() const; + std::u16string GetTooltipForToolbarButton() const; - std::u16string name() { return name_; } + std::u16string name() const { return name_; } const gfx::VectorIcon& icon() { return *icon_; } // TabStripModelObserver: @@ -65,10 +68,23 @@ void OnTemplateURLServiceChanged() override; void OnTemplateURLServiceShuttingDown() override; + // Updates CSC availability in Side Panel. + void UpdateCompanionAvailabilityInSidePanel(); + + // Called if there is a change in the state of policy pref. + void OnPolicyPrefChanged(); + + // Returns true if CSC runtime checks pass. + bool DoCompanionRuntimeChecksPass() const; + raw_ptr<Browser> browser_; std::u16string name_; const raw_ref<const gfx::VectorIcon, ExperimentalAsh> icon_; + raw_ptr<PrefService> pref_service_; bool dsp_is_google_ = false; + bool csc_enabled_via_policy_ = false; + + std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; base::ScopedObservation<TemplateURLService, TemplateURLServiceObserver> template_url_service_observation_{this};
diff --git a/chrome/browser/ui/views/side_panel/side_panel_toolbar_container.cc b/chrome/browser/ui/views/side_panel/side_panel_toolbar_container.cc index 53d09a12..7f9a722 100644 --- a/chrome/browser/ui/views/side_panel/side_panel_toolbar_container.cc +++ b/chrome/browser/ui/views/side_panel/side_panel_toolbar_container.cc
@@ -182,8 +182,10 @@ // update pinned entry toolbar buttons as the coordinator becomes aware of // them. This sort of observation is unnecessary for now when there is only // one pinned entry. + // Runtime availability checks are set to `true` because pinned buttons should + // be created only if runtime checks pass. if (!SearchCompanionSidePanelCoordinator::IsSupported( - browser_view_->GetProfile())) { + browser_view_->GetProfile(), /*include_runtime_checks=*/true)) { return; } auto* search_companion_coordinator =
diff --git a/chrome/browser/ui/views/side_panel/side_panel_util.cc b/chrome/browser/ui/views/side_panel/side_panel_util.cc index fe484544..c6d21cfa 100644 --- a/chrome/browser/ui/views/side_panel/side_panel_util.cc +++ b/chrome/browser/ui/views/side_panel/side_panel_util.cc
@@ -89,9 +89,12 @@ } // Create Search Companion coordinator. + // Disable runtime checks so that coordinator can monitor the runtime changes + // in the availability of companion. if (base::FeatureList::IsEnabled(companion::features::kSidePanelCompanion) && SearchCompanionSidePanelCoordinator::IsSupported( - browser->profile(), /*include_dsp_check=*/false)) { + browser->profile(), + /*include_runtime_checks=*/false)) { SearchCompanionSidePanelCoordinator::GetOrCreateForBrowser(browser); }
diff --git a/chrome/browser/ui/web_applications/web_app_interactive_uitest.cc b/chrome/browser/ui/web_applications/web_app_interactive_uitest.cc index f02035f..0b17f90 100644 --- a/chrome/browser/ui/web_applications/web_app_interactive_uitest.cc +++ b/chrome/browser/ui/web_applications/web_app_interactive_uitest.cc
@@ -46,7 +46,7 @@ MAYBE_TabOpensOnCorrectDisplay) { #if BUILDFLAG(IS_CHROMEOS_ASH) display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) - .UpdateDisplay("801x802,802x802"); + .UpdateDisplay("801x802,802x803"); #elif BUILDFLAG(IS_MAC) if (!display::test::VirtualDisplayMacUtil::IsAPIAvailable()) { GTEST_SKIP() << "Skipping test for unsupported MacOS version.";
diff --git a/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.cc b/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.cc index 8eba9396..bf676bc5 100644 --- a/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.cc +++ b/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.cc
@@ -37,13 +37,15 @@ IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_JS); source->SetDefaultResource(IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_HTML); // Data strings: - source->AddString(version_ui::kVersion, version_info::GetVersionNumber()); + source->AddString(version_ui::kVersion, + std::string(version_info::GetVersionNumber())); source->AddString(version_ui::kOfficial, version_info::IsOfficialBuild() ? "official" : "Developer build"); source->AddString(version_ui::kVersionModifier, chrome::GetChannelName(chrome::WithExtendedStable(true))); - source->AddString(version_ui::kCL, version_info::GetLastChange()); + source->AddString(version_ui::kCL, + std::string(version_info::GetLastChange())); source->AddString(version_ui::kUserAgent, embedder_support::GetUserAgent()); source->AddString("app_locale", g_browser_process->GetApplicationLocale()); }
diff --git a/chrome/browser/ui/webui/flags/flags_ui.cc b/chrome/browser/ui/webui/flags/flags_ui.cc index a273e235..bc0318f 100644 --- a/chrome/browser/ui/webui/flags/flags_ui.cc +++ b/chrome/browser/ui/webui/flags/flags_ui.cc
@@ -70,7 +70,8 @@ source->OverrideContentSecurityPolicy( network::mojom::CSPDirectiveName::TrustedTypes, "trusted-types jstemplate;"); - source->AddString(flags_ui::kVersion, version_info::GetVersionNumber()); + source->AddString(flags_ui::kVersion, + std::string(version_info::GetVersionNumber())); #if BUILDFLAG(IS_CHROMEOS_ASH) if (!user_manager::UserManager::Get()->IsCurrentUserOwner() &&
diff --git a/chrome/browser/ui/webui/nacl_ui.cc b/chrome/browser/ui/webui/nacl_ui.cc index 0125ddc..8ead8db 100644 --- a/chrome/browser/ui/webui/nacl_ui.cc +++ b/chrome/browser/ui/webui/nacl_ui.cc
@@ -197,7 +197,7 @@ // OS version information. // TODO(jvoung): refactor this to share the extra windows labeling // with about:flash, or something. - std::string os_label = version_info::GetOSType(); + std::string os_label(version_info::GetOSType()); #if BUILDFLAG(IS_WIN) base::win::OSInfo* os = base::win::OSInfo::GetInstance(); switch (os->version()) {
diff --git a/chrome/browser/ui/webui/realbox/realbox_handler.cc b/chrome/browser/ui/webui/realbox/realbox_handler.cc index 9541662..66a58fa6 100644 --- a/chrome/browser/ui/webui/realbox/realbox_handler.cc +++ b/chrome/browser/ui/webui/realbox/realbox_handler.cc
@@ -682,14 +682,16 @@ web_contents_(web_contents), metrics_reporter_(metrics_reporter), page_handler_(this, std::move(pending_page_handler)) { + // Indirectly observe all the `AutocompleteController` instances registered + // with the `AutocompleteControllerEmitter`. In addition to observing the + // instance associated with this handler, `RealboxHandler` also observes + // omnibox's instance for when it is used in the context of the WebUI omnibox. controller_emitter_observation_.Observe( AutocompleteControllerEmitter::GetForBrowserContext(profile_)); controller_ = std::make_unique<OmniboxController>( + /*view=*/nullptr, /*edit_model_delegate=*/this, - std::make_unique<AutocompleteController>( - std::make_unique<ChromeAutocompleteProviderClient>(profile_), - AutocompleteClassifier::DefaultOmniboxProviders()), std::make_unique<RealboxOmniboxClient>(profile_, web_contents_)); }
diff --git a/chrome/browser/ui/webui/settings/ash/os_settings_recovery_browsertest.cc b/chrome/browser/ui/webui/settings/ash/os_settings_recovery_browsertest.cc index 7b5d64addc..514c4d3 100644 --- a/chrome/browser/ui/webui/settings/ash/os_settings_recovery_browsertest.cc +++ b/chrome/browser/ui/webui/settings/ash/os_settings_recovery_browsertest.cc
@@ -128,7 +128,9 @@ // Check that trying to change recovery with an invalidated auth session shows // the password prompt again. -IN_PROC_BROWSER_TEST_F(OSSettingsRecoveryTestWithFeature, DestroyedSession) { +// TODO(crbug.com/1436858): Re-enable this test +IN_PROC_BROWSER_TEST_F(OSSettingsRecoveryTestWithFeature, + DISABLED_DestroyedSession) { mojom::LockScreenSettingsAsyncWaiter lock_screen_settings = OpenLockScreenSettingsAndAuthenticate();
diff --git a/chrome/browser/ui/webui/settings/ash/privacy_section.cc b/chrome/browser/ui/webui/settings/ash/privacy_section.cc index 8bb3dad1..8d590e3b 100644 --- a/chrome/browser/ui/webui/settings/ash/privacy_section.cc +++ b/chrome/browser/ui/webui/settings/ash/privacy_section.cc
@@ -402,6 +402,10 @@ IDS_OS_SETTINGS_PRIVACY_HUB_MICROPHONE_TOGGLE_SUBTEXT}, {"noMicrophoneConnectedText", IDS_OS_SETTINGS_PRIVACY_HUB_NO_MICROPHONE_CONNECTED_TEXT}, + {"speakOnMuteDetectionToggleTitle", + IDS_OS_SETTINGS_PRIVACY_HUB_SPEAK_ON_MUTE_DETECTION_TOGGLE_TITLE}, + {"speakOnMuteDetectionToggleSubtext", + IDS_OS_SETTINGS_PRIVACY_HUB_SPEAK_ON_MUTE_DETECTION_TOGGLE_SUBTEXT}, {"geolocationToggleTitle", IDS_OS_SETTINGS_PRIVACY_HUB_GEOLOCATION_TOGGLE_TITLE}, {"geolocationToggleDesc", @@ -426,6 +430,8 @@ ash::features::IsCrosPrivacyHubV1Enabled()); html_source->AddBoolean("showPrivacyHubFuturePage", ash::features::IsCrosPrivacyHubV2Enabled()); + html_source->AddBoolean("showSpeakOnMuteDetectionPage", + ash::features::IsSpeakOnMuteEnabled()); html_source->AddString( "smartPrivacyDesc", @@ -443,6 +449,9 @@ html_source->AddString("peripheralDataAccessLearnMoreURL", chrome::kPeripheralDataAccessHelpURL); + html_source->AddString("speakOnMuteDetectionLearnMoreURL", + chrome::kSpeakOnMuteDetectionLearnMoreURL); + html_source->AddBoolean("showSecureDnsSetting", IsSecureDnsAvailable()); html_source->AddBoolean("showSecureDnsOsSettingLink", false); @@ -565,7 +574,8 @@ RegisterNestedSettingBulk( mojom::Subpage::kPrivacyHub, {{mojom::Setting::kCameraOnOff, mojom::Setting::kMicrophoneOnOff, - mojom::Setting::kGeolocationOnOff}}, + mojom::Setting::kGeolocationOnOff, + mojom::Setting::kSpeakOnMuteDetectionOnOff}}, generator); }
diff --git a/chrome/browser/ui/webui/settings/chromeos/constants/setting.mojom b/chrome/browser/ui/webui/settings/chromeos/constants/setting.mojom index 2d2012b0d..baa854f 100644 --- a/chrome/browser/ui/webui/settings/chromeos/constants/setting.mojom +++ b/chrome/browser/ui/webui/settings/chromeos/constants/setting.mojom
@@ -216,6 +216,7 @@ kMicrophoneOnOff = 1117, kGeolocationOnOff = 1118, kLockScreenNotification = 1119, + kSpeakOnMuteDetectionOnOff = 1120, // Languages and Input section. kAddLanguage = 1200,
diff --git a/chrome/browser/ui/webui/version/version_ui.cc b/chrome/browser/ui/webui/version/version_ui.cc index 7ca8498..d61e2354 100644 --- a/chrome/browser/ui/webui/version/version_ui.cc +++ b/chrome/browser/ui/webui/version/version_ui.cc
@@ -223,7 +223,7 @@ // Data strings. html_source->AddString(version_ui::kVersion, - version_info::GetVersionNumber()); + std::string(version_info::GetVersionNumber())); html_source->AddString(version_ui::kVersionModifier, GetProductModifier()); @@ -239,7 +239,8 @@ base::i18n::MessageFormatter::FormatWithNumberedArgs( l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT), base::Time::Now())); - html_source->AddString(version_ui::kCL, version_info::GetLastChange()); + html_source->AddString(version_ui::kCL, + std::string(version_info::GetLastChange())); html_source->AddString(version_ui::kUserAgent, embedder_support::GetUserAgent()); // Note that the executable path and profile path are retrieved asynchronously @@ -251,7 +252,8 @@ #if BUILDFLAG(IS_MAC) html_source->AddString(version_ui::kOSType, base::mac::GetOSDisplayName()); #elif !BUILDFLAG(IS_CHROMEOS_ASH) - html_source->AddString(version_ui::kOSType, version_info::GetOSType()); + html_source->AddString(version_ui::kOSType, + std::string(version_info::GetOSType())); #endif // BUILDFLAG(IS_MAC) #if BUILDFLAG(IS_ANDROID) @@ -307,7 +309,7 @@ : std::string()); html_source->AddString(version_ui::kSanitizer, - version_info::GetSanitizerList()); + std::string(version_info::GetSanitizerList())); } #if !BUILDFLAG(IS_ANDROID)
diff --git a/chrome/browser/upgrade_detector/get_installed_version_linux_unittest.cc b/chrome/browser/upgrade_detector/get_installed_version_linux_unittest.cc index 2e923bd..1297beb 100644 --- a/chrome/browser/upgrade_detector/get_installed_version_linux_unittest.cc +++ b/chrome/browser/upgrade_detector/get_installed_version_linux_unittest.cc
@@ -61,7 +61,7 @@ case ChildMode::kWithVersion: // Print the current version and report success. - printf("%s\n", version_info::GetVersionNumber().c_str()); + printf("%s\n", version_info::GetVersionNumber().data()); return 0; } return 1;
diff --git a/chrome/browser/window_management/window_management_browsertest.cc b/chrome/browser/window_management/window_management_browsertest.cc index 1b8e486..8ad83e7 100644 --- a/chrome/browser/window_management/window_management_browsertest.cc +++ b/chrome/browser/window_management/window_management_browsertest.cc
@@ -413,12 +413,12 @@ IN_PROC_BROWSER_TEST_P(WindowManagementTest, MAYBE_ScreenDetailedOnChange) { #if BUILDFLAG(IS_CHROMEOS_ASH) display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) - .UpdateDisplay("100+100-801x802,901+100-802x802"); + .UpdateDisplay("100+100-801x802,901+100-802x803"); #else display::ScreenBase screen; screen.display_list().AddDisplay({1, gfx::Rect(100, 100, 801, 802)}, display::DisplayList::Type::PRIMARY); - screen.display_list().AddDisplay({2, gfx::Rect(901, 100, 802, 802)}, + screen.display_list().AddDisplay({2, gfx::Rect(901, 100, 802, 803)}, display::DisplayList::Type::NOT_PRIMARY); display::Screen::SetScreenInstance(&screen); #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -482,7 +482,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) - .UpdateDisplay("100+100-801x301,901+100-802x802"); + .UpdateDisplay("100+100-801x301,901+100-802x803"); #else screen.display_list().UpdateDisplay({1, gfx::Rect(100, 100, 801, 301)}, display::DisplayList::Type::PRIMARY);
diff --git a/chrome/browser/window_management/window_management_permission_context_browsertest.cc b/chrome/browser/window_management/window_management_permission_context_browsertest.cc index bec9305c..279ee47 100644 --- a/chrome/browser/window_management/window_management_permission_context_browsertest.cc +++ b/chrome/browser/window_management/window_management_permission_context_browsertest.cc
@@ -141,7 +141,7 @@ display::Screen::SetScreenInstance(&screen_); screen_.display_list().AddDisplay({1, gfx::Rect(100, 100, 801, 802)}, display::DisplayList::Type::PRIMARY); - screen_.display_list().AddDisplay({2, gfx::Rect(901, 100, 802, 802)}, + screen_.display_list().AddDisplay({2, gfx::Rect(901, 100, 802, 803)}, display::DisplayList::Type::NOT_PRIMARY); ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays()); #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -152,7 +152,7 @@ // This has to happen later than SetScreenInstance as the ash shell // does not exist yet. display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) - .UpdateDisplay("100+100-801x802,901+100-802x802"); + .UpdateDisplay("100+100-801x802,901+100-802x803"); ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays()); #endif WindowManagementPermissionContextTest::SetUpOnMainThread();
diff --git a/chrome/build/lacros64.pgo.txt b/chrome/build/lacros64.pgo.txt index eb87c3e4..21ed722 100644 --- a/chrome/build/lacros64.pgo.txt +++ b/chrome/build/lacros64.pgo.txt
@@ -1 +1 @@ -chrome-chromeos-amd64-generic-main-1684166300-a1977d7b9884e164d260d6c33b9d4e205e4ddb06.profdata +chrome-chromeos-amd64-generic-main-1684180694-0644ab0a81d34de128eb72e2c73f37b90ebe0566.profdata
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 94b3c29..34c488ec 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1684087171-f167275cf0752c3218ce0cf4a353d636a8ad577a.profdata +chrome-linux-main-1684173541-e231634b282caa18a630a7b1fdae16f7f40dc5e8.profdata
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index 28df7f3d..795e44f 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1684166300-a02730dee233c17519199a930badb8fcdc65257f.profdata +chrome-mac-arm-main-1684187961-d27c8210982b626265d15a85712022ecc8846dab.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 36853e5..6b4fc33 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1684162775-28c5d35abf29bb167549419671a3018389b62011.profdata +chrome-win32-main-1684173541-15e465c60ff9b71b734ca652291f9758416bfdd4.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index a72592b..25785a7 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1684162775-e47a1a8247b7440e00bd3acee6cdffd97ad7f8fc.profdata +chrome-win64-main-1684173541-c14f2fa2bd371f396f14cedb7545a63dc6432396.profdata
diff --git a/chrome/common/accessibility/read_anything_constants.h b/chrome/common/accessibility/read_anything_constants.h index 5a92562..ef64fef 100644 --- a/chrome/common/accessibility/read_anything_constants.h +++ b/chrome/common/accessibility/read_anything_constants.h
@@ -44,7 +44,6 @@ const int kIconSize = 16; const int kColorsIconSize = 24; const int kSpacingIconSize = 20; -const int kMenuLabelFontSizePx = 15; // Font size in em const double kReadAnythingDefaultFontScale = 1;
diff --git a/chrome/common/mac/app_mode_chrome_locator_browsertest.mm b/chrome/common/mac/app_mode_chrome_locator_browsertest.mm index b7a08aa..ddc843b 100644 --- a/chrome/common/mac/app_mode_chrome_locator_browsertest.mm +++ b/chrome/common/mac/app_mode_chrome_locator_browsertest.mm
@@ -68,8 +68,8 @@ base::FilePath framework_path; base::FilePath framework_dylib_path; EXPECT_TRUE(app_mode::GetChromeBundleInfo( - chrome_bundle_path, version_info::GetVersionNumber(), &executable_path, - &framework_path, &framework_dylib_path)); + chrome_bundle_path, std::string(version_info::GetVersionNumber()), + &executable_path, &framework_path, &framework_dylib_path)); EXPECT_TRUE(base::PathExists(executable_path)); EXPECT_TRUE(base::DirectoryExists(framework_path)); EXPECT_TRUE(base::PathExists(framework_dylib_path));
diff --git a/chrome/common/mac/app_mode_common.mm b/chrome/common/mac/app_mode_common.mm index 90956df..0d170b0 100644 --- a/chrome/common/mac/app_mode_common.mm +++ b/chrome/common/mac/app_mode_common.mm
@@ -93,7 +93,7 @@ // static ChromeConnectionConfig ChromeConnectionConfig::GenerateForCurrentProcess() { return { - .framework_version = version_info::GetVersionNumber(), + .framework_version = std::string(version_info::GetVersionNumber()), .is_mojo_ipcz_enabled = mojo::core::IsMojoIpczEnabled(), }; }
diff --git a/chrome/common/media/media_resource_provider.cc b/chrome/common/media/media_resource_provider.cc index 8fe796e8..3887f89 100644 --- a/chrome/common/media/media_resource_provider.cc +++ b/chrome/common/media/media_resource_provider.cc
@@ -18,10 +18,8 @@ case media::COMMUNICATIONS_AUDIO_DEVICE_NAME: return IDS_COMMUNICATIONS_AUDIO_DEVICE_NAME; #endif - default: - NOTREACHED(); - return 0; } + NOTREACHED_NORETURN(); } } // namespace
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 4ced775..b7bdd22 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc
@@ -1683,6 +1683,9 @@ // a button in the toolbar. const char kSidePanelCompanionEntryPinnedToToolbar[] = "side_panel.companion_pinned_to_toolbar"; +// Corresponds to the enterprise policy. +const char kGoogleSearchSidePanelEnabled[] = + "side_panel.google_search_side_panel_enabled"; #endif // Number of minutes of inactivity before running actions from
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index ccdb3a40..a7863d99 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h
@@ -1244,6 +1244,7 @@ extern const char kLensRegionSearchEnabled[]; extern const char kSidePanelHorizontalAlignment[]; extern const char kSidePanelCompanionEntryPinnedToToolbar[]; +extern const char kGoogleSearchSidePanelEnabled[]; extern const char kLensDesktopNTPSearchEnabled[]; #endif
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index c1ded520..dd2e6c81 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc
@@ -470,6 +470,9 @@ const char kSmbSharesLearnMoreURL[] = "https://support.google.com/chromebook?p=network_file_shares"; +const char kSpeakOnMuteDetectionLearnMoreURL[] = + "https://support.google.com/chromebook?p=mic-mute"; + const char kSuggestedContentLearnMoreURL[] = "https://support.google.com/chromebook/?p=explorecontent";
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index 222c94a6..e836baf 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h
@@ -445,6 +445,10 @@ // The URL for the "Learn more" page for the network file shares settings page. extern const char kSmbSharesLearnMoreURL[]; +// The URL for the "Learn more" page for Speak-on-mute Detection in the privacy +// hub page. +extern const char kSpeakOnMuteDetectionLearnMoreURL[]; + // The URL for the "Learn more" page for Suggested Content in the privacy page. extern const char kSuggestedContentLearnMoreURL[];
diff --git a/chrome/renderer/accessibility/read_anything_app_controller.cc b/chrome/renderer/accessibility/read_anything_app_controller.cc index 5cedf95..f299b70 100644 --- a/chrome/renderer/accessibility/read_anything_app_controller.cc +++ b/chrome/renderer/accessibility/read_anything_app_controller.cc
@@ -769,6 +769,11 @@ ui::AXNode* focus_node = model_.GetAXNode(focus_node_id); ui::AXNode* anchor_node = model_.GetAXNode(anchor_node_id); + if (!focus_node || !anchor_node) { + // Sometimes when the side panel size is adjusted, a focus or anchor node + // may be null. Return early if this happens. + return; + } // Some text fields, like Gmail, allow a <div> to be returned as a focus // node for selection, most frequently when a triple click causes an entire // range of text to be selected, including non-text nodes. This can cause
diff --git a/chrome/renderer/accessibility/read_anything_app_controller_browsertest.cc b/chrome/renderer/accessibility/read_anything_app_controller_browsertest.cc index 14b2a47e..8b426c6 100644 --- a/chrome/renderer/accessibility/read_anything_app_controller_browsertest.cc +++ b/chrome/renderer/accessibility/read_anything_app_controller_browsertest.cc
@@ -55,6 +55,8 @@ mojo::Receiver<read_anything::mojom::UntrustedPageHandler> receiver_{this}; }; +using testing::Mock; + class ReadAnythingAppControllerTest : public ChromeRenderViewTest { public: ReadAnythingAppControllerTest() = default; @@ -101,6 +103,7 @@ AccessibilityEventReceived({snapshot}); OnActiveAXTreeIDChanged(tree_id_); OnAXTreeDistilled({}); + Mock::VerifyAndClearExpectations(distiller_); } void SetUpdateTreeID(ui::AXTreeUpdate* update) { @@ -583,16 +586,17 @@ SetUpdateTreeID(&update); update.nodes.resize(1); update.nodes[0].id = 3; - update.nodes[0].AddIntAttribute(ax::mojom::IntAttribute::kScrollX, 100); - // This update changes the horizontal scroll position of node 3. When the - // controller receives it in AccessibilityEventReceived, it will re-distill - // the tree. This is an example of a generated event. + // This update says the page loaded. When the controller receives it in + // AccessibilityEventReceived, it will re-distill the tree. This is an + // example of a non-generated event. EXPECT_CALL(*distiller_, Distill).Times(1); - AccessibilityEventReceived({update}); + ui::AXEvent load_complete(0, ax::mojom::Event::kLoadComplete); + AccessibilityEventReceived({update}, {load_complete}); OnAXTreeDistilled({3}); EXPECT_TRUE(DisplayNodeIdsContains(1)); EXPECT_FALSE(DisplayNodeIdsContains(2)); EXPECT_TRUE(DisplayNodeIdsContains(3)); + Mock::VerifyAndClearExpectations(distiller_); } TEST_F(ReadAnythingAppControllerTest, @@ -744,11 +748,13 @@ EXPECT_CALL(*distiller_, Distill).Times(1); OnActiveAXTreeIDChanged(tree_ids[i]); EXPECT_EQ("Tree " + base::NumberToString(i), GetTextContent(1)); + Mock::VerifyAndClearExpectations(distiller_); } // Changing the active tree ID to the same ID does nothing. EXPECT_CALL(*distiller_, Distill).Times(0); OnActiveAXTreeIDChanged(tree_ids[2]); + Mock::VerifyAndClearExpectations(distiller_); } TEST_F(ReadAnythingAppControllerTest, @@ -761,9 +767,11 @@ update.nodes[0].id = 1; AccessibilityEventReceived({update}); OnAXTreeDistilled({1}); + EXPECT_CALL(*distiller_, Distill).Times(1); OnActiveAXTreeIDChanged(id_1, GURL("www.google.com")); EXPECT_TRUE(isSelectable()); + Mock::VerifyAndClearExpectations(distiller_); ui::AXTreeUpdate update_1; SetUpdateTreeID(&update_1, tree_id_); @@ -772,12 +780,14 @@ update_1.nodes[0].id = 1; AccessibilityEventReceived({update_1}); OnAXTreeDistilled({1}); + EXPECT_CALL(*distiller_, Distill).Times(1); OnActiveAXTreeIDChanged( tree_id_, GURL("https://docs.google.com/document/d/" "1t6x1PQaQWjE8wb9iyYmFaoK1XAEgsl8G1Hx3rzfpoKA/" "edit?ouid=103677288878638916900&usp=docs_home&ths=true")); EXPECT_FALSE(isSelectable()); + Mock::VerifyAndClearExpectations(distiller_); } TEST_F(ReadAnythingAppControllerTest, DoesNotCrashIfActiveAXTreeIDUnknown) { @@ -786,6 +796,7 @@ OnActiveAXTreeIDChanged(tree_id); OnAXTreeDestroyed(tree_id); OnAXTreeDistilled({1}); + Mock::VerifyAndClearExpectations(distiller_); } TEST_F(ReadAnythingAppControllerTest, DoesNotCrashIfActiveAXTreeIDNotInTrees) { @@ -853,6 +864,7 @@ EXPECT_CALL(*distiller_, Distill).Times(0); AccessibilityEventReceived({initial_update}); EXPECT_EQ("234", GetTextContent(1)); + Mock::VerifyAndClearExpectations(distiller_); std::vector<ui::AXTreeUpdate> updates; for (int i = 0; i < 3; i++) { @@ -876,11 +888,13 @@ EXPECT_CALL(*distiller_, Distill).Times(0); AccessibilityEventReceived({updates[0]}); EXPECT_EQ("2345", GetTextContent(1)); + Mock::VerifyAndClearExpectations(distiller_); // Send update 1. EXPECT_CALL(*distiller_, Distill).Times(0); AccessibilityEventReceived({updates[1]}); EXPECT_EQ("23456", GetTextContent(1)); + Mock::VerifyAndClearExpectations(distiller_); // Destroy the tree. ASSERT_TRUE(HasTree(tree_id_)); @@ -890,13 +904,6 @@ TEST_F(ReadAnythingAppControllerTest, DistillationInProgress_TreeUpdateReceivedOnActiveTree) { - // TODO(accessibility): this entire file's usage of mocks is incorrect. It - // should resemble what this test does. As is, the EXPECT_CALL expectations - // are mismatched with the calls they're supposed to align with. Mocks run - // *after* all calls (implicitly at the end of the test) or explicitly via - // VerifyAndClearExpectations*. - using testing::Mock; - // Set the name of each node to be its id. ui::AXTreeUpdate initial_update; SetUpdateTreeID(&initial_update); @@ -941,11 +948,11 @@ EXPECT_EQ("2345", GetTextContent(1)); Mock::VerifyAndClearExpectations(distiller_); - // Send update 1. This triggers distillation via a generated event. The data - // is also unserialized. + // Send update 1. This triggers distillation via a non-generated event. The + // data is also unserialized. EXPECT_CALL(*distiller_, Distill).Times(1); - updates[1].nodes[0].AddIntAttribute(ax::mojom::IntAttribute::kScrollY, 100); - AccessibilityEventReceived({updates[1]}); + ui::AXEvent load_complete_1(1, ax::mojom::Event::kLoadComplete); + AccessibilityEventReceived({updates[1]}, {load_complete_1}); EXPECT_EQ("23456", GetTextContent(1)); Mock::VerifyAndClearExpectations(distiller_); @@ -953,10 +960,8 @@ // event. This does not result in distillation (yet). The data is not // unserialized. EXPECT_CALL(*distiller_, Distill).Times(0); - // Keep the root scrolled. - updates[2].nodes[0].AddIntAttribute(ax::mojom::IntAttribute::kScrollY, 100); - ui::AXEvent load_complete(1, ax::mojom::Event::kLoadComplete); - AccessibilityEventReceived({updates[2]}, {load_complete}); + ui::AXEvent load_complete_2(2, ax::mojom::Event::kLoadComplete); + AccessibilityEventReceived({updates[2]}, {load_complete_2}); EXPECT_EQ("23456", GetTextContent(1)); Mock::VerifyAndClearExpectations(distiller_); @@ -991,6 +996,7 @@ EXPECT_CALL(*distiller_, Distill).Times(0); AccessibilityEventReceived({initial_update}); EXPECT_EQ("234", GetTextContent(1)); + Mock::VerifyAndClearExpectations(distiller_); std::vector<ui::AXTreeUpdate> updates; for (int i = 0; i < 3; i++) { @@ -1015,11 +1021,13 @@ EXPECT_CALL(*distiller_, Distill).Times(1); ui::AXEvent load_complete(1, ax::mojom::Event::kLoadComplete); AccessibilityEventReceived({updates[0]}, {load_complete}); + Mock::VerifyAndClearExpectations(distiller_); // Send update 1. Since there's no event (generated or not) which triggers // distllation, we have no calls. EXPECT_CALL(*distiller_, Distill).Times(0); AccessibilityEventReceived({updates[1]}); + Mock::VerifyAndClearExpectations(distiller_); // Ensure that there are no crashes after an accessibility event is received // immediately after distilling. @@ -1027,6 +1035,7 @@ OnAXTreeDistilled({1}); SetDistillationInProgress(true); AccessibilityEventReceived({updates[2]}); + Mock::VerifyAndClearExpectations(distiller_); } TEST_F(ReadAnythingAppControllerTest, @@ -1053,12 +1062,17 @@ EXPECT_CALL(*distiller_, Distill).Times(0); AccessibilityEventReceived({updates[0]}); + Mock::VerifyAndClearExpectations(distiller_); + EXPECT_CALL(*distiller_, Distill).Times(1); ui::AXEvent load_complete(1, ax::mojom::Event::kLoadComplete); AccessibilityEventReceived({updates[1]}, {load_complete}); + Mock::VerifyAndClearExpectations(distiller_); + EXPECT_CALL(*distiller_, Distill).Times(0); AccessibilityEventReceived({updates[2]}); EXPECT_EQ("56", GetTextContent(1)); + Mock::VerifyAndClearExpectations(distiller_); // Calling OnActiveAXTreeID updates the active AXTreeID. ui::AXTreeID tree_id_2 = ui::AXTreeID::CreateNewAXTreeID(); @@ -1066,6 +1080,7 @@ ASSERT_EQ(tree_id_, ActiveTreeId()); OnActiveAXTreeIDChanged(tree_id_2); ASSERT_EQ(tree_id_2, ActiveTreeId()); + Mock::VerifyAndClearExpectations(distiller_); } TEST_F(ReadAnythingAppControllerTest, @@ -1128,10 +1143,12 @@ EXPECT_CALL(*distiller_, Distill).Times(0); AccessibilityEventReceived({updates[0]}); AccessibilityEventReceived(tree_id_, {updates[1], updates[2]}); + Mock::VerifyAndClearExpectations(distiller_); // Switch to a new active tree. Should not crash. EXPECT_CALL(*distiller_, Distill).Times(0); OnActiveAXTreeIDChanged(ui::AXTreeIDUnknown()); + Mock::VerifyAndClearExpectations(distiller_); } TEST_F(ReadAnythingAppControllerTest, OnLinkClicked) { @@ -1139,6 +1156,7 @@ EXPECT_CALL(page_handler_, OnLinkClicked(tree_id_, ax_node_id)).Times(1); OnLinkClicked(ax_node_id); page_handler_.FlushForTesting(); + Mock::VerifyAndClearExpectations(distiller_); } TEST_F(ReadAnythingAppControllerTest, OnLinkClicked_DistillationInProgress) { @@ -1149,13 +1167,16 @@ update.nodes.resize(1); update.nodes[0].id = 1; AccessibilityEventReceived({update}); + EXPECT_CALL(*distiller_, Distill).Times(1); OnActiveAXTreeIDChanged(new_tree_id); + Mock::VerifyAndClearExpectations(distiller_); // If distillation is in progress, OnLinkClicked should not be called. EXPECT_CALL(page_handler_, OnLinkClicked).Times(0); OnLinkClicked(2); page_handler_.FlushForTesting(); + Mock::VerifyAndClearExpectations(distiller_); } TEST_F(ReadAnythingAppControllerTest, OnSelectionChange) { @@ -1178,6 +1199,7 @@ focus_node_id, focus_offset)) .Times(1); OnSelectionChange(anchor_node_id, anchor_offset, focus_node_id, focus_offset); + Mock::VerifyAndClearExpectations(distiller_); } TEST_F(ReadAnythingAppControllerTest, @@ -1201,6 +1223,7 @@ .Times(0); OnSelectionChange(anchor_node_id, anchor_offset, focus_node_id, focus_offset); page_handler_.FlushForTesting(); + Mock::VerifyAndClearExpectations(distiller_); } TEST_F(ReadAnythingAppControllerTest, @@ -1215,11 +1238,13 @@ AccessibilityEventReceived({update}); EXPECT_CALL(*distiller_, Distill).Times(1); OnActiveAXTreeIDChanged(new_tree_id); + Mock::VerifyAndClearExpectations(distiller_); // If distillation is in progress, OnSelectionChange should not be called. EXPECT_CALL(page_handler_, OnSelectionChange).Times(0); OnSelectionChange(2, 0, 3, 1); page_handler_.FlushForTesting(); + Mock::VerifyAndClearExpectations(distiller_); } TEST_F(ReadAnythingAppControllerTest, @@ -1244,6 +1269,7 @@ .Times(0); OnSelectionChange(anchor_node_id, anchor_offset, focus_node_id, focus_offset); page_handler_.FlushForTesting(); + Mock::VerifyAndClearExpectations(distiller_); } TEST_F(ReadAnythingAppControllerTest, Selection_Forward) {
diff --git a/chrome/renderer/accessibility/read_anything_app_model.cc b/chrome/renderer/accessibility/read_anything_app_model.cc index c7c0c0a..ce7487f 100644 --- a/chrome/renderer/accessibility/read_anything_app_model.cc +++ b/chrome/renderer/accessibility/read_anything_app_model.cc
@@ -543,10 +543,6 @@ // It's up to the consumer to pick but its generally good to prefer generated. for (const auto& event : event_generator) { switch (event.event_params.event) { - case ui::AXEventGenerator::Event::SCROLL_HORIZONTAL_POSITION_CHANGED: - case ui::AXEventGenerator::Event::SCROLL_VERTICAL_POSITION_CHANGED: - requires_distillation_ = true; - break; case ui::AXEventGenerator::Event::DOCUMENT_SELECTION_CHANGED: if (event.event_params.event_from == ax::mojom::EventFrom::kUser) { requires_post_process_selection_ = true; @@ -618,6 +614,8 @@ case ui::AXEventGenerator::Event::REQUIRED_STATE_CHANGED: case ui::AXEventGenerator::Event::ROLE_CHANGED: case ui::AXEventGenerator::Event::ROW_COUNT_CHANGED: + case ui::AXEventGenerator::Event::SCROLL_HORIZONTAL_POSITION_CHANGED: + case ui::AXEventGenerator::Event::SCROLL_VERTICAL_POSITION_CHANGED: case ui::AXEventGenerator::Event::SELECTED_CHANGED: case ui::AXEventGenerator::Event::SELECTED_CHILDREN_CHANGED: case ui::AXEventGenerator::Event::SELECTED_VALUE_CHANGED:
diff --git a/chrome/services/qrcode_generator/qrcode_generator_service_pixeltest.cc b/chrome/services/qrcode_generator/qrcode_generator_service_pixeltest.cc index a49ecd7..566348d 100644 --- a/chrome/services/qrcode_generator/qrcode_generator_service_pixeltest.cc +++ b/chrome/services/qrcode_generator/qrcode_generator_service_pixeltest.cc
@@ -8,7 +8,6 @@ #include "chrome/services/qrcode_generator/public/cpp/qrcode_generator_service.h" #include "chrome/services/qrcode_generator/public/mojom/qrcode_generator.mojom.h" #include "chrome/test/base/in_process_browser_test.h" -#include "components/metrics/content/subprocess_metrics_provider.h" #include "content/public/test/browser_test.h" #include "ui/base/test/skia_gold_pixel_diff.h" @@ -59,12 +58,8 @@ ASSERT_EQ(response->bitmap.height() % response->data_size.height(), 0); // Verify that the expected UMA metrics got logged. - metrics::SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); + // TODO(1246137): Cover BytesToQrPixels and QrPixelsToQrImage as well. histograms.ExpectTotalCount("Sharing.QRCodeGeneration.Duration", 1); - histograms.ExpectTotalCount( - "Sharing.QRCodeGeneration.Duration.BytesToQrPixels", 1); - histograms.ExpectTotalCount( - "Sharing.QRCodeGeneration.Duration.QrPixelsToQrImage", 1); #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ BUILDFLAG(IS_CHROMEOS_LACROS) @@ -82,15 +77,8 @@ } }; -// Flaky on Linux https://crbug.com/1444578 -#if BUILDFLAG(IS_LINUX) -#define MAYBE_DinoWithRoundQrPixelsAndLocators \ - DISABLED_DinoWithRoundQrPixelsAndLocators -#else -#define MAYBE_DinoWithRoundQrPixelsAndLocators DinoWithRoundQrPixelsAndLocators -#endif IN_PROC_BROWSER_TEST_F(QrCodeGeneratorServicePixelTest, - MAYBE_DinoWithRoundQrPixelsAndLocators) { + DinoWithRoundQrPixelsAndLocators) { TestGolden("https://example.com", mojom::CenterImage::CHROME_DINO, mojom::ModuleStyle::CIRCLES, mojom::LocatorStyle::ROUNDED); }
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index c2dda7f..1e64fd7 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -552,6 +552,7 @@ "//chrome/app_shim", "//components/upload_list", ] + configs += [ "//build/config/compiler:enable_arc" ] public_deps += [ "//components/crash/core/app" ] } @@ -5590,6 +5591,7 @@ "../browser/enterprise/connectors/interstitials/enterprise_page_unittest.cc", "../browser/enterprise/identifiers/profile_id_service_factory_unittest.cc", "../browser/enterprise/reporting/browser_report_generator_unittest.cc", + "../browser/enterprise/reporting/legacy_tech/legacy_tech_report_generator_unittest.cc", "../browser/enterprise/reporting/legacy_tech/legacy_tech_url_matcher_unittest.cc", "../browser/enterprise/reporting/policy_info_unittest.cc", "../browser/enterprise/reporting/profile_report_generator_unittest.cc", @@ -8572,7 +8574,7 @@ deps += [ "//dbus:test_support" ] } - if (is_android || is_chromeos || is_win) { + if (is_android || is_chromeos_ash || is_win) { sources += [ "../browser/media/protected_media_identifier_permission_context_unittest.cc" ] }
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/OmniboxTestUtils.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/OmniboxTestUtils.java index ce9f675..5561857f 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/OmniboxTestUtils.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/OmniboxTestUtils.java
@@ -53,10 +53,6 @@ public class OmniboxTestUtils { /** Value indicating that the index is not valid. */ public static final int SUGGESTION_INDEX_INVALID = -1; - /** Maximum time to wait for the Omnibox content to stabilize. */ - private static final int MAX_TIME_TO_POLL_MS = 300; - /** Interval between subsequent polls. */ - private static final int POLL_INTERVAL_MS = 30; private final @NonNull Activity mActivity; private final @NonNull LocationBarLayout mLocationBar; @@ -145,7 +141,7 @@ Context.INPUT_METHOD_SERVICE); Criteria.checkThat("Keyboard did not reach expected state", imm.isActive(mUrlBar), Matchers.is(active)); - }, MAX_TIME_TO_POLL_MS, POLL_INTERVAL_MS); + }); } /** @@ -165,7 +161,7 @@ CriteriaHelper.pollUiThread(() -> { Criteria.checkThat("Omnibox not shown.", mUrlBar.isShown(), Matchers.is(true)); Criteria.checkThat("Omnibox not focusable.", mUrlBar.isFocusable(), Matchers.is(true)); - }, MAX_TIME_TO_POLL_MS, POLL_INTERVAL_MS); + }); TestThreadUtils.runOnUiThreadBlockingNoException(() -> mUrlBar.requestFocus()); waitAnimationsComplete(); @@ -211,7 +207,7 @@ suggestionsDropdown.getViewGroup().isShown(), Matchers.is(true)); Criteria.checkThat("suggestion list has no entries", suggestionsDropdown.getDropdownItemViewCountForTest(), Matchers.greaterThan(0)); - }, MAX_TIME_TO_POLL_MS, POLL_INTERVAL_MS); + }); } /** @@ -285,7 +281,7 @@ } } return false; - }, MAX_TIME_TO_POLL_MS, POLL_INTERVAL_MS); + }); return result.get(); } @@ -484,7 +480,7 @@ // URL bar is not focused. Match against the content. Criteria.checkThat(mUrlBar.getText().toString(), textMatcher); } - }, MAX_TIME_TO_POLL_MS, POLL_INTERVAL_MS); + }); } /** @@ -526,7 +522,7 @@ Criteria.checkThat("Composing Span End", BaseInputConnection.getComposingSpanEnd(composingText), Matchers.is(composingRangeEnd)); - }, MAX_TIME_TO_POLL_MS, POLL_INTERVAL_MS); + }); } /**
diff --git a/chrome/test/base/launchservices_utils_mac.mm b/chrome/test/base/launchservices_utils_mac.mm index a0013a4e..61832d4f4 100644 --- a/chrome/test/base/launchservices_utils_mac.mm +++ b/chrome/test/base/launchservices_utils_mac.mm
@@ -6,12 +6,17 @@ #include <Foundation/Foundation.h> +#include "base/apple/bridging.h" #include "base/base_paths.h" #include "base/files/file_path.h" #include "base/mac/foundation_util.h" #include "base/path_service.h" #include "build/branding_buildflags.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace test { bool RegisterAppWithLaunchServices() { @@ -24,19 +29,22 @@ // Try to guess the path to the real org.chromium.Chromium and/or // org.google.Chrome bundle if the current main bundle's path isn't already a // .app directory: - NSURL* bundleURL = [[NSBundle mainBundle] bundleURL]; + NSURL* bundleURL = NSBundle.mainBundle.bundleURL; if (![bundleURL.lastPathComponent hasSuffix:@".app"]) { base::FilePath bundle_path; - if (!base::PathService::Get(base::DIR_EXE, &bundle_path)) + if (!base::PathService::Get(base::DIR_EXE, &bundle_path)) { return false; + } bundle_path = bundle_path.Append(kAppSuffix); bundleURL = base::mac::FilePathToNSURL(bundle_path); } - if (![NSFileManager.defaultManager fileExistsAtPath:bundleURL.path]) + if (![bundleURL checkResourceIsReachableAndReturnError:nil]) { return false; + } - return LSRegisterURL(base::mac::NSToCFCast(bundleURL), false) == noErr; + return LSRegisterURL(base::apple::NSToCFPtrCast(bundleURL), + /*inUpdate=*/false) == noErr; } } // namespace test
diff --git a/chrome/test/base/scoped_bundle_swizzler_mac.h b/chrome/test/base/scoped_bundle_swizzler_mac.h index ac8ccd848..f4708e90 100644 --- a/chrome/test/base/scoped_bundle_swizzler_mac.h +++ b/chrome/test/base/scoped_bundle_swizzler_mac.h
@@ -7,11 +7,9 @@ #include <memory> -namespace base { -namespace mac { +namespace base::mac { class ScopedObjCClassSwizzler; -} // namespace mac -} // namespace base +} // namespace base::mac // Within a given scope, swizzles the implementation of +[NSBundle mainBundle] // to return a partial mock of the original bundle. This partial mock has a
diff --git a/chrome/test/base/scoped_bundle_swizzler_mac.mm b/chrome/test/base/scoped_bundle_swizzler_mac.mm index f9a6851..54f7da4a 100644 --- a/chrome/test/base/scoped_bundle_swizzler_mac.mm +++ b/chrome/test/base/scoped_bundle_swizzler_mac.mm
@@ -10,11 +10,14 @@ #include "base/check.h" #include "base/mac/foundation_util.h" -#include "base/mac/scoped_nsobject.h" #include "base/mac/scoped_objc_class_swizzler.h" #include "base/strings/sys_string_conversions.h" -static id g_swizzled_main_bundle = nil; +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +static id __strong g_swizzled_main_bundle = nil; // A donor class that provides a +[NSBundle mainBundle] method that can be // swapped with NSBundle. @@ -24,8 +27,8 @@ @end @implementation TestBundle { - base::scoped_nsobject<NSBundle> _mainBundle; - base::scoped_nsobject<NSString> _bundleID; + NSBundle* __strong _mainBundle; + NSString* __strong _bundleID; } + (NSBundle*)mainBundle { @@ -33,18 +36,17 @@ } - (instancetype)initWithRealBundle:(NSBundle*)bundle { - _mainBundle.reset([bundle retain]); - _bundleID.reset(base::SysUTF8ToNSString(base::mac::BaseBundleID()), - base::scoped_policy::RETAIN); + _mainBundle = bundle; + _bundleID = base::SysUTF8ToNSString(base::mac::BaseBundleID()); return self; } - (NSString*)bundleIdentifier { - return _bundleID.get(); + return _bundleID; } - (void)forwardInvocation:(NSInvocation*)invocation { - invocation.target = _mainBundle.get(); + invocation.target = _mainBundle; [invocation invoke]; } @@ -57,7 +59,7 @@ ScopedBundleSwizzlerMac::ScopedBundleSwizzlerMac() { CHECK(!g_swizzled_main_bundle); - NSBundle* original_main_bundle = [NSBundle mainBundle]; + NSBundle* original_main_bundle = NSBundle.mainBundle; g_swizzled_main_bundle = [[TestBundle alloc] initWithRealBundle:original_main_bundle]; @@ -66,6 +68,5 @@ } ScopedBundleSwizzlerMac::~ScopedBundleSwizzlerMac() { - [g_swizzled_main_bundle release]; g_swizzled_main_bundle = nil; }
diff --git a/chrome/test/data/webui/cr_components/chromeos/network/apn_list_test.js b/chrome/test/data/webui/cr_components/chromeos/network/apn_list_test.js index b608a3b..641e102 100644 --- a/chrome/test/data/webui/cr_components/chromeos/network/apn_list_test.js +++ b/chrome/test/data/webui/cr_components/chromeos/network/apn_list_test.js
@@ -158,7 +158,9 @@ assertTrue(!!getErrorMessage()); const getErrorMessageText = () => getErrorMessage().querySelector('localized-link').localizedString; - assertEquals('Can\'t connect to network.', getErrorMessageText()); + assertEquals( + apnList.i18n('apnSettingsDatabaseApnsErrorMessage'), + getErrorMessageText()); // Add an enabled custom APN. apnList.managedCellularProperties = { @@ -178,7 +180,9 @@ await flushTasks(); assertFalse(!!getZeroStateText()); assertTrue(!!getErrorMessage()); - assertEquals('Can\'t connect to network.', getErrorMessageText()); + assertEquals( + apnList.i18n('apnSettingsDatabaseApnsErrorMessage'), + getErrorMessageText()); // Add a connected APN. The error should not show. apnList.managedCellularProperties = {
diff --git a/chrome/test/data/webui/new_tab_page/modules/drive_v2/module_test.ts b/chrome/test/data/webui/new_tab_page/modules/drive_v2/module_test.ts index c048188..811d7cd 100644 --- a/chrome/test/data/webui/new_tab_page/modules/drive_v2/module_test.ts +++ b/chrome/test/data/webui/new_tab_page/modules/drive_v2/module_test.ts
@@ -184,7 +184,7 @@ // Assert. const event: DisableModuleEvent = await whenFired; assertEquals( - 'You won\'t see Drive files again on this page', + 'You won\'t see Drive files on this page again', event.detail.message); }); });
diff --git a/chrome/test/data/webui/settings/chromeos/BUILD.gn b/chrome/test/data/webui/settings/chromeos/BUILD.gn index 3aa8747d..11d48e1 100644 --- a/chrome/test/data/webui/settings/chromeos/BUILD.gn +++ b/chrome/test/data/webui/settings/chromeos/BUILD.gn
@@ -246,6 +246,7 @@ "os_settings_ui/os_settings_ui_about_page_test.js", "os_settings_ui/os_settings_ui_menu_test.js", + "os_settings_ui/os_settings_ui_page_availability_test.ts", "os_settings_ui/os_settings_ui_test.ts", "os_settings_ui/os_settings_hats_ui_test.ts", "os_settings_ui/test_os_settings_hats_browser_proxy.ts",
diff --git a/chrome/test/data/webui/settings/chromeos/cups_printer_entry_tests.js b/chrome/test/data/webui/settings/chromeos/cups_printer_entry_tests.js index bc3cd7e..2bf8542 100644 --- a/chrome/test/data/webui/settings/chromeos/cups_printer_entry_tests.js +++ b/chrome/test/data/webui/settings/chromeos/cups_printer_entry_tests.js
@@ -104,7 +104,6 @@ }, printerProtocol: 'ipp', printerQueue: 'moreinfohere', - printerStatusReason: PrinterStatusReason.UNKNOWN_REASON, }, printerType: printerType, };
diff --git a/chrome/test/data/webui/settings/chromeos/cups_printer_test_utils.js b/chrome/test/data/webui/settings/chromeos/cups_printer_test_utils.js index d867858..f2cc3b99e 100644 --- a/chrome/test/data/webui/settings/chromeos/cups_printer_test_utils.js +++ b/chrome/test/data/webui/settings/chromeos/cups_printer_test_utils.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 {PrinterStatusReason} from 'chrome://os-settings/chromeos/lazy_load.js'; - /** * @param {string} printerName * @param {string} printerAddress @@ -31,7 +29,6 @@ }, printerProtocol: 'ipp', printerQueue: 'moreinfohere', - printerStatusReason: PrinterStatusReason.UNKNOWN_REASON, printServerUri: '', }; return printer; @@ -64,7 +61,6 @@ }, printerProtocol: 'ipp', printerQueue: 'moreinfohere', - printerStatusReason: PrinterStatusReason.UNKNOWN_REASON, printServerUri: '', }, printerType: printerType,
diff --git a/chrome/test/data/webui/settings/chromeos/os_privacy_page/privacy_hub_subpage_test.ts b/chrome/test/data/webui/settings/chromeos/os_privacy_page/privacy_hub_subpage_test.ts index d2da628..9c6ab48b 100644 --- a/chrome/test/data/webui/settings/chromeos/os_privacy_page/privacy_hub_subpage_test.ts +++ b/chrome/test/data/webui/settings/chromeos/os_privacy_page/privacy_hub_subpage_test.ts
@@ -5,7 +5,7 @@ import 'chrome://os-settings/chromeos/lazy_load.js'; import {MediaDevicesProxy, PrivacyHubBrowserProxyImpl, SettingsPrivacyHubSubpage} from 'chrome://os-settings/chromeos/lazy_load.js'; -import {MetricsConsentBrowserProxyImpl, OsSettingsPrivacyPageElement, Router, routes, SecureDnsMode, SettingsToggleButtonElement} from 'chrome://os-settings/chromeos/os_settings.js'; +import {MetricsConsentBrowserProxyImpl, OsSettingsPrivacyPageElement, Router, routes, SecureDnsMode, settingMojom, SettingsToggleButtonElement} from 'chrome://os-settings/chromeos/os_settings.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; import {webUIListenerCallback} from 'chrome://resources/js/cr.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.js'; @@ -35,6 +35,7 @@ showPrivacyHubPage: true, showPrivacyHubMVPPage: true, showPrivacyHubFuturePage: true, + showSpeakOnMuteDetectionPage: true, }; } case PrivacyHubVersion.Dogfood: { @@ -42,6 +43,7 @@ showPrivacyHubPage: true, showPrivacyHubMVPPage: false, showPrivacyHubFuturePage: false, + showSpeakOnMuteDetectionPage: true, }; } case PrivacyHubVersion.MVP: { @@ -49,6 +51,7 @@ showPrivacyHubPage: true, showPrivacyHubMVPPage: true, showPrivacyHubFuturePage: false, + showSpeakOnMuteDetectionPage: true, }; } default: { @@ -223,6 +226,25 @@ } }); + test('Deep link to speak-on-mute toggle on privacy hub', async () => { + const params = new URLSearchParams(); + const settingId = settingMojom.Setting.kSpeakOnMuteDetectionOnOff; + params.append('settingId', `${settingId}`); + Router.getInstance().navigateTo(routes.PRIVACY_HUB, params); + + flush(); + + const deepLinkElement = privacyHubSubpage.shadowRoot! + .querySelector('#speakonmuteDetectionToggle')! + .shadowRoot!.querySelector('cr-toggle'); + assert(deepLinkElement); + await waitAfterNextRender(deepLinkElement); + assertEquals( + deepLinkElement, getDeepActiveElement(), + `Speak-on-mute detection toggle should be focused for settingId=${ + settingId}.`); + }); + test('Camera, microphone toggle, their sublabel and their list', async () => { const getNoCameraText = () => privacyHubSubpage.shadowRoot!.querySelector('#noCamera');
diff --git a/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js b/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js index 79272c03..b35245b4 100644 --- a/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js +++ b/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js
@@ -579,6 +579,10 @@ ['OsSettingsUi', 'os_settings_ui/os_settings_ui_test.js'], ['OsSettingsUiAboutPage', 'os_settings_ui/os_settings_ui_about_page_test.js'], ['OsSettingsUiMenu', 'os_settings_ui/os_settings_ui_menu_test.js'], + [ + 'OsSettingsUiPageAvailability', + 'os_settings_ui/os_settings_ui_page_availability_test.js', + ], ['OsSettingsUiToolbar', 'os_settings_ui/os_settings_ui_toolbar_test.js'], [ 'OsSettingsUiUserActionRecorder',
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 05cc8666..12e10b3 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
@@ -44,10 +44,6 @@ /** @return {OsSettingsPageElement} */ function init() { - loadTimeData.overrideValues({ - isKerberosEnabled: true, // Simulate Kerberos enabled - }); - const element = document.createElement('os-settings-page'); element.prefs = prefElement.prefs; element.pageAvailability = createPageAvailabilityForTesting(); @@ -56,125 +52,6 @@ return element; } - suite('Basic pages', () => { - suiteSetup(() => { - Router.getInstance().navigateTo(routes.BASIC); - settingsPage = init(); - }); - - suiteTeardown(() => { - settingsPage.remove(); - CrSettingsPrefs.resetForTesting(); - Router.getInstance().resetRouteForTesting(); - }); - - const basicPages = [ - 'settings-internet-page', - 'os-settings-bluetooth-page', - 'settings-multidevice-page', - 'settings-kerberos-page', - 'os-settings-people-page', - 'settings-device-page', - 'settings-personalization-page', - 'os-settings-search-page', - 'os-settings-privacy-page', - 'os-settings-apps-page', - 'os-settings-a11y-page', - ]; - basicPages.forEach((pageName) => { - test(`${pageName} exists`, () => { - const pageElement = settingsPage.shadowRoot.querySelector(pageName); - assertTrue(!!pageElement, `Element <${pageName}> was not found.`); - }); - }); - }); - - suite('Advanced pages', () => { - suiteSetup(async () => { - Router.getInstance().navigateTo(routes.BASIC); - settingsPage = init(); - const idleRender = - settingsPage.shadowRoot.querySelector('settings-idle-load'); - await idleRender.get(); - }); - - suiteTeardown(() => { - settingsPage.remove(); - CrSettingsPrefs.resetForTesting(); - Router.getInstance().resetRouteForTesting(); - }); - - const advancedPages = [ - 'settings-date-time-page', - 'os-settings-languages-section', - 'os-settings-files-page', - 'os-settings-printing-page', - 'settings-crostini-page', - 'os-settings-reset-page', - ]; - advancedPages.forEach((pageName) => { - test(`${pageName} exists`, () => { - const pageElement = settingsPage.shadowRoot.querySelector(pageName); - assertTrue(!!pageElement, `Element <${pageName}> was not found.`); - }); - }); - }); - - suite('In Guest mode', () => { - suiteSetup(async () => { - Router.getInstance().navigateTo(routes.BASIC); - loadTimeData.overrideValues({isGuest: true}); - settingsPage = init(); - - const idleRender = - settingsPage.shadowRoot.querySelector('settings-idle-load'); - await idleRender.get(); - }); - - suiteTeardown(() => { - settingsPage.remove(); - CrSettingsPrefs.resetForTesting(); - Router.getInstance().resetRouteForTesting(); - }); - - const visiblePages = [ - 'settings-internet-page', - 'os-settings-bluetooth-page', - 'settings-kerberos-page', - 'settings-device-page', - 'os-settings-search-page', - 'os-settings-privacy-page', - 'os-settings-apps-page', - 'os-settings-a11y-page', - 'settings-date-time-page', - 'os-settings-languages-section', - 'os-settings-printing-page', - 'settings-crostini-page', - 'os-settings-reset-page', - ]; - visiblePages.forEach((pageName) => { - test(`${pageName} should exist`, () => { - const pageElement = settingsPage.shadowRoot.querySelector(pageName); - assertTrue( - !!pageElement, `Element <${pageName}> should exist in Guest mode.`); - }); - }); - - const hiddenPages = [ - 'settings-multidevice-page', - 'os-settings-people-page', - 'settings-personalization-page', - 'os-settings-files-page', - ]; - hiddenPages.forEach((pageName) => { - test(`${pageName} should not exist`, () => { - const pageElement = settingsPage.shadowRoot.querySelector(pageName); - assertEquals( - null, pageElement, - `Element <${pageName}> should not exist in Guest mode.`); - }); - }); - }); suite('Page availability', () => { suiteSetup(async () => { @@ -192,14 +69,79 @@ Router.getInstance().resetRouteForTesting(); }); - [{ - pageName: 'osReset', - elementName: 'os-settings-reset-page', - }, - { - pageName: 'kerberos', - elementName: 'settings-kerberos-page', - }].forEach(({pageName, elementName}) => { + [ + // Basic pages + { + pageName: 'internet', + elementName: 'settings-internet-page', + }, + { + pageName: 'bluetooth', + elementName: 'os-settings-bluetooth-page', + }, + { + pageName: 'multidevice', + elementName: 'settings-multidevice-page', + }, + { + pageName: 'kerberos', + elementName: 'settings-kerberos-page', + }, + { + pageName: 'osPeople', + elementName: 'os-settings-people-page', + }, + { + pageName: 'device', + elementName: 'settings-device-page', + }, + { + pageName: 'personalization', + elementName: 'settings-personalization-page', + }, + { + pageName: 'osSearch', + elementName: 'os-settings-search-page', + }, + { + pageName: 'osPrivacy', + elementName: 'os-settings-privacy-page', + }, + { + pageName: 'apps', + elementName: 'os-settings-apps-page', + }, + { + pageName: 'osAccessibility', + elementName: 'os-settings-a11y-page', + }, + + // Advanced section pages + { + pageName: 'dateTime', + elementName: 'settings-date-time-page', + }, + { + pageName: 'osLanguages', + elementName: 'os-settings-languages-section', + }, + { + pageName: 'files', + elementName: 'os-settings-files-page', + }, + { + pageName: 'osPrinting', + elementName: 'os-settings-printing-page', + }, + { + pageName: 'crostini', + elementName: 'settings-crostini-page', + }, + { + pageName: 'osReset', + elementName: 'os-settings-reset-page', + }, + ].forEach(({pageName, elementName}) => { test(`${pageName} page is controlled by pageAvailability`, () => { // Make page available settingsPage.pageAvailability = {
diff --git a/chrome/test/data/webui/settings/chromeos/os_settings_ui/os_settings_ui_page_availability_test.ts b/chrome/test/data/webui/settings/chromeos/os_settings_ui/os_settings_ui_page_availability_test.ts new file mode 100644 index 0000000..ad5d386 --- /dev/null +++ b/chrome/test/data/webui/settings/chromeos/os_settings_ui/os_settings_ui_page_availability_test.ts
@@ -0,0 +1,182 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * @fileoverview + * Suite of tests for page availability in the CrOS Settings UI. + * Separated into a separate file to mitigate test timeouts. + */ + +import {CrSettingsPrefs, OsSettingsMainElement, OsSettingsPageElement, OsSettingsSectionElement, OsSettingsUiElement} from 'chrome://os-settings/chromeos/os_settings.js'; +import {assert} from 'chrome://resources/js/assert_ts.js'; +import {loadTimeData} from 'chrome://resources/js/load_time_data.js'; +import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {assertEquals, assertGT, assertTrue} from 'chrome://webui-test/chai_assert.js'; + +suite('<os-settings-ui> page availability', () => { + let ui: OsSettingsUiElement; + let settingsMain: OsSettingsMainElement; + let settingsPage: OsSettingsPageElement; + + async function createUi() { + ui = document.createElement('os-settings-ui'); + document.body.appendChild(ui); + flush(); + + await CrSettingsPrefs.initialized; + const mainElement = ui.shadowRoot!.querySelector('os-settings-main'); + assert(mainElement); + settingsMain = mainElement; + + const pageElement = + settingsMain.shadowRoot!.querySelector('os-settings-page'); + assert(pageElement); + settingsPage = pageElement; + + const idleRender = + settingsPage.shadowRoot!.querySelector('settings-idle-load'); + assert(idleRender); + await idleRender.get(); + flush(); + } + + /** + * Verifies the section has a visible #main element and that any possible + * sub-pages are hidden. + */ + function verifySubpagesHidden(section: OsSettingsSectionElement): void { + // Check if there are any sub-pages to verify, being careful to filter out + // any dom-if and template noise when we search. + const pages = section.firstElementChild!.shadowRoot!.querySelector( + 'settings-animated-pages'); + if (!pages) { + return; + } + + const children = + pages.shadowRoot!.querySelector('slot')!.assignedNodes({flatten: true}) + .filter(n => n.nodeType === Node.ELEMENT_NODE) as HTMLElement[]; + + const stampedChildren = children.filter(function(element) { + return element.tagName !== 'TEMPLATE'; + }); + + // The section's main child should be stamped and visible. + const main = stampedChildren.filter(function(element) { + return element.getAttribute('route-path') === 'default'; + }); + assertEquals( + 1, main.length, + 'default card not found for section ' + section.section); + assertGT(main[0]!.offsetHeight, 0); + + // Any other stamped subpages should not be visible. + const subpages = stampedChildren.filter(function(element) { + return element.getAttribute('route-path') !== 'default'; + }); + for (const subpage of subpages) { + assertEquals( + 0, subpage.offsetHeight, + 'Expected subpage #' + subpage.id + ' in ' + section.section + + ' not to be visible.'); + } + } + + suite('For normal user', () => { + suiteSetup(async () => { + loadTimeData.overrideValues({ + isGuest: false, // Default to normal user + isKerberosEnabled: true, // Simulate kerberos page available + allowPowerwash: true, // Simulate reset page available + }); + await createUi(); + }); + + suiteTeardown(() => { + ui.remove(); + }); + + const availablePages = [ + 'apps', + 'bluetooth', + 'crostini', + 'dateTime', + 'device', + 'files', + 'internet', + 'kerberos', + 'multidevice', + 'osAccessibility', + 'osLanguages', + 'osPeople', + 'osPrinting', + 'osPrivacy', + 'osReset', + 'osSearch', + 'personalization', + ]; + for (const name of availablePages) { + test(`${name} page should be stamped and subpages hidden`, () => { + const section = + settingsPage.shadowRoot!.querySelector<OsSettingsSectionElement>( + `os-settings-section[section=${name}]`); + assertTrue(!!section, `Expected to find ${name} page stamped`); + verifySubpagesHidden(section); + }); + } + }); + + suite('For guest user', () => { + suiteSetup(async () => { + loadTimeData.overrideValues({ + isGuest: true, // Simulate guest mode + isKerberosEnabled: true, // Simulate kerberos page available + allowPowerwash: true, // Simulate reset page available + }); + await createUi(); + }); + + suiteTeardown(() => { + ui.remove(); + }); + + const unavailablePages = [ + 'files', + 'multidevice', + 'osPeople', + 'personalization', + ]; + for (const name of unavailablePages) { + test(`${name} page should not be stamped`, () => { + const section = + settingsPage.shadowRoot!.querySelector<OsSettingsSectionElement>( + `os-settings-section[section=${name}]`); + assertEquals(null, section, `Found unexpected page ${name}`); + }); + } + + const availablePages = [ + 'apps', + 'bluetooth', + 'dateTime', + 'device', + 'internet', + 'kerberos', + 'osAccessibility', + 'osLanguages', + 'osPrivacy', + 'osReset', + 'osSearch', + ]; + for (const name of availablePages) { + test(`${name} page should be stamped and subpages hidden`, () => { + const section = + settingsPage.shadowRoot!.querySelector<OsSettingsSectionElement>( + `os-settings-section[section=${name}]`); + assertTrue(!!section, `Expected to find ${name} page stamped`); + verifySubpagesHidden(section); + }); + } + }); +});
diff --git a/chrome/test/data/webui/settings/chromeos/os_settings_ui/os_settings_ui_test.ts b/chrome/test/data/webui/settings/chromeos/os_settings_ui/os_settings_ui_test.ts index a47339d..c793b01 100644 --- a/chrome/test/data/webui/settings/chromeos/os_settings_ui/os_settings_ui_test.ts +++ b/chrome/test/data/webui/settings/chromeos/os_settings_ui/os_settings_ui_test.ts
@@ -2,13 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {CrSettingsPrefs, OsSettingsMainElement, OsSettingsPageElement, OsSettingsSectionElement, OsSettingsUiElement} from 'chrome://os-settings/chromeos/os_settings.js'; +import {CrSettingsPrefs, OsSettingsMainElement, OsSettingsPageElement, OsSettingsUiElement} from 'chrome://os-settings/chromeos/os_settings.js'; import {CrDrawerElement} from 'chrome://resources/cr_elements/cr_drawer/cr_drawer.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; -import {loadTimeData} from 'chrome://resources/js/load_time_data.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {assertEquals, assertFalse, assertGT, assertTrue} from 'chrome://webui-test/chai_assert.js'; -import {flushTasks} from 'chrome://webui-test/polymer_test_util.js'; +import {assertEquals, assertFalse, assertTrue} from 'chrome://webui-test/chai_assert.js'; import {eventToPromise} from 'chrome://webui-test/test_util.js'; /** @fileoverview Suite of tests for the OS Settings ui and main page. */ @@ -20,10 +18,6 @@ suiteSetup(async function() { document.body.innerHTML = ''; - loadTimeData.overrideValues({ - isKerberosEnabled: true, // Simulate Kerberos enabled - }); - ui = document.createElement('os-settings-ui'); document.body.appendChild(ui); flush(); @@ -42,134 +36,6 @@ flush(); }); - /** - * Verifies the section has a visible #main element and that any possible - * sub-pages are hidden. - */ - function verifySubpagesHidden(section: OsSettingsSectionElement): void { - // Check if there are any sub-pages to verify, being careful to filter out - // any dom-if and template noise when we search. - const pages = section.firstElementChild!.shadowRoot!.querySelector( - 'settings-animated-pages'); - if (!pages) { - return; - } - - const children = - pages.shadowRoot!.querySelector('slot')!.assignedNodes({flatten: true}) - .filter(n => n.nodeType === Node.ELEMENT_NODE) as HTMLElement[]; - - const stampedChildren = children.filter(function(element) { - return element.tagName !== 'TEMPLATE'; - }); - - // The section's main child should be stamped and visible. - const main = stampedChildren.filter(function(element) { - return element.getAttribute('route-path') === 'default'; - }); - assertEquals( - 1, main.length, - 'default card not found for section ' + section.section); - assertGT(main[0]!.offsetHeight, 0); - - // Any other stamped subpages should not be visible. - const subpages = stampedChildren.filter(function(element) { - return element.getAttribute('route-path') !== 'default'; - }); - for (const subpage of subpages) { - assertEquals( - 0, subpage.offsetHeight, - 'Expected subpage #' + subpage.id + ' in ' + section.section + - ' not to be visible.'); - } - } - - test('Basic sections', function() { - const sectionNames = [ - 'internet', - 'bluetooth', - 'multidevice', - 'osPeople', - 'kerberos', - 'device', - 'personalization', - 'osSearch', - 'apps', - ]; - - for (const name of sectionNames) { - const section = - settingsPage!.shadowRoot!.querySelector<OsSettingsSectionElement>( - `os-settings-section[section=${name}]`); - assertTrue(!!section, 'Did not find ' + name); - verifySubpagesHidden(section); - } - }); - - test('AdvancedSections', async function() { - // Open the Advanced section. - assert(settingsMain); - settingsMain.advancedToggleExpanded = true; - flush(); - await flushTasks(); - - const sectionNames = [ - 'osPrivacy', - 'osLanguages', - 'files', - 'osReset', - 'dateTime', - 'osAccessibility', - ]; - - for (const name of sectionNames) { - const section = - settingsPage!.shadowRoot!.querySelector<OsSettingsSectionElement>( - `os-settings-section[section=${name}]`); - assertTrue(!!section, 'Did not find ' + name); - verifySubpagesHidden(section); - } - }); - - test('Guest mode', async function() { - // Simulate guest mode. - settingsPage!.set('isGuestMode_', true); - - // Ensure Advanced is open. - settingsMain!.advancedToggleExpanded = true; - flush(); - await flushTasks(); - - const hiddenSections = ['multidevice', 'osPeople', 'personalization']; - for (const name of hiddenSections) { - const section = - settingsPage!.shadowRoot!.querySelector<OsSettingsSectionElement>( - `os-settings-section[section=${name}]`); - assertEquals(null, section, 'Found unexpected section ' + name); - } - - const visibleSections = [ - 'internet', - 'bluetooth', - 'kerberos', - 'device', - 'osSearch', - 'apps', - 'osPrivacy', - 'osLanguages', - 'files', - 'osReset', - 'dateTime', - 'osAccessibility', - ]; - for (const name of visibleSections) { - const section = - settingsPage!.shadowRoot!.querySelector<OsSettingsSectionElement>( - `os-settings-section[section=${name}]`); - assertTrue(!!section, 'Expected section ' + name); - } - }); - test('Update required end of life banner visibility', function() { flush(); assert(settingsPage);
diff --git a/chrome/test/enterprise/e2e/connector/common/device_trust_ui_test.py b/chrome/test/enterprise/e2e/connector/common/device_trust_ui_test.py index c72c717..7e1a2544 100644 --- a/chrome/test/enterprise/e2e/connector/common/device_trust_ui_test.py +++ b/chrome/test/enterprise/e2e/connector/common/device_trust_ui_test.py
@@ -3,20 +3,13 @@ # found in the LICENSE file. import json -import os import re -import socket -import sys import time import traceback -from typing import Dict, List, Optional, Set from absl import app from absl import flags from absl import logging -from attr import asdict -from attr import define -from attr import Factory from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import StaleElementReferenceException @@ -25,7 +18,8 @@ from test_util import getElementFromShadowRoot from test_util import getElementsFromShadowRoot from test_util import shutdown_chrome -import win32clipboard + +from histogram.util import poll_histogram FLAGS = flags.FLAGS @@ -39,265 +33,6 @@ SuccessValue = 9 -@define -class HistogramDataBucket: - """Maps to the json:"buckets" values inside HistogramData. - - This class allows for the parsing of the "buckets" json response when using - histogram collection in Chrome. For more information on histogram collection, - see http://shortn/_Oar7S8pRLF. - - Attributes: - count: The "count" value in the nested "buckets" json object of the json - response. Defaults to None. - high: The "high" value in the nested "buckets" json object of the json - response. Defaults to None. - low: The "low" value in the nested "buckets" json object of the json - response. Defaults to None. - """ - count: int = None - high: int = None - low: int = None - - def __bool__(self): - return bool(self.count or self.high or self.low) - - -@define -class HistogramDataParams: - """Maps to the json:"params" inside HistogramData. - - This class allows for the parsing of the "params" within the json response - provided when using histogram collection in Chrome. For more information on - histogram collection, see http://shortn/_Oar7S8pRLF. - - Attributes: - bucket_count: The "bucket_count" value in the nested "params" json of the - json response. Defaults to None. - max_value: The "max" value in the nested "params" json of the json response. - Defaults to None. - min_value: The "min" value in the nested "params" json of the json response. - Defaults to None. - data_type: The "type" value in the nested "params" json of the json - response. Defaults to None. - """ - bucket_count: float = None - max_value: float = None - min_value: float = None - data_type: str = None - - def __bool__(self): - return bool(self.bucket_count or self.max_value or self.min_value or - self.data_type) - - -@define -class HistogramData: - """Maps to the json string schema from histogram. - - This class allows for the parsing of the json response provided when using - histogram collection in Chrome. For more information on histogram collection, - see http://shortn/_Oar7S8pRLF. All values default to None in the case of a - partial json response. - - Attributes: - buckets: The "buckets" value of the json response. Defaults to None. - count: The "count" value of the json response. Defaults to None. - flags: The "flags" value of the json response. Defaults to None. - name: The "name" value of the json response. Defaults to None. - params: The "params" value of the json response. Defaults to None. - pid: The "pid" value of the json response. Defaults to None. - sum_value: The "sum" value of the json response. Defaults to None. - """ - buckets: List[HistogramDataBucket] = Factory(list) - count: float = 0.0 - flags: float = None - name: str = None - params: HistogramDataParams = None - pid: float = None - sum_value: float = None - values: Set[int] = Factory(set) - - def isValuePresent(self, value: int) -> bool: - return value in self.values - - -def parse(response: str) -> HistogramData: - """Parses a Chrome histogram response json string into a HistogramData object. - - Args: - response: A string representation for the json response from a call to - statsCollectionController.getBrowserHistogram. - - Returns: - A HistogramData object represented the json response. - - Raises: - BaseException: If the json response isn't able to be parsed into a - HistogramData object. - """ - d = json.loads(response) - buckets_list = d["buckets"] if "buckets" in d else [] - buckets = [ - HistogramDataBucket(b["count"], b["high"], b["low"]) for b in buckets_list - ] if buckets_list else None - count = d["count"] if "count" in d else None - flags = d["flags"] if "flags" in d else None - name = d["name"] if "name" in d else None - p = d["params"] if "params" in d else None - params = HistogramDataParams( - p["bucket_count"] if "bucket_count" in p else 0.0, - p["max"] if "max" in p else -1, p["min"] if "min" in p else -1, - p["type"] if "type" in p else None) if p else None - pid = d["pid"] if "pid" in d else None - s = d["sum"] if "sum" in d else None - return HistogramData(buckets, count, flags, name, params, pid, s) - - -def add(val1: Optional[float], val2: Optional[float]) -> Optional[float]: - if not val1 or not val2: - return val2 if not val1 else val1 - return val1 + val2 - - -def to_int(val: Optional[float]) -> int: - """Returns a rounded up integer from a byte string.""" - if not val: - return 0 - return int(float(str(val))) - - -def merge_histograms(hd1: Optional[HistogramData], - hd2: Optional[HistogramData]) -> Optional[HistogramData]: - """Merges two histograms by summing corresponding values. - - Args: - hd1: A HistogramData object to be merged. - hd2: A HistogramData object to be merged. - - Returns: - A HistogramData object in which all corresponding values are added. - """ - if not hd1 or not hd2: - return hd2 if not hd1 else hd1 - - logging.info(f'hd1={hd1}, hd2={hd2}') - hd1.count = add(hd1.count, hd2.count) - hd1.sum_value = add(hd1.sum_value, hd2.sum_value) - # Add both sum_value to values to allow query for present query - # sum_value is byte format, and it is like b'9.0' - try: - hd1.values.add(to_int(hd1.sum_value)) - hd1.values.add(to_int(hd2.sum_value)) - except e: - logging.warning( - f'fail to add {hd1.sum_value}, {hd2.sum_value}. err: {str(e)}') - - if not hd2.buckets: - return hd1 - - for b2 in hd2.buckets: - found = False - for i, b1 in enumerate(hd1.buckets): - if b2.low == b1.low and b2.high == b1.high: - hd1.buckets[i].count += b2.count - found = True - - if not found: - hd1.buckets.append(b2) - - return hd1 - - -def histogram(cd: webdriver.chrome.webdriver.WebDriver, - name: str, - timeout: int = 30) -> Optional[HistogramData]: - """Queries a particular histogram from Chrome and formats the response. - - The ChromeDriver instance provided is used to execute javascript in browser, - generating a histogram as a json response. The response is then parsed - and processed, ultimately returned as a HistogramData object. For more - information on histogram collection, see http://shortn/_Oar7S8pRLF. - - Args: - cd: A selenium.webdriver.chrome.webdriver.WebDriver instance. - name: The name of the histogram to search for. - timeout: The timeout for the script execution in seconds. Defaults to 30. - - Returns: - A HistogramData object parsed from the json response. - - Raises: - BaseException: When either histogram request returns an empty response. - """ - resp_str = execute_script( - cd, "return statsCollectionController.getBrowserHistogram('%s');" % name, - timeout) - if not resp_str: - raise BaseException("Could not get histogram with %s" % name) - - hd1 = parse(resp_str) - - # Fetch renderer histograms as well - resp_str = execute_script( - cd, "return statsCollectionController.getHistogram('%s');" % name) - if not resp_str: - raise ValueError("Could not get second histogram with %s" % name) - hd2 = parse(resp_str) - return merge_histograms(hd1, hd2) - - -def execute_script(cd: webdriver.chrome.webdriver.WebDriver, - script: str, - timeout: int = 30) -> str: - """Executes javascript in browser through ChromeDriver. - - Args: - cd: A selenium.webdriver.chrome.webdriver.WebDriver instance. - script: The script to run in the form of a string. - timeout: The timeout to update the socket to. Defaults to 30 seconds to - ensure adequate time for the javascript response. - - Returns: - A str of the response data from executing the script. - """ - default_timeout = socket.getdefaulttimeout() - socket.setdefaulttimeout(timeout) - logging.log(logging.DEBUG, "Set socket timeout to %s seconds", timeout) - - script_result = cd.execute_script(script) - logging.log(logging.DEBUG, "Executed Javascript in browser: %s", script) - - socket.setdefaulttimeout(default_timeout) - logging.log(logging.DEBUG, "Set socket timeout to default: %s", - default_timeout) - return script_result - - -def poll_histogram(cd: webdriver.chrome.webdriver.WebDriver, - names: List[str], - timeout: int = 30) -> Optional[Dict[str, HistogramData]]: - """Polls the histograms and returns the list of non-empty histogram. - - Args: - cd: A selenium.webdriver.chrome.webdriver.WebDriver instance. - names: The names of the histograms to fetch. - timeout: The timeout for each histogram fetch request in seconds. Defaults - to 30. - - Returns: - A dict of HistogramData object of the matched histogram. - """ - hgs = None - for name in names: - hg = histogram(cd, name, timeout) - if not hgs: - hgs = {} - hgs[name] = asdict(hg) - - return hgs - - def save_screenshot(driver: webdriver.Chrome, path: str) -> None: original_size = driver.get_window_size() required_width = driver.execute_script( @@ -339,10 +74,13 @@ driver.get(PolicyURL) WebDriverWait(driver=driver, timeout=10) count += 1 - # Avoid to click `Reload-policies` button because it force a entire - # redownload of all policies. it is going to be very slow. - # driver.find_element_by_xpath('//*[@id="reload-policies"]').click() - # WebDriverWait(driver=driver, timeout=10) + # Only click `Reload-policies` button on the key_creation because + # a newly enrolled Chrome does not have policies cached. The button + # triggers a policy refetch which is needed. + # For the key_load, the policies are fetched from disk. + if test_case == 'key_creation': + driver.find_element_by_xpath('//*[@id="reload-policies"]').click() + WebDriverWait(driver=driver, timeout=30) policy_table = driver.find_element_by_css_selector('policy-table') row_groups = getElementsFromShadowRoot(driver, policy_table, '.policy-data') @@ -424,29 +162,23 @@ '#copy-signals').click() ci_signals = '' + # *[@id="device-trust-connector"]/device-trust-connector//div[3] + # or 'div:nth-child(5)' + # or #signals + content = getElementFromShadowRoot(driver, device_trust_connector, + '#signals').text + # trim off 'Signals: {...} Copy Signals + content = content.replace('Signals:', '') + content = content.replace('Copy Signals', '') try: - win32clipboard.OpenClipboard() - content = win32clipboard.GetClipboardData(win32clipboard.CF_HDROP) ci_signals = json.loads(content) - win32clipboard.CloseClipboard() - except: - logging.info('Exception happen when read via win32clipboard. Skip') - - if not ci_signals: - # win32clipboard is not very reliable, apply alternate approach - signals = {} - content = getElementFromShadowRoot(driver, device_trust_connector, - 'div:nth-child(5)').text - logging.info(content) - # trim off 'Signals: {...} Copy Signals - content = content.replace('Signals:', '') - content = content.replace('Copy Signals', '') - ci_signals = json.loads(content) + except json.decoder.JSONDecodeError: + logging.info('content retrieved: %s', content) + ci_signals = content logging.info('signals: %s' % ci_signals) result['ConnectorsInternalsSignals'] = ci_signals - # Step 3: navigate to fake IdP homepage logging.info(f'fake_idp:{idp_url}') result['FakeIdP'] = idp_url
diff --git a/chrome/test/enterprise/e2e/connector/common/histogram/__init__.py b/chrome/test/enterprise/e2e/connector/common/histogram/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/chrome/test/enterprise/e2e/connector/common/histogram/__init__.py
diff --git a/chrome/test/enterprise/e2e/connector/common/histogram/util.py b/chrome/test/enterprise/e2e/connector/common/histogram/util.py new file mode 100644 index 0000000..3fe3273 --- /dev/null +++ b/chrome/test/enterprise/e2e/connector/common/histogram/util.py
@@ -0,0 +1,272 @@ +# Copyright 2023 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import json +import socket +from typing import Dict, List, Optional, Set + +from absl import logging +from attr import asdict +from attr import define +from attr import Factory +from selenium import webdriver + + +@define +class HistogramDataBucket: + """Maps to the json:"buckets" values inside HistogramData. + + This class allows for the parsing of the "buckets" json response when using + histogram collection in Chrome. For more information on histogram collection, + see http://shortn/_Oar7S8pRLF. + + Attributes: + count: The "count" value in the nested "buckets" json object of the json + response. Defaults to None. + high: The "high" value in the nested "buckets" json object of the json + response. Defaults to None. + low: The "low" value in the nested "buckets" json object of the json + response. Defaults to None. + """ + count: int = None + high: int = None + low: int = None + + def __bool__(self): + return bool(self.count or self.high or self.low) + + +@define +class HistogramDataParams: + """Maps to the json:"params" inside HistogramData. + + This class allows for the parsing of the "params" within the json response + provided when using histogram collection in Chrome. For more information on + histogram collection, see http://shortn/_Oar7S8pRLF. + + Attributes: + bucket_count: The "bucket_count" value in the nested "params" json of the + json response. Defaults to None. + max_value: The "max" value in the nested "params" json of the json response. + Defaults to None. + min_value: The "min" value in the nested "params" json of the json response. + Defaults to None. + data_type: The "type" value in the nested "params" json of the json + response. Defaults to None. + """ + bucket_count: float = None + max_value: float = None + min_value: float = None + data_type: str = None + + def __bool__(self): + return bool(self.bucket_count or self.max_value or self.min_value or + self.data_type) + + +@define +class HistogramData: + """Maps to the json string schema from histogram. + + This class allows for the parsing of the json response provided when using + histogram collection in Chrome. For more information on histogram collection, + see http://shortn/_Oar7S8pRLF. All values default to None in the case of a + partial json response. + + Attributes: + buckets: The "buckets" value of the json response. Defaults to None. + count: The "count" value of the json response. Defaults to None. + flags: The "flags" value of the json response. Defaults to None. + name: The "name" value of the json response. Defaults to None. + params: The "params" value of the json response. Defaults to None. + pid: The "pid" value of the json response. Defaults to None. + sum_value: The "sum" value of the json response. Defaults to None. + """ + buckets: List[HistogramDataBucket] = Factory(list) + count: float = 0.0 + flags: float = None + name: str = None + params: HistogramDataParams = None + pid: float = None + sum_value: float = None + values: Set[int] = Factory(set) + + def isValuePresent(self, value: int) -> bool: + return value in self.values + + +def parse(response: str) -> HistogramData: + """Parses a Chrome histogram response json string into a HistogramData object. + + Args: + response: A string representation for the json response from a call to + statsCollectionController.getBrowserHistogram. + + Returns: + A HistogramData object represented the json response. + + Raises: + BaseException: If the json response isn't able to be parsed into a + HistogramData object. + """ + d = json.loads(response) + buckets_list = d["buckets"] if "buckets" in d else [] + buckets = [ + HistogramDataBucket(b["count"], b["high"], b["low"]) for b in buckets_list + ] if buckets_list else None + count = d["count"] if "count" in d else None + flags = d["flags"] if "flags" in d else None + name = d["name"] if "name" in d else None + p = d["params"] if "params" in d else None + params = HistogramDataParams( + p["bucket_count"] if "bucket_count" in p else 0.0, + p["max"] if "max" in p else -1, p["min"] if "min" in p else -1, + p["type"] if "type" in p else None) if p else None + pid = d["pid"] if "pid" in d else None + s = d["sum"] if "sum" in d else None + return HistogramData(buckets, count, flags, name, params, pid, s) + + +def add(val1: Optional[float], val2: Optional[float]) -> Optional[float]: + if not val1 or not val2: + return val2 if not val1 else val1 + return val1 + val2 + + +def to_int(val: Optional[float]) -> int: + """Returns a rounded up integer from a byte string.""" + if not val: + return 0 + return int(float(str(val))) + + +def merge_histograms(hd1: Optional[HistogramData], + hd2: Optional[HistogramData]) -> Optional[HistogramData]: + """Merges two histograms by summing corresponding values. + + Args: + hd1: A HistogramData object to be merged. + hd2: A HistogramData object to be merged. + + Returns: + A HistogramData object in which all corresponding values are added. + """ + if not hd1 or not hd2: + return hd2 if not hd1 else hd1 + + logging.info(f'hd1={hd1}, hd2={hd2}') + hd1.count = add(hd1.count, hd2.count) + hd1.sum_value = add(hd1.sum_value, hd2.sum_value) + # Add both sum_value to values to allow query for present query + # sum_value is byte format, and it is like b'9.0' + try: + hd1.values.add(to_int(hd1.sum_value)) + hd1.values.add(to_int(hd2.sum_value)) + except e: + logging.warning( + f'fail to add {hd1.sum_value}, {hd2.sum_value}. err: {str(e)}') + + if not hd2.buckets: + return hd1 + + for b2 in hd2.buckets: + found = False + for i, b1 in enumerate(hd1.buckets): + if b2.low == b1.low and b2.high == b1.high: + hd1.buckets[i].count += b2.count + found = True + + if not found: + hd1.buckets.append(b2) + + return hd1 + + +def histogram(cd: webdriver.chrome.webdriver.WebDriver, + name: str, + timeout: int = 30) -> Optional[HistogramData]: + """Queries a particular histogram from Chrome and formats the response. + + The ChromeDriver instance provided is used to execute javascript in browser, + generating a histogram as a json response. The response is then parsed + and processed, ultimately returned as a HistogramData object. For more + information on histogram collection, see http://shortn/_Oar7S8pRLF. + + Args: + cd: A selenium.webdriver.chrome.webdriver.WebDriver instance. + name: The name of the histogram to search for. + timeout: The timeout for the script execution in seconds. Defaults to 30. + + Returns: + A HistogramData object parsed from the json response. + + Raises: + BaseException: When either histogram request returns an empty response. + """ + resp_str = execute_script( + cd, "return statsCollectionController.getBrowserHistogram('%s');" % name, + timeout) + if not resp_str: + raise BaseException("Could not get histogram with %s" % name) + + hd1 = parse(resp_str) + + # Fetch renderer histograms as well + resp_str = execute_script( + cd, "return statsCollectionController.getHistogram('%s');" % name) + if not resp_str: + raise ValueError("Could not get second histogram with %s" % name) + hd2 = parse(resp_str) + return merge_histograms(hd1, hd2) + + +def execute_script(cd: webdriver.chrome.webdriver.WebDriver, + script: str, + timeout: int = 30) -> str: + """Executes javascript in browser through ChromeDriver. + + Args: + cd: A selenium.webdriver.chrome.webdriver.WebDriver instance. + script: The script to run in the form of a string. + timeout: The timeout to update the socket to. Defaults to 30 seconds to + ensure adequate time for the javascript response. + + Returns: + A str of the response data from executing the script. + """ + default_timeout = socket.getdefaulttimeout() + socket.setdefaulttimeout(timeout) + logging.log(logging.DEBUG, "Set socket timeout to %s seconds", timeout) + + script_result = cd.execute_script(script) + logging.log(logging.DEBUG, "Executed Javascript in browser: %s", script) + + socket.setdefaulttimeout(default_timeout) + logging.log(logging.DEBUG, "Set socket timeout to default: %s", + default_timeout) + return script_result + + +def poll_histogram(cd: webdriver.chrome.webdriver.WebDriver, + names: List[str], + timeout: int = 30) -> Optional[Dict[str, HistogramData]]: + """Polls the histograms and returns the list of non-empty histogram. + + Args: + cd: A selenium.webdriver.chrome.webdriver.WebDriver instance. + names: The names of the histograms to fetch. + timeout: The timeout for each histogram fetch request in seconds. Defaults + to 30. + + Returns: + A dict of HistogramData object of the matched histogram. + """ + hgs = None + for name in names: + hg = histogram(cd, name, timeout) + if not hgs: + hgs = {} + hgs[name] = asdict(hg) + + return hgs
diff --git a/chrome/test/enterprise/e2e/connector/device_trust_connector/device_trust_connector_windows_enrollment_test.py b/chrome/test/enterprise/e2e/connector/device_trust_connector/device_trust_connector_windows_enrollment_test.py index 4be4095..1f7db8f 100644 --- a/chrome/test/enterprise/e2e/connector/device_trust_connector/device_trust_connector_windows_enrollment_test.py +++ b/chrome/test/enterprise/e2e/connector/device_trust_connector/device_trust_connector_windows_enrollment_test.py
@@ -56,6 +56,7 @@ # Schedule to run device_trust_ui_test on GCP VM machines commonDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + self.EnableHistogramSupport(self.win_config['client'], commonDir) output = self.RunUITest( self.win_config['client'], os.path.join(commonDir, 'common', 'device_trust_ui_test.py'),
diff --git a/chrome/test/enterprise/e2e/infra/chrome_ent_test_case.py b/chrome/test/enterprise/e2e/infra/chrome_ent_test_case.py index 232651d0..3302110d 100644 --- a/chrome/test/enterprise/e2e/infra/chrome_ent_test_case.py +++ b/chrome/test/enterprise/e2e/infra/chrome_ent_test_case.py
@@ -4,6 +4,7 @@ import logging import os +from posixpath import join import random import string import subprocess @@ -235,6 +236,27 @@ args) return self.RunCommand(instance_name, cmd).decode() + def EnableHistogramSupport(self, instance_name, base_path): + """Enable histogram package support on an instance. + + Note that base_path is the path to chrome/test/enterprise/e2e/connector. + + Args: + instance_name: name of the instance. + base_path: the base path of the test in the chromium_src. + """ + dest_path = join('c:', 'temp', 'histogram') + cmd = r'New-Item -ItemType Directory -Force -Path ' + dest_path + self.clients[instance_name].RunPowershell(cmd) + + self.UploadFile( + self.win_config['client'], + os.path.join(base_path, 'common', 'histogram', '__init__.py'), + dest_path) + self.UploadFile(self.win_config['client'], + os.path.join(base_path, 'common', 'histogram', 'util.py'), + dest_path) + def RunUITest(self, instance_name, test_file, timeout=300, args=[]): """Runs a UI test on an instance.
diff --git a/chrome/updater/configurator.cc b/chrome/updater/configurator.cc index ad331c4..26afea1 100644 --- a/chrome/updater/configurator.cc +++ b/chrome/updater/configurator.cc
@@ -129,7 +129,7 @@ } std::string Configurator::GetOSLongName() const { - return version_info::GetOSType(); + return std::string(version_info::GetOSType()); } base::flat_map<std::string, std::string> Configurator::ExtraRequestParams()
diff --git a/chromecast/base/device_capabilities.h b/chromecast/base/device_capabilities.h index 844c320..52b12b1 100644 --- a/chromecast/base/device_capabilities.h +++ b/chromecast/base/device_capabilities.h
@@ -222,9 +222,9 @@ virtual void SetCapability(const std::string& path, base::Value proposed_value) = 0; - // Iterates through entries in |dict_value| and calls SetCapability() for - // each one. This method is asynchronous. - virtual void MergeDictionary(const base::Value& dict_value) = 0; + // Iterates through entries in |dict| and calls SetCapability() for each one. + // This method is asynchronous. + virtual void MergeDictionary(const base::Value::Dict& dict) = 0; // Adds/removes an observer. It doesn't take the ownership of |observer|. virtual void AddCapabilitiesObserver(Observer* observer) = 0;
diff --git a/chromecast/base/device_capabilities_impl.cc b/chromecast/base/device_capabilities_impl.cc index d98ee09..eb203e6 100644 --- a/chromecast/base/device_capabilities_impl.cc +++ b/chromecast/base/device_capabilities_impl.cc
@@ -277,10 +277,9 @@ SetPublicValidatedValue(path, std::move(proposed_value)); } -void DeviceCapabilitiesImpl::MergeDictionary(const base::Value& dict_value) { - DCHECK(dict_value.is_dict()); - for (const auto kv : dict_value.GetDict()) { - SetCapability(kv.first, kv.second.Clone()); +void DeviceCapabilitiesImpl::MergeDictionary(const base::Value::Dict& dict) { + for (const auto [key, value] : dict) { + SetCapability(key, value.Clone()); } }
diff --git a/chromecast/base/device_capabilities_impl.h b/chromecast/base/device_capabilities_impl.h index 6f8fb6c5..075c292 100644 --- a/chromecast/base/device_capabilities_impl.h +++ b/chromecast/base/device_capabilities_impl.h
@@ -41,7 +41,7 @@ scoped_refptr<Data> GetPublicData() const override; void SetCapability(const std::string& path, base::Value proposed_value) override; - void MergeDictionary(const base::Value& dict_value) override; + void MergeDictionary(const base::Value::Dict& dict) override; void AddCapabilitiesObserver(Observer* observer) override; void RemoveCapabilitiesObserver(Observer* observer) override;
diff --git a/chromecast/base/device_capabilities_impl_unittest.cc b/chromecast/base/device_capabilities_impl_unittest.cc index 17f667c..5a3b095 100644 --- a/chromecast/base/device_capabilities_impl_unittest.cc +++ b/chromecast/base/device_capabilities_impl_unittest.cc
@@ -583,11 +583,11 @@ EXPECT_EQ(value.GetInt(), 99); } -// Test MergeDictionary. +// Test MergeDictionary. TEST_F(DeviceCapabilitiesImplTest, MergeDictionary) { - auto deserialized_value = base::JSONReader::Read(kSampleDictionaryCapability); + absl::optional<base::Value::Dict> deserialized_value = + base::JSONReader::ReadDict(kSampleDictionaryCapability); ASSERT_TRUE(deserialized_value); - ASSERT_TRUE(deserialized_value->is_dict()); capabilities()->MergeDictionary(*deserialized_value); base::RunLoop().RunUntilIdle(); @@ -603,8 +603,8 @@ // Now just update one of the fields. Make sure the updated value is changed // in DeviceCapabilities and the other field remains untouched. - deserialized_value->GetDict().Set("dummy_field_int", 100); - ASSERT_TRUE(deserialized_value->RemoveKey("dummy_field_bool")); + deserialized_value->Set("dummy_field_int", 100); + ASSERT_TRUE(deserialized_value->Remove("dummy_field_bool")); capabilities()->MergeDictionary(*deserialized_value); base::RunLoop().RunUntilIdle();
diff --git a/chromeos/ash/components/cryptohome/auth_factor.cc b/chromeos/ash/components/cryptohome/auth_factor.cc index 7456f7c..8913d08 100644 --- a/chromeos/ash/components/cryptohome/auth_factor.cc +++ b/chromeos/ash/components/cryptohome/auth_factor.cc
@@ -34,7 +34,7 @@ // =============== `AuthFactorCommonMetadata` =============== AuthFactorCommonMetadata::AuthFactorCommonMetadata() : chrome_version_last_updated_( - ComponentVersion(version_info::GetVersionNumber())) {} + ComponentVersion(std::string(version_info::GetVersionNumber()))) {} AuthFactorCommonMetadata::AuthFactorCommonMetadata(ComponentVersion chrome, ComponentVersion chromeos)
diff --git a/chromeos/ash/components/proximity_auth/smart_lock_metrics_recorder.cc b/chromeos/ash/components/proximity_auth/smart_lock_metrics_recorder.cc index 2134ac7..8a546e9 100644 --- a/chromeos/ash/components/proximity_auth/smart_lock_metrics_recorder.cc +++ b/chromeos/ash/components/proximity_auth/smart_lock_metrics_recorder.cc
@@ -6,10 +6,6 @@ #include "base/metrics/histogram_macros.h" -SmartLockMetricsRecorder::UsageRecorder::UsageRecorder() = default; - -SmartLockMetricsRecorder::UsageRecorder::~UsageRecorder() = default; - SmartLockMetricsRecorder::SmartLockMetricsRecorder() = default; SmartLockMetricsRecorder::~SmartLockMetricsRecorder() {} @@ -57,19 +53,6 @@ } // static -void SmartLockMetricsRecorder::SetUsageRecorderInstance( - SmartLockMetricsRecorder::UsageRecorder* usage_recorder) { - SmartLockMetricsRecorder::g_usage_recorder = usage_recorder; -} - -// static void SmartLockMetricsRecorder::RecordAuthResultSuccess(bool success) { UMA_HISTOGRAM_BOOLEAN("SmartLock.AuthResult", success); - - if (SmartLockMetricsRecorder::g_usage_recorder) { - SmartLockMetricsRecorder::g_usage_recorder->RecordUsage(success); - } } - -SmartLockMetricsRecorder::UsageRecorder* - SmartLockMetricsRecorder::g_usage_recorder = nullptr;
diff --git a/chromeos/ash/components/proximity_auth/smart_lock_metrics_recorder.h b/chromeos/ash/components/proximity_auth/smart_lock_metrics_recorder.h index f1e5b7c..72c87a9 100644 --- a/chromeos/ash/components/proximity_auth/smart_lock_metrics_recorder.h +++ b/chromeos/ash/components/proximity_auth/smart_lock_metrics_recorder.h
@@ -7,22 +7,6 @@ class SmartLockMetricsRecorder { public: - // The UsageRecorder abstract class is implemented within - // SmartLockFeatureUsageMetrics to avoid a circular dependency. RecordUsage() - // is used to track Smart Lock feature usage for the Standard Feature Usage - // Logging (SFUL) framework. - class UsageRecorder { - public: - UsageRecorder(); - - UsageRecorder(const UsageRecorder&) = delete; - UsageRecorder& operator=(const UsageRecorder&) = delete; - - virtual ~UsageRecorder(); - - virtual void RecordUsage(bool success) = 0; - }; - SmartLockMetricsRecorder(); ~SmartLockMetricsRecorder(); @@ -116,17 +100,8 @@ static void RecordAuthMethodChoiceSignInPasswordState( SmartLockAuthEventPasswordState password_state); - static void SetUsageRecorderInstance(UsageRecorder* usage_recorder); - private: static void RecordAuthResultSuccess(bool success); - - // TODO(b/227674947): After deleting EasyUnlockServiceSignIn and combining - // EasyUnlockService and EasyUnlockServiceRegular into one class, delete - // g_usage_recorder and simplify our SFUL implementation. We can call - // SmartLockFeatureUsageMetrics::RecordUsage() on our SFUL instance directly - // within that combined class. - static UsageRecorder* g_usage_recorder; }; #endif // CHROMEOS_ASH_COMPONENTS_PROXIMITY_AUTH_SMART_LOCK_METRICS_RECORDER_H_
diff --git a/chromeos/ash/services/device_sync/proto/device_classifier_util.cc b/chromeos/ash/services/device_sync/proto/device_classifier_util.cc index 29687fa7..db1291e9 100644 --- a/chromeos/ash/services/device_sync/proto/device_classifier_util.cc +++ b/chromeos/ash/services/device_sync/proto/device_classifier_util.cc
@@ -36,7 +36,8 @@ classifier.set_device_software_version_code(version_components[0]); } - classifier.set_device_software_package(version_info::GetProductName()); + classifier.set_device_software_package( + std::string(version_info::GetProductName())); return classifier; }());
diff --git a/chromeos/chromeos_strings.grd b/chromeos/chromeos_strings.grd index 0cf665f..70e0140c 100644 --- a/chromeos/chromeos_strings.grd +++ b/chromeos/chromeos_strings.grd
@@ -2815,6 +2815,36 @@ <message name="IDS_PERSONALIZATION_APP_SEARCH_RESULT_DARK_MODE_SCHEDULE_ALT4" desc="Text for search result item which, when clicked, navigates the user to personalization app dark mode settings, with a dropdown to select scheduling mode. Alternate phrase for: 'Dark theme schedule', 'Dark mode schedule', 'Automatic dark mode', 'Automatic light mode'"> Automatic dark theme </message> + <message name="IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR" desc="Text for search result item, which, when clicked, navigates the user to personalization app theme setting."> + Theme + </message> + <message name="IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT1" desc="Text for search result item, which, when clicked, navigates the user to personalization app theme setting. Alternate phrase 1"> + Theme color + </message> + <message name="IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT2" desc="Text for search result item, which, when clicked, navigates the user to personalization app theme setting. Alternate phrase 2"> + Accent color + </message> + <message name="IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT3" desc="Text for search result item, which, when clicked, navigates the user to personalization app theme setting. Alternate phrase 3"> + System color + </message> + <message name="IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT4" desc="Text for search result item, which, when clicked, navigates the user to personalization app theme setting. Alternate phrase 4"> + Launcher color + </message> + <message name="IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT5" desc="Text for search result item, which, when clicked, navigates the user to personalization app theme setting. Alternate phrase 5"> + Wallpaper color + </message> + <message name="IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT6" desc="Text for search result item, which, when clicked, navigates the user to personalization app theme setting. Alternate phrase 6"> + Desktop color + </message> + <message name="IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT7" desc="Text for search result item, which, when clicked, navigates the user to personalization app theme setting. Alternate phrase 7"> + Background image + </message> + <message name="IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT8" desc="Text for search result item, which, when clicked, navigates the user to personalization app theme setting. Alternate phrase 8"> + UI color + </message> + <message name="IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT9" desc="Text for search result item, which, when clicked, navigates the user to personalization app theme setting. Alternate phrase 9"> + Interface color + </message> <message name="IDS_PERSONALIZATION_APP_SEARCH_RESULT_KEYBOARD_BACKLIGHT" desc="Text for search result item which, when clicked, navigates the user to personalization app keyboard backlight setting."> Keyboard backlight </message> @@ -4138,8 +4168,11 @@ <message name="IDS_SETTINGS_APN_ZERO_STATE_DESCRIPTION" desc="Text explaining there is no APN information to show because the network has not been attempted to be connected with, and that the user might need to add a custom APN."> You are not connected yet. If your mobile carrier recommends a custom APN, enter the APN information by selecting "+ New APN" </message> + <message name="IDS_SETTINGS_APN_DATABASE_APNS_ERROR_MESSAGE" desc="Error message displayed when a cellular network fails to connect to any database APNs due to APN-related reasons."> + Can’t connect to this network using automatically detected APNs. Contact your mobile carrier for more information. + </message> <message name="IDS_SETTINGS_APN_CUSTOM_APNS_ERROR_MESSAGE" desc="Error message displayed when a cellular network fails to connect due to APN-related reasons, informing the user that none of the enabled custom APNs were successful in being used to connect."> - Can't connect to any enabled custom APNs. Contact your mobile carrier for more information. + Can’t connect to this network using any enabled custom APNs. Contact your mobile carrier for more information. </message> <message name="IDS_SETTINGS_APN_MENU_DETAILS" desc="Details button in three dotted menu for APNs"> Details @@ -4211,7 +4244,7 @@ Automatically detected </message> <message name="IDS_SETTINGS_APN_WARNING_PROMPT_FOR_DISABLE_REMOVE" desc="Warning Prompt describing why the APN can't be disabled or removed."> - Can't disable or remove this APN. Make sure enabled attached APNs are disabled or removed. + Can't disable or remove this APN. Make sure enabled attach APNs are disabled or removed. </message> <message name="IDS_SETTINGS_APN_DIALOG_ADD" desc="Text used for adding a new APN."> Add
diff --git a/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR.png.sha1 b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR.png.sha1 new file mode 100644 index 0000000..b22b1bd --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR.png.sha1
@@ -0,0 +1 @@ +03778a9a041e242ba389940a83bf61703f2ec91b \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT1.png.sha1 b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT1.png.sha1 new file mode 100644 index 0000000..db7fb5d --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT1.png.sha1
@@ -0,0 +1 @@ +f1b92eea33055487be496d3487a8ef0d488cc08a \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT2.png.sha1 b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT2.png.sha1 new file mode 100644 index 0000000..3b622192 --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT2.png.sha1
@@ -0,0 +1 @@ +8a4afa6bfdf9c5901426c3865869d5354bc388fe \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT3.png.sha1 b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT3.png.sha1 new file mode 100644 index 0000000..2d745dcb --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT3.png.sha1
@@ -0,0 +1 @@ +43c10343b075de6512adb2c93af3617b1508a440 \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT4.png.sha1 b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT4.png.sha1 new file mode 100644 index 0000000..f18cb62 --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT4.png.sha1
@@ -0,0 +1 @@ +267ba534ba9523f38761fed9f829a0f94ddecc4f \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT5.png.sha1 b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT5.png.sha1 new file mode 100644 index 0000000..1a48d28 --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT5.png.sha1
@@ -0,0 +1 @@ +2a5e1484336a3bd75eb764cce0293dc1d2759413 \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT6.png.sha1 b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT6.png.sha1 new file mode 100644 index 0000000..c16d353 --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT6.png.sha1
@@ -0,0 +1 @@ +44809c8ba6f62efda5315a656ab52ef8e14d9e1d \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT7.png.sha1 b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT7.png.sha1 new file mode 100644 index 0000000..925777f6 --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT7.png.sha1
@@ -0,0 +1 @@ +c08e26d97e8432ba59a7a28f113285021ece8a50 \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT8.png.sha1 b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT8.png.sha1 new file mode 100644 index 0000000..6646f94a --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT8.png.sha1
@@ -0,0 +1 @@ +16c49702b58cf0f0e4ea47eecb6ed3093c3271c6 \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT9.png.sha1 b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT9.png.sha1 new file mode 100644 index 0000000..27d539bb --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_SEARCH_RESULT_DYNAMIC_COLOR_ALT9.png.sha1
@@ -0,0 +1 @@ +1a84ff27bf60166611ddbdbe28ee56156a363787 \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_SETTINGS_APN_CUSTOM_APNS_ERROR_MESSAGE.png.sha1 b/chromeos/chromeos_strings_grd/IDS_SETTINGS_APN_CUSTOM_APNS_ERROR_MESSAGE.png.sha1 index 22a0b70..5ebbf0e4 100644 --- a/chromeos/chromeos_strings_grd/IDS_SETTINGS_APN_CUSTOM_APNS_ERROR_MESSAGE.png.sha1 +++ b/chromeos/chromeos_strings_grd/IDS_SETTINGS_APN_CUSTOM_APNS_ERROR_MESSAGE.png.sha1
@@ -1 +1 @@ -581f228f9f5ef6fe35b13cccb7ba080bd0a14fc2 \ No newline at end of file +53dafb3580458cba1ab11faf54e4c045ad7f253d \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_SETTINGS_APN_DATABASE_APNS_ERROR_MESSAGE.png.sha1 b/chromeos/chromeos_strings_grd/IDS_SETTINGS_APN_DATABASE_APNS_ERROR_MESSAGE.png.sha1 new file mode 100644 index 0000000..5c45f81 --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_SETTINGS_APN_DATABASE_APNS_ERROR_MESSAGE.png.sha1
@@ -0,0 +1 @@ +b74b41570aebf0a213dbf2fdc45d7db0aaceeaeb \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_SETTINGS_APN_WARNING_PROMPT_FOR_DISABLE_REMOVE.png.sha1 b/chromeos/chromeos_strings_grd/IDS_SETTINGS_APN_WARNING_PROMPT_FOR_DISABLE_REMOVE.png.sha1 index a060c5d..a8120fdd 100644 --- a/chromeos/chromeos_strings_grd/IDS_SETTINGS_APN_WARNING_PROMPT_FOR_DISABLE_REMOVE.png.sha1 +++ b/chromeos/chromeos_strings_grd/IDS_SETTINGS_APN_WARNING_PROMPT_FOR_DISABLE_REMOVE.png.sha1
@@ -1 +1 @@ -385bbfb1e9cf944122ebe490dcf924876bde9fcd \ No newline at end of file +b39ce41e2160c0b38aa30a0a25f8774dd0ae6f33 \ No newline at end of file
diff --git a/chromeos/printing/printer_translator.cc b/chromeos/printing/printer_translator.cc index 23e8965..cd199ff3 100644 --- a/chromeos/printing/printer_translator.cc +++ b/chromeos/printing/printer_translator.cc
@@ -204,10 +204,6 @@ if (!printer.uri().GetQueryEncodedAsString().empty()) printer_queue += "?" + printer.uri().GetQueryEncodedAsString(); printer_info.Set("printerQueue", printer_queue); - printer_info.Set( - "printerStatusReason", - static_cast<int>( - CupsPrinterStatus::CupsPrinterStatusReason::Reason::kUnknownReason)); return printer_info; }
diff --git a/chromeos/profiles/arm-exp.afdo.newest.txt b/chromeos/profiles/arm-exp.afdo.newest.txt index 035db59..55e8d7e 100644 --- a/chromeos/profiles/arm-exp.afdo.newest.txt +++ b/chromeos/profiles/arm-exp.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-arm-none-115-5715.0-1683546756-benchmark-115.0.5771.0-r1-redacted.afdo.xz +chromeos-chrome-arm-none-115-5735.18-1684150800-benchmark-115.0.5772.0-r1-redacted.afdo.xz
diff --git a/chromeos/profiles/arm.afdo.newest.txt b/chromeos/profiles/arm.afdo.newest.txt index 035db59..55e8d7e 100644 --- a/chromeos/profiles/arm.afdo.newest.txt +++ b/chromeos/profiles/arm.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-arm-none-115-5715.0-1683546756-benchmark-115.0.5771.0-r1-redacted.afdo.xz +chromeos-chrome-arm-none-115-5735.18-1684150800-benchmark-115.0.5772.0-r1-redacted.afdo.xz
diff --git a/chromeos/profiles/atom.afdo.newest.txt b/chromeos/profiles/atom.afdo.newest.txt index f7020a2..7851a5b 100644 --- a/chromeos/profiles/atom.afdo.newest.txt +++ b/chromeos/profiles/atom.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-atom-115-5735.12-1683543901-benchmark-115.0.5771.0-r1-redacted.afdo.xz +chromeos-chrome-amd64-atom-115-5735.18-1684144513-benchmark-115.0.5772.0-r1-redacted.afdo.xz
diff --git a/chromeos/profiles/bigcore.afdo.newest.txt b/chromeos/profiles/bigcore.afdo.newest.txt index 37612bb..3251af0 100644 --- a/chromeos/profiles/bigcore.afdo.newest.txt +++ b/chromeos/profiles/bigcore.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-bigcore-115-5735.12-1683542912-benchmark-115.0.5771.0-r1-redacted.afdo.xz +chromeos-chrome-amd64-bigcore-115-5735.18-1684149627-benchmark-115.0.5772.0-r1-redacted.afdo.xz
diff --git a/components/attribution_reporting/BUILD.gn b/components/attribution_reporting/BUILD.gn index c978ea6a..469b6a3 100644 --- a/components/attribution_reporting/BUILD.gn +++ b/components/attribution_reporting/BUILD.gn
@@ -166,6 +166,7 @@ "//components/aggregation_service:mojom", "//mojo/public/mojom/base", "//services/network/public/mojom:mojom_schemeful_site", + "//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_origin", ] @@ -260,6 +261,11 @@ forward_declaration = "namespace attribution_reporting { class DestinationSet; }" }, + { + mojom = "attribution_reporting.mojom.OsRegistration" + cpp = "::std::vector<::GURL>" + move_only = true + }, ] traits_headers = [ "registration_mojom_traits.h" ] traits_public_deps = [ ":registration_mojom_traits" ]
diff --git a/components/attribution_reporting/registration.mojom b/components/attribution_reporting/registration.mojom index 9fee875d..c61b1f4 100644 --- a/components/attribution_reporting/registration.mojom +++ b/components/attribution_reporting/registration.mojom
@@ -10,6 +10,7 @@ import "mojo/public/mojom/base/time.mojom"; import "services/network/public/mojom/schemeful_site.mojom"; import "url/mojom/origin.mojom"; +import "url/mojom/url.mojom"; struct DebugKey { uint64 value; @@ -163,3 +164,10 @@ // reports. SourceRegistrationTimeConfig source_registration_time_config; }; + +// Represents a source or trigger registration that will be passed to the OS, if supported. +struct OsRegistration { + // The URLs to which the OS will make a request in order to retrieve the actual + // source or trigger registration. + array<url.mojom.Url> urls; +};
diff --git a/components/attribution_reporting/registration_mojom_traits.h b/components/attribution_reporting/registration_mojom_traits.h index 1517426..6b9482a 100644 --- a/components/attribution_reporting/registration_mojom_traits.h +++ b/components/attribution_reporting/registration_mojom_traits.h
@@ -32,7 +32,9 @@ #include "services/network/public/cpp/schemeful_site_mojom_traits.h" #include "third_party/abseil-cpp/absl/numeric/int128.h" #include "third_party/abseil-cpp/absl/types/optional.h" +#include "url/gurl.h" #include "url/mojom/origin_mojom_traits.h" +#include "url/mojom/url_gurl_mojom_traits.h" #include "url/origin.h" namespace mojo { @@ -319,6 +321,20 @@ attribution_reporting::AggregatableDedupKey* out); }; +template <> +struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS) + StructTraits<attribution_reporting::mojom::OsRegistrationDataView, + std::vector<GURL>> { + static const std::vector<GURL>& urls(const std::vector<GURL>& urls) { + return urls; + } + + static bool Read(attribution_reporting::mojom::OsRegistrationDataView data, + std::vector<GURL>* out) { + return data.ReadUrls(out); + } +}; + } // namespace mojo #endif // COMPONENTS_ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS_H_
diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc index 8b016ef..e15a7c77 100644 --- a/components/autofill/core/browser/form_structure.cc +++ b/components/autofill/core/browser/form_structure.cc
@@ -10,6 +10,7 @@ #include <deque> #include <map> #include <memory> +#include <string> #include <unordered_map> #include <unordered_set> #include <utility> @@ -414,7 +415,7 @@ AutofillUploadContents upload; upload.set_submission(observed_submission); upload.set_client_version( - version_info::GetProductNameAndVersionForUserAgent()); + std::string(version_info::GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_signature().value()); upload.set_autofill_used(form_was_autofilled); upload.set_data_present(data_present); @@ -500,7 +501,7 @@ base::flat_map<FormGlobalId, FormSignature>(std::move(subforms))) { uploads.emplace_back(); uploads.back().set_client_version( - version_info::GetProductNameAndVersionForUserAgent()); + std::string(version_info::GetProductNameAndVersionForUserAgent())); uploads.back().set_form_signature(subform_signature.value()); uploads.back().set_autofill_used(form_was_autofilled); uploads.back().set_data_present(data_present); @@ -521,7 +522,7 @@ queried_form_signatures->reserve(forms.size()); query->set_client_version( - version_info::GetProductNameAndVersionForUserAgent()); + std::string(version_info::GetProductNameAndVersionForUserAgent())); // If a page contains repeated forms, detect that and encode only one form as // the returned data would be the same for all the repeated forms.
diff --git a/components/autofill/core/browser/form_structure_unittest.cc b/components/autofill/core/browser/form_structure_unittest.cc index bd7ffe05..b701b1f 100644 --- a/components/autofill/core/browser/form_structure_unittest.cc +++ b/components/autofill/core/browser/form_structure_unittest.cc
@@ -7,6 +7,7 @@ #include <stddef.h> #include <memory> +#include <string> #include "base/base64.h" #include "base/command_line.h" @@ -2247,7 +2248,7 @@ // Prepare the expected proto string. AutofillPageQueryRequest query; - query.set_client_version(GetProductNameAndVersionForUserAgent()); + query.set_client_version(std::string(GetProductNameAndVersionForUserAgent())); { AutofillPageQueryRequest::Form* query_form = query.add_forms(); query_form->set_signature(form_signature.value()); @@ -2552,7 +2553,8 @@ // Prepare the expected proto string. AutofillUploadContents upload; upload.set_submission(true); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(false); upload.set_data_present("1442000308"); @@ -2731,7 +2733,8 @@ // Prepare the expected proto string. AutofillUploadContents upload; upload.set_submission(true); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(false); upload.set_data_present("1442000308"); @@ -2855,7 +2858,8 @@ // Prepare the expected proto string. AutofillUploadContents upload; upload.set_submission(true); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(false); upload.set_data_present("1442000308"); @@ -2977,7 +2981,8 @@ AutofillUploadContents upload; upload.set_submission(true); upload.set_submission_event(AutofillUploadContents::HTML_FORM_SUBMISSION); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(false); upload.set_data_present("1442000308"); @@ -3159,7 +3164,8 @@ // Prepare the expected proto string. AutofillUploadContents upload; upload.set_submission(true); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(true); upload.set_data_present("1440000000000000000802"); @@ -3250,7 +3256,8 @@ // Prepare the expected proto string. AutofillUploadContents upload; upload.set_submission(true); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(true); upload.set_data_present("1440"); @@ -3338,7 +3345,8 @@ // Prepare the expected proto string. AutofillUploadContents upload; upload.set_submission(true); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(true); upload.set_data_present("1440"); @@ -3423,7 +3431,8 @@ // Prepare the expected proto string. AutofillUploadContents upload; upload.set_submission(false); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(true); upload.set_data_present("1440"); @@ -3497,7 +3506,8 @@ // Prepare the expected proto string. AutofillUploadContents upload; upload.set_submission(true); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(true); upload.set_data_present("1440"); @@ -3570,7 +3580,8 @@ // Prepare the expected proto string. AutofillUploadContents upload; upload.set_submission(true); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(true); upload.set_data_present("1440"); @@ -3653,7 +3664,8 @@ // Prepare the expected proto string. AutofillUploadContents upload; upload.set_submission(true); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(true); upload.set_data_present("1440"); @@ -3729,7 +3741,8 @@ // Prepare the expected proto string. AutofillUploadContents upload; upload.set_submission(true); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(true); upload.set_data_present("1440"); @@ -3814,7 +3827,8 @@ // Prepare the expected proto string. AutofillUploadContents upload; upload.set_submission(true); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(true); upload.set_data_present("1440"); @@ -3919,7 +3933,8 @@ upload.set_submission(true); upload.set_submission_event( AutofillUploadContents_SubmissionIndicatorEvent_NONE); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(false); upload.set_data_present("0000000000001850"); @@ -3939,7 +3954,8 @@ const AutofillUploadContents upload_name_exp = [&] { AutofillUploadContents upload; - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form.fields[0].host_form_signature.value()); upload.set_autofill_used(false); upload.set_data_present("0000000000001850"); @@ -3952,7 +3968,8 @@ const AutofillUploadContents upload_number = [&] { AutofillUploadContents upload; - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form.fields[1].host_form_signature.value()); upload.set_autofill_used(false); upload.set_data_present("0000000000001850"); @@ -3963,7 +3980,8 @@ const AutofillUploadContents upload_cvc = [&] { AutofillUploadContents upload; - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form.fields[3].host_form_signature.value()); upload.set_autofill_used(false); upload.set_data_present("0000000000001850"); @@ -4030,7 +4048,8 @@ // Prepare the expected proto string. AutofillUploadContents upload; upload.set_submission(true); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure.form_signature().value()); upload.set_autofill_used(false); upload.set_data_present(""); @@ -4291,7 +4310,8 @@ // Prepare the expected proto string. AutofillUploadContents upload; upload.set_submission(true); - upload.set_client_version(GetProductNameAndVersionForUserAgent()); + upload.set_client_version( + std::string(GetProductNameAndVersionForUserAgent())); upload.set_form_signature(form_structure->form_signature().value()); upload.set_autofill_used(false); upload.set_data_present("1440000360000008"); @@ -4787,7 +4807,7 @@ // Create the expected query and serialize it to a string. AutofillPageQueryRequest query; - query.set_client_version(GetProductNameAndVersionForUserAgent()); + query.set_client_version(std::string(GetProductNameAndVersionForUserAgent())); AutofillPageQueryRequest::Form* query_form = query.add_forms(); query_form->set_signature(form_structure.form_signature().value()); @@ -4836,7 +4856,7 @@ // Create the expected query and serialize it to a string. AutofillPageQueryRequest query; - query.set_client_version(GetProductNameAndVersionForUserAgent()); + query.set_client_version(std::string(GetProductNameAndVersionForUserAgent())); AutofillPageQueryRequest::Form* query_form = query.add_forms(); query_form->set_signature(form_structure.form_signature().value()); @@ -4887,7 +4907,7 @@ // Create the expected query and serialize it to a string. AutofillPageQueryRequest query; - query.set_client_version(GetProductNameAndVersionForUserAgent()); + query.set_client_version(std::string(GetProductNameAndVersionForUserAgent())); AutofillPageQueryRequest::Form* query_form = query.add_forms(); query_form->set_signature(form_structure.form_signature().value()); @@ -4933,7 +4953,7 @@ // Create the expected query and serialize it to a string. AutofillPageQueryRequest query; - query.set_client_version(GetProductNameAndVersionForUserAgent()); + query.set_client_version(std::string(GetProductNameAndVersionForUserAgent())); AutofillPageQueryRequest::Form* query_form = query.add_forms(); query_form->set_signature(form_structure.form_signature().value());
diff --git a/components/browser_ui/styles/android/java/res/values-night/colors.xml b/components/browser_ui/styles/android/java/res/values-night/colors.xml index 2eab07d..b74f81b 100644 --- a/components/browser_ui/styles/android/java/res/values-night/colors.xml +++ b/components/browser_ui/styles/android/java/res/values-night/colors.xml
@@ -16,8 +16,8 @@ <color name="switch_thumb_disabled_color_baseline">@color/switch_thumb_disabled_color_baseline_dark</color> <!-- Empty states colors --> - <color name="empty_state_icon_color">@color/material_primary_200</color> - <color name="empty_state_icon_bg_color">@color/material_primary_800</color> - <color name="empty_state_icon_bg_background_color">@color/material_primary_900</color> - <color name="empty_state_icon_bg_foreground_color">@color/material_primary_800</color> + <color name="empty_state_icon_color">@color/material_primary_80</color> + <color name="empty_state_icon_bg_color">@color/material_primary_20</color> + <color name="empty_state_icon_bg_background_color">@color/material_primary_10</color> + <color name="empty_state_icon_bg_foreground_color">@color/material_primary_20</color> </resources>
diff --git a/components/browser_ui/styles/android/java/res/values-v31/colors.xml b/components/browser_ui/styles/android/java/res/values-v31/colors.xml index b0cf6de..7557b81 100644 --- a/components/browser_ui/styles/android/java/res/values-v31/colors.xml +++ b/components/browser_ui/styles/android/java/res/values-v31/colors.xml
@@ -7,10 +7,10 @@ <resources xmlns:tools="http://schemas.android.com/tools"> <!-- GM3 dynamic colors for Android S and above.--> - <color name="material_primary_900">@color/material_dynamic_primary10</color> - <color name="material_primary_800">@color/material_dynamic_primary20</color> - <color name="material_primary_600">@color/material_dynamic_primary40</color> - <color name="material_primary_200">@color/material_dynamic_primary80</color> - <color name="material_primary_100">@color/material_dynamic_primary90</color> - <color name="material_primary_50">@color/material_dynamic_primary95</color> + <color name="material_primary_10">@color/material_dynamic_primary10</color> + <color name="material_primary_20">@color/material_dynamic_primary20</color> + <color name="material_primary_40">@color/material_dynamic_primary40</color> + <color name="material_primary_80">@color/material_dynamic_primary80</color> + <color name="material_primary_90">@color/material_dynamic_primary90</color> + <color name="material_primary_95">@color/material_dynamic_primary95</color> </resources> \ No newline at end of file
diff --git a/components/browser_ui/styles/android/java/res/values/colors.xml b/components/browser_ui/styles/android/java/res/values/colors.xml index 475ff39..2b1fb42 100644 --- a/components/browser_ui/styles/android/java/res/values/colors.xml +++ b/components/browser_ui/styles/android/java/res/values/colors.xml
@@ -53,8 +53,8 @@ <macro name="default_chip_assistive_text_color_secondary" tools:ignore="UnusedResources">@macro/default_text_color_secondary</macro> <!-- Clank Empty States Colors--> - <color name="empty_state_icon_bg_color">@color/material_primary_50</color> - <color name="empty_state_icon_bg_background_color">@color/material_primary_50</color> - <color name="empty_state_icon_bg_foreground_color">@color/material_primary_100</color> - <color name="empty_state_icon_color">@color/material_primary_600</color> + <color name="empty_state_icon_bg_color">@color/material_primary_95</color> + <color name="empty_state_icon_bg_background_color">@color/material_primary_95</color> + <color name="empty_state_icon_bg_foreground_color">@color/material_primary_90</color> + <color name="empty_state_icon_color">@color/material_primary_40</color> </resources>
diff --git a/components/browser_ui/theme/android/java/res/values-night/themes.xml b/components/browser_ui/theme/android/java/res/values-night/themes.xml index b28975c6..74b55b03 100644 --- a/components/browser_ui/theme/android/java/res/values-night/themes.xml +++ b/components/browser_ui/theme/android/java/res/values-night/themes.xml
@@ -10,11 +10,11 @@ Theme.BrowserUI.AlertDialog.NoActionBar.DayNight. --> <style name="Theme.BrowserUI.DayNight" parent="Theme.BrowserUI"> <!-- Color palettes --> - <item name="colorPrimary">@color/baseline_primary_200</item> - <item name="colorPrimaryInverse">@color/baseline_primary_600</item> - <item name="colorOnPrimary">@color/baseline_primary_800</item> - <item name="colorPrimaryContainer">@color/baseline_primary_700</item> - <item name="colorOnPrimaryContainer">@color/baseline_primary_100</item> + <item name="colorPrimary">@color/baseline_primary_80</item> + <item name="colorPrimaryInverse">@color/baseline_primary_40</item> + <item name="colorOnPrimary">@color/baseline_primary_20</item> + <item name="colorPrimaryContainer">@color/baseline_primary_30</item> + <item name="colorOnPrimaryContainer">@color/baseline_primary_90</item> <item name="colorSecondaryContainer">@color/baseline_secondary_700</item> <item name="colorOnSecondaryContainer">@color/baseline_secondary_100</item> <item name="android:colorBackground">@color/baseline_neutral_900</item> @@ -34,11 +34,11 @@ <!-- Colors should be mirrored by Theme.BrowserUI.DayNight. --> <style name="Theme.BrowserUI.DialogWhenLarge.DayNight" parent="Theme.BrowserUI.DialogWhenLarge"> <!-- Color palettes --> - <item name="colorPrimary">@color/baseline_primary_200</item> - <item name="colorPrimaryInverse">@color/baseline_primary_600</item> - <item name="colorOnPrimary">@color/baseline_primary_800</item> - <item name="colorPrimaryContainer">@color/baseline_primary_700</item> - <item name="colorOnPrimaryContainer">@color/baseline_primary_100</item> + <item name="colorPrimary">@color/baseline_primary_80</item> + <item name="colorPrimaryInverse">@color/baseline_primary_40</item> + <item name="colorOnPrimary">@color/baseline_primary_20</item> + <item name="colorPrimaryContainer">@color/baseline_primary_30</item> + <item name="colorOnPrimaryContainer">@color/baseline_primary_90</item> <item name="colorSecondaryContainer">@color/baseline_secondary_700</item> <item name="colorOnSecondaryContainer">@color/baseline_secondary_100</item> <item name="android:colorBackground">@color/baseline_neutral_900</item> @@ -58,11 +58,11 @@ <!-- Colors should be mirrored by Theme.BrowserUI.DayNight. --> <style name="Theme.BrowserUI.AlertDialog.NoActionBar.DayNight" parent="Theme.BrowserUI.AlertDialog.NoActionBar"> <!-- Color palettes --> - <item name="colorPrimary">@color/baseline_primary_200</item> - <item name="colorPrimaryInverse">@color/baseline_primary_600</item> - <item name="colorOnPrimary">@color/baseline_primary_800</item> - <item name="colorPrimaryContainer">@color/baseline_primary_700</item> - <item name="colorOnPrimaryContainer">@color/baseline_primary_100</item> + <item name="colorPrimary">@color/baseline_primary_80</item> + <item name="colorPrimaryInverse">@color/baseline_primary_40</item> + <item name="colorOnPrimary">@color/baseline_primary_20</item> + <item name="colorPrimaryContainer">@color/baseline_primary_30</item> + <item name="colorOnPrimaryContainer">@color/baseline_primary_90</item> <item name="colorSecondaryContainer">@color/baseline_secondary_700</item> <item name="colorOnSecondaryContainer">@color/baseline_secondary_100</item> <item name="android:colorBackground">@color/baseline_neutral_900</item>
diff --git a/components/browser_ui/theme/android/java/res/values/themes.xml b/components/browser_ui/theme/android/java/res/values/themes.xml index bd8f7dfe..f33309d 100644 --- a/components/browser_ui/theme/android/java/res/values/themes.xml +++ b/components/browser_ui/theme/android/java/res/values/themes.xml
@@ -12,12 +12,12 @@ <item name="dynamicColorThemeOverlay">@style/ThemeOverlay.BrowserUI.DynamicColors</item> <!-- Color palettes --> - <item name="colorPrimary">@color/baseline_primary_600</item> + <item name="colorPrimary">@color/baseline_primary_40</item> <item name="colorPrimaryDark">@android:color/black</item> - <item name="colorPrimaryInverse">@color/baseline_primary_200</item> - <item name="colorOnPrimary">@color/baseline_primary_0</item> - <item name="colorPrimaryContainer">@color/baseline_primary_100</item> - <item name="colorOnPrimaryContainer">@color/baseline_primary_900</item> + <item name="colorPrimaryInverse">@color/baseline_primary_80</item> + <item name="colorOnPrimary">@color/baseline_primary_100</item> + <item name="colorPrimaryContainer">@color/baseline_primary_90</item> + <item name="colorOnPrimaryContainer">@color/baseline_primary_10</item> <item name="colorSecondaryContainer">@color/baseline_secondary_100</item> <item name="colorOnSecondaryContainer">@color/baseline_secondary_900</item> <item name="colorAccent">@macro/default_control_color_active</item> @@ -112,12 +112,12 @@ <item name="dynamicColorThemeOverlay">@style/ThemeOverlay.BrowserUI.DynamicColors</item> <!-- Color palettes --> - <item name="colorPrimary">@color/baseline_primary_600</item> + <item name="colorPrimary">@color/baseline_primary_40</item> <item name="colorPrimaryDark">@android:color/black</item> - <item name="colorPrimaryInverse">@color/baseline_primary_200</item> - <item name="colorOnPrimary">@color/baseline_primary_0</item> - <item name="colorPrimaryContainer">@color/baseline_primary_100</item> - <item name="colorOnPrimaryContainer">@color/baseline_primary_900</item> + <item name="colorPrimaryInverse">@color/baseline_primary_80</item> + <item name="colorOnPrimary">@color/baseline_primary_100</item> + <item name="colorPrimaryContainer">@color/baseline_primary_90</item> + <item name="colorOnPrimaryContainer">@color/baseline_primary_10</item> <item name="colorSecondaryContainer">@color/baseline_secondary_100</item> <item name="colorOnSecondaryContainer">@color/baseline_secondary_900</item> <item name="colorAccent">@macro/default_control_color_active</item> @@ -179,12 +179,12 @@ <item name="dynamicColorThemeOverlay">@style/ThemeOverlay.BrowserUI.DynamicColors</item> <!-- Color palettes --> - <item name="colorPrimary">@color/baseline_primary_600</item> + <item name="colorPrimary">@color/baseline_primary_40</item> <item name="colorPrimaryDark">@android:color/black</item> - <item name="colorPrimaryInverse">@color/baseline_primary_200</item> - <item name="colorOnPrimary">@color/baseline_primary_0</item> - <item name="colorPrimaryContainer">@color/baseline_primary_100</item> - <item name="colorOnPrimaryContainer">@color/baseline_primary_900</item> + <item name="colorPrimaryInverse">@color/baseline_primary_80</item> + <item name="colorOnPrimary">@color/baseline_primary_100</item> + <item name="colorPrimaryContainer">@color/baseline_primary_90</item> + <item name="colorOnPrimaryContainer">@color/baseline_primary_10</item> <item name="colorSecondaryContainer">@color/baseline_secondary_100</item> <item name="colorOnSecondaryContainer">@color/baseline_secondary_900</item> <item name="colorAccent">@macro/default_control_color_active</item>
diff --git a/components/cast_receiver/OWNERS b/components/cast_receiver/OWNERS index f233420..3dc8e8b 100644 --- a/components/cast_receiver/OWNERS +++ b/components/cast_receiver/OWNERS
@@ -1,5 +1,4 @@ ddorwin@chromium.org mfoltz@chromium.org -rwkeane@google.com seantopping@chromium.org vigeni@google.com
diff --git a/components/cast_streaming/OWNERS b/components/cast_streaming/OWNERS index 30e743e..aac534f7 100644 --- a/components/cast_streaming/OWNERS +++ b/components/cast_streaming/OWNERS
@@ -1,4 +1,3 @@ jophba@chromium.org -rwkeane@google.com ddorwin@chromium.org mfoltz@chromium.org
diff --git a/components/component_updater/configurator_impl.cc b/components/component_updater/configurator_impl.cc index 034d38b..f3f29ea 100644 --- a/components/component_updater/configurator_impl.cc +++ b/components/component_updater/configurator_impl.cc
@@ -89,7 +89,7 @@ } std::string ConfiguratorImpl::GetOSLongName() const { - return version_info::GetOSType(); + return std::string(version_info::GetOSType()); } base::flat_map<std::string, std::string> ConfiguratorImpl::ExtraRequestParams()
diff --git a/components/embedder_support/user_agent_utils.cc b/components/embedder_support/user_agent_utils.cc index 67f9610..13c7a85 100644 --- a/components/embedder_support/user_agent_utils.cc +++ b/components/embedder_support/user_agent_utils.cc
@@ -4,6 +4,7 @@ #include "components/embedder_support/user_agent_utils.h" +#include <string> #include <vector> #include "base/command_line.h" @@ -232,7 +233,7 @@ // Force major version to 99. return ShouldForceMajorVersionToMinorPosition(options.force_major_to_minor) ? GetMajorInMinorVersionNumber() - : version_info::GetVersionNumber(); + : std::string(version_info::GetVersionNumber()); } const blink::UserAgentBrandList GetUserAgentBrandList( @@ -273,7 +274,7 @@ bool enable_updated_grease_by_policy) { return GetUserAgentBrandList(version_info::GetMajorVersionNumber(), enable_updated_grease_by_policy, - version_info::GetVersionNumber(), + std::string(version_info::GetVersionNumber()), blink::UserAgentBrandVersionType::kMajorVersion); } @@ -291,7 +292,7 @@ bool enable_updated_grease_by_policy) { return GetUserAgentBrandList(version_info::GetMajorVersionNumber(), enable_updated_grease_by_policy, - version_info::GetVersionNumber(), + std::string(version_info::GetVersionNumber()), blink::UserAgentBrandVersionType::kFullVersion); } @@ -358,7 +359,8 @@ return ShouldReduceUserAgentMinorVersion(user_agent_reduction) ? version_info::GetProductNameAndVersionForReducedUserAgent( blink::features::kUserAgentFrozenBuildVersion.Get()) - : version_info::GetProductNameAndVersionForUserAgent(); + : std::string( + version_info::GetProductNameAndVersionForUserAgent()); } // Internal function to handle return the full or "reduced" user agent string, @@ -577,7 +579,7 @@ return "Chromium OS"; # endif #else - return version_info::GetOSType(); + return std::string(version_info::GetOSType()); #endif }
diff --git a/components/embedder_support/user_agent_utils_unittest.cc b/components/embedder_support/user_agent_utils_unittest.cc index a845de07..29879fb 100644 --- a/components/embedder_support/user_agent_utils_unittest.cc +++ b/components/embedder_support/user_agent_utils_unittest.cc
@@ -4,6 +4,7 @@ #include "components/embedder_support/user_agent_utils.h" +#include <string> #include <vector> #include "base/command_line.h" @@ -462,7 +463,7 @@ // Make sure all APIs have the correct behavior once user provide invalid // custom user agent. const std::string major_version = version_info::GetMajorVersionNumber(); - const std::string full_version = version_info::GetVersionNumber(); + const std::string full_version(version_info::GetVersionNumber()); base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitAndEnableFeature(blink::features::kReduceUserAgent); @@ -824,7 +825,7 @@ auto metadata = GetUserAgentMetadata(); const std::string major_version = version_info::GetMajorVersionNumber(); - const std::string full_version = version_info::GetVersionNumber(); + const std::string full_version(version_info::GetVersionNumber()); const std::string major_to_minor_full_version = MajorToMinorVersionNumber(); // According to spec, Sec-CH-UA should contain what project the browser is @@ -837,9 +838,9 @@ const blink::UserAgentBrandVersion major_to_minor_chromium_brand_version = { "Chromium", "99"}; const blink::UserAgentBrandVersion product_brand_version = { - version_info::GetProductName(), major_version}; + std::string(version_info::GetProductName()), major_version}; const blink::UserAgentBrandVersion major_to_minor_product_brand_version = { - version_info::GetProductName(), "99"}; + std::string(version_info::GetProductName()), "99"}; EXPECT_TRUE(ContainsBrandVersion(metadata.brand_version_list, chromium_brand_version)); @@ -853,9 +854,10 @@ major_to_minor_chromium_brand_full_version = { "Chromium", major_to_minor_full_version}; const blink::UserAgentBrandVersion product_brand_full_version = { - version_info::GetProductName(), full_version}; + std::string(version_info::GetProductName()), full_version}; const blink::UserAgentBrandVersion major_to_minor_product_brand_full_version = - {version_info::GetProductName(), major_to_minor_full_version}; + {std::string(version_info::GetProductName()), + major_to_minor_full_version}; EXPECT_TRUE(ContainsBrandVersion(metadata.brand_full_version_list, chromium_brand_full_version));
diff --git a/components/enterprise/browser/reporting/browser_report_generator.cc b/components/enterprise/browser/reporting/browser_report_generator.cc index 5bcd4ff1..e928f92 100644 --- a/components/enterprise/browser/reporting/browser_report_generator.cc +++ b/components/enterprise/browser/reporting/browser_report_generator.cc
@@ -57,7 +57,7 @@ #endif // BUILDFLAG(IS_CHROMEOS_ASH) if (contains_version_and_channel) { - report->set_browser_version(version_info::GetVersionNumber()); + report->set_browser_version(std::string(version_info::GetVersionNumber())); report->set_channel(policy::ConvertToProtoChannel(delegate_->GetChannel())); if (delegate_->IsExtendedStableChannel()) report->set_is_extended_stable_channel(true);
diff --git a/components/feedback/feedback_util.cc b/components/feedback/feedback_util.cc index 3ac47cc..ec6dcb1 100644 --- a/components/feedback/feedback_util.cc +++ b/components/feedback/feedback_util.cc
@@ -83,23 +83,23 @@ } void RemoveUrlsFromAutofillData(std::string& autofill_metadata) { - absl::optional<base::Value> properties = base::JSONReader::Read( + absl::optional<base::Value::Dict> autofill_data = base::JSONReader::ReadDict( autofill_metadata, base::JSON_ALLOW_TRAILING_COMMAS); - if (!properties || !properties->is_dict()) { + if (!autofill_data) { LOG(ERROR) << "base::JSONReader::Read failed to translate to JSON"; return; } - base::Value::Dict& autofill_data = properties->GetDict(); if (base::Value::List* form_structures = - autofill_data.FindList("formStructures")) { + autofill_data->FindList("formStructures")) { for (base::Value& item : *form_structures) { - item.RemoveKey("sourceUrl"); - item.RemoveKey("mainFrameUrl"); + auto& dict = item.GetDict(); + dict.Remove("sourceUrl"); + dict.Remove("mainFrameUrl"); } } - base::JSONWriter::Write(properties.value(), &autofill_metadata); + base::JSONWriter::Write(*autofill_data, &autofill_metadata); return; }
diff --git a/components/feedback/feedback_util_unittest.cc b/components/feedback/feedback_util_unittest.cc index 7e87aa5..20ebc38 100644 --- a/components/feedback/feedback_util_unittest.cc +++ b/components/feedback/feedback_util_unittest.cc
@@ -161,8 +161,9 @@ base::Value::List* form_structures = autofill_data.FindList("formStructures"); ASSERT_TRUE(form_structures); for (base::Value& item : *form_structures) { - item.RemoveKey("sourceUrl"); - item.RemoveKey("mainFrameUrl"); + auto& dict = item.GetDict(); + dict.Remove("sourceUrl"); + dict.Remove("mainFrameUrl"); } std::string expected_autofill_data_str;
diff --git a/components/fuchsia_component_support/feedback_registration.cc b/components/fuchsia_component_support/feedback_registration.cc index 24721ad9..a1451460 100644 --- a/components/fuchsia_component_support/feedback_registration.cc +++ b/components/fuchsia_component_support/feedback_registration.cc
@@ -30,7 +30,7 @@ fuchsia::feedback::CrashReportingProduct product_data; product_data.set_name(std::string(crash_product_name)); - product_data.set_version(version_info::GetVersionNumber()); + product_data.set_version(std::string(version_info::GetVersionNumber())); // TODO(https://crbug.com/1077428): Use the actual channel when appropriate. // For now, always set it to the empty string to avoid reporting "missing". product_data.set_channel(""); @@ -58,7 +58,7 @@ component_data.set_namespace_(std::string(component_namespace)); // TODO(https://crbug.com/1077428): Add release channel to the annotations. component_data.mutable_annotations()->push_back( - {"version", version_info::GetVersionNumber()}); + {"version", std::string(version_info::GetVersionNumber())}); base::ComponentContextForProcess() ->svc() ->Connect<fuchsia::feedback::ComponentDataRegister>()
diff --git a/components/fuchsia_component_support/inspect.cc b/components/fuchsia_component_support/inspect.cc index 7129bcb..dc5a4f3 100644 --- a/components/fuchsia_component_support/inspect.cc +++ b/components/fuchsia_component_support/inspect.cc
@@ -19,10 +19,10 @@ // These values are managed by the inspector, since they won't be updated over // the lifetime of the component. // TODO(https://crbug.com/1077428): Add release channel. - inspector->root().CreateString(kVersion, version_info::GetVersionNumber(), - inspector); - inspector->root().CreateString(kLastChange, version_info::GetLastChange(), - inspector); + inspector->root().CreateString( + kVersion, std::string(version_info::GetVersionNumber()), inspector); + inspector->root().CreateString( + kLastChange, std::string(version_info::GetLastChange()), inspector); } } // namespace fuchsia_component_support
diff --git a/components/gcm_driver/gcm_desktop_utils.cc b/components/gcm_driver/gcm_desktop_utils.cc index 1ebdd54..be2b26c 100644 --- a/components/gcm_driver/gcm_desktop_utils.cc +++ b/components/gcm_driver/gcm_desktop_utils.cc
@@ -57,7 +57,7 @@ } std::string GetVersion() { - return version_info::GetVersionNumber(); + return std::string(version_info::GetVersionNumber()); } GCMClient::ChromeBuildInfo GetChromeBuildInfo(
diff --git a/components/history/core/browser/download_database.cc b/components/history/core/browser/download_database.cc index 194e13f..18218c4f 100644 --- a/components/history/core/browser/download_database.cc +++ b/components/history/core/browser/download_database.cc
@@ -316,6 +316,20 @@ "INTEGER NOT NULL DEFAULT 0"); } +bool DownloadDatabase::MigrateDownloadByWebApp() { + bool id_column_exists = + GetDB().DoesColumnExist(kDownloadsTable, "by_ext_id") + ? GetDB().Execute( + base::StringPrintf("ALTER TABLE %s RENAME COLUMN " + "by_ext_id TO by_ext_or_web_app_id", + kDownloadsTable) + .c_str()) + : EnsureColumnExists("by_ext_or_web_app_id", + "VARCHAR NOT NULL DEFAULT ''"); + return id_column_exists && + EnsureColumnExists("is_by_web_app", "INTEGER NOT NULL DEFAULT 0"); +} + bool DownloadDatabase::InitDownloadTable() { const std::string kSchema = base::StringPrintf( "CREATE TABLE %s (" @@ -347,9 +361,11 @@ "tab_referrer_url VARCHAR NOT NULL," // Tag referrer URL for // initiator. "http_method VARCHAR NOT NULL," // HTTP method. - "by_ext_id VARCHAR NOT NULL," // ID of extension that started the - // download - "by_ext_name VARCHAR NOT NULL," // name of extension + "by_ext_or_web_app_id VARCHAR NOT NULL," // ID of extension or web app + // that started the download. + "by_ext_name VARCHAR NOT NULL," // name of extension + "is_by_web_app INTEGER NOT NULL," // 1 if by_ext_or_web_app_id is for + // a web app, else 0. "etag VARCHAR NOT NULL," // ETag "last_modified VARCHAR NOT NULL," // Last-Modified header "mime_type VARCHAR(255) NOT NULL," // MIME type. @@ -450,8 +466,8 @@ "danger_type, interrupt_reason, hash, end_time, opened, " "last_access_time, transient, referrer, site_url, " "embedder_download_data, tab_url, tab_referrer_url, http_method, " - "by_ext_id, by_ext_name, etag, last_modified FROM %s ORDER BY " - "start_time", + "by_ext_or_web_app_id, by_ext_name, is_by_web_app, etag, " + "last_modified FROM %s ORDER BY start_time", kDownloadsTable) .c_str())); @@ -492,8 +508,9 @@ info->tab_url = GURL(statement_main.ColumnString(column++)); info->tab_referrer_url = GURL(statement_main.ColumnString(column++)); info->http_method = statement_main.ColumnString(column++); - info->by_ext_id = statement_main.ColumnString(column++); + info->by_ext_or_web_app_id = statement_main.ColumnString(column++); info->by_ext_name = statement_main.ColumnString(column++); + info->is_by_web_app = statement_main.ColumnInt(column++) != 0; info->etag = statement_main.ColumnString(column++); info->last_modified = statement_main.ColumnString(column++); @@ -598,8 +615,8 @@ "danger_type=?, interrupt_reason=?, hash=?, " "end_time=?, total_bytes=?, " "opened=?, last_access_time=?, transient=?, " - "by_ext_id=?, by_ext_name=?, " - "etag=?, last_modified=? WHERE id=?", + "by_ext_or_web_app_id=?, by_ext_name=?, " + "is_by_web_app=?, etag=?, last_modified=? WHERE id=?", kDownloadsTable) .c_str())); int column = 0; @@ -618,8 +635,9 @@ statement.BindInt(column++, (data.opened ? 1 : 0)); statement.BindTime(column++, data.last_access_time); statement.BindInt(column++, (data.transient ? 1 : 0)); - statement.BindString(column++, data.by_ext_id); + statement.BindString(column++, data.by_ext_or_web_app_id); statement.BindString(column++, data.by_ext_name); + statement.BindInt(column++, data.is_by_web_app ? 1 : 0); statement.BindString(column++, data.etag); statement.BindString(column++, data.last_modified); statement.BindInt64(column++, DownloadIdToInt(data.id)); @@ -682,10 +700,11 @@ "state, danger_type, interrupt_reason, hash, end_time, opened, " "last_access_time, transient, referrer, site_url, " "embedder_download_data, tab_url, tab_referrer_url, http_method, " - "by_ext_id, by_ext_name, etag, last_modified) " + "by_ext_or_web_app_id, by_ext_name, is_by_web_app, etag, " + "last_modified) " "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " - " ?, ?, ?, ?, ?, ?, ?)", + " ?, ?, ?, ?, ?, ?, ?, ?)", kDownloadsTable) .c_str())); @@ -715,8 +734,9 @@ statement_insert.BindString(column++, info.tab_url.spec()); statement_insert.BindString(column++, info.tab_referrer_url.spec()); statement_insert.BindString(column++, info.http_method); - statement_insert.BindString(column++, info.by_ext_id); + statement_insert.BindString(column++, info.by_ext_or_web_app_id); statement_insert.BindString(column++, info.by_ext_name); + statement_insert.BindInt(column++, info.is_by_web_app ? 1 : 0); statement_insert.BindString(column++, info.etag); statement_insert.BindString(column++, info.last_modified); if (!statement_insert.Run()) {
diff --git a/components/history/core/browser/download_database.h b/components/history/core/browser/download_database.h index 1abe8ac..8f334ff2 100644 --- a/components/history/core/browser/download_database.h +++ b/components/history/core/browser/download_database.h
@@ -109,6 +109,10 @@ // Returns true if able to add the finished column to downloads slices table. bool MigrateDownloadSliceFinished(); + // Returns true if able to rename the by_ext_id column to by_ext_or_web_app_id + // and add the is_by_web_app column. + bool MigrateDownloadByWebApp(); + // Creates the downloads table if needed. bool InitDownloadTable();
diff --git a/components/history/core/browser/download_row.cc b/components/history/core/browser/download_row.cc index b59060c..63417e2 100644 --- a/components/history/core/browser/download_row.cc +++ b/components/history/core/browser/download_row.cc
@@ -31,8 +31,9 @@ interrupt_reason == rhs.interrupt_reason && hash == rhs.hash && id == rhs.id && guid == rhs.guid && opened == rhs.opened && last_access_time == rhs.last_access_time && - transient == rhs.transient && by_ext_id == rhs.by_ext_id && - by_ext_name == rhs.by_ext_name && + transient == rhs.transient && + by_ext_or_web_app_id == rhs.by_ext_or_web_app_id && + by_ext_name == rhs.by_ext_name && is_by_web_app == rhs.is_by_web_app && download_slice_info == rhs.download_slice_info; }
diff --git a/components/history/core/browser/download_row.h b/components/history/core/browser/download_row.h index e5619573..eefd327a 100644 --- a/components/history/core/browser/download_row.h +++ b/components/history/core/browser/download_row.h
@@ -123,9 +123,15 @@ // completion and not shown in the UI. bool transient = false; - // The id and name of the extension that created this download. - std::string by_ext_id; + // Field that either contains the id of the extension that created this + // download, or the id of the web app that created this download. These are + // mutually exclusive. + std::string by_ext_or_web_app_id; + // The name of the extension that created this download. std::string by_ext_name; + // Whether the field `by_ext_or_web_app_id` is for a web app. (true = web app, + // false = extension.) Is false if that field is empty. + bool is_by_web_app = false; // Data slices that have been downloaded so far. The slices must be ordered // by their offset.
diff --git a/components/history/core/browser/history_backend_db_unittest.cc b/components/history/core/browser/history_backend_db_unittest.cc index 1694877b..68672d4 100644 --- a/components/history/core/browser/history_backend_db_unittest.cc +++ b/components/history/core/browser/history_backend_db_unittest.cc
@@ -95,8 +95,9 @@ EXPECT_EQ(DownloadDangerType::NOT_DANGEROUS, downloads[0].danger_type); EXPECT_EQ(kTestDownloadInterruptReasonNone, downloads[0].interrupt_reason); EXPECT_FALSE(downloads[0].opened); - EXPECT_EQ("by_ext_id", downloads[0].by_ext_id); + EXPECT_EQ("by_ext_id", downloads[0].by_ext_or_web_app_id); EXPECT_EQ("by_ext_name", downloads[0].by_ext_name); + EXPECT_FALSE(downloads[0].is_by_web_app); EXPECT_EQ("application/vnd.oasis.opendocument.text", downloads[0].mime_type); EXPECT_EQ("application/octet-stream", downloads[0].original_mime_type); @@ -388,8 +389,10 @@ EXPECT_EQ(cur_version, s.ColumnInt(0)); } { + // by_ext_id was renamed to by_ext_or_web_app_id in migration to + // version 64. sql::Statement s(db.GetUniqueStatement( - "SELECT by_ext_id, by_ext_name from downloads")); + "SELECT by_ext_or_web_app_id, by_ext_name from downloads")); EXPECT_TRUE(s.Step()); EXPECT_EQ(std::string(), s.ColumnString(0)); EXPECT_EQ(std::string(), s.ColumnString(1)); @@ -900,7 +903,7 @@ download_A.opened = false; download_A.last_access_time = last_access_time; download_A.transient = true; - download_A.by_ext_id = "extension-id"; + download_A.by_ext_or_web_app_id = "extension-id"; download_A.by_ext_name = "extension-name"; ASSERT_TRUE(db_->CreateDownload(download_A)); @@ -937,8 +940,9 @@ download_B.opened = false; download_B.last_access_time = last_access_time2; download_B.transient = true; - download_B.by_ext_id = "extension-id"; - download_B.by_ext_name = "extension-name"; + download_B.by_ext_or_web_app_id = "web-app-id"; + download_B.by_ext_name = ""; + download_B.is_by_web_app = true; ASSERT_TRUE(db_->CreateDownload(download_B)); @@ -997,7 +1001,7 @@ download.opened = false; download.last_access_time = last_access_time; download.transient = false; - download.by_ext_id = "extension-id"; + download.by_ext_or_web_app_id = "extension-id"; download.by_ext_name = "extension-name"; db_->CreateDownload(download); @@ -1015,8 +1019,9 @@ download.hash = "some-other-hash"; download.opened = !download.opened; download.transient = !download.transient; - download.by_ext_id = "by-new-extension-id"; - download.by_ext_name = "by-new-extension-name"; + download.by_ext_or_web_app_id = "by-new-web-app-id"; + download.by_ext_name = ""; + download.is_by_web_app = true; download.etag = "new-etag"; download.last_modified = "new-last-modified"; @@ -1120,7 +1125,7 @@ download.opened = false; download.last_access_time = now; download.transient = false; - download.by_ext_id = "by_ext_id"; + download.by_ext_or_web_app_id = "by_ext_or_web_app_id"; download.by_ext_name = "by_ext_name"; // Creating records without any urls should fail. @@ -1258,7 +1263,7 @@ download.opened = false; download.last_access_time = download.start_time + base::Hours(5); download.transient = false; - download.by_ext_id = "extension-id"; + download.by_ext_or_web_app_id = "extension-id"; download.by_ext_name = "extension-name"; download.download_slice_info.push_back( DownloadSliceInfo(download.id, 500, download.received_bytes, true)); @@ -1308,7 +1313,7 @@ download.opened = false; download.last_access_time = download.start_time + base::Hours(5); download.transient = true; - download.by_ext_id = "extension-id"; + download.by_ext_or_web_app_id = "extension-id"; download.by_ext_name = "extension-name"; ASSERT_TRUE(db_->CreateDownload(download)); @@ -1353,7 +1358,7 @@ download.opened = false; download.last_access_time = download.start_time + base::Hours(5); download.transient = true; - download.by_ext_id = "extension-id"; + download.by_ext_or_web_app_id = "extension-id"; download.by_ext_name = "extension-name"; download.download_slice_info.push_back( DownloadSliceInfo(download.id, 0, download.received_bytes, false)); @@ -1380,6 +1385,53 @@ EXPECT_EQ(0u, results[0].download_slice_info.size()); } +// Test that the web app responsible for a download is recorded. +TEST_F(HistoryBackendDBTest, UpdateDownloadByWebApp) { + CreateBackendAndDatabase(); + + DownloadRow download; + download.current_path = base::FilePath(FILE_PATH_LITERAL("/path/1")); + download.target_path = base::FilePath(FILE_PATH_LITERAL("/path/2")); + download.url_chain.push_back(GURL("http://example.com/a")); + download.referrer_url = GURL("http://example.com/referrer"); + download.site_url = GURL("http://example.com"); + download.embedder_download_data = "embedder_download_data"; + download.tab_url = GURL("http://example.com/tab-url"); + download.tab_referrer_url = GURL("http://example.com/tab-referrer"); + download.http_method = "GET"; + download.mime_type = "mime/type"; + download.original_mime_type = "original/mime-type"; + download.start_time = base::Time::Now(); + download.end_time = download.start_time + base::Hours(1); + download.etag = "etag1"; + download.last_modified = "last_modified_1"; + download.received_bytes = 0; + download.total_bytes = 1500; + download.state = DownloadState::INTERRUPTED; + download.danger_type = DownloadDangerType::NOT_DANGEROUS; + download.interrupt_reason = kTestDownloadInterruptReasonCrash; + download.hash = "hash-value1"; + download.id = 1; + download.guid = "FE672168-26EF-4275-A149-FEC25F6A75F9"; + download.opened = false; + download.last_access_time = download.start_time + base::Hours(5); + download.transient = true; + download.by_ext_or_web_app_id = "extension-id"; + download.by_ext_name = "extension-name"; + + ASSERT_TRUE(db_->CreateDownload(download)); + + // Add a new web app id and call UpdateDownload(). + download.by_ext_or_web_app_id = "by_web_app_id"; + download.is_by_web_app = true; + ASSERT_TRUE(db_->UpdateDownload(download)); + std::vector<DownloadRow> results; + db_->QueryDownloads(&results); + ASSERT_EQ(1u, results.size()); + EXPECT_EQ(download.by_ext_or_web_app_id, results[0].by_ext_or_web_app_id); + EXPECT_TRUE(results[0].is_by_web_app); +} + TEST_F(HistoryBackendDBTest, MigratePresentations) { // Create the db we want. Use 22 since segments didn't change in that time // frame. @@ -2807,6 +2859,71 @@ } } +TEST_F(HistoryBackendDBTest, MigrateDownloadByWebApp) { + ASSERT_NO_FATAL_FAILURE(CreateDBVersion(63)); + + // Precondition: Open the old version of the DB and make sure the new columns + // don't exist yet. + { + sql::Database db; + ASSERT_TRUE(db.Open(history_dir_.Append(kHistoryFilename))); + ASSERT_FALSE(db.DoesColumnExist("downloads", "by_ext_or_web_app_id")); + ASSERT_FALSE(db.DoesColumnExist("downloads", "is_by_web_app")); + { + sql::Statement s(db.GetUniqueStatement( + "INSERT INTO downloads (" + " id, guid, current_path, target_path, start_time, received_bytes," + " total_bytes, state, danger_type, interrupt_reason, hash," + " end_time, opened, last_access_time, transient, referrer, " + " site_url, embedder_download_data, tab_url, tab_referrer_url, " + " http_method, by_ext_id, by_ext_name, etag, last_modified, " + " mime_type, original_mime_type)" + "VALUES(" + " 1, '435A5C7A-F6B7-4DF2-8696-22E4FCBA3EB2', 'foo.txt', 'foo.txt'," + " 13104873187307670, 11, 11, 1, 0, 0, X'', 13104873187521021, 0, " + " 13104873187521021, 0, 'http://example.com/dl/'," + " 'http://example.com', '', '', '', '', 'extension-id'," + " 'extension-name', '', '', 'text/plain', 'text/plain')")); + ASSERT_TRUE(s.Run()); + } + { + sql::Statement s(db.GetUniqueStatement( + "INSERT INTO downloads_url_chains (id, chain_index, url) VALUES " + "(1, 0, 'https://example.com')")); + ASSERT_TRUE(s.Run()); + } + } + + // Re-open the db using the HistoryDatabase, which should migrate to the + // current version. + CreateBackendAndDatabase(); + DeleteBackend(); + { + // Re-open the db for manual manipulation. + sql::Database db; + ASSERT_TRUE(db.Open(history_dir_.Append(kHistoryFilename))); + // The version should have been updated. + int cur_version = HistoryDatabase::GetCurrentVersion(); + ASSERT_LE(64, cur_version); + { + sql::Statement s(db.GetUniqueStatement( + "SELECT value FROM meta WHERE key = 'version'")); + EXPECT_TRUE(s.Step()); + EXPECT_EQ(cur_version, s.ColumnInt(0)); + } + { + // The downloads table should have the by_ext_id column renamed to + // by_ext_or_web_app_id, and should have the new is_by_web_app column + // initialized to zero. + sql::Statement s(db.GetUniqueStatement( + "SELECT by_ext_or_web_app_id, is_by_web_app from downloads")); + EXPECT_TRUE(s.Step()); + EXPECT_EQ("extension-id", s.ColumnString(0)); + EXPECT_EQ(0, s.ColumnInt(1)); + } + } +} + // ^^^ NEW MIGRATION TESTS GO HERE ^^^ // Preparation for the next DB migration: This test verifies that the test DB
diff --git a/components/history/core/browser/history_database.cc b/components/history/core/browser/history_database.cc index 8172deea..2937cc12 100644 --- a/components/history/core/browser/history_database.cc +++ b/components/history/core/browser/history_database.cc
@@ -39,7 +39,7 @@ // Current version number. We write databases at the "current" version number, // but any previous version that can read the "compatible" one can make do with // our database without *too* many bad effects. -const int kCurrentVersionNumber = 63; +const int kCurrentVersionNumber = 64; const int kCompatibleVersionNumber = 16; const char kEarlyExpirationThresholdKey[] = "early_expiration_threshold"; @@ -942,6 +942,15 @@ std::ignore = meta_table_.SetVersionNumber(cur_version); } + if (cur_version == 63) { + if (!MigrateDownloadByWebApp()) { + return LogMigrationFailure(63); + } + cur_version++; + // TODO(crbug.com/1414092): Handle failure instead of ignoring it. + std::ignore = meta_table_.SetVersionNumber(cur_version); + } + // ========================= ^^ new migration code goes here ^^ // ADDING NEW MIGRATION CODE // =========================
diff --git a/components/history/core/test/history_backend_db_base_test.cc b/components/history/core/test/history_backend_db_base_test.cc index 0f51e52..361265d 100644 --- a/components/history/core/test/history_backend_db_base_test.cc +++ b/components/history/core/test/history_backend_db_base_test.cc
@@ -144,8 +144,9 @@ download.opened = false; download.last_access_time = time; download.transient = true; - download.by_ext_id = "by_ext_id"; + download.by_ext_or_web_app_id = "by_ext_id"; download.by_ext_name = "by_ext_name"; + download.is_by_web_app = false; return db_->CreateDownload(download); }
diff --git a/components/history_clusters/core/history_clusters_service.cc b/components/history_clusters/core/history_clusters_service.cc index 2302fe1..f9afa3fc 100644 --- a/components/history_clusters/core/history_clusters_service.cc +++ b/components/history_clusters/core/history_clusters_service.cc
@@ -107,6 +107,8 @@ return keyword_map; } +constexpr base::TimeDelta kAllKeywordsCacheRefreshAge = base::Hours(2); + } // namespace HistoryClustersService::HistoryClustersService( @@ -447,7 +449,8 @@ } // 2 hour threshold chosen arbitrarily for cache refresh time. - if ((base::Time::Now() - all_keywords_cache_timestamp_) > base::Hours(2)) { + if ((base::Time::Now() - all_keywords_cache_timestamp_) > + kAllKeywordsCacheRefreshAge) { // Update the timestamp right away, to prevent this from running again. // (The cache_query_task_tracker_ should also do this.) all_keywords_cache_timestamp_ = base::Time::Now(); @@ -606,9 +609,14 @@ const base::Value::Dict* all_keywords_dict = all_cache_dict.FindDict("all_keywords"); all_keywords_cache_ = DictToKeywordsCache(all_keywords_dict); - all_keywords_cache_timestamp_ = + // When loading `all_keywords_cache_` from the prefs, make sure it will be + // refreshed after 15 seconds, regardless of the persisted timestamp. This is + // to account for new synced visits, and to flush away stale data on restart. + // Extra 15 seconds is to avoid impacting startup. https://crbug.com/1444256. + all_keywords_cache_timestamp_ = std::min( base::ValueToTime(all_cache_dict.Find("all_timestamp")) - .value_or(all_keywords_cache_timestamp_); + .value_or(all_keywords_cache_timestamp_), + base::Time::Now() - kAllKeywordsCacheRefreshAge + base::Seconds(15)); base::UmaHistogramCustomTimes( "History.Clusters.KeywordCache.LoadCachesFromPrefs.Latency",
diff --git a/components/history_clusters/core/history_clusters_service_unittest.cc b/components/history_clusters/core/history_clusters_service_unittest.cc index 4168ba9..8839490 100644 --- a/components/history_clusters/core/history_clusters_service_unittest.cc +++ b/components/history_clusters/core/history_clusters_service_unittest.cc
@@ -155,6 +155,15 @@ ResetHistoryClustersServiceWithLocale("en-US"); } + void TearDown() override { + // Give history a chance to flush out the task to avoid memory leaks. + history::BlockUntilHistoryProcessesPendingRequests(history_service_.get()); + + history_clusters_service_.reset(); + pref_service_.reset(); + history_service_.reset(); + } + HistoryClustersServiceTestBase(const HistoryClustersServiceTestBase&) = delete; HistoryClustersServiceTestBase& operator=( @@ -1400,6 +1409,130 @@ ExpectSyncedVisits()); } +class HistoryClustersServicePrefPersistenceTest + : public HistoryClustersServiceTestBase { + public: + HistoryClustersServicePrefPersistenceTest() { + scoped_feature_list_.InitWithFeatures( + /*enabled_features=*/{internal::kJourneys, + internal::kJourneysPersistCachesToPrefs}, + /*disabled_features=*/{}); + Config config; + config.persist_clusters_in_history_db = true; + // TODO(b/276488340): Update this test when non context clusterer code gets + // cleaned up. + config.use_navigation_context_clusters = false; + SetConfigForTesting(config); + } +}; + +TEST_F(HistoryClustersServicePrefPersistenceTest, LoadCachesFromPrefs) { + AddHardcodedTestDataToHistoryService(); + EXPECT_FALSE(history_clusters_service_->DoesQueryMatchAnyCluster("apples")); + + std::vector<history::Cluster> clusters; + clusters.push_back(history::Cluster( + 0, + { + GetHardcodedClusterVisit(5), + GetHardcodedClusterVisit(2), + }, + {{u"apples", + history::ClusterKeywordData(history::ClusterKeywordData::kEntity, 5.0f, + {"fuji", "honeycrisp"})}, + {u"oranges", history::ClusterKeywordData( + history::ClusterKeywordData::kSearchTerms, 100.0f, {})}, + {u"z", history::ClusterKeywordData()}, + {u"apples bananas", history::ClusterKeywordData()}}, + /*should_show_on_prominent_ui_surfaces=*/true)); + + FlushKeywordRequests(clusters, 3); + + const auto keyword_data = + history_clusters_service_->DoesQueryMatchAnyCluster("apples"); + EXPECT_TRUE(keyword_data); + + // Empty the cache artificially to simulate a process restart. + history_clusters_service_test_api_->SetAllKeywordsCache({}); + EXPECT_FALSE(history_clusters_service_->DoesQueryMatchAnyCluster("apples")); + + LoadCachesFromPrefs(); + + const auto apples_keyword_data = + history_clusters_service_->DoesQueryMatchAnyCluster("apples"); + EXPECT_TRUE(apples_keyword_data); + EXPECT_EQ(apples_keyword_data, + history::ClusterKeywordData(history::ClusterKeywordData::kEntity, + 5.0f, {"fuji", "honeycrisp"})); + const auto oranges_keyword_data = + history_clusters_service_->DoesQueryMatchAnyCluster("oranges"); + EXPECT_TRUE(oranges_keyword_data); + EXPECT_EQ(oranges_keyword_data, + history::ClusterKeywordData(history::ClusterKeywordData( + history::ClusterKeywordData::kSearchTerms, 100.0f, {}))); + EXPECT_TRUE( + history_clusters_service_->DoesQueryMatchAnyCluster("apples bananas")); +} + +TEST_F(HistoryClustersServicePrefPersistenceTest, + LoadSecondaryCachesFromPrefs) { + AddHardcodedTestDataToHistoryService(); + auto minutes_ago = [](int minutes) { + return base::Time::Now() - base::Minutes(minutes); + }; + + // Set up the cache timestamps. + history_clusters_service_test_api_->SetAllKeywordsCacheTimestamp( + minutes_ago(60)); + history_clusters_service_test_api_->SetShortKeywordCacheTimestamp( + minutes_ago(15)); + + // Set up the visit timestamps. + // Visits newer than both cache timestamps should be reclustered. + auto visit = GetHardcodedTestVisits()[0]; + visit.visit_row.visit_time = minutes_ago(5); + AddCompleteVisit(visit); + visit = GetHardcodedTestVisits()[1]; + visit.visit_row.visit_time = minutes_ago(10); + AddCompleteVisit(visit); + + // Kick off cluster request and verify the correct visits are sent. + EXPECT_FALSE(history_clusters_service_->DoesQueryMatchAnyCluster("peach")); + test_clustering_backend_->WaitForGetClustersCall(); + + // Send the cluster response and verify the keyword was cached. + std::vector<history::Cluster> clusters2; + clusters2.push_back(history::Cluster( + 0, + { + GetHardcodedClusterVisit(1), + GetHardcodedClusterVisit(2), + }, + {{u"peach", + history::ClusterKeywordData(history::ClusterKeywordData::kEntity, 13.0f, + {"georgia"})}, + {u"", history::ClusterKeywordData()}}, + /*should_show_on_prominent_ui_surfaces=*/true)); + test_clustering_backend_->FulfillCallback(clusters2); + history::BlockUntilHistoryProcessesPendingRequests(history_service_.get()); + EXPECT_TRUE(history_clusters_service_->DoesQueryMatchAnyCluster("peach")); + + // Verify the keyword is in the short cache specifically. + history_clusters_service_test_api_->SetAllKeywordsCache({}); + EXPECT_TRUE(history_clusters_service_->DoesQueryMatchAnyCluster("peach")); + + // Empty the cache artificially to simulate a process restart. + history_clusters_service_test_api_->SetShortKeywordCache({}); + EXPECT_FALSE(history_clusters_service_->DoesQueryMatchAnyCluster("peach")); + + LoadCachesFromPrefs(); + const auto peach_keyword_data = + history_clusters_service_->DoesQueryMatchAnyCluster("peach"); + EXPECT_EQ(peach_keyword_data, + history::ClusterKeywordData(history::ClusterKeywordData( + history::ClusterKeywordData::kEntity, 13.0f, {"georgia"}))); +} + class HistoryClustersServiceJourneysDisabledTest : public HistoryClustersServiceTestBase { public:
diff --git a/components/metrics/structured/BUILD.gn b/components/metrics/structured/BUILD.gn index e5ed8592..fbe7dbc 100644 --- a/components/metrics/structured/BUILD.gn +++ b/components/metrics/structured/BUILD.gn
@@ -24,10 +24,6 @@ "structured_metrics_provider.h", "structured_metrics_recorder.cc", "structured_metrics_recorder.h", - "structured_metrics_scheduler.cc", - "structured_metrics_scheduler.h", - "structured_metrics_service.cc", - "structured_metrics_service.h", ] public_deps = [ @@ -243,7 +239,6 @@ "persistent_proto_unittest.cc", "structured_metrics_provider_unittest.cc", "structured_metrics_recorder_unittest.cc", - "structured_metrics_service_unittest.cc", ] deps = [ @@ -254,10 +249,7 @@ ":structured_metrics_validator", "//base", "//base/test:test_support", - "//components/metrics", - "//components/metrics:test_support", "//components/prefs", - "//components/prefs:test_support", "//testing/gtest", ] }
diff --git a/components/metrics/structured/reporting/structured_metrics_reporting_service.cc b/components/metrics/structured/reporting/structured_metrics_reporting_service.cc index ff84cf28..6ddc2aa 100644 --- a/components/metrics/structured/reporting/structured_metrics_reporting_service.cc +++ b/components/metrics/structured/reporting/structured_metrics_reporting_service.cc
@@ -28,21 +28,10 @@ client->GetUploadSigningKey(), /* logs_event_manager=*/nullptr) {} -void StructuredMetricsReportingService::StoreLog( - const std::string& serialized_log, - metrics::MetricsLogsEventManager::CreateReason reason) { - LogMetadata metadata; - log_store_.StoreLog(serialized_log, metadata, reason); -} - metrics::LogStore* StructuredMetricsReportingService::log_store() { return &log_store_; } -void StructuredMetricsReportingService::Purge() { - log_store_.Purge(); -} - // Getters for MetricsLogUploader parameters. GURL StructuredMetricsReportingService::GetUploadUrl() const { return client()->GetMetricsServerUrl(); @@ -66,5 +55,4 @@ PrefRegistrySimple* registry) { registry->RegisterListPref(prefs::kLogStoreName); } - } // namespace metrics::structured::reporting
diff --git a/components/metrics/structured/reporting/structured_metrics_reporting_service.h b/components/metrics/structured/reporting/structured_metrics_reporting_service.h index 42c91ea9..b6bf4e5 100644 --- a/components/metrics/structured/reporting/structured_metrics_reporting_service.h +++ b/components/metrics/structured/reporting/structured_metrics_reporting_service.h
@@ -31,17 +31,12 @@ PrefService* local_state, const StorageLimits& storage_limits); - void StoreLog(const std::string& serialized_log, - metrics::MetricsLogsEventManager::CreateReason reason); - - // metrics::ReportingService: - metrics::LogStore* log_store() override; - - void Purge(); - static void RegisterPrefs(PrefRegistrySimple* registry); private: + // metrics::ReportingService: + metrics::LogStore* log_store() override; + // Getters for MetricsLogUploader parameters. GURL GetUploadUrl() const override; GURL GetInsecureUploadUrl() const override;
diff --git a/components/metrics/structured/structured_metrics_features.cc b/components/metrics/structured/structured_metrics_features.cc index 57e7564a..e7fdbd20 100644 --- a/components/metrics/structured/structured_metrics_features.cc +++ b/components/metrics/structured/structured_metrics_features.cc
@@ -4,6 +4,8 @@ #include "components/metrics/structured/structured_metrics_features.h" +#include "base/metrics/field_trial_params.h" + namespace metrics::structured { BASE_FEATURE(kStructuredMetrics, @@ -35,24 +37,6 @@ constexpr base::FeatureParam<std::string> kDisallowedProjectsParam{ &kStructuredMetrics, "disabled_projects", ""}; -constexpr base::FeatureParam<int> kMinLogQueueCount{ - &kEnabledStructuredMetricsService, "min_log_queue_count", 10}; - -constexpr base::FeatureParam<int> kMinLogQueueSizeBytes{ - &kEnabledStructuredMetricsService, "min_log_queue_size_bytes", - 300 * 1024 * 1024 // 300 KiB -}; - -constexpr base::FeatureParam<int> kMaxLogSizeBytes{ - &kEnabledStructuredMetricsService, "max_log_size_bytes", - 1024 * 1024 * 1024 // 1 MiB -}; - -constexpr base::FeatureParam<int> kUploadTimeInSeconds{ - &kEnabledStructuredMetricsService, "upload_time_in_seconds", - 40 * 60 // 40 minutes -}; - bool IsIndependentMetricsUploadEnabled() { return base::GetFieldTrialParamByFeatureAsBool( kStructuredMetrics, "enable_independent_metrics_upload", true); @@ -70,8 +54,4 @@ return kDisallowedProjectsParam.Get(); } -int GetUploadInterval() { - return kUploadTimeInSeconds.Get(); -} - } // namespace metrics::structured
diff --git a/components/metrics/structured/structured_metrics_features.h b/components/metrics/structured/structured_metrics_features.h index 1c55b220..bd921ff 100644 --- a/components/metrics/structured/structured_metrics_features.h +++ b/components/metrics/structured/structured_metrics_features.h
@@ -6,7 +6,6 @@ #define COMPONENTS_METRICS_STRUCTURED_STRUCTURED_METRICS_FEATURES_H_ #include "base/feature_list.h" -#include "base/metrics/field_trial_params.h" namespace metrics::structured { @@ -25,15 +24,6 @@ // provider. BASE_DECLARE_FEATURE(kEnabledStructuredMetricsService); -// Controls the minimum number of logs to be stored. -extern const base::FeatureParam<int> kMinLogQueueCount; - -// Controls the minimum size of all logs that can be stored in bytes. -extern const base::FeatureParam<int> kMinLogQueueSizeBytes; - -// Controls the maximum size of a single log in bytes. -extern const base::FeatureParam<int> kMaxLogSizeBytes; - // TODO(crbug.com/1148168): This is a temporary switch to revert structured // metrics upload to its old behaviour. Old behaviour: // - all metrics are uploaded in the main UMA upload @@ -60,9 +50,6 @@ // recorded. std::string GetDisabledProjects(); -// Retrieves the Structured Metrics upload interval (defaults to 40 minutes). -int GetUploadInterval(); - } // namespace metrics::structured #endif // COMPONENTS_METRICS_STRUCTURED_STRUCTURED_METRICS_FEATURES_H_
diff --git a/components/metrics/structured/structured_metrics_recorder.h b/components/metrics/structured/structured_metrics_recorder.h index e77469e..23eb33b 100644 --- a/components/metrics/structured/structured_metrics_recorder.h +++ b/components/metrics/structured/structured_metrics_recorder.h
@@ -95,7 +95,6 @@ friend class StructuredMetricsRecorderHwidTest; friend class TestStructuredMetricsRecorder; friend class TestStructuredMetricsProvider; - friend class StructuredMetricsServiceTest; // files that are asynchronously read from disk at startup. When all files // have been read, the provider has been initialized.
diff --git a/components/metrics/structured/structured_metrics_scheduler.cc b/components/metrics/structured/structured_metrics_scheduler.cc deleted file mode 100644 index fed3374..0000000 --- a/components/metrics/structured/structured_metrics_scheduler.cc +++ /dev/null
@@ -1,18 +0,0 @@ -// Copyright 2023 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/metrics/structured/structured_metrics_scheduler.h" - -namespace metrics::structured { -StructuredMetricsScheduler::StructuredMetricsScheduler( - const base::RepeatingClosure& rotation_callback, - const base::RepeatingCallback<base::TimeDelta(void)>& interval_callback, - bool fast_startup_for_testing) - : metrics::MetricsRotationScheduler(rotation_callback, - interval_callback, - fast_startup_for_testing) {} - -StructuredMetricsScheduler::~StructuredMetricsScheduler() = default; - -} // namespace metrics::structured
diff --git a/components/metrics/structured/structured_metrics_scheduler.h b/components/metrics/structured/structured_metrics_scheduler.h deleted file mode 100644 index e255aa2..0000000 --- a/components/metrics/structured/structured_metrics_scheduler.h +++ /dev/null
@@ -1,34 +0,0 @@ -// Copyright 2023 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_METRICS_STRUCTURED_STRUCTURED_METRICS_SCHEDULER_H_ -#define COMPONENTS_METRICS_STRUCTURED_STRUCTURED_METRICS_SCHEDULER_H_ - -#include "base/time/time.h" -#include "components/metrics/metrics_rotation_scheduler.h" - -namespace metrics::structured { - -// Schedulers a periodic rotation of logs and initiates a log upload to the -// reporting service. -class StructuredMetricsScheduler : public metrics::MetricsRotationScheduler { - public: - // Creates StructuredMetricsScheduler object with the given - // |rotation_callback| callback to call when log rotation should happen and - // |interval_callback| to determine the interval between rotations in steady - // state. - StructuredMetricsScheduler( - const base::RepeatingClosure& rotation_callback, - const base::RepeatingCallback<base::TimeDelta(void)>& interval_callback, - bool fast_startup_for_testing); - - StructuredMetricsScheduler(const StructuredMetricsScheduler&) = delete; - StructuredMetricsScheduler& operator=(const StructuredMetricsScheduler&) = - delete; - - ~StructuredMetricsScheduler() override; -}; -} // namespace metrics::structured - -#endif // COMPONENTS_METRICS_STRUCTURED_STRUCTURED_METRICS_SCHEDULER_H_
diff --git a/components/metrics/structured/structured_metrics_service.cc b/components/metrics/structured/structured_metrics_service.cc deleted file mode 100644 index 1b7ef09..0000000 --- a/components/metrics/structured/structured_metrics_service.cc +++ /dev/null
@@ -1,158 +0,0 @@ -// Copyright 2023 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/metrics/structured/structured_metrics_service.h" - -#include "components/metrics/metrics_service_client.h" -#include "components/metrics/structured/reporting/structured_metrics_reporting_service.h" -#include "components/metrics/structured/structured_metrics_features.h" - -namespace metrics::structured { - -StructuredMetricsService::StructuredMetricsService( - base::raw_ptr<MetricsProvider> system_profile_provider, - MetricsServiceClient* client, - PrefService* local_state) - : StructuredMetricsService(client, - local_state, - std::make_unique<StructuredMetricsRecorder>( - system_profile_provider)) {} - -StructuredMetricsService::~StructuredMetricsService() = default; - -void StructuredMetricsService::EnableRecording() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (!initialize_complete_) { - Initialize(); - } - recorder_->EnableRecording(); -} - -void StructuredMetricsService::DisableRecording() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - recorder_->DisableRecording(); -} - -void StructuredMetricsService::EnableReporting() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (!reporting_active()) { - scheduler_->Start(); - } - reporting_service_->EnableReporting(); -} - -void StructuredMetricsService::DisableReporting() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - reporting_service_->DisableReporting(); - scheduler_->Stop(); -} - -void StructuredMetricsService::Flush( - metrics::MetricsLogsEventManager::CreateReason reason) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - BuildAndStoreLog(reason); - reporting_service_->log_store()->TrimAndPersistUnsentLogs(true); -} - -void StructuredMetricsService::Purge() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - recorder_->Purge(); - reporting_service_->Purge(); -} - -StructuredMetricsService::StructuredMetricsService( - MetricsServiceClient* client, - PrefService* local_state, - std::unique_ptr<StructuredMetricsRecorder> recorder) - : recorder_(std::move(recorder)), client_(client) { - DCHECK(client); - DCHECK(local_state); - - // Setup the reporting service. - const reporting::StorageLimits storage_limits = GetLogStoreLimits(); - - reporting_service_ = - std::make_unique<reporting::StructuredMetricsReportingService>( - client, local_state, storage_limits); - - reporting_service_->Initialize(); - - // Setup the log rotation scheduler. - base::RepeatingClosure rotate_callback = base::BindRepeating( - &StructuredMetricsService::RotateLogsAndSend, weak_factory_.GetWeakPtr()); - base::RepeatingCallback<base::TimeDelta(void)> get_upload_interval_callback = - base::BindRepeating(&StructuredMetricsService::GetUploadTimeInterval, - base::Unretained(this)); - - const bool fast_startup_for_test = client->ShouldStartUpFastForTesting(); - scheduler_ = std::make_unique<StructuredMetricsScheduler>( - rotate_callback, get_upload_interval_callback, fast_startup_for_test); -} - -base::TimeDelta StructuredMetricsService::GetUploadTimeInterval() { - return base::Seconds(GetUploadInterval()); -} - -void StructuredMetricsService::RotateLogsAndSend() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (recorder_->events()->non_uma_events_size() == 0) { - return; - } - - if (!reporting_service_->log_store()->has_unsent_logs()) { - BuildAndStoreLog(metrics::MetricsLogsEventManager::CreateReason::kPeriodic); - } - reporting_service_->Start(); - scheduler_->RotationFinished(); -} - -void StructuredMetricsService::BuildAndStoreLog( - metrics::MetricsLogsEventManager::CreateReason reason) { - ChromeUserMetricsExtension uma_proto; - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - InitializeUmaProto(uma_proto); - recorder_->ProvideEventMetrics(uma_proto); - const std::string serialized_log = SerializeLog(uma_proto); - reporting_service_->StoreLog(serialized_log, reason); -} - -void StructuredMetricsService::Initialize() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(!initialize_complete_); - - initialize_complete_ = true; - - // Notifies the scheduler that it is ready to start creating logs. - scheduler_->InitTaskComplete(); -} - -void StructuredMetricsService::InitializeUmaProto( - ChromeUserMetricsExtension& uma_proto) { - const int32_t product = client_->GetProduct(); - if (product != uma_proto.product()) { - uma_proto.set_product(product); - } -} - -// static: -std::string StructuredMetricsService::SerializeLog( - const ChromeUserMetricsExtension& uma_proto) { - std::string log_data; - DCHECK(uma_proto.SerializeToString(&log_data)); - return log_data; -} - -void StructuredMetricsService::RegisterPrefs(PrefRegistrySimple* registry) { - reporting::StructuredMetricsReportingService::RegisterPrefs(registry); -} - -reporting::StorageLimits StructuredMetricsService::GetLogStoreLimits() { - return reporting::StorageLimits{ - .min_log_queue_count = static_cast<size_t>(kMinLogQueueCount.Get()), - .min_log_queue_size = static_cast<size_t>(kMinLogQueueSizeBytes.Get()), - .max_log_size = static_cast<size_t>(kMaxLogSizeBytes.Get()), - }; -} - -} // namespace metrics::structured
diff --git a/components/metrics/structured/structured_metrics_service.h b/components/metrics/structured/structured_metrics_service.h deleted file mode 100644 index cb60d4f..0000000 --- a/components/metrics/structured/structured_metrics_service.h +++ /dev/null
@@ -1,105 +0,0 @@ -// Copyright 2023 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_METRICS_STRUCTURED_STRUCTURED_METRICS_SERVICE_H_ -#define COMPONENTS_METRICS_STRUCTURED_STRUCTURED_METRICS_SERVICE_H_ - -#include <memory> - -#include "base/memory/weak_ptr.h" -#include "components/metrics/structured/reporting/structured_metrics_reporting_service.h" -#include "components/metrics/structured/structured_metrics_recorder.h" -#include "components/metrics/structured/structured_metrics_scheduler.h" - -FORWARD_DECLARE_TEST(StructuredMetricsServiceTest, RotateLogs); - -class PrefRegistrySimple; - -namespace metrics::structured { - -// The Structured Metrics Service is responsible for collecting and uploading -// Structured Metric events. -class StructuredMetricsService final { - public: - StructuredMetricsService( - base::raw_ptr<MetricsProvider> system_profile_provider, - MetricsServiceClient* client, - PrefService* local_state); - - ~StructuredMetricsService(); - - StructuredMetricsService(const StructuredMetricsService&) = delete; - StructuredMetricsService& operator=(StructuredMetricsService&) = delete; - - void EnableRecording(); - void DisableRecording(); - - void EnableReporting(); - void DisableReporting(); - - // Flushes any event currently in the recorder to prefs. - void Flush(metrics::MetricsLogsEventManager::CreateReason reason); - - // Clears all event and log data. - void Purge(); - - bool reporting_active() const { - return reporting_service_->reporting_active(); - } - - static void RegisterPrefs(PrefRegistrySimple* registry); - - private: - friend class StructuredMetricsServiceTest; - FRIEND_TEST_ALL_PREFIXES(StructuredMetricsServiceTest, RotateLogs); - - StructuredMetricsService(MetricsServiceClient* client, - PrefService* local_state, - std::unique_ptr<StructuredMetricsRecorder> recorder); - - // Callback function to get the upload interval. - base::TimeDelta GetUploadTimeInterval(); - - // Creates a new log and sends any currently stages logs. - void RotateLogsAndSend(); - - // Collects the events from the recorder and builds a new log. - void BuildAndStoreLog(metrics::MetricsLogsEventManager::CreateReason reason); - - // Starts the initialization process for |this|. - void Initialize(); - - // Fills out the UMA proto to be sent. - void InitializeUmaProto(ChromeUserMetricsExtension& uma_proto); - - // Helper function to serialize a ChromeUserMetricsExtension proto. - static std::string SerializeLog(const ChromeUserMetricsExtension& uma_proto); - - // Retrieves the storage parameters to control the reporting service. - static reporting::StorageLimits GetLogStoreLimits(); - - // Manages on-device recording of events. - std::unique_ptr<StructuredMetricsRecorder> recorder_; - - // Service for uploading completed logs. - std::unique_ptr<reporting::StructuredMetricsReportingService> - reporting_service_; - - // Schedules when logs will be created. - std::unique_ptr<StructuredMetricsScheduler> scheduler_; - - // Marks that initialization has completed. - bool initialize_complete_ = false; - - // The metrics client |this| is service is associated. - base::raw_ptr<MetricsServiceClient> client_; - - SEQUENCE_CHECKER(sequence_checker_); - - base::WeakPtrFactory<StructuredMetricsService> weak_factory_{this}; -}; - -} // namespace metrics::structured - -#endif // COMPONENTS_METRICS_STRUCTURED_STRUCTURED_METRICS_SERVICE_H_
diff --git a/components/metrics/structured/structured_metrics_service_unittest.cc b/components/metrics/structured/structured_metrics_service_unittest.cc deleted file mode 100644 index 4a328a97..0000000 --- a/components/metrics/structured/structured_metrics_service_unittest.cc +++ /dev/null
@@ -1,264 +0,0 @@ -// Copyright 2023 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/metrics/structured/structured_metrics_service.h" - -#include "base/files/file_path.h" -#include "base/files/file_util.h" -#include "base/files/scoped_temp_dir.h" -#include "base/test/scoped_feature_list.h" -#include "base/test/task_environment.h" -#include "base/test/test_simple_task_runner.h" -#include "components/metrics/log_decoder.h" -#include "components/metrics/metrics_provider.h" -#include "components/metrics/structured/recorder.h" -#include "components/metrics/structured/reporting/structured_metrics_reporting_service.h" -#include "components/metrics/structured/structured_events.h" -#include "components/metrics/structured/structured_metrics_features.h" -#include "components/metrics/structured/structured_metrics_prefs.h" -#include "components/metrics/structured/structured_metrics_recorder.h" -#include "components/metrics/test/test_metrics_service_client.h" -#include "components/metrics/unsent_log_store.h" -#include "components/metrics/unsent_log_store_metrics_impl.h" -#include "components/prefs/testing_pref_service.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace metrics::structured { -namespace { - -using events::v2::test_project_one::TestEventOne; -using events::v2::test_project_six::TestEventSeven; - -// The name hash of "TestProjectOne". -constexpr uint64_t kProjectOneHash = UINT64_C(16881314472396226433); -// The name hash of "TestProjectThree". -constexpr uint64_t kProjectThreeHash = UINT64_C(10860358748803291132); - -class TestRecorder : public StructuredMetricsClient::RecordingDelegate { - public: - TestRecorder() = default; - TestRecorder(const TestRecorder& recorder) = delete; - TestRecorder& operator=(const TestRecorder& recorder) = delete; - ~TestRecorder() override = default; - - void RecordEvent(Event&& event) override { - Recorder::GetInstance()->RecordEvent(std::move(event)); - } - - bool IsReadyToRecord() const override { return true; } -}; - -class TestSystemProfileProvider : public metrics::MetricsProvider { - public: - TestSystemProfileProvider() = default; - TestSystemProfileProvider(const TestSystemProfileProvider& recorder) = delete; - TestSystemProfileProvider& operator=( - const TestSystemProfileProvider& recorder) = delete; - ~TestSystemProfileProvider() override = default; - - void ProvideSystemProfileMetrics( - metrics::SystemProfileProto* proto) override {} -}; - -} // namespace - -class StructuredMetricsServiceTest : public testing::Test { - public: - StructuredMetricsServiceTest() { - reporting::StructuredMetricsReportingService::RegisterPrefs( - prefs_.registry()); - - Recorder::GetInstance()->SetUiTaskRunner( - task_environment_.GetMainThreadTaskRunner()); - StructuredMetricsClient::Get()->SetDelegate(&test_recorder_); - } - - void SetUp() override { - feature_list_.InitWithFeatures({kEnabledStructuredMetricsService}, {}); - - ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - - WriteTestingDeviceKeys(); - - system_profile_provider_ = std::make_unique<TestSystemProfileProvider>(); - - WriteTestingProfileKeys(); - } - - void Init() { - auto recorder = std::unique_ptr<StructuredMetricsRecorder>( - new StructuredMetricsRecorder(DeviceKeyFilePath(), base::Seconds(0), - system_profile_provider_.get())); - recorder->OnProfileAdded(temp_dir_.GetPath()); - service_ = std::unique_ptr<StructuredMetricsService>( - new StructuredMetricsService(&client_, &prefs_, std::move(recorder))); - Wait(); - } - - void EnableRecording() { service_->EnableRecording(); } - void EnableReporting() { service_->EnableReporting(); } - - void DisableRecording() { service_->DisableRecording(); } - void DisableReporting() { service_->DisableReporting(); } - - base::FilePath ProfileKeyFilePath() { - return temp_dir_.GetPath().Append("structured_metrics").Append("keys"); - } - - base::FilePath DeviceKeyFilePath() { - return temp_dir_.GetPath() - .Append("structured_metrics") - .Append("device_keys"); - } - - void WriteTestingProfileKeys() { - const int today = (base::Time::Now() - base::Time::UnixEpoch()).InDays(); - - KeyDataProto proto; - KeyProto& key_one = (*proto.mutable_keys())[kProjectOneHash]; - key_one.set_key("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); - key_one.set_last_rotation(today); - key_one.set_rotation_period(90); - - KeyProto& key_three = (*proto.mutable_keys())[kProjectThreeHash]; - key_three.set_key("cccccccccccccccccccccccccccccccc"); - key_three.set_last_rotation(today); - key_three.set_rotation_period(90); - - base::CreateDirectory(ProfileKeyFilePath().DirName()); - ASSERT_TRUE( - base::WriteFile(ProfileKeyFilePath(), proto.SerializeAsString())); - Wait(); - } - - void WriteTestingDeviceKeys() { - base::CreateDirectory(DeviceKeyFilePath().DirName()); - ASSERT_TRUE(base::WriteFile(DeviceKeyFilePath(), - KeyDataProto().SerializeAsString())); - Wait(); - } - - int GetPersistedLogCount() { - return prefs_.GetList(prefs::kLogStoreName).size(); - } - - ChromeUserMetricsExtension GetPersistedLog() { - EXPECT_THAT(GetPersistedLogCount(), 1); - metrics::UnsentLogStore result_unsent_log_store( - std::make_unique<UnsentLogStoreMetricsImpl>(), &prefs_, - prefs::kLogStoreName, /*metadata_pref_name=*/nullptr, - /*min_log_count=*/3, /*min_log_bytes=*/1000, - /*max_log_size=*/0, - /*signing_key=*/std::string(), - /*logs_event_manager=*/nullptr); - - result_unsent_log_store.LoadPersistedUnsentLogs(); - result_unsent_log_store.StageNextLog(); - - ChromeUserMetricsExtension uma_proto; - EXPECT_TRUE(metrics::DecodeLogDataToProto( - result_unsent_log_store.staged_log(), &uma_proto)); - return uma_proto; - } - - StructuredMetricsService& service() { return *service_.get(); } - - void Wait() { task_environment_.RunUntilIdle(); } - - void AdvanceClock(int hours) { - task_environment_.AdvanceClock(base::Hours(hours)); - } - - protected: - std::unique_ptr<StructuredMetricsService> service_; - - private: - base::test::ScopedFeatureList feature_list_; - metrics::TestMetricsServiceClient client_; - TestingPrefServiceSimple prefs_; - - std::unique_ptr<TestSystemProfileProvider> system_profile_provider_; - TestRecorder test_recorder_; - base::ScopedTempDir temp_dir_; - - base::test::TaskEnvironment task_environment_{ - base::test::TaskEnvironment::MainThreadType::UI, - base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED, - base::test::TaskEnvironment::TimeSource::MOCK_TIME}; -}; - -TEST_F(StructuredMetricsServiceTest, PurgeInMemory) { - Init(); - - EnableRecording(); - EnableReporting(); - - TestEventOne().SetTestMetricTwo(1).Record(); - TestEventSeven().SetTestMetricSeven(1.0).Record(); - - service_->Purge(); - service_->Flush(metrics::MetricsLogsEventManager::CreateReason::kUnknown); - - const auto uma_proto = GetPersistedLog(); - EXPECT_THAT(uma_proto.structured_data().events().size(), 0); -} - -TEST_F(StructuredMetricsServiceTest, PurgePersisted) { - Init(); - - EnableRecording(); - EnableReporting(); - - TestEventOne().SetTestMetricTwo(1).Record(); - TestEventSeven().SetTestMetricSeven(1.0).Record(); - - service_->Flush(metrics::MetricsLogsEventManager::CreateReason::kUnknown); - - service_->Purge(); - - // Need to make sure there is a log to read. - service_->Flush(metrics::MetricsLogsEventManager::CreateReason::kUnknown); - - const auto uma_proto = GetPersistedLog(); - EXPECT_THAT(uma_proto.structured_data().events().size(), 0); -} - -TEST_F(StructuredMetricsServiceTest, RotateLogs) { - Init(); - - EnableRecording(); - EnableReporting(); - - TestEventOne().SetTestMetricTwo(1).Record(); - TestEventSeven().SetTestMetricSeven(1).Record(); - - service_->Flush(metrics::MetricsLogsEventManager::CreateReason::kUnknown); - - const auto uma_proto = GetPersistedLog(); - EXPECT_THAT(uma_proto.structured_data().events().size(), 2); -} - -TEST_F(StructuredMetricsServiceTest, DoesNotRecordWhenRecordingDisabled) { - Init(); - EnableRecording(); - EnableReporting(); - - TestEventOne().SetTestMetricTwo(1).Record(); - TestEventSeven().SetTestMetricSeven(1).Record(); - - DisableRecording(); - - TestEventOne().SetTestMetricTwo(1).Record(); - TestEventSeven().SetTestMetricSeven(1).Record(); - - EnableRecording(); - - service_->Flush(metrics::MetricsLogsEventManager::CreateReason::kUnknown); - - const auto uma_proto = GetPersistedLog(); - EXPECT_THAT(uma_proto.structured_data().events().size(), 2); -} - -} // namespace metrics::structured
diff --git a/components/metrics/version_utils.cc b/components/metrics/version_utils.cc index bc4e987..34e80a60 100644 --- a/components/metrics/version_utils.cc +++ b/components/metrics/version_utils.cc
@@ -16,7 +16,7 @@ namespace metrics { std::string GetVersionString() { - std::string version = version_info::GetVersionNumber(); + std::string version(version_info::GetVersionNumber()); #if defined(ARCH_CPU_64_BITS) version += "-64"; #endif // defined(ARCH_CPU_64_BITS)
diff --git a/components/minidump_uploader/rewrite_minidumps_as_mimes.cc b/components/minidump_uploader/rewrite_minidumps_as_mimes.cc index 04cc43d8..2cb275e 100644 --- a/components/minidump_uploader/rewrite_minidumps_as_mimes.cc +++ b/components/minidump_uploader/rewrite_minidumps_as_mimes.cc
@@ -230,8 +230,8 @@ crashpad::HTTPMultipartBuilder builder; builder.SetFormData("version", version_number); builder.SetFormData("product", "Chrome_Android"); - builder.SetFormData("channel", version_info::GetChannelString( - version_info::android::GetChannel())); + builder.SetFormData("channel", std::string(version_info::GetChannelString( + version_info::android::GetChannel()))); if (!build_id.empty()) { builder.SetFormData("elf_build_id", build_id); }
diff --git a/components/omnibox/browser/BUILD.gn b/components/omnibox/browser/BUILD.gn index 71cc4bb..5670630 100644 --- a/components/omnibox/browser/BUILD.gn +++ b/components/omnibox/browser/BUILD.gn
@@ -33,6 +33,8 @@ "answer_sunrise.icon", "answer_translation.icon", "answer_when_is.icon", + "arrow_down_chrome_refresh.icon", + "arrow_up_chrome_refresh.icon", "bookmark.icon", "calculator.icon", "chevron.icon",
diff --git a/components/omnibox/browser/android/java/src/org/chromium/components/omnibox/AutocompleteResult.java b/components/omnibox/browser/android/java/src/org/chromium/components/omnibox/AutocompleteResult.java index b36de7ce..03b182d1 100644 --- a/components/omnibox/browser/android/java/src/org/chromium/components/omnibox/AutocompleteResult.java +++ b/components/omnibox/browser/android/java/src/org/chromium/components/omnibox/AutocompleteResult.java
@@ -62,7 +62,7 @@ * @param groupsInfo Additional information about the AutocompleteMatch groups. */ @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) - AutocompleteResult(long nativeResult, @Nullable List<AutocompleteMatch> suggestions, + public AutocompleteResult(long nativeResult, @Nullable List<AutocompleteMatch> suggestions, @Nullable GroupsInfo groupsInfo) { // Consider all locally constructed AutocompleteResult objects as coming from Cache. // These results do not have a native counterpart, meaning there's no corresponding C++
diff --git a/components/omnibox/browser/autocomplete_scoring_model_handler.cc b/components/omnibox/browser/autocomplete_scoring_model_handler.cc index 69eb3b1..f70e0b6 100644 --- a/components/omnibox/browser/autocomplete_scoring_model_handler.cc +++ b/components/omnibox/browser/autocomplete_scoring_model_handler.cc
@@ -87,6 +87,23 @@ model_metadata.value()); } +absl::optional<std::vector<std::vector<float>>> +AutocompleteScoringModelHandler::GetBatchModelInput( + const std::vector<const ScoringSignals*>& scoring_signals_vec) { + std::vector<std::vector<float>> batch_model_input; + for (const auto* scoring_signals : scoring_signals_vec) { + const absl::optional<std::vector<float>> model_input = + GetModelInput(*scoring_signals); + if (model_input) { + batch_model_input.push_back(std::move(*model_input)); + } else { + // Return null if any input in the batch is invalid. + return absl::nullopt; + } + } + return batch_model_input; +} + std::vector<float> AutocompleteScoringModelHandler::ExtractInputFromScoringSignals( const ScoringSignals& scoring_signals,
diff --git a/components/omnibox/browser/autocomplete_scoring_model_handler.h b/components/omnibox/browser/autocomplete_scoring_model_handler.h index dcd7de15..240bbf66 100644 --- a/components/omnibox/browser/autocomplete_scoring_model_handler.h +++ b/components/omnibox/browser/autocomplete_scoring_model_handler.h
@@ -46,6 +46,10 @@ absl::optional<std::vector<float>> GetModelInput( const ScoringSignals& scoring_signals); + // Construct a batch model input from a vector of scoring signals. + absl::optional<std::vector<std::vector<float>>> GetBatchModelInput( + const std::vector<const ScoringSignals*>& scoring_signals_vec); + private: FRIEND_TEST_ALL_PREFIXES(AutocompleteScoringModelHandlerTest, ExtractInputFromScoringSignalsTest);
diff --git a/components/omnibox/browser/autocomplete_scoring_model_handler_unittest.cc b/components/omnibox/browser/autocomplete_scoring_model_handler_unittest.cc index c636878..1c3f70a 100644 --- a/components/omnibox/browser/autocomplete_scoring_model_handler_unittest.cc +++ b/components/omnibox/browser/autocomplete_scoring_model_handler_unittest.cc
@@ -4,9 +4,12 @@ #include "components/omnibox/browser/autocomplete_scoring_model_handler.h" +#include "base/base_paths.h" +#include "base/path_service.h" #include "base/task/sequenced_task_runner.h" #include "base/test/task_environment.h" #include "components/omnibox/browser/autocomplete_scoring_model_executor.h" +#include "components/optimization_guide/core/test_model_info_builder.h" #include "components/optimization_guide/core/test_optimization_guide_model_provider.h" #include "components/optimization_guide/proto/autocomplete_scoring_model_metadata.pb.h" #include "components/optimization_guide/proto/models.pb.h" @@ -80,6 +83,15 @@ /*optimization_target=*/ optimization_guide::proto::OPTIMIZATION_TARGET_OMNIBOX_URL_SCORING, /*model_metadata=*/absl::nullopt); + + base::FilePath source_root_dir; + base::PathService::Get(base::DIR_SOURCE_ROOT, &source_root_dir); + // A model of `add` operator. + model_file_path_ = source_root_dir.AppendASCII("components") + .AppendASCII("test") + .AppendASCII("data") + .AppendASCII("omnibox") + .AppendASCII("adder.tflite"); } void TearDown() override { @@ -88,6 +100,35 @@ RunUntilIdle(); } + void PushModelFileToModelExecutor( + absl::optional< + optimization_guide::proto::AutocompleteScoringModelMetadata> + metadata) { + absl::optional<optimization_guide::proto::Any> any; + + // Craft a correct Any proto in the case we passed in metadata. + if (metadata) { + std::string serialized_metadata; + metadata->SerializeToString(&serialized_metadata); + optimization_guide::proto::Any any_proto; + any = absl::make_optional(any_proto); + any->set_value(serialized_metadata); + any->set_type_url( + "type.googleapis.com/" + "optimization_guide.protos.AutocompleteScoringModelMetadata"); + } + + auto model_metadata = optimization_guide::TestModelInfoBuilder() + .SetModelMetadata(any) + .SetModelFilePath(model_file_path_) + .SetVersion(123) + .Build(); + model_handler_->OnModelUpdated( + optimization_guide::proto::OPTIMIZATION_TARGET_OMNIBOX_URL_SCORING, + *model_metadata); + task_environment_.RunUntilIdle(); + } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } protected: @@ -95,6 +136,7 @@ std::unique_ptr<optimization_guide::TestOptimizationGuideModelProvider> model_provider_; std::unique_ptr<AutocompleteScoringModelHandler> model_handler_; + base::FilePath model_file_path_; }; TEST_F(AutocompleteScoringModelHandlerTest, @@ -125,4 +167,25 @@ const auto input_signals = model_handler_->ExtractInputFromScoringSignals( scoring_signals, model_metadata); EXPECT_THAT(input_signals, testing::UnorderedElementsAre(10, 9, -2)); -} \ No newline at end of file +} + +TEST_F(AutocompleteScoringModelHandlerTest, GetBatchModelInputTest) { + AutocompleteScoringModelMetadata model_metadata; + *model_metadata.add_scoring_signal_specs() = CreateScoringSignalSpec( + optimization_guide::proto::SCORING_SIGNAL_TYPE_LENGTH_OF_URL); + PushModelFileToModelExecutor(model_metadata); + + std::vector<const ScoringSignals*> scoring_signals_vec; + // Scoring signals. + ScoringSignals scoring_signals_1, scoring_signals_2; + scoring_signals_1.set_length_of_url(10); + scoring_signals_vec.push_back(&scoring_signals_1); + scoring_signals_2.set_length_of_url(12); + scoring_signals_vec.push_back(&scoring_signals_2); + const absl::optional<std::vector<std::vector<float>>> batch_model_input = + model_handler_->GetBatchModelInput(scoring_signals_vec); + ASSERT_TRUE(batch_model_input); + ASSERT_EQ(batch_model_input->size(), 2u); + EXPECT_THAT(batch_model_input->at(0), testing::UnorderedElementsAre(10)); + EXPECT_THAT(batch_model_input->at(1), testing::UnorderedElementsAre(12)); +}
diff --git a/components/omnibox/browser/autocomplete_scoring_model_service.cc b/components/omnibox/browser/autocomplete_scoring_model_service.cc index 1863331..e6737a4 100644 --- a/components/omnibox/browser/autocomplete_scoring_model_service.cc +++ b/components/omnibox/browser/autocomplete_scoring_model_service.cc
@@ -62,7 +62,7 @@ url_scoring_model_handler_->ExecuteModelWithInput( tracker, base::BindOnce(&AutocompleteScoringModelService::ProcessModelOutput, - base::Unretained(this), std::move(result_callback), + weak_ptr_factory_.GetWeakPtr(), std::move(result_callback), match_index, match_destination_url), *input_signals); } @@ -72,6 +72,39 @@ url_scoring_model_handler_->ModelAvailable(); } +void AutocompleteScoringModelService::BatchScoreAutocompleteUrlMatches( + base::CancelableTaskTracker* tracker, + const std::vector<const ScoringSignals*>& batch_scoring_signals, + const std::vector<size_t>& match_indexes, + const std::vector<GURL>& match_destination_urls, + BatchResultCallback batch_result_callback) { + TRACE_EVENT0( + "omnibox", + "AutocompleteScoringModelService::BatchScoreAutocompleteUrlMatches"); + + if (!UrlScoringModelAvailable()) { + std::move(batch_result_callback) + .Run(absl::nullopt, match_indexes, match_destination_urls); + return; + } + + absl::optional<std::vector<std::vector<float>>> batch_input = + url_scoring_model_handler_->GetBatchModelInput(batch_scoring_signals); + if (!batch_input) { + std::move(batch_result_callback) + .Run(absl::nullopt, match_indexes, match_destination_urls); + return; + } + + url_scoring_model_handler_->BatchExecuteModelWithInput( + tracker, + base::BindOnce(&AutocompleteScoringModelService::ProcessBatchModelOutput, + weak_ptr_factory_.GetWeakPtr(), + std::move(batch_result_callback), match_indexes, + match_destination_urls), + *batch_input); +} + void AutocompleteScoringModelService::ProcessModelOutput( ResultCallback result_callback, size_t match_index, @@ -92,3 +125,26 @@ std::move(result_callback) .Run(std::make_tuple(absl::nullopt, match_index, match_destination_url)); } + +void AutocompleteScoringModelService::ProcessBatchModelOutput( + BatchResultCallback batch_result_callback, + const std::vector<size_t>& match_indexes, + const std::vector<GURL>& match_destination_urls, + const std::vector< + absl::optional<AutocompleteScoringModelExecutor::ModelOutput>>& + batch_model_output) { + TRACE_EVENT0("omnibox", + "AutocompleteScoringModelService::ProcessBatchModelOutput"); + + std::vector<absl::optional<float>> batch_output_scores; + for (const auto& output : batch_model_output) { + if (output) { + batch_output_scores.push_back(output.value()[0]); + } else { + batch_output_scores.push_back(absl::nullopt); + } + } + + std::move(batch_result_callback) + .Run(batch_output_scores, match_indexes, match_destination_urls); +}
diff --git a/components/omnibox/browser/autocomplete_scoring_model_service.h b/components/omnibox/browser/autocomplete_scoring_model_service.h index f0287b4..d4957075 100644 --- a/components/omnibox/browser/autocomplete_scoring_model_service.h +++ b/components/omnibox/browser/autocomplete_scoring_model_service.h
@@ -24,6 +24,10 @@ public: using ResultCallback = base::OnceCallback<void(std::tuple<absl::optional<float>, size_t, GURL>)>; + using BatchResultCallback = base::OnceCallback<void( + absl::optional<std::vector<absl::optional<float>>>, + std::vector<size_t>, + std::vector<GURL>)>; using ScoringSignals = ::metrics::OmniboxEventProto::Suggestion::ScoringSignals; @@ -45,6 +49,16 @@ GURL match_destination_url, ResultCallback result_callback); + // Invokes the model to scores a batch of URL candidates with their signals. + // Calls `batch_result_callback` with a batch of optional prediction scores + // from the model. + void BatchScoreAutocompleteUrlMatches( + base::CancelableTaskTracker* tracker, + const std::vector<const ScoringSignals*>& batch_scoring_signals, + const std::vector<size_t>& match_indexes, + const std::vector<GURL>& match_destination_urls, + BatchResultCallback batch_result_callback); + // Returns whether the scoring model is loaded and the pointer to the // handler is non-null. bool UrlScoringModelAvailable(); @@ -60,10 +74,20 @@ const absl::optional<AutocompleteScoringModelExecutor::ModelOutput>& model_output); + void ProcessBatchModelOutput( + BatchResultCallback batch_result_callback, + const std::vector<size_t>& match_indexes, + const std::vector<GURL>& match_destination_urls, + const std::vector< + absl::optional<AutocompleteScoringModelExecutor::ModelOutput>>& + batch_model_output); + scoped_refptr<base::SequencedTaskRunner> model_executor_task_runner_; // Autocomplete URL scoring model. std::unique_ptr<AutocompleteScoringModelHandler> url_scoring_model_handler_; + + base::WeakPtrFactory<AutocompleteScoringModelService> weak_ptr_factory_{this}; }; #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_SCORING_MODEL_SERVICE_H_
diff --git a/components/omnibox/browser/omnibox_controller.cc b/components/omnibox/browser/omnibox_controller.cc index 30b869ef..503845ba 100644 --- a/components/omnibox/browser/omnibox_controller.cc +++ b/components/omnibox/browser/omnibox_controller.cc
@@ -20,45 +20,26 @@ OmniboxView* view, OmniboxEditModelDelegate* edit_model_delegate, std::unique_ptr<OmniboxClient> client) - : OmniboxController(view, - edit_model_delegate, - /*autocomplete_controller=*/nullptr, - std::move(client)) {} - -OmniboxController::OmniboxController( - OmniboxEditModelDelegate* edit_model_delegate, - std::unique_ptr<AutocompleteController> autocomplete_controller, - std::unique_ptr<OmniboxClient> client) - : OmniboxController(/*view=*/nullptr, - edit_model_delegate, - std::move(autocomplete_controller), - std::move(client)) {} - -OmniboxController::OmniboxController( - OmniboxView* view, - OmniboxEditModelDelegate* edit_model_delegate, - std::unique_ptr<AutocompleteController> autocomplete_controller, - std::unique_ptr<OmniboxClient> client) - : client_(std::move(client)) { + : client_(std::move(client)), + autocomplete_controller_(std::make_unique<AutocompleteController>( + client_->CreateAutocompleteProviderClient(), + AutocompleteClassifier::DefaultOmniboxProviders())) { edit_model_ = std::make_unique<OmniboxEditModel>(view, edit_model_delegate, client_.get()); // TODO(crbug.com/1404748): Pass a reference to `OmniboxController` to the // constructor of `OmniboxEditModel` so this is no longer needed. edit_model_->set_omnibox_controller(this); - autocomplete_controller_ = std::move(autocomplete_controller); - if (!autocomplete_controller_) { - autocomplete_controller_ = std::make_unique<AutocompleteController>( - client_->CreateAutocompleteProviderClient(), - AutocompleteClassifier::DefaultOmniboxProviders()); - // Only observe the `AutocompleteController` instance created here for the - // omnibox. `RealboxHandler` observes both its own `AutocompleteController` - // instance and the one created here for the omnibox via - // `AutocompleteControllerEmitter`. The latter is being observed for when - // `RealboxHandler` is used in the context of the WebUI omnibox. + // Directly observe omnibox's `AutocompleteController` instance - i.e., when + // `view` is provided in the constructor. In the case of realbox - i.e., when + // `view` is not provided in the constructor - `RealboxHandler` indirectly + // observes all the `AutocompleteController` instances registered with the + // `AutocompleteControllerEmitter`. + if (view) { autocomplete_controller_->AddObserver(this); } + // Register the `AutocompleteController` with `AutocompleteControllerEmitter`. if (auto* emitter = client_->GetAutocompleteControllerEmitter()) { autocomplete_controller_->AddObserver(emitter); }
diff --git a/components/omnibox/browser/omnibox_controller.h b/components/omnibox/browser/omnibox_controller.h index 8fd8962..6242f5da 100644 --- a/components/omnibox/browser/omnibox_controller.h +++ b/components/omnibox/browser/omnibox_controller.h
@@ -23,17 +23,9 @@ // omnibox, including `AutocompleteController` and `OmniboxEditModel`. class OmniboxController : public AutocompleteController::Observer { public: - // Used by the omnibox which uses `OmniboxView` and whose - // `AutocompleteController` instance is created and observed here. OmniboxController(OmniboxView* view, OmniboxEditModelDelegate* edit_model_delegate, std::unique_ptr<OmniboxClient> client); - // Used by the realbox which does not use `OmniboxView` and observes and - // passes its own instance of `AutocompleteController`. - OmniboxController( - OmniboxEditModelDelegate* edit_model_delegate, - std::unique_ptr<AutocompleteController> autocomplete_controller, - std::unique_ptr<OmniboxClient> client); ~OmniboxController() override; OmniboxController(const OmniboxController&) = delete; OmniboxController& operator=(const OmniboxController&) = delete; @@ -71,14 +63,6 @@ return autocomplete_controller_->result(); } - protected: - // Used by other constructors. - OmniboxController( - OmniboxView* view, - OmniboxEditModelDelegate* edit_model_delegate, - std::unique_ptr<AutocompleteController> autocomplete_controller, - std::unique_ptr<OmniboxClient> client); - private: // Stores the bitmap in the OmniboxPopupModel. void SetRichSuggestionBitmap(int result_index, const SkBitmap& bitmap);
diff --git a/components/omnibox/browser/omnibox_field_trial.cc b/components/omnibox/browser/omnibox_field_trial.cc index dc5d2ad..af44e1c 100644 --- a/components/omnibox/browser/omnibox_field_trial.cc +++ b/components/omnibox/browser/omnibox_field_trial.cc
@@ -692,6 +692,12 @@ return enabled; } +bool OmniboxFieldTrial::IsChromeRefreshSuggestIconsEnabled() { + return features::GetChromeRefresh2023Level() == + features::ChromeRefresh2023Level::kLevel2 || + base::FeatureList::IsEnabled(omnibox::kExpandedStateSuggestIcons); +} + bool OmniboxFieldTrial::IsGM3TextStyleEnabled() { return features::GetChromeRefresh2023Level() == features::ChromeRefresh2023Level::kLevel2 ||
diff --git a/components/omnibox/browser/omnibox_field_trial.h b/components/omnibox/browser/omnibox_field_trial.h index 0f20b07..41dc875 100644 --- a/components/omnibox/browser/omnibox_field_trial.h +++ b/components/omnibox/browser/omnibox_field_trial.h
@@ -384,6 +384,10 @@ // Returns true if the feature to enable GM3 icons is enabled. bool IsChromeRefreshIconsEnabled(); +// Omnibox CR23 - suggestion icons. +// Returns true if the feature to enable CR23 suggestion icons is enabled. +bool IsChromeRefreshSuggestIconsEnabled(); + // Omnibox GM3 - text style. // Returns true if the feature to enable GM3 text styling is enabled. bool IsGM3TextStyleEnabled();
diff --git a/components/omnibox/browser/omnibox_view.cc b/components/omnibox/browser/omnibox_view.cc index ab7f308..6af17529 100644 --- a/components/omnibox/browser/omnibox_view.cc +++ b/components/omnibox/browser/omnibox_view.cc
@@ -372,8 +372,8 @@ // TODO(crbug.com/1404748): Verify if this can actually happen and prevent it // such that checking `model()` before use is no longer necessary. if (client) { - controller_ = std::make_unique<OmniboxController>(this, edit_model_delegate, - std::move(client)); + controller_ = std::make_unique<OmniboxController>( + /*view=*/this, edit_model_delegate, std::move(client)); } }
diff --git a/components/omnibox/browser/vector_icons/arrow_down_chrome_refresh.icon b/components/omnibox/browser/vector_icons/arrow_down_chrome_refresh.icon new file mode 100644 index 0000000..c9a08ff9 --- /dev/null +++ b/components/omnibox/browser/vector_icons/arrow_down_chrome_refresh.icon
@@ -0,0 +1,11 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +CANVAS_DIMENSIONS, 16, +MOVE_TO, 8, 9.73f, +LINE_TO, 4.58f, 6.31f, +R_H_LINE_TO, 6.84f, +CLOSE, +R_MOVE_TO, 0, 0, +CLOSE
diff --git a/components/omnibox/browser/vector_icons/arrow_up_chrome_refresh.icon b/components/omnibox/browser/vector_icons/arrow_up_chrome_refresh.icon new file mode 100644 index 0000000..4d456e9 --- /dev/null +++ b/components/omnibox/browser/vector_icons/arrow_up_chrome_refresh.icon
@@ -0,0 +1,11 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +CANVAS_DIMENSIONS, 16, +MOVE_TO, 4.58f, 9.69f, +LINE_TO, 8, 6.27f, +R_LINE_TO, 3.42f, 3.42f, +CLOSE, +R_MOVE_TO, 0, 0, +CLOSE
diff --git a/components/optimization_guide/core/hints_manager.cc b/components/optimization_guide/core/hints_manager.cc index 47daefe..7031610 100644 --- a/components/optimization_guide/core/hints_manager.cc +++ b/components/optimization_guide/core/hints_manager.cc
@@ -371,6 +371,8 @@ case OptimizationTypeDecision::kNoMatchingPageHint: case OptimizationTypeDecision::kNoHintAvailable: case OptimizationTypeDecision::kNotAllowedByOptimizationFilter: + case OptimizationTypeDecision::kInvalidURL: + case OptimizationTypeDecision::kRequestedUnregisteredType: return OptimizationGuideDecision::kFalse; } } @@ -1391,15 +1393,16 @@ // have a hint, so just return. if (!is_optimization_type_registered && (url_keyed_hint == nullptr && host_keyed_hint == nullptr)) { - scoped_logger.set_type_decision(OptimizationTypeDecision::kNoHintAvailable); - return OptimizationTypeDecision::kNoHintAvailable; + scoped_logger.set_type_decision( + OptimizationTypeDecision::kRequestedUnregisteredType); + return OptimizationTypeDecision::kRequestedUnregisteredType; } // If the URL doesn't have a host, we cannot query the hint for it, so just // return early. if (!navigation_url.has_host()) { - scoped_logger.set_type_decision(OptimizationTypeDecision::kNoHintAvailable); - return OptimizationTypeDecision::kNoHintAvailable; + scoped_logger.set_type_decision(OptimizationTypeDecision::kInvalidURL); + return OptimizationTypeDecision::kInvalidURL; } const auto& host = navigation_url.host();
diff --git a/components/optimization_guide/core/hints_manager_unittest.cc b/components/optimization_guide/core/hints_manager_unittest.cc index 0dec2bf1..dd035ae 100644 --- a/components/optimization_guide/core/hints_manager_unittest.cc +++ b/components/optimization_guide/core/hints_manager_unittest.cc
@@ -1080,8 +1080,7 @@ /*optimization_metadata=*/nullptr); // Make sure decisions are logged correctly. - EXPECT_EQ(OptimizationTypeDecision::kNoHintAvailable, - optimization_type_decision); + EXPECT_EQ(OptimizationTypeDecision::kInvalidURL, optimization_type_decision); } TEST_F(HintsManagerTest, CanApplyOptimizationHasFilterForTypeButNotLoadedYet) {
diff --git a/components/optimization_guide/core/optimization_guide_enums.h b/components/optimization_guide/core/optimization_guide_enums.h index 0253995c..4c28f245 100644 --- a/components/optimization_guide/core/optimization_guide_enums.h +++ b/components/optimization_guide/core/optimization_guide_enums.h
@@ -44,9 +44,16 @@ // Guide Service was started, but was not available in time to make a // decision. kHintFetchStartedButNotAvailableInTime = 10, + // A fetch to get the hint for the page load from the remote Optimization + // Guide Service was started, but requested optimization type was not + // registered. + kRequestedUnregisteredType = 11, + // A fetch to get the hint for the page load from the remote Optimization + // Guide Service was started, but requested URL was invalid. + kInvalidURL = 12, // Add new values above this line. - kMaxValue = kHintFetchStartedButNotAvailableInTime, + kMaxValue = kInvalidURL, }; // The statuses for racing a hints fetch with the current navigation based
diff --git a/components/payments/content/android/BUILD.gn b/components/payments/content/android/BUILD.gn index eccb1a8..a886c3e1 100644 --- a/components/payments/content/android/BUILD.gn +++ b/components/payments/content/android/BUILD.gn
@@ -24,8 +24,8 @@ "origin_security_checker_android.cc", "payment_app_service_bridge.cc", "payment_app_service_bridge.h", - "payment_feature_list.cc", - "payment_feature_list.h", + "payment_feature_map.cc", + "payment_feature_map.h", "payment_handler_host.cc", "payment_handler_host.h", "payment_handler_navigation_throttle_android.cc", @@ -74,7 +74,7 @@ "java/src/org/chromium/components/payments/JourneyLogger.java", "java/src/org/chromium/components/payments/OriginSecurityChecker.java", "java/src/org/chromium/components/payments/PaymentAppServiceBridge.java", - "java/src/org/chromium/components/payments/PaymentFeatureList.java", + "java/src/org/chromium/components/payments/PaymentFeatureMap.java", "java/src/org/chromium/components/payments/PaymentHandlerHost.java", "java/src/org/chromium/components/payments/PaymentHandlerNavigationThrottle.java", "java/src/org/chromium/components/payments/PaymentManifestDownloader.java", @@ -140,8 +140,10 @@ android_library("feature_list_java") { annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - sources = - [ "java/src/org/chromium/components/payments/PaymentFeatureList.java" ] + sources = [ + "java/src/org/chromium/components/payments/PaymentFeatureList.java", + "java/src/org/chromium/components/payments/PaymentFeatureMap.java", + ] deps = [ "//base:base_java", "//base:jni_java",
diff --git a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureList.java b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureList.java index 65160e7..fc875a7 100644 --- a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureList.java +++ b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureList.java
@@ -4,19 +4,17 @@ package org.chromium.components.payments; -import androidx.annotation.VisibleForTesting; - -import org.chromium.base.FeatureList; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; /** - * Exposes payment specific features in to java since files in org.chromium.components.payments - * package package cannot depend on - * org.chromium.chrome.browser.flags.org.chromium.chrome.browser.flags.ChromeFeatureList. + * Exposes payment specific features to java since files in org.chromium.components.payments + * cannot depend on org.chromium.chrome.browser.flags.ChromeFeatureList. + * + * Features listed here should be also registered in kFeaturesExposedToJava in + * components/payments/content/android/payment_feature_map.cc */ @JNINamespace("payments::android") -public class PaymentFeatureList { +public abstract class PaymentFeatureList { /** Alphabetical: */ public static final String ADD_IDENTITY_IN_CAN_MAKE_PAYMENT_EVENT = "AddIdentityInCanMakePaymentEvent"; @@ -33,27 +31,23 @@ "WebPaymentsExperimentalFeatures"; public static final String WEB_PAYMENTS_SINGLE_APP_UI_SKIP = "WebPaymentsSingleAppUiSkip"; - // Do not instantiate this class. - private PaymentFeatureList() {} - /** * Returns whether the specified feature is enabled or not. * * Note: Features queried through this API must be added to the array - * |kFeaturesExposedToJava| in components/payments/content/android/payment_feature_list.cc + * |kFeaturesExposedToJava| in components/payments/content/android/payment_feature_map.cc * * @param featureName The name of the feature to query. * @return Whether the feature is enabled or not. */ public static boolean isEnabled(String featureName) { - assert FeatureList.isNativeInitialized(); - return PaymentFeatureListJni.get().isEnabled(featureName); + return PaymentFeatureMap.getInstance().isEnabled(featureName); } /** - * Returns whether the feature is enabled or not. * + * Returns whether the feature is enabled or not. * Note: Features queried through this API must be added to the array - * |kFeaturesExposedToJava| in components/payments/content/android/payment_feature_list.cc + * |kFeaturesExposedToJava| in components/payments/content/android/payment_feature_map.cc * * @param featureName The name of the feature to query. * @return true when either the specified feature or |WEB_PAYMENTS_EXPERIMENTAL_FEATURES| is @@ -62,14 +56,4 @@ public static boolean isEnabledOrExperimentalFeaturesEnabled(String featureName) { return isEnabled(WEB_PAYMENTS_EXPERIMENTAL_FEATURES) || isEnabled(featureName); } - - /** - * The interface implemented by the automatically generated JNI bindings class - * PaymentsFeatureListJni. - */ - @VisibleForTesting - @NativeMethods - public interface Natives { - boolean isEnabled(String featureName); - } }
diff --git a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureMap.java b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureMap.java new file mode 100644 index 0000000..6098e0f --- /dev/null +++ b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureMap.java
@@ -0,0 +1,43 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.components.payments; + +import androidx.annotation.VisibleForTesting; + +import org.chromium.base.FeatureMap; +import org.chromium.base.annotations.JNINamespace; +import org.chromium.base.annotations.NativeMethods; + +/** + * Java accessor for state of Payments feature flags. + */ +@JNINamespace("payments::android") +public class PaymentFeatureMap extends FeatureMap { + private static PaymentFeatureMap sInstance; + + // Do not instantiate this class. + private PaymentFeatureMap() { + super(); + } + + /** + * @return the singleton PaymentFeatureMap. + */ + public static PaymentFeatureMap getInstance() { + if (sInstance == null) sInstance = new PaymentFeatureMap(); + return sInstance; + } + + @Override + protected long getNativeMap() { + return PaymentFeatureMapJni.get().getNativeMap(); + } + + @VisibleForTesting + @NativeMethods + public interface Natives { + long getNativeMap(); + } +}
diff --git a/components/payments/content/android/payment_feature_list.cc b/components/payments/content/android/payment_feature_map.cc similarity index 64% rename from components/payments/content/android/payment_feature_list.cc rename to components/payments/content/android/payment_feature_map.cc index 9b895a61..e92d7a4 100644 --- a/components/payments/content/android/payment_feature_list.cc +++ b/components/payments/content/android/payment_feature_map.cc
@@ -2,18 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/payments/content/android/payment_feature_list.h" +#include "components/payments/content/android/payment_feature_map.h" -#include "base/android/jni_string.h" +#include "base/android/feature_map.h" #include "base/feature_list.h" -#include "base/notreached.h" -#include "components/payments/content/android/jni_headers/PaymentFeatureList_jni.h" +#include "base/no_destructor.h" +#include "components/payments/content/android/jni_headers/PaymentFeatureMap_jni.h" #include "components/payments/core/features.h" #include "content/public/common/content_features.h" #include "third_party/blink/public/common/features_generated.h" -namespace payments { -namespace android { +namespace payments::android { namespace { // Array of payment features exposed through the Java PaymentFeatureList API. @@ -37,19 +36,19 @@ &kOmitParametersInReadyToPay, }; -const base::Feature* FindFeatureExposedToJava(const std::string& feature_name) { - for (const base::Feature* feature : kFeaturesExposedToJava) { - if (feature->name == feature_name) { - return feature; - } - } - NOTREACHED() << "Queried feature cannot be found in PaymentsFeatureList: " - << feature_name; - return nullptr; +// static +base::android::FeatureMap* GetFeatureMap() { + static base::NoDestructor<base::android::FeatureMap> kFeatureMap(std::vector( + std::begin(kFeaturesExposedToJava), std::end(kFeaturesExposedToJava))); + return kFeatureMap.get(); } } // namespace +static jlong JNI_PaymentFeatureMap_GetNativeMap(JNIEnv* env) { + return reinterpret_cast<jlong>(GetFeatureMap()); +} + // Android only features. BASE_FEATURE(kAndroidAppPaymentUpdateEvents, "AndroidAppPaymentUpdateEvents", @@ -58,13 +57,4 @@ "OmitParametersInReadyToPay", base::FEATURE_DISABLED_BY_DEFAULT); -static jboolean JNI_PaymentFeatureList_IsEnabled( - JNIEnv* env, - const base::android::JavaParamRef<jstring>& jfeature_name) { - const base::Feature* feature = FindFeatureExposedToJava( - base::android::ConvertJavaStringToUTF8(env, jfeature_name)); - return base::FeatureList::IsEnabled(*feature); -} - -} // namespace android -} // namespace payments +} // namespace payments::android
diff --git a/components/payments/content/android/payment_feature_list.h b/components/payments/content/android/payment_feature_map.h similarity index 74% rename from components/payments/content/android/payment_feature_list.h rename to components/payments/content/android/payment_feature_map.h index eb99addf..d3fe5565 100644 --- a/components/payments/content/android/payment_feature_list.h +++ b/components/payments/content/android/payment_feature_map.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 COMPONENTS_PAYMENTS_CONTENT_ANDROID_PAYMENT_FEATURE_LIST_H_ -#define COMPONENTS_PAYMENTS_CONTENT_ANDROID_PAYMENT_FEATURE_LIST_H_ +#ifndef COMPONENTS_PAYMENTS_CONTENT_ANDROID_PAYMENT_FEATURE_MAP_H_ +#define COMPONENTS_PAYMENTS_CONTENT_ANDROID_PAYMENT_FEATURE_MAP_H_ #include <jni.h> @@ -23,4 +23,4 @@ } // namespace android } // namespace payments -#endif // COMPONENTS_PAYMENTS_CONTENT_ANDROID_PAYMENT_FEATURE_LIST_H_ +#endif // COMPONENTS_PAYMENTS_CONTENT_ANDROID_PAYMENT_FEATURE_MAP_H_
diff --git a/components/permissions/permission_request_manager.cc b/components/permissions/permission_request_manager.cc index 9726659..7db2994a 100644 --- a/components/permissions/permission_request_manager.cc +++ b/components/permissions/permission_request_manager.cc
@@ -544,10 +544,6 @@ } GURL PermissionRequestManager::GetEmbeddingOrigin() const { - if (embedding_origin_for_testing_.has_value()) { - return embedding_origin_for_testing_.value(); - } - return PermissionUtil::GetLastCommittedOriginAsURL( web_contents()->GetPrimaryMainFrame()); }
diff --git a/components/permissions/permission_request_manager.h b/components/permissions/permission_request_manager.h index 066a4f7..4d7ff6e6 100644 --- a/components/permissions/permission_request_manager.h +++ b/components/permissions/permission_request_manager.h
@@ -238,10 +238,6 @@ enabled_app_level_notification_permission_for_testing_ = enabled; } - void set_embedding_origin_for_testing(const GURL& embedding_origin) { - embedding_origin_for_testing_ = embedding_origin; - } - base::ObserverList<Observer>* get_observer_list_for_testing() { CHECK_IS_TEST(); return &observer_list_; @@ -499,8 +495,6 @@ absl::optional<bool> enabled_app_level_notification_permission_for_testing_; - absl::optional<GURL> embedding_origin_for_testing_; - // A timer is used to pre-ignore the permission request if it's been displayed // as a quiet chip. base::OneShotTimer preignore_timer_;
diff --git a/components/policy/core/common/cloud/cloud_policy_util.cc b/components/policy/core/common/cloud/cloud_policy_util.cc index 5a158b29..ef894952 100644 --- a/components/policy/core/common/cloud/cloud_policy_util.cc +++ b/components/policy/core/common/cloud/cloud_policy_util.cc
@@ -155,7 +155,7 @@ } std::string GetOSPlatform() { - return version_info::GetOSType(); + return std::string(version_info::GetOSType()); } std::string GetOSArchitecture() {
diff --git a/components/policy/core/common/policy_logger.cc b/components/policy/core/common/policy_logger.cc index 1b45e8b..db32aa3 100644 --- a/components/policy/core/common/policy_logger.cc +++ b/components/policy/core/common/policy_logger.cc
@@ -60,7 +60,7 @@ // Constructs the URL for Chromium Code Search that points to the line of code // that generated the log and the Chromium git revision hash. std::string GetLineURL(const base::Location location) { - std::string last_change = version_info::GetLastChange(); + std::string last_change(version_info::GetLastChange()); // The substring separates the last change commit hash from the branch name on // the '-'.
diff --git a/components/policy/resources/templates/policies.yaml b/components/policy/resources/templates/policies.yaml index 9f77e5e2..cb23015b 100644 --- a/components/policy/resources/templates/policies.yaml +++ b/components/policy/resources/templates/policies.yaml
@@ -1103,6 +1103,10 @@ 1102: ReportAppInventory 1103: ReportAppUsage 1104: ReportAppUsageCollectionRateMs + 1105: BrowserContextAwareAccessSignalsAllowlist + 1106: UserContextAwareAccessSignalsAllowlist + 1107: GoogleSearchSidePanelEnabled + 1108: PdfUseSkiaRendererEnabled atomic_groups: 1: Homepage 2: RemoteAccess
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserContextAwareAccessSignalsAllowlist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserContextAwareAccessSignalsAllowlist.yaml new file mode 100644 index 0000000..03fb9583 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserContextAwareAccessSignalsAllowlist.yaml
@@ -0,0 +1,31 @@ +caption: Enable the <ph name="CHROME_ENTERPRISE_DEVICE_TRUST_CONNECTOR">Chrome Enterprise Device Trust Connector</ph> attestation flow for a list of URLs on Managed Browsers +desc: |- + Enable <ph name="CHROME_ENTERPRISE_DEVICE_TRUST_CONNECTOR">Chrome Enterprise Device Trust Connector</ph> for a list of URLs. + + Setting this policy specifies for which URLs <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> will offer to start the attestation flow for managed browsers. The latter allows those websites to get an attested set of context-aware signals from the device. + This policy can only be configured via the Chrome Enterprise Connectors page on the <ph name="GOOGLE_ADMIN_CONSOLE_PRODUCT_NAME">Google Admin console</ph>. + + Leaving this policy unset or empty means that no website will be able to start a browser-level attestation flow and get signals from the device. However if the corresponding + <ph name="USER_CONTEXT_AWARE_ACCESS_SIGNALS_ALLOWLIST">UserContextAwareAccessSignalsAllowlist</ph> policy is enabled then the attestation flow can be started for the managed profile and device signals can be collected. + + For detailed information on valid <ph name="URL_LABEL">URL</ph> patterns, please see https://support.google.com/chrome/a?p=url_blocklist_filter_format. +example_value: +- https://example1.com +- example2.com +- https://foo.example3.com/path +features: + cloud_only: true + dynamic_refresh: true + per_profile: false +future_on: +- chrome.* +owners: +- hmare@google.com +- seblalancette@chromium.org +- cbe-device-trust-eng@google.com +schema: + items: + type: string + type: array +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/GoogleSearchSidePanelEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/GoogleSearchSidePanelEnabled.yaml new file mode 100644 index 0000000..df266531 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/GoogleSearchSidePanelEnabled.yaml
@@ -0,0 +1,27 @@ +caption: Enable <ph name="PRODUCT_NAME">$1<ex>Google Search Side Panel</ex></ph> + +desc: |- + If set to Enabled or not set, <ph name="PRODUCT_NAME">$1<ex>Google Search Side Panel</ex></ph> is allowed on all web pages. + + If set to Disabled, <ph name="PRODUCT_NAME">$1<ex>Google Search Side Panel</ex></ph> is not available on any webpage. +default: true +example_value: true +features: + dynamic_refresh: true + per_profile: true +items: +- caption: Enable <ph name="PRODUCT_NAME">$1<ex>Google Search Side Panel</ex></ph> on all web pages + value: true +- caption: Disable <ph name="PRODUCT_NAME">$1<ex>Google Search Side Panel</ex></ph> on all web pages + value: false +owners: +- file://chrome/browser/companion/OWNERS +- tbansal@chromium.org +schema: + type: boolean +supported_on: +- chrome.*:115- +- chrome_os:115- +tags: +- google-sharing +type: main \ No newline at end of file
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/PdfUseSkiaRendererEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/PdfUseSkiaRendererEnabled.yaml new file mode 100644 index 0000000..a6948ce --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/PdfUseSkiaRendererEnabled.yaml
@@ -0,0 +1,32 @@ +caption: Use Skia renderer for PDF rendering +default: null +desc: |- + Controls whether the PDF viewer in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> uses Skia renderer. + + When this policy is enabled, the PDF viewer uses Skia renderer. + + When this policy is disabled, the PDF viewer uses its current AGG renderer. + + When this policy is not set, the PDF renderer will be chosen by the browser. +example_value: true +features: + dynamic_refresh: true + per_profile: true +items: +- caption: The PDF viewer uses Skia renderer. + value: true +- caption: The PDF viewer uses AGG renderer. + value: false +- caption: Use the default renderer based on the field trial config. + value: null +owners: +- nigi@chromium.org +- file://pdf/OWNERS +schema: + type: boolean +supported_on: +- chrome.*:115- +- chrome_os:115- +- fuchsia:115- +tags: [] +type: main
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/UserContextAwareAccessSignalsAllowlist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/UserContextAwareAccessSignalsAllowlist.yaml new file mode 100644 index 0000000..eb4314bc --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/UserContextAwareAccessSignalsAllowlist.yaml
@@ -0,0 +1,34 @@ +caption: Enable the <ph name="CHROME_ENTERPRISE_DEVICE_TRUST_CONNECTOR">Chrome Enterprise Device Trust Connector</ph> attestation flow for a list of URLs on Managed Profiles +desc: |- + Enable <ph name="CHROME_ENTERPRISE_DEVICE_TRUST_CONNECTOR">Chrome Enterprise Device Trust Connector</ph> for a list of URLs. + + Setting this policy specifies for which URLs <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> will offer to start the attestation flow for managed profiles. The latter allows those websites to get an attested set of context-aware signals from the device. + This policy can only be configured via the Chrome Enterprise Connectors page on the <ph name="GOOGLE_ADMIN_CONSOLE_PRODUCT_NAME">Google Admin console</ph>. + + Leaving this policy unset or empty means that no website will be able to start a user-level attestation flow and get signals from the device. However if the corresponding + <ph name="BROWSER_CONTEXT_AWARE_ACCESS_SIGNALS_ALLOWLIST">BrowserContextAwareAccessSignalsAllowlist</ph> policy is enabled then the attestation flow can be started for the managed browser and device signals can be collected. + + For <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph>, this policy is related to remote attestation where a certificate is automatically generated and uploaded to the server. For usage of the attestation flow on the device's login screen, please use the <ph name="DEVICE_LOGIN_SCREEN_CONTEXT_AWARE_ACCESS_SIGNALS_ALLOWLIST_POLICY_NAME">DeviceLoginScreenContextAwareAccessSignalsAllowlist</ph> policy. + + For detailed information on valid <ph name="URL_LABEL">URL</ph> patterns, please see https://support.google.com/chrome/a?p=url_blocklist_filter_format. +example_value: +- https://example1.com +- example2.com +- https://foo.example3.com/path +features: + cloud_only: true + dynamic_refresh: true + per_profile: true +future_on: +- chrome.* +- chrome_os +owners: +- hmare@google.com +- seblalancette@chromium.org +- cbe-device-trust-eng@google.com +schema: + items: + type: string + type: array +tags: [] +type: list
diff --git a/components/policy/test/data/policy_test_cases.json b/components/policy/test/data/policy_test_cases.json index ab95e34..737a797 100644 --- a/components/policy/test/data/policy_test_cases.json +++ b/components/policy/test/data/policy_test_cases.json
@@ -8008,7 +8008,115 @@ ] }, "AppLaunchAutomation": { - "reason_for_missing_test": "TODO(b/268538092): Feature not yet implemented" + "os": [ + "chromeos_ash" + ], + "policy_pref_mapping_tests": [ + { + "policies": { + "AppLaunchAutomation": [ + { + "auto_launch_on_startup": true, + "created_time_usec": "13320917261678808", + "desk": { + "apps": [{ + "app_type": "browser", + "browser_tabs": [{ + "url": "https://www.chromium.org/" + }], + "window_id": 30002 + }, { + "app_type": "browser", + "browser_tabs": [{ + "url": "chrome://version/" + }, { + "url": "https://dev.chromium.org/" + }], + "window_id": 30001 + }] + }, + "name": "App Launch Automation 1", + "updated_time_usec": "13320917261678808", + "uuid": "27ea906b-a7d3-40b1-8c36-76d332d7f184" + }, + { + "auto_launch_on_startup": false, + "created_time_usec": "13320917271679905", + "desk": { + "apps": [{ + "app_type": "browser", + "browser_tabs": [{ + "url": "https://www.google.com/" + }, { + "url": "https://www.youtube.com/" + }], + "window_id": 30001 + }] + }, + "name": "App Launch Automation 2", + "updated_time_usec": "13320917271679905", + "uuid": "3aa30d88-576e-48ea-ab26-cbdd2cbe43a1" + } + ] + }, + "prefs": { + "ash.app_launch_automation": { + "value": [ + { + "auto_launch_on_startup": true, + "created_time_usec": "13320917261678808", + "desk": { + "apps": [{ + "app_type": "browser", + "browser_tabs": [{ + "url": "https://www.chromium.org/" + }], + "window_id": 30002 + }, { + "app_type": "browser", + "browser_tabs": [{ + "url": "chrome://version/" + }, { + "url": "https://dev.chromium.org/" + }], + "window_id": 30001 + }] + }, + "name": "App Launch Automation 1", + "updated_time_usec": "13320917261678808", + "uuid": "27ea906b-a7d3-40b1-8c36-76d332d7f184" + }, + { + "auto_launch_on_startup": false, + "created_time_usec": "13320917271679905", + "desk": { + "apps": [{ + "app_type": "browser", + "browser_tabs": [{ + "url": "https://www.google.com/" + }, { + "url": "https://www.youtube.com/" + }], + "window_id": 30001 + }] + }, + "name": "App Launch Automation 2", + "updated_time_usec": "13320917271679905", + "uuid": "3aa30d88-576e-48ea-ab26-cbdd2cbe43a1" + } + ] + } + } + }, + { + "policies": {}, + "prefs": { + "ash.app_launch_automation": { + "default_value": [] + } + } + } + ] }, "AllowedDomainsForApps": { "os": [ @@ -18999,6 +19107,28 @@ } ] }, + "PdfUseSkiaRendererEnabled": { + "os": [ + "win", + "linux", + "mac", + "chromeos_ash", + "chromeos_lacros" + ], + "policy_pref_mapping_tests": [ + { + "policies": { + "PdfUseSkiaRendererEnabled": true + }, + "prefs": { + "pdf.enable_skia": { + "location": "user_profile", + "value": true + } + } + } + ] + }, "ExplicitlyAllowedNetworkPorts": { "os": [ "win", @@ -22892,5 +23022,104 @@ } } ] + }, + "BrowserContextAwareAccessSignalsAllowlist": { + "os": [ + "win", + "linux", + "mac" + ], + "policy_pref_mapping_tests": [ + { + "policies": { + "BrowserContextAwareAccessSignalsAllowlist": [ + "https://example1.com", + "https://[*.]example2.com", + "https://foo.example3.com/path" + ] + }, + "prefs": { + "enterprise_connectors.device_trust_browser.origins": { + "value": [ + "https://example1.com", + "https://[*.]example2.com", + "https://foo.example3.com/path" + ] + } + } + } + ] + }, +"UserContextAwareAccessSignalsAllowlist": { + "os": [ + "win", + "linux", + "mac", + "chromeos_ash", + "chromeos_lacros" + ], + "policy_pref_mapping_tests": [ + { + "policies": { + "UserContextAwareAccessSignalsAllowlist": [ + "https://example1.com", + "https://[*.]example2.com", + "https://foo.example3.com/path" + ] + }, + "prefs": { + "enterprise_connectors.device_trust_user.origins": { + "value": [ + "https://example1.com", + "https://[*.]example2.com", + "https://foo.example3.com/path" + ] + } + } + } + ] + }, + "GoogleSearchSidePanelEnabled": { + "os": [ + "chromeos_ash", + "chromeos_lacros", + "linux", + "mac", + "win" + ], + "policy_pref_mapping_tests": [ + { + "note": "Check with GoogleSearchSidePanelEnabled default.", + "policies": { + }, + "prefs": { + "side_panel.google_search_side_panel_enabled": { + "default_value": true + } + } + }, + { + "note": "Check with GoogleSearchSidePanelEnabled enabled.", + "policies": { + "GoogleSearchSidePanelEnabled": true + }, + "prefs": { + "side_panel.google_search_side_panel_enabled": { + "value": true + } + } + }, + { + "note": "Check with GoogleSearchSidePanelEnabled disabled.", + "policies": { + "GoogleSearchSidePanelEnabled": false + }, + "prefs": { + "side_panel.google_search_side_panel_enabled": { + "value": false + } + } + } + ] } }
diff --git a/components/remote_cocoa/app_shim/immersive_mode_tabbed_controller.h b/components/remote_cocoa/app_shim/immersive_mode_tabbed_controller.h index ed12c96..a7d53e8b 100644 --- a/components/remote_cocoa/app_shim/immersive_mode_tabbed_controller.h +++ b/components/remote_cocoa/app_shim/immersive_mode_tabbed_controller.h
@@ -47,6 +47,10 @@ void AddController(); void RemoveController(); + // Ensure tab window is z-order on top of any siblings. Tab window will be + // parented to overlay window regardless of the current parent. + void OrderTabWindowZOrderOnTop(); + NSWindow* const tab_window_; BridgedContentView* tab_content_view_; base::scoped_nsobject<NSTitlebarAccessoryViewController>
diff --git a/components/remote_cocoa/app_shim/immersive_mode_tabbed_controller.mm b/components/remote_cocoa/app_shim/immersive_mode_tabbed_controller.mm index cccd9d8..8358eb5 100644 --- a/components/remote_cocoa/app_shim/immersive_mode_tabbed_controller.mm +++ b/components/remote_cocoa/app_shim/immersive_mode_tabbed_controller.mm
@@ -136,6 +136,12 @@ } ImmersiveModeController::UpdateToolbarVisibility(style); + // During fullscreen restore or split screen restore tab window can be left + // without a parent, leading to the window being hidden which causes + // compositing to stop. This call ensures that tab window is parented to + // overlay window and is in the correct z-order. + OrderTabWindowZOrderOnTop(); + // macOS 10.15 does not call `OnTitlebarFrameDidChange` as often as newer // versions of macOS. Add a layout call here and in `RevealLock` and // `RevealUnlock` to pickup the slack. There is no harm in extra layout calls @@ -207,14 +213,7 @@ return; } - // Keep the tab window on top of its siblings. This will allow children of tab - // window to always be z-order on top of overlay window children. - // Practically this allows for the tab preview hover card to be z-order on top - // of omnibox results popup. - if (overlay_window().childWindows.lastObject != tab_window_) { - [overlay_window() removeChildWindow:tab_window_]; - [overlay_window() addChildWindow:tab_window_ ordered:NSWindowAbove]; - } + OrderTabWindowZOrderOnTop(); ImmersiveModeController::OnChildWindowAdded(child); } @@ -239,4 +238,15 @@ return true; } +void ImmersiveModeTabbedController::OrderTabWindowZOrderOnTop() { + // Keep the tab window on top of its siblings. This will allow children of tab + // window to always be z-order on top of overlay window children. + // Practically this allows for the tab preview hover card to be z-order on top + // of omnibox results popup. + if (overlay_window().childWindows.lastObject != tab_window_) { + [overlay_window() removeChildWindow:tab_window_]; + [overlay_window() addChildWindow:tab_window_ ordered:NSWindowAbove]; + } +} + } // namespace remote_cocoa
diff --git a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm index 3b1f523..e90c794 100644 --- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm +++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
@@ -103,6 +103,11 @@ - (void)_zoomToScreenEdge:(NSUInteger)edge; @end +// Private API as of at least macOS 13. +@interface NSWindow (NSWindow_Theme) +- (void)_regularMinimizeToDock; +@end + @interface NativeWidgetMacNSWindow () <NSKeyedArchiverDelegate> - (ViewsNSWindowDelegate*)viewsNSWindowDelegate; - (BOOL)hasViewsMenuActive; @@ -167,6 +172,7 @@ BOOL _preventKeyWindow; BOOL _isTooltip; BOOL _isHeadless; + BOOL _miniaturizationInProgress; } @synthesize bridgedNativeWidgetId = _bridgedNativeWidgetId; @synthesize bridge = _bridge; @@ -288,6 +294,8 @@ } - (void)orderFrontKeepWindowKeyState { + _miniaturizationInProgress = NO; + if ([self isOnActiveSpace]) { [self orderWindow:NSWindowAbove relativeTo:0]; return; @@ -496,6 +504,53 @@ [[self viewsNSWindowDelegate] onWindowOrderChanged:nil]; } +- (void)miniaturize:(id)sender { + static const BOOL isMacOS13OrHigher = base::mac::IsAtLeastOS13(); + // On macOS 13, the miniaturize operation appears to no longer be "atomic" + // because of non-blocking roundtrip IPC with the Dock. We want to note here + // that miniaturization is in progress. The process completes when we + // reach -_regularMinimizeToDock:. + _miniaturizationInProgress = isMacOS13OrHigher; + + [super miniaturize:sender]; +} + +- (void)_regularMinimizeToDock { + // On macOS 13, a call to -miniaturize: kicks of an async round-trip IPC with + // the Dock that ends up in this method. Unfortunately, it appears that if we + // immediately follow a call to -miniaturize: with -makeKeyAndOrderFront:, + // the AppKit doesn't cancel the in-flight round-trip IPC. As a result, + // _regularMinimizeToDock gets called sometime after -makeKeyAndOrderFront: + // and miniaturizes the window anyway. This is a potential problem in + // session restore where we might restart with a single browser window + // sitting Dock. In that case, Session Restore creates the window, + // miniaturizes to the dock, and then brings it back out. With this new macOS + // 13 behavior (which seems like a bug), the browser window may not be + // restored from the Dock. + // + // To get around this problem, if we arrive here and + // _miniaturizationInProgress is NO, the miniaturization process was + // cancelled by a call to -makeKeyAndOrderFront:. In that case, we don't want + // to proceed with miniaturization. + static const BOOL isMacOS13OrHigher = base::mac::IsAtLeastOS13(); + if (isMacOS13OrHigher && !_miniaturizationInProgress) { + return; + } + + _miniaturizationInProgress = NO; + [super _regularMinimizeToDock]; +} + +- (void)makeKeyAndOrderFront:(id)sender { + _miniaturizationInProgress = NO; + [super makeKeyAndOrderFront:sender]; +} + +- (void)orderOut:(id)sender { + _miniaturizationInProgress = NO; + [super orderOut:sender]; +} + // NSResponder implementation. - (BOOL)performKeyEquivalent:(NSEvent*)event {
diff --git a/components/safe_browsing/android/BUILD.gn b/components/safe_browsing/android/BUILD.gn index 7dcff55..4b8db50 100644 --- a/components/safe_browsing/android/BUILD.gn +++ b/components/safe_browsing/android/BUILD.gn
@@ -18,6 +18,7 @@ sources = [ "java/src/org/chromium/components/safe_browsing/SafeBrowsingApiBridge.java", "java/src/org/chromium/components/safe_browsing/SafeBrowsingApiHandler.java", + "java/src/org/chromium/components/safe_browsing/SafetyNetApiHandler.java", ] }
diff --git a/components/safe_browsing/android/java/src/org/chromium/components/safe_browsing/SafeBrowsingApiHandler.java b/components/safe_browsing/android/java/src/org/chromium/components/safe_browsing/SafeBrowsingApiHandler.java index 570df6dd..a2d318e4 100644 --- a/components/safe_browsing/android/java/src/org/chromium/components/safe_browsing/SafeBrowsingApiHandler.java +++ b/components/safe_browsing/android/java/src/org/chromium/components/safe_browsing/SafeBrowsingApiHandler.java
@@ -12,6 +12,7 @@ /** * Java interface that a SafeBrowsingApiHandler must implement when used with * {@code SafeBrowsingApiBridge}. + * TODO(crbug.com/1444515): Remove this interface once it is fully renamed to SafetyNetApiHandler. */ public interface SafeBrowsingApiHandler { /**
diff --git a/components/safe_browsing/android/java/src/org/chromium/components/safe_browsing/SafetyNetApiHandler.java b/components/safe_browsing/android/java/src/org/chromium/components/safe_browsing/SafetyNetApiHandler.java new file mode 100644 index 0000000..6844575 --- /dev/null +++ b/components/safe_browsing/android/java/src/org/chromium/components/safe_browsing/SafetyNetApiHandler.java
@@ -0,0 +1,12 @@ +// Copyright 2016 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.components.safe_browsing; + +/** + * Java interface that a SafetyNetApiHandler must implement when used with + * {@code SafeBrowsingApiBridge}. + * TODO(crbug.com/1444515): Port SafeBrowsingApiHandler to this interface. + */ +public interface SafetyNetApiHandler extends SafeBrowsingApiHandler {}
diff --git a/components/safe_browsing/content/browser/password_protection/password_protection_service_unittest.cc b/components/safe_browsing/content/browser/password_protection/password_protection_service_unittest.cc index 8ba33cf..14dfa31 100644 --- a/components/safe_browsing/content/browser/password_protection/password_protection_service_unittest.cc +++ b/components/safe_browsing/content/browser/password_protection/password_protection_service_unittest.cc
@@ -480,28 +480,26 @@ void CacheInvalidVerdict(ReusedPasswordAccountType password_type) { GURL invalid_hostname("http://invalid.com"); - base::Value verdict_dictionary = content_setting_map_->GetWebsiteSetting( + base::Value verdict = content_setting_map_->GetWebsiteSetting( invalid_hostname, GURL(), ContentSettingsType::PASSWORD_PROTECTION, nullptr); - if (!verdict_dictionary.is_dict()) - verdict_dictionary = base::Value(base::Value::Type::DICT); - - base::Value invalid_verdict_entry(base::Value::Type::DICT); - invalid_verdict_entry.SetStringKey("invalid", "invalid_string"); - - base::Value invalid_cache_expression_entry(base::Value::Type::DICT); - invalid_cache_expression_entry.SetKey("invalid_cache_expression", - std::move(invalid_verdict_entry)); - verdict_dictionary.SetKey( + auto verdict_dictionary = base::Value::Dict(); + if (verdict.is_dict()) { + verdict_dictionary = std::move(verdict).TakeDict(); + } + verdict_dictionary.Set( base::NumberToString(static_cast<std::underlying_type_t<PasswordType>>( password_protection_service_ ->ConvertReusedPasswordAccountTypeToPasswordType( password_type))), - std::move(invalid_cache_expression_entry)); + base::Value::Dict().Set( + "invalid_cache_expression", + base::Value::Dict().Set("invalid", "invalid_string"))); + content_setting_map_->SetWebsiteSettingDefaultScope( invalid_hostname, GURL(), ContentSettingsType::PASSWORD_PROTECTION, - std::move(verdict_dictionary)); + base::Value(std::move(verdict_dictionary))); } size_t GetStoredVerdictCount(LoginReputationClientRequest::TriggerType type) {
diff --git a/components/safe_browsing/core/browser/db/v4_protocol_manager_util.cc b/components/safe_browsing/core/browser/db/v4_protocol_manager_util.cc index 48332d2..82a99504 100644 --- a/components/safe_browsing/core/browser/db/v4_protocol_manager_util.cc +++ b/components/safe_browsing/core/browser/db/v4_protocol_manager_util.cc
@@ -81,7 +81,7 @@ bool disable_auto_update) { return V4ProtocolConfig(client_name, disable_auto_update, google_apis::GetAPIKey(), - version_info::GetVersionNumber()); + std::string(version_info::GetVersionNumber())); } void SetSbV4UrlPrefixForTesting(const char* url_prefix) {
diff --git a/components/security_interstitials/content/certificate_error_report.cc b/components/security_interstitials/content/certificate_error_report.cc index 5afe25e..b09db9ff 100644 --- a/components/security_interstitials/content/certificate_error_report.cc +++ b/components/security_interstitials/content/certificate_error_report.cc
@@ -486,8 +486,9 @@ chrome_browser_ssl::CertLoggerFeaturesInfo::ANDROID_AIA_FETCHING_ENABLED); #endif - cert_report_->set_chrome_version(version_info::GetVersionNumber()); - cert_report_->set_os_type(version_info::GetOSType()); + cert_report_->set_chrome_version( + std::string(version_info::GetVersionNumber())); + cert_report_->set_os_type(std::string(version_info::GetOSType())); cert_report_->set_os_version(base::SysInfo::OperatingSystemVersion()); cert_report_->set_hardware_model_name(base::SysInfo::HardwareModelName()); cert_report_->set_os_architecture(
diff --git a/components/security_interstitials/core/common_string_util.cc b/components/security_interstitials/core/common_string_util.cc index 4f72294..19d71a0 100644 --- a/components/security_interstitials/core/common_string_util.cc +++ b/components/security_interstitials/core/common_string_util.cc
@@ -65,26 +65,6 @@ load_time_data.Set("pem", base::StrCat(encoded_chain)); } -void PopulateLegacyTLSStrings(base::Value* load_time_data, - const std::u16string& hostname) { - load_time_data->SetStringKey("tabTitle", - l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE)); - load_time_data->SetStringKey( - "heading", l10n_util::GetStringUTF16(IDS_LEGACY_TLS_HEADING)); - load_time_data->SetStringKey( - "primaryButtonText", - l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_SAFETY_BUTTON)); - load_time_data->SetStringKey( - "primaryParagraph", - l10n_util::GetStringUTF16(IDS_LEGACY_TLS_PRIMARY_PARAGRAPH)); - load_time_data->SetStringKey( - "explanationParagraph", - l10n_util::GetStringUTF16(IDS_LEGACY_TLS_EXPLANATION)); - load_time_data->SetStringKey( - "finalParagraph", l10n_util::GetStringFUTF16( - IDS_SSL_OVERRIDABLE_PROCEED_PARAGRAPH, hostname)); -} - } // namespace common_string_util } // namespace security_interstitials
diff --git a/components/security_interstitials/core/common_string_util.h b/components/security_interstitials/core/common_string_util.h index 0a73ace..7755ff7 100644 --- a/components/security_interstitials/core/common_string_util.h +++ b/components/security_interstitials/core/common_string_util.h
@@ -28,11 +28,6 @@ const base::Time time_triggered, base::Value::Dict& load_time_data); -// Fills in the details for a legacy TLS error. Abstracts the strings for -// access from ios/. -void PopulateLegacyTLSStrings(base::Value* load_time_data, - const std::u16string& hostname); - } // common_string_util } // namespace security_interstitials
diff --git a/components/segmentation_platform/embedder/default_model/search_user_model.cc b/components/segmentation_platform/embedder/default_model/search_user_model.cc index bb73230..62c2db4 100644 --- a/components/segmentation_platform/embedder/default_model/search_user_model.cc +++ b/components/segmentation_platform/embedder/default_model/search_user_model.cc
@@ -123,7 +123,7 @@ const ModelProvider::Request& inputs, ExecutionCallback callback) { // Invalid inputs. - if (inputs.size() != kSearchUserUMAFeatures.size()) { + if (inputs.size() < kSearchUserUMAFeatures.size()) { base::SequencedTaskRunner::GetCurrentDefault()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt)); return;
diff --git a/components/signin/internal/identity_manager/mutable_profile_oauth2_token_service_delegate_unittest.cc b/components/signin/internal/identity_manager/mutable_profile_oauth2_token_service_delegate_unittest.cc index ff4628e0..aaa418f 100644 --- a/components/signin/internal/identity_manager/mutable_profile_oauth2_token_service_delegate_unittest.cc +++ b/components/signin/internal/identity_manager/mutable_profile_oauth2_token_service_delegate_unittest.cc
@@ -992,11 +992,10 @@ ScopedListPrefUpdate update(&pref_service_, prefs::kAccountInfo); update->clear(); - base::Value dict(base::Value::Type::DICT); - dict.SetStringKey("account_id", email); - dict.SetStringKey("email", email); - dict.SetStringKey("gaia", gaia_id); - update->Append(std::move(dict)); + update->Append(base::Value::Dict() + .Set("account_id", email) + .Set("email", email) + .Set("gaia", gaia_id)); account_tracker_service_.ResetForTesting(); AddAuthTokenManually("AccountId-" + email, "refresh_token");
diff --git a/components/sync_preferences/dual_layer_user_pref_store_unittest.cc b/components/sync_preferences/dual_layer_user_pref_store_unittest.cc index 201946c5..0c39d59a 100644 --- a/components/sync_preferences/dual_layer_user_pref_store_unittest.cc +++ b/components/sync_preferences/dual_layer_user_pref_store_unittest.cc
@@ -451,7 +451,7 @@ ASSERT_EQ(*mutable_value, original_value); // Update it! - mutable_value->SetStringKey("key", "new_value"); + mutable_value->GetDict().Set("key", "new_value"); const base::Value expected_value = mutable_value->Clone(); @@ -484,7 +484,7 @@ ASSERT_EQ(*mutable_value, original_value); // Update it! - mutable_value->SetStringKey("key", "new_value"); + mutable_value->GetDict().Set("key", "new_value"); const base::Value expected_value = mutable_value->Clone(); @@ -521,7 +521,7 @@ ASSERT_EQ(*mutable_value, original_account_value); // Update it! - mutable_value->SetStringKey("key", "new_value"); + mutable_value->GetDict().Set("key", "new_value"); const base::Value expected_value = mutable_value->Clone(); @@ -555,7 +555,7 @@ ASSERT_TRUE(mutable_value); ASSERT_EQ(*mutable_value, original_value); - mutable_value->SetStringKey("key", "new_value"); + mutable_value->GetDict().Set("key", "new_value"); // While the mutable value is "pending" (hasn't been "released" via // ReportValueChanged()), the pref gets cleared. @@ -755,17 +755,17 @@ base::Value* value1 = nullptr; ASSERT_TRUE(store()->GetMutableValue(kPref1, &value1)); - value1->SetStringKey("key1", "new_value1"); + value1->GetDict().Set("key1", "new_value1"); store()->ReportValueChanged(kPref1, 0); base::Value* value2 = nullptr; ASSERT_TRUE(store()->GetMutableValue(kPref2, &value2)); - value2->SetStringKey("key2", "new_value2"); + value2->GetDict().Set("key2", "new_value2"); store()->ReportValueChanged(kPref2, 0); base::Value* value3 = nullptr; ASSERT_TRUE(store()->GetMutableValue(kPref3, &value3)); - value3->SetStringKey("key3", "new_value3"); + value3->GetDict().Set("key3", "new_value3"); store()->ReportValueChanged(kPref3, 0); store()->RemoveObserver(&observer);
diff --git a/components/test/data/history/README.md b/components/test/data/history/README.md index bbd58412..2aebbc9b 100644 --- a/components/test/data/history/README.md +++ b/components/test/data/history/README.md
@@ -10,7 +10,7 @@ doesn't really matter how long you run it, but there'll be less work for you if you quit early. - $ out/Debug/chrome-wrapper --user-data-dir=foo + $ out/Debug/chrome --user-data-dir=foo 3. Locate the `History` file in the user-data-dir directory; e.g., `foo/Default/History`. @@ -21,8 +21,24 @@ 5. Manually remove all `INSERT INTO` statements other than the statements populating the `meta` table. -To generate history.N.sql, be sure to run these steps before implementing the N+1 migration in -chromium. I.e. you'll usually want to run these steps on the main branch rather than the CL branch. +<!-- This section adapted from comment in history_backend_db_unittest.cc. --> +In the past, we only added a history.57.sql file to the repo while adding a +migration to the NEXT version 58. That's confusing because then the developer +has to reverse engineer what the migration for 57 was. +If you introduce a new migration, add a test for it in `HistoryBackendDBTest`, +and add a new `history.N.sql` file for the new DB layout so that +`HistoryBackendDBTest.VerifyTestSQLFileForCurrentVersionAlreadyExists` keeps +passing. SQL schemas can change without migrations, so make sure to verify the +`history.N-1.sql` is up-to-date by re-creating. The flow to create a migration +`N` should be: +1. There should already exist `history.N-1.sql`. +2. Re-create `history.N-1.sql` to make sure it hasn't changed since it was + created. +3. Implement your migration to version `N`. +4. Add a migration test above the line labeled `NEW MIGRATION TESTS GO HERE`, + beginning with `CreateDBVersion(n-1)` and ending with + `ASSERT_GE(HistoryDatabase::GetCurrentVersion(), n);` +5. Create `history.N.sql`. Then run `git cl presubmit` to get a command to add + the new file to a filelist in this directory. [SQLite CLI]: https://www.sqlite.org/cli.html -
diff --git a/components/test/data/history/history.64.sql b/components/test/data/history/history.64.sql new file mode 100644 index 0000000..bdd9328b --- /dev/null +++ b/components/test/data/history/history.64.sql
@@ -0,0 +1,39 @@ +PRAGMA foreign_keys=OFF; +BEGIN TRANSACTION; +CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR); +INSERT INTO meta VALUES('mmap_status','-1'); +INSERT INTO meta VALUES('version','64'); +INSERT INTO meta VALUES('last_compatible_version','16'); +CREATE TABLE urls(id INTEGER PRIMARY KEY AUTOINCREMENT,url LONGVARCHAR,title LONGVARCHAR,visit_count INTEGER DEFAULT 0 NOT NULL,typed_count INTEGER DEFAULT 0 NOT NULL,last_visit_time INTEGER NOT NULL,hidden INTEGER DEFAULT 0 NOT NULL); +CREATE TABLE visits(id INTEGER PRIMARY KEY AUTOINCREMENT,url INTEGER NOT NULL,visit_time INTEGER NOT NULL,from_visit INTEGER,transition INTEGER DEFAULT 0 NOT NULL,segment_id INTEGER,visit_duration INTEGER DEFAULT 0 NOT NULL,incremented_omnibox_typed_score BOOLEAN DEFAULT FALSE NOT NULL,opener_visit INTEGER,originator_cache_guid TEXT,originator_visit_id INTEGER,originator_from_visit INTEGER,originator_opener_visit INTEGER,is_known_to_sync BOOLEAN DEFAULT FALSE NOT NULL,consider_for_ntp_most_visited BOOLEAN DEFAULT FALSE NOT NULL); +CREATE TABLE visit_source(id INTEGER PRIMARY KEY,source INTEGER NOT NULL); +CREATE TABLE keyword_search_terms (keyword_id INTEGER NOT NULL,url_id INTEGER NOT NULL,term LONGVARCHAR NOT NULL,normalized_term LONGVARCHAR NOT NULL); +CREATE TABLE downloads (id INTEGER PRIMARY KEY,guid VARCHAR NOT NULL,current_path LONGVARCHAR NOT NULL,target_path LONGVARCHAR NOT NULL,start_time INTEGER NOT NULL,received_bytes INTEGER NOT NULL,total_bytes INTEGER NOT NULL,state INTEGER NOT NULL,danger_type INTEGER NOT NULL,interrupt_reason INTEGER NOT NULL,hash BLOB NOT NULL,end_time INTEGER NOT NULL,opened INTEGER NOT NULL,last_access_time INTEGER NOT NULL,transient INTEGER NOT NULL,referrer VARCHAR NOT NULL,site_url VARCHAR NOT NULL,embedder_download_data VARCHAR NOT NULL,tab_url VARCHAR NOT NULL,tab_referrer_url VARCHAR NOT NULL,http_method VARCHAR NOT NULL,by_ext_or_web_app_id VARCHAR NOT NULL,by_ext_name VARCHAR NOT NULL,is_by_web_app INTEGER NOT NULL,etag VARCHAR NOT NULL,last_modified VARCHAR NOT NULL,mime_type VARCHAR(255) NOT NULL,original_mime_type VARCHAR(255) NOT NULL); +CREATE TABLE downloads_url_chains (id INTEGER NOT NULL,chain_index INTEGER NOT NULL,url LONGVARCHAR NOT NULL, PRIMARY KEY (id, chain_index) ); +CREATE TABLE downloads_slices (download_id INTEGER NOT NULL,offset INTEGER NOT NULL,received_bytes INTEGER NOT NULL,finished INTEGER NOT NULL DEFAULT 0,PRIMARY KEY (download_id, offset) ); +CREATE TABLE segments (id INTEGER PRIMARY KEY,name VARCHAR,url_id INTEGER NON NULL); +CREATE TABLE segment_usage (id INTEGER PRIMARY KEY,segment_id INTEGER NOT NULL,time_slot INTEGER NOT NULL,visit_count INTEGER DEFAULT 0 NOT NULL); +CREATE TABLE typed_url_sync_metadata (storage_key INTEGER PRIMARY KEY NOT NULL,value BLOB); +CREATE TABLE content_annotations(visit_id INTEGER PRIMARY KEY,visibility_score NUMERIC,floc_protected_score NUMERIC,categories VARCHAR,page_topics_model_version INTEGER,annotation_flags INTEGER NOT NULL,entities VARCHAR,related_searches VARCHAR,search_normalized_url VARCHAR,search_terms LONGVARCHAR,alternative_title VARCHAR,page_language VARCHAR,password_state INTEGER DEFAULT 0 NOT NULL,has_url_keyed_image BOOLEAN NOT NULL); +CREATE TABLE context_annotations(visit_id INTEGER PRIMARY KEY,context_annotation_flags INTEGER NOT NULL,duration_since_last_visit INTEGER,page_end_reason INTEGER,total_foreground_duration INTEGER,browser_type INTEGER DEFAULT 0 NOT NULL,window_id INTEGER DEFAULT -1 NOT NULL,tab_id INTEGER DEFAULT -1 NOT NULL,task_id INTEGER DEFAULT -1 NOT NULL,root_task_id INTEGER DEFAULT -1 NOT NULL,parent_task_id INTEGER DEFAULT -1 NOT NULL,response_code INTEGER DEFAULT 0 NOT NULL); +CREATE TABLE clusters(cluster_id INTEGER PRIMARY KEY AUTOINCREMENT,should_show_on_prominent_ui_surfaces BOOLEAN NOT NULL,label VARCHAR NOT NULL,raw_label VARCHAR NOT NULL,triggerability_calculated BOOLEAN NOT NULL,originator_cache_guid TEXT NOT NULL,originator_cluster_id INTEGER NOT NULL); +CREATE TABLE clusters_and_visits(cluster_id INTEGER NOT NULL,visit_id INTEGER NOT NULL,score NUMERIC NOT NULL,engagement_score NUMERIC NOT NULL,url_for_deduping LONGVARCHAR NOT NULL,normalized_url LONGVARCHAR NOT NULL,url_for_display LONGVARCHAR NOT NULL,PRIMARY KEY(cluster_id,visit_id))WITHOUT ROWID; +CREATE TABLE cluster_keywords(cluster_id INTEGER NOT NULL,keyword VARCHAR NOT NULL,type INTEGER NOT NULL,score NUMERIC NOT NULL,collections VARCHAR NOT NULL); +CREATE TABLE cluster_visit_duplicates(visit_id INTEGER NOT NULL,duplicate_visit_id INTEGER NOT NULL,PRIMARY KEY(visit_id,duplicate_visit_id))WITHOUT ROWID; +CREATE TABLE history_sync_metadata (storage_key INTEGER PRIMARY KEY NOT NULL, value BLOB); +DELETE FROM sqlite_sequence; +CREATE INDEX visits_url_index ON visits (url); +CREATE INDEX visits_from_index ON visits (from_visit); +CREATE INDEX visits_time_index ON visits (visit_time); +CREATE INDEX visits_originator_id_index ON visits (originator_visit_id); +CREATE INDEX keyword_search_terms_index1 ON keyword_search_terms (keyword_id, normalized_term); +CREATE INDEX keyword_search_terms_index2 ON keyword_search_terms (url_id); +CREATE INDEX keyword_search_terms_index3 ON keyword_search_terms (term); +CREATE INDEX segments_name ON segments(name); +CREATE INDEX segments_url_id ON segments(url_id); +CREATE INDEX segment_usage_time_slot_segment_id ON segment_usage(time_slot, segment_id); +CREATE INDEX segments_usage_seg_id ON segment_usage(segment_id); +CREATE INDEX clusters_for_visit ON clusters_and_visits(visit_id); +CREATE INDEX cluster_keywords_cluster_id_index ON cluster_keywords(cluster_id); +CREATE INDEX urls_url_index ON urls (url); +COMMIT;
diff --git a/components/test/data/history/unit_tests_bundle_data.filelist b/components/test/data/history/unit_tests_bundle_data.filelist index 307aa50..d50ac0dd 100644 --- a/components/test/data/history/unit_tests_bundle_data.filelist +++ b/components/test/data/history/unit_tests_bundle_data.filelist
@@ -51,6 +51,7 @@ //components/test/data/history/history.61.sql //components/test/data/history/history.62.sql //components/test/data/history/history.63.sql +//components/test/data/history/history.64.sql //components/test/data/history/thumbnail_wild/Favicons.corrupt_meta.disable //components/test/data/history/thumbnail_wild/Favicons.v2.init.sql //components/test/data/history/thumbnail_wild/Favicons.v3.init.sql
diff --git a/components/update_client/update_query_params.cc b/components/update_client/update_query_params.cc index a427158f..e52d9e7 100644 --- a/components/update_client/update_query_params.cc +++ b/components/update_client/update_query_params.cc
@@ -158,7 +158,7 @@ // static std::string UpdateQueryParams::GetProdVersion() { - return version_info::GetVersionNumber(); + return std::string(version_info::GetVersionNumber()); } // static
diff --git a/components/version_info/version_info.h b/components/version_info/version_info.h index fa40b5a..d50aff41 100644 --- a/components/version_info/version_info.h +++ b/components/version_info/version_info.h
@@ -9,6 +9,7 @@ #include "base/notreached.h" #include "base/sanitizer_buildflags.h" +#include "base/strings/string_piece.h" #include "build/branding_buildflags.h" #include "build/build_config.h" #include "components/version_info/channel.h" @@ -27,18 +28,18 @@ const std::string& build_version); // Returns the product name, e.g. "Chromium" or "Google Chrome". -constexpr std::string GetProductName() { +constexpr base::StringPiece GetProductName() { return PRODUCT_NAME; } // Returns the version number, e.g. "6.0.490.1". -constexpr std::string GetVersionNumber() { +constexpr base::StringPiece GetVersionNumber() { return PRODUCT_VERSION; } // Returns the product name and version information for the User-Agent header, // in the format: Chrome/<major_version>.<minor_version>.<build>.<patch>. -constexpr std::string GetProductNameAndVersionForUserAgent() { +constexpr base::StringPiece GetProductNameAndVersionForUserAgent() { return "Chrome/" PRODUCT_VERSION; } @@ -53,7 +54,7 @@ const base::Version& GetVersion(); // Returns a version control specific identifier of this release. -constexpr std::string GetLastChange() { +constexpr base::StringPiece GetLastChange() { return LAST_CHANGE; } @@ -65,7 +66,7 @@ } // Returns the OS type, e.g. "Windows", "Linux", "FreeBSD", ... -constexpr std::string GetOSType() { +constexpr base::StringPiece GetOSType() { #if BUILDFLAG(IS_WIN) return "Windows"; #elif BUILDFLAG(IS_IOS) @@ -97,7 +98,7 @@ // Returns a string equivalent of |channel|, independent of whether the build // is branded or not and without any additional modifiers. -constexpr std::string GetChannelString(Channel channel) { +constexpr base::StringPiece GetChannelString(Channel channel) { switch (channel) { case Channel::STABLE: return "stable"; @@ -114,7 +115,7 @@ } // Returns a list of sanitizers enabled in this build. -constexpr std::string GetSanitizerList() { +constexpr base::StringPiece GetSanitizerList() { return "" #if defined(ADDRESS_SANITIZER) "address "
diff --git a/components/viz/service/display/skia_renderer.cc b/components/viz/service/display/skia_renderer.cc index 7cd0dc9..79d92e5 100644 --- a/components/viz/service/display/skia_renderer.cc +++ b/components/viz/service/display/skia_renderer.cc
@@ -3685,8 +3685,6 @@ OverlayCandidate::ApplyClip(*overlay, gfx::RectF(apply_clip)); overlay->clip_rect = absl::nullopt; } - // Assume full damage every time the pass is rendered. - overlay->damage_rect = gfx::RectF(filter_bounds); // Fill in |format| and |color_space| information based on selected backing. overlay->color_space = color_space; overlay->format = BufferFormat(buffer_format.resource_format());
diff --git a/components/webapps/browser/android/webapk/webapk_proto_builder.cc b/components/webapps/browser/android/webapk/webapk_proto_builder.cc index b3b25b0..1e2501c7 100644 --- a/components/webapps/browser/android/webapk/webapk_proto_builder.cc +++ b/components/webapps/browser/android/webapk/webapk_proto_builder.cc
@@ -106,7 +106,8 @@ webapk->set_manifest_url(shortcut_info.manifest_url.spec()); webapk->set_requester_application_package( base::android::BuildInfo::GetInstance()->package_name()); - webapk->set_requester_application_version(version_info::GetVersionNumber()); + webapk->set_requester_application_version( + std::string(version_info::GetVersionNumber())); webapk->set_android_abi(getCurrentAbi()); webapk->set_package_name(package_name); webapk->set_version(version);
diff --git a/components/webauthn/android/java/src/org/chromium/components/webauthn/Fido2ApiTestHelper.java b/components/webauthn/android/java/src/org/chromium/components/webauthn/Fido2ApiTestHelper.java index c2448a65..9d31d82 100644 --- a/components/webauthn/android/java/src/org/chromium/components/webauthn/Fido2ApiTestHelper.java +++ b/components/webauthn/android/java/src/org/chromium/components/webauthn/Fido2ApiTestHelper.java
@@ -38,8 +38,6 @@ import org.chromium.blink.mojom.PublicKeyCredentialType; import org.chromium.blink.mojom.PublicKeyCredentialUserEntity; import org.chromium.blink.mojom.UvmEntry; -import org.chromium.components.payments.PaymentFeatureList; -import org.chromium.components.payments.PaymentFeatureListJni; import org.chromium.content.browser.ClientDataJsonImpl; import org.chromium.content.browser.ClientDataJsonImplJni; import org.chromium.mojo_base.mojom.TimeDelta; @@ -624,22 +622,8 @@ } /** - * Mocks PaymentFeatureList so that the Security Payment Confirmation flag has been enabled. - * @param mocker The mocker used to mock the PaymentFeatureListJni. - */ - public static void setSecurePaymentConfirmationEnabled(JniMocker mocker) { - PaymentFeatureList.Natives paymentFeatureListJni = new PaymentFeatureList.Natives() { - @Override - public boolean isEnabled(String featureName) { - return featureName.equals(PaymentFeatureList.SECURE_PAYMENT_CONFIRMATION); - } - }; - mocker.mock(PaymentFeatureListJni.TEST_HOOKS, paymentFeatureListJni); - } - - /** * Mocks ClientDataJson so that it returns the provided result. - * @param mocker The mocker used to mock the PaymentFeatureListJni. + * @param mocker The JNI mocker * @param mockResult The mock value for {@link ClientDataJson#buildClientDataJson} to return. */ public static void mockClientDataJson(JniMocker mocker, String mockResult) {
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 66896cc..2b2ba4e 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -1327,6 +1327,8 @@ "message_port_provider.cc", "metrics/histogram_controller.cc", "metrics/histogram_controller.h", + "metrics/histogram_shared_memory_config.cc", + "metrics/histogram_shared_memory_config.h", "metrics/histogram_subscriber.h", "metrics/histogram_synchronizer.cc", "metrics/histogram_synchronizer.h",
diff --git a/content/browser/attribution_reporting/attribution_data_host_manager.h b/content/browser/attribution_reporting/attribution_data_host_manager.h index 1cfe4ccd..89a894f 100644 --- a/content/browser/attribution_reporting/attribution_data_host_manager.h +++ b/content/browser/attribution_reporting/attribution_data_host_manager.h
@@ -11,6 +11,7 @@ #include "components/attribution_reporting/registration_type.mojom-forward.h" #include "content/browser/attribution_reporting/attribution_beacon_id.h" #include "mojo/public/cpp/bindings/pending_receiver.h" +#include "services/network/public/cpp/attribution_reporting_runtime_features.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/common/tokens/tokens.h" #include "third_party/blink/public/mojom/conversions/attribution_data_host.mojom-forward.h" @@ -24,10 +25,6 @@ class HttpResponseHeaders; } // namespace net -namespace network { -struct AttributionReportingRuntimeFeatures; -} // namespace network - namespace url { class Origin; } // namespace url
diff --git a/content/browser/attribution_reporting/attribution_data_host_manager_impl.cc b/content/browser/attribution_reporting/attribution_data_host_manager_impl.cc index 4dd2ab3..d1285bc 100644 --- a/content/browser/attribution_reporting/attribution_data_host_manager_impl.cc +++ b/content/browser/attribution_reporting/attribution_data_host_manager_impl.cc
@@ -578,7 +578,9 @@ network::AttributionReportingRuntimeFeatures runtime_features, bool is_final_response) { if (auto header = RegistrarAndHeader::Get( - headers, runtime_features.cross_app_web_enabled)) { + headers, + runtime_features.Has( + network::AttributionReportingRuntimeFeature::kCrossAppWeb))) { auto [it, inserted] = registrations_.emplace( source_origin, is_within_fenced_frame, std::move(input_event), render_frame_id, @@ -688,29 +690,33 @@ } void AttributionDataHostManagerImpl::OsSourceDataAvailable( - const GURL& registration_url) { + std::vector<GURL> registration_urls) { const ReceiverContext* context = GetReceiverContextForSource(); if (!context) { return; } - attribution_manager_->HandleOsRegistration( - OsRegistration(registration_url, context->context_origin(), - context->input_event()), - context->render_frame_id()); + for (GURL& url : registration_urls) { + attribution_manager_->HandleOsRegistration( + OsRegistration(std::move(url), context->context_origin(), + context->input_event()), + context->render_frame_id()); + } } void AttributionDataHostManagerImpl::OsTriggerDataAvailable( - const GURL& registration_url) { + std::vector<GURL> registration_urls) { const ReceiverContext* context = GetReceiverContextForTrigger(); if (!context) { return; } - attribution_manager_->HandleOsRegistration( - OsRegistration(registration_url, context->context_origin(), - /*input_event=*/absl::nullopt), - context->render_frame_id()); + for (GURL& url : registration_urls) { + attribution_manager_->HandleOsRegistration( + OsRegistration(std::move(url), context->context_origin(), + /*input_event=*/absl::nullopt), + context->render_frame_id()); + } } void AttributionDataHostManagerImpl::OnReceiverDisconnected() { @@ -774,8 +780,9 @@ return; } - auto attribution_header = - RegistrarAndHeader::Get(headers, runtime_features.cross_app_web_enabled); + auto attribution_header = RegistrarAndHeader::Get( + headers, runtime_features.Has( + network::AttributionReportingRuntimeFeature::kCrossAppWeb)); if (!attribution_header) { MaybeOnRegistrationsFinished(it); return;
diff --git a/content/browser/attribution_reporting/attribution_data_host_manager_impl.h b/content/browser/attribution_reporting/attribution_data_host_manager_impl.h index d86b66e..a27226ef 100644 --- a/content/browser/attribution_reporting/attribution_data_host_manager_impl.h +++ b/content/browser/attribution_reporting/attribution_data_host_manager_impl.h
@@ -133,8 +133,8 @@ attribution_reporting::SuitableOrigin reporting_origin, attribution_reporting::TriggerRegistration, absl::optional<network::TriggerVerification> verification) override; - void OsSourceDataAvailable(const GURL& registration_url) override; - void OsTriggerDataAvailable(const GURL& registration_url) override; + void OsSourceDataAvailable(std::vector<GURL> registration_urls) override; + void OsTriggerDataAvailable(std::vector<GURL> registration_urls) override; const ReceiverContext* GetReceiverContextForSource(); const ReceiverContext* GetReceiverContextForTrigger();
diff --git a/content/browser/attribution_reporting/attribution_data_host_manager_impl_unittest.cc b/content/browser/attribution_reporting/attribution_data_host_manager_impl_unittest.cc index 9bcdbcc..20374402 100644 --- a/content/browser/attribution_reporting/attribution_data_host_manager_impl_unittest.cc +++ b/content/browser/attribution_reporting/attribution_data_host_manager_impl_unittest.cc
@@ -1154,9 +1154,8 @@ attribution_src_token, headers.get(), reporter, source_site, AttributionInputEvent(), AttributionNavigationType::kAnchor, /*is_within_fenced_frame=*/false, kFrameId, kNavigationId, - network::AttributionReportingRuntimeFeatures{ - .cross_app_web_enabled = true, - }, + network::AttributionReportingRuntimeFeatures( + network::AttributionReportingRuntimeFeature::kCrossAppWeb), /*is_final_response=*/false); // Wait for parsing to finish. task_environment_.FastForwardBy(base::TimeDelta()); @@ -1184,9 +1183,8 @@ attribution_src_token, headers.get(), reporter, source_site, AttributionInputEvent(), AttributionNavigationType::kAnchor, /*is_within_fenced_frame=*/false, kFrameId, kNavigationId, - network::AttributionReportingRuntimeFeatures{ - .cross_app_web_enabled = true, - }, + network::AttributionReportingRuntimeFeatures( + network::AttributionReportingRuntimeFeature::kCrossAppWeb), /*is_final_response=*/false); // Wait for parsing to finish. task_environment_.FastForwardBy(base::TimeDelta()); @@ -1229,9 +1227,8 @@ attribution_src_token, headers.get(), reporter, source_site, AttributionInputEvent(), AttributionNavigationType::kAnchor, /*is_within_fenced_frame=*/false, kFrameId, kNavigationId, - network::AttributionReportingRuntimeFeatures{ - .cross_app_web_enabled = true, - }, + network::AttributionReportingRuntimeFeatures( + network::AttributionReportingRuntimeFeature::kCrossAppWeb), /*is_final_response=*/false); } @@ -1244,9 +1241,8 @@ attribution_src_token, headers.get(), reporter, source_site, AttributionInputEvent(), AttributionNavigationType::kAnchor, /*is_within_fenced_frame=*/false, kFrameId, kNavigationId, - network::AttributionReportingRuntimeFeatures{ - .cross_app_web_enabled = true, - }, + network::AttributionReportingRuntimeFeatures( + network::AttributionReportingRuntimeFeature::kCrossAppWeb), /*is_final_response=*/false); } @@ -1277,9 +1273,8 @@ attribution_src_token, headers.get(), reporter, source_site, AttributionInputEvent(), AttributionNavigationType::kAnchor, /*is_within_fenced_frame=*/false, kFrameId, kNavigationId, - network::AttributionReportingRuntimeFeatures{ - .cross_app_web_enabled = true, - }, + network::AttributionReportingRuntimeFeatures( + network::AttributionReportingRuntimeFeature::kCrossAppWeb), /*is_final_response=*/false); // Wait for parsing to finish. task_environment_.FastForwardBy(base::TimeDelta()); @@ -2151,9 +2146,8 @@ data_host_manager_.NotifyFencedFrameReportingBeaconData( kBeaconId, - network::AttributionReportingRuntimeFeatures{ - .cross_app_web_enabled = true, - }, + network::AttributionReportingRuntimeFeatures( + network::AttributionReportingRuntimeFeature::kCrossAppWeb), reporting_origin, headers.get(), /*is_final_response=*/false); @@ -2162,9 +2156,8 @@ data_host_manager_.NotifyFencedFrameReportingBeaconData( kBeaconId, - network::AttributionReportingRuntimeFeatures{ - .cross_app_web_enabled = true, - }, + network::AttributionReportingRuntimeFeatures( + network::AttributionReportingRuntimeFeature::kCrossAppWeb), reporting_origin, headers.get(), /*is_final_response=*/true); @@ -2693,7 +2686,7 @@ /*is_within_fenced_frame=*/false, RegistrationType::kSourceOrTrigger, kFrameId, /*last_navigation_id=*/kNavigationId); - data_host_remote->OsSourceDataAvailable(kRegistrationUrl); + data_host_remote->OsSourceDataAvailable({kRegistrationUrl}); data_host_remote.FlushForTesting(); } @@ -2713,7 +2706,7 @@ /*is_within_fenced_frame=*/false, RegistrationType::kSourceOrTrigger, kFrameId, /*last_navigation_id=*/kNavigationId); - data_host_remote->OsTriggerDataAvailable(kRegistrationUrl); + data_host_remote->OsTriggerDataAvailable({kRegistrationUrl}); data_host_remote.FlushForTesting(); }
diff --git a/content/browser/attribution_reporting/attribution_src_browsertest.cc b/content/browser/attribution_reporting/attribution_src_browsertest.cc index 75266f2..0b96b2e 100644 --- a/content/browser/attribution_reporting/attribution_src_browsertest.cc +++ b/content/browser/attribution_reporting/attribution_src_browsertest.cc
@@ -1396,8 +1396,8 @@ struct OsRegistrationTestCase { const char* name; const char* header; - std::vector<GURL> expected_os_sources; - std::vector<GURL> expected_os_triggers; + std::vector<std::vector<GURL>> expected_os_sources; + std::vector<std::vector<GURL>> expected_os_triggers; }; class AttributionSrcCrossAppWebEnabledOsRegistrationBrowserTest @@ -1413,8 +1413,10 @@ .header = "Attribution-Reporting-Register-OS-Source", .expected_os_sources = { - GURL("https://r1.test/x"), - GURL("https://r2.test/y"), + { + GURL("https://r1.test/x"), + GURL("https://r2.test/y"), + }, }, }, OsRegistrationTestCase{ @@ -1422,8 +1424,10 @@ .header = "Attribution-Reporting-Register-OS-Trigger", .expected_os_triggers = { - GURL("https://r1.test/x"), - GURL("https://r2.test/y"), + { + GURL("https://r1.test/x"), + GURL("https://r2.test/y"), + }, }, }), [](const auto& info) { return info.param.name; }); // test name generator
diff --git a/content/browser/attribution_reporting/test/mock_data_host.cc b/content/browser/attribution_reporting/test/mock_data_host.cc index 3f4c0a7..18fd709 100644 --- a/content/browser/attribution_reporting/test/mock_data_host.cc +++ b/content/browser/attribution_reporting/test/mock_data_host.cc
@@ -72,16 +72,16 @@ wait_loop_.Quit(); } -void MockDataHost::OsSourceDataAvailable(const GURL& registration_url) { - os_sources_.push_back(registration_url); +void MockDataHost::OsSourceDataAvailable(std::vector<GURL> registration_urls) { + os_sources_.emplace_back(std::move(registration_urls)); if (os_sources_.size() < min_os_sources_count_) { return; } wait_loop_.Quit(); } -void MockDataHost::OsTriggerDataAvailable(const GURL& registration_url) { - os_triggers_.push_back(registration_url); +void MockDataHost::OsTriggerDataAvailable(std::vector<GURL> registration_urls) { + os_triggers_.emplace_back(std::move(registration_urls)); if (os_triggers_.size() < min_os_triggers_count_) { return; }
diff --git a/content/browser/attribution_reporting/test/mock_data_host.h b/content/browser/attribution_reporting/test/mock_data_host.h index abfa404..24002bbc0 100644 --- a/content/browser/attribution_reporting/test/mock_data_host.h +++ b/content/browser/attribution_reporting/test/mock_data_host.h
@@ -52,8 +52,12 @@ return trigger_data_; } - const std::vector<GURL>& os_sources() const { return os_sources_; } - const std::vector<GURL>& os_triggers() const { return os_triggers_; } + const std::vector<std::vector<GURL>>& os_sources() const { + return os_sources_; + } + const std::vector<std::vector<GURL>>& os_triggers() const { + return os_triggers_; + } void WaitForOsSources(size_t); void WaitForOsTriggers(size_t); @@ -70,8 +74,8 @@ attribution_reporting::SuitableOrigin reporting_origin, attribution_reporting::TriggerRegistration, absl::optional<network::TriggerVerification>) override; - void OsSourceDataAvailable(const GURL& registration_url) override; - void OsTriggerDataAvailable(const GURL& registration_url) override; + void OsSourceDataAvailable(std::vector<GURL> registration_urls) override; + void OsTriggerDataAvailable(std::vector<GURL> registration_urls) override; size_t min_source_data_count_ = 0; std::vector<attribution_reporting::SourceRegistration> source_data_; @@ -80,10 +84,10 @@ std::vector<attribution_reporting::TriggerRegistration> trigger_data_; size_t min_os_sources_count_ = 0; - std::vector<GURL> os_sources_; + std::vector<std::vector<GURL>> os_sources_; size_t min_os_triggers_count_ = 0; - std::vector<GURL> os_triggers_; + std::vector<std::vector<GURL>> os_triggers_; base::RunLoop wait_loop_; mojo::Receiver<blink::mojom::AttributionDataHost> receiver_{this};
diff --git a/content/browser/browser_child_process_host_impl.cc b/content/browser/browser_child_process_host_impl.cc index 637eb29..1b52df1 100644 --- a/content/browser/browser_child_process_host_impl.cc +++ b/content/browser/browser_child_process_host_impl.cc
@@ -17,6 +17,7 @@ #include "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/metrics/histogram_shared_memory.h" #include "base/metrics/persistent_histogram_allocator.h" #include "base/metrics/persistent_memory_allocator.h" #include "base/observer_list.h" @@ -32,6 +33,7 @@ #include "content/browser/browser_main_loop.h" #include "content/browser/child_process_host_impl.h" #include "content/browser/metrics/histogram_controller.h" +#include "content/browser/metrics/histogram_shared_memory_config.h" #include "content/browser/tracing/background_tracing_manager_impl.h" #include "content/public/browser/browser_child_process_host_delegate.h" #include "content/public/browser/browser_child_process_observer.h" @@ -555,62 +557,35 @@ // Create a persistent memory segment for subprocess histograms only if // they're active in the browser. // TODO(crbug.com/1290457): Remove this. - if (!base::GlobalHistogramAllocator::Get()) + if (!base::GlobalHistogramAllocator::Get()) { return; - - // Determine the correct parameters based on the process type. - size_t memory_size; - base::StringPiece metrics_name; - switch (data_.process_type) { - case PROCESS_TYPE_UTILITY: - // This needs to be larger for the network service. - memory_size = 256 << 10; // 256 KiB - metrics_name = "UtilityMetrics"; - break; - - case PROCESS_TYPE_ZYGOTE: - memory_size = 64 << 10; // 64 KiB - metrics_name = "ZygoteMetrics"; - break; - - case PROCESS_TYPE_SANDBOX_HELPER: - memory_size = 64 << 10; // 64 KiB - metrics_name = "SandboxHelperMetrics"; - break; - - case PROCESS_TYPE_GPU: - // This needs to be larger for the display-compositor in the gpu process. - memory_size = 256 << 10; // 256 KiB - metrics_name = "GpuMetrics"; - break; - - case PROCESS_TYPE_PPAPI_PLUGIN: - memory_size = 64 << 10; // 64 KiB - metrics_name = "PpapiPluginMetrics"; - break; - - case PROCESS_TYPE_PPAPI_BROKER: - memory_size = 64 << 10; // 64 KiB - metrics_name = "PpapiBrokerMetrics"; - break; - - default: - return; } - // Create the shared memory segment and attach an allocator to it. - // Mapping the memory shouldn't fail but be safe if it does; everything - // will continue to work but just as if persistence weren't available. - base::WritableSharedMemoryRegion shm_region = - base::WritableSharedMemoryRegion::Create(memory_size); - base::WritableSharedMemoryMapping shm_mapping = shm_region.Map(); - if (!shm_region.IsValid() || !shm_mapping.IsValid()) + // This class is not expected to be used for renderer child processes. + // TODO(crbug/1028263): CHECK, once proven that this scenario does not + // occur in the wild, else remove dump and just return early if disproven. + if (data_.process_type == PROCESS_TYPE_RENDERER) { + base::debug::DumpWithoutCrashing(); return; - metrics_allocator_ = - std::make_unique<base::WritableSharedPersistentMemoryAllocator>( - std::move(shm_mapping), static_cast<uint64_t>(data_.id), - metrics_name); - metrics_shared_region_ = std::move(shm_region); + } + + // Get the shared memory configuration for this process type, if any, + auto shared_memory_config = + GetHistogramSharedMemoryConfig(data_.process_type); + if (!shared_memory_config.has_value()) { + return; + } + + // Create the shared memory region and histogram allocator. + auto shared_memory = base::HistogramSharedMemory::Create( + data_.id, shared_memory_config.value()); + if (!shared_memory.has_value()) { + return; + } + + // Move the memory region and allocator out of the |shared_memory| helper. + metrics_allocator_ = shared_memory->TakeAllocator(); + metrics_shared_region_ = shared_memory->TakeRegion(); } void BrowserChildProcessHostImpl::ShareMetricsAllocatorToProcess() {
diff --git a/content/browser/media/active_media_session_controller.cc b/content/browser/media/active_media_session_controller.cc index 37f02a8..b052a97 100644 --- a/content/browser/media/active_media_session_controller.cc +++ b/content/browser/media/active_media_session_controller.cc
@@ -205,8 +205,7 @@ case MediaSessionAction::kSetMute: case MediaSessionAction::kPreviousSlide: case MediaSessionAction::kNextSlide: - NOTREACHED(); - return; + NOTREACHED_NORETURN(); } } @@ -227,8 +226,7 @@ case ui::KeyboardCode::VKEY_MEDIA_PREV_TRACK: return MediaSessionAction::kPreviousTrack; default: - NOTREACHED(); - return MediaSessionAction::kPlay; + NOTREACHED_NORETURN(); } }
diff --git a/content/browser/media/android/browser_gpu_video_accelerator_factories.cc b/content/browser/media/android/browser_gpu_video_accelerator_factories.cc index 88cc3d5..e341b1b 100644 --- a/content/browser/media/android/browser_gpu_video_accelerator_factories.cc +++ b/content/browser/media/android/browser_gpu_video_accelerator_factories.cc
@@ -178,14 +178,12 @@ gpu::SharedImageInterface* BrowserGpuVideoAcceleratorFactories::SharedImageInterface() { - NOTREACHED(); - return nullptr; + NOTREACHED_NORETURN(); } gpu::GpuMemoryBufferManager* BrowserGpuVideoAcceleratorFactories::GpuMemoryBufferManager() { - NOTREACHED(); - return nullptr; + NOTREACHED_NORETURN(); } base::UnsafeSharedMemoryRegion
diff --git a/content/browser/media/media_capabilities_browsertest.cc b/content/browser/media/media_capabilities_browsertest.cc index c5a8874..d579f97 100644 --- a/content/browser/media/media_capabilities_browsertest.cc +++ b/content/browser/media/media_capabilities_browsertest.cc
@@ -164,10 +164,8 @@ return kMediaSourceString; case ConfigType::kWebRtc: return kWebRtcString; - default: - NOTREACHED(); - return ""; } + NOTREACHED_NORETURN(); } };
diff --git a/content/browser/media/session/media_session_impl.cc b/content/browser/media/session/media_session_impl.cc index 3440f79c..2ce5d74e3 100644 --- a/content/browser/media/session/media_session_impl.cc +++ b/content/browser/media/session/media_session_impl.cc
@@ -157,8 +157,7 @@ case media_session::mojom::MediaSessionAction::kNextSlide: return MediaSessionUserAction::kNextSlide; } - NOTREACHED(); - return MediaSessionUserAction::kPlay; + NOTREACHED_NORETURN(); } // If the string is not empty then push it to the back of a vector.
diff --git a/content/browser/metrics/histogram_shared_memory_config.cc b/content/browser/metrics/histogram_shared_memory_config.cc new file mode 100644 index 0000000..5d82bd92 --- /dev/null +++ b/content/browser/metrics/histogram_shared_memory_config.cc
@@ -0,0 +1,47 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/metrics/histogram_shared_memory_config.h" + +#include "content/public/common/process_type.h" + +namespace content { + +absl::optional<base::HistogramSharedMemoryConfig> +GetHistogramSharedMemoryConfig(int process_type) { + using Config = base::HistogramSharedMemoryConfig; + + // Determine the correct parameters based on the process type. + switch (process_type) { + case PROCESS_TYPE_RENDERER: + // Create persistent/shared memory and allow histograms to be stored in + // it. Memory that is not actually used won't be physically mapped by the + // system. RendererMetrics usage, as reported in UMA, peaked around 0.7MiB + // as of 2016-12-20. + return Config{"RendererMetrics", 2 << 20}; // 2 MiB + + case PROCESS_TYPE_UTILITY: + return Config{"UtilityMetrics", 256 << 10}; // 256 KiB + + case PROCESS_TYPE_ZYGOTE: + return Config{"ZygoteMetrics", 64 << 10}; // 64 KiB + + case PROCESS_TYPE_SANDBOX_HELPER: + return Config{"SandboxHelperMetrics", 64 << 10}; // 64 KiB + + case PROCESS_TYPE_GPU: + return Config{"GpuMetrics", 256 << 10}; // 256 KiB + + case PROCESS_TYPE_PPAPI_PLUGIN: + return Config{"PpapiPluginMetrics", 64 << 10}; // 64 KiB + + case PROCESS_TYPE_PPAPI_BROKER: + return Config{"PpapiBrokerMetrics", 64 << 10}; // 64 KiB + + default: + return absl::nullopt; + } +} + +} // namespace content
diff --git a/content/browser/metrics/histogram_shared_memory_config.h b/content/browser/metrics/histogram_shared_memory_config.h new file mode 100644 index 0000000..2f9d21e1 --- /dev/null +++ b/content/browser/metrics/histogram_shared_memory_config.h
@@ -0,0 +1,20 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_METRICS_HISTOGRAM_SHARED_MEMORY_CONFIG_H_ +#define CONTENT_BROWSER_METRICS_HISTOGRAM_SHARED_MEMORY_CONFIG_H_ + +#include "base/metrics/histogram_shared_memory.h" +#include "content/common/content_export.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace content { + +// Returns the histogram shared memory configuration for |process_type|, if any. +CONTENT_EXPORT absl::optional<base::HistogramSharedMemoryConfig> +GetHistogramSharedMemoryConfig(int process_type); + +} // namespace content + +#endif // CONTENT_BROWSER_METRICS_HISTOGRAM_SHARED_MEMORY_CONFIG_H_
diff --git a/content/browser/metrics/histogram_shared_memory_config_unittest.cc b/content/browser/metrics/histogram_shared_memory_config_unittest.cc new file mode 100644 index 0000000..67790cd --- /dev/null +++ b/content/browser/metrics/histogram_shared_memory_config_unittest.cc
@@ -0,0 +1,54 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/metrics/histogram_shared_memory_config.h" +#include "content/public/common/process_type.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace content { + +namespace { + +using Config = base::HistogramSharedMemoryConfig; + +struct ProcessTypeToOptionalConfig { + int process_type; + absl::optional<base::HistogramSharedMemoryConfig> expected; +}; + +using HistogramSharedMemoryConfigTest = + testing::TestWithParam<ProcessTypeToOptionalConfig>; + +} // namespace + +TEST_P(HistogramSharedMemoryConfigTest, GetHistogramSharedMemoryConfig) { + const auto& process_type = GetParam().process_type; + const auto& expected = GetParam().expected; + + const auto config = GetHistogramSharedMemoryConfig(process_type); + ASSERT_EQ(config.has_value(), expected.has_value()); + if (config.has_value()) { + EXPECT_EQ(config->allocator_name, expected->allocator_name); + EXPECT_EQ(config->memory_size_bytes, expected->memory_size_bytes); + } +} + +INSTANTIATE_TEST_SUITE_P( + All, + HistogramSharedMemoryConfigTest, + testing::ValuesIn(std::vector<ProcessTypeToOptionalConfig>({ + {PROCESS_TYPE_UNKNOWN, absl::nullopt}, + {PROCESS_TYPE_BROWSER, absl::nullopt}, + {PROCESS_TYPE_RENDERER, Config{"RendererMetrics", 2 << 20}}, + {PROCESS_TYPE_PLUGIN_DEPRECATED, absl::nullopt}, + {PROCESS_TYPE_WORKER_DEPRECATED, absl::nullopt}, + {PROCESS_TYPE_UTILITY, Config{"UtilityMetrics", 256 << 10}}, + {PROCESS_TYPE_ZYGOTE, Config{"ZygoteMetrics", 64 << 10}}, + {PROCESS_TYPE_SANDBOX_HELPER, Config{"SandboxHelperMetrics", 64 << 10}}, + {PROCESS_TYPE_GPU, Config{"GpuMetrics", 256 << 10}}, + {PROCESS_TYPE_PPAPI_PLUGIN, Config{"PpapiPluginMetrics", 64 << 10}}, + {PROCESS_TYPE_PPAPI_BROKER, Config{"PpapiBrokerMetrics", 64 << 10}}, + }))); + +} // namespace content
diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/content/browser/renderer_host/browser_compositor_view_mac.mm index 323548d..b7311c8 100644 --- a/content/browser/renderer_host/browser_compositor_view_mac.mm +++ b/content/browser/renderer_host/browser_compositor_view_mac.mm
@@ -12,7 +12,7 @@ #include "base/command_line.h" #include "base/containers/circular_deque.h" -#include "base/lazy_instance.h" +#include "base/no_destructor.h" #include "base/trace_event/trace_event.h" #include "components/viz/common/features.h" #include "components/viz/common/surfaces/local_surface_id.h" @@ -38,8 +38,10 @@ // signals to shut down will come in very late, long after things that the // ui::Compositor depend on have been destroyed). // https://crbug.com/805726 -base::LazyInstance<std::set<BrowserCompositorMac*>>::Leaky - g_browser_compositors; +std::set<BrowserCompositorMac*>& GetBrowserCompositors() { + static base::NoDestructor<std::set<BrowserCompositorMac*>> instance; + return *instance.get(); +} } // namespace @@ -54,7 +56,7 @@ : client_(client), accelerated_widget_mac_ns_view_(accelerated_widget_mac_ns_view), weak_factory_(this) { - g_browser_compositors.Get().insert(this); + GetBrowserCompositors().insert(this); root_layer_ = std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR); // Ensure that this layer draws nothing when it does not not have delegated @@ -75,7 +77,7 @@ delegated_frame_host_.reset(); root_layer_.reset(); - size_t num_erased = g_browser_compositors.Get().erase(this); + size_t num_erased = GetBrowserCompositors().erase(this); DCHECK_EQ(1u, num_erased); } @@ -138,9 +140,9 @@ } if (recyclable_compositor_) { - recyclable_compositor_->UpdateSurface(dfh_size_pixels_, - current.device_scale_factor, - current.display_color_spaces); + recyclable_compositor_->UpdateSurface( + dfh_size_pixels_, current.device_scale_factor, + current.display_color_spaces, current.display_id); } } @@ -160,9 +162,9 @@ dfh_device_scale_factor_ = new_device_scale_factor; root_layer_->SetBounds(gfx::Rect(dfh_size_dip_)); if (recyclable_compositor_) { - recyclable_compositor_->UpdateSurface(dfh_size_pixels_, - current.device_scale_factor, - current.display_color_spaces); + recyclable_compositor_->UpdateSurface( + dfh_size_pixels_, current.device_scale_factor, + current.display_color_spaces, current.display_id); } } delegated_frame_host_->EmbedSurface( @@ -252,9 +254,9 @@ recyclable_compositor_ = std::make_unique<ui::RecyclableCompositorMac>( content::GetContextFactory()); display::ScreenInfo current = client_->GetCurrentScreenInfo(); - recyclable_compositor_->UpdateSurface(dfh_size_pixels_, - current.device_scale_factor, - current.display_color_spaces); + recyclable_compositor_->UpdateSurface( + dfh_size_pixels_, current.device_scale_factor, + current.display_color_spaces, current.display_id); recyclable_compositor_->compositor()->SetRootLayer(root_layer_.get()); recyclable_compositor_->compositor()->SetBackgroundColor(background_color_); recyclable_compositor_->widget()->SetNSView( @@ -273,9 +275,8 @@ // Ensure that the client has destroyed its BrowserCompositorViewMac before // it dependencies are destroyed. // https://crbug.com/805726 - while (!g_browser_compositors.Get().empty()) { - BrowserCompositorMac* browser_compositor = - *g_browser_compositors.Get().begin(); + while (!GetBrowserCompositors().empty()) { + BrowserCompositorMac* browser_compositor = *GetBrowserCompositors().begin(); browser_compositor->client_->DestroyCompositorForShutdown(); } }
diff --git a/content/browser/renderer_host/media/fuchsia_media_codec_provider_impl.cc b/content/browser/renderer_host/media/fuchsia_media_codec_provider_impl.cc index 61b4927..4904953 100644 --- a/content/browser/renderer_host/media/fuchsia_media_codec_provider_impl.cc +++ b/content/browser/renderer_host/media/fuchsia_media_codec_provider_impl.cc
@@ -44,8 +44,7 @@ break; } - NOTREACHED(); - return absl::nullopt; + NOTREACHED_NORETURN(); } media::VideoCodecProfile ConvertToVideoCodecProfile(
diff --git a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc index 942122cf..f7051cf 100644 --- a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc +++ b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
@@ -256,13 +256,10 @@ switch (stream_type) { case blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE: { - if (!video_capture_system_) { - // Clients who create an instance of |this| without providing a - // VideoCaptureSystem instance are expected to know that - // MEDIA_DEVICE_VIDEO_CAPTURE is not supported in this case. - NOTREACHED(); - return; - } + // Clients who create an instance of |this| without providing a + // VideoCaptureSystem instance are expected to know that + // MEDIA_DEVICE_VIDEO_CAPTURE is not supported in this case. + CHECK(video_capture_system_); start_capture_closure = base::BindOnce( &InProcessVideoCaptureDeviceLauncher:: DoStartDeviceCaptureOnDeviceThread, @@ -447,8 +444,7 @@ std::move(done_cb).Run(); return; case State::READY_TO_LAUNCH: - NOTREACHED(); - return; + NOTREACHED_NORETURN(); } } @@ -466,8 +462,7 @@ std::move(done_cb).Run(); return; case State::READY_TO_LAUNCH: - NOTREACHED(); - return; + NOTREACHED_NORETURN(); } }
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc index 7da1a40b..22816f5 100644 --- a/content/browser/renderer_host/media/media_stream_manager.cc +++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -3834,11 +3834,9 @@ MediaStreamType stream_type) const { if (blink::IsVideoInputMediaType(stream_type)) { return video_capture_manager(); - } else if (blink::IsAudioInputMediaType(stream_type)) { - return audio_input_device_manager(); } - NOTREACHED(); - return nullptr; + CHECK(blink::IsAudioInputMediaType(stream_type)); + return audio_input_device_manager(); } void MediaStreamManager::OnMediaStreamUIWindowId(
diff --git a/content/browser/renderer_host/media/service_video_capture_device_launcher.cc b/content/browser/renderer_host/media/service_video_capture_device_launcher.cc index 0efd3db..921537c 100644 --- a/content/browser/renderer_host/media/service_video_capture_device_launcher.cc +++ b/content/browser/renderer_host/media/service_video_capture_device_launcher.cc
@@ -85,11 +85,8 @@ auto scoped_trace = ScopedCaptureTrace::CreateIfEnabled( "ServiceVideoCaptureDeviceLauncher::LaunchDeviceAsync"); - if (stream_type != blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE) { - // This launcher only supports MediaStreamType::DEVICE_VIDEO_CAPTURE. - NOTREACHED(); - return; - } + // This launcher only supports MediaStreamType::DEVICE_VIDEO_CAPTURE. + CHECK_EQ(stream_type, blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE); connect_to_source_provider_cb_.Run(&service_connection_); if (!service_connection_->source_provider().is_bound()) {
diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc index 3ae118394..08175a2 100644 --- a/content/browser/renderer_host/media/video_capture_controller.cc +++ b/content/browser/renderer_host/media/video_capture_controller.cc
@@ -477,19 +477,11 @@ DCHECK_CURRENTLY_ON(BrowserThread::IO); ControllerClient* client = FindClient(id, event_handler, controller_clients_); + CHECK(client); - // If this buffer is not held by this client, or this client doesn't exist - // in controller, do nothing. - if (!client) { - NOTREACHED(); - return; - } auto buffers_in_use_entry_iter = base::ranges::find(client->buffers_in_use, buffer_id); - if (buffers_in_use_entry_iter == std::end(client->buffers_in_use)) { - NOTREACHED(); - return; - } + CHECK(buffers_in_use_entry_iter != std::end(client->buffers_in_use)); client->buffers_in_use.erase(buffers_in_use_entry_iter); OnClientFinishedConsumingBuffer(client, buffer_id, feedback);
diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc index 34a99a9..e0b702e1 100644 --- a/content/browser/renderer_host/media/video_capture_manager.cc +++ b/content/browser/renderer_host/media/video_capture_manager.cc
@@ -437,16 +437,13 @@ VideoCaptureControllerID client_id, VideoCaptureControllerEventHandler* client_handler, media::VideoCaptureError error) { + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("video_and_image_capture"), + "VideoCaptureManager::DisconnectClient"); DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(controller); DCHECK(client_handler); - TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("video_and_image_capture"), - "VideoCaptureManager::DisconnectClient"); + CHECK(IsControllerPointerValid(controller)); - if (!IsControllerPointerValid(controller)) { - NOTREACHED(); - return; - } if (error != media::VideoCaptureError::kNone) { LogVideoCaptureError(error); std::ostringstream string_stream;
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc index b2bd4b327..8bd3ac75 100644 --- a/content/browser/renderer_host/navigation_controller_impl.cc +++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -62,6 +62,7 @@ #include "content/browser/browser_url_handler_impl.h" #include "content/browser/dom_storage/dom_storage_context_wrapper.h" #include "content/browser/dom_storage/session_storage_namespace_impl.h" +#include "content/browser/process_lock.h" #include "content/browser/renderer_host/debug_urls.h" #include "content/browser/renderer_host/frame_tree.h" #include "content/browser/renderer_host/frame_tree_node.h" @@ -536,9 +537,9 @@ scoped_refptr<network::SharedURLLoaderFactory> blob_url_loader_factory) { return NavigationControllerImpl::CreateNavigationEntry( url, referrer, std::move(initiator_origin), std::move(initiator_base_url), - nullptr /* source_site_instance */, transition, is_renderer_initiated, - extra_headers, browser_context, std::move(blob_url_loader_factory), - true /* rewrite_virtual_urls */); + absl::nullopt /* source_process_site_url */, transition, + is_renderer_initiated, extra_headers, browser_context, + std::move(blob_url_loader_factory), true /* rewrite_virtual_urls */); } // static @@ -548,7 +549,7 @@ Referrer referrer, absl::optional<url::Origin> initiator_origin, absl::optional<GURL> initiator_base_url, - SiteInstance* source_site_instance, + absl::optional<GURL> source_process_site_url, ui::PageTransition transition, bool is_renderer_initiated, const std::string& extra_headers, @@ -565,7 +566,7 @@ // Let the NTP override the navigation params and pretend that this is a // browser-initiated, bookmark-like navigation. GetContentClient()->browser()->OverrideNavigationParams( - source_site_instance, &transition, &is_renderer_initiated, &referrer, + source_process_site_url, &transition, &is_renderer_initiated, &referrer, &initiator_origin); auto entry = std::make_unique<NavigationEntryImpl>( @@ -2781,9 +2782,14 @@ // fenced frames or subframes, they don't rewrite urls as the urls are not // input urls by users. bool rewrite_virtual_urls = node->IsOutermostMainFrame(); + absl::optional<GURL> source_process_site_url = absl::nullopt; + if (source_site_instance && source_site_instance->HasProcess()) { + source_process_site_url = + source_site_instance->GetProcess()->GetProcessLock().site_url(); + } entry = NavigationEntryImpl::FromNavigationEntry(CreateNavigationEntry( url, referrer, initiator_origin, initiator_base_url, - source_site_instance, page_transition, is_renderer_initiated, + source_process_site_url, page_transition, is_renderer_initiated, extra_headers, browser_context_, blob_url_loader_factory, rewrite_virtual_urls)); entry->root_node()->frame_entry->set_source_site_instance( @@ -3739,9 +3745,16 @@ // fenced frames or subframes, they don't rewrite urls as the urls are not // input urls by users. bool rewrite_virtual_urls = node->IsOutermostMainFrame(); + scoped_refptr<SiteInstance> source_site_instance = + params.source_site_instance; + absl::optional<GURL> source_process_site_url = absl::nullopt; + if (source_site_instance && source_site_instance->HasProcess()) { + source_process_site_url = + source_site_instance->GetProcess()->GetProcessLock().site_url(); + } entry = NavigationEntryImpl::FromNavigationEntry(CreateNavigationEntry( params.url, params.referrer, params.initiator_origin, - params.initiator_base_url, params.source_site_instance.get(), + params.initiator_base_url, source_process_site_url, params.transition_type, params.is_renderer_initiated, extra_headers_crlf, browser_context_, blob_url_loader_factory, rewrite_virtual_urls));
diff --git a/content/browser/renderer_host/navigation_controller_impl.h b/content/browser/renderer_host/navigation_controller_impl.h index 9d7bd9a..097f693 100644 --- a/content/browser/renderer_host/navigation_controller_impl.h +++ b/content/browser/renderer_host/navigation_controller_impl.h
@@ -414,7 +414,7 @@ const blink::PageState& page_state); // Like NavigationController::CreateNavigationEntry, but takes an extra - // argument, |source_site_instance|. + // argument, |source_process_site_url|. // `rewrite_virtual_urls` is true when it needs to rewrite virtual urls // (e.g., for outermost frames). static std::unique_ptr<NavigationEntryImpl> CreateNavigationEntry( @@ -422,7 +422,7 @@ Referrer referrer, absl::optional<url::Origin> initiator_origin, absl::optional<GURL> initiator_base_url, - SiteInstance* source_site_instance, + absl::optional<GURL> source_process_site_url, ui::PageTransition transition, bool is_renderer_initiated, const std::string& extra_headers,
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index 8b054b3..7b44c0407 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc
@@ -1848,8 +1848,9 @@ ui::PageTransition transition = ui::PageTransitionFromInt(common_params_->transition); GetContentClient()->browser()->OverrideNavigationParams( - source_site_instance_.get(), &transition, &is_renderer_initiated, - &referrer, &common_params_->initiator_origin); + source_site_instance_->GetProcess()->GetProcessLock().site_url(), + &transition, &is_renderer_initiated, &referrer, + &common_params_->initiator_origin); common_params_->transition = transition; common_params_->referrer = blink::mojom::Referrer::New(referrer.url, referrer.policy);
diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc index 0e23c03..4627e9c 100644 --- a/content/browser/renderer_host/navigator.cc +++ b/content/browser/renderer_host/navigator.cc
@@ -1335,7 +1335,11 @@ // therefore that |current_site_instance| is also the |source_site_instance|. SiteInstance* current_site_instance = frame_tree_node->current_frame_host()->GetSiteInstance(); - SiteInstance* source_site_instance = current_site_instance; + absl::optional<GURL> source_process_site_url = absl::nullopt; + if (current_site_instance && current_site_instance->HasProcess()) { + source_process_site_url = + current_site_instance->GetProcess()->GetProcessLock().site_url(); + } // If `frame_tree_node` is the outermost main frame, it rewrites a virtual // url in order to adjust the original input url if needed. For inner frames // such as fenced frames or subframes, they don't rewrite urls as the urls @@ -1346,7 +1350,7 @@ NavigationControllerImpl::CreateNavigationEntry( common_params.url, content::Referrer(), common_params.initiator_origin, common_params.initiator_base_url, - source_site_instance, ui::PAGE_TRANSITION_LINK, + source_process_site_url, ui::PAGE_TRANSITION_LINK, true /* is_renderer_initiated */, std::string() /* extra_headers */, controller_.GetBrowserContext(),
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index 5d513ca4..ffa1f10c 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -8231,7 +8231,7 @@ const std::string& event_data, const std::string& event_type, const std::vector<blink::FencedFrame::ReportingDestination>& destinations, - const network::AttributionReportingRuntimeFeatures& + network::AttributionReportingRuntimeFeatures attribution_reporting_runtime_features) { for (const blink::FencedFrame::ReportingDestination& destination : destinations) { @@ -8379,7 +8379,7 @@ void RenderFrameHostImpl::SetFencedFrameAutomaticBeaconReportEventData( const std::string& event_data, const std::vector<blink::FencedFrame::ReportingDestination>& destinations, - const network::AttributionReportingRuntimeFeatures& + network::AttributionReportingRuntimeFeatures attribution_reporting_runtime_features) { if (event_data.length() > blink::kFencedFrameMaxBeaconLength) { mojo::ReportBadMessage(
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h index 171a001b1..aaaf3472 100644 --- a/content/browser/renderer_host/render_frame_host_impl.h +++ b/content/browser/renderer_host/render_frame_host_impl.h
@@ -105,6 +105,7 @@ #include "ppapi/buildflags/buildflags.h" #include "services/device/public/mojom/sensor_provider.mojom-forward.h" #include "services/metrics/public/cpp/ukm_source_id.h" +#include "services/network/public/cpp/attribution_reporting_runtime_features.h" #include "services/network/public/cpp/cross_origin_embedder_policy.h" #include "services/network/public/cpp/cross_origin_opener_policy.h" #include "services/network/public/mojom/cookie_access_observer.mojom.h" @@ -213,7 +214,6 @@ } namespace network { -struct AttributionReportingRuntimeFeatures; class ResourceRequestBody; } // namespace network @@ -2405,12 +2405,12 @@ const std::string& event_data, const std::string& event_type, const std::vector<blink::FencedFrame::ReportingDestination>& destinations, - const network::AttributionReportingRuntimeFeatures& + network::AttributionReportingRuntimeFeatures attribution_reporting_runtime_features) override; void SetFencedFrameAutomaticBeaconReportEventData( const std::string& event_data, const std::vector<blink::FencedFrame::ReportingDestination>& destinations, - const network::AttributionReportingRuntimeFeatures& + network::AttributionReportingRuntimeFeatures attribution_reporting_runtime_features) override; void SendPrivateAggregationRequestsForFencedFrameEvent( const std::string& event_type) override;
diff --git a/content/browser/renderer_host/render_frame_host_owner.h b/content/browser/renderer_host/render_frame_host_owner.h index 3af5ea3..eee6d095 100644 --- a/content/browser/renderer_host/render_frame_host_owner.h +++ b/content/browser/renderer_host/render_frame_host_owner.h
@@ -10,6 +10,7 @@ #include "build/build_config.h" #include "mojo/public/cpp/bindings/pending_receiver.h" +#include "services/network/public/cpp/attribution_reporting_runtime_features.h" #include "services/network/public/mojom/referrer_policy.mojom-forward.h" #include "third_party/blink/public/mojom/frame/user_activation_update_types.mojom-forward.h" #include "third_party/blink/public/mojom/loader/referrer.mojom-forward.h" @@ -25,10 +26,6 @@ class IsolationInfo; } // namespace net -namespace network { -struct AttributionReportingRuntimeFeatures; -} // namespace network - namespace url { class Origin; } // namespace url
diff --git a/content/browser/renderer_host/render_frame_proxy_host.cc b/content/browser/renderer_host/render_frame_proxy_host.cc index b7f1eb8..429f3de 100644 --- a/content/browser/renderer_host/render_frame_proxy_host.cc +++ b/content/browser/renderer_host/render_frame_proxy_host.cc
@@ -758,6 +758,9 @@ // See also https://crbug.com/647772. // TODO(clamy): The transition should probably be changed for POST navigations // to PAGE_TRANSITION_FORM_SUBMIT. See https://crbug.com/829827. + // TODO(https://crbug.com/1261963): Determine which source_site_instance from + // site_instance_group_ to use for navigations to about:blank, once + // RenderFrameProxyHost no longer has a site_instance_. frame_tree_node_->navigator().NavigateFromFrameProxy( current_rfh, validated_url, base::OptionalToPtr(params->initiator_frame_token), GetProcess()->GetID(),
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 641dea27..d7a4810 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -40,6 +40,7 @@ #include "base/message_loop/message_pump_type.h" #include "base/metrics/histogram_base.h" #include "base/metrics/histogram_macros.h" +#include "base/metrics/histogram_shared_memory.h" #include "base/metrics/persistent_histogram_allocator.h" #include "base/metrics/persistent_memory_allocator.h" #include "base/metrics/statistics_recorder.h" @@ -100,6 +101,7 @@ #include "content/browser/media/frameless_media_interface_proxy.h" #include "content/browser/media/media_internals.h" #include "content/browser/metrics/histogram_controller.h" +#include "content/browser/metrics/histogram_shared_memory_config.h" #include "content/browser/mime_registry_impl.h" #include "content/browser/network_service_instance_impl.h" #include "content/browser/notifications/platform_notification_context_impl.h" @@ -4788,26 +4790,23 @@ if (destination == base::kNullProcessHandle) return; - // Create persistent/shared memory and allow histograms to be stored in - // it. Memory that is not actually used won't be physically mapped by the - // system. RendererMetrics usage, as reported in UMA, peaked around 0.7MiB - // as of 2016-12-20. - base::WritableSharedMemoryRegion shm_region = - base::WritableSharedMemoryRegion::Create(2 << 20); // 2 MiB - base::WritableSharedMemoryMapping shm_mapping = shm_region.Map(); - if (!shm_region.IsValid() || !shm_mapping.IsValid()) - return; + // Get the renderer histogram shared memory configuration. + auto shared_memory_config = + GetHistogramSharedMemoryConfig(PROCESS_TYPE_RENDERER); + CHECK(shared_memory_config.has_value()); - // If a renderer crashes before completing startup and gets restarted, this - // method will get called a second time meaning that a metrics-allocator - // already exists. We have to recreate it here because previously used - // |shm_region| is gone. - metrics_allocator_ = - std::make_unique<base::WritableSharedPersistentMemoryAllocator>( - std::move(shm_mapping), GetID(), "RendererMetrics"); + // Create the shared memory region and allocator. + auto shared_memory = base::HistogramSharedMemory::Create( + GetID(), shared_memory_config.value()); + if (!shared_memory.has_value()) { + return; + } + + // Move the region and allocator out of the |shared_memory| helper. + metrics_allocator_ = shared_memory->TakeAllocator(); HistogramController::GetInstance()->SetHistogramMemory<RenderProcessHost>( - this, std::move(shm_region)); + this, shared_memory->TakeRegion()); } ChildProcessTerminationInfo RenderProcessHostImpl::GetChildTerminationInfo(
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index 059024e8..7bc8b9a 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h
@@ -542,8 +542,12 @@ // Allows the embedder to override parameters when navigating. Called for both // opening new URLs and when transferring URLs across processes. + // If the initiator of the navigation is set, `source_process_site_url` is + // the site URL that the initiator's process is locked to. Generally the + // initiator is set on renderer-initiated navigations, but not on + // browser-initiated navigations. virtual void OverrideNavigationParams( - SiteInstance* site_instance, + absl::optional<GURL> source_process_site_url, ui::PageTransition* transition, bool* is_renderer_initiated, content::Referrer* referrer,
diff --git a/content/renderer/media/batching_media_log.cc b/content/renderer/media/batching_media_log.cc index ed397b0..aaea3db81 100644 --- a/content/renderer/media/batching_media_log.cc +++ b/content/renderer/media/batching_media_log.cc
@@ -204,10 +204,11 @@ } return ""; } - default: - NOTREACHED(); - return ""; + case media::MediaLogRecord::Type::kMediaPropertyChange: + case media::MediaLogRecord::Type::kMediaEventTriggered: + NOTREACHED_NORETURN(); } + NOTREACHED_NORETURN(); } void BatchingMediaLog::SendQueuedMediaEvents() {
diff --git a/content/renderer/media/inspector_media_event_handler.cc b/content/renderer/media/inspector_media_event_handler.cc index 7b9f26a..634b464 100644 --- a/content/renderer/media/inspector_media_event_handler.cc +++ b/content/renderer/media/inspector_media_event_handler.cc
@@ -94,10 +94,8 @@ return blink::InspectorPlayerMessage::Level::kWarning; if (level == "info") return blink::InspectorPlayerMessage::Level::kInfo; - if (level == "debug") - return blink::InspectorPlayerMessage::Level::kDebug; - NOTREACHED(); - return blink::InspectorPlayerMessage::Level::kError; + CHECK_EQ(level, "debug"); + return blink::InspectorPlayerMessage::Level::kDebug; } } // namespace
diff --git a/content/renderer/media/renderer_webaudiodevice_impl.cc b/content/renderer/media/renderer_webaudiodevice_impl.cc index 6f5ba000..411fdfa 100644 --- a/content/renderer/media/renderer_webaudiodevice_impl.cc +++ b/content/renderer/media/renderer_webaudiodevice_impl.cc
@@ -55,10 +55,9 @@ case WebAudioLatencyHint::kCategoryExact: return blink::WebAudioDeviceSourceType::kWebAudioExact; case WebAudioLatencyHint::kLastValue: - NOTREACHED(); + NOTREACHED_NORETURN(); } - NOTREACHED(); - return blink::WebAudioDeviceSourceType::kWebAudioInteractive; + NOTREACHED_NORETURN(); } int GetOutputBufferSize(const blink::WebAudioLatencyHint& latency_hint,
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index e57fc4f..c68f538b 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -2408,6 +2408,7 @@ "../browser/media/system_media_controls_notifier_unittest.cc", "../browser/media/webaudio/audio_context_manager_impl_unittest.cc", "../browser/memory/swap_metrics_driver_impl_unittest.cc", + "../browser/metrics/histogram_shared_memory_config_unittest.cc", "../browser/metrics/histograms_monitor_unittest.cc", "../browser/mojo_binder_policy_applier_unittest.cc", "../browser/mojo_binder_policy_map_impl_unittest.cc",
diff --git a/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt index 578b4f6..1947aac 100644 --- a/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt
@@ -356,7 +356,8 @@ crbug.com/1395227 [ asan intel mac-x86_64 monterey release ] Pixel_WebGPUImportVideoFrameOffscreenCanvas [ Failure ] crbug.com/1395227 [ amd-0x7340 no-clang-coverage release-x64 target-cpu-64 win ] Pixel_WebGPUImportVideoFrameUnacceleratedOffscreenCanvas [ Failure ] crbug.com/1395227 [ intel-0x9bc5 no-clang-coverage release-x64 target-cpu-64 win ] Pixel_WebGPUImportVideoFrameUnacceleratedOffscreenCanvas [ Failure ] - +crbug.com/1445575 [ win10 nvidia-0x2184 target-cpu-64 passthrough ] Pixel_WebGPUImportVideoFrameUnaccelerated [ Failure ] +crbug.com/1445575 [ win10 nvidia-0x2184 target-cpu-64 passthrough ] Pixel_WebGPUImportVideoFrameUnacceleratedOffscreenCanvas [ Failure ] crbug.com/1372144 [ android android-sm-a135m ] Pixel_CanvasDisplaySRGBAccelerated2D [ Failure ] crbug.com/1372144 [ android android-sm-a135m ] Pixel_CanvasLowLatencyWebGLAlphaFalse [ Failure ] @@ -408,6 +409,9 @@ crbug.com/1444804 [ android-pixel-4 android-r angle-disabled no-passthrough ] Pixel_Video_Context_Loss_VP9 [ Failure ] crbug.com/1444804 [ android-pixel-4 android-r angle-disabled no-passthrough ] Pixel_Video_VP9 [ Failure ] +# Samsung flaky incorrect colors +crbug.com/1445552 [ android android-sm-a135m ] Pixel_OffscreenCanvasWebGLDefault [ Failure ] + ####################################################################### # Automated Entries After This Point - Do Not Manually Add Below Here # #######################################################################
diff --git a/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt index 96da894..4a37573 100644 --- a/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt
@@ -592,6 +592,7 @@ crbug.com/1372155 [ android android-sm-a135m no-passthrough ] conformance/rendering/blending.html [ Failure ] crbug.com/1372155 [ android android-sm-a135m ] conformance/uniforms/uniform-samplers-test.html [ Failure ] crbug.com/1372149 [ android android-sm-a235m no-passthrough ] conformance/rendering/blending.html [ Failure ] +crbug.com/1445548 [ android android-sm-a235m no-passthrough ] conformance/extensions/oes-vertex-array-object-bufferData.html [ Failure ] ############
diff --git a/extensions/shell/browser/shell_extensions_browser_client.cc b/extensions/shell/browser/shell_extensions_browser_client.cc index 7fcd119..5583a00 100644 --- a/extensions/shell/browser/shell_extensions_browser_client.cc +++ b/extensions/shell/browser/shell_extensions_browser_client.cc
@@ -321,7 +321,7 @@ std::string ShellExtensionsBrowserClient::GetUserAgent() const { return content::BuildUserAgentFromProduct( - version_info::GetProductNameAndVersionForUserAgent()); + std::string(version_info::GetProductNameAndVersionForUserAgent())); } void ShellExtensionsBrowserClient::InitWithBrowserContext(
diff --git a/fuchsia_web/common/init_logging.cc b/fuchsia_web/common/init_logging.cc index b7d74ef..13f5d35 100644 --- a/fuchsia_web/common/init_logging.cc +++ b/fuchsia_web/common/init_logging.cc
@@ -48,7 +48,7 @@ void LogComponentStartWithVersion(base::StringPiece component_name) { std::string version_string = base::StringPrintf( "Starting %.*s %s", base::saturated_cast<int>(component_name.length()), - component_name.data(), version_info::GetVersionNumber().c_str()); + component_name.data(), version_info::GetVersionNumber().data()); #if !defined(OFFICIAL_BUILD) version_string += base::StrCat({" (built at ", version_info::GetLastChange(), ")"});
diff --git a/fuchsia_web/webengine/browser/web_engine_content_browser_client.cc b/fuchsia_web/webengine/browser/web_engine_content_browser_client.cc index ce153632..9400a507 100644 --- a/fuchsia_web/webengine/browser/web_engine_content_browser_client.cc +++ b/fuchsia_web/webengine/browser/web_engine_content_browser_client.cc
@@ -169,7 +169,7 @@ } std::string WebEngineContentBrowserClient::GetProduct() { - return version_info::GetProductNameAndVersionForUserAgent(); + return std::string(version_info::GetProductNameAndVersionForUserAgent()); } std::string WebEngineContentBrowserClient::GetUserAgent() {
diff --git "a/infra/config/generated/builders/reclient/Linux Builder reclient test \050unified uploads\051 untrusted/properties.json" "b/infra/config/generated/builders/reclient/Linux Builder reclient test \050unified uploads\051 untrusted/properties.json" index 92671a3a..46e9210 100644 --- "a/infra/config/generated/builders/reclient/Linux Builder reclient test \050unified uploads\051 untrusted/properties.json" +++ "b/infra/config/generated/builders/reclient/Linux Builder reclient test \050unified uploads\051 untrusted/properties.json"
@@ -44,7 +44,8 @@ "$build/reclient": { "bootstrap_env": { "GLOG_use_unified_uploads": "true", - "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true" + "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true", + "RBE_fast_log_collection": "true" }, "instance": "rbe-chromium-untrusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git "a/infra/config/generated/builders/reclient/Linux Builder reclient test \050unified uploads\051/properties.json" "b/infra/config/generated/builders/reclient/Linux Builder reclient test \050unified uploads\051/properties.json" index e83db50..1296f43 100644 --- "a/infra/config/generated/builders/reclient/Linux Builder reclient test \050unified uploads\051/properties.json" +++ "b/infra/config/generated/builders/reclient/Linux Builder reclient test \050unified uploads\051/properties.json"
@@ -44,7 +44,8 @@ "$build/reclient": { "bootstrap_env": { "GLOG_use_unified_uploads": "true", - "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true" + "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true", + "RBE_fast_log_collection": "true" }, "instance": "rbe-chromium-trusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/builders/reclient/Linux Builder reclient test untrusted/properties.json b/infra/config/generated/builders/reclient/Linux Builder reclient test untrusted/properties.json index c960f9c..0f86422 100644 --- a/infra/config/generated/builders/reclient/Linux Builder reclient test untrusted/properties.json +++ b/infra/config/generated/builders/reclient/Linux Builder reclient test untrusted/properties.json
@@ -43,7 +43,8 @@ }, "$build/reclient": { "bootstrap_env": { - "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true" + "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true", + "RBE_fast_log_collection": "true" }, "instance": "rbe-chromium-untrusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/builders/reclient/Linux Builder reclient test/properties.json b/infra/config/generated/builders/reclient/Linux Builder reclient test/properties.json index f3960f3..3dc32155 100644 --- a/infra/config/generated/builders/reclient/Linux Builder reclient test/properties.json +++ b/infra/config/generated/builders/reclient/Linux Builder reclient test/properties.json
@@ -43,7 +43,8 @@ }, "$build/reclient": { "bootstrap_env": { - "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true" + "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true", + "RBE_fast_log_collection": "true" }, "instance": "rbe-chromium-trusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/builders/reclient/Mac Builder reclient test untrusted/properties.json b/infra/config/generated/builders/reclient/Mac Builder reclient test untrusted/properties.json index fc660b6e..37de23c 100644 --- a/infra/config/generated/builders/reclient/Mac Builder reclient test untrusted/properties.json +++ b/infra/config/generated/builders/reclient/Mac Builder reclient test untrusted/properties.json
@@ -45,7 +45,8 @@ "$build/reclient": { "bootstrap_env": { "GLOG_vmodule": "bridge*=2", - "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true" + "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true", + "RBE_fast_log_collection": "true" }, "instance": "rbe-chromium-untrusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/builders/reclient/Mac Builder reclient test/properties.json b/infra/config/generated/builders/reclient/Mac Builder reclient test/properties.json index 3cb305c6..82db03ac 100644 --- a/infra/config/generated/builders/reclient/Mac Builder reclient test/properties.json +++ b/infra/config/generated/builders/reclient/Mac Builder reclient test/properties.json
@@ -45,7 +45,8 @@ "$build/reclient": { "bootstrap_env": { "GLOG_vmodule": "bridge*=2", - "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true" + "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true", + "RBE_fast_log_collection": "true" }, "instance": "rbe-chromium-trusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test untrusted/properties.json b/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test untrusted/properties.json index c7d5297..a11c559 100644 --- a/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test untrusted/properties.json +++ b/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test untrusted/properties.json
@@ -51,7 +51,8 @@ }, "$build/reclient": { "bootstrap_env": { - "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true" + "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true", + "RBE_fast_log_collection": "true" }, "instance": "rbe-chromium-untrusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test/properties.json b/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test/properties.json index e5d3bb7..26a422e 100644 --- a/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test/properties.json +++ b/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test/properties.json
@@ -51,7 +51,8 @@ }, "$build/reclient": { "bootstrap_env": { - "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true" + "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true", + "RBE_fast_log_collection": "true" }, "instance": "rbe-chromium-trusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/builders/reclient/Win x64 Builder reclient test untrusted/properties.json b/infra/config/generated/builders/reclient/Win x64 Builder reclient test untrusted/properties.json index 52126c31..f6bf26b 100644 --- a/infra/config/generated/builders/reclient/Win x64 Builder reclient test untrusted/properties.json +++ b/infra/config/generated/builders/reclient/Win x64 Builder reclient test untrusted/properties.json
@@ -44,7 +44,8 @@ }, "$build/reclient": { "bootstrap_env": { - "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true" + "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true", + "RBE_fast_log_collection": "true" }, "instance": "rbe-chromium-untrusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/builders/reclient/Win x64 Builder reclient test/properties.json b/infra/config/generated/builders/reclient/Win x64 Builder reclient test/properties.json index aa0e50b8..69716be 100644 --- a/infra/config/generated/builders/reclient/Win x64 Builder reclient test/properties.json +++ b/infra/config/generated/builders/reclient/Win x64 Builder reclient test/properties.json
@@ -44,7 +44,8 @@ }, "$build/reclient": { "bootstrap_env": { - "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true" + "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true", + "RBE_fast_log_collection": "true" }, "instance": "rbe-chromium-trusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/builders/reclient/ios-simulator reclient test untrusted/properties.json b/infra/config/generated/builders/reclient/ios-simulator reclient test untrusted/properties.json index b271c05..84e989c2 100644 --- a/infra/config/generated/builders/reclient/ios-simulator reclient test untrusted/properties.json +++ b/infra/config/generated/builders/reclient/ios-simulator reclient test untrusted/properties.json
@@ -46,7 +46,8 @@ "$build/reclient": { "bootstrap_env": { "GLOG_vmodule": "bridge*=2", - "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true" + "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true", + "RBE_fast_log_collection": "true" }, "instance": "rbe-chromium-untrusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/builders/reclient/ios-simulator reclient test/properties.json b/infra/config/generated/builders/reclient/ios-simulator reclient test/properties.json index 2f79e59e..19575d1 100644 --- a/infra/config/generated/builders/reclient/ios-simulator reclient test/properties.json +++ b/infra/config/generated/builders/reclient/ios-simulator reclient test/properties.json
@@ -46,7 +46,8 @@ "$build/reclient": { "bootstrap_env": { "GLOG_vmodule": "bridge*=2", - "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true" + "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true", + "RBE_fast_log_collection": "true" }, "instance": "rbe-chromium-trusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/builders/reclient/mac-arm64-rel reclient test untrusted/properties.json b/infra/config/generated/builders/reclient/mac-arm64-rel reclient test untrusted/properties.json index 85988bb6..bec1716 100644 --- a/infra/config/generated/builders/reclient/mac-arm64-rel reclient test untrusted/properties.json +++ b/infra/config/generated/builders/reclient/mac-arm64-rel reclient test untrusted/properties.json
@@ -45,7 +45,8 @@ "$build/reclient": { "bootstrap_env": { "GLOG_vmodule": "bridge*=2", - "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true" + "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true", + "RBE_fast_log_collection": "true" }, "instance": "rbe-chromium-untrusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/builders/reclient/mac-arm64-rel reclient test/properties.json b/infra/config/generated/builders/reclient/mac-arm64-rel reclient test/properties.json index 664f6ed7..28bbbcf 100644 --- a/infra/config/generated/builders/reclient/mac-arm64-rel reclient test/properties.json +++ b/infra/config/generated/builders/reclient/mac-arm64-rel reclient test/properties.json
@@ -45,7 +45,8 @@ "$build/reclient": { "bootstrap_env": { "GLOG_vmodule": "bridge*=2", - "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true" + "GOMA_COMPILER_PROXY_ENABLE_CRASH_DUMP": "true", + "RBE_fast_log_collection": "true" }, "instance": "rbe-chromium-trusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/cq-builders.md b/infra/config/generated/cq-builders.md index b1fe926b..26554e8 100644 --- a/infra/config/generated/cq-builders.md +++ b/infra/config/generated/cq-builders.md
@@ -506,7 +506,9 @@ * [win_optional_gpu_tests_rel](https://ci.chromium.org/p/chromium/builders/try/win_optional_gpu_tests_rel) ([definition](https://cs.chromium.org/search?q=+file:/try/.*\.star$+""win_optional_gpu_tests_rel"")) Location filters: + * [`//chrome/browser/media/.+`](https://cs.chromium.org/chromium/src/chrome/browser/media/) * [`//chrome/browser/vr/.+`](https://cs.chromium.org/chromium/src/chrome/browser/vr/) + * [`//components/cdm/renderer/.+`](https://cs.chromium.org/chromium/src/components/cdm/renderer/) * [`//content/browser/xr/.+`](https://cs.chromium.org/chromium/src/content/browser/xr/) * [`//content/test/gpu/.+`](https://cs.chromium.org/chromium/src/content/test/gpu/) * [`//device/vr/.+`](https://cs.chromium.org/chromium/src/device/vr/) @@ -514,6 +516,7 @@ * [`//media/audio/.+`](https://cs.chromium.org/chromium/src/media/audio/) * [`//media/base/.+`](https://cs.chromium.org/chromium/src/media/base/) * [`//media/capture/.+`](https://cs.chromium.org/chromium/src/media/capture/) + * [`//media/cdm/.+`](https://cs.chromium.org/chromium/src/media/cdm/) * [`//media/filters/.+`](https://cs.chromium.org/chromium/src/media/filters/) * [`//media/gpu/.+`](https://cs.chromium.org/chromium/src/media/gpu/) * [`//media/mojo/.+`](https://cs.chromium.org/chromium/src/media/mojo/)
diff --git a/infra/config/generated/cq-usage/full.cfg b/infra/config/generated/cq-usage/full.cfg index 1355fea..21ee5dc 100644 --- a/infra/config/generated/cq-usage/full.cfg +++ b/infra/config/generated/cq-usage/full.cfg
@@ -2611,11 +2611,21 @@ location_filters { gerrit_host_regexp: ".*" gerrit_project_regexp: ".*" + path_regexp: "chrome/browser/media/.+" + } + location_filters { + gerrit_host_regexp: ".*" + gerrit_project_regexp: ".*" path_regexp: "chrome/browser/vr/.+" } location_filters { gerrit_host_regexp: ".*" gerrit_project_regexp: ".*" + path_regexp: "components/cdm/renderer/.+" + } + location_filters { + gerrit_host_regexp: ".*" + gerrit_project_regexp: ".*" path_regexp: "content/browser/xr/.+" } location_filters { @@ -2651,6 +2661,11 @@ location_filters { gerrit_host_regexp: ".*" gerrit_project_regexp: ".*" + path_regexp: "media/cdm/.+" + } + location_filters { + gerrit_host_regexp: ".*" + gerrit_project_regexp: ".*" path_regexp: "media/filters/.+" } location_filters {
diff --git a/infra/config/generated/luci/commit-queue.cfg b/infra/config/generated/luci/commit-queue.cfg index c498644..cf9e8f7 100644 --- a/infra/config/generated/luci/commit-queue.cfg +++ b/infra/config/generated/luci/commit-queue.cfg
@@ -4187,11 +4187,21 @@ location_filters { gerrit_host_regexp: ".*" gerrit_project_regexp: ".*" + path_regexp: "chrome/browser/media/.+" + } + location_filters { + gerrit_host_regexp: ".*" + gerrit_project_regexp: ".*" path_regexp: "chrome/browser/vr/.+" } location_filters { gerrit_host_regexp: ".*" gerrit_project_regexp: ".*" + path_regexp: "components/cdm/renderer/.+" + } + location_filters { + gerrit_host_regexp: ".*" + gerrit_project_regexp: ".*" path_regexp: "content/browser/xr/.+" } location_filters { @@ -4227,6 +4237,11 @@ location_filters { gerrit_host_regexp: ".*" gerrit_project_regexp: ".*" + path_regexp: "media/cdm/.+" + } + location_filters { + gerrit_host_regexp: ".*" + gerrit_project_regexp: ".*" path_regexp: "media/filters/.+" } location_filters {
diff --git a/infra/config/generated/luci/luci-notify.cfg b/infra/config/generated/luci/luci-notify.cfg index 4913ee7..0334623 100644 --- a/infra/config/generated/luci/luci-notify.cfg +++ b/infra/config/generated/luci/luci-notify.cfg
@@ -3830,6 +3830,19 @@ } notifiers { notifications { + on_occurrence: FAILURE + on_occurrence: INFRA_FAILURE + email { + recipients: "chrome-browser-infra-team@google.com" + } + } + builders { + bucket: "infra" + name: "autosharder" + } +} +notifiers { + notifications { on_occurrence: SUCCESS on_occurrence: FAILURE on_occurrence: INFRA_FAILURE
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.win.star b/infra/config/subprojects/chromium/try/tryserver.chromium.win.star index 2131739..2d4d863 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.win.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.win.star
@@ -283,7 +283,9 @@ main_list_view = "try", tryjob = try_.job( location_filters = [ + cq.location_filter(path_regexp = "chrome/browser/media/.+"), cq.location_filter(path_regexp = "chrome/browser/vr/.+"), + cq.location_filter(path_regexp = "components/cdm/renderer/.+"), cq.location_filter(path_regexp = "content/browser/xr/.+"), cq.location_filter(path_regexp = "content/test/gpu/.+"), cq.location_filter(path_regexp = "device/vr/.+"), @@ -291,6 +293,7 @@ cq.location_filter(path_regexp = "media/audio/.+"), cq.location_filter(path_regexp = "media/base/.+"), cq.location_filter(path_regexp = "media/capture/.+"), + cq.location_filter(path_regexp = "media/cdm/.+"), cq.location_filter(path_regexp = "media/filters/.+"), cq.location_filter(path_regexp = "media/gpu/.+"), cq.location_filter(path_regexp = "media/mojo/.+"),
diff --git a/infra/config/subprojects/infra.star b/infra/config/subprojects/infra.star index 365c944..8d114d8 100644 --- a/infra/config/subprojects/infra.star +++ b/infra/config/subprojects/infra.star
@@ -63,5 +63,12 @@ category = "autosharder", short_name = "auto", ), + notifies = [ + luci.notifier( + name = "chromium-autosharder-notifier", + notify_emails = ["chrome-browser-infra-team@google.com"], + on_occurrence = ["FAILURE", "INFRA_FAILURE"], + ), + ], service_account = "chromium-autosharder@chops-service-accounts.iam.gserviceaccount.com", )
diff --git a/infra/config/subprojects/reclient/reclient.star b/infra/config/subprojects/reclient/reclient.star index d0b5e26..7e38c07f 100644 --- a/infra/config/subprojects/reclient/reclient.star +++ b/infra/config/subprojects/reclient/reclient.star
@@ -104,6 +104,9 @@ console_view_category, **kwargs): reclient_bootstrap_env = kwargs.pop("reclient_bootstrap_env", {}) + reclient_bootstrap_env.update({ + "RBE_fast_log_collection": "true", + }) return fyi_reclient_staging_builder( name = name, console_view_category = console_view_category,
diff --git a/ios/chrome/browser/flags/about_flags.mm b/ios/chrome/browser/flags/about_flags.mm index db2d594..5c483b9 100644 --- a/ios/chrome/browser/flags/about_flags.mm +++ b/ios/chrome/browser/flags/about_flags.mm
@@ -519,6 +519,8 @@ {"phonenumber", "true"}}; const FeatureEntry::FeatureParam kEnableExpKitTextClassifierEmail[] = { {"email", "true"}}; +const FeatureEntry::FeatureParam kEnableExpKitTextClassifierOneTap[] = { + {"onetap", "true"}}; const FeatureEntry::FeatureParam kEnableExpKitTextClassifierAll[] = { {"date", "true"}, {"address", "true"}, @@ -534,7 +536,9 @@ {"Enabled for phonenumber", kEnableExpKitTextClassifierPhoneNumber, std::size(kEnableExpKitTextClassifierPhoneNumber), nullptr}, {"Enabled for email", kEnableExpKitTextClassifierEmail, - std::size(kEnableExpKitTextClassifierEmail), nullptr}}; + std::size(kEnableExpKitTextClassifierEmail), nullptr}, + {"Enabled for One Tap mode", kEnableExpKitTextClassifierOneTap, + std::size(kEnableExpKitTextClassifierOneTap), nullptr}}; const FeatureEntry::FeatureParam kFollowingFeedSortTypeGroupedByPublisher[] = { {kFollowingFeedDefaultSortTypeGroupedByPublisher, "true"},
diff --git a/ios/chrome/browser/omaha/omaha_service.mm b/ios/chrome/browser/omaha/omaha_service.mm index 6a1cead..55b5613 100644 --- a/ios/chrome/browser/omaha/omaha_service.mm +++ b/ios/chrome/browser/omaha/omaha_service.mm
@@ -624,10 +624,10 @@ // An install retry ping only makes sense if an install event must be send. DCHECK(sending_install_event_ || !IsNextPingInstallRetry()); std::string request_id = GetNextPingRequestId(ping_content); - return GetPingContent(request_id, ios::device_util::GetRandomId(), - version_info::GetVersionNumber(), GetChannelString(), - base::Time::FromTimeT(application_install_date_), - ping_content); + return GetPingContent( + request_id, ios::device_util::GetRandomId(), + std::string(version_info::GetVersionNumber()), GetChannelString(), + base::Time::FromTimeT(application_install_date_), ping_content); } void OmahaService::SendPing() {
diff --git a/ios/chrome/browser/omaha/omaha_service_unittest.mm b/ios/chrome/browser/omaha/omaha_service_unittest.mm index f734a14..14fe3af 100644 --- a/ios/chrome/browser/omaha/omaha_service_unittest.mm +++ b/ios/chrome/browser/omaha/omaha_service_unittest.mm
@@ -149,7 +149,7 @@ service.set_upgrade_recommended_callback(base::BindRepeating( &OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); std::string content = service.GetPingContent( - "requestId", "sessionId", version_info::GetVersionNumber(), + "requestId", "sessionId", std::string(version_info::GetVersionNumber()), GetChannelString(), base::Time::Now(), OmahaService::USAGE_PING); regex_t regex; regcomp(®ex, expectedResult, REG_NOSUB); @@ -177,7 +177,7 @@ service.set_upgrade_recommended_callback(base::BindRepeating( &OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); std::string content = service.GetPingContent( - "requestId", "sessionId", version_info::GetVersionNumber(), + "requestId", "sessionId", std::string(version_info::GetVersionNumber()), GetChannelString(), base::Time::FromTimeT(kUnknownInstallDate), OmahaService::USAGE_PING); regex_t regex; @@ -210,7 +210,7 @@ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); CleanService(&service, ""); std::string content = service.GetPingContent( - "requestId", "sessionId", version_info::GetVersionNumber(), + "requestId", "sessionId", std::string(version_info::GetVersionNumber()), GetChannelString(), base::Time::Now(), OmahaService::INSTALL_EVENT); regmatch_t matches[2]; regex_t regex; @@ -227,7 +227,7 @@ const char* kPreviousVersion = "0.5"; CleanService(&service, kPreviousVersion); content = service.GetPingContent( - "requestId", "sessionId", version_info::GetVersionNumber(), + "requestId", "sessionId", std::string(version_info::GetVersionNumber()), GetChannelString(), base::Time::Now(), OmahaService::INSTALL_EVENT); expected_result = base::StringPrintf(kExpectedResultFormat, kPreviousVersion, 0 /* install age */, 3 /* event type */); @@ -246,7 +246,7 @@ service.set_upgrade_recommended_callback(base::BindRepeating( &OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); - CleanService(&service, version_info::GetVersionNumber()); + CleanService(&service, std::string(version_info::GetVersionNumber())); service.SendPing(); @@ -275,7 +275,7 @@ service.set_upgrade_recommended_callback(base::BindRepeating( &OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); - CleanService(&service, version_info::GetVersionNumber()); + CleanService(&service, std::string(version_info::GetVersionNumber())); service.SendPing(); @@ -296,7 +296,7 @@ service.set_upgrade_recommended_callback(base::BindRepeating( &OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); - CleanService(&service, version_info::GetVersionNumber()); + CleanService(&service, std::string(version_info::GetVersionNumber())); service.SendPing(); @@ -337,7 +337,7 @@ service.set_upgrade_recommended_callback(base::BindRepeating( &OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); - CleanService(&service, version_info::GetVersionNumber()); + CleanService(&service, std::string(version_info::GetVersionNumber())); service.SendPing(); @@ -375,7 +375,7 @@ base::BindOnce(^(UpgradeRecommendedDetails details) { OmahaServiceTest::OneOffCheck(details); }); - CleanService(&service, version_info::GetVersionNumber()); + CleanService(&service, std::string(version_info::GetVersionNumber())); service.SendPing(); @@ -405,7 +405,7 @@ service.set_upgrade_recommended_callback(base::BindRepeating( &OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); - CleanService(&service, version_info::GetVersionNumber()); + CleanService(&service, std::string(version_info::GetVersionNumber())); service.SendPing(); @@ -447,7 +447,7 @@ base::BindOnce(^(UpgradeRecommendedDetails details) { OmahaServiceTest::OneOffCheck(details); }); - CleanService(&service, version_info::GetVersionNumber()); + CleanService(&service, std::string(version_info::GetVersionNumber())); service.SendPing(); @@ -491,7 +491,7 @@ base::BindOnce(^(UpgradeRecommendedDetails details) { OmahaServiceTest::OneOffCheck(details); }); - CleanService(&service, version_info::GetVersionNumber()); + CleanService(&service, std::string(version_info::GetVersionNumber())); service.SendPing(); @@ -528,7 +528,7 @@ service.set_upgrade_recommended_callback(base::BindRepeating( &OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); - CleanService(&service, version_info::GetVersionNumber()); + CleanService(&service, std::string(version_info::GetVersionNumber())); service.SendPing(); @@ -550,7 +550,7 @@ "<ping active=\"1\" ad=\"4088\" rd=\"4088\"/></app></request>"; std::string content = service.GetPingContent( - "requestId", "sessionId", version_info::GetVersionNumber(), + "requestId", "sessionId", std::string(version_info::GetVersionNumber()), GetChannelString(), base::Time::FromTimeT(kUnknownInstallDate), OmahaService::USAGE_PING); regex_t regex; @@ -603,7 +603,7 @@ service.set_upgrade_recommended_callback(base::BindRepeating( &OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); - CleanService(&service, version_info::GetVersionNumber()); + CleanService(&service, std::string(version_info::GetVersionNumber())); service.SendPing(); @@ -650,7 +650,7 @@ service.set_upgrade_recommended_callback(base::BindRepeating( &OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); - CleanService(&service, version_info::GetVersionNumber()); + CleanService(&service, std::string(version_info::GetVersionNumber())); service.SendPing(); @@ -695,7 +695,7 @@ } TEST_F(OmahaServiceTest, PersistStatesTest) { - std::string version_string = version_info::GetVersionNumber(); + std::string version_string(version_info::GetVersionNumber()); base::Time now = base::Time::Now(); OmahaService service(false); service.StartInternal(); @@ -780,7 +780,7 @@ service.set_upgrade_recommended_callback(base::BindRepeating( &OmahaServiceTest::OnNeedUpdate, base::Unretained(this))); service.InitializeURLLoaderFactory(test_shared_url_loader_factory_); - CleanService(&service, version_info::GetVersionNumber()); + CleanService(&service, std::string(version_info::GetVersionNumber())); service.SendPing();
diff --git a/ios/chrome/browser/text_selection/text_classifier_model_service_factory.h b/ios/chrome/browser/text_selection/text_classifier_model_service_factory.h index 388eea1..caa2e9ec 100644 --- a/ios/chrome/browser/text_selection/text_classifier_model_service_factory.h +++ b/ios/chrome/browser/text_selection/text_classifier_model_service_factory.h
@@ -39,6 +39,7 @@ web::BrowserState* GetBrowserStateToUse( web::BrowserState* context) const override; bool ServiceIsCreatedWithBrowserState() const override; + bool ServiceIsNULLWhileTesting() const override; }; #endif // IOS_CHROME_BROWSER_TEXT_SELECTION_TEXT_CLASSIFIER_MODEL_SERVICE_FACTORY_H_
diff --git a/ios/chrome/browser/text_selection/text_classifier_model_service_factory.mm b/ios/chrome/browser/text_selection/text_classifier_model_service_factory.mm index 10c094d3..b6528a02 100644 --- a/ios/chrome/browser/text_selection/text_classifier_model_service_factory.mm +++ b/ios/chrome/browser/text_selection/text_classifier_model_service_factory.mm
@@ -45,8 +45,7 @@ std::unique_ptr<KeyedService> TextClassifierModelServiceFactory::BuildServiceInstanceFor( web::BrowserState* context) const { - if ((!base::FeatureList::IsEnabled(kEnableExpKitCalendarTextClassifier) && - !base::FeatureList::IsEnabled(kEnableExpKitTextClassifier)) || + if (!base::FeatureList::IsEnabled(kEnableExpKitTextClassifier) || !optimization_guide::features::IsOptimizationTargetPredictionEnabled()) { return nullptr; } @@ -71,3 +70,7 @@ const { return true; } + +bool TextClassifierModelServiceFactory::ServiceIsNULLWhileTesting() const { + return true; +}
diff --git a/ios/chrome/browser/text_selection/text_selection_util.h b/ios/chrome/browser/text_selection/text_selection_util.h index 1a6cbe5..e3089e4 100644 --- a/ios/chrome/browser/text_selection/text_selection_util.h +++ b/ios/chrome/browser/text_selection/text_selection_util.h
@@ -8,12 +8,8 @@ #include "base/feature_list.h" // Feature flag to enable Text Classifier entity detection in experience kit -// calendar. -BASE_DECLARE_FEATURE(kEnableExpKitCalendarTextClassifier); - -// Feature flag to enable Text Classifier entity detection in experience kit -// The feature params will control which entity types are enabled for -// detection. +// The addresses entity type is enabled by default. Feature params will control +// enabling the other entity types, and enabling for the one tap mode. BASE_DECLARE_FEATURE(kEnableExpKitTextClassifier); #endif // IOS_CHROME_BROWSER_TEXT_SELECTION_TEXT_SELECTION_UTIL_H_
diff --git a/ios/chrome/browser/text_selection/text_selection_util.mm b/ios/chrome/browser/text_selection/text_selection_util.mm index b390aa2e..e9700a3 100644 --- a/ios/chrome/browser/text_selection/text_selection_util.mm +++ b/ios/chrome/browser/text_selection/text_selection_util.mm
@@ -8,10 +8,6 @@ #error "This file requires ARC support." #endif -BASE_FEATURE(kEnableExpKitCalendarTextClassifier, - "EnableExpKitCalendarTextClassifier", - base::FEATURE_DISABLED_BY_DEFAULT); - BASE_FEATURE(kEnableExpKitTextClassifier, "EnableExpKitTextClassifier", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT);
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm index fac0eb09..a257a1f 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
@@ -517,8 +517,15 @@ initWithContentView:self.mostVisitedStackView type:ContentSuggestionsModuleType::kMostVisited]; if (ShouldPutMostVisitedSitesInMagicStack()) { - [_magicStack insertArrangedSubview:self.mostVisitedModuleContainer - atIndex:0]; + // Only add it to the Magic Stack here if it is after the inital + // construction of the Magic Stack. + if (_magicStack) { + [_magicStack + insertArrangedSubview:self.mostVisitedModuleContainer + atIndex:[self indexForMagicStackModule: + ContentSuggestionsModuleType:: + kMostVisited]]; + } } else { [self.verticalStackView insertArrangedSubview:self.mostVisitedModuleContainer @@ -633,6 +640,23 @@ ]]; } +// Returns the index position `moduleType` should be placed in the Magic Stack. +// This should only be used when looking to add a module after the inital Magic +// Stack construction. +- (NSUInteger)indexForMagicStackModule: + (ContentSuggestionsModuleType)moduleType { + NSUInteger index = 0; + for (NSNumber* moduleTypeNum in _magicStackModuleOrder) { + ContentSuggestionsModuleType type = + (ContentSuggestionsModuleType)[moduleTypeNum intValue]; + if (type == moduleType) { + return index; + } + index++; + } + NOTREACHED_NORETURN(); +} + // Determines the final page offset given the scroll `offset` and the `velocity` // scroll. If the drag is slow enough, then the closest page is the final state. // If the drag is in the negative direction, then go to the page previous to the
diff --git a/ios/chrome/browser/ui/settings/about_chrome_table_view_controller.mm b/ios/chrome/browser/ui/settings/about_chrome_table_view_controller.mm index 35fcbca..37ab810 100644 --- a/ios/chrome/browser/ui/settings/about_chrome_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/about_chrome_table_view_controller.mm
@@ -182,7 +182,7 @@ } - (std::string)versionString { - std::string versionString = version_info::GetVersionNumber(); + std::string versionString(version_info::GetVersionNumber()); std::string versionStringModifier = GetChannelString(); if (!versionStringModifier.empty()) { versionString = versionString + " " + versionStringModifier;
diff --git a/ios/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.mm b/ios/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.mm index f071ea1..d8bd3cb0 100644 --- a/ios/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.mm +++ b/ios/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.mm
@@ -34,13 +34,15 @@ IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_JS); source->SetDefaultResource(IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_HTML); // Data strings: - source->AddString(version_ui::kVersion, version_info::GetVersionNumber()); + source->AddString(version_ui::kVersion, + std::string(version_info::GetVersionNumber())); source->AddString(version_ui::kOfficial, version_info::IsOfficialBuild() ? "official" : "Developer build"); source->AddString(version_ui::kVersionModifier, - GetChannelString(GetChannel())); - source->AddString(version_ui::kCL, version_info::GetLastChange()); + std::string(GetChannelString(GetChannel()))); + source->AddString(version_ui::kCL, + std::string(version_info::GetLastChange())); source->AddString(version_ui::kUserAgent, web::GetWebClient()->GetUserAgent( web::UserAgentType::MOBILE)); source->AddString("app_locale",
diff --git a/ios/chrome/browser/ui/webui/flags_ui.mm b/ios/chrome/browser/ui/webui/flags_ui.mm index d85708b..5d53f868 100644 --- a/ios/chrome/browser/ui/webui/flags_ui.mm +++ b/ios/chrome/browser/ui/webui/flags_ui.mm
@@ -42,7 +42,8 @@ web::WebUIIOSDataSource* CreateFlagsUIHTMLSource() { web::WebUIIOSDataSource* source = web::WebUIIOSDataSource::Create(kChromeUIFlagsHost); - source->AddString(flags_ui::kVersion, version_info::GetVersionNumber()); + source->AddString(flags_ui::kVersion, + std::string(version_info::GetVersionNumber())); source->UseStringsJs(); FlagsUI::AddFlagsIOSStrings(source);
diff --git a/ios/chrome/browser/ui/webui/policy/policy_ui_handler.mm b/ios/chrome/browser/ui/webui/policy/policy_ui_handler.mm index cbd7a2a..d144f74 100644 --- a/ios/chrome/browser/ui/webui/policy/policy_ui_handler.mm +++ b/ios/chrome/browser/ui/webui/policy/policy_ui_handler.mm
@@ -188,10 +188,10 @@ GetStatusValue(), policy::JsonGenerationParams() .with_application_name(l10n_util::GetStringUTF8(IDS_IOS_PRODUCT_NAME)) - .with_channel_name(GetChannelString(GetChannel())) + .with_channel_name(std::string(GetChannelString(GetChannel()))) .with_processor_variation(l10n_util::GetStringUTF8( sizeof(void*) == 8 ? IDS_VERSION_UI_64BIT : IDS_VERSION_UI_32BIT)) - .with_os_name(version_info::GetOSType())); + .with_os_name(std::string(version_info::GetOSType()))); } void PolicyUIHandler::OnSchemaRegistryUpdated(bool has_new_schemas) {
diff --git a/ios/chrome/browser/ui/webui/version_ui.mm b/ios/chrome/browser/ui/webui/version_ui.mm index 36446b40..65ac7511 100644 --- a/ios/chrome/browser/ui/webui/version_ui.mm +++ b/ios/chrome/browser/ui/webui/version_ui.mm
@@ -49,11 +49,12 @@ html_source->AddLocalizedString(version_ui::kApplicationLabel, IDS_IOS_PRODUCT_NAME); html_source->AddString(version_ui::kVersion, - version_info::GetVersionNumber()); + std::string(version_info::GetVersionNumber())); html_source->AddString(version_ui::kVersionModifier, - GetChannelString(GetChannel())); + std::string(GetChannelString(GetChannel()))); html_source->AddLocalizedString(version_ui::kOSName, IDS_VERSION_UI_OS); - html_source->AddString(version_ui::kOSType, version_info::GetOSType()); + html_source->AddString(version_ui::kOSType, + std::string(version_info::GetOSType())); html_source->AddLocalizedString(version_ui::kCompany, IDS_IOS_ABOUT_VERSION_COMPANY_NAME); @@ -67,7 +68,7 @@ base::NumberToString16(exploded_time.year))); html_source->AddLocalizedString(version_ui::kRevision, IDS_VERSION_UI_REVISION); - std::string last_change = version_info::GetLastChange(); + std::string last_change(version_info::GetLastChange()); // Shorten the git hash to display it correctly on small devices. if ((ui::GetDeviceFormFactor() != ui::DEVICE_FORM_FACTOR_TABLET) && last_change.length() > 12) { @@ -110,7 +111,8 @@ version_ui::SeedTypeToUiString( GetApplicationContext()->GetVariationsService()->GetSeedType())); - html_source->AddString(version_ui::kSanitizer, version_info::GetSanitizerList()); + html_source->AddString(version_ui::kSanitizer, + std::string(version_info::GetSanitizerList())); html_source->UseStringsJs(); html_source->AddResourcePath(version_ui::kVersionJS, IDR_VERSION_UI_JS);
diff --git a/ios/chrome/browser/ui/webui/web_ui_egtest.mm b/ios/chrome/browser/ui/webui/web_ui_egtest.mm index 0a06e70..f594560 100644 --- a/ios/chrome/browser/ui/webui/web_ui_egtest.mm +++ b/ios/chrome/browser/ui/webui/web_ui_egtest.mm
@@ -56,7 +56,7 @@ [ChromeEarlGrey loadURL:WebUIPageUrlWithHost(kChromeUIVersionHost)]; // Verify that app version is present on the page. - const std::string version = version_info::GetVersionNumber(); + const std::string version(version_info::GetVersionNumber()); [ChromeEarlGrey waitForWebStateContainingText:version]; NSString* userAgent = [ChromeEarlGrey mobileUserAgentString];
diff --git a/ios/chrome/browser/web/chrome_web_client.mm b/ios/chrome/browser/web/chrome_web_client.mm index a79584e..910234f 100644 --- a/ios/chrome/browser/web/chrome_web_client.mm +++ b/ios/chrome/browser/web/chrome_web_client.mm
@@ -177,7 +177,7 @@ // form "productname/version". Used as part of the user agent string. std::string GetMobileProduct() { return base::StringPrintf(kProductTagWithPlaceholder, - version_info::GetVersionNumber().c_str()); + version_info::GetVersionNumber().data()); } // Returns a string describing the product name and version, of the
diff --git a/ios/chrome/browser/web/image_fetch/image_fetch_java_script_feature_fuzzer.mm b/ios/chrome/browser/web/image_fetch/image_fetch_java_script_feature_fuzzer.mm index d5aee304..1e5dad1 100644 --- a/ios/chrome/browser/web/image_fetch/image_fetch_java_script_feature_fuzzer.mm +++ b/ios/chrome/browser/web/image_fetch/image_fetch_java_script_feature_fuzzer.mm
@@ -31,8 +31,8 @@ if (base::RandDouble() < 0.2) { std::string encoded; base::Base64Encode("some raw data", &encoded); - script_message->body()->SetStringKey("data", encoded); + script_message->body()->GetDict().Set("data", encoded); } } env.InvokeScriptMessageReceived(*script_message); -} \ No newline at end of file +}
diff --git a/ios/chrome/browser/web/visible_url_egtest.mm b/ios/chrome/browser/web/visible_url_egtest.mm index f2db49f..a9040f5a 100644 --- a/ios/chrome/browser/web/visible_url_egtest.mm +++ b/ios/chrome/browser/web/visible_url_egtest.mm
@@ -416,7 +416,7 @@ [ChromeEarlGrey goForward]; [ChromeEarlGrey goForward]; - const std::string version = version_info::GetVersionNumber(); + const std::string version(version_info::GetVersionNumber()); [ChromeEarlGrey waitForWebStateContainingText:version]; // Make sure that kChromeUIVersionURL URL is displayed in the omnibox.
diff --git a/ios/chrome/test/wpt/cwt_request_handler.mm b/ios/chrome/test/wpt/cwt_request_handler.mm index 94622c5..f23e590 100644 --- a/ios/chrome/test/wpt/cwt_request_handler.mm +++ b/ios/chrome/test/wpt/cwt_request_handler.mm
@@ -149,12 +149,11 @@ base::Value CreateErrorValue(const std::string& error, const std::string& message) { - base::Value error_value(base::Value::Type::DICT); - error_value.SetStringKey(kWebDriverErrorCodeValueField, error); - error_value.SetStringKey(kWebDriverErrorMessageValueField, message); - error_value.SetStringKey(kWebDriverStackTraceValueField, - base::debug::StackTrace().ToString()); - return error_value; + return base::Value(base::Value::Dict() + .Set(kWebDriverErrorCodeValueField, error) + .Set(kWebDriverErrorMessageValueField, message) + .Set(kWebDriverStackTraceValueField, + base::debug::StackTrace().ToString())); } bool IsErrorValue(const base::Value& value) { @@ -439,9 +438,8 @@ std::string stderr_contents; base::ReadFileToString(log_file, &stderr_contents); - base::Value result(base::Value::Type::DICT); - result.SetStringKey(kChromeStderrValueField, stderr_contents); - return result; + return base::Value( + base::Value::Dict().Set(kChromeStderrValueField, stderr_contents)); } base::Value CWTRequestHandler::SetTimeouts(const base::Value& timeouts) { @@ -572,21 +570,20 @@ } base::Value CWTRequestHandler::GetVersionInfo() { - base::Value result(base::Value::Type::DICT); - result.SetStringKey(kCapabilitiesBrowserVersionField, - version_info::GetVersionNumber()); + auto result = base::Value::Dict().Set(kCapabilitiesBrowserVersionField, + version_info::GetVersionNumber()); // The full revision starts with a git hash and ends with the revision // number in the following format: @{#123456} - std::string full_revision = version_info::GetLastChange(); + std::string full_revision(version_info::GetLastChange()); size_t start_position = full_revision.rfind("#") + 1; if (start_position == std::string::npos) { - result.SetStringKey(kChromeRevisionNumberField, "0"); + result.Set(kChromeRevisionNumberField, "0"); } else { size_t length = full_revision.size() - start_position - 1; - result.SetStringKey(kChromeRevisionNumberField, - full_revision.substr(start_position, length)); + result.Set(kChromeRevisionNumberField, + full_revision.substr(start_position, length)); } - return result; + return base::Value(std::move(result)); }
diff --git a/ios/google_internal/frameworks/ChromeInternal.framework.dSYM.ios.zip.sha1 b/ios/google_internal/frameworks/ChromeInternal.framework.dSYM.ios.zip.sha1 index fda479ee..6f6d9a1 100644 --- a/ios/google_internal/frameworks/ChromeInternal.framework.dSYM.ios.zip.sha1 +++ b/ios/google_internal/frameworks/ChromeInternal.framework.dSYM.ios.zip.sha1
@@ -1 +1 @@ -fe76e8105cbd146304444cdfd9675f21d2cea68c \ No newline at end of file +9101131c0dbf88905e86e995e702df38a3413ed9 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/ChromeSSOInternal.framework.dSYM.ios.zip.sha1 b/ios/google_internal/frameworks/ChromeSSOInternal.framework.dSYM.ios.zip.sha1 index dfefa14..e284239 100644 --- a/ios/google_internal/frameworks/ChromeSSOInternal.framework.dSYM.ios.zip.sha1 +++ b/ios/google_internal/frameworks/ChromeSSOInternal.framework.dSYM.ios.zip.sha1
@@ -1 +1 @@ -bdc52de02739e0fd432549ef105f622770c745a7 \ No newline at end of file +01594fa1416cd846053439c1ce0ed30eef9b67e7 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 index 35dd43e..5555cef4 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -e223c5cb16f2fe199436fd9df7e7ded3ec4f6d51 \ No newline at end of file +d5e82889616e6ef5eb3b8fcfcfb4211fcbb5b6ac \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 index 1b0396a..c424bfe3 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -eb7022a2d3589c7d543540f8bf7819a1b13fad3d \ No newline at end of file +5f2550158c8283be5b7e408ccf173ff34c74d454 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 index 6827f52..a754c97 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -413d9c745aebf523c09bac0940dc719a2b1711db \ No newline at end of file +f2c98d74b7527c59a3795df00624bb4e1df926ca \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 index 19c2359..e94fe4b3 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -3c3e1bbb1e3f57a2af8021c19bc742ac985832d4 \ No newline at end of file +506bae995111f5dd1e6232a5ced042d31d3a509c \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.ios.zip.sha1 index b06402a..9ce78c5 100644 --- a/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -d3a83c900c0ce79337955494a533112a346986fa \ No newline at end of file +9915c32976a86cdcc4c40e42976821fd714b0ba3 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.iossimulator.zip.sha1 index 4238d5c..ac12bb3 100644 --- a/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -97b568f09129c795d88c02029fadce383229fb4f \ No newline at end of file +6b000433683f815a98e222160dfc4f76b7ee4934 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 index 29aed46..a79aff3 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -9c4617e8781182350377ab3bce40f15ab76650f6 \ No newline at end of file +0f16cbf43564b986e8e21583d7b44c0dfc754ed0 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 index d9a15690..435178c 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -9686decf1a238a1fe40426da478a9cfa5fcd7c0a \ No newline at end of file +b30746424da0e37d1a2d70a40b16b332a95d1e98 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 index 60b460c5..b7c301a 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -48610ea0edd4119ed0f96ca54b2331b3e5fc7675 \ No newline at end of file +3ff0ca8c2a336b52739c1189457494efab4d9766 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 index ca58b27..487f9c79 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -7f32bb5267bacc84ec940a75b3cf0409c6289f8d \ No newline at end of file +a17f2497f05627c8a0f5d474bf774e3608151026 \ No newline at end of file
diff --git a/ios/web/content/BUILD.gn b/ios/web/content/BUILD.gn index 2724bf1..b197f24 100644 --- a/ios/web/content/BUILD.gn +++ b/ios/web/content/BUILD.gn
@@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/config/features.gni") +import("//ios/web/public/js_messaging/optimize_ts.gni") assert(use_blink, "Content is only supported in Blink builds.") @@ -33,6 +34,7 @@ "web_state/crc_web_view_proxy_impl.mm", ] deps = [ + ":send_webkit_message_js", "//base", "//build:blink_buildflags", "//components/js_injection/browser", @@ -62,3 +64,9 @@ "//ios/web/public/thread", ] } + +optimize_ts("send_webkit_message_js") { + visibility = [ ":content" ] + + sources = [ "js_messaging/resources/send_webkit_message.ts" ] +}
diff --git a/ios/web/content/js_messaging/content_web_frames_manager.mm b/ios/web/content/js_messaging/content_web_frames_manager.mm index 8e7eb30..5431e9c 100644 --- a/ios/web/content/js_messaging/content_web_frames_manager.mm +++ b/ios/web/content/js_messaging/content_web_frames_manager.mm
@@ -6,6 +6,7 @@ #import <set> +#import "base/no_destructor.h" #import "base/strings/utf_string_conversions.h" #import "base/unguessable_token.h" #import "components/js_injection/browser/js_communication_host.h" @@ -32,6 +33,23 @@ const char kHandlerNamePropertyName[] = "handler_name"; const char kMessagePropertyName[] = "message"; +const char kSendWebKitMessageScriptName[] = "send_webkit_message"; + +// This feature intercepts calls to window.webkit.messageHandlers and reroutes +// them to window.webkitMessageHandler. +JavaScriptFeature* GetSendWebKitMessageJavaScriptFeature() { + // Static storage is ok for `send_webkit_message_feature` as it holds no + // state. + static base::NoDestructor<JavaScriptFeature> send_webkit_message_feature( + ContentWorld::kPageContentWorld, + std::vector<const JavaScriptFeature::FeatureScript>( + {JavaScriptFeature::FeatureScript::CreateWithFilename( + kSendWebKitMessageScriptName, + JavaScriptFeature::FeatureScript::InjectionTime::kDocumentStart, + JavaScriptFeature::FeatureScript::TargetFrames::kAllFrames)})); + return send_webkit_message_feature.get(); +} + } // namespace ContentWebFramesManager::ContentWebFramesManager( @@ -52,10 +70,7 @@ std::vector<JavaScriptFeature*> java_script_features; java_script_features.push_back( java_script_features::GetBaseJavaScriptFeature()); - - // TODO(crbug.com/1423527): Insert another feature that overrides the - // definition of sendWebKitMessage from common.js, to use - // webkitMessageHandler.postMessage. + java_script_features.push_back(GetSendWebKitMessageJavaScriptFeature()); java_script_features.push_back( java_script_features::GetCommonJavaScriptFeature()); java_script_features.push_back(
diff --git a/ios/web/content/js_messaging/resources/send_webkit_message.ts b/ios/web/content/js_messaging/resources/send_webkit_message.ts new file mode 100644 index 0000000..41ae74b --- /dev/null +++ b/ios/web/content/js_messaging/resources/send_webkit_message.ts
@@ -0,0 +1,25 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +interface Window { + __proto__: any; + webkitMessageHandler: any; +} + +/** + * Injects a proxy object that captures calls to window.webkit.messageHandlers + * and forwards them to window.webkitMessageHandler. + */ +window.__proto__.webkit = {}; +window.__proto__.webkit.messageHandlers = + new Proxy(window.webkitMessageHandler, { + get(target, property) { + return { + 'postMessage': function(message: object|string) { + var payload = {'handler_name': property, 'message': message}; + target.postMessage(JSON.stringify(payload)); + } + } + } + });
diff --git a/ios/web_view/internal/sync/web_view_device_info_sync_service_factory.mm b/ios/web_view/internal/sync/web_view_device_info_sync_service_factory.mm index ba236e3b..71d9752 100644 --- a/ios/web_view/internal/sync/web_view_device_info_sync_service_factory.mm +++ b/ios/web_view/internal/sync/web_view_device_info_sync_service_factory.mm
@@ -127,7 +127,8 @@ browser_state->GetPrefs(), sync_invalidations_service); auto local_device_info_provider = std::make_unique<syncer::LocalDeviceInfoProviderImpl>( - version_info::Channel::STABLE, version_info::GetVersionNumber(), + version_info::Channel::STABLE, + std::string(version_info::GetVersionNumber()), device_info_sync_client.get()); auto device_prefs = std::make_unique<syncer::DeviceInfoPrefs>( browser_state->GetPrefs(), base::DefaultClock::GetInstance());
diff --git a/media/audio/audio_device_description.cc b/media/audio/audio_device_description.cc index 059a4fec..07d5518 100644 --- a/media/audio/audio_device_description.cc +++ b/media/audio/audio_device_description.cc
@@ -91,8 +91,7 @@ // is deprecated. return ""; #else - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); #endif }
diff --git a/media/audio/audio_encoders_unittest.cc b/media/audio/audio_encoders_unittest.cc index 1f323bf..2aa5078 100644 --- a/media/audio/audio_encoders_unittest.cc +++ b/media/audio/audio_encoders_unittest.cc
@@ -119,8 +119,7 @@ case EncoderStatus::Codes::kEncoderMojoConnectionError: return "kEncoderMojoConnectionError"; default: - NOTREACHED(); - return "default"; + NOTREACHED_NORETURN(); } }
diff --git a/media/audio/audio_manager_base.cc b/media/audio/audio_manager_base.cc index 655bc60..d0d614d3 100644 --- a/media/audio/audio_manager_base.cc +++ b/media/audio/audio_manager_base.cc
@@ -512,8 +512,7 @@ AudioParameters AudioManagerBase::GetInputStreamParameters( const std::string& device_id) { - NOTREACHED(); - return AudioParameters(); + NOTREACHED_NORETURN(); } std::string AudioManagerBase::GetAssociatedOutputDeviceID(
diff --git a/media/audio/audio_output_resampler.cc b/media/audio/audio_output_resampler.cc index 9bc91de..9b6b2f61 100644 --- a/media/audio/audio_output_resampler.cc +++ b/media/audio/audio_output_resampler.cc
@@ -168,8 +168,7 @@ return success ? OpenStreamResult::kFallbackToFakeSuccess : OpenStreamResult::kFallbackToFakeFail; default: - NOTREACHED(); - return OpenStreamResult::kFail; + NOTREACHED_NORETURN(); } }
diff --git a/media/audio/fuchsia/audio_manager_fuchsia.cc b/media/audio/fuchsia/audio_manager_fuchsia.cc index 2d4307a..53857f5 100644 --- a/media/audio/fuchsia/audio_manager_fuchsia.cc +++ b/media/audio/fuchsia/audio_manager_fuchsia.cc
@@ -146,8 +146,7 @@ AudioOutputStream* AudioManagerFuchsia::MakeLinearOutputStream( const AudioParameters& params, const LogCallback& log_callback) { - NOTREACHED(); - return nullptr; + NOTREACHED_NORETURN(); } AudioOutputStream* AudioManagerFuchsia::MakeLowLatencyOutputStream(
diff --git a/media/base/android/media_drm_bridge.cc b/media/base/android/media_drm_bridge.cc index 316876e8..50f2bef 100644 --- a/media/base/android/media_drm_bridge.cc +++ b/media/base/android/media_drm_bridge.cc
@@ -92,10 +92,10 @@ return "video/mp4"; case media::EmeInitDataType::KEYIDS: return "keyids"; - default: - NOTREACHED(); - return "unknown"; + case media::EmeInitDataType::UNKNOWN: + NOTREACHED_NORETURN(); } + NOTREACHED_NORETURN(); } // Convert CdmSessionType to MediaDrmKeyType supported by MediaDrm. @@ -123,8 +123,7 @@ return CdmMessageType::LICENSE_RELEASE; } - NOTREACHED(); - return CdmMessageType::LICENSE_REQUEST; + NOTREACHED_NORETURN(); } CdmKeyInformation::KeyStatus ConvertKeyStatus(KeyStatus key_status, @@ -158,8 +157,7 @@ return CdmKeyInformation::EXPIRED; } - NOTREACHED(); - return CdmKeyInformation::INTERNAL_ERROR; + NOTREACHED_NORETURN(); } class KeySystemManager { @@ -220,10 +218,7 @@ // resolved. bool IsKeySystemSupportedWithTypeImpl(const std::string& key_system, const std::string& container_mime_type) { - if (key_system.empty()) { - NOTREACHED(); - return false; - } + CHECK(!key_system.empty()); UUID scheme_uuid = GetKeySystemManager()->GetUUID(key_system); if (scheme_uuid.empty()) {
diff --git a/media/base/android/media_player_bridge.cc b/media/base/android/media_player_bridge.cc index b9e94f9..34b4f47 100644 --- a/media/base/android/media_player_bridge.cc +++ b/media/base/android/media_player_bridge.cc
@@ -123,10 +123,8 @@ void MediaPlayerBridge::Initialize() { cookies_.clear(); - if (url_.SchemeIsBlob() || url_.SchemeIsFileSystem()) { - NOTREACHED(); - return; - } + CHECK(!url_.SchemeIsBlob()); + CHECK(!url_.SchemeIsFileSystem()); if (allow_credentials_ && !url_.SchemeIsFile()) { media::MediaResourceGetter* resource_getter = @@ -188,11 +186,8 @@ void MediaPlayerBridge::Prepare() { DCHECK(j_media_player_bridge_.is_null()); - - if (url_.SchemeIsBlob() || url_.SchemeIsFileSystem()) { - NOTREACHED(); - return; - } + CHECK(!url_.SchemeIsBlob()); + CHECK(!url_.SchemeIsFileSystem()); CreateJavaMediaPlayerBridge();
diff --git a/media/base/cdm_key_information.cc b/media/base/cdm_key_information.cc index bcf74f6..9fefd68 100644 --- a/media/base/cdm_key_information.cc +++ b/media/base/cdm_key_information.cc
@@ -58,8 +58,7 @@ return "RELEASED"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } std::ostream& operator<<(std::ostream& os,
diff --git a/media/base/fake_demuxer_stream.cc b/media/base/fake_demuxer_stream.cc index f4c58eb1..f1f4264 100644 --- a/media/base/fake_demuxer_stream.cc +++ b/media/base/fake_demuxer_stream.cc
@@ -94,9 +94,7 @@ } AudioDecoderConfig FakeDemuxerStream::audio_decoder_config() { - DCHECK(task_runner_->BelongsToCurrentThread()); - NOTREACHED(); - return AudioDecoderConfig(); + NOTREACHED_NORETURN(); } VideoDecoderConfig FakeDemuxerStream::video_decoder_config() {
diff --git a/media/base/key_systems.cc b/media/base/key_systems.cc index ee32b45..a38e43b 100644 --- a/media/base/key_systems.cc +++ b/media/base/key_systems.cc
@@ -165,8 +165,7 @@ case EncryptionScheme::kUnencrypted: break; } - NOTREACHED(); - return EmeConfig::UnsupportedRule(); + NOTREACHED_NORETURN(); } SupportedCodecs GetSupportedCodecs() const final { @@ -585,10 +584,7 @@ DCHECK(thread_checker_.CalledOnValidThread()); const auto* key_system_info = GetKeySystemInfo(key_system); - if (!key_system_info) { - NOTREACHED(); - return false; - } + CHECK(key_system_info); return key_system_info->IsSupportedInitDataType(init_data_type); } @@ -599,10 +595,7 @@ DCHECK(thread_checker_.CalledOnValidThread()); const auto* key_system_info = GetKeySystemInfo(key_system); - if (!key_system_info) { - NOTREACHED(); - return EmeConfig::UnsupportedRule(); - } + CHECK(key_system_info); return key_system_info->GetEncryptionSchemeConfigRule(encryption_scheme); } @@ -789,10 +782,7 @@ DCHECK(thread_checker_.CalledOnValidThread()); const auto* key_system_info = GetKeySystemInfo(key_system); - if (!key_system_info) { - NOTREACHED(); - return EmeConfig::UnsupportedRule(); - } + CHECK(key_system_info); return key_system_info->GetRobustnessConfigRule( key_system, media_type, requested_robustness, hw_secure_requirement); @@ -803,10 +793,7 @@ DCHECK(thread_checker_.CalledOnValidThread()); const auto* key_system_info = GetKeySystemInfo(key_system); - if (!key_system_info) { - NOTREACHED(); - return EmeConfig::UnsupportedRule(); - } + CHECK(key_system_info); return key_system_info->GetPersistentLicenseSessionSupport(); } @@ -816,10 +803,7 @@ DCHECK(thread_checker_.CalledOnValidThread()); const auto* key_system_info = GetKeySystemInfo(key_system); - if (!key_system_info) { - NOTREACHED(); - return EmeFeatureSupport::INVALID; - } + CHECK(key_system_info); return key_system_info->GetPersistentStateSupport(); } @@ -829,10 +813,7 @@ DCHECK(thread_checker_.CalledOnValidThread()); const auto* key_system_info = GetKeySystemInfo(key_system); - if (!key_system_info) { - NOTREACHED(); - return EmeFeatureSupport::INVALID; - } + CHECK(key_system_info); return key_system_info->GetDistinctiveIdentifierSupport(); }
diff --git a/media/base/key_systems_unittest.cc b/media/base/key_systems_unittest.cc index 0a20b4f..6abb282 100644 --- a/media/base/key_systems_unittest.cc +++ b/media/base/key_systems_unittest.cc
@@ -135,8 +135,7 @@ case EncryptionScheme::kCbcs: return EmeConfig{.hw_secure_codecs = EmeConfigRuleState::kNotAllowed}; } - NOTREACHED(); - return EmeConfig::UnsupportedRule(); + NOTREACHED_NORETURN(); } // We have hardware secure codec support for FOO_VIDEO and FOO_SECURE_VIDEO. @@ -151,14 +150,12 @@ const bool* /*hw_secure_requirement*/) const override { if (requested_robustness == kRobustnessSupported) { return EmeConfig::SupportedRule(); - } else if (requested_robustness == kRobustnessSecureCodecsRequired) { - return EmeConfig{.hw_secure_codecs = EmeConfigRuleState::kRequired}; - } else if (requested_robustness == kRobustnessNotSupported) { - return EmeConfig::UnsupportedRule(); - } else { - NOTREACHED(); - return EmeConfig::UnsupportedRule(); } + if (requested_robustness == kRobustnessSecureCodecsRequired) { + return EmeConfig{.hw_secure_codecs = EmeConfigRuleState::kRequired}; + } + CHECK_EQ(requested_robustness, kRobustnessNotSupported); + return EmeConfig::UnsupportedRule(); } EmeConfig::Rule GetPersistentLicenseSessionSupport() const override {
diff --git a/media/base/mac/videotoolbox_helpers.cc b/media/base/mac/videotoolbox_helpers.cc index 7100a0e..7427c64 100644 --- a/media/base/mac/videotoolbox_helpers.cc +++ b/media/base/mac/videotoolbox_helpers.cc
@@ -163,8 +163,7 @@ parameterSetSizeOut, parameterSetCountOut, NALUnitHeaderLengthOut); #endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER) default: - NOTREACHED(); - return kCMFormatDescriptionBridgeError_InvalidParameter; + NOTREACHED_NORETURN(); } }
diff --git a/media/base/media_log_message_levels.cc b/media/base/media_log_message_levels.cc index bf13597..26da8fc1 100644 --- a/media/base/media_log_message_levels.cc +++ b/media/base/media_log_message_levels.cc
@@ -21,8 +21,7 @@ case MediaLogMessageLevel::kDEBUG: return "debug"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } } // namespace media \ No newline at end of file
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc index 4fd8c35..fd832db 100644 --- a/media/base/media_switches.cc +++ b/media/base/media_switches.cc
@@ -795,7 +795,7 @@ // Enable VP8 temporal layer encoding with HW encoder on ChromeOS. BASE_FEATURE(kVaapiVp8TemporalLayerHWEncoding, "VaapiVp8TemporalLayerEncoding", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); // Enable VP9 k-SVC encoding with HW encoder for webrtc use case on ChromeOS. BASE_FEATURE(kVaapiVp9kSVCHWEncoding, "VaapiVp9kSVCHWEncoding",
diff --git a/media/base/media_track.cc b/media/base/media_track.cc index 0ca8ed6..ab32ccfd 100644 --- a/media/base/media_track.cc +++ b/media/base/media_track.cc
@@ -28,8 +28,7 @@ case MediaTrack::Video: return "video"; } - NOTREACHED(); - return "INVALID"; + NOTREACHED_NORETURN(); } } // namespace media
diff --git a/media/base/media_url_demuxer.cc b/media/base/media_url_demuxer.cc index 41bff02..66f60eb6 100644 --- a/media/base/media_url_demuxer.cc +++ b/media/base/media_url_demuxer.cc
@@ -28,8 +28,7 @@ // Should never be called since MediaResource::Type is URL. std::vector<DemuxerStream*> MediaUrlDemuxer::GetAllStreams() { - NOTREACHED(); - return std::vector<DemuxerStream*>(); + NOTREACHED_NORETURN(); } const MediaUrlParams& MediaUrlDemuxer::GetMediaUrlParams() const {
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc index 93f1556..ad32f53 100644 --- a/media/base/pipeline_impl.cc +++ b/media/base/pipeline_impl.cc
@@ -822,7 +822,7 @@ // TODO(tmathmeyer): Look into text track switching. case DemuxerStream::TEXT: case DemuxerStream::UNKNOWN: // Fail on unknown type. - NOTREACHED(); + NOTREACHED_NORETURN(); } } @@ -1570,8 +1570,7 @@ RETURN_STRING(kSuspended); RETURN_STRING(kResuming); } - NOTREACHED(); - return "INVALID"; + NOTREACHED_NORETURN(); } #undef RETURN_STRING
diff --git a/media/base/pipeline_status.cc b/media/base/pipeline_status.cc index 7b1fcd8..b3a9a75e 100644 --- a/media/base/pipeline_status.cc +++ b/media/base/pipeline_status.cc
@@ -38,8 +38,7 @@ #undef STRINGIFY_STATUS_CASE - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } std::ostream& operator<<(std::ostream& out, const PipelineStatus& status) {
diff --git a/media/base/svc_scalability_mode.cc b/media/base/svc_scalability_mode.cc index 2f00fd0..3d021db 100644 --- a/media/base/svc_scalability_mode.cc +++ b/media/base/svc_scalability_mode.cc
@@ -79,7 +79,6 @@ case SVCScalabilityMode::kL3T3KeyShift: return "L3T3_KEY_SHIFT"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } } // namespace media
diff --git a/media/base/text_renderer.cc b/media/base/text_renderer.cc index 6ddbab2..fc1902f 100644 --- a/media/base/text_renderer.cc +++ b/media/base/text_renderer.cc
@@ -172,12 +172,10 @@ case kPaused: case kUninitialized: case kEnded: - NOTREACHED(); - return; + NOTREACHED_NORETURN(); } - NOTREACHED(); - return; + NOTREACHED_NORETURN(); } if (input->end_of_stream()) { @@ -268,8 +266,7 @@ case kPaused: case kUninitialized: case kEnded: - NOTREACHED(); - return; + NOTREACHED_NORETURN(); } base::TimeDelta start = text_cue->timestamp();
diff --git a/media/base/video_codecs.cc b/media/base/video_codecs.cc index 1df9c4b..08ec1b8 100644 --- a/media/base/video_codecs.cc +++ b/media/base/video_codecs.cc
@@ -44,8 +44,7 @@ case VideoCodec::kAV1: return "av1"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } // Reported as part of some UMA names. NEVER change existing strings! @@ -74,8 +73,7 @@ case VideoCodec::kAV1: return "AV1"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } std::string GetProfileName(VideoCodecProfile profile) { @@ -157,8 +155,7 @@ case AV1PROFILE_PROFILE_PRO: return "av1 profile pro"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } std::string BuildH264MimeSuffix(media::VideoCodecProfile profile,
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc index 17689238..e91de46 100644 --- a/media/base/video_frame.cc +++ b/media/base/video_frame.cc
@@ -175,8 +175,7 @@ break; } } - NOTREACHED(); - return gfx::Size(); + NOTREACHED_NORETURN(); } // Checks if |source_format| can be wrapped into a |target_format| frame. @@ -1107,8 +1106,7 @@ case PIXEL_FORMAT_UNKNOWN: break; } - NOTREACHED(); - return 0; + NOTREACHED_NORETURN(); } // static
diff --git a/media/base/video_frame.h b/media/base/video_frame.h index a410b4dd..40f0553 100644 --- a/media/base/video_frame.h +++ b/media/base/video_frame.h
@@ -548,11 +548,8 @@ const gfx::Size& natural_size() const { return natural_size_; } int stride(size_t plane) const { - if (UNLIKELY(!IsValidPlane(format(), plane) || - plane >= layout_.num_planes())) { - NOTREACHED(); - return 0; - } + CHECK(IsValidPlane(format(), plane)); + CHECK_LT(plane, layout_.num_planes()); return layout_.planes()[plane].stride; }
diff --git a/media/base/video_transformation.cc b/media/base/video_transformation.cc index 65529a88..fd337a29 100644 --- a/media/base/video_transformation.cc +++ b/media/base/video_transformation.cc
@@ -32,8 +32,7 @@ case VIDEO_ROTATION_270: return "270°"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } bool operator==(const struct VideoTransformation& first,
diff --git a/media/base/video_types.cc b/media/base/video_types.cc index 7020c9d..40d099de 100644 --- a/media/base/video_types.cc +++ b/media/base/video_types.cc
@@ -307,8 +307,7 @@ case PIXEL_FORMAT_RGBAF16: return 16; } - NOTREACHED(); - return 0; + NOTREACHED_NORETURN(); } } // namespace media
diff --git a/media/base/video_util.cc b/media/base/video_util.cc index 8e63a3b0..1e3827c 100644 --- a/media/base/video_util.cc +++ b/media/base/video_util.cc
@@ -103,8 +103,7 @@ case kBGRA_8888_SkColorType: return GL_BGRA8_EXT; default: - NOTREACHED(); - return 0; + NOTREACHED_NORETURN(); } } @@ -1277,8 +1276,7 @@ case PIXEL_FORMAT_ARGB: return kBGRA_8888_SkColorType; default: - NOTREACHED(); - return kUnknown_SkColorType; + NOTREACHED_NORETURN(); } }
diff --git a/media/base/watch_time_keys.cc b/media/base/watch_time_keys.cc index 2114fd98..817f271 100644 --- a/media/base/watch_time_keys.cc +++ b/media/base/watch_time_keys.cc
@@ -251,8 +251,7 @@ return base::StringPiece(); }; - NOTREACHED(); - return base::StringPiece(); + NOTREACHED_NORETURN(); } } // namespace media
diff --git a/media/capture/content/video_capture_oracle.cc b/media/capture/content/video_capture_oracle.cc index 7160b29..1be76d3 100644 --- a/media/capture/content/video_capture_oracle.cc +++ b/media/capture/content/video_capture_oracle.cc
@@ -422,8 +422,7 @@ case kNumEvents: break; } - NOTREACHED(); - return "unknown"; + NOTREACHED_NORETURN(); } base::TimeTicks VideoCaptureOracle::GetFrameTimestamp(int frame_number) const {
diff --git a/media/capture/mojom/video_capture_types_mojom_traits.cc b/media/capture/mojom/video_capture_types_mojom_traits.cc index 6b86519b..e52b371 100644 --- a/media/capture/mojom/video_capture_types_mojom_traits.cc +++ b/media/capture/mojom/video_capture_types_mojom_traits.cc
@@ -23,8 +23,7 @@ case media::ResolutionChangePolicy::ANY_WITHIN_LIMIT: return media::mojom::ResolutionChangePolicy::ANY_WITHIN_LIMIT; } - NOTREACHED(); - return media::mojom::ResolutionChangePolicy::FIXED_RESOLUTION; + NOTREACHED_NORETURN(); } // static @@ -43,8 +42,7 @@ *output = media::ResolutionChangePolicy::ANY_WITHIN_LIMIT; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static @@ -59,8 +57,7 @@ case media::PowerLineFrequency::k60Hz: return media::mojom::PowerLineFrequency::HZ_60; } - NOTREACHED(); - return media::mojom::PowerLineFrequency::DEFAULT; + NOTREACHED_NORETURN(); } // static @@ -78,8 +75,7 @@ *output = media::PowerLineFrequency::k60Hz; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static @@ -162,8 +158,7 @@ case media::VideoPixelFormat::PIXEL_FORMAT_NV12A: return media::mojom::VideoCapturePixelFormat::NV12A; } - NOTREACHED(); - return media::mojom::VideoCapturePixelFormat::I420; + NOTREACHED_NORETURN(); } // static @@ -284,8 +279,7 @@ *output = media::PIXEL_FORMAT_NV12A; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static @@ -301,8 +295,7 @@ case media::VideoCaptureBufferType::kGpuMemoryBuffer: return media::mojom::VideoCaptureBufferType::kGpuMemoryBuffer; } - NOTREACHED(); - return media::mojom::VideoCaptureBufferType::kSharedMemory; + NOTREACHED_NORETURN(); } // static @@ -316,8 +309,7 @@ return true; case media::mojom::VideoCaptureBufferType:: kSharedMemoryViaRawFileDescriptor_DEPRECATED: - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); case media::mojom::VideoCaptureBufferType::kMailboxHolder: *output = media::VideoCaptureBufferType::kMailboxHolder; return true; @@ -325,8 +317,7 @@ *output = media::VideoCaptureBufferType::kGpuMemoryBuffer; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static @@ -808,8 +799,7 @@ return media::mojom::VideoCaptureError:: kWinDirectShowDeviceInitializationFailed; } - NOTREACHED(); - return media::mojom::VideoCaptureError::kNone; + NOTREACHED_NORETURN(); } // static @@ -1456,8 +1446,7 @@ media::VideoCaptureError::kWinDirectShowDeviceInitializationFailed; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static @@ -1561,8 +1550,7 @@ return media::mojom::VideoCaptureFrameDropReason:: kGpuMemoryBufferMapFailed; } - NOTREACHED(); - return media::mojom::VideoCaptureFrameDropReason::kNone; + NOTREACHED_NORETURN(); } // static @@ -1702,8 +1690,7 @@ *output = media::VideoCaptureFrameDropReason::kGpuMemoryBufferMapFailed; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static @@ -1718,11 +1705,9 @@ case media::VideoFacingMode::MEDIA_VIDEO_FACING_ENVIRONMENT: return media::mojom::VideoFacingMode::ENVIRONMENT; case media::VideoFacingMode::NUM_MEDIA_VIDEO_FACING_MODES: - NOTREACHED(); - return media::mojom::VideoFacingMode::NONE; + NOTREACHED_NORETURN(); } - NOTREACHED(); - return media::mojom::VideoFacingMode::NONE; + NOTREACHED_NORETURN(); } // static @@ -1740,8 +1725,7 @@ *output = media::VideoFacingMode::MEDIA_VIDEO_FACING_ENVIRONMENT; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static @@ -1776,8 +1760,7 @@ case media::VideoCaptureApi::UNKNOWN: return media::mojom::VideoCaptureApi::UNKNOWN; } - NOTREACHED(); - return media::mojom::VideoCaptureApi::UNKNOWN; + NOTREACHED_NORETURN(); } // static @@ -1825,8 +1808,7 @@ *output = media::VideoCaptureApi::UNKNOWN; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static @@ -1840,8 +1822,7 @@ case media::VideoCaptureTransportType::OTHER_TRANSPORT: return media::mojom::VideoCaptureTransportType::OTHER_TRANSPORT; } - NOTREACHED(); - return media::mojom::VideoCaptureTransportType::OTHER_TRANSPORT; + NOTREACHED_NORETURN(); } // static @@ -1857,8 +1838,7 @@ *output = media::VideoCaptureTransportType::OTHER_TRANSPORT; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static
diff --git a/media/capture/video/android/video_capture_device_android.cc b/media/capture/video/android/video_capture_device_android.cc index cd22cf36..52a0c05 100644 --- a/media/capture/video/android/video_capture_device_android.cc +++ b/media/capture/video/android/video_capture_device_android.cc
@@ -65,8 +65,7 @@ case mojom::MeteringMode::NONE: return PhotoCapabilities::AndroidMeteringMode::NONE; } - NOTREACHED(); - return PhotoCapabilities::AndroidMeteringMode::NOT_SET; + NOTREACHED_NORETURN(); } mojom::FillLightMode ToMojomFillLightMode( @@ -82,8 +81,7 @@ case PhotoCapabilities::AndroidFillLightMode::NUM_ENTRIES: NOTREACHED(); } - NOTREACHED(); - return mojom::FillLightMode::OFF; + NOTREACHED_NORETURN(); } PhotoCapabilities::AndroidFillLightMode ToAndroidFillLightMode( @@ -96,8 +94,7 @@ case mojom::FillLightMode::OFF: return PhotoCapabilities::AndroidFillLightMode::OFF; } - NOTREACHED(); - return PhotoCapabilities::AndroidFillLightMode::NOT_SET; + NOTREACHED_NORETURN(); } } // anonymous namespace
diff --git a/media/capture/video/fake_video_capture_device.cc b/media/capture/video/fake_video_capture_device.cc index 2005176..9e07b0d 100644 --- a/media/capture/video/fake_video_capture_device.cc +++ b/media/capture/video/fake_video_capture_device.cc
@@ -335,8 +335,7 @@ return std::make_unique<GpuMemoryBufferFrameDeliverer>( std::move(frame_painter), gmb_support_.get()); } - NOTREACHED(); - return nullptr; + NOTREACHED_NORETURN(); } PacmanFramePainter::PacmanFramePainter(Format pixel_format,
diff --git a/media/capture/video/fuchsia/video_capture_device_fuchsia.cc b/media/capture/video/fuchsia/video_capture_device_fuchsia.cc index 4c978eb..6232a7f2 100644 --- a/media/capture/video/fuchsia/video_capture_device_fuchsia.cc +++ b/media/capture/video/fuchsia/video_capture_device_fuchsia.cc
@@ -32,8 +32,7 @@ case fuchsia::sysmem::PixelFormatType::NV12: return libyuv::FourCC::FOURCC_NV12; default: - NOTREACHED(); - return libyuv::FourCC::FOURCC_I420; + NOTREACHED_NORETURN(); } } @@ -438,4 +437,4 @@ // Frame buffer is returned to the device by dropping the |frame_info|. } -} // namespace media \ No newline at end of file +} // namespace media
diff --git a/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc b/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc index b489d16..4a8101e3 100644 --- a/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc +++ b/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc
@@ -67,8 +67,7 @@ ~HeapBufferHandleProvider() override = default; base::UnsafeSharedMemoryRegion DuplicateAsUnsafeRegion() override { - NOTREACHED(); - return {}; + NOTREACHED_NORETURN(); } std::unique_ptr<VideoCaptureBufferHandle> GetHandleForInProcessAccess() @@ -150,7 +149,7 @@ base::TimeTicks reference_time, base::TimeDelta timestamp, int frame_feedback_id) override { - NOTREACHED(); + NOTREACHED_NORETURN(); } void OnIncomingCapturedGfxBuffer(gfx::GpuMemoryBuffer* buffer, const VideoCaptureFormat& frame_format, @@ -158,7 +157,7 @@ base::TimeTicks reference_time, base::TimeDelta timestamp, int frame_feedback_id) override { - NOTREACHED(); + NOTREACHED_NORETURN(); } void OnIncomingCapturedExternalBuffer( CapturedExternalVideoBuffer buffer, @@ -166,27 +165,24 @@ base::TimeTicks reference_time, base::TimeDelta timestamp, gfx::Rect visible_rect) override { - NOTREACHED(); + NOTREACHED_NORETURN(); } void OnIncomingCapturedBuffer(Buffer buffer, const VideoCaptureFormat& format, base::TimeTicks reference_time, base::TimeDelta timestamp) override { - NOTREACHED(); + NOTREACHED_NORETURN(); } void OnError(VideoCaptureError error, const base::Location& from_here, const std::string& reason) override { - NOTREACHED(); + NOTREACHED_NORETURN(); } void OnFrameDropped(VideoCaptureFrameDropReason reason) override { - NOTREACHED(); + NOTREACHED_NORETURN(); } - void OnLog(const std::string& message) override { NOTREACHED(); } - double GetBufferPoolUtilization() const override { - NOTREACHED(); - return 0; - } + void OnLog(const std::string& message) override { NOTREACHED_NORETURN(); } + double GetBufferPoolUtilization() const override { NOTREACHED_NORETURN(); } bool started_ = false; std::vector<ReceivedFrame> received_frames_;
diff --git a/media/capture/video/linux/fake_v4l2_impl.cc b/media/capture/video/linux/fake_v4l2_impl.cc index 5721d9f..5165502 100644 --- a/media/capture/video/linux/fake_v4l2_impl.cc +++ b/media/capture/video/linux/fake_v4l2_impl.cc
@@ -15,6 +15,7 @@ #include "base/bits.h" #include "base/containers/flat_set.h" #include "base/functional/bind.h" +#include "base/logging.h" #include "base/ranges/algorithm.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread.h" @@ -599,13 +600,12 @@ case VIDIOC_DV_TIMINGS_CAP: case VIDIOC_ENUM_FREQ_BANDS: // Unsupported |request| code. - NOTREACHED() << "Unsupported request code " << request; + LOG(ERROR) << "Unsupported request code " << request; return kErrorReturnValue; } // Invalid |request|. - NOTREACHED(); - return kErrorReturnValue; + NOTREACHED_NORETURN(); } // We ignore |start| in this implementation
diff --git a/media/capture/video/mock_video_capture_device_client.cc b/media/capture/video/mock_video_capture_device_client.cc index 0b17ce1..2699160 100644 --- a/media/capture/video/mock_video_capture_device_client.cc +++ b/media/capture/video/mock_video_capture_device_client.cc
@@ -39,8 +39,7 @@ ~StubBufferHandleProvider() override = default; base::UnsafeSharedMemoryRegion DuplicateAsUnsafeRegion() override { - NOTREACHED(); - return {}; + NOTREACHED_NORETURN(); } std::unique_ptr<VideoCaptureBufferHandle> GetHandleForInProcessAccess()
diff --git a/media/capture/video/win/filter_base_win.cc b/media/capture/video/win/filter_base_win.cc index d6393845..87c61275 100644 --- a/media/capture/video/win/filter_base_win.cc +++ b/media/capture/video/win/filter_base_win.cc
@@ -142,8 +142,7 @@ // Implement from IPersistent. HRESULT FilterBase::GetClassID(CLSID* class_id) { - NOTREACHED(); - return E_NOTIMPL; + NOTREACHED_NORETURN(); } // Implement IUnknown.
diff --git a/media/capture/video/win/pin_base_win.cc b/media/capture/video/win/pin_base_win.cc index 9ab67be..0062daa 100644 --- a/media/capture/video/win/pin_base_win.cc +++ b/media/capture/video/win/pin_base_win.cc
@@ -185,8 +185,7 @@ } HRESULT PinBase::QueryId(LPWSTR* id) { - NOTREACHED(); - return E_OUTOFMEMORY; + NOTREACHED_NORETURN(); } HRESULT PinBase::QueryAccept(const AM_MEDIA_TYPE* media_type) { @@ -218,8 +217,7 @@ HRESULT PinBase::NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate) { - NOTREACHED(); - return E_NOTIMPL; + NOTREACHED_NORETURN(); } // Inherited from IMemInputPin.
diff --git a/media/capture/video/win/video_capture_device_factory_win_unittest.cc b/media/capture/video/win/video_capture_device_factory_win_unittest.cc index 2d9dba1..bdc50fd 100644 --- a/media/capture/video/win/video_capture_device_factory_win_unittest.cc +++ b/media/capture/video/win/video_capture_device_factory_win_unittest.cc
@@ -953,8 +953,7 @@ *object = AddReference(new StubVideoProcAmp(device_id())); return S_OK; } - NOTREACHED(); - return E_NOTIMPL; + NOTREACHED_NORETURN(); } IFACEMETHODIMP get_Category(DWORD index, GUID* category) override { return E_NOTIMPL; @@ -984,8 +983,7 @@ : KSNODETYPE_DEV_SPECIFIC; return S_OK; } - NOTREACHED(); - return E_NOTIMPL; + NOTREACHED_NORETURN(); } IFACEMETHODIMP get_NumCategories(DWORD* num_categories) override { return E_NOTIMPL;
diff --git a/media/capture/video/win/video_capture_device_mf_win_unittest.cc b/media/capture/video/win/video_capture_device_mf_win_unittest.cc index 576cdbd..44091f1 100644 --- a/media/capture/video/win/video_capture_device_mf_win_unittest.cc +++ b/media/capture/video/win/video_capture_device_mf_win_unittest.cc
@@ -192,8 +192,7 @@ *flags = CameraControl_Flags_Auto; return S_OK; default: - NOTREACHED(); - return E_NOTIMPL; + NOTREACHED_NORETURN(); } } IFACEMETHODIMP GetRange(long property, @@ -217,8 +216,7 @@ *caps_flags = CameraControl_Flags_Auto | CameraControl_Flags_Manual; return S_OK; default: - NOTREACHED(); - return E_NOTIMPL; + NOTREACHED_NORETURN(); } } IFACEMETHODIMP Set(long property, long value, long flags) override { @@ -247,8 +245,7 @@ *flags = VideoProcAmp_Flags_Auto; return S_OK; default: - NOTREACHED(); - return E_NOTIMPL; + NOTREACHED_NORETURN(); } } IFACEMETHODIMP GetRange(long property, @@ -275,8 +272,7 @@ *caps_flags = VideoProcAmp_Flags_Auto | VideoProcAmp_Flags_Manual; return S_OK; default: - NOTREACHED(); - return E_NOTIMPL; + NOTREACHED_NORETURN(); } } IFACEMETHODIMP Set(long property, long value, long flags) override {
diff --git a/media/cast/common/openscreen_conversion_helpers.cc b/media/cast/common/openscreen_conversion_helpers.cc index 2f84751..e2b1a97 100644 --- a/media/cast/common/openscreen_conversion_helpers.cc +++ b/media/cast/common/openscreen_conversion_helpers.cc
@@ -76,8 +76,7 @@ case Codec::kAudioAac: return openscreen::cast::AudioCodec::kAac; default: - NOTREACHED(); - return openscreen::cast::AudioCodec::kNotSpecified; + NOTREACHED_NORETURN(); } } @@ -94,8 +93,7 @@ case Codec::kVideoAv1: return openscreen::cast::VideoCodec::kAv1; default: - NOTREACHED(); - return openscreen::cast::VideoCodec::kNotSpecified; + NOTREACHED_NORETURN(); } } @@ -108,8 +106,7 @@ case openscreen::cast::AudioCodec::kAac: return Codec::kAudioAac; } - NOTREACHED(); - return Codec::kUnknown; + NOTREACHED_NORETURN(); } Codec ToCodec(openscreen::cast::VideoCodec codec) { @@ -127,8 +124,7 @@ case openscreen::cast::VideoCodec::kHevc: return Codec::kUnknown; } - NOTREACHED(); - return Codec::kUnknown; + NOTREACHED_NORETURN(); } AudioCodec ToAudioCodec(openscreen::cast::AudioCodec codec) { @@ -141,8 +137,7 @@ case openscreen::cast::AudioCodec::kAac: return AudioCodec::kAAC; } - NOTREACHED(); - return AudioCodec::kUnknown; + NOTREACHED_NORETURN(); } VideoCodec ToVideoCodec(openscreen::cast::VideoCodec codec) { @@ -161,8 +156,7 @@ case openscreen::cast::VideoCodec::kHevc: return VideoCodec::kHEVC; } - NOTREACHED(); - return VideoCodec::kUnknown; + NOTREACHED_NORETURN(); } openscreen::IPAddress ToOpenscreenIPAddress(const net::IPAddress& address) {
diff --git a/media/cast/encoding/audio_encoder.cc b/media/cast/encoding/audio_encoder.cc index 4666583..5b9dfcb7 100644 --- a/media/cast/encoding/audio_encoder.cc +++ b/media/cast/encoding/audio_encoder.cc
@@ -620,8 +620,7 @@ void* in_buffer, UInt32* out_size) { // This class only does writing. - NOTREACHED(); - return kAudioFileNotOpenError; + NOTREACHED_NORETURN(); } // The AudioFile write callback function. Appends the data to the encoder's @@ -647,8 +646,7 @@ // The AudioFile getsize callback function. static SInt64 FileGetSizeCallback(void* in_encoder) { // This class only does writing. - NOTREACHED(); - return 0; + NOTREACHED_NORETURN(); } // The AudioFile setsize callback function. @@ -788,19 +786,13 @@ int AudioEncoder::GetSamplesPerFrame() const { DCHECK_CALLED_ON_VALID_THREAD(insert_thread_checker_); - if (InitializationResult() != STATUS_INITIALIZED) { - NOTREACHED(); - return std::numeric_limits<int>::max(); - } + CHECK_EQ(InitializationResult(), STATUS_INITIALIZED); return impl_->samples_per_frame(); } base::TimeDelta AudioEncoder::GetFrameDuration() const { DCHECK_CALLED_ON_VALID_THREAD(insert_thread_checker_); - if (InitializationResult() != STATUS_INITIALIZED) { - NOTREACHED(); - return base::TimeDelta(); - } + CHECK_EQ(InitializationResult(), STATUS_INITIALIZED); return impl_->frame_duration(); } @@ -816,10 +808,7 @@ const base::TimeTicks recorded_time) { DCHECK_CALLED_ON_VALID_THREAD(insert_thread_checker_); DCHECK(audio_bus.get()); - if (InitializationResult() != STATUS_INITIALIZED) { - NOTREACHED(); - return; - } + CHECK_EQ(InitializationResult(), STATUS_INITIALIZED); cast_environment_->PostTask( CastEnvironment::AUDIO, FROM_HERE, base::BindOnce(&AudioEncoder::ImplBase::EncodeAudio, impl_,
diff --git a/media/cast/logging/logging_defines.cc b/media/cast/logging/logging_defines.cc index ce475f84..cc44cae6 100644 --- a/media/cast/logging/logging_defines.cc +++ b/media/cast/logging/logging_defines.cc
@@ -28,8 +28,7 @@ ENUM_TO_STRING(PACKET_RTX_REJECTED); ENUM_TO_STRING(PACKET_RECEIVED); } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } FrameEvent::FrameEvent()
diff --git a/media/cast/logging/proto/proto_utils.cc b/media/cast/logging/proto/proto_utils.cc index c3b2c2f..d341fab 100644 --- a/media/cast/logging/proto/proto_utils.cc +++ b/media/cast/logging/proto/proto_utils.cc
@@ -28,8 +28,7 @@ TO_PROTO_ENUM(PACKET_RTX_REJECTED); TO_PROTO_ENUM(PACKET_RECEIVED); } - NOTREACHED(); - return proto::UNKNOWN; + NOTREACHED_NORETURN(); } } // namespace cast
diff --git a/media/cast/logging/stats_event_subscriber.cc b/media/cast/logging/stats_event_subscriber.cc index 490294d..19fe185 100644 --- a/media/cast/logging/stats_event_subscriber.cc +++ b/media/cast/logging/stats_event_subscriber.cc
@@ -313,8 +313,7 @@ STAT_ENUM_TO_STRING(E2E_LATENCY_MS_HISTO); STAT_ENUM_TO_STRING(LATE_FRAME_MS_HISTO); } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } const int kDefaultMaxLatencyBucketMs = 800;
diff --git a/media/cast/net/rtcp/receiver_rtcp_session.cc b/media/cast/net/rtcp/receiver_rtcp_session.cc index fed1ac5..f520dfbe 100644 --- a/media/cast/net/rtcp/receiver_rtcp_session.cc +++ b/media/cast/net/rtcp/receiver_rtcp_session.cc
@@ -82,10 +82,7 @@ void ReceiverRtcpSession::OnReceivedLipSyncInfo(RtpTimeTicks rtp_timestamp, uint32_t ntp_seconds, uint32_t ntp_fraction) { - if (ntp_seconds == 0) { - NOTREACHED(); - return; - } + CHECK_GT(ntp_seconds, 0u); lip_sync_rtp_timestamp_ = rtp_timestamp; lip_sync_ntp_timestamp_ = (static_cast<uint64_t>(ntp_seconds) << 32) | ntp_fraction;
diff --git a/media/cast/net/rtp/packet_storage.cc b/media/cast/net/rtp/packet_storage.cc index b9b30b8fc..48b7cec6 100644 --- a/media/cast/net/rtp/packet_storage.cc +++ b/media/cast/net/rtp/packet_storage.cc
@@ -21,10 +21,7 @@ void PacketStorage::StoreFrame(FrameId frame_id, const SendPacketVector& packets) { - if (packets.empty()) { - NOTREACHED(); - return; - } + CHECK(!packets.empty()); if (frames_.empty()) { first_frame_id_in_list_ = frame_id;
diff --git a/media/cast/openscreen/config_conversions.cc b/media/cast/openscreen/config_conversions.cc index fb1d41b..8268764 100644 --- a/media/cast/openscreen/config_conversions.cc +++ b/media/cast/openscreen/config_conversions.cc
@@ -31,8 +31,7 @@ break; } - NOTREACHED(); - return media::VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN; + NOTREACHED_NORETURN(); } media::AudioCodec ToAudioDecoderConfigCodec( @@ -46,8 +45,7 @@ break; } - NOTREACHED(); - return media::AudioCodec::kUnknown; + NOTREACHED_NORETURN(); } media::VideoCodec ToVideoDecoderConfigCodec( @@ -67,8 +65,7 @@ break; } - NOTREACHED(); - return media::VideoCodec::kUnknown; + NOTREACHED_NORETURN(); } } // namespace @@ -84,8 +81,7 @@ break; } - NOTREACHED(); - return openscreen::cast::AudioCodec::kNotSpecified; + NOTREACHED_NORETURN(); } openscreen::cast::VideoCodec ToVideoCaptureConfigCodec( @@ -105,8 +101,7 @@ break; } - NOTREACHED(); - return openscreen::cast::VideoCodec::kNotSpecified; + NOTREACHED_NORETURN(); } openscreen::cast::AudioCaptureConfig ToAudioCaptureConfig(
diff --git a/media/cast/sender/audio_sender.cc b/media/cast/sender/audio_sender.cc index 2fe68a78..0f6a476 100644 --- a/media/cast/sender/audio_sender.cc +++ b/media/cast/sender/audio_sender.cc
@@ -99,11 +99,7 @@ void AudioSender::InsertAudio(std::unique_ptr<AudioBus> audio_bus, const base::TimeTicks& recorded_time) { DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); - - if (!audio_encoder_) { - NOTREACHED(); - return; - } + CHECK(audio_encoder_); number_of_frames_inserted_++; const base::TimeDelta next_frame_duration =
diff --git a/media/cast/sender/video_sender.cc b/media/cast/sender/video_sender.cc index c87a01a..914068d 100644 --- a/media/cast/sender/video_sender.cc +++ b/media/cast/sender/video_sender.cc
@@ -182,11 +182,7 @@ scoped_refptr<media::VideoFrame> video_frame, const base::TimeTicks& reference_time) { DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); - - if (!video_encoder_) { - NOTREACHED(); - return; - } + CHECK(video_encoder_); const RtpTimeTicks rtp_timestamp = ToRtpTimeTicks(video_frame->timestamp(), kVideoFrequency);
diff --git a/media/cast/test/utility/input_builder.cc b/media/cast/test/utility/input_builder.cc index f77b67ea..5f30b523 100644 --- a/media/cast/test/utility/input_builder.cc +++ b/media/cast/test/utility/input_builder.cc
@@ -41,10 +41,7 @@ printf("# "); fflush(stdout); char raw_input[128]; - if (!fgets(raw_input, 128, stdin)) { - NOTREACHED(); - return std::string(); - } + CHECK(fgets(raw_input, sizeof(raw_input), stdin)); std::string input = raw_input; input = input.substr(0, input.size() - 1); // Strip last \n.
diff --git a/media/cdm/cdm_adapter.cc b/media/cdm/cdm_adapter.cc index 69f03e6..51bd39b 100644 --- a/media/cdm/cdm_adapter.cc +++ b/media/cdm/cdm_adapter.cc
@@ -96,8 +96,7 @@ return "kDeferredInitialization"; } - NOTREACHED(); - return "Invalid Status!"; + NOTREACHED_NORETURN(); } inline std::ostream& operator<<(std::ostream& out, cdm::Status status) { @@ -135,11 +134,9 @@ return static_cast<cdm::Host_10*>(cdm_adapter); case cdm::Host_11::kVersion: return static_cast<cdm::Host_11*>(cdm_adapter); - default: - NOTREACHED() << "Unexpected host interface version " - << host_interface_version; - return nullptr; } + NOTREACHED_NORETURN() << "Unexpected host interface version " + << host_interface_version; } void ReportSystemCodeUMA(const std::string& key_system, uint32_t system_code) { @@ -990,7 +987,7 @@ return; } - NOTREACHED() << "Unexpected cdm::StreamType " << stream_type; + NOTREACHED_NORETURN() << "Unexpected cdm::StreamType " << stream_type; } cdm::FileIO* CdmAdapter::CreateFileIO(cdm::FileIOClient* client) {
diff --git a/media/cdm/fuchsia/fuchsia_cdm.cc b/media/cdm/fuchsia/fuchsia_cdm.cc index 0f94e5b..3b7c041 100644 --- a/media/cdm/fuchsia/fuchsia_cdm.cc +++ b/media/cdm/fuchsia/fuchsia_cdm.cc
@@ -108,8 +108,7 @@ case fuchsia::media::drm::Error::NOT_PROVISIONED: // FuchsiaCdmManager is supposed to provision CDM. - NOTREACHED(); - return CdmPromise::Exception::INVALID_STATE_ERROR; + NOTREACHED_NORETURN(); case fuchsia::media::drm::Error::INTERNAL: DLOG(ERROR) << "CDM failed due to an internal error.";
diff --git a/media/cdm/library_cdm/clear_key_cdm/cdm_file_adapter.cc b/media/cdm/library_cdm/clear_key_cdm/cdm_file_adapter.cc index 4f79142..9b8779a 100644 --- a/media/cdm/library_cdm/clear_key_cdm/cdm_file_adapter.cc +++ b/media/cdm/library_cdm/clear_key_cdm/cdm_file_adapter.cc
@@ -24,8 +24,7 @@ return CdmFileAdapter::Status::kError; } - NOTREACHED(); - return CdmFileAdapter::Status::kError; + NOTREACHED_NORETURN(); } } // namespace
diff --git a/media/cdm/library_cdm/clear_key_cdm/cdm_file_io_test.cc b/media/cdm/library_cdm/clear_key_cdm/cdm_file_io_test.cc index 36aa3112..c9f7232 100644 --- a/media/cdm/library_cdm/clear_key_cdm/cdm_file_io_test.cc +++ b/media/cdm/library_cdm/clear_key_cdm/cdm_file_io_test.cc
@@ -594,8 +594,7 @@ case ACTION_CLOSE: return false; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } bool FileIOTest::MatchesResult(const TestStep& a, const TestStep& b) {
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc index 276b486..35deae8 100644 --- a/media/filters/chunk_demuxer.cc +++ b/media/filters/chunk_demuxer.cc
@@ -392,9 +392,7 @@ switch (state_) { case UNINITIALIZED: - requested_buffer_count_ = 0; - NOTREACHED(); - return; + NOTREACHED_NORETURN(); case RETURNING_ABORT_FOR_READS: // Null buffers should be returned in this state since we are waiting // for a seek. Any buffers in the SourceBuffer should NOT be returned @@ -1573,8 +1571,7 @@ break; case DemuxerStream::UNKNOWN: - NOTREACHED(); - return nullptr; + NOTREACHED_NORETURN(); } std::unique_ptr<ChunkDemuxerStream> stream =
diff --git a/media/filters/decoder_stream.cc b/media/filters/decoder_stream.cc index 0f449e6..6724fa5b 100644 --- a/media/filters/decoder_stream.cc +++ b/media/filters/decoder_stream.cc
@@ -90,8 +90,7 @@ return "decode_error"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } template <DemuxerStream::Type StreamType>
diff --git a/media/filters/decrypting_demuxer_stream.cc b/media/filters/decrypting_demuxer_stream.cc index d77d12b..60c8a08 100644 --- a/media/filters/decrypting_demuxer_stream.cc +++ b/media/filters/decrypting_demuxer_stream.cc
@@ -411,8 +411,7 @@ } default: - NOTREACHED(); - return; + NOTREACHED_NORETURN(); } LogMetadata(); }
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc index bbe2879..ee28cdd 100644 --- a/media/filters/ffmpeg_demuxer.cc +++ b/media/filters/ffmpeg_demuxer.cc
@@ -1661,8 +1661,7 @@ return stream.get(); } - NOTREACHED(); - return nullptr; + NOTREACHED_NORETURN(); } void FFmpegDemuxer::OnSeekFrameDone(int result) {
diff --git a/media/filters/frame_processor.cc b/media/filters/frame_processor.cc index 22ca3000..e0e2af3 100644 --- a/media/filters/frame_processor.cc +++ b/media/filters/frame_processor.cc
@@ -1185,8 +1185,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } } // namespace media
diff --git a/media/filters/hls_data_source_provider.h b/media/filters/hls_data_source_provider.h index daee452c..6093bc4 100644 --- a/media/filters/hls_data_source_provider.h +++ b/media/filters/hls_data_source_provider.h
@@ -26,10 +26,7 @@ } // namespace -class HlsManifestDemuxerEngine; - -// Interface which can provide HlsManifestDemuxerEngine with data, respecting -// byterange boundaries. +// Interface which can provide data, respecting byterange boundaries. class MEDIA_EXPORT HlsDataSource { public: enum class ReadStatusCodes : StatusCodeType { @@ -72,20 +69,12 @@ const absl::optional<size_t> size_; }; -// Interface which can provide the HlsManifestDemuxerEngine with data sources, -// given a URI and an optional byterange. This interface should be used via -// `base::SequenceBound` to proxy requests across the media thread and the main -// thread. +// Interface which can provide data sources, given a URI and an optional +// byterange. This interface should be used via `base::SequenceBound` to proxy +// requests across the media thread and the main thread. class MEDIA_EXPORT HlsDataSourceProvider { public: virtual ~HlsDataSourceProvider(); - - // Sets the owning HlsManifestDemuxerEngine for this HlsDataSourceProvider. - // This may only be called once. - virtual void SetOwner(HlsManifestDemuxerEngine*) = 0; - - // API allowing an HlsManifestDemuxerEngine to make requests for external - // data. using RequestCb = base::OnceCallback<void(std::unique_ptr<HlsDataSource>)>; virtual void RequestDataSource(GURL uri, absl::optional<hls::types::ByteRange> range,
diff --git a/media/filters/source_buffer_range.cc b/media/filters/source_buffer_range.cc index 07ec1317..1dcd0d3 100644 --- a/media/filters/source_buffer_range.cc +++ b/media/filters/source_buffer_range.cc
@@ -597,8 +597,7 @@ return result; } - NOTREACHED(); - return base::TimeDelta(); + NOTREACHED_NORETURN(); } base::TimeDelta SourceBufferRange::NextKeyframeTimestamp(
diff --git a/media/filters/source_buffer_stream.cc b/media/filters/source_buffer_stream.cc index d7412584..f0a4c04 100644 --- a/media/filters/source_buffer_stream.cc +++ b/media/filters/source_buffer_stream.cc
@@ -80,8 +80,7 @@ case SourceBufferStreamStatus::kEndOfStream: return "kEndOfStream"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } // Helper method for logging, converts a range into a readable string. @@ -150,8 +149,7 @@ return SourceBufferRange::ALLOW_GAPS; } - NOTREACHED(); - return SourceBufferRange::NO_GAPS_ALLOWED; + NOTREACHED_NORETURN(); } } // namespace @@ -1992,8 +1990,7 @@ case SourceBufferStreamType::kText: return "TEXT"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } SourceBufferStreamType SourceBufferStream::GetType() const {
diff --git a/media/filters/source_buffer_stream_unittest.cc b/media/filters/source_buffer_stream_unittest.cc index 81af440..20ae8d3 100644 --- a/media/filters/source_buffer_stream_unittest.cc +++ b/media/filters/source_buffer_stream_unittest.cc
@@ -447,10 +447,8 @@ return DemuxerStream::VIDEO; case SourceBufferStreamType::kText: return DemuxerStream::TEXT; - default: - NOTREACHED(); - return DemuxerStream::UNKNOWN; } + NOTREACHED_NORETURN(); } base::TimeDelta ConvertToFrameDuration(int frames_per_second) {
diff --git a/media/formats/hls/parse_status.cc b/media/formats/hls/parse_status.cc index 2d39136..a7c9585 100644 --- a/media/formats/hls/parse_status.cc +++ b/media/formats/hls/parse_status.cc
@@ -67,8 +67,7 @@ PARSE_STATUS_CODE_CASE(kRenditionGroupDoesNotExist); } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } #undef PARSE_STATUS_CODE_CASE
diff --git a/media/formats/hls/tag_name.cc b/media/formats/hls/tag_name.cc index 8c82bef..ab2a683f 100644 --- a/media/formats/hls/tag_name.cc +++ b/media/formats/hls/tag_name.cc
@@ -110,8 +110,7 @@ return TagKind::kMediaPlaylistTag; } - NOTREACHED(); - return TagKind::kMaxValue; + NOTREACHED_NORETURN(); } absl::optional<TagName> ParseTagName(base::StringPiece name) { @@ -131,8 +130,7 @@ } } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } } // namespace media::hls
diff --git a/media/formats/hls/tags.cc b/media/formats/hls/tags.cc index 826106a..9f91a6af 100644 --- a/media/formats/hls/tags.cc +++ b/media/formats/hls/tags.cc
@@ -68,8 +68,7 @@ return "VALUE"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } // Attributes expected in `EXT-X-MEDIA` tag contents. @@ -121,8 +120,7 @@ return "URI"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } // Attributes expected in `EXT-X-STREAM-INF` tag contents. @@ -162,8 +160,7 @@ return "SCORE"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } // Attributes expected in `EXT-X-MAP` tag contents. @@ -182,8 +179,7 @@ return "URI"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } // Attributes expected in `EXT-X-PART` tag contents. @@ -225,8 +221,7 @@ return "PART-TARGET"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } // Attributes expected in `EXT-X-SERVER-CONTROL` tag contents. @@ -255,8 +250,7 @@ return "PART-HOLD-BACK"; } - NOTREACHED(); - return ""; + NOTREACHED_NORETURN(); } template <typename T, size_t kLast>
diff --git a/media/formats/mp4/avc.cc b/media/formats/mp4/avc.cc index 9c268d0..40609a87 100644 --- a/media/formats/mp4/avc.cc +++ b/media/formats/mp4/avc.cc
@@ -55,8 +55,7 @@ if (p > ptr) return i; } - NOTREACHED(); - return 0; + NOTREACHED_NORETURN(); } // static
diff --git a/media/formats/mp4/mp4_stream_parser.cc b/media/formats/mp4/mp4_stream_parser.cc index 3bd040b..2d77942 100644 --- a/media/formats/mp4/mp4_stream_parser.cc +++ b/media/formats/mp4/mp4_stream_parser.cc
@@ -195,8 +195,7 @@ switch (state_) { case kWaitingForInit: case kError: - NOTREACHED(); - return ParseStatus::kFailed; + NOTREACHED_NORETURN(); case kParsingBoxes: { ParseResult pr = ParseBox();
diff --git a/media/fuchsia/video/fuchsia_video_decoder_unittest.cc b/media/fuchsia/video/fuchsia_video_decoder_unittest.cc index a331cfc..43073166 100644 --- a/media/fuchsia/video/fuchsia_video_decoder_unittest.cc +++ b/media/fuchsia/video/fuchsia_video_decoder_unittest.cc
@@ -380,23 +380,11 @@ ~FakeClientNativePixmap() override = default; // gfx::ClientNativePixmap implementation. - bool Map() override { - NOTREACHED(); - return false; - } + bool Map() override { NOTREACHED_NORETURN(); } void Unmap() override { NOTREACHED(); } - size_t GetNumberOfPlanes() const override { - NOTREACHED(); - return 0; - } - void* GetMemoryAddress(size_t plane) const override { - NOTREACHED(); - return nullptr; - } - int GetStride(size_t plane) const override { - NOTREACHED(); - return 0; - } + size_t GetNumberOfPlanes() const override { NOTREACHED_NORETURN(); } + void* GetMemoryAddress(size_t plane) const override { NOTREACHED_NORETURN(); } + int GetStride(size_t plane) const override { NOTREACHED_NORETURN(); } gfx::NativePixmapHandle CloneHandleForIPC() const override { return gfx::CloneHandleForIPC(handle_); }
diff --git a/media/gpu/android/codec_wrapper.cc b/media/gpu/android/codec_wrapper.cc index 35e33eb..496fe00 100644 --- a/media/gpu/android/codec_wrapper.cc +++ b/media/gpu/android/codec_wrapper.cc
@@ -242,8 +242,7 @@ case MEDIA_CODEC_OK: break; default: - NOTREACHED(); - return QueueStatus::kError; + NOTREACHED_NORETURN(); } } @@ -290,8 +289,7 @@ owned_input_buffer_ = input_buffer; return QueueStatus::kNoKey; default: - NOTREACHED(); - return QueueStatus::kError; + NOTREACHED_NORETURN(); } } @@ -382,8 +380,7 @@ continue; } case MEDIA_CODEC_NO_KEY: { - NOTREACHED(); - return DequeueStatus::kError; + NOTREACHED_NORETURN(); } } }
diff --git a/media/gpu/android/video_frame_factory_impl.cc b/media/gpu/android/video_frame_factory_impl.cc index b629ff3..88d4ff68 100644 --- a/media/gpu/android/video_frame_factory_impl.cc +++ b/media/gpu/android/video_frame_factory_impl.cc
@@ -49,8 +49,7 @@ return gpu::TextureOwner::Mode::kAImageReaderInsecureSurfaceControl; } - NOTREACHED(); - return gpu::TextureOwner::Mode::kSurfaceTextureInsecure; + NOTREACHED_NORETURN(); } // Run on the GPU main thread to allocate the texture owner, and return it
diff --git a/media/gpu/av1_decoder.cc b/media/gpu/av1_decoder.cc index 98ab17a1..5e429581 100644 --- a/media/gpu/av1_decoder.cc +++ b/media/gpu/av1_decoder.cc
@@ -66,8 +66,7 @@ case AV1PROFILE_PROFILE_PRO: return bit_depth == 8u || bit_depth == 10u || bit_depth == 12u; default: - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }
diff --git a/media/gpu/chromeos/oop_video_decoder.cc b/media/gpu/chromeos/oop_video_decoder.cc index 4af612e6..1afc2df 100644 --- a/media/gpu/chromeos/oop_video_decoder.cc +++ b/media/gpu/chromeos/oop_video_decoder.cc
@@ -761,13 +761,11 @@ } void OOPVideoDecoder::ApplyResolutionChange() { - NOTREACHED(); + NOTREACHED_NORETURN(); } bool OOPVideoDecoder::NeedsBitstreamConversion() const { - NOTIMPLEMENTED(); - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } bool OOPVideoDecoder::CanReadWithoutStalling() const { @@ -790,9 +788,7 @@ } int OOPVideoDecoder::GetMaxDecodeRequests() const { - NOTIMPLEMENTED(); - NOTREACHED(); - return 4; + NOTREACHED_NORETURN(); } VideoDecoderType OOPVideoDecoder::GetDecoderType() const { @@ -803,9 +799,7 @@ } bool OOPVideoDecoder::IsPlatformDecoder() const { - NOTIMPLEMENTED(); - NOTREACHED(); - return true; + NOTREACHED_NORETURN(); } bool OOPVideoDecoder::NeedsTranscryption() {
diff --git a/media/gpu/h264_decoder.cc b/media/gpu/h264_decoder.cc index 75c14e5..4c31ac0 100644 --- a/media/gpu/h264_decoder.cc +++ b/media/gpu/h264_decoder.cc
@@ -76,8 +76,7 @@ // Spec H.10.1.1 and H.10.1.2. return bit_depth == 8u; default: - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } } } // namespace @@ -1763,8 +1762,7 @@ break; default: - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } return true; }
diff --git a/media/gpu/ipc/service/picture_buffer_manager.cc b/media/gpu/ipc/service/picture_buffer_manager.cc index 0d76f42..534863a 100644 --- a/media/gpu/ipc/service/picture_buffer_manager.cc +++ b/media/gpu/ipc/service/picture_buffer_manager.cc
@@ -181,8 +181,7 @@ picture_data.gpu_memory_buffer_video_frame = std::move(gpu_memory_buffer_video_frame); #else - NOTREACHED(); - return {}; + NOTREACHED_NORETURN(); #endif // BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC) }
diff --git a/media/gpu/mac/gl_image_io_surface.mm b/media/gpu/mac/gl_image_io_surface.mm index 0413e93..674ada5 100644 --- a/media/gpu/mac/gl_image_io_surface.mm +++ b/media/gpu/mac/gl_image_io_surface.mm
@@ -26,8 +26,7 @@ default: break; } - NOTREACHED(); - return nullptr; + NOTREACHED_NORETURN(); } GLImageIOSurface::GLImageIOSurface(const gfx::Size& size) : size_(size) {}
diff --git a/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc b/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc index def6c04..31336072 100644 --- a/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc +++ b/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc
@@ -80,8 +80,7 @@ VaapiWrapper::PreSandboxInitialization(/*allow_disabling_global_lock=*/true); return true; #else - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); #endif // BUILDFLAG(USE_VAAPI) } @@ -109,8 +108,7 @@ VaapiWrapper::PreSandboxInitialization(/*allow_disabling_global_lock=*/true); return true; #else - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); #endif // BUILDFLAG(USE_VAAPI) } @@ -164,8 +162,7 @@ #endif // BUILDFLAG(USE_LIBV4L2) return true; #else - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); #endif // BUILDFLAG(USE_V4L2_CODEC) }
diff --git a/media/gpu/test/video_test_helpers.cc b/media/gpu/test/video_test_helpers.cc index a68551501..83509cc 100644 --- a/media/gpu/test/video_test_helpers.cc +++ b/media/gpu/test/video_test_helpers.cc
@@ -172,8 +172,7 @@ case VideoCodec::kAV1: return GetNextFrame(); default: - NOTREACHED(); - return nullptr; + NOTREACHED_NORETURN(); } }
diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn index 482344e..a976c194 100644 --- a/media/gpu/v4l2/BUILD.gn +++ b/media/gpu/v4l2/BUILD.gn
@@ -26,8 +26,6 @@ sources = [ "buffer_affinity_tracker.cc", "buffer_affinity_tracker.h", - "generic_v4l2_device.cc", - "generic_v4l2_device.h", "legacy/v4l2_slice_video_decode_accelerator.cc", "legacy/v4l2_slice_video_decode_accelerator.h", "legacy/v4l2_stateful_workaround.cc",
diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc deleted file mode 100644 index 20cc4576..0000000 --- a/media/gpu/v4l2/generic_v4l2_device.cc +++ /dev/null
@@ -1,508 +0,0 @@ -// Copyright 2014 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// - -#include "media/gpu/v4l2/generic_v4l2_device.h" - -#include <errno.h> -#include <fcntl.h> -#include <libdrm/drm_fourcc.h> -#include <linux/videodev2.h> -#include <poll.h> -#include <string.h> -#include <sys/eventfd.h> -#include <sys/ioctl.h> -#include <sys/mman.h> - -#include <memory> - -#include "base/containers/contains.h" -#include "base/files/scoped_file.h" -#include "base/posix/eintr_wrapper.h" -#include "base/strings/stringprintf.h" -#include "base/trace_event/trace_event.h" -#include "build/build_config.h" -#include "gpu/command_buffer/service/shared_image/gl_image_native_pixmap.h" -#include "media/base/video_types.h" -#include "media/gpu/buildflags.h" -#include "media/gpu/chromeos/fourcc.h" -#include "media/gpu/macros.h" -#include "media/gpu/v4l2/generic_v4l2_device.h" -#include "media/gpu/v4l2/v4l2_utils.h" -#include "ui/gfx/native_pixmap.h" -#include "ui/gfx/native_pixmap_handle.h" -#include "ui/gl/egl_util.h" -#include "ui/gl/gl_bindings.h" - -// Auto-generated for dlopen libv4l2 libraries -#include "media/gpu/v4l2/v4l2_stubs.h" -#include "third_party/v4l-utils/lib/include/libv4l2.h" - -using media_gpu_v4l2::InitializeStubs; -using media_gpu_v4l2::kModuleV4l2; -using media_gpu_v4l2::StubPathMap; - -namespace media { - -namespace { - -uint32_t V4L2PixFmtToDrmFormat(uint32_t format) { - switch (format) { - case V4L2_PIX_FMT_NV12: - case V4L2_PIX_FMT_NV12M: - return DRM_FORMAT_NV12; - - case V4L2_PIX_FMT_YUV420: - case V4L2_PIX_FMT_YUV420M: - return DRM_FORMAT_YUV420; - - case V4L2_PIX_FMT_YVU420: - return DRM_FORMAT_YVU420; - - case V4L2_PIX_FMT_RGB32: - return DRM_FORMAT_ARGB8888; - - default: - DVLOGF(1) << "Unrecognized format " << FourccToString(format); - return 0; - } -} - -} // namespace - -GenericV4L2Device::GenericV4L2Device() { - use_libv4l2_ = false; -} - -GenericV4L2Device::~GenericV4L2Device() { - CloseDevice(); -} - -int GenericV4L2Device::Ioctl(int request, void* arg) { - DCHECK(device_fd_.is_valid()); - - if (use_libv4l2_) - return HANDLE_EINTR(v4l2_ioctl(device_fd_.get(), request, arg)); - - return HANDLE_EINTR(ioctl(device_fd_.get(), request, arg)); -} - -bool GenericV4L2Device::Poll(bool poll_device, bool* event_pending) { - struct pollfd pollfds[2]; - nfds_t nfds; - int pollfd = -1; - - pollfds[0].fd = device_poll_interrupt_fd_.get(); - pollfds[0].events = POLLIN | POLLERR; - nfds = 1; - - if (poll_device) { - DVLOGF(5) << "adding device fd to poll() set"; - pollfds[nfds].fd = device_fd_.get(); - pollfds[nfds].events = POLLIN | POLLOUT | POLLERR | POLLPRI; - pollfd = nfds; - nfds++; - } - - if (HANDLE_EINTR(poll(pollfds, nfds, -1)) == -1) { - VPLOGF(1) << "poll() failed"; - return false; - } - *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLPRI); - return true; -} - -void* GenericV4L2Device::Mmap(void* addr, - unsigned int len, - int prot, - int flags, - unsigned int offset) { - DCHECK(device_fd_.is_valid()); - return mmap(addr, len, prot, flags, device_fd_.get(), offset); -} - -void GenericV4L2Device::Munmap(void* addr, unsigned int len) { - munmap(addr, len); -} - -bool GenericV4L2Device::SetDevicePollInterrupt() { - DVLOGF(4); - - const uint64_t buf = 1; - if (HANDLE_EINTR(write(device_poll_interrupt_fd_.get(), &buf, sizeof(buf))) == - -1) { - VPLOGF(1) << "write() failed"; - return false; - } - return true; -} - -bool GenericV4L2Device::ClearDevicePollInterrupt() { - DVLOGF(5); - - uint64_t buf; - if (HANDLE_EINTR(read(device_poll_interrupt_fd_.get(), &buf, sizeof(buf))) == - -1) { - if (errno == EAGAIN) { - // No interrupt flag set, and we're reading nonblocking. Not an error. - return true; - } else { - VPLOGF(1) << "read() failed"; - return false; - } - } - return true; -} - -bool GenericV4L2Device::Initialize() { - DVLOGF(3); - static bool v4l2_functions_initialized = PostSandboxInitialization(); - if (!v4l2_functions_initialized) { - VLOGF(1) << "Failed to initialize LIBV4L2 libs"; - return false; - } - - return true; -} - -bool GenericV4L2Device::Open(Type type, uint32_t v4l2_pixfmt) { - DVLOGF(3); - std::string path = GetDevicePathFor(type, v4l2_pixfmt); - - if (path.empty()) { - VLOGF(1) << "No devices supporting " << FourccToString(v4l2_pixfmt) - << " for type: " << static_cast<int>(type); - return false; - } - - if (!OpenDevicePath(path, type)) { - VLOGF(1) << "Failed opening " << path; - return false; - } - - device_poll_interrupt_fd_.reset(eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC)); - if (!device_poll_interrupt_fd_.is_valid()) { - VLOGF(1) << "Failed creating a poll interrupt fd"; - return false; - } - - return true; -} - -std::vector<base::ScopedFD> GenericV4L2Device::GetDmabufsForV4L2Buffer( - int index, - size_t num_planes, - enum v4l2_buf_type buf_type) { - DVLOGF(3); - DCHECK(V4L2_TYPE_IS_MULTIPLANAR(buf_type)); - - std::vector<base::ScopedFD> dmabuf_fds; - for (size_t i = 0; i < num_planes; ++i) { - struct v4l2_exportbuffer expbuf; - memset(&expbuf, 0, sizeof(expbuf)); - expbuf.type = buf_type; - expbuf.index = index; - expbuf.plane = i; - expbuf.flags = O_CLOEXEC; - if (Ioctl(VIDIOC_EXPBUF, &expbuf) != 0) { - dmabuf_fds.clear(); - break; - } - - dmabuf_fds.push_back(base::ScopedFD(expbuf.fd)); - } - - return dmabuf_fds; -} - -bool GenericV4L2Device::CanCreateEGLImageFrom(const Fourcc fourcc) const { - static uint32_t kEGLImageDrmFmtsSupported[] = { - DRM_FORMAT_ARGB8888, -#if defined(ARCH_CPU_ARM_FAMILY) - DRM_FORMAT_NV12, - DRM_FORMAT_YVU420, -#endif - }; - - return base::Contains(kEGLImageDrmFmtsSupported, - V4L2PixFmtToDrmFormat(fourcc.ToV4L2PixFmt())); -} - -EGLImageKHR GenericV4L2Device::CreateEGLImage( - EGLDisplay egl_display, - EGLContext /* egl_context */, - GLuint texture_id, - const gfx::Size& size, - unsigned int buffer_index, - const Fourcc fourcc, - gfx::NativePixmapHandle handle) const { - DVLOGF(3); - - if (!CanCreateEGLImageFrom(fourcc)) { - VLOGF(1) << "Unsupported V4L2 pixel format"; - return EGL_NO_IMAGE_KHR; - } - - // Number of components, as opposed to the number of V4L2 planes, which is - // just a buffer count. - const size_t num_planes = handle.planes.size(); - DCHECK_LE(num_planes, 3u); - - std::vector<EGLint> attrs; - attrs.push_back(EGL_WIDTH); - attrs.push_back(size.width()); - attrs.push_back(EGL_HEIGHT); - attrs.push_back(size.height()); - attrs.push_back(EGL_LINUX_DRM_FOURCC_EXT); - attrs.push_back(V4L2PixFmtToDrmFormat(fourcc.ToV4L2PixFmt())); - - for (size_t plane = 0; plane < num_planes; ++plane) { - attrs.push_back(EGL_DMA_BUF_PLANE0_FD_EXT + plane * 3); - attrs.push_back(handle.planes[plane].fd.get()); - attrs.push_back(EGL_DMA_BUF_PLANE0_OFFSET_EXT + plane * 3); - attrs.push_back(handle.planes[plane].offset); - attrs.push_back(EGL_DMA_BUF_PLANE0_PITCH_EXT + plane * 3); - attrs.push_back(handle.planes[plane].stride); - } - - attrs.push_back(EGL_NONE); - - EGLImageKHR egl_image = eglCreateImageKHR( - egl_display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, NULL, &attrs[0]); - if (egl_image == EGL_NO_IMAGE_KHR) { - VLOGF(1) << "Failed creating EGL image: " << ui::GetLastEGLErrorString(); - return egl_image; - } - glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture_id); - glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, egl_image); - - return egl_image; -} - -EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, - EGLImageKHR egl_image) const { - DVLOGF(3); - EGLBoolean result = eglDestroyImageKHR(egl_display, egl_image); - if (result != EGL_TRUE) { - LOG(WARNING) << "Destroy EGLImage failed."; - } - return result; -} - -GLenum GenericV4L2Device::GetTextureTarget() const { - return GL_TEXTURE_EXTERNAL_OES; -} - -std::vector<uint32_t> GenericV4L2Device::PreferredInputFormat(Type type) const { - if (type == Type::kEncoder) - return {V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_NV12}; - - return {}; -} - -std::vector<uint32_t> GenericV4L2Device::GetSupportedImageProcessorPixelformats( - v4l2_buf_type buf_type) { - std::vector<uint32_t> supported_pixelformats; - - Type type = Type::kImageProcessor; - const auto& devices = GetDevicesForType(type); - for (const auto& device : devices) { - if (!OpenDevicePath(device.first, type)) { - VLOGF(1) << "Failed opening " << device.first; - continue; - } - - const auto pixelformats = EnumerateSupportedPixFmts( - base::BindRepeating(&V4L2Device::Ioctl, this), buf_type); - - supported_pixelformats.insert(supported_pixelformats.end(), - pixelformats.begin(), pixelformats.end()); - CloseDevice(); - } - - return supported_pixelformats; -} - -VideoDecodeAccelerator::SupportedProfiles -GenericV4L2Device::GetSupportedDecodeProfiles( - const std::vector<uint32_t>& pixelformats) { - VideoDecodeAccelerator::SupportedProfiles supported_profiles; - - Type type = Type::kDecoder; - const auto& devices = GetDevicesForType(type); - for (const auto& device : devices) { - if (!OpenDevicePath(device.first, type)) { - VLOGF(1) << "Failed opening " << device.first; - continue; - } - - const auto& profiles = EnumerateSupportedDecodeProfiles(pixelformats); - supported_profiles.insert(supported_profiles.end(), profiles.begin(), - profiles.end()); - CloseDevice(); - } - - return supported_profiles; -} - -VideoEncodeAccelerator::SupportedProfiles -GenericV4L2Device::GetSupportedEncodeProfiles() { - VideoEncodeAccelerator::SupportedProfiles supported_profiles; - - Type type = Type::kEncoder; - const auto& devices = GetDevicesForType(type); - for (const auto& device : devices) { - if (!OpenDevicePath(device.first, type)) { - VLOGF(1) << "Failed opening " << device.first; - continue; - } - - const auto& profiles = EnumerateSupportedEncodeProfiles(); - supported_profiles.insert(supported_profiles.end(), profiles.begin(), - profiles.end()); - CloseDevice(); - } - - return supported_profiles; -} - -bool GenericV4L2Device::IsImageProcessingSupported() { - const auto& devices = GetDevicesForType(Type::kImageProcessor); - return !devices.empty(); -} - -bool GenericV4L2Device::IsJpegDecodingSupported() { - const auto& devices = GetDevicesForType(Type::kJpegDecoder); - return !devices.empty(); -} - -bool GenericV4L2Device::IsJpegEncodingSupported() { - const auto& devices = GetDevicesForType(Type::kJpegEncoder); - return !devices.empty(); -} - -bool GenericV4L2Device::OpenDevicePath(const std::string& path, Type type) { - DCHECK(!device_fd_.is_valid()); - - device_fd_.reset( - HANDLE_EINTR(open(path.c_str(), O_RDWR | O_NONBLOCK | O_CLOEXEC))); - if (!device_fd_.is_valid()) - return false; - - if (V4L2Device::UseLibV4L2()) { - if (type == Type::kEncoder && - HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) != - -1) { - DVLOGF(3) << "Using libv4l2 for " << path; - use_libv4l2_ = true; - } - } - return true; -} - -void GenericV4L2Device::CloseDevice() { - DVLOGF(3); - if (use_libv4l2_ && device_fd_.is_valid()) - v4l2_close(device_fd_.release()); - device_fd_.reset(); -} - -// static -bool GenericV4L2Device::PostSandboxInitialization() { - if (V4L2Device::UseLibV4L2()) { - StubPathMap paths; - paths[kModuleV4l2].push_back(V4L2Device::kLibV4l2Path); - - return InitializeStubs(paths); - } else { - return true; - } -} - -void GenericV4L2Device::EnumerateDevicesForType(Type type) { - static const std::string kDecoderDevicePattern = "/dev/video-dec"; - static const std::string kEncoderDevicePattern = "/dev/video-enc"; - static const std::string kImageProcessorDevicePattern = "/dev/image-proc"; - static const std::string kJpegDecoderDevicePattern = "/dev/jpeg-dec"; - static const std::string kJpegEncoderDevicePattern = "/dev/jpeg-enc"; - - std::string device_pattern; - v4l2_buf_type buf_type; - switch (type) { - case Type::kDecoder: - device_pattern = kDecoderDevicePattern; - buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; - break; - case Type::kEncoder: - device_pattern = kEncoderDevicePattern; - buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; - break; - case Type::kImageProcessor: - device_pattern = kImageProcessorDevicePattern; - buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; - break; - case Type::kJpegDecoder: - device_pattern = kJpegDecoderDevicePattern; - buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; - break; - case Type::kJpegEncoder: - device_pattern = kJpegEncoderDevicePattern; - buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; - break; - } - - std::vector<std::string> candidate_paths; - - // TODO(posciak): Remove this legacy unnumbered device once - // all platforms are updated to use numbered devices. - candidate_paths.push_back(device_pattern); - - // We are sandboxed, so we can't query directory contents to check which - // devices are actually available. Try to open the first 10; if not present, - // we will just fail to open immediately. - for (int i = 0; i < 10; ++i) { - candidate_paths.push_back( - base::StringPrintf("%s%d", device_pattern.c_str(), i)); - } - - Devices devices; - for (const auto& path : candidate_paths) { - if (!OpenDevicePath(path, type)) - continue; - const auto supported_pixelformats = EnumerateSupportedPixFmts( - base::BindRepeating(&V4L2Device::Ioctl, this), buf_type); - - if (!supported_pixelformats.empty()) { - DVLOGF(3) << "Found device: " << path; - devices.push_back(std::make_pair(path, supported_pixelformats)); - } - - CloseDevice(); - } - - DCHECK_EQ(devices_by_type_.count(type), 0u); - devices_by_type_[type] = devices; -} - -const GenericV4L2Device::Devices& GenericV4L2Device::GetDevicesForType( - Type type) { - if (devices_by_type_.count(type) == 0) - EnumerateDevicesForType(type); - - DCHECK_NE(devices_by_type_.count(type), 0u); - return devices_by_type_[type]; -} - -std::string GenericV4L2Device::GetDevicePathFor(Type type, uint32_t pixfmt) { - const Devices& devices = GetDevicesForType(type); - - for (const auto& device : devices) { - if (base::Contains(device.second, pixfmt)) - return device.first; - } - - return std::string(); -} - -} // namespace media
diff --git a/media/gpu/v4l2/generic_v4l2_device.h b/media/gpu/v4l2/generic_v4l2_device.h deleted file mode 100644 index 1aa4a9c..0000000 --- a/media/gpu/v4l2/generic_v4l2_device.h +++ /dev/null
@@ -1,126 +0,0 @@ -// Copyright 2014 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// This file contains the implementation of GenericV4L2Device used on -// platforms, which provide generic V4L2 video codec devices. - -#ifndef MEDIA_GPU_V4L2_GENERIC_V4L2_DEVICE_H_ -#define MEDIA_GPU_V4L2_GENERIC_V4L2_DEVICE_H_ - -#include <stddef.h> -#include <stdint.h> - -#include <map> -#include <vector> - -#include "base/files/scoped_file.h" -#include "media/gpu/buildflags.h" -#include "media/gpu/v4l2/v4l2_device.h" -#include "ui/gfx/native_pixmap_handle.h" - -namespace media { - -class GenericV4L2Device : public V4L2Device { - public: - GenericV4L2Device(); - - GenericV4L2Device(const GenericV4L2Device&) = delete; - GenericV4L2Device& operator=(const GenericV4L2Device&) = delete; - - // V4L2Device implementation. - bool Open(Type type, uint32_t v4l2_pixfmt) override; - int Ioctl(int request, void* arg) override; - bool Poll(bool poll_device, bool* event_pending) override; - bool SetDevicePollInterrupt() override; - bool ClearDevicePollInterrupt() override; - void* Mmap(void* addr, - unsigned int len, - int prot, - int flags, - unsigned int offset) override; - void Munmap(void* addr, unsigned int len) override; - - std::vector<base::ScopedFD> GetDmabufsForV4L2Buffer( - int index, - size_t num_planes, - enum v4l2_buf_type buf_type) override; - - bool CanCreateEGLImageFrom(const Fourcc fourcc) const override; - EGLImageKHR CreateEGLImage(EGLDisplay egl_display, - EGLContext egl_context, - GLuint texture_id, - const gfx::Size& size, - unsigned int buffer_index, - const Fourcc fourcc, - gfx::NativePixmapHandle handle) const override; - - EGLBoolean DestroyEGLImage(EGLDisplay egl_display, - EGLImageKHR egl_image) const override; - GLenum GetTextureTarget() const override; - std::vector<uint32_t> PreferredInputFormat(Type type) const override; - - std::vector<uint32_t> GetSupportedImageProcessorPixelformats( - v4l2_buf_type buf_type) override; - - VideoDecodeAccelerator::SupportedProfiles GetSupportedDecodeProfiles( - const std::vector<uint32_t>& pixelformats) override; - - VideoEncodeAccelerator::SupportedProfiles GetSupportedEncodeProfiles() - override; - - bool IsImageProcessingSupported() override; - - bool IsJpegDecodingSupported() override; - bool IsJpegEncodingSupported() override; - - protected: - ~GenericV4L2Device() override; - - bool Initialize() override; - - private: - // Vector of video device node paths and corresponding pixelformats supported - // by each device node. - using Devices = std::vector<std::pair<std::string, std::vector<uint32_t>>>; - - // Open device node for |path| as a device of |type|. - bool OpenDevicePath(const std::string& path, Type type); - - // Close the currently open device. - void CloseDevice(); - - // Enumerate all V4L2 devices on the system for |type| and store the results - // under devices_by_type_[type]. - void EnumerateDevicesForType(V4L2Device::Type type); - - // Return device information for all devices of |type| available in the - // system. Enumerates and queries devices on first run and caches the results - // for subsequent calls. - const Devices& GetDevicesForType(V4L2Device::Type type); - - // Return device node path for device of |type| supporting |pixfmt|, or - // an empty string if the given combination is not supported by the system. - std::string GetDevicePathFor(V4L2Device::Type type, uint32_t pixfmt); - - // Stores information for all devices available on the system - // for each device Type. - std::map<V4L2Device::Type, Devices> devices_by_type_; - - // The actual device fd. - base::ScopedFD device_fd_; - - // eventfd fd to signal device poll thread when its poll() should be - // interrupted. - base::ScopedFD device_poll_interrupt_fd_; - - // Use libv4l2 when operating |device_fd_|. - bool use_libv4l2_; - - // Lazily initialize static data after sandbox is enabled. Return false on - // init failure. - static bool PostSandboxInitialization(); -}; -} // namespace media - -#endif // MEDIA_GPU_V4L2_GENERIC_V4L2_DEVICE_H_
diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc index da59d39..149229e 100644 --- a/media/gpu/v4l2/v4l2_device.cc +++ b/media/gpu/v4l2/v4l2_device.cc
@@ -8,6 +8,7 @@ #include <fcntl.h> #include <linux/media.h> #include <poll.h> +#include <sys/eventfd.h> #include <sys/ioctl.h> #include <unistd.h> @@ -36,10 +37,18 @@ #include "media/gpu/chromeos/platform_video_frame_utils.h" #include "media/gpu/macros.h" #include "media/gpu/v4l2/buffer_affinity_tracker.h" -#include "media/gpu/v4l2/generic_v4l2_device.h" #include "media/gpu/v4l2/v4l2_utils.h" #include "ui/gfx/generic_shared_memory_id.h" #include "ui/gfx/native_pixmap_handle.h" +#include "ui/gl/egl_util.h" + +// Auto-generated for dlopen libv4l2 libraries +#include "media/gpu/v4l2/v4l2_stubs.h" +#include "third_party/v4l-utils/lib/include/libv4l2.h" + +using media_gpu_v4l2::InitializeStubs; +using media_gpu_v4l2::kModuleV4l2; +using media_gpu_v4l2::StubPathMap; namespace media { @@ -143,6 +152,28 @@ #endif } +uint32_t V4L2PixFmtToDrmFormat(uint32_t format) { + switch (format) { + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV12M: + return DRM_FORMAT_NV12; + + case V4L2_PIX_FMT_YUV420: + case V4L2_PIX_FMT_YUV420M: + return DRM_FORMAT_YUV420; + + case V4L2_PIX_FMT_YVU420: + return DRM_FORMAT_YVU420; + + case V4L2_PIX_FMT_RGB32: + return DRM_FORMAT_ARGB8888; + + default: + DVLOGF(1) << "Unrecognized format " << FourccToString(format); + return 0; + } +} + } // namespace V4L2ExtCtrl::V4L2ExtCtrl(uint32_t id) { @@ -1488,7 +1519,9 @@ DETACH_FROM_SEQUENCE(client_sequence_checker_); } -V4L2Device::~V4L2Device() = default; +V4L2Device::~V4L2Device() { + CloseDevice(); +} scoped_refptr<V4L2Queue> V4L2Device::GetQueue(enum v4l2_buf_type type) { DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_); @@ -1528,9 +1561,7 @@ scoped_refptr<V4L2Device> V4L2Device::Create() { DVLOGF(3); - scoped_refptr<V4L2Device> device; - - device = new GenericV4L2Device(); + scoped_refptr<V4L2Device> device = new V4L2Device(); if (device->Initialize()) return device; @@ -1538,6 +1569,30 @@ return nullptr; } +bool V4L2Device::Open(Type type, uint32_t v4l2_pixfmt) { + DVLOGF(3); + std::string path = GetDevicePathFor(type, v4l2_pixfmt); + + if (path.empty()) { + VLOGF(1) << "No devices supporting " << FourccToString(v4l2_pixfmt) + << " for type: " << static_cast<int>(type); + return false; + } + + if (!OpenDevicePath(path, type)) { + VLOGF(1) << "Failed opening " << path; + return false; + } + + device_poll_interrupt_fd_.reset(eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC)); + if (!device_poll_interrupt_fd_.is_valid()) { + VLOGF(1) << "Failed creating a poll interrupt fd"; + return false; + } + + return true; +} + std::string V4L2Device::GetDriverName() { struct v4l2_capability caps; memset(&caps, 0, sizeof(caps)); @@ -1858,6 +1913,205 @@ return use_libv4l2; } +int V4L2Device::Ioctl(int request, void* arg) { + DCHECK(device_fd_.is_valid()); + + if (use_libv4l2_) { + return HANDLE_EINTR(v4l2_ioctl(device_fd_.get(), request, arg)); + } + + return HANDLE_EINTR(ioctl(device_fd_.get(), request, arg)); +} + +bool V4L2Device::Poll(bool poll_device, bool* event_pending) { + struct pollfd pollfds[2]; + nfds_t nfds; + int pollfd = -1; + + pollfds[0].fd = device_poll_interrupt_fd_.get(); + pollfds[0].events = POLLIN | POLLERR; + nfds = 1; + + if (poll_device) { + DVLOGF(5) << "adding device fd to poll() set"; + pollfds[nfds].fd = device_fd_.get(); + pollfds[nfds].events = POLLIN | POLLOUT | POLLERR | POLLPRI; + pollfd = nfds; + nfds++; + } + + if (HANDLE_EINTR(poll(pollfds, nfds, -1)) == -1) { + VPLOGF(1) << "poll() failed"; + return false; + } + *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLPRI); + return true; +} + +void* V4L2Device::Mmap(void* addr, + unsigned int len, + int prot, + int flags, + unsigned int offset) { + DCHECK(device_fd_.is_valid()); + return mmap(addr, len, prot, flags, device_fd_.get(), offset); +} + +void V4L2Device::Munmap(void* addr, unsigned int len) { + munmap(addr, len); +} + +bool V4L2Device::SetDevicePollInterrupt() { + DVLOGF(4); + + const uint64_t buf = 1; + if (HANDLE_EINTR(write(device_poll_interrupt_fd_.get(), &buf, sizeof(buf))) == + -1) { + VPLOGF(1) << "write() failed"; + return false; + } + return true; +} + +bool V4L2Device::ClearDevicePollInterrupt() { + DVLOGF(5); + + uint64_t buf; + if (HANDLE_EINTR(read(device_poll_interrupt_fd_.get(), &buf, sizeof(buf))) == + -1) { + if (errno == EAGAIN) { + // No interrupt flag set, and we're reading nonblocking. Not an error. + return true; + } else { + VPLOGF(1) << "read() failed"; + return false; + } + } + return true; +} + +bool V4L2Device::Initialize() { + DVLOGF(3); + static bool v4l2_functions_initialized = PostSandboxInitialization(); + if (!v4l2_functions_initialized) { + VLOGF(1) << "Failed to initialize LIBV4L2 libs"; + return false; + } + + return true; +} + +std::vector<base::ScopedFD> V4L2Device::GetDmabufsForV4L2Buffer( + int index, + size_t num_planes, + enum v4l2_buf_type buf_type) { + DVLOGF(3); + DCHECK(V4L2_TYPE_IS_MULTIPLANAR(buf_type)); + + std::vector<base::ScopedFD> dmabuf_fds; + for (size_t i = 0; i < num_planes; ++i) { + struct v4l2_exportbuffer expbuf; + memset(&expbuf, 0, sizeof(expbuf)); + expbuf.type = buf_type; + expbuf.index = index; + expbuf.plane = i; + expbuf.flags = O_CLOEXEC; + if (Ioctl(VIDIOC_EXPBUF, &expbuf) != 0) { + dmabuf_fds.clear(); + break; + } + + dmabuf_fds.push_back(base::ScopedFD(expbuf.fd)); + } + + return dmabuf_fds; +} + +bool V4L2Device::CanCreateEGLImageFrom(const Fourcc fourcc) const { + static uint32_t kEGLImageDrmFmtsSupported[] = { + DRM_FORMAT_ARGB8888, +#if defined(ARCH_CPU_ARM_FAMILY) + DRM_FORMAT_NV12, + DRM_FORMAT_YVU420, +#endif + }; + + return base::Contains(kEGLImageDrmFmtsSupported, + V4L2PixFmtToDrmFormat(fourcc.ToV4L2PixFmt())); +} + +EGLImageKHR V4L2Device::CreateEGLImage(EGLDisplay egl_display, + EGLContext /* egl_context */, + GLuint texture_id, + const gfx::Size& size, + unsigned int buffer_index, + const Fourcc fourcc, + gfx::NativePixmapHandle handle) const { + DVLOGF(3); + + if (!CanCreateEGLImageFrom(fourcc)) { + VLOGF(1) << "Unsupported V4L2 pixel format"; + return EGL_NO_IMAGE_KHR; + } + + // Number of components, as opposed to the number of V4L2 planes, which is + // just a buffer count. + const size_t num_planes = handle.planes.size(); + DCHECK_LE(num_planes, 3u); + + std::vector<EGLint> attrs; + attrs.push_back(EGL_WIDTH); + attrs.push_back(size.width()); + attrs.push_back(EGL_HEIGHT); + attrs.push_back(size.height()); + attrs.push_back(EGL_LINUX_DRM_FOURCC_EXT); + attrs.push_back(V4L2PixFmtToDrmFormat(fourcc.ToV4L2PixFmt())); + + for (size_t plane = 0; plane < num_planes; ++plane) { + attrs.push_back(EGL_DMA_BUF_PLANE0_FD_EXT + plane * 3); + attrs.push_back(handle.planes[plane].fd.get()); + attrs.push_back(EGL_DMA_BUF_PLANE0_OFFSET_EXT + plane * 3); + attrs.push_back(handle.planes[plane].offset); + attrs.push_back(EGL_DMA_BUF_PLANE0_PITCH_EXT + plane * 3); + attrs.push_back(handle.planes[plane].stride); + } + + attrs.push_back(EGL_NONE); + + EGLImageKHR egl_image = eglCreateImageKHR( + egl_display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, NULL, &attrs[0]); + if (egl_image == EGL_NO_IMAGE_KHR) { + VLOGF(1) << "Failed creating EGL image: " << ui::GetLastEGLErrorString(); + return egl_image; + } + glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture_id); + glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, egl_image); + + return egl_image; +} + +EGLBoolean V4L2Device::DestroyEGLImage(EGLDisplay egl_display, + EGLImageKHR egl_image) const { + DVLOGF(3); + EGLBoolean result = eglDestroyImageKHR(egl_display, egl_image); + if (result != EGL_TRUE) { + LOG(WARNING) << "Destroy EGLImage failed."; + } + return result; +} + +GLenum V4L2Device::GetTextureTarget() const { + return GL_TEXTURE_EXTERNAL_OES; +} + +std::vector<uint32_t> V4L2Device::PreferredInputFormat(Type type) const { + if (type == Type::kEncoder) { + return {V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_NV12}; + } + + return {}; +} + void V4L2Device::GetSupportedResolution(uint32_t pixelformat, gfx::Size* min_resolution, gfx::Size* max_resolution) { @@ -1945,6 +2199,87 @@ return rate_control_mode; } +std::vector<uint32_t> V4L2Device::GetSupportedImageProcessorPixelformats( + v4l2_buf_type buf_type) { + std::vector<uint32_t> supported_pixelformats; + + Type type = Type::kImageProcessor; + const auto& devices = GetDevicesForType(type); + for (const auto& device : devices) { + if (!OpenDevicePath(device.first, type)) { + VLOGF(1) << "Failed opening " << device.first; + continue; + } + + const auto pixelformats = EnumerateSupportedPixFmts( + base::BindRepeating(&V4L2Device::Ioctl, this), buf_type); + + supported_pixelformats.insert(supported_pixelformats.end(), + pixelformats.begin(), pixelformats.end()); + CloseDevice(); + } + + return supported_pixelformats; +} + +VideoDecodeAccelerator::SupportedProfiles +V4L2Device::GetSupportedDecodeProfiles( + const std::vector<uint32_t>& pixelformats) { + VideoDecodeAccelerator::SupportedProfiles supported_profiles; + + Type type = Type::kDecoder; + const auto& devices = GetDevicesForType(type); + for (const auto& device : devices) { + if (!OpenDevicePath(device.first, type)) { + VLOGF(1) << "Failed opening " << device.first; + continue; + } + + const auto& profiles = EnumerateSupportedDecodeProfiles(pixelformats); + supported_profiles.insert(supported_profiles.end(), profiles.begin(), + profiles.end()); + CloseDevice(); + } + + return supported_profiles; +} + +VideoEncodeAccelerator::SupportedProfiles +V4L2Device::GetSupportedEncodeProfiles() { + VideoEncodeAccelerator::SupportedProfiles supported_profiles; + + Type type = Type::kEncoder; + const auto& devices = GetDevicesForType(type); + for (const auto& device : devices) { + if (!OpenDevicePath(device.first, type)) { + VLOGF(1) << "Failed opening " << device.first; + continue; + } + + const auto& profiles = EnumerateSupportedEncodeProfiles(); + supported_profiles.insert(supported_profiles.end(), profiles.begin(), + profiles.end()); + CloseDevice(); + } + + return supported_profiles; +} + +bool V4L2Device::IsImageProcessingSupported() { + const auto& devices = GetDevicesForType(Type::kImageProcessor); + return !devices.empty(); +} + +bool V4L2Device::IsJpegDecodingSupported() { + const auto& devices = GetDevicesForType(Type::kJpegDecoder); + return !devices.empty(); +} + +bool V4L2Device::IsJpegEncodingSupported() { + const auto& devices = GetDevicesForType(Type::kJpegEncoder); + return !devices.empty(); +} + VideoDecodeAccelerator::SupportedProfiles V4L2Device::EnumerateSupportedDecodeProfiles( const std::vector<uint32_t>& pixelformats) { @@ -2242,6 +2577,133 @@ return true; } +// static +bool V4L2Device::PostSandboxInitialization() { + if (V4L2Device::UseLibV4L2()) { + StubPathMap paths; + paths[kModuleV4l2].push_back(V4L2Device::kLibV4l2Path); + + return InitializeStubs(paths); + } else { + return true; + } +} + +bool V4L2Device::OpenDevicePath(const std::string& path, Type type) { + DCHECK(!device_fd_.is_valid()); + + device_fd_.reset( + HANDLE_EINTR(open(path.c_str(), O_RDWR | O_NONBLOCK | O_CLOEXEC))); + if (!device_fd_.is_valid()) { + return false; + } + + if (V4L2Device::UseLibV4L2()) { + if (type == Type::kEncoder && + HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) != + -1) { + DVLOGF(3) << "Using libv4l2 for " << path; + use_libv4l2_ = true; + } + } + return true; +} + +void V4L2Device::CloseDevice() { + DVLOGF(3); + if (use_libv4l2_ && device_fd_.is_valid()) { + v4l2_close(device_fd_.release()); + } + device_fd_.reset(); +} + +void V4L2Device::EnumerateDevicesForType(Type type) { + static const std::string kDecoderDevicePattern = "/dev/video-dec"; + static const std::string kEncoderDevicePattern = "/dev/video-enc"; + static const std::string kImageProcessorDevicePattern = "/dev/image-proc"; + static const std::string kJpegDecoderDevicePattern = "/dev/jpeg-dec"; + static const std::string kJpegEncoderDevicePattern = "/dev/jpeg-enc"; + + std::string device_pattern; + v4l2_buf_type buf_type; + switch (type) { + case Type::kDecoder: + device_pattern = kDecoderDevicePattern; + buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; + break; + case Type::kEncoder: + device_pattern = kEncoderDevicePattern; + buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; + break; + case Type::kImageProcessor: + device_pattern = kImageProcessorDevicePattern; + buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; + break; + case Type::kJpegDecoder: + device_pattern = kJpegDecoderDevicePattern; + buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; + break; + case Type::kJpegEncoder: + device_pattern = kJpegEncoderDevicePattern; + buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; + break; + } + + std::vector<std::string> candidate_paths; + + // TODO(posciak): Remove this legacy unnumbered device once + // all platforms are updated to use numbered devices. + candidate_paths.push_back(device_pattern); + + // We are sandboxed, so we can't query directory contents to check which + // devices are actually available. Try to open the first 10; if not present, + // we will just fail to open immediately. + for (int i = 0; i < 10; ++i) { + candidate_paths.push_back( + base::StringPrintf("%s%d", device_pattern.c_str(), i)); + } + + Devices devices; + for (const auto& path : candidate_paths) { + if (!OpenDevicePath(path, type)) { + continue; + } + const auto supported_pixelformats = EnumerateSupportedPixFmts( + base::BindRepeating(&V4L2Device::Ioctl, this), buf_type); + + if (!supported_pixelformats.empty()) { + DVLOGF(3) << "Found device: " << path; + devices.push_back(std::make_pair(path, supported_pixelformats)); + } + + CloseDevice(); + } + + DCHECK_EQ(devices_by_type_.count(type), 0u); + devices_by_type_[type] = devices; +} + +const V4L2Device::Devices& V4L2Device::GetDevicesForType(Type type) { + if (devices_by_type_.count(type) == 0) { + EnumerateDevicesForType(type); + } + + DCHECK_NE(devices_by_type_.count(type), 0u); + return devices_by_type_[type]; +} + +std::string V4L2Device::GetDevicePathFor(Type type, uint32_t pixfmt) { + const Devices& devices = GetDevicesForType(type); + + for (const auto& device : devices) { + if (base::Contains(device.second, pixfmt)) { + return device.first; + } + } + + return std::string(); +} + class V4L2Request { public: V4L2Request(const V4L2Request&) = delete; @@ -2365,8 +2827,7 @@ VPLOGF(1) << "Failed to poll request"; return false; default: - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }
diff --git a/media/gpu/v4l2/v4l2_device.h b/media/gpu/v4l2/v4l2_device.h index f88a8a6..e6a3c273 100644 --- a/media/gpu/v4l2/v4l2_device.h +++ b/media/gpu/v4l2/v4l2_device.h
@@ -722,7 +722,7 @@ // Open a V4L2 device of |type| for use with |v4l2_pixfmt|. // Return true on success. // The device will be closed in the destructor. - [[nodiscard]] virtual bool Open(Type type, uint32_t v4l2_pixfmt) = 0; + [[nodiscard]] bool Open(Type type, uint32_t v4l2_pixfmt); // Returns the driver name. std::string GetDriverName(); @@ -733,7 +733,7 @@ // Parameters and return value are the same as for the standard ioctl() system // call. - [[nodiscard]] virtual int Ioctl(int request, void* arg) = 0; + [[nodiscard]] int Ioctl(int request, void* arg); // This method sleeps until either: // - SetDevicePollInterrupt() is called (on another thread), @@ -742,7 +742,7 @@ // |*event_pending| will be set to true. // Returns false on error, true otherwise. // This method should be called from a separate thread. - virtual bool Poll(bool poll_device, bool* event_pending) = 0; + bool Poll(bool poll_device, bool* event_pending); // These methods are used to interrupt the thread sleeping on Poll() and force // it to return regardless of device state, which is usually when the client @@ -750,51 +750,50 @@ // client state change, etc.). When SetDevicePollInterrupt() is called, Poll() // will return immediately, and any subsequent calls to it will also do so // until ClearDevicePollInterrupt() is called. - virtual bool SetDevicePollInterrupt() = 0; - virtual bool ClearDevicePollInterrupt() = 0; + bool SetDevicePollInterrupt(); + bool ClearDevicePollInterrupt(); // Wrappers for standard mmap/munmap system calls. - virtual void* Mmap(void* addr, - unsigned int len, - int prot, - int flags, - unsigned int offset) = 0; - virtual void Munmap(void* addr, unsigned int len) = 0; + void* Mmap(void* addr, + unsigned int len, + int prot, + int flags, + unsigned int offset); + void Munmap(void* addr, unsigned int len); // Return a vector of dmabuf file descriptors, exported for V4L2 buffer with // |index|, assuming the buffer contains |num_planes| V4L2 planes and is of // |type|. Return an empty vector on failure. // The caller is responsible for closing the file descriptors after use. - virtual std::vector<base::ScopedFD> GetDmabufsForV4L2Buffer( - int index, - size_t num_planes, - enum v4l2_buf_type type) = 0; + std::vector<base::ScopedFD> GetDmabufsForV4L2Buffer(int index, + size_t num_planes, + enum v4l2_buf_type type); // Return true if the given V4L2 pixfmt can be used in CreateEGLImage() // for the current platform. - virtual bool CanCreateEGLImageFrom(const Fourcc fourcc) const = 0; + bool CanCreateEGLImageFrom(const Fourcc fourcc) const; // Create an EGLImage from provided |handle|, taking full ownership of it. // Some implementations may also require the V4L2 |buffer_index| of the buffer // for which |handle| has been exported. // Return EGL_NO_IMAGE_KHR on failure. - virtual EGLImageKHR CreateEGLImage(EGLDisplay egl_display, - EGLContext egl_context, - GLuint texture_id, - const gfx::Size& size, - unsigned int buffer_index, - const Fourcc fourcc, - gfx::NativePixmapHandle handle) const = 0; + EGLImageKHR CreateEGLImage(EGLDisplay egl_display, + EGLContext egl_context, + GLuint texture_id, + const gfx::Size& size, + unsigned int buffer_index, + const Fourcc fourcc, + gfx::NativePixmapHandle handle) const; // Destroys the EGLImageKHR. - virtual EGLBoolean DestroyEGLImage(EGLDisplay egl_display, - EGLImageKHR egl_image) const = 0; + EGLBoolean DestroyEGLImage(EGLDisplay egl_display, + EGLImageKHR egl_image) const; // Returns the supported texture target for the V4L2Device. - virtual GLenum GetTextureTarget() const = 0; + GLenum GetTextureTarget() const; // Returns the preferred V4L2 input formats for |type| or empty if none. - virtual std::vector<uint32_t> PreferredInputFormat(Type type) const = 0; + std::vector<uint32_t> PreferredInputFormat(Type type) const; // Get minimum and maximum resolution for fourcc |pixelformat| and store to // |min_resolution| and |max_resolution|. @@ -814,24 +813,23 @@ // Return V4L2 pixelformats supported by the available image processor // devices for |buf_type|. - virtual std::vector<uint32_t> GetSupportedImageProcessorPixelformats( - v4l2_buf_type buf_type) = 0; + std::vector<uint32_t> GetSupportedImageProcessorPixelformats( + v4l2_buf_type buf_type); // Return supported profiles for decoder, including only profiles for given // fourcc |pixelformats|. - virtual VideoDecodeAccelerator::SupportedProfiles GetSupportedDecodeProfiles( - const std::vector<uint32_t>& pixelformats) = 0; + VideoDecodeAccelerator::SupportedProfiles GetSupportedDecodeProfiles( + const std::vector<uint32_t>& pixelformats); // Return supported profiles for encoder. - virtual VideoEncodeAccelerator::SupportedProfiles - GetSupportedEncodeProfiles() = 0; + VideoEncodeAccelerator::SupportedProfiles GetSupportedEncodeProfiles(); // Return true if image processing is supported, false otherwise. - virtual bool IsImageProcessingSupported() = 0; + bool IsImageProcessingSupported(); // Return true if JPEG codec is supported, false otherwise. - virtual bool IsJpegDecodingSupported() = 0; - virtual bool IsJpegEncodingSupported() = 0; + bool IsJpegDecodingSupported(); + bool IsJpegEncodingSupported(); // Start polling on this V4L2Device. |event_callback| will be posted to // the caller's sequence if a buffer is ready to be dequeued and/or a V4L2 @@ -870,24 +868,47 @@ // Set periodic keyframe placement (group of pictures length) bool SetGOPLength(uint32_t gop_length); - protected: + private: friend class base::RefCountedThreadSafe<V4L2Device>; + // Vector of video device node paths and corresponding pixelformats supported + // by each device node. + using Devices = std::vector<std::pair<std::string, std::vector<uint32_t>>>; + + // Lazily initialize static data after sandbox is enabled. Return false on + // init failure. + static bool PostSandboxInitialization(); + V4L2Device(); - virtual ~V4L2Device(); + ~V4L2Device(); VideoDecodeAccelerator::SupportedProfiles EnumerateSupportedDecodeProfiles( const std::vector<uint32_t>& pixelformats); VideoEncodeAccelerator::SupportedProfiles EnumerateSupportedEncodeProfiles(); - private: // Perform platform-specific initialization of the device instance. // Return true on success, false on error or if the particular implementation // is not available. - [[nodiscard]] virtual bool Initialize() = 0; + [[nodiscard]] bool Initialize(); - // Associates a v4l2_buf_type to its queue. - base::flat_map<enum v4l2_buf_type, V4L2Queue*> queues_; + // Open device node for |path| as a device of |type|. + bool OpenDevicePath(const std::string& path, Type type); + + // Close the currently open device. + void CloseDevice(); + + // Enumerate all V4L2 devices on the system for |type| and store the results + // under devices_by_type_[type]. + void EnumerateDevicesForType(V4L2Device::Type type); + + // Return device information for all devices of |type| available in the + // system. Enumerates and queries devices on first run and caches the results + // for subsequent calls. + const Devices& GetDevicesForType(V4L2Device::Type type); + + // Return device node path for device of |type| supporting |pixfmt|, or + // an empty string if the given combination is not supported by the system. + std::string GetDevicePathFor(V4L2Device::Type type, uint32_t pixfmt); // Callback that is called upon a queue's destruction, to cleanup its pointer // in queues_. @@ -903,6 +924,23 @@ // The request queue stores all requests allocated to be used. std::unique_ptr<V4L2RequestsQueue> requests_queue_; + // Stores information for all devices available on the system + // for each device Type. + std::map<V4L2Device::Type, Devices> devices_by_type_; + + // The actual device fd. + base::ScopedFD device_fd_; + + // eventfd fd to signal device poll thread when its poll() should be + // interrupted. + base::ScopedFD device_poll_interrupt_fd_; + + // Use libv4l2 when operating |device_fd_|. + bool use_libv4l2_ = false; + + // Associates a v4l2_buf_type to its queue. + base::flat_map<enum v4l2_buf_type, V4L2Queue*> queues_; + SEQUENCE_CHECKER(client_sequence_checker_); };
diff --git a/media/gpu/v4l2/v4l2_image_processor_backend.cc b/media/gpu/v4l2/v4l2_image_processor_backend.cc index dbc3d774..6ce2f40 100644 --- a/media/gpu/v4l2/v4l2_image_processor_backend.cc +++ b/media/gpu/v4l2/v4l2_image_processor_backend.cc
@@ -556,10 +556,7 @@ DVLOGF(4) << "ts=" << frame->timestamp().InMilliseconds(); DCHECK_CALLED_ON_VALID_SEQUENCE(backend_sequence_checker_); - if (output_memory_type_ != V4L2_MEMORY_MMAP) { - NOTREACHED(); - return; - } + CHECK_EQ(output_memory_type_, V4L2_MEMORY_MMAP); auto job_record = std::make_unique<JobRecord>(); job_record->input_frame = frame; @@ -905,8 +902,7 @@ break; default: - NOTREACHED(); - return; + NOTREACHED_NORETURN(); } const auto timestamp = job_record->input_frame->timestamp(); @@ -983,8 +979,7 @@ break; } default: - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } DVLOGF(4) << "enqueued frame ts=" << job_record->input_frame->timestamp().InMilliseconds() @@ -1022,8 +1017,7 @@ output_handle->native_pixmap_handle.planes); } default: - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }
diff --git a/media/gpu/v4l2/v4l2_vda_helpers.cc b/media/gpu/v4l2/v4l2_vda_helpers.cc index 1fda578e..5b69a74 100644 --- a/media/gpu/v4l2/v4l2_vda_helpers.cc +++ b/media/gpu/v4l2/v4l2_vda_helpers.cc
@@ -268,8 +268,7 @@ } *endpos = (nalu.data + nalu.size) - data; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } void H264InputBufferFragmentSplitter::Reset() { @@ -403,8 +402,7 @@ } *endpos = (nalu.data + nalu.size) - data; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } void HEVCInputBufferFragmentSplitter::Reset() {
diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc index 94c9eac..76b8a851 100644 --- a/media/gpu/v4l2/v4l2_video_decoder.cc +++ b/media/gpu/v4l2/v4l2_video_decoder.cc
@@ -266,13 +266,11 @@ bool V4L2VideoDecoder::CanReadWithoutStalling() const { NOTIMPLEMENTED(); - NOTREACHED(); - return true; + NOTREACHED_NORETURN(); } int V4L2VideoDecoder::GetMaxDecodeRequests() const { - NOTREACHED(); - return 4; + NOTREACHED_NORETURN(); } VideoDecoderType V4L2VideoDecoder::GetDecoderType() const {
diff --git a/media/gpu/v4l2/v4l2_video_encode_accelerator.cc b/media/gpu/v4l2/v4l2_video_encode_accelerator.cc index aad7497..1d6d87d 100644 --- a/media/gpu/v4l2/v4l2_video_encode_accelerator.cc +++ b/media/gpu/v4l2/v4l2_video_encode_accelerator.cc
@@ -1397,8 +1397,7 @@ break; } default: - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } input_buf.SetPlaneBytesUsed(i, bytesused);
diff --git a/media/gpu/vaapi/gl_image_gl_texture.cc b/media/gpu/vaapi/gl_image_gl_texture.cc index 0f4c90d..0c97272 100644 --- a/media/gpu/vaapi/gl_image_gl_texture.cc +++ b/media/gpu/vaapi/gl_image_gl_texture.cc
@@ -76,8 +76,7 @@ case DRM_FORMAT_P010: return gfx::BufferFormat::P010; default: - NOTREACHED(); - return gfx::BufferFormat::BGRA_8888; + NOTREACHED_NORETURN(); } }
diff --git a/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.cc b/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.cc index e97b9c8..a4201bf1 100644 --- a/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.cc +++ b/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.cc
@@ -498,8 +498,7 @@ current_sps_.profile_idc = H264SPS::kProfileIDCHigh; break; default: - NOTREACHED(); - return; + NOTREACHED_NORETURN(); } H264SPS::GetLevelConfigFromProfileLevel(profile_, level_,
diff --git a/media/gpu/vaapi/test/h264_decoder.cc b/media/gpu/vaapi/test/h264_decoder.cc index 5cea679..e0c9428 100644 --- a/media/gpu/vaapi/test/h264_decoder.cc +++ b/media/gpu/vaapi/test/h264_decoder.cc
@@ -91,8 +91,7 @@ break; default: - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } return true; }
diff --git a/media/gpu/vaapi/vaapi_image_decode_accelerator_worker_unittest.cc b/media/gpu/vaapi/vaapi_image_decode_accelerator_worker_unittest.cc index 9130b2a..c12aab8 100644 --- a/media/gpu/vaapi/vaapi_image_decode_accelerator_worker_unittest.cc +++ b/media/gpu/vaapi/vaapi_image_decode_accelerator_worker_unittest.cc
@@ -102,8 +102,7 @@ case gpu::ImageDecodeAcceleratorType::kWebP: return SkYUVColorSpace::kRec601_SkYUVColorSpace; case gpu::ImageDecodeAcceleratorType::kUnknown: - NOTREACHED(); - return SkYUVColorSpace::kIdentity_SkYUVColorSpace; + NOTREACHED_NORETURN(); } }
diff --git a/media/gpu/vaapi/vaapi_jpeg_decoder.cc b/media/gpu/vaapi/vaapi_jpeg_decoder.cc index ea55c92..328fb86 100644 --- a/media/gpu/vaapi/vaapi_jpeg_decoder.cc +++ b/media/gpu/vaapi/vaapi_jpeg_decoder.cc
@@ -287,13 +287,9 @@ // disable support for odd dimensions since the VAImage path is only expected // to be used in camera captures (and we don't expect JPEGs with odd // dimensions in that path). - if ((scoped_va_context_and_surface_->size().width() & 1) || - (scoped_va_context_and_surface_->size().height() & 1)) { - VLOGF(1) << "Getting images with odd dimensions is not supported"; - *status = VaapiImageDecodeStatus::kCannotGetImage; - NOTREACHED(); - return nullptr; - } + CHECK((scoped_va_context_and_surface_->size().width() & 1) == 0 && + (scoped_va_context_and_surface_->size().height() & 1) == 0) + << "Getting images with odd dimensions is not supported"; auto scoped_image = vaapi_wrapper_->CreateVaImage( scoped_va_context_and_surface_->id(), &image_format, scoped_va_context_and_surface_->size());
diff --git a/media/gpu/vaapi/vaapi_picture_native_pixmap_angle.cc b/media/gpu/vaapi/vaapi_picture_native_pixmap_angle.cc index 2ef6bc1..1a0be4d 100644 --- a/media/gpu/vaapi/vaapi_picture_native_pixmap_angle.cc +++ b/media/gpu/vaapi/vaapi_picture_native_pixmap_angle.cc
@@ -129,8 +129,7 @@ bool VaapiPictureNativePixmapAngle::ImportGpuMemoryBufferHandle( gfx::BufferFormat format, gfx::GpuMemoryBufferHandle gpu_memory_buffer_handle) { - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } bool VaapiPictureNativePixmapAngle::DownloadFromSurface(
diff --git a/media/gpu/vaapi/vaapi_video_decoder.cc b/media/gpu/vaapi/vaapi_video_decoder.cc index 47e5262..50ffe2ac 100644 --- a/media/gpu/vaapi/vaapi_video_decoder.cc +++ b/media/gpu/vaapi/vaapi_video_decoder.cc
@@ -955,14 +955,11 @@ } bool VaapiVideoDecoder::CanReadWithoutStalling() const { - NOTIMPLEMENTED(); - NOTREACHED(); - return true; + NOTREACHED_NORETURN(); } int VaapiVideoDecoder::GetMaxDecodeRequests() const { - NOTREACHED(); - return 4; + NOTREACHED_NORETURN(); } VideoDecoderType VaapiVideoDecoder::GetDecoderType() const {
diff --git a/media/gpu/vaapi/vaapi_wrapper.cc b/media/gpu/vaapi/vaapi_wrapper.cc index 9825704..6f06ae3 100644 --- a/media/gpu/vaapi/vaapi_wrapper.cc +++ b/media/gpu/vaapi/vaapi_wrapper.cc
@@ -1867,8 +1867,7 @@ // 4:4:4), this driver should only support the first two. Since we check // for supported internal formats at the beginning of this function, we // shouldn't get here. - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } } else if (GetImplementationType() == VAImplementation::kIntelI965) { // Workaround deduced from observations in samus and nocturne: we found that @@ -2015,8 +2014,7 @@ case VaapiWrapper::kVideoProcess: return VAEntrypointVideoProc; case VaapiWrapper::kCodecModeMax: - NOTREACHED(); - return VAEntrypointVLD; + NOTREACHED_NORETURN(); } } @@ -2508,11 +2506,8 @@ // // TODO(crbug.com/974438): support multiple buffer objects so that this can // work in AMD. - if (descriptor.num_objects != 1u) { - DVLOG(1) << "Only surface descriptors with one bo are supported"; - NOTREACHED(); - return nullptr; - } + CHECK_EQ(descriptor.num_objects, 1u) + << "Only surface descriptors with one bo are supported"; base::ScopedFD bo_fd(descriptor.objects[0].fd); const uint64_t bo_modifier = descriptor.objects[0].drm_format_modifier;
diff --git a/media/gpu/vp9_decoder.cc b/media/gpu/vp9_decoder.cc index 1e5bb2b3..af26ea05 100644 --- a/media/gpu/vp9_decoder.cc +++ b/media/gpu/vp9_decoder.cc
@@ -81,8 +81,7 @@ case VP9PROFILE_PROFILE3: return bit_depth == 10u || bit_depth == 12u; default: - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }
diff --git a/media/gpu/vp9_svc_layers.cc b/media/gpu/vp9_svc_layers.cc index 5f5b3e7..97d95d15 100644 --- a/media/gpu/vp9_svc_layers.cc +++ b/media/gpu/vp9_svc_layers.cc
@@ -174,8 +174,7 @@ FrameConfig(1, kReference, kUpdate, true), FrameConfig(2, kNone, kReference, true)}; default: - NOTREACHED(); - return {}; + NOTREACHED_NORETURN(); } } } // namespace
diff --git a/media/gpu/windows/d3d11_texture_wrapper.cc b/media/gpu/windows/d3d11_texture_wrapper.cc index 307775b..2d0790b 100644 --- a/media/gpu/windows/d3d11_texture_wrapper.cc +++ b/media/gpu/windows/d3d11_texture_wrapper.cc
@@ -64,8 +64,7 @@ case DXGI_FORMAT_R16G16B16A16_FLOAT: return 1; default: - NOTREACHED(); - return 0; + NOTREACHED_NORETURN(); } }
diff --git a/media/gpu/windows/dxva_picture_buffer_win.cc b/media/gpu/windows/dxva_picture_buffer_win.cc index 184fa48..3078c6be 100644 --- a/media/gpu/windows/dxva_picture_buffer_win.cc +++ b/media/gpu/windows/dxva_picture_buffer_win.cc
@@ -55,8 +55,7 @@ return picture_buffer; } } - NOTREACHED(); - return nullptr; + NOTREACHED_NORETURN(); } DXVAPictureBuffer::~DXVAPictureBuffer() {} @@ -70,8 +69,7 @@ IDirect3DSurface9* dest_surface, ID3D11Texture2D* dx11_texture, int input_buffer_id) { - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } void DXVAPictureBuffer::set_bound() { @@ -85,8 +83,7 @@ bool DXVAPictureBuffer::CopySurfaceComplete(IDirect3DSurface9* src_surface, IDirect3DSurface9* dest_surface) { - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } DXVAPictureBuffer::DXVAPictureBuffer(const PictureBuffer& buffer) @@ -95,8 +92,7 @@ bool DXVAPictureBuffer::BindSampleToTexture( DXVAVideoDecodeAccelerator* decoder, Microsoft::WRL::ComPtr<IMFSample> sample) { - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } bool PbufferPictureBuffer::Initialize(const DXVAVideoDecodeAccelerator& decoder,
diff --git a/media/gpu/windows/dxva_video_decode_accelerator_win.cc b/media/gpu/windows/dxva_video_decode_accelerator_win.cc index 39e7b30..c647f051 100644 --- a/media/gpu/windows/dxva_video_decode_accelerator_win.cc +++ b/media/gpu/windows/dxva_video_decode_accelerator_win.cc
@@ -210,8 +210,7 @@ DCHECK_EQ(textures_per_picture, 2u); return false; default: // Unsupported - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } } @@ -3155,8 +3154,7 @@ case PictureBufferMechanism::COPY_TO_RGB: return GL_TEXTURE_2D; } - NOTREACHED(); - return 0; + NOTREACHED_NORETURN(); } void DXVAVideoDecodeAccelerator::DisableSharedTextureSupport() { @@ -3297,8 +3295,7 @@ case PictureBufferMechanism::COPY_TO_RGB: return false; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } ID3D11Device* DXVAVideoDecodeAccelerator::D3D11Device() const {
diff --git a/media/learning/impl/learning_session_impl_unittest.cc b/media/learning/impl/learning_session_impl_unittest.cc index 38825f8e..3141d46 100644 --- a/media/learning/impl/learning_session_impl_unittest.cc +++ b/media/learning/impl/learning_session_impl_unittest.cc
@@ -71,10 +71,7 @@ updated_id_ = id; } - const LearningTask& GetLearningTask() override { - NOTREACHED(); - return LearningTask::Empty(); - } + const LearningTask& GetLearningTask() override { NOTREACHED_NORETURN(); } void PredictDistribution(const FeatureVector& features, PredictionCB callback) override {
diff --git a/media/midi/message_util.cc b/media/midi/message_util.cc index c49e50b2d..b0495c7 100644 --- a/media/midi/message_util.cc +++ b/media/midi/message_util.cc
@@ -44,10 +44,8 @@ case 0xfe: case 0xff: return 1; - default: - NOTREACHED(); - return 0; } + NOTREACHED_NORETURN(); } bool IsDataByte(uint8_t data) {
diff --git a/media/midi/midi_manager.cc b/media/midi/midi_manager.cc index 159b83c..f0064628 100644 --- a/media/midi/midi_manager.cc +++ b/media/midi/midi_manager.cc
@@ -95,12 +95,8 @@ { base::AutoLock auto_lock(lock_); - if (clients_.find(client) != clients_.end() || - pending_clients_.find(client) != pending_clients_.end()) { - // Should not happen. But just in case the renderer is compromised. - NOTREACHED(); - return; - } + CHECK(clients_.find(client) == clients_.end()); + CHECK(pending_clients_.find(client) == pending_clients_.end()); if (initialization_state_ == InitializationState::COMPLETED) { // Platform dependent initialization was already finished for previously
diff --git a/media/mojo/mojom/audio_encoder_config_mojom_traits.cc b/media/mojo/mojom/audio_encoder_config_mojom_traits.cc index 585b077..dfe0dbe 100644 --- a/media/mojo/mojom/audio_encoder_config_mojom_traits.cc +++ b/media/mojo/mojom/audio_encoder_config_mojom_traits.cc
@@ -22,8 +22,7 @@ case media::AudioEncoder::AacOutputFormat::AAC: return media::mojom::AacOutputFormat::kAAC; } - NOTREACHED(); - return media::mojom::AacOutputFormat::kAAC; + NOTREACHED_NORETURN(); } // static @@ -39,8 +38,7 @@ *output = media::AudioEncoder::AacOutputFormat::AAC; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static
diff --git a/media/mojo/mojom/cdm_key_information_mojom_traits.cc b/media/mojo/mojom/cdm_key_information_mojom_traits.cc index 587bdf1..3efacf6 100644 --- a/media/mojo/mojom/cdm_key_information_mojom_traits.cc +++ b/media/mojo/mojom/cdm_key_information_mojom_traits.cc
@@ -30,8 +30,7 @@ case NativeKeyStatus::RELEASED: return MojomKeyStatus::RELEASED; } - NOTREACHED(); - return MojomKeyStatus::INTERNAL_ERROR; + NOTREACHED_NORETURN(); } // static @@ -61,8 +60,7 @@ *out = NativeKeyStatus::RELEASED; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static
diff --git a/media/mojo/mojom/media_foundation_rendering_mode_mojom_traits.h b/media/mojo/mojom/media_foundation_rendering_mode_mojom_traits.h index 3d3cc06..76beed7 100644 --- a/media/mojo/mojom/media_foundation_rendering_mode_mojom_traits.h +++ b/media/mojo/mojom/media_foundation_rendering_mode_mojom_traits.h
@@ -22,8 +22,7 @@ *output = media::MediaFoundationRenderingMode::FrameServer; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } static media::mojom::MediaFoundationRenderingMode ToMojom( @@ -35,8 +34,7 @@ return media::mojom::MediaFoundationRenderingMode::FrameServer; break; } - NOTREACHED(); - return media::mojom::MediaFoundationRenderingMode::DirectComposition; + NOTREACHED_NORETURN(); } };
diff --git a/media/mojo/mojom/media_types_enum_mojom_traits.h b/media/mojo/mojom/media_types_enum_mojom_traits.h index 237b91b9..e8bc0eef 100644 --- a/media/mojo/mojom/media_types_enum_mojom_traits.h +++ b/media/mojo/mojom/media_types_enum_mojom_traits.h
@@ -34,8 +34,7 @@ return media::mojom::CdmEvent::kHardwareContextReset; } - NOTREACHED(); - return media::mojom::CdmEvent::kCdmError; + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -57,8 +56,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; #endif // BUILDFLAG(IS_WIN) @@ -81,8 +79,7 @@ return media::mojom::CdmSessionClosedReason::kResourceEvicted; } - NOTREACHED(); - return static_cast<media::mojom::CdmSessionClosedReason>(input); + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -107,8 +104,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -126,8 +122,7 @@ return media::mojom::EncryptionType::kEncryptedWithClearLead; } - NOTREACHED(); - return static_cast<media::mojom::EncryptionType>(input); + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -149,8 +144,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -202,8 +196,7 @@ case media::SVCScalabilityMode::kL2T3KeyShift: case media::SVCScalabilityMode::kL3T2KeyShift: case media::SVCScalabilityMode::kL3T3KeyShift: - NOTREACHED(); - return media::mojom::SVCScalabilityMode::kUnsupportedMode; + NOTREACHED_NORETURN(); } } @@ -211,8 +204,7 @@ media::SVCScalabilityMode* output) { switch (input) { case media::mojom::SVCScalabilityMode::kUnsupportedMode: - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); case media::mojom::SVCScalabilityMode::kL1T1: *output = media::SVCScalabilityMode::kL1T1; return true; @@ -242,8 +234,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -261,8 +252,7 @@ return media::mojom::VideoRotation::kVideoRotation270; } - NOTREACHED(); - return static_cast<media::mojom::VideoRotation>(input); + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -284,8 +274,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -317,8 +306,7 @@ return media::mojom::RendererType::kTest; } - NOTREACHED(); - return static_cast<media::mojom::RendererType>(input); + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -361,8 +349,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } };
diff --git a/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc b/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc index 0802fa2..a3319438 100644 --- a/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc +++ b/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc
@@ -1288,8 +1288,7 @@ return false; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static
diff --git a/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h b/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h index 2f9ea976..a0cf073 100644 --- a/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h +++ b/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h
@@ -25,8 +25,7 @@ return media::stable::mojom::CdmContextEvent::kHardwareContextReset; } - NOTREACHED(); - return media::stable::mojom::CdmContextEvent::kHasAdditionalUsableKey; + NOTREACHED_NORETURN(); } static bool FromMojom(media::stable::mojom::CdmContextEvent input, @@ -39,8 +38,7 @@ *output = ::media::CdmContext::Event::kHardwareContextReset; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -84,8 +82,7 @@ return media::stable::mojom::ColorSpacePrimaryID::kCustom; } - NOTREACHED(); - return media::stable::mojom::ColorSpacePrimaryID::kInvalid; + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -143,8 +140,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -208,8 +204,7 @@ return media::stable::mojom::ColorSpaceTransferID::kScrgbLinear80Nits; } - NOTREACHED(); - return media::stable::mojom::ColorSpaceTransferID::kInvalid; + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -297,8 +292,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -334,8 +328,7 @@ return media::stable::mojom::ColorSpaceMatrixID::kGBR; } - NOTREACHED(); - return media::stable::mojom::ColorSpaceMatrixID::kInvalid; + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -381,8 +374,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -402,8 +394,7 @@ return media::stable::mojom::ColorSpaceRangeID::kDerived; } - NOTREACHED(); - return media::stable::mojom::ColorSpaceRangeID::kInvalid; + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -425,8 +416,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -554,8 +544,7 @@ return media::stable::mojom::DecryptStatus::kFailure; } - NOTREACHED(); - return media::stable::mojom::DecryptStatus::kFailure; + NOTREACHED_NORETURN(); } static bool FromMojom(media::stable::mojom::DecryptStatus input, @@ -571,8 +560,7 @@ *output = ::media::Decryptor::Status::kError; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -590,8 +578,7 @@ return media::stable::mojom::EncryptionScheme::kCbcs; } - NOTREACHED(); - return media::stable::mojom::EncryptionScheme::kUnencrypted; + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -610,8 +597,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -645,8 +631,7 @@ return media::stable::mojom::MediaLogRecord_Type::kMediaStatus; } - NOTREACHED(); - return media::stable::mojom::MediaLogRecord_Type::kMessage; + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -668,8 +653,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -797,8 +781,7 @@ return media::stable::mojom::VideoCodec::kAV1; } - NOTREACHED(); - return media::stable::mojom::VideoCodec::kUnknown; + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -841,8 +824,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -943,8 +925,7 @@ return media::stable::mojom::VideoCodecProfile::kDolbyVisionProfile9; } - NOTREACHED(); - return media::stable::mojom::VideoCodecProfile::kVideoCodecProfileUnknown; + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -1074,8 +1055,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -1142,8 +1122,7 @@ return media::stable::mojom::VideoDecoderType::kUnknown; } - NOTREACHED(); - return media::stable::mojom::VideoDecoderType::kUnknown; + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -1168,8 +1147,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -1266,8 +1244,7 @@ return media::stable::mojom::VideoPixelFormat::kPixelFormatNV12A; } - NOTREACHED(); - return media::stable::mojom::VideoPixelFormat::kPixelFormatUnknown; + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -1388,8 +1365,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } }; @@ -1408,8 +1384,7 @@ return media::stable::mojom::WaitingReason::kSecureSurfaceLost; } - NOTREACHED(); - return media::stable::mojom::WaitingReason::kNoCdm; + NOTREACHED_NORETURN(); } // Returning false results in deserialization failure and causes the @@ -1431,8 +1406,7 @@ return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } };
diff --git a/media/mojo/mojom/video_encode_accelerator_mojom_traits.cc b/media/mojo/mojom/video_encode_accelerator_mojom_traits.cc index ce086e8..b840488 100644 --- a/media/mojo/mojom/video_encode_accelerator_mojom_traits.cc +++ b/media/mojo/mojom/video_encode_accelerator_mojom_traits.cc
@@ -29,9 +29,7 @@ return media::mojom::VideoEncodeAcceleratorSupportedRateControlMode:: kVariableMode; } - NOTREACHED(); - return media::mojom::VideoEncodeAcceleratorSupportedRateControlMode:: - kConstantMode; + NOTREACHED_NORETURN(); } // static @@ -52,8 +50,7 @@ *out = media::VideoEncodeAccelerator::kVariableMode; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static @@ -183,8 +180,7 @@ return data.ReadH265(&out->h265); } } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static @@ -273,8 +269,7 @@ case media::VideoEncodeAccelerator::Config::StorageType::kShmem: return media::mojom::VideoEncodeAcceleratorConfig_StorageType::kShmem; } - NOTREACHED(); - return media::mojom::VideoEncodeAcceleratorConfig_StorageType::kShmem; + NOTREACHED_NORETURN(); } // static @@ -292,8 +287,7 @@ media::VideoEncodeAccelerator::Config::StorageType::kGpuMemoryBuffer; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static @@ -310,8 +304,7 @@ return media::mojom::VideoEncodeAcceleratorConfig_EncoderType:: kNoPreference; } - NOTREACHED(); - return media::mojom::VideoEncodeAcceleratorConfig_EncoderType::kHardware; + NOTREACHED_NORETURN(); } // static @@ -331,8 +324,7 @@ media::VideoEncodeAccelerator::Config::EncoderType::kNoPreference; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static @@ -346,8 +338,7 @@ case media::VideoEncodeAccelerator::Config::ContentType::kCamera: return media::mojom::VideoEncodeAcceleratorConfig_ContentType::kCamera; } - NOTREACHED(); - return media::mojom::VideoEncodeAcceleratorConfig_ContentType::kCamera; + NOTREACHED_NORETURN(); } // static @@ -363,8 +354,7 @@ *output = media::VideoEncodeAccelerator::Config::ContentType::kDisplay; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static @@ -382,8 +372,7 @@ return media::mojom::VideoEncodeAcceleratorConfig_InterLayerPredMode:: kOnKeyPic; } - NOTREACHED(); - return media::mojom::VideoEncodeAcceleratorConfig_InterLayerPredMode::kOff; + NOTREACHED_NORETURN(); } // static @@ -405,8 +394,7 @@ media::VideoEncodeAccelerator::Config::InterLayerPredMode::kOnKeyPic; return true; } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static @@ -464,8 +452,7 @@ case media::Bitrate::Mode::kExternal: return media::mojom::BitrateDataView::Tag::kExternal; } - NOTREACHED(); - return media::mojom::BitrateDataView::Tag::kConstant; + NOTREACHED_NORETURN(); } // static @@ -481,8 +468,7 @@ return input.ReadExternal(output); } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } // static
diff --git a/media/mojo/mojom/video_encode_accelerator_mojom_traits.h b/media/mojo/mojom/video_encode_accelerator_mojom_traits.h index acd1faf..b08470a 100644 --- a/media/mojo/mojom/video_encode_accelerator_mojom_traits.h +++ b/media/mojo/mojom/video_encode_accelerator_mojom_traits.h
@@ -134,8 +134,7 @@ } else if (metadata.h265) { return media::mojom::CodecMetadataDataView::Tag::kH265; } - NOTREACHED(); - return media::mojom::CodecMetadataDataView::Tag::kVp8; + NOTREACHED_NORETURN(); } static bool IsNull(const media::BitstreamBufferMetadata& metadata) {
diff --git a/media/mojo/mojom/video_frame_mojom_traits.cc b/media/mojo/mojom/video_frame_mojom_traits.cc index e6e4db7e..ee3428c 100644 --- a/media/mojo/mojom/video_frame_mojom_traits.cc +++ b/media/mojo/mojom/video_frame_mojom_traits.cc
@@ -346,8 +346,7 @@ frame->set_ycbcr_info(ycbcr_info); } else { // TODO(sandersd): Switch on the union tag to avoid this ugliness? - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } if (!frame) {
diff --git a/media/mojo/services/mojo_cdm_file_io.cc b/media/mojo/services/mojo_cdm_file_io.cc index dc07c11..5c05cc9 100644 --- a/media/mojo/services/mojo_cdm_file_io.cc +++ b/media/mojo/services/mojo_cdm_file_io.cc
@@ -120,7 +120,7 @@ return; } - NOTREACHED(); + NOTREACHED_NORETURN(); } void MojoCdmFileIO::Read() {
diff --git a/media/renderers/audio_renderer_impl.cc b/media/renderers/audio_renderer_impl.cc index 8874c16..75636a1 100644 --- a/media/renderers/audio_renderer_impl.cc +++ b/media/renderers/audio_renderer_impl.cc
@@ -1072,8 +1072,7 @@ case kUninitialized: case kInitializing: case kFlushing: - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); case kFlushed: DCHECK(!pending_read_); @@ -1373,8 +1372,7 @@ switch (state_) { case kUninitialized: case kInitializing: - NOTREACHED(); - return; + NOTREACHED_NORETURN(); case kFlushing: ChangeState_Locked(kFlushed); if (status == PIPELINE_OK) {
diff --git a/media/renderers/paint_canvas_video_renderer.cc b/media/renderers/paint_canvas_video_renderer.cc index de12acc..16cd81d 100644 --- a/media/renderers/paint_canvas_video_renderer.cc +++ b/media/renderers/paint_canvas_video_renderer.cc
@@ -349,8 +349,7 @@ case kBT2020_12bit_Limited_SkYUVColorSpace: return &YUV_MATRIX(libyuv::kYuv2020Constants); case kIdentity_SkYUVColorSpace: - NOTREACHED(); - return nullptr; + NOTREACHED_NORETURN(); }; } @@ -1192,8 +1191,7 @@ break; default: - NOTREACHED(); - return nullptr; + NOTREACHED_NORETURN(); } const int scale = 1 << (24 - video_frame->BitDepth()); scoped_refptr<VideoFrame> ret = VideoFrame::CreateFrame(
diff --git a/media/renderers/video_frame_yuv_converter.cc b/media/renderers/video_frame_yuv_converter.cc index 4c1d8ea..d08bea8 100644 --- a/media/renderers/video_frame_yuv_converter.cc +++ b/media/renderers/video_frame_yuv_converter.cc
@@ -48,8 +48,7 @@ case GL_SRGB8_ALPHA8: return kRGBA_8888_SkColorType; default: - NOTREACHED(); - return kUnknown_SkColorType; + NOTREACHED_NORETURN(); } }
diff --git a/media/renderers/video_frame_yuv_mailboxes_holder.cc b/media/renderers/video_frame_yuv_mailboxes_holder.cc index 37e306d2..c5775db3d 100644 --- a/media/renderers/video_frame_yuv_mailboxes_holder.cc +++ b/media/renderers/video_frame_yuv_mailboxes_holder.cc
@@ -40,8 +40,7 @@ case 4: return viz::SinglePlaneFormat::kRGBA_8888; } - NOTREACHED(); - return viz::SinglePlaneFormat::kRGBA_8888; + NOTREACHED_NORETURN(); } GLenum PlaneGLFormat(int num_channels, const gpu::Capabilities& capabilities) {
diff --git a/media/renderers/video_resource_updater.cc b/media/renderers/video_resource_updater.cc index cd4861e..0a9dbf06 100644 --- a/media/renderers/video_resource_updater.cc +++ b/media/renderers/video_resource_updater.cc
@@ -326,8 +326,7 @@ case PIXEL_FORMAT_ARGB: return viz::SinglePlaneFormat::kBGRA_8888; default: - NOTREACHED(); - return viz::SinglePlaneFormat::kRGBA_8888; + NOTREACHED_NORETURN(); } #endif }
diff --git a/media/renderers/win/media_engine_notify_impl.cc b/media/renderers/win/media_engine_notify_impl.cc index 8d7cac6..c8ca386 100644 --- a/media/renderers/win/media_engine_notify_impl.cc +++ b/media/renderers/win/media_engine_notify_impl.cc
@@ -78,8 +78,7 @@ case MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED: return DEMUXER_ERROR_COULD_NOT_OPEN; default: - NOTREACHED(); - return PIPELINE_ERROR_INVALID_STATE; + NOTREACHED_NORETURN(); } }
diff --git a/media/renderers/win/media_foundation_stream_wrapper.cc b/media/renderers/win/media_foundation_stream_wrapper.cc index 3c448b37..c6de096 100644 --- a/media/renderers/win/media_foundation_stream_wrapper.cc +++ b/media/renderers/win/media_foundation_stream_wrapper.cc
@@ -489,8 +489,9 @@ // Continue to ProcessRequestsIfPossible() to satisfy pending sample // request by issuing DemuxerStream::Read() if necessary. } else { - NOTREACHED() << "Unexpected demuxer stream status. status=" << status - << ", this=" << this; + NOTREACHED_NORETURN() + << "Unexpected demuxer stream status. status=" << status + << ", this=" << this; } }
diff --git a/media/video/gpu_memory_buffer_video_frame_pool.cc b/media/video/gpu_memory_buffer_video_frame_pool.cc index e9ea16e..9d1c893 100644 --- a/media/video/gpu_memory_buffer_video_frame_pool.cc +++ b/media/video/gpu_memory_buffer_video_frame_pool.cc
@@ -372,11 +372,9 @@ case GpuVideoAcceleratorFactories::OutputFormat::BGRA: return 1; case GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED: - NOTREACHED(); - break; + NOTREACHED_NORETURN(); } - NOTREACHED(); - return 0; + NOTREACHED_NORETURN(); } // The number of shared images for a given format. Note that a single
diff --git a/media/video/h264_parser.cc b/media/video/h264_parser.cc index 741061d..5fc015f 100644 --- a/media/video/h264_parser.cc +++ b/media/video/h264_parser.cc
@@ -497,8 +497,7 @@ return false; } } - NOTREACHED(); - return false; + NOTREACHED_NORETURN(); } H264Parser::Result H264Parser::AdvanceToNextNALU(H264NALU* nalu) {
diff --git a/media/video/h265_parser.cc b/media/video/h265_parser.cc index bc40ac9..a7eb5e4 100644 --- a/media/video/h265_parser.cc +++ b/media/video/h265_parser.cc
@@ -213,8 +213,7 @@ case 3: return VideoChromaSampling::k444; default: - NOTREACHED(); - return VideoChromaSampling::kUnknown; + NOTREACHED_NORETURN(); } }
diff --git a/net/der/parse_values.cc b/net/der/parse_values.cc index ec6fbd8..1385819 100644 --- a/net/der/parse_values.cc +++ b/net/der/parse_values.cc
@@ -74,13 +74,16 @@ return false; if (time.day < 1) return false; - if (time.hours < 0 || time.hours > 23) + if (time.hours > 23) { return false; - if (time.minutes < 0 || time.minutes > 59) + } + if (time.minutes > 59) { return false; + } // Leap seconds are allowed. - if (time.seconds < 0 || time.seconds > 60) + if (time.seconds > 60) { return false; + } // validate upper bound for day of month switch (time.month) {
diff --git a/net/http/transport_security_state_static.json b/net/http/transport_security_state_static.json index 3d45352..512a9ad 100644 --- a/net/http/transport_security_state_static.json +++ b/net/http/transport_security_state_static.json
@@ -78425,7 +78425,6 @@ { "name": "anz.co.nz", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "apert.be", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "aqua-dom33.ru", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, - { "name": "aquafirm.com", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "arachnid.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "aroma-therapy.tk", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true }, { "name": "arqpericial.es", "policy": "bulk-1-year", "mode": "force-https", "include_subdomains": true },
diff --git a/net/quic/dedicated_web_transport_http3_client.cc b/net/quic/dedicated_web_transport_http3_client.cc index 0de9441..9f749e1 100644 --- a/net/quic/dedicated_web_transport_http3_client.cc +++ b/net/quic/dedicated_web_transport_http3_client.cc
@@ -652,7 +652,6 @@ if (stream == nullptr) { return ERR_QUIC_PROTOCOL_ERROR; } - connect_stream_ = stream; spdy::Http2HeaderBlock headers; DCHECK_EQ(url_.scheme(), url::kHttpsScheme);
diff --git a/net/quic/dedicated_web_transport_http3_client.h b/net/quic/dedicated_web_transport_http3_client.h index 450a2268..f81aa5ce 100644 --- a/net/quic/dedicated_web_transport_http3_client.h +++ b/net/quic/dedicated_web_transport_http3_client.h
@@ -178,7 +178,6 @@ std::unique_ptr<DatagramClientSocket> socket_; std::unique_ptr<quic::QuicSpdyClientSession> session_; raw_ptr<quic::QuicConnection> connection_; // owned by |session_| - raw_ptr<quic::QuicSpdyStream, DanglingUntriaged> connect_stream_ = nullptr; raw_ptr<quic::WebTransportSession, DanglingUntriaged> web_transport_session_ = nullptr; std::unique_ptr<QuicChromiumPacketReader> packet_reader_;
diff --git a/remoting/base/BUILD.gn b/remoting/base/BUILD.gn index c68999d..f374bcc 100644 --- a/remoting/base/BUILD.gn +++ b/remoting/base/BUILD.gn
@@ -28,8 +28,6 @@ "buffered_socket_writer.h", "capabilities.cc", "capabilities.h", - "chromium_url_request.cc", - "chromium_url_request.h", "chromoting_event.cc", "chromoting_event.h", "compound_buffer.cc", @@ -80,7 +78,6 @@ "telemetry_log_writer.cc", "telemetry_log_writer.h", "typed_buffer.h", - "url_request.h", "url_request_context_getter.cc", "url_request_context_getter.h", "util.cc",
diff --git a/remoting/base/chromium_url_request.cc b/remoting/base/chromium_url_request.cc deleted file mode 100644 index cd8b295..0000000 --- a/remoting/base/chromium_url_request.cc +++ /dev/null
@@ -1,104 +0,0 @@ -// Copyright 2016 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "remoting/base/chromium_url_request.h" - -#include <memory> -#include <utility> - -#include "base/functional/bind.h" -#include "net/base/load_flags.h" -#include "services/network/public/cpp/resource_request.h" -#include "services/network/public/cpp/shared_url_loader_factory.h" -#include "services/network/public/cpp/simple_url_loader.h" -#include "services/network/public/mojom/url_response_head.mojom.h" - -namespace remoting { - -ChromiumUrlRequest::ChromiumUrlRequest( - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - UrlRequest::Type type, - const std::string& url, - const net::NetworkTrafficAnnotationTag& traffic_annotation) - : traffic_annotation_(traffic_annotation) { - url_loader_factory_ = url_loader_factory; - - std::string request_type = "GET"; - switch (type) { - case Type::GET: - break; - case Type::POST: - request_type = "POST"; - break; - } - resource_request_ = std::make_unique<network::ResourceRequest>(); - resource_request_->url = GURL(url); - resource_request_->method = request_type; - resource_request_->credentials_mode = network::mojom::CredentialsMode::kOmit; - resource_request_->referrer = GURL("https://chrome.google.com/remotedesktop"); -} - -ChromiumUrlRequest::~ChromiumUrlRequest() = default; - -void ChromiumUrlRequest::AddHeader(const std::string& value) { - resource_request_->headers.AddHeaderFromString(value); -} - -void ChromiumUrlRequest::SetPostData(const std::string& content_type, - const std::string& data) { - post_data_content_type_ = content_type; - post_data_ = data; -} - -void ChromiumUrlRequest::Start(OnResultCallback on_result_callback) { - DCHECK(!on_result_callback.is_null()); - DCHECK(on_result_callback_.is_null()); - - on_result_callback_ = std::move(on_result_callback); - - std::string method = resource_request_->method; - - url_loader_ = network::SimpleURLLoader::Create(std::move(resource_request_), - traffic_annotation_); - if (method == "POST") { - url_loader_->AttachStringForUpload(post_data_, post_data_content_type_); - } - - url_loader_->DownloadToStringOfUnboundedSizeUntilCrashAndDie( - url_loader_factory_.get(), - base::BindOnce(&ChromiumUrlRequest::OnURLLoadComplete, - base::Unretained(this))); -} - -void ChromiumUrlRequest::OnURLLoadComplete( - std::unique_ptr<std::string> response_body) { - Result result; - result.success = !!response_body; - if (result.success) { - result.status = -1; - result.response_body = std::move(*response_body); - } - - if (url_loader_->ResponseInfo() && url_loader_->ResponseInfo()->headers) { - result.status = url_loader_->ResponseInfo()->headers->response_code(); - } - - DCHECK(!on_result_callback_.is_null()); - std::move(on_result_callback_).Run(result); -} - -ChromiumUrlRequestFactory::ChromiumUrlRequestFactory( - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) - : url_loader_factory_(url_loader_factory) {} -ChromiumUrlRequestFactory::~ChromiumUrlRequestFactory() = default; - -std::unique_ptr<UrlRequest> ChromiumUrlRequestFactory::CreateUrlRequest( - UrlRequest::Type type, - const std::string& url, - const net::NetworkTrafficAnnotationTag& traffic_annotation) { - return std::make_unique<ChromiumUrlRequest>(url_loader_factory_, type, url, - traffic_annotation); -} - -} // namespace remoting
diff --git a/remoting/base/chromium_url_request.h b/remoting/base/chromium_url_request.h deleted file mode 100644 index a005341..0000000 --- a/remoting/base/chromium_url_request.h +++ /dev/null
@@ -1,71 +0,0 @@ -// Copyright 2016 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef REMOTING_BASE_CHROMIUM_URL_REQUEST_H_ -#define REMOTING_BASE_CHROMIUM_URL_REQUEST_H_ - -#include <string> - -#include "base/functional/callback.h" -#include "base/memory/scoped_refptr.h" -#include "net/traffic_annotation/network_traffic_annotation.h" -#include "remoting/base/url_request.h" - -namespace network { -class SharedURLLoaderFactory; -class SimpleURLLoader; -struct ResourceRequest; -} // namespace network - -namespace remoting { - -// UrlRequest implementation based on network::SimpleURLLoader. -class ChromiumUrlRequest : public UrlRequest { - public: - ChromiumUrlRequest( - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - UrlRequest::Type type, - const std::string& url, - const net::NetworkTrafficAnnotationTag& traffic_annotation); - ~ChromiumUrlRequest() override; - - // UrlRequest interface. - void AddHeader(const std::string& value) override; - void SetPostData(const std::string& content_type, - const std::string& data) override; - void Start(OnResultCallback on_result_callback) override; - - private: - void OnURLLoadComplete(std::unique_ptr<std::string> response_body); - - std::unique_ptr<network::SimpleURLLoader> url_loader_; - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; - std::unique_ptr<network::ResourceRequest> resource_request_; - - const net::NetworkTrafficAnnotationTag traffic_annotation_; - std::string post_data_content_type_; - std::string post_data_; - - OnResultCallback on_result_callback_; -}; - -class ChromiumUrlRequestFactory : public UrlRequestFactory { - public: - ChromiumUrlRequestFactory( - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory); - ~ChromiumUrlRequestFactory() override; - - // UrlRequestFactory interface. - std::unique_ptr<UrlRequest> CreateUrlRequest( - UrlRequest::Type type, - const std::string& url, - const net::NetworkTrafficAnnotationTag& traffic_annotation) override; - - private: - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; -}; - -} // namespace remoting - -#endif // REMOTING_BASE_CHROMIUM_URL_REQUEST_H_
diff --git a/remoting/base/telemetry_log_writer.h b/remoting/base/telemetry_log_writer.h index 71b1613..6dac6d0 100644 --- a/remoting/base/telemetry_log_writer.h +++ b/remoting/base/telemetry_log_writer.h
@@ -16,7 +16,6 @@ #include "remoting/base/chromoting_event.h" #include "remoting/base/chromoting_event_log_writer.h" #include "remoting/base/oauth_token_getter.h" -#include "remoting/base/url_request.h" namespace network { class SharedURLLoaderFactory;
diff --git a/remoting/base/url_request.h b/remoting/base/url_request.h deleted file mode 100644 index e79b744..0000000 --- a/remoting/base/url_request.h +++ /dev/null
@@ -1,71 +0,0 @@ -// Copyright 2016 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef REMOTING_BASE_URL_REQUEST_H_ -#define REMOTING_BASE_URL_REQUEST_H_ - -#include <memory> -#include <string> - -#include "base/functional/callback_forward.h" -#include "net/traffic_annotation/network_traffic_annotation.h" - -namespace remoting { - -// Abstract interface for URL requests. -class UrlRequest { - public: - enum class Type { - GET, - POST, - }; - - struct Result { - Result() = default; - Result(int status, std::string response_body) - : success(true), status(status), response_body(response_body) {} - - static Result Failed() { return Result(); } - - // Set to true when the URL has been fetched successfully. - bool success = false; - - // HTTP status code received from the server. Valid only when |success| is - // set to true. - int status = 0; - - // Body of the response received from the server. Valid only when |success| - // is set to true. - std::string response_body; - }; - - typedef base::OnceCallback<void(const Result& result)> OnResultCallback; - - virtual ~UrlRequest() {} - - // Adds an HTTP header to the request. Has no effect if called after Start(). - virtual void AddHeader(const std::string& value) = 0; - - // Sets data to be sent for POST requests. - virtual void SetPostData(const std::string& content_type, - const std::string& post_data) = 0; - - // Sends a request to the server. |on_response_callback| will be called to - // return result of the request. - virtual void Start(OnResultCallback on_result_callback) = 0; -}; - -// Factory for UrlRequest instances. -class UrlRequestFactory { - public: - virtual ~UrlRequestFactory() {} - virtual std::unique_ptr<UrlRequest> CreateUrlRequest( - UrlRequest::Type type, - const std::string& url, - const net::NetworkTrafficAnnotationTag& traffic_annotation) = 0; -}; - -} // namespace remoting - -#endif // REMOTING_BASE_URL_REQUEST_H_
diff --git a/remoting/client/chromoting_client_runtime.cc b/remoting/client/chromoting_client_runtime.cc index d71c2d6..bec8fe7 100644 --- a/remoting/client/chromoting_client_runtime.cc +++ b/remoting/client/chromoting_client_runtime.cc
@@ -16,7 +16,6 @@ #include "base/task/thread_pool/thread_pool_instance.h" #include "build/build_config.h" #include "mojo/core/embedder/embedder.h" -#include "remoting/base/chromium_url_request.h" #include "remoting/base/directory_service_client.h" #include "remoting/base/mojo_util.h" #include "remoting/base/oauth_token_getter_proxy.h"
diff --git a/remoting/client/client_telemetry_logger.h b/remoting/client/client_telemetry_logger.h index 0f31189..872dfef 100644 --- a/remoting/client/client_telemetry_logger.h +++ b/remoting/client/client_telemetry_logger.h
@@ -15,7 +15,6 @@ #include "base/time/time.h" #include "remoting/base/chromoting_event.h" #include "remoting/base/chromoting_event_log_writer.h" -#include "remoting/base/url_request.h" #include "remoting/protocol/connection_to_host.h" #include "remoting/protocol/performance_tracker.h" #include "remoting/protocol/transport.h"
diff --git a/remoting/client/jni/jni_runtime_delegate.cc b/remoting/client/jni/jni_runtime_delegate.cc index dc499bd1..72c6dbb 100644 --- a/remoting/client/jni/jni_runtime_delegate.cc +++ b/remoting/client/jni/jni_runtime_delegate.cc
@@ -16,7 +16,6 @@ #include "base/synchronization/waitable_event.h" #include "base/task/thread_pool/thread_pool_instance.h" #include "remoting/android/jni_headers/JniInterface_jni.h" -#include "remoting/base/chromium_url_request.h" #include "remoting/base/oauth_token_getter_proxy.h" #include "remoting/base/url_request_context_getter.h" #include "remoting/client/jni/jni_oauth_token_getter.h"
diff --git a/remoting/protocol/ice_transport_unittest.cc b/remoting/protocol/ice_transport_unittest.cc index d722ec32..192c5fdc 100644 --- a/remoting/protocol/ice_transport_unittest.cc +++ b/remoting/protocol/ice_transport_unittest.cc
@@ -17,7 +17,6 @@ #include "build/build_config.h" #include "components/webrtc/thread_wrapper.h" #include "net/url_request/url_request_context_getter.h" -#include "remoting/base/url_request.h" #include "remoting/protocol/chromium_port_allocator_factory.h" #include "remoting/protocol/connection_tester.h" #include "remoting/protocol/fake_authenticator.h"
diff --git a/remoting/test/protocol_perftest.cc b/remoting/test/protocol_perftest.cc index b31d2b8c..623651f 100644 --- a/remoting/test/protocol_perftest.cc +++ b/remoting/test/protocol_perftest.cc
@@ -24,7 +24,6 @@ #include "net/test/test_data_directory.h" #include "net/url_request/url_request_context_getter.h" #include "remoting/base/rsa_key_pair.h" -#include "remoting/base/url_request.h" #include "remoting/client/audio/audio_player.h" #include "remoting/client/chromoting_client.h" #include "remoting/client/client_context.h"
diff --git a/sandbox/policy/mac/common.sb b/sandbox/policy/mac/common.sb index 05dd5c3c..91773ada 100644 --- a/sandbox/policy/mac/common.sb +++ b/sandbox/policy/mac/common.sb
@@ -342,3 +342,13 @@ (syscall-number SYS_workq_kernreturn) (syscall-number SYS_workq_open) ))) + +; Explicit denials. These are already covered by the blanket `(deny default)`, +; but benefit from explanation as to why they're denied. +(deny mach-lookup + ; CFPreferences falls back to in-process access to preference plists, known as + ; direct mode, when cfprefsd is inaccessible. This in-process access ensures + ; that our sandbox policy limits which preference domains can be accessed via + ; CFPreferences or NSUserDefaults. + (global-name "com.apple.cfprefsd.daemon") +)
diff --git a/services/audio/BUILD.gn b/services/audio/BUILD.gn index 98ec0c8..c3ebab2d 100644 --- a/services/audio/BUILD.gn +++ b/services/audio/BUILD.gn
@@ -79,10 +79,6 @@ "//build:chromeos_buildflags", ] - if (is_android) { - deps += [ ":audio_service_jni_headers" ] - } - public_deps = [ "//base", "//media", @@ -134,12 +130,6 @@ ] } -if (is_android) { - generate_jni("audio_service_jni_headers") { - sources = [ "public/java/src/org/chromium/audio/AudioFeatureList.java" ] - } -} - # NOTE: This is its own component target because it exposes static storage # consumed by multiple binary targets that get linked together (e.g. # content/utility and content_browsertests in a component build). Consider
diff --git a/services/audio/public/cpp/BUILD.gn b/services/audio/public/cpp/BUILD.gn index d7d46af..76e79e1 100644 --- a/services/audio/public/cpp/BUILD.gn +++ b/services/audio/public/cpp/BUILD.gn
@@ -2,8 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/features.gni") - component("cpp") { sources = [ "audio_system_to_service_adapter.cc", @@ -38,29 +36,6 @@ output_name = "audio_public_cpp" } -component("audio_features") { - public = [ "audio_features.h" ] - sources = [ - "audio_features.cc", - "audio_features_export.h", - ] - configs += [ "//build/config/compiler:wexit_time_destructors" ] - public_deps = [ "//base" ] - - defines = [ "AUDIO_FEATURES_IMPLEMENTATION" ] -} - -if (is_android) { - source_set("audio_feature_list") { - sources = [ "audio_feature_list.cc" ] - deps = [ - ":audio_features", - "//base", - "//services/audio:audio_service_jni_headers", - ] - } -} - source_set("test_support") { testonly = true
diff --git a/services/audio/public/cpp/audio_feature_list.cc b/services/audio/public/cpp/audio_feature_list.cc deleted file mode 100644 index 72d8c5b..0000000 --- a/services/audio/public/cpp/audio_feature_list.cc +++ /dev/null
@@ -1,47 +0,0 @@ -// Copyright 2023 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/android/jni_string.h" -#include "base/feature_list.h" -#include "base/notreached.h" -#include "services/audio/audio_service_jni_headers/AudioFeatureList_jni.h" -#include "services/audio/public/cpp/audio_features.h" - -using base::android::ConvertJavaStringToUTF8; -using base::android::JavaParamRef; - -namespace features { - -namespace { - -// Array of features exposed through the Java ContentFeatureList API. Entries in -// this array may either refer to features defined in the header of this file or -// in other locations in the code base (e.g. content_features.h). -const base::Feature* const kFeaturesExposedToJava[] = { - &kBlockMidiByDefault, -}; - -// TODO(crbug.com/1060097): Removethis once a generalized FeatureList exists. -const base::Feature* FindFeatureExposedToJava(const std::string& feature_name) { - for (const base::Feature* feature : kFeaturesExposedToJava) { - if (feature->name == feature_name) { - return feature; - } - } - NOTREACHED() << "Queried feature cannot be found in AuiodFeatureList: " - << feature_name; - return nullptr; -} - -} // namespace - -static jboolean JNI_AudioFeatureList_IsEnabled( - JNIEnv* env, - const JavaParamRef<jstring>& jfeature_name) { - const base::Feature* feature = - FindFeatureExposedToJava(ConvertJavaStringToUTF8(env, jfeature_name)); - return base::FeatureList::IsEnabled(*feature); -} - -} // namespace features
diff --git a/services/audio/public/cpp/audio_features.cc b/services/audio/public/cpp/audio_features.cc deleted file mode 100644 index f0e5b45..0000000 --- a/services/audio/public/cpp/audio_features.cc +++ /dev/null
@@ -1,14 +0,0 @@ -// Copyright 2023 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "services/audio/public/cpp/audio_features.h" - -namespace features { - -// Enables disallowing MIDI permission by default. -BASE_FEATURE(kBlockMidiByDefault, - "BlockMidiByDefault", - base::FEATURE_DISABLED_BY_DEFAULT); - -} // namespace features
diff --git a/services/audio/public/cpp/audio_features.h b/services/audio/public/cpp/audio_features.h deleted file mode 100644 index 0d5c18d..0000000 --- a/services/audio/public/cpp/audio_features.h +++ /dev/null
@@ -1,23 +0,0 @@ -// Copyright 2023 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file defines all the public base::FeatureList features for the -// services/audio module. - -#ifndef SERVICES_AUDIO_PUBLIC_CPP_AUDIO_FEATURES_H_ -#define SERVICES_AUDIO_PUBLIC_CPP_AUDIO_FEATURES_H_ - -#include "base/feature_list.h" -#include "build/build_config.h" -#include "services/audio/public/cpp/audio_features_export.h" - -namespace features { - -// The features should be documented alongside the definition of their values -// in the .cc file. -AUDIO_FEATURES_EXPORT BASE_DECLARE_FEATURE(kBlockMidiByDefault); - -} // namespace features - -#endif // SERVICES_AUDIO_PUBLIC_CPP_AUDIO_FEATURES_H_
diff --git a/services/audio/public/cpp/audio_features_export.h b/services/audio/public/cpp/audio_features_export.h deleted file mode 100644 index 5b3e8eb6..0000000 --- a/services/audio/public/cpp/audio_features_export.h +++ /dev/null
@@ -1,34 +0,0 @@ -// Copyright 2023 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SERVICES_AUDIO_PUBLIC_CPP_AUDIO_FEATURES_EXPORT_H_ -#define SERVICES_AUDIO_PUBLIC_CPP_AUDIO_FEATURES_EXPORT_H_ - -#if defined(COMPONENT_BUILD) - -#if defined(WIN32) - -#if defined(AUDIO_FEATURES_IMPLEMENTATION) -#define AUDIO_FEATURES_EXPORT __declspec(dllexport) -#else -#define AUDIO_FEATURES_EXPORT __declspec(dllimport) -#endif - -#else // !defined(WIN32) - -#if defined(AUDIO_FEATURES_IMPLEMENTATION) -#define AUDIO_FEATURES_EXPORT __attribute__((visibility("default"))) -#else -#define AUDIO_FEATURES_EXPORT -#endif - -#endif - -#else // !defined(COMPONENT_BUILD) - -#define AUDIO_FEATURES_EXPORT - -#endif - -#endif // SERVICES_AUDIO_PUBLIC_CPP_AUDIO_FEATURES_EXPORT_H_
diff --git a/services/audio/public/java/BUILD.gn b/services/audio/public/java/BUILD.gn deleted file mode 100644 index 4826513..0000000 --- a/services/audio/public/java/BUILD.gn +++ /dev/null
@@ -1,15 +0,0 @@ -# Copyright 2023 The Chromium Authors -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("//build/config/android/rules.gni") - -android_library("audio_feature_list_java") { - sources = [ "src/org/chromium/audio/AudioFeatureList.java" ] - deps = [ - "//base:base_java", - "//base:jni_java", - "//build/android:build_java", - ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] -}
diff --git a/services/audio/public/java/src/org/chromium/audio/AudioFeatureList.java b/services/audio/public/java/src/org/chromium/audio/AudioFeatureList.java deleted file mode 100644 index ee104b0..0000000 --- a/services/audio/public/java/src/org/chromium/audio/AudioFeatureList.java +++ /dev/null
@@ -1,41 +0,0 @@ -// Copyright 2023 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package org.chromium.audio; - -import org.chromium.base.FeatureList; -import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; - -/** - * Provides an API for querying the status of Audio Service Features. - */ -// TODO(crbug.com/1060097): Remove/update this once a generalized FeatureList exists. -@JNINamespace("features") -public class AudioFeatureList { - public static final String BLOCK_MIDI_BY_DEFAULT = "BlockMidiByDefault"; - - private AudioFeatureList() {} - - /** - * Returns whether the specified feature is enabled or not. - * - * Note: Features queried through this API must be added to the array - * |kFeaturesExposedToJava| in //services/audio/public/cpp/audio_feature_list.cc. - * - * @param featureName The name of the feature to query. - * @return Whether the feature is enabled or not. - */ - public static boolean isEnabled(String featureName) { - Boolean testValue = FeatureList.getTestValueForFeature(featureName); - if (testValue != null) return testValue; - assert FeatureList.isNativeInitialized(); - return AudioFeatureListJni.get().isEnabled(featureName); - } - - @NativeMethods - interface Natives { - boolean isEnabled(String featureName); - } -}
diff --git a/services/device/public/cpp/device_feature_list.cc b/services/device/public/cpp/device_feature_list.cc index 82b9efe1..3c8a60ba 100644 --- a/services/device/public/cpp/device_feature_list.cc +++ b/services/device/public/cpp/device_feature_list.cc
@@ -23,6 +23,7 @@ &device::kWebAuthnAndroidCredMan, &device::kWebAuthnHybridLinkWithoutNotifications, &kGenericSensorExtraClasses, + &device::kWebAuthnHybridLinkWithoutNotifications, }; // TODO(crbug.com/1060097): Removethis once a generalized FeatureList exists.
diff --git a/services/network/attribution/attribution_request_helper.cc b/services/network/attribution/attribution_request_helper.cc index de8c5b1..93b4f070 100644 --- a/services/network/attribution/attribution_request_helper.cc +++ b/services/network/attribution/attribution_request_helper.cc
@@ -313,7 +313,8 @@ // base::Feature (which is set from the browser, so trustworthy) and the // runtime feature (which can be spoofed in a compromised renderer, so is // best-effort). - if (request.attribution_reporting_runtime_features.cross_app_web_enabled && + if (request.attribution_reporting_runtime_features.Has( + AttributionReportingRuntimeFeature::kCrossAppWeb) && base::FeatureList::IsEnabled( features::kAttributionReportingCrossAppWeb)) { url_request.SetExtraRequestHeaderByName(
diff --git a/services/network/public/cpp/attribution_mojom_traits.h b/services/network/public/cpp/attribution_mojom_traits.h index ff82c59..871b5ce4 100644 --- a/services/network/public/cpp/attribution_mojom_traits.h +++ b/services/network/public/cpp/attribution_mojom_traits.h
@@ -36,14 +36,17 @@ StructTraits<network::mojom::AttributionReportingRuntimeFeaturesDataView, network::AttributionReportingRuntimeFeatures> { static bool cross_app_web_enabled( - const network::AttributionReportingRuntimeFeatures& runtime_features) { - return runtime_features.cross_app_web_enabled; + network::AttributionReportingRuntimeFeatures runtime_features) { + return runtime_features.Has( + network::AttributionReportingRuntimeFeature::kCrossAppWeb); } static bool Read( network::mojom::AttributionReportingRuntimeFeaturesDataView data, network::AttributionReportingRuntimeFeatures* out) { - out->cross_app_web_enabled = data.cross_app_web_enabled(); + if (data.cross_app_web_enabled()) { + out->Put(network::AttributionReportingRuntimeFeature::kCrossAppWeb); + } return true; } };
diff --git a/services/network/public/cpp/attribution_reporting_runtime_features.h b/services/network/public/cpp/attribution_reporting_runtime_features.h index c8cbade..e390603e 100644 --- a/services/network/public/cpp/attribution_reporting_runtime_features.h +++ b/services/network/public/cpp/attribution_reporting_runtime_features.h
@@ -5,17 +5,21 @@ #ifndef SERVICES_NETWORK_PUBLIC_CPP_ATTRIBUTION_REPORTING_RUNTIME_FEATURES_H_ #define SERVICES_NETWORK_PUBLIC_CPP_ATTRIBUTION_REPORTING_RUNTIME_FEATURES_H_ -#include "base/component_export.h" +#include "base/containers/enum_set.h" namespace network { -// This corresponds to network::mojom::AttributionReportingRuntimeFeatures. -// See the comments there. -struct COMPONENT_EXPORT(NETWORK_CPP_ATTRIBUTION) - AttributionReportingRuntimeFeatures { - bool cross_app_web_enabled = false; +enum class AttributionReportingRuntimeFeature { + kCrossAppWeb, + kMinValue = kCrossAppWeb, + kMaxValue = kCrossAppWeb, }; +using AttributionReportingRuntimeFeatures = + base::EnumSet<AttributionReportingRuntimeFeature, + AttributionReportingRuntimeFeature::kMinValue, + AttributionReportingRuntimeFeature::kMaxValue>; + } // namespace network #endif // SERVICES_NETWORK_PUBLIC_CPP_ATTRIBUTION_REPORTING_RUNTIME_FEATURES_H_
diff --git a/services/network/public/mojom/BUILD.gn b/services/network/public/mojom/BUILD.gn index fffdf6f..e78805c 100644 --- a/services/network/public/mojom/BUILD.gn +++ b/services/network/public/mojom/BUILD.gn
@@ -381,6 +381,7 @@ { mojom = "network.mojom.AttributionReportingRuntimeFeatures" cpp = "::network::AttributionReportingRuntimeFeatures" + copyable_pass_by_value = true }, ] traits_headers =
diff --git a/services/network/sct_auditing/sct_auditing_cache.cc b/services/network/sct_auditing/sct_auditing_cache.cc index 519c2495..bb33a0b 100644 --- a/services/network/sct_auditing/sct_auditing_cache.cc +++ b/services/network/sct_auditing/sct_auditing_cache.cc
@@ -134,7 +134,8 @@ } RecordSCTAuditingReportDeduplicatedMetrics(false); - report->set_user_agent(version_info::GetProductNameAndVersionForUserAgent()); + report->set_user_agent( + std::string(version_info::GetProductNameAndVersionForUserAgent())); // Add `cache_key` to the dedupe cache. The cache value is not used. dedupe_cache_.Put(cache_key, true);
diff --git a/services/tracing/public/cpp/perfetto/trace_event_data_source_unittest.cc b/services/tracing/public/cpp/perfetto/trace_event_data_source_unittest.cc index 6ce65055..75aa1280 100644 --- a/services/tracing/public/cpp/perfetto/trace_event_data_source_unittest.cc +++ b/services/tracing/public/cpp/perfetto/trace_event_data_source_unittest.cc
@@ -899,11 +899,11 @@ } void HasMetadataValue(const perfetto::protos::ChromeMetadata& entry, - const base::Value& value) { + const base::Value::Dict& value) { EXPECT_TRUE(entry.has_json_value()); - absl::optional<base::Value> child_dict = - base::JSONReader::Read(entry.json_value()); + absl::optional<base::Value::Dict> child_dict = + base::JSONReader::ReadDict(entry.json_value()); EXPECT_EQ(*child_dict, value); } @@ -948,8 +948,7 @@ MetadataHasNamedValue(metadata, "foo_str", "bar"); MetadataHasNamedValue(metadata, "foo_bool", true); - base::Value child_dict(base::Value::Type::DICT); - child_dict.SetStringKey("child_str", "child_val"); + auto child_dict = base::Value::Dict().Set("child_str", "child_val"); MetadataHasNamedValue(metadata, "child_dict", child_dict); } @@ -967,8 +966,7 @@ MetadataHasNamedValue(metadata, "foo_str", "bar"); MetadataHasNamedValue(metadata, "foo_bool", true); - base::Value child_dict(base::Value::Type::DICT); - child_dict.SetStringKey("child_str", "child_val"); + auto child_dict = base::Value::Dict().Set("child_str", "child_val"); MetadataHasNamedValue(metadata, "child_dict", child_dict); } @@ -997,8 +995,7 @@ MetadataHasNamedValue(metadata, "foo_str", "bar"); MetadataHasNamedValue(metadata, "foo_bool", true); - base::Value child_dict(base::Value::Type::DICT); - child_dict.SetStringKey("child_str", "child_val"); + auto child_dict = base::Value::Dict().Set("child_str", "child_val"); MetadataHasNamedValue(metadata, "child_dict", child_dict); EXPECT_EQ(1, metadata1.size());
diff --git a/testing/buildbot/autoshard_exceptions.json b/testing/buildbot/autoshard_exceptions.json index a60b121..a7253a7 100644 --- a/testing/buildbot/autoshard_exceptions.json +++ b/testing/buildbot/autoshard_exceptions.json
@@ -3,17 +3,17 @@ "android-12-x64-rel": { "webview_instrumentation_test_apk": { "debug": { - "avg_num_builds_per_peak_hour": "81.0", - "estimated_bot_hour_delta": "3.18", - "prev_avg_pending_time_sec": "278.9", - "prev_p50_pending_time_sec": "76.0", - "prev_p90_pending_time_sec": "800.0", - "prev_percentile_duration_minutes": "15.37", - "prev_shard_count": "11", - "simulated_max_shard_duration": "14.09", + "avg_num_builds_per_peak_hour": "83.0", + "estimated_bot_hour_delta": "-3.09", + "prev_avg_pending_time_sec": "168.9", + "prev_p50_pending_time_sec": "17.0", + "prev_p90_pending_time_sec": "424.0", + "prev_percentile_duration_minutes": "13.84", + "prev_shard_count": "12", + "simulated_max_shard_duration": "15.1", "try_builder": "android-12-x64-rel" }, - "shards": "12" + "shards": "11" } } }, @@ -21,20 +21,34 @@ "linux-chromeos-rel": { "browser_tests": { "debug": { - "avg_num_builds_per_peak_hour": "81.0", - "estimated_bot_hour_delta": "-11.65", - "prev_avg_pending_time_sec": "133.5", - "prev_p50_pending_time_sec": "36.0", - "prev_p90_pending_time_sec": "376.0", - "prev_percentile_duration_minutes": "13.78", - "prev_shard_count": "64", - "simulated_max_shard_duration": "14.95", + "avg_num_builds_per_peak_hour": "84.0", + "estimated_bot_hour_delta": "16.64", + "prev_avg_pending_time_sec": "110.0", + "prev_p50_pending_time_sec": "12.0", + "prev_p90_pending_time_sec": "360.0", + "prev_percentile_duration_minutes": "16.45", + "prev_shard_count": "59", + "simulated_max_shard_duration": "14.71", "try_builder": "linux-chromeos-rel" }, - "shards": "59" + "shards": "66" } }, "linux-lacros-tester-rel": { + "browser_tests": { + "debug": { + "avg_num_builds_per_peak_hour": "83.0", + "estimated_bot_hour_delta": "4.3", + "prev_avg_pending_time_sec": "82.3", + "prev_p50_pending_time_sec": "2.0", + "prev_p90_pending_time_sec": "268.0", + "prev_percentile_duration_minutes": "15.98", + "prev_shard_count": "20", + "simulated_max_shard_duration": "14.53", + "try_builder": "linux-lacros-rel" + }, + "shards": "22" + }, "interactive_ui_tests": { "debug": { "avg_num_builds_per_peak_hour": "77.0", @@ -214,16 +228,16 @@ "browser_tests": { "debug": { "avg_num_builds_per_peak_hour": "78.0", - "estimated_bot_hour_delta": "2.53", - "prev_avg_pending_time_sec": "400.0", - "prev_p50_pending_time_sec": "14.0", - "prev_p90_pending_time_sec": "1562.0", - "prev_percentile_duration_minutes": "15.18", - "prev_shard_count": "24", + "estimated_bot_hour_delta": "-2.04", + "prev_avg_pending_time_sec": "111.1", + "prev_p50_pending_time_sec": "4.0", + "prev_p90_pending_time_sec": "402.0", + "prev_percentile_duration_minutes": "13.99", + "prev_shard_count": "25", "simulated_max_shard_duration": "14.57", "try_builder": "linux-rel" }, - "shards": "25" + "shards": "24" }, "interactive_ui_tests": { "debug": { @@ -275,47 +289,75 @@ "Linux ASan LSan Tests (1)": { "content_browsertests": { "debug": { - "avg_num_builds_per_peak_hour": "82.0", - "estimated_bot_hour_delta": "3.09", - "prev_avg_pending_time_sec": "138.7", - "prev_p50_pending_time_sec": "34.0", - "prev_p90_pending_time_sec": "402.0", - "prev_percentile_duration_minutes": "15.03", - "prev_shard_count": "26", - "simulated_max_shard_duration": "14.47", + "avg_num_builds_per_peak_hour": "83.0", + "estimated_bot_hour_delta": "3.22", + "prev_avg_pending_time_sec": "94.9", + "prev_p50_pending_time_sec": "4.0", + "prev_p90_pending_time_sec": "314.0", + "prev_percentile_duration_minutes": "15.24", + "prev_shard_count": "27", + "simulated_max_shard_duration": "14.7", "try_builder": "linux_chromium_asan_rel_ng" }, - "shards": "27" + "shards": "28" }, "interactive_ui_tests": { "debug": { - "avg_num_builds_per_peak_hour": "82.0", - "estimated_bot_hour_delta": "6.26", - "prev_avg_pending_time_sec": "131.8", - "prev_p50_pending_time_sec": "24.0", - "prev_p90_pending_time_sec": "381.0", - "prev_percentile_duration_minutes": "16.34", - "prev_shard_count": "15", - "simulated_max_shard_duration": "14.42", + "avg_num_builds_per_peak_hour": "83.0", + "estimated_bot_hour_delta": "6.6", + "prev_avg_pending_time_sec": "92.5", + "prev_p50_pending_time_sec": "2.0", + "prev_p90_pending_time_sec": "305.0", + "prev_percentile_duration_minutes": "15.97", + "prev_shard_count": "17", + "simulated_max_shard_duration": "14.29", "try_builder": "linux_chromium_asan_rel_ng" }, - "shards": "17" + "shards": "19" } }, "Linux TSan Tests": { - "content_browsertests": { + "components_unittests": { "debug": { - "avg_num_builds_per_peak_hour": "82.0", - "estimated_bot_hour_delta": "-2.5", - "prev_avg_pending_time_sec": "130.2", - "prev_p50_pending_time_sec": "21.0", - "prev_p90_pending_time_sec": "369.0", - "prev_percentile_duration_minutes": "14.35", - "prev_shard_count": "32", - "simulated_max_shard_duration": "14.81", + "avg_num_builds_per_peak_hour": "84.0", + "estimated_bot_hour_delta": "2.32", + "prev_avg_pending_time_sec": "82.3", + "prev_p50_pending_time_sec": "4.0", + "prev_p90_pending_time_sec": "262.0", + "prev_percentile_duration_minutes": "15.64", + "prev_shard_count": "2", + "simulated_max_shard_duration": "10.43", "try_builder": "linux_chromium_tsan_rel_ng" }, - "shards": "31" + "shards": "3" + }, + "content_browsertests": { + "debug": { + "avg_num_builds_per_peak_hour": "84.0", + "estimated_bot_hour_delta": "2.54", + "prev_avg_pending_time_sec": "87.8", + "prev_p50_pending_time_sec": "3.0", + "prev_p90_pending_time_sec": "285.0", + "prev_percentile_duration_minutes": "15.45", + "prev_shard_count": "31", + "simulated_max_shard_duration": "14.97", + "try_builder": "linux_chromium_tsan_rel_ng" + }, + "shards": "32" + }, + "unit_tests": { + "debug": { + "avg_num_builds_per_peak_hour": "84.0", + "estimated_bot_hour_delta": "2.4", + "prev_avg_pending_time_sec": "81.1", + "prev_p50_pending_time_sec": "2.0", + "prev_p90_pending_time_sec": "260.0", + "prev_percentile_duration_minutes": "15.81", + "prev_shard_count": "2", + "simulated_max_shard_duration": "10.54", + "try_builder": "linux_chromium_tsan_rel_ng" + }, + "shards": "3" }, "webkit_unit_tests": { "debug": {
diff --git a/testing/buildbot/chromium.android.json b/testing/buildbot/chromium.android.json index b0d2c730..57b5751 100644 --- a/testing/buildbot/chromium.android.json +++ b/testing/buildbot/chromium.android.json
@@ -10668,7 +10668,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 12 + "shards": 11 }, "test": "webview_instrumentation_test_apk", "test_id_prefix": "ninja://android_webview/test:webview_instrumentation_test_apk/"
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index 32da1092f..793d7c9 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -3582,7 +3582,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 59 + "shards": 66 }, "test": "browser_tests", "test_id_prefix": "ninja://chrome/test:browser_tests/" @@ -5185,7 +5185,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 20 + "shards": 22 }, "test": "browser_tests", "test_id_prefix": "ninja://chrome/test:browser_tests/"
diff --git a/testing/buildbot/chromium.gpu.fyi.json b/testing/buildbot/chromium.gpu.fyi.json index f167ff7a5..5968f565 100644 --- a/testing/buildbot/chromium.gpu.fyi.json +++ b/testing/buildbot/chromium.gpu.fyi.json
@@ -18554,6 +18554,32 @@ }, { "args": [ + "--gtest_filter=MediaFoundationEncryptedMediaTest*", + "--use-gpu-in-tests" + ], + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "name": "media_foundation_browser_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "containment_type": "AUTO", + "dimension_sets": [ + { + "display_attached": "1", + "gpu": "8086:9bc5-31.0.101.2111", + "os": "Windows-10", + "pool": "chromium.tests.gpu" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "browser_tests", + "test_id_prefix": "ninja://chrome/test:browser_tests/" + }, + { + "args": [ "--enable-gpu", "--test-launcher-bot-mode", "--test-launcher-jobs=1",
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index 8c206975..3c5b054 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -2104,7 +2104,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 25 + "shards": 24 }, "test": "browser_tests", "test_id_prefix": "ninja://chrome/test:browser_tests/"
diff --git a/testing/buildbot/chromium.memory.json b/testing/buildbot/chromium.memory.json index 9ebc8f8..36e3262 100644 --- a/testing/buildbot/chromium.memory.json +++ b/testing/buildbot/chromium.memory.json
@@ -462,7 +462,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 27 + "shards": 28 }, "test": "content_browsertests", "test_id_prefix": "ninja://content/test:content_browsertests/" @@ -909,7 +909,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 17 + "shards": 19 }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/" @@ -8949,7 +8949,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 + "shards": 3 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/" @@ -8988,7 +8988,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 31 + "shards": 32 }, "test": "content_browsertests", "test_id_prefix": "ninja://content/test:content_browsertests/" @@ -10057,7 +10057,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 + "shards": 3 }, "test": "unit_tests", "test_id_prefix": "ninja://chrome/test:unit_tests/"
diff --git a/testing/buildbot/filters/pixel_tests.filter b/testing/buildbot/filters/pixel_tests.filter index cfb7364f..fb63e9b 100644 --- a/testing/buildbot/filters/pixel_tests.filter +++ b/testing/buildbot/filters/pixel_tests.filter
@@ -70,7 +70,6 @@ RelaunchRecommendedBubbleViewDialogTest.* RelaunchRequiredDialogViewDialogTest.* ReopenTabPromoControllerDialogBrowserTest.* -SAAEnabledPermissionPromptBubbleViewBrowserTest.* SafetyTipPageInfoBubbleViewDialogTest.* ScreenCaptureNotificationUiBrowserTest.* SecurePaymentConfirmationDialogViewTest.InvokeUi_*
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index cb63660..19f9e5b2 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -2870,6 +2870,16 @@ }, }, }, + 'media_foundation_browser_tests': { + 'remove_from': [ + # TODO(crbug.com/1445173): Enable Media Foundation browser tests on NVIDIA + # gpu bots once the Windows OS supports HW secure decryption. + 'Win10 FYI x64 Debug (NVIDIA)', + 'Win10 FYI x64 Release (AMD RX 5500 XT)', + 'Win10 FYI x64 Release (NVIDIA)', + 'Win10 FYI x86 Release (NVIDIA)', + ], + }, 'media_unittests': { 'modifications': { 'android-11-x86-rel': {
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 9cbbb55..5af6c5a7 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -2814,6 +2814,19 @@ }, }, + 'gpu_default_and_optional_win_media_foundation_specific_gtests': { + # MediaFoundation browser tests, which currently only run on Windows OS, + # and require physical hardware. + 'media_foundation_browser_tests': { + 'args': [ + '--gtest_filter=MediaFoundationEncryptedMediaTest*', + '--use-gpu-in-tests' + ], + 'test': 'browser_tests', + 'ci_only': True, + }, + }, + 'gpu_default_and_optional_win_specific_gtests': { # WebNN DirectML backend unit tests, which currently only run on # Windows OS, and require physical hardware. @@ -6514,6 +6527,7 @@ 'gpu_fyi_win_gtests': [ 'gpu_angle_unit_gtests', 'gpu_common_gtests_passthrough', + 'gpu_default_and_optional_win_media_foundation_specific_gtests', 'gpu_default_and_optional_win_specific_gtests', 'gpu_desktop_specific_gtests', 'gpu_fyi_and_optional_non_linux_gtests', @@ -7757,6 +7771,11 @@ }, 'win_optional_gpu_tests_rel_gtests': { + 'gpu_default_and_optional_win_media_foundation_specific_gtests': { + 'variants': [ + 'WIN10_INTEL_UHD_630_STABLE', + ], + }, 'gpu_default_and_optional_win_specific_gtests': { 'variants': [ 'WIN10_INTEL_UHD_630_STABLE',
diff --git a/testing/buildbot/tryserver.chromium.win.json b/testing/buildbot/tryserver.chromium.win.json index 6158f857..4c2c16fc 100644 --- a/testing/buildbot/tryserver.chromium.win.json +++ b/testing/buildbot/tryserver.chromium.win.json
@@ -5,6 +5,33 @@ "gtest_tests": [ { "args": [ + "--gtest_filter=MediaFoundationEncryptedMediaTest*", + "--use-gpu-in-tests" + ], + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "name": "media_foundation_browser_tests 8086:9bc5", + "swarming": { + "can_use_on_swarming_builders": true, + "containment_type": "AUTO", + "dimension_sets": [ + { + "display_attached": "1", + "gpu": "8086:9bc5-31.0.101.2111", + "os": "Windows-10", + "pool": "chromium.tests.gpu" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "browser_tests", + "test_id_prefix": "ninja://chrome/test:browser_tests/", + "variant_id": "8086:9bc5" + }, + { + "args": [ "--use-gpu-in-tests", "--use-angle=d3d9" ],
diff --git a/testing/xvfb.py b/testing/xvfb.py index 409cf91..1154781f 100755 --- a/testing/xvfb.py +++ b/testing/xvfb.py
@@ -43,14 +43,20 @@ if not proc: return - proc.terminate() thread = threading.Thread(target=proc.wait) - thread.start() + try: + proc.terminate() + thread.start() - thread.join(timeout_in_seconds) - if thread.is_alive(): - print('%s running after SIGTERM, trying SIGKILL.\n' % name, file=sys.stderr) - proc.kill() + thread.join(timeout_in_seconds) + if thread.is_alive(): + print('%s running after SIGTERM, trying SIGKILL.\n' % name, + file=sys.stderr) + proc.kill() + except OSError as e: + # proc.terminate()/kill() can raise, not sure if only ProcessLookupError + # which is explained in https://bugs.python.org/issue40550#msg382427 + print('Exception while killing process %s: %s' % (name, e), file=sys.stderr) thread.join(timeout_in_seconds) if thread.is_alive(): @@ -199,13 +205,16 @@ signal.signal(signal.SIGUSR1, signal.SIG_IGN) xvfb_proc = subprocess.Popen(xvfb_cmd, stderr=subprocess.STDOUT, env=env) signal.signal(signal.SIGUSR1, set_xvfb_ready) - for _ in range(10): + for _ in range(30): time.sleep(.1) # gives Xvfb time to start or fail. if xvfb_ready.getvalue() or xvfb_proc.poll() is not None: break # xvfb sent ready signal, or already failed and stopped. if xvfb_proc.poll() is None: - break # xvfb is running, can proceed. + if xvfb_ready.getvalue(): + break # xvfb is ready + kill(xvfb_proc, 'Xvfb') # still not ready, give up and retry + if xvfb_proc.poll() is not None: raise _XvfbProcessError('Failed to start after 10 tries') @@ -229,12 +238,12 @@ ['openbox', '--sm-disable', '--startup', openbox_startup_cmd], stderr=subprocess.STDOUT, env=env) - for _ in range(10): + for _ in range(30): time.sleep(.1) # gives Openbox time to start or fail. if openbox_ready.getvalue() or openbox_proc.poll() is not None: break # openbox sent ready signal, or failed and stopped. - if openbox_proc.poll() is not None: + if openbox_proc.poll() is not None or not openbox_ready.getvalue(): raise _XvfbProcessError('Failed to start OpenBox.') if use_xcompmgr:
diff --git a/third_party/blink/public/mojom/conversions/attribution_data_host.mojom b/third_party/blink/public/mojom/conversions/attribution_data_host.mojom index 3e62e3b..77fc8d4 100644 --- a/third_party/blink/public/mojom/conversions/attribution_data_host.mojom +++ b/third_party/blink/public/mojom/conversions/attribution_data_host.mojom
@@ -6,7 +6,6 @@ import "components/attribution_reporting/registration.mojom"; import "services/network/public/mojom/attribution.mojom"; -import "url/mojom/url.mojom"; // Browser-process interface responsible for processing attribution // configurations registered by the renderer. These configurations may be sent @@ -24,12 +23,12 @@ network.mojom.TriggerVerification? verification); // Called when OS source data from the renderer is available for a given - // attributionsrc request. The OS will make a subsequent request to - // `registration_url` to obtain the actual registration. - OsSourceDataAvailable(url.mojom.Url registration_url); + // attributionsrc request. The OS will make subsequent requests to + // to obtain the actual registration. + OsSourceDataAvailable(attribution_reporting.mojom.OsRegistration registration); // Called when OS trigger data from the renderer is available for a given - // attributionsrc request. The OS will make a subsequent request to - // `registration_url` to obtain the actual registration. - OsTriggerDataAvailable(url.mojom.Url registration_url); + // attributionsrc request. The OS will make subsequent requests to + // to obtain the actual registration. + OsTriggerDataAvailable(attribution_reporting.mojom.OsRegistration registration); };
diff --git a/third_party/blink/renderer/bindings/generated_in_modules.gni b/third_party/blink/renderer/bindings/generated_in_modules.gni index 5e0c67b..acd52112 100644 --- a/third_party/blink/renderer/bindings/generated_in_modules.gni +++ b/third_party/blink/renderer/bindings/generated_in_modules.gni
@@ -2709,6 +2709,8 @@ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_websocket.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_websocket_stream.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_websocket_stream.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_wgsl_language_features.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_wgsl_language_features.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_window.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_window.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_window_client.cc", @@ -2851,6 +2853,8 @@ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sync_iterator_midi_output_map.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sync_iterator_rtc_stats_report.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sync_iterator_rtc_stats_report.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sync_iterator_wgsl_language_features.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sync_iterator_wgsl_language_features.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sync_iterator_xr_anchor_set.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sync_iterator_xr_anchor_set.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sync_iterator_xr_hand.cc",
diff --git a/third_party/blink/renderer/bindings/idl_in_modules.gni b/third_party/blink/renderer/bindings/idl_in_modules.gni index 9a5b48a8..1cdd557 100644 --- a/third_party/blink/renderer/bindings/idl_in_modules.gni +++ b/third_party/blink/renderer/bindings/idl_in_modules.gni
@@ -1090,6 +1090,7 @@ "//third_party/blink/renderer/modules/webgpu/gpu_vertex_buffer_layout.idl", "//third_party/blink/renderer/modules/webgpu/gpu_vertex_state.idl", "//third_party/blink/renderer/modules/webgpu/navigator_gpu.idl", + "//third_party/blink/renderer/modules/webgpu/wgsl_language_features.idl", "//third_party/blink/renderer/modules/webgpu/worker_navigator_gpu.idl", "//third_party/blink/renderer/modules/webmidi/midi_access.idl", "//third_party/blink/renderer/modules/webmidi/midi_connection_event.idl",
diff --git a/third_party/blink/renderer/core/accessibility/ax_object_cache.h b/third_party/blink/renderer/core/accessibility/ax_object_cache.h index 7bc1d3c..f09bb1fc 100644 --- a/third_party/blink/renderer/core/accessibility/ax_object_cache.h +++ b/third_party/blink/renderer/core/accessibility/ax_object_cache.h
@@ -211,7 +211,7 @@ static bool IsInsideFocusableElementOrARIAWidget(const Node&); // Returns true if there are any pending updates that need processing. - virtual bool IsDirty() const = 0; + virtual bool IsDirty() = 0; virtual void SerializeLocationChanges() = 0;
diff --git a/third_party/blink/renderer/core/animation/keyframe_effect.cc b/third_party/blink/renderer/core/animation/keyframe_effect.cc index f4316bf..50a7ac5 100644 --- a/third_party/blink/renderer/core/animation/keyframe_effect.cc +++ b/third_party/blink/renderer/core/animation/keyframe_effect.cc
@@ -42,7 +42,6 @@ #include "third_party/blink/renderer/core/animation/sampled_effect.h" #include "third_party/blink/renderer/core/animation/timing_calculations.h" #include "third_party/blink/renderer/core/animation/timing_input.h" -#include "third_party/blink/renderer/core/animation/view_timeline.h" #include "third_party/blink/renderer/core/css/parser/css_selector_parser.h" #include "third_party/blink/renderer/core/css/properties/css_property_ref.h" #include "third_party/blink/renderer/core/css/properties/longhands.h" @@ -303,9 +302,8 @@ ScriptState* script_state) { if (Animation* animation = GetAnimation()) { animation->FlushPendingUpdates(); - if (ViewTimeline* view_timeline = - DynamicTo<ViewTimeline>(animation->timeline())) { - view_timeline->ResolveTimelineOffsets(); + if (AnimationTimeline* timeline = animation->timeline()) { + animation->ResolveTimelineOffsets(timeline->GetTimelineRange()); } }
diff --git a/third_party/blink/renderer/core/frame/attribution_src_loader.cc b/third_party/blink/renderer/core/frame/attribution_src_loader.cc index 73d1272..88fa150f 100644 --- a/third_party/blink/renderer/core/frame/attribution_src_loader.cc +++ b/third_party/blink/renderer/core/frame/attribution_src_loader.cc
@@ -538,11 +538,13 @@ network::AttributionReportingRuntimeFeatures AttributionSrcLoader::GetRuntimeFeatures() const { - return network::AttributionReportingRuntimeFeatures{ - .cross_app_web_enabled = - RuntimeEnabledFeatures::AttributionReportingCrossAppWebEnabled( - local_frame_->DomWindow()), - }; + network::AttributionReportingRuntimeFeatures runtime_features; + if (RuntimeEnabledFeatures::AttributionReportingCrossAppWebEnabled( + local_frame_->DomWindow())) { + runtime_features.Put( + network::AttributionReportingRuntimeFeature::kCrossAppWeb); + } + return runtime_features; } bool AttributionSrcLoader::MaybeRegisterAttributionHeaders( @@ -819,9 +821,7 @@ /*invalid_parameter=*/headers.os_source); return; } - for (const GURL& registration_url : registration_urls) { - data_host_->OsSourceDataAvailable(KURL(registration_url)); - } + data_host_->OsSourceDataAvailable(std::move(registration_urls)); ++num_registrations_; } @@ -880,9 +880,7 @@ /*invalid_parameter=*/headers.os_trigger); return; } - for (const GURL& registration_url : registration_urls) { - data_host_->OsTriggerDataAvailable(KURL(registration_url)); - } + data_host_->OsTriggerDataAvailable(std::move(registration_urls)); ++num_registrations_; }
diff --git a/third_party/blink/renderer/core/frame/attribution_src_loader.h b/third_party/blink/renderer/core/frame/attribution_src_loader.h index 5be296d..c229449 100644 --- a/third_party/blink/renderer/core/frame/attribution_src_loader.h +++ b/third_party/blink/renderer/core/frame/attribution_src_loader.h
@@ -8,6 +8,7 @@ #include <stdint.h> #include "components/attribution_reporting/registration_type.mojom-blink-forward.h" +#include "services/network/public/cpp/attribution_reporting_runtime_features.h" #include "services/network/public/mojom/attribution.mojom-forward.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/common/tokens/tokens.h" @@ -18,7 +19,6 @@ #include "third_party/blink/renderer/platform/wtf/forward.h" namespace network { -struct AttributionReportingRuntimeFeatures; class TriggerVerification; } // namespace network
diff --git a/third_party/blink/renderer/core/frame/attribution_src_loader_test.cc b/third_party/blink/renderer/core/frame/attribution_src_loader_test.cc index 5abbad6..5f6f31e 100644 --- a/third_party/blink/renderer/core/frame/attribution_src_loader_test.cc +++ b/third_party/blink/renderer/core/frame/attribution_src_loader_test.cc
@@ -109,8 +109,12 @@ return trigger_verification_; } - const Vector<KURL>& os_sources() const { return os_sources_; } - const Vector<KURL>& os_triggers() const { return os_triggers_; } + const std::vector<std::vector<GURL>>& os_sources() const { + return os_sources_; + } + const std::vector<std::vector<GURL>>& os_triggers() const { + return os_triggers_; + } size_t disconnects() const { return disconnects_; } @@ -134,12 +138,12 @@ trigger_verification_.push_back(std::move(verification)); } - void OsSourceDataAvailable(const KURL& registration_url) override { - os_sources_.push_back(registration_url); + void OsSourceDataAvailable(std::vector<GURL> registration_urls) override { + os_sources_.emplace_back(std::move(registration_urls)); } - void OsTriggerDataAvailable(const KURL& registration_url) override { - os_triggers_.push_back(registration_url); + void OsTriggerDataAvailable(std::vector<GURL> registration_urls) override { + os_triggers_.emplace_back(std::move(registration_urls)); } Vector<attribution_reporting::SourceRegistration> source_data_; @@ -148,8 +152,8 @@ Vector<absl::optional<network::TriggerVerification>> trigger_verification_; - Vector<KURL> os_sources_; - Vector<KURL> os_triggers_; + std::vector<std::vector<GURL>> os_sources_; + std::vector<std::vector<GURL>> os_triggers_; size_t disconnects_ = 0; mojo::Receiver<mojom::blink::AttributionDataHost> receiver_{this}; @@ -678,8 +682,9 @@ ASSERT_TRUE(mock_data_host); mock_data_host->Flush(); - EXPECT_THAT(mock_data_host->os_triggers(), - ::testing::ElementsAre(KURL("https://r.test/x"))); + EXPECT_THAT( + mock_data_host->os_triggers(), + ::testing::ElementsAre(::testing::ElementsAre(GURL("https://r.test/x")))); } } // namespace
diff --git a/third_party/blink/renderer/core/html/forms/text_control_element.cc b/third_party/blink/renderer/core/html/forms/text_control_element.cc index c9ba8ea1..c608dcf 100644 --- a/third_party/blink/renderer/core/html/forms/text_control_element.cc +++ b/third_party/blink/renderer/core/html/forms/text_control_element.cc
@@ -183,19 +183,10 @@ return stripped.ToString(); } -static bool IsNotLineBreak(UChar ch) { - return ch != kNewlineCharacter && ch != kCarriageReturnCharacter; -} - -bool TextControlElement::IsPlaceholderEmpty() const { - const AtomicString& attribute_value = - FastGetAttribute(html_names::kPlaceholderAttr); - return attribute_value.GetString().Find(IsNotLineBreak) == kNotFound; -} - bool TextControlElement::PlaceholderShouldBeVisible() const { return SupportsPlaceholder() && InnerEditorValue().empty() && - !IsPlaceholderEmpty() && SuggestedValue().empty(); + FastHasAttribute(html_names::kPlaceholderAttr) && + SuggestedValue().empty(); } HTMLElement* TextControlElement::PlaceholderElement() const {
diff --git a/third_party/blink/renderer/core/html/forms/text_control_element.h b/third_party/blink/renderer/core/html/forms/text_control_element.h index 2d6dc7cb..68509a2 100644 --- a/third_party/blink/renderer/core/html/forms/text_control_element.h +++ b/third_party/blink/renderer/core/html/forms/text_control_element.h
@@ -164,7 +164,6 @@ protected: TextControlElement(const QualifiedName&, Document&); - bool IsPlaceholderEmpty() const; virtual void UpdatePlaceholderText() = 0; virtual String GetPlaceholderValue() const = 0;
diff --git a/third_party/blink/renderer/core/layout/layout_box.cc b/third_party/blink/renderer/core/layout/layout_box.cc index 66f847db..24d03cb 100644 --- a/third_party/blink/renderer/core/layout/layout_box.cc +++ b/third_party/blink/renderer/core/layout/layout_box.cc
@@ -147,6 +147,13 @@ LayoutUnit TextAreaIntrinsicInlineSize(const HTMLTextAreaElement& textarea, const LayoutBox& box) { + int scrollbar_thickness = 0; + if (!RuntimeEnabledFeatures::LayoutNewTextAreaScrollbarEnabled() || + box.StyleRef().OverflowBlockDirection() == EOverflow::kScroll || + box.StyleRef().OverflowBlockDirection() == EOverflow::kAuto) { + scrollbar_thickness = layout_text_control::ScrollbarThickness(box); + } + // <textarea>'s intrinsic inline-size always contains the scrollbar thickness // regardless of actual existence of a scrollbar. // @@ -154,7 +161,7 @@ // ComputeIntrinsicLogicalWidths()|. return LayoutUnit(ceilf(layout_text_control::GetAvgCharWidth(box.StyleRef()) * textarea.cols())) + - layout_text_control::ScrollbarThickness(box); + scrollbar_thickness; } LayoutUnit TextFieldIntrinsicInlineSize(const HTMLInputElement& input, @@ -211,12 +218,15 @@ const LayoutBox& inner_box = *inner_editor->GetLayoutBox(); const ComputedStyle& inner_style = inner_box.StyleRef(); // We are able to have a horizontal scrollbar if the overflow style is - // scroll, or if its auto and there's no word wrap. + // scroll, or if it's auto and there's no word wrap and new textarea + // scrollbar logic is disabled. int scrollbar_thickness = 0; if (box.StyleRef().OverflowInlineDirection() == EOverflow::kScroll || - (box.StyleRef().OverflowInlineDirection() == EOverflow::kAuto && - inner_style.OverflowWrap() == EOverflowWrap::kNormal)) + (!RuntimeEnabledFeatures::LayoutNewTextAreaScrollbarEnabled() && + box.StyleRef().OverflowInlineDirection() == EOverflow::kAuto && + inner_style.OverflowWrap() == EOverflowWrap::kNormal)) { scrollbar_thickness = layout_text_control::ScrollbarThickness(box); + } return inner_box.FirstLineHeight() * textarea.rows() + scrollbar_thickness; }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc index 00600cd..e968f69 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc
@@ -466,9 +466,8 @@ // Inline children require an inline child layout context to be // passed between siblings. We want to stack-allocate that one, but // only on demand, as it's quite big. - NGLayoutInputNode first_child(nullptr); - if (Node().IsInlineFormattingContextRoot(&first_child)) { - NGInlineNode inline_child = To<NGInlineNode>(first_child); + NGInlineNode inline_child(nullptr); + if (Node().IsInlineFormattingContextRoot(&inline_child)) { if (UNLIKELY(NeedsLineInfoList(inline_child))) { result = LayoutWithLineInfoList(inline_child); } else {
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc index 0ccd165..9024c4e0 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc
@@ -1680,14 +1680,14 @@ } bool NGBlockNode::IsInlineFormattingContextRoot( - NGLayoutInputNode* first_child_out) const { + NGInlineNode* first_child_out) const { if (const auto* block = DynamicTo<LayoutBlockFlow>(box_.Get())) { if (!AreNGBlockFlowChildrenInline(block)) return false; NGLayoutInputNode first_child = FirstChild(); if (first_child.IsInline()) { if (first_child_out) - *first_child_out = first_child; + *first_child_out = To<NGInlineNode>(first_child); return true; } }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.h b/third_party/blink/renderer/core/layout/ng/ng_block_node.h index f3ce10f..6aa781b 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.h +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.h
@@ -20,6 +20,7 @@ class NGConstraintSpace; class NGEarlyBreak; class NGFragmentItems; +class NGInlineNode; class NGLayoutResult; class NGPhysicalBoxFragment; class NGPhysicalFragment; @@ -144,7 +145,7 @@ // or nodes consisting purely of block-level, floats, and/or out-of-flow // positioned children will return false. bool IsInlineFormattingContextRoot( - NGLayoutInputNode* first_child_out = nullptr) const; + NGInlineNode* first_child_out = nullptr) const; bool IsInlineLevel() const; bool IsAtomicInlineLevel() const;
diff --git a/third_party/blink/renderer/core/testing/fake_local_frame_host.cc b/third_party/blink/renderer/core/testing/fake_local_frame_host.cc index db1c9ff..68873da0 100644 --- a/third_party/blink/renderer/core/testing/fake_local_frame_host.cc +++ b/third_party/blink/renderer/core/testing/fake_local_frame_host.cc
@@ -255,13 +255,13 @@ const WTF::String& event_data, const WTF::String& event_type, const WTF::Vector<blink::FencedFrame::ReportingDestination>& destinations, - const network::AttributionReportingRuntimeFeatures& + network::AttributionReportingRuntimeFeatures attribution_reporting_runtime_features) {} void FakeLocalFrameHost::SetFencedFrameAutomaticBeaconReportEventData( const WTF::String& event_data, const WTF::Vector<blink::FencedFrame::ReportingDestination>& destinations, - const network::AttributionReportingRuntimeFeatures& + network::AttributionReportingRuntimeFeatures attribution_reporting_runtime_features) {} void FakeLocalFrameHost::SendPrivateAggregationRequestsForFencedFrameEvent(
diff --git a/third_party/blink/renderer/core/testing/fake_local_frame_host.h b/third_party/blink/renderer/core/testing/fake_local_frame_host.h index 995a97b..8e0828f 100644 --- a/third_party/blink/renderer/core/testing/fake_local_frame_host.h +++ b/third_party/blink/renderer/core/testing/fake_local_frame_host.h
@@ -176,12 +176,12 @@ const WTF::String& event_data, const WTF::String& event_type, const WTF::Vector<blink::FencedFrame::ReportingDestination>& destinations, - const network::AttributionReportingRuntimeFeatures& + network::AttributionReportingRuntimeFeatures attribution_reporting_runtime_features) override; void SetFencedFrameAutomaticBeaconReportEventData( const WTF::String& event_data, const WTF::Vector<blink::FencedFrame::ReportingDestination>& destinations, - const network::AttributionReportingRuntimeFeatures& + network::AttributionReportingRuntimeFeatures attribution_reporting_runtime_features) override; void SendPrivateAggregationRequestsForFencedFrameEvent( const WTF::String& event_type) override;
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.cc b/third_party/blink/renderer/modules/accessibility/ax_object.cc index 532e17d..0875a56 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object.cc
@@ -598,6 +598,46 @@ --number_of_live_ax_objects_; } +void AXObject::SetAncestorsHaveDirtyDescendants() const { + if (!RuntimeEnabledFeatures::AccessibilityEagerAXTreeUpdateEnabled()) { + return; + } + for (auto* obj = CachedParentObject(); obj; obj = obj->CachedParentObject()) { + DCHECK(!obj->IsDetached()); + // We need to to continue setting bits through AX objects for which + // LastKnownIsIncludedInTreeValue is false, since those objects are omitted + // from the generated tree. + if (obj->has_dirty_descendants_ && obj->LastKnownIsIncludedInTreeValue()) { + break; + } + obj->has_dirty_descendants_ = true; + } +#if DCHECK_IS_ON() + // Walk up the tree looking for dirty bits that failed to be set. If any + // are found, this is a bug. + if (!AXObjectCache().UpdatingTree()) { + bool fail = false; + for (auto* obj = CachedParentObject(); obj; + obj = obj->CachedParentObject()) { + if (!obj->has_dirty_descendants_) { + fail = true; + break; + } + } + if (fail) { + LOG(ERROR) << "Failed to set dirty bits on some objects in the ancestor" + "chain. Bits set: "; + for (auto* obj = this; obj; obj = obj->CachedParentObject()) { + LOG(ERROR) << "has_dirty_descendants_: " << obj->has_dirty_descendants_ + << " object: " << obj->AXObjectID() + << " detached: " << obj->IsDetached(); + } + DCHECK(false); + } + } +#endif +} + void AXObject::Init(AXObject* parent) { #if DCHECK_IS_ON() DCHECK(!parent_) << "Should not already have a cached parent:" @@ -693,6 +733,7 @@ parent_ = nullptr; ax_object_cache_ = nullptr; children_dirty_ = false; + has_dirty_descendants_ = false; id_ = 0; } @@ -756,6 +797,7 @@ #endif parent_ = new_parent; + SetAncestorsHaveDirtyDescendants(); } bool AXObject::IsMissingParent() const { @@ -5473,6 +5515,7 @@ return; children_dirty_ = true; ClearChildren(); + SetAncestorsHaveDirtyDescendants(); } // static
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.h b/third_party/blink/renderer/modules/accessibility/ax_object.h index 359ae2e..e6cf2c4b 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.h +++ b/third_party/blink/renderer/modules/accessibility/ax_object.h
@@ -293,6 +293,19 @@ // root of the tree. virtual void Init(AXObject* parent); + // TODO(chrishtr): these methods are not really const, but there are various + // other related methods that need const. Review/fix. + + // Sets, clears or queries the has_dirty_descendants_ bit. This dirty + // bit controls whether the object, or a descendant, needs to be visited + // a tree walk to update the AX tree via + // AXObjectCacheImpl::UpdateTreeIfNeeded. It does not directly indicate + // whether children, parent or other pointers are actually out of date; there + // are other dirty bits such as children_dirty_ for that. + void SetAncestorsHaveDirtyDescendants() const; + void ClearHasDirtyDescendants() { has_dirty_descendants_ = false; } + bool HasDirtyDescendants() const { return has_dirty_descendants_; } + // When the corresponding WebCore object that this AXObject // wraps is deleted, it must be detached. virtual void Detach(); @@ -1394,7 +1407,8 @@ mutable Member<AXObject> parent_; // Only children that are included in tree, maybe rename to children_in_tree_. mutable AXObjectVector children_; - mutable bool children_dirty_; + mutable bool children_dirty_ = false; + mutable bool has_dirty_descendants_ = false; // The final role, taking into account the ARIA role and native role. ax::mojom::blink::Role role_;
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc index 8a66260f..1e24da35 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc
@@ -2369,6 +2369,60 @@ relation_cache_->UpdateRelatedTree(optional_node, obj); } +void AXObjectCacheImpl::UpdateTreeIfNeededOnce() { + DCHECK(!updating_tree_); + base::AutoReset<bool> updating(&updating_tree_, true); + HeapDeque<Member<AXObject>> objects_to_process; + objects_to_process.push_back(Root()); + while (!objects_to_process.empty()) { + AXObject* obj = objects_to_process.front(); + objects_to_process.pop_front(); + if (obj->IsDetached()) { + continue; + } + obj->UpdateChildrenIfNecessary(); + if (obj->HasDirtyDescendants()) { + obj->ClearHasDirtyDescendants(); + for (auto& child : obj->ChildrenIncludingIgnored()) { + objects_to_process.push_back(child); + } + } + } +} + +void AXObjectCacheImpl::UpdateTreeIfNeeded() { + if (!RuntimeEnabledFeatures::AccessibilityEagerAXTreeUpdateEnabled()) { + return; + } + UpdateTreeIfNeededOnce(); + // Update a second time because image maps or AX relations may invalidate + // ancestors. See AXNodeObject::AddImageMapChildren or + // AXRelationCache::UpdateRelatedText. + // TODO(chrishtr): find a way to do this without two tree walks. + if (Root()->HasDirtyDescendants() || Root()->NeedsToUpdateChildren()) { + UpdateTreeIfNeededOnce(); + } + +#if EXPENSIVE_DCHECKS_ARE_ON() + HeapDeque<Member<AXObject>> objects_to_process; + objects_to_process.push_back(Root()); + while (!objects_to_process.empty()) { + AXObject* obj = objects_to_process.TakeFirst(); + if (obj->IsDetached()) { + continue; + } + DCHECK(!obj->NeedsToUpdateChildren()) + << "No children in the tree should require an update at this point."; + // Use CachedChildrenIncludingIgnored() so that the DCHECK code paths don't + // end up with a different tree. + DCHECK(!obj->HasDirtyDescendants()) << " " << obj; + for (auto& child : obj->CachedChildrenIncludingIgnored()) { + objects_to_process.push_back(child); + } + } +#endif +} + void AXObjectCacheImpl::ProcessDeferredAccessibilityEvents(Document& document) { if (IsPopup(document)) { // Only process popup document together with main document. @@ -2447,7 +2501,7 @@ relation_cache_->ProcessUpdatesWithCleanLayout(); // Keep going if there are more ids to invalidate or children changes to - // process from previous steps. For examople, a display locked + // process from previous steps. For example, a display locked // (content-visibility:auto) element could be invalidated as it is scrolled // in or out of view, causing Invalidate() to add it to invalidated_ids_. // As ProcessInvalidatedObjects() refreshes the objectt and calls @@ -2459,6 +2513,10 @@ } while (!nodes_with_pending_children_changed_.empty() || !GetInvalidatedIds(document).empty()); + if (RuntimeEnabledFeatures::AccessibilityEagerAXTreeUpdateEnabled()) { + UpdateTreeIfNeeded(); + } + // Send events to RenderAccessibilityImpl, which serializes them and then // sends the serialized events and dirty objects to the browser process. PostNotifications(document); @@ -2477,9 +2535,19 @@ !invalidated_ids_popup_.empty(); } -bool AXObjectCacheImpl::IsDirty() const { - return IsMainDocumentDirty() || IsPopupDocumentDirty() || - relation_cache_->IsDirty(); +bool AXObjectCacheImpl::IsDirty() { + if (IsMainDocumentDirty() || IsPopupDocumentDirty() || + relation_cache_->IsDirty()) { + return true; + } + DCHECK(RuntimeEnabledFeatures::AccessibilityEagerAXTreeUpdateEnabled() || + !Root()->HasDirtyDescendants()); + if (RuntimeEnabledFeatures::AccessibilityEagerAXTreeUpdateEnabled()) { + if (Root()->NeedsToUpdateChildren() || Root()->HasDirtyDescendants()) { + return true; + } + } + return false; } void AXObjectCacheImpl::EmbeddingTokenChanged(HTMLFrameOwnerElement* element) { @@ -3636,6 +3704,9 @@ if (!obj) return; + // TODO(chrishtr): handle |subtree|. + obj->SetAncestorsHaveDirtyDescendants(); + // If the content is inside the popup, mark the owning element dirty. // TODO(aleventhal): not sure why this works, but now that we run a11y in // PostRunLifecycleTasks(), we need this, otherwise the pending updates in
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h index 8ea076d..0621982 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h +++ b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h
@@ -233,7 +233,7 @@ // Called during the accessibility lifecycle to refresh the AX tree. void ProcessDeferredAccessibilityEvents(Document&) override; // Is there work to be done when layout becomes clean? - bool IsDirty() const override; + bool IsDirty() override; // Called when a HTMLFrameOwnerElement (such as an iframe element) changes the // embedding token of its child frame. @@ -513,6 +513,10 @@ void ResetSerializer() override; void MarkElementDirty(const Node*) override; + // Returns true if UpdateTreeIfNeeded has been called and has not yet + /// finished. + bool UpdatingTree() { return updating_tree_; } + protected: void PostPlatformNotification( AXObject* obj, @@ -564,6 +568,17 @@ "blink::WebAXObject"); }; + // Calls UpdateTreeIfNeededOnce if NeedsUpdate is true on the root AXObject, + // and a second time if it is still true. + void UpdateTreeIfNeeded(); + // Updates the AX tree once by walking from the root, calling AXObject:: + // UpdateChildrenIfNecessary on each AXObject for which NeedsUpdate is true. + // This method is part of a11y-during-render, and in particular transitioning + // to an eager (as opposed to lazy) AX tree update pattern. See + // https://bugs.chromium.org/p/chromium/issues/detail?id=1342801#c12 for more + // details. + void UpdateTreeIfNeededOnce(); + // Create an AXObject, and do not check if a previous one exists. // Also, initialize the object and add it to maps for later retrieval. AXObject* CreateAndInit(Node*, @@ -934,6 +949,7 @@ Deque<ui::AXEvent> pending_events_; + bool updating_tree_ = false; // Make sure the next serialization sends everything. bool mark_all_dirty_ = false;
diff --git a/third_party/blink/renderer/modules/document_picture_in_picture/picture_in_picture_controller_impl.cc b/third_party/blink/renderer/modules/document_picture_in_picture/picture_in_picture_controller_impl.cc index 41cbb9a..7980bbb 100644 --- a/third_party/blink/renderer/modules/document_picture_in_picture/picture_in_picture_controller_impl.cc +++ b/third_party/blink/renderer/modules/document_picture_in_picture/picture_in_picture_controller_impl.cc
@@ -413,7 +413,8 @@ continue; } CSSStyleSheet* css = To<CSSStyleSheet>(sheet); - StyleSheetContents* contents = css->Contents(); + StyleSheetContents* contents = + MakeGarbageCollected<StyleSheetContents>(*css->Contents()); // Inject the style sheet. It will not stay in sync with the opener. //
diff --git a/third_party/blink/renderer/modules/document_picture_in_picture/picture_in_picture_controller_test.cc b/third_party/blink/renderer/modules/document_picture_in_picture/picture_in_picture_controller_test.cc index db848f7..c444508 100644 --- a/third_party/blink/renderer/modules/document_picture_in_picture/picture_in_picture_controller_test.cc +++ b/third_party/blink/renderer/modules/document_picture_in_picture/picture_in_picture_controller_test.cc
@@ -815,6 +815,12 @@ // CSS for a blue background should have been copied from the opener. EXPECT_EQ(GetBodyBackgroundColor(v8_scope, pictureInPictureDocument), "rgb(0, 0, 255)"); + + // Changing the opener's sheets should not result in a change to PiP. + CSSStyleSheet* sheet = DynamicTo<CSSStyleSheet>(FindStyleSheetInOpener()); + sheet->deleteRule(0, v8_scope.GetExceptionState()); + EXPECT_EQ(GetBodyBackgroundColor(v8_scope, pictureInPictureDocument), + "rgb(0, 0, 255)"); } TEST_F(PictureInPictureControllerTestWithChromeClient,
diff --git a/third_party/blink/renderer/modules/webgpu/BUILD.gn b/third_party/blink/renderer/modules/webgpu/BUILD.gn index 266351fa..704e599 100644 --- a/third_party/blink/renderer/modules/webgpu/BUILD.gn +++ b/third_party/blink/renderer/modules/webgpu/BUILD.gn
@@ -97,6 +97,8 @@ "string_utils.h", "texture_utils.cc", "texture_utils.h", + "wgsl_language_features.cc", + "wgsl_language_features.h", ] deps = [ "//gpu/command_buffer/client:webgpu_interface",
diff --git a/third_party/blink/renderer/modules/webgpu/gpu.cc b/third_party/blink/renderer/modules/webgpu/gpu.cc index 6b28582..3b3b17ae 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu.cc +++ b/third_party/blink/renderer/modules/webgpu/gpu.cc
@@ -33,6 +33,7 @@ #include "third_party/blink/renderer/modules/webgpu/gpu_buffer.h" #include "third_party/blink/renderer/modules/webgpu/gpu_supported_features.h" #include "third_party/blink/renderer/modules/webgpu/string_utils.h" +#include "third_party/blink/renderer/modules/webgpu/wgsl_language_features.h" #include "third_party/blink/renderer/platform/graphics/gpu/dawn_control_client_holder.h" #include "third_party/blink/renderer/platform/graphics/gpu/webgpu_callback.h" #include "third_party/blink/renderer/platform/graphics/web_graphics_context_3d_provider_util.h" @@ -120,16 +121,24 @@ GPU::GPU(NavigatorBase& navigator) : Supplement<NavigatorBase>(navigator), ExecutionContextLifecycleObserver(navigator.GetExecutionContext()), + wgsl_language_features_(MakeGarbageCollected<WGSLLanguageFeatures>()), mappable_buffer_handles_( - base::MakeRefCounted<BoxedMappableWGPUBufferHandles>()) {} + base::MakeRefCounted<BoxedMappableWGPUBufferHandles>()) { + DCHECK(wgsl_language_features_->FeatureNameSet().empty()); +} GPU::~GPU() = default; +WGSLLanguageFeatures* GPU::wgslLanguageFeatures() const { + return wgsl_language_features_; +} + void GPU::Trace(Visitor* visitor) const { ScriptWrappable::Trace(visitor); Supplement<NavigatorBase>::Trace(visitor); ExecutionContextLifecycleObserver::Trace(visitor); visitor->Trace(mappable_buffers_); + visitor->Trace(wgsl_language_features_); } void GPU::ContextDestroyed() {
diff --git a/third_party/blink/renderer/modules/webgpu/gpu.h b/third_party/blink/renderer/modules/webgpu/gpu.h index c1940d4..118bc21 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu.h +++ b/third_party/blink/renderer/modules/webgpu/gpu.h
@@ -30,6 +30,7 @@ class ScriptPromiseResolver; class ScriptState; class DawnControlClientHolder; +class WGSLLanguageFeatures; struct BoxedMappableWGPUBufferHandles : public RefCounted<BoxedMappableWGPUBufferHandles> { @@ -78,6 +79,7 @@ ScriptPromise requestAdapter(ScriptState* script_state, const GPURequestAdapterOptions* options); String getPreferredCanvasFormat(); + WGSLLanguageFeatures* wgslLanguageFeatures() const; static WGPUTextureFormat preferred_canvas_format(); @@ -111,6 +113,8 @@ const GPURequestAdapterOptions* options, ScriptPromiseResolver* resolver); + Member<WGSLLanguageFeatures> wgsl_language_features_; + scoped_refptr<DawnControlClientHolder> dawn_control_client_; WTF::Vector<base::OnceCallback<void()>> dawn_control_client_initialized_callbacks_;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu.idl b/third_party/blink/renderer/modules/webgpu/gpu.idl index 52964c86d..653c681 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu.idl
@@ -29,4 +29,5 @@ CallWith=ScriptState ] Promise<GPUAdapter?> requestAdapter(optional GPURequestAdapterOptions options = {}); GPUTextureFormat getPreferredCanvasFormat(); + [SameObject] readonly attribute WGSLLanguageFeatures wgslLanguageFeatures; };
diff --git a/third_party/blink/renderer/modules/webgpu/wgsl_language_features.cc b/third_party/blink/renderer/modules/webgpu/wgsl_language_features.cc new file mode 100644 index 0000000..88cbe10 --- /dev/null +++ b/third_party/blink/renderer/modules/webgpu/wgsl_language_features.cc
@@ -0,0 +1,45 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/modules/webgpu/wgsl_language_features.h" + +namespace blink { + +WGSLLanguageFeatures::WGSLLanguageFeatures() = default; + +bool WGSLLanguageFeatures::has(const String& feature) const { + return features_.Contains(feature); +} + +bool WGSLLanguageFeatures::hasForBinding( + ScriptState* script_state, + const String& feature, + ExceptionState& exception_state) const { + return has(feature); +} + +WGSLLanguageFeatures::IterationSource::IterationSource( + const HashSet<String>& features) { + features_.ReserveCapacityForSize(features.size()); + for (auto feature : features) { + features_.insert(feature); + } + iter_ = features_.begin(); +} + +bool WGSLLanguageFeatures::IterationSource::FetchNextItem( + ScriptState* script_state, + String& value, + ExceptionState& exception_state) { + if (iter_ == features_.end()) { + return false; + } + + value = *iter_; + ++iter_; + + return true; +} + +} // namespace blink
diff --git a/third_party/blink/renderer/modules/webgpu/wgsl_language_features.h b/third_party/blink/renderer/modules/webgpu/wgsl_language_features.h new file mode 100644 index 0000000..bb13af8 --- /dev/null +++ b/third_party/blink/renderer/modules/webgpu/wgsl_language_features.h
@@ -0,0 +1,62 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_WGSL_LANGUAGE_FEATURES_H_ +#define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_WGSL_LANGUAGE_FEATURES_H_ + +#include <bitset> + +#include "third_party/blink/renderer/bindings/core/v8/iterable.h" +#include "third_party/blink/renderer/bindings/modules/v8/v8_sync_iterator_wgsl_language_features.h" +#include "third_party/blink/renderer/platform/bindings/script_wrappable.h" +#include "third_party/blink/renderer/platform/wtf/hash_set.h" + +namespace blink { + +class WGSLLanguageFeatures : public ScriptWrappable, + public ValueSyncIterable<WGSLLanguageFeatures> { + DEFINE_WRAPPERTYPEINFO(); + + public: + WGSLLanguageFeatures(); + + bool has(const String& feature) const; + bool hasForBinding(ScriptState* script_state, + const String& feature, + ExceptionState& exception_state) const; + + unsigned size() const { return features_.size(); } + + const HashSet<String>& FeatureNameSet() const { return features_; } + + private: + HashSet<String> features_; + + class IterationSource final + : public ValueSyncIterable<WGSLLanguageFeatures>::IterationSource { + public: + explicit IterationSource(const HashSet<String>& features); + + bool FetchNextItem(ScriptState* script_state, + String& value, + ExceptionState& exception_state) override; + + private: + HashSet<String> features_; + HashSet<String>::iterator iter_; + }; + + // Starts iteration over the Setlike. + // Needed for ValueSyncIterable to work properly. + WGSLLanguageFeatures::IterationSource* CreateIterationSource( + ScriptState* script_state, + ExceptionState& exception_state) override { + return MakeGarbageCollected<WGSLLanguageFeatures::IterationSource>( + features_); + } +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_WGSL_LANGUAGE_FEATURES_H_
diff --git a/third_party/blink/renderer/modules/webgpu/wgsl_language_features.idl b/third_party/blink/renderer/modules/webgpu/wgsl_language_features.idl new file mode 100644 index 0000000..dd4c54fa6f --- /dev/null +++ b/third_party/blink/renderer/modules/webgpu/wgsl_language_features.idl
@@ -0,0 +1,12 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://gpuweb.github.io/gpuweb/ + +[ + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext +] interface WGSLLanguageFeatures { + readonly setlike<DOMString>; +};
diff --git a/third_party/blink/renderer/platform/media/hls_data_source_provider_impl.cc b/third_party/blink/renderer/platform/media/hls_data_source_provider_impl.cc index 66697a80..1132b6f0 100644 --- a/third_party/blink/renderer/platform/media/hls_data_source_provider_impl.cc +++ b/third_party/blink/renderer/platform/media/hls_data_source_provider_impl.cc
@@ -127,19 +127,11 @@ tick_clock); } -void HlsDataSourceProviderImpl::SetOwner( - media::HlsManifestDemuxerEngine* owner) { - DCHECK(main_task_runner_->BelongsToCurrentThread()); - DCHECK(!owner_ && owner); - owner_ = owner; -} - void HlsDataSourceProviderImpl::RequestDataSource( GURL uri, absl::optional<media::hls::types::ByteRange> range, RequestCb callback) { DCHECK(main_task_runner_->BelongsToCurrentThread()); - DCHECK(owner_); // TODO(https://crbug.com/1379488): Find a way to force // `MultiBufferDataSource` to limit its requests to within `range`.
diff --git a/third_party/blink/renderer/platform/media/hls_data_source_provider_impl.h b/third_party/blink/renderer/platform/media/hls_data_source_provider_impl.h index ec2d82f..20ac680e3 100644 --- a/third_party/blink/renderer/platform/media/hls_data_source_provider_impl.h +++ b/third_party/blink/renderer/platform/media/hls_data_source_provider_impl.h
@@ -32,9 +32,7 @@ scoped_refptr<base::SequencedTaskRunner> media_task_runner, const base::TickClock* tick_clock); - void SetOwner(media::HlsManifestDemuxerEngine* owner) override; - - // |media::HlsManifestDemuxerEngine::DataSourceProvider| implementation + // `media::DataSourceProvider` implementation void RequestDataSource(GURL uri, absl::optional<media::hls::types::ByteRange> range, RequestCb callback) override; @@ -64,7 +62,6 @@ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; scoped_refptr<base::SequencedTaskRunner> media_task_runner_; std::unique_ptr<BufferedDataSourceHostImpl> buffered_data_source_host_; - media::HlsManifestDemuxerEngine* owner_ = nullptr; // Set of all active `MultiBufferDataSource`s belonging to the // `HlsDataSourceImpl`s created by this provider. This uses a
diff --git a/third_party/blink/renderer/platform/media/web_content_decryption_module_session_impl.cc b/third_party/blink/renderer/platform/media/web_content_decryption_module_session_impl.cc index 47545e4..cbad612 100644 --- a/third_party/blink/renderer/platform/media/web_content_decryption_module_session_impl.cc +++ b/third_party/blink/renderer/platform/media/web_content_decryption_module_session_impl.cc
@@ -41,6 +41,7 @@ const char kRemoveSessionUMAName[] = "RemoveSession"; const char kUpdateSessionUMAName[] = "UpdateSession"; const char kKeyStatusSystemCodeUMAName[] = "KeyStatusSystemCode"; +const char kInitialKeyStatusMixUMAName[] = "InitialKeyStatusMix"; media::CdmSessionType ConvertSessionType( WebEncryptedMediaSessionType session_type) { @@ -181,6 +182,62 @@ return true; } +// Reported to UMA. Do NOT change or reuse existing values. +enum class KeyStatusMixForUma { + kAllUsable = 0, + kAllInternalError = 1, + kAllExpired = 2, + kAllOutputRestricted = 3, + kAllOutputDownscaled = 4, + kAllKeyStatusPending = 5, + kAllReleased = 6, + kEmpty = 7, + kMixedWithUsable = 8, + kMixedWithoutUsable = 9, + kMaxValue = kMixedWithoutUsable +}; + +KeyStatusMixForUma GetKeyStatusMixForUma(const media::CdmKeysInfo& keys_info) { + if (keys_info.empty()) { + return KeyStatusMixForUma::kEmpty; + } + + bool has_usable = false; + bool is_mixed = false; + auto key_status = keys_info[0]->status; + + for (const auto& key_info : keys_info) { + if (key_info->status == media::CdmKeyInformation::KeyStatus::USABLE) { + has_usable = true; + } + if (key_info->status != key_status) { + is_mixed = true; + } + } + + if (!is_mixed) { + switch (key_status) { + case media::CdmKeyInformation::KeyStatus::USABLE: + return KeyStatusMixForUma::kAllUsable; + case media::CdmKeyInformation::KeyStatus::INTERNAL_ERROR: + return KeyStatusMixForUma::kAllInternalError; + case media::CdmKeyInformation::KeyStatus::EXPIRED: + return KeyStatusMixForUma::kAllExpired; + case media::CdmKeyInformation::KeyStatus::OUTPUT_RESTRICTED: + return KeyStatusMixForUma::kAllOutputRestricted; + case media::CdmKeyInformation::KeyStatus::OUTPUT_DOWNSCALED: + return KeyStatusMixForUma::kAllOutputDownscaled; + case media::CdmKeyInformation::KeyStatus::KEY_STATUS_PENDING: + return KeyStatusMixForUma::kAllKeyStatusPending; + case media::CdmKeyInformation::KeyStatus::RELEASED: + return KeyStatusMixForUma::kAllReleased; + } + } else { + return has_usable ? KeyStatusMixForUma::kMixedWithUsable + : KeyStatusMixForUma::kMixedWithoutUsable; + } +} + } // namespace WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl( @@ -417,7 +474,7 @@ WebVector<WebEncryptedMediaKeyInformation> keys(keys_info.size()); for (size_t i = 0; i < keys_info.size(); ++i) { auto& key_info = keys_info[i]; - keys[i].SetId(WebData(reinterpret_cast<char*>(&key_info->key_id[0]), + keys[i].SetId(WebData(reinterpret_cast<char*>(key_info->key_id.data()), key_info->key_id.size())); keys[i].SetStatus(ConvertCdmKeyStatus(key_info->status)); keys[i].SetSystemCode(key_info->system_code); @@ -427,6 +484,15 @@ key_info->system_code); } + // Only report the UMA on the first keys change event per session. + if (!has_key_status_uma_reported_) { + has_key_status_uma_reported_ = true; + auto key_status_mix_for_uma = GetKeyStatusMixForUma(keys_info); + base::UmaHistogramEnumeration( + adapter_->GetKeySystemUMAPrefix() + kInitialKeyStatusMixUMAName, + key_status_mix_for_uma); + } + // Now send the event to blink. client_->OnSessionKeysChange(keys, has_additional_usable_key); }
diff --git a/third_party/blink/renderer/platform/media/web_content_decryption_module_session_impl.h b/third_party/blink/renderer/platform/media/web_content_decryption_module_session_impl.h index 48e5b875..70d035d 100644 --- a/third_party/blink/renderer/platform/media/web_content_decryption_module_session_impl.h +++ b/third_party/blink/renderer/platform/media/web_content_decryption_module_session_impl.h
@@ -90,6 +90,8 @@ bool has_close_been_called_; bool is_closed_; + bool has_key_status_uma_reported_ = false; + THREAD_CHECKER(thread_checker_); // Since promises will live until they are fired, use a weak reference when
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 0419a3c..59bced2a 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -252,6 +252,10 @@ base_feature: "none", }, { + name: "AccessibilityEagerAXTreeUpdate", + status: "stable", + }, + { name: "AccessibilityExposeDisplayNone", status: "test", base_feature: "none", @@ -2077,6 +2081,10 @@ status: "stable", }, { + name: "LayoutNewTextAreaScrollbar", + status: "stable", + }, + { // crbug.com/1353190 name: "LayoutNGNoCopyBack", depends_on: ["RemoveConvertToLayerCoords"],
diff --git a/third_party/blink/tools/blinkpy/web_tests/fuzzy_diff_analyzer/fuzzy_diff_analyzer_analyzer.py b/third_party/blink/tools/blinkpy/web_tests/fuzzy_diff_analyzer/fuzzy_diff_analyzer_analyzer.py new file mode 100644 index 0000000..424afb2 --- /dev/null +++ b/third_party/blink/tools/blinkpy/web_tests/fuzzy_diff_analyzer/fuzzy_diff_analyzer_analyzer.py
@@ -0,0 +1,126 @@ +# Copyright 2023 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +"""Module for all matching analyzers.""" + +import numpy as np +from typing import List + +from blinkpy.web_tests.fuzzy_diff_analyzer import fuzzy_diff_analyzer_data_types as dt + + +class ImageMatchingAnalyzer: + """Abstract base class for all analyzers.""" + def run_analyzer(self, test_results: dt.TestToTypTagsType) -> str: + """Gets the analysis result of the input test's results. + + Returns: + A string representing the analyzer suggested matching information for + the input image comparison test's result. + """ + raise NotImplementedError() + + def description(self) -> str: + """Returns a description string representation of the analyzer.""" + raise NotImplementedError() + + +class FuzzyMatchingAnalyzer(ImageMatchingAnalyzer): + def __init__(self, + fuzzy_match_image_num_threshold: int = 3, + fuzzy_match_distinct_diff_num_threshold: int = 3): + """Class for the fuzzy matching analyzer for web tests. + + Args: + fuzzy_match_image_num_threshold: An int denoting the number of image + test result at least to get the suggested fuzzy match range. + fuzzy_match_distinct_diff_num_threshold: An int denoting the number of + different image diff result at least to calculate the suggested + fuzzy match range. + """ + super().__init__() + assert fuzzy_match_image_num_threshold >= 0 + assert fuzzy_match_distinct_diff_num_threshold >= 0 + self._image_num_threshold = fuzzy_match_image_num_threshold + self._distinct_diff_num_threshold = fuzzy_match_distinct_diff_num_threshold + + def run_analyzer(self, test_results: dt.TestToTypTagsType) -> str: + """Analyze the input image comparison test result for a fuzzy match + range suggestion. + + Args: + test_results: Parsed test results of a test with image diff data. + + Returns: + A string of fuzzy match range suggestion + """ + # Check the image num threshold + total_image_num = 0 + image_diff_counts = {} + for image_diff_list in test_results.values(): + total_image_num += len(image_diff_list) + for image_diff in image_diff_list: + key = dt.ImageDiffTagTupleType(image_diff.color_difference, + image_diff.pixel_difference, "") + image_diff_counts[key] = image_diff_counts.get(key, 0) + 1 + + # Total image number does not reach the threshold, return no result. + if total_image_num < self._image_num_threshold: + return 'Total image number is less than %d, no result' % \ + self._image_num_threshold + + # Total distinct image diff number does not reach the threshold, return all + # these image diff as suggested matching. + if len(image_diff_counts) < self._distinct_diff_num_threshold: + result = 'Total distinct image diff number is less than %d. Suggested ' \ + 'make all following image diff (color_difference, ' \ + 'pixel_difference) to match actual image result:' % \ + self._distinct_diff_num_threshold + for image_diff in image_diff_counts.keys(): + result = result + ' (%d, %d)' % (image_diff.color_difference, + image_diff.pixel_difference) + return result + + # Calculate the suggested fuzzy match number. + color_diff_list = [] + pixel_diff_list = [] + for image_diff, count in image_diff_counts.items(): + color_diff_list += [image_diff.color_difference] * count + pixel_diff_list += [image_diff.pixel_difference] * count + + result = 'The list of fuzzy match range suggested for this test: ' + result += '\nFor color difference:\n' + result += self._calculate_data_percentile(color_diff_list) + result += '\nFor pixel difference:\n' + result += self._calculate_data_percentile(pixel_diff_list) + return result + + def _calculate_data_percentile(self, data_list: List[int]) -> str: + """Calculate the input data list for the percentile result. + + Args: + data_list: List of int to calculate. + + Returns: + A string of percentile information. + """ + + if len(data_list) > 0: + data_list.sort() + color_diff_length = len(data_list) - 1 + result = '%d to cover 50 percentile, %d to cover 75 ' \ + 'percentile, %d to cover 90 percentile, %d to cover 95' \ + ' percentile, %d to cover all.' % \ + (data_list[int(color_diff_length * 0.5)], + data_list[int(color_diff_length * 0.75)], + data_list[int(color_diff_length * 0.9)], + data_list[int(color_diff_length * 0.95)], + data_list[color_diff_length]) + return result + + return "No data." + + def description(self) -> str: + return 'Fuzzy match analyzer with image_num_threshold of %d and ' \ + 'distinct_diff_num_threshold of %d' % \ + (self._image_num_threshold, self._distinct_diff_num_threshold)
diff --git a/third_party/blink/tools/blinkpy/web_tests/fuzzy_diff_analyzer/fuzzy_diff_analyzer_analyzer_unittest.py b/third_party/blink/tools/blinkpy/web_tests/fuzzy_diff_analyzer/fuzzy_diff_analyzer_analyzer_unittest.py new file mode 100644 index 0000000..576cfbc --- /dev/null +++ b/third_party/blink/tools/blinkpy/web_tests/fuzzy_diff_analyzer/fuzzy_diff_analyzer_analyzer_unittest.py
@@ -0,0 +1,140 @@ +# Copyright 2023 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import unittest + +from blinkpy.web_tests.fuzzy_diff_analyzer import fuzzy_diff_analyzer_analyzer as analyzer +from blinkpy.web_tests.fuzzy_diff_analyzer import fuzzy_diff_analyzer_data_types as dt + + +class FuzzyMatchingAnalyzerTest(unittest.TestCase): + def test_run_analyzer_in_image_num_threshold(self) -> None: + fuzzy_match_analyzer = analyzer.FuzzyMatchingAnalyzer( + fuzzy_match_image_num_threshold=4, + fuzzy_match_distinct_diff_num_threshold=5) + + test_data = \ + { + tuple(['win']): [ + dt.ImageDiffTagTupleType( + 10, 40, 'http://ci.chromium.org/b/1111'), + dt.ImageDiffTagTupleType( + 15, 42, 'http://ci.chromium.org/b/2222')], + tuple(['linux']): [ + dt.ImageDiffTagTupleType( + 10, 40, 'http://ci.chromium.org/b/3333')], + } + actual_result = fuzzy_match_analyzer.run_analyzer(test_data) + expected_result = 'Total image number is less than 4, no result' + self.assertEqual(actual_result, expected_result) + + def test_run_analyzer_in_distinct_diff_num_threshold(self) -> None: + fuzzy_match_analyzer = analyzer.FuzzyMatchingAnalyzer( + fuzzy_match_image_num_threshold=3, + fuzzy_match_distinct_diff_num_threshold=4) + + test_data = \ + { + tuple(['win']): [ + dt.ImageDiffTagTupleType( + 10, 40, 'http://ci.chromium.org/b/1111'), + dt.ImageDiffTagTupleType( + 15, 42, 'http://ci.chromium.org/b/2222')], + tuple(['linux']): [ + dt.ImageDiffTagTupleType( + 10, 40, 'http://ci.chromium.org/b/3333')], + } + actual_result = fuzzy_match_analyzer.run_analyzer(test_data) + expected_result = 'Total distinct image diff number is less than 4. ' \ + 'Suggested make all following image diff ' \ + '(color_difference, pixel_difference) to match actual ' \ + 'image result: (10, 40) (15, 42)' + self.assertEqual(actual_result, expected_result) + + def test_run_analyzer_in_fuzzy_match_range_in_different_platform( + self) -> None: + fuzzy_match_analyzer = analyzer.FuzzyMatchingAnalyzer( + fuzzy_match_image_num_threshold=3, + fuzzy_match_distinct_diff_num_threshold=3) + + test_data = \ + { + tuple(['win']): [ + dt.ImageDiffTagTupleType( + 10, 40, 'http://ci.chromium.org/b/1111'), + dt.ImageDiffTagTupleType( + 15, 42, 'http://ci.chromium.org/b/2222'), + dt.ImageDiffTagTupleType( + 16, 46, 'http://ci.chromium.org/b/4444'), + dt.ImageDiffTagTupleType( + 303, 8000, 'http://ci.chromium.org/b/5555')], + tuple(['linux']): [ + dt.ImageDiffTagTupleType( + 10, 40, 'http://ci.chromium.org/b/3333')], + } + actual_result = fuzzy_match_analyzer.run_analyzer(test_data) + expected_result = 'The list of fuzzy match range suggested for this ' \ + 'test: \nFor color difference:\n15 to cover 50 percentile, 16 ' \ + 'to cover 75 percentile, 16 to cover 90 percentile, ' \ + '16 to cover 95 percentile, 303 to cover all.\nFor ' \ + 'pixel difference:\n42 to cover 50 percentile, 46 to cover ' \ + '75 percentile, 46 to cover 90 percentile, 46 to cover ' \ + '95 percentile, 8000 to cover all.' + self.assertEqual(actual_result, expected_result) + + def test_run_analyzer_in_fuzzy_match_range_with_large_even_number_tests( + self) -> None: + fuzzy_match_analyzer = analyzer.FuzzyMatchingAnalyzer( + fuzzy_match_image_num_threshold=3, + fuzzy_match_distinct_diff_num_threshold=3) + image_diffs = [] + for i in range(1, 101): + image_diffs.append(dt.ImageDiffTagTupleType(i, 100 + i, '')) + test_data = \ + { + tuple(['win']): image_diffs, + } + actual_result = fuzzy_match_analyzer.run_analyzer(test_data) + expected_result = 'The list of fuzzy match range suggested for this ' \ + 'test: \nFor color difference:\n50 to cover 50 percentile, 75 ' \ + 'to cover 75 percentile, 90 to cover 90 percentile, ' \ + '95 to cover 95 percentile, 100 to cover all.\nFor ' \ + 'pixel difference:\n150 to cover 50 percentile, 175 to cover ' \ + '75 percentile, 190 to cover 90 percentile, 195 to cover ' \ + '95 percentile, 200 to cover all.' + self.assertEqual(actual_result, expected_result) + + def test_run_analyzer_in_fuzzy_match_range_with_large_odd_number_tests( + self) -> None: + fuzzy_match_analyzer = analyzer.FuzzyMatchingAnalyzer( + fuzzy_match_image_num_threshold=3, + fuzzy_match_distinct_diff_num_threshold=3) + image_diffs = [] + for i in range(1, 102): + image_diffs.append(dt.ImageDiffTagTupleType(i, 100 + i, '')) + test_data = \ + { + tuple(['win']): image_diffs, + } + actual_result = fuzzy_match_analyzer.run_analyzer(test_data) + expected_result = 'The list of fuzzy match range suggested for this ' \ + 'test: \nFor color difference:\n51 to cover 50 percentile, 76 ' \ + 'to cover 75 percentile, 91 to cover 90 percentile, ' \ + '96 to cover 95 percentile, 101 to cover all.\nFor ' \ + 'pixel difference:\n151 to cover 50 percentile, 176 to cover ' \ + '75 percentile, 191 to cover 90 percentile, 196 to cover ' \ + '95 percentile, 201 to cover all.' + self.assertEqual(actual_result, expected_result) + + def test_invalid_args(self) -> None: + # Test negative number. + with self.assertRaises(AssertionError): + analyzer.FuzzyMatchingAnalyzer( + fuzzy_match_image_num_threshold=-1, + fuzzy_match_distinct_diff_num_threshold=0) + # Test negative number. + with self.assertRaises(AssertionError): + analyzer.FuzzyMatchingAnalyzer( + fuzzy_match_image_num_threshold=0, + fuzzy_match_distinct_diff_num_threshold=-1)
diff --git a/third_party/blink/tools/run_wpt_tests.py b/third_party/blink/tools/run_wpt_tests.py index 0cca6cdd..1dfda1a 100755 --- a/third_party/blink/tools/run_wpt_tests.py +++ b/third_party/blink/tools/run_wpt_tests.py
@@ -25,10 +25,6 @@ from blinkpy.common.host import Host from blinkpy.common.path_finder import PathFinder from blinkpy.w3c.wpt_results_processor import WPTResultsProcessor -from blinkpy.web_tests.port.android import ( - ANDROID_WEBVIEW, - CHROME_ANDROID, -) from blinkpy.web_tests.port.base import Port path_finder.add_testing_dir_to_sys_path() @@ -180,6 +176,7 @@ self.fs = self.host.filesystem self.path_finder = PathFinder(self.fs) self.port = self.host.port_factory.get() + self._product_registry = make_product_registry() self._shard_index = _parse_environ_int('GTEST_SHARD_INDEX') self._total_shards = _parse_environ_int('GTEST_TOTAL_SHARDS') @@ -188,7 +185,7 @@ argv: Optional[List[str]] = None, ) -> argparse.Namespace: wptrunner_parser = wptcommandline.create_parser( - product_choices=sorted(_product_registry, key=len)) + product_choices=sorted(self._product_registry, key=len)) # Not ideal, but this creates a wptrunner-compliant CLI without showing # many irrelevant parameters. for group in wptrunner_parser._action_groups: @@ -455,6 +452,7 @@ stack.callback(self.fs.rmtree, tmp_dir) product = self._make_product(options) stack.enter_context(product.test_env()) + product.update_options_for_product(options) if options.use_upstream_wpt: tests_root = tools_root = self.fs.join(tmp_dir, 'upstream-wpt') @@ -498,7 +496,7 @@ return exit_code def _make_product(self, options: argparse.Namespace) -> 'Product': - product_cls = _product_registry[options.product] + product_cls = self._product_registry[options.product] return product_cls(self.host, options, self.port.python3_command()) def _checkout_3h_epoch_commit(self, tools_root: str): @@ -561,7 +559,7 @@ '-p', '--product', default='content_shell', - choices=sorted(_product_registry, key=len), + choices=sorted(self._product_registry, key=len), help='Product (browser or browser component) to test.') group.add_argument('--headless', action='store_true', @@ -733,28 +731,18 @@ 'Android specific arguments', 'Options for configuring Android devices and tooling.') common.add_emulator_args(group) - group.add_argument( - '--browser-apk', - # Aliases for backwards compatibility. - '--chrome-apk', - '--system-webview-shell', - type=os.path.abspath, - help=('Path to the browser APK to install and run. ' - '(For WebView, this value is the shell. ' - 'Defaults to an on-device APK if not provided.)')) + group.add_argument('--browser-apk', + type=os.path.abspath, + help=('Path to the browser APK to install and run. ' + '(For WebView, this value is the shell.)')) group.add_argument('--webview-provider', type=os.path.abspath, help=('Path to a WebView provider APK to install. ' '(WebView only.)')) - group.add_argument( - '--additional-apk', - type=os.path.abspath, - action='append', - default=[], - help='Paths to additional APKs to install.') - group.add_argument( - '--release-channel', - help='Install WebView from release channel. (WebView only.)') + group.add_argument('--no-install', + action='store_true', + help=('Do not install packages to device. ' + 'Use the packages preinstalled instead.')) return group def add_ios_arguments(self, parser): @@ -856,6 +844,18 @@ return functools.partial(run.run, dummy_venv) +def make_product_registry(): + """Create a mapping from all product names (including aliases) to their + respective classes. + """ + product_registry = {} + product_classes = [Chrome, ContentShell, ChromeiOS, ChromeAndroid, WebView] + for product_cls in product_classes: + names = [product_cls.name] + product_cls.aliases + product_registry.update((name, product_cls) for name in names) + return product_registry + + class Product: """A product (browser or browser component) that can run web platform tests. @@ -872,73 +872,55 @@ self._options = options self._python_executable = python_executable self._tasks = contextlib.ExitStack() - self._validate_options() def _path_from_target(self, *components): return self._path_finder.path_from_chromium_base( 'out', self._options.target, *components) - def _validate_options(self): - """Validate product-specific command-line options. - - The validity of some options may depend on the product. We check these - options here instead of at parse time because the product itself is an - option and the parser cannot handle that dependency. - - The test environment will not be set up at this point, so checks should - not depend on external resources. - - Raises: - ValueError: When the given options are invalid for this product. - The user will see the error's message (formatted with - `argparse`, not a traceback) and the program will exit early, - which avoids wasted runtime. - """ - @contextlib.contextmanager def test_env(self): """Set up and clean up the test environment.""" with self._tasks: - self.update_options() yield - def update_options(self): + def update_options_for_product(self, options): """Override product-specific wptrunner parameters.""" - version = self.get_version() # pylint: disable=assignment-from-none - if version: - self._options.browser_version = version - webdriver = self.webdriver_binary - if webdriver and self._host.filesystem.exists(webdriver): - self._options.webdriver_binary = webdriver + self._ensure_value(options, 'browser_version', self.get_version()) + self._ensure_value(options, 'webdriver_binary', + self.default_webdriver_binary) + + def _ensure_value(self, options, name, value): + if not getattr(options, name, None) and value is not None: + setattr(options, name, value) def get_version(self): """Get the product version, if available.""" return None @property - def webdriver_binary(self): - """Optional[str]: Path to the webdriver binary, if available.""" - return self._options.webdriver_binary + def default_webdriver_binary(self): + """Path to the default webdriver binary, if available.""" + return None class DesktopBase(Product): @property - def binary(self): - raise NotImplementedError + def default_binary(self): + return None - def update_options(self): - super().update_options() - self._options.binary = self.binary + def update_options_for_product(self, options): + super().update_options_for_product(options) + self._ensure_value(options, 'binary', self.default_binary) port = self._host.port_factory.get() - self._options.processes = (self._options.processes - or port.default_child_processes()) + self._ensure_value(options, 'processes', + port.default_child_processes()) class Chrome(DesktopBase): name = 'chrome' @property - def binary(self): + def default_binary(self): binary_path = 'chrome' if self._host.platform.is_win(): binary_path += '.exe' @@ -949,19 +931,19 @@ return self._path_from_target(binary_path) @property - def webdriver_binary(self): - default_binary = 'chromedriver' + def default_webdriver_binary(self): if self._host.platform.is_win(): - default_binary += '.exe' - return (super().webdriver_binary - or self._path_from_target(default_binary)) + path = 'chromedriver.exe' + else: + path = 'chromedriver' #linux and mac + return self._path_from_target(path) class ContentShell(DesktopBase): name = 'content_shell' @property - def binary(self): + def default_binary(self): binary_path = 'content_shell' if self._host.platform.is_win(): binary_path += '.exe' @@ -976,17 +958,14 @@ name = 'chrome_ios' @property - def webdriver_binary(self) -> Optional[str]: - return os.path.realpath( - os.path.join( - os.path.dirname(__file__), - '../../../ios/chrome/test/wpt/tools/' - 'run_cwt_chromedriver_wrapper.py')) + def default_webdriver_binary(self) -> Optional[str]: + return self._path_finder.path_from_chromium_base( + 'ios', 'chrome', 'test', 'wpt', 'tools', + 'run_cwt_chromedriver_wrapper.py') @contextlib.contextmanager def test_env(self): with super().test_env(): - self.update_options() # Set up xcode log output dir. output_dir = self._host.filesystem.join( self._host.filesystem.dirname( @@ -1021,48 +1000,51 @@ yield -@contextlib.contextmanager -def _install_apk(device, path): - """Helper context manager for ensuring a device uninstalls an APK.""" - device.Install(path) - try: - yield - finally: - device.Uninstall(path) - - class ChromeAndroidBase(Product): def __init__(self, host, options, python_executable=None): super().__init__(host, options, python_executable) - self.devices = {} + self.browser_apk = options.browser_apk or self.default_browser_apk + self.no_install = options.no_install + self.devices = [] + + @contextlib.contextmanager + def _install_apk(self, device, path): + """Helper context manager for ensuring a device uninstalls an APK.""" + device.Install(path) + try: + yield + finally: + device.Uninstall(path) @contextlib.contextmanager def test_env(self): with super().test_env(): - devil_chromium.Initialize(adb_path=self._options.adb_binary) - if not self._options.adb_binary: - self._options.adb_binary = devil_env.config.FetchPath('adb') - devices = self._tasks.enter_context(get_devices(self._options)) - if not devices: + self.adb_binary = devil_env.config.FetchPath('adb') + devil_chromium.Initialize(adb_path=self.adb_binary) + self.devices = self._tasks.enter_context(get_devices( + self._options)) + if not self.devices: raise Exception('No devices attached to this host. ' "Make sure to provide '--avd-config' " 'if using only emulators.') - self.provision_devices(devices) - self.update_options() + if not self.no_install: + self.provision_devices() yield - def update_options(self): - super().update_options() - self._options.device_serial.extend(sorted(self.devices)) - self._options.package_name = (self._options.package_name - or self.get_browser_package_name()) + def update_options_for_product(self, options): + super().update_options_for_product(options) + self._ensure_value(options, 'adb_binary', self.adb_binary) + self._ensure_value(options, 'device_serial', + [device.serial for device in self.devices]) + self._ensure_value(options, 'package_name', + self.get_browser_package_name()) def get_version(self): version_provider = self.get_version_provider_package_name() if self.devices and version_provider: # Assume devices are identically provisioned, so select any. - device = list(self.devices.values())[0] + device = self.devices[0] try: version = device.GetApplicationVersion(version_provider) logger.info('Product version: %s %s (package: %r)', self.name, @@ -1075,9 +1057,8 @@ return None @property - def webdriver_binary(self): - default_binary = self._path_from_target('clang_x64', 'chromedriver') - return super().webdriver_binary or default_binary + def default_webdriver_binary(self): + return self._path_from_target('clang_x64', 'chromedriver') def get_browser_package_name(self): """Get the name of the package to run tests against. @@ -1091,11 +1072,9 @@ See Also: https://github.com/web-platform-tests/wpt/blob/merge_pr_33203/tools/wpt/browser.py#L867-L924 """ - if self._options.package_name: - return self._options.package_name - if self._options.browser_apk: + if self.browser_apk: with contextlib.suppress(apk_helper.ApkHelperError): - return apk_helper.GetPackageName(self._options.browser_apk) + return apk_helper.GetPackageName(self.browser_apk) return None def get_version_provider_package_name(self): @@ -1116,17 +1095,11 @@ # Assume the product is a single APK. return self.get_browser_package_name() - def provision_devices(self, devices): + def provision_devices(self): """Provisions a set of Android devices in parallel.""" - contexts = [self._provision_device(device) for device in devices] + contexts = [self._provision_device(device) for device in self.devices] self._tasks.enter_context(SyncParallelizer(contexts)) - for device in devices: - if device.serial in self.devices: - raise Exception('duplicate device serial: %s' % device.serial) - self.devices[device.serial] = device - self._tasks.callback(self.devices.pop, device.serial, None) - @contextlib.contextmanager def _provision_device(self, device): """Provision a single Android device for a test. @@ -1135,33 +1108,31 @@ it is crucial that it is thread safe. """ with contextlib.ExitStack() as exit_stack: - if self._options.browser_apk: - exit_stack.enter_context( - _install_apk(device, self._options.browser_apk)) - for apk in self._options.additional_apk: - exit_stack.enter_context(_install_apk(device, apk)) + exit_stack.enter_context( + self._install_apk(device, self.browser_apk)) logger.info('Provisioned device (serial: %s)', device.serial) yield class WebView(ChromeAndroidBase): - name = ANDROID_WEBVIEW + name = 'android_webview' aliases = ['webview'] + def __init__(self, host, options, python_executable=None): + super().__init__(host, options, python_executable) + self.webview_provider = options.webview_provider or self.default_webview_provider + + @property + def default_browser_apk(self): + return self._path_from_target('apks', 'SystemWebViewShell.apk') + + @property + def default_webview_provider(self): + return self._path_from_target('apks', 'SystemWebView.apk') + def _install_webview(self, device): # Prioritize local builds. - if self._options.webview_provider: - return webview_app.UseWebViewProvider( - device, self._options.webview_provider) - assert self._options.release_channel, 'no webview install method' - return self._install_webview_from_release(device) - - def _validate_options(self): - super()._validate_options() - if not self._options.webview_provider \ - and not self._options.release_channel: - raise ValueError("Must provide either '--webview-provider' or " - "'--release-channel' to install WebView.") + return webview_app.UseWebViewProvider(device, self.webview_provider) def get_browser_package_name(self): return (super().get_browser_package_name() @@ -1182,50 +1153,14 @@ with self._install_webview(device), super()._provision_device(device): yield - @contextlib.contextmanager - def _install_webview_from_release(self, device): - script_path = self._path_finder.path_from_chromium_base( - 'clank', 'bin', 'install_webview.py') - command = [ - self._python_executable, script_path, '-s', device.serial, - '--channel', self._options.release_channel - ] - exit_code = common.run_command(command) - if exit_code != 0: - raise Exception( - 'failed to install webview from release ' - '(serial: %r, channel: %r, exit code: %d)' % - (device.serial, self._options.release_channel, exit_code)) - yield - class ChromeAndroid(ChromeAndroidBase): - name = CHROME_ANDROID + name = 'chrome_android' aliases = ['clank'] - def _validate_options(self): - super()._validate_options() - if not self._options.package_name and not self._options.browser_apk: - raise ValueError( - "Must provide either '--package-name' or '--browser-apk' " - 'for %r.' % self.name) - - -def _make_product_registry(): - """Create a mapping from all product names (including aliases) to their - respective classes. - """ - product_registry = {} - product_classes = [Chrome, ContentShell, ChromeiOS] - if _ANDROID_ENABLED: - product_classes.extend([ChromeAndroid, WebView]) - for product_cls in product_classes: - names = [product_cls.name] + product_cls.aliases - product_registry.update((name, product_cls) for name in names) - return product_registry - - -_product_registry = _make_product_registry() + @property + def default_browser_apk(self): + return self._path_from_target('apks', 'ChromePublic.apk') @contextlib.contextmanager
diff --git a/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials b/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials index 84584dd..f665d690 100644 --- a/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials +++ b/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials
@@ -84,7 +84,8 @@ crbug.com/1209223 external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-security-check-same-origin-domain.sub.html [ Failure ] # ====== New tests from wpt-importer added here ====== -crbug.com/626703 external/wpt/preload/modulepreload-as.html [ Timeout Failure ] +crbug.com/626703 external/wpt/clipboard-apis/async-navigator-clipboard-write-multiple.tentative.https.sub.html [ Timeout ] +crbug.com/626703 external/wpt/preload/modulepreload-as.html [ Failure Timeout ] crbug.com/626703 external/wpt/html/semantics/popovers/popover-hide-crash.html [ Timeout ] crbug.com/626703 virtual/fenced-frame-mparch/wpt_internal/fenced_frame/unfenced-top.https.html [ Timeout ] crbug.com/626703 [ Release ] virtual/fenced-frame-mparch/wpt_internal/fenced_frame/can-load-api.https.html [ Timeout ]
diff --git a/third_party/blink/web_tests/FlagExpectations/force-renderer-accessibility b/third_party/blink/web_tests/FlagExpectations/force-renderer-accessibility index 8996c8b6..c2bc2368 100644 --- a/third_party/blink/web_tests/FlagExpectations/force-renderer-accessibility +++ b/third_party/blink/web_tests/FlagExpectations/force-renderer-accessibility
@@ -82,3 +82,8 @@ # Most likely a forced style/layout update from accessibiity while we are # render blocking, which should not happen. + +crbug.com/1445710 external/wpt/css/css-lists/list-marker-containing-control-char-crash.html [ Failure ] + +# Times out +http/tests/inspector-protocol/runtime/serialization_options.js [ Skip ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index fa9162d7..a4f5406 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -1691,7 +1691,6 @@ crbug.com/1158554 external/wpt/css/css-conditional/at-supports-046.html [ Failure ] # CSS Scrollbars -crbug.com/891944 external/wpt/css/css-scrollbars/textarea-scrollbar-width-none.html [ Failure ] crbug.com/891944 external/wpt/css/css-scrollbars/transparent-on-root.html [ Failure ] # Failures from CSS3 Text (text-justify and text-indent: hanging/each-line) not being implemented. @@ -2910,8 +2909,9 @@ crbug.com/626703 [ Win ] virtual/partitioned-cookies/http/tests/inspector-protocol/network/disabled-cache-navigation.js [ Failure ] # ====== New tests from wpt-importer added here ====== -crbug.com/626703 external/wpt/preload/modulepreload-as.html [ Timeout Failure ] -crbug.com/626703 [ Win ] external/wpt/preload/modulepreload.html [ Timeout Failure ] +crbug.com/626703 external/wpt/clipboard-apis/async-navigator-clipboard-write-multiple.tentative.https.sub.html [ Timeout ] +crbug.com/626703 external/wpt/preload/modulepreload-as.html [ Failure Timeout ] +crbug.com/626703 [ Win ] external/wpt/preload/modulepreload.html [ Failure Timeout ] crbug.com/626703 [ Mac11 ] external/wpt/html/cross-origin-opener-policy/tentative/restrict-properties/access-reporting-post-message.https.html [ Timeout ] crbug.com/626703 [ Mac13 ] external/wpt/html/semantics/links/hyperlink-auditing/headers.optional.html [ Timeout ] crbug.com/626703 [ Mac13 ] external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-video.html [ Failure ] @@ -6007,6 +6007,8 @@ crbug.com/1434123 media/video-source-type-params.html [ Failure Pass ] crbug.com/1266821 [ Mac10.14 ] compositing/reflections/reflection-in-composited.html [ Timeout ] crbug.com/1418393 [ Debug Linux ] external/wpt/performance-timeline/not-restored-reasons/performance-navigation-timing-attributes.tentative.window.html [ Failure ] +crbug.com/1445580 [ Mac ] virtual/popover-hint-disabled/external/wpt/html/semantics/popovers/light-dismiss-event-ordering.html [ Timeout ] +crbug.com/1445674 [ Linux ] webaudio/internals/audioworkletprocessor-gc.https.html [ Timeout ] # Suppress http/tests/inspector-protocol/network/navigate-iframe-in2out.js test cluster crbug.com/1395412 [ Mac ] virtual/partitioned-cookies/http/tests/inspector-protocol/network/navigate-iframe-in2out.js [ Failure ]
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json index c889de08..81d9ff3 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json
@@ -100609,6 +100609,19 @@ {} ] ], + "at-supports-selector-file-selector-button.html": [ + "a51e503ef696fc0075234747a709ab8190fcf6d1", + [ + null, + [ + [ + "/css/css-conditional/at-supports-001-ref.html", + "==" + ] + ], + {} + ] + ], "css-supports-001.xht": [ "9221309d45fd637e613a1c11519a09fa105a4830", [ @@ -272123,11 +272136,11 @@ "support": { ".cache": { "gitignore2.json": [ - "eab186c5a15be1168b7c96f5f55e1e5ea447887c", + "33994b8c7d47d7fe5dad78f845cda057ecdbe35c", [] ], "mtime.json": [ - "dde16757bcee4e34fc657890539c48a97ab3db38", + "712c0eb75ab94f25f4850f933ea44fd9adf14dd8", [] ] }, @@ -275682,6 +275695,10 @@ "71aa47aca0b74604ff8ea329243b1486849d8d9d", [] ], + "async-navigator-clipboard-write-multiple.tentative.https.sub.html.ini": [ + "09a1898020974a298d8c042d0db472a2d6ea7414", + [] + ], "async-unsanitized-html-formats-write-read.tentative.https.html.ini": [ "ed4443ea57955d31f8dfa616768c18cd8d2a46de", [] @@ -275753,6 +275770,10 @@ "6e555e3b197ce2f448f59d61e1488a0175490145", [] ], + "page.html": [ + "35bde8e5016bd3ff045ebe8cc3e0e39b08d90dc1", + [] + ], "user-activation.js": [ "ed294bb9cb27b552f23061118fcd260dc6b86a8f", [] @@ -276310,6 +276331,10 @@ "72d0b2c6f6851764453f79cf71fc19be73bcb0e8", [] ], + "webkit-box-horizontal-reverse-variants.html.ini": [ + "e3d8ea8f45c1a3157e0e1cd2bc5942b192dfd0db", + [] + ], "webkit-box-horizontal-rtl-variants-ref.html": [ "42321c506979b2ec08814cf024dc95da24f3d6d2", [] @@ -291956,10 +291981,6 @@ "2f4eaa10a7a83e1bc6d70bf31f78cf1d86fd2d5a", [] ], - "color-computed-color-mix-function-expected.txt": [ - "99139ad99774438ab4d45bbd88a6beaad33e869f", - [] - ], "color-computed-color-mix-function.html.ini": [ "41595c07163a24a6c7d661b412c040e18992533c", [] @@ -297123,6 +297144,10 @@ [] ] }, + "percentage-descendant-of-anonymous-flex-item.html.ini": [ + "ea1c8b56922b68d929c01d7eaee705f78b5d1b5f", + [] + ], "percentage-heights-002-ref.html": [ "55ec381d23f2cb276368cbdfd4be4be061860945", [] @@ -318782,7 +318807,7 @@ [] ], "min-content-negative-margin-crash.html.ini": [ - "fc03201a2e519872f038f27bab9ee8d549c691f1", + "8b1ec07250783341395e37498aa692a0e71857f3", [] ], "nested-flexbox-image-percentage-max-height-computes-as-none-ref.html": [ @@ -326460,7 +326485,7 @@ [] ], "preserve3d-and-flattening-z-order-004.html.ini": [ - "9fdf89b3e6b5d5de5e0987ac93b05ac258b4cf47", + "678c8821596261b86a8c10ba34a365c5956fb875", [] ], "preserve3d-and-flattening-z-order-005.html.ini": [ @@ -329725,7 +329750,7 @@ [] ], "kind-of-widget-fallback-input-submit-border-right-color-001.html.ini": [ - "d417d77fddbe4a9cb63aef1474eab7a29911e6d7", + "02c56fc0709deaf2bf3203a5101303c561d959a7", [] ], "kind-of-widget-fallback-input-submit-border-right-style-001.html.ini": [ @@ -335914,11 +335939,11 @@ [] ], "idlharness-expected.txt": [ - "bd7cc069ca424c0703bbd3e280b6ef0bbb5848d8", + "7ec3477367d5c8f55af9fc6194fc6bf68974b732", [] ], "idlharness.html.ini": [ - "b04976d2081525721f81cfc7e7448e8dca0f1fe9", + "69e601a8249426edcfdfae6d271e688251413fe9", [] ], "insertRule-from-script-ref.html": [ @@ -336773,6 +336798,10 @@ "e8f5ef7e726886e9d816655732bf9bd6c085afd3", [] ], + "backdrop-filter-zero-size.html.ini": [ + "8356be887143286343197a0ebfe0211c777dadd2", + [] + ], "backdrop-filters-brightness-ref.html": [ "999894eb81f29dc441731d46772539db6b41ed2a", [] @@ -350635,6 +350664,20 @@ [] ] }, + "graphics-aria": { + "META.yml": [ + "692db91315ef759184fa1e4b7e259a9af40f3686", + [] + ], + "graphics-roles-expected.txt": [ + "086bb96e34a6e01452957f8ded5b19e41bb237c8", + [] + ], + "graphics-roles.html.ini": [ + "5a1045baf260f99ca5dc8abd0037496018417046", + [] + ] + }, "gyroscope": { "DIR_METADATA": [ "caea56d67a654fb8b15e43a1b0eab7e413a88177", @@ -357179,7 +357222,7 @@ [] ], "iframe-test.js": [ - "a18688caf786bb54d19df621b984dad3f9c1d411", + "f788cbd1ebdb7a76dff082d0a59649bf756310b2", [] ], "popup-test.js": [ @@ -357274,27 +357317,27 @@ [] ], "iframe-popup-to-un.https.html.ini": [ - "673d02cf901bcf85e712bb04a02bf9dff1430448", + "f12c342d4d2d2a357c17c7253f6dbe1397a8e9df", [] ], "iframe-popup-to-un.https_1-2-expected.txt": [ - "8202bc349aa27952eabe30d454d1e7cd82c62493", + "dad4d5276e0effcd7c278eda4dbed56eb54ab17e", [] ], "iframe-popup-to-un.https_3-4-expected.txt": [ - "9775b0166e25ca406ed0f4e80d7527568e8fa9e9", + "17f62ffff335ec61ca6dd7ffa4fd00a7a0aff9ab", [] ], "iframe-popup-to-un.https_5-6-expected.txt": [ - "1eae9ec768fe9f3fccec1d521a3b67671cc91d94", + "d4f46fced55357dddf8f09b0efbcbec4e4e51e05", [] ], "iframe-popup-to-un.https_7-8-expected.txt": [ - "29f43f321607de810c6bd738b0946ad2fec6bd29", + "8bf1c42a1f5702e30c7eb8f8c21d2498638f74f4", [] ], "iframe-popup-to-un.https_9-last-expected.txt": [ - "0008a079a6e678a726bed65539d3bc7a80c55c45", + "ea46f1732b074b65c9c58f7e5eb7c9bfe1244f62", [] ], "iframe-popup.https.html.headers": [ @@ -357302,23 +357345,23 @@ [] ], "iframe-popup.https.html.ini": [ - "ead098e8152ebd19f6c9fd2e8ce7c17c72726c96", + "64c1ac29baa1c8cc7fd0652244996b1da0b5068b", [] ], "iframe-popup.https_3-4-expected.txt": [ - "71f4d09dd9c5b1901424d21f863b45744d1fbbc2", + "644c164c8c437653d6c4efbf3c43ed7024028088", [] ], "iframe-popup.https_5-6-expected.txt": [ - "0dd9afe0878ba11fad168f603000f36acdee49b7", + "3c25f6bf259082c17102ff88df73ca9784ac259b", [] ], "iframe-popup.https_7-8-expected.txt": [ - "6a17b364180af685b858b1ae0e8112348f8bef31", + "0f7aa6470db647989128ed85f2c7535fef3e7809", [] ], "iframe-popup.https_9-last-expected.txt": [ - "8c4d17b714f69b4a3b48a00344b5a082e9f92f07", + "91a7867ef4014ac3f688742523402808e81cacbe", [] ], "named_targeting.https-expected.txt": [ @@ -357401,6 +357444,10 @@ "05d2d2984d8a6e34589a66c6dfc67391763fdead", [] ], + "reporting-bcg-reuse.https.html.sub.headers": [ + "33abadd83dd9187bfa5ecf811f9fef7058412780", + [] + ], "reporting-from-rp-ro.https-expected.txt": [ "ea3108eb21ec47915e61e5d4b61c42d46a37754a", [] @@ -357946,11 +357993,11 @@ [] ], "idlharness.https.html.ini": [ - "2ff4bc17cb04ac92b8bf6b4c9e5fe95081934d0c", + "1fbb91f3fa5c1479cf3497532097c19b15edd6fc", [] ], "idlharness.https_exclude=(Document_Window_HTML._)-expected.txt": [ - "4b4cb1b7399c63aaec61e006d7222ed4256bf58e", + "ad1f5d2eac1f5897b1382a0abacb9f334ab15fc7", [] ], "idlharness.https_include=(Document_Window)-expected.txt": [ @@ -357962,7 +358009,7 @@ [] ], "idlharness.worker-expected.txt": [ - "667c2c9dae313d25e4e919ac768f931198085886", + "8ea520aeae80ed1a61d357dcea4ea5517fee6959", [] ], "idlharness.worker.js.ini": [ @@ -365341,10 +365388,24 @@ [] ], "attributes-common-to-form-controls": { - "dirname-ltr-iframe.html": [ - "b5ed7e3d9a717746d9653c7d5f867f3acbf3e47f", + "dirname-only-if-applies-expected.txt": [ + "ba7c5f4246ad8fab9f87cbe4a918fd07979fc9a0", [] - ] + ], + "dirname-only-if-applies.html.ini": [ + "b73b3cee21bbefc674be9a46d20d03c1d69c9157", + [] + ], + "resources": { + "dirname-iframe.html": [ + "b5ed7e3d9a717746d9653c7d5f867f3acbf3e47f", + [] + ], + "dirname.js": [ + "f0e97bc30142bcf4ee0429283486091203b2c220", + [] + ] + } }, "constraints": { "form-validation-validity-patternMismatch.html.ini": [ @@ -371191,7 +371252,7 @@ [] ], "README.md": [ - "82138a300b84382094b7d971794d6f4501a01358", + "7d0ec556aa45e60fdf03f21d24087d0dbd836005", [] ], "assumptions": { @@ -371925,7 +371986,7 @@ [] ], "attribution-reporting-api.idl": [ - "76640f54c8d5bd22151509d4d9b8a018d9492a09", + "ed4497b56ff5b7cafe3ae43ae1fcba1638f4b29c", [] ], "audio-output.idl": [ @@ -372025,11 +372086,11 @@ [] ], "css-cascade-6.idl": [ - "37cdfb8293097e4297691f92ad291fc0433269f3", + "3bdf6ba3a6bf4dddada0edfd96c68e5c9e774630", [] ], "css-cascade.idl": [ - "9011dc7fd9e2a3f835e6d6ff565d9854db82e96f", + "0dd9969f6ebc0b5c98e4a251fa67275ece32307b", [] ], "css-color-5.idl": [ @@ -372133,7 +372194,7 @@ [] ], "cssom.idl": [ - "222b3dc09ec0eeecfd83d6f25c71c0f250481453", + "7f5bf17139874ee5fd6d7dfcd835a03e6396dd6b", [] ], "custom-state-pseudo-class.idl": [ @@ -372193,7 +372254,7 @@ [] ], "fenced-frame.idl": [ - "2869b95e6bb3c5968a3ced65cefd5b4509dbff9d", + "6b0734d1f7be28a29ab26b8ca6a17fe623fa249c", [] ], "fetch.idl": [ @@ -372217,7 +372278,7 @@ [] ], "fs.idl": [ - "e2474132abfb4c7ffe2e6ebcca7158d4eadbee75", + "e341ab387d9c4767c52ad661286ddbf75d7770bf", [] ], "fullscreen.idl": [ @@ -372269,7 +372330,7 @@ [] ], "html.idl": [ - "33d4de0db976e1ee3008fa743772202f9207b14a", + "99b33705b3991c1ffd3823e8d8d2e7aacebf56a9", [] ], "idle-detection.idl": [ @@ -372393,7 +372454,7 @@ [] ], "mediastream-recording.idl": [ - "99f30282333a933c6f59e0e34ac127742efea2f7", + "496bfcf2e27da7a7da6c653b8e7f27b702f7386f", [] ], "model-element.idl": [ @@ -372516,6 +372577,10 @@ "d8ee0bb3a46f856ac2ea18f5731b8270a36c0262", [] ], + "real-world-meshing.idl": [ + "38fe71f6c66a7f798d75c71ad5fe128cf7c13ed3", + [] + ], "referrer-policy.idl": [ "0ef9a1fdecc87241a536df9f725f3d7e2030d3e3", [] @@ -372541,7 +372606,7 @@ [] ], "resource-timing.idl": [ - "151e5d46d842742cf7f7a6328bedcc40e4cf7456", + "aa17003493eb2bd32dc1be241aa88323cb1889c5", [] ], "sanitizer-api.idl": [ @@ -372573,7 +372638,7 @@ [] ], "scroll-animations.idl": [ - "14215509c9fec9db69602ed1f91c0ee1ee7052d0", + "31b3746e9d4d629e468646e695726814682e615e", [] ], "scroll-to-text-fragment.idl": [ @@ -372581,7 +372646,7 @@ [] ], "secure-payment-confirmation.idl": [ - "9061b243477b4aaecc4ce756d5e0aae654342fe5", + "08ec8065c53081b50091ac780c9b330abb6dc1b5", [] ], "selection-api.idl": [ @@ -372604,6 +372669,10 @@ "4fc1f085ea2c24b73a9fa5f7d706d87fedf225a6", [] ], + "shared-storage.idl": [ + "eb5806f9a6db83daa76d3807af3683cb07b6ba39", + [] + ], "speech-api.idl": [ "74085481525c943296f023e94a6532e5bc9f5b15", [] @@ -372612,6 +372681,10 @@ "fff583e0982399d7ebdd001653d4bf338a14243a", [] ], + "storage-buckets.idl": [ + "f3d500a5711d393e72975d212f1654dd9c93f8e4", + [] + ], "storage-buckets.tentative.idl": [ "73d72ceab9805195704bbc63fca6ba658018784f", [] @@ -372645,7 +372718,7 @@ [] ], "trust-token-api.idl": [ - "ee339590827e0f678d9dc1dfe592d4ab33ba697c", + "f521acea1f5e5f5d593576f4af9534bf4371bd0b", [] ], "trusted-types.idl": [ @@ -372653,7 +372726,7 @@ [] ], "turtledove.idl": [ - "cd81a3d87ef8cb476ee303eafe58fb3b9d4fbca2", + "8add667b57509d3ec86ff214de6ee7380721fe18", [] ], "ua-client-hints.idl": [ @@ -372665,7 +372738,7 @@ [] ], "url.idl": [ - "6549e45f419cd89e9e5e5f28889da8ff18cf2d79", + "a5e4d1eb492e8248d74824bd53b3a2120e847fe5", [] ], "urlpattern.idl": [ @@ -372741,7 +372814,7 @@ [] ], "webauthn.idl": [ - "58a9e285232184b99caed6434b1a66f8a8ecee4a", + "c7f72eacfd079e1555c355c4648692787ab1a3c6", [] ], "webcodecs-aac-codec-registration.idl": [ @@ -372749,11 +372822,11 @@ [] ], "webcodecs-av1-codec-registration.idl": [ - "00e4493d3c0a957fefbaeeeb95efeaa26afd871c", + "ab20879728db6ba619600ac82478162ea87a7e6e", [] ], "webcodecs-avc-codec-registration.idl": [ - "d4074f647dab2b1af158a4f544ccd4737164b32c", + "2b952c2219422bfd657976b222a397313ac7551e", [] ], "webcodecs-flac-codec-registration.idl": [ @@ -372773,7 +372846,7 @@ [] ], "webcodecs.idl": [ - "77649029db69dd81b77f4178f9325537d50e4198", + "0b95dc8b75788e126d395ec9d69371b11f0d3a6c", [] ], "webcrypto-secure-curves.idl": [ @@ -372793,7 +372866,7 @@ [] ], "webgpu.idl": [ - "284327a578999a7a068952526ab457389e40729f", + "34f78a1d8cd52b59eff807de7ab383afda60d53d", [] ], "webhid.idl": [ @@ -372809,11 +372882,11 @@ [] ], "webnn.idl": [ - "2c2ab35e909712ad4ab89fe0f16358b4e92b353c", + "d2b973a624b46f86299ad65d05e515e3d3c4b773", [] ], "webrtc-encoded-transform.idl": [ - "e48f1080c41209bd83d90e002aa00d52f4c2425f", + "59710bf46c2e3b57f09aaacccb80eb2c48f33406", [] ], "webrtc-ice.idl": [ @@ -372829,7 +372902,7 @@ [] ], "webrtc-stats.idl": [ - "7e820a26df4844bcd094e16089a86ebca235a612", + "a5fb3294b7e64b56b0afec24ab25112ab3cac4cd", [] ], "webrtc-svc.idl": [ @@ -372893,7 +372966,7 @@ [] ], "webxrlayers.idl": [ - "e182f47b9c5bce5b6f3c8d47109358eb6c999856", + "c8b3a71c699cb641d1b037d2b2c41190fea11bd7", [] ], "window-controls-overlay.idl": [ @@ -379509,7 +379582,7 @@ [] ], "modulepreload-as.html.ini": [ - "79e2df963b2f24376c68c427ef0514b44f203937", + "0835ead581d41e170115e74e1a41764197e7191b", [] ], "modulepreload-expected.txt": [ @@ -382881,6 +382954,14 @@ "c20285ad1f4bf99ae99e9851afb459e952426c42", [] ], + "animation-timeline-named-scroll-progress-timeline.tentative-expected.txt": [ + "2068867a94bd82594b544da8cbddf43c16de352e", + [] + ], + "animation-timeline-named-scroll-progress-timeline.tentative.html.ini": [ + "dd95338bd7c25cead72b2b479b333a0f621a22d7", + [] + ], "animation-update-ref.html": [ "7e375a1df7f063ba6cdbbdad92beb73915b84d6e", [] @@ -382927,8 +383008,12 @@ "3c072829e6f8cd5c2b94f12a8feeb5d860abc6cd", [] ], + "scroll-timeline-dynamic.tentative-expected.txt": [ + "08ecd4949cf126b613ec22012b7571081fc2686a", + [] + ], "scroll-timeline-dynamic.tentative.html.ini": [ - "c8e2d28318cc34ca521a234cd88da83d5b1a0244", + "9aa09b90343e576ff20d49464f61d89b0ce32974", [] ], "scroll-timeline-frame-size-changed-ref.html": [ @@ -386484,7 +386569,7 @@ [] ], "unregister-immediately-during-extendable-events.https.html.ini": [ - "c346d607933e395a6f975f448e6d44f95ebd52f8", + "addd977dd5a090af1d5bdae030fa916ce91ed9c9", [] ], "unregister-then-register-new-script.https-expected.txt": [ @@ -391653,7 +391738,7 @@ [] ], "idlharness.any-expected.txt": [ - "4995d2373340ba69cf4c46cb1abbceda92c6489c", + "d8599ca8a812769f00441fa2e9a734181bd454a6", [] ], "idlharness.any.js.ini": [ @@ -391661,7 +391746,7 @@ [] ], "idlharness.any.worker-expected.txt": [ - "4995d2373340ba69cf4c46cb1abbceda92c6489c", + "d8599ca8a812769f00441fa2e9a734181bd454a6", [] ], "javascript-urls.window-expected.txt": [ @@ -395361,7 +395446,7 @@ [] ], "idlharness.https.any.js.ini": [ - "742ed6b31a948822d5b4997787765a6cbda29dd6", + "c2b96c4b662bb4652df091b275e2bc2b98917119", [] ], "leaky_relu.https.any.js.ini": [ @@ -396593,7 +396678,7 @@ [] ], "supported-stats.https-expected.txt": [ - "5006c482344955c1feb842b137ba768dccf05f0c", + "a0f851bf1de96e09172bb4a66fbbf76398063c1b", [] ], "supported-stats.https.html.ini": [ @@ -398582,7 +398667,7 @@ [] ], "embedded_style_imports_blocked.html.ini": [ - "2d5fe71f6d84bc3c17f0331312dac5c1e783e3fc", + "56cc39975726ad9ed5101a4b0e4a35145db58485", [] ], "embedded_style_invalid_format-ref.html": [ @@ -402425,7 +402510,7 @@ [] ], "shared-worker-parse-error-failure.html.ini": [ - "3d3a090a43fd893d067965cebc6f4c1d1d2b5ba0", + "49ac44f054583153d49ef5b6095d79f1bb38c2e8", [] ], "support": { @@ -426159,6 +426244,15 @@ } ] ], + "async-navigator-clipboard-write-multiple.tentative.https.sub.html": [ + "73cdd2f049e3ba1b0413476e49f0f98ef366c247", + [ + null, + { + "testdriver": true + } + ] + ], "async-promise-write-blobs-read-blobs.https.html": [ "12184c92e0777f5d10a63ad8e075e8422d5545a5", [ @@ -512833,6 +512927,17 @@ ] ] }, + "graphics-aria": { + "graphics-roles.html": [ + "159190ed833398d2410c5f4f2224f0b3a7dfd0a8", + [ + null, + { + "testdriver": true + } + ] + ] + }, "gyroscope": { "Gyroscope-disabled-by-feature-policy.https.html": [ "02cc44ec78b0c6ebeea657b8d0921943aa01028f", @@ -542574,7 +542679,7 @@ ] ], "access-reporting-post-message.https.html": [ - "4c8e96f57933f74d0ff3f76cafe498c20bef7353", + "5bc718e2a89a28a6867e83c0d85bc0cedefe39f6", [ null, {} @@ -542813,6 +542918,15 @@ } ] ], + "reporting-bcg-reuse.https.html": [ + "9bc171a269c5284de80cad871baafd58fb297da0", + [ + null, + { + "timeout": "long" + } + ] + ], "reporting-from-rp-ro.https.html": [ "60322bffe7a1c7d8d536b35504e925b09ff0c6bd", [ @@ -552694,21 +552808,28 @@ "forms": { "attributes-common-to-form-controls": { "dirname-ltr.html": [ - "9d1c9eb77e9fdef844689bb71b44c8c2271e6ba4", + "cbdbb72c674eec63e262957937f251fc557d9a6d", + [ + null, + {} + ] + ], + "dirname-only-if-applies.html": [ + "7d542111896e68e7df0b271b247126b99b3c1972", [ null, {} ] ], "dirname-rtl-auto.html": [ - "6368a26fafd74105428969660fec3d29bbcb4dce", + "072b85086857ba9d018895dfbc29a66a69b2dbc0", [ null, {} ] ], "dirname-rtl-inherited.html": [ - "1e6967d914a34de49033b1ea358b4093f11baf97", + "e7b07288d6b7ab0e0c2f4ce419dc6681760f8ab6", [ null, {} @@ -601373,7 +601494,7 @@ ] ], "animation-timeline-named-scroll-progress-timeline.tentative.html": [ - "ed2c32d31e97bfbe8e5836a382a3a5b116c5ce29", + "8dcf48c4ac4c8dac6a52fe8119b6462356799c84", [ null, {} @@ -601492,7 +601613,7 @@ ] ], "scroll-timeline-dynamic.tentative.html": [ - "0d951e7b139c1d219284398c386e81a2753a281a", + "744639f6636eba9d158b54d758ee553ea4ce65f9", [ null, {} @@ -616431,7 +616552,7 @@ }, "subapps": { "add-error.tentative.https.html": [ - "2cbf50836df093ee12e0157d5db6dfa0cc59706e", + "defe4743c6ab290683af9b57f193508c5743c4e0", [ null, { @@ -616440,7 +616561,7 @@ ] ], "add-success.tentative.https.html": [ - "2453fdbdecd39cfadf142b5ecf34d35a9eaef5ca", + "a9a439b36ac9a9095be58eef3767136d402d9071", [ null, { @@ -616481,21 +616602,21 @@ ] ], "list-success.tentative.https.html": [ - "c1d281abc530f16f60c0af6548d36a35710fd4dd", + "ea4f96124a912f361abb1a9ca73bd08aa77776ad", [ null, {} ] ], "remove-error.tentative.https.html": [ - "917c3b4d022d446488ac14c45fff114e34a95c5d", + "a7271905dc7d19b4778d59e7f2c59274b4f7b813", [ null, {} ] ], "remove-success.tentative.https.html": [ - "6fd4305b4340a036ddba6084d9f6c5b929254f2e", + "ad60d6398dd848e935898810673d3aac3eba0333", [ null, {}
diff --git a/third_party/blink/web_tests/external/wpt/clipboard-apis/async-navigator-clipboard-write-multiple.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/clipboard-apis/async-navigator-clipboard-write-multiple.tentative.https.sub.html new file mode 100644 index 0000000..73cdd2f0 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/clipboard-apis/async-navigator-clipboard-write-multiple.tentative.https.sub.html
@@ -0,0 +1,106 @@ +<!doctype html> +<meta charset="utf-8"> +<title>Async Clipboard write should cancel the prior pending request</title> +<link rel="help" href="https://github.com/w3c/clipboard-apis/issues/161"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="resources/user-activation.js"></script> + +<iframe width="50" height="50" id="same" src="resources/page.html"></iframe><br> +<iframe width="50" height="50" id="cross" src="https://{{hosts[alt][]}}:{{ports[https][1]}}/clipboard-apis/resources/page.html"></iframe><br> +<input value="Test"> +<script> +"use strict"; + +// Permissions are required in order to invoke navigator.clipboard functions in +// an automated test. +async function getPermissions() { + await test_driver.set_permission({name: "clipboard-read"}, "granted"); + await test_driver.set_permission({name: "clipboard-write"}, "granted"); + await waitForUserActivation(); +} + +function waitForMessage(msg) { + return new Promise((resolve) => { + window.addEventListener("message", function handler(e) { + if (e.data == msg) { + window.removeEventListener("message", handler); + resolve(); + } + }); + }); +} + +function generateRandomString() { + return "random number: " + Math.random(); +} + +function testCancelPendingWrite(funcToMakeNewRequest, msg) { + promise_test(async t => { + await getPermissions(); + + // Create a pending write request which should be rejected after a new + // request is made. + let resolvePendingPromise; + let promise = navigator.clipboard.write([ + new ClipboardItem({ + "text/plain": new Promise((resolve) => { resolvePendingPromise = resolve; }), + }), + ]).catch(e => { return e; }); + + // Make a new request that should cancel the prior pending request. + let str = generateRandomString(); + await funcToMakeNewRequest(str); + + // Pending request should be rejected with NotAllowedError. + let error = await promise; + assert_not_equals(error, undefined); + assert_equals(error.name, "NotAllowedError"); + + // Resolve pending promise. + resolvePendingPromise(generateRandomString()); + // Check clipboard data. + assert_equals(await navigator.clipboard.readText(), str); + }, msg); +} + +testCancelPendingWrite(async (str) => { + // A new write request should cancel the prior pending request. + await navigator.clipboard.write([ + new ClipboardItem({ + "text/plain": str, + }), + ]).catch(() => { + assert_true(false, "should not fail"); + }); +}, "clipboard.write() should cancel the prior pending one (same document)"); + +testCancelPendingWrite(async (str) => { + // A new write should cancel the prior pending request. + const iframe = document.getElementById("same"); + iframe.contentWindow.postMessage(["write", str], "*"); + await waitForMessage("done"); +}, "clipboard.write() should cancel the prior pending one (same-origin iframe)"); + +testCancelPendingWrite(async (str) => { + // A new write should cancel the prior pending request. + const iframe = document.getElementById("cross"); + iframe.contentWindow.postMessage(["write", str], "*"); + await waitForMessage("done"); +}, "clipboard.write() should cancel the prior pending one (cross-origin iframe)"); + +testCancelPendingWrite(async (str) => { + const input = document.querySelector("input"); + input.value = str; + input.focus(); + input.select(); + + // A new copy action should cancel the prior pending request. + const modifier_key = navigator.platform.includes("Mac") ? "\uE03D" : "\uE009"; + await new test_driver.Actions().keyDown(modifier_key).keyDown("c").send(); +}, "copy action should cancel the prior pending clipboard.write() request"); + +</script>
diff --git a/third_party/blink/web_tests/external/wpt/clipboard-apis/async-navigator-clipboard-write-multiple.tentative.https.sub.html.ini b/third_party/blink/web_tests/external/wpt/clipboard-apis/async-navigator-clipboard-write-multiple.tentative.https.sub.html.ini new file mode 100644 index 0000000..09a1898 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/clipboard-apis/async-navigator-clipboard-write-multiple.tentative.https.sub.html.ini
@@ -0,0 +1,18 @@ +[async-navigator-clipboard-write-multiple.tentative.https.sub.html] + expected: + if product == "chrome": TIMEOUT + [clipboard.write() should cancel the prior pending one (cross-origin iframe)] + expected: + if product == "chrome": NOTRUN + + [clipboard.write() should cancel the prior pending one (same document)] + expected: + if product == "chrome": FAIL + + [clipboard.write() should cancel the prior pending one (same-origin iframe)] + expected: + if product == "chrome": TIMEOUT + + [copy action should cancel the prior pending clipboard.write() request] + expected: + if product == "chrome": NOTRUN
diff --git a/third_party/blink/web_tests/external/wpt/clipboard-apis/resources/page.html b/third_party/blink/web_tests/external/wpt/clipboard-apis/resources/page.html new file mode 100644 index 0000000..35bde8e5 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/clipboard-apis/resources/page.html
@@ -0,0 +1,26 @@ +<!DOCTYPE html> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-action.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="user-activation.js"></script> + +<div style="width: 10px; height: 10px"></div> +<script> +window.addEventListener("message", async (e) => { + if (e.data && e.data[0] == "write") { + test_driver.set_test_context(window.parent); + await test_driver.set_permission({name: 'clipboard-read'}, 'granted'); + await test_driver.set_permission({name: 'clipboard-write'}, 'granted'); + await waitForUserActivation(); + await navigator.clipboard.write([ + new ClipboardItem({ + "text/plain": e.data[1], + }), + ]).catch(() => { + assert_true(false, `should not fail`); + }); + window.parent.postMessage("done", "*"); + } +}); +</script> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/compat/webkit-box-horizontal-reverse-variants.html.ini b/third_party/blink/web_tests/external/wpt/compat/webkit-box-horizontal-reverse-variants.html.ini new file mode 100644 index 0000000..e3d8ea8f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/compat/webkit-box-horizontal-reverse-variants.html.ini
@@ -0,0 +1,3 @@ +[webkit-box-horizontal-reverse-variants.html] + expected: + if (product == "content_shell") and (os == "mac") and (port == "mac12-arm64"): FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-conditional/at-supports-selector-file-selector-button.html b/third_party/blink/web_tests/external/wpt/css/css-conditional/at-supports-selector-file-selector-button.html new file mode 100644 index 0000000..a51e503e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-conditional/at-supports-selector-file-selector-button.html
@@ -0,0 +1,24 @@ +<!doctype html> +<html> + <head> + <title>CSS Test (Conditional Rules): In @supports, ::file-selector-button can be parsed successfully</title> + <link rel="author" title="Tim Nguyen" href="https://github.com/nt1m"> + <link rel="help" href="https://drafts.csswg.org/css-conditional-3/#at-supports"> + <link rel="help" href="https://drafts.csswg.org/css-pseudo/#file-selector-button-pseudo"> + <link rel="match" href="at-supports-001-ref.html"> + <style> + div { + background: red; + height: 100px; + width: 100px; + } + @supports selector(input::file-selector-button) { + div { background-color:green; } + } + </style> + </head> + <body> + <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p> + <div></div> + </body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-flexbox/percentage-descendant-of-anonymous-flex-item.html.ini b/third_party/blink/web_tests/external/wpt/css/css-flexbox/percentage-descendant-of-anonymous-flex-item.html.ini new file mode 100644 index 0000000..ea1c8b5692 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-flexbox/percentage-descendant-of-anonymous-flex-item.html.ini
@@ -0,0 +1,3 @@ +[percentage-descendant-of-anonymous-flex-item.html] + expected: + if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scrollbars/textarea-scrollbar-width-none.html.ini b/third_party/blink/web_tests/external/wpt/css/css-scrollbars/textarea-scrollbar-width-none.html.ini deleted file mode 100644 index 16a645b4..0000000 --- a/third_party/blink/web_tests/external/wpt/css/css-scrollbars/textarea-scrollbar-width-none.html.ini +++ /dev/null
@@ -1,2 +0,0 @@ -[textarea-scrollbar-width-none.html] - expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-sizing/min-content-negative-margin-crash.html.ini b/third_party/blink/web_tests/external/wpt/css/css-sizing/min-content-negative-margin-crash.html.ini index fc03201..8b1ec07 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-sizing/min-content-negative-margin-crash.html.ini +++ b/third_party/blink/web_tests/external/wpt/css/css-sizing/min-content-negative-margin-crash.html.ini
@@ -1,4 +1,5 @@ [min-content-negative-margin-crash.html] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): TIMEOUT if (product == "content_shell") and (os == "mac") and (port == "mac11"): TIMEOUT + if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): TIMEOUT + if (product == "content_shell") and (os == "mac") and (port == "mac12"): TIMEOUT
diff --git a/third_party/blink/web_tests/external/wpt/css/css-transforms/preserve3d-and-flattening-z-order-004.html.ini b/third_party/blink/web_tests/external/wpt/css/css-transforms/preserve3d-and-flattening-z-order-004.html.ini index 9fdf89b..678c8821 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-transforms/preserve3d-and-flattening-z-order-004.html.ini +++ b/third_party/blink/web_tests/external/wpt/css/css-transforms/preserve3d-and-flattening-z-order-004.html.ini
@@ -1,3 +1,4 @@ [preserve3d-and-flattening-z-order-004.html] expected: if (product == "content_shell") and (os == "mac") and (port == "mac13"): FAIL + if (product == "content_shell") and (os == "mac") and (port == "mac12-arm64"): FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-input-submit-border-right-color-001.html.ini b/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-input-submit-border-right-color-001.html.ini index d417d77..02c56fc0 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-input-submit-border-right-color-001.html.ini +++ b/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-input-submit-border-right-color-001.html.ini
@@ -1,3 +1,3 @@ [kind-of-widget-fallback-input-submit-border-right-color-001.html] expected: - if (product == "content_shell") and (os == "win") and (port == "win10.20h2"): FAIL + if (product == "content_shell") and (os == "win"): FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/cssom/idlharness-expected.txt b/third_party/blink/web_tests/external/wpt/css/cssom/idlharness-expected.txt index bd7cc06..7ec3477 100644 --- a/third_party/blink/web_tests/external/wpt/css/cssom/idlharness-expected.txt +++ b/third_party/blink/web_tests/external/wpt/css/cssom/idlharness-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 449 tests; 395 PASS, 54 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 453 tests; 396 PASS, 57 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS idl_test validation PASS Partial interface CSSStyleSheet: original interface defined @@ -205,11 +205,15 @@ PASS CSSImportRule interface: attribute href PASS CSSImportRule interface: attribute media PASS CSSImportRule interface: attribute styleSheet +PASS CSSImportRule interface: attribute layerName +FAIL CSSImportRule interface: attribute supportsText assert_true: The prototype object must have a property "supportsText" expected true got false PASS CSSImportRule must be primary interface of sheet.cssRules[0] PASS Stringification of sheet.cssRules[0] PASS CSSImportRule interface: sheet.cssRules[0] must inherit property "href" with the proper type PASS CSSImportRule interface: sheet.cssRules[0] must inherit property "media" with the proper type PASS CSSImportRule interface: sheet.cssRules[0] must inherit property "styleSheet" with the proper type +FAIL CSSImportRule interface: sheet.cssRules[0] must inherit property "layerName" with the proper type assert_equals: expected "string" but got "object" +FAIL CSSImportRule interface: sheet.cssRules[0] must inherit property "supportsText" with the proper type assert_inherits: property "supportsText" not found in prototype chain PASS CSSRule interface: sheet.cssRules[0] must inherit property "cssText" with the proper type PASS CSSRule interface: sheet.cssRules[0] must inherit property "parentRule" with the proper type PASS CSSRule interface: sheet.cssRules[0] must inherit property "parentStyleSheet" with the proper type
diff --git a/third_party/blink/web_tests/external/wpt/css/cssom/idlharness.html.ini b/third_party/blink/web_tests/external/wpt/css/cssom/idlharness.html.ini index b04976d2..69e601a8 100644 --- a/third_party/blink/web_tests/external/wpt/css/cssom/idlharness.html.ini +++ b/third_party/blink/web_tests/external/wpt/css/cssom/idlharness.html.ini
@@ -17,6 +17,15 @@ [CSSGroupingRule interface: sheet.cssRules[2\] must inherit property "insertRule(CSSOMString, optional unsigned long)" with the proper type] expected: FAIL + [CSSImportRule interface: attribute supportsText] + expected: FAIL + + [CSSImportRule interface: sheet.cssRules[0\] must inherit property "layerName" with the proper type] + expected: FAIL + + [CSSImportRule interface: sheet.cssRules[0\] must inherit property "supportsText" with the proper type] + expected: FAIL + [CSSMarginRule interface object length] expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/filter-effects/backdrop-filter-zero-size.html.ini b/third_party/blink/web_tests/external/wpt/css/filter-effects/backdrop-filter-zero-size.html.ini new file mode 100644 index 0000000..8356be88 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/filter-effects/backdrop-filter-zero-size.html.ini
@@ -0,0 +1,3 @@ +[backdrop-filter-zero-size.html] + expected: + if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): FAIL
diff --git a/third_party/blink/web_tests/external/wpt/graphics-aria/META.yml b/third_party/blink/web_tests/external/wpt/graphics-aria/META.yml new file mode 100644 index 0000000..692db91 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/graphics-aria/META.yml
@@ -0,0 +1,4 @@ +spec: https://w3c.github.io/graphics-aria/ +suggested_reviewers: + - cookiecrook + - spectranaut
diff --git a/third_party/blink/web_tests/external/wpt/graphics-aria/graphics-roles-expected.txt b/third_party/blink/web_tests/external/wpt/graphics-aria/graphics-roles-expected.txt new file mode 100644 index 0000000..086bb96 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/graphics-aria/graphics-roles-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +Harness Error. harness_status.status = 1 , harness_status.message = Uncaught ReferenceError: AriaUtils is not defined +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/graphics-aria/graphics-roles.html b/third_party/blink/web_tests/external/wpt/graphics-aria/graphics-roles.html new file mode 100644 index 0000000..159190ed8 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/graphics-aria/graphics-roles.html
@@ -0,0 +1,22 @@ +<!doctype html> +<html> +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/resources/testdriver.js"></script> + <script src="/resources/testdriver-vendor.js"></script> + <script src="/resources/testdriver-actions.js"></script> + <script src="/wai-aria/scripts/aria-utils.js"></script> +</head> +<body> + +<div role="graphics-document" data-expectedrole="graphics-document" class="ex">x</div> +<div role="graphics-object" data-expectedrole="graphics-object" class="ex">x</div> +<div role="graphics-symbol" data-expectedrole="graphics-symbol" class="ex">x</div> + +<script> +AriaUtils.verifyRolesBySelector(".ex"); +</script> + +</body> +</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/graphics-aria/graphics-roles.html.ini b/third_party/blink/web_tests/external/wpt/graphics-aria/graphics-roles.html.ini new file mode 100644 index 0000000..5a1045ba --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/graphics-aria/graphics-roles.html.ini
@@ -0,0 +1,3 @@ +[graphics-roles.html] + expected: + if product == "chrome": ERROR
diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/tentative/restrict-properties/iframe-popup-to-un.https.html.ini b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/tentative/restrict-properties/iframe-popup-to-un.https.html.ini index 673d02c..f12c342 100644 --- a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/tentative/restrict-properties/iframe-popup-to-un.https.html.ini +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/tentative/restrict-properties/iframe-popup-to-un.https.html.ini
@@ -1,9 +1,29 @@ [iframe-popup-to-un.https.html?1-2] expected: if product == "chrome": ERROR + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same origin iframe, same origin popup with anchor] + expected: + if product == "chrome": PASS + FAIL + + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same origin iframe, same origin popup with form] + expected: + if product == "chrome": PASS + FAIL + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same origin iframe, same origin popup with window_open] expected: FAIL + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same site iframe, same origin popup with anchor] + expected: + if product == "chrome": PASS + FAIL + + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same site iframe, same origin popup with form] + expected: + if product == "chrome": PASS + FAIL + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same site iframe, same origin popup with window_open] expected: FAIL @@ -11,9 +31,29 @@ [iframe-popup-to-un.https.html?3-4] expected: if product == "chrome": ERROR + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with cross origin iframe, same origin popup with anchor] + expected: + if product == "chrome": PASS + FAIL + + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with cross origin iframe, same origin popup with form] + expected: + if product == "chrome": PASS + FAIL + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with cross origin iframe, same origin popup with window_open] expected: FAIL + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same origin iframe, same site popup with anchor] + expected: + if product == "chrome": PASS + FAIL + + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same origin iframe, same site popup with form] + expected: + if product == "chrome": PASS + FAIL + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same origin iframe, same site popup with window_open] expected: FAIL @@ -21,9 +61,29 @@ [iframe-popup-to-un.https.html?5-6] expected: if product == "chrome": ERROR + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with cross origin iframe, same site popup with anchor] + expected: + if product == "chrome": PASS + FAIL + + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with cross origin iframe, same site popup with form] + expected: + if product == "chrome": PASS + FAIL + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with cross origin iframe, same site popup with window_open] expected: FAIL + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same site iframe, same site popup with anchor] + expected: + if product == "chrome": PASS + FAIL + + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same site iframe, same site popup with form] + expected: + if product == "chrome": PASS + FAIL + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same site iframe, same site popup with window_open] expected: FAIL @@ -31,15 +91,39 @@ [iframe-popup-to-un.https.html?7-8] expected: if product == "chrome": ERROR + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same origin iframe, cross origin popup with anchor] + expected: + if product == "chrome": PASS + FAIL + + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same origin iframe, cross origin popup with form] + expected: + if product == "chrome": PASS + FAIL + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same origin iframe, cross origin popup with window_open] expected: FAIL + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same site iframe, cross origin popup with anchor] + expected: + if product == "chrome": PASS + FAIL + + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same site iframe, cross origin popup with form] + expected: + if product == "chrome": PASS + FAIL + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with same site iframe, cross origin popup with window_open] expected: FAIL [iframe-popup-to-un.https.html?9-last] - expected: - if product == "chrome": [ERROR, OK] + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with cross origin iframe, cross origin popup with anchor] + expected: FAIL + + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with cross origin iframe, cross origin popup with form] + expected: FAIL + [COOP: restrict-properties to popup COOP: unsafe-none via an iframe, with cross origin iframe, cross origin popup with window_open] expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/tentative/restrict-properties/iframe-popup.https.html.ini b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/tentative/restrict-properties/iframe-popup.https.html.ini index ead098e..64c1ac2 100644 --- a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/tentative/restrict-properties/iframe-popup.https.html.ini +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/tentative/restrict-properties/iframe-popup.https.html.ini
@@ -4,6 +4,16 @@ [iframe-popup.https.html?3-4] expected: if product == "chrome": ERROR + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with same origin iframe, same site popup with anchor] + expected: + if product == "chrome": PASS + FAIL + + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with same origin iframe, same site popup with form] + expected: + if product == "chrome": PASS + FAIL + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with same origin iframe, same site popup with window_open] expected: FAIL @@ -11,9 +21,29 @@ [iframe-popup.https.html?5-6] expected: if product == "chrome": ERROR + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with cross origin iframe, same site popup with anchor] + expected: + if product == "chrome": PASS + FAIL + + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with cross origin iframe, same site popup with form] + expected: + if product == "chrome": PASS + FAIL + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with cross origin iframe, same site popup with window_open] expected: FAIL + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with same site iframe, same site popup with anchor] + expected: + if product == "chrome": PASS + FAIL + + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with same site iframe, same site popup with form] + expected: + if product == "chrome": PASS + FAIL + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with same site iframe, same site popup with window_open] expected: FAIL @@ -21,15 +51,45 @@ [iframe-popup.https.html?7-8] expected: if product == "chrome": ERROR + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with same origin iframe, cross origin popup with anchor] + expected: + if product == "chrome": PASS + FAIL + + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with same origin iframe, cross origin popup with form] + expected: + if product == "chrome": PASS + FAIL + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with same origin iframe, cross origin popup with window_open] expected: FAIL + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with same site iframe, cross origin popup with anchor] + expected: + if product == "chrome": PASS + FAIL + + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with same site iframe, cross origin popup with form] + expected: + if product == "chrome": PASS + FAIL + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with same site iframe, cross origin popup with window_open] expected: FAIL [iframe-popup.https.html?9-last] expected: - if product == "chrome": [ERROR, OK] + if product == "chrome": ERROR + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with cross origin iframe, cross origin popup with anchor] + expected: + if product == "chrome": PASS + FAIL + + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with cross origin iframe, cross origin popup with form] + expected: + if product == "chrome": PASS + FAIL + [COOP: restrict-properties to popup COOP: restrict-properties via an iframe, with cross origin iframe, cross origin popup with window_open] expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/html/dom/idlharness.https.html.ini b/third_party/blink/web_tests/external/wpt/html/dom/idlharness.https.html.ini index 2ff4bc1..1fbb91f 100644 --- a/third_party/blink/web_tests/external/wpt/html/dom/idlharness.https.html.ini +++ b/third_party/blink/web_tests/external/wpt/html/dom/idlharness.https.html.ini
@@ -86,6 +86,18 @@ [TextTrack interface: document.createElement("track").track must inherit property "inBandMetadataTrackDispatchType" with the proper type] expected: FAIL + [VisibilityStateEntry interface: attribute duration] + expected: FAIL + + [VisibilityStateEntry interface: attribute entryType] + expected: FAIL + + [VisibilityStateEntry interface: attribute name] + expected: FAIL + + [VisibilityStateEntry interface: attribute startTime] + expected: FAIL + [Worker interface: attribute onmessageerror] expected: FAIL
diff --git "a/third_party/blink/web_tests/external/wpt/html/dom/idlharness.https_exclude=\050Document_Window_HTML._\051-expected.txt" "b/third_party/blink/web_tests/external/wpt/html/dom/idlharness.https_exclude=\050Document_Window_HTML._\051-expected.txt" index 4b4cb1b7..ad1f5d2 100644 --- "a/third_party/blink/web_tests/external/wpt/html/dom/idlharness.https_exclude=\050Document_Window_HTML._\051-expected.txt" +++ "b/third_party/blink/web_tests/external/wpt/html/dom/idlharness.https_exclude=\050Document_Window_HTML._\051-expected.txt"
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 1415 tests; 1385 PASS, 30 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 1425 tests; 1391 PASS, 34 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS idl_test validation PASS Partial interface Document: original interface defined @@ -845,6 +845,16 @@ PASS ElementInternals interface: operation checkValidity() PASS ElementInternals interface: operation reportValidity() PASS ElementInternals interface: attribute labels +PASS VisibilityStateEntry interface: existence and properties of interface object +PASS VisibilityStateEntry interface object length +PASS VisibilityStateEntry interface object name +PASS VisibilityStateEntry interface: existence and properties of interface prototype object +PASS VisibilityStateEntry interface: existence and properties of interface prototype object's "constructor" property +PASS VisibilityStateEntry interface: existence and properties of interface prototype object's @@unscopables property +FAIL VisibilityStateEntry interface: attribute name assert_own_property: expected property "name" missing +FAIL VisibilityStateEntry interface: attribute entryType assert_own_property: expected property "entryType" missing +FAIL VisibilityStateEntry interface: attribute startTime assert_own_property: expected property "startTime" missing +FAIL VisibilityStateEntry interface: attribute duration assert_own_property: expected property "duration" missing PASS UserActivation interface: existence and properties of interface object PASS UserActivation interface object length PASS UserActivation interface object name
diff --git a/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt b/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt index 667c2c9..8ea520a 100644 --- a/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 749 tests; 740 PASS, 9 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 750 tests; 741 PASS, 9 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS idl_test validation PASS Partial interface Document: original interface defined @@ -422,6 +422,7 @@ PASS OffscreenCanvasRenderingContext2D interface: operation ellipse(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) PASS CustomElementRegistry interface: existence and properties of interface object PASS ElementInternals interface: existence and properties of interface object +PASS VisibilityStateEntry interface: existence and properties of interface object FAIL UserActivation interface: existence and properties of interface object assert_false: expected false got true PASS DataTransfer interface: existence and properties of interface object PASS DataTransferItemList interface: existence and properties of interface object
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-ltr.html b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-ltr.html index 9d1c9eb..cbdbb72 100644 --- a/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-ltr.html +++ b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-ltr.html
@@ -5,32 +5,19 @@ <link rel=help href="https://html.spec.whatwg.org/multipage/#submitting-element-directionality:-the-dirname-attribute"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> +<script src="resources/dirname.js"></script> <div id="log"></div> -<form action="dirname-ltr-iframe.html" method=get target="iframe"> +<form action="resources/dirname-iframe.html" method=get target="iframe"> <p><label>Comment: <input type=text name="comment" dirname="comment.dir" required></label></p> <p><button type=submit>Post Comment</button></p> </form> <iframe name="iframe"></iframe> <script> - function getParameterByName(name) { - name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); - var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), - results = regex.exec(document.querySelector("iframe").contentWindow.location.search); - return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); - } - var t = async_test("submit element directionality"); document.querySelector("input").value = "foobar"; document.querySelector("button").click(); - var iframe = document.querySelector("iframe"); - iframe.onload = t.step_func(function() { - // The initial about:blank load event can be fired before the form navigation occurs. - // See https://github.com/whatwg/html/issues/490 for more information. - if(iframe.contentWindow.location.href == "about:blank") { return; } - - assert_equals(getParameterByName("comment.dir"), "ltr"); - - t.done(); + onIframeLoadedDone(t, function(params) { + assert_equals(params.get("comment.dir"), "ltr"); }); </script>
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-only-if-applies-expected.txt b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-only-if-applies-expected.txt new file mode 100644 index 0000000..ba7c5f42 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-only-if-applies-expected.txt
@@ -0,0 +1,7 @@ +This is a testharness.js-based test. +FAIL Submit input element directionality to FormData, if dirname applies. assert_false: Do not submit dir for input type=tel expected false got true +PASS Submit textarea element directionality to FormData. +FAIL Submit input element directionality, if dirname applies. assert_false: Do not submit dir for input type=tel expected false got true +PASS Submit textarea element directionality. +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-only-if-applies.html b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-only-if-applies.html new file mode 100644 index 0000000..7d542111 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-only-if-applies.html
@@ -0,0 +1,75 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset=utf-8> + <title>Submitting element directionality: the dirname attribute</title> + <link rel="author" title="Vincent Hilla" href="mailto:vhilla@mozilla.com"> + <link rel=help href="https://html.spec.whatwg.org/multipage/#submitting-element-directionality:-the-dirname-attribute"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="resources/dirname.js"></script> + </head> + <body> + <div id="log"></div> + <form action="resources/dirname-iframe.html" method=get target="iframe"> + <textarea name="textarea" dirname="textarea.dir"></textarea> + <p><button id="btn-submit" type=submit>Submit</button></p> + </form> + <iframe name="iframe"></iframe> + + <script> + const types_applies = ["text", "search"]; + const types_not = [ + "hidden", "tel", "url", "email", "password", "date", "month", "week", "time", + "datetime-local", "number", "range", "color", "checkbox", "radio", "file", "submit", + "image", "reset", "button" + ]; + const types = [...types_applies, ...types_not]; + let form = document.querySelector("form"); + for (const type of types) { + let p = document.createElement("p"); + let lbl = document.createElement("label"); + let txt = document.createTextNode(type + ": "); + let inp = document.createElement("input"); + inp.type = type; + inp.name = type; + inp.dirName = type + ".dir"; + inp.id = "testelement." + type + lbl.appendChild(txt); + lbl.appendChild(inp); + p.appendChild(lbl); + form.appendChild(p); + } + // Avoid continue in https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-form-data-set:attr-fe-dirname + document.getElementById("testelement.checkbox").checked = true; + document.getElementById("testelement.radio").checked = true; + + function assertInputSubmission(data) { + for (const type of types_applies) { + assert_equals(data.get(type + ".dir"), "ltr", "Submit ltr for input type=" + type); + } + for (const type of types_not) { + assert_false(data.has(type + ".dir"), "Do not submit dir for input type=" + type); + } + } + + const data = new FormData(form); + test(function() { + assertInputSubmission(data); + }, "Submit input element directionality to FormData, if dirname applies."); + test(function() { + assert_equals(data.get("textarea.dir"), "ltr", "Submit ltr for textarea"); + }, "Submit textarea element directionality to FormData."); + + document.getElementById("btn-submit").click(); + const t_inp = async_test("Submit input element directionality, if dirname applies."); + onIframeLoadedDone(t_inp, function(params) { + assertInputSubmission(params); + }); + const t_ta = async_test("Submit textarea element directionality."); + onIframeLoadedDone(t_ta, function(params) { + assert_equals(params.get("textarea.dir"), "ltr", "Submit ltr for textarea"); + }); + </script> + </body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-only-if-applies.html.ini b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-only-if-applies.html.ini new file mode 100644 index 0000000..b73b3ce --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-only-if-applies.html.ini
@@ -0,0 +1,6 @@ +[dirname-only-if-applies.html] + [Submit input element directionality to FormData, if dirname applies.] + expected: FAIL + + [Submit input element directionality, if dirname applies.] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-rtl-auto.html b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-rtl-auto.html index 6368a26..072b850 100644 --- a/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-rtl-auto.html +++ b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-rtl-auto.html
@@ -5,33 +5,20 @@ <link rel=help href="https://html.spec.whatwg.org/multipage/#submitting-element-directionality:-the-dirname-attribute"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> +<script src="resources/dirname.js"></script> <div id="log"></div> -<form action="dirname-ltr-iframe.html" method=get target="iframe"> +<form action="resources/dirname-iframe.html" method=get target="iframe"> <p><label>Comment: <input type=text name="comment" dir="auto" dirname="comment.dir" required/></label></p> <p><button type=submit>Post Comment</button></p> </form> <iframe name="iframe"></iframe> <script> - function getParameterByName(name) { - name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); - var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), - results = regex.exec(document.querySelector("iframe").contentWindow.location.search); - return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); - } - var t = async_test("submit element directionality"); var rtlValue = "Ù…Ø±ØØ¨Ø§"; document.querySelector("input").value = rtlValue; document.querySelector("button").click(); - var iframe = document.querySelector("iframe"); - iframe.onload = t.step_func(function() { - // The initial about:blank load event can be fired before the form navigation occurs. - // See https://github.com/whatwg/html/issues/490 for more information. - if(iframe.contentWindow.location.href == "about:blank") { return; } - - assert_equals(getParameterByName("comment.dir"), "rtl"); - - t.done(); + onIframeLoadedDone(t, function(params) { + assert_equals(params.get("comment.dir"), "rtl"); }); </script>
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-rtl-inherited.html b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-rtl-inherited.html index 1e6967d..e7b0728 100644 --- a/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-rtl-inherited.html +++ b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-rtl-inherited.html
@@ -5,34 +5,21 @@ <link rel=help href="https://html.spec.whatwg.org/multipage/#submitting-element-directionality:-the-dirname-attribute"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> +<script src="resources/dirname.js"></script> <div id="log"></div> <div dir="rtl"> - <form action="dirname-ltr-iframe.html" method=get target="iframe"> + <form action="resources/dirname-iframe.html" method=get target="iframe"> <p><label>Comment: <input type=text name="comment" dirname="comment.dir" required/></label></p> <p><button type=submit>Post Comment</button></p> </form> </div> <iframe name="iframe"></iframe> <script> - function getParameterByName(name) { - name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); - var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), - results = regex.exec(document.querySelector("iframe").contentWindow.location.search); - return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); - } - var t = async_test("submit element directionality"); document.querySelector("input").value = "foobar"; document.querySelector("button").click(); - var iframe = document.querySelector("iframe"); - iframe.onload = t.step_func(function() { - // The initial about:blank load event can be fired before the form navigation occurs. - // See https://github.com/whatwg/html/issues/490 for more information. - if(iframe.contentWindow.location.href == "about:blank") { return; } - - assert_equals(getParameterByName("comment.dir"), "rtl"); - - t.done(); + onIframeLoadedDone(t, function(params) { + assert_equals(params.get("comment.dir"), "rtl"); }); </script>
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-ltr-iframe.html b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/resources/dirname-iframe.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/dirname-ltr-iframe.html rename to third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/resources/dirname-iframe.html
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/resources/dirname.js b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/resources/dirname.js new file mode 100644 index 0000000..f0e97bc3 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/semantics/forms/attributes-common-to-form-controls/resources/dirname.js
@@ -0,0 +1,12 @@ +function onIframeLoadedDone(t, cb, selector="iframe") { + const iframe = document.querySelector(selector); + iframe.addEventListener("load", function() { + // The initial about:blank load event can be fired before the form navigation occurs. + // See https://github.com/whatwg/html/issues/490 for more information. + if(iframe.contentWindow.location.href == "about:blank") { return; } + + const params = new URLSearchParams(iframe.contentWindow.location.search); + t.step(() => cb(params)) + t.done(); + }); +}
diff --git a/third_party/blink/web_tests/external/wpt/infrastructure/README.md b/third_party/blink/web_tests/external/wpt/infrastructure/README.md index 82138a3..7d0ec55 100644 --- a/third_party/blink/web_tests/external/wpt/infrastructure/README.md +++ b/third_party/blink/web_tests/external/wpt/infrastructure/README.md
@@ -7,3 +7,8 @@ * The tests in server/ are designed to test the WPT server configuration * The tests in expected-fail/ should all fail. + +To update the expectations stored in metadata/, you want to use the `wpt` +tool with an invocation such as `./wpt update-expectations --metadata +infrastructure/metadata --manifest MANIFEST.json [wptreport.json]` with one +or more wptreport.json files.
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/attribution-reporting-api.idl b/third_party/blink/web_tests/external/wpt/interfaces/attribution-reporting-api.idl index 76640f54..ed4497b 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/attribution-reporting-api.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/attribution-reporting-api.idl
@@ -4,9 +4,23 @@ // Source: Attribution Reporting (https://wicg.github.io/attribution-reporting-api/) interface mixin HTMLAttributionSrcElementUtils { - [CEReactions] attribute USVString attributionSrc; + [CEReactions, SecureContext] attribute USVString attributionSrc; }; HTMLAnchorElement includes HTMLAttributionSrcElementUtils; HTMLImageElement includes HTMLAttributionSrcElementUtils; HTMLScriptElement includes HTMLAttributionSrcElementUtils; + +dictionary AttributionReportingRequestOptions { + required boolean eventSourceEligible; + required boolean triggerEligible; +}; + +partial dictionary RequestInit { + AttributionReportingRequestOptions attributionReporting; +}; + +partial interface XMLHttpRequest { + [SecureContext] + undefined setAttributionReporting(AttributionReportingRequestOptions options); +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/css-cascade-6.idl b/third_party/blink/web_tests/external/wpt/interfaces/css-cascade-6.idl index 37cdfb8..3bdf6ba3 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/css-cascade-6.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/css-cascade-6.idl
@@ -5,6 +5,6 @@ [Exposed=Window] interface CSSScopeRule : CSSGroupingRule { - readonly attribute CSSOMString start; - readonly attribute CSSOMString end; + readonly attribute CSSOMString? start; + readonly attribute CSSOMString? end; };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/css-cascade.idl b/third_party/blink/web_tests/external/wpt/interfaces/css-cascade.idl index 9011dc7..0dd9969f 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/css-cascade.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/css-cascade.idl
@@ -3,10 +3,6 @@ // (https://github.com/w3c/webref) // Source: CSS Cascading and Inheritance Level 5 (https://drafts.csswg.org/css-cascade-5/) -partial interface CSSImportRule { - readonly attribute CSSOMString? layerName; -}; - [Exposed=Window] interface CSSLayerBlockRule : CSSGroupingRule { readonly attribute CSSOMString name;
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/cssom.idl b/third_party/blink/web_tests/external/wpt/interfaces/cssom.idl index 222b3dc0..7f5bf17 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/cssom.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/cssom.idl
@@ -106,7 +106,9 @@ interface CSSImportRule : CSSRule { readonly attribute USVString href; [SameObject, PutForwards=mediaText] readonly attribute MediaList media; - [SameObject] readonly attribute CSSStyleSheet styleSheet; + [SameObject] readonly attribute CSSStyleSheet? styleSheet; + readonly attribute CSSOMString? layerName; + readonly attribute CSSOMString? supportsText; }; [Exposed=Window]
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/fenced-frame.idl b/third_party/blink/web_tests/external/wpt/interfaces/fenced-frame.idl index 2869b95e6..6b0734d 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/fenced-frame.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/fenced-frame.idl
@@ -10,19 +10,23 @@ [CEReactions] attribute FencedFrameConfig? config; [CEReactions] attribute DOMString width; [CEReactions] attribute DOMString height; + [CEReactions] attribute DOMString allow; }; enum OpaqueProperty {"opaque"}; typedef (unsigned long or OpaqueProperty) FencedFrameConfigSize; -typedef (USVString or OpaqueProperty) FencedFrameConfigURL; +typedef USVString FencedFrameConfigURL; [Exposed=Window] interface FencedFrameConfig { - constructor(USVString url); readonly attribute FencedFrameConfigURL? url; - readonly attribute FencedFrameConfigSize? width; - readonly attribute FencedFrameConfigSize? height; + readonly attribute FencedFrameConfigSize? containerWidth; + readonly attribute FencedFrameConfigSize? containerHeight; + readonly attribute FencedFrameConfigSize? contentWidth; + readonly attribute FencedFrameConfigSize? contentHeight; + + undefined setSharedStorageContext(DOMString contextString); }; enum FenceReportingDestination {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/fs.idl b/third_party/blink/web_tests/external/wpt/interfaces/fs.idl index e2474132..e341ab3 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/fs.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/fs.idl
@@ -15,6 +15,7 @@ Promise<boolean> isSameEntry(FileSystemHandle other); }; + dictionary FileSystemCreateWritableOptions { boolean keepExistingData = false; }; @@ -26,6 +27,7 @@ [Exposed=DedicatedWorker] Promise<FileSystemSyncAccessHandle> createSyncAccessHandle(); }; + dictionary FileSystemGetFileOptions { boolean create = false; }; @@ -49,6 +51,7 @@ Promise<sequence<USVString>?> resolve(FileSystemHandle possibleDescendant); }; + enum WriteCommandType { "write", "seek", @@ -70,6 +73,7 @@ Promise<undefined> seek(unsigned long long position); Promise<undefined> truncate(unsigned long long size); }; + dictionary FileSystemReadWriteOptions { [EnforceRange] unsigned long long at; };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/html.idl b/third_party/blink/web_tests/external/wpt/interfaces/html.idl index 33d4de0..99b3370 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/html.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/html.idl
@@ -1643,6 +1643,14 @@ boolean customError = false; }; +[Exposed=(Window)] +interface VisibilityStateEntry : PerformanceEntry { + readonly attribute DOMString name; // shadows inherited name + readonly attribute DOMString entryType; // shadows inherited entryType + readonly attribute DOMHighResTimeStamp startTime; // shadows inherited startTime + readonly attribute unsigned long duration; // shadows inherited duration +}; + [Exposed=Window] interface UserActivation { readonly attribute boolean hasBeenActive;
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/mediastream-recording.idl b/third_party/blink/web_tests/external/wpt/interfaces/mediastream-recording.idl index 99f3028..496bfcf2 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/mediastream-recording.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/mediastream-recording.idl
@@ -34,6 +34,8 @@ unsigned long videoBitsPerSecond; unsigned long bitsPerSecond; BitrateMode audioBitrateMode = "variable"; + DOMHighResTimeStamp videoKeyFrameIntervalDuration; + unsigned long videoKeyFrameIntervalCount; }; enum BitrateMode {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/real-world-meshing.idl b/third_party/blink/web_tests/external/wpt/interfaces/real-world-meshing.idl new file mode 100644 index 0000000..38fe71f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/interfaces/real-world-meshing.idl
@@ -0,0 +1,21 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: WebXR Mesh Detection Module (https://immersive-web.github.io/real-world-meshing/) + +[Exposed=Window] interface XRMesh { + [SameObject] readonly attribute XRSpace meshSpace; + + readonly attribute FrozenArray<Float32Array> vertices; + readonly attribute Uint32Array indices; + readonly attribute DOMHighResTimeStamp lastChangedTime; + readonly attribute DOMString? semanticLabel; +}; + +[Exposed=Window] interface XRMeshSet { + readonly setlike<XRMesh>; +}; + +partial interface XRFrame { + readonly attribute XRMeshSet detectedMeshs; +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/resource-timing.idl b/third_party/blink/web_tests/external/wpt/interfaces/resource-timing.idl index 151e5d46d..aa17003 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/resource-timing.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/resource-timing.idl
@@ -18,6 +18,7 @@ readonly attribute DOMHighResTimeStamp connectEnd; readonly attribute DOMHighResTimeStamp secureConnectionStart; readonly attribute DOMHighResTimeStamp requestStart; + readonly attribute DOMHighResTimeStamp firstInterimResponseStart; readonly attribute DOMHighResTimeStamp responseStart; readonly attribute DOMHighResTimeStamp responseEnd; readonly attribute unsigned long long transferSize;
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/scroll-animations.idl b/third_party/blink/web_tests/external/wpt/interfaces/scroll-animations.idl index 14215509c..31b3746 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/scroll-animations.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/scroll-animations.idl
@@ -36,7 +36,11 @@ readonly attribute CSSNumericValue endOffset; }; +dictionary AnimationTimeOptions { + DOMString? range; +}; + [Exposed=Window] partial interface AnimationTimeline { - CSSNumericValue? getCurrentTime(optional CSSOMString rangeName); + CSSNumericValue? getCurrentTime(optional AnimationTimeOptions options = {}); };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/secure-payment-confirmation.idl b/third_party/blink/web_tests/external/wpt/interfaces/secure-payment-confirmation.idl index 9061b24..08ec806 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/secure-payment-confirmation.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/secure-payment-confirmation.idl
@@ -15,6 +15,7 @@ sequence<USVString> locale; boolean showOptOut; }; + partial dictionary AuthenticationExtensionsClientInputs { AuthenticationExtensionsPaymentInputs payment; }; @@ -30,9 +31,11 @@ PaymentCurrencyAmount total; PaymentCredentialInstrument instrument; }; + dictionary CollectedClientPaymentData : CollectedClientData { required CollectedClientAdditionalPaymentData payment; }; + dictionary CollectedClientAdditionalPaymentData { required USVString rpId; required USVString topOrigin; @@ -41,6 +44,7 @@ required PaymentCurrencyAmount total; required PaymentCredentialInstrument instrument; }; + dictionary PaymentCredentialInstrument { required USVString displayName; required USVString icon;
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/shared-storage.idl b/third_party/blink/web_tests/external/wpt/interfaces/shared-storage.idl new file mode 100644 index 0000000..eb5806f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/interfaces/shared-storage.idl
@@ -0,0 +1,80 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: Shared Storage API (https://wicg.github.io/shared-storage/) + +[Exposed=(Window)] +interface SharedStorageWorklet : Worklet { +}; + +[Exposed=SharedStorageWorklet, Global=SharedStorageWorklet] +interface SharedStorageWorkletGlobalScope : WorkletGlobalScope { + undefined register(DOMString name, + SharedStorageOperationConstructor operationCtor); +}; + +callback SharedStorageOperationConstructor = + SharedStorageOperation(optional SharedStorageRunOperationMethodOptions options); + +[Exposed=SharedStorageWorklet] +interface SharedStorageOperation { +}; + +dictionary SharedStorageRunOperationMethodOptions { + object data; + boolean resolveToConfig = false; + boolean keepAlive = false; +}; + +[Exposed=SharedStorageWorklet] +interface SharedStorageRunOperation : SharedStorageOperation { + Promise<undefined> run(object data); +}; + +[Exposed=SharedStorageWorklet] +interface SharedStorageSelectURLOperation : SharedStorageOperation { + Promise<long> run(object data, + FrozenArray<SharedStorageUrlWithMetadata> urls); +}; + +[Exposed=(Window,SharedStorageWorklet)] +interface SharedStorage { + Promise<any> set(DOMString key, + DOMString value, + optional SharedStorageSetMethodOptions options = {}); + Promise<any> append(DOMString key, + DOMString value); + Promise<any> delete(DOMString key); + Promise<any> clear(); +}; + +dictionary SharedStorageSetMethodOptions { + boolean ignoreIfPresent = false; +}; + +typedef (USVString or FencedFrameConfig) SharedStorageResponse; + +[Exposed=(Window)] +interface WindowSharedStorage : SharedStorage { + Promise<any> run(DOMString name, + optional SharedStorageRunOperationMethodOptions options = {}); + Promise<SharedStorageResponse> selectURL(DOMString name, + FrozenArray<SharedStorageUrlWithMetadata> urls, + optional SharedStorageRunOperationMethodOptions options = {}); + + readonly attribute SharedStorageWorklet worklet; +}; + +dictionary SharedStorageUrlWithMetadata { + required USVString url; + object reportingMetadata; +}; + +[Exposed=(SharedStorageWorklet)] +interface WorkletSharedStorage : SharedStorage { + Promise<DOMString> get(DOMString key); + Promise<unsigned long> length(); + Promise<double> remainingBudget(); + + async iterable<DOMString, DOMString>; +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/storage-buckets.idl b/third_party/blink/web_tests/external/wpt/interfaces/storage-buckets.idl new file mode 100644 index 0000000..f3d500a5 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/interfaces/storage-buckets.idl
@@ -0,0 +1,53 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: Storage Buckets API (https://wicg.github.io/storage-buckets/) + +[SecureContext] +interface mixin NavigatorStorageBuckets { + [SameObject] readonly attribute StorageBucketManager storageBuckets; +}; +Navigator includes NavigatorStorageBuckets; +WorkerNavigator includes NavigatorStorageBuckets; + +[Exposed=(Window,Worker), + SecureContext] +interface StorageBucketManager { + Promise<StorageBucket> open(DOMString name, optional StorageBucketOptions options = {}); + Promise<sequence<DOMString>> keys(); + Promise<undefined> delete(DOMString name); +}; + +enum StorageBucketDurability { + "strict", + "relaxed" +}; + +dictionary StorageBucketOptions { + boolean? persisted = null; + StorageBucketDurability? durability = null; + unsigned long long? quota = null; + DOMHighResTimeStamp? expires = null; +}; + +[Exposed=(Window,Worker), + SecureContext] +interface StorageBucket { + readonly attribute DOMString name; + + [Exposed=Window] Promise<boolean> persist(); + Promise<boolean> persisted(); + + Promise<StorageEstimate> estimate(); + + Promise<StorageBucketDurability> durability(); + + Promise<undefined> setExpires(DOMHighResTimeStamp expires); + Promise<DOMHighResTimeStamp?> expires(); + + [SameObject] readonly attribute IDBFactory indexedDB; + + [SameObject] readonly attribute CacheStorage caches; + + Promise<FileSystemDirectoryHandle> getDirectory(); +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/trust-token-api.idl b/third_party/blink/web_tests/external/wpt/interfaces/trust-token-api.idl index ee33959..f521ace 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/trust-token-api.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/trust-token-api.idl
@@ -5,14 +5,11 @@ enum RefreshPolicy { "none", "refresh" }; -enum TokenType { "private-state-token" }; - enum TokenVersion { "1" }; enum OperationType { "token-request", "send-redemption-record", "token-redemption" }; dictionary PrivateToken { - required TokenType type; required TokenVersion version; required OperationType operation; RefreshPolicy refreshPolicy = "none"; @@ -24,6 +21,6 @@ }; partial interface Document { - Promise<boolean> hasPrivateTokens(USVString issuer, USVString type); - Promise<boolean> hasRedemptionRecord(USVString issuer, USVString type); + Promise<boolean> hasPrivateTokens(USVString issuer); + Promise<boolean> hasRedemptionRecord(USVString issuer); };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/turtledove.idl b/third_party/blink/web_tests/external/wpt/interfaces/turtledove.idl index cd81a3d8..8add667 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/turtledove.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/turtledove.idl
@@ -1,7 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT // Content was automatically extracted by Reffy into webref // (https://github.com/w3c/webref) -// Source: FLEDGE (https://wicg.github.io/turtledove/) +// Source: Protected Audience (formerly FLEDGE) (https://wicg.github.io/turtledove/) [SecureContext] partial interface Navigator { @@ -25,7 +25,7 @@ DOMString executionMode = "compatibility"; USVString biddingLogicURL; USVString biddingWasmHelperURL; - USVString dailyUpdateURL; + USVString updateURL; USVString trustedBiddingSignalsURL; sequence<USVString> trustedBiddingSignalsKeys; any userBiddingSignals; @@ -67,9 +67,15 @@ AbortSignal? signal; }; +[Exposed=InterestGroupScriptRunnerGlobalScope] +interface InterestGroupScriptRunnerGlobalScope { +}; + [Exposed=InterestGroupBiddingScriptRunnerGlobalScope, -Global=InterestGroupBiddingScriptRunnerGlobalScope] -interface InterestGroupBiddingScriptRunnerGlobalScope { + Global=(InterestGroupScriptRunnerGlobalScope, + InterestGroupBiddingScriptRunnerGlobalScope)] +interface InterestGroupBiddingScriptRunnerGlobalScope + : InterestGroupScriptRunnerGlobalScope { boolean setBid(); boolean setBid(GenerateBidOutput generateBidOutput); undefined setPriority(double priority); @@ -77,13 +83,17 @@ }; [Exposed=InterestGroupScoringScriptRunnerGlobalScope, -Global=InterestGroupScoringScriptRunnerGlobalScope] -interface InterestGroupScoringScriptRunnerGlobalScope { + Global=(InterestGroupScriptRunnerGlobalScope, + InterestGroupScoringScriptRunnerGlobalScope)] +interface InterestGroupScoringScriptRunnerGlobalScope + : InterestGroupScriptRunnerGlobalScope { }; [Exposed=InterestGroupReportingScriptRunnerGlobalScope, -Global=InterestGroupReportingScriptRunnerGlobalScope] -interface InterestGroupReportingScriptRunnerGlobalScope { + Global=(InterestGroupScriptRunnerGlobalScope, + InterestGroupReportingScriptRunnerGlobalScope)] +interface InterestGroupReportingScriptRunnerGlobalScope + : InterestGroupScriptRunnerGlobalScope { undefined sendReportTo(DOMString url); }; @@ -96,7 +106,7 @@ dictionary GenerateBidOutput { required double bid; required (DOMString or AdRender) adRender; - DOMString ad; + any ad; sequence<(DOMString or AdRender)> adComponents; double adCost; double modelingSignals;
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/url.idl b/third_party/blink/web_tests/external/wpt/interfaces/url.idl index 6549e45..a5e4d1e 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/url.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/url.idl
@@ -33,10 +33,10 @@ readonly attribute unsigned long size; undefined append(USVString name, USVString value); - undefined delete(USVString name); + undefined delete(USVString name, optional USVString value); USVString? get(USVString name); sequence<USVString> getAll(USVString name); - boolean has(USVString name); + boolean has(USVString name, optional USVString value); undefined set(USVString name, USVString value); undefined sort();
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webauthn.idl b/third_party/blink/web_tests/external/wpt/interfaces/webauthn.idl index 58a9e285..c7f72ea 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webauthn.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webauthn.idl
@@ -12,6 +12,7 @@ static Promise<boolean> isConditionalMediationAvailable(); PublicKeyCredentialJSON toJSON(); }; + typedef DOMString Base64URLString; typedef (RegistrationResponseJSON or AuthenticationResponseJSON) PublicKeyCredentialJSON; @@ -48,15 +49,19 @@ dictionary AuthenticationExtensionsClientOutputsJSON { }; + partial dictionary CredentialCreationOptions { PublicKeyCredentialCreationOptions publicKey; }; + partial dictionary CredentialRequestOptions { PublicKeyCredentialRequestOptions publicKey; }; + partial interface PublicKeyCredential { static Promise<boolean> isUserVerifyingPlatformAuthenticatorAvailable(); }; + partial interface PublicKeyCredential { static PublicKeyCredentialCreationOptions parseCreationOptionsFromJSON(PublicKeyCredentialCreationOptionsJSON options); }; @@ -87,6 +92,7 @@ dictionary AuthenticationExtensionsClientInputsJSON { }; + partial interface PublicKeyCredential { static PublicKeyCredentialRequestOptions parseRequestOptionsFromJSON(PublicKeyCredentialRequestOptionsJSON options); }; @@ -99,10 +105,12 @@ DOMString userVerification = "preferred"; AuthenticationExtensionsClientInputsJSON extensions; }; + [SecureContext, Exposed=Window] interface AuthenticatorResponse { [SameObject] readonly attribute ArrayBuffer clientDataJSON; }; + [SecureContext, Exposed=Window] interface AuthenticatorAttestationResponse : AuthenticatorResponse { [SameObject] readonly attribute ArrayBuffer attestationObject; @@ -111,6 +119,7 @@ ArrayBuffer? getPublicKey(); COSEAlgorithmIdentifier getPublicKeyAlgorithm(); }; + [SecureContext, Exposed=Window] interface AuthenticatorAssertionResponse : AuthenticatorResponse { [SameObject] readonly attribute ArrayBuffer authenticatorData; @@ -118,10 +127,12 @@ [SameObject] readonly attribute ArrayBuffer? userHandle; [SameObject] readonly attribute ArrayBuffer? attestationObject; }; + dictionary PublicKeyCredentialParameters { required DOMString type; required COSEAlgorithmIdentifier alg; }; + dictionary PublicKeyCredentialCreationOptions { required PublicKeyCredentialRpEntity rp; required PublicKeyCredentialUserEntity user; @@ -136,37 +147,45 @@ sequence<DOMString> attestationFormats = []; AuthenticationExtensionsClientInputs extensions; }; + dictionary PublicKeyCredentialEntity { required DOMString name; }; + dictionary PublicKeyCredentialRpEntity : PublicKeyCredentialEntity { DOMString id; }; + dictionary PublicKeyCredentialUserEntity : PublicKeyCredentialEntity { required BufferSource id; required DOMString displayName; }; + dictionary AuthenticatorSelectionCriteria { DOMString authenticatorAttachment; DOMString residentKey; boolean requireResidentKey = false; DOMString userVerification = "preferred"; }; + enum AuthenticatorAttachment { "platform", "cross-platform" }; + enum ResidentKeyRequirement { "discouraged", "preferred", "required" }; + enum AttestationConveyancePreference { "none", "indirect", "direct", "enterprise" }; + dictionary PublicKeyCredentialRequestOptions { required BufferSource challenge; unsigned long timeout; @@ -177,10 +196,13 @@ sequence<DOMString> attestationFormats = []; AuthenticationExtensionsClientInputs extensions; }; + dictionary AuthenticationExtensionsClientInputs { }; + dictionary AuthenticationExtensionsClientOutputs { }; + dictionary CollectedClientData { required DOMString type; required DOMString challenge; @@ -195,42 +217,54 @@ }; enum TokenBindingStatus { "present", "supported" }; + enum PublicKeyCredentialType { "public-key" }; + dictionary PublicKeyCredentialDescriptor { required DOMString type; required BufferSource id; sequence<DOMString> transports; }; + enum AuthenticatorTransport { "usb", "nfc", "ble", + "smart-card", "hybrid", "internal" }; + typedef long COSEAlgorithmIdentifier; + enum UserVerificationRequirement { "required", "preferred", "discouraged" }; + partial dictionary AuthenticationExtensionsClientInputs { USVString appid; }; + partial dictionary AuthenticationExtensionsClientOutputs { boolean appid; }; + partial dictionary AuthenticationExtensionsClientInputs { USVString appidExclude; }; + partial dictionary AuthenticationExtensionsClientOutputs { boolean appidExclude; }; + partial dictionary AuthenticationExtensionsClientInputs { boolean credProps; }; + dictionary CredentialPropertiesOutput { boolean rk; }; @@ -238,6 +272,7 @@ partial dictionary AuthenticationExtensionsClientOutputs { CredentialPropertiesOutput credProps; }; + dictionary AuthenticationExtensionsPRFValues { required BufferSource first; BufferSource second; @@ -289,12 +324,14 @@ partial dictionary AuthenticationExtensionsClientInputs { boolean uvm; }; + typedef sequence<unsigned long> UvmEntry; typedef sequence<UvmEntry> UvmEntries; partial dictionary AuthenticationExtensionsClientOutputs { UvmEntries uvm; }; + dictionary AuthenticationExtensionsDevicePublicKeyInputs { DOMString attestation = "none"; sequence<DOMString> attestationFormats = [];
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webcodecs-av1-codec-registration.idl b/third_party/blink/web_tests/external/wpt/interfaces/webcodecs-av1-codec-registration.idl index 00e4493..ab208797 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webcodecs-av1-codec-registration.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webcodecs-av1-codec-registration.idl
@@ -3,6 +3,14 @@ // (https://github.com/w3c/webref) // Source: AV1 WebCodecs Registration (https://w3c.github.io/webcodecs/av1_codec_registration.html) +partial dictionary VideoEncoderConfig { + AV1EncoderConfig av1; +}; + +dictionary AV1EncoderConfig { + boolean forceScreenContentTools = false; +}; + partial dictionary VideoEncoderEncodeOptions { VideoEncoderEncodeOptionsForAv1 av1; };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webcodecs-avc-codec-registration.idl b/third_party/blink/web_tests/external/wpt/interfaces/webcodecs-avc-codec-registration.idl index d4074f6..2b952c22 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webcodecs-avc-codec-registration.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webcodecs-avc-codec-registration.idl
@@ -15,3 +15,11 @@ "annexb", "avc", }; + +partial dictionary VideoEncoderEncodeOptions { + VideoEncoderEncodeOptionsForAvc avc; +}; + +dictionary VideoEncoderEncodeOptionsForAvc { + unsigned short? quantizer; +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webcodecs.idl b/third_party/blink/web_tests/external/wpt/interfaces/webcodecs.idl index 77649029..0b95dc8 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webcodecs.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webcodecs.idl
@@ -161,6 +161,7 @@ [EnforceRange] unsigned long sampleRate; [EnforceRange] unsigned long numberOfChannels; [EnforceRange] unsigned long long bitrate; + BitrateMode bitrateMode; }; dictionary VideoEncoderConfig {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webgpu.idl b/third_party/blink/web_tests/external/wpt/interfaces/webgpu.idl index 284327a..34f78a1 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webgpu.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webgpu.idl
@@ -18,6 +18,7 @@ readonly attribute unsigned long maxTextureDimension3D; readonly attribute unsigned long maxTextureArrayLayers; readonly attribute unsigned long maxBindGroups; + readonly attribute unsigned long maxBindGroupsPlusVertexBuffers; readonly attribute unsigned long maxBindingsPerBindGroup; readonly attribute unsigned long maxDynamicUniformBuffersPerPipelineLayout; readonly attribute unsigned long maxDynamicStorageBuffersPerPipelineLayout; @@ -26,7 +27,6 @@ readonly attribute unsigned long maxStorageBuffersPerShaderStage; readonly attribute unsigned long maxStorageTexturesPerShaderStage; readonly attribute unsigned long maxUniformBuffersPerShaderStage; - readonly attribute unsigned long maxFragmentCombinedOutputResources; readonly attribute unsigned long long maxUniformBufferBindingSize; readonly attribute unsigned long long maxStorageBufferBindingSize; readonly attribute unsigned long minUniformBufferOffsetAlignment; @@ -85,7 +85,7 @@ enum GPUPowerPreference { "low-power", - "high-performance" + "high-performance", }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -98,7 +98,8 @@ Promise<GPUAdapterInfo> requestAdapterInfo(optional sequence<DOMString> unmaskHints = []); }; -dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase { +dictionary GPUDeviceDescriptor + : GPUObjectDescriptorBase { sequence<GPUFeatureName> requiredFeatures = []; record<DOMString, GPUSize64> requiredLimits = {}; GPUQueueDescriptor defaultQueue = {}; @@ -115,7 +116,7 @@ "shader-f16", "rg11b10ufloat-renderable", "bgra8unorm-storage", - "float32-filterable" + "float32-filterable", }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -167,10 +168,11 @@ enum GPUBufferMapState { "unmapped", "pending", - "mapped" + "mapped", }; -dictionary GPUBufferDescriptor : GPUObjectDescriptorBase { +dictionary GPUBufferDescriptor + : GPUObjectDescriptorBase { required GPUSize64 size; required GPUBufferUsageFlags usage; boolean mappedAtCreation = false; @@ -215,7 +217,8 @@ }; GPUTexture includes GPUObjectBase; -dictionary GPUTextureDescriptor : GPUObjectDescriptorBase { +dictionary GPUTextureDescriptor + : GPUObjectDescriptorBase { required GPUExtent3D size; GPUIntegerCoordinate mipLevelCount = 1; GPUSize32 sampleCount = 1; @@ -228,7 +231,7 @@ enum GPUTextureDimension { "1d", "2d", - "3d" + "3d", }; typedef [EnforceRange] unsigned long GPUTextureUsageFlags; @@ -246,7 +249,8 @@ }; GPUTextureView includes GPUObjectBase; -dictionary GPUTextureViewDescriptor : GPUObjectDescriptorBase { +dictionary GPUTextureViewDescriptor + : GPUObjectDescriptorBase { GPUTextureFormat format; GPUTextureViewDimension dimension; GPUTextureAspect aspect = "all"; @@ -262,13 +266,13 @@ "2d-array", "cube", "cube-array", - "3d" + "3d", }; enum GPUTextureAspect { "all", "stencil-only", - "depth-only" + "depth-only", }; enum GPUTextureFormat { @@ -388,7 +392,7 @@ "astc-12x10-unorm", "astc-12x10-unorm-srgb", "astc-12x12-unorm", - "astc-12x12-unorm-srgb" + "astc-12x12-unorm-srgb", }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -396,8 +400,9 @@ }; GPUExternalTexture includes GPUObjectBase; -dictionary GPUExternalTextureDescriptor : GPUObjectDescriptorBase { - required HTMLVideoElement source; +dictionary GPUExternalTextureDescriptor + : GPUObjectDescriptorBase { + required (HTMLVideoElement or VideoFrame) source; PredefinedColorSpace colorSpace = "srgb"; }; @@ -406,7 +411,8 @@ }; GPUSampler includes GPUObjectBase; -dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase { +dictionary GPUSamplerDescriptor + : GPUObjectDescriptorBase { GPUAddressMode addressModeU = "clamp-to-edge"; GPUAddressMode addressModeV = "clamp-to-edge"; GPUAddressMode addressModeW = "clamp-to-edge"; @@ -422,17 +428,17 @@ enum GPUAddressMode { "clamp-to-edge", "repeat", - "mirror-repeat" + "mirror-repeat", }; enum GPUFilterMode { "nearest", - "linear" + "linear", }; enum GPUMipmapFilterMode { "nearest", - "linear" + "linear", }; enum GPUCompareFunction { @@ -443,7 +449,7 @@ "greater", "not-equal", "greater-equal", - "always" + "always", }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -451,7 +457,8 @@ }; GPUBindGroupLayout includes GPUObjectBase; -dictionary GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase { +dictionary GPUBindGroupLayoutDescriptor + : GPUObjectDescriptorBase { required sequence<GPUBindGroupLayoutEntry> entries; }; @@ -477,7 +484,7 @@ enum GPUBufferBindingType { "uniform", "storage", - "read-only-storage" + "read-only-storage", }; dictionary GPUBufferBindingLayout { @@ -489,7 +496,7 @@ enum GPUSamplerBindingType { "filtering", "non-filtering", - "comparison" + "comparison", }; dictionary GPUSamplerBindingLayout { @@ -501,7 +508,7 @@ "unfilterable-float", "depth", "sint", - "uint" + "uint", }; dictionary GPUTextureBindingLayout { @@ -511,7 +518,7 @@ }; enum GPUStorageTextureAccess { - "write-only" + "write-only", }; dictionary GPUStorageTextureBindingLayout { @@ -528,7 +535,8 @@ }; GPUBindGroup includes GPUObjectBase; -dictionary GPUBindGroupDescriptor : GPUObjectDescriptorBase { +dictionary GPUBindGroupDescriptor + : GPUObjectDescriptorBase { required GPUBindGroupLayout layout; required sequence<GPUBindGroupEntry> entries; }; @@ -551,7 +559,8 @@ }; GPUPipelineLayout includes GPUObjectBase; -dictionary GPUPipelineLayoutDescriptor : GPUObjectDescriptorBase { +dictionary GPUPipelineLayoutDescriptor + : GPUObjectDescriptorBase { required sequence<GPUBindGroupLayout> bindGroupLayouts; }; @@ -561,7 +570,8 @@ }; GPUShaderModule includes GPUObjectBase; -dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase { +dictionary GPUShaderModuleDescriptor + : GPUObjectDescriptorBase { required USVString code; object sourceMap; record<USVString, GPUShaderModuleCompilationHint> hints; @@ -574,7 +584,7 @@ enum GPUCompilationMessageType { "error", "warning", - "info" + "info", }; [Exposed=(Window, DedicatedWorker), Serializable, SecureContext] @@ -604,14 +614,15 @@ enum GPUPipelineErrorReason { "validation", - "internal" + "internal", }; enum GPUAutoLayoutMode { - "auto" + "auto", }; -dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase { +dictionary GPUPipelineDescriptorBase + : GPUObjectDescriptorBase { required (GPUPipelineLayout or GPUAutoLayoutMode) layout; }; @@ -633,7 +644,8 @@ GPUComputePipeline includes GPUObjectBase; GPUComputePipeline includes GPUPipelineBase; -dictionary GPUComputePipelineDescriptor : GPUPipelineDescriptorBase { +dictionary GPUComputePipelineDescriptor + : GPUPipelineDescriptorBase { required GPUProgrammableStage compute; }; @@ -643,7 +655,8 @@ GPURenderPipeline includes GPUObjectBase; GPURenderPipeline includes GPUPipelineBase; -dictionary GPURenderPipelineDescriptor : GPUPipelineDescriptorBase { +dictionary GPURenderPipelineDescriptor + : GPUPipelineDescriptorBase { required GPUVertexState vertex; GPUPrimitiveState primitive = {}; GPUDepthStencilState depthStencil; @@ -666,18 +679,18 @@ "line-list", "line-strip", "triangle-list", - "triangle-strip" + "triangle-strip", }; enum GPUFrontFace { "ccw", - "cw" + "cw", }; enum GPUCullMode { "none", "front", - "back" + "back", }; dictionary GPUMultisampleState { @@ -686,7 +699,8 @@ boolean alphaToCoverageEnabled = false; }; -dictionary GPUFragmentState : GPUProgrammableStage { +dictionary GPUFragmentState + : GPUProgrammableStage { required sequence<GPUColorTargetState?> targets; }; @@ -731,7 +745,7 @@ "one-minus-dst-alpha", "src-alpha-saturated", "constant", - "one-minus-constant" + "one-minus-constant", }; enum GPUBlendOperation { @@ -739,7 +753,7 @@ "subtract", "reverse-subtract", "min", - "max" + "max", }; dictionary GPUDepthStencilState { @@ -774,12 +788,12 @@ "increment-clamp", "decrement-clamp", "increment-wrap", - "decrement-wrap" + "decrement-wrap", }; enum GPUIndexFormat { "uint16", - "uint32" + "uint32", }; enum GPUVertexFormat { @@ -812,15 +826,16 @@ "sint32", "sint32x2", "sint32x3", - "sint32x4" + "sint32x4", }; enum GPUVertexStepMode { "vertex", - "instance" + "instance", }; -dictionary GPUVertexState : GPUProgrammableStage { +dictionary GPUVertexState + : GPUProgrammableStage { sequence<GPUVertexBufferLayout?> buffers = []; }; @@ -837,17 +852,43 @@ required GPUIndex32 shaderLocation; }; -dictionary GPUImageDataLayout { GPUSize64 offset = 0; GPUSize32 bytesPerRow; GPUSize32 rowsPerImage;}; -dictionary GPUImageCopyBuffer : GPUImageDataLayout { required GPUBuffer buffer;}; -dictionary GPUImageCopyTexture { required GPUTexture texture; GPUIntegerCoordinate mipLevel = 0; GPUOrigin3D origin = {}; GPUTextureAspect aspect = "all";}; -dictionary GPUImageCopyTextureTagged : GPUImageCopyTexture { PredefinedColorSpace colorSpace = "srgb"; boolean premultipliedAlpha = false;}; -dictionary GPUImageCopyExternalImage { required (ImageBitmap or HTMLVideoElement or HTMLCanvasElement or OffscreenCanvas) source; GPUOrigin2D origin = {}; boolean flipY = false;}; +dictionary GPUImageDataLayout { + GPUSize64 offset = 0; + GPUSize32 bytesPerRow; + GPUSize32 rowsPerImage; +}; + +dictionary GPUImageCopyBuffer + : GPUImageDataLayout { + required GPUBuffer buffer; +}; + +dictionary GPUImageCopyTexture { + required GPUTexture texture; + GPUIntegerCoordinate mipLevel = 0; + GPUOrigin3D origin = {}; + GPUTextureAspect aspect = "all"; +}; + +dictionary GPUImageCopyTextureTagged + : GPUImageCopyTexture { + PredefinedColorSpace colorSpace = "srgb"; + boolean premultipliedAlpha = false; +}; + +dictionary GPUImageCopyExternalImage { + required (ImageBitmap or HTMLVideoElement or HTMLCanvasElement or OffscreenCanvas) source; + GPUOrigin2D origin = {}; + boolean flipY = false; +}; + [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUCommandBuffer { }; GPUCommandBuffer includes GPUObjectBase; -dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase { +dictionary GPUCommandBufferDescriptor + : GPUObjectDescriptorBase { }; interface mixin GPUCommandsMixin { @@ -900,14 +941,15 @@ GPUCommandEncoder includes GPUCommandsMixin; GPUCommandEncoder includes GPUDebugCommandsMixin; -dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase { +dictionary GPUCommandEncoderDescriptor + : GPUObjectDescriptorBase { }; interface mixin GPUBindingCommandsMixin { - undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup, + undefined setBindGroup(GPUIndex32 index, GPUBindGroup? bindGroup, optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []); - undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup, + undefined setBindGroup(GPUIndex32 index, GPUBindGroup? bindGroup, Uint32Array dynamicOffsetsData, GPUSize64 dynamicOffsetsDataStart, GPUSize32 dynamicOffsetsDataLength); @@ -932,21 +974,15 @@ GPUComputePassEncoder includes GPUDebugCommandsMixin; GPUComputePassEncoder includes GPUBindingCommandsMixin; -enum GPUComputePassTimestampLocation { - "beginning", - "end" -}; - -dictionary GPUComputePassTimestampWrite { +dictionary GPUComputePassTimestampWrites { required GPUQuerySet querySet; - required GPUSize32 queryIndex; - required GPUComputePassTimestampLocation location; + GPUSize32 beginningOfPassWriteIndex; + GPUSize32 endOfPassWriteIndex; }; -typedef sequence<GPUComputePassTimestampWrite> GPUComputePassTimestampWrites; - -dictionary GPUComputePassDescriptor : GPUObjectDescriptorBase { - GPUComputePassTimestampWrites timestampWrites = []; +dictionary GPUComputePassDescriptor + : GPUObjectDescriptorBase { + GPUComputePassTimestampWrites timestampWrites; }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -973,24 +1009,18 @@ GPURenderPassEncoder includes GPUBindingCommandsMixin; GPURenderPassEncoder includes GPURenderCommandsMixin; -enum GPURenderPassTimestampLocation { - "beginning", - "end" -}; - -dictionary GPURenderPassTimestampWrite { +dictionary GPURenderPassTimestampWrites { required GPUQuerySet querySet; - required GPUSize32 queryIndex; - required GPURenderPassTimestampLocation location; + GPUSize32 beginningOfPassWriteIndex; + GPUSize32 endOfPassWriteIndex; }; -typedef sequence<GPURenderPassTimestampWrite> GPURenderPassTimestampWrites; - -dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase { +dictionary GPURenderPassDescriptor + : GPUObjectDescriptorBase { required sequence<GPURenderPassColorAttachment?> colorAttachments; GPURenderPassDepthStencilAttachment depthStencilAttachment; GPUQuerySet occlusionQuerySet; - GPURenderPassTimestampWrites timestampWrites = []; + GPURenderPassTimestampWrites timestampWrites; GPUSize64 maxDrawCount = 50000000; }; @@ -1019,15 +1049,16 @@ enum GPULoadOp { "load", - "clear" + "clear", }; enum GPUStoreOp { "store", - "discard" + "discard", }; -dictionary GPURenderPassLayout : GPUObjectDescriptorBase { +dictionary GPURenderPassLayout + : GPUObjectDescriptorBase { required sequence<GPUTextureFormat?> colorFormats; GPUTextureFormat depthStencilFormat; GPUSize32 sampleCount = 1; @@ -1037,7 +1068,7 @@ undefined setPipeline(GPURenderPipeline pipeline); undefined setIndexBuffer(GPUBuffer buffer, GPUIndexFormat indexFormat, optional GPUSize64 offset = 0, optional GPUSize64 size); - undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size); + undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer? buffer, optional GPUSize64 offset = 0, optional GPUSize64 size); undefined draw(GPUSize32 vertexCount, optional GPUSize32 instanceCount = 1, optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0); @@ -1055,7 +1086,8 @@ }; GPURenderBundle includes GPUObjectBase; -dictionary GPURenderBundleDescriptor : GPUObjectDescriptorBase { +dictionary GPURenderBundleDescriptor + : GPUObjectDescriptorBase { }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -1068,12 +1100,14 @@ GPURenderBundleEncoder includes GPUBindingCommandsMixin; GPURenderBundleEncoder includes GPURenderCommandsMixin; -dictionary GPURenderBundleEncoderDescriptor : GPURenderPassLayout { +dictionary GPURenderBundleEncoderDescriptor + : GPURenderPassLayout { boolean depthReadOnly = false; boolean stencilReadOnly = false; }; -dictionary GPUQueueDescriptor : GPUObjectDescriptorBase { +dictionary GPUQueueDescriptor + : GPUObjectDescriptorBase { }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -1111,14 +1145,15 @@ }; GPUQuerySet includes GPUObjectBase; -dictionary GPUQuerySetDescriptor : GPUObjectDescriptorBase { +dictionary GPUQuerySetDescriptor + : GPUObjectDescriptorBase { required GPUQueryType type; required GPUSize32 count; }; enum GPUQueryType { "occlusion", - "timestamp" + "timestamp", }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -1133,7 +1168,7 @@ enum GPUCanvasAlphaMode { "opaque", - "premultiplied" + "premultiplied", }; dictionary GPUCanvasConfiguration { @@ -1147,7 +1182,7 @@ enum GPUDeviceLostReason { "unknown", - "destroyed" + "destroyed", }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -1166,24 +1201,27 @@ }; [Exposed=(Window, DedicatedWorker), SecureContext] -interface GPUValidationError : GPUError { +interface GPUValidationError + : GPUError { constructor(DOMString message); }; [Exposed=(Window, DedicatedWorker), SecureContext] -interface GPUOutOfMemoryError : GPUError { +interface GPUOutOfMemoryError + : GPUError { constructor(DOMString message); }; [Exposed=(Window, DedicatedWorker), SecureContext] -interface GPUInternalError : GPUError { +interface GPUInternalError + : GPUError { constructor(DOMString message); }; enum GPUErrorFilter { "validation", "out-of-memory", - "internal" + "internal", }; partial interface GPUDevice {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webnn.idl b/third_party/blink/web_tests/external/wpt/interfaces/webnn.idl index 2c2ab35..d2b973a 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webnn.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webnn.idl
@@ -489,13 +489,8 @@ MLActivation sigmoid(); }; -dictionary MLSliceOptions { - sequence<unsigned long> axes; -}; - partial interface MLGraphBuilder { - MLOperand slice(MLOperand input, sequence<long> starts, sequence<long> sizes, - optional MLSliceOptions options = {}); + MLOperand slice(MLOperand input, sequence<unsigned long> starts, sequence<unsigned long> sizes); }; partial interface MLGraphBuilder {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webrtc-encoded-transform.idl b/third_party/blink/web_tests/external/wpt/interfaces/webrtc-encoded-transform.idl index e48f1080..59710bf4 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webrtc-encoded-transform.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webrtc-encoded-transform.idl
@@ -72,7 +72,8 @@ unsigned long temporalIndex; unsigned long synchronizationSource; octet payloadType; - sequence<unsigned long> contributingSources; + sequence<unsigned long> contributingSources; + long long timestamp; // microseconds }; // New interfaces to define encoded video and audio frames. Will eventually
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webrtc-stats.idl b/third_party/blink/web_tests/external/wpt/interfaces/webrtc-stats.idl index 7e820a2..a5fb329 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webrtc-stats.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webrtc-stats.idl
@@ -94,6 +94,8 @@ boolean powerEfficientDecoder; unsigned long framesAssembledFromMultiplePackets; double totalAssemblyTime; + unsigned long long retransmittedPacketsReceived; + unsigned long long retransmittedBytesReceived; }; dictionary RTCRemoteInboundRtpStreamStats : RTCReceivedRtpStreamStats {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webxrlayers.idl b/third_party/blink/web_tests/external/wpt/interfaces/webxrlayers.idl index e182f47..c8b3a71 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webxrlayers.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webxrlayers.idl
@@ -11,6 +11,12 @@ "stereo-top-bottom" }; +enum XRLayerQuality { + "default", + "text-optimized", + "graphics-optimized" +}; + [Exposed=Window] interface XRCompositionLayer : XRLayer { readonly attribute XRLayerLayout layout; @@ -18,6 +24,7 @@ attribute boolean forceMonoPresentation; attribute float opacity; readonly attribute unsigned long mipLevels; + attribute XRLayerQuality quality; readonly attribute boolean needsRedraw; @@ -106,6 +113,7 @@ GLenum colorFormat = 0x1908; // RGBA GLenum depthFormat = 0x1902; // DEPTH_COMPONENT double scaleFactor = 1.0; + boolean clearOnAccess = true; }; dictionary XRLayerInit { @@ -117,6 +125,7 @@ required unsigned long viewPixelHeight; XRLayerLayout layout = "mono"; boolean isStatic = false; + boolean clearOnAccess = true; }; dictionary XRQuadLayerInit : XRLayerInit {
diff --git a/third_party/blink/web_tests/external/wpt/preload/modulepreload-as.html.ini b/third_party/blink/web_tests/external/wpt/preload/modulepreload-as.html.ini index 79e2df96..0835ead 100644 --- a/third_party/blink/web_tests/external/wpt/preload/modulepreload-as.html.ini +++ b/third_party/blink/web_tests/external/wpt/preload/modulepreload-as.html.ini
@@ -1,192 +1,138 @@ [modulepreload-as.html] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): ERROR - if (product == "content_shell") and (os == "mac") and (port == "mac12"): OK - if (product == "content_shell") and (os == "mac") and (port == "mac11"): [OK, ERROR, TIMEOUT] - if (product == "content_shell") and (os == "mac") and (port == "mac12-arm64"): [ERROR, OK] - if (product == "content_shell") and (os == "mac") and (port == "mac13"): [ERROR, OK, TIMEOUT] - if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): [OK, TIMEOUT] + if (product == "content_shell") and (os == "mac") and (port == "mac11"): OK + if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): OK + if (product == "content_shell") and (os == "mac") and (port == "mac12"): [OK, ERROR, TIMEOUT] if (product == "content_shell") and (os == "win") and (port == "win11"): TIMEOUT - if product == "chrome": ERROR - [ERROR, TIMEOUT] + ERROR [Modulepreload with as="audio"] - expected: - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - if (product == "content_shell") and (os == "linux") and (flag_specific == "disable-site-isolation-trials"): [FAIL, PASS] - FAIL + expected: FAIL [Modulepreload with as="audioworklet"] - expected: - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - FAIL + expected: FAIL [Modulepreload with as="document"] - expected: - if (product == "content_shell") and (os == "linux") and (flag_specific == "disable-site-isolation-trials"): [FAIL, PASS] - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - if (product == "content_shell") and (os == "win"): [FAIL, PASS] - if product == "chrome": [FAIL, PASS] - FAIL + expected: FAIL [Modulepreload with as="embed"] - expected: - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - if (product == "content_shell") and (os == "mac") and (port == "mac11"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac12-arm64"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): FAIL - if (product == "content_shell") and (os == "linux") and (flag_specific == "disable-site-isolation-trials"): FAIL - [FAIL, PASS] + expected: FAIL [Modulepreload with as="fetch"] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): [PASS, FAIL] - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS + if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): PASS + if (product == "content_shell") and (os == "mac") and (port == "mac12"): [FAIL, PASS] if (product == "content_shell") and (os == "linux"): PASS if product == "chrome": PASS - [FAIL, PASS] + FAIL [Modulepreload with as="font"] expected: - if (product == "content_shell") and (os == "linux") and (flag_specific == "disable-site-isolation-trials"): [PASS, FAIL] - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): [FAIL, PASS] - if (product == "content_shell") and (os == "win"): [PASS, FAIL] - if product == "chrome": [PASS, FAIL] + if (product == "content_shell") and (os == "linux") and (flag_specific == "disable-site-isolation-trials"): PASS + if (product == "content_shell") and (os == "win"): PASS + if product == "chrome": PASS FAIL [Modulepreload with as="frame"] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - if (product == "content_shell") and (os == "mac") and (port == "mac11"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): FAIL - if (product == "content_shell") and (os == "linux") and (flag_specific == "disable-site-isolation-trials"): [PASS, FAIL] - if (product == "content_shell") and (os == "win"): [PASS, FAIL] - if product == "chrome": [PASS, FAIL] - [FAIL, PASS] + if (product == "content_shell") and (os == "linux") and (flag_specific == "disable-site-isolation-trials"): PASS + if (product == "content_shell") and (os == "win"): PASS + if product == "chrome": PASS + FAIL [Modulepreload with as="iMaGe"] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac11"): [FAIL, PASS] - if (product == "content_shell") and (os == "mac") and (port == "mac13"): [FAIL, PASS] - if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): [FAIL, PASS] - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - if (product == "content_shell") and (os == "linux"): PASS - [PASS, FAIL] + if (product == "content_shell") and (os == "mac") and (port == "mac13"): FAIL + if (product == "content_shell") and (os == "mac") and (port == "mac11"): FAIL + if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): FAIL + if (product == "content_shell") and (os == "mac") and (port == "mac12"): [FAIL, PASS] [Modulepreload with as="iframe"] expected: + if (product == "content_shell") and (os == "linux") and (flag_specific == "disable-site-isolation-trials"): PASS if (product == "content_shell") and (os == "linux") and (flag_specific == ""): PASS - if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): [FAIL, PASS] - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - if (product == "content_shell") and (os == "mac") and (port == "mac11"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac12-arm64"): [FAIL, PASS] - if (product == "content_shell") and (os == "mac") and (port == "mac13"): [FAIL, PASS] - [PASS, FAIL] + if (product == "content_shell") and (os == "win"): PASS + if product == "chrome": PASS + FAIL [Modulepreload with as="image"] expected: + if (product == "content_shell") and (os == "mac") and (port == "mac12-arm64"): FAIL + if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): FAIL if (product == "content_shell") and (os == "mac") and (port == "mac11"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac12-arm64"): [FAIL, PASS] - if (product == "content_shell") and (os == "mac") and (port == "mac13"): [FAIL, PASS] if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): [FAIL, PASS] - if (product == "content_shell") and (os == "linux") and (flag_specific == "disable-site-isolation-trials"): [PASS, FAIL] - if (product == "content_shell") and (os == "win"): [PASS, FAIL] + if (product == "content_shell") and (os == "mac") and (port == "mac12"): [FAIL, PASS] + if (product == "content_shell") and (os == "mac") and (port == "mac13"): FAIL [Modulepreload with as="invalid-dest"] - expected: - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - FAIL + expected: FAIL [Modulepreload with as="manifest"] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac13"): [FAIL, PASS] + if (product == "content_shell") and (os == "mac") and (port == "mac12"): [FAIL, PASS] if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): [PASS, FAIL] + if (product == "content_shell") and (os == "mac") and (port == "mac13"): FAIL + if (product == "content_shell") and (os == "mac") and (port == "mac12-arm64"): FAIL if (product == "content_shell") and (os == "mac") and (port == "mac11"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac12-arm64"): [FAIL, PASS] - if (product == "content_shell") and (os == "linux") and (flag_specific == "disable-site-isolation-trials"): [PASS, FAIL] [Modulepreload with as="object"] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac12-arm64"): [PASS, FAIL] + if (product == "content_shell") and (os == "mac") and (port == "mac12"): [FAIL, PASS] + if (product == "content_shell") and (os == "mac") and (port == "mac11"): FAIL if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): [PASS, FAIL] - if (product == "content_shell") and (os == "mac") and (port == "mac11"): [FAIL, PASS] - if (product == "content_shell") and (os == "mac") and (port == "mac13"): [PASS, FAIL] [Modulepreload with as="paintworklet"] - expected: - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - FAIL + expected: FAIL [Modulepreload with as="report"] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): [PASS, FAIL] - if (product == "content_shell") and (os == "mac") and (port == "mac11"): [FAIL, PASS] - if (product == "content_shell") and (os == "mac") and (port == "mac12-arm64"): [PASS, FAIL] - if (product == "content_shell") and (os == "mac") and (port == "mac13"): [PASS, FAIL] + if (product == "content_shell") and (os == "mac") and (port == "mac11"): FAIL if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): FAIL + if (product == "content_shell") and (os == "mac") and (port == "mac12"): [FAIL, PASS] [Modulepreload with as="serviceworker"] - expected: - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - FAIL + expected: FAIL [Modulepreload with as="sharedworker"] - expected: - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - FAIL + expected: FAIL [Modulepreload with as="style"] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): [PASS, FAIL] - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - if (product == "content_shell") and (os == "mac") and (port == "mac13"): FAIL - if (product == "content_shell") and (os == "linux") and (flag_specific == ""): [PASS, FAIL] - if product == "chrome": [PASS, FAIL] - [FAIL, PASS] + if (product == "content_shell") and (os == "linux") and (flag_specific == ""): PASS + if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): PASS + if product == "chrome": PASS + FAIL [Modulepreload with as="track"] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac13"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): [PASS, FAIL] - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - if (product == "content_shell") and (os == "linux") and (flag_specific == ""): [PASS, FAIL] - if product == "chrome": [PASS, FAIL] - [FAIL, PASS] + if (product == "content_shell") and (os == "linux") and (flag_specific == ""): PASS + if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): PASS + if product == "chrome": PASS + FAIL [Modulepreload with as="video"] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac11"): [FAIL, PASS] - if (product == "content_shell") and (os == "mac") and (port == "mac13"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): [FAIL, PASS] - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - if (product == "content_shell") and (os == "win"): [FAIL, PASS] - [PASS, FAIL] + if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): PASS + if (product == "content_shell") and (os == "mac") and (port == "mac12-arm64"): PASS + if (product == "content_shell") and (os == "linux"): PASS + if product == "chrome": PASS + FAIL [Modulepreload with as="webidentity"] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac13"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): [FAIL, PASS] - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - if (product == "content_shell") and (os == "mac") and (port == "mac11"): [FAIL, PASS] if (product == "content_shell") and (os == "linux") and (flag_specific == "disable-site-isolation-trials"): PASS - if (product == "content_shell") and (os == "win"): [FAIL, PASS] - [PASS, FAIL] + if (product == "content_shell") and (os == "linux") and (flag_specific == ""): PASS + if (product == "content_shell") and (os == "mac") and (port == "mac12-arm64"): PASS + if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): PASS + if product == "chrome": PASS + FAIL [Modulepreload with as="worker"] - expected: - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS - FAIL + expected: FAIL [Modulepreload with as="xslt"] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac13"): FAIL - if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): [PASS, FAIL] - if (product == "content_shell") and (os == "mac") and (port == "mac12"): PASS + if (product == "content_shell") and (os == "mac") and (port == "mac12"): [FAIL, PASS] + if (product == "content_shell") and (os == "mac") and (port == "mac13-arm64"): PASS if (product == "content_shell") and (os == "linux"): PASS - if product == "chrome": [PASS, FAIL] - [FAIL, PASS] + if product == "chrome": PASS + FAIL
diff --git a/third_party/blink/web_tests/external/wpt/scroll-animations/css/animation-timeline-named-scroll-progress-timeline.tentative.html.ini b/third_party/blink/web_tests/external/wpt/scroll-animations/css/animation-timeline-named-scroll-progress-timeline.tentative.html.ini new file mode 100644 index 0000000..dd95338b --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/scroll-animations/css/animation-timeline-named-scroll-progress-timeline.tentative.html.ini
@@ -0,0 +1,3 @@ +[animation-timeline-named-scroll-progress-timeline.tentative.html] + [scroll-timeline-name is not referenceable in animation-timeline on that element's siblings] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/scroll-animations/css/scroll-timeline-dynamic.tentative.html.ini b/third_party/blink/web_tests/external/wpt/scroll-animations/css/scroll-timeline-dynamic.tentative.html.ini index c8e2d28..9aa09b90 100644 --- a/third_party/blink/web_tests/external/wpt/scroll-animations/css/scroll-timeline-dynamic.tentative.html.ini +++ b/third_party/blink/web_tests/external/wpt/scroll-animations/css/scroll-timeline-dynamic.tentative.html.ini
@@ -1,6 +1,6 @@ [scroll-timeline-dynamic.tentative.html] - [Changing to/from animation-timeline:none [immediate\]] + [Change to timeline attachment while paused [immediate\]] expected: FAIL - [Changing to/from animation-timeline:none [scroll\]] + [Change to timeline attachment while paused [scroll\]] expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/unregister-immediately-during-extendable-events.https.html.ini b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/unregister-immediately-during-extendable-events.https.html.ini index c346d60..addd977d 100644 --- a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/unregister-immediately-during-extendable-events.https.html.ini +++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/unregister-immediately-during-extendable-events.https.html.ini
@@ -1,10 +1,10 @@ [unregister-immediately-during-extendable-events.https.html] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac11"): OK - if (product == "content_shell") and (os == "mac") and (port == "mac12"): [OK, TIMEOUT] + if (product == "content_shell") and (os == "mac") and (port == "mac12"): OK + if (product == "content_shell") and (os == "mac") and (port == "mac11"): [TIMEOUT, OK] TIMEOUT [Clear-Site-Data must fail pending subresource fetch events.] expected: - if (product == "content_shell") and (os == "mac") and (port == "mac11"): FAIL if (product == "content_shell") and (os == "mac") and (port == "mac12"): FAIL + if (product == "content_shell") and (os == "mac") and (port == "mac11"): FAIL TIMEOUT
diff --git a/third_party/blink/web_tests/external/wpt/url/idlharness.any-expected.txt b/third_party/blink/web_tests/external/wpt/url/idlharness.any-expected.txt index 4995d237..d8599ca 100644 --- a/third_party/blink/web_tests/external/wpt/url/idlharness.any-expected.txt +++ b/third_party/blink/web_tests/external/wpt/url/idlharness.any-expected.txt
@@ -50,10 +50,10 @@ PASS URLSearchParams interface: existence and properties of interface prototype object's @@unscopables property PASS URLSearchParams interface: attribute size PASS URLSearchParams interface: operation append(USVString, USVString) -PASS URLSearchParams interface: operation delete(USVString) +PASS URLSearchParams interface: operation delete(USVString, optional USVString) PASS URLSearchParams interface: operation get(USVString) PASS URLSearchParams interface: operation getAll(USVString) -PASS URLSearchParams interface: operation has(USVString) +PASS URLSearchParams interface: operation has(USVString, optional USVString) PASS URLSearchParams interface: operation set(USVString, USVString) PASS URLSearchParams interface: operation sort() PASS URLSearchParams interface: iterable<USVString, USVString> @@ -63,14 +63,14 @@ PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "size" with the proper type PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "append(USVString, USVString)" with the proper type PASS URLSearchParams interface: calling append(USVString, USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError -PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "delete(USVString)" with the proper type -PASS URLSearchParams interface: calling delete(USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError +PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "delete(USVString, optional USVString)" with the proper type +PASS URLSearchParams interface: calling delete(USVString, optional USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "get(USVString)" with the proper type PASS URLSearchParams interface: calling get(USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "getAll(USVString)" with the proper type PASS URLSearchParams interface: calling getAll(USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError -PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "has(USVString)" with the proper type -PASS URLSearchParams interface: calling has(USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError +PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "has(USVString, optional USVString)" with the proper type +PASS URLSearchParams interface: calling has(USVString, optional USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "set(USVString, USVString)" with the proper type PASS URLSearchParams interface: calling set(USVString, USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "sort()" with the proper type
diff --git a/third_party/blink/web_tests/external/wpt/url/idlharness.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/url/idlharness.any.worker-expected.txt index 4995d237..d8599ca 100644 --- a/third_party/blink/web_tests/external/wpt/url/idlharness.any.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/url/idlharness.any.worker-expected.txt
@@ -50,10 +50,10 @@ PASS URLSearchParams interface: existence and properties of interface prototype object's @@unscopables property PASS URLSearchParams interface: attribute size PASS URLSearchParams interface: operation append(USVString, USVString) -PASS URLSearchParams interface: operation delete(USVString) +PASS URLSearchParams interface: operation delete(USVString, optional USVString) PASS URLSearchParams interface: operation get(USVString) PASS URLSearchParams interface: operation getAll(USVString) -PASS URLSearchParams interface: operation has(USVString) +PASS URLSearchParams interface: operation has(USVString, optional USVString) PASS URLSearchParams interface: operation set(USVString, USVString) PASS URLSearchParams interface: operation sort() PASS URLSearchParams interface: iterable<USVString, USVString> @@ -63,14 +63,14 @@ PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "size" with the proper type PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "append(USVString, USVString)" with the proper type PASS URLSearchParams interface: calling append(USVString, USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError -PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "delete(USVString)" with the proper type -PASS URLSearchParams interface: calling delete(USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError +PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "delete(USVString, optional USVString)" with the proper type +PASS URLSearchParams interface: calling delete(USVString, optional USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "get(USVString)" with the proper type PASS URLSearchParams interface: calling get(USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "getAll(USVString)" with the proper type PASS URLSearchParams interface: calling getAll(USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError -PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "has(USVString)" with the proper type -PASS URLSearchParams interface: calling has(USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError +PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "has(USVString, optional USVString)" with the proper type +PASS URLSearchParams interface: calling has(USVString, optional USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "set(USVString, USVString)" with the proper type PASS URLSearchParams interface: calling set(USVString, USVString) on new URLSearchParams("hi=there&thank=you") with too few arguments must throw TypeError PASS URLSearchParams interface: new URLSearchParams("hi=there&thank=you") must inherit property "sort()" with the proper type
diff --git a/third_party/blink/web_tests/external/wpt/webnn/idlharness.https.any.js.ini b/third_party/blink/web_tests/external/wpt/webnn/idlharness.https.any.js.ini index 742ed6b3..c2b96c4 100644 --- a/third_party/blink/web_tests/external/wpt/webnn/idlharness.https.any.js.ini +++ b/third_party/blink/web_tests/external/wpt/webnn/idlharness.https.any.js.ini
@@ -1,25 +1,4 @@ [idlharness.https.any.html] - [MLActivation interface object length] - expected: FAIL - - [MLActivation interface object name] - expected: FAIL - - [MLActivation interface: existence and properties of interface object] - expected: FAIL - - [MLActivation interface: existence and properties of interface prototype object] - expected: FAIL - - [MLActivation interface: existence and properties of interface prototype object's "constructor" property] - expected: FAIL - - [MLActivation interface: existence and properties of interface prototype object's @@unscopables property] - expected: FAIL - - [MLActivation must be primary interface of relu] - expected: FAIL - [MLCommandEncoder interface object length] expected: FAIL @@ -47,54 +26,24 @@ [MLCommandEncoder interface: operation initializeGraph(MLGraph)] expected: FAIL - [MLContext interface: calling compute(MLGraph, MLNamedArrayBufferViews, MLNamedArrayBufferViews) on context with too few arguments must throw TypeError] - expected: FAIL - - [MLContext interface: context must inherit property "compute(MLGraph, MLNamedArrayBufferViews, MLNamedArrayBufferViews)" with the proper type] - expected: FAIL - [MLContext interface: context must inherit property "createCommandEncoder()" with the proper type] expected: FAIL - [MLContext interface: operation compute(MLGraph, MLNamedArrayBufferViews, MLNamedArrayBufferViews)] - expected: FAIL - [MLContext interface: operation createCommandEncoder()] expected: FAIL [MLGraph must be primary interface of graph] expected: FAIL - [MLGraphBuilder interface: builder must inherit property "abs(MLOperand)" with the proper type] - expected: FAIL - [MLGraphBuilder interface: builder must inherit property "batchNormalization(MLOperand, MLOperand, MLOperand, optional MLBatchNormalizationOptions)" with the proper type] expected: FAIL - [MLGraphBuilder interface: builder must inherit property "ceil(MLOperand)" with the proper type] - expected: FAIL - - [MLGraphBuilder interface: builder must inherit property "concat(sequence<MLOperand>, long)" with the proper type] - expected: FAIL - - [MLGraphBuilder interface: builder must inherit property "convTranspose2d(MLOperand, MLOperand, optional MLConvTranspose2dOptions)" with the proper type] - expected: FAIL - [MLGraphBuilder interface: builder must inherit property "cos(MLOperand)" with the proper type] expected: FAIL - [MLGraphBuilder interface: builder must inherit property "elu(MLOperand, optional MLEluOptions)" with the proper type] - expected: FAIL - - [MLGraphBuilder interface: builder must inherit property "elu(optional MLEluOptions)" with the proper type] - expected: FAIL - [MLGraphBuilder interface: builder must inherit property "exp(MLOperand)" with the proper type] expected: FAIL - [MLGraphBuilder interface: builder must inherit property "floor(MLOperand)" with the proper type] - expected: FAIL - [MLGraphBuilder interface: builder must inherit property "gru(MLOperand, MLOperand, MLOperand, unsigned long, unsigned long, optional MLGruOptions)" with the proper type] expected: FAIL @@ -113,12 +62,6 @@ [MLGraphBuilder interface: builder must inherit property "l2Pool2d(MLOperand, optional MLPool2dOptions)" with the proper type] expected: FAIL - [MLGraphBuilder interface: builder must inherit property "leakyRelu(MLOperand, optional MLLeakyReluOptions)" with the proper type] - expected: FAIL - - [MLGraphBuilder interface: builder must inherit property "leakyRelu(optional MLLeakyReluOptions)" with the proper type] - expected: FAIL - [MLGraphBuilder interface: builder must inherit property "linear(MLOperand, optional MLLinearOptions)" with the proper type] expected: FAIL @@ -137,12 +80,6 @@ [MLGraphBuilder interface: builder must inherit property "matmul(MLOperand, MLOperand)" with the proper type] expected: FAIL - [MLGraphBuilder interface: builder must inherit property "neg(MLOperand)" with the proper type] - expected: FAIL - - [MLGraphBuilder interface: builder must inherit property "pad(MLOperand, MLOperand, optional MLPadOptions)" with the proper type] - expected: FAIL - [MLGraphBuilder interface: builder must inherit property "pow(MLOperand, MLOperand)" with the proper type] expected: FAIL @@ -179,7 +116,7 @@ [MLGraphBuilder interface: builder must inherit property "sin(MLOperand)" with the proper type] expected: FAIL - [MLGraphBuilder interface: builder must inherit property "slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions)" with the proper type] + [MLGraphBuilder interface: builder must inherit property "slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>)" with the proper type] expected: FAIL [MLGraphBuilder interface: builder must inherit property "softplus(MLOperand, optional MLSoftplusOptions)" with the proper type] @@ -209,39 +146,15 @@ [MLGraphBuilder interface: builder must inherit property "tanh(MLOperand)" with the proper type] expected: FAIL - [MLGraphBuilder interface: builder must inherit property "transpose(MLOperand, optional MLTransposeOptions)" with the proper type] - expected: FAIL - - [MLGraphBuilder interface: calling abs(MLOperand) on builder with too few arguments must throw TypeError] - expected: FAIL - [MLGraphBuilder interface: calling batchNormalization(MLOperand, MLOperand, MLOperand, optional MLBatchNormalizationOptions) on builder with too few arguments must throw TypeError] expected: FAIL - [MLGraphBuilder interface: calling ceil(MLOperand) on builder with too few arguments must throw TypeError] - expected: FAIL - - [MLGraphBuilder interface: calling concat(sequence<MLOperand>, long) on builder with too few arguments must throw TypeError] - expected: FAIL - - [MLGraphBuilder interface: calling convTranspose2d(MLOperand, MLOperand, optional MLConvTranspose2dOptions) on builder with too few arguments must throw TypeError] - expected: FAIL - [MLGraphBuilder interface: calling cos(MLOperand) on builder with too few arguments must throw TypeError] expected: FAIL - [MLGraphBuilder interface: calling elu(MLOperand, optional MLEluOptions) on builder with too few arguments must throw TypeError] - expected: FAIL - - [MLGraphBuilder interface: calling elu(optional MLEluOptions) on builder with too few arguments must throw TypeError] - expected: FAIL - [MLGraphBuilder interface: calling exp(MLOperand) on builder with too few arguments must throw TypeError] expected: FAIL - [MLGraphBuilder interface: calling floor(MLOperand) on builder with too few arguments must throw TypeError] - expected: FAIL - [MLGraphBuilder interface: calling gru(MLOperand, MLOperand, MLOperand, unsigned long, unsigned long, optional MLGruOptions) on builder with too few arguments must throw TypeError] expected: FAIL @@ -260,12 +173,6 @@ [MLGraphBuilder interface: calling l2Pool2d(MLOperand, optional MLPool2dOptions) on builder with too few arguments must throw TypeError] expected: FAIL - [MLGraphBuilder interface: calling leakyRelu(MLOperand, optional MLLeakyReluOptions) on builder with too few arguments must throw TypeError] - expected: FAIL - - [MLGraphBuilder interface: calling leakyRelu(optional MLLeakyReluOptions) on builder with too few arguments must throw TypeError] - expected: FAIL - [MLGraphBuilder interface: calling linear(MLOperand, optional MLLinearOptions) on builder with too few arguments must throw TypeError] expected: FAIL @@ -284,12 +191,6 @@ [MLGraphBuilder interface: calling matmul(MLOperand, MLOperand) on builder with too few arguments must throw TypeError] expected: FAIL - [MLGraphBuilder interface: calling neg(MLOperand) on builder with too few arguments must throw TypeError] - expected: FAIL - - [MLGraphBuilder interface: calling pad(MLOperand, MLOperand, optional MLPadOptions) on builder with too few arguments must throw TypeError] - expected: FAIL - [MLGraphBuilder interface: calling pow(MLOperand, MLOperand) on builder with too few arguments must throw TypeError] expected: FAIL @@ -326,7 +227,7 @@ [MLGraphBuilder interface: calling sin(MLOperand) on builder with too few arguments must throw TypeError] expected: FAIL - [MLGraphBuilder interface: calling slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions) on builder with too few arguments must throw TypeError] + [MLGraphBuilder interface: calling slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>) on builder with too few arguments must throw TypeError] expected: FAIL [MLGraphBuilder interface: calling softplus(MLOperand, optional MLSoftplusOptions) on builder with too few arguments must throw TypeError] @@ -350,45 +251,21 @@ [MLGraphBuilder interface: calling tanh(MLOperand) on builder with too few arguments must throw TypeError] expected: FAIL - [MLGraphBuilder interface: calling transpose(MLOperand, optional MLTransposeOptions) on builder with too few arguments must throw TypeError] - expected: FAIL - - [MLGraphBuilder interface: operation abs(MLOperand)] - expected: FAIL - [MLGraphBuilder interface: operation batchNormalization(MLOperand, MLOperand, MLOperand, optional MLBatchNormalizationOptions)] expected: FAIL - [MLGraphBuilder interface: operation ceil(MLOperand)] - expected: FAIL - - [MLGraphBuilder interface: operation concat(sequence<MLOperand>, long)] - expected: FAIL - [MLGraphBuilder interface: operation constant(MLOperandDescriptor, MLBufferView)] expected: FAIL [MLGraphBuilder interface: operation constant(double, optional MLOperandType)] expected: FAIL - [MLGraphBuilder interface: operation convTranspose2d(MLOperand, MLOperand, optional MLConvTranspose2dOptions)] - expected: FAIL - [MLGraphBuilder interface: operation cos(MLOperand)] expected: FAIL - [MLGraphBuilder interface: operation elu(MLOperand, optional MLEluOptions)] - expected: FAIL - - [MLGraphBuilder interface: operation elu(optional MLEluOptions)] - expected: FAIL - [MLGraphBuilder interface: operation exp(MLOperand)] expected: FAIL - [MLGraphBuilder interface: operation floor(MLOperand)] - expected: FAIL - [MLGraphBuilder interface: operation gru(MLOperand, MLOperand, MLOperand, unsigned long, unsigned long, optional MLGruOptions)] expected: FAIL @@ -407,12 +284,6 @@ [MLGraphBuilder interface: operation l2Pool2d(MLOperand, optional MLPool2dOptions)] expected: FAIL - [MLGraphBuilder interface: operation leakyRelu(MLOperand, optional MLLeakyReluOptions)] - expected: FAIL - - [MLGraphBuilder interface: operation leakyRelu(optional MLLeakyReluOptions)] - expected: FAIL - [MLGraphBuilder interface: operation linear(MLOperand, optional MLLinearOptions)] expected: FAIL @@ -431,12 +302,6 @@ [MLGraphBuilder interface: operation matmul(MLOperand, MLOperand)] expected: FAIL - [MLGraphBuilder interface: operation neg(MLOperand)] - expected: FAIL - - [MLGraphBuilder interface: operation pad(MLOperand, MLOperand, optional MLPadOptions)] - expected: FAIL - [MLGraphBuilder interface: operation pow(MLOperand, MLOperand)] expected: FAIL @@ -473,7 +338,7 @@ [MLGraphBuilder interface: operation sin(MLOperand)] expected: FAIL - [MLGraphBuilder interface: operation slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions)] + [MLGraphBuilder interface: operation slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>)] expected: FAIL [MLGraphBuilder interface: operation softmax()] @@ -509,9 +374,6 @@ [MLGraphBuilder interface: operation tanh(MLOperand)] expected: FAIL - [MLGraphBuilder interface: operation transpose(MLOperand, optional MLTransposeOptions)] - expected: FAIL - [NavigatorML must be primary interface of navigator] expected: FAIL @@ -521,9 +383,6 @@ [Stringification of navigator] expected: FAIL - [Stringification of relu] - expected: FAIL - [idl_test setup] expected: FAIL @@ -574,36 +433,18 @@ [MLGraph must be primary interface of graph] expected: FAIL - [MLGraphBuilder interface: builder must inherit property "abs(MLOperand)" with the proper type] - expected: FAIL - [MLGraphBuilder interface: builder must inherit property "batchNormalization(MLOperand, MLOperand, MLOperand, optional MLBatchNormalizationOptions)" with the proper type] expected: FAIL [MLGraphBuilder interface: builder must inherit property "build(MLNamedOperands)" with the proper type] expected: FAIL - [MLGraphBuilder interface: builder must inherit property "ceil(MLOperand)" with the proper type] - expected: FAIL - - [MLGraphBuilder interface: builder must inherit property "convTranspose2d(MLOperand, MLOperand, optional MLConvTranspose2dOptions)" with the proper type] - expected: FAIL - [MLGraphBuilder interface: builder must inherit property "cos(MLOperand)" with the proper type] expected: FAIL - [MLGraphBuilder interface: builder must inherit property "elu(MLOperand, optional MLEluOptions)" with the proper type] - expected: FAIL - - [MLGraphBuilder interface: builder must inherit property "elu(optional MLEluOptions)" with the proper type] - expected: FAIL - [MLGraphBuilder interface: builder must inherit property "exp(MLOperand)" with the proper type] expected: FAIL - [MLGraphBuilder interface: builder must inherit property "floor(MLOperand)" with the proper type] - expected: FAIL - [MLGraphBuilder interface: builder must inherit property "gru(MLOperand, MLOperand, MLOperand, unsigned long, unsigned long, optional MLGruOptions)" with the proper type] expected: FAIL @@ -640,9 +481,6 @@ [MLGraphBuilder interface: builder must inherit property "matmul(MLOperand, MLOperand)" with the proper type] expected: FAIL - [MLGraphBuilder interface: builder must inherit property "neg(MLOperand)" with the proper type] - expected: FAIL - [MLGraphBuilder interface: builder must inherit property "pow(MLOperand, MLOperand)" with the proper type] expected: FAIL @@ -679,7 +517,7 @@ [MLGraphBuilder interface: builder must inherit property "sin(MLOperand)" with the proper type] expected: FAIL - [MLGraphBuilder interface: builder must inherit property "slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions)" with the proper type] + [MLGraphBuilder interface: builder must inherit property "slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>)" with the proper type] expected: FAIL [MLGraphBuilder interface: builder must inherit property "softplus(MLOperand, optional MLSoftplusOptions)" with the proper type] @@ -709,36 +547,18 @@ [MLGraphBuilder interface: builder must inherit property "tanh(MLOperand)" with the proper type] expected: FAIL - [MLGraphBuilder interface: calling abs(MLOperand) on builder with too few arguments must throw TypeError] - expected: FAIL - [MLGraphBuilder interface: calling batchNormalization(MLOperand, MLOperand, MLOperand, optional MLBatchNormalizationOptions) on builder with too few arguments must throw TypeError] expected: FAIL [MLGraphBuilder interface: calling build(MLNamedOperands) on builder with too few arguments must throw TypeError] expected: FAIL - [MLGraphBuilder interface: calling ceil(MLOperand) on builder with too few arguments must throw TypeError] - expected: FAIL - - [MLGraphBuilder interface: calling convTranspose2d(MLOperand, MLOperand, optional MLConvTranspose2dOptions) on builder with too few arguments must throw TypeError] - expected: FAIL - [MLGraphBuilder interface: calling cos(MLOperand) on builder with too few arguments must throw TypeError] expected: FAIL - [MLGraphBuilder interface: calling elu(MLOperand, optional MLEluOptions) on builder with too few arguments must throw TypeError] - expected: FAIL - - [MLGraphBuilder interface: calling elu(optional MLEluOptions) on builder with too few arguments must throw TypeError] - expected: FAIL - [MLGraphBuilder interface: calling exp(MLOperand) on builder with too few arguments must throw TypeError] expected: FAIL - [MLGraphBuilder interface: calling floor(MLOperand) on builder with too few arguments must throw TypeError] - expected: FAIL - [MLGraphBuilder interface: calling gru(MLOperand, MLOperand, MLOperand, unsigned long, unsigned long, optional MLGruOptions) on builder with too few arguments must throw TypeError] expected: FAIL @@ -775,9 +595,6 @@ [MLGraphBuilder interface: calling matmul(MLOperand, MLOperand) on builder with too few arguments must throw TypeError] expected: FAIL - [MLGraphBuilder interface: calling neg(MLOperand) on builder with too few arguments must throw TypeError] - expected: FAIL - [MLGraphBuilder interface: calling pow(MLOperand, MLOperand) on builder with too few arguments must throw TypeError] expected: FAIL @@ -814,7 +631,7 @@ [MLGraphBuilder interface: calling sin(MLOperand) on builder with too few arguments must throw TypeError] expected: FAIL - [MLGraphBuilder interface: calling slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions) on builder with too few arguments must throw TypeError] + [MLGraphBuilder interface: calling slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>) on builder with too few arguments must throw TypeError] expected: FAIL [MLGraphBuilder interface: calling softplus(MLOperand, optional MLSoftplusOptions) on builder with too few arguments must throw TypeError] @@ -838,42 +655,24 @@ [MLGraphBuilder interface: calling tanh(MLOperand) on builder with too few arguments must throw TypeError] expected: FAIL - [MLGraphBuilder interface: operation abs(MLOperand)] - expected: FAIL - [MLGraphBuilder interface: operation batchNormalization(MLOperand, MLOperand, MLOperand, optional MLBatchNormalizationOptions)] expected: FAIL [MLGraphBuilder interface: operation build(MLNamedOperands)] expected: FAIL - [MLGraphBuilder interface: operation ceil(MLOperand)] - expected: FAIL - [MLGraphBuilder interface: operation constant(MLOperandDescriptor, MLBufferView)] expected: FAIL [MLGraphBuilder interface: operation constant(double, optional MLOperandType)] expected: FAIL - [MLGraphBuilder interface: operation convTranspose2d(MLOperand, MLOperand, optional MLConvTranspose2dOptions)] - expected: FAIL - [MLGraphBuilder interface: operation cos(MLOperand)] expected: FAIL - [MLGraphBuilder interface: operation elu(MLOperand, optional MLEluOptions)] - expected: FAIL - - [MLGraphBuilder interface: operation elu(optional MLEluOptions)] - expected: FAIL - [MLGraphBuilder interface: operation exp(MLOperand)] expected: FAIL - [MLGraphBuilder interface: operation floor(MLOperand)] - expected: FAIL - [MLGraphBuilder interface: operation gru(MLOperand, MLOperand, MLOperand, unsigned long, unsigned long, optional MLGruOptions)] expected: FAIL @@ -910,12 +709,6 @@ [MLGraphBuilder interface: operation matmul(MLOperand, MLOperand)] expected: FAIL - [MLGraphBuilder interface: operation neg(MLOperand)] - expected: FAIL - - [MLGraphBuilder interface: operation pad(MLOperand, MLOperand, optional MLPadOptions)] - expected: FAIL - [MLGraphBuilder interface: operation pow(MLOperand, MLOperand)] expected: FAIL @@ -952,7 +745,7 @@ [MLGraphBuilder interface: operation sin(MLOperand)] expected: FAIL - [MLGraphBuilder interface: operation slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions)] + [MLGraphBuilder interface: operation slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>)] expected: FAIL [MLGraphBuilder interface: operation softmax()]
diff --git a/third_party/blink/web_tests/external/wpt/webrtc-stats/supported-stats.https-expected.txt b/third_party/blink/web_tests/external/wpt/webrtc-stats/supported-stats.https-expected.txt index 5006c48..a0f851b 100644 --- a/third_party/blink/web_tests/external/wpt/webrtc-stats/supported-stats.https-expected.txt +++ b/third_party/blink/web_tests/external/wpt/webrtc-stats/supported-stats.https-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 249 tests; 241 PASS, 8 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 251 tests; 243 PASS, 8 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS getStats succeeds PASS Validating stats PASS codec's payloadType @@ -60,6 +60,8 @@ PASS inbound-rtp's powerEfficientDecoder PASS inbound-rtp's framesAssembledFromMultiplePackets PASS inbound-rtp's totalAssemblyTime +PASS inbound-rtp's retransmittedPacketsReceived +PASS inbound-rtp's retransmittedBytesReceived PASS inbound-rtp's packetsReceived PASS inbound-rtp's packetsLost PASS inbound-rtp's jitter
diff --git a/third_party/blink/web_tests/external/wpt/webvtt/rendering/cues-with-video/processing-model/embedded_style_imports_blocked.html.ini b/third_party/blink/web_tests/external/wpt/webvtt/rendering/cues-with-video/processing-model/embedded_style_imports_blocked.html.ini index 2d5fe71f..56cc399 100644 --- a/third_party/blink/web_tests/external/wpt/webvtt/rendering/cues-with-video/processing-model/embedded_style_imports_blocked.html.ini +++ b/third_party/blink/web_tests/external/wpt/webvtt/rendering/cues-with-video/processing-model/embedded_style_imports_blocked.html.ini
@@ -1,4 +1,5 @@ [embedded_style_imports_blocked.html] expected: + if (product == "content_shell") and (os == "mac") and (port == "mac10.15"): FAIL if (product == "content_shell") and (os == "win") and (port == "win10.20h2"): FAIL if (product == "content_shell") and (os == "linux"): FAIL
diff --git a/third_party/blink/web_tests/external/wpt/workers/shared-worker-parse-error-failure.html.ini b/third_party/blink/web_tests/external/wpt/workers/shared-worker-parse-error-failure.html.ini index 3d3a090..49ac44f 100644 --- a/third_party/blink/web_tests/external/wpt/workers/shared-worker-parse-error-failure.html.ini +++ b/third_party/blink/web_tests/external/wpt/workers/shared-worker-parse-error-failure.html.ini
@@ -1,7 +1,5 @@ [shared-worker-parse-error-failure.html] - expected: - if (product == "content_shell") and (os == "mac") and (port == "mac12"): OK - TIMEOUT + expected: TIMEOUT [Classic shared worker construction for script with syntax error should dispatch an event named error.] expected: if product == "chrome": TIMEOUT
diff --git a/third_party/blink/web_tests/fast/css/placeholder-shown-basics-expected.html b/third_party/blink/web_tests/fast/css/placeholder-shown-basics-expected.html index 13bd0e3..70d8b1a 100644 --- a/third_party/blink/web_tests/fast/css/placeholder-shown-basics-expected.html +++ b/third_party/blink/web_tests/fast/css/placeholder-shown-basics-expected.html
@@ -10,61 +10,61 @@ <p>This test checks how various input elements are styled when :placeholder-shown is applied.</p> <div> <textarea></textarea> - <textarea placeholder></textarea> + <textarea placeholder class="placeholder-shown"></textarea> <textarea placeholder="Placeholder text" class="placeholder-shown"></textarea> <textarea placeholder="Placeholder text">Foobar</textarea> </div> <div> <input> - <input placeholder> + <input placeholder class="placeholder-shown"> <input placeholder="Placeholder text" class="placeholder-shown"> <input placeholder="Placeholder text" value="Foobar"> </div> <div> <input type=""> - <input type="" placeholder> + <input type="" placeholder class="placeholder-shown"> <input type="" placeholder="Placeholder text" class="placeholder-shown"> <input type="" placeholder="Placeholder text" value="Foobar"> </div> <div> <input type="hidden"> <input type="hidden" placeholder> - <input type="hidden" placeholder="Placeholder text" class="placeholder-shown"> + <input type="hidden" placeholder="Placeholder text"> <input type="hidden" placeholder="Placeholder text" value="Foobar"> </div> <div> <input type="text"> - <input type="text" placeholder> + <input type="text" placeholder class="placeholder-shown"> <input type="text" placeholder="Placeholder text" class="placeholder-shown"> <input type="text" placeholder="Placeholder text" value="Foobar"> </div> <div> <input type="tel"> - <input type="tel" placeholder> + <input type="tel" placeholder class="placeholder-shown"> <input type="tel" placeholder="Placeholder text" class="placeholder-shown"> <input type="tel" placeholder="Placeholder text" value="Foobar"> </div> <div> <input type="url"> - <input type="url" placeholder> + <input type="url" placeholder class="placeholder-shown"> <input type="url" placeholder="Placeholder text" class="placeholder-shown"> <input type="url" placeholder="Placeholder text" value="Foobar"> </div> <div> <input type="email"> - <input type="email" placeholder> + <input type="email" placeholder class="placeholder-shown"> <input type="email" placeholder="Placeholder text" class="placeholder-shown"> <input type="email" placeholder="Placeholder text" value="Foobar"> </div> <div> <input type="password"> - <input type="password" placeholder> + <input type="password" placeholder class="placeholder-shown"> <input type="password" placeholder="Placeholder text" class="placeholder-shown"> <input type="password" placeholder="Placeholder text" value="Foobar"> </div> <div> <input type="search"> - <input type="search" placeholder> + <input type="search" placeholder class="placeholder-shown"> <input type="search" placeholder="Placeholder text" class="placeholder-shown"> <input type="search" placeholder="Placeholder text" value="Foobar"> </div> @@ -100,7 +100,7 @@ </div> <div> <input type="number"> - <input type="number" placeholder> + <input type="number" placeholder class="placeholder-shown"> <input type="number" placeholder="Placeholder text" class="placeholder-shown"> <input type="number" placeholder="Placeholder text" value="0"> </div>
diff --git a/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt b/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt index 4693c16..700f639 100644 --- a/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt +++ b/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt
@@ -53,6 +53,7 @@ PASS window.cached_navigator_connection.type is window.navigator.connection.type PASS window.cached_navigator_devicePosture.onchange is null PASS window.cached_navigator_devicePosture.type is window.navigator.devicePosture.type +PASS window.cached_navigator_gpu_wgslLanguageFeatures.size is 0 PASS window.cached_navigator_hid.onconnect is null PASS window.cached_navigator_hid.ondisconnect is null PASS window.cached_navigator_managed.onmanagedconfigurationchange is null
diff --git a/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt b/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt index c4e5c8b5..06dbc27 100644 --- a/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt +++ b/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt
@@ -53,6 +53,7 @@ PASS window.cached_navigator_connection.type is window.navigator.connection.type PASS window.cached_navigator_devicePosture.onchange is null PASS window.cached_navigator_devicePosture.type is window.navigator.devicePosture.type +PASS window.cached_navigator_gpu_wgslLanguageFeatures.size is 0 PASS window.cached_navigator_hid.onconnect is null PASS window.cached_navigator_hid.ondisconnect is null PASS window.cached_navigator_managed.onmanagedconfigurationchange is null
diff --git a/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt b/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt index 8c612f77..1c23b08 100644 --- a/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt +++ b/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt
@@ -53,6 +53,7 @@ PASS window.cached_navigator_connection.type is window.navigator.connection.type PASS window.cached_navigator_devicePosture.onchange is null PASS window.cached_navigator_devicePosture.type is window.navigator.devicePosture.type +PASS window.cached_navigator_gpu_wgslLanguageFeatures.size is 0 PASS window.cached_navigator_hid.onconnect is null PASS window.cached_navigator_hid.ondisconnect is null PASS window.cached_navigator_managed.onmanagedconfigurationchange is null
diff --git a/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt b/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt index c0bf242..583ae6ee 100644 --- a/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt +++ b/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt
@@ -51,6 +51,7 @@ PASS oldChildWindow.navigator.devicePosture.onchange is newChildWindow.navigator.devicePosture.onchange PASS oldChildWindow.navigator.devicePosture.type is newChildWindow.navigator.devicePosture.type PASS oldChildWindow.navigator.doNotTrack is newChildWindow.navigator.doNotTrack +PASS oldChildWindow.navigator.gpu.wgslLanguageFeatures.size is newChildWindow.navigator.gpu.wgslLanguageFeatures.size PASS oldChildWindow.navigator.hardwareConcurrency is newChildWindow.navigator.hardwareConcurrency PASS oldChildWindow.navigator.hid.onconnect is newChildWindow.navigator.hid.onconnect PASS oldChildWindow.navigator.hid.ondisconnect is newChildWindow.navigator.hid.ondisconnect
diff --git a/third_party/blink/web_tests/fast/forms/placeholder-stripped-expected.txt b/third_party/blink/web_tests/fast/forms/placeholder-stripped-expected.txt index f574e234..4b67c94 100644 --- a/third_party/blink/web_tests/fast/forms/placeholder-stripped-expected.txt +++ b/third_party/blink/web_tests/fast/forms/placeholder-stripped-expected.txt
@@ -5,8 +5,8 @@ PASS internals.visiblePlaceholder(input0) is "first line second line" PASS internals.visiblePlaceholder(input1) is "" PASS internals.visiblePlaceholder(textarea0) is "first line \nsecond line" -PASS internals.visiblePlaceholder(textarea1) is "" -PASS internals.visiblePlaceholder(textarea2) is "" +PASS internals.visiblePlaceholder(textarea1) is "\n" +PASS internals.visiblePlaceholder(textarea2) is "\n" PASS successfullyParsed is true TEST COMPLETE
diff --git a/third_party/blink/web_tests/fast/forms/placeholder-stripped.html b/third_party/blink/web_tests/fast/forms/placeholder-stripped.html index b250676..291da4aa 100644 --- a/third_party/blink/web_tests/fast/forms/placeholder-stripped.html +++ b/third_party/blink/web_tests/fast/forms/placeholder-stripped.html
@@ -21,8 +21,8 @@ shouldBeEqualToString('internals.visiblePlaceholder(input0)', 'first line second line'); shouldBeEqualToString('internals.visiblePlaceholder(input1)', ''); shouldBeEqualToString('internals.visiblePlaceholder(textarea0)', 'first line \nsecond line'); - shouldBeEqualToString('internals.visiblePlaceholder(textarea1)', ''); - shouldBeEqualToString('internals.visiblePlaceholder(textarea2)', ''); + shouldBeEqualToString('internals.visiblePlaceholder(textarea1)', '\n'); + shouldBeEqualToString('internals.visiblePlaceholder(textarea2)', '\n'); document.body.removeChild(document.getElementById('container')); } else {
diff --git a/third_party/blink/web_tests/fast/selectors/placeholder-shown-style-update.html b/third_party/blink/web_tests/fast/selectors/placeholder-shown-style-update.html index 9284c32f..4fed50f 100644 --- a/third_party/blink/web_tests/fast/selectors/placeholder-shown-style-update.html +++ b/third_party/blink/web_tests/fast/selectors/placeholder-shown-style-update.html
@@ -64,7 +64,7 @@ textareaCaseWithoutRenderer.appendChild(document.createTextNode("Foobar")); testBackgroundColor(false); debug("Removing the placeholder, we should not match."); -setAttribute("placeholder", ""); +document.querySelectorAll('input, textarea').forEach(element => element.removeAttribute('placeholder')); testBackgroundColor(false); debug("Removing the value. We should still not match since the placeholder attribute was removed."); inputCaseWithRenderer.value = "";
diff --git a/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-input-basics-expected.txt b/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-input-basics-expected.txt index 5b72e82..8f17ee5 100644 --- a/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-input-basics-expected.txt +++ b/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-input-basics-expected.txt
@@ -2,37 +2,37 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -PASS document.querySelectorAll(":placeholder-shown").length is 3 +PASS document.querySelectorAll(":placeholder-shown").length is 7 PASS document.querySelectorAll(":placeholder-shown")[0] is document.getElementById("valid-placeholder") PASS document.querySelectorAll(":placeholder-shown")[1] is document.getElementById("valid-placeholder-with-empty-value") PASS document.querySelectorAll(":placeholder-shown")[2] is document.getElementById("valid-placeholder-with-empty-value2") +PASS document.querySelectorAll(":placeholder-shown")[3] is document.getElementById("empty-placeholder") +PASS document.querySelectorAll(":placeholder-shown")[4] is document.getElementById("empty-placeholder2") +PASS document.querySelectorAll(":placeholder-shown")[5] is document.getElementById("placeholder-contains-only-newline") +PASS document.querySelectorAll(":placeholder-shown")[6] is document.getElementById("placeholder-contains-only-carriageReturn") PASS getComputedStyle(document.getElementById("no-placeholder")).backgroundColor is "rgb(255, 255, 255)" -PASS getComputedStyle(document.getElementById("empty-placeholder")).backgroundColor is "rgb(255, 255, 255)" -PASS getComputedStyle(document.getElementById("empty-placeholder2")).backgroundColor is "rgb(255, 255, 255)" -PASS getComputedStyle(document.getElementById("placeholder-contains-only-newline")).backgroundColor is "rgb(255, 255, 255)" -PASS getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).backgroundColor is "rgb(255, 255, 255)" PASS getComputedStyle(document.getElementById("with-value")).backgroundColor is "rgb(255, 255, 255)" PASS getComputedStyle(document.getElementById("valid-placeholder")).backgroundColor is "rgb(1, 2, 3)" PASS getComputedStyle(document.getElementById("valid-placeholder-with-empty-value")).backgroundColor is "rgb(1, 2, 3)" PASS getComputedStyle(document.getElementById("valid-placeholder-with-empty-value2")).backgroundColor is "rgb(1, 2, 3)" +PASS getComputedStyle(document.getElementById("empty-placeholder")).backgroundColor is "rgb(1, 2, 3)" +PASS getComputedStyle(document.getElementById("empty-placeholder2")).backgroundColor is "rgb(1, 2, 3)" +PASS getComputedStyle(document.getElementById("placeholder-contains-only-newline")).backgroundColor is "rgb(1, 2, 3)" +PASS getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).backgroundColor is "rgb(1, 2, 3)" -PASS document.querySelectorAll("input:not(:placeholder-shown)").length is 6 +PASS document.querySelectorAll("input:not(:placeholder-shown)").length is 2 PASS document.querySelectorAll("input:not(:placeholder-shown)")[0] is document.getElementById("no-placeholder") -PASS document.querySelectorAll("input:not(:placeholder-shown)")[1] is document.getElementById("empty-placeholder") -PASS document.querySelectorAll("input:not(:placeholder-shown)")[2] is document.getElementById("empty-placeholder2") -PASS document.querySelectorAll("input:not(:placeholder-shown)")[3] is document.getElementById("placeholder-contains-only-newline") -PASS document.querySelectorAll("input:not(:placeholder-shown)")[4] is document.getElementById("placeholder-contains-only-carriageReturn") -PASS document.querySelectorAll("input:not(:placeholder-shown)")[5] is document.getElementById("with-value") +PASS document.querySelectorAll("input:not(:placeholder-shown)")[1] is document.getElementById("with-value") PASS getComputedStyle(document.getElementById("no-placeholder")).color is "rgb(4, 5, 6)" -PASS getComputedStyle(document.getElementById("empty-placeholder")).color is "rgb(4, 5, 6)" -PASS getComputedStyle(document.getElementById("empty-placeholder2")).color is "rgb(4, 5, 6)" -PASS getComputedStyle(document.getElementById("placeholder-contains-only-newline")).color is "rgb(4, 5, 6)" -PASS getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).color is "rgb(4, 5, 6)" PASS getComputedStyle(document.getElementById("with-value")).color is "rgb(4, 5, 6)" PASS getComputedStyle(document.getElementById("valid-placeholder")).color is "rgb(0, 0, 0)" PASS getComputedStyle(document.getElementById("valid-placeholder-with-empty-value")).color is "rgb(0, 0, 0)" PASS getComputedStyle(document.getElementById("valid-placeholder-with-empty-value2")).color is "rgb(0, 0, 0)" +PASS getComputedStyle(document.getElementById("empty-placeholder")).color is "rgb(0, 0, 0)" +PASS getComputedStyle(document.getElementById("empty-placeholder2")).color is "rgb(0, 0, 0)" +PASS getComputedStyle(document.getElementById("placeholder-contains-only-newline")).color is "rgb(0, 0, 0)" +PASS getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).color is "rgb(0, 0, 0)" PASS successfullyParsed is true TEST COMPLETE
diff --git a/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-input-basics.html b/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-input-basics.html index c9d9b94..dd4ed74 100644 --- a/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-input-basics.html +++ b/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-input-basics.html
@@ -15,51 +15,49 @@ <div style="display:none"> <!-- Does not match: no placeholder defined. --> <input type="text" id="no-placeholder"> - <!-- Does not match: empty placeholder. --> - <input type="text" id="empty-placeholder" placeholder> - <input type="text" id="empty-placeholder2" placeholder=""> - <!-- Does not match: placeholder contains only newline or carriage return characters. --> - <input type="text" id="placeholder-contains-only-newline"> - <input type="text" id="placeholder-contains-only-carriageReturn"> <!-- Does not match: the placeholder is not shown when a value is set --> <input type="text" id="with-value" placeholder="WebKit" value="FooBar"> <!-- Valid cases --> <input type="text" id="valid-placeholder" placeholder="WebKit"> <input type="text" id="valid-placeholder-with-empty-value" placeholder="WebKit" value> <input type="text" id="valid-placeholder-with-empty-value2" placeholder="WebKit" value=""> + <input type="text" id="empty-placeholder" placeholder> + <input type="text" id="empty-placeholder2" placeholder=""> + <input type="text" id="placeholder-contains-only-newline"> + <input type="text" id="placeholder-contains-only-carriageReturn"> </div> <script> description('Check the basic features of the ":placeholder-shown" pseudo class with the <input> element.'); document.getElementById('placeholder-contains-only-newline').setAttribute('placeholder', '\n'); document.getElementById('placeholder-contains-only-carriageReturn').setAttribute('placeholder', '\r'); -shouldBe('document.querySelectorAll(":placeholder-shown").length', '3'); +shouldBe('document.querySelectorAll(":placeholder-shown").length', '7'); shouldBe('document.querySelectorAll(":placeholder-shown")[0]', 'document.getElementById("valid-placeholder")'); shouldBe('document.querySelectorAll(":placeholder-shown")[1]', 'document.getElementById("valid-placeholder-with-empty-value")'); shouldBe('document.querySelectorAll(":placeholder-shown")[2]', 'document.getElementById("valid-placeholder-with-empty-value2")'); +shouldBe('document.querySelectorAll(":placeholder-shown")[3]', 'document.getElementById("empty-placeholder")'); +shouldBe('document.querySelectorAll(":placeholder-shown")[4]', 'document.getElementById("empty-placeholder2")'); +shouldBe('document.querySelectorAll(":placeholder-shown")[5]', 'document.getElementById("placeholder-contains-only-newline")'); +shouldBe('document.querySelectorAll(":placeholder-shown")[6]', 'document.getElementById("placeholder-contains-only-carriageReturn")'); shouldBeEqualToString('getComputedStyle(document.getElementById("no-placeholder")).backgroundColor', 'rgb(255, 255, 255)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder")).backgroundColor', 'rgb(255, 255, 255)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder2")).backgroundColor', 'rgb(255, 255, 255)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-newline")).backgroundColor', 'rgb(255, 255, 255)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).backgroundColor', 'rgb(255, 255, 255)'); shouldBeEqualToString('getComputedStyle(document.getElementById("with-value")).backgroundColor', 'rgb(255, 255, 255)'); shouldBeEqualToString('getComputedStyle(document.getElementById("valid-placeholder")).backgroundColor', 'rgb(1, 2, 3)'); shouldBeEqualToString('getComputedStyle(document.getElementById("valid-placeholder-with-empty-value")).backgroundColor', 'rgb(1, 2, 3)'); shouldBeEqualToString('getComputedStyle(document.getElementById("valid-placeholder-with-empty-value2")).backgroundColor', 'rgb(1, 2, 3)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder")).backgroundColor', 'rgb(1, 2, 3)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder2")).backgroundColor', 'rgb(1, 2, 3)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-newline")).backgroundColor', 'rgb(1, 2, 3)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).backgroundColor', 'rgb(1, 2, 3)'); debug(""); -shouldBe('document.querySelectorAll("input:not(:placeholder-shown)").length', '6'); +shouldBe('document.querySelectorAll("input:not(:placeholder-shown)").length', '2'); shouldBe('document.querySelectorAll("input:not(:placeholder-shown)")[0]', 'document.getElementById("no-placeholder")'); -shouldBe('document.querySelectorAll("input:not(:placeholder-shown)")[1]', 'document.getElementById("empty-placeholder")'); -shouldBe('document.querySelectorAll("input:not(:placeholder-shown)")[2]', 'document.getElementById("empty-placeholder2")'); -shouldBe('document.querySelectorAll("input:not(:placeholder-shown)")[3]', 'document.getElementById("placeholder-contains-only-newline")'); -shouldBe('document.querySelectorAll("input:not(:placeholder-shown)")[4]', 'document.getElementById("placeholder-contains-only-carriageReturn")'); -shouldBe('document.querySelectorAll("input:not(:placeholder-shown)")[5]', 'document.getElementById("with-value")'); +shouldBe('document.querySelectorAll("input:not(:placeholder-shown)")[1]', 'document.getElementById("with-value")'); shouldBeEqualToString('getComputedStyle(document.getElementById("no-placeholder")).color', 'rgb(4, 5, 6)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder")).color', 'rgb(4, 5, 6)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder2")).color', 'rgb(4, 5, 6)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-newline")).color', 'rgb(4, 5, 6)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).color', 'rgb(4, 5, 6)'); shouldBeEqualToString('getComputedStyle(document.getElementById("with-value")).color', 'rgb(4, 5, 6)'); shouldBeEqualToString('getComputedStyle(document.getElementById("valid-placeholder")).color', 'rgb(0, 0, 0)'); shouldBeEqualToString('getComputedStyle(document.getElementById("valid-placeholder-with-empty-value")).color', 'rgb(0, 0, 0)'); shouldBeEqualToString('getComputedStyle(document.getElementById("valid-placeholder-with-empty-value2")).color', 'rgb(0, 0, 0)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder")).color', 'rgb(0, 0, 0)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder2")).color', 'rgb(0, 0, 0)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-newline")).color', 'rgb(0, 0, 0)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).color', 'rgb(0, 0, 0)'); </script>
diff --git a/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-textarea-basics-expected.txt b/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-textarea-basics-expected.txt index a8d1da5..7f97a87a 100644 --- a/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-textarea-basics-expected.txt +++ b/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-textarea-basics-expected.txt
@@ -2,16 +2,20 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -PASS document.querySelectorAll(":placeholder-shown").length is 4 +PASS document.querySelectorAll(":placeholder-shown").length is 8 PASS document.querySelectorAll(":placeholder-shown")[0] is document.getElementById("valid-placeholder") -PASS document.querySelectorAll(":placeholder-shown")[1] is document.getElementById("valid-placeholder-with-value-attribute") -PASS document.querySelectorAll(":placeholder-shown")[2] is document.getElementById("valid-placeholder-with-value-attribute2") -PASS document.querySelectorAll(":placeholder-shown")[3] is document.getElementById("valid-placeholder-with-value-attribute3") +PASS document.querySelectorAll(":placeholder-shown")[1] is document.getElementById("empty-placeholder") +PASS document.querySelectorAll(":placeholder-shown")[2] is document.getElementById("empty-placeholder2") +PASS document.querySelectorAll(":placeholder-shown")[3] is document.getElementById("placeholder-contains-only-newline") +PASS document.querySelectorAll(":placeholder-shown")[4] is document.getElementById("placeholder-contains-only-carriageReturn") +PASS document.querySelectorAll(":placeholder-shown")[5] is document.getElementById("valid-placeholder-with-value-attribute") +PASS document.querySelectorAll(":placeholder-shown")[6] is document.getElementById("valid-placeholder-with-value-attribute2") +PASS document.querySelectorAll(":placeholder-shown")[7] is document.getElementById("valid-placeholder-with-value-attribute3") PASS getComputedStyle(document.getElementById("no-placeholder")).backgroundColor is "rgb(255, 255, 255)" -PASS getComputedStyle(document.getElementById("empty-placeholder")).backgroundColor is "rgb(255, 255, 255)" -PASS getComputedStyle(document.getElementById("empty-placeholder2")).backgroundColor is "rgb(255, 255, 255)" -PASS getComputedStyle(document.getElementById("placeholder-contains-only-newline")).backgroundColor is "rgb(255, 255, 255)" -PASS getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).backgroundColor is "rgb(255, 255, 255)" +PASS getComputedStyle(document.getElementById("empty-placeholder")).backgroundColor is "rgb(1, 2, 3)" +PASS getComputedStyle(document.getElementById("empty-placeholder2")).backgroundColor is "rgb(1, 2, 3)" +PASS getComputedStyle(document.getElementById("placeholder-contains-only-newline")).backgroundColor is "rgb(1, 2, 3)" +PASS getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).backgroundColor is "rgb(1, 2, 3)" PASS getComputedStyle(document.getElementById("with-value")).backgroundColor is "rgb(255, 255, 255)" PASS getComputedStyle(document.getElementById("valid-placeholder")).backgroundColor is "rgb(1, 2, 3)" PASS getComputedStyle(document.getElementById("valid-placeholder-with-value-attribute")).backgroundColor is "rgb(1, 2, 3)" @@ -19,18 +23,14 @@ PASS getComputedStyle(document.getElementById("valid-placeholder-with-value-attribute3")).backgroundColor is "rgb(1, 2, 3)" -PASS document.querySelectorAll("textarea:not(:placeholder-shown)").length is 6 +PASS document.querySelectorAll("textarea:not(:placeholder-shown)").length is 2 PASS document.querySelectorAll("textarea:not(:placeholder-shown)")[0] is document.getElementById("no-placeholder") -PASS document.querySelectorAll("textarea:not(:placeholder-shown)")[1] is document.getElementById("empty-placeholder") -PASS document.querySelectorAll("textarea:not(:placeholder-shown)")[2] is document.getElementById("empty-placeholder2") -PASS document.querySelectorAll("textarea:not(:placeholder-shown)")[3] is document.getElementById("placeholder-contains-only-newline") -PASS document.querySelectorAll("textarea:not(:placeholder-shown)")[4] is document.getElementById("placeholder-contains-only-carriageReturn") -PASS document.querySelectorAll("textarea:not(:placeholder-shown)")[5] is document.getElementById("with-value") +PASS document.querySelectorAll("textarea:not(:placeholder-shown)")[1] is document.getElementById("with-value") PASS getComputedStyle(document.getElementById("no-placeholder")).color is "rgb(4, 5, 6)" -PASS getComputedStyle(document.getElementById("empty-placeholder")).color is "rgb(4, 5, 6)" -PASS getComputedStyle(document.getElementById("empty-placeholder2")).color is "rgb(4, 5, 6)" -PASS getComputedStyle(document.getElementById("placeholder-contains-only-newline")).color is "rgb(4, 5, 6)" -PASS getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).color is "rgb(4, 5, 6)" +PASS getComputedStyle(document.getElementById("empty-placeholder")).color is "rgb(0, 0, 0)" +PASS getComputedStyle(document.getElementById("empty-placeholder2")).color is "rgb(0, 0, 0)" +PASS getComputedStyle(document.getElementById("placeholder-contains-only-newline")).color is "rgb(0, 0, 0)" +PASS getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).color is "rgb(0, 0, 0)" PASS getComputedStyle(document.getElementById("with-value")).color is "rgb(4, 5, 6)" PASS getComputedStyle(document.getElementById("valid-placeholder")).color is "rgb(0, 0, 0)" PASS getComputedStyle(document.getElementById("valid-placeholder-with-value-attribute")).color is "rgb(0, 0, 0)"
diff --git a/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-textarea-basics.html b/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-textarea-basics.html index c5d71392..71d5548 100644 --- a/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-textarea-basics.html +++ b/third_party/blink/web_tests/fast/selectors/placeholder-shown-with-textarea-basics.html
@@ -15,16 +15,14 @@ <div style="display:none"> <!-- Does not match: no placeholder defined. --> <textarea id="no-placeholder"></textarea> - <!-- Does not match: empty placeholder. --> - <textarea id="empty-placeholder" placeholder></textarea> - <textarea id="empty-placeholder2" placeholder=""></textarea> - <!-- Does not match: placeholder contains only newline or carriage return characters. --> - <textarea id="placeholder-contains-only-newline"></textarea> - <textarea id="placeholder-contains-only-carriageReturn"></textarea> <!-- Does not match: the placeholder is not shown when a value is set --> <textarea id="with-value" placeholder="WebKit">FooBar</textarea> <!-- Valid cases --> <textarea id="valid-placeholder" placeholder="WebKit"></textarea> + <textarea id="empty-placeholder" placeholder></textarea> + <textarea id="empty-placeholder2" placeholder=""></textarea> + <textarea id="placeholder-contains-only-newline"></textarea> + <textarea id="placeholder-contains-only-carriageReturn"></textarea> <!-- Value does not do anything on <textarea>, the content is the innerText --> <textarea id="valid-placeholder-with-value-attribute" placeholder="WebKit" value></textarea> <textarea id="valid-placeholder-with-value-attribute2" placeholder="WebKit" value=""></textarea> @@ -34,34 +32,34 @@ description('Check the basic features of the ":placeholder-shown" pseudo class with the <textarea> element.'); document.getElementById('placeholder-contains-only-newline').setAttribute('placeholder', '\n'); document.getElementById('placeholder-contains-only-carriageReturn').setAttribute('placeholder', '\r'); -shouldBe('document.querySelectorAll(":placeholder-shown").length', '4'); +shouldBe('document.querySelectorAll(":placeholder-shown").length', '8'); shouldBe('document.querySelectorAll(":placeholder-shown")[0]', 'document.getElementById("valid-placeholder")'); -shouldBe('document.querySelectorAll(":placeholder-shown")[1]', 'document.getElementById("valid-placeholder-with-value-attribute")'); -shouldBe('document.querySelectorAll(":placeholder-shown")[2]', 'document.getElementById("valid-placeholder-with-value-attribute2")'); -shouldBe('document.querySelectorAll(":placeholder-shown")[3]', 'document.getElementById("valid-placeholder-with-value-attribute3")'); +shouldBe('document.querySelectorAll(":placeholder-shown")[1]', 'document.getElementById("empty-placeholder")'); +shouldBe('document.querySelectorAll(":placeholder-shown")[2]', 'document.getElementById("empty-placeholder2")'); +shouldBe('document.querySelectorAll(":placeholder-shown")[3]', 'document.getElementById("placeholder-contains-only-newline")'); +shouldBe('document.querySelectorAll(":placeholder-shown")[4]', 'document.getElementById("placeholder-contains-only-carriageReturn")'); +shouldBe('document.querySelectorAll(":placeholder-shown")[5]', 'document.getElementById("valid-placeholder-with-value-attribute")'); +shouldBe('document.querySelectorAll(":placeholder-shown")[6]', 'document.getElementById("valid-placeholder-with-value-attribute2")'); +shouldBe('document.querySelectorAll(":placeholder-shown")[7]', 'document.getElementById("valid-placeholder-with-value-attribute3")'); shouldBeEqualToString('getComputedStyle(document.getElementById("no-placeholder")).backgroundColor', 'rgb(255, 255, 255)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder")).backgroundColor', 'rgb(255, 255, 255)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder2")).backgroundColor', 'rgb(255, 255, 255)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-newline")).backgroundColor', 'rgb(255, 255, 255)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).backgroundColor', 'rgb(255, 255, 255)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder")).backgroundColor', 'rgb(1, 2, 3)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder2")).backgroundColor', 'rgb(1, 2, 3)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-newline")).backgroundColor', 'rgb(1, 2, 3)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).backgroundColor', 'rgb(1, 2, 3)'); shouldBeEqualToString('getComputedStyle(document.getElementById("with-value")).backgroundColor', 'rgb(255, 255, 255)'); shouldBeEqualToString('getComputedStyle(document.getElementById("valid-placeholder")).backgroundColor', 'rgb(1, 2, 3)'); shouldBeEqualToString('getComputedStyle(document.getElementById("valid-placeholder-with-value-attribute")).backgroundColor', 'rgb(1, 2, 3)'); shouldBeEqualToString('getComputedStyle(document.getElementById("valid-placeholder-with-value-attribute2")).backgroundColor', 'rgb(1, 2, 3)'); shouldBeEqualToString('getComputedStyle(document.getElementById("valid-placeholder-with-value-attribute3")).backgroundColor', 'rgb(1, 2, 3)'); debug(""); -shouldBe('document.querySelectorAll("textarea:not(:placeholder-shown)").length', '6'); +shouldBe('document.querySelectorAll("textarea:not(:placeholder-shown)").length', '2'); shouldBe('document.querySelectorAll("textarea:not(:placeholder-shown)")[0]', 'document.getElementById("no-placeholder")'); -shouldBe('document.querySelectorAll("textarea:not(:placeholder-shown)")[1]', 'document.getElementById("empty-placeholder")'); -shouldBe('document.querySelectorAll("textarea:not(:placeholder-shown)")[2]', 'document.getElementById("empty-placeholder2")'); -shouldBe('document.querySelectorAll("textarea:not(:placeholder-shown)")[3]', 'document.getElementById("placeholder-contains-only-newline")'); -shouldBe('document.querySelectorAll("textarea:not(:placeholder-shown)")[4]', 'document.getElementById("placeholder-contains-only-carriageReturn")'); -shouldBe('document.querySelectorAll("textarea:not(:placeholder-shown)")[5]', 'document.getElementById("with-value")'); +shouldBe('document.querySelectorAll("textarea:not(:placeholder-shown)")[1]', 'document.getElementById("with-value")'); shouldBeEqualToString('getComputedStyle(document.getElementById("no-placeholder")).color', 'rgb(4, 5, 6)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder")).color', 'rgb(4, 5, 6)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder2")).color', 'rgb(4, 5, 6)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-newline")).color', 'rgb(4, 5, 6)'); -shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).color', 'rgb(4, 5, 6)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder")).color', 'rgb(0, 0, 0)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("empty-placeholder2")).color', 'rgb(0, 0, 0)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-newline")).color', 'rgb(0, 0, 0)'); +shouldBeEqualToString('getComputedStyle(document.getElementById("placeholder-contains-only-carriageReturn")).color', 'rgb(0, 0, 0)'); shouldBeEqualToString('getComputedStyle(document.getElementById("with-value")).color', 'rgb(4, 5, 6)'); shouldBeEqualToString('getComputedStyle(document.getElementById("valid-placeholder")).color', 'rgb(0, 0, 0)'); shouldBeEqualToString('getComputedStyle(document.getElementById("valid-placeholder-with-value-attribute")).color', 'rgb(0, 0, 0)');
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/textarea/basic-textareas-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/textarea/basic-textareas-expected.png index 5b0eee2..e44e08f 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/textarea/basic-textareas-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/textarea/basic-textareas-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/textarea/basic-textareas-quirks-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/textarea/basic-textareas-quirks-expected.png index 70354a7..7f4e916 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/textarea/basic-textareas-quirks-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/textarea/basic-textareas-quirks-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/basic-textareas-quirks-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/basic-textareas-quirks-expected.png index b30001f..b41be8d 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/basic-textareas-quirks-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/basic-textareas-quirks-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/external/wpt/webnn/idlharness.https.any-expected.txt b/third_party/blink/web_tests/platform/mac/external/wpt/webnn/idlharness.https.any-expected.txt index 2b13842..97c2898 100644 --- a/third_party/blink/web_tests/platform/mac/external/wpt/webnn/idlharness.https.any-expected.txt +++ b/third_party/blink/web_tests/platform/mac/external/wpt/webnn/idlharness.https.any-expected.txt
@@ -245,7 +245,7 @@ PASS MLGraphBuilder interface: operation reshape(MLOperand, sequence<unsigned long?>) PASS MLGraphBuilder interface: operation sigmoid(MLOperand) PASS MLGraphBuilder interface: operation sigmoid() -FAIL MLGraphBuilder interface: operation slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions) assert_own_property: interface prototype object missing non-static operation expected property "slice" missing +FAIL MLGraphBuilder interface: operation slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>) assert_own_property: interface prototype object missing non-static operation expected property "slice" missing FAIL MLGraphBuilder interface: operation softmax(MLOperand) assert_equals: property has wrong .length expected 0 but got 1 FAIL MLGraphBuilder interface: operation softmax() assert_equals: property has wrong .length expected 0 but got 1 FAIL MLGraphBuilder interface: operation softplus(MLOperand, optional MLSoftplusOptions) assert_own_property: interface prototype object missing non-static operation expected property "softplus" missing @@ -385,8 +385,8 @@ PASS MLGraphBuilder interface: builder must inherit property "sigmoid(MLOperand)" with the proper type PASS MLGraphBuilder interface: calling sigmoid(MLOperand) on builder with too few arguments must throw TypeError PASS MLGraphBuilder interface: builder must inherit property "sigmoid()" with the proper type -FAIL MLGraphBuilder interface: builder must inherit property "slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions)" with the proper type assert_inherits: property "slice" not found in prototype chain -FAIL MLGraphBuilder interface: calling slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions) on builder with too few arguments must throw TypeError assert_inherits: property "slice" not found in prototype chain +FAIL MLGraphBuilder interface: builder must inherit property "slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>)" with the proper type assert_inherits: property "slice" not found in prototype chain +FAIL MLGraphBuilder interface: calling slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>) on builder with too few arguments must throw TypeError assert_inherits: property "slice" not found in prototype chain PASS MLGraphBuilder interface: builder must inherit property "softmax(MLOperand)" with the proper type PASS MLGraphBuilder interface: calling softmax(MLOperand) on builder with too few arguments must throw TypeError PASS MLGraphBuilder interface: builder must inherit property "softmax()" with the proper type
diff --git a/third_party/blink/web_tests/platform/mac/external/wpt/webnn/idlharness.https.any.worker-expected.txt b/third_party/blink/web_tests/platform/mac/external/wpt/webnn/idlharness.https.any.worker-expected.txt index f4bd625..b080058 100644 --- a/third_party/blink/web_tests/platform/mac/external/wpt/webnn/idlharness.https.any.worker-expected.txt +++ b/third_party/blink/web_tests/platform/mac/external/wpt/webnn/idlharness.https.any.worker-expected.txt
@@ -250,7 +250,7 @@ PASS MLGraphBuilder interface: operation reshape(MLOperand, sequence<unsigned long?>) PASS MLGraphBuilder interface: operation sigmoid(MLOperand) PASS MLGraphBuilder interface: operation sigmoid() -FAIL MLGraphBuilder interface: operation slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions) assert_own_property: interface prototype object missing non-static operation expected property "slice" missing +FAIL MLGraphBuilder interface: operation slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>) assert_own_property: interface prototype object missing non-static operation expected property "slice" missing FAIL MLGraphBuilder interface: operation softmax(MLOperand) assert_equals: property has wrong .length expected 0 but got 1 FAIL MLGraphBuilder interface: operation softmax() assert_equals: property has wrong .length expected 0 but got 1 FAIL MLGraphBuilder interface: operation softplus(MLOperand, optional MLSoftplusOptions) assert_own_property: interface prototype object missing non-static operation expected property "softplus" missing @@ -391,8 +391,8 @@ PASS MLGraphBuilder interface: builder must inherit property "sigmoid(MLOperand)" with the proper type PASS MLGraphBuilder interface: calling sigmoid(MLOperand) on builder with too few arguments must throw TypeError PASS MLGraphBuilder interface: builder must inherit property "sigmoid()" with the proper type -FAIL MLGraphBuilder interface: builder must inherit property "slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions)" with the proper type assert_inherits: property "slice" not found in prototype chain -FAIL MLGraphBuilder interface: calling slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions) on builder with too few arguments must throw TypeError assert_inherits: property "slice" not found in prototype chain +FAIL MLGraphBuilder interface: builder must inherit property "slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>)" with the proper type assert_inherits: property "slice" not found in prototype chain +FAIL MLGraphBuilder interface: calling slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>) on builder with too few arguments must throw TypeError assert_inherits: property "slice" not found in prototype chain PASS MLGraphBuilder interface: builder must inherit property "softmax(MLOperand)" with the proper type PASS MLGraphBuilder interface: calling softmax(MLOperand) on builder with too few arguments must throw TypeError PASS MLGraphBuilder interface: builder must inherit property "softmax()" with the proper type
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-expected.png index 2a69a107f..67d38c9 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-quirks-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-quirks-expected.png index 66d466a..2bbe8cb 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-quirks-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-quirks-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/external/wpt/webnn/idlharness.https.any-expected.txt b/third_party/blink/web_tests/platform/win/external/wpt/webnn/idlharness.https.any-expected.txt index 76a85be..cb3c93b 100644 --- a/third_party/blink/web_tests/platform/win/external/wpt/webnn/idlharness.https.any-expected.txt +++ b/third_party/blink/web_tests/platform/win/external/wpt/webnn/idlharness.https.any-expected.txt
@@ -245,7 +245,7 @@ PASS MLGraphBuilder interface: operation reshape(MLOperand, sequence<unsigned long?>) PASS MLGraphBuilder interface: operation sigmoid(MLOperand) PASS MLGraphBuilder interface: operation sigmoid() -FAIL MLGraphBuilder interface: operation slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions) assert_own_property: interface prototype object missing non-static operation expected property "slice" missing +FAIL MLGraphBuilder interface: operation slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>) assert_own_property: interface prototype object missing non-static operation expected property "slice" missing FAIL MLGraphBuilder interface: operation softmax(MLOperand) assert_equals: property has wrong .length expected 0 but got 1 FAIL MLGraphBuilder interface: operation softmax() assert_equals: property has wrong .length expected 0 but got 1 FAIL MLGraphBuilder interface: operation softplus(MLOperand, optional MLSoftplusOptions) assert_own_property: interface prototype object missing non-static operation expected property "softplus" missing @@ -385,8 +385,8 @@ PASS MLGraphBuilder interface: builder must inherit property "sigmoid(MLOperand)" with the proper type PASS MLGraphBuilder interface: calling sigmoid(MLOperand) on builder with too few arguments must throw TypeError PASS MLGraphBuilder interface: builder must inherit property "sigmoid()" with the proper type -FAIL MLGraphBuilder interface: builder must inherit property "slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions)" with the proper type assert_inherits: property "slice" not found in prototype chain -FAIL MLGraphBuilder interface: calling slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions) on builder with too few arguments must throw TypeError assert_inherits: property "slice" not found in prototype chain +FAIL MLGraphBuilder interface: builder must inherit property "slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>)" with the proper type assert_inherits: property "slice" not found in prototype chain +FAIL MLGraphBuilder interface: calling slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>) on builder with too few arguments must throw TypeError assert_inherits: property "slice" not found in prototype chain PASS MLGraphBuilder interface: builder must inherit property "softmax(MLOperand)" with the proper type PASS MLGraphBuilder interface: calling softmax(MLOperand) on builder with too few arguments must throw TypeError PASS MLGraphBuilder interface: builder must inherit property "softmax()" with the proper type
diff --git a/third_party/blink/web_tests/platform/win/external/wpt/webnn/idlharness.https.any.worker-expected.txt b/third_party/blink/web_tests/platform/win/external/wpt/webnn/idlharness.https.any.worker-expected.txt index ac45e6c..523abe88 100644 --- a/third_party/blink/web_tests/platform/win/external/wpt/webnn/idlharness.https.any.worker-expected.txt +++ b/third_party/blink/web_tests/platform/win/external/wpt/webnn/idlharness.https.any.worker-expected.txt
@@ -250,7 +250,7 @@ PASS MLGraphBuilder interface: operation reshape(MLOperand, sequence<unsigned long?>) PASS MLGraphBuilder interface: operation sigmoid(MLOperand) PASS MLGraphBuilder interface: operation sigmoid() -FAIL MLGraphBuilder interface: operation slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions) assert_own_property: interface prototype object missing non-static operation expected property "slice" missing +FAIL MLGraphBuilder interface: operation slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>) assert_own_property: interface prototype object missing non-static operation expected property "slice" missing FAIL MLGraphBuilder interface: operation softmax(MLOperand) assert_equals: property has wrong .length expected 0 but got 1 FAIL MLGraphBuilder interface: operation softmax() assert_equals: property has wrong .length expected 0 but got 1 FAIL MLGraphBuilder interface: operation softplus(MLOperand, optional MLSoftplusOptions) assert_own_property: interface prototype object missing non-static operation expected property "softplus" missing @@ -391,8 +391,8 @@ PASS MLGraphBuilder interface: builder must inherit property "sigmoid(MLOperand)" with the proper type PASS MLGraphBuilder interface: calling sigmoid(MLOperand) on builder with too few arguments must throw TypeError PASS MLGraphBuilder interface: builder must inherit property "sigmoid()" with the proper type -FAIL MLGraphBuilder interface: builder must inherit property "slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions)" with the proper type assert_inherits: property "slice" not found in prototype chain -FAIL MLGraphBuilder interface: calling slice(MLOperand, sequence<long>, sequence<long>, optional MLSliceOptions) on builder with too few arguments must throw TypeError assert_inherits: property "slice" not found in prototype chain +FAIL MLGraphBuilder interface: builder must inherit property "slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>)" with the proper type assert_inherits: property "slice" not found in prototype chain +FAIL MLGraphBuilder interface: calling slice(MLOperand, sequence<unsigned long>, sequence<unsigned long>) on builder with too few arguments must throw TypeError assert_inherits: property "slice" not found in prototype chain PASS MLGraphBuilder interface: builder must inherit property "softmax(MLOperand)" with the proper type PASS MLGraphBuilder interface: calling softmax(MLOperand) on builder with too few arguments must throw TypeError PASS MLGraphBuilder interface: builder must inherit property "softmax()" with the proper type
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/textarea/basic-textareas-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/textarea/basic-textareas-expected.png index 23e3ef49..ccbe6db 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/textarea/basic-textareas-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/textarea/basic-textareas-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/textarea/basic-textareas-quirks-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/textarea/basic-textareas-quirks-expected.png index da85864..8d9c0bb 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/textarea/basic-textareas-quirks-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/textarea/basic-textareas-quirks-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt b/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt index ec9bb213..f1797ae 100644 --- a/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt +++ b/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt
@@ -45,6 +45,7 @@ PASS window.cached_navigator_connection.onchange is null PASS window.cached_navigator_connection.rtt is window.navigator.connection.rtt PASS window.cached_navigator_connection.saveData is false +PASS window.cached_navigator_gpu_wgslLanguageFeatures.size is 0 PASS window.cached_navigator_hid.onconnect is null PASS window.cached_navigator_hid.ondisconnect is null PASS window.cached_navigator_managed.onmanagedconfigurationchange is null
diff --git a/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt b/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt index 4a147b07..5640ed06 100644 --- a/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt +++ b/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt
@@ -45,6 +45,7 @@ PASS window.cached_navigator_connection.onchange is null PASS window.cached_navigator_connection.rtt is window.navigator.connection.rtt PASS window.cached_navigator_connection.saveData is false +PASS window.cached_navigator_gpu_wgslLanguageFeatures.size is 0 PASS window.cached_navigator_hid.onconnect is null PASS window.cached_navigator_hid.ondisconnect is null PASS window.cached_navigator_managed.onmanagedconfigurationchange is null
diff --git a/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt b/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt index 9c68cc8..4420f6d 100644 --- a/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt +++ b/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt
@@ -45,6 +45,7 @@ PASS window.cached_navigator_connection.onchange is null PASS window.cached_navigator_connection.rtt is window.navigator.connection.rtt PASS window.cached_navigator_connection.saveData is false +PASS window.cached_navigator_gpu_wgslLanguageFeatures.size is 0 PASS window.cached_navigator_hid.onconnect is null PASS window.cached_navigator_hid.ondisconnect is null PASS window.cached_navigator_managed.onmanagedconfigurationchange is null
diff --git a/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt b/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt index 8150bf6..720e123 100644 --- a/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt +++ b/third_party/blink/web_tests/virtual/stable/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt
@@ -42,6 +42,7 @@ PASS oldChildWindow.navigator.cookieEnabled is newChildWindow.navigator.cookieEnabled PASS oldChildWindow.navigator.deviceMemory is newChildWindow.navigator.deviceMemory PASS oldChildWindow.navigator.doNotTrack is newChildWindow.navigator.doNotTrack +PASS oldChildWindow.navigator.gpu.wgslLanguageFeatures.size is newChildWindow.navigator.gpu.wgslLanguageFeatures.size PASS oldChildWindow.navigator.hardwareConcurrency is newChildWindow.navigator.hardwareConcurrency PASS oldChildWindow.navigator.hid.onconnect is newChildWindow.navigator.hid.onconnect PASS oldChildWindow.navigator.hid.ondisconnect is newChildWindow.navigator.hid.ondisconnect
diff --git a/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt index f7a6b48..e274727 100644 --- a/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -597,6 +597,7 @@ [Worker] method values [Worker] interface GPU [Worker] attribute @@toStringTag +[Worker] getter wgslLanguageFeatures [Worker] method constructor [Worker] method getPreferredCanvasFormat [Worker] method requestAdapter @@ -2039,6 +2040,16 @@ [Worker] method close [Worker] method constructor [Worker] method copyTo +[Worker] interface WGSLLanguageFeatures +[Worker] attribute @@toStringTag +[Worker] getter size +[Worker] method @@iterator +[Worker] method constructor +[Worker] method entries +[Worker] method forEach +[Worker] method has +[Worker] method keys +[Worker] method values [Worker] interface WebGL2RenderingContext [Worker] attribute @@toStringTag [Worker] attribute ACTIVE_ATTRIBUTES
diff --git a/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt index 93abaca1..dc22d11 100644 --- a/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt +++ b/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -2363,6 +2363,7 @@ method constructor interface GPU attribute @@toStringTag + getter wgslLanguageFeatures method constructor method getPreferredCanvasFormat method requestAdapter @@ -8940,6 +8941,16 @@ method constructor setter onresize setter onscroll +interface WGSLLanguageFeatures + attribute @@toStringTag + getter size + method @@iterator + method constructor + method entries + method forEach + method has + method keys + method values interface WakeLock attribute @@toStringTag method constructor
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt index 503e5f62..5188d0b 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -613,6 +613,7 @@ [Worker] method values [Worker] interface GPU [Worker] attribute @@toStringTag +[Worker] getter wgslLanguageFeatures [Worker] method constructor [Worker] method getPreferredCanvasFormat [Worker] method requestAdapter @@ -2241,6 +2242,16 @@ [Worker] method close [Worker] method constructor [Worker] method copyTo +[Worker] interface WGSLLanguageFeatures +[Worker] attribute @@toStringTag +[Worker] getter size +[Worker] method @@iterator +[Worker] method constructor +[Worker] method entries +[Worker] method forEach +[Worker] method has +[Worker] method keys +[Worker] method values [Worker] interface WakeLock [Worker] attribute @@toStringTag [Worker] method constructor
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt index 5e5f0c4..2d1032b 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt
@@ -2834,6 +2834,7 @@ method createSelectorDirective interface GPU attribute @@toStringTag + getter wgslLanguageFeatures method constructor method getPreferredCanvasFormat method requestAdapter @@ -9940,6 +9941,16 @@ method constructor setter onresize setter onscroll +interface WGSLLanguageFeatures + attribute @@toStringTag + getter size + method @@iterator + method constructor + method entries + method forEach + method has + method keys + method values interface WakeLock attribute @@toStringTag method constructor
diff --git a/third_party/blink/web_tests/wpt_internal/webstorage/general-storage-deprecation-trial-third-party-enabled-local.sub.https.html.ini b/third_party/blink/web_tests/wpt_internal/webstorage/general-storage-deprecation-trial-third-party-enabled-local.sub.https.html.ini new file mode 100644 index 0000000..a923923 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/webstorage/general-storage-deprecation-trial-third-party-enabled-local.sub.https.html.ini
@@ -0,0 +1,4 @@ +[general-storage-deprecation-trial-third-party-enabled-local.sub.https.html] + [Test for Local Storage with DisableThirdPartySessionStoragePartitioning enabled in cross-origin iframe] + expected: + if product == "chrome": FAIL
diff --git a/third_party/blink/web_tests/wpt_internal/webstorage/general-storage-deprecation-trial-third-party-enabled-session.sub.https.html.ini b/third_party/blink/web_tests/wpt_internal/webstorage/general-storage-deprecation-trial-third-party-enabled-session.sub.https.html.ini new file mode 100644 index 0000000..de0a3f8c --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/webstorage/general-storage-deprecation-trial-third-party-enabled-session.sub.https.html.ini
@@ -0,0 +1,4 @@ +[general-storage-deprecation-trial-third-party-enabled-session.sub.https.html] + [Test for Session Storage with DisableThirdPartySessionStoragePartitioning enabled in cross-origin iframe] + expected: + if product == "chrome": FAIL
diff --git a/third_party/ruy/BUILD.gn b/third_party/ruy/BUILD.gn index be324dd..5ac4003 100644 --- a/third_party/ruy/BUILD.gn +++ b/third_party/ruy/BUILD.gn
@@ -35,29 +35,23 @@ # eating the binary size for everybody. # Analogous to cmake's |ruy_8_mavx2_mfma_arch_AVX2|. +# Note: No MSVC style flags are used since it is not supported by Chrome. config("ruy_avx2_flags") { if (current_cpu == "x86_64" || current_cpu == "x64" || current_cpu == "amd64") { - if (is_win) { - cflags = [ "/arch:AVX2" ] - } else { - cflags = [ - "-mavx2", - "-mfma", - ] - } + cflags = [ + "-mavx2", + "-mfma", + ] } } # Analogous to cmake's |ruy_9_mavx_arch_AVX|. +# Note: No MSVC style flags are used since it is not supported by Chrome. config("ruy_avx_flags") { if (current_cpu == "x86_64" || current_cpu == "x64" || current_cpu == "amd64") { - if (is_win) { - cflags = [ "/arch:AVX" ] - } else { - cflags = [ "-mavx" ] - } + cflags = [ "-mavx" ] } }
diff --git a/tools/bisect-builds.py b/tools/bisect-builds.py index 8c5840e..91de703 100755 --- a/tools/bisect-builds.py +++ b/tools/bisect-builds.py
@@ -158,10 +158,14 @@ # below where these are patched. self.archive_name = 'chrome-win32.zip' self._archive_extract_dir = 'chrome-win32' - elif self.platform == 'android': + elif self.platform in ('android', 'android64'): self._binary_name = 'apks/ChromePublic.apk' self.archive_name = 'chrome-android.zip' self._archive_extract_dir = 'chrome-android' + elif self.platform in ('webview', 'webview64'): + self._binary_name = 'apks/SystemWebView.apk' + self.archive_name = 'chrome-android.zip' + self._archive_extract_dir = 'chrome-android' else: raise Exception('Invalid platform: %s' % self.platform) @@ -188,8 +192,10 @@ self._listing_platform_dir = 'Win/' elif self.platform == 'win64': self._listing_platform_dir = 'Win_x64/' - elif self.platform == 'android': + elif self.platform in ('android', 'webview'): self._listing_platform_dir = 'Android/' + elif self.platform in ('android64', 'webview64'): + self._listing_platform_dir = 'Android_Arm64/' def GetASANPlatformDir(self): """ASAN builds are in directories like "linux-release", or have filenames @@ -674,11 +680,15 @@ runcommand = [] # Ideally we'd use third_party/catapult for the adb command, but testers need # the script to be more portable without the chromium repo. - if context.platform == 'android': + if 'android' in context.platform: runcommand = ('adb install -d -r {} &&' ' adb shell am start -a {} -p {}'.format( os.path.abspath(context.GetLaunchPath(revision)), _ANDROID_CHROME_INTENT, _ANDROID_CHROME_PACKAGE)) + elif 'webview' in context.platform: + # Doesn't start an intent as testers use different apps for testing. + runcommand = 'adb install -d -r {}'.format( + os.path.abspath(context.GetLaunchPath(revision))) else: for token in shlex.split(command): if token == '%a': @@ -691,8 +701,10 @@ result = None try: for _ in range(num_runs): + use_shell = ('android' in context.platform + or 'webview' in context.platform) subproc = subprocess.Popen(runcommand, - shell=context.platform == 'android', + shell=use_shell, bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -1228,6 +1240,9 @@ 'linux-arm', 'chromeos', 'android', + 'android64', + 'webview', + 'webview64', ] parser.add_option('-a', '--archive', choices=choices,
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 1bd8ed9..9d3b1b9 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -14833,6 +14833,19 @@ <int value="8" label="DisabledOnError"/> </enum> +<enum name="CdmKeyStatusMix"> + <int value="0" label="kAllUsable"/> + <int value="1" label="kAllInternalError"/> + <int value="2" label="kAllExpired"/> + <int value="3" label="kAllOutputRestricted"/> + <int value="4" label="kAllOutputDownscaled"/> + <int value="5" label="kAllKeyStatusPending"/> + <int value="6" label="kAllReleased"/> + <int value="7" label="kEmpty"/> + <int value="8" label="kMixedWithUsable"/> + <int value="9" label="kMixedWithoutUsable"/> +</enum> + <enum name="CdmLoadResult"> <int value="0" label="Success"/> <int value="1" label="CDM file missing"/> @@ -29935,6 +29948,14 @@ <int value="3" label="Challenge Response Sent"/> </enum> +<enum name="DTAttestationPolicyLevel"> + <int value="0" label="No policy enabled for the inline flow"/> + <int value="1" label="Unknown policy for the Inline flow"/> + <int value="2" label="Inline flow for browser"/> + <int value="3" label="Inline flow for user"/> + <int value="4" label="Inline flow for user and browser"/> +</enum> + <enum name="DTAttestationResult"> <int value="0" label="Missing Core Signals"/> <int value="1" label="Missing Signing Key"/> @@ -32787,6 +32808,10 @@ <int value="1102" label="ReportAppInventory"/> <int value="1103" label="ReportAppUsage"/> <int value="1104" label="ReportAppUsageCollectionRateMs"/> + <int value="1105" label="BrowserContextAwareAccessSignalsAllowlist"/> + <int value="1106" label="UserContextAwareAccessSignalsAllowlist"/> + <int value="1107" label="GoogleSearchSidePanelEnabled"/> + <int value="1108" label="PdfUseSkiaRendererEnabled"/> </enum> <enum name="EnterprisePoliciesSources"> @@ -77260,6 +77285,18 @@ (Added in M80, Previously, this was combined with "No hint available for page load".) </int> + <int value="11" label="Hint was being fetched but was not registered"> + A fetch to get the hint for the page load from the remote Optimization Guide + Service was started, but requested optimization type was not registered. + (Added in M115, Previously, this was combined with "No hint available + for page load".) + </int> + <int value="12" label="Hint requested for an invalid URL"> + A fetch to get the hint for the page load from the remote Optimization Guide + Service was started, but requested URL was invalid. (Added in M115, + Previously, this was combined with "No hint available for page + load".) + </int> </enum> <enum name="OptimizationGuidePageContentAnnotationsStorageStatus"> @@ -77848,6 +77885,7 @@ <int value="1117" label="Privacy: Microphone Software Switch"/> <int value="1118" label="Privacy: Geolocation Software Switch"/> <int value="1119" label="Privacy: Lock Screen Notification Switch"/> + <int value="1120" label="Privacy: Speak-on-mute Detection Software Switch"/> <int value="1200" label="Add Language"/> <int value="1201" label="Show Input Options In Shelf"/> <int value="1202" label="Show Personal Information Suggestions (Deprecated)"/> @@ -82197,6 +82235,7 @@ <int value="401" label="kDarkModeSchedule"/> <int value="402" label="kDarkModeTurnOff"/> <int value="403" label="kDarkModeTurnOn"/> + <int value="404" label="kDynamicColor"/> </enum> <enum name="PersonalizationThemeColorMode">
diff --git a/tools/metrics/histograms/metadata/custom_tabs/histograms.xml b/tools/metrics/histograms/metadata/custom_tabs/histograms.xml index ae7835b..461a90b 100644 --- a/tools/metrics/histograms/metadata/custom_tabs/histograms.xml +++ b/tools/metrics/histograms/metadata/custom_tabs/histograms.xml
@@ -495,7 +495,7 @@ <histogram name="CustomTabs.RetainableSessionsV2.TimeBetweenLaunch{IdentifierType}" - units="seconds" expires_after="2023-06-12"> + units="seconds" expires_after="2023-10-22"> <owner>wenyufu@chromium.org</owner> <owner>chrome-connective-tissue@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/enterprise/histograms.xml b/tools/metrics/histograms/metadata/enterprise/histograms.xml index b64d455..c2adbd9 100644 --- a/tools/metrics/histograms/metadata/enterprise/histograms.xml +++ b/tools/metrics/histograms/metadata/enterprise/histograms.xml
@@ -907,6 +907,18 @@ </summary> </histogram> +<histogram name="Enterprise.DeviceTrust.Inline.Attestation.PolicyLevel" + enum="DTAttestationPolicyLevel" expires_after="2024-05-11"> + <owner>hmare@google.com</owner> + <owner>cbe-device-trust-eng@google.com</owner> + <summary> + Policy levels enabled for the Device Trust connector during the DTC inline + flow process. The inline flow can occur during a user navigation, and the + policy level determines the content of the attestation services' challenge + response. + </summary> +</histogram> + <histogram name="Enterprise.DeviceTrust.Key.TrustLevel" enum="DTKeyTrustLevel" expires_after="2023-12-01"> <owner>hmare@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/media/histograms.xml b/tools/metrics/histograms/metadata/media/histograms.xml index db99c62..a0870c6 100644 --- a/tools/metrics/histograms/metadata/media/histograms.xml +++ b/tools/metrics/histograms/metadata/media/histograms.xml
@@ -2763,6 +2763,17 @@ <token key="KeySystem" variants="KeySystemWithRobustness"/> </histogram> +<histogram name="Media.EME.{KeySystem}.InitialKeyStatusMix" + enum="CdmKeyStatusMix" expires_after="2024-04-11"> + <owner>xhwang@chromium.org</owner> + <owner>media-dev@chromium.org</owner> + <summary> + Reports a summary of key statuses associated with an EME CDM session. + Reported once per EME CDM session on the first key statuses update. + </summary> + <token key="KeySystem" variants="KeySystemWithRobustness"/> +</histogram> + <histogram name="Media.EME.{KeySystem}.KeyStatusSystemCode" enum="CdmSystemCode" expires_after="2024-04-11"> <owner>xhwang@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/tab/histograms.xml b/tools/metrics/histograms/metadata/tab/histograms.xml index 1edb1ee..2653b92 100644 --- a/tools/metrics/histograms/metadata/tab/histograms.xml +++ b/tools/metrics/histograms/metadata/tab/histograms.xml
@@ -2269,7 +2269,7 @@ </summary> </histogram> -<histogram name="Tabs.TabState.SaveTime" units="ms" expires_after="2023-06-18"> +<histogram name="Tabs.TabState.SaveTime" units="ms" expires_after="2024-05-14"> <owner>yusufo@chromium.org</owner> <owner>nyquist@chromium.org</owner> <owner>dtrainor@chromium.org</owner>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 981496d0..a1bd229 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -5,16 +5,16 @@ "full_remote_path": "perfetto-luci-artifacts/v34.0/linux-arm64/trace_processor_shell" }, "win": { - "hash": "a6ef59f506e789a2a8f4e3ff8367e24ad48be433", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/d9d0730f824491aeae712e41d43cf348272eb55e/trace_processor_shell.exe" + "hash": "6f192d5407895245d9a416144264a8668c5671e4", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/287c9bfb7d7107806ee430453f2e8db09fe9ed8a/trace_processor_shell.exe" }, "linux_arm": { "hash": "336a42cb9ec3c417e13a97816271fec10cdf67e5", "full_remote_path": "perfetto-luci-artifacts/v34.0/linux-arm/trace_processor_shell" }, "mac": { - "hash": "3553f5a4f72c25a9adeecd00e3c821fefa6bd9bd", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/d9d0730f824491aeae712e41d43cf348272eb55e/trace_processor_shell" + "hash": "469a62b9403ec3c275e9568fa85673ccb841d043", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/287c9bfb7d7107806ee430453f2e8db09fe9ed8a/trace_processor_shell" }, "mac_arm64": { "hash": "c32364e05e22cdf82ee0866aedd11c0e2050809c", @@ -22,7 +22,7 @@ }, "linux": { "hash": "ab9efa3edd117f26568756e670183fdfb87141b2", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/22a5641b28a7f061f700ea1c486e634943569f72/trace_processor_shell" + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/287c9bfb7d7107806ee430453f2e8db09fe9ed8a/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/ui/android/java/res/values/color_palette.xml b/ui/android/java/res/values/color_palette.xml index df7da0c..2de2a05 100644 --- a/ui/android/java/res/values/color_palette.xml +++ b/ui/android/java/res/values/color_palette.xml
@@ -8,21 +8,21 @@ <!-- 2021 color palette. --> <color name="baseline_error_200">#F2B8B5</color> <color name="baseline_error_600">#B3261E</color> - <color name="baseline_primary_0">@android:color/white</color> - <color name="baseline_primary_100">#D3E3FD</color> - <color name="baseline_primary_200">#A8C7FA</color> - <color name="baseline_primary_50">#ECF3FE</color> - <color name="baseline_primary_200_alpha_10" tools:ignore="UnusedResources">#19A8C7FA</color> - <color name="baseline_primary_200_alpha_20">#33A8C7FA</color> - <color name="baseline_primary_200_alpha_50">#80A8C7FA</color> - <color name="baseline_primary_600">#0B57D0</color> - <color name="baseline_primary_600_alpha_6">#0F0B57D0</color> - <color name="baseline_primary_600_alpha_10">#190B57D0</color> - <color name="baseline_primary_600_alpha_12">#1F0B57D0</color> - <color name="baseline_primary_600_alpha_65" tools:ignore="UnusedResources">#6A0B57D0</color> - <color name="baseline_primary_700">#0842A0</color> - <color name="baseline_primary_800">#062E6F</color> - <color name="baseline_primary_900">#041E49</color> + <color name="baseline_primary_100">@android:color/white</color> + <color name="baseline_primary_95">#ECF3FE</color> + <color name="baseline_primary_90">#D3E3FD</color> + <color name="baseline_primary_80">#A8C7FA</color> + <color name="baseline_primary_80_alpha_10" tools:ignore="UnusedResources">#19A8C7FA</color> + <color name="baseline_primary_80_alpha_20">#33A8C7FA</color> + <color name="baseline_primary_80_alpha_50">#80A8C7FA</color> + <color name="baseline_primary_40">#0B57D0</color> + <color name="baseline_primary_40_alpha_6">#0F0B57D0</color> + <color name="baseline_primary_40_alpha_10">#190B57D0</color> + <color name="baseline_primary_40_alpha_12">#1F0B57D0</color> + <color name="baseline_primary_40_alpha_65" tools:ignore="UnusedResources">#6A0B57D0</color> + <color name="baseline_primary_30">#0842A0</color> + <color name="baseline_primary_20">#062E6F</color> + <color name="baseline_primary_10">#041E49</color> <color name="baseline_neutral_0">@android:color/white</color> <color name="baseline_neutral_0_with_neutral_600_alpha_5_with_primary_600_2" tools:ignore="UnusedResources">#F2F4F6</color> <color name="baseline_neutral_0_with_neutral_600_alpha_8_with_primary_600_2" tools:ignore="UnusedResources">#EDEFF1</color> @@ -100,16 +100,16 @@ <!-- Remapped to 2021 color palette. Do not add new references to these. --> <color name="modern_white">@color/baseline_neutral_0</color> <!-- Correct for most places to use 200 instead of 300 now. --> - <color name="modern_blue_300">@color/baseline_primary_200</color> - <color name="modern_blue_300_alpha_10" tools:ignore="UnusedResources">@color/baseline_primary_200_alpha_10</color> - <color name="modern_blue_300_alpha_50">@color/baseline_primary_200_alpha_50</color> - <color name="modern_blue_600">@color/baseline_primary_600</color> - <color name="modern_blue_600_alpha_6">@color/baseline_primary_600_alpha_6</color> - <color name="modern_blue_600_alpha_10">@color/baseline_primary_600_alpha_10</color> - <color name="modern_blue_600_alpha_12">@color/baseline_primary_600_alpha_12</color> - <color name="modern_blue_600_alpha_65" tools:ignore="UnusedResources">@color/baseline_primary_600_alpha_65</color> - <color name="modern_blue_700">@color/baseline_primary_700</color> - <color name="modern_blue_800" tools:ignore="UnusedResources">@color/baseline_primary_800</color> + <color name="modern_blue_300">@color/baseline_primary_80</color> + <color name="modern_blue_300_alpha_10" tools:ignore="UnusedResources">@color/baseline_primary_80_alpha_10</color> + <color name="modern_blue_300_alpha_50">@color/baseline_primary_80_alpha_50</color> + <color name="modern_blue_600">@color/baseline_primary_40</color> + <color name="modern_blue_600_alpha_6">@color/baseline_primary_40_alpha_6</color> + <color name="modern_blue_600_alpha_10">@color/baseline_primary_40_alpha_10</color> + <color name="modern_blue_600_alpha_12">@color/baseline_primary_40_alpha_12</color> + <color name="modern_blue_600_alpha_65" tools:ignore="UnusedResources">@color/baseline_primary_40_alpha_65</color> + <color name="modern_blue_700">@color/baseline_primary_30</color> + <color name="modern_blue_800" tools:ignore="UnusedResources">@color/baseline_primary_20</color> <color name="google_green_300">@color/baseline_tertiary_200</color> <color name="google_green_600">@color/baseline_tertiary_600</color> @@ -160,10 +160,10 @@ <color name="google_blue_50" tools:ignore="UnusedResources">#E3F2FD</color> <!-- GM3 dynamic colors that point to the baseline palette for below Android S.--> - <color name="material_primary_50">@color/baseline_primary_50</color> - <color name="material_primary_100">@color/baseline_primary_100</color> - <color name="material_primary_200">@color/baseline_primary_200</color> - <color name="material_primary_600">@color/baseline_primary_600</color> - <color name="material_primary_800">@color/baseline_primary_800</color> - <color name="material_primary_900">@color/baseline_primary_900</color> + <color name="material_primary_95">@color/baseline_primary_95</color> + <color name="material_primary_90">@color/baseline_primary_90</color> + <color name="material_primary_80">@color/baseline_primary_80</color> + <color name="material_primary_40">@color/baseline_primary_40</color> + <color name="material_primary_20">@color/baseline_primary_20</color> + <color name="material_primary_10">@color/baseline_primary_10</color> </resources>
diff --git a/ui/android/java/res/values/semantic_colors_non_adaptive.xml b/ui/android/java/res/values/semantic_colors_non_adaptive.xml index 41656c1..6a721027 100644 --- a/ui/android/java/res/values/semantic_colors_non_adaptive.xml +++ b/ui/android/java/res/values/semantic_colors_non_adaptive.xml
@@ -14,8 +14,8 @@ <color name="default_icon_color_secondary_dark">@color/baseline_neutral_variant_700</color> <color name="default_icon_color_secondary_light">@color/baseline_neutral_variant_200</color> <!-- Same as ?attr/colorPrimary. --> - <color name="default_icon_color_blue_dark">@color/baseline_primary_600</color> - <color name="default_icon_color_blue_light">@color/baseline_primary_200</color> + <color name="default_icon_color_blue_dark">@color/baseline_primary_40</color> + <color name="default_icon_color_blue_light">@color/baseline_primary_80</color> <!-- Same as ?attr/colorOnSurface. --> <color name="default_icon_color_disabled_dark">@color/baseline_neutral_900_alpha_38</color> <color name="default_icon_color_disabled_light">@color/baseline_neutral_100_alpha_38</color> @@ -23,8 +23,8 @@ <color name="default_icon_color_inverse_light">@color/baseline_neutral_50</color> <color name="default_icon_color_inverse_dark">@color/baseline_neutral_800</color> <!-- Same as ?attr/colorOnPrimary. --> - <color name="default_icon_color_on_accent1_light">@color/baseline_neutral_0</color> - <color name="default_icon_color_on_accent1_dark">@color/baseline_primary_800</color> + <color name="default_icon_color_on_accent1_light">@color/baseline_primary_100</color> + <color name="default_icon_color_on_accent1_dark">@color/baseline_primary_20</color> <!-- Common text colors --> <!-- Same as ?attr/colorOnSurface. --> @@ -37,10 +37,10 @@ <color name="default_text_color_disabled_light">@color/baseline_neutral_100_alpha_38</color> <color name="default_text_color_disabled_dark">@color/baseline_neutral_900_alpha_38</color> <!-- Same as ?attr/colorPrimary. --> - <color name="default_text_color_blue_dark">@color/baseline_primary_600</color> - <color name="default_text_color_blue_light">@color/baseline_primary_200</color> - <color name="default_text_color_link_dark">@color/baseline_primary_600</color> - <color name="default_text_color_link_light">@color/baseline_primary_200</color> + <color name="default_text_color_blue_dark">@color/baseline_primary_40</color> + <color name="default_text_color_blue_light">@color/baseline_primary_80</color> + <color name="default_text_color_link_dark">@color/baseline_primary_40</color> + <color name="default_text_color_link_light">@color/baseline_primary_80</color> <!-- Same as ?attr/colorError. --> <color name="default_text_color_error_light">@color/baseline_error_200</color> <color name="default_text_color_error_dark">@color/baseline_error_600</color> @@ -48,8 +48,8 @@ <color name="default_text_color_link_disabled_light">@color/baseline_neutral_100_alpha_38</color> <color name="default_text_color_link_disabled_dark">@color/baseline_neutral_900_alpha_38</color> <!-- Same as ?attr/colorOnPrimary. --> - <color name="default_text_color_on_accent1_light">@color/baseline_neutral_0</color> - <color name="default_text_color_on_accent1_dark">@color/baseline_primary_800</color> + <color name="default_text_color_on_accent1_light">@color/baseline_primary_100</color> + <color name="default_text_color_on_accent1_dark">@color/baseline_primary_20</color> <!-- Same as ?attr/colorError. --> <color name="default_red_light">@color/baseline_error_200</color> @@ -107,8 +107,8 @@ <!-- Colors used for Widgets (checkboxes, switches, buttons, etc)--> <!-- Same as ?attr/colorPrimary. --> - <color name="default_control_color_active_light" tools:ignore="UnusedResources">@color/baseline_primary_600</color> - <color name="default_control_color_active_dark" tools:ignore="UnusedResources">@color/baseline_primary_200</color> + <color name="default_control_color_active_light" tools:ignore="UnusedResources">@color/baseline_primary_40</color> + <color name="default_control_color_active_dark" tools:ignore="UnusedResources">@color/baseline_primary_80</color> <!-- Same as ?attr/colorOnSurfaceVariant. --> <color name="default_control_color_normal_light" tools:ignore="UnusedResources">@color/baseline_neutral_variant_700</color> <color name="default_control_color_normal_dark" tools:ignore="UnusedResources">@color/baseline_neutral_variant_200</color> @@ -119,7 +119,7 @@ <!-- Filled Button --> <color name="filled_button_bg_color_dark">@color/modern_blue_600</color> - <color name="filled_button_bg_color_light">@color/baseline_primary_200</color> + <color name="filled_button_bg_color_light">@color/baseline_primary_80</color> <color name="filled_button_bg_color_disabled_dark">@color/baseline_neutral_900_alpha_12</color> <color name="filled_button_bg_color_disabled_light">@color/baseline_neutral_100_alpha_12</color>
diff --git a/ui/chromeos/strings/network/network_element_localized_strings_provider.cc b/ui/chromeos/strings/network/network_element_localized_strings_provider.cc index cb1ef37d..0172d0d 100644 --- a/ui/chromeos/strings/network/network_element_localized_strings_provider.cc +++ b/ui/chromeos/strings/network/network_element_localized_strings_provider.cc
@@ -331,6 +331,8 @@ IDS_SETTINGS_APN_DESCRIPTION_WITH_LEARN_MORE_LINK}, {"apnSettingsZeroStateDescription", IDS_SETTINGS_APN_ZERO_STATE_DESCRIPTION}, + {"apnSettingsDatabaseApnsErrorMessage", + IDS_SETTINGS_APN_DATABASE_APNS_ERROR_MESSAGE}, {"apnSettingsCustomApnsErrorMessage", IDS_SETTINGS_APN_CUSTOM_APNS_ERROR_MESSAGE}, {"apnMenuDetails", IDS_SETTINGS_APN_MENU_DETAILS},
diff --git a/ui/color/dynamic_color/palette_factory.cc b/ui/color/dynamic_color/palette_factory.cc index 7ff6ccb..cca9802 100644 --- a/ui/color/dynamic_color/palette_factory.cc +++ b/ui/color/dynamic_color/palette_factory.cc
@@ -42,6 +42,24 @@ it->second); } +// Returns the chroma value from `hues_to_chroma` given a `source_hue`. If the +// `source_hue` is out of range, the first entry in `hues_to_chroma` is +// returned. +double GetAdjustedChroma( + double source_hue, + const base::flat_map<double, double>& hues_to_chromas) { + CHECK_GE(source_hue, -0.0); + CHECK_LE(source_hue, 360.0); + CHECK(!hues_to_chromas.empty()); + + auto iter = hues_to_chromas.lower_bound(source_hue); + if (iter == hues_to_chromas.end()) { + return hues_to_chromas.begin()->second; + } + + return iter->second; +} + class CustomPalette : public Palette { public: CustomPalette(TonalPalette&& primary, @@ -89,10 +107,14 @@ : hue_rotation(hue_rotation), chroma(chroma), hues_to_rotations(hues_to_rotations) {} + explicit Transform(base::flat_map<double, double> hues_to_chroma) + : hues_to_chroma(hues_to_chroma) {} double hue_rotation = 0.0; double chroma = 0.0; - absl::optional<base::flat_map<double, double>> hues_to_rotations; + absl::optional<base::flat_map<double, double>> hues_to_rotations = + absl::nullopt; + absl::optional<base::flat_map<double, double>> hues_to_chroma = absl::nullopt; }; Transform Chroma(double chroma) { @@ -113,13 +135,18 @@ // Returns a `TonalPalette` constructed from `hue` transformed by `transform`. TonalPalette MakePalette(double hue, const Transform& transform) { + CHECK_LE(hue, 360.0); + double chroma = transform.chroma; + if (transform.hues_to_chroma) { + chroma = GetAdjustedChroma(hue, *transform.hues_to_chroma); + } if (transform.hues_to_rotations) { hue = GetRotatedHue(hue, *transform.hues_to_rotations); } else { hue = material_color_utilities::SanitizeDegreesDouble( hue + transform.hue_rotation); } - return TonalPalette(hue, transform.chroma); + return TonalPalette(hue, chroma); } std::unique_ptr<Palette> FromConfig(SkColor seed_color, const Config& config) { @@ -175,10 +202,15 @@ Chroma(12.0)}; break; } - case SchemeVariant::kNeutral: - config = {Chroma(12.0), Chroma(8.0), Chroma(16.0), Chroma(2.0), - Chroma(2.0)}; + case SchemeVariant::kNeutral: { + const auto hues = std::to_array<double>({0, 260, 315, 360}); + const auto chromas = std::to_array<double>({12.0, 12.0, 20.0, 12.0}); + const base::flat_map<double, double> chroma_transforms = + Zip(hues, chromas); + config = {Transform(std::move(chroma_transforms)), Chroma(8.0), + Chroma(16.0), Chroma(2.0), Chroma(2.0)}; break; + } case SchemeVariant::kExpressive: { const auto hues = std::to_array<double>({0, 21, 51, 121, 151, 191, 271, 321, 360}); @@ -191,7 +223,7 @@ std::to_array<double>({120, 120, 20, 45, 20, 15, 20, 120, 120}); const base::flat_map<double, double> tertiary_hues_to_rotations = Zip(hues, tertiary_rotations); - config = {Transform(120.0, 40.0), + config = {Transform(-90, 40.0), Transform(0.0, 24.0, secondary_hues_to_rotations), Transform(0.0, 32.0, tertiary_hues_to_rotations), Chroma(8.0), Chroma(12.0)};
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index c652c0d..e52e5b74 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc
@@ -347,6 +347,9 @@ display_private_->SetDisplayColorMatrix( gfx::SkM44ToTransform(display_color_matrix_)); display_private_->SetOutputIsSecure(output_is_secure_); +#if BUILDFLAG(IS_MAC) + display_private_->SetVSyncDisplayID(display_id_); +#endif if (has_vsync_params_) { display_private_->SetDisplayVSyncParameters(vsync_timebase_, vsync_interval_);
diff --git a/ui/compositor/recyclable_compositor_mac.cc b/ui/compositor/recyclable_compositor_mac.cc index 0e30e781..0c57b17 100644 --- a/ui/compositor/recyclable_compositor_mac.cc +++ b/ui/compositor/recyclable_compositor_mac.cc
@@ -12,6 +12,7 @@ #include "ui/compositor/compositor.h" #include "ui/compositor/compositor_observer.h" #include "ui/compositor/compositor_switches.h" +#include "ui/display/types/display_constants.h" namespace ui { @@ -65,7 +66,8 @@ void RecyclableCompositorMac::UpdateSurface( const gfx::Size& size_pixels, float scale_factor, - const gfx::DisplayColorSpaces& display_color_spaces) { + const gfx::DisplayColorSpaces& display_color_spaces, + int64_t display_id) { if (size_pixels != size_pixels_ || scale_factor != scale_factor_) { size_pixels_ = size_pixels; scale_factor_ = scale_factor; @@ -75,21 +77,19 @@ compositor()->SetScaleAndSize(scale_factor_, size_pixels_, local_surface_id); } - if (display_color_spaces != display_color_spaces_) { - display_color_spaces_ = display_color_spaces; - compositor()->SetDisplayColorSpaces(display_color_spaces_); - } + compositor()->SetDisplayColorSpaces(display_color_spaces); + compositor()->SetVSyncDisplayID(display_id); } void RecyclableCompositorMac::InvalidateSurface() { size_pixels_ = gfx::Size(); scale_factor_ = 1.f; local_surface_id_allocator_.Invalidate(); - display_color_spaces_ = gfx::DisplayColorSpaces(); compositor()->SetScaleAndSize( scale_factor_, size_pixels_, local_surface_id_allocator_.GetCurrentLocalSurfaceId()); compositor()->SetDisplayColorSpaces(gfx::DisplayColorSpaces()); + compositor()->SetVSyncDisplayID(display::kInvalidDisplayId); } void RecyclableCompositorMac::OnCompositingDidCommit(
diff --git a/ui/compositor/recyclable_compositor_mac.h b/ui/compositor/recyclable_compositor_mac.h index 891204a..778842be 100644 --- a/ui/compositor/recyclable_compositor_mac.h +++ b/ui/compositor/recyclable_compositor_mac.h
@@ -49,7 +49,8 @@ // Update the compositor's surface information, if needed. void UpdateSurface(const gfx::Size& size_pixels, float scale_factor, - const gfx::DisplayColorSpaces& display_color_spaces); + const gfx::DisplayColorSpaces& display_color_spaces, + int64_t display_id); private: // Invalidate the compositor's surface information. @@ -63,7 +64,6 @@ viz::ParentLocalSurfaceIdAllocator local_surface_id_allocator_; gfx::Size size_pixels_; float scale_factor_ = 1.f; - gfx::DisplayColorSpaces display_color_spaces_; std::unique_ptr<ui::AcceleratedWidgetMac> accelerated_widget_mac_; ui::Compositor compositor_;
diff --git a/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc b/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc index 46ee692..b7fce20 100644 --- a/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc +++ b/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc
@@ -142,7 +142,6 @@ Evdev* evdev, EventStateRec* evstate) { DCHECK(evdev->info.is_monotonic) << "libevdev must use monotonic timestamps"; - VLOG(9) << "HACK DO NOT REMOVE OR LINK WILL FAIL" << (void*)gestures_log; // Set device pointer and initialize properties. evdev_ = evdev;
diff --git a/ui/events/ozone/evdev/libgestures_glue/gesture_logging.h b/ui/events/ozone/evdev/libgestures_glue/gesture_logging.h index c20a8f0..98bb84c 100644 --- a/ui/events/ozone/evdev/libgestures_glue/gesture_logging.h +++ b/ui/events/ozone/evdev/libgestures_glue/gesture_logging.h
@@ -7,9 +7,11 @@ // libgestures.so binds to this function for logging. // TODO(spang): Fix libgestures to not require this. +// clang-format off extern "C" - __attribute__((visibility("default"))) void gestures_log(int verb, - const char* fmt, - ...); + __attribute__((visibility("default"))) + __attribute__((used, retain)) + void gestures_log(int verb, const char* fmt, ...); +// clang-format on #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_LOGGING_H_
diff --git a/ui/gl/swap_chain_presenter.cc b/ui/gl/swap_chain_presenter.cc index 1b2f233..b2e37c4 100644 --- a/ui/gl/swap_chain_presenter.cc +++ b/ui/gl/swap_chain_presenter.cc
@@ -2043,10 +2043,8 @@ } } if (!use_yuv_swap_chain) { - std::ostringstream trace_event_stream; - trace_event_stream << "SwapChainPresenter::ReallocateSwapChain::" - << DxgiFormatToString(swap_chain_format); - TRACE_EVENT0("gpu", trace_event_stream.str().c_str()); + TRACE_EVENT1("gpu", "SwapChainPresenter::ReallocateSwapChain::BGRA", + "format", DxgiFormatToString(swap_chain_format)); desc.Format = swap_chain_format; desc.Flags = DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO;
diff --git a/ui/native_theme/native_theme_mac.h b/ui/native_theme/native_theme_mac.h index 532ae34..aeef6b55 100644 --- a/ui/native_theme/native_theme_mac.h +++ b/ui/native_theme/native_theme_mac.h
@@ -104,7 +104,8 @@ // high contrast. void PaintSelectedMenuItem(cc::PaintCanvas* canvas, const ColorProvider* color_provider, - const gfx::Rect& rect) const; + const gfx::Rect& rect, + const MenuItemExtraParams& extra_params) const; void PaintScrollBarTrackGradient(cc::PaintCanvas* canvas, const gfx::Rect& rect,
diff --git a/ui/native_theme/native_theme_mac.mm b/ui/native_theme/native_theme_mac.mm index 938c9948..eacbc63 100644 --- a/ui/native_theme/native_theme_mac.mm +++ b/ui/native_theme/native_theme_mac.mm
@@ -482,7 +482,7 @@ // Draw nothing over the regular background. break; case NativeTheme::kHovered: - PaintSelectedMenuItem(canvas, color_provider, rect); + PaintSelectedMenuItem(canvas, color_provider, rect, menu_item); break; default: NOTREACHED(); @@ -529,14 +529,18 @@ removeObserver:high_contrast_notification_token_]; } -void NativeThemeMac::PaintSelectedMenuItem(cc::PaintCanvas* canvas, - const ColorProvider* color_provider, - const gfx::Rect& rect) const { +void NativeThemeMac::PaintSelectedMenuItem( + cc::PaintCanvas* canvas, + const ColorProvider* color_provider, + const gfx::Rect& rect, + const MenuItemExtraParams& extra_params) const { DCHECK(color_provider); // Draw the background. cc::PaintFlags flags; + flags.setAntiAlias(true); flags.setColor(color_provider->GetColor(kColorMenuItemBackgroundSelected)); - canvas->drawRect(gfx::RectToSkRect(rect), flags); + const SkScalar radius = SkIntToScalar(extra_params.corner_radius); + canvas->drawRoundRect(gfx::RectToSkRect(rect), radius, radius, flags); } void NativeThemeMac::InitializeDarkModeStateAndObserver() {
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm index dc65762..ca1a9e0 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
@@ -617,7 +617,7 @@ content_bounds_in_screen_.size(), display_.device_scale_factor())); compositor_->UpdateSurface(content_bounds_in_pixels, display_.device_scale_factor(), - display_.color_spaces()); + display_.color_spaces(), display_.id()); } void NativeWidgetMacNSWindowHost::DestroyCompositor() { @@ -1173,7 +1173,7 @@ content_bounds_in_screen_.size(), display_.device_scale_factor())); compositor_->UpdateSurface(content_bounds_in_pixels, display_.device_scale_factor(), - display_.color_spaces()); + display_.color_spaces(), display_.id()); } if (display_id_changed) { @@ -1187,7 +1187,6 @@ if (compositor_) { RequestVSyncParametersUpdate(); - compositor_->compositor()->SetVSyncDisplayID(display_.id()); } } }
diff --git a/ui/views/controls/menu/menu_config.cc b/ui/views/controls/menu/menu_config.cc index ad6c198..d504795 100644 --- a/ui/views/controls/menu/menu_config.cc +++ b/ui/views/controls/menu/menu_config.cc
@@ -57,7 +57,6 @@ separator_right_margin = 12; item_top_margin = 6; item_bottom_margin = 6; - item_horizontal_border_padding = 12; } // static
diff --git a/ui/views/controls/menu/menu_config_linux.cc b/ui/views/controls/menu/menu_config_linux.cc index 9d74e85..59de1747 100644 --- a/ui/views/controls/menu/menu_config_linux.cc +++ b/ui/views/controls/menu/menu_config_linux.cc
@@ -4,10 +4,16 @@ #include "ui/views/controls/menu/menu_config.h" +#include "ui/base/ui_base_features.h" + namespace views { void MenuConfig::Init() { arrow_to_edge_padding = 6; + // Set Linux specific metrics for CR2023 + if (features::IsChromeRefresh2023()) { + item_horizontal_border_padding = 12; + } } } // namespace views
diff --git a/ui/views/controls/menu/menu_config_mac.mm b/ui/views/controls/menu/menu_config_mac.mm index ceb31ba..324348fc 100644 --- a/ui/views/controls/menu/menu_config_mac.mm +++ b/ui/views/controls/menu/menu_config_mac.mm
@@ -36,6 +36,7 @@ config->auxiliary_corner_radius = 4; config->item_top_margin = 4; config->item_bottom_margin = 4; + config->item_horizontal_border_padding = 0; } } // namespace
diff --git a/ui/views/controls/menu/menu_config_win.cc b/ui/views/controls/menu/menu_config_win.cc index eb13da1..5a6f071e 100644 --- a/ui/views/controls/menu/menu_config_win.cc +++ b/ui/views/controls/menu/menu_config_win.cc
@@ -55,6 +55,10 @@ if (use_bubble_border && !is_refresh) { corner_radius = 8; } + // Set Windows specific metrics for CR2023 + if (is_refresh) { + item_horizontal_border_padding = 12; + } } } // namespace views
diff --git a/url/gurl.cc b/url/gurl.cc index 6930f73..9f2e5fa 100644 --- a/url/gurl.cc +++ b/url/gurl.cc
@@ -13,6 +13,7 @@ #include "base/check_op.h" #include "base/no_destructor.h" +#include "base/notreached.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" #include "base/trace_event/base_tracing.h" @@ -158,7 +159,9 @@ if (is_valid_ || spec_.empty()) return spec_; - DCHECK(false) << "Trying to get the spec of an invalid URL!"; + // TODO(crbug.com/851128): Make sure this no longer hits before making + // NOTREACHED_NORETURN(); + NOTREACHED() << "Trying to get the spec of an invalid URL!"; return base::EmptyString(); }
diff --git a/weblayer/browser/content_browser_client_impl.cc b/weblayer/browser/content_browser_client_impl.cc index 995122b..09b71c8 100644 --- a/weblayer/browser/content_browser_client_impl.cc +++ b/weblayer/browser/content_browser_client_impl.cc
@@ -422,7 +422,7 @@ } std::string ContentBrowserClientImpl::GetProduct() { - return version_info::GetProductNameAndVersionForUserAgent(); + return std::string(version_info::GetProductNameAndVersionForUserAgent()); } std::string ContentBrowserClientImpl::GetUserAgent() {