diff --git a/DEPS b/DEPS index f32b021..7d57a51 100644 --- a/DEPS +++ b/DEPS
@@ -280,7 +280,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': '2d6e13210d3030dc5a10308d6aa9c3bd81c1dcb4', + 'skia_revision': '068fc2cfc1ccee45f1927c91847a757270f02dec', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -296,7 +296,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': 'c153a82e5bb12fb769060fc7718f7556e6a93c56', + 'pdfium_revision': 'c5807c5522f360c78ab123e8342d66a15114acfa', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. @@ -331,7 +331,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. - 'freetype_revision': 'd5d048bbfe1bcfae18fa5948284c95f89d8f33a0', + 'freetype_revision': '8a9192f68ef0100649502bd8fe17df7f51211521', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. @@ -395,7 +395,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': 'e427a9ba5ec2d2d0b7e4a083cbc26ba465bbc24a', + 'dawn_revision': '342931ae08a24f58f19e05e13e39dd275c687bfe', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -760,7 +760,7 @@ }, 'src/ios/third_party/earl_grey2/src': { - 'url': Var('chromium_git') + '/external/github.com/google/EarlGrey.git' + '@' + 'da03109b4eb3ee32ab4d83d160968a78a3ed0369', + 'url': Var('chromium_git') + '/external/github.com/google/EarlGrey.git' + '@' + '2882ae6f9ac225a615a6f1d7eddb2dd542dfaba0', 'condition': 'checkout_ios', }, @@ -1564,7 +1564,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'acc008eff9c38f106b21ee30f6fac8741cb77878', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'f56e4abd18a85f6719dcff6fcdc305673d0f3f4e', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1615,7 +1615,7 @@ 'packages': [ { 'package': 'chromium/third_party/r8', - 'version': 'rjJlU5IP2VfVMVMEzQ8fMaA6vkqr15VmfRYimpm4TeIC', + 'version': 'Zmb3PQpaMmxHLKO-7rV_Zl3UzVWX40QwqDQQibl5kkYC', }, ], 'condition': 'checkout_android', @@ -1734,7 +1734,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'a6bab72c7259ca3131b00a856cd9be23fc15bbd3', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'cbfdcc535e595dad73249be55b1340bc2561412c', + Var('webrtc_git') + '/src.git' + '@' + '9b29b874708f0567951f0c8923fc1af2e4f9b5e7', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1807,7 +1807,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@46b9d6fc5a491a4c89b9435c16394db178caaab9', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@57532da32c2a6e4cb1a5f471a7426274c93091b0', 'condition': 'checkout_src_internal', },
diff --git a/ash/app_list/app_list_controller_impl_unittest.cc b/ash/app_list/app_list_controller_impl_unittest.cc index 371da3b..485fa14 100644 --- a/ash/app_list/app_list_controller_impl_unittest.cc +++ b/ash/app_list/app_list_controller_impl_unittest.cc
@@ -725,7 +725,7 @@ // Add a folder, whose AppListItemList the AppListModel will observe. AppListModel* model = GetAppListModel(); const std::string folder_id("folder_1"); - model->AddFolderItemForTest(folder_id); + model->CreateFolderItem(folder_id); for (int i = 0; i < 2; ++i) { auto item = std::make_unique<AppListItem>(base::StringPrintf("app_%d", i));
diff --git a/ash/app_list/app_list_metrics_unittest.cc b/ash/app_list/app_list_metrics_unittest.cc index ac28500..a83eea67 100644 --- a/ash/app_list/app_list_metrics_unittest.cc +++ b/ash/app_list/app_list_metrics_unittest.cc
@@ -859,7 +859,7 @@ // Create a folder and add 3 items to it. const std::string folder_id = "folder_id"; - model->AddFolderItemForTest(folder_id); + model->CreateFolderItem(folder_id); for (int i = 0; i < 3; i++) { auto item = std::make_unique<AppListItem>(base::StringPrintf("id_in_folder_%d", i));
diff --git a/ash/app_list/model/app_list_model.cc b/ash/app_list/model/app_list_model.cc index 4c755362..417dda5 100644 --- a/ash/app_list/model/app_list_model.cc +++ b/ash/app_list/model/app_list_model.cc
@@ -64,6 +64,18 @@ return nullptr; } +AppListFolderItem* AppListModel::CreateFolderItem( + const std::string& folder_id) { + DCHECK(!top_level_item_list()->FindItem(folder_id)); + std::unique_ptr<AppListFolderItem> new_folder = + std::make_unique<AppListFolderItem>(folder_id, delegate_); + new_folder->set_position( + top_level_item_list_->CreatePositionBefore(syncer::StringOrdinal())); + AppListItem* new_folder_item = AddItemToRootListAndNotify( + std::move(new_folder), ReparentItemReason::kAdd); + return static_cast<AppListFolderItem*>(new_folder_item); +} + AppListItem* AppListModel::AddItem(std::unique_ptr<AppListItem> item) { DCHECK(!item->IsInFolder()); DCHECK(!top_level_item_list()->FindItem(item->id())); @@ -120,9 +132,9 @@ DVLOG(2) << "AddItemToFolder: " << item->id() << ": " << folder_id; CHECK_NE(folder_id, item->folder_id()); DCHECK_NE(AppListFolderItem::kItemType, item->GetItemType()); - AppListFolderItem* dest_folder = FindOrCreateFolderItem(folder_id); + AppListFolderItem* dest_folder = FindFolderItem(folder_id); if (!dest_folder) - return nullptr; + dest_folder = CreateFolderItem(folder_id); DCHECK(!dest_folder->item_list()->FindItem(item->id())) << "Already in folder: " << dest_folder->id(); return AddItemToFolderListAndNotify(dest_folder, std::move(item), @@ -175,8 +187,9 @@ return; if (!item->IsInFolder()) { - AppListFolderItem* dest_folder = FindOrCreateFolderItem(folder_id); - DCHECK(dest_folder); + AppListFolderItem* dest_folder = FindFolderItem(folder_id); + if (!dest_folder) + dest_folder = CreateFolderItem(folder_id); // Handle the case that `item` is a top list item. std::unique_ptr<AppListItem> item_ptr = RemoveFromTopList(item); AddItemToFolderListAndNotify(dest_folder, std::move(item_ptr), @@ -194,7 +207,7 @@ << " <- " << item->ToDebugString(); if (item->folder_id().empty()) return false; - AppListFolderItem* src_folder = FindOrCreateFolderItem(item->folder_id()); + AppListFolderItem* src_folder = FindFolderItem(item->folder_id()); if (src_folder && src_folder->folder_type() == AppListFolderItem::FOLDER_TYPE_OEM) { LOG(WARNING) << "MoveItemToFolderAt called with OEM folder as source"; @@ -252,31 +265,6 @@ /*destination_folder_id=*/absl::nullopt); } -void AppListModel::AddFolderItemForTest(const std::string& folder_id) { - AddItem(std::make_unique<AppListFolderItem>(folder_id, delegate_)); -} - -// Protected methods - -AppListFolderItem* AppListModel::FindOrCreateFolderItem( - const std::string& folder_id) { - if (folder_id.empty()) - return nullptr; - - AppListFolderItem* dest_folder = FindFolderItem(folder_id); - if (dest_folder) - return dest_folder; - - DVLOG(2) << "Creating new folder: " << folder_id; - std::unique_ptr<AppListFolderItem> new_folder = - std::make_unique<AppListFolderItem>(folder_id, delegate_); - new_folder->set_position( - top_level_item_list_->CreatePositionBefore(syncer::StringOrdinal())); - AppListItem* new_folder_item = AddItemToRootListAndNotify( - std::move(new_folder), ReparentItemReason::kAdd); - return static_cast<AppListFolderItem*>(new_folder_item); -} - // Private methods void AppListModel::OnListItemMoved(size_t from_index, @@ -357,9 +345,14 @@ AddItemToRootListAndNotify(std::move(removed_item), ReparentItemReason::kUpdate); } else { - AddItemToFolderListAndNotify( - FindOrCreateFolderItem(*destination_folder_id), - std::move(removed_item), ReparentItemReason::kUpdate); + // Create a folder if the destination folder doesn't exist. + AppListFolderItem* destination_folder = + FindFolderItem(*destination_folder_id); + if (!destination_folder) + destination_folder = CreateFolderItem(*destination_folder_id); + + AddItemToFolderListAndNotify(destination_folder, std::move(removed_item), + ReparentItemReason::kUpdate); } } else { // Destroy `removed_item` and notify observers.
diff --git a/ash/app_list/model/app_list_model.h b/ash/app_list/model/app_list_model.h index 5603a3a..ee5710f 100644 --- a/ash/app_list/model/app_list_model.h +++ b/ash/app_list/model/app_list_model.h
@@ -51,6 +51,9 @@ // Find a folder item matching |id|. AppListFolderItem* FindFolderItem(const std::string& id); + // Creates and adds an empty folder item with the provided ID. + AppListFolderItem* CreateFolderItem(const std::string& folder_id); + // Adds |item| to the model. The model takes ownership of |item|. Returns a // pointer to the item that is safe to use (e.g. after passing ownership). AppListItem* AddItem(std::unique_ptr<AppListItem> item); @@ -117,9 +120,6 @@ // appropriate folder. void DeleteItem(const std::string& id); - // Creates and adds an empty folder item with the provided ID. - void AddFolderItemForTest(const std::string& folder_id); - AppListModelDelegate* delegate() { return delegate_; } AppListItemList* top_level_item_list() const { @@ -128,10 +128,6 @@ AppListModelStatus status() const { return status_; } - protected: - // Returns an existing folder matching |folder_id| or creates a new folder. - AppListFolderItem* FindOrCreateFolderItem(const std::string& folder_id); - private: enum class ReparentItemReason { // Reparent an item when adding the item to the model.
diff --git a/ash/app_list/model/app_list_test_model.cc b/ash/app_list/model/app_list_test_model.cc index d284d06..8dc01ed 100644 --- a/ash/app_list/model/app_list_test_model.cc +++ b/ash/app_list/model/app_list_test_model.cc
@@ -89,8 +89,9 @@ void AppListTestModel::RequestMoveItemToFolder(std::string id, const std::string& folder_id) { - // Copy the logic of `ChromeAppListModelUpdater::HandleMoveItemToFolder()`. - AppListFolderItem* dest_folder = FindOrCreateFolderItem(folder_id); + // Copy the logic of `ChromeAppListModelUpdater::RequestMoveItemToFolder()`. + AppListFolderItem* dest_folder = FindFolderItem(folder_id); + DCHECK(dest_folder); const syncer::StringOrdinal target_position = dest_folder->item_list()->CreatePositionBefore(syncer::StringOrdinal()); @@ -103,7 +104,7 @@ void AppListTestModel::RequestMoveItemToRoot( std::string id, syncer::StringOrdinal target_position) { - // Copy the logic of `ChromeAppListModelUpdater::HandleMoveItemToRoot()`. + // Copy the logic of `ChromeAppListModelUpdater::RequestMoveItemToRoot()`. auto metadata = FindItem(id)->CloneMetadata(); metadata->folder_id = ""; metadata->position = target_position;
diff --git a/ash/app_list/views/app_list_item_view.cc b/ash/app_list/views/app_list_item_view.cc index d8ca602..f55c90a 100644 --- a/ash/app_list/views/app_list_item_view.cc +++ b/ash/app_list/views/app_list_item_view.cc
@@ -19,7 +19,6 @@ #include "ash/constants/ash_features.h" #include "ash/public/cpp/app_list/app_list_color_provider.h" #include "ash/public/cpp/app_list/app_list_config.h" -#include "ash/public/cpp/app_list/app_list_switches.h" #include "ash/public/cpp/app_list/app_list_types.h" #include "ash/public/cpp/style/color_provider.h" #include "ash/strings/grit/ash_strings.h" @@ -35,27 +34,22 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/compositor/layer.h" #include "ui/compositor/scoped_layer_animation_settings.h" -#include "ui/gfx/animation/throb_animation.h" #include "ui/gfx/canvas.h" -#include "ui/gfx/color_analysis.h" #include "ui/gfx/color_palette.h" #include "ui/gfx/font_list.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/rounded_corners_f.h" #include "ui/gfx/geometry/transform_util.h" -#include "ui/gfx/geometry/vector2d.h" #include "ui/gfx/image/canvas_image_source.h" #include "ui/gfx/image/image_skia_operations.h" #include "ui/gfx/scoped_canvas.h" #include "ui/gfx/shadow_value.h" #include "ui/gfx/skia_paint_util.h" -#include "ui/strings/grit/ui_strings.h" #include "ui/views/accessibility/accessibility_paint_checks.h" -#include "ui/views/background.h" +#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/controls/image_view.h" #include "ui/views/controls/label.h" #include "ui/views/controls/menu/menu_runner.h" -#include "ui/views/drag_controller.h" namespace ash { @@ -325,6 +319,7 @@ DCHECK(view_delegate_); SetFocusBehavior(FocusBehavior::ALWAYS); set_suppress_default_focus_handling(); + GetViewAccessibility().OverrideIsLeaf(true); auto title = std::make_unique<views::Label>(); title->SetBackgroundColor(SK_ColorTRANSPARENT); @@ -676,6 +671,11 @@ IDS_APP_LIST_PAUSED_APP)); break; default: + if (item_weak_->is_new_install()) { + node_data->SetDescription( + ui::ResourceBundle::GetSharedInstance().GetLocalizedString( + IDS_APP_LIST_NEW_INSTALL_ACCESSIBILE_DESCRIPTION)); + } break; } }
diff --git a/ash/app_list/views/app_list_item_view_unittest.cc b/ash/app_list/views/app_list_item_view_unittest.cc index 4de24cc6..054c414a 100644 --- a/ash/app_list/views/app_list_item_view_unittest.cc +++ b/ash/app_list/views/app_list_item_view_unittest.cc
@@ -13,6 +13,8 @@ #include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "base/test/scoped_feature_list.h" +#include "ui/accessibility/ax_enums.mojom-shared.h" +#include "ui/accessibility/ax_node_data.h" #include "ui/views/controls/label.h" namespace ash { @@ -89,6 +91,7 @@ auto* helper = GetAppListTestHelper(); helper->ShowAppList(); + ui::AXNodeData node_data; // By default, the new install dot is not visible. auto* apps_grid_view = helper->GetScrollableAppsGridView(); @@ -97,11 +100,19 @@ ASSERT_TRUE(new_install_dot); EXPECT_FALSE(new_install_dot->GetVisible()); EXPECT_EQ(item_view->GetTooltipText({}), u"Google Buzz"); + item_view->GetAccessibleNodeData(&node_data); + EXPECT_EQ( + node_data.GetStringAttribute(ax::mojom::StringAttribute::kDescription), + ""); // When the app is a new install the dot is visible and the tooltip changes. item->SetIsNewInstall(true); EXPECT_TRUE(new_install_dot->GetVisible()); EXPECT_EQ(item_view->GetTooltipText({}), u"Google Buzz\nNew install"); + item_view->GetAccessibleNodeData(&node_data); + EXPECT_EQ( + node_data.GetStringAttribute(ax::mojom::StringAttribute::kDescription), + "New install"); } TEST_F(AppListItemViewProductivityLauncherTest, LabelInsetWithNewInstallDot) {
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index 951e5df..ac3a500 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -4332,6 +4332,9 @@ <message name="IDS_APP_LIST_BLOCKED_APP" desc="The spoken feedback text when a focused app is blocked."> Blocked </message> + <message name="IDS_APP_LIST_NEW_INSTALL_ACCESSIBILE_DESCRIPTION" desc="The spoken feedback text when a focused app is newly installed."> + New install + </message> <message name="IDS_APP_LIST_PAUSED_APP" desc="The spoken feedback text when a focused app is paused."> Paused </message>
diff --git a/ash/ash_strings_grd/IDS_APP_LIST_NEW_INSTALL_ACCESSIBILE_DESCRIPTION.png.sha1 b/ash/ash_strings_grd/IDS_APP_LIST_NEW_INSTALL_ACCESSIBILE_DESCRIPTION.png.sha1 new file mode 100644 index 0000000..da55921 --- /dev/null +++ b/ash/ash_strings_grd/IDS_APP_LIST_NEW_INSTALL_ACCESSIBILE_DESCRIPTION.png.sha1
@@ -0,0 +1 @@ +1628188f794c34abc2de1d7d2d3795c50722ea28 \ No newline at end of file
diff --git a/ash/components/arc/enterprise/arc_data_snapshotd_bridge.cc b/ash/components/arc/enterprise/arc_data_snapshotd_bridge.cc index a58db6b..3cb300c 100644 --- a/ash/components/arc/enterprise/arc_data_snapshotd_bridge.cc +++ b/ash/components/arc/enterprise/arc_data_snapshotd_bridge.cc
@@ -10,7 +10,6 @@ #include "base/logging.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/dbus/arc/arc_data_snapshotd_client.h" -#include "chromeos/dbus/dbus_thread_manager.h" namespace arc { namespace data_snapshotd { @@ -56,11 +55,9 @@ dbus_waiting_weak_ptr_factory_.InvalidateWeakPtrs(); - chromeos::DBusThreadManager::Get() - ->GetArcDataSnapshotdClient() - ->WaitForServiceToBeAvailable( - base::BindOnce(&ArcDataSnapshotdBridge::OnWaitedForDBusService, - dbus_waiting_weak_ptr_factory_.GetWeakPtr())); + chromeos::ArcDataSnapshotdClient::Get()->WaitForServiceToBeAvailable( + base::BindOnce(&ArcDataSnapshotdBridge::OnWaitedForDBusService, + dbus_waiting_weak_ptr_factory_.GetWeakPtr())); ScheduleWaitingForDBusService(); } @@ -94,9 +91,7 @@ } VLOG(1) << "GenerateKeyPair via D-Bus"; - chromeos::DBusThreadManager::Get() - ->GetArcDataSnapshotdClient() - ->GenerateKeyPair(std::move(callback)); + chromeos::ArcDataSnapshotdClient::Get()->GenerateKeyPair(std::move(callback)); } void ArcDataSnapshotdBridge::ClearSnapshot( @@ -108,9 +103,8 @@ return; } VLOG(1) << "ClearSnapshot via D-Bus"; - chromeos::DBusThreadManager::Get() - ->GetArcDataSnapshotdClient() - ->ClearSnapshot(last, std::move(callback)); + chromeos::ArcDataSnapshotdClient::Get()->ClearSnapshot(last, + std::move(callback)); } void ArcDataSnapshotdBridge::TakeSnapshot( @@ -122,8 +116,8 @@ return; } VLOG(1) << "TakeSnapshot via D-Bus"; - chromeos::DBusThreadManager::Get()->GetArcDataSnapshotdClient()->TakeSnapshot( - account_id, std::move(callback)); + chromeos::ArcDataSnapshotdClient::Get()->TakeSnapshot(account_id, + std::move(callback)); } void ArcDataSnapshotdBridge::LoadSnapshot( @@ -135,8 +129,8 @@ return; } VLOG(1) << "LoadSnapshot via D-Bus"; - chromeos::DBusThreadManager::Get()->GetArcDataSnapshotdClient()->LoadSnapshot( - account_id, std::move(callback)); + chromeos::ArcDataSnapshotdClient::Get()->LoadSnapshot(account_id, + std::move(callback)); } void ArcDataSnapshotdBridge::Update(int percent, @@ -147,8 +141,7 @@ return; } VLOG(1) << "Update via D-Bus"; - chromeos::DBusThreadManager::Get()->GetArcDataSnapshotdClient()->Update( - percent, std::move(callback)); + chromeos::ArcDataSnapshotdClient::Get()->Update(percent, std::move(callback)); } void ArcDataSnapshotdBridge::ConnectToUiCancelledSignal( @@ -159,13 +152,11 @@ return; } VLOG(1) << "Connect to UiCancelled D-Bus signal."; - chromeos::DBusThreadManager::Get() - ->GetArcDataSnapshotdClient() - ->ConnectToUiCancelledSignal( - std::move(signal_callback), - base::BindOnce( - &ArcDataSnapshotdBridge::OnUiCancelledSignalConnectedCallback, - weak_ptr_factory_.GetWeakPtr())); + chromeos::ArcDataSnapshotdClient::Get()->ConnectToUiCancelledSignal( + std::move(signal_callback), + base::BindOnce( + &ArcDataSnapshotdBridge::OnUiCancelledSignalConnectedCallback, + weak_ptr_factory_.GetWeakPtr())); } void ArcDataSnapshotdBridge::OnUiCancelledSignalConnectedCallback(
diff --git a/ash/components/arc/enterprise/arc_data_snapshotd_bridge_unittest.cc b/ash/components/arc/enterprise/arc_data_snapshotd_bridge_unittest.cc index caafb055..f653528 100644 --- a/ash/components/arc/enterprise/arc_data_snapshotd_bridge_unittest.cc +++ b/ash/components/arc/enterprise/arc_data_snapshotd_bridge_unittest.cc
@@ -94,15 +94,16 @@ ArcDataSnapshotdBridgeTest() { chromeos::DBusThreadManager::Initialize(); EXPECT_TRUE(chromeos::DBusThreadManager::Get()->IsUsingFakes()); + chromeos::ArcDataSnapshotdClient::InitializeFake(); } ~ArcDataSnapshotdBridgeTest() override { + chromeos::ArcDataSnapshotdClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); } chromeos::FakeArcDataSnapshotdClient* dbus_client() { - auto* client = - chromeos::DBusThreadManager::Get()->GetArcDataSnapshotdClient(); + auto* client = chromeos::ArcDataSnapshotdClient::Get(); DCHECK(client); return static_cast<chromeos::FakeArcDataSnapshotdClient*>(client); }
diff --git a/ash/components/arc/enterprise/arc_data_snapshotd_manager_unittest.cc b/ash/components/arc/enterprise/arc_data_snapshotd_manager_unittest.cc index e041cb3..e3bd01d4 100644 --- a/ash/components/arc/enterprise/arc_data_snapshotd_manager_unittest.cc +++ b/ash/components/arc/enterprise/arc_data_snapshotd_manager_unittest.cc
@@ -166,6 +166,7 @@ // Initialize fake D-Bus client. chromeos::DBusThreadManager::Initialize(); EXPECT_TRUE(chromeos::DBusThreadManager::Get()->IsUsingFakes()); + chromeos::ArcDataSnapshotdClient::InitializeFake(); fake_user_manager_ = new user_manager::FakeUserManager(); scoped_user_manager_ = std::make_unique<user_manager::ScopedUserManager>( @@ -192,6 +193,7 @@ } ~ArcDataSnapshotdManagerBasicTest() override { + chromeos::ArcDataSnapshotdClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); } @@ -219,7 +221,7 @@ void SetDBusClientAvailability(bool is_available) { auto* client = static_cast<chromeos::FakeArcDataSnapshotdClient*>( - chromeos::DBusThreadManager::Get()->GetArcDataSnapshotdClient()); + chromeos::ArcDataSnapshotdClient::Get()); DCHECK(client); client->set_available(is_available); } @@ -313,7 +315,7 @@ chromeos::FakeArcDataSnapshotdClient* client() const { return static_cast<chromeos::FakeArcDataSnapshotdClient*>( - chromeos::DBusThreadManager::Get()->GetArcDataSnapshotdClient()); + chromeos::ArcDataSnapshotdClient::Get()); } protected:
diff --git a/ash/components/audio/cras_audio_handler.cc b/ash/components/audio/cras_audio_handler.cc index 07ff012..682c4500 100644 --- a/ash/components/audio/cras_audio_handler.cc +++ b/ash/components/audio/cras_audio_handler.cc
@@ -1131,8 +1131,7 @@ } // Sets Floss enabled based on feature flag. - CrasAudioClient::Get()->SetFlossEnabled( - base::FeatureList::IsEnabled(floss::features::kFlossEnabled)); + CrasAudioClient::Get()->SetFlossEnabled(floss::features::IsFlossEnabled()); input_muted_by_microphone_mute_switch_ = IsMicrophoneMuteSwitchOn(); if (input_muted_by_microphone_mute_switch_)
diff --git a/ash/public/cpp/app_list/app_list_features.cc b/ash/public/cpp/app_list/app_list_features.cc index 3601153..87e8d91 100644 --- a/ash/public/cpp/app_list/app_list_features.cc +++ b/ash/public/cpp/app_list/app_list_features.cc
@@ -31,8 +31,6 @@ base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kEnableExactMatchForNonLatinLocale{ "EnableExactMatchForNonLatinLocale", base::FEATURE_ENABLED_BY_DEFAULT}; -const base::Feature kEnableAggregatedMlSearchRanking{ - "EnableAggregatedMlSearchRanking", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kEnableLauncherSearchNormalization{ "EnableLauncherSearchNormalization", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kCategoricalSearch{"CategoricalSearch", @@ -87,10 +85,6 @@ return base::FeatureList::IsEnabled(kEnableExactMatchForNonLatinLocale); } -bool IsAggregatedMlSearchRankingEnabled() { - return base::FeatureList::IsEnabled(kEnableAggregatedMlSearchRanking); -} - bool IsLauncherSearchNormalizationEnabled() { return base::FeatureList::IsEnabled(kEnableLauncherSearchNormalization); }
diff --git a/ash/public/cpp/app_list/app_list_features.h b/ash/public/cpp/app_list/app_list_features.h index cd3ffea..2a8e7fec 100644 --- a/ash/public/cpp/app_list/app_list_features.h +++ b/ash/public/cpp/app_list/app_list_features.h
@@ -53,10 +53,6 @@ // Enables launcher search results for OS settings. ASH_PUBLIC_EXPORT extern const base::Feature kLauncherSettingsSearch; -// Enables using aggregated model in ranking non-app results for -// non empty queries. -ASH_PUBLIC_EXPORT extern const base::Feature kEnableAggregatedMlSearchRanking; - // Enables normalization of search results in the launcher. ASH_PUBLIC_EXPORT extern const base::Feature kEnableLauncherSearchNormalization;
diff --git a/ash/public/cpp/system_tray_client.h b/ash/public/cpp/system_tray_client.h index 04ca24c..d14a4bd 100644 --- a/ash/public/cpp/system_tray_client.h +++ b/ash/public/cpp/system_tray_client.h
@@ -159,9 +159,6 @@ bool& opened_pwa, GURL& finalized_event_url) = 0; - // Retrieves the release track on which the device resides. - virtual version_info::Channel GetChannel() = 0; - protected: SystemTrayClient() {} };
diff --git a/ash/public/cpp/test/test_system_tray_client.cc b/ash/public/cpp/test/test_system_tray_client.cc index b4e70f73..a7c1532 100644 --- a/ash/public/cpp/test/test_system_tray_client.cc +++ b/ash/public/cpp/test/test_system_tray_client.cc
@@ -120,8 +120,4 @@ bool& opened_pwa, GURL& final_event_url) {} -version_info::Channel TestSystemTrayClient::GetChannel() { - return channel_; -} - } // namespace ash
diff --git a/ash/public/cpp/test/test_system_tray_client.h b/ash/public/cpp/test/test_system_tray_client.h index c652c57f..4db1910 100644 --- a/ash/public/cpp/test/test_system_tray_client.h +++ b/ash/public/cpp/test/test_system_tray_client.h
@@ -9,7 +9,6 @@ #include "ash/public/cpp/system_tray_client.h" #include "base/strings/string_piece.h" #include "components/access_code_cast/common/access_code_cast_metrics.h" -#include "components/version_info/channel.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace ash { @@ -67,7 +66,6 @@ const base::Time& date, bool& opened_pwa, GURL& final_event_url) override; - version_info::Channel GetChannel() override; int show_bluetooth_settings_count() const { return show_bluetooth_settings_count_; @@ -119,8 +117,6 @@ return last_network_settings_network_id_; } - void set_channel(version_info::Channel channel) { channel_ = channel; } - private: int show_network_settings_count_ = 0; int show_bluetooth_settings_count_ = 0; @@ -136,7 +132,6 @@ std::string last_bluetooth_settings_device_id_; std::string last_network_settings_network_id_; std::string last_network_type_; - version_info::Channel channel_ = version_info::Channel::UNKNOWN; }; } // namespace ash
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index 5f4da634..5b29bceb 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h
@@ -12,6 +12,7 @@ #include "ash/services/multidevice_setup/public/mojom/multidevice_setup.mojom-forward.h" #include "base/files/file_path.h" #include "chromeos/ui/base/window_pin_type.h" +#include "components/version_info/channel.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "services/device/public/mojom/bluetooth_system.mojom-forward.h" #include "services/device/public/mojom/fingerprint.mojom-forward.h" @@ -140,6 +141,9 @@ // Returns the last committed URL from the web contents if the given |window| // contains a browser frame, otherwise returns GURL::EmptyURL(). virtual const GURL& GetLastCommittedURLForWindowIfAny(aura::Window* window); + + // Retrieves the release track on which the device resides. + virtual version_info::Channel GetChannel() = 0; }; } // namespace ash
diff --git a/ash/system/channel_indicator/channel_indicator.cc b/ash/system/channel_indicator/channel_indicator.cc index 2d0dcd7..e2a0fd02 100644 --- a/ash/system/channel_indicator/channel_indicator.cc +++ b/ash/system/channel_indicator/channel_indicator.cc
@@ -11,7 +11,6 @@ #include "ash/public/cpp/style/dark_light_mode_controller.h" #include "ash/public/cpp/system_tray_client.h" #include "ash/resources/vector_icons/vector_icons.h" -#include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/model/system_tray_model.h" #include "ash/system/tray/tray_constants.h" @@ -92,9 +91,12 @@ } // namespace -ChannelIndicatorView::ChannelIndicatorView(Shelf* shelf) : TrayItemView(shelf) { +ChannelIndicatorView::ChannelIndicatorView(Shelf* shelf, + version_info::Channel channel) + : TrayItemView(shelf), channel_(channel) { SetVisible(false); CreateImageView(); + Update(channel_); } ChannelIndicatorView::~ChannelIndicatorView() = default; @@ -130,14 +132,6 @@ Update(channel_); } -void ChannelIndicatorView::OnSessionStateChanged( - session_manager::SessionState state) { - if (state == session_manager::SessionState::ACTIVE) { - channel_ = Shell::Get()->system_tray_model()->client()->GetChannel(); - Update(channel_); - } -} - void ChannelIndicatorView::Update(version_info::Channel channel) { if (!IsDisplayableChannel(channel)) return;
diff --git a/ash/system/channel_indicator/channel_indicator.h b/ash/system/channel_indicator/channel_indicator.h index b4ff40a..ce410e4f 100644 --- a/ash/system/channel_indicator/channel_indicator.h +++ b/ash/system/channel_indicator/channel_indicator.h
@@ -5,7 +5,6 @@ #ifndef ASH_SYSTEM_CHANNEL_INDICATOR_CHANNEL_INDICATOR_H_ #define ASH_SYSTEM_CHANNEL_INDICATOR_CHANNEL_INDICATOR_H_ -#include "ash/public/cpp/session/session_observer.h" #include "ash/system/tray/tray_item_view.h" #include "components/version_info/channel.h" @@ -13,10 +12,9 @@ // A view that resides in the system tray, to make it obvious to the user when a // device is running on a release track other than "stable." -class ChannelIndicatorView : public TrayItemView, public SessionObserver { +class ChannelIndicatorView : public TrayItemView { public: - explicit ChannelIndicatorView(Shelf* shelf); - + ChannelIndicatorView(Shelf* shelf, version_info::Channel channel); ChannelIndicatorView(const ChannelIndicatorView&) = delete; ChannelIndicatorView& operator=(const ChannelIndicatorView&) = delete; @@ -33,9 +31,6 @@ // TrayItemView: void HandleLocaleChange() override; - // SessionObserver: - void OnSessionStateChanged(session_manager::SessionState state) override; - private: // Functions called downstream from Update(), that make no assumptions about // the value of the `channel_` member variable. @@ -46,8 +41,7 @@ std::u16string accessible_name_; std::u16string tooltip_; - version_info::Channel channel_ = version_info::Channel::UNKNOWN; - ScopedSessionObserver session_observer_{this}; + version_info::Channel channel_; }; } // namespace ash
diff --git a/ash/system/channel_indicator/channel_indicator_unittest.cc b/ash/system/channel_indicator/channel_indicator_unittest.cc index f6cecf2f..12c5bc4 100644 --- a/ash/system/channel_indicator/channel_indicator_unittest.cc +++ b/ash/system/channel_indicator/channel_indicator_unittest.cc
@@ -5,20 +5,20 @@ #include "ash/system/channel_indicator/channel_indicator.h" #include "ash/constants/ash_features.h" -#include "ash/public/cpp/test/test_system_tray_client.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/shell.h" #include "ash/system/model/system_tray_model.h" #include "ash/system/status_area_widget_test_helper.h" #include "ash/system/unified/unified_system_tray.h" #include "ash/test/ash_test_base.h" +#include "ash/test_shell_delegate.h" #include "base/test/scoped_feature_list.h" #include "components/version_info/channel.h" namespace ash { class ChannelIndicatorViewTest - : public NoSessionAshTestBase, + : public AshTestBase, public testing::WithParamInterface<version_info::Channel> { public: void SetUp() override { @@ -26,8 +26,11 @@ // instantiated. feature_list_.InitAndEnableFeature(features::kReleaseTrackUi); - // Instantiates the `TestSystemTrayClient`. - AshTestBase::SetUp(); + // Instantiate a `TestShellDelegate` with the channel set to our param. + std::unique_ptr<TestShellDelegate> shell_delegate = + std::make_unique<TestShellDelegate>(); + shell_delegate->set_channel(static_cast<version_info::Channel>(GetParam())); + AshTestBase::SetUp(std::move(shell_delegate)); } private: @@ -45,16 +48,8 @@ TEST_P(ChannelIndicatorViewTest, Visible) { // Local ref. - TestSystemTrayClient* system_tray_client = GetSystemTrayClient(); - DCHECK(system_tray_client); - - // Param is channel value to be set in `system_tray_client`. - system_tray_client->set_channel( - static_cast<version_info::Channel>(GetParam())); - - // Now OK to log in to a session. - constexpr char kUserEmail[] = "user1@test.com"; - SimulateUserLogin(kUserEmail); + ShellDelegate* shell_delegate = Shell::Get()->shell_delegate(); + DCHECK(shell_delegate); // Local ref. UnifiedSystemTray* tray = @@ -64,7 +59,7 @@ // The `ChannelIndicatorView` should be visible for BETA, DEV, and CANARY // channels, not visible otherwise. - switch (system_tray_client->GetChannel()) { + switch (shell_delegate->GetChannel()) { case version_info::Channel::BETA: case version_info::Channel::DEV: case version_info::Channel::CANARY:
diff --git a/ash/system/unified/unified_system_tray.cc b/ash/system/unified/unified_system_tray.cc index 7df3d3eb..5993a292 100644 --- a/ash/system/unified/unified_system_tray.cc +++ b/ash/system/unified/unified_system_tray.cc
@@ -10,6 +10,7 @@ #include "ash/session/session_controller_impl.h" #include "ash/shelf/shelf.h" #include "ash/shell.h" +#include "ash/shell_delegate.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/channel_indicator/channel_indicator.h" #include "ash/system/human_presence/snooping_protection_view.h" @@ -186,10 +187,7 @@ CameraMicTrayItemView::Type::kCamera)), mic_view_( new CameraMicTrayItemView(shelf, CameraMicTrayItemView::Type::kMic)), - time_view_(new TimeTrayItemView(shelf, TimeView::Type::kTime)), - channel_indicator_view_(features::IsReleaseTrackUiEnabled() - ? new ChannelIndicatorView(shelf) - : nullptr) { + time_view_(new TimeTrayItemView(shelf, TimeView::Type::kTime)) { tray_container()->SetMargin( kUnifiedTrayContentPadding - ShelfConfig::Get()->status_area_hit_region_padding(), @@ -234,8 +232,11 @@ AddTrayItemToContainer(network_tray_view_); AddTrayItemToContainer(new PowerTrayView(shelf)); - if (features::IsReleaseTrackUiEnabled()) + if (features::IsReleaseTrackUiEnabled()) { + channel_indicator_view_ = new ChannelIndicatorView( + shelf, Shell::Get()->shell_delegate()->GetChannel()); AddTrayItemToContainer(channel_indicator_view_); + } auto vertical_clock_padding = std::make_unique<views::View>(); vertical_clock_padding->SetPreferredSize(gfx::Size(
diff --git a/ash/test_shell_delegate.cc b/ash/test_shell_delegate.cc index 0f0dc61..2d401a7c 100644 --- a/ash/test_shell_delegate.cc +++ b/ash/test_shell_delegate.cc
@@ -115,4 +115,8 @@ last_committed_url_ = url; } +version_info::Channel TestShellDelegate::GetChannel() { + return channel_; +} + } // namespace ash
diff --git a/ash/test_shell_delegate.h b/ash/test_shell_delegate.h index d2619f40..c9c2d8b5b 100644 --- a/ash/test_shell_delegate.h +++ b/ash/test_shell_delegate.h
@@ -64,6 +64,9 @@ base::FilePath GetPrimaryUserDownloadsFolder() const override; void OpenFeedbackPageForPersistentDesksBar() override {} void SetLastCommittedURLForWindow(const GURL& url); + version_info::Channel GetChannel() override; + + void set_channel(version_info::Channel channel) { channel_ = channel; } private: // True if the current top window can go back. @@ -84,6 +87,8 @@ MultiDeviceSetupBinder multidevice_setup_binder_; GURL last_committed_url_ = GURL::EmptyGURL(); + + version_info::Channel channel_ = version_info::Channel::UNKNOWN; }; } // namespace ash
diff --git a/ash/wm/desks/desks_bar_view.cc b/ash/wm/desks/desks_bar_view.cc index afd9acc..78fb09d 100644 --- a/ash/wm/desks/desks_bar_view.cc +++ b/ash/wm/desks/desks_bar_view.cc
@@ -216,10 +216,10 @@ // The presenter is shutdown early in the overview destruction process to // prevent calls to the model. Some animations on the desks bar may still // call this function past shutdown start. In this case we just continue - // as if the saved desks Ui should be hidden. + // as if the saved desks UI should be hidden. OverviewSession* session = bar_view_->overview_grid()->overview_session(); const bool should_show_templates_ui = - saved_desk_util::IsSavedDesksEnabled() && + saved_desk_util::IsSavedDesksEnabled() && session && !session->is_shutting_down() && session->saved_desk_presenter()->should_show_templates_ui(); auto* zero_state_desks_templates_button =
diff --git a/base/allocator/partition_allocator/partition_alloc_unittest.cc b/base/allocator/partition_allocator/partition_alloc_unittest.cc index 41bcd6e20..a4b02e0 100644 --- a/base/allocator/partition_allocator/partition_alloc_unittest.cc +++ b/base/allocator/partition_allocator/partition_alloc_unittest.cc
@@ -97,7 +97,7 @@ // // Set to 4GiB, since we have 2GiB Android devices where tests flakily fail // (e.g. Nexus 5X, crbug.com/1191195). - return base::SysInfo::AmountOfPhysicalMemory() >= 4000LL * 1024 * 1024; + return base::SysInfo::AmountOfPhysicalMemory() >= 4000ULL * 1024 * 1024; } bool SetAddressSpaceLimit() {
diff --git a/base/process/process_metrics_unittest.cc b/base/process/process_metrics_unittest.cc index 8ab3e9b1..4a589f1 100644 --- a/base/process/process_metrics_unittest.cc +++ b/base/process/process_metrics_unittest.cc
@@ -207,11 +207,11 @@ EXPECT_EQ(meminfo.shmem, 140204); EXPECT_EQ(meminfo.slab, 54212); #endif - EXPECT_EQ(355725, + EXPECT_EQ(355725u, base::SysInfo::AmountOfAvailablePhysicalMemory(meminfo) / 1024); // Simulate as if there is no MemAvailable. meminfo.available = 0; - EXPECT_EQ(374448, + EXPECT_EQ(374448u, base::SysInfo::AmountOfAvailablePhysicalMemory(meminfo) / 1024); meminfo = {}; EXPECT_TRUE(ParseProcMeminfo(valid_input2, &meminfo)); @@ -223,7 +223,7 @@ EXPECT_EQ(meminfo.swap_total, 524280); EXPECT_EQ(meminfo.swap_free, 524200); EXPECT_EQ(meminfo.dirty, 4); - EXPECT_EQ(69936, + EXPECT_EQ(69936u, base::SysInfo::AmountOfAvailablePhysicalMemory(meminfo) / 1024); }
diff --git a/base/profiler/stack_copier_signal.cc b/base/profiler/stack_copier_signal.cc index 1cf08fc..bc2ecb0 100644 --- a/base/profiler/stack_copier_signal.cc +++ b/base/profiler/stack_copier_signal.cc
@@ -37,7 +37,7 @@ // futex() can wake up spuriously if this memory address was previously used // for a pthread mutex. So, also check the condition. while (true) { - int res = + long res = syscall(SYS_futex, futex_int_ptr(), FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, nullptr, nullptr, 0); if (futex_.load(std::memory_order_acquire) != 0)
diff --git a/base/sync_socket_posix.cc b/base/sync_socket_posix.cc index 92d47fc..1b75de7 100644 --- a/base/sync_socket_posix.cc +++ b/base/sync_socket_posix.cc
@@ -23,6 +23,7 @@ #include "base/check_op.h" #include "base/containers/span.h" #include "base/files/file_util.h" +#include "base/numerics/safe_conversions.h" #include "base/threading/scoped_blocking_call.h" #include "build/build_config.h" @@ -174,8 +175,7 @@ // If there is an error in ioctl, signal that the channel would block. return 0; } - DCHECK_GE(number_chars, 0); - return number_chars; + return checked_cast<size_t>(number_chars); } bool SyncSocket::IsValid() const {
diff --git a/base/system/sys_info.cc b/base/system/sys_info.cc index a4c99975..7b068fb 100644 --- a/base/system/sys_info.cc +++ b/base/system/sys_info.cc
@@ -23,21 +23,21 @@ namespace { #if BUILDFLAG(IS_IOS) // For M99, 45% of devices have 2GB of RAM, and 55% have more. -constexpr int64_t kLowMemoryDeviceThresholdMB = 1024; +constexpr uint64_t kLowMemoryDeviceThresholdMB = 1024; #else // Updated Desktop default threshold to match the Android 2021 definition. -constexpr int64_t kLowMemoryDeviceThresholdMB = 2048; +constexpr uint64_t kLowMemoryDeviceThresholdMB = 2048; #endif } // namespace // static -int64_t SysInfo::AmountOfPhysicalMemory() { +uint64_t SysInfo::AmountOfPhysicalMemory() { if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableLowEndDeviceMode)) { // Keep using 512MB as the simulated RAM amount for when users or tests have // manually enabled low-end device mode. Note this value is different from // the threshold used for low end devices. - constexpr int64_t kSimulatedMemoryForEnableLowEndDeviceMode = + constexpr uint64_t kSimulatedMemoryForEnableLowEndDeviceMode = 512 * 1024 * 1024; return std::min(kSimulatedMemoryForEnableLowEndDeviceMode, AmountOfPhysicalMemoryImpl()); @@ -47,14 +47,14 @@ } // static -int64_t SysInfo::AmountOfAvailablePhysicalMemory() { +uint64_t SysInfo::AmountOfAvailablePhysicalMemory() { if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableLowEndDeviceMode)) { // Estimate the available memory by subtracting our memory used estimate // from the fake |kLowMemoryDeviceThresholdMB| limit. - int64_t memory_used = + uint64_t memory_used = AmountOfPhysicalMemoryImpl() - AmountOfAvailablePhysicalMemoryImpl(); - int64_t memory_limit = kLowMemoryDeviceThresholdMB * 1024 * 1024; + uint64_t memory_limit = kLowMemoryDeviceThresholdMB * 1024 * 1024; // std::min ensures no underflow, as |memory_used| can be > |memory_limit|. return memory_limit - std::min(memory_used, memory_limit); } @@ -82,7 +82,8 @@ return false; int ram_size_mb = SysInfo::AmountOfPhysicalMemoryMB(); - return (ram_size_mb > 0 && ram_size_mb <= kLowMemoryDeviceThresholdMB); + return ram_size_mb > 0 && + static_cast<uint64_t>(ram_size_mb) <= kLowMemoryDeviceThresholdMB; } // static
diff --git a/base/system/sys_info.h b/base/system/sys_info.h index 1cd1231..963eb48 100644 --- a/base/system/sys_info.h +++ b/base/system/sys_info.h
@@ -34,19 +34,19 @@ // Return the number of bytes of physical memory on the current machine. // If low-end device mode is manually enabled via command line flag, this // will return the lesser of the actual physical memory, or 512MB. - static int64_t AmountOfPhysicalMemory(); + static uint64_t AmountOfPhysicalMemory(); // Return the number of bytes of current available physical memory on the // machine. // (The amount of memory that can be allocated without any significant // impact on the system. It can lead to freeing inactive file-backed // and/or speculative file-backed memory). - static int64_t AmountOfAvailablePhysicalMemory(); + static uint64_t AmountOfAvailablePhysicalMemory(); // Return the number of bytes of virtual memory of this process. A return // value of zero means that there is no limit on the available virtual // memory. - static int64_t AmountOfVirtualMemory(); + static uint64_t AmountOfVirtualMemory(); // Return the number of megabytes of physical memory on the current machine. static int AmountOfPhysicalMemoryMB() { @@ -215,14 +215,14 @@ FRIEND_TEST_ALL_PREFIXES(SysInfoTest, AmountOfAvailablePhysicalMemory); FRIEND_TEST_ALL_PREFIXES(debug::SystemMetricsTest, ParseMeminfo); - static int64_t AmountOfPhysicalMemoryImpl(); - static int64_t AmountOfAvailablePhysicalMemoryImpl(); + static uint64_t AmountOfPhysicalMemoryImpl(); + static uint64_t AmountOfAvailablePhysicalMemoryImpl(); static bool IsLowEndDeviceImpl(); static HardwareInfo GetHardwareInfoSync(); #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ BUILDFLAG(IS_AIX) - static int64_t AmountOfAvailablePhysicalMemory( + static uint64_t AmountOfAvailablePhysicalMemory( const SystemMemoryInfoKB& meminfo); #endif };
diff --git a/base/system/sys_info_fuchsia.cc b/base/system/sys_info_fuchsia.cc index 25396a8..c555946 100644 --- a/base/system/sys_info_fuchsia.cc +++ b/base/system/sys_info_fuchsia.cc
@@ -91,12 +91,12 @@ } // namespace // static -int64_t SysInfo::AmountOfPhysicalMemoryImpl() { +uint64_t SysInfo::AmountOfPhysicalMemoryImpl() { return zx_system_get_physmem(); } // static -int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { +uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { // TODO(https://crbug.com/986608): Implement this. NOTIMPLEMENTED_LOG_ONCE(); return 0; @@ -108,7 +108,7 @@ } // static -int64_t SysInfo::AmountOfVirtualMemory() { +uint64_t SysInfo::AmountOfVirtualMemory() { return 0; }
diff --git a/base/system/sys_info_ios.mm b/base/system/sys_info_ios.mm index e278a18..2b523e5 100644 --- a/base/system/sys_info_ios.mm +++ b/base/system/sys_info_ios.mm
@@ -14,6 +14,7 @@ #include "base/check_op.h" #include "base/mac/scoped_mach_port.h" #include "base/notreached.h" +#include "base/numerics/safe_conversions.h" #include "base/process/process_metrics.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" @@ -115,7 +116,7 @@ } // static -int64_t SysInfo::AmountOfPhysicalMemoryImpl() { +uint64_t SysInfo::AmountOfPhysicalMemoryImpl() { struct host_basic_info hostinfo; mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT; base::mac::ScopedMachSendRight host(mach_host_self()); @@ -126,17 +127,17 @@ return 0; } DCHECK_EQ(HOST_BASIC_INFO_COUNT, count); - return static_cast<int64_t>(hostinfo.max_mem); + return hostinfo.max_mem; } // static -int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { +uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { SystemMemoryInfoKB info; if (!GetSystemMemoryInfo(&info)) return 0; // We should add inactive file-backed memory also but there is no such // information from iOS unfortunately. - return static_cast<int64_t>(info.free + info.speculative) * 1024; + return checked_cast<uint64_t>(info.free + info.speculative) * 1024; } // static
diff --git a/base/system/sys_info_linux.cc b/base/system/sys_info_linux.cc index 881db6f5..1b30427 100644 --- a/base/system/sys_info_linux.cc +++ b/base/system/sys_info_linux.cc
@@ -24,22 +24,20 @@ namespace { -int64_t AmountOfMemory(int pages_name) { +uint64_t AmountOfMemory(int pages_name) { long pages = sysconf(pages_name); long page_size = sysconf(_SC_PAGESIZE); - if (pages == -1 || page_size == -1) { - NOTREACHED(); + if (pages < 0 || page_size < 0) return 0; - } - return static_cast<int64_t>(pages) * page_size; + return static_cast<uint64_t>(pages) * static_cast<uint64_t>(page_size); } -int64_t AmountOfPhysicalMemory() { +uint64_t AmountOfPhysicalMemory() { return AmountOfMemory(_SC_PHYS_PAGES); } base::LazyInstance< - base::internal::LazySysInfoValue<int64_t, AmountOfPhysicalMemory>>::Leaky + base::internal::LazySysInfoValue<uint64_t, AmountOfPhysicalMemory>>::Leaky g_lazy_physical_memory = LAZY_INSTANCE_INITIALIZER; } // namespace @@ -47,12 +45,12 @@ namespace base { // static -int64_t SysInfo::AmountOfPhysicalMemoryImpl() { +uint64_t SysInfo::AmountOfPhysicalMemoryImpl() { return g_lazy_physical_memory.Get().value(); } // static -int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { +uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { SystemMemoryInfoKB info; if (!GetSystemMemoryInfo(&info)) return 0; @@ -60,16 +58,16 @@ } // static -int64_t SysInfo::AmountOfAvailablePhysicalMemory( +uint64_t SysInfo::AmountOfAvailablePhysicalMemory( const SystemMemoryInfoKB& info) { // See details here: // https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773 // The fallback logic (when there is no MemAvailable) would be more precise // if we had info about zones watermarks (/proc/zoneinfo). - int64_t res_kb = info.available != 0 - ? info.available - info.active_file - : info.free + info.reclaimable + info.inactive_file; - return res_kb * 1024; + int res_kb = info.available != 0 + ? info.available - info.active_file + : info.free + info.reclaimable + info.inactive_file; + return checked_cast<uint64_t>(res_kb) * 1024; } // static
diff --git a/base/system/sys_info_mac.mm b/base/system/sys_info_mac.mm index dc52dea1..5cc7636 100644 --- a/base/system/sys_info_mac.mm +++ b/base/system/sys_info_mac.mm
@@ -16,6 +16,7 @@ #include "base/mac/mac_util.h" #include "base/mac/scoped_mach_port.h" #include "base/notreached.h" +#include "base/numerics/safe_conversions.h" #include "base/process/process_metrics.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" @@ -74,7 +75,7 @@ } // static -int64_t SysInfo::AmountOfPhysicalMemoryImpl() { +uint64_t SysInfo::AmountOfPhysicalMemoryImpl() { struct host_basic_info hostinfo; mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT; base::mac::ScopedMachSendRight host(mach_host_self()); @@ -85,17 +86,17 @@ return 0; } DCHECK_EQ(HOST_BASIC_INFO_COUNT, count); - return static_cast<int64_t>(hostinfo.max_mem); + return hostinfo.max_mem; } // static -int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { +uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { SystemMemoryInfoKB info; if (!GetSystemMemoryInfo(&info)) return 0; // We should add inactive file-backed memory also but there is no such // information from Mac OS unfortunately. - return static_cast<int64_t>(info.free + info.speculative) * 1024; + return checked_cast<uint64_t>(info.free + info.speculative) * 1024; } // static
diff --git a/base/system/sys_info_openbsd.cc b/base/system/sys_info_openbsd.cc index 8849960..a32f06ee 100644 --- a/base/system/sys_info_openbsd.cc +++ b/base/system/sys_info_openbsd.cc
@@ -14,14 +14,12 @@ namespace { -int64_t AmountOfMemory(int pages_name) { +uint64_t AmountOfMemory(int pages_name) { long pages = sysconf(pages_name); long page_size = sysconf(_SC_PAGESIZE); - if (pages == -1 || page_size == -1) { - NOTREACHED(); + if (pages < 0 || page_size < 0) return 0; - } - return static_cast<int64_t>(pages) * page_size; + return static_cast<uint64_t>(pages) * static_cast<uint64_t>(page_size); } } // namespace @@ -41,12 +39,12 @@ } // static -int64_t SysInfo::AmountOfPhysicalMemoryImpl() { +uint64_t SysInfo::AmountOfPhysicalMemoryImpl() { return AmountOfMemory(_SC_PHYS_PAGES); } // static -int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { +uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { // We should add inactive file-backed memory also but there is no such // information from OpenBSD unfortunately. return AmountOfMemory(_SC_AVPHYS_PAGES);
diff --git a/base/system/sys_info_posix.cc b/base/system/sys_info_posix.cc index 7495c4c5..7ae2d021 100644 --- a/base/system/sys_info_posix.cc +++ b/base/system/sys_info_posix.cc
@@ -17,6 +17,7 @@ #include "base/files/file_util.h" #include "base/lazy_instance.h" #include "base/notreached.h" +#include "base/numerics/safe_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/system/sys_info_internal.h" #include "base/threading/scoped_blocking_call.h" @@ -78,7 +79,7 @@ Leaky g_lazy_number_of_processors = LAZY_INSTANCE_INITIALIZER; #endif // !BUILDFLAG(IS_OPENBSD) -int64_t AmountOfVirtualMemory() { +uint64_t AmountOfVirtualMemory() { struct rlimit limit; int result = getrlimit(RLIMIT_DATA, &limit); if (result != 0) { @@ -89,7 +90,7 @@ } base::LazyInstance< - base::internal::LazySysInfoValue<int64_t, AmountOfVirtualMemory>>::Leaky + base::internal::LazySysInfoValue<uint64_t, AmountOfVirtualMemory>>::Leaky g_lazy_virtual_memory = LAZY_INSTANCE_INITIALIZER; #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) @@ -127,13 +128,14 @@ *available_bytes = zero_size_means_unlimited ? std::numeric_limits<int64_t>::max() - : static_cast<int64_t>(stats.f_bavail) * stats.f_frsize; + : base::checked_cast<int64_t>(stats.f_bavail * stats.f_frsize); } if (total_bytes) { - *total_bytes = zero_size_means_unlimited - ? std::numeric_limits<int64_t>::max() - : static_cast<int64_t>(stats.f_blocks) * stats.f_frsize; + *total_bytes = + zero_size_means_unlimited + ? std::numeric_limits<int64_t>::max() + : base::checked_cast<int64_t>(stats.f_blocks * stats.f_frsize); } return true; } @@ -149,7 +151,7 @@ #endif // !BUILDFLAG(IS_OPENBSD) // static -int64_t SysInfo::AmountOfVirtualMemory() { +uint64_t SysInfo::AmountOfVirtualMemory() { return g_lazy_virtual_memory.Get().value(); } @@ -245,7 +247,7 @@ // static size_t SysInfo::VMAllocationGranularity() { - return getpagesize(); + return checked_cast<size_t>(getpagesize()); } } // namespace base
diff --git a/base/system/sys_info_unittest.cc b/base/system/sys_info_unittest.cc index 226ef8c2..6f10cf04 100644 --- a/base/system/sys_info_unittest.cc +++ b/base/system/sys_info_unittest.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/environment.h" #include "base/files/file_util.h" +#include "base/numerics/safe_conversions.h" #include "base/process/process_metrics.h" #include "base/run_loop.h" #include "base/strings/pattern.h" @@ -57,10 +58,10 @@ TEST_F(SysInfoTest, AmountOfMem) { // We aren't actually testing that it's correct, just that it's sane. - EXPECT_GT(SysInfo::AmountOfPhysicalMemory(), 0); + EXPECT_GT(SysInfo::AmountOfPhysicalMemory(), 0u); EXPECT_GT(SysInfo::AmountOfPhysicalMemoryMB(), 0); // The maxmimal amount of virtual memory can be zero which means unlimited. - EXPECT_GE(SysInfo::AmountOfVirtualMemory(), 0); + EXPECT_GE(SysInfo::AmountOfVirtualMemory(), 0u); } #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) @@ -78,7 +79,7 @@ if (info.available != 0) { // If there is MemAvailable from kernel. EXPECT_LT(info.available, info.total); - const int64_t amount = SysInfo::AmountOfAvailablePhysicalMemory(info); + const uint64_t amount = SysInfo::AmountOfAvailablePhysicalMemory(info); // We aren't actually testing that it's correct, just that it's sane. // Available memory is |free - reserved + reclaimable (inactive, non-free)|. // On some android platforms, reserved is a substantial portion. @@ -88,17 +89,17 @@ #else info.free; #endif // BUILDFLAG(IS_ANDROID) - EXPECT_GT(amount, static_cast<int64_t>(available) * 1024); - EXPECT_LT(amount / 1024, info.available); + EXPECT_GT(amount, checked_cast<uint64_t>(available) * 1024); + EXPECT_LT(amount / 1024, checked_cast<uint64_t>(info.available)); // Simulate as if there is no MemAvailable. info.available = 0; } // There is no MemAvailable. Check the fallback logic. - const int64_t amount = SysInfo::AmountOfAvailablePhysicalMemory(info); + const uint64_t amount = SysInfo::AmountOfAvailablePhysicalMemory(info); // We aren't actually testing that it's correct, just that it's sane. - EXPECT_GT(amount, static_cast<int64_t>(info.free) * 1024); - EXPECT_LT(amount / 1024, info.total); + EXPECT_GT(amount, checked_cast<uint64_t>(info.free) * 1024); + EXPECT_LT(amount / 1024, checked_cast<uint64_t>(info.total)); } #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || // BUILDFLAG(IS_ANDROID)
diff --git a/base/system/sys_info_win.cc b/base/system/sys_info_win.cc index dd0cc51..c881ca5 100644 --- a/base/system/sys_info_win.cc +++ b/base/system/sys_info_win.cc
@@ -13,6 +13,7 @@ #include "base/check.h" #include "base/files/file_path.h" #include "base/notreached.h" +#include "base/numerics/safe_conversions.h" #include "base/process/process_metrics.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" @@ -24,7 +25,7 @@ namespace { -int64_t AmountOfMemory(DWORDLONG MEMORYSTATUSEX::*memory_field) { +uint64_t AmountOfMemory(DWORDLONG MEMORYSTATUSEX::*memory_field) { MEMORYSTATUSEX memory_info; memory_info.dwLength = sizeof(memory_info); if (!GlobalMemoryStatusEx(&memory_info)) { @@ -32,8 +33,7 @@ return 0; } - int64_t rv = static_cast<int64_t>(memory_info.*memory_field); - return rv < 0 ? std::numeric_limits<int64_t>::max() : rv; + return memory_info.*memory_field; } bool GetDiskSpaceInfo(const base::FilePath& path, @@ -68,20 +68,20 @@ } // static -int64_t SysInfo::AmountOfPhysicalMemoryImpl() { +uint64_t SysInfo::AmountOfPhysicalMemoryImpl() { return AmountOfMemory(&MEMORYSTATUSEX::ullTotalPhys); } // static -int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { +uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { SystemMemoryInfoKB info; if (!GetSystemMemoryInfo(&info)) return 0; - return static_cast<int64_t>(info.avail_phys) * 1024; + return checked_cast<uint64_t>(info.avail_phys) * 1024; } // static -int64_t SysInfo::AmountOfVirtualMemory() { +uint64_t SysInfo::AmountOfVirtualMemory() { return AmountOfMemory(&MEMORYSTATUSEX::ullTotalVirtual); }
diff --git a/base/third_party/nspr/prtime.cc b/base/third_party/nspr/prtime.cc index 88fe1eba5..5d36b5b 100644 --- a/base/third_party/nspr/prtime.cc +++ b/base/third_party/nspr/prtime.cc
@@ -1165,9 +1165,9 @@ #endif if (secs != (time_t) -1) { - *result_imploded = (PRInt64)secs * PR_USEC_PER_SEC; - *result_imploded += result->tm_usec; - return PR_SUCCESS; + *result_imploded = secs * (PRTime)PR_USEC_PER_SEC; + *result_imploded += result->tm_usec; + return PR_SUCCESS; } }
diff --git a/base/threading/hang_watcher.cc b/base/threading/hang_watcher.cc index 8f38b8a8..4d65101 100644 --- a/base/threading/hang_watcher.cc +++ b/base/threading/hang_watcher.cc
@@ -740,7 +740,7 @@ // Emit trace events for monitored threads. if (ThreadTypeLoggingLevelGreaterOrEqual(watch_state.get()->thread_type(), LoggingLevel::kUmaOnly)) { - const uint64_t thread_id = watch_state.get()->GetThreadID(); + const PlatformThreadId thread_id = watch_state.get()->GetThreadID(); const auto track = perfetto::Track::FromPointer( this, perfetto::ThreadTrack::ForThread(thread_id)); TRACE_EVENT_BEGIN("base", "HangWatcher::ThreadHung", track, deadline); @@ -758,9 +758,8 @@ // the next capture then they'll already be marked and will be included // in the capture at that time. if (thread_marked && all_threads_marked) { - hung_watch_state_copies_.push_back(WatchStateCopy{ - deadline, - static_cast<PlatformThreadId>(watch_state.get()->GetThreadID())}); + hung_watch_state_copies_.push_back( + WatchStateCopy{deadline, watch_state.get()->GetThreadID()}); } else { all_threads_marked = false; } @@ -1172,7 +1171,9 @@ // provided by PlatformThread. Make sure to use the same for correct // attribution. #if BUILDFLAG(IS_MAC) - pthread_threadid_np(pthread_self(), &thread_id_); + uint64_t thread_id; + pthread_threadid_np(pthread_self(), &thread_id); + thread_id_ = thread_id; #else thread_id_ = PlatformThread::CurrentId(); #endif @@ -1275,7 +1276,7 @@ return hang_watch_state.get(); } -uint64_t HangWatchState::GetThreadID() const { +PlatformThreadId HangWatchState::GetThreadID() const { return thread_id_; }
diff --git a/base/threading/hang_watcher.h b/base/threading/hang_watcher.h index a2a557c4..4f3bf2b24 100644 --- a/base/threading/hang_watcher.h +++ b/base/threading/hang_watcher.h
@@ -625,7 +625,7 @@ WatchHangsInScope* GetCurrentWatchHangsInScope(); #endif - uint64_t GetThreadID() const; + PlatformThreadId GetThreadID() const; // Retrieve the current hang watch deadline directly. For testing only. HangWatchDeadline* GetHangWatchDeadlineForTesting(); @@ -652,9 +652,8 @@ HangWatchDeadline deadline_; // A unique ID of the thread under watch. Used for logging in crash reports - // only. Unsigned type is used as it provides a correct behavior for all - // platforms for positive thread ids. Any valid thread id should be positive. - uint64_t thread_id_; + // only. + PlatformThreadId thread_id_; // Number of active HangWatchScopeEnables on this thread. int nesting_level_ = 0;
diff --git a/base/threading/platform_thread_linux.cc b/base/threading/platform_thread_linux.cc index 48f2670..27c0fd01 100644 --- a/base/threading/platform_thread_linux.cc +++ b/base/threading/platform_thread_linux.cc
@@ -164,8 +164,10 @@ const FilePath& cgroup_directory) { FilePath tasks_filepath = cgroup_directory.Append(FILE_PATH_LITERAL("tasks")); std::string tid = NumberToString(thread_id); - int bytes_written = WriteFile(tasks_filepath, tid.c_str(), tid.size()); - if (bytes_written != static_cast<int>(tid.size())) { + // TODO(crbug.com/1333521): Remove cast. + const int size = static_cast<int>(tid.size()); + int bytes_written = WriteFile(tasks_filepath, tid.data(), size); + if (bytes_written != size) { DVLOG(1) << "Failed to add " << tid << " to " << tasks_filepath.value(); } } @@ -412,7 +414,7 @@ #endif const int nice_setting = internal::ThreadTypeToNiceValue(thread_type); - if (setpriority(PRIO_PROCESS, thread_id, nice_setting)) { + if (setpriority(PRIO_PROCESS, static_cast<id_t>(thread_id), nice_setting)) { DVPLOG(1) << "Failed to set nice value of thread (" << thread_id << ") to " << nice_setting; }
diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc index 23e18d1..418efcb 100644 --- a/base/threading/platform_thread_posix.cc +++ b/base/threading/platform_thread_posix.cc
@@ -220,7 +220,7 @@ (g_is_main_thread && !g_main_thread_tid_cache_valid.load(std::memory_order_relaxed))) { // Update the cached tid. - g_thread_id = syscall(__NR_gettid); + g_thread_id = static_cast<pid_t>(syscall(__NR_gettid)); // If this is the main thread, we can mark the tid_cache as valid. // Otherwise, stop the current thread from always entering this slow path. if (g_thread_id == getpid()) {
diff --git a/base/time/time_exploded_posix.cc b/base/time/time_exploded_posix.cc index 45327a8..a2562a9 100644 --- a/base/time/time_exploded_posix.cc +++ b/base/time/time_exploded_posix.cc
@@ -158,7 +158,7 @@ exploded->hour = timestruct.tm_hour; exploded->minute = timestruct.tm_min; exploded->second = timestruct.tm_sec; - exploded->millisecond = millisecond; + exploded->millisecond = static_cast<int>(millisecond); } // static
diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc index 7c30c56..69251d6 100644 --- a/base/trace_event/malloc_dump_provider.cc +++ b/base/trace_event/malloc_dump_provider.cc
@@ -16,6 +16,7 @@ #include "base/format_macros.h" #include "base/memory/nonscannable_memory.h" #include "base/metrics/histogram_functions.h" +#include "base/numerics/safe_conversions.h" #include "base/strings/stringprintf.h" #include "base/trace_event/process_memory_dump.h" #include "base/trace_event/traced_value.h" @@ -184,7 +185,7 @@ #if (BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && BUILDFLAG(IS_ANDROID)) || \ (!BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && !BUILDFLAG(IS_WIN) && \ - !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_FUCHSIA)) + !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_FUCHSIA)) void ReportMallinfoStats(ProcessMemoryDump* pmd, size_t* total_virtual_size, size_t* resident_size, @@ -203,17 +204,19 @@ // In case of Android's jemalloc |arena| is 0 and the outer pages size is // reported by |hblkhd|. In case of dlmalloc the total is given by // |arena| + |hblkhd|. For more details see link: http://goo.gl/fMR8lF. - *total_virtual_size += info.arena + info.hblkhd; - *resident_size += info.uordblks; + *total_virtual_size += checked_cast<size_t>(info.arena + info.hblkhd); + size_t total_allocated_size = checked_cast<size_t>(info.uordblks); + *resident_size += total_allocated_size; // Total allocated space is given by |uordblks|. - *allocated_objects_size += info.uordblks; + *allocated_objects_size += total_allocated_size; if (pmd) { MemoryAllocatorDump* sys_alloc_dump = pmd->CreateAllocatorDump("malloc/sys_malloc"); sys_alloc_dump->AddScalar(MemoryAllocatorDump::kNameSize, - MemoryAllocatorDump::kUnitsBytes, info.uordblks); + MemoryAllocatorDump::kUnitsBytes, + total_allocated_size); } } #endif
diff --git a/base/trace_event/trace_log.cc b/base/trace_event/trace_log.cc index f9f27c1..fb951928 100644 --- a/base/trace_event/trace_log.cc +++ b/base/trace_event/trace_log.cc
@@ -2208,7 +2208,7 @@ // See http://isthe.com/chongo/tech/comp/fnv/ for algorithm details. const uint64_t kOffsetBasis = 14695981039346656037ull; const uint64_t kFnvPrime = 1099511628211ull; - const uint64_t pid = process_id_; + const uint64_t pid = static_cast<uint64_t>(process_id_); process_id_hash_ = (kOffsetBasis ^ pid) * kFnvPrime; }
diff --git a/cc/paint/filter_operations_unittest.cc b/cc/paint/filter_operations_unittest.cc index 54fe835..7371522 100644 --- a/cc/paint/filter_operations_unittest.cc +++ b/cc/paint/filter_operations_unittest.cc
@@ -54,7 +54,7 @@ ops.Append( FilterOperation::CreateReferenceFilter(sk_make_sp<DropShadowPaintFilter>( SkIntToScalar(3), SkIntToScalar(8), SkIntToScalar(4), - SkIntToScalar(9), SK_ColorBLACK, + SkIntToScalar(9), SkColors::kBlack, DropShadowPaintFilter::ShadowMode::kDrawShadowAndForeground, nullptr))); EXPECT_EQ(gfx::Rect(-9, -19, 34, 64), @@ -70,7 +70,7 @@ ops.Append( FilterOperation::CreateReferenceFilter(sk_make_sp<DropShadowPaintFilter>( SkIntToScalar(3), SkIntToScalar(8), SkIntToScalar(4), - SkIntToScalar(9), SK_ColorBLACK, + SkIntToScalar(9), SkColors::kBlack, DropShadowPaintFilter::ShadowMode::kDrawShadowAndForeground, nullptr))); EXPECT_EQ(gfx::Rect(-15, -35, 34, 64),
diff --git a/cc/paint/paint_filter.cc b/cc/paint/paint_filter.cc index 9be014d..be1ffb0 100644 --- a/cc/paint/paint_filter.cc +++ b/cc/paint/paint_filter.cc
@@ -538,7 +538,7 @@ SkScalar dy, SkScalar sigma_x, SkScalar sigma_y, - SkColor color, + SkColor4f color, ShadowMode shadow_mode, sk_sp<PaintFilter> input, const CropRect* crop_rect) @@ -551,13 +551,15 @@ shadow_mode_(shadow_mode), input_(std::move(input)) { if (shadow_mode == ShadowMode::kDrawShadowOnly) { - cached_sk_filter_ = - SkImageFilters::DropShadowOnly(dx_, dy_, sigma_x_, sigma_y_, color_, - GetSkFilter(input_.get()), crop_rect); + // TODO(crbug/1308932): Remove toSkColor and make all SkColor4f. + cached_sk_filter_ = SkImageFilters::DropShadowOnly( + dx_, dy_, sigma_x_, sigma_y_, color_.toSkColor(), + GetSkFilter(input_.get()), crop_rect); } else { - cached_sk_filter_ = - SkImageFilters::DropShadow(dx_, dy_, sigma_x_, sigma_y_, color_, - GetSkFilter(input_.get()), crop_rect); + // TODO(crbug/1308932): Remove toSkColor and make all SkColor4f. + cached_sk_filter_ = SkImageFilters::DropShadow( + dx_, dy_, sigma_x_, sigma_y_, color_.toSkColor(), + GetSkFilter(input_.get()), crop_rect); } } @@ -1290,9 +1292,10 @@ if (alpha < 255) { // The blend effectively produces (shader * alpha), the rgb of the secondary // color are ignored. - SkColor color = SkColorSetARGB(alpha, 255, 255, 255); + SkColor4f color{1.0f, 1.0f, 1.0f, alpha / 255.0f}; + // TODO(crbug/1308932): Remove toSkColor and make all SkColor4f. sk_shader = SkShaders::Blend(SkBlendMode::kDstIn, std::move(sk_shader), - SkShaders::Color(color)); + SkShaders::Color(color.toSkColor())); } cached_sk_filter_ = @@ -1376,7 +1379,7 @@ LightingDistantPaintFilter::LightingDistantPaintFilter( LightingType lighting_type, const SkPoint3& direction, - SkColor light_color, + SkColor4f light_color, SkScalar surface_scale, SkScalar kconstant, SkScalar shininess, @@ -1392,14 +1395,16 @@ input_(std::move(input)) { switch (lighting_type_) { case LightingType::kDiffuse: + // TODO(crbug/1308932): Remove toSkColor and make all SkColor4f. cached_sk_filter_ = SkImageFilters::DistantLitDiffuse( - direction_, light_color_, surface_scale_, kconstant_, + direction_, light_color_.toSkColor(), surface_scale_, kconstant_, GetSkFilter(input_.get()), crop_rect); break; case LightingType::kSpecular: + // TODO(crbug/1308932): Remove toSkColor and make all SkColor4f. cached_sk_filter_ = SkImageFilters::DistantLitSpecular( - direction_, light_color_, surface_scale_, kconstant_, shininess_, - GetSkFilter(input_.get()), crop_rect); + direction_, light_color_.toSkColor(), surface_scale_, kconstant_, + shininess_, GetSkFilter(input_.get()), crop_rect); break; } } @@ -1435,7 +1440,7 @@ LightingPointPaintFilter::LightingPointPaintFilter(LightingType lighting_type, const SkPoint3& location, - SkColor light_color, + SkColor4f light_color, SkScalar surface_scale, SkScalar kconstant, SkScalar shininess, @@ -1451,14 +1456,16 @@ input_(std::move(input)) { switch (lighting_type_) { case LightingType::kDiffuse: + // TODO(crbug/1308932): Remove toSkColor and make all SkColor4f. cached_sk_filter_ = SkImageFilters::PointLitDiffuse( - location_, light_color_, surface_scale_, kconstant_, + location_, light_color_.toSkColor(), surface_scale_, kconstant_, GetSkFilter(input_.get()), crop_rect); break; case LightingType::kSpecular: + // TODO(crbug/1308932): Remove toSkColor and make all SkColor4f. cached_sk_filter_ = SkImageFilters::PointLitSpecular( - location_, light_color_, surface_scale_, kconstant_, shininess_, - GetSkFilter(input_.get()), crop_rect); + location_, light_color_.toSkColor(), surface_scale_, kconstant_, + shininess_, GetSkFilter(input_.get()), crop_rect); break; } } @@ -1497,7 +1504,7 @@ const SkPoint3& target, SkScalar specular_exponent, SkScalar cutoff_angle, - SkColor light_color, + SkColor4f light_color, SkScalar surface_scale, SkScalar kconstant, SkScalar shininess, @@ -1516,15 +1523,18 @@ input_(std::move(input)) { switch (lighting_type_) { case LightingType::kDiffuse: + // TODO(crbug/1308932): Remove toSkColor and make all SkColor4f. cached_sk_filter_ = SkImageFilters::SpotLitDiffuse( - location_, target_, specular_exponent_, cutoff_angle_, light_color_, - surface_scale_, kconstant_, GetSkFilter(input_.get()), crop_rect); + location_, target_, specular_exponent_, cutoff_angle_, + light_color_.toSkColor(), surface_scale_, kconstant_, + GetSkFilter(input_.get()), crop_rect); break; case LightingType::kSpecular: + // TODO(crbug/1308932): Remove toSkColor and make all SkColor4f. cached_sk_filter_ = SkImageFilters::SpotLitSpecular( - location_, target_, specular_exponent_, cutoff_angle_, light_color_, - surface_scale_, kconstant_, shininess_, GetSkFilter(input_.get()), - crop_rect); + location_, target_, specular_exponent_, cutoff_angle_, + light_color_.toSkColor(), surface_scale_, kconstant_, shininess_, + GetSkFilter(input_.get()), crop_rect); break; } }
diff --git a/cc/paint/paint_filter.h b/cc/paint/paint_filter.h index 8a82611..7cd1a3d 100644 --- a/cc/paint/paint_filter.h +++ b/cc/paint/paint_filter.h
@@ -220,7 +220,7 @@ SkScalar dy, SkScalar sigma_x, SkScalar sigma_y, - SkColor color, + SkColor4f color, ShadowMode shadow_mode, sk_sp<PaintFilter> input, const CropRect* crop_rect = nullptr); @@ -230,7 +230,7 @@ SkScalar dy() const { return dy_; } SkScalar sigma_x() const { return sigma_x_; } SkScalar sigma_y() const { return sigma_y_; } - SkColor color() const { return color_; } + SkColor4f color() const { return color_; } ShadowMode shadow_mode() const { return shadow_mode_; } const sk_sp<PaintFilter>& input() const { return input_; } @@ -246,7 +246,7 @@ SkScalar dy_; SkScalar sigma_x_; SkScalar sigma_y_; - SkColor color_; + SkColor4f color_; ShadowMode shadow_mode_; sk_sp<PaintFilter> input_; }; @@ -754,7 +754,7 @@ // For specular lighting type only, shininess denotes the specular exponent. LightingDistantPaintFilter(LightingType lighting_type, const SkPoint3& direction, - SkColor light_color, + SkColor4f light_color, SkScalar surface_scale, SkScalar kconstant, SkScalar shininess, @@ -764,7 +764,7 @@ LightingType lighting_type() const { return lighting_type_; } const SkPoint3& direction() const { return direction_; } - SkColor light_color() const { return light_color_; } + SkColor4f light_color() const { return light_color_; } SkScalar surface_scale() const { return surface_scale_; } SkScalar kconstant() const { return kconstant_; } SkScalar shininess() const { return shininess_; } @@ -780,7 +780,7 @@ private: LightingType lighting_type_; SkPoint3 direction_; - SkColor light_color_; + SkColor4f light_color_; SkScalar surface_scale_; SkScalar kconstant_; SkScalar shininess_; @@ -795,7 +795,7 @@ // For specular lighting type only, shininess denotes the specular exponent. LightingPointPaintFilter(LightingType lighting_type, const SkPoint3& location, - SkColor light_color, + SkColor4f light_color, SkScalar surface_scale, SkScalar kconstant, SkScalar shininess, @@ -805,7 +805,7 @@ LightingType lighting_type() const { return lighting_type_; } const SkPoint3& location() const { return location_; } - SkColor light_color() const { return light_color_; } + SkColor4f light_color() const { return light_color_; } SkScalar surface_scale() const { return surface_scale_; } SkScalar kconstant() const { return kconstant_; } SkScalar shininess() const { return shininess_; } @@ -821,7 +821,7 @@ private: LightingType lighting_type_; SkPoint3 location_; - SkColor light_color_; + SkColor4f light_color_; SkScalar surface_scale_; SkScalar kconstant_; SkScalar shininess_; @@ -839,7 +839,7 @@ const SkPoint3& target, SkScalar specular_exponent, SkScalar cutoff_angle, - SkColor light_color, + SkColor4f light_color, SkScalar surface_scale, SkScalar kconstant, SkScalar shininess, @@ -852,7 +852,7 @@ const SkPoint3& target() const { return target_; } SkScalar specular_exponent() const { return specular_exponent_; } SkScalar cutoff_angle() const { return cutoff_angle_; } - SkColor light_color() const { return light_color_; } + SkColor4f light_color() const { return light_color_; } SkScalar surface_scale() const { return surface_scale_; } SkScalar kconstant() const { return kconstant_; } SkScalar shininess() const { return shininess_; } @@ -871,7 +871,7 @@ SkPoint3 target_; SkScalar specular_exponent_; SkScalar cutoff_angle_; - SkColor light_color_; + SkColor4f light_color_; SkScalar surface_scale_; SkScalar kconstant_; SkScalar shininess_;
diff --git a/cc/paint/paint_filter_unittest.cc b/cc/paint/paint_filter_unittest.cc index a25d3fd..a075980 100644 --- a/cc/paint/paint_filter_unittest.cc +++ b/cc/paint/paint_filter_unittest.cc
@@ -59,7 +59,7 @@ record_filter, &crop_rect); case PaintFilter::Type::kDropShadow: return sk_make_sp<DropShadowPaintFilter>( - 0.1, 0.2f, 0.3f, 0.4f, SK_ColorWHITE, + 0.1, 0.2f, 0.3f, 0.4f, SkColors::kWhite, DropShadowPaintFilter::ShadowMode::kDrawShadowOnly, image_filter, &crop_rect); case PaintFilter::Type::kMagnifier: @@ -124,15 +124,15 @@ case PaintFilter::Type::kLightingDistant: return sk_make_sp<LightingDistantPaintFilter>( PaintFilter::LightingType::kDiffuse, SkPoint3::Make(0.1f, 0.2f, 0.3f), - SK_ColorWHITE, 0.1f, 0.2f, 0.3f, image_filter, &crop_rect); + SkColors::kWhite, 0.1f, 0.2f, 0.3f, image_filter, &crop_rect); case PaintFilter::Type::kLightingPoint: return sk_make_sp<LightingPointPaintFilter>( PaintFilter::LightingType::kDiffuse, SkPoint3::Make(0.1f, 0.2f, 0.3f), - SK_ColorWHITE, 0.1f, 0.2f, 0.3f, record_filter, &crop_rect); + SkColors::kWhite, 0.1f, 0.2f, 0.3f, record_filter, &crop_rect); case PaintFilter::Type::kLightingSpot: return sk_make_sp<LightingSpotPaintFilter>( PaintFilter::LightingType::kDiffuse, SkPoint3::Make(0.1f, 0.2f, 0.3f), - SkPoint3::Make(0.4f, 0.5f, 0.6f), 0.1f, 0.2f, SK_ColorWHITE, 0.4f, + SkPoint3::Make(0.4f, 0.5f, 0.6f), 0.1f, 0.2f, SkColors::kWhite, 0.4f, 0.5f, 0.6f, image_filter, &crop_rect); case PaintFilter::Type::kStretch: return sk_make_sp<StretchPaintFilter>(0.1f, 0.2f, 100.f, 200.f,
diff --git a/cc/paint/paint_op_buffer_unittest.cc b/cc/paint/paint_op_buffer_unittest.cc index 31f99d6..82ec8b2 100644 --- a/cc/paint/paint_op_buffer_unittest.cc +++ b/cc/paint/paint_op_buffer_unittest.cc
@@ -3387,7 +3387,7 @@ sk_sp<PaintFilter>{ new BlurPaintFilter(0.5f, 0.3f, SkTileMode::kRepeat, nullptr)}, sk_sp<PaintFilter>{new DropShadowPaintFilter( - 5.f, 10.f, 0.1f, 0.3f, SK_ColorBLUE, + 5.f, 10.f, 0.1f, 0.3f, SkColors::kBlue, DropShadowPaintFilter::ShadowMode::kDrawShadowOnly, nullptr)}, sk_sp<PaintFilter>{new MagnifierPaintFilter(SkRect::MakeXYWH(5, 6, 7, 8), 10.5f, nullptr)}, @@ -3408,13 +3408,13 @@ SkMatrix::I(), PaintFlags::FilterQuality::kHigh, nullptr)}, sk_sp<PaintFilter>{new LightingDistantPaintFilter( PaintFilter::LightingType::kSpecular, SkPoint3::Make(1, 2, 3), - SK_ColorCYAN, 1.1f, 2.2f, 3.3f, nullptr)}, + SkColors::kCyan, 1.1f, 2.2f, 3.3f, nullptr)}, sk_sp<PaintFilter>{new LightingPointPaintFilter( PaintFilter::LightingType::kDiffuse, SkPoint3::Make(2, 3, 4), - SK_ColorRED, 1.2f, 3.4f, 5.6f, nullptr)}, + SkColors::kRed, 1.2f, 3.4f, 5.6f, nullptr)}, sk_sp<PaintFilter>{new LightingSpotPaintFilter( PaintFilter::LightingType::kSpecular, SkPoint3::Make(100, 200, 300), - SkPoint3::Make(400, 500, 600), 1, 2, SK_ColorMAGENTA, 3, 4, 5, + SkPoint3::Make(400, 500, 600), 1, 2, SkColors::kMagenta, 3, 4, 5, nullptr)}, sk_sp<PaintFilter>{ new ImagePaintFilter(CreateDiscardablePaintImage(gfx::Size(100, 100)),
diff --git a/cc/paint/paint_op_reader.cc b/cc/paint/paint_op_reader.cc index 2627822..88ad5a8 100644 --- a/cc/paint/paint_op_reader.cc +++ b/cc/paint/paint_op_reader.cc
@@ -917,12 +917,12 @@ Read(&color); ReadEnum(&shadow_mode); Read(&input); - if (!valid_) return; - filter->reset(new DropShadowPaintFilter(dx, dy, sigma_x, sigma_y, color, - shadow_mode, std::move(input), - base::OptionalOrNullptr(crop_rect))); + // TODO(crbug/1308932): Remove FromColor and make all SkColor4f. + filter->reset(new DropShadowPaintFilter( + dx, dy, sigma_x, sigma_y, SkColor4f::FromColor(color), shadow_mode, + std::move(input), base::OptionalOrNullptr(crop_rect))); } void PaintOpReader::ReadMagnifierPaintFilter( @@ -1296,9 +1296,11 @@ Read(&input); if (!valid_) return; + // TODO(crbug/1308932): Remove FromColor and make all SkColor4f. filter->reset(new LightingDistantPaintFilter( - lighting_type, direction, light_color, surface_scale, kconstant, - shininess, std::move(input), base::OptionalOrNullptr(crop_rect))); + lighting_type, direction, SkColor4f::FromColor(light_color), + surface_scale, kconstant, shininess, std::move(input), + base::OptionalOrNullptr(crop_rect))); } void PaintOpReader::ReadLightingPointPaintFilter( @@ -1321,9 +1323,11 @@ Read(&input); if (!valid_) return; + // TODO(crbug/1308932): Remove FromColor and make all SkColor4f. filter->reset(new LightingPointPaintFilter( - lighting_type, location, light_color, surface_scale, kconstant, shininess, - std::move(input), base::OptionalOrNullptr(crop_rect))); + lighting_type, location, SkColor4f::FromColor(light_color), surface_scale, + kconstant, shininess, std::move(input), + base::OptionalOrNullptr(crop_rect))); } void PaintOpReader::ReadLightingSpotPaintFilter( @@ -1353,10 +1357,11 @@ if (!valid_) return; + // TODO(crbug/1308932): Remove FromColor and make all SkColor4f. filter->reset(new LightingSpotPaintFilter( lighting_type, location, target, specular_exponent, cutoff_angle, - light_color, surface_scale, kconstant, shininess, std::move(input), - base::OptionalOrNullptr(crop_rect))); + SkColor4f::FromColor(light_color), surface_scale, kconstant, shininess, + std::move(input), base::OptionalOrNullptr(crop_rect))); } void PaintOpReader::ReadStretchPaintFilter(
diff --git a/cc/paint/paint_op_writer.cc b/cc/paint/paint_op_writer.cc index f899b75..648095a 100644 --- a/cc/paint/paint_op_writer.cc +++ b/cc/paint/paint_op_writer.cc
@@ -715,7 +715,8 @@ WriteSimple(filter.dy()); WriteSimple(filter.sigma_x()); WriteSimple(filter.sigma_y()); - WriteSimple(filter.color()); + // TODO(crbug/1308932): Remove toSkColor and make all SkColor4f. + WriteSimple(filter.color().toSkColor()); WriteEnum(filter.shadow_mode()); Write(filter.input().get(), current_ctm); } @@ -879,7 +880,8 @@ const SkM44& current_ctm) { WriteEnum(filter.lighting_type()); WriteSimple(filter.direction()); - WriteSimple(filter.light_color()); + // TODO(crbug/1308932): Remove toSkColor and make all SkColor4f. + WriteSimple(filter.light_color().toSkColor()); WriteSimple(filter.surface_scale()); WriteSimple(filter.kconstant()); WriteSimple(filter.shininess()); @@ -890,7 +892,8 @@ const SkM44& current_ctm) { WriteEnum(filter.lighting_type()); WriteSimple(filter.location()); - WriteSimple(filter.light_color()); + // TODO(crbug/1308932): Remove toSkColor and make all SkColor4f. + WriteSimple(filter.light_color().toSkColor()); WriteSimple(filter.surface_scale()); WriteSimple(filter.kconstant()); WriteSimple(filter.shininess()); @@ -904,7 +907,8 @@ WriteSimple(filter.target()); WriteSimple(filter.specular_exponent()); WriteSimple(filter.cutoff_angle()); - WriteSimple(filter.light_color()); + // TODO(crbug/1308932): Remove toSkColor and make all SkColor4f. + WriteSimple(filter.light_color().toSkColor()); WriteSimple(filter.surface_scale()); WriteSimple(filter.kconstant()); WriteSimple(filter.shininess());
diff --git a/cc/paint/render_surface_filters.cc b/cc/paint/render_surface_filters.cc index fde3c82a..43a4655 100644 --- a/cc/paint/render_surface_filters.cc +++ b/cc/paint/render_surface_filters.cc
@@ -198,11 +198,12 @@ std::move(image_filter)); break; case FilterOperation::DROP_SHADOW: + // TODO(crbug/1308932): Remove FromColor and make all SkColor4f. image_filter = sk_make_sp<DropShadowPaintFilter>( SkIntToScalar(op.drop_shadow_offset().x()), SkIntToScalar(op.drop_shadow_offset().y()), SkIntToScalar(op.amount()), SkIntToScalar(op.amount()), - op.drop_shadow_color(), + SkColor4f::FromColor(op.drop_shadow_color()), DropShadowPaintFilter::ShadowMode::kDrawShadowAndForeground, std::move(image_filter)); break;
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index f7b3928..f7f7780 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -496,6 +496,7 @@ "//components/browser_ui/webshare/android:java", "//components/browser_ui/widget/android:java", "//components/commerce/core:proto_java", + "//components/commerce/core/android:core_java", "//components/component_updater/android:background_task_update_scheduler_java", "//components/content_capture/android:java", "//components/content_settings/android:content_settings_enums_java",
diff --git a/chrome/android/chrome_java_resources.gni b/chrome/android/chrome_java_resources.gni index b133b84..75f76b1 100644 --- a/chrome/android/chrome_java_resources.gni +++ b/chrome/android/chrome_java_resources.gni
@@ -12,7 +12,6 @@ "java/res/anim/activity_close_exit.xml", "java/res/anim/activity_open_enter.xml", "java/res/anim/decelerate_quart.xml", - "java/res/anim/fast_out_extra_slow_in_interpolator.xml", "java/res/anim/fast_out_slow_in_interpolator.xml", "java/res/anim/slide_in_up.xml", "java/res/anim/stay_hidden.xml",
diff --git a/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/start_surface/TabSwitcherAndStartSurfaceLayout.java b/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/start_surface/TabSwitcherAndStartSurfaceLayout.java index 662f0f5..0b53caa 100644 --- a/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/start_surface/TabSwitcherAndStartSurfaceLayout.java +++ b/chrome/android/features/start_surface/java/src/org/chromium/chrome/features/start_surface/TabSwitcherAndStartSurfaceLayout.java
@@ -18,7 +18,6 @@ import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; -import androidx.vectordrawable.graphics.drawable.AnimationUtilsCompat; import org.chromium.base.Log; import org.chromium.base.TraceEvent; @@ -27,7 +26,6 @@ import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordUserAction; import org.chromium.base.supplier.Supplier; -import org.chromium.chrome.R; import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider; import org.chromium.chrome.browser.compositor.layouts.Layout; import org.chromium.chrome.browser.compositor.layouts.LayoutRenderHost; @@ -73,7 +71,7 @@ // Duration of the transition animation public static final long ZOOMING_DURATION = 300; - private static final int TRANSLATE_DURATION_MS = 500; + private static final int TRANSLATE_DURATION_MS = 450; private static final int BACKGROUND_FADING_DURATION_MS = 150; private static final String TRACE_SHOW_TAB_SWITCHER = "StartSurfaceLayout.Show.TabSwitcher"; @@ -618,8 +616,7 @@ Animator translateUp = ObjectAnimator.ofFloat(mStartSurface.getTabSwitcherContainer(), View.TRANSLATION_Y, mStartSurface.getTabSwitcherContainer().getHeight(), 0f); - translateUp.setInterpolator(AnimationUtilsCompat.loadInterpolator( - getContext(), R.anim.fast_out_extra_slow_in_interpolator)); + translateUp.setInterpolator(Interpolators.EMPHASIZED_DECELERATE); translateUp.setDuration(TRANSLATE_DURATION_MS); mTabToSwitcherAnimation = new AnimatorSet(); @@ -654,8 +651,7 @@ Animator translateDown = ObjectAnimator.ofFloat(mStartSurface.getTabSwitcherContainer(), View.TRANSLATION_Y, 0f, mStartSurface.getTabSwitcherContainer().getHeight()); - translateDown.setInterpolator(AnimationUtilsCompat.loadInterpolator( - getContext(), R.anim.fast_out_extra_slow_in_interpolator)); + translateDown.setInterpolator(Interpolators.EMPHASIZED_ACCELERATE); translateDown.setDuration(TRANSLATE_DURATION_MS); mTabToSwitcherAnimation = new AnimatorSet();
diff --git a/chrome/android/features/start_surface/javatests/src/org/chromium/chrome/features/start_surface/InstantStartTest.java b/chrome/android/features/start_surface/javatests/src/org/chromium/chrome/features/start_surface/InstantStartTest.java index be27035..735c40b 100644 --- a/chrome/android/features/start_surface/javatests/src/org/chromium/chrome/features/start_surface/InstantStartTest.java +++ b/chrome/android/features/start_surface/javatests/src/org/chromium/chrome/features/start_surface/InstantStartTest.java
@@ -169,7 +169,8 @@ final Bitmap thumbnailBitmap = StartSurfaceTestUtils.createThumbnailBitmapAndWriteToFile(tabId); - tabContentManager.getTabThumbnailWithCallback(tabId, thumbnailFetchListener, false, false); + tabContentManager.getTabThumbnailWithCallback( + tabId, null, thumbnailFetchListener, false, false); CriteriaHelper.pollInstrumentationThread( () -> Criteria.checkThat(mThumbnailFetchCount, greaterThan(0)));
diff --git a/chrome/android/features/start_surface/javatests/src/org/chromium/chrome/features/start_surface/TabSwitcherAndStartSurfaceLayoutTest.java b/chrome/android/features/start_surface/javatests/src/org/chromium/chrome/features/start_surface/TabSwitcherAndStartSurfaceLayoutTest.java index 7cd2617..049cadc 100644 --- a/chrome/android/features/start_surface/javatests/src/org/chromium/chrome/features/start_surface/TabSwitcherAndStartSurfaceLayoutTest.java +++ b/chrome/android/features/start_surface/javatests/src/org/chromium/chrome/features/start_surface/TabSwitcherAndStartSurfaceLayoutTest.java
@@ -1986,7 +1986,7 @@ TabModel currentModel = mActivityTestRule.getActivity().getCurrentTabModel(); for (int i = 0; i < currentModel.getCount(); i++) { Tab tab = currentModel.getTabAt(i); - Bitmap bitmap = TabContentManager.getJpegForTab(tab.getId()); + Bitmap bitmap = TabContentManager.getJpegForTab(tab.getId(), null); bitmap = Bitmap.createScaledBitmap( bitmap, bitmap.getWidth(), (int) (bitmap.getWidth() * 1.0 / 0.75), false); encodeJpeg(tab, bitmap); @@ -2004,7 +2004,7 @@ TabModel currentModel = mActivityTestRule.getActivity().getCurrentTabModel(); for (int i = 0; i < currentModel.getCount(); i++) { Tab tab = currentModel.getTabAt(i); - Bitmap bitmap = TabContentManager.getJpegForTab(tab.getId()); + Bitmap bitmap = TabContentManager.getJpegForTab(tab.getId(), null); double bitmapRatio = bitmap.getWidth() * 1.0 / bitmap.getHeight(); assertTrue("Actual ratio: " + bitmapRatio + "; Expected ratio: " + ratio, Math.abs(bitmapRatio - ratio) <= TabContentManager.ASPECT_RATIO_PRECISION);
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/MultiThumbnailCardProvider.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/MultiThumbnailCardProvider.java index 39cd8d2..b95fa14 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/MultiThumbnailCardProvider.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/MultiThumbnailCardProvider.java
@@ -15,6 +15,7 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; +import android.util.Size; import org.chromium.base.Callback; import org.chromium.base.task.PostTask; @@ -46,8 +47,6 @@ private final float mRadius; private final float mFaviconFrameCornerRadius; - private final int mThumbnailWidth; - private final int mThumbnailHeight; private final Paint mEmptyThumbnailPaint; private final Paint mThumbnailFramePaint; private final Paint mThumbnailBasePaint; @@ -56,9 +55,6 @@ private final Paint mSelectedEmptyThumbnailPaint; private final Paint mSelectedTextPaint; private final int mFaviconBackgroundPaintColor; - private final List<Rect> mFaviconRects = new ArrayList<>(4); - private final List<RectF> mThumbnailRects = new ArrayList<>(4); - private final List<RectF> mFaviconBackgroundRects = new ArrayList<>(4); private TabListFaviconProvider mTabListFaviconProvider; private Context mContext; @@ -75,25 +71,94 @@ private Bitmap mMultiThumbnailBitmap; private String mText; + private final List<Rect> mFaviconRects = new ArrayList<>(4); + private final List<RectF> mThumbnailRects = new ArrayList<>(4); + private final List<RectF> mFaviconBackgroundRects = new ArrayList<>(4); + private final int mThumbnailWidth; + private final int mThumbnailHeight; + /** * Fetcher that get the thumbnail drawable depending on if the tab is selected. * @see TabContentManager#getTabThumbnailWithCallback + * @param initialTab Thumbnail is generated for tabs related to initialTab. + * @param thumbnailSize Desired size of multi-thumbnail. + * @param finalCallback Callback which receives generated bitmap. + * @param forceUpdate, writeToCache Required for bitmap generator. * @param isTabSelected Whether the thumbnail is for a currently selected tab. */ - MultiThumbnailFetcher(PseudoTab initialTab, Callback<Bitmap> finalCallback, - boolean forceUpdate, boolean writeToCache, boolean isTabSelected) { + MultiThumbnailFetcher(PseudoTab initialTab, Size thumbnailSize, + Callback<Bitmap> finalCallback, boolean forceUpdate, boolean writeToCache, + boolean isTabSelected) { mFinalCallback = finalCallback; mInitialTab = initialTab; mForceUpdate = forceUpdate; mWriteToCache = writeToCache; mIsTabSelected = isTabSelected; + + if (thumbnailSize == null || thumbnailSize.getHeight() <= 0 + || thumbnailSize.getWidth() <= 0) { + float expectedThumbnailAspectRatio = TabUtils.getTabThumbnailAspectRatio(mContext); + mThumbnailWidth = (int) mContext.getResources().getDimension( + R.dimen.tab_grid_thumbnail_card_default_size); + mThumbnailHeight = (int) (mThumbnailWidth / expectedThumbnailAspectRatio); + } else { + mThumbnailWidth = thumbnailSize.getWidth(); + mThumbnailHeight = thumbnailSize.getHeight(); + } + } + + /** + * Initialize rects used for thumbnails. + */ + private void initializeRects(Context context) { + float thumbnailHorizontalPadding = + TabUiThemeProvider.getTabMiniThumbnailPaddingDimension(context); + float thumbnailVerticalPadding = thumbnailHorizontalPadding; + + float centerX = mThumbnailWidth * 0.5f; + float centerY = mThumbnailHeight * 0.5f; + float halfThumbnailHorizontalPadding = thumbnailHorizontalPadding / 2; + float halfThumbnailVerticalPadding = thumbnailVerticalPadding / 2; + + mThumbnailRects.add(new RectF(0, 0, centerX - halfThumbnailHorizontalPadding, + centerY - halfThumbnailVerticalPadding)); + mThumbnailRects.add(new RectF(centerX + halfThumbnailHorizontalPadding, 0, + mThumbnailWidth, centerY - halfThumbnailVerticalPadding)); + mThumbnailRects.add(new RectF(0, centerY + halfThumbnailVerticalPadding, + centerX - halfThumbnailHorizontalPadding, mThumbnailHeight)); + mThumbnailRects.add(new RectF(centerX + halfThumbnailHorizontalPadding, + centerY + halfThumbnailVerticalPadding, mThumbnailWidth, mThumbnailHeight)); + + // Initialize Rects for favicons and favicon frame. + final float halfFaviconFrameSize = + mContext.getResources().getDimension( + R.dimen.tab_grid_thumbnail_favicon_frame_size) + / 2f; + float thumbnailFaviconPaddingFromBackground = mContext.getResources().getDimension( + R.dimen.tab_grid_thumbnail_favicon_padding_from_frame); + for (int i = 0; i < 4; i++) { + RectF thumbnailRect = mThumbnailRects.get(i); + + float thumbnailRectCenterX = thumbnailRect.centerX(); + float thumbnailRectCenterY = thumbnailRect.centerY(); + RectF faviconBackgroundRect = new RectF(thumbnailRectCenterX, thumbnailRectCenterY, + thumbnailRectCenterX, thumbnailRectCenterY); + faviconBackgroundRect.inset(-halfFaviconFrameSize, -halfFaviconFrameSize); + mFaviconBackgroundRects.add(faviconBackgroundRect); + + RectF faviconRectF = new RectF(faviconBackgroundRect); + faviconRectF.inset(thumbnailFaviconPaddingFromBackground, + thumbnailFaviconPaddingFromBackground); + Rect faviconRect = new Rect(); + faviconRectF.roundOut(faviconRect); + mFaviconRects.add(faviconRect); + } } private void initializeAndStartFetching(PseudoTab tab) { // Initialize mMultiThumbnailBitmap. - int width = mThumbnailWidth; - int height = mThumbnailHeight; - mMultiThumbnailBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + mMultiThumbnailBitmap = + Bitmap.createBitmap(mThumbnailWidth, mThumbnailHeight, Bitmap.Config.ARGB_8888); mCanvas = new Canvas(mMultiThumbnailBitmap); mCanvas.drawColor(Color.TRANSPARENT); @@ -127,13 +192,15 @@ final int index = i; final GURL url = mTabs.get(i).getUrl(); final boolean isIncognito = mTabs.get(i).isIncognito(); + final Size tabThumbnailSize = new Size((int) mThumbnailRects.get(i).width(), + (int) mThumbnailRects.get(i).height()); // getTabThumbnailWithCallback() might call the callback up to twice, // so use |lastFavicon| to avoid fetching the favicon the second time. // Fetching the favicon after getting the live thumbnail would lead to // visible flicker. final AtomicReference<Drawable> lastFavicon = new AtomicReference<>(); mTabContentManager.getTabThumbnailWithCallback( - mTabs.get(i).getId(), thumbnail -> { + mTabs.get(i).getId(), tabThumbnailSize, thumbnail -> { drawThumbnailBitmapOnCanvasWithFrame(thumbnail, index); if (lastFavicon.get() != null) { drawFaviconThenMaybeSendBack(lastFavicon.get(), index); @@ -202,6 +269,7 @@ } private void fetch() { + initializeRects(mContext); initializeAndStartFetching(mInitialTab); } } @@ -210,10 +278,6 @@ TabModelSelector tabModelSelector) { mContext = context; Resources resource = context.getResources(); - float expectedThumbnailAspectRatio = TabUtils.getTabThumbnailAspectRatio(context); - - mThumbnailWidth = (int) resource.getDimension(R.dimen.tab_grid_thumbnail_card_default_size); - mThumbnailHeight = (int) (mThumbnailWidth / expectedThumbnailAspectRatio); mTabContentManager = tabContentManager; mTabModelSelector = tabModelSelector; @@ -269,31 +333,6 @@ resource.getDimension(R.dimen.tab_grid_thumbnail_favicon_background_down_shift), resource.getColor(R.color.modern_grey_800_alpha_38)); - initializedThumbnailRects(context); - - // Initialize Rects for favicons and favicon frame. - final float halfFaviconFrameSize = - resource.getDimension(R.dimen.tab_grid_thumbnail_favicon_frame_size) / 2f; - float thumbnailFaviconPaddingFromBackground = - resource.getDimension(R.dimen.tab_grid_thumbnail_favicon_padding_from_frame); - for (int i = 0; i < 4; i++) { - RectF thumbnailRect = mThumbnailRects.get(i); - - float thumbnailRectCenterX = thumbnailRect.centerX(); - float thumbnailRectCenterY = thumbnailRect.centerY(); - RectF faviconBackgroundRect = new RectF(thumbnailRectCenterX, thumbnailRectCenterY, - thumbnailRectCenterX, thumbnailRectCenterY); - faviconBackgroundRect.inset(-halfFaviconFrameSize, -halfFaviconFrameSize); - mFaviconBackgroundRects.add(faviconBackgroundRect); - - RectF faviconRectF = new RectF(faviconBackgroundRect); - faviconRectF.inset( - thumbnailFaviconPaddingFromBackground, thumbnailFaviconPaddingFromBackground); - Rect faviconRect = new Rect(); - faviconRectF.roundOut(faviconRect); - mFaviconRects.add(faviconRect); - } - mTabModelSelectorObserver = new TabModelSelectorObserver() { @Override public void onTabModelSelected(TabModel newModel, TabModel oldModel) { @@ -331,40 +370,18 @@ mTabModelSelector.removeObserver(mTabModelSelectorObserver); } - /** - * Initialize rects used for thumbnails. - */ - private void initializedThumbnailRects(Context context) { - float thumbnailHorizontalPadding = - TabUiThemeProvider.getTabMiniThumbnailPaddingDimension(context); - float thumbnailVerticalPadding = thumbnailHorizontalPadding; - - float centerX = mThumbnailWidth * 0.5f; - float centerY = mThumbnailHeight * 0.5f; - float halfThumbnailHorizontalPadding = thumbnailHorizontalPadding / 2; - float halfThumbnailVerticalPadding = thumbnailVerticalPadding / 2; - - mThumbnailRects.add(new RectF(0, 0, centerX - halfThumbnailHorizontalPadding, - centerY - halfThumbnailVerticalPadding)); - mThumbnailRects.add(new RectF(centerX + halfThumbnailHorizontalPadding, 0, mThumbnailWidth, - centerY - halfThumbnailVerticalPadding)); - mThumbnailRects.add(new RectF(0, centerY + halfThumbnailVerticalPadding, - centerX - halfThumbnailHorizontalPadding, mThumbnailHeight)); - mThumbnailRects.add(new RectF(centerX + halfThumbnailHorizontalPadding, - centerY + halfThumbnailVerticalPadding, mThumbnailWidth, mThumbnailHeight)); - } - @Override - public void getTabThumbnailWithCallback( - int tabId, Callback<Bitmap> finalCallback, boolean forceUpdate, boolean writeToCache) { + public void getTabThumbnailWithCallback(int tabId, Size thumbnailSize, + Callback<Bitmap> finalCallback, boolean forceUpdate, boolean writeToCache) { PseudoTab tab = PseudoTab.fromTabId(tabId); if (tab == null || PseudoTab.getRelatedTabs(mContext, tab, mTabModelSelector).size() == 1) { mTabContentManager.getTabThumbnailWithCallback( - tabId, finalCallback, forceUpdate, writeToCache); + tabId, thumbnailSize, finalCallback, forceUpdate, writeToCache); return; } boolean isSelected = tabId == mTabModelSelector.getCurrentTabId(); - new MultiThumbnailFetcher(tab, finalCallback, forceUpdate, writeToCache, isSelected) + new MultiThumbnailFetcher( + tab, thumbnailSize, finalCallback, forceUpdate, writeToCache, isSelected) .fetch(); } }
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridViewBinder.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridViewBinder.java index 127ecc21..a1502bd 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridViewBinder.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridViewBinder.java
@@ -370,13 +370,15 @@ thumbnail.setColorThumbnailPlaceHolder( model.get(TabProperties.IS_INCOGNITO), model.get(TabProperties.IS_SELECTED)); + final Size thumbnailSize = + TabUiFeatureUtilities.isTabletGridTabSwitcherPolishEnabled(view.getContext()) + ? TabUtils.deriveThumbnailSize(model.get(TabProperties.GRID_CARD_WIDTH), + model.get(TabProperties.GRID_CARD_HEIGHT), view.getContext()) + : null; Callback<Bitmap> callback = result -> { if (result != null) { if (TabUiFeatureUtilities.isTabletGridTabSwitcherPolishEnabled(view.getContext())) { // Adjust bitmap to thumbnail. - final Size thumbnailSize = - TabUtils.deriveThumbnailSize(model.get(TabProperties.GRID_CARD_WIDTH), - model.get(TabProperties.GRID_CARD_HEIGHT), view.getContext()); updateThumbnailMatrix(thumbnail, result, thumbnailSize); } else { thumbnail.setScaleType(ScaleType.FIT_CENTER); @@ -386,9 +388,9 @@ } }; if (TabUiFeatureUtilities.isLaunchPolishEnabled() && sThumbnailFetcherForTesting != null) { - sThumbnailFetcherForTesting.fetch(callback); + sThumbnailFetcherForTesting.fetch(callback, thumbnailSize); } else { - fetcher.fetch(callback); + fetcher.fetch(callback, thumbnailSize); } }
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediator.java index 4e2bfac..76ff8c6 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediator.java
@@ -20,6 +20,7 @@ import android.os.Handler; import android.text.TextUtils; import android.util.Pair; +import android.util.Size; import android.view.View; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; @@ -124,8 +125,8 @@ /** * @see TabContentManager#getTabThumbnailWithCallback */ - void getTabThumbnailWithCallback( - int tabId, Callback<Bitmap> callback, boolean forceUpdate, boolean writeToCache); + void getTabThumbnailWithCallback(int tabId, Size thumbnailSize, Callback<Bitmap> callback, + boolean forceUpdate, boolean writeToCache); } /** @@ -289,14 +290,14 @@ mWriteToCache = writeToCache; } - void fetch(Callback<Bitmap> callback) { + void fetch(Callback<Bitmap> callback, Size thumbnailSize) { Callback<Bitmap> forking = (bitmap) -> { if (sBitmapCallbackForTesting != null) sBitmapCallbackForTesting.onResult(bitmap); callback.onResult(bitmap); }; sFetchCountForTesting++; mThumbnailProvider.getTabThumbnailWithCallback( - mId, forking, mForceUpdate, mWriteToCache); + mId, thumbnailSize, forking, mForceUpdate, mWriteToCache); } }
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherLayout.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherLayout.java index ceb8fdcd..fb80dd6 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherLayout.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherLayout.java
@@ -18,7 +18,6 @@ import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; -import androidx.vectordrawable.graphics.drawable.AnimationUtilsCompat; import org.chromium.base.Log; import org.chromium.base.TraceEvent; @@ -27,7 +26,6 @@ import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordUserAction; import org.chromium.base.supplier.Supplier; -import org.chromium.chrome.R; import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider; import org.chromium.chrome.browser.compositor.layouts.Layout; import org.chromium.chrome.browser.compositor.layouts.LayoutRenderHost; @@ -69,7 +67,7 @@ // Duration of the transition animation public static final long ZOOMING_DURATION = 300; - private static final int TRANSLATE_DURATION_MS = 500; + private static final int TRANSLATE_DURATION_MS = 450; private static final int BACKGROUND_FADING_DURATION_MS = 150; private static final String TRACE_SHOW_TAB_SWITCHER = "TabSwitcherLayout.Show.TabSwitcher"; @@ -519,8 +517,7 @@ Animator translateUp = ObjectAnimator.ofFloat(mController.getTabSwitcherContainer(), View.TRANSLATION_Y, mController.getTabSwitcherContainer().getHeight(), 0f); - translateUp.setInterpolator(AnimationUtilsCompat.loadInterpolator( - getContext(), R.anim.fast_out_extra_slow_in_interpolator)); + translateUp.setInterpolator(Interpolators.EMPHASIZED_DECELERATE); translateUp.setDuration(TRANSLATE_DURATION_MS); mTabToSwitcherAnimation = new AnimatorSet(); @@ -555,8 +552,7 @@ Animator translateDown = ObjectAnimator.ofFloat(mController.getTabSwitcherContainer(), View.TRANSLATION_Y, 0f, mController.getTabSwitcherContainer().getHeight()); - translateDown.setInterpolator(AnimationUtilsCompat.loadInterpolator( - getContext(), R.anim.fast_out_extra_slow_in_interpolator)); + translateDown.setInterpolator(Interpolators.EMPHASIZED_ACCELERATE); translateDown.setDuration(TRANSLATE_DURATION_MS); mTabToSwitcherAnimation = new AnimatorSet();
diff --git a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListViewHolderTest.java b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListViewHolderTest.java index b2e23f2..043e81e 100644 --- a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListViewHolderTest.java +++ b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListViewHolderTest.java
@@ -21,6 +21,7 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; +import android.util.Size; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; @@ -176,8 +177,8 @@ private TabListMediator.ThumbnailFetcher mMockThumbnailProvider = new TabListMediator.ThumbnailFetcher(new TabListMediator.ThumbnailProvider() { @Override - public void getTabThumbnailWithCallback(int tabId, Callback<Bitmap> callback, - boolean forceUpdate, boolean writeToCache) { + public void getTabThumbnailWithCallback(int tabId, Size thumbnailSize, + Callback<Bitmap> callback, boolean forceUpdate, boolean writeToCache) { Bitmap bitmap = mShouldReturnBitmap ? Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888) : null;
diff --git a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherThumbnailTest.java b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherThumbnailTest.java index 0d3be5ff..38c2b2a 100644 --- a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherThumbnailTest.java +++ b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherThumbnailTest.java
@@ -62,8 +62,9 @@ public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private TabListMediator.ThumbnailFetcher mNullThumbnailProvider = - new TabListMediator.ThumbnailFetcher((tabId, callback, forceUpdate, writeToCache) - -> callback.onResult(null), + new TabListMediator.ThumbnailFetcher( + (tabId, thumbnailSize, callback, forceUpdate, writeToCache) + -> callback.onResult(null), Tab.INVALID_TAB_ID, false, false); @Before
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridViewBinderUnitTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridViewBinderUnitTest.java index 3effed6..36974f6 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridViewBinderUnitTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridViewBinderUnitTest.java
@@ -112,7 +112,7 @@ verify(mThumbnailView).setColorThumbnailPlaceHolder(false, true); assertThat(mLayoutParams.width, equalTo(updatedCardWidth)); - verify(mFetcher).fetch(mCallbackCaptor.capture()); + verify(mFetcher).fetch(mCallbackCaptor.capture(), any()); mCallbackCaptor.getValue().onResult(mBitmap); verify(mThumbnailView).setScaleType(ScaleType.FIT_CENTER); @@ -139,7 +139,7 @@ verify(mViewGroup).setMinimumWidth(updatedCardWidth); verify(mThumbnailView).setColorThumbnailPlaceHolder(false, true); assertThat(mLayoutParams.width, equalTo(updatedCardWidth)); - verify(mFetcher).fetch(mCallbackCaptor.capture()); + verify(mFetcher).fetch(mCallbackCaptor.capture(), any()); // Pass bitmap to callback and verify thumbnail updated with image resize. mCallbackCaptor.getValue().onResult(mBitmap); @@ -179,7 +179,7 @@ verify(mThumbnailView).setColorThumbnailPlaceHolder(false, true); assertThat(mLayoutParams.height, equalTo(updatedCardHeight)); assertThat(thumbnailParams.height, equalTo(LayoutParams.MATCH_PARENT)); - verify(mFetcher).fetch(mCallbackCaptor.capture()); + verify(mFetcher).fetch(mCallbackCaptor.capture(), any()); // Pass bitmap to callback and verify thumbnail updated with image resize. mCallbackCaptor.getValue().onResult(mBitmap);
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediatorUnitTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediatorUnitTest.java index 3494f48..810431e 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediatorUnitTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediatorUnitTest.java
@@ -362,7 +362,7 @@ doNothing() .when(mTabContentManager) - .getTabThumbnailWithCallback(anyInt(), any(), anyBoolean(), anyBoolean()); + .getTabThumbnailWithCallback(anyInt(), any(), any(), anyBoolean(), anyBoolean()); doReturn(mTabModel).when(mTabModelSelector).getCurrentModel(); doReturn(tabModelList).when(mTabModelSelector).getModels();
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherMediatorUnitTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherMediatorUnitTest.java index 2a3016b0..3e205ec6 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherMediatorUnitTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherMediatorUnitTest.java
@@ -170,7 +170,7 @@ doNothing() .when(mTabContentManager) - .getTabThumbnailWithCallback(anyInt(), any(), anyBoolean(), anyBoolean()); + .getTabThumbnailWithCallback(anyInt(), any(), any(), anyBoolean(), anyBoolean()); doReturn(mResources).when(mContext).getResources(); doReturn(mTabModel).when(mTabModelSelector).getCurrentModel();
diff --git a/chrome/android/java/res/anim/fast_out_extra_slow_in_interpolator.xml b/chrome/android/java/res/anim/fast_out_extra_slow_in_interpolator.xml deleted file mode 100644 index da641af..0000000 --- a/chrome/android/java/res/anim/fast_out_extra_slow_in_interpolator.xml +++ /dev/null
@@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2022 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. --> - -<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android" - android:pathData="M 0,0 C 0.05, 0, 0.133333, 0.06, 0.166666, 0.4 C 0.208333, 0.82, 0.25, 1, 1, 1"/>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/content/TabContentManager.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/content/TabContentManager.java index cd4a58d..01e64ba0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/content/TabContentManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/content/TabContentManager.java
@@ -11,6 +11,7 @@ import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; +import android.util.Size; import android.view.View; import android.view.ViewGroup.MarginLayoutParams; @@ -339,18 +340,20 @@ * Call to get a thumbnail for a given tab through a {@link Callback}. If there is * no up-to-date thumbnail on disk for the given tab, callback returns null. * @param tabId The ID of the tab to get the thumbnail for. + * @param thumbnailSize Desired size of thumbnail received by callback. Use default values if + * null. * @param callback The callback to send the {@link Bitmap} with. Can be called up to twice when * {@code forceUpdate}; otherwise always called exactly once. * @param forceUpdate Whether to obtain the thumbnail from the live content. * @param writeBack When {@code forceUpdate}, whether to write the thumbnail to cache. */ - public void getTabThumbnailWithCallback(@NonNull int tabId, @NonNull Callback<Bitmap> callback, - boolean forceUpdate, boolean writeBack) { + public void getTabThumbnailWithCallback(@NonNull int tabId, @Nullable Size thumbnailSize, + @NonNull Callback<Bitmap> callback, boolean forceUpdate, boolean writeBack) { if (!mSnapshotsEnabled) return; if (!forceUpdate) { assert !writeBack : "writeBack is ignored if not forceUpdate"; - getTabThumbnailFromDisk(tabId, callback); + getTabThumbnailFromDisk(tabId, thumbnailSize, callback); return; } @@ -358,7 +361,7 @@ // Reading thumbnail from disk is faster than taking screenshot from live Tab, so fetch // that first even if |forceUpdate|. - getTabThumbnailFromDisk(tabId, (diskBitmap) -> { + getTabThumbnailFromDisk(tabId, thumbnailSize, (diskBitmap) -> { if (diskBitmap != null) callback.onResult(diskBitmap); if (mTabFinder == null) return; @@ -420,13 +423,52 @@ } @VisibleForTesting - public static Bitmap getJpegForTab(int tabId) { + public static Bitmap getJpegForTab(int tabId, @Nullable Size thumbnailSize) { File file = getTabThumbnailFileJpeg(tabId); if (!file.isFile()) return null; - return BitmapFactory.decodeFile(file.getPath()); + if (thumbnailSize == null || thumbnailSize.getWidth() <= 0 + || thumbnailSize.getHeight() <= 0) { + return BitmapFactory.decodeFile(file.getPath()); + } + return resizeJpeg(file.getPath(), thumbnailSize); } - private void getTabThumbnailFromDisk(@NonNull int tabId, @NonNull Callback<Bitmap> callback) { + /** + * See https://developer.android.com/topic/performance/graphics/load-bitmap#load-bitmap. + * @param path Path of jpeg file. + * @param thumbnailSize Desired thumbnail size to resize to. + * @return Resized bitmap. + */ + private static Bitmap resizeJpeg(String path, Size thumbnailSize) { + BitmapFactory.Options options = new BitmapFactory.Options(); + options.inJustDecodeBounds = true; + BitmapFactory.decodeFile(path, options); + + // Raw height and width of image + final int height = options.outHeight; + final int width = options.outWidth; + int inSampleSize = 1; + + if (height > thumbnailSize.getHeight() || width > thumbnailSize.getWidth()) { + final int halfHeight = height / 2; + final int halfWidth = width / 2; + + // Calculate the largest inSampleSize value that is a power of 2 and keeps both + // height and width larger than the requested height and width. + while ((halfHeight / inSampleSize) >= thumbnailSize.getHeight() + && (halfWidth / inSampleSize) >= thumbnailSize.getWidth()) { + inSampleSize *= 2; + } + } + options.inSampleSize = inSampleSize; + + // Decode bitmap with inSampleSize set + options.inJustDecodeBounds = false; + return BitmapFactory.decodeFile(path, options); + } + + private void getTabThumbnailFromDisk( + @NonNull int tabId, @Nullable Size thumbnailSize, @NonNull Callback<Bitmap> callback) { mOnTheFlyRequests++; mRequests++; // Try JPEG thumbnail first before using the more costly @@ -435,7 +477,7 @@ new AsyncTask<Bitmap>() { @Override public Bitmap doInBackground() { - return getJpegForTab(tabId); + return getJpegForTab(tabId, thumbnailSize); } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/segmentation_platform/ContextualPageActionController.java b/chrome/android/java/src/org/chromium/chrome/browser/segmentation_platform/ContextualPageActionController.java index b9dd3c6..3f213e0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/segmentation_platform/ContextualPageActionController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/segmentation_platform/ContextualPageActionController.java
@@ -22,7 +22,7 @@ * button data to the toolbar when asked for it. */ public class ContextualPageActionController { - private static final String CONTEXTUAL_PAGE_ACTION_SEGMENTATION_KEY = "contextual_page_action"; + private static final String CONTEXTUAL_PAGE_ACTION_SEGMENTATION_KEY = "contextual_page_actions"; private SegmentationPlatformService mSegmentationPlatformService; private final ObservableSupplier<Tab> mTabSupplier;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/segmentation_platform/OWNERS b/chrome/android/java/src/org/chromium/chrome/browser/segmentation_platform/OWNERS new file mode 100644 index 0000000..ffc05827 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/segmentation_platform/OWNERS
@@ -0,0 +1 @@ +shaktisahu@chromium.org
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index cb03fae..66c192ef 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -159,6 +159,15 @@ <message name="IDS_SETTINGS_SHOW_BOOKMARKS_BAR" desc="Label for the checkbox which enables or disables showing the bookmarks bar in the toolbar."> Show bookmarks bar </message> + <message name="IDS_SETTINGS_SIDE_PANEL" desc="Title for the side panel section. Allows the user to toggle which side the side panel is displayed on."> + Side panel + </message> + <message name="IDS_SETTINGS_SIDE_PANEL_ALIGN_LEFT" desc="Label for the button that allows the side panel to appear on the left side of the browser. Translate this verbatim, do not localize for RTL languages."> + Show on left + </message> + <message name="IDS_SETTINGS_SIDE_PANEL_ALIGN_RIGHT" desc="Label for the button that allows the side panel to appear on the right side of the browser. Translate this verbatim, do not localize for RTL languages."> + Show on right + </message> <message name="IDS_SETTINGS_HOME_PAGE_NTP" desc="Description of the New Tab Page when set as the home page."> New Tab page </message>
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SIDE_PANEL.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SIDE_PANEL.png.sha1 new file mode 100644 index 0000000..cf27bd7 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SIDE_PANEL.png.sha1
@@ -0,0 +1 @@ +4f1e0c0acfb8a46c20490e16ed7e60ab2c763a13 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SIDE_PANEL_ALIGN_LEFT.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SIDE_PANEL_ALIGN_LEFT.png.sha1 new file mode 100644 index 0000000..cf27bd7 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SIDE_PANEL_ALIGN_LEFT.png.sha1
@@ -0,0 +1 @@ +4f1e0c0acfb8a46c20490e16ed7e60ab2c763a13 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SIDE_PANEL_ALIGN_RIGHT.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SIDE_PANEL_ALIGN_RIGHT.png.sha1 new file mode 100644 index 0000000..cf27bd7 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SIDE_PANEL_ALIGN_RIGHT.png.sha1
@@ -0,0 +1 @@ +4f1e0c0acfb8a46c20490e16ed7e60ab2c763a13 \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 99e6869..44ffe94 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -2268,6 +2268,7 @@ "//components/services/patch/content", "//components/services/quarantine", "//components/services/quarantine/public/mojom", + "//components/services/storage/public/cpp:prefs", "//components/services/unzip/content", "//components/services/unzip/public/cpp", "//components/services/unzip/public/mojom", @@ -7386,10 +7387,6 @@ "spellchecker/spellcheck_factory.h", "spellchecker/spellcheck_hunspell_dictionary.cc", "spellchecker/spellcheck_hunspell_dictionary.h", - "spellchecker/spellcheck_language_blocklist_policy_handler.cc", - "spellchecker/spellcheck_language_blocklist_policy_handler.h", - "spellchecker/spellcheck_language_policy_handler.cc", - "spellchecker/spellcheck_language_policy_handler.h", "spellchecker/spellcheck_service.cc", "spellchecker/spellcheck_service.h", ] @@ -7401,6 +7398,15 @@ ] } + if (is_win || is_linux || is_chromeos) { + sources += [ + "spellchecker/spellcheck_language_blocklist_policy_handler.cc", + "spellchecker/spellcheck_language_blocklist_policy_handler.h", + "spellchecker/spellcheck_language_policy_handler.cc", + "spellchecker/spellcheck_language_policy_handler.h", + ] + } + if (has_spellcheck_panel) { sources += [ "spellchecker/spell_check_panel_host_impl.cc",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 2e9fc611..0dd2bca 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -3917,6 +3917,9 @@ chrome::android::kAdaptiveButtonInTopToolbarCustomizationV2, kAdaptiveButtonInTopToolbarCustomizationVariations, "OptionalToolbarButtonCustomization")}, + {"android-media-picker", flag_descriptions::kAndroidMediaPickerSupportName, + flag_descriptions::kAndroidMediaPickerSupportDescription, kOsAndroid, + FEATURE_VALUE_TYPE(photo_picker::features::kAndroidMediaPickerSupport)}, {"contextual-page-actions-with-price-tracking", flag_descriptions::kContextualPageActionsWithPriceTrackingName, flag_descriptions::kContextualPageActionsWithPriceTrackingDescription, @@ -7111,13 +7114,6 @@ flag_descriptions::kLauncherHideContinueSectionName, flag_descriptions::kLauncherHideContinueSectionDescription, kOsCrOS, FEATURE_VALUE_TYPE(ash::features::kLauncherHideContinueSection)}, - {"launcher-nudge", flag_descriptions::kLauncherNudgeName, - flag_descriptions::kLauncherNudgeDescription, kOsCrOS, - FEATURE_VALUE_TYPE(ash::features::kShelfLauncherNudge)}, - {"launcher-nudge-short-interval", - flag_descriptions::kLauncherNudgeShortIntervalName, - flag_descriptions::kLauncherNudgeShortIntervalDescription, kOsCrOS, - FEATURE_VALUE_TYPE(ash::features::kLauncherNudgeShortInterval)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/ash/BUILD.gn b/chrome/browser/ash/BUILD.gn index 71b479e7..b8dab8e0 100644 --- a/chrome/browser/ash/BUILD.gn +++ b/chrome/browser/ash/BUILD.gn
@@ -1601,6 +1601,7 @@ "//chromeos/dbus/debug_daemon", "//chromeos/dbus/dlcservice", "//chromeos/dbus/gnubby", + "//chromeos/dbus/image_burner", "//chromeos/dbus/missive", "//chromeos/dbus/power", "//chromeos/dbus/power:power_manager_proto",
diff --git a/chrome/browser/ash/accessibility/dictation_browsertest.cc b/chrome/browser/ash/accessibility/dictation_browsertest.cc index 5a1584a..1b9daada 100644 --- a/chrome/browser/ash/accessibility/dictation_browsertest.cc +++ b/chrome/browser/ash/accessibility/dictation_browsertest.cc
@@ -1331,21 +1331,13 @@ // Setup ChromeVox first. test::SpeechMonitor sm; EXPECT_FALSE(GetManager()->IsSpokenFeedbackEnabled()); - extensions::ExtensionHostTestHelper host_helper( - browser()->profile(), extension_misc::kChromeVoxExtensionId); EnableChromeVox(); - host_helper.WaitForHostCompletedFirstLoad(); EXPECT_TRUE(GetManager()->IsSpokenFeedbackEnabled()); - ToggleDictationWithKeystroke(); - WaitForRecognitionStarted(); + // Wait for ChromeVox to start. + sm.ExpectSpeech("ChromeVox spoken feedback is ready"); - // Hints should show up after a few seconds without speech. - WaitForProperties( - /*visible=*/true, - /*icon=*/DictationBubbleIconType::kStandby, - /*text=*/absl::optional<std::u16string>(), - /*hints=*/std::vector<std::u16string>{kTrySaying, kType, kHelp}); + sm.Call([this]() { ToggleDictationWithKeystroke(); }); // Assert speech from ChromeVox. sm.ExpectSpeechPattern("Try saying*Type*Help*");
diff --git a/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc b/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc index 242cd13..91611ba 100644 --- a/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc +++ b/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc
@@ -466,7 +466,7 @@ arc_bridge_service_->app()->AddObserver(this); arc_bridge_service_->intent_helper()->AddObserver(this); - if (base::FeatureList::IsEnabled(floss::features::kFlossEnabled)) { + if (floss::features::IsFlossEnabled()) { VLOG(1) << "Disabling ArcBluetoothBridge, Floss not yet supported."; return; }
diff --git a/chrome/browser/ash/arc/keymaster/arc_keymaster_bridge.cc b/chrome/browser/ash/arc/keymaster/arc_keymaster_bridge.cc index 4f7f83f8..df7dd0c 100644 --- a/chrome/browser/ash/arc/keymaster/arc_keymaster_bridge.cc +++ b/chrome/browser/ash/arc/keymaster/arc_keymaster_bridge.cc
@@ -14,7 +14,6 @@ #include "base/process/process_handle.h" #include "chrome/services/keymaster/public/mojom/cert_store.mojom.h" #include "chromeos/dbus/arc/arc_keymaster_client.h" -#include "chromeos/dbus/dbus_thread_manager.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/platform/platform_channel.h" #include "mojo/public/cpp/system/invitation.h" @@ -146,12 +145,10 @@ keymaster_server_proxy_.set_disconnect_handler( base::BindOnce(&mojo::Remote<mojom::KeymasterServer>::reset, base::Unretained(&keymaster_server_proxy_))); - chromeos::DBusThreadManager::Get() - ->GetArcKeymasterClient() - ->BootstrapMojoConnection( - channel.TakeRemoteEndpoint().TakePlatformHandle().TakeFD(), - base::BindOnce(&ArcKeymasterBridge::OnBootstrapMojoConnection, - weak_factory_.GetWeakPtr(), std::move(callback))); + chromeos::ArcKeymasterClient::Get()->BootstrapMojoConnection( + channel.TakeRemoteEndpoint().TakePlatformHandle().TakeFD(), + base::BindOnce(&ArcKeymasterBridge::OnBootstrapMojoConnection, + weak_factory_.GetWeakPtr(), std::move(callback))); } } // namespace arc
diff --git a/chrome/browser/ash/bluetooth/debug_logs_manager.cc b/chrome/browser/ash/bluetooth/debug_logs_manager.cc index aab695e..da238fe 100644 --- a/chrome/browser/ash/bluetooth/debug_logs_manager.cc +++ b/chrome/browser/ash/bluetooth/debug_logs_manager.cc
@@ -91,7 +91,7 @@ uint8_t level = enable ? kVerboseBasicLevel : kVerboseDisabledLevel; VLOG(1) << (enable ? "Enabling" : "Disabling") << " bluetooth verbose logs"; - if (base::FeatureList::IsEnabled(floss::features::kFlossEnabled)) { + if (floss::features::IsFlossEnabled()) { VLOG(1) << "Floss does not yet support dynamic verbose logging."; return; }
diff --git a/chrome/browser/ash/borealis/borealis_features.cc b/chrome/browser/ash/borealis/borealis_features.cc index bef4048a..3b2a62e 100644 --- a/chrome/browser/ash/borealis/borealis_features.cc +++ b/chrome/browser/ash/borealis/borealis_features.cc
@@ -35,7 +35,7 @@ namespace { -constexpr int64_t kGibi = 1024 * 1024 * 1024; +constexpr uint64_t kGibi = 1024ull * 1024 * 1024; // Used to make it difficult to tell what someone's token is based on their // prefs.
diff --git a/chrome/browser/ash/borealis/borealis_features_unittest.cc b/chrome/browser/ash/borealis/borealis_features_unittest.cc index 28b2c75..98c05e76 100644 --- a/chrome/browser/ash/borealis/borealis_features_unittest.cc +++ b/chrome/browser/ash/borealis/borealis_features_unittest.cc
@@ -135,11 +135,11 @@ EXPECT_TRUE(checker.CpuRegexMatches("cp")); EXPECT_TRUE(checker.CpuRegexMatches("^[a-z]*$")); - EXPECT_TRUE(checker.HasMemory(-1)); + EXPECT_TRUE(checker.HasMemory(0)); EXPECT_TRUE(checker.HasMemory(41)); EXPECT_TRUE(checker.HasMemory(42)); EXPECT_FALSE(checker.HasMemory(43)); - EXPECT_FALSE(checker.HasMemory(std::numeric_limits<int64_t>::max())); + EXPECT_FALSE(checker.HasMemory(std::numeric_limits<uint64_t>::max())); } TEST(BorealisFeaturesUtilTest, DataCanBeBuilt) { @@ -160,7 +160,7 @@ // Faking CPU and RAM are not supported, so just assert they have some // trivial values. EXPECT_NE(data.cpu, ""); - EXPECT_GT(data.memory, 0); + EXPECT_GT(data.memory, 0u); loop.Quit(); })); loop.Run();
diff --git a/chrome/browser/ash/borealis/borealis_features_util.cc b/chrome/browser/ash/borealis/borealis_features_util.cc index 6ae51eec..2e9b9cc9 100644 --- a/chrome/browser/ash/borealis/borealis_features_util.cc +++ b/chrome/browser/ash/borealis/borealis_features_util.cc
@@ -91,7 +91,7 @@ std::string board, std::string model, std::string cpu, - int64_t memory) + uint64_t memory) : token_hash(std::move(token_hash)), board(std::move(board)), model(std::move(model)), @@ -176,7 +176,7 @@ return RE2::PartialMatch(token_hardware_.cpu, cpu_regex); } -bool TokenHardwareChecker::HasMemory(int64_t mem_bytes) const { +bool TokenHardwareChecker::HasMemory(uint64_t mem_bytes) const { return token_hardware_.memory >= mem_bytes; }
diff --git a/chrome/browser/ash/borealis/borealis_features_util.h b/chrome/browser/ash/borealis/borealis_features_util.h index 1bd73fb..d0311b8f 100644 --- a/chrome/browser/ash/borealis/borealis_features_util.h +++ b/chrome/browser/ash/borealis/borealis_features_util.h
@@ -23,7 +23,7 @@ std::string board, std::string model, std::string cpu, - int64_t memory); + uint64_t memory); Data(const Data& other); ~Data(); @@ -31,7 +31,7 @@ std::string board; std::string model; std::string cpu; - int64_t memory; + uint64_t memory; }; // A hashing function used for creating tokens. @@ -53,7 +53,7 @@ bool IsModel(const std::string& model) const; bool ModelIn(base::flat_set<std::string> models) const; bool CpuRegexMatches(const std::string& cpu_regex) const; - bool HasMemory(int64_t mem_bytes) const; + bool HasMemory(uint64_t mem_bytes) const; private: const Data token_hardware_;
diff --git a/chrome/browser/ash/crosapi/crosapi_util.cc b/chrome/browser/ash/crosapi/crosapi_util.cc index 4418e27..2c94103 100644 --- a/chrome/browser/ash/crosapi/crosapi_util.cc +++ b/chrome/browser/ash/crosapi/crosapi_util.cc
@@ -118,6 +118,7 @@ #include "components/user_manager/user.h" #include "components/user_manager/user_manager.h" #include "components/version_info/version_info.h" +#include "device/bluetooth/floss/floss_features.h" #include "media/capture/mojom/video_capture.mojom.h" #include "media/mojo/mojom/stable/stable_video_decoder.mojom.h" #include "services/device/public/mojom/hid.mojom.h" @@ -530,6 +531,7 @@ params->ash_chrome_version = version_info::GetVersionNumber(); params->use_cups_for_printing = GetUseCupsForPrinting(); + params->use_floss_bluetooth = floss::features::IsFlossEnabled(); return params; }
diff --git a/chrome/browser/ash/dbus/ash_dbus_helper.cc b/chrome/browser/ash/dbus/ash_dbus_helper.cc index cf3c456f..b9173ba5 100644 --- a/chrome/browser/ash/dbus/ash_dbus_helper.cc +++ b/chrome/browser/ash/dbus/ash_dbus_helper.cc
@@ -58,6 +58,8 @@ #include "chromeos/ash/components/hibernate/buildflags.h" // ENABLE_HIBERNATE #include "chromeos/dbus/arc/arc_appfuse_provider_client.h" #include "chromeos/dbus/arc/arc_camera_client.h" +#include "chromeos/dbus/arc/arc_data_snapshotd_client.h" +#include "chromeos/dbus/arc/arc_keymaster_client.h" #include "chromeos/dbus/arc/arc_sensor_service_client.h" #include "chromeos/dbus/attestation/attestation_client.h" #include "chromeos/dbus/cdm_factory_daemon/cdm_factory_daemon_client.h" @@ -66,6 +68,7 @@ #include "chromeos/dbus/dlcservice/dlcservice_client.h" #include "chromeos/dbus/dlp/dlp_client.h" #include "chromeos/dbus/hermes/hermes_clients.h" +#include "chromeos/dbus/image_burner/image_burner_client.h" #include "chromeos/dbus/image_loader/image_loader_client.h" #include "chromeos/dbus/init/initialize_dbus_client.h" #include "chromeos/dbus/machine_learning/machine_learning_client.h" @@ -123,6 +126,8 @@ InitializeDBusClient<AnomalyDetectorClient>(bus); InitializeDBusClient<chromeos::ArcAppfuseProviderClient>(bus); InitializeDBusClient<chromeos::ArcCameraClient>(bus); + InitializeDBusClient<chromeos::ArcDataSnapshotdClient>(bus); + InitializeDBusClient<chromeos::ArcKeymasterClient>(bus); InitializeDBusClient<ArcQuotaClient>(bus); InitializeDBusClient<chromeos::ArcSensorServiceClient>(bus); InitializeDBusClient<chromeos::AttestationClient>(bus); @@ -146,6 +151,7 @@ #if BUILDFLAG(ENABLE_HIBERNATE) InitializeDBusClient<HibermanClient>(bus); #endif + InitializeDBusClient<chromeos::ImageBurnerClient>(bus); InitializeDBusClient<chromeos::ImageLoaderClient>(bus); InitializeDBusClient<InstallAttributesClient>(bus); InitializeDBusClient<IpPeripheralServiceClient>(bus); @@ -188,7 +194,7 @@ using chromeos::InitializeDBusClient; dbus::Bus* bus = chromeos::DBusThreadManager::Get()->GetSystemBus(); - if (base::FeatureList::IsEnabled(floss::features::kFlossEnabled)) { + if (floss::features::IsFlossEnabled()) { InitializeDBusClient<floss::FlossDBusManager>(bus); } else { InitializeDBusClient<bluez::BluezDBusManager>(bus); @@ -225,7 +231,7 @@ CfmHotlineClient::Shutdown(); } #endif - if (base::FeatureList::IsEnabled(floss::features::kFlossEnabled)) { + if (floss::features::IsFlossEnabled()) { floss::FlossDBusManager::Shutdown(); } else { bluez::BluezDBusManager::Shutdown(); @@ -267,6 +273,7 @@ IpPeripheralServiceClient::Shutdown(); InstallAttributesClient::Shutdown(); chromeos::ImageLoaderClient::Shutdown(); + chromeos::ImageBurnerClient::Shutdown(); #if BUILDFLAG(ENABLE_HIBERNATE) HibermanClient::Shutdown(); #endif @@ -288,6 +295,8 @@ AuthPolicyClient::Shutdown(); chromeos::AttestationClient::Shutdown(); ArcQuotaClient::Shutdown(); + chromeos::ArcKeymasterClient::Shutdown(); + chromeos::ArcDataSnapshotdClient::Shutdown(); chromeos::ArcCameraClient::Shutdown(); chromeos::ArcAppfuseProviderClient::Shutdown(); AnomalyDetectorClient::Shutdown();
diff --git a/chrome/browser/ash/policy/status_collector/device_status_collector.h b/chrome/browser/ash/policy/status_collector/device_status_collector.h index fcadffd..02487e3 100644 --- a/chrome/browser/ash/policy/status_collector/device_status_collector.h +++ b/chrome/browser/ash/policy/status_collector/device_status_collector.h
@@ -373,7 +373,7 @@ struct MemoryUsage { // Amount of free RAM (measures raw memory used by processes, not internal // memory waiting to be reclaimed by GC). - int64_t bytes_of_ram_free; + uint64_t bytes_of_ram_free; // Sampling timestamp. base::Time timestamp;
diff --git a/chrome/browser/ash/policy/status_collector/legacy_device_status_collector.h b/chrome/browser/ash/policy/status_collector/legacy_device_status_collector.h index 47e09b8..d5d21d1 100644 --- a/chrome/browser/ash/policy/status_collector/legacy_device_status_collector.h +++ b/chrome/browser/ash/policy/status_collector/legacy_device_status_collector.h
@@ -342,7 +342,7 @@ // Amount of free RAM (measures raw memory used by processes, not internal // memory waiting to be reclaimed by GC). - int64_t bytes_of_ram_free; + uint64_t bytes_of_ram_free; // Sampling timestamp. base::Time timestamp;
diff --git a/chrome/browser/ash/system_logs/bluetooth_log_source.cc b/chrome/browser/ash/system_logs/bluetooth_log_source.cc index 275abab..dc73272 100644 --- a/chrome/browser/ash/system_logs/bluetooth_log_source.cc +++ b/chrome/browser/ash/system_logs/bluetooth_log_source.cc
@@ -29,8 +29,7 @@ auto response = std::make_unique<SystemLogsResponse>(); std::string json; - bluetooth_log.SetBoolKey( - kIsFloss, base::FeatureList::IsEnabled(floss::features::kFlossEnabled)); + bluetooth_log.SetBoolKey(kIsFloss, floss::features::IsFlossEnabled()); base::JSONWriter::WriteWithOptions( bluetooth_log, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json);
diff --git a/chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.cc b/chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.cc index 7103e08..5d4ee0a2 100644 --- a/chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.cc +++ b/chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.cc
@@ -81,39 +81,37 @@ #endif } -void ChromeBluetoothDelegateImplClient::ShowBluetoothDeviceCredentialsDialog( +void ChromeBluetoothDelegateImplClient::ShowBluetoothDevicePairDialog( content::RenderFrameHost* frame, const std::u16string& device_identifier, - content::BluetoothDelegate::CredentialsCallback callback) { + content::BluetoothDelegate::PairPromptCallback callback, + content::BluetoothDelegate::PairingKind pairing_kind) { #if PAIR_BLUETOOTH_ON_DEMAND() - chrome::ShowBluetoothDeviceCredentialsDialog( - content::WebContents::FromRenderFrameHost(frame), device_identifier, - std::move(callback)); + + switch (pairing_kind) { + case (content::BluetoothDelegate::PairingKind::kProvidePin): + chrome::ShowBluetoothDeviceCredentialsDialog( + content::WebContents::FromRenderFrameHost(frame), device_identifier, + std::move(callback)); + break; + case (content::BluetoothDelegate::PairingKind::kConfirmOnly): + chrome::ShowBluetoothDevicePairConfirmDialog( + content::WebContents::FromRenderFrameHost(frame), device_identifier, + std::move(callback)); + break; + default: + NOTREACHED(); + std::move(callback).Run(content::BluetoothDelegate::PairPromptResult( + content::BluetoothDelegate::PairPromptStatus::kCancelled)); + break; + } + #else // WebBluetoothServiceImpl will only start the pairing process (which prompts // for credentials) on devices that pair on demand. This should never be // reached. NOTREACHED(); - std::move(callback).Run( - content::BluetoothDelegate::DeviceCredentialsPromptResult::kCancelled, - u""); -#endif -} - -void ChromeBluetoothDelegateImplClient::ShowBluetoothDevicePairConfirmDialog( - content::RenderFrameHost* frame, - const std::u16string& device_identifier, - content::BluetoothDelegate::PairConfirmCallback callback) { -#if PAIR_BLUETOOTH_ON_DEMAND() - chrome::ShowBluetoothDevicePairConfirmDialog( - content::WebContents::FromRenderFrameHost(frame), device_identifier, - std::move(callback)); -#else - // WebBluetoothServiceImpl will only start the pairing process (which prompts - // for confirmation) on devices that pair on demand. This should never be - // reached. - NOTREACHED(); - std::move(callback).Run( - content::BluetoothDelegate::DevicePairConfirmPromptResult::kCancelled); + std::move(callback).Run(content::BluetoothDelegate::PairPromptResult( + content::BluetoothDelegate::PairPromptStatus::kCancelled)); #endif }
diff --git a/chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.h b/chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.h index a8c74fc..04dbe5e0 100644 --- a/chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.h +++ b/chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.h
@@ -41,14 +41,12 @@ content::RenderFrameHost* frame, const content::BluetoothScanningPrompt::EventHandler& event_handler) override; - void ShowBluetoothDeviceCredentialsDialog( + + void ShowBluetoothDevicePairDialog( content::RenderFrameHost* frame, const std::u16string& device_identifier, - content::BluetoothDelegate::CredentialsCallback callback) override; - void ShowBluetoothDevicePairConfirmDialog( - content::RenderFrameHost* frame, - const std::u16string& device_identifier, - content::BluetoothDelegate::PairConfirmCallback callback) override; + content::BluetoothDelegate::PairPromptCallback callback, + content::BluetoothDelegate::PairingKind pairing_kind) override; }; #endif // CHROME_BROWSER_BLUETOOTH_CHROME_BLUETOOTH_DELEGATE_IMPL_CLIENT_H_
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 9e001aa..4c44b21 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -238,6 +238,7 @@ #include "components/security_interstitials/content/ssl_cert_reporter.h" #include "components/security_interstitials/content/ssl_error_handler.h" #include "components/security_interstitials/content/ssl_error_navigation_throttle.h" +#include "components/services/storage/public/cpp/storage_prefs.h" #include "components/site_isolation/pref_names.h" #include "components/site_isolation/preloaded_isolated_origins.h" #include "components/site_isolation/site_isolation_policy.h" @@ -2318,13 +2319,6 @@ process, profile); } - // This passes the preference set by an enterprise policy on to a blink - // switch so that we know whether to force WebSQL to be enabled. - if (g_browser_process->local_state()->GetBoolean( - policy::policy_prefs::kWebSQLAccess)) { - command_line->AppendSwitch(blink::switches::kWebSQLAccess); - } - #if BUILDFLAG(IS_CHROMEOS_ASH) const std::string& login_profile = browser_command_line.GetSwitchValueASCII(ash::switches::kLoginProfile); @@ -2347,6 +2341,17 @@ if (prefs->GetBoolean(prefs::kPrintPreviewDisabled)) command_line->AppendSwitch(switches::kDisablePrintPreview); + // This passes the preference set by an enterprise policy on to a blink + // switch so that we know whether to force WebSQL/WebSQL in non-secure + // context to be enabled. + if (prefs->GetBoolean(storage::kWebSQLAccess)) { + command_line->AppendSwitch(blink::switches::kWebSQLAccess); + } + if (prefs->GetBoolean(storage::kWebSQLNonSecureContextEnabled)) { + command_line->AppendSwitch( + blink::switches::kWebSQLNonSecureContextEnabled); + } + #if !BUILDFLAG(IS_ANDROID) InstantService* instant_service = InstantServiceFactory::GetForProfile(profile);
diff --git a/chrome/browser/chrome_content_browser_client_unittest.cc b/chrome/browser/chrome_content_browser_client_unittest.cc index ea81fece..3b93e9801 100644 --- a/chrome/browser/chrome_content_browser_client_unittest.cc +++ b/chrome/browser/chrome_content_browser_client_unittest.cc
@@ -39,6 +39,7 @@ #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/policy/core/common/policy_pref_names.h" #include "components/search_engines/template_url_service.h" +#include "components/services/storage/public/cpp/storage_prefs.h" #include "components/variations/variations_associated_data.h" #include "components/version_info/version_info.h" #include "content/public/browser/browsing_data_filter_builder.h" @@ -880,15 +881,13 @@ } #endif // BUILDFLAG(ENABLE_EXTENSIONS) -class ChromeContentBrowserClientSwitchTest : public testing::Test { +class ChromeContentBrowserClientSwitchTest + : public ChromeRenderViewHostTestHarness { public: ChromeContentBrowserClientSwitchTest() : testing_local_state_(TestingBrowserProcess::GetGlobal()) {} - void SetBooleanSwitchToLocalState(const std::string& path, bool value) { - testing_local_state_.Get()->SetBoolean(path, value); - } - + protected: void AppendSwitchInCurrentProcess(const base::StringPiece& switch_string) { base::CommandLine::ForCurrentProcess()->AppendSwitch(switch_string); } @@ -898,15 +897,13 @@ command_line.AppendSwitchASCII(switches::kProcessType, switches::kRendererProcess); - client_.AppendExtraCommandLineSwitches(&command_line, kFakeChildProcessId); + client_.AppendExtraCommandLineSwitches(&command_line, process()->GetID()); return command_line; } private: ScopedTestingLocalState testing_local_state_; ChromeContentBrowserClient client_; - content::BrowserTaskEnvironment task_environment_; - static const int kFakeChildProcessId = 1; }; TEST_F(ChromeContentBrowserClientSwitchTest, WebSQLAccessDefault) { @@ -915,17 +912,42 @@ } TEST_F(ChromeContentBrowserClientSwitchTest, WebSQLAccessDisabled) { - SetBooleanSwitchToLocalState(policy::policy_prefs::kWebSQLAccess, false); + profile()->GetPrefs()->SetBoolean(storage::kWebSQLAccess, false); base::CommandLine result = FetchCommandLineSwitchesForRendererProcess(); EXPECT_FALSE(result.HasSwitch(blink::switches::kWebSQLAccess)); } TEST_F(ChromeContentBrowserClientSwitchTest, WebSQLAccessEnabled) { - SetBooleanSwitchToLocalState(policy::policy_prefs::kWebSQLAccess, true); + profile()->GetPrefs()->SetBoolean(storage::kWebSQLAccess, true); base::CommandLine result = FetchCommandLineSwitchesForRendererProcess(); EXPECT_TRUE(result.HasSwitch(blink::switches::kWebSQLAccess)); } +TEST_F(ChromeContentBrowserClientSwitchTest, + WebSQLNonSecureContextEnabledDefault) { + base::CommandLine result = FetchCommandLineSwitchesForRendererProcess(); + EXPECT_FALSE( + result.HasSwitch(blink::switches::kWebSQLNonSecureContextEnabled)); +} + +TEST_F(ChromeContentBrowserClientSwitchTest, + WebSQLNonSecureContextEnabledDisabled) { + profile()->GetPrefs()->SetBoolean(storage::kWebSQLNonSecureContextEnabled, + false); + base::CommandLine result = FetchCommandLineSwitchesForRendererProcess(); + EXPECT_FALSE( + result.HasSwitch(blink::switches::kWebSQLNonSecureContextEnabled)); +} + +TEST_F(ChromeContentBrowserClientSwitchTest, + WebSQLNonSecureContextEnabledEnabled) { + profile()->GetPrefs()->SetBoolean(storage::kWebSQLNonSecureContextEnabled, + true); + base::CommandLine result = FetchCommandLineSwitchesForRendererProcess(); + EXPECT_TRUE( + result.HasSwitch(blink::switches::kWebSQLNonSecureContextEnabled)); +} + #if BUILDFLAG(IS_CHROMEOS) TEST_F(ChromeContentBrowserClientSwitchTest, ShouldSetForceAppModeSwitchInRendererProcessIfItIsSetInCurrentProcess) {
diff --git a/chrome/browser/commerce/price_tracking/android/java/src/org/chromium/chrome/browser/price_tracking/PriceTrackingButtonController.java b/chrome/browser/commerce/price_tracking/android/java/src/org/chromium/chrome/browser/price_tracking/PriceTrackingButtonController.java index 1d189d7..8c5b489f 100644 --- a/chrome/browser/commerce/price_tracking/android/java/src/org/chromium/chrome/browser/price_tracking/PriceTrackingButtonController.java +++ b/chrome/browser/commerce/price_tracking/android/java/src/org/chromium/chrome/browser/price_tracking/PriceTrackingButtonController.java
@@ -40,10 +40,11 @@ // TODO(shaktisahu): Provide accurate icon and string. mButtonData = new ButtonDataImpl(/*canShow=*/true, - AppCompatResources.getDrawable(mActivity, R.drawable.ic_toolbar_share_offset_24dp), + AppCompatResources.getDrawable(mActivity, R.drawable.price_tracking_disabled), view -> onPriceTrackingClicked(tabSupplier.get()), - R.string.share, /*supportsTinting=*/true, /*iphCommandBuilder*/ null, + R.string.enable_price_tracking_menu_item, /*supportsTinting=*/true, + /*iphCommandBuilder*/ null, /*isEnabled=*/true, AdaptiveToolbarButtonVariant.PRICE_TRACKING); }
diff --git a/chrome/browser/device_api/managed_configuration_api.cc b/chrome/browser/device_api/managed_configuration_api.cc index dc932bc..70676f3e 100644 --- a/chrome/browser/device_api/managed_configuration_api.cc +++ b/chrome/browser/device_api/managed_configuration_api.cc
@@ -256,7 +256,7 @@ return; if (configuration_url.empty()) { - PostStoreConfiguration(origin, base::DictionaryValue()); + PostStoreConfiguration(origin, base::Value::Dict()); return; } @@ -299,7 +299,7 @@ if (!decoding_result.value || !decoding_result.value->is_dict()) { VLOG(1) << "Could not fetch managed configuration for app with origin = " << origin.Serialize(); - PostStoreConfiguration(origin, base::DictionaryValue()); + PostStoreConfiguration(origin, base::Value::Dict()); return; } DictionaryPrefUpdate update(profile_->GetPrefs(), @@ -307,12 +307,12 @@ update.Get()->SetStringKey(GetOriginEncoded(origin), url_hash); // We need to transform each value into a string. - base::DictionaryValue result_dict; + base::Value::Dict result_dict; for (auto item : decoding_result.value->DictItems()) { std::string result; JSONStringValueSerializer serializer(&result); serializer.Serialize(item.second); - result_dict.SetStringPath(item.first, result); + result_dict.SetByDottedPath(item.first, result); } PostStoreConfiguration(origin, std::move(result_dict)); @@ -320,7 +320,7 @@ void ManagedConfigurationAPI::PostStoreConfiguration( const url::Origin& origin, - base::DictionaryValue configuration) { + base::Value::Dict configuration) { MaybeCreateStoreForOrigin(origin); store_map_[origin] .AsyncCall(&ManagedConfigurationStore::SetCurrentPolicy)
diff --git a/chrome/browser/device_api/managed_configuration_api.h b/chrome/browser/device_api/managed_configuration_api.h index 88d332b..a38bcac 100644 --- a/chrome/browser/device_api/managed_configuration_api.h +++ b/chrome/browser/device_api/managed_configuration_api.h
@@ -83,7 +83,7 @@ // Sends an operation to set the configured value on FILE thread. void PostStoreConfiguration(const url::Origin& origin, - base::DictionaryValue configuration); + base::Value::Dict configuration); void InformObserversIfConfigurationChanged(const url::Origin& origin, bool changed);
diff --git a/chrome/browser/device_api/managed_configuration_store.cc b/chrome/browser/device_api/managed_configuration_store.cc index b6dad5e..57de764 100644 --- a/chrome/browser/device_api/managed_configuration_store.cc +++ b/chrome/browser/device_api/managed_configuration_store.cc
@@ -19,7 +19,7 @@ } bool ManagedConfigurationStore::SetCurrentPolicy( - const base::DictionaryValue& current_configuration) { + const base::Value::Dict& current_configuration) { if (!store_) Initialize(); // Get the previous policies stored in the database. @@ -38,7 +38,7 @@ bool store_updated = false; for (auto kv : previous_policy) { - if (!current_configuration.FindKey(kv.first)) + if (!current_configuration.Find(kv.first)) removed_keys.push_back(kv.first); } value_store::ValueStoreChangeList changes;
diff --git a/chrome/browser/device_api/managed_configuration_store.h b/chrome/browser/device_api/managed_configuration_store.h index e2a2ad4..62424008c 100644 --- a/chrome/browser/device_api/managed_configuration_store.h +++ b/chrome/browser/device_api/managed_configuration_store.h
@@ -25,7 +25,7 @@ // Returns |true| if the new policy is different from the previously set // policy. - bool SetCurrentPolicy(const base::DictionaryValue& current_configuration); + bool SetCurrentPolicy(const base::Value::Dict& current_configuration); absl::optional<base::Value::Dict> Get(const std::vector<std::string>& keys); private:
diff --git a/chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.cc b/chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.cc index 42d1930a..27666ce 100644 --- a/chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.cc +++ b/chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.cc
@@ -236,6 +236,13 @@ #else std::string client_id = policy::BrowserDMTokenStorage::Get()->RetrieveClientId(); +#if BUILDFLAG(IS_CHROMEOS_LACROS) + Profile* main_profile = enterprise_connectors::GetMainProfileLacros(); + if (main_profile) { + // Prefer the user client id if available. + client_id = reporting::GetUserClientId(main_profile).value_or(client_id); + } +#endif // BUILDFLAG(IS_CHROMEOS_LACROS) // Make sure DeviceManagementService has been initialized. device_management_service->ScheduleInitialization(0); @@ -254,7 +261,7 @@ dm_token, client_id, /*user_affiliation_ids=*/std::vector<std::string>()); } -#endif +#endif // BUILDFLAG(IS_CHROMEOS_ASH) return {policy_client_desc, client}; } @@ -325,13 +332,11 @@ } #ifndef NDEBUG - // Make sure the event is a SAFE_BROWSING event in kAllReportingEvents array. + // Make sure the event is included in the kAllReportingEvents array. bool found = false; for (const auto& event : enterprise_connectors::ReportingServiceSettings::kAllReportingEvents) { - if (event.source == enterprise_connectors::ReportingConnectorEventSource:: - SAFE_BROWSING && - event.name == name) { + if (event.name == name) { found = true; break; } @@ -367,7 +372,6 @@ wrapper.Set("uploaded_successfully", uploaded); wrapper.Set(per_profile ? "profile_dm_token" : "browser_dm_token", std::move(dm_token)); - // TODO(xanth-this-cl): Also add extension events safe_browsing::WebUIInfoSingleton::GetInstance()->AddToReportingEvents( std::move(wrapper)); },
diff --git a/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc b/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc index 3a43205..8829e24a 100644 --- a/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc +++ b/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc
@@ -34,6 +34,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test.h" #include "content/public/test/download_test_observer.h" +#include "content/public/test/fenced_frame_test_util.h" #include "extensions/browser/extension_action.h" #include "extensions/browser/extension_action_manager.h" #include "extensions/browser/extension_host.h" @@ -788,7 +789,6 @@ IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, BrowserActionPopupWithIframe) { ASSERT_TRUE(embedded_test_server()->Start()); - ASSERT_TRUE(LoadExtension( test_data_dir_.AppendASCII("browser_action/popup_with_iframe"))); const Extension* extension = GetSingleLoadedExtension(); @@ -834,6 +834,71 @@ EXPECT_TRUE(ClosePopup()); } +class BrowserActionInteractiveFencedFrameTest + : public BrowserActionInteractiveTest { + public: + ~BrowserActionInteractiveFencedFrameTest() override = default; + + content::test::FencedFrameTestHelper& fenced_frame_test_helper() { + return fenced_frame_test_helper_; + } + + private: + content::test::FencedFrameTestHelper fenced_frame_test_helper_; +}; + +IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveFencedFrameTest, + BrowserActionPopupWithFencedFrame) { + net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); + https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_TEST_NAMES); + https_server.ServeFilesFromSourceDirectory("chrome/test/data"); + ASSERT_TRUE(https_server.Start()); + + ASSERT_TRUE(LoadExtension( + test_data_dir_.AppendASCII("browser_action/popup_with_fencedframe"))); + const Extension* extension = GetSingleLoadedExtension(); + ASSERT_TRUE(extension) << message_; + + // Simulate a click on the browser action to open the popup. + ASSERT_TRUE(OpenPopupViaToolbar(extension->id())); + + // Find a primary main frame associated in the popup. + extensions::ProcessManager* manager = + extensions::ProcessManager::Get(browser()->profile()); + std::set<content::RenderFrameHost*> hosts = + manager->GetRenderFrameHostsForExtension(extension->id()); + const auto& it = + base::ranges::find_if(hosts, [](content::RenderFrameHost* host) { + return host->IsInPrimaryMainFrame(); + }); + content::RenderFrameHost* primary_rfh = (it != hosts.end()) ? *it : nullptr; + ASSERT_TRUE(primary_rfh); + + // Navigate the popup's fenced frame to a (cross-site) web page via its + // parent, and wait for that page to send a message, which will ensure that + // the page has loaded. + GURL foo_url(https_server.GetURL("a.test", "/popup_fencedframe.html")); + + content::RenderFrameHost* fenced_frame_rfh = + fenced_frame_test_helper().GetMostRecentlyAddedFencedFrame(primary_rfh); + ASSERT_TRUE(fenced_frame_rfh); + + RenderFrameChangedWatcher watcher( + content::WebContents::FromRenderFrameHost(fenced_frame_rfh)); + std::string script = + "document.querySelector('fencedframe').src = '" + foo_url.spec() + "'"; + EXPECT_TRUE(ExecuteScript(primary_rfh, script)); + fenced_frame_rfh = watcher.WaitAndReturnNewFrame(); + + // Confirm that the new page (popup_fencedframe.html) is actually loaded. + content::DOMMessageQueue dom_message_queue(fenced_frame_rfh); + std::string json; + EXPECT_TRUE(dom_message_queue.WaitForMessage(&json)); + EXPECT_EQ("\"DONE\"", json); + + EXPECT_TRUE(ClosePopup()); +} + class NavigatingExtensionPopupInteractiveTest : public BrowserActionInteractiveTest { public:
diff --git a/chrome/browser/extensions/api/image_writer_private/operation_chromeos.cc b/chrome/browser/extensions/api/image_writer_private/operation_chromeos.cc index 61ed8e2..99fecf62 100644 --- a/chrome/browser/extensions/api/image_writer_private/operation_chromeos.cc +++ b/chrome/browser/extensions/api/image_writer_private/operation_chromeos.cc
@@ -10,7 +10,6 @@ #include "base/bind.h" #include "chrome/browser/extensions/api/image_writer_private/error_constants.h" #include "chrome/browser/extensions/api/image_writer_private/operation.h" -#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/image_burner/image_burner_client.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" @@ -31,9 +30,7 @@ return; } - chromeos::DBusThreadManager::Get()-> - GetImageBurnerClient()-> - ResetEventHandlers(); + chromeos::ImageBurnerClient::Get()->ResetEventHandlers(); } } // namespace @@ -95,8 +92,7 @@ DCHECK_CURRENTLY_ON(BrowserThread::UI); // TODO(haven): Image Burner cannot handle multiple burns. crbug.com/373575 - ImageBurnerClient* burner = - chromeos::DBusThreadManager::Get()->GetImageBurnerClient(); + ImageBurnerClient* burner = chromeos::ImageBurnerClient::Get(); burner->SetEventHandlers( base::BindOnce(&Operation::OnBurnFinished, this, std::move(continuation)),
diff --git a/chrome/browser/extensions/api/image_writer_private/test_utils.cc b/chrome/browser/extensions/api/image_writer_private/test_utils.cc index ab8c0ec..3670f23 100644 --- a/chrome/browser/extensions/api/image_writer_private/test_utils.cc +++ b/chrome/browser/extensions/api/image_writer_private/test_utils.cc
@@ -23,14 +23,13 @@ #include "chromeos/ash/components/dbus/concierge/concierge_client.h" #include "chromeos/dbus/dbus_thread_manager.h" // nogncheck #include "chromeos/dbus/image_burner/fake_image_burner_client.h" +#include "chromeos/dbus/image_burner/image_burner_client.h" #endif namespace extensions { namespace image_writer { #if BUILDFLAG(IS_CHROMEOS_ASH) -namespace { - class ImageWriterFakeImageBurnerClient : public chromeos::FakeImageBurnerClient { public: @@ -65,8 +64,6 @@ BurnFinishedHandler burn_finished_handler_; BurnProgressUpdateHandler burn_progress_update_handler_; }; - -} // namespace #endif MockOperationManager::MockOperationManager(content::BrowserContext* context) @@ -249,8 +246,8 @@ ash::ConciergeClient::InitializeFake( /*fake_cicerone_client=*/nullptr); } - chromeos::DBusThreadManager::GetSetterForTesting()->SetImageBurnerClient( - std::make_unique<ImageWriterFakeImageBurnerClient>()); + image_burner_client_ = std::make_unique<ImageWriterFakeImageBurnerClient>(); + chromeos::ImageBurnerClient::SetInstanceForTest(image_burner_client_.get()); } FakeDiskMountManager* disk_manager = new FakeDiskMountManager(); @@ -272,6 +269,9 @@ void ImageWriterTestUtils::TearDown() { #if BUILDFLAG(IS_CHROMEOS_ASH) + chromeos::ImageBurnerClient::SetInstanceForTest(nullptr); + image_burner_client_.reset(); + if (chromeos::DBusThreadManager::IsInitialized()) { // When in browser_tests, this path is not taken. These clients have already // been shut down by chromeos::ShutdownDBus().
diff --git a/chrome/browser/extensions/api/image_writer_private/test_utils.h b/chrome/browser/extensions/api/image_writer_private/test_utils.h index 68970d4c..9b4b136 100644 --- a/chrome/browser/extensions/api/image_writer_private/test_utils.h +++ b/chrome/browser/extensions/api/image_writer_private/test_utils.h
@@ -30,6 +30,10 @@ namespace extensions { namespace image_writer { +#if BUILDFLAG(IS_CHROMEOS_ASH) +class ImageWriterFakeImageBurnerClient; +#endif + const char kDummyExtensionId[] = "DummyExtension"; // Default file size to use in tests. Currently 32kB. @@ -186,7 +190,9 @@ base::FilePath test_image_path_; base::FilePath test_device_path_; -#if !BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS_ASH) + std::unique_ptr<ImageWriterFakeImageBurnerClient> image_burner_client_; +#else scoped_refptr<FakeImageWriterClient> client_; ImageWriterUtilityClient::ImageWriterUtilityClientFactory utility_client_factory_;
diff --git a/chrome/browser/extensions/api/permissions/permissions_apitest.cc b/chrome/browser/extensions/api/permissions/permissions_apitest.cc index cc5cdc6..c6d0a373 100644 --- a/chrome/browser/extensions/api/permissions/permissions_apitest.cc +++ b/chrome/browser/extensions/api/permissions/permissions_apitest.cc
@@ -100,8 +100,9 @@ << message_; } -// TODO(crbug/1065399): Flaky on ChromeOS and Linux non-dbg builds. -#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && defined(NDEBUG) +// TODO(crbug/1065399): Flaky on ChromeOS, Linux, and Mac non-dbg builds. +#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)) && \ + defined(NDEBUG) #define MAYBE_FaviconPermission DISABLED_FaviconPermission #else #define MAYBE_FaviconPermission FaviconPermission
diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc index 0ed4b54c..efb2269 100644 --- a/chrome/browser/extensions/api/settings_private/prefs_util.cc +++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -182,6 +182,8 @@ settings_api::PrefType::PREF_TYPE_BOOLEAN; (*s_allowlist)[bookmarks::prefs::kShowBookmarkBar] = settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_allowlist)[::prefs::kSidePanelHorizontalAlignment] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete.
diff --git a/chrome/browser/extensions/api/storage/policy_value_store.cc b/chrome/browser/extensions/api/storage/policy_value_store.cc index 8b9b7ef..8958996 100644 --- a/chrome/browser/extensions/api/storage/policy_value_store.cc +++ b/chrome/browser/extensions/api/storage/policy_value_store.cc
@@ -42,10 +42,10 @@ DCHECK(IsOnBackendSequence()); // Convert |policy| to a dictionary value. Only include mandatory policies // for now. - base::DictionaryValue current_policy; + base::Value::Dict current_policy; for (const auto& it : policy) { if (it.second.level == policy::POLICY_LEVEL_MANDATORY) { - current_policy.SetKey(it.first, it.second.value_unsafe()->Clone()); + current_policy.Set(it.first, it.second.value_unsafe()->Clone()); } } @@ -70,7 +70,7 @@ // anymore. std::vector<std::string> removed_keys; for (auto kv : previous_policy) { - if (!current_policy.FindKey(kv.first)) + if (!current_policy.Find(kv.first)) removed_keys.push_back(kv.first); } @@ -149,7 +149,7 @@ ValueStore::WriteResult PolicyValueStore::Set( WriteOptions options, - const base::DictionaryValue& settings) { + const base::Value::Dict& settings) { return WriteResult(ReadOnlyError()); }
diff --git a/chrome/browser/extensions/api/storage/policy_value_store.h b/chrome/browser/extensions/api/storage/policy_value_store.h index e202a7c..bf9ee43 100644 --- a/chrome/browser/extensions/api/storage/policy_value_store.h +++ b/chrome/browser/extensions/api/storage/policy_value_store.h
@@ -55,7 +55,7 @@ const std::string& key, const base::Value& value) override; WriteResult Set(WriteOptions options, - const base::DictionaryValue& values) override; + const base::Value::Dict& values) override; WriteResult Remove(const std::string& key) override; WriteResult Remove(const std::vector<std::string>& keys) override; WriteResult Clear() override;
diff --git a/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc b/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc index 58d5071..90a86e2 100644 --- a/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc +++ b/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc
@@ -90,7 +90,7 @@ } WriteResult Set(WriteOptions options, - const base::DictionaryValue& values) override { + const base::Value::Dict& values) override { return delegate()->Set(options, values); } @@ -180,8 +180,8 @@ base::Value string_value("value"); EXPECT_FALSE(store_->Set(options, "key", string_value).status().ok()); - base::DictionaryValue dict; - dict.SetStringKey("key", "value"); + base::Value::Dict dict; + dict.Set("key", "value"); EXPECT_FALSE(store_->Set(options, dict).status().ok()); EXPECT_FALSE(store_->Remove("key").status().ok());
diff --git a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc index a171433..73f873ed 100644 --- a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc +++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
@@ -97,7 +97,8 @@ } ValueStore::WriteResult SyncableSettingsStorage::Set( - WriteOptions options, const base::DictionaryValue& values) { + WriteOptions options, + const base::Value::Dict& values) { DCHECK(IsOnBackendSequence()); WriteResult result = HandleResult(delegate_->Set(options, values)); if (!result.status().ok())
diff --git a/chrome/browser/extensions/api/storage/syncable_settings_storage.h b/chrome/browser/extensions/api/storage/syncable_settings_storage.h index 7712c8c9..4f7c328c 100644 --- a/chrome/browser/extensions/api/storage/syncable_settings_storage.h +++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.h
@@ -54,7 +54,7 @@ const std::string& key, const base::Value& value) override; WriteResult Set(WriteOptions options, - const base::DictionaryValue& values) override; + const base::Value::Dict& values) override; WriteResult Remove(const std::string& key) override; WriteResult Remove(const std::vector<std::string>& keys) override; WriteResult Clear() override;
diff --git a/chrome/browser/extensions/offscreen_document_browsertest.cc b/chrome/browser/extensions/offscreen_document_browsertest.cc index 0aebedb..15dc90c 100644 --- a/chrome/browser/extensions/offscreen_document_browsertest.cc +++ b/chrome/browser/extensions/offscreen_document_browsertest.cc
@@ -4,6 +4,7 @@ #include "extensions/browser/offscreen_document_host.h" +#include "base/test/bind.h" #include "base/test/scoped_feature_list.h" #include "base/test/values_test_util.h" #include "chrome/browser/devtools/devtools_window.h" @@ -579,4 +580,73 @@ expect_navigation_failure(extension->GetResourceURL("other.html")); } +// Tests calling window.close() in an offscreen document. +IN_PROC_BROWSER_TEST_F(OffscreenDocumentBrowserTest, CallWindowClose) { + static constexpr char kManifest[] = + R"({ + "name": "Offscreen Document Test", + "manifest_version": 3, + "version": "0.1" + })"; + TestExtensionDir test_dir; + test_dir.WriteManifest(kManifest); + test_dir.WriteFile(FILE_PATH_LITERAL("offscreen.html"), + "<html>offscreen</html>"); + + const Extension* extension = LoadExtension(test_dir.UnpackedPath()); + ASSERT_TRUE(extension); + const GURL offscreen_url = extension->GetResourceURL("offscreen.html"); + + { + std::unique_ptr<OffscreenDocumentHost> offscreen_document = + CreateOffscreenDocument(*extension, offscreen_url); + // Create a simple handler for the window.close() call that deletes the + // document. + base::RunLoop run_loop; + auto close_handler = [&run_loop, &offscreen_document](ExtensionHost* host) { + ASSERT_EQ(offscreen_document.get(), host); + offscreen_document.reset(); + run_loop.Quit(); + }; + offscreen_document->SetCloseHandler( + base::BindOnce(base::BindLambdaForTesting(close_handler))); + content::ExecuteScriptAsync(offscreen_document->host_contents(), + "window.close();"); + run_loop.Run(); + // The close handler should have been invoked. + EXPECT_EQ(nullptr, offscreen_document); + } + + { + std::unique_ptr<OffscreenDocumentHost> offscreen_document = + CreateOffscreenDocument(*extension, offscreen_url); + + // Repeat the test, but don't actually close the document in response to + // the call (which simulates an asynchronous close). This allows the + // window to call close() multiple times. Even though it does so, we should + // only receive the signal from the OffscreenDocumentHost once. + size_t close_count = 0; + auto close_handler = [&close_count, + &offscreen_document](ExtensionHost* host) { + ASSERT_EQ(offscreen_document.get(), host); + ++close_count; + }; + offscreen_document->SetCloseHandler( + base::BindOnce(base::BindLambdaForTesting(close_handler))); + + content::WebContents* contents = offscreen_document->host_contents(); + ASSERT_TRUE(content::ExecuteScript(contents, "window.close();")); + // Unfortunately, ExecuteScript() and the call to + // WebContentsDelegate::CloseContents() race with each other. Add an ugly + // RunUntilIdle() to "solve" it. + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(1u, close_count); + // Repeat the close() call. It shouldn't fire the close handler a second + // time. + ASSERT_TRUE(content::ExecuteScript(contents, "window.close();")); + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(1u, close_count); + } +} + } // namespace extensions
diff --git a/chrome/browser/extensions/user_host_restrictions_browsertest.cc b/chrome/browser/extensions/user_host_restrictions_browsertest.cc index 0946d35..b6e7310 100644 --- a/chrome/browser/extensions/user_host_restrictions_browsertest.cc +++ b/chrome/browser/extensions/user_host_restrictions_browsertest.cc
@@ -56,6 +56,36 @@ return sessions::SessionTabHelper::IdForTab(GetActiveTab()).id(); } + // Withholds host permissions from `extension` and waits for the withholding + // to take effect. + void WithholdExtensionPermissions(const Extension& extension) { + // Withhold extension host permissions. Wait for the notification to be + // fired to ensure all renderers and services have been properly updated. + auto is_update_for_extension = + [&extension](const content::NotificationSource& source, + const content::NotificationDetails& details) { + UpdatedExtensionPermissionsInfo* info = + content::Details<UpdatedExtensionPermissionsInfo>(details).ptr(); + return info->extension->id() == extension.id(); + }; + content::WindowedNotificationObserver permissions_observer( + NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, + base::BindLambdaForTesting(is_update_for_extension)); + ScriptingPermissionsModifier(profile(), &extension) + .SetWithholdHostPermissions(true); + permissions_observer.Wait(); + } + + // Adds `url` as a new user-permitted site and waits for the change to take + // effect. + void AddUserPermittedSite(const GURL& url) { + PermissionsManager* permissions_manager = + PermissionsManager::Get(profile()); + PermissionsManagerWaiter waiter(permissions_manager); + permissions_manager->AddUserPermittedSite(url::Origin::Create(url)); + waiter.WaitForPermissionsChange(); + }; + private: base::test::ScopedFeatureList feature_list_; }; @@ -295,23 +325,7 @@ const GURL unrequested_url = embedded_test_server()->GetURL("unrequested.example", "/title3.html"); - { - // Withhold extension host permissions. Wait for the notification to be - // fired to ensure all renderers and services have been properly updated. - auto is_update_for_extension = - [extension](const content::NotificationSource& source, - const content::NotificationDetails& details) { - UpdatedExtensionPermissionsInfo* info = - content::Details<UpdatedExtensionPermissionsInfo>(details).ptr(); - return info->extension->id() == extension->id(); - }; - content::WindowedNotificationObserver permissions_observer( - NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, - base::BindLambdaForTesting(is_update_for_extension)); - ScriptingPermissionsModifier(profile(), extension) - .SetWithholdHostPermissions(true); - permissions_observer.Wait(); - } + WithholdExtensionPermissions(*extension); const int kTabId = extension_misc::kUnknownTabId; @@ -333,14 +347,8 @@ // Next, simulate the user granting all extensions access to `allowed_url` and // `unrequested_url`. - PermissionsManager* permissions_manager = PermissionsManager::Get(profile()); - auto add_user_permitted_site = [permissions_manager](const GURL& url) { - PermissionsManagerWaiter waiter(permissions_manager); - permissions_manager->AddUserPermittedSite(url::Origin::Create(url)); - waiter.WaitForPermissionsChange(); - }; - add_user_permitted_site(allowed_url); - add_user_permitted_site(unrequested_url); + AddUserPermittedSite(allowed_url); + AddUserPermittedSite(unrequested_url); // Now, the extension should be allowed to run on the `allowed_url`, but // `restricted_url` should remain withheld. @@ -376,6 +384,8 @@ // only had access to this URL via it being a user-permitted URL (and not // via an explicit grant), the extension should lose access to the URL. { + PermissionsManager* permissions_manager = + PermissionsManager::Get(profile()); PermissionsManagerWaiter waiter(permissions_manager); permissions_manager->RemoveUserPermittedSite( url::Origin::Create(allowed_url)); @@ -400,4 +410,63 @@ // (in case the implementation changes). } +// Tests that user permitted sites are persisted and granted on extension load. +IN_PROC_BROWSER_TEST_P(UserHostRestrictionsBrowserTest, + PRE_UserPermittedSitesArePersisted) { + // Note: We need a "real" extension here (instead of just a TestExtensionDir) + // because it needs to persist for the next test. + const Extension* extension = + LoadExtension(test_data_dir_.AppendASCII("simple_all_urls")); + ASSERT_TRUE(extension); + + WithholdExtensionPermissions(*extension); + + // Note: We don't use `embedded_test_server` to grab a URL here because the + // port would (potentially) change between the PRE_ test and the second test. + // Instead, just use a constructed URL. Since all we check is the permissions + // data, we don't need the URL to actually load in the browsertest. + const GURL allowed_url("https://example.com"); + + EXPECT_EQ(PermissionsData::PageAccess::kWithheld, + extension->permissions_data()->GetPageAccess( + allowed_url, extension_misc::kUnknownTabId, nullptr)); + + AddUserPermittedSite(allowed_url); + // Technically, this should only happen if the feature is enabled. However, + // we only add user-permitted sites when the feature is enabled. We can't + // DCHECK that (because then the version of these tests without the feature + // don't work), so we somewhat awkwardly just allow it to take effect + // (knowing that it shouldn't happen outside of tests). + EXPECT_EQ(PermissionsData::PageAccess::kAllowed, + extension->permissions_data()->GetPageAccess( + allowed_url, extension_misc::kUnknownTabId, nullptr)); +} + +IN_PROC_BROWSER_TEST_P(UserHostRestrictionsBrowserTest, + UserPermittedSitesArePersisted) { + const Extension* found_extension = nullptr; + for (const auto& extension : + ExtensionRegistry::Get(profile())->enabled_extensions()) { + if (extension->name() == "All Urls Extension") { + found_extension = extension.get(); + break; + } + } + ASSERT_TRUE(found_extension); + + const GURL example_com("https://example.com"); + // The user-permitted site should be allowed if and only if the feature is + // enabled (unlike the test above, our load-time granting *is* guarded behind + // the feature flag). + if (GetParam()) { + EXPECT_EQ(PermissionsData::PageAccess::kAllowed, + found_extension->permissions_data()->GetPageAccess( + example_com, extension_misc::kUnknownTabId, nullptr)); + } else { + EXPECT_EQ(PermissionsData::PageAccess::kWithheld, + found_extension->permissions_data()->GetPageAccess( + example_com, extension_misc::kUnknownTabId, nullptr)); + } +} + } // namespace extensions
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 82c118c..7ad19b9 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -163,6 +163,11 @@ "expiry_milestone": 107 }, { + "name": "android-media-picker", + "owners": [ "finnur@google.com", "beverloo@google.com" ], + "expiry_milestone": 140 + }, + { "name": "android-picture-in-picture-api", "owners": [ "steimel", "jazzhsu", "media-dev" ], "expiry_milestone": 120 @@ -4060,16 +4065,6 @@ "expiry_milestone": 115 }, { - "name": "launcher-nudge", - "owners": [ "wcwang", "//ash/app_list/OWNERS" ], - "expiry_milestone": 104 - }, - { - "name": "launcher-nudge-short-interval", - "owners": [ "wcwang", "//ash/app_list/OWNERS" ], - "expiry_milestone": 104 - }, - { "name": "launcher-play-store-search", "owners": [ "amandadeacon", "tby", "wrong" ], "expiry_milestone": 105
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 9ebd2e4..ce6469e 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -3140,6 +3140,10 @@ "When enabled the app language prompt to change the UI language will" "always be shown."; +const char kAndroidMediaPickerSupportName[] = "Android Media Picker"; +const char kAndroidMediaPickerSupportDescription[] = + "When enabled the Android Media picker is used instead of the Chrome one."; + const char kAndroidSurfaceControlName[] = "Android SurfaceControl"; const char kAndroidSurfaceControlDescription[] = " Enables SurfaceControl to manage the buffer queue for the " @@ -5721,15 +5725,6 @@ "Adds a 'Hide all suggestions' option to the continue section item " "right-click menus."; -const char kLauncherNudgeName[] = "Enable launcher nudge"; -const char kLauncherNudgeDescription[] = - "Enables nudges that bring new users' attention to the launcher button."; - -const char kLauncherNudgeShortIntervalName[] = - "Enable short intervals for launcher nudge"; -const char kLauncherNudgeShortIntervalDescription[] = - "Enables short intervals for launcher nudge for testing"; - const char kLauncherPulsingBlocksRefreshName[] = "Launcher pulsing blocks' new UI"; const char kLauncherPulsingBlocksRefreshDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 68556fe2..f5d6dee 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1769,6 +1769,9 @@ extern const char kAndroidForceAppLanguagePromptName[]; extern const char kAndroidForceAppLanguagePromptDescription[]; +extern const char kAndroidMediaPickerSupportName[]; +extern const char kAndroidMediaPickerSupportDescription[]; + extern const char kAndroidSurfaceControlName[]; extern const char kAndroidSurfaceControlDescription[]; @@ -3281,12 +3284,6 @@ extern const char kLauncherHideContinueSectionName[]; extern const char kLauncherHideContinueSectionDescription[]; -extern const char kLauncherNudgeName[]; -extern const char kLauncherNudgeDescription[]; - -extern const char kLauncherNudgeShortIntervalName[]; -extern const char kLauncherNudgeShortIntervalDescription[]; - extern const char kLauncherPulsingBlocksRefreshName[]; extern const char kLauncherPulsingBlocksRefreshDescription[];
diff --git a/chrome/browser/hid/hid_browsertest.cc b/chrome/browser/hid/hid_browsertest.cc index 430e3d6..4c78b9fc 100644 --- a/chrome/browser/hid/hid_browsertest.cc +++ b/chrome/browser/hid/hid_browsertest.cc
@@ -5,7 +5,6 @@ #include <memory> #include <string> #include <utility> -#include "build/build_config.h" #include "base/memory/raw_ptr.h" #include "base/test/bind.h" @@ -126,10 +125,22 @@ void TearDownOnMainThread() override { #if BUILDFLAG(IS_CHROMEOS_ASH) + // Explicitly removing the user is required; otherwise ProfileHelper keeps + // a dangling pointer to the User. + // TODO(b/208629291): Consider removing all users from ProfileHelper in the + // destructor of ash::FakeChromeUserManager. + GetFakeUserManager()->RemoveUserFromList(kManagedUserAccountId); scoped_user_manager_.reset(); #endif // BUILDFLAG(IS_CHROMEOS_ASH) } +#if BUILDFLAG(IS_CHROMEOS_ASH) + ash::FakeChromeUserManager* GetFakeUserManager() const { + return static_cast<ash::FakeChromeUserManager*>( + user_manager::UserManager::Get()); + } +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + void SetUpPolicy(const Extension* extension) { g_browser_process->local_state()->Set( prefs::kManagedWebHidAllowDevicesForUrls, @@ -190,14 +201,7 @@ } }; -// TODO(crbug.com/1342174): Re-enable this test -#if BUILDFLAG(IS_CHROMEOS) -#define MAYBE_FeatureDefaultDisabled DISABLED_FeatureDefaultDisabled -#else -#define MAYBE_FeatureDefaultDisabled FeatureDefaultDisabled -#endif -IN_PROC_BROWSER_TEST_F(WebHidExtensionBrowserTest, - MAYBE_FeatureDefaultDisabled) { +IN_PROC_BROWSER_TEST_F(WebHidExtensionBrowserTest, FeatureDefaultDisabled) { extensions::TestExtensionDir test_dir; constexpr char kBackgroundJs[] = R"( @@ -215,14 +219,8 @@ LoadExtensionAndRunTest(kBackgroundJs); } -// TODO(crbug.com/1342174): Re-enable this test -#if BUILDFLAG(IS_CHROMEOS) -#define MAYBE_FeatureDisabled DISABLED_FeatureDisabled -#else -#define MAYBE_FeatureDisabled FeatureDisabled -#endif IN_PROC_BROWSER_TEST_F(WebHidExtensionFeatureDisabledBrowserTest, - MAYBE_FeatureDisabled) { + FeatureDisabled) { extensions::TestExtensionDir test_dir; constexpr char kBackgroundJs[] = R"( @@ -240,14 +238,7 @@ LoadExtensionAndRunTest(kBackgroundJs); } -// TODO(crbug.com/1342174): Re-enable this test -#if BUILDFLAG(IS_CHROMEOS) -#define MAYBE_GetDevices DISABLED_GetDevices -#else -#define MAYBE_GetDevices GetDevices -#endif -IN_PROC_BROWSER_TEST_F(WebHidExtensionFeatureEnabledBrowserTest, - MAYBE_GetDevices) { +IN_PROC_BROWSER_TEST_F(WebHidExtensionFeatureEnabledBrowserTest, GetDevices) { extensions::TestExtensionDir test_dir; auto device = CreateTestDeviceWithInputAndOutputReports(); @@ -268,14 +259,8 @@ LoadExtensionAndRunTest(kBackgroundJs); } -// TODO(crbug.com/1342174): Re-enable this test -#if BUILDFLAG(IS_CHROMEOS) -#define MAYBE_RequestDevice DISABLED_RequestDevice -#else -#define MAYBE_RequestDevice RequestDevice -#endif IN_PROC_BROWSER_TEST_F(WebHidExtensionFeatureEnabledBrowserTest, - MAYBE_RequestDevice) { + RequestDevice) { extensions::TestExtensionDir test_dir; constexpr char kBackgroundJs[] = R"(
diff --git a/chrome/browser/metrics/bluetooth_metrics_provider.cc b/chrome/browser/metrics/bluetooth_metrics_provider.cc index 273f4a66..cc3a47e 100644 --- a/chrome/browser/metrics/bluetooth_metrics_provider.cc +++ b/chrome/browser/metrics/bluetooth_metrics_provider.cc
@@ -77,7 +77,7 @@ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) bool is_initialized; - if (base::FeatureList::IsEnabled(floss::features::kFlossEnabled)) { + if (floss::features::IsFlossEnabled()) { bluetooth_stack_name_ = BluetoothStackName::kFloss; is_initialized = floss::FlossDBusManager::IsInitialized(); } else {
diff --git a/chrome/browser/optimization_guide/page_content_annotations_service_browsertest.cc b/chrome/browser/optimization_guide/page_content_annotations_service_browsertest.cc index 1ce9dad..65da319 100644 --- a/chrome/browser/optimization_guide/page_content_annotations_service_browsertest.cc +++ b/chrome/browser/optimization_guide/page_content_annotations_service_browsertest.cc
@@ -6,6 +6,8 @@ #include "base/path_service.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" +#include "base/test/scoped_run_loop_timeout.h" +#include "base/time/time.h" #include "build/build_config.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/optimization_guide/browser_test_util.h" @@ -453,12 +455,15 @@ private: base::test::ScopedFeatureList scoped_feature_list_; + // Actual model execution can take a little while, so try to keep tests from + // flaking. + const base::test::ScopedRunLoopTimeout scoped_timeout_{FROM_HERE, + base::Seconds(60)}; bool load_model_on_startup_ = true; }; -// Disabled. https://crbug.com/1338408 IN_PROC_BROWSER_TEST_F(PageContentAnnotationsServiceBrowserTest, - DISABLED_ModelExecutes) { + ModelExecutes) { base::HistogramTester histogram_tester; ukm::TestAutoSetUkmRecorder ukm_recorder; @@ -732,16 +737,8 @@ base::test::ScopedFeatureList scoped_feature_list_; }; -// Flaky on Linux Tests (dbg): crbug.com/1338040 -#if BUILDFLAG(IS_LINUX) && !defined(NDEBUG) -#define MAYBE_ModelExecutesButDoesntWriteToHistory \ - DISABLED_ModelExecutesButDoesntWriteToHistory -#else -#define MAYBE_ModelExecutesButDoesntWriteToHistory \ - ModelExecutesButDoesntWriteToHistory -#endif IN_PROC_BROWSER_TEST_F(PageContentAnnotationsServiceNoHistoryTest, - MAYBE_ModelExecutesButDoesntWriteToHistory) { + ModelExecutesButDoesntWriteToHistory) { base::HistogramTester histogram_tester; GURL url(embedded_test_server()->GetURL("a.com", "/hello.html")); @@ -765,15 +762,8 @@ EXPECT_FALSE(GetContentAnnotationsForURL(url).has_value()); } -// Flaky on Linux Tests (dbg): crbug.com/1338408 -#if BUILDFLAG(IS_LINUX) && !defined(NDEBUG) -#define MAYBE_ModelExecutesAndUsesCachedResult \ - DISABLED_ModelExecutesAndUsesCachedResult -#else -#define MAYBE_ModelExecutesAndUsesCachedResult ModelExecutesAndUsesCachedResult -#endif IN_PROC_BROWSER_TEST_F(PageContentAnnotationsServiceNoHistoryTest, - MAYBE_ModelExecutesAndUsesCachedResult) { + ModelExecutesAndUsesCachedResult) { { base::HistogramTester histogram_tester;
diff --git a/chrome/browser/performance_manager/policies/background_tab_loading_policy.cc b/chrome/browser/performance_manager/policies/background_tab_loading_policy.cc index eb76d9b..0ffb5cb 100644 --- a/chrome/browser/performance_manager/policies/background_tab_loading_policy.cc +++ b/chrome/browser/performance_manager/policies/background_tab_loading_policy.cc
@@ -486,11 +486,8 @@ size_t BackgroundTabLoadingPolicy::GetFreePhysicalMemoryMib() const { if (free_memory_mb_for_testing_ != 0) return free_memory_mb_for_testing_; - constexpr int64_t kMibibytesInBytes = 1 << 20; - int64_t free_mem = - base::SysInfo::AmountOfAvailablePhysicalMemory() / kMibibytesInBytes; - DCHECK_GE(free_mem, 0); - return free_mem; + constexpr uint64_t kMibibytesInBytes = 1 << 20; + return base::SysInfo::AmountOfAvailablePhysicalMemory() / kMibibytesInBytes; } void BackgroundTabLoadingPolicy::ErasePageNodeToLoadData(
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index a82db3e..d6ada641 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -97,6 +97,7 @@ #include "components/search_engines/search_engines_pref_names.h" #include "components/security_interstitials/core/https_only_mode_policy_handler.h" #include "components/security_interstitials/core/pref_names.h" +#include "components/services/storage/public/cpp/storage_prefs.h" #include "components/signin/public/base/signin_pref_names.h" #include "components/spellcheck/spellcheck_buildflags.h" #include "components/sync/base/pref_names.h" @@ -712,9 +713,11 @@ { key::kCloudManagementEnrollmentMandatory, policy_prefs::kCloudManagementEnrollmentMandatory, base::Value::Type::BOOLEAN }, + #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) { key::kRequireOnlineRevocationChecksForLocalAnchors, prefs::kCertRevocationCheckingRequiredLocalAnchors, base::Value::Type::BOOLEAN }, +#endif // #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) { key::kAuthSchemes, prefs::kAuthSchemes, base::Value::Type::STRING }, @@ -1663,7 +1666,10 @@ prefs::kForceMajorVersionToMinorPositionInUserAgent, base::Value::Type::INTEGER}, { key::kWebSQLAccess, - policy_prefs::kWebSQLAccess, + storage::kWebSQLAccess, + base::Value::Type::BOOLEAN }, + { key::kWebSQLNonSecureContextEnabled, + storage::kWebSQLNonSecureContextEnabled, base::Value::Type::BOOLEAN }, #if BUILDFLAG(IS_MAC) { key::kWarnBeforeQuittingEnabled, @@ -2334,10 +2340,12 @@ #endif #if BUILDFLAG(ENABLE_SPELLCHECK) +#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) handlers->AddHandler(std::make_unique<SpellcheckLanguagePolicyHandler>()); handlers->AddHandler( std::make_unique<SpellcheckLanguageBlocklistPolicyHandler>( policy::key::kSpellcheckLanguageBlocklist)); +#endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) #endif // BUILDFLAG(ENABLE_SPELLCHECK) #if BUILDFLAG(IS_LINUX)
diff --git a/chrome/browser/policy/messaging_layer/public/report_client.cc b/chrome/browser/policy/messaging_layer/public/report_client.cc index 526e334..325b1b2 100644 --- a/chrome/browser/policy/messaging_layer/public/report_client.cc +++ b/chrome/browser/policy/messaging_layer/public/report_client.cc
@@ -77,8 +77,10 @@ // UploadClient. class ReportingClient::Uploader : public UploaderInterface { public: - using UploadCallback = base::OnceCallback< - Status(bool, std::vector<EncryptedRecord>, ScopedReservation)>; + using UploadCallback = + base::OnceCallback<Status(bool, + std::vector<EncryptedRecord>, + absl::optional<ScopedReservation>)>; static std::unique_ptr<Uploader> Create(bool need_encryption_key, UploadCallback upload_callback) { @@ -127,7 +129,7 @@ bool completed_{false}; const bool need_encryption_key_; std::vector<EncryptedRecord> encrypted_records_; - ScopedReservation encrypted_records_reservation_; + absl::optional<ScopedReservation> encrypted_records_reservation_; UploadCallback upload_callback_; }; @@ -155,7 +157,9 @@ return; } encrypted_records_.emplace_back(std::move(data)); - encrypted_records_reservation_.HandOver(scoped_reservation); + if (encrypted_records_reservation_.has_value()) { + encrypted_records_reservation_.value().HandOver(scoped_reservation); + } std::move(processed_cb).Run(true); } @@ -194,6 +198,8 @@ std::move(upload_callback_) .Run(need_encryption_key_, std::move(encrypted_records_), std::move(encrypted_records_reservation_)); + // Make sure the reservation is invalidated. + encrypted_records_reservation_.reset(); if (!upload_status.ok()) { LOG(ERROR) << "Unable to upload records: " << upload_status; } @@ -350,10 +356,12 @@ [](EncryptedReportingUploadProvider* upload_provider, bool need_encryption_key, std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation) { + absl::optional<ScopedReservation> scoped_reservation) { upload_provider->RequestUploadEncryptedRecords( need_encryption_key, std::move(records), std::move(scoped_reservation), base::DoNothing()); + // Make sure reservation is invalidated. + scoped_reservation.reset(); return Status::StatusOK(); }, base::Unretained(instance->upload_provider_.get())));
diff --git a/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service.cc b/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service.cc index 03e8d8e..72bddda9 100644 --- a/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service.cc +++ b/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service.cc
@@ -72,7 +72,7 @@ DmServerUploader::DmServerUploader( bool need_encryption_key, std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, RecordHandler* handler, ReportSuccessfulUploadCallback report_success_upload_cb, EncryptionKeyAttachedCallback encryption_key_attached_cb, @@ -209,7 +209,7 @@ Status DmServerUploadService::EnqueueUpload( bool need_encryption_key, std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, ReportSuccessfulUploadCallback report_upload_success_cb, EncryptionKeyAttachedCallback encryption_key_attached_cb) { Start<DmServerUploader>(need_encryption_key, std::move(records),
diff --git a/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service.h b/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service.h index ec2b473b..ab62332c 100644 --- a/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service.h +++ b/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service.h
@@ -102,7 +102,7 @@ DmServerUploader( bool need_encryption_key, std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, RecordHandler* handler, ReportSuccessfulUploadCallback report_success_upload_cb, EncryptionKeyAttachedCallback encryption_key_attached_cb, @@ -138,7 +138,7 @@ const bool need_encryption_key_; std::vector<EncryptedRecord> encrypted_records_; - ScopedReservation scoped_reservation_; + absl::optional<ScopedReservation> scoped_reservation_; const ReportSuccessfulUploadCallback report_success_upload_cb_; const EncryptionKeyAttachedCallback encryption_key_attached_cb_; raw_ptr<RecordHandler> handler_; @@ -165,7 +165,7 @@ Status EnqueueUpload( bool need_encryption_key, std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, ReportSuccessfulUploadCallback report_upload_success_cb, EncryptionKeyAttachedCallback encryption_key_attached_cb);
diff --git a/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service_unittest.cc b/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service_unittest.cc index 6e17507..aaa762e5 100644 --- a/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service_unittest.cc +++ b/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service_unittest.cc
@@ -18,13 +18,14 @@ #include "chrome/test/base/testing_profile.h" #include "components/policy/core/browser/browser_policy_connector.h" #include "components/policy/core/common/cloud/mock_cloud_policy_client.h" -#include "components/reporting/resources/memory_resource_impl.h" -#include "components/reporting/resources/resource_interface.h" #include "components/reporting/util/status.h" #include "components/reporting/util/test_support_callbacks.h" #include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" +namespace reporting { +namespace { + using ::testing::_; using ::testing::Eq; using ::testing::Invoke; @@ -34,9 +35,6 @@ using ::testing::StrictMock; using ::testing::WithArgs; -namespace reporting { -namespace { - // Ensures that profile cannot be null. TEST(DmServerUploadServiceTest, DeniesNullptrProfile) { content::BrowserTaskEnvironment task_envrionment; @@ -47,12 +45,6 @@ Property(&Status::error_code, Eq(error::INVALID_ARGUMENT))); } -EncryptedRecord DummyRecord() { - EncryptedRecord record; - record.set_encrypted_wrapped_record("TEST_DATA"); - return record; -} - class TestRecordHandler : public DmServerUploadService::RecordHandler { public: TestRecordHandler() : RecordHandler(/*client=*/nullptr) {} @@ -79,12 +71,7 @@ public: DmServerTest() : sequenced_task_runner_(base::ThreadPool::CreateSequencedTaskRunner({})), - handler_(std::make_unique<TestRecordHandler>()), - memory_resource_(base::MakeRefCounted<MemoryResourceImpl>( - 4u * 1024LLu * 1024LLu)) // 4 MiB - {} - - virtual ~DmServerTest() { EXPECT_THAT(memory_resource_->GetUsed(), Eq(0uL)); } + handler_(std::make_unique<TestRecordHandler>()) {} protected: content::BrowserTaskEnvironment task_envrionment_{ @@ -96,8 +83,6 @@ std::vector<EncryptedRecord> records_; const base::TimeDelta kMaxDelay_ = base::Seconds(1); - - scoped_refptr<ResourceInterface> memory_resource_; }; class DmServerFailureTest : public DmServerTest, @@ -118,72 +103,8 @@ using TestEncryptionKeyAttached = MockFunction<void(SignedEncryptionInfo)>; TEST_P(DmServerUploaderTest, ProcessesRecord) { - records_.emplace_back(DummyRecord()); - - ScopedReservation record_reservation(records_.back().ByteSizeLong(), - memory_resource_); - EXPECT_TRUE(record_reservation.reserved()); - - const bool force_confirm_flag = force_confirm(); - EXPECT_CALL(*handler_, HandleRecords_(_, _, _, _)) - .WillOnce(WithArgs<0, 2, 3>( - Invoke([&force_confirm_flag]( - bool need_encryption_key, - DmServerUploadService::CompletionCallback callback, - DmServerUploadService::EncryptionKeyAttachedCallback - encryption_key_attached_cb) { - if (need_encryption_key) { - std::move(encryption_key_attached_cb).Run(SignedEncryptionInfo()); - } - std::move(callback).Run( - DmServerUploadService::SuccessfulUploadResponse{ - .force_confirm = force_confirm_flag}); - }))); - - StrictMock<TestSuccessfulUpload> successful_upload; - EXPECT_CALL(successful_upload, Call(_, _)).Times(1); - auto successful_upload_cb = base::BindRepeating( - &TestSuccessfulUpload::Call, base::Unretained(&successful_upload)); - StrictMock<TestEncryptionKeyAttached> encryption_key_attached; - EXPECT_CALL(encryption_key_attached, Call(_)) - .Times(need_encryption_key() ? 1 : 0); - auto encryption_key_attached_cb = - base::BindRepeating(&TestEncryptionKeyAttached::Call, - base::Unretained(&encryption_key_attached)); - - test::TestEvent<DmServerUploadService::CompletionResponse> callback_waiter; - Start<DmServerUploadService::DmServerUploader>( - need_encryption_key(), std::move(records_), std::move(record_reservation), - handler_.get(), std::move(successful_upload_cb), - std::move(encryption_key_attached_cb), callback_waiter.cb(), - sequenced_task_runner_); - - const auto response = callback_waiter.result(); - EXPECT_OK(response); -} - -TEST_P(DmServerUploaderTest, ProcessesRecords) { - const int64_t kNumberOfRecords = 10; - const int64_t kGenerationId = 1234; - - ScopedReservation records_reservation(0uL, memory_resource_); - EXPECT_FALSE(records_reservation.reserved()); - for (int64_t i = 0; i < kNumberOfRecords; i++) { - EncryptedRecord encrypted_record; - encrypted_record.set_encrypted_wrapped_record( - base::StrCat({"Record Number ", base::NumberToString(i)})); - auto* sequence_information = - encrypted_record.mutable_sequence_information(); - sequence_information->set_generation_id(kGenerationId); - sequence_information->set_sequencing_id(i); - sequence_information->set_priority(Priority::IMMEDIATE); - ScopedReservation record_reservation(encrypted_record.ByteSizeLong(), - memory_resource_); - EXPECT_TRUE(record_reservation.reserved()); - records_reservation.HandOver(record_reservation); - records_.push_back(std::move(encrypted_record)); - } - EXPECT_TRUE(records_reservation.reserved()); + // Add an empty record. + records_.emplace_back(); const bool force_confirm_flag = force_confirm(); EXPECT_CALL(*handler_, HandleRecords_(_, _, _, _)) @@ -215,7 +136,61 @@ test::TestEvent<DmServerUploadService::CompletionResponse> callback_waiter; Start<DmServerUploadService::DmServerUploader>( need_encryption_key(), std::move(records_), - std::move(records_reservation), handler_.get(), + /*scoped_reservation*/ absl::nullopt, handler_.get(), + std::move(successful_upload_cb), std::move(encryption_key_attached_cb), + callback_waiter.cb(), sequenced_task_runner_); + + const auto response = callback_waiter.result(); + EXPECT_OK(response); +} + +TEST_P(DmServerUploaderTest, ProcessesRecords) { + const int64_t kNumberOfRecords = 10; + const int64_t kGenerationId = 1234; + + for (int64_t i = 0; i < kNumberOfRecords; i++) { + EncryptedRecord encrypted_record; + encrypted_record.set_encrypted_wrapped_record( + base::StrCat({"Record Number ", base::NumberToString(i)})); + auto* sequence_information = + encrypted_record.mutable_sequence_information(); + sequence_information->set_generation_id(kGenerationId); + sequence_information->set_sequencing_id(i); + sequence_information->set_priority(Priority::IMMEDIATE); + records_.push_back(std::move(encrypted_record)); + } + + const bool force_confirm_flag = force_confirm(); + EXPECT_CALL(*handler_, HandleRecords_(_, _, _, _)) + .WillOnce(WithArgs<0, 2, 3>( + Invoke([&force_confirm_flag]( + bool need_encryption_key, + DmServerUploadService::CompletionCallback callback, + DmServerUploadService::EncryptionKeyAttachedCallback + encryption_key_attached_cb) { + if (need_encryption_key) { + std::move(encryption_key_attached_cb).Run(SignedEncryptionInfo()); + } + std::move(callback).Run( + DmServerUploadService::SuccessfulUploadResponse{ + .force_confirm = force_confirm_flag}); + }))); + + StrictMock<TestSuccessfulUpload> successful_upload; + EXPECT_CALL(successful_upload, Call(_, _)).Times(1); + auto successful_upload_cb = base::BindRepeating( + &TestSuccessfulUpload::Call, base::Unretained(&successful_upload)); + StrictMock<TestEncryptionKeyAttached> encryption_key_attached; + EXPECT_CALL(encryption_key_attached, Call(_)) + .Times(need_encryption_key() ? 1 : 0); + auto encryption_key_attached_cb = + base::BindRepeating(&TestEncryptionKeyAttached::Call, + base::Unretained(&encryption_key_attached)); + + test::TestEvent<DmServerUploadService::CompletionResponse> callback_waiter; + Start<DmServerUploadService::DmServerUploader>( + need_encryption_key(), std::move(records_), + /*scoped_reservation*/ absl::nullopt, handler_.get(), std::move(successful_upload_cb), std::move(encryption_key_attached_cb), callback_waiter.cb(), sequenced_task_runner_); @@ -224,11 +199,8 @@ } TEST_P(DmServerUploaderTest, ReportsFailureToProcess) { - records_.emplace_back(DummyRecord()); - - ScopedReservation record_reservation(records_.back().ByteSizeLong(), - memory_resource_); - EXPECT_TRUE(record_reservation.reserved()); + // Add an empty record. + records_.emplace_back(); EXPECT_CALL(*handler_, HandleRecords_(_, _, _, _)) .WillOnce(WithArgs<2>( @@ -249,10 +221,10 @@ test::TestEvent<DmServerUploadService::CompletionResponse> callback_waiter; Start<DmServerUploadService::DmServerUploader>( - need_encryption_key(), std::move(records_), std::move(record_reservation), - handler_.get(), std::move(successful_upload_cb), - std::move(encryption_key_attached_cb), callback_waiter.cb(), - sequenced_task_runner_); + need_encryption_key(), std::move(records_), + /*scoped_reservation*/ absl::nullopt, handler_.get(), + std::move(successful_upload_cb), std::move(encryption_key_attached_cb), + callback_waiter.cb(), sequenced_task_runner_); const auto response = callback_waiter.result(); EXPECT_THAT(response.status(), @@ -260,9 +232,6 @@ } TEST_P(DmServerUploaderTest, ReprotWithZeroRecords) { - ScopedReservation no_records_reservation(0uL, memory_resource_); - EXPECT_FALSE(no_records_reservation.reserved()); - StrictMock<TestSuccessfulUpload> successful_upload; EXPECT_CALL(successful_upload, Call(_, _)) .Times(need_encryption_key() ? 1 : 0); @@ -299,7 +268,7 @@ test::TestEvent<DmServerUploadService::CompletionResponse> callback_waiter; Start<DmServerUploadService::DmServerUploader>( need_encryption_key(), std::move(records_), - std::move(no_records_reservation), handler_.get(), + /*scoped_reservation*/ absl::nullopt, handler_.get(), std::move(successful_upload_cb), std::move(encryption_key_attached_cb), callback_waiter.cb(), sequenced_task_runner_); @@ -314,12 +283,8 @@ TEST_P(DmServerFailureTest, ReportsFailureToUpload) { const error::Code& error_code = GetParam(); - - records_.emplace_back(DummyRecord()); - - ScopedReservation record_reservation(records_.back().ByteSizeLong(), - memory_resource_); - EXPECT_TRUE(record_reservation.reserved()); + // Add an empty record. + records_.emplace_back(); EXPECT_CALL(*handler_, HandleRecords_(_, _, _, _)) .WillOnce(WithArgs<2>(Invoke( @@ -340,7 +305,7 @@ test::TestEvent<DmServerUploadService::CompletionResponse> callback_waiter; Start<DmServerUploadService::DmServerUploader>( /*need_encryption_key*/ true, std::move(records_), - std::move(record_reservation), handler_.get(), + /*scoped_reservation*/ absl::nullopt, handler_.get(), std::move(successful_upload_cb), std::move(encryption_key_attached_cb), callback_waiter.cb(), sequenced_task_runner_);
diff --git a/chrome/browser/policy/messaging_layer/upload/fake_upload_client.cc b/chrome/browser/policy/messaging_layer/upload/fake_upload_client.cc index bc13b01..5f433f5 100644 --- a/chrome/browser/policy/messaging_layer/upload/fake_upload_client.cc +++ b/chrome/browser/policy/messaging_layer/upload/fake_upload_client.cc
@@ -94,7 +94,7 @@ Status FakeUploadClient::EnqueueUpload( bool need_encryption_key, std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, ReportSuccessfulUploadCallback report_upload_success_cb, EncryptionKeyAttachedCallback encryption_key_attached_cb) { UploadEncryptedReportingRequestBuilder builder; @@ -121,7 +121,7 @@ } void FakeUploadClient::OnUploadComplete( - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, ReportSuccessfulUploadCallback report_upload_success_cb, EncryptionKeyAttachedCallback encryption_key_attached_cb, absl::optional<base::Value::Dict> response) {
diff --git a/chrome/browser/policy/messaging_layer/upload/fake_upload_client.h b/chrome/browser/policy/messaging_layer/upload/fake_upload_client.h index 4313a4ae..9878d6a 100644 --- a/chrome/browser/policy/messaging_layer/upload/fake_upload_client.h +++ b/chrome/browser/policy/messaging_layer/upload/fake_upload_client.h
@@ -23,7 +23,7 @@ Status EnqueueUpload( bool need_encryption_key, std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, ReportSuccessfulUploadCallback report_upload_success_cb, EncryptionKeyAttachedCallback encryption_key_attached_cb) override; @@ -31,7 +31,7 @@ explicit FakeUploadClient(policy::CloudPolicyClient* cloud_policy_client); void OnUploadComplete( - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, ReportSuccessfulUploadCallback report_upload_success_cb, EncryptionKeyAttachedCallback encryption_key_attached_cb, absl::optional<base::Value::Dict> response);
diff --git a/chrome/browser/policy/messaging_layer/upload/upload_client.cc b/chrome/browser/policy/messaging_layer/upload/upload_client.cc index 05e8904..ecfe067 100644 --- a/chrome/browser/policy/messaging_layer/upload/upload_client.cc +++ b/chrome/browser/policy/messaging_layer/upload/upload_client.cc
@@ -42,7 +42,7 @@ Status UploadClient::EnqueueUpload( bool need_encryption_key, std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, ReportSuccessfulUploadCallback report_upload_success_cb, EncryptionKeyAttachedCallback encryption_key_attached_cb) { if (records.empty() && !need_encryption_key) {
diff --git a/chrome/browser/policy/messaging_layer/upload/upload_client.h b/chrome/browser/policy/messaging_layer/upload/upload_client.h index 07fc1bf..3a84fcd4d 100644 --- a/chrome/browser/policy/messaging_layer/upload/upload_client.h +++ b/chrome/browser/policy/messaging_layer/upload/upload_client.h
@@ -47,7 +47,7 @@ virtual Status EnqueueUpload( bool need_encryption_key, std::vector<EncryptedRecord> record, - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, ReportSuccessfulUploadCallback report_upload_success_cb, EncryptionKeyAttachedCallback encryption_key_attached_cb);
diff --git a/chrome/browser/policy/messaging_layer/upload/upload_client_unittest.cc b/chrome/browser/policy/messaging_layer/upload/upload_client_unittest.cc index 1a6978d..59ed3720 100644 --- a/chrome/browser/policy/messaging_layer/upload/upload_client_unittest.cc +++ b/chrome/browser/policy/messaging_layer/upload/upload_client_unittest.cc
@@ -23,7 +23,6 @@ #include "components/policy/core/common/cloud/mock_cloud_policy_client.h" #include "components/reporting/proto/synced/record.pb.h" #include "components/reporting/proto/synced/record_constants.pb.h" -#include "components/reporting/resources/memory_resource_impl.h" #include "components/reporting/util/test_support_callbacks.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" @@ -70,9 +69,6 @@ protected: void SetUp() override { - memory_resource_ = base::MakeRefCounted<MemoryResourceImpl>( - 4u * 1024LLu * 1024LLu); // 4 MiB - #if BUILDFLAG(IS_CHROMEOS_ASH) // Set up fake primary profile. auto mock_user_manager = @@ -96,7 +92,6 @@ user_manager_.reset(); profile_.reset(); #endif // BUILDFLAG(IS_CHROMEOS_ASH) - EXPECT_THAT(memory_resource_->GetUsed(), Eq(0uL)); } bool need_encryption_key() const { return std::get<0>(GetParam()); } @@ -108,7 +103,6 @@ std::unique_ptr<TestingProfile> profile_; std::unique_ptr<user_manager::ScopedUserManager> user_manager_; #endif // BUILDFLAG(IS_CHROMEOS_ASH) - scoped_refptr<ResourceInterface> memory_resource_; }; using TestEncryptionKeyAttached = MockFunction<void(SignedEncryptionInfo)>; @@ -128,7 +122,6 @@ record->set_data(json_data); record->set_destination(Destination::UPLOAD_EVENTS); - ScopedReservation total_reservation(0uL, memory_resource_); std::string serialized_record; wrapped_record.SerializeToString(&serialized_record); std::vector<EncryptedRecord> records; @@ -140,10 +133,6 @@ sequence_information->set_sequencing_id(static_cast<int64_t>(i)); sequence_information->set_generation_id(kGenerationId); sequence_information->set_priority(Priority::IMMEDIATE); - ScopedReservation record_reservation(encrypted_record.ByteSizeLong(), - memory_resource_); - EXPECT_TRUE(record_reservation.reserved()); - total_reservation.HandOver(record_reservation); records.push_back(encrypted_record); } @@ -214,8 +203,9 @@ auto upload_client = std::move(upload_client_result.ValueOrDie()); auto enqueue_result = upload_client->EnqueueUpload( - need_encryption_key(), std::move(records), std::move(total_reservation), - std::move(upload_success_cb), encryption_key_attached_cb); + need_encryption_key(), std::move(records), + /*scoped_reservation*/ absl::nullopt, std::move(upload_success_cb), + encryption_key_attached_cb); EXPECT_TRUE(enqueue_result.ok()); auto upload_success_result = upload_success.result();
diff --git a/chrome/browser/policy/messaging_layer/upload/upload_provider.cc b/chrome/browser/policy/messaging_layer/upload/upload_provider.cc index 2a7c5537..5b8a0b5 100644 --- a/chrome/browser/policy/messaging_layer/upload/upload_provider.cc +++ b/chrome/browser/policy/messaging_layer/upload/upload_provider.cc
@@ -45,7 +45,7 @@ // Uploads encrypted records (can be invoked on any thread). void EnqueueUpload(bool need_encryption_key, std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, base::OnceCallback<void(Status)> enqueued_cb) const; private: @@ -67,10 +67,11 @@ // Uploads encrypted records on sequenced task runner (and thus capable of // detecting whether upload client is ready or not). If not ready, // it will wait and then upload. - void EnqueueUploadInternal(bool need_encryption_key, - std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation, - base::OnceCallback<void(Status)> enqueued_cb); + void EnqueueUploadInternal( + bool need_encryption_key, + std::vector<EncryptedRecord> records, + absl::optional<ScopedReservation> scoped_reservation, + base::OnceCallback<void(Status)> enqueued_cb); // Sequence task runner and checker used during // |PostNewCloudPolicyClientRequest| processing. @@ -220,13 +221,12 @@ // Upload client is ready, upload all previously stored requests (if any). while (!stored_records_.empty() || stored_need_encryption_key_) { std::vector<EncryptedRecord> records; - ScopedReservation scoped_reservation; + absl::optional<ScopedReservation> scoped_reservation; if (!stored_records_.empty()) { records = std::move(stored_records_.begin()->second); auto it = stored_reservations_.find(stored_records_.begin()->first); if (it != stored_reservations_.end()) { - scoped_reservation.HandOver(*it->second); - DCHECK(!it->second->reserved()); + scoped_reservation.emplace(std::move(*it->second)); stored_reservations_.erase(it); } stored_records_.erase(stored_records_.begin()); @@ -245,7 +245,7 @@ void EncryptedReportingUploadProvider::UploadHelper::EnqueueUpload( bool need_encryption_key, std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, base::OnceCallback<void(Status)> enqueued_cb) const { sequenced_task_runner_->PostTask( FROM_HERE, @@ -258,7 +258,7 @@ void EncryptedReportingUploadProvider::UploadHelper::EnqueueUploadInternal( bool need_encryption_key, std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, base::OnceCallback<void(Status)> enqueued_cb) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequenced_task_checker_); if (upload_client_ == nullptr) { @@ -269,9 +269,11 @@ generation_id = records.begin()->sequence_information().generation_id(); } stored_records_.emplace(generation_id, std::move(records)); - stored_reservations_.emplace( - generation_id, - std::make_unique<ScopedReservation>(std::move(scoped_reservation))); + if (scoped_reservation.has_value()) { + stored_reservations_.emplace(generation_id, + std::make_unique<ScopedReservation>( + std::move(scoped_reservation.value()))); + } // Report success even though the upload has not been executed. // Actual success is reported through two permanent repeating callbacks. std::move(enqueued_cb).Run(Status::StatusOK()); @@ -306,7 +308,7 @@ void EncryptedReportingUploadProvider::RequestUploadEncryptedRecords( bool need_encryption_key, std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, base::OnceCallback<void(Status)> result_cb) { DCHECK(helper_); helper_->EnqueueUpload(need_encryption_key, std::move(records),
diff --git a/chrome/browser/policy/messaging_layer/upload/upload_provider.h b/chrome/browser/policy/messaging_layer/upload/upload_provider.h index db1b0bf..ae3c000 100644 --- a/chrome/browser/policy/messaging_layer/upload/upload_provider.h +++ b/chrome/browser/policy/messaging_layer/upload/upload_provider.h
@@ -54,7 +54,7 @@ void RequestUploadEncryptedRecords( bool need_encryption_key, std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation, + absl::optional<ScopedReservation> scoped_reservation, base::OnceCallback<void(Status)> result_cb); private:
diff --git a/chrome/browser/policy/messaging_layer/upload/upload_provider_unittest.cc b/chrome/browser/policy/messaging_layer/upload/upload_provider_unittest.cc index 00ba5f6..a8a5ee3 100644 --- a/chrome/browser/policy/messaging_layer/upload/upload_provider_unittest.cc +++ b/chrome/browser/policy/messaging_layer/upload/upload_provider_unittest.cc
@@ -16,8 +16,6 @@ #include "chrome/browser/policy/messaging_layer/util/test_response_payload.h" #include "components/policy/core/common/cloud/dm_token.h" #include "components/policy/core/common/cloud/mock_cloud_policy_client.h" -#include "components/reporting/resources/memory_resource_impl.h" -#include "components/reporting/resources/resource_interface.h" #include "components/reporting/util/test_support_callbacks.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -89,8 +87,6 @@ protected: void SetUp() override { - memory_resource_ = base::MakeRefCounted<MemoryResourceImpl>( - 4u * 1024LLu * 1024LLu); // 4 MiB cloud_policy_client_.SetDMToken( policy::DMToken::CreateValidTokenForTesting("FAKE_DM_TOKEN").value()); service_provider_ = std::make_unique<TestEncryptedReportingUploadProvider>( @@ -110,14 +106,10 @@ sequence_information->set_priority(reporting::Priority::SLOW_BATCH); } - void TearDown() override { - EXPECT_THAT(memory_resource_->GetUsed(), Eq(0uL)); - } - Status CallRequestUploadEncryptedRecord( bool need_encryption_key, std::vector<EncryptedRecord> records, - ScopedReservation scoped_reservation) { + absl::optional<ScopedReservation> scoped_reservation) { test::TestEvent<Status> result; service_provider_->RequestUploadEncryptedRecords( need_encryption_key, std::move(records), std::move(scoped_reservation), @@ -131,8 +123,6 @@ policy::MockCloudPolicyClient cloud_policy_client_; reporting::EncryptedRecord record_; - scoped_refptr<ResourceInterface> memory_resource_; - std::unique_ptr<TestEncryptedReportingUploadProvider> service_provider_; }; @@ -148,12 +138,9 @@ std::vector<EncryptedRecord> records; records.emplace_back(record_); - ScopedReservation record_reservation(records.back().ByteSizeLong(), - memory_resource_); - EXPECT_TRUE(record_reservation.reserved()); const auto status = CallRequestUploadEncryptedRecord( /*need_encryption_key=*/false, std::move(records), - std::move(record_reservation)); + /*scoped_reservation=*/absl::nullopt); EXPECT_OK(status) << status; auto uploaded_result = uploaded_event.result(); EXPECT_THAT(std::get<0>(uploaded_result),
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 9af66dea..ab9df55 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -140,6 +140,7 @@ #include "components/security_interstitials/content/stateful_ssl_host_state_delegate.h" #include "components/segmentation_platform/public/segmentation_platform_service.h" #include "components/services/screen_ai/buildflags/buildflags.h" +#include "components/services/storage/public/cpp/storage_prefs.h" #include "components/sessions/core/session_id_generator.h" #include "components/signin/public/base/signin_buildflags.h" #include "components/signin/public/identity_manager/identity_manager.h" @@ -1084,7 +1085,6 @@ policy::policy_prefs::kIntensiveWakeUpThrottlingEnabled, false); registry->RegisterBooleanPref( policy::policy_prefs::kUserAgentClientHintsGREASEUpdateEnabled, true); - registry->RegisterBooleanPref(policy::policy_prefs::kWebSQLAccess, false); #if BUILDFLAG(IS_ANDROID) registry->RegisterBooleanPref(policy::policy_prefs::kBackForwardCacheEnabled, true); @@ -1333,6 +1333,7 @@ SessionStartupPref::RegisterProfilePrefs(registry); SharingSyncPreference::RegisterProfilePrefs(registry); site_engagement::SiteEngagementService::RegisterProfilePrefs(registry); + storage::RegisterProfilePrefs(registry); sync_sessions::SessionSyncPrefs::RegisterProfilePrefs(registry); syncer::DeviceInfoPrefs::RegisterProfilePrefs(registry); syncer::SyncPrefs::RegisterProfilePrefs(registry); @@ -1582,6 +1583,13 @@ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); registry->RegisterBooleanPref( webauthn::pref_names::kRemoteProxiedRequestsAllowed, false); + + // When in RTL mode, the side panel should default to the left of the screen. + // Otherwise, the side panel should default to the right side of the screen. + // TODO(dljames): Add enum values kAlternateSide / kDefaultSide that will + // replace false and true respectively. + registry->RegisterBooleanPref(prefs::kSidePanelHorizontalAlignment, + base::i18n::IsRTL() ? false : true); #endif registry->RegisterBooleanPref(prefs::kPrivacyGuideViewed, false);
diff --git a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/AdPersonalizationFragment.java b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/AdPersonalizationFragment.java index 36bf0e2..229c722f 100644 --- a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/AdPersonalizationFragment.java +++ b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/AdPersonalizationFragment.java
@@ -6,6 +6,7 @@ import android.os.Bundle; import android.view.LayoutInflater; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; @@ -19,6 +20,8 @@ import org.chromium.chrome.browser.ui.messages.snackbar.Snackbar; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.components.browser_ui.settings.ChromeBasePreference; +import org.chromium.components.browser_ui.settings.FragmentSettingsLauncher; +import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.components.browser_ui.settings.SettingsUtils; import org.chromium.components.favicon.LargeIconBridge; @@ -27,8 +30,8 @@ /** * Settings fragment for privacy sandbox settings. */ -public class AdPersonalizationFragment - extends PrivacySandboxSettingsBaseFragment implements Preference.OnPreferenceClickListener { +public class AdPersonalizationFragment extends PrivacySandboxSettingsBaseFragment + implements Preference.OnPreferenceClickListener, FragmentSettingsLauncher { private static final String AD_PERSONALIZATION_DESCRIPTION = "ad_personalization_description"; private static final String TOPICS_CATEGORY_PREFERENCE = "topic_interests"; @@ -51,11 +54,17 @@ private Preference mDescriptionPreference; private LargeIconBridge mLargeIconBridge; + private SettingsLauncher mSettingsLauncher; public void setSnackbarManager(SnackbarManager snackbarManager) { mSnackbarManager = snackbarManager; } + @Override + public void setSettingsLauncher(SettingsLauncher settingsLauncher) { + mSettingsLauncher = settingsLauncher; + } + /** * Initializes all the objects related to the preferences page. */ @@ -210,4 +219,14 @@ mEmptyTopicsPreference.setVisible(mTopicsCategory.getPreferenceCount() == 0); mEmptyFledgePreference.setVisible(mFledgeCategory.getPreferenceCount() == 0); } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == R.id.menu_id_targeted_help) { + // Override action for the question mark button. + mSettingsLauncher.launchSettingsActivity(getContext(), LearnMoreFragment.class); + return true; + } + return false; + } }
diff --git a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/AdPersonalizationRemovedFragment.java b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/AdPersonalizationRemovedFragment.java index b46d806..3fad1d0 100644 --- a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/AdPersonalizationRemovedFragment.java +++ b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/AdPersonalizationRemovedFragment.java
@@ -6,6 +6,7 @@ import android.os.Bundle; import android.view.LayoutInflater; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; @@ -18,14 +19,16 @@ import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.ui.messages.snackbar.Snackbar; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; +import org.chromium.components.browser_ui.settings.FragmentSettingsLauncher; +import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.components.browser_ui.settings.SettingsUtils; import org.chromium.components.favicon.LargeIconBridge; /** * Settings fragment for privacy sandbox settings. */ -public class AdPersonalizationRemovedFragment - extends PrivacySandboxSettingsBaseFragment implements Preference.OnPreferenceClickListener { +public class AdPersonalizationRemovedFragment extends PrivacySandboxSettingsBaseFragment + implements Preference.OnPreferenceClickListener, FragmentSettingsLauncher { private static final String TOPICS_CATEGORY_PREFERENCE = "topic_interests"; private static final String EMPTY_TOPICS_PREFERENCE = "empty_topics"; private static final String FLEDGE_CATEGORY_PREFERENCE = "fledge_interests"; @@ -37,11 +40,17 @@ private Preference mEmptyFledgePreference; private SnackbarManager mSnackbarManager; private LargeIconBridge mLargeIconBridge; + private SettingsLauncher mSettingsLauncher; public void setSnackbarManager(SnackbarManager snackbarManager) { mSnackbarManager = snackbarManager; } + @Override + public void setSettingsLauncher(SettingsLauncher settingsLauncher) { + mSettingsLauncher = settingsLauncher; + } + /** * Initializes all the objects related to the preferences page. */ @@ -141,4 +150,14 @@ mEmptyTopicsPreference.setVisible(mTopicsCategory.getPreferenceCount() == 0); mEmptyFledgePreference.setVisible(mFledgeCategory.getPreferenceCount() == 0); } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == R.id.menu_id_targeted_help) { + // Override action for the help button. + mSettingsLauncher.launchSettingsActivity(getContext(), LearnMoreFragment.class); + return true; + } + return false; + } }
diff --git a/chrome/browser/resource_coordinator/session_restore_policy.cc b/chrome/browser/resource_coordinator/session_restore_policy.cc index 15ca094..6787763 100644 --- a/chrome/browser/resource_coordinator/session_restore_policy.cc +++ b/chrome/browser/resource_coordinator/session_restore_policy.cc
@@ -68,11 +68,8 @@ } size_t GetFreeMemoryMiB() const override { - constexpr int64_t kMibibytesInBytes = 1 << 20; - int64_t free_mem = - base::SysInfo::AmountOfAvailablePhysicalMemory() / kMibibytesInBytes; - DCHECK(free_mem >= 0); - return free_mem; + constexpr uint64_t kMibibytesInBytes = 1 << 20; + return base::SysInfo::AmountOfAvailablePhysicalMemory() / kMibibytesInBytes; } base::TimeTicks NowTicks() const override { return base::TimeTicks::Now(); }
diff --git a/chrome/browser/resources/bluetooth_internals/BUILD.gn b/chrome/browser/resources/bluetooth_internals/BUILD.gn index 1e9aca8..72267a0 100644 --- a/chrome/browser/resources/bluetooth_internals/BUILD.gn +++ b/chrome/browser/resources/bluetooth_internals/BUILD.gn
@@ -3,6 +3,7 @@ # found in the LICENSE file. import("//tools/grit/grit_rule.gni") +import("//tools/polymer/html_to_wrapper.gni") import("//tools/typescript/ts_library.gni") import("//ui/webui/resources/tools/generate_grd.gni") @@ -33,38 +34,72 @@ root_build_dir) } +html_files = [ + "expandable_list_item.html", + "expandable_list.html", + "descriptor_list_item.html", + "characteristic_list_item.html", + "service_list_item.html", +] + +# Files generated by html_to_wrapper +html_wrapper_files = [] +foreach(f, html_files) { + html_wrapper_files += [ f + ".ts" ] +} + +html_to_wrapper("html_wrapper_files") { + in_files = html_files + template = "native" +} + +js_files = [ + "adapter_broker.js", + "adapter_page.js", + "characteristic_list.js", + "characteristic_list_item.js", + "debug_log_page.js", + "descriptor_list.js", + "descriptor_list_item.js", + "device_broker.js", + "device_collection.js", + "device_details_page.js", + "device_table.js", + "device_utils.js", + "devices_page.js", + "expandable_list_item.js", + "expandable_list.js", + "bluetooth_internals.js", + "main.js", + "object_fieldset.js", + "page_manager.js", + "page.js", + "service_list.js", + "service_list_item.js", + "sidebar.js", + "snackbar.js", + "value_control.js", +] + +copy("copy_files") { + sources = js_files + outputs = [ "${target_gen_dir}/{{source_file_part}}" ] +} + # TODO(crbug.com/1337318): This page should be converted to TypeScript but this # will be a lot of work. Passing the JavaScript files through the TypeScript # compiler will provide basic static checks (e.g. syntax) without validating # types. ts_library("build_ts") { - root_dir = "." + root_dir = target_gen_dir out_dir = "$target_gen_dir/tsc" tsconfig_base = "tsconfig_base.json" - in_files = [ - "adapter_broker.js", - "adapter_page.js", - "debug_log_page.js", - "characteristic_list.js", - "descriptor_list.js", - "device_broker.js", - "device_collection.js", - "device_details_page.js", - "device_table.js", - "device_utils.js", - "devices_page.js", - "expandable_list.js", - "bluetooth_internals.js", - "main.js", - "object_fieldset.js", - "page_manager.js", - "page.js", - "service_list.js", - "sidebar.js", - "snackbar.js", - "value_control.js", - ] + in_files = js_files + html_wrapper_files deps = [ "//ui/webui/resources:library" ] + extra_deps = [ + ":copy_files", + ":html_wrapper_files", + ] } grit("resources") {
diff --git a/chrome/browser/resources/bluetooth_internals/bluetooth_internals.css b/chrome/browser/resources/bluetooth_internals/bluetooth_internals.css index 4a130e7..ca8953b 100644 --- a/chrome/browser/resources/bluetooth_internals/bluetooth_internals.css +++ b/chrome/browser/resources/bluetooth_internals/bluetooth_internals.css
@@ -26,10 +26,6 @@ color: rgb(92, 97, 102); } -.info-container h4 button.show-all-properties { - margin: 10px; -} - .toggle-status { background-image: url(chrome://resources/images/cancel_red.svg); background-repeat: no-repeat; @@ -42,60 +38,6 @@ url(chrome://resources/images/check_circle_green.svg); } -/* Expandable List */ -list { - list-style-type: none; - outline: none; -} - -list .spinner { - height: 48px; - margin: 0 auto; - pointer-events: none; - width: 48px; -} - -.expandable-list-item .brief-content { - align-items: center; - border-bottom: var(--divider-border); - color: white; - cursor: pointer; - display: flex; - font-weight: 600; - height: 40px; - padding: 8px; -} - -.service-list-item > .brief-content { - background-color: var(--primary-color); -} - -.characteristic-list-item > .brief-content { - background-color: var(--dark-primary-color); -} - -.descriptor-list-item > .brief-content { - background-color: var(--darker-primary-color); -} - -.expandable-list-item > .expanded-content { - height: 0; - overflow: hidden; -} - -.expandable-list-item.expanded > .expanded-content { - height: auto; -} - -.expandable-list-item .info-container > h4, -.expandable-list-item .info-container > div { - margin: var(--section-padding); -} - -.empty-message { - padding-inline-start: calc(2 * var(--section-padding)); -} - /* Page container */ #page-container { margin-inline-start: var(--sidebar-width); @@ -400,6 +342,12 @@ visibility: visible; } +@media screen and (min-width: 601px) { + .flex { + display: flex; + } +} + /* Object Fieldset */ .object-fieldset .status { align-items: center; @@ -427,22 +375,9 @@ } } + /* Device Details Page */ .device-details-page section, .info-container fieldset { margin-inline-start: 1em; } - -/* Value Control */ -.value-control > div { - display: flex; - margin: 4px 0; -} - -.value-control > div > input { - flex-grow: 1; -} - -.value-control > div:nth-of-type(2) { - justify-content: flex-end; -}
diff --git a/chrome/browser/resources/bluetooth_internals/characteristic_list.js b/chrome/browser/resources/bluetooth_internals/characteristic_list.js index 9f35d6a0..4d1ab21 100644 --- a/chrome/browser/resources/bluetooth_internals/characteristic_list.js +++ b/chrome/browser/resources/bluetooth_internals/characteristic_list.js
@@ -2,214 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -/** - * Javascript for CharacteristicList and CharacteristicListItem, served from - * chrome://bluetooth-internals/. - */ +import './characteristic_list_item.js'; +import './expandable_list.js'; import {assert} from 'chrome://resources/js/assert.m.js'; -import {define as crUiDefine} from 'chrome://resources/js/cr/ui.m.js'; -import {ArrayDataModel} from 'chrome://resources/js/cr/ui/array_data_model.m.js'; -import {DescriptorList} from './descriptor_list.js'; -import {CharacteristicInfo, Property} from './device.mojom-webui.js'; import {connectToDevice} from './device_broker.js'; -import {ExpandableList, ExpandableListItem} from './expandable_list.js'; -import {ObjectFieldSet} from './object_fieldset.js'; +import {ExpandableListElement} from './expandable_list.js'; import {Snackbar, SnackbarType} from './snackbar.js'; -import {ValueControl} from './value_control.js'; - -/** Property names for the CharacteristicInfo fieldset */ -const INFO_PROPERTY_NAMES = { - id: 'ID', - 'uuid.uuid': 'UUID', -}; - -/** Property names for the Properties fieldset. */ -const PROPERTIES_PROPERTY_NAMES = { - broadcast: 'Broadcast', - read: 'Read', - write_without_response: 'Write Without Response', - write: 'Write', - notify: 'Notify', - indicate: 'Indicate', - authenticated_signed_writes: 'Authenticated Signed Writes', - extended_properties: 'Extended Properties', - reliable_write: 'Reliable Write', - writable_auxiliaries: 'Writable Auxiliaries', - read_encrypted: 'Read Encrypted', - write_encrypted: 'Write Encrypted', - read_encrypted_authenticated: 'Read Encrypted Authenticated', - write_encrypted_authenticated: 'Write Encrypted Authenticated', -}; - -/** - * A list item that displays the properties of a CharacteristicInfo object. - * Two fieldsets are created within the element: one for the primitive - * properties, 'id' and 'uuid', and one for the 'properties' bitfield in the - * CharacteristicInfo object. - * @constructor - * @param {!CharacteristicInfo} characteristicInfo - * @param {string} deviceAddress - * @param {string} serviceId - * @extends {ExpandableListItem} - */ -export function CharacteristicListItem( - characteristicInfo, deviceAddress, serviceId) { - const listItem = new ExpandableListItem(); - listItem.__proto__ = CharacteristicListItem.prototype; - - /** @type {!CharacteristicInfo} */ - listItem.info = characteristicInfo; - /** @private {string} */ - listItem.deviceAddress_ = deviceAddress; - /** @private {string} */ - listItem.serviceId_ = serviceId; - - listItem.decorate(); - return listItem; -} - -CharacteristicListItem.prototype = { - __proto__: ExpandableListItem.prototype, - - /** - * Decorates the element as a characteristic list item. Creates and caches - * two fieldsets for displaying property values. - * @override - */ - decorate() { - this.classList.add('characteristic-list-item'); - - /** @private {!ObjectFieldSet} */ - this.characteristicFieldSet_ = new ObjectFieldSet(); - this.characteristicFieldSet_.setPropertyDisplayNames(INFO_PROPERTY_NAMES); - this.characteristicFieldSet_.setObject({ - id: this.info.id, - 'uuid.uuid': this.info.uuid.uuid, - }); - - /** @private {!ObjectFieldSet} */ - this.propertiesFieldSet_ = new ObjectFieldSet(); - this.propertiesFieldSet_.setPropertyDisplayNames(PROPERTIES_PROPERTY_NAMES); - this.propertiesFieldSet_.showAll = false; - this.propertiesFieldSet_.setObject({ - broadcast: (this.info.properties & Property.BROADCAST) > 0, - read: (this.info.properties & Property.READ) > 0, - write_without_response: - (this.info.properties & Property.WRITE_WITHOUT_RESPONSE) > 0, - write: (this.info.properties & Property.WRITE) > 0, - notify: (this.info.properties & Property.NOTIFY) > 0, - indicate: (this.info.properties & Property.INDICATE) > 0, - authenticated_signed_writes: - (this.info.properties & Property.AUTHENTICATED_SIGNED_WRITES) > 0, - extended_properties: - (this.info.properties & Property.EXTENDED_PROPERTIES) > 0, - reliable_write: (this.info.properties & Property.RELIABLE_WRITE) > 0, - writable_auxiliaries: - (this.info.properties & Property.WRITABLE_AUXILIARIES) > 0, - read_encrypted: (this.info.properties & Property.READ_ENCRYPTED) > 0, - write_encrypted: (this.info.properties & Property.WRITE_ENCRYPTED) > 0, - read_encrypted_authenticated: - (this.info.properties & Property.READ_ENCRYPTED_AUTHENTICATED) > 0, - write_encrypted_authenticated: - (this.info.properties & Property.WRITE_ENCRYPTED_AUTHENTICATED) > 0, - }); - - /** @private {!ValueControl} */ - this.valueControl_ = new ValueControl(); - - this.valueControl_.load({ - deviceAddress: this.deviceAddress_, - serviceId: this.serviceId_, - characteristicId: this.info.id, - properties: this.info.properties, - }); - this.valueControl_.setValue(this.info.lastKnownValue); - - /** @private {!DescriptorList} */ - this.descriptorList_ = new DescriptorList(); - - // Create content for display in brief content container. - const characteristicHeaderText = document.createElement('div'); - characteristicHeaderText.textContent = 'Characteristic:'; - - const characteristicHeaderValue = document.createElement('div'); - characteristicHeaderValue.textContent = this.info.uuid.uuid; - - const characteristicHeader = document.createElement('div'); - characteristicHeader.appendChild(characteristicHeaderText); - characteristicHeader.appendChild(characteristicHeaderValue); - this.briefContent_.appendChild(characteristicHeader); - - // Create content for display in expanded content container. - const characteristicInfoHeader = document.createElement('h4'); - characteristicInfoHeader.textContent = 'Characteristic Info'; - - const characteristicDiv = document.createElement('div'); - characteristicDiv.classList.add('flex'); - characteristicDiv.appendChild(this.characteristicFieldSet_); - - const propertiesHeader = document.createElement('h4'); - propertiesHeader.textContent = 'Properties'; - - const propertiesBtn = document.createElement('button'); - propertiesBtn.textContent = 'Show All'; - propertiesBtn.classList.add('show-all-properties'); - propertiesBtn.addEventListener('click', () => { - this.propertiesFieldSet_.showAll = !this.propertiesFieldSet_.showAll; - propertiesBtn.textContent = - this.propertiesFieldSet_.showAll ? 'Hide' : 'Show all'; - this.propertiesFieldSet_.redraw(); - }); - propertiesHeader.appendChild(propertiesBtn); - - const propertiesDiv = document.createElement('div'); - propertiesDiv.classList.add('flex'); - propertiesDiv.appendChild(this.propertiesFieldSet_); - - const descriptorsHeader = document.createElement('h4'); - descriptorsHeader.textContent = 'Descriptors'; - - const infoDiv = document.createElement('div'); - infoDiv.classList.add('info-container'); - - const valueHeader = document.createElement('h4'); - valueHeader.textContent = 'Value'; - - infoDiv.appendChild(characteristicInfoHeader); - infoDiv.appendChild(characteristicDiv); - infoDiv.appendChild(propertiesHeader); - infoDiv.appendChild(propertiesDiv); - infoDiv.appendChild(valueHeader); - infoDiv.appendChild(this.valueControl_); - infoDiv.appendChild(descriptorsHeader); - infoDiv.appendChild(this.descriptorList_); - - this.expandedContent_.appendChild(infoDiv); - }, - - /** @override */ - onExpandInternal(expanded) { - this.descriptorList_.load( - this.deviceAddress_, this.serviceId_, this.info.id); - }, -}; - -/** - * A list that displays CharacteristicListItems. - * @constructor - * @extends {ExpandableList} - */ -export const CharacteristicList = crUiDefine('list'); - -CharacteristicList.prototype = { - __proto__: ExpandableList.prototype, - - /** @override */ - decorate() { - ExpandableList.prototype.decorate.call(this); +export class CharacteristicListElement extends ExpandableListElement { + constructor() { + super(); /** @private {?string} */ this.deviceAddress_ = null; @@ -217,15 +21,18 @@ this.serviceId_ = null; /** @private {boolean} */ this.characteristicsRequested_ = false; + } + connectedCallback() { + super.connectedCallback(); this.classList.add('characteristic-list'); - this.setEmptyMessage('No Characteristics Found'); - }, + } createItem(data) { - return new CharacteristicListItem( - data, assert(this.deviceAddress_), assert(this.serviceId_)); - }, + const item = document.createElement('characteristic-list-item'); + item.initialize(data, assert(this.deviceAddress_), assert(this.serviceId_)); + return item; + } /** * Loads the characteristic list with an array of CharacteristicInfo from @@ -235,6 +42,7 @@ * @param {string} serviceId */ load(deviceAddress, serviceId) { + this.setEmptyMessage('No Characteristics Found'); if (this.characteristicsRequested_ || !this.isSpinnerShowing()) { return; } @@ -248,7 +56,7 @@ return device.getCharacteristics(serviceId); }.bind(this)) .then(function(response) { - this.setData(new ArrayDataModel(response.characteristics || [])); + this.setData(response.characteristics || []); this.setSpinnerShowing(false); this.characteristicsRequested_ = false; }.bind(this)) @@ -260,5 +68,7 @@ this.load(deviceAddress, serviceId); }.bind(this)); }.bind(this)); - }, -}; + } +} + +customElements.define('characteristic-list', CharacteristicListElement);
diff --git a/chrome/browser/resources/bluetooth_internals/characteristic_list_item.html b/chrome/browser/resources/bluetooth_internals/characteristic_list_item.html new file mode 100644 index 0000000..8030c1ae --- /dev/null +++ b/chrome/browser/resources/bluetooth_internals/characteristic_list_item.html
@@ -0,0 +1,122 @@ +<style> + :host { + --brief-content-background-color: var(--dark-primary-color); + } + + .info-container > h4, + .info-container > div { + margin: 1em; + } + + /* Object Fieldset */ + .object-fieldset .status { + align-items: center; + display: flex; + margin-bottom: 0.8em; + } + + .object-fieldset .status div:first-child { + margin-inline-end: 1em; + white-space: nowrap; + } + + .object-fieldset .status:last-child { + margin-bottom: 0; + } + + .toggle-status { + background-image: url(chrome://resources/images/cancel_red.svg); + background-repeat: no-repeat; + min-height: 24px; + min-width: 24px; + } + + .toggle-status.checked { + background-image: + url(chrome://resources/images/check_circle_green.svg); + } + + /* Object Fieldset Container */ + .flex { + overflow-x: auto; + } + + @media screen and (min-width: 601px) { + .flex { + display: flex; + } + } + + /* Value Control */ + .value-control > div { + display: flex; + margin: 4px 0; + } + + .value-control > div > input { + flex-grow: 1; + } + + .value-control > div:nth-of-type(2) { + justify-content: flex-end; + } + + button.show-all-properties { + background-image: linear-gradient(#ededed, #ededed 38%, #dedede); + border: 1px solid rgba(0, 0, 0, 0.25); + border-radius: 2px; + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), + inset 0 1px 2px rgba(255, 255, 255, 0.75); + color: #444; + font: inherit; + margin: 10px; + min-height: 2em; + min-width: 4em; + outline: none; + padding: 1px 10px; + text-shadow: 0 1px 0 rgb(240, 240, 240); + user-select: none; + } + + button.show-all-properties:hover { + background-image: -webkit-linear-gradient(#f0f0f0, #f0f0f0 38%, #e0e0e0); + border-color: rgba(0, 0, 0, 0.3); + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12), + inset 0 1px 2px rgba(255, 255, 255, 0.95); + color: black; + } + + button.show-all-properties:active { + background-image: -webkit-linear-gradient(#e7e7e7, #e7e7e7 38%, #d7d7d7); + box-shadow: none; + text-shadow: none; + } + + button.show-all-properties:focus { + border-color: rgb(77, 144, 254); + outline: none; + /* OVERRIDE */ + transition: border-color 200ms; + } + + h3 { + font-weight: normal; + line-height: 1; + user-select: none; + } +</style> +<expandable-list-item> + <div slot="brief-content"> + <div>Characteristic:</div> + <div class="header-value"></div> + </div> + <div slot="expanded-content" class="info-container"> + <h4>Characteristic Info</h4> + <div class="flex characteristic-div"></div> + <h4>Properties<button class="show-all-properties">Show All</button></h4> + <div class="flex properties-div"></div> + <h4>Descriptors</h4> + <descriptor-list></descriptor-list> + <h4>Value</h4> + </div> +</expandable-list-item>
diff --git a/chrome/browser/resources/bluetooth_internals/characteristic_list_item.js b/chrome/browser/resources/bluetooth_internals/characteristic_list_item.js new file mode 100644 index 0000000..b28fb346 --- /dev/null +++ b/chrome/browser/resources/bluetooth_internals/characteristic_list_item.js
@@ -0,0 +1,152 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import './descriptor_list.js'; +import './expandable_list_item.js'; + +import {CustomElement} from 'chrome://resources/js/custom_element.js'; + +import {getTemplate} from './characteristic_list_item.html.js'; +import {CharacteristicInfo, Property} from './device.mojom-webui.js'; +import {ObjectFieldSet} from './object_fieldset.js'; +import {ValueControl} from './value_control.js'; + +/** Property names for the CharacteristicInfo fieldset */ +const INFO_PROPERTY_NAMES = { + id: 'ID', + 'uuid.uuid': 'UUID', +}; + +/** Property names for the Properties fieldset. */ +const PROPERTIES_PROPERTY_NAMES = { + broadcast: 'Broadcast', + read: 'Read', + write_without_response: 'Write Without Response', + write: 'Write', + notify: 'Notify', + indicate: 'Indicate', + authenticated_signed_writes: 'Authenticated Signed Writes', + extended_properties: 'Extended Properties', + reliable_write: 'Reliable Write', + writable_auxiliaries: 'Writable Auxiliaries', + read_encrypted: 'Read Encrypted', + write_encrypted: 'Write Encrypted', + read_encrypted_authenticated: 'Read Encrypted Authenticated', + write_encrypted_authenticated: 'Write Encrypted Authenticated', +}; + +/** + * A list item that displays the properties of a CharacteristicInfo object. + * Two fieldsets are created within the element: one for the primitive + * properties, 'id' and 'uuid', and one for the 'properties' bitfield in the + * CharacteristicInfo object. + */ +export class CharacteristicListItemElement extends CustomElement { + static get template() { + return getTemplate(); + } + + constructor() { + super(); + + /** @type {?CharacteristicInfo} */ + this.info = null; + /** @private {string} */ + this.deviceAddress_ = ''; + /** @private {string} */ + this.serviceId_ = ''; + /** @private {!ObjectFieldSet} */ + this.characteristicFieldSet_ = new ObjectFieldSet(); + /** @private {!ObjectFieldSet} */ + this.propertiesFieldSet_ = new ObjectFieldSet(); + /** @private {!ValueControl} */ + this.valueControl_ = new ValueControl(); + } + + connectedCallback() { + this.classList.add('characteristic-list-item'); + this.shadowRoot.querySelector('expandable-list-item') + .addEventListener('list-item-expanded', () => { + const list = this.shadowRoot.querySelector('descriptor-list'); + list.load(this.deviceAddress_, this.serviceId_, this.info.id); + }); + + const propertiesBtn = this.shadowRoot.querySelector('.show-all-properties'); + propertiesBtn.addEventListener('click', () => { + this.propertiesFieldSet_.showAll = !this.propertiesFieldSet_.showAll; + propertiesBtn.textContent = + this.propertiesFieldSet_.showAll ? 'Hide' : 'Show all'; + this.propertiesFieldSet_.redraw(); + }); + } + + /** + * @param {!CharacteristicInfo} characteristicInfo + * @param {string} deviceAddress + * @param {string} serviceId + */ + initialize(characteristicInfo, deviceAddress, serviceId) { + this.info = characteristicInfo; + this.deviceAddress_ = deviceAddress; + this.serviceId_ = serviceId; + + this.shadowRoot.querySelector('.header-value').textContent = + this.info.uuid.uuid; + + this.characteristicFieldSet_.setPropertyDisplayNames(INFO_PROPERTY_NAMES); + this.characteristicFieldSet_.setObject({ + id: this.info.id, + 'uuid.uuid': this.info.uuid.uuid, + }); + + this.propertiesFieldSet_.setPropertyDisplayNames(PROPERTIES_PROPERTY_NAMES); + this.propertiesFieldSet_.showAll = false; + this.propertiesFieldSet_.setObject({ + broadcast: (this.info.properties & Property.BROADCAST) > 0, + read: (this.info.properties & Property.READ) > 0, + write_without_response: + (this.info.properties & Property.WRITE_WITHOUT_RESPONSE) > 0, + write: (this.info.properties & Property.WRITE) > 0, + notify: (this.info.properties & Property.NOTIFY) > 0, + indicate: (this.info.properties & Property.INDICATE) > 0, + authenticated_signed_writes: + (this.info.properties & Property.AUTHENTICATED_SIGNED_WRITES) > 0, + extended_properties: + (this.info.properties & Property.EXTENDED_PROPERTIES) > 0, + reliable_write: (this.info.properties & Property.RELIABLE_WRITE) > 0, + writable_auxiliaries: + (this.info.properties & Property.WRITABLE_AUXILIARIES) > 0, + read_encrypted: (this.info.properties & Property.READ_ENCRYPTED) > 0, + write_encrypted: (this.info.properties & Property.WRITE_ENCRYPTED) > 0, + read_encrypted_authenticated: + (this.info.properties & Property.READ_ENCRYPTED_AUTHENTICATED) > 0, + write_encrypted_authenticated: + (this.info.properties & Property.WRITE_ENCRYPTED_AUTHENTICATED) > 0, + }); + + this.valueControl_.load({ + deviceAddress: this.deviceAddress_, + serviceId: this.serviceId_, + characteristicId: this.info.id, + properties: this.info.properties, + }); + this.valueControl_.setValue(this.info.lastKnownValue); + + // Create content for display in expanded content container. + const characteristicDiv = + this.shadowRoot.querySelector('.characteristic-div'); + characteristicDiv.appendChild(this.characteristicFieldSet_); + + const propertiesDiv = this.shadowRoot.querySelector('.properties-div'); + propertiesDiv.appendChild(this.propertiesFieldSet_); + + const infoDiv = this.shadowRoot.querySelector('.info-container'); + infoDiv.insertBefore( + this.valueControl_, + this.shadowRoot.querySelector('characteristic-list')); + } +} + +customElements.define( + 'characteristic-list-item', CharacteristicListItemElement);
diff --git a/chrome/browser/resources/bluetooth_internals/descriptor_list.js b/chrome/browser/resources/bluetooth_internals/descriptor_list.js index 06921b1..fe9e4b3 100644 --- a/chrome/browser/resources/bluetooth_internals/descriptor_list.js +++ b/chrome/browser/resources/bluetooth_internals/descriptor_list.js
@@ -7,127 +7,21 @@ * chrome://bluetooth-internals/. */ +import './descriptor_list_item.js'; +import './expandable_list.js'; + import {assert} from 'chrome://resources/js/assert.m.js'; -import {define as crUiDefine} from 'chrome://resources/js/cr/ui.m.js'; -import {ArrayDataModel} from 'chrome://resources/js/cr/ui/array_data_model.m.js'; -import {DescriptorInfo} from './device.mojom-webui.js'; import {connectToDevice} from './device_broker.js'; -import {ExpandableList, ExpandableListItem} from './expandable_list.js'; -import {ObjectFieldSet} from './object_fieldset.js'; +import {ExpandableListElement} from './expandable_list.js'; import {Snackbar, SnackbarType} from './snackbar.js'; -import {ValueControl} from './value_control.js'; - -/** Property names for the DescriptorInfo fieldset */ -const INFO_PROPERTY_NAMES = { - id: 'ID', - 'uuid.uuid': 'UUID', -}; - -/** - * A list item that displays the properties of a DescriptorInfo object. - * A fieldset is created within the element for the primitive - * properties, 'id' and 'uuid' within the DescriptorInfo object. - * @constructor - * @param {!DescriptorInfo} descriptorInfo - * @param {string} deviceAddress - * @param {string} serviceId - * @param {string} characteristicId - * @extends {ExpandableListItem} - */ -export function DescriptorListItem( - descriptorInfo, deviceAddress, serviceId, characteristicId) { - const listItem = new ExpandableListItem(); - listItem.__proto__ = DescriptorListItem.prototype; - - /** @type {!DescriptorInfo} */ - listItem.info = descriptorInfo; - /** @private {string} */ - listItem.deviceAddress_ = deviceAddress; - /** @private {string} */ - listItem.serviceId_ = serviceId; - /** @private {string} */ - listItem.characteristicId_ = characteristicId; - - listItem.decorate(); - return listItem; -} - -DescriptorListItem.prototype = { - __proto__: ExpandableListItem.prototype, - - /** - * Decorates the element as a descriptor list item. Creates and caches - * a fieldset for displaying property values. - * @override - */ - decorate() { - this.classList.add('descriptor-list-item'); - - /** @private {!ObjectFieldSet} */ - this.descriptorFieldSet_ = new ObjectFieldSet(); - this.descriptorFieldSet_.setPropertyDisplayNames(INFO_PROPERTY_NAMES); - this.descriptorFieldSet_.setObject({ - id: this.info.id, - 'uuid.uuid': this.info.uuid.uuid, - }); - - /** @private {!ValueControl} */ - this.valueControl_ = new ValueControl(); - this.valueControl_.load({ - deviceAddress: this.deviceAddress_, - serviceId: this.serviceId_, - characteristicId: this.characteristicId_, - descriptorId: this.info.id, - }); - - // Create content for display in brief content container. - const descriptorHeaderText = document.createElement('div'); - descriptorHeaderText.textContent = 'Descriptor:'; - - const descriptorHeaderValue = document.createElement('div'); - descriptorHeaderValue.textContent = this.info.uuid.uuid; - - const descriptorHeader = document.createElement('div'); - descriptorHeader.appendChild(descriptorHeaderText); - descriptorHeader.appendChild(descriptorHeaderValue); - this.briefContent_.appendChild(descriptorHeader); - - // Create content for display in expanded content container. - const descriptorInfoHeader = document.createElement('h4'); - descriptorInfoHeader.textContent = 'Descriptor Info'; - - const descriptorDiv = document.createElement('div'); - descriptorDiv.classList.add('flex'); - descriptorDiv.appendChild(this.descriptorFieldSet_); - - const valueHeader = document.createElement('h4'); - valueHeader.textContent = 'Value'; - - const infoDiv = document.createElement('div'); - infoDiv.classList.add('info-container'); - infoDiv.appendChild(descriptorInfoHeader); - infoDiv.appendChild(descriptorDiv); - infoDiv.appendChild(valueHeader); - infoDiv.appendChild(this.valueControl_); - - this.expandedContent_.appendChild(infoDiv); - }, -}; /** * A list that displays DescriptorListItems. - * @constructor - * @extends {ExpandableList} */ -export const DescriptorList = crUiDefine('list'); - -DescriptorList.prototype = { - __proto__: ExpandableList.prototype, - - /** @override */ - decorate() { - ExpandableList.prototype.decorate.call(this); +export class DescriptorListElement extends ExpandableListElement { + constructor() { + super(); /** @private {?string} */ this.deviceAddress_ = null; @@ -137,16 +31,20 @@ this.characteristicId_ = null; /** @private {boolean} */ this.descriptorsRequested_ = false; + } + connectedCallback() { + super.connectedCallback(); this.classList.add('descriptor-list'); - this.setEmptyMessage('No Descriptors Found'); - }, + } createItem(data) { - return new DescriptorListItem( + const item = document.createElement('descriptor-list-item'); + item.initialize( data, assert(this.deviceAddress_), assert(this.serviceId_), assert(this.characteristicId_)); - }, + return item; + } /** * Loads the descriptor list with an array of DescriptorInfo from @@ -158,6 +56,7 @@ * @param {string} characteristicId */ load(deviceAddress, serviceId, characteristicId) { + this.setEmptyMessage('No Descriptors Found'); if (this.descriptorsRequested_ || !this.isSpinnerShowing()) { return; } @@ -172,7 +71,7 @@ return device.getDescriptors(serviceId, characteristicId); }.bind(this)) .then(function(response) { - this.setData(new ArrayDataModel(response.descriptors || [])); + this.setData(response.descriptors || []); this.setSpinnerShowing(false); this.descriptorsRequested_ = false; }.bind(this)) @@ -184,5 +83,7 @@ this.load(deviceAddress, serviceId, characteristicId); }.bind(this)); }.bind(this)); - }, -}; + } +} + +customElements.define('descriptor-list', DescriptorListElement);
diff --git a/chrome/browser/resources/bluetooth_internals/descriptor_list_item.html b/chrome/browser/resources/bluetooth_internals/descriptor_list_item.html new file mode 100644 index 0000000..614d8fc --- /dev/null +++ b/chrome/browser/resources/bluetooth_internals/descriptor_list_item.html
@@ -0,0 +1,81 @@ +<style> + :host { + --brief-content-background-color: var(--darker-primary-color); + } + + .info-container > h4, + .info-container > div { + margin: 1em; + } + + /* Object Fieldset */ + .object-fieldset .status { + align-items: center; + display: flex; + margin-bottom: 0.8em; + } + + .object-fieldset .status div:first-child { + margin-inline-end: 1em; + white-space: nowrap; + } + + .object-fieldset .status:last-child { + margin-bottom: 0; + } + + .toggle-status { + background-image: url(chrome://resources/images/cancel_red.svg); + background-repeat: no-repeat; + min-height: 24px; + min-width: 24px; + } + + .toggle-status.checked { + background-image: + url(chrome://resources/images/check_circle_green.svg); + } + + + /* Object Fieldset Container */ + .flex { + overflow-x: auto; + } + + @media screen and (min-width: 601px) { + .flex { + display: flex; + } + } + + /* Value Control */ + .value-control > div { + display: flex; + margin: 4px 0; + } + + .value-control > div > input { + flex-grow: 1; + } + + .value-control > div:nth-of-type(2) { + justify-content: flex-end; + } + + h3 { + font-weight: normal; + line-height: 1; + user-select: none; + } +</style> +<expandable-list-item> + <div slot="brief-content"> + <div>Descriptor:</div> + <div class="header-value"></div> + </div> + <div slot="expanded-content" class="info-container"> + <h4>Descriptor Info</h4> + <div class="flex"></div> + <h4>Value</h4> + </div> +</expandable-list-item>
diff --git a/chrome/browser/resources/bluetooth_internals/descriptor_list_item.js b/chrome/browser/resources/bluetooth_internals/descriptor_list_item.js new file mode 100644 index 0000000..92d29ce --- /dev/null +++ b/chrome/browser/resources/bluetooth_internals/descriptor_list_item.js
@@ -0,0 +1,81 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import './expandable_list_item.js'; + +import {CustomElement} from 'chrome://resources/js/custom_element.js'; + +import {getTemplate} from './descriptor_list_item.html.js'; +import {DescriptorInfo} from './device.mojom-webui.js'; +import {ObjectFieldSet} from './object_fieldset.js'; +import {ValueControl} from './value_control.js'; + +/** Property names for the DescriptorInfo fieldset */ +const INFO_PROPERTY_NAMES = { + id: 'ID', + 'uuid.uuid': 'UUID', +}; + +export class DescriptorListItemElement extends CustomElement { + static get template() { + return getTemplate(); + } + + constructor() { + super(); + + /** @private {?DescriptorInfo} */ + this.info = null; + /** @private {string} */ + this.deviceAddress_ = ''; + /** @private {string} */ + this.serviceId_ = ''; + /** @private {string} */ + this.characteristicId_ = ''; + + /** @private {!ObjectFieldSet} */ + this.descriptorFieldSet_ = new ObjectFieldSet(); + + /** @private {!ValueControl} */ + this.valueControl_ = new ValueControl(); + } + + connectedCallback() { + this.classList.add('descriptor-list-item'); + } + + initialize(descriptorInfo, deviceAddress, serviceId, characteristicId) { + this.info = descriptorInfo; + this.deviceAddress_ = deviceAddress; + this.serviceId_ = serviceId; + this.characteristicId_ = characteristicId; + + this.descriptorFieldSet_.setPropertyDisplayNames(INFO_PROPERTY_NAMES); + this.descriptorFieldSet_.setObject({ + id: this.info.id, + 'uuid.uuid': this.info.uuid.uuid, + }); + + this.valueControl_.load({ + deviceAddress: this.deviceAddress_, + serviceId: this.serviceId_, + characteristicId: this.characteristicId_, + descriptorId: this.info.id, + }); + + const descriptorHeaderValue = + this.shadowRoot.querySelector('.header-value'); + descriptorHeaderValue.textContent = this.info.uuid.uuid; + + const infoDiv = this.shadowRoot.querySelector('.info-container'); + infoDiv.insertBefore( + this.valueControl_, + this.shadowRoot.querySelector('characteristic-list')); + + const descriptorDiv = this.shadowRoot.querySelector('.flex'); + descriptorDiv.appendChild(this.descriptorFieldSet_); + } +} + +customElements.define('descriptor-list-item', DescriptorListItemElement);
diff --git a/chrome/browser/resources/bluetooth_internals/device_details_page.js b/chrome/browser/resources/bluetooth_internals/device_details_page.js index 28ab4edb..f1436a7 100644 --- a/chrome/browser/resources/bluetooth_internals/device_details_page.js +++ b/chrome/browser/resources/bluetooth_internals/device_details_page.js
@@ -8,6 +8,8 @@ * served from chrome://bluetooth-internals/. */ +import './service_list.js'; + import {$} from 'chrome://resources/js/util.m.js'; import {DeviceInfo, DeviceRemote, ServiceInfo} from './device.mojom-webui.js'; @@ -16,7 +18,6 @@ import {formatManufacturerDataMap, formatServiceUuids} from './device_utils.js'; import {ObjectFieldSet} from './object_fieldset.js'; import {Page} from './page.js'; -import {ServiceList} from './service_list.js'; import {Snackbar, SnackbarType} from './snackbar.js'; /** @@ -61,7 +62,7 @@ this.deviceFieldSet_.setPropertyDisplayNames(PROPERTY_NAMES); /** @private {!ServiceList} */ - this.serviceList_ = new ServiceList(); + this.serviceList_ = document.createElement('service-list'); /** @private {!ConnectionStatus} */ this.status_ = ConnectionStatus.DISCONNECTED; @@ -178,7 +179,6 @@ }; this.deviceFieldSet_.setObject(deviceViewObj); - this.serviceList_.redraw(); } /**
diff --git a/chrome/browser/resources/bluetooth_internals/expandable_list.html b/chrome/browser/resources/bluetooth_internals/expandable_list.html new file mode 100644 index 0000000..50f28f2 --- /dev/null +++ b/chrome/browser/resources/bluetooth_internals/expandable_list.html
@@ -0,0 +1,25 @@ +<style> + :host { + list-style-type: none; + outline: none; + } + + .spinner { + background-image: url(chrome://resources/images/throbber_small.svg); + background-size: 100%; + height: 48px; + margin: 0 auto; + pointer-events: none; + width: 48px; + } + + .empty-message { + font-weight: normal; + line-height: 1; + padding-inline-start: calc(2 * var(--section-padding)); + user-select: none; + } +</style> +<h3 class="empty-message" hidden></h3> +<div class="list-items"></div> +<div class="spinner"></div>
diff --git a/chrome/browser/resources/bluetooth_internals/expandable_list.js b/chrome/browser/resources/bluetooth_internals/expandable_list.js index 7090723..d758e6e7 100644 --- a/chrome/browser/resources/bluetooth_internals/expandable_list.js +++ b/chrome/browser/resources/bluetooth_internals/expandable_list.js
@@ -2,113 +2,43 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {define as crUiDefine} from 'chrome://resources/js/cr/ui.m.js'; -import {ArrayDataModel} from 'chrome://resources/js/cr/ui/array_data_model.m.js'; -import {List} from 'chrome://resources/js/cr/ui/list.m.js'; -import {ListItem} from 'chrome://resources/js/cr/ui/list_item.m.js'; +import {assert} from 'chrome://resources/js/assert.m.js'; +import {CustomElement} from 'chrome://resources/js/custom_element.js'; -/** - * Javascript for ExpandableList and ExpandableListItem, served from - * chrome://bluetooth-internals/. - */ +import {getTemplate} from './expandable_list.html.js'; -/** - * A list item that has expandable content that toggles when the item is - * clicked. - * @constructor - * @extends {ListItem} - */ -export const ExpandableListItem = crUiDefine('li'); +export class ExpandableListElement extends CustomElement { + static get template() { + return getTemplate(); + } -ExpandableListItem.prototype = { - __proto__: ListItem.prototype, - - /** - * Decorates the element as an expandable list item and caches the created - * content holders for implementations. - * @override - */ - decorate() { - this.classList.add('expandable-list-item'); - this.briefContent_ = document.createElement('div'); - this.briefContent_.classList.add('brief-content'); - this.briefContent_.addEventListener('click', this.onExpand_.bind(this)); - this.appendChild(this.briefContent_); - - this.expandedContent_ = document.createElement('div'); - this.expandedContent_.classList.add('expanded-content'); - this.appendChild(this.expandedContent_); - }, - - /** - * Called when the list item is expanded or collapsed. - * @param {boolean} expanded - */ - onExpandInternal(expanded) {}, - - /** - * Toggles the expanded class on the item. - * @private - */ - onExpand_() { - this.onExpandInternal(this.classList.toggle('expanded')); - }, -}; - -/** - * A list that contains expandable list items. - * @constructor - * @extends {List} - */ -export const ExpandableList = crUiDefine('list'); - -ExpandableList.prototype = { - __proto__: List.prototype, - - /** - * Decorates element as an expandable list and caches references to layout - * elements. - * @override - */ - decorate() { - List.prototype.decorate.call(this); + connectedCallback() { this.classList.add('expandable-list'); - - this.emptyMessage_ = document.createElement('h3'); - this.emptyMessage_.classList.add('empty-message'); - this.emptyMessage_.hidden = true; - this.insertBefore(this.emptyMessage_, this.firstChild); - - this.spinner_ = document.createElement('div'); - this.spinner_.classList.add('spinner'); - this.insertBefore(this.spinner_, this.firstChild); - - this.autoExpands = true; - this.boundUpdateMessage_ = this.updateMessageDisplay_.bind(this); - this.setSpinnerShowing(true); - }, + } /** * Sets the data model of the list. - * @param {ArrayDataModel} data + * @param {Array} data */ setData(data) { - if (this.dataModel) { - this.dataModel.removeEventListener('splice', this.boundUpdateMessage_); - } + this.updateMessageDisplay_(data.length === 0); + const items = this.shadowRoot.querySelector('.list-items'); + data.forEach(item => { + const listItem = this.createItem(item); + items.appendChild(listItem); + }); + } - this.dataModel = data; - this.dataModel.addEventListener('splice', this.boundUpdateMessage_); - this.updateMessageDisplay_(); - }, + createItem(itemData) {} /** * Sets the empty message text. * @param {string} message */ setEmptyMessage(message) { - this.emptyMessage_.textContent = message; - }, + const emptyMessage = this.shadowRoot.querySelector('.empty-message'); + emptyMessage.textContent = message; + } /** * Sets the spinner display state. If |showing| is true, the loading @@ -116,22 +46,27 @@ * @param {boolean} showing */ setSpinnerShowing(showing) { - this.spinner_.hidden = !showing; - }, + this.shadowRoot.querySelector('.spinner').hidden = !showing; + } /** * Gets the spinner display state. Returns true if the spinner is showing. * @return {boolean} */ isSpinnerShowing() { - return !this.spinner_.hidden; - }, + return !this.shadowRoot.querySelector('.spinner').hidden; + } /** * Updates the display state of the empty message. If there are no items in * the data model, the empty message is displayed. + * @param {boolean} empty Whether the list is empty. */ - updateMessageDisplay_() { - this.emptyMessage_.hidden = this.dataModel.length > 0; - }, -}; + updateMessageDisplay_(empty) { + const emptyMessage = this.shadowRoot.querySelector('.empty-message'); + assert(emptyMessage); + emptyMessage.hidden = !empty; + } +} + +customElements.define('expandable-list', ExpandableListElement);
diff --git a/chrome/browser/resources/bluetooth_internals/expandable_list_item.html b/chrome/browser/resources/bluetooth_internals/expandable_list_item.html new file mode 100644 index 0000000..f438704 --- /dev/null +++ b/chrome/browser/resources/bluetooth_internals/expandable_list_item.html
@@ -0,0 +1,28 @@ +<style> + .brief-content { + align-items: center; + background-color: var(--brief-content-background-color, white); + border-bottom: var(--divider-border); + color: white; + cursor: pointer; + display: flex; + font-weight: 600; + height: 40px; + padding: 8px; + } + + .expanded-content { + height: 0; + overflow: hidden; + } + + :host([expanded]) .expanded-content { + height: auto; + } +</style> +<div class="brief-content"> + <slot name="brief-content"></slot> +</div> +<div class="expanded-content"> + <slot name="expanded-content"></slot> +</div>
diff --git a/chrome/browser/resources/bluetooth_internals/expandable_list_item.js b/chrome/browser/resources/bluetooth_internals/expandable_list_item.js new file mode 100644 index 0000000..9178d7e --- /dev/null +++ b/chrome/browser/resources/bluetooth_internals/expandable_list_item.js
@@ -0,0 +1,34 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {CustomElement} from 'chrome://resources/js/custom_element.js'; + +import {getTemplate} from './expandable_list_item.html.js'; + +/** + * A list item that has expandable content that toggles when the item is + * clicked. + */ +export class ExpandableListItemElement extends CustomElement { + static get template() { + return getTemplate(); + } + + connectedCallback() { + const briefContent = this.shadowRoot.querySelector('.brief-content'); + briefContent.addEventListener('click', () => this.onExpand_()); + this.classList.add('expandable-list-item'); + } + + /** @private */ + onExpand_() { + const expanded = !this.hasAttribute('expanded'); + this.toggleAttribute('expanded', expanded); + this.dispatchEvent(new CustomEvent( + 'list-item-expanded', + {bubbles: true, composed: true, detail: expanded})); + } +} + +customElements.define('expandable-list-item', ExpandableListItemElement);
diff --git a/chrome/browser/resources/bluetooth_internals/service_list.js b/chrome/browser/resources/bluetooth_internals/service_list.js index d141b52..a0e8920 100644 --- a/chrome/browser/resources/bluetooth_internals/service_list.js +++ b/chrome/browser/resources/bluetooth_internals/service_list.js
@@ -2,143 +2,49 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {assert} from 'chrome://resources/js/assert.m.js'; -import {define as crUiDefine} from 'chrome://resources/js/cr/ui.m.js'; -import {ArrayDataModel} from 'chrome://resources/js/cr/ui/array_data_model.m.js'; +import './service_list_item.js'; +import './expandable_list.js'; -import {CharacteristicList} from './characteristic_list.js'; -import {ServiceInfo} from './device.mojom-webui.js'; +import {assert} from 'chrome://resources/js/assert.m.js'; + import {connectToDevice} from './device_broker.js'; -import {ExpandableList, ExpandableListItem} from './expandable_list.js'; -import {ObjectFieldSet} from './object_fieldset.js'; +import {ExpandableListElement} from './expandable_list.js'; import {Snackbar, SnackbarType} from './snackbar.js'; /** - * Javascript for ServiceList and ServiceListItem, served from - * chrome://bluetooth-internals/. - */ - -/** - * Property names that will be displayed in the ObjectFieldSet which contains - * the ServiceInfo object. - */ -const PROPERTY_NAMES = { - id: 'ID', - 'uuid.uuid': 'UUID', - isPrimary: 'Type', -}; - -/** - * A list item that displays the data in a ServiceInfo object. The brief - * section contains the UUID of the given |serviceInfo|. The expanded section - * contains an ObjectFieldSet that displays all of the properties in the - * given |serviceInfo|. Data is not loaded until the ServiceListItem is - * expanded for the first time. - * @param {!ServiceInfo} serviceInfo - * @param {string} deviceAddress - * @extends {ExpandableListItem} - * @constructor - */ -export function ServiceListItem(serviceInfo, deviceAddress) { - const listItem = new ExpandableListItem(); - listItem.__proto__ = ServiceListItem.prototype; - - /** @type {!ServiceInfo} */ - listItem.info = serviceInfo; - /** @private {string} */ - listItem.deviceAddress_ = deviceAddress; - - listItem.decorate(); - return listItem; -} - -ServiceListItem.prototype = { - __proto__: ExpandableListItem.prototype, - - /** - * Decorates the element as a service list item. Creates layout and caches - * references to the created header and fieldset. - * @override - */ - decorate() { - this.classList.add('service-list-item'); - - /** @private {!ObjectFieldSet} */ - this.serviceFieldSet_ = new ObjectFieldSet(); - this.serviceFieldSet_.setPropertyDisplayNames(PROPERTY_NAMES); - this.serviceFieldSet_.setObject({ - id: this.info.id, - 'uuid.uuid': this.info.uuid.uuid, - isPrimary: this.info.isPrimary ? 'Primary' : 'Secondary', - }); - - // Create content for display in brief content container. - const serviceHeaderText = document.createElement('div'); - serviceHeaderText.textContent = 'Service:'; - - const serviceHeaderValue = document.createElement('div'); - serviceHeaderValue.textContent = this.info.uuid.uuid; - - const serviceHeader = document.createElement('div'); - serviceHeader.appendChild(serviceHeaderText); - serviceHeader.appendChild(serviceHeaderValue); - this.briefContent_.appendChild(serviceHeader); - - // Create content for display in expanded content container. - const serviceInfoHeader = document.createElement('h4'); - serviceInfoHeader.textContent = 'Service Info'; - - const serviceDiv = document.createElement('div'); - serviceDiv.classList.add('flex'); - serviceDiv.appendChild(this.serviceFieldSet_); - - const characteristicsListHeader = document.createElement('h4'); - characteristicsListHeader.textContent = 'Characteristics'; - this.characteristicList_ = new CharacteristicList(); - - const infoDiv = document.createElement('div'); - infoDiv.classList.add('info-container'); - infoDiv.appendChild(serviceInfoHeader); - infoDiv.appendChild(serviceDiv); - infoDiv.appendChild(characteristicsListHeader); - infoDiv.appendChild(this.characteristicList_); - - this.expandedContent_.appendChild(infoDiv); - }, - - /** @override */ - onExpandInternal(expanded) { - this.characteristicList_.load(this.deviceAddress_, this.info.id); - }, -}; - -/** * A list that displays ServiceListItems. - * @constructor - * @extends {ExpandableList} */ -export const ServiceList = crUiDefine('list'); - -ServiceList.prototype = { - __proto__: ExpandableList.prototype, - - /** @override */ - decorate() { - ExpandableList.prototype.decorate.call(this); +export class ServiceListElement extends ExpandableListElement { + constructor() { + super(); /** @private {?string} */ this.deviceAddress_ = null; /** @private {boolean} */ this.servicesRequested_ = false; + } + + connectedCallback() { + super.connectedCallback(); this.classList.add('service-list'); - this.setEmptyMessage('No Services Found'); - }, + } + + /** + * Sets the empty message text. + * @param {string} message + */ + setEmptyMessage(message) { + const emptyMessage = this.shadowRoot.querySelector('.empty-message'); + emptyMessage.textContent = message; + } /** @override */ createItem(data) { - return new ServiceListItem(data, assert(this.deviceAddress_)); - }, + const item = document.createElement('service-list-item'); + item.initialize(data, assert(this.deviceAddress_)); + return item; + } /** * Loads the service list with an array of ServiceInfo from the @@ -147,6 +53,8 @@ * @param {string} deviceAddress */ load(deviceAddress) { + this.setEmptyMessage('No Services Found'); + if (this.servicesRequested_ || !this.isSpinnerShowing()) { return; } @@ -159,7 +67,7 @@ return device.getServices(); }.bind(this)) .then(function(response) { - this.setData(new ArrayDataModel(response.services)); + this.setData(response.services || []); this.setSpinnerShowing(false); this.servicesRequested_ = false; }.bind(this)) @@ -171,5 +79,7 @@ this.load(deviceAddress); }.bind(this)); }.bind(this)); - }, -}; + } +} + +customElements.define('service-list', ServiceListElement);
diff --git a/chrome/browser/resources/bluetooth_internals/service_list_item.html b/chrome/browser/resources/bluetooth_internals/service_list_item.html new file mode 100644 index 0000000..22e6a97f --- /dev/null +++ b/chrome/browser/resources/bluetooth_internals/service_list_item.html
@@ -0,0 +1,68 @@ +<style> + :host { + --brief-content-background-color: var(--primary-color); + } + + .info-container > h4, + .info-container > div { + margin: 1em; + } + + /* Object Fieldset */ + .object-fieldset .status { + align-items: center; + display: flex; + margin-bottom: 0.8em; + } + + .object-fieldset .status div:first-child { + margin-inline-end: 1em; + white-space: nowrap; + } + + .object-fieldset .status:last-child { + margin-bottom: 0; + } + + .toggle-status { + background-image: url(chrome://resources/images/cancel_red.svg); + background-repeat: no-repeat; + min-height: 24px; + min-width: 24px; + } + + .toggle-status.checked { + background-image: + url(chrome://resources/images/check_circle_green.svg); + } + + + /* Object Fieldset Container */ + .flex { + overflow-x: auto; + } + + @media screen and (min-width: 601px) { + .flex { + display: flex; + } + } + + h3 { + font-weight: normal; + line-height: 1; + user-select: none; + } +</style> +<expandable-list-item> + <div slot="brief-content"> + <div>Service:</div> + <div class="header-value"></div> + </div> + <div slot="expanded-content" class="info-container"> + <h4>Service Info</h4> + <div class="flex"></div> + <h4>Characteristics</h4> + <characteristic-list></characteristic-list> + </div> +</expandable-list-item>
diff --git a/chrome/browser/resources/bluetooth_internals/service_list_item.js b/chrome/browser/resources/bluetooth_internals/service_list_item.js new file mode 100644 index 0000000..ceb1914 --- /dev/null +++ b/chrome/browser/resources/bluetooth_internals/service_list_item.js
@@ -0,0 +1,78 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import './characteristic_list.js'; +import './expandable_list_item.js'; + +import {CustomElement} from 'chrome://resources/js/custom_element.js'; + +import {ServiceInfo} from './device.mojom-webui.js'; +import {ObjectFieldSet} from './object_fieldset.js'; +import {getTemplate} from './service_list_item.html.js'; + +/** + * Property names that will be displayed in the ObjectFieldSet which contains + * the ServiceInfo object. + */ +const PROPERTY_NAMES = { + id: 'ID', + 'uuid.uuid': 'UUID', + isPrimary: 'Type', +}; + +/** + * A list item that displays the data in a ServiceInfo object. The brief + * section contains the UUID of the given |serviceInfo|. The expanded section + * contains an ObjectFieldSet that displays all of the properties in the + * given |serviceInfo|. Data is not loaded until the ServiceListItem is + * expanded for the first time. + */ +export class ServiceListItemElement extends CustomElement { + static get template() { + return getTemplate(); + } + + constructor() { + super(); + /** @type {?ServiceInfo} */ + this.info = null; + /** @private {string} */ + this.deviceAddress_ = ''; + /** @private {!ObjectFieldSet} */ + this.serviceFieldSet_ = new ObjectFieldSet(); + } + + connectedCallback() { + this.classList.add('service-list-item'); + this.shadowRoot.querySelector('expandable-list-item') + .addEventListener('list-item-expanded', () => { + const list = this.shadowRoot.querySelector('characteristic-list'); + list.load(this.deviceAddress_, this.info.id); + }); + } + + /** + * @param {!ServiceInfo} serviceInfo + * @param {string} deviceAddress + */ + initialize(serviceInfo, deviceAddress) { + this.info = serviceInfo; + this.deviceAddress_ = deviceAddress; + + this.shadowRoot.querySelector('.header-value').textContent = + this.info.uuid.uuid; + + this.serviceFieldSet_.setPropertyDisplayNames(PROPERTY_NAMES); + this.serviceFieldSet_.setObject({ + id: this.info.id, + 'uuid.uuid': this.info.uuid.uuid, + isPrimary: this.info.isPrimary ? 'Primary' : 'Secondary', + }); + + const serviceDiv = this.shadowRoot.querySelector('.flex'); + serviceDiv.appendChild(this.serviceFieldSet_); + } +} + +customElements.define('service-list-item', ServiceListItemElement);
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background.html b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background.html index 9ea919e..4558424 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background.html +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background.html
@@ -1,19 +1,7 @@ <!-- ChromeVox --> - -<!-- ChromeVox compiled script (non-ES6 modules) packed into one file. --> <script src="../chromeVoxChromeBackgroundScript.js" charset="utf-8"> </script> -<!-- - ChromeVox ES6 module(s). - - During the transition to ES6 modules, this top level module will import all - migrated modules. The migration will occur in breadth-first order, starting - with background.js. ES6 modules can "depend" on Closure files (since these are - global), but not vice versa. ---> -<script type="module" src="es6_loader.js"></script> - <!-- Generated at build time --> <script type="text/javascript" src="../phonetic_dictionaries.js" charset="utf-8"></script>
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/classic_background.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/classic_background.js index 2ef2466d..956153a 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/classic_background.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/classic_background.js
@@ -52,8 +52,7 @@ ChromeVox.tts = this.tts; ChromeVox.braille = this.backgroundBraille_; - chrome.accessibilityPrivate.onIntroduceChromeVox.addListener( - this.onIntroduceChromeVox); + this.onIntroduceChromeVox(); // Set up a message passing system for goog.provide() calls from // within the content scripts.
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/loader.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/loader.js index 110d90c..fcc7a842 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/loader.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/loader.js
@@ -6,6 +6,10 @@ * @fileoverview Loader for the background page. */ +// These legacy Closure requires will eventually be moved to ES6 modules (see +// below block). These requires represent a dependency graph sourced from +// loader.js via a script node in our top level html. Once done, that script can +// itself be type="module". goog.require('AbstractEarcons'); goog.require('AutomationPredicate'); goog.require('AutomationTreeWalker'); @@ -52,3 +56,11 @@ goog.require('goog.i18n.MessageFormat'); goog.require('ALL_NODE_MENU_DATA'); + +// ChromeVox ES6 module(s). +// +// During the transition to ES6 modules, this top level module will import all +// migrated modules. The migration will occur in breadth-first order, starting +// with background.js. ES6 modules can "depend" on Closure provides (since these +// are global), but not vice versa. Those Closure provides are above. +import('/chromevox/background/es6_loader.js');
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/tts_background_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/tts_background_test.js index 9ad6a4b5..1f2da8a5 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/tts_background_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/tts_background_test.js
@@ -259,7 +259,10 @@ lastSpokenTextString); }); -AX_TEST_F('ChromeVoxTtsBackgroundTest', 'NumberReadingStyle', function() { +AX_TEST_F('ChromeVoxTtsBackgroundTest', 'NumberReadingStyle', async function() { + // This test depends on local storage initialized by prefs. + await importModule('ChromeVoxPrefs', '/chromevox/background/prefs.js'); + let lastSpokenTextString = ''; tts.speakUsingQueue_ = function(utterance, _) { lastSpokenTextString = utterance.textString; @@ -354,7 +357,10 @@ assertEqualsJSON(['a'], split('a', 'b')); }); -AX_TEST_F('ChromeVoxTtsBackgroundTest', 'Phonetics', function() { +AX_TEST_F('ChromeVoxTtsBackgroundTest', 'Phonetics', async function() { + // JaPhoneticMap gets initialized by Background. + await importModule('Background', '/chromevox/background/background.js'); + let spokenStrings = []; tts.speakUsingQueue_ = (utterance, ...rest) => { spokenStrings.push(utterance.textString); @@ -541,18 +547,22 @@ this.expectUtteranceQueueIsLike([]); }); -TEST_F('ChromeVoxTtsBackgroundTest', 'ResetTtsSettingsClearsVoice', function() { - this.newCallback(async () => { - ChromeVox.tts.ttsEngines_[0].currentVoice = ''; - CommandHandlerInterface.instance.onCommand('resetTextToSpeechSettings'); - await new Promise(r => { - ChromeVox.tts.speak = textString => { - if (textString === 'Reset text to speech settings to default values') { - r(); - } - }; +AX_TEST_F( + 'ChromeVoxTtsBackgroundTest', 'ResetTtsSettingsClearsVoice', + async function() { + // Pull in ChromeVox.tts which is initialized by Background. + await importModule('Background', '/chromevox/background/background.js'); + + ChromeVox.tts.ttsEngines_[0].currentVoice = ''; + CommandHandlerInterface.instance.onCommand('resetTextToSpeechSettings'); + await new Promise(r => { + ChromeVox.tts.speak = textString => { + if (textString === + 'Reset text to speech settings to default values') { + r(); + } + }; + }); + assertEquals( + constants.SYSTEM_VOICE, ChromeVox.tts.ttsEngines_[0].currentVoice); }); - assertEquals( - constants.SYSTEM_VOICE, ChromeVox.tts.ttsEngines_[0].currentVoice); - })(); -});
diff --git a/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_navigation_control_test.js b/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_navigation_control_test.js index 9e0f5af4..a47fde6 100644 --- a/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_navigation_control_test.js +++ b/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_navigation_control_test.js
@@ -923,11 +923,13 @@ AX_TEST_F( 'SelectToSpeakNavigationControlTest', 'AutoDismissesIfNavigationControlsDisabled', async function() { - // Disable navigation controls via settings. - chrome.storage.sync.set({'navigationControls': false}); const bodyHtml = '<p id="p1">Paragraph 1</p>'; await this.runWithLoadedTree( this.generateHtmlWithSelectedElement('p1', bodyHtml)); + + // Disable navigation controls. + selectToSpeak.prefsManager_.navigationControlsEnabled_ = false; + // Simulate starting and completing TTS. this.triggerReadSelectedText(); this.mockTts.finishPendingUtterance();
diff --git a/chrome/browser/resources/chromeos/notification_tester/form_constants.js b/chrome/browser/resources/chromeos/notification_tester/form_constants.js index 8b0e03e9..2af6004 100644 --- a/chrome/browser/resources/chromeos/notification_tester/form_constants.js +++ b/chrome/browser/resources/chromeos/notification_tester/form_constants.js
@@ -112,9 +112,9 @@ ], ICON_OPTIONS: [ {displayText: 'No Image', value: 'none'}, - {displayText: 'Top Hat Cinammon Toast (PNG)', value: 'top_hat'}, - {displayText: 'Metal Cinammon Toast (JPEG)', value: 'metal'}, - {displayText: 'Google Icon (SVG)', value: 'google'}, + {displayText: 'Chromium Logo (PNG)', value: 'chromium_logo'}, + {displayText: 'Google Logo (PNG)', value: 'google_logo'}, + {displayText: 'Warning Symbol (PNG)', value: 'warning'}, ], IMAGE_OPTIONS: [ {displayText: 'No Image', value: 'none'},
diff --git a/chrome/browser/resources/chromeos/notification_tester/notification_tester.js b/chrome/browser/resources/chromeos/notification_tester/notification_tester.js index 43562fe5..3b32f77 100644 --- a/chrome/browser/resources/chromeos/notification_tester/notification_tester.js +++ b/chrome/browser/resources/chromeos/notification_tester/notification_tester.js
@@ -31,7 +31,19 @@ notifMetadata: { type: Object, value: function() { - return {}; + // Set default values of form elements. + return { + notifierType: 'System', + richDataNeverTimeout: false, + richDataPinned: false, + richDataRenotify: false, + richDataProgress: '-1', + richDataShowSettings: false, + richDataShowSnooze: false, + richDataNumButtons: '0', + richDataNumNotifItems: '0', + originURL: '', + }; }, }, /* @@ -137,11 +149,21 @@ static get observers() { return [ 'notificationTypeChanged_(notifMetadata.notificationType)', - 'notifierTypeChanged_(notifMetadata.notifierType)' + 'notifierTypeChanged_(notifMetadata.notifierType)', ]; } onClickGenerate() { + // Convert properties where strings represent base-10 numbers to base-10 + // numbers. + const BASE_TEN = 10; + this.notifMetadata.richDataNumButtons = + parseInt(this.notifMetadata.richDataNumButtons, BASE_TEN); + this.notifMetadata.richDataNumNotifItems = + parseInt(this.notifMetadata.richDataNumNotifItems, BASE_TEN); + this.notifMetadata.richDataProgress = + parseInt(this.notifMetadata.richDataProgress, BASE_TEN); + // Send notification data to C++ chrome.send('generateNotificationForm', [this.notifMetadata]); }
diff --git a/chrome/browser/resources/settings/appearance_page/appearance_page.html b/chrome/browser/resources/settings/appearance_page/appearance_page.html index 69900c0..9065e5b 100644 --- a/chrome/browser/resources/settings/appearance_page/appearance_page.html +++ b/chrome/browser/resources/settings/appearance_page/appearance_page.html
@@ -71,7 +71,8 @@ prefs.homepage.value)]]"> </settings-toggle-button> <template is="dom-if" if="[[prefs.browser.show_home_button.value]]"> - <div class="list-frame" hidden="[[!pageVisibility.homeButton]]"> + <div id="home-button-options" class="list-frame" + hidden="[[!pageVisibility.homeButton]]"> <settings-radio-group pref="{{prefs.homepage_is_newtabpage}}"> <controlled-radio-button class="list-item" name="true" pref="[[prefs.homepage_is_newtabpage]]" @@ -109,6 +110,31 @@ pref="{{prefs.bookmark_bar.show_on_all_tabs}}" label="$i18n{showBookmarksBar}"> </settings-toggle-button> + + <template is="dom-if" if="[[showSidePanelOptions_]]"> + <div class="cr-row">$i18n{sidePanel}</div> + <div class="list-frame"> + <settings-radio-group + id="side-panel" + pref="{{prefs.side_panel.is_right_aligned}}"> + <controlled-radio-button + class="list-item" + pref="[[prefs.side_panel.is_right_aligned]]" + label="$i18n{sidePanelAlignRight}" + name="true" + no-extension-indicator> + </controlled-radio-button> + <controlled-radio-button + class="list-item" + pref="[[prefs.side_panel.is_right_aligned]]" + label="$i18n{sidePanelAlignLeft}" + name="false" + no-extension-indicator> + </controlled-radio-button> + </settings-radio-group> + </div> + </template> + <if expr="is_linux"> <div class="hr" hidden="[[!pageVisibility.bookmarksBar]]"></div> <settings-toggle-button
diff --git a/chrome/browser/resources/settings/appearance_page/appearance_page.ts b/chrome/browser/resources/settings/appearance_page/appearance_page.ts index 1b5071c..065f3e0 100644 --- a/chrome/browser/resources/settings/appearance_page/appearance_page.ts +++ b/chrome/browser/resources/settings/appearance_page/appearance_page.ts
@@ -157,6 +157,13 @@ }, // </if> + showSidePanelOptions_: { + type: Boolean, + value() { + return loadTimeData.getBoolean('showSidePanelOptions'); + } + }, + showManagedThemeDialog_: Boolean, }; } @@ -175,6 +182,7 @@ } pageVisibility: AppearancePageVisibility; + private showSidePanelOptions_: boolean; private defaultZoom_: number; private isWallpaperPolicyControlled_: boolean; private fontSizeOptions_: DropdownMenuOptionList;
diff --git a/chrome/browser/resources/settings/chromeos/BUILD.gn b/chrome/browser/resources/settings/chromeos/BUILD.gn index ff61bdf..b088db4 100644 --- a/chrome/browser/resources/settings/chromeos/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/BUILD.gn
@@ -824,7 +824,7 @@ deps = [ "..:router", "..:setting_id_param_util", - "//chrome/browser/ui/webui/settings/chromeos/constants:mojom_js_library_for_compile", + "//chrome/browser/ui/webui/settings/chromeos/constants:mojom_webui_js", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:load_time_data.m", ]
diff --git a/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_page.js b/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_page.js index 30c1c9f..7dd31e3 100644 --- a/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_page.js +++ b/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_page.js
@@ -20,6 +20,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {afterNextRender, flush, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -107,13 +108,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kAmbientModeOnOff, - chromeos.settings.mojom.Setting.kAmbientModeSource, + Setting.kAmbientModeOnOff, + Setting.kAmbientModeSource, ]), }, @@ -163,10 +164,10 @@ /** * Overridden from DeepLinkingBehavior. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId */ beforeDeepLinkAttempt(settingId) { - if (settingId !== chromeos.settings.mojom.Setting.kAmbientModeSource) { + if (settingId !== Setting.kAmbientModeSource) { // Continue with deep link attempt. return true; }
diff --git a/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_page.js b/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_page.js index f3a809061..3709a5a 100644 --- a/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_page.js +++ b/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_page.js
@@ -23,6 +23,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -166,11 +167,11 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, - value: () => new Set([chromeos.settings.mojom.Setting.kBluetoothOnOff]), + value: () => new Set([Setting.kBluetoothOnOff]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_subpage.js b/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_subpage.js index 59939c0..deb35d9 100644 --- a/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_subpage.js +++ b/chrome/browser/resources/settings/chromeos/bluetooth_page/bluetooth_subpage.js
@@ -24,6 +24,7 @@ import {ListPropertyUpdateBehavior, ListPropertyUpdateBehaviorInterface} from 'chrome://resources/js/list_property_update_behavior.m.js'; import {flush, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -195,7 +196,7 @@ /** * Contains the settingId of any deep link that wasn't able to be shown, * null otherwise. - * @private {?chromeos.settings.mojom.Setting} + * @private {?Setting} */ pendingSettingId_: { type: Number, @@ -204,16 +205,16 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kBluetoothOnOff, - chromeos.settings.mojom.Setting.kBluetoothConnectToDevice, - chromeos.settings.mojom.Setting.kBluetoothDisconnectFromDevice, - chromeos.settings.mojom.Setting.kBluetoothPairDevice, - chromeos.settings.mojom.Setting.kBluetoothUnpairDevice, + Setting.kBluetoothOnOff, + Setting.kBluetoothConnectToDevice, + Setting.kBluetoothDisconnectFromDevice, + Setting.kBluetoothPairDevice, + Setting.kBluetoothUnpairDevice, ]), }, @@ -275,7 +276,7 @@ /** * Overridden from DeepLinkingBehavior. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {boolean} */ beforeDeepLinkAttempt(settingId) { @@ -283,12 +284,10 @@ // button on a paired device), FocusRowBehavior prevents the Focus Row from // being focused. We clear lastFocused_ so that we can focus the row (such // as a paired/unpaired device). - if (settingId === - chromeos.settings.mojom.Setting.kBluetoothConnectToDevice || - settingId === - chromeos.settings.mojom.Setting.kBluetoothDisconnectFromDevice || - settingId === chromeos.settings.mojom.Setting.kBluetoothPairDevice || - settingId === chromeos.settings.mojom.Setting.kBluetoothUnpairDevice) { + if (settingId === Setting.kBluetoothConnectToDevice || + settingId === Setting.kBluetoothDisconnectFromDevice || + settingId === Setting.kBluetoothPairDevice || + settingId === Setting.kBluetoothUnpairDevice) { this.lastFocused_ = null; } // Should continue with deep link attempt.
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_arc_adb.js b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_arc_adb.js index 6eaf9b6..8826355 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_arc_adb.js +++ b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_arc_adb.js
@@ -19,6 +19,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -100,12 +101,11 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, - value: () => - new Set([chromeos.settings.mojom.Setting.kCrostiniAdbDebugging]), + value: () => new Set([Setting.kCrostiniAdbDebugging]), }, }; }
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_export_import.js b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_export_import.js index 365f3b0..3b906138 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_export_import.js +++ b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_export_import.js
@@ -15,6 +15,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -122,13 +123,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kBackupLinuxAppsAndFiles, - chromeos.settings.mojom.Setting.kRestoreLinuxAppsAndFiles, + Setting.kBackupLinuxAppsAndFiles, + Setting.kRestoreLinuxAppsAndFiles, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_page.js b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_page.js index 6bde7d6d..49feaad5 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_page.js +++ b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_page.js
@@ -30,6 +30,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -129,11 +130,11 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, - value: () => new Set([chromeos.settings.mojom.Setting.kSetUpCrostini]), + value: () => new Set([Setting.kSetUpCrostini]), }, enableBruschetta_: {
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_subpage.js b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_subpage.js index fdb61e4..679af81 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_subpage.js +++ b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_subpage.js
@@ -22,6 +22,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -225,15 +226,15 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kUninstallCrostini, - chromeos.settings.mojom.Setting.kCrostiniDiskResize, - chromeos.settings.mojom.Setting.kCrostiniMicAccess, - chromeos.settings.mojom.Setting.kCrostiniContainerUpgrade, + Setting.kUninstallCrostini, + Setting.kCrostiniDiskResize, + Setting.kCrostiniMicAccess, + Setting.kCrostiniContainerUpgrade, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/date_time_page/date_time_page.js b/chrome/browser/resources/settings/chromeos/date_time_page/date_time_page.js index fc1a3f1..a1bd702 100644 --- a/chrome/browser/resources/settings/chromeos/date_time_page/date_time_page.js +++ b/chrome/browser/resources/settings/chromeos/date_time_page/date_time_page.js
@@ -23,6 +23,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -114,13 +115,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.k24HourClock, - chromeos.settings.mojom.Setting.kChangeTimeZone, + Setting.k24HourClock, + Setting.kChangeTimeZone, ]), },
diff --git a/chrome/browser/resources/settings/chromeos/date_time_page/timezone_subpage.js b/chrome/browser/resources/settings/chromeos/date_time_page/timezone_subpage.js index bba0ba9..0fd5709 100644 --- a/chrome/browser/resources/settings/chromeos/date_time_page/timezone_subpage.js +++ b/chrome/browser/resources/settings/chromeos/date_time_page/timezone_subpage.js
@@ -16,6 +16,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -62,11 +63,11 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, - value: () => new Set([chromeos.settings.mojom.Setting.kChangeTimeZone]), + value: () => new Set([Setting.kChangeTimeZone]), }, }; }
diff --git a/chrome/browser/resources/settings/chromeos/deep_linking_behavior.js b/chrome/browser/resources/settings/chromeos/deep_linking_behavior.js index 221e589..c7e668d 100644 --- a/chrome/browser/resources/settings/chromeos/deep_linking_behavior.js +++ b/chrome/browser/resources/settings/chromeos/deep_linking_behavior.js
@@ -8,13 +8,10 @@ */ import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js'; -import '../constants/setting.mojom-lite.js'; -import {assert} from 'chrome://resources/js/assert.m.js'; -import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; -import {afterNextRender, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {afterNextRender} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {Router} from '../router.js'; +import {Setting} from '../mojom-webui/setting.mojom-webui.js'; import {getSettingIdParameter} from '../setting_id_param_util.js'; /** @type {string} */ @@ -30,13 +27,13 @@ */ Setting: { type: Object, - value: chromeos.settings.mojom.Setting, + value: Setting, }, /** * Set of setting IDs that could be deep linked to. Initialized as an * empty set, should be overridden with applicable setting IDs. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, @@ -47,7 +44,7 @@ /** * Retrieves the settingId saved in the url's query parameter. Returns null if * deep linking is disabled or if no settingId is found. - * @return {?chromeos.settings.mojom.Setting} + * @return {?Setting} */ getDeepLinkSettingId() { const settingIdStr = getSettingIdParameter(); @@ -58,7 +55,7 @@ if (isNaN(settingIdNum)) { return null; } - return /** @type {!chromeos.settings.mojom.Setting} */ (settingIdNum); + return /** @type {!Setting} */ (settingIdNum); }, /** @@ -66,9 +63,9 @@ * Promise for an object that reflects if the deep link was shown or not. The * object has a boolean |deepLinkShown| and any |pendingSettingId| that * couldn't be shown. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {!Promise<!{deepLinkShown: boolean, pendingSettingId: - * ?chromeos.settings.mojom.Setting}>} + * ?Setting}>} */ showDeepLink(settingId) { return new Promise(resolve => { @@ -100,7 +97,7 @@ * and before the deep link is shown. Returns whether or not the deep link * attempt should continue. Default behavior is to no op and then return * true, continuing the deep link attempt. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {boolean} */ beforeDeepLinkAttempt(settingId) { @@ -113,7 +110,7 @@ * link was shown or not. The object has a boolean |deepLinkShown| and any * |pendingSettingId| that couldn't be shown. * @return {!Promise<!{deepLinkShown: boolean, pendingSettingId: - * ?chromeos.settings.mojom.Setting}>} + * ?Setting}>} */ attemptDeepLink() { const settingId = this.getDeepLinkSettingId(); @@ -143,19 +140,19 @@ /** @type {!Object} */ this.Setting; - /** @type {!Set<!chromeos.settings.mojom.Setting>}} */ + /** @type {!Set<!Setting>}} */ this.supportedSettingIds; } /** - * @return {?chromeos.settings.mojom.Setting} + * @return {?Setting} */ getDeepLinkSettingId() {} /** - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {!Promise<!{deepLinkShown: boolean, pendingSettingId: - * ?chromeos.settings.mojom.Setting}>} + * ?Setting}>} */ showDeepLink(settingId) {} @@ -165,14 +162,14 @@ showDeepLinkElement(elToFocus) {} /** - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {boolean} */ beforeDeepLinkAttempt(settingId) {} /** * @return {!Promise<!{deepLinkShown: boolean, pendingSettingId: - * ?chromeos.settings.mojom.Setting}>} + * ?Setting}>} */ attemptDeepLink() {} }
diff --git a/chrome/browser/resources/settings/chromeos/device_page/display.js b/chrome/browser/resources/settings/chromeos/device_page/display.js index 32171423..aa4ec0dc 100644 --- a/chrome/browser/resources/settings/chromeos/device_page/display.js +++ b/chrome/browser/resources/settings/chromeos/device_page/display.js
@@ -29,6 +29,7 @@ import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {flush, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -258,7 +259,7 @@ /** * Contains the settingId of any deep link that wasn't able to be shown, * null otherwise. - * @private {?chromeos.settings.mojom.Setting} + * @private {?Setting} */ pendingSettingId_: { type: Number, @@ -267,23 +268,23 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kDisplaySize, - chromeos.settings.mojom.Setting.kNightLight, - chromeos.settings.mojom.Setting.kDisplayOrientation, - chromeos.settings.mojom.Setting.kDisplayArrangement, - chromeos.settings.mojom.Setting.kDisplayResolution, - chromeos.settings.mojom.Setting.kDisplayRefreshRate, - chromeos.settings.mojom.Setting.kDisplayMirroring, - chromeos.settings.mojom.Setting.kAllowWindowsToSpanDisplays, - chromeos.settings.mojom.Setting.kAmbientColors, - chromeos.settings.mojom.Setting.kTouchscreenCalibration, - chromeos.settings.mojom.Setting.kNightLightColorTemperature, - chromeos.settings.mojom.Setting.kDisplayOverscan, + Setting.kDisplaySize, + Setting.kNightLight, + Setting.kDisplayOrientation, + Setting.kDisplayArrangement, + Setting.kDisplayResolution, + Setting.kDisplayRefreshRate, + Setting.kDisplayMirroring, + Setting.kAllowWindowsToSpanDisplays, + Setting.kAmbientColors, + Setting.kTouchscreenCalibration, + Setting.kNightLightColorTemperature, + Setting.kDisplayOverscan, ]), }, @@ -378,7 +379,7 @@ /** * Overridden from DeepLinkingBehavior. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {boolean} */ beforeDeepLinkAttempt(settingId) {
diff --git a/chrome/browser/resources/settings/chromeos/device_page/keyboard.js b/chrome/browser/resources/settings/chromeos/device_page/keyboard.js index d9cca68..3a5e25a 100644 --- a/chrome/browser/resources/settings/chromeos/device_page/keyboard.js +++ b/chrome/browser/resources/settings/chromeos/device_page/keyboard.js
@@ -15,6 +15,7 @@ import {afterNextRender, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -130,14 +131,14 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kKeyboardFunctionKeys, - chromeos.settings.mojom.Setting.kKeyboardAutoRepeat, - chromeos.settings.mojom.Setting.kKeyboardShortcuts, + Setting.kKeyboardFunctionKeys, + Setting.kKeyboardAutoRepeat, + Setting.kKeyboardShortcuts, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/device_page/pointers.js b/chrome/browser/resources/settings/chromeos/device_page/pointers.js index d9ddd33..f4120997 100644 --- a/chrome/browser/resources/settings/chromeos/device_page/pointers.js +++ b/chrome/browser/resources/settings/chromeos/device_page/pointers.js
@@ -18,6 +18,7 @@ import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -156,27 +157,27 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kTouchpadTapToClick, - chromeos.settings.mojom.Setting.kTouchpadTapDragging, - chromeos.settings.mojom.Setting.kTouchpadReverseScrolling, - chromeos.settings.mojom.Setting.kTouchpadAcceleration, - chromeos.settings.mojom.Setting.kTouchpadScrollAcceleration, - chromeos.settings.mojom.Setting.kTouchpadSpeed, - chromeos.settings.mojom.Setting.kTouchpadHapticFeedback, - chromeos.settings.mojom.Setting.kTouchpadHapticClickSensitivity, - chromeos.settings.mojom.Setting.kPointingStickAcceleration, - chromeos.settings.mojom.Setting.kPointingStickSpeed, - chromeos.settings.mojom.Setting.kPointingStickSwapPrimaryButtons, - chromeos.settings.mojom.Setting.kMouseSwapPrimaryButtons, - chromeos.settings.mojom.Setting.kMouseReverseScrolling, - chromeos.settings.mojom.Setting.kMouseAcceleration, - chromeos.settings.mojom.Setting.kMouseScrollAcceleration, - chromeos.settings.mojom.Setting.kMouseSpeed, + Setting.kTouchpadTapToClick, + Setting.kTouchpadTapDragging, + Setting.kTouchpadReverseScrolling, + Setting.kTouchpadAcceleration, + Setting.kTouchpadScrollAcceleration, + Setting.kTouchpadSpeed, + Setting.kTouchpadHapticFeedback, + Setting.kTouchpadHapticClickSensitivity, + Setting.kPointingStickAcceleration, + Setting.kPointingStickSpeed, + Setting.kPointingStickSwapPrimaryButtons, + Setting.kMouseSwapPrimaryButtons, + Setting.kMouseReverseScrolling, + Setting.kMouseAcceleration, + Setting.kMouseScrollAcceleration, + Setting.kMouseSpeed, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/device_page/power.js b/chrome/browser/resources/settings/chromeos/device_page/power.js index 2fffee78..5b8fd81a 100644 --- a/chrome/browser/resources/settings/chromeos/device_page/power.js +++ b/chrome/browser/resources/settings/chromeos/device_page/power.js
@@ -20,6 +20,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -172,16 +173,16 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kPowerIdleBehaviorWhileCharging, - chromeos.settings.mojom.Setting.kPowerSource, - chromeos.settings.mojom.Setting.kSleepWhenLaptopLidClosed, - chromeos.settings.mojom.Setting.kPowerIdleBehaviorWhileOnBattery, - chromeos.settings.mojom.Setting.kAdaptiveCharging, + Setting.kPowerIdleBehaviorWhileCharging, + Setting.kPowerSource, + Setting.kSleepWhenLaptopLidClosed, + Setting.kPowerIdleBehaviorWhileOnBattery, + Setting.kAdaptiveCharging, ]), }, @@ -214,12 +215,11 @@ /** * Overridden from DeepLinkingBehavior. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {boolean} */ beforeDeepLinkAttempt(settingId) { - if (settingId === chromeos.settings.mojom.Setting.kPowerSource && - this.$.powerSource.hidden) { + if (settingId === Setting.kPowerSource && this.$.powerSource.hidden) { // If there is only 1 power source, there is no dropdown to focus. // Stop the deep link attempt in this case. return false;
diff --git a/chrome/browser/resources/settings/chromeos/device_page/stylus.js b/chrome/browser/resources/settings/chromeos/device_page/stylus.js index 18fb1ae..512b3e3 100644 --- a/chrome/browser/resources/settings/chromeos/device_page/stylus.js +++ b/chrome/browser/resources/settings/chromeos/device_page/stylus.js
@@ -20,6 +20,7 @@ import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {html, microTask, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -113,15 +114,15 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kStylusToolsInShelf, - chromeos.settings.mojom.Setting.kStylusNoteTakingApp, - chromeos.settings.mojom.Setting.kStylusNoteTakingFromLockScreen, - chromeos.settings.mojom.Setting.kStylusLatestNoteOnLockScreen, + Setting.kStylusToolsInShelf, + Setting.kStylusNoteTakingApp, + Setting.kStylusNoteTakingFromLockScreen, + Setting.kStylusLatestNoteOnLockScreen, ]), },
diff --git a/chrome/browser/resources/settings/chromeos/google_assistant_page/google_assistant_page.js b/chrome/browser/resources/settings/chromeos/google_assistant_page/google_assistant_page.js index 40a926f..53fff8f 100644 --- a/chrome/browser/resources/settings/chromeos/google_assistant_page/google_assistant_page.js +++ b/chrome/browser/resources/settings/chromeos/google_assistant_page/google_assistant_page.js
@@ -20,6 +20,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -145,17 +146,17 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kAssistantOnOff, - chromeos.settings.mojom.Setting.kAssistantRelatedInfo, - chromeos.settings.mojom.Setting.kAssistantOkGoogle, - chromeos.settings.mojom.Setting.kAssistantNotifications, - chromeos.settings.mojom.Setting.kAssistantVoiceInput, - chromeos.settings.mojom.Setting.kTrainAssistantVoiceModel, + Setting.kAssistantOnOff, + Setting.kAssistantRelatedInfo, + Setting.kAssistantOkGoogle, + Setting.kAssistantNotifications, + Setting.kAssistantVoiceInput, + Setting.kTrainAssistantVoiceModel, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/internet_detail_menu.js b/chrome/browser/resources/settings/chromeos/internet_page/internet_detail_menu.js index 1f13c18..171e6a7 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/internet_detail_menu.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/internet_detail_menu.js
@@ -17,11 +17,13 @@ import {OncMojo} from 'chrome://resources/cr_components/chromeos/network/onc_mojo.m.js'; import {afterNextRender, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; import {RouteObserverBehavior, RouteObserverBehaviorInterface} from '../route_observer_behavior.js'; + // TODO(crbug.com/1093185): Implement DeepLinkingBehavior and override methods // to show the actions for search result. /** @@ -79,13 +81,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kCellularRenameESimNetwork, - chromeos.settings.mojom.Setting.kCellularRemoveESimNetwork, + Setting.kCellularRenameESimNetwork, + Setting.kCellularRemoveESimNetwork, ]), }, }; @@ -93,7 +95,7 @@ /** * Overridden from DeepLinkingBehavior. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {boolean} */ beforeDeepLinkAttempt(settingId) { @@ -105,8 +107,7 @@ // Wait for menu to open. afterNextRender(this, () => { let element; - if (settingId === - chromeos.settings.mojom.Setting.kCellularRenameESimNetwork) { + if (settingId === Setting.kCellularRenameESimNetwork) { element = this.shadowRoot.querySelector('#renameBtn'); } else { element = this.shadowRoot.querySelector('#removeBtn');
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/internet_detail_page.js b/chrome/browser/resources/settings/chromeos/internet_page/internet_detail_page.js index 1a135de..5e93de2 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/internet_detail_page.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/internet_detail_page.js
@@ -44,6 +44,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {afterNextRender, flush, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {SyncBrowserProxyImpl} from '../../people_page/sync_browser_proxy.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; @@ -329,34 +330,34 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kConfigureEthernet, - chromeos.settings.mojom.Setting.kEthernetAutoConfigureIp, - chromeos.settings.mojom.Setting.kEthernetDns, - chromeos.settings.mojom.Setting.kEthernetProxy, - chromeos.settings.mojom.Setting.kDisconnectWifiNetwork, - chromeos.settings.mojom.Setting.kPreferWifiNetwork, - chromeos.settings.mojom.Setting.kForgetWifiNetwork, - chromeos.settings.mojom.Setting.kWifiAutoConfigureIp, - chromeos.settings.mojom.Setting.kWifiDns, - chromeos.settings.mojom.Setting.kWifiHidden, - chromeos.settings.mojom.Setting.kWifiProxy, - chromeos.settings.mojom.Setting.kWifiAutoConnectToNetwork, - chromeos.settings.mojom.Setting.kCellularSimLock, - chromeos.settings.mojom.Setting.kCellularRoaming, - chromeos.settings.mojom.Setting.kCellularApn, - chromeos.settings.mojom.Setting.kDisconnectCellularNetwork, - chromeos.settings.mojom.Setting.kCellularAutoConfigureIp, - chromeos.settings.mojom.Setting.kCellularDns, - chromeos.settings.mojom.Setting.kCellularProxy, - chromeos.settings.mojom.Setting.kCellularAutoConnectToNetwork, - chromeos.settings.mojom.Setting.kDisconnectTetherNetwork, - chromeos.settings.mojom.Setting.kWifiMetered, - chromeos.settings.mojom.Setting.kCellularMetered, + Setting.kConfigureEthernet, + Setting.kEthernetAutoConfigureIp, + Setting.kEthernetDns, + Setting.kEthernetProxy, + Setting.kDisconnectWifiNetwork, + Setting.kPreferWifiNetwork, + Setting.kForgetWifiNetwork, + Setting.kWifiAutoConfigureIp, + Setting.kWifiDns, + Setting.kWifiHidden, + Setting.kWifiProxy, + Setting.kWifiAutoConnectToNetwork, + Setting.kCellularSimLock, + Setting.kCellularRoaming, + Setting.kCellularApn, + Setting.kDisconnectCellularNetwork, + Setting.kCellularAutoConfigureIp, + Setting.kCellularDns, + Setting.kCellularProxy, + Setting.kCellularAutoConnectToNetwork, + Setting.kDisconnectTetherNetwork, + Setting.kWifiMetered, + Setting.kCellularMetered, ]), }, }; @@ -450,7 +451,7 @@ /** * Helper function for manually showing deep links on this page. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @param {!function():?Element} elementCallback * @private */ @@ -468,12 +469,12 @@ /** * Overridden from DeepLinkingBehavior. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {boolean} */ beforeDeepLinkAttempt(settingId) { // Manually show the deep links for settings in shared elements. - if (settingId === chromeos.settings.mojom.Setting.kCellularRoaming) { + if (settingId === Setting.kCellularRoaming) { this.afterRenderShowDeepLink( settingId, () => this.shadowRoot.querySelector('cellular-roaming-toggle-button') @@ -482,7 +483,7 @@ return false; } - if (settingId === chromeos.settings.mojom.Setting.kCellularApn) { + if (settingId === Setting.kCellularApn) { this.networkExpanded_ = true; this.afterRenderShowDeepLink( settingId, @@ -491,11 +492,9 @@ return false; } - if (settingId === - chromeos.settings.mojom.Setting.kEthernetAutoConfigureIp || - settingId === chromeos.settings.mojom.Setting.kWifiAutoConfigureIp || - settingId === - chromeos.settings.mojom.Setting.kCellularAutoConfigureIp) { + if (settingId === Setting.kEthernetAutoConfigureIp || + settingId === Setting.kWifiAutoConfigureIp || + settingId === Setting.kCellularAutoConfigureIp) { this.networkExpanded_ = true; this.afterRenderShowDeepLink( settingId, @@ -504,9 +503,8 @@ return false; } - if (settingId === chromeos.settings.mojom.Setting.kEthernetDns || - settingId === chromeos.settings.mojom.Setting.kWifiDns || - settingId === chromeos.settings.mojom.Setting.kCellularDns) { + if (settingId === Setting.kEthernetDns || settingId === Setting.kWifiDns || + settingId === Setting.kCellularDns) { this.networkExpanded_ = true; this.afterRenderShowDeepLink( settingId, @@ -515,9 +513,9 @@ return false; } - if (settingId === chromeos.settings.mojom.Setting.kEthernetProxy || - settingId === chromeos.settings.mojom.Setting.kWifiProxy || - settingId === chromeos.settings.mojom.Setting.kCellularProxy) { + if (settingId === Setting.kEthernetProxy || + settingId === Setting.kWifiProxy || + settingId === Setting.kCellularProxy) { this.proxyExpanded_ = true; this.afterRenderShowDeepLink( settingId, @@ -526,14 +524,14 @@ return false; } - if (settingId === chromeos.settings.mojom.Setting.kWifiMetered || - settingId === chromeos.settings.mojom.Setting.kCellularMetered) { + if (settingId === Setting.kWifiMetered || + settingId === Setting.kCellularMetered) { this.advancedExpanded_ = true; // Continue with automatically showing these deep links. return true; } - if (settingId === chromeos.settings.mojom.Setting.kForgetWifiNetwork) { + if (settingId === Setting.kForgetWifiNetwork) { this.afterRenderShowDeepLink(settingId, () => { const forgetButton = this.shadowRoot.querySelector('#forgetButton'); if (forgetButton && !forgetButton.hidden) { @@ -545,7 +543,7 @@ return false; } - if (settingId === chromeos.settings.mojom.Setting.kCellularSimLock) { + if (settingId === Setting.kCellularSimLock) { this.advancedExpanded_ = true; // If the page just loaded, deviceState_ will not be fully initialized @@ -816,7 +814,7 @@ /** @private */ deepLinkToSimLockElement_() { - const settingId = chromeos.settings.mojom.Setting.kCellularSimLock; + const settingId = Setting.kCellularSimLock; const simLockStatus = this.deviceState_.simLockStatus; // In this rare case, element not focusable until after a second wait.
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/internet_known_networks_page.js b/chrome/browser/resources/settings/chromeos/internet_page/internet_known_networks_page.js index 6392ee1c..48e41ee2 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/internet_known_networks_page.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/internet_known_networks_page.js
@@ -22,6 +22,7 @@ import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -94,7 +95,7 @@ /** * Contains the settingId of any deep link that wasn't able to be shown, * null otherwise. - * @private {?chromeos.settings.mojom.Setting} + * @private {?Setting} */ pendingSettingId_: { type: Number, @@ -103,13 +104,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kPreferWifiNetwork, - chromeos.settings.mojom.Setting.kForgetWifiNetwork, + Setting.kPreferWifiNetwork, + Setting.kForgetWifiNetwork, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/internet_page.js b/chrome/browser/resources/settings/chromeos/internet_page/internet_page.js index 928d1b1c..7e069f9 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/internet_page.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/internet_page.js
@@ -42,6 +42,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {afterNextRender, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -260,13 +261,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kWifiOnOff, - chromeos.settings.mojom.Setting.kMobileOnOff, + Setting.kWifiOnOff, + Setting.kMobileOnOff, ]), }, @@ -377,15 +378,15 @@ /** * Overridden from DeepLinkingBehavior. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {boolean} */ beforeDeepLinkAttempt(settingId) { // Manually show the deep links for settings nested within elements. let networkType = null; - if (settingId === chromeos.settings.mojom.Setting.kWifiOnOff) { + if (settingId === Setting.kWifiOnOff) { networkType = mojom.NetworkType.kWiFi; - } else if (settingId === chromeos.settings.mojom.Setting.kMobileOnOff) { + } else if (settingId === Setting.kMobileOnOff) { networkType = mojom.NetworkType.kCellular; }
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/internet_subpage.js b/chrome/browser/resources/settings/chromeos/internet_page/internet_subpage.js index 68681d2..ca0dfa2 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/internet_subpage.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/internet_subpage.js
@@ -31,6 +31,7 @@ import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js'; import {afterNextRender, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -213,7 +214,7 @@ /** * Contains the settingId of any deep link that wasn't able to be shown, * null otherwise. - * @private {?chromeos.settings.mojom.Setting} + * @private {?Setting} */ pendingSettingId_: { type: Number, @@ -222,16 +223,16 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kWifiOnOff, - chromeos.settings.mojom.Setting.kWifiAddNetwork, - chromeos.settings.mojom.Setting.kMobileOnOff, - chromeos.settings.mojom.Setting.kInstantTetheringOnOff, - chromeos.settings.mojom.Setting.kAddESimNetwork, + Setting.kWifiOnOff, + Setting.kWifiAddNetwork, + Setting.kMobileOnOff, + Setting.kInstantTetheringOnOff, + Setting.kAddESimNetwork, ]), }, }; @@ -285,11 +286,11 @@ /** * Overridden from DeepLinkingBehavior. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {boolean} */ beforeDeepLinkAttempt(settingId) { - if (settingId === chromeos.settings.mojom.Setting.kAddESimNetwork) { + if (settingId === Setting.kAddESimNetwork) { afterNextRender(this, () => { const deepLinkElement = this.shadowRoot.querySelector('cellular-networks-list') @@ -303,7 +304,7 @@ return false; } - if (settingId === chromeos.settings.mojom.Setting.kInstantTetheringOnOff) { + if (settingId === Setting.kInstantTetheringOnOff) { // Wait for element to load. afterNextRender(this, () => { // If both Cellular and Instant Tethering are enabled, we show a special
diff --git a/chrome/browser/resources/settings/chromeos/kerberos_page/kerberos_accounts.js b/chrome/browser/resources/settings/chromeos/kerberos_page/kerberos_accounts.js index 2c074ae..3e0f66f1 100644 --- a/chrome/browser/resources/settings/chromeos/kerberos_page/kerberos_accounts.js +++ b/chrome/browser/resources/settings/chromeos/kerberos_page/kerberos_accounts.js
@@ -24,6 +24,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -106,14 +107,14 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kAddKerberosTicketV2, - chromeos.settings.mojom.Setting.kRemoveKerberosTicketV2, - chromeos.settings.mojom.Setting.kSetActiveKerberosTicketV2, + Setting.kAddKerberosTicketV2, + Setting.kRemoveKerberosTicketV2, + Setting.kSetActiveKerberosTicketV2, ]), },
diff --git a/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_page.js b/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_page.js index 04447a1..d634ce0 100644 --- a/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_page.js +++ b/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_page.js
@@ -24,6 +24,7 @@ import {beforeNextRender, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {NearbyShareSettingsBehavior, NearbyShareSettingsBehaviorInterface} from '../../shared/nearby_share_settings_behavior.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; @@ -154,15 +155,15 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kSetUpMultiDevice, - chromeos.settings.mojom.Setting.kVerifyMultiDeviceSetup, - chromeos.settings.mojom.Setting.kMultiDeviceOnOff, - chromeos.settings.mojom.Setting.kNearbyShareOnOff, + Setting.kSetUpMultiDevice, + Setting.kVerifyMultiDeviceSetup, + Setting.kMultiDeviceOnOff, + Setting.kNearbyShareOnOff, ]), },
diff --git a/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_smartlock_subpage.js b/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_smartlock_subpage.js index e83ac7f..456d621 100644 --- a/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_smartlock_subpage.js +++ b/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_smartlock_subpage.js
@@ -11,6 +11,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -101,13 +102,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kSmartLockOnOff, - chromeos.settings.mojom.Setting.kSmartLockUnlockOrSignIn, + Setting.kSmartLockOnOff, + Setting.kSmartLockUnlockOrSignIn, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_subpage.js b/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_subpage.js index 62ec947f..f4f4023 100644 --- a/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_subpage.js +++ b/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_subpage.js
@@ -24,6 +24,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -73,23 +74,23 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kInstantTetheringOnOff, - chromeos.settings.mojom.Setting.kMultiDeviceOnOff, - chromeos.settings.mojom.Setting.kSmartLockOnOff, - chromeos.settings.mojom.Setting.kMessagesSetUp, - chromeos.settings.mojom.Setting.kMessagesOnOff, - chromeos.settings.mojom.Setting.kForgetPhone, - chromeos.settings.mojom.Setting.kPhoneHubOnOff, - chromeos.settings.mojom.Setting.kPhoneHubCameraRollOnOff, - chromeos.settings.mojom.Setting.kPhoneHubNotificationsOnOff, - chromeos.settings.mojom.Setting.kPhoneHubTaskContinuationOnOff, - chromeos.settings.mojom.Setting.kWifiSyncOnOff, - chromeos.settings.mojom.Setting.kPhoneHubAppsOnOff, + Setting.kInstantTetheringOnOff, + Setting.kMultiDeviceOnOff, + Setting.kSmartLockOnOff, + Setting.kMessagesSetUp, + Setting.kMessagesOnOff, + Setting.kForgetPhone, + Setting.kPhoneHubOnOff, + Setting.kPhoneHubCameraRollOnOff, + Setting.kPhoneHubNotificationsOnOff, + Setting.kPhoneHubTaskContinuationOnOff, + Setting.kWifiSyncOnOff, + Setting.kPhoneHubAppsOnOff, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_subpage.js b/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_subpage.js index 62390be..f8a1cf5 100644 --- a/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_subpage.js +++ b/chrome/browser/resources/settings/chromeos/nearby_share_page/nearby_share_subpage.js
@@ -22,6 +22,7 @@ import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js'; import {flush, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {getContactManager} from '../../shared/nearby_contact_manager.js'; import {NearbySettings} from '../../shared/nearby_share_settings_behavior.js'; @@ -132,18 +133,17 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kNearbyShareOnOff, - chromeos.settings.mojom.Setting.kNearbyShareDeviceName, - chromeos.settings.mojom.Setting.kNearbyShareDeviceVisibility, - chromeos.settings.mojom.Setting.kNearbyShareContacts, - chromeos.settings.mojom.Setting.kNearbyShareDataUsage, - chromeos.settings.mojom.Setting - .kDevicesNearbyAreSharingNotificationOnOff, + Setting.kNearbyShareOnOff, + Setting.kNearbyShareDeviceName, + Setting.kNearbyShareDeviceVisibility, + Setting.kNearbyShareContacts, + Setting.kNearbyShareDataUsage, + Setting.kDevicesNearbyAreSharingNotificationOnOff, ]), },
diff --git a/chrome/browser/resources/settings/chromeos/os_a11y_page/manage_a11y_page.js b/chrome/browser/resources/settings/chromeos/os_a11y_page/manage_a11y_page.js index 8a20d72..c8c8888 100644 --- a/chrome/browser/resources/settings/chromeos/os_a11y_page/manage_a11y_page.js +++ b/chrome/browser/resources/settings/chromeos/os_a11y_page/manage_a11y_page.js
@@ -22,6 +22,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {BatteryStatus, DevicePageBrowserProxy, DevicePageBrowserProxyImpl, ExternalStorage, getDisplayApi, IdleBehavior, LidClosedBehavior, NoteAppInfo, NoteAppLockScreenSupport, PowerManagementSettings, PowerSource, StorageSpaceState} from '../device_page/device_page_browser_proxy.js'; @@ -376,32 +377,31 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kChromeVox, - chromeos.settings.mojom.Setting.kSelectToSpeak, - chromeos.settings.mojom.Setting.kHighContrastMode, - chromeos.settings.mojom.Setting.kFullscreenMagnifier, - chromeos.settings.mojom.Setting - .kFullscreenMagnifierMouseFollowingMode, - chromeos.settings.mojom.Setting.kFullscreenMagnifierFocusFollowing, - chromeos.settings.mojom.Setting.kDockedMagnifier, - chromeos.settings.mojom.Setting.kStickyKeys, - chromeos.settings.mojom.Setting.kOnScreenKeyboard, - chromeos.settings.mojom.Setting.kDictation, - chromeos.settings.mojom.Setting.kHighlightKeyboardFocus, - chromeos.settings.mojom.Setting.kHighlightTextCaret, - chromeos.settings.mojom.Setting.kAutoClickWhenCursorStops, - chromeos.settings.mojom.Setting.kLargeCursor, - chromeos.settings.mojom.Setting.kHighlightCursorWhileMoving, - chromeos.settings.mojom.Setting.kTabletNavigationButtons, - chromeos.settings.mojom.Setting.kMonoAudio, - chromeos.settings.mojom.Setting.kStartupSound, - chromeos.settings.mojom.Setting.kEnableSwitchAccess, - chromeos.settings.mojom.Setting.kEnableCursorColor, + Setting.kChromeVox, + Setting.kSelectToSpeak, + Setting.kHighContrastMode, + Setting.kFullscreenMagnifier, + Setting.kFullscreenMagnifierMouseFollowingMode, + Setting.kFullscreenMagnifierFocusFollowing, + Setting.kDockedMagnifier, + Setting.kStickyKeys, + Setting.kOnScreenKeyboard, + Setting.kDictation, + Setting.kHighlightKeyboardFocus, + Setting.kHighlightTextCaret, + Setting.kAutoClickWhenCursorStops, + Setting.kLargeCursor, + Setting.kHighlightCursorWhileMoving, + Setting.kTabletNavigationButtons, + Setting.kMonoAudio, + Setting.kStartupSound, + Setting.kEnableSwitchAccess, + Setting.kEnableCursorColor, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/os_a11y_page/os_a11y_page.js b/chrome/browser/resources/settings/chromeos/os_a11y_page/os_a11y_page.js index 852f8435..3363546 100644 --- a/chrome/browser/resources/settings/chromeos/os_a11y_page/os_a11y_page.js +++ b/chrome/browser/resources/settings/chromeos/os_a11y_page/os_a11y_page.js
@@ -22,6 +22,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {afterNextRender, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -122,14 +123,14 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kA11yQuickSettings, - chromeos.settings.mojom.Setting.kGetImageDescriptionsFromGoogle, - chromeos.settings.mojom.Setting.kLiveCaption, + Setting.kA11yQuickSettings, + Setting.kGetImageDescriptionsFromGoogle, + Setting.kLiveCaption, ]), }, }; @@ -157,11 +158,11 @@ /** * Overridden from DeepLinkingBehavior. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {boolean} */ beforeDeepLinkAttempt(settingId) { - if (settingId === chromeos.settings.mojom.Setting.kLiveCaption) { + if (settingId === Setting.kLiveCaption) { afterNextRender(this, () => { const captionsSubpage = /** @type {?SettingsCaptionsElement} */ ( this.shadowRoot.querySelector('settings-captions'));
diff --git a/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_subpage.js b/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_subpage.js index ab429d00e..2166fda 100644 --- a/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_subpage.js +++ b/chrome/browser/resources/settings/chromeos/os_a11y_page/switch_access_subpage.js
@@ -20,6 +20,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -180,14 +181,14 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kSwitchActionAssignment, - chromeos.settings.mojom.Setting.kSwitchActionAutoScan, - chromeos.settings.mojom.Setting.kSwitchActionAutoScanKeyboard, + Setting.kSwitchActionAssignment, + Setting.kSwitchActionAutoScan, + Setting.kSwitchActionAutoScanKeyboard, ]), },
diff --git a/chrome/browser/resources/settings/chromeos/os_a11y_page/text_to_speech_page.js b/chrome/browser/resources/settings/chromeos/os_a11y_page/text_to_speech_page.js index 255b9ec..43283db 100644 --- a/chrome/browser/resources/settings/chromeos/os_a11y_page/text_to_speech_page.js +++ b/chrome/browser/resources/settings/chromeos/os_a11y_page/text_to_speech_page.js
@@ -16,6 +16,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {DevicePageBrowserProxy, DevicePageBrowserProxyImpl} from '../device_page/device_page_browser_proxy.js'; @@ -72,13 +73,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kChromeVox, - chromeos.settings.mojom.Setting.kSelectToSpeak, + Setting.kChromeVox, + Setting.kSelectToSpeak, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/os_a11y_page/tts_subpage.js b/chrome/browser/resources/settings/chromeos/os_a11y_page/tts_subpage.js index a02ca5b..d4dc798 100644 --- a/chrome/browser/resources/settings/chromeos/os_a11y_page/tts_subpage.js +++ b/chrome/browser/resources/settings/chromeos/os_a11y_page/tts_subpage.js
@@ -19,6 +19,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {LanguagesBrowserProxy, LanguagesBrowserProxyImpl} from '../os_languages_page/languages_browser_proxy.js'; @@ -119,16 +120,16 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kTextToSpeechRate, - chromeos.settings.mojom.Setting.kTextToSpeechPitch, - chromeos.settings.mojom.Setting.kTextToSpeechVolume, - chromeos.settings.mojom.Setting.kTextToSpeechVoice, - chromeos.settings.mojom.Setting.kTextToSpeechEngines, + Setting.kTextToSpeechRate, + Setting.kTextToSpeechPitch, + Setting.kTextToSpeechVolume, + Setting.kTextToSpeechVoice, + Setting.kTextToSpeechEngines, ]), }, }; @@ -400,13 +401,13 @@ return; } const allCodes = new Set( - Object.keys(this.prefs.settings['tts']['lang_to_voice_name'].value)); + Object.keys(this.prefs['settings']['tts']['lang_to_voice_name'].value)); for (const code in langToVoices) { // Remove from allCodes, to track what we've found a default for. allCodes.delete(code); const voices = langToVoices[code].voices; const defaultVoiceForLang = - this.prefs.settings['tts']['lang_to_voice_name'].value[code]; + this.prefs['settings']['tts']['lang_to_voice_name'].value[code]; if (!defaultVoiceForLang || defaultVoiceForLang === '') { // Initialize prefs that have no value this.set( @@ -463,7 +464,7 @@ const code = languageCodeMap[prospectiveUILanguage]; // First try the pref value. result = - this.prefs.settings['tts']['lang_to_voice_name'].value[code]; + this.prefs['settings']['tts']['lang_to_voice_name'].value[code]; } if (!result) { // If it's not a pref value yet, or the prospectiveUILanguage was
diff --git a/chrome/browser/resources/settings/chromeos/os_about_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_about_page/BUILD.gn index 4dfb886..cb0ddd7 100644 --- a/chrome/browser/resources/settings/chromeos/os_about_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_about_page/BUILD.gn
@@ -99,6 +99,10 @@ "../..:lifetime_browser_proxy", "../..:router", "../os_settings_page:main_page_behavior", + + # TODO(crbug.com/1179821) Remove this dependency when os_about_page + # no longer uses the global namespace "chromeos.settings.mojom" + "//chrome/browser/ui/webui/settings/chromeos/constants:mojom_js_library_for_compile", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data.m",
diff --git a/chrome/browser/resources/settings/chromeos/os_about_page/detailed_build_info.js b/chrome/browser/resources/settings/chromeos/os_about_page/detailed_build_info.js index 85c8afdd..62b86f94 100644 --- a/chrome/browser/resources/settings/chromeos/os_about_page/detailed_build_info.js +++ b/chrome/browser/resources/settings/chromeos/os_about_page/detailed_build_info.js
@@ -25,6 +25,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -105,14 +106,14 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kChangeChromeChannel, - chromeos.settings.mojom.Setting.kChangeDeviceName, - chromeos.settings.mojom.Setting.kCopyDetailedBuildInfo, + Setting.kChangeChromeChannel, + Setting.kChangeDeviceName, + Setting.kCopyDetailedBuildInfo, ]), },
diff --git a/chrome/browser/resources/settings/chromeos/os_about_page/os_about_page.js b/chrome/browser/resources/settings/chromeos/os_about_page/os_about_page.js index 196903e..dd9ffde 100644 --- a/chrome/browser/resources/settings/chromeos/os_about_page/os_about_page.js +++ b/chrome/browser/resources/settings/chromeos/os_about_page/os_about_page.js
@@ -25,6 +25,7 @@ import 'chrome://resources/cr_elements/icons.m.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import 'chrome://resources/polymer/v3_0/iron-media-query/iron-media-query.js'; +import '../../constants/setting.mojom-lite.js'; import {assert} from 'chrome://resources/js/assert.m.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js'; @@ -34,6 +35,7 @@ import {loadTimeData} from '../../i18n_setup.js'; import {LifetimeBrowserProxyImpl} from '../../lifetime_browser_proxy.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -245,18 +247,18 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kCheckForOsUpdate, - chromeos.settings.mojom.Setting.kSeeWhatsNew, - chromeos.settings.mojom.Setting.kGetHelpWithChromeOs, - chromeos.settings.mojom.Setting.kReportAnIssue, - chromeos.settings.mojom.Setting.kTermsOfService, - chromeos.settings.mojom.Setting.kDiagnostics, - chromeos.settings.mojom.Setting.kFirmwareUpdates, + Setting.kCheckForOsUpdate, + Setting.kSeeWhatsNew, + Setting.kGetHelpWithChromeOs, + Setting.kReportAnIssue, + Setting.kTermsOfService, + Setting.kDiagnostics, + Setting.kFirmwareUpdates, ]), }, }; @@ -342,9 +344,7 @@ if (!result.deepLinkShown && result.pendingSettingId) { // Only the check for OS update is expected to fail deep link when // awaiting the check for update. - assert( - result.pendingSettingId === - chromeos.settings.mojom.Setting.kCheckForOsUpdate); + assert(result.pendingSettingId === Setting.kCheckForOsUpdate); this.isPendingOsUpdateDeepLink_ = true; } }); @@ -458,12 +458,11 @@ return; } - this.showDeepLink(chromeos.settings.mojom.Setting.kCheckForOsUpdate) - .then(result => { - if (result.deepLinkShown) { - this.isPendingOsUpdateDeepLink_ = false; - } - }); + this.showDeepLink(Setting.kCheckForOsUpdate).then(result => { + if (result.deepLinkShown) { + this.isPendingOsUpdateDeepLink_ = false; + } + }); } /** @private */
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/android_apps_subpage.js b/chrome/browser/resources/settings/chromeos/os_apps_page/android_apps_subpage.js index f7a3f51..08ccc72 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/android_apps_subpage.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/android_apps_subpage.js
@@ -17,6 +17,7 @@ import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -80,13 +81,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kManageAndroidPreferences, - chromeos.settings.mojom.Setting.kRemovePlayStore, + Setting.kManageAndroidPreferences, + Setting.kRemovePlayStore, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_notifications_page/app_notifications_subpage.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_notifications_page/app_notifications_subpage.js index cbaf3cf..2a0f1d7 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_notifications_page/app_notifications_subpage.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_notifications_page/app_notifications_subpage.js
@@ -16,6 +16,7 @@ import {assert} from 'chrome://resources/js/assert.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../../deep_linking_behavior.js'; import {recordSettingChange} from '../../metrics_recorder.js'; @@ -75,12 +76,12 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kDoNotDisturbOnOff, + Setting.kDoNotDisturbOnOff, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/os_apps_page.js b/chrome/browser/resources/settings/chromeos/os_apps_page/os_apps_page.js index 71e3587b..682371be 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/os_apps_page.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/os_apps_page.js
@@ -32,6 +32,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -208,14 +209,14 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kManageAndroidPreferences, - chromeos.settings.mojom.Setting.kTurnOnPlayStore, - chromeos.settings.mojom.Setting.kRestoreAppsAndPages, + Setting.kManageAndroidPreferences, + Setting.kTurnOnPlayStore, + Setting.kRestoreAppsAndPages, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_devices_subpage.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_devices_subpage.js index a1bfffbc..c30b9d6e 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_devices_subpage.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_devices_subpage.js
@@ -20,6 +20,7 @@ import {BluetoothSystemProperties, BluetoothSystemState, DeviceConnectionState, PairedBluetoothDeviceProperties} from 'chrome://resources/mojo/chromeos/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom-webui.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -71,14 +72,11 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, - value: () => new Set([ - chromeos.settings.mojom.Setting.kBluetoothOnOff, - chromeos.settings.mojom.Setting.kFastPairOnOff - ]), + value: () => new Set([Setting.kBluetoothOnOff, Setting.kFastPairOnOff]), }, /**
diff --git a/chrome/browser/resources/settings/chromeos/os_files_page/os_files_page.js b/chrome/browser/resources/settings/chromeos/os_files_page/os_files_page.js index f4fa8e5..ede08c8 100644 --- a/chrome/browser/resources/settings/chromeos/os_files_page/os_files_page.js +++ b/chrome/browser/resources/settings/chromeos/os_files_page/os_files_page.js
@@ -15,6 +15,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -63,12 +64,11 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, - value: () => - new Set([chromeos.settings.mojom.Setting.kGoogleDriveConnection]), + value: () => new Set([Setting.kGoogleDriveConnection]), }, }; }
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.js b/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.js index 1658df6a..332ff0a 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.js
@@ -26,6 +26,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -108,14 +109,14 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kShowInputOptionsInShelf, - chromeos.settings.mojom.Setting.kAddInputMethod, - chromeos.settings.mojom.Setting.kSpellCheck, + Setting.kShowInputOptionsInShelf, + Setting.kAddInputMethod, + Setting.kSpellCheck, ]), },
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/os_languages_page_v2.js b/chrome/browser/resources/settings/chromeos/os_languages_page/os_languages_page_v2.js index 1ad1590..924ce6d 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/os_languages_page_v2.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/os_languages_page_v2.js
@@ -28,6 +28,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -132,14 +133,14 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kAddLanguage, - chromeos.settings.mojom.Setting.kChangeDeviceLanguage, - chromeos.settings.mojom.Setting.kOfferTranslation, + Setting.kAddLanguage, + Setting.kChangeDeviceLanguage, + Setting.kOfferTranslation, ]), },
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/smart_inputs_page.js b/chrome/browser/resources/settings/chromeos/os_languages_page/smart_inputs_page.js index 9704d96..a2fd91c 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/smart_inputs_page.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/smart_inputs_page.js
@@ -15,6 +15,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -70,13 +71,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kShowPersonalInformationSuggestions, - chromeos.settings.mojom.Setting.kShowEmojiSuggestions, + Setting.kShowPersonalInformationSuggestions, + Setting.kShowEmojiSuggestions, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/account_manager.js b/chrome/browser/resources/settings/chromeos/os_people_page/account_manager.js index 5d33a43..80fe737 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/account_manager.js +++ b/chrome/browser/resources/settings/chromeos/os_people_page/account_manager.js
@@ -23,6 +23,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -128,13 +129,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kAddAccount, - chromeos.settings.mojom.Setting.kRemoveAccount, + Setting.kAddAccount, + Setting.kRemoveAccount, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/fingerprint_list.js b/chrome/browser/resources/settings/chromeos/os_people_page/fingerprint_list.js index c7215ca..bcbd442 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/fingerprint_list.js +++ b/chrome/browser/resources/settings/chromeos/os_people_page/fingerprint_list.js
@@ -20,6 +20,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -100,13 +101,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kAddFingerprintV2, - chromeos.settings.mojom.Setting.kRemoveFingerprintV2, + Setting.kAddFingerprintV2, + Setting.kRemoveFingerprintV2, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/lock_screen.js b/chrome/browser/resources/settings/chromeos/os_people_page/lock_screen.js index 771ae24..c4508cd 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/lock_screen.js +++ b/chrome/browser/resources/settings/chromeos/os_people_page/lock_screen.js
@@ -36,6 +36,7 @@ import {afterNextRender, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -214,13 +215,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kLockScreenV2, - chromeos.settings.mojom.Setting.kChangeAuthPinV2, + Setting.kLockScreenV2, + Setting.kChangeAuthPinV2, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/os_people_page.js b/chrome/browser/resources/settings/chromeos/os_people_page/os_people_page.js index f1c7e43..d96cf9b7 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/os_people_page.js +++ b/chrome/browser/resources/settings/chromeos/os_people_page/os_people_page.js
@@ -36,6 +36,7 @@ import {afterNextRender, flush, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {ProfileInfoBrowserProxyImpl} from '../../people_page/profile_info_browser_proxy.js'; import {SyncBrowserProxyImpl} from '../../people_page/sync_browser_proxy.js'; import {Route, Router} from '../../router.js'; @@ -216,18 +217,18 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kSetUpParentalControls, + Setting.kSetUpParentalControls, // Perform Sync page deep links here since it's a shared page. - chromeos.settings.mojom.Setting.kNonSplitSyncEncryptionOptions, - chromeos.settings.mojom.Setting.kAutocompleteSearchesAndUrls, - chromeos.settings.mojom.Setting.kMakeSearchesAndBrowsingBetter, - chromeos.settings.mojom.Setting.kGoogleDriveSearchSuggestions, + Setting.kNonSplitSyncEncryptionOptions, + Setting.kAutocompleteSearchesAndUrls, + Setting.kMakeSearchesAndBrowsingBetter, + Setting.kGoogleDriveSearchSuggestions, ]), }, @@ -292,7 +293,7 @@ /** * Helper function for manually showing deep links on this page. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @param {!function():?Element} getElementCallback * @private */ @@ -310,13 +311,13 @@ /** * Overridden from DeepLinkingBehavior. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {boolean} */ beforeDeepLinkAttempt(settingId) { switch (settingId) { // Manually show the deep links for settings nested within elements. - case chromeos.settings.mojom.Setting.kSetUpParentalControls: + case Setting.kSetUpParentalControls: this.afterRenderShowDeepLink_(settingId, () => { const parentalPage = /** @type {?SettingsParentalControlsPageElement} */ ( @@ -329,7 +330,7 @@ // Handle the settings within the old sync page since its a shared // component. - case chromeos.settings.mojom.Setting.kNonSplitSyncEncryptionOptions: + case Setting.kNonSplitSyncEncryptionOptions: this.afterRenderShowDeepLink_(settingId, () => { const syncPage = /** @type {?SettingsSyncPageElement} */ ( this.shadowRoot.querySelector('settings-sync-page')); @@ -341,7 +342,7 @@ }); return false; - case chromeos.settings.mojom.Setting.kAutocompleteSearchesAndUrls: + case Setting.kAutocompleteSearchesAndUrls: this.afterRenderShowDeepLink_(settingId, () => { const syncPage = /** @type {?SettingsSyncPageElement} */ ( this.shadowRoot.querySelector('settings-sync-page')); @@ -350,7 +351,7 @@ }); return false; - case chromeos.settings.mojom.Setting.kMakeSearchesAndBrowsingBetter: + case Setting.kMakeSearchesAndBrowsingBetter: this.afterRenderShowDeepLink_(settingId, () => { const syncPage = /** @type {?SettingsSyncPageElement} */ ( this.shadowRoot.querySelector('settings-sync-page')); @@ -359,7 +360,7 @@ }); return false; - case chromeos.settings.mojom.Setting.kGoogleDriveSearchSuggestions: + case Setting.kGoogleDriveSearchSuggestions: this.afterRenderShowDeepLink_(settingId, () => { const syncPage = /** @type {?SettingsSyncPageElement} */ ( this.shadowRoot.querySelector('settings-sync-page'));
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_controls.js b/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_controls.js index 970665c..6772529 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_controls.js +++ b/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_controls.js
@@ -13,6 +13,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -102,11 +103,11 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, - value: () => new Set([chromeos.settings.mojom.Setting.kSplitSyncOnOff]), + value: () => new Set([Setting.kSplitSyncOnOff]), }, }; }
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/users_page.js b/chrome/browser/resources/settings/chromeos/os_people_page/users_page.js index debcfc04..2b3b7224 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/users_page.js +++ b/chrome/browser/resources/settings/chromeos/os_people_page/users_page.js
@@ -21,6 +21,7 @@ import {afterNextRender, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -77,16 +78,16 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kGuestBrowsingV2, - chromeos.settings.mojom.Setting.kShowUsernamesAndPhotosAtSignInV2, - chromeos.settings.mojom.Setting.kRestrictSignInV2, - chromeos.settings.mojom.Setting.kAddToUserAllowlistV2, - chromeos.settings.mojom.Setting.kRemoveFromUserAllowlistV2, + Setting.kGuestBrowsingV2, + Setting.kShowUsernamesAndPhotosAtSignInV2, + Setting.kRestrictSignInV2, + Setting.kAddToUserAllowlistV2, + Setting.kRemoveFromUserAllowlistV2, ]), }, }; @@ -114,12 +115,11 @@ /** * Overridden from DeepLinkingBehavior. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {boolean} */ beforeDeepLinkAttempt(settingId) { - if (settingId !== - chromeos.settings.mojom.Setting.kRemoveFromUserAllowlistV2) { + if (settingId !== Setting.kRemoveFromUserAllowlistV2) { // Continue with deep linking attempt. return true; }
diff --git a/chrome/browser/resources/settings/chromeos/os_printing_page/cups_printers.js b/chrome/browser/resources/settings/chromeos/os_printing_page/cups_printers.js index 43318004..cee8afe 100644 --- a/chrome/browser/resources/settings/chromeos/os_printing_page/cups_printers.js +++ b/chrome/browser/resources/settings/chromeos/os_printing_page/cups_printers.js
@@ -36,6 +36,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {afterNextRender, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -176,13 +177,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kAddPrinter, - chromeos.settings.mojom.Setting.kSavedPrinters, + Setting.kAddPrinter, + Setting.kSavedPrinters, ]), }, }; @@ -250,12 +251,12 @@ /** * Overridden from DeepLinkingBehavior. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {boolean} */ beforeDeepLinkAttempt(settingId) { // Manually show the deep links for settings nested within elements. - if (settingId !== chromeos.settings.mojom.Setting.kSavedPrinters) { + if (settingId !== Setting.kSavedPrinters) { // Continue with deep link attempt. return true; }
diff --git a/chrome/browser/resources/settings/chromeos/os_printing_page/os_printing_page.js b/chrome/browser/resources/settings/chromeos/os_printing_page/os_printing_page.js index 143e0f00..0d9fcbd 100644 --- a/chrome/browser/resources/settings/chromeos/os_printing_page/os_printing_page.js +++ b/chrome/browser/resources/settings/chromeos/os_printing_page/os_printing_page.js
@@ -9,6 +9,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; @@ -67,14 +68,11 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, - value: () => new Set([ - chromeos.settings.mojom.Setting.kPrintJobs, - chromeos.settings.mojom.Setting.kScanningApp - ]), + value: () => new Set([Setting.kPrintJobs, Setting.kScanningApp]), }, }; }
diff --git a/chrome/browser/resources/settings/chromeos/os_privacy_page/os_privacy_page.js b/chrome/browser/resources/settings/chromeos/os_privacy_page/os_privacy_page.js index 83f3f3f1..7f54299 100644 --- a/chrome/browser/resources/settings/chromeos/os_privacy_page/os_privacy_page.js +++ b/chrome/browser/resources/settings/chromeos/os_privacy_page/os_privacy_page.js
@@ -24,6 +24,7 @@ import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {afterNextRender, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {LockStateBehavior, LockStateBehaviorInterface} from '../os_people_page/lock_state_behavior.js'; @@ -111,13 +112,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kVerifiedAccess, - chromeos.settings.mojom.Setting.kUsageStatsAndCrashReports, + Setting.kVerifiedAccess, + Setting.kUsageStatsAndCrashReports, ]), }, @@ -272,8 +273,7 @@ this.browserProxy_.isThunderboltSupported().then(enabled => { this.isThunderboltSupported_ = enabled; if (this.isThunderboltSupported_) { - this.supportedSettingIds.add( - chromeos.settings.mojom.Setting.kPeripheralDataAccessProtection); + this.supportedSettingIds.add(Setting.kPeripheralDataAccessProtection); } });
diff --git a/chrome/browser/resources/settings/chromeos/os_privacy_page/privacy_hub_page.js b/chrome/browser/resources/settings/chromeos/os_privacy_page/privacy_hub_page.js index 0821e34e..6db1a1d 100644 --- a/chrome/browser/resources/settings/chromeos/os_privacy_page/privacy_hub_page.js +++ b/chrome/browser/resources/settings/chromeos/os_privacy_page/privacy_hub_page.js
@@ -15,6 +15,7 @@ import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -85,13 +86,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kCameraOnOff, - chromeos.settings.mojom.Setting.kMicrophoneOnOff, + Setting.kCameraOnOff, + Setting.kMicrophoneOnOff, ]), },
diff --git a/chrome/browser/resources/settings/chromeos/os_privacy_page/smart_privacy_page.js b/chrome/browser/resources/settings/chromeos/os_privacy_page/smart_privacy_page.js index 2b45112..2d3773fd 100644 --- a/chrome/browser/resources/settings/chromeos/os_privacy_page/smart_privacy_page.js +++ b/chrome/browser/resources/settings/chromeos/os_privacy_page/smart_privacy_page.js
@@ -19,6 +19,7 @@ import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -89,13 +90,13 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kQuickDim, - chromeos.settings.mojom.Setting.kSnoopingProtection, + Setting.kQuickDim, + Setting.kSnoopingProtection, ]), }, };
diff --git a/chrome/browser/resources/settings/chromeos/os_reset_page/os_reset_page.js b/chrome/browser/resources/settings/chromeos/os_reset_page/os_reset_page.js index 61c32821..209df7c9 100644 --- a/chrome/browser/resources/settings/chromeos/os_reset_page/os_reset_page.js +++ b/chrome/browser/resources/settings/chromeos/os_reset_page/os_reset_page.js
@@ -14,6 +14,7 @@ import {focusWithoutInk} from 'chrome://resources/js/cr/ui/focus_without_ink.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -56,11 +57,11 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, - value: () => new Set([chromeos.settings.mojom.Setting.kPowerwash]), + value: () => new Set([Setting.kPowerwash]), }, }; }
diff --git a/chrome/browser/resources/settings/chromeos/os_search_page/os_search_page.js b/chrome/browser/resources/settings/chromeos/os_search_page/os_search_page.js index 1910173..200ddc8d 100644 --- a/chrome/browser/resources/settings/chromeos/os_search_page/os_search_page.js +++ b/chrome/browser/resources/settings/chromeos/os_search_page/os_search_page.js
@@ -26,6 +26,7 @@ import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -74,12 +75,11 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, - value: () => - new Set([chromeos.settings.mojom.Setting.kPreferredSearchEngine]), + value: () => new Set([Setting.kPreferredSearchEngine]), }, }; }
diff --git a/chrome/browser/resources/settings/chromeos/os_search_page/search_subpage.js b/chrome/browser/resources/settings/chromeos/os_search_page/search_subpage.js index df005c0..e7502dc 100644 --- a/chrome/browser/resources/settings/chromeos/os_search_page/search_subpage.js +++ b/chrome/browser/resources/settings/chromeos/os_search_page/search_subpage.js
@@ -24,6 +24,7 @@ import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -56,16 +57,16 @@ return { /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, value: () => new Set([ - chromeos.settings.mojom.Setting.kPreferredSearchEngine, - chromeos.settings.mojom.Setting.kQuickAnswersOnOff, - chromeos.settings.mojom.Setting.kQuickAnswersDefinition, - chromeos.settings.mojom.Setting.kQuickAnswersTranslation, - chromeos.settings.mojom.Setting.kQuickAnswersUnitConversion, + Setting.kPreferredSearchEngine, + Setting.kQuickAnswersOnOff, + Setting.kQuickAnswersDefinition, + Setting.kQuickAnswersTranslation, + Setting.kQuickAnswersUnitConversion, ]), },
diff --git a/chrome/browser/resources/settings/chromeos/os_settings.gni b/chrome/browser/resources/settings/chromeos/os_settings.gni index e4ef917..8b86821 100644 --- a/chrome/browser/resources/settings/chromeos/os_settings.gni +++ b/chrome/browser/resources/settings/chromeos/os_settings.gni
@@ -20,6 +20,8 @@ "js_module_root=" + rebase_path( "$root_gen_dir/mojom-webui/chrome/browser/ui/webui/settings/chromeos/constants", root_build_dir), + "browser_resolver_prefix_replacements=\"../../../mojom-webui/=../../../\"", + "browser_resolver_prefix_replacements=\"../../mojom-webui/=../../\"", "browser_resolver_prefix_replacements=\"../mojom-webui/=../\"", "js_module_root=" + rebase_path( "$root_gen_dir/mojom-webui/ash/webui/personalization_app/search",
diff --git a/chrome/browser/resources/settings/chromeos/personalization_page/change_picture.js b/chrome/browser/resources/settings/chromeos/personalization_page/change_picture.js index a905526c..f06c702 100644 --- a/chrome/browser/resources/settings/chromeos/personalization_page/change_picture.js +++ b/chrome/browser/resources/settings/chromeos/personalization_page/change_picture.js
@@ -20,6 +20,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; import {routes} from '../os_route.js'; @@ -113,12 +114,11 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, - value: () => new Set( - [chromeos.settings.mojom.Setting.kChangeDeviceAccountImage]), + value: () => new Set([Setting.kChangeDeviceAccountImage]), }, }; } @@ -179,13 +179,11 @@ /** * Overridden from DeepLinkingBehavior. - * @param {!chromeos.settings.mojom.Setting} settingId + * @param {!Setting} settingId * @return {boolean} */ beforeDeepLinkAttempt(settingId) { - assert( - settingId === - chromeos.settings.mojom.Setting.kChangeDeviceAccountImage); + assert(settingId === Setting.kChangeDeviceAccountImage); this.pictureList_.setFocus(); return false;
diff --git a/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.js b/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.js index 656f3129..4acc3ef 100644 --- a/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.js +++ b/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.js
@@ -18,6 +18,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; import {Route, Router} from '../../router.js'; import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; @@ -95,11 +96,11 @@ /** * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} + * @type {!Set<!Setting>} */ supportedSettingIds: { type: Object, - value: () => new Set([chromeos.settings.mojom.Setting.kOpenWallpaper]), + value: () => new Set([Setting.kOpenWallpaper]), }, }; }
diff --git a/chrome/browser/resources/settings/page_visibility.ts b/chrome/browser/resources/settings/page_visibility.ts index 14f95680..7c044b18 100644 --- a/chrome/browser/resources/settings/page_visibility.ts +++ b/chrome/browser/resources/settings/page_visibility.ts
@@ -29,6 +29,7 @@ homeButton: boolean, pageZoom: boolean, setTheme: boolean, + sidePanel: boolean, }; export type PrivacyPageVisibility = { @@ -74,6 +75,7 @@ homeButton: false, bookmarksBar: false, pageZoom: false, + sidePanel: false, }, advancedSettings: true, privacy: {
diff --git a/chrome/browser/ssl/ocsp_browsertest.cc b/chrome/browser/ssl/ocsp_browsertest.cc index 669082d..bc33e20 100644 --- a/chrome/browser/ssl/ocsp_browsertest.cc +++ b/chrome/browser/ssl/ocsp_browsertest.cc
@@ -514,6 +514,7 @@ EXPECT_TRUE(cert_status & net::CERT_STATUS_REV_CHECKING_ENABLED); } +#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) IN_PROC_BROWSER_TEST_F(OCSPBrowserTest, HardFailOnOCSPInvalid) { if (!ssl_test_util::SystemSupportsHardFailRevocationChecking()) { LOG(WARNING) << "Skipping test because system doesn't support hard fail " @@ -558,6 +559,7 @@ EXPECT_FALSE(cert_status & net::CERT_STATUS_IS_EV); EXPECT_TRUE(cert_status & net::CERT_STATUS_REV_CHECKING_ENABLED); } +#endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) using AIABrowserTest = OCSPBrowserTest;
diff --git a/chrome/browser/sync/test/integration/extension_settings_helper.cc b/chrome/browser/sync/test/integration/extension_settings_helper.cc index 5a8a08f..6265e1f1 100644 --- a/chrome/browser/sync/test/integration/extension_settings_helper.cc +++ b/chrome/browser/sync/test/integration/extension_settings_helper.cc
@@ -79,7 +79,7 @@ return same; } -void SetSettingsOnBackendSequence(const base::DictionaryValue* settings, +void SetSettingsOnBackendSequence(const base::Value::Dict* settings, base::WaitableEvent* signal, value_store::ValueStore* storage) { EXPECT_TRUE(extensions::GetBackendTaskRunner()->RunsTasksInCurrentSequence()); @@ -91,7 +91,7 @@ void SetExtensionSettings(Profile* profile, const std::string& id, - const base::DictionaryValue& settings) { + const base::Value::Dict& settings) { base::WaitableEvent signal(base::WaitableEvent::ResetPolicy::AUTOMATIC, base::WaitableEvent::InitialState::NOT_SIGNALED); extensions::StorageFrontend::Get(profile)->RunWithStorage( @@ -102,7 +102,7 @@ } void SetExtensionSettingsForAllProfiles(const std::string& id, - const base::DictionaryValue& settings) { + const base::Value::Dict& settings) { for (int i = 0; i < test()->num_clients(); ++i) { SetExtensionSettings(test()->GetProfile(i), id, settings); }
diff --git a/chrome/browser/sync/test/integration/extension_settings_helper.h b/chrome/browser/sync/test/integration/extension_settings_helper.h index 226674de..6fbb39a 100644 --- a/chrome/browser/sync/test/integration/extension_settings_helper.h +++ b/chrome/browser/sync/test/integration/extension_settings_helper.h
@@ -7,21 +7,20 @@ #include <string> +#include "base/values.h" + class Profile; -namespace base { -class DictionaryValue; -} namespace extension_settings_helper { // Calls Set() with |settings| for |profile| and the extension with ID |id|. void SetExtensionSettings(Profile* profile, const std::string& id, - const base::DictionaryValue& settings); + const base::Value::Dict& settings); // Calls Set() with |settings| for all profiles the extension with ID |id|. void SetExtensionSettingsForAllProfiles(const std::string& id, - const base::DictionaryValue& settings); + const base::Value::Dict& settings); // Returns whether the extension settings are the same across all profiles. bool AllExtensionSettingsSameAsVerifier();
diff --git a/chrome/browser/sync/test/integration/two_client_extension_settings_and_app_settings_sync_test.cc b/chrome/browser/sync/test/integration/two_client_extension_settings_and_app_settings_sync_test.cc index abd716e8..73554c7 100644 --- a/chrome/browser/sync/test/integration/two_client_extension_settings_and_app_settings_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_extension_settings_and_app_settings_sync_test.cc
@@ -37,28 +37,28 @@ const std::string& extension2) { { // Write to extension0 from profile 0 but not profile 1. - base::DictionaryValue settings; - settings.SetString("asdf", base::StringPrintf("asdfasdf-%d", seed)); + base::Value::Dict settings; + settings.Set("asdf", base::StringPrintf("asdfasdf-%d", seed)); SetExtensionSettings(test()->verifier(), extension0, settings); SetExtensionSettings(test()->GetProfile(0), extension0, settings); } { // Write the same data to extension1 from both profiles. - base::DictionaryValue settings; - settings.SetString("asdf", base::StringPrintf("asdfasdf-%d", seed)); - settings.SetString("qwer", base::StringPrintf("qwerqwer-%d", seed)); + base::Value::Dict settings; + settings.Set("asdf", base::StringPrintf("asdfasdf-%d", seed)); + settings.Set("qwer", base::StringPrintf("qwerqwer-%d", seed)); SetExtensionSettingsForAllProfiles(extension1, settings); } { // Write different data to extension2 from each profile. - base::DictionaryValue settings0; - settings0.SetString("zxcv", base::StringPrintf("zxcvzxcv-%d", seed)); + base::Value::Dict settings0; + settings0.Set("zxcv", base::StringPrintf("zxcvzxcv-%d", seed)); SetExtensionSettings(test()->verifier(), extension2, settings0); SetExtensionSettings(test()->GetProfile(0), extension2, settings0); - base::DictionaryValue settings1; - settings1.SetString("1324", base::StringPrintf("12341234-%d", seed)); - settings1.SetString("5687", base::StringPrintf("56785678-%d", seed)); + base::Value::Dict settings1; + settings1.Set("1324", base::StringPrintf("12341234-%d", seed)); + settings1.Set("5687", base::StringPrintf("56785678-%d", seed)); SetExtensionSettings(test()->verifier(), extension2, settings1); SetExtensionSettings(test()->GetProfile(1), extension2, settings1); } @@ -89,14 +89,14 @@ { // Leave extension0 empty. } { - base::DictionaryValue settings; - settings.SetString("foo", "bar"); + base::Value::Dict settings; + settings.Set("foo", "bar"); SetExtensionSettingsForAllProfiles(extension1, settings); } { - base::DictionaryValue settings; - settings.SetString("foo", "bar"); - settings.SetString("baz", "qux"); + base::Value::Dict settings; + settings.Set("foo", "bar"); + settings.Set("baz", "qux"); SetExtensionSettingsForAllProfiles(extension2, settings); } @@ -145,15 +145,15 @@ // test (nonempty, nonempty) because the merging will provide // unpredictable results, so test (empty, empty). } { - base::DictionaryValue settings; - settings.SetString("foo", "bar"); + base::Value::Dict settings; + settings.Set("foo", "bar"); SetExtensionSettings(test()->verifier(), extension1, settings); SetExtensionSettings(test()->GetProfile(0), extension1, settings); } { - base::DictionaryValue settings; - settings.SetString("foo", "bar"); - settings.SetString("baz", "qux"); + base::Value::Dict settings; + settings.Set("foo", "bar"); + settings.Set("baz", "qux"); SetExtensionSettings(test()->verifier(), extension2, settings); SetExtensionSettings(test()->GetProfile(1), extension2, settings); }
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc index 3bb0057..c39ef789 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -50,6 +50,7 @@ #include "chrome/browser/ui/webui/tab_strip/tab_strip_ui_layout.h" #include "chrome/browser/ui/webui/tab_strip/tab_strip_ui_util.h" #include "chrome/browser/web_applications/web_app_provider.h" +#include "chrome/common/channel_info.h" #include "chrome/common/chrome_switches.h" #include "components/ui_devtools/devtools_server.h" #include "components/user_manager/user_manager.h" @@ -337,3 +338,7 @@ return contents ? contents->GetLastCommittedURL() : GURL::EmptyGURL(); } + +version_info::Channel ChromeShellDelegate::GetChannel() { + return chrome::GetChannel(); +}
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.h b/chrome/browser/ui/ash/chrome_shell_delegate.h index efd71ee..97714bb 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.h +++ b/chrome/browser/ui/ash/chrome_shell_delegate.h
@@ -62,6 +62,7 @@ static void SetDisableLoggingRedirectForTesting(bool value); static void ResetDisableLoggingRedirectForTesting(); const GURL& GetLastCommittedURLForWindowIfAny(aura::Window* window) override; + version_info::Channel GetChannel() override; }; #endif // CHROME_BROWSER_UI_ASH_CHROME_SHELL_DELEGATE_H_
diff --git a/chrome/browser/ui/ash/system_tray_client_impl.cc b/chrome/browser/ui/ash/system_tray_client_impl.cc index 3c42c74..d5d4087 100644 --- a/chrome/browser/ui/ash/system_tray_client_impl.cc +++ b/chrome/browser/ui/ash/system_tray_client_impl.cc
@@ -750,10 +750,6 @@ opened_pwa = true; } -version_info::Channel SystemTrayClientImpl::GetChannel() { - return chrome::GetChannel(); -} - SystemTrayClientImpl::SystemTrayClientImpl(SystemTrayClientImpl* mock_instance) : system_tray_(nullptr) { DCHECK(!g_system_tray_client_instance);
diff --git a/chrome/browser/ui/ash/system_tray_client_impl.h b/chrome/browser/ui/ash/system_tray_client_impl.h index fdfdd93..fedf44e9 100644 --- a/chrome/browser/ui/ash/system_tray_client_impl.h +++ b/chrome/browser/ui/ash/system_tray_client_impl.h
@@ -104,7 +104,6 @@ const base::Time& date, bool& opened_pwa, GURL& finalized_event_url) override; - version_info::Channel GetChannel() override; protected: // Used by mocks in tests.
diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h index 2a003b4..bf588c97 100644 --- a/chrome/browser/ui/browser_dialogs.h +++ b/chrome/browser/ui/browser_dialogs.h
@@ -137,7 +137,7 @@ void ShowBluetoothDeviceCredentialsDialog( content::WebContents* web_contents, const std::u16string& device_identifier, - content::BluetoothDelegate::CredentialsCallback close_callback); + content::BluetoothDelegate::PairPromptCallback close_callback); // Shows the dialog to let user confirm to pair with the device // identified by |device_identifier|. |device_identifier| is the most @@ -146,7 +146,7 @@ void ShowBluetoothDevicePairConfirmDialog( content::WebContents* web_contents, const std::u16string& device_identifier, - content::BluetoothDelegate::PairConfirmCallback close_callback); + content::BluetoothDelegate::PairPromptCallback close_callback); #endif // PAIR_BLUETOOTH_ON_DEMAND() // Callback used to indicate whether a user has accepted the installation of a
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller_browsertest.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller_browsertest.cc index d1dd6925..daae5f0e 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller_browsertest.cc +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller_browsertest.cc
@@ -147,8 +147,16 @@ ->IsKeyboardLockActive()); } +// Disabled for flaky SEGFAULTs on Lacros: crbug.com/1340114 +#if BUILDFLAG(IS_CHROMEOS_LACROS) +#define MAYBE_KeyboardLockNotLockedInExtensionFullscreenMode \ + DISABLED_KeyboardLockNotLockedInExtensionFullscreenMode +#else +#define MAYBE_KeyboardLockNotLockedInExtensionFullscreenMode \ + KeyboardLockNotLockedInExtensionFullscreenMode +#endif // IS_CHROMEOS_LACROS IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, - KeyboardLockNotLockedInExtensionFullscreenMode) { + MAYBE_KeyboardLockNotLockedInExtensionFullscreenMode) { EnterExtensionInitiatedFullscreen(); ASSERT_TRUE(RequestKeyboardLock(/*esc_key_locked=*/true)); ASSERT_FALSE(GetExclusiveAccessManager()
diff --git a/chrome/browser/ui/views/bluetooth_device_credentials_view.cc b/chrome/browser/ui/views/bluetooth_device_credentials_view.cc index e543c71..f0ffceb8 100644 --- a/chrome/browser/ui/views/bluetooth_device_credentials_view.cc +++ b/chrome/browser/ui/views/bluetooth_device_credentials_view.cc
@@ -29,7 +29,7 @@ void ShowBluetoothDeviceCredentialsDialog( content::WebContents* web_contents, const std::u16string& device_identifier, - BluetoothDelegate::CredentialsCallback close_callback) { + BluetoothDelegate::PairPromptCallback close_callback) { // This dialog owns itself. DialogDelegateView will delete |dialog| instance. auto* dialog = new BluetoothDeviceCredentialsView(device_identifier, std::move(close_callback)); @@ -56,7 +56,7 @@ BluetoothDeviceCredentialsView::BluetoothDeviceCredentialsView( const std::u16string& device_identifier, - BluetoothDelegate::CredentialsCallback close_callback) + BluetoothDelegate::PairPromptCallback close_callback) : close_callback_(std::move(close_callback)) { SetModalType(ui::MODAL_TYPE_CHILD); set_margins(ChromeLayoutProvider::Get()->GetDialogInsetsForContentType( @@ -66,7 +66,8 @@ base::Unretained(this))); auto canceled = [](BluetoothDeviceCredentialsView* dialog) { std::move(dialog->close_callback_) - .Run(BluetoothDelegate::DeviceCredentialsPromptResult::kCancelled, u""); + .Run(BluetoothDelegate::PairPromptResult( + BluetoothDelegate::PairPromptStatus::kCancelled)); }; SetCancelCallback(base::BindOnce(canceled, base::Unretained(this))); SetCloseCallback(base::BindOnce(canceled, base::Unretained(this))); @@ -181,9 +182,10 @@ base::TrimWhitespace(passkey_text_->GetText(), base::TRIM_ALL, &trimmed_input); - std::move(close_callback_) - .Run(BluetoothDelegate::DeviceCredentialsPromptResult::kSuccess, - std::move(trimmed_input)); + BluetoothDelegate::PairPromptResult result; + result.result_code = BluetoothDelegate::PairPromptStatus::kSuccess; + result.pin = base::UTF16ToUTF8(trimmed_input); + std::move(close_callback_).Run(result); } void BluetoothDeviceCredentialsView::ContentsChanged(
diff --git a/chrome/browser/ui/views/bluetooth_device_credentials_view.h b/chrome/browser/ui/views/bluetooth_device_credentials_view.h index 834d822..f720f2b 100644 --- a/chrome/browser/ui/views/bluetooth_device_credentials_view.h +++ b/chrome/browser/ui/views/bluetooth_device_credentials_view.h
@@ -22,7 +22,7 @@ METADATA_HEADER(BluetoothDeviceCredentialsView); BluetoothDeviceCredentialsView( const std::u16string& device_identifier, - content::BluetoothDelegate::CredentialsCallback close_callback); + content::BluetoothDelegate::PairPromptCallback close_callback); BluetoothDeviceCredentialsView(const BluetoothDeviceCredentialsView&) = delete; BluetoothDeviceCredentialsView& operator=( @@ -48,7 +48,7 @@ void ContentsChanged(views::Textfield* sender, const std::u16string& new_contents) override; - content::BluetoothDelegate::CredentialsCallback close_callback_; + content::BluetoothDelegate::PairPromptCallback close_callback_; raw_ptr<views::Textfield> passkey_text_ = nullptr; raw_ptr<views::View> icon_view_ = nullptr; raw_ptr<views::View> contents_wrapper_ = nullptr;
diff --git a/chrome/browser/ui/views/bluetooth_device_credentials_view_browsertest.cc b/chrome/browser/ui/views/bluetooth_device_credentials_view_browsertest.cc index 29479fc..3d43ed2 100644 --- a/chrome/browser/ui/views/bluetooth_device_credentials_view_browsertest.cc +++ b/chrome/browser/ui/views/bluetooth_device_credentials_view_browsertest.cc
@@ -16,9 +16,6 @@ namespace { -using DeviceCredentialsPromptResult = - ::content::BluetoothDelegate::DeviceCredentialsPromptResult; - const std::u16string kDeviceIdentifier = u"test-device"; } // namespace @@ -28,15 +25,10 @@ BluetoothDeviceCredentialsViewBrowserTest() = default; ~BluetoothDeviceCredentialsViewBrowserTest() override = default; - void DialogCallback(DeviceCredentialsPromptResult status, - const std::u16string& result) {} - void ShowUi(const std::string& name) override { chrome::ShowBluetoothDeviceCredentialsDialog( browser()->tab_strip_model()->GetActiveWebContents(), kDeviceIdentifier, - base::BindOnce( - &BluetoothDeviceCredentialsViewBrowserTest::DialogCallback, - weak_factory_.GetWeakPtr())); + base::NullCallback()); } private:
diff --git a/chrome/browser/ui/views/bluetooth_device_pair_confirm_view.cc b/chrome/browser/ui/views/bluetooth_device_pair_confirm_view.cc index a65dbb4..cbb6d73 100644 --- a/chrome/browser/ui/views/bluetooth_device_pair_confirm_view.cc +++ b/chrome/browser/ui/views/bluetooth_device_pair_confirm_view.cc
@@ -27,7 +27,7 @@ void ShowBluetoothDevicePairConfirmDialog( content::WebContents* web_contents, const std::u16string& device_identifier, - BluetoothDelegate::PairConfirmCallback close_callback) { + BluetoothDelegate::PairPromptCallback close_callback) { // This dialog owns itself. DialogDelegateView will delete |dialog| instance. auto* dialog = new BluetoothDevicePairConfirmView(device_identifier, std::move(close_callback)); @@ -38,7 +38,7 @@ BluetoothDevicePairConfirmView::BluetoothDevicePairConfirmView( const std::u16string& device_identifier, - BluetoothDelegate::PairConfirmCallback close_callback) + BluetoothDelegate::PairPromptCallback close_callback) : close_callback_(std::move(close_callback)) { SetModalType(ui::MODAL_TYPE_CHILD); set_margins(ChromeLayoutProvider::Get()->GetDialogInsetsForContentType( @@ -48,7 +48,8 @@ base::Unretained(this))); auto canceled = [](BluetoothDevicePairConfirmView* dialog) { std::move(dialog->close_callback_) - .Run(BluetoothDelegate::DevicePairConfirmPromptResult::kCancelled); + .Run(BluetoothDelegate::PairPromptResult( + BluetoothDelegate::PairPromptStatus::kCancelled)); }; SetCancelCallback(base::BindOnce(canceled, base::Unretained(this))); SetCloseCallback(base::BindOnce(canceled, base::Unretained(this))); @@ -132,8 +133,9 @@ } void BluetoothDevicePairConfirmView::OnDialogAccepted() { - std::move(close_callback_) - .Run(BluetoothDelegate::DevicePairConfirmPromptResult::kSuccess); + BluetoothDelegate::PairPromptResult prompt_result; + prompt_result.result_code = BluetoothDelegate::PairPromptStatus::kSuccess; + std::move(close_callback_).Run(prompt_result); } BEGIN_METADATA(BluetoothDevicePairConfirmView, views::DialogDelegateView)
diff --git a/chrome/browser/ui/views/bluetooth_device_pair_confirm_view.h b/chrome/browser/ui/views/bluetooth_device_pair_confirm_view.h index 8a95657..d17b3db0 100644 --- a/chrome/browser/ui/views/bluetooth_device_pair_confirm_view.h +++ b/chrome/browser/ui/views/bluetooth_device_pair_confirm_view.h
@@ -22,7 +22,7 @@ METADATA_HEADER(BluetoothDevicePairConfirmView); BluetoothDevicePairConfirmView( const std::u16string& device_identifier, - content::BluetoothDelegate::PairConfirmCallback close_callback); + content::BluetoothDelegate::PairPromptCallback close_callback); BluetoothDevicePairConfirmView(const BluetoothDevicePairConfirmView&) = delete; BluetoothDevicePairConfirmView& operator=( @@ -40,7 +40,7 @@ private: void OnDialogAccepted(); - content::BluetoothDelegate::PairConfirmCallback close_callback_; + content::BluetoothDelegate::PairPromptCallback close_callback_; raw_ptr<views::Textfield> passkey_text_ = nullptr; raw_ptr<views::View> icon_view_ = nullptr; raw_ptr<views::View> contents_wrapper_ = nullptr;
diff --git a/chrome/browser/ui/views/side_panel/read_anything/read_anything_coordinator.cc b/chrome/browser/ui/views/side_panel/read_anything/read_anything_coordinator.cc index 4ea28c9..10b29da 100644 --- a/chrome/browser/ui/views/side_panel/read_anything/read_anything_coordinator.cc +++ b/chrome/browser/ui/views/side_panel/read_anything/read_anything_coordinator.cc
@@ -82,7 +82,8 @@ std::unique_ptr<views::View> ReadAnythingCoordinator::CreateContainerView() { // Create the views. - auto toolbar = std::make_unique<ReadAnythingToolbarView>(this); + auto toolbar = + std::make_unique<ReadAnythingToolbarView>(this, controller_.get()); Browser* browser = &GetBrowser(); auto content_web_view = std::make_unique<SidePanelWebUIViewT<ReadAnythingUI>>(
diff --git a/chrome/browser/ui/views/side_panel/read_anything/read_anything_coordinator_unittest.cc b/chrome/browser/ui/views/side_panel/read_anything/read_anything_coordinator_unittest.cc index 476f831..c1e6db48 100644 --- a/chrome/browser/ui/views/side_panel/read_anything/read_anything_coordinator_unittest.cc +++ b/chrome/browser/ui/views/side_panel/read_anything/read_anything_coordinator_unittest.cc
@@ -27,20 +27,6 @@ MOCK_METHOD(void, OnCoordinatorDestroyed, (), (override)); }; -class MockReadAnythingModelObserver : public ReadAnythingModel::Observer { - public: - MOCK_METHOD(void, - OnFontNameUpdated, - (const std::string& new_font_name), - (override)); - MOCK_METHOD(void, - OnAXTreeDistilled, - (const ui::AXTreeUpdate& snapshot, - const std::vector<ui::AXNodeID>& content_node_ids), - (override)); - MOCK_METHOD(void, OnFontSizeChanged, (float new_font_size), (override)); -}; - class ReadAnythingCoordinatorTest : public TestWithBrowserView { public: void SetUp() override { @@ -82,7 +68,6 @@ raw_ptr<ReadAnythingCoordinator> read_anything_coordinator_ = nullptr; MockReadAnythingCoordinatorObserver coordinator_observer_; - MockReadAnythingModelObserver model_observer_; }; TEST_F(ReadAnythingCoordinatorTest, ModelAndControllerPersist) { @@ -112,19 +97,6 @@ EXPECT_CALL(coordinator_observer_, OnCoordinatorDestroyed()).Times(1); } -TEST_F(ReadAnythingCoordinatorTest, ModelObserversReceiveNotifications) { - GetModel()->AddObserver(&model_observer_); - - EXPECT_CALL(model_observer_, OnAXTreeDistilled(_, _)).Times(1); - EXPECT_CALL(model_observer_, OnFontNameUpdated(_)).Times(1); - - GetModel()->SetDistilledAXTree(ui::AXTreeUpdate(), - std::vector<ui::AXNodeID>()); - GetModel()->SetSelectedFontByIndex(3); - - GetModel()->RemoveObserver(&model_observer_); -} - TEST_F(ReadAnythingCoordinatorTest, ActivatesAndDeactivatesController) { side_panel_coordinator_->Show(SidePanelEntry::Id::kReadAnything); EXPECT_TRUE(IsControllerActive());
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 new file mode 100644 index 0000000..fd9a280f --- /dev/null +++ b/chrome/browser/ui/views/side_panel/read_anything/read_anything_model_unittest.cc
@@ -0,0 +1,137 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/views/side_panel/read_anything/read_anything_model.h" + +#include <vector> + +#include "base/feature_list.h" +#include "chrome/browser/ui/ui_features.h" +#include "chrome/browser/ui/views/frame/test_with_browser_view.h" +#include "testing/gmock/include/gmock/gmock.h" + +#include "ui/accessibility/accessibility_features.h" + +using testing::_; +using testing::FloatNear; + +class MockReadAnythingModelObserver : public ReadAnythingModel::Observer { + public: + MOCK_METHOD(void, + OnFontNameUpdated, + (const std::string& new_font_name), + (override)); + MOCK_METHOD(void, + OnAXTreeDistilled, + (const ui::AXTreeUpdate& snapshot, + const std::vector<ui::AXNodeID>& content_node_ids), + (override)); + MOCK_METHOD(void, OnFontSizeChanged, (const float new_font_size), (override)); +}; + +class ReadAnythingModelTest : public TestWithBrowserView { + public: + void SetUp() override { + base::test::ScopedFeatureList features; + features.InitWithFeatures( + {features::kUnifiedSidePanel, features::kReadAnything}, {}); + TestWithBrowserView::SetUp(); + + std::string prefs_font_name; + model_ = std::make_unique<ReadAnythingModel>(prefs_font_name); + } + + // Wrapper methods around the ReadAnythingModel. These do nothing more + // than keep the below tests less verbose (simple pass-throughs). + + ReadAnythingFontModel* GetFontModel() { return model_->GetFontModel(); } + + protected: + std::unique_ptr<ReadAnythingModel> model_; + + MockReadAnythingModelObserver model_observer_1_; + MockReadAnythingModelObserver model_observer_2_; + MockReadAnythingModelObserver model_observer_3_; +}; + +TEST_F(ReadAnythingModelTest, AddingModelObserverNotifiesAllObservers) { + model_->AddObserver(&model_observer_1_); + + EXPECT_CALL(model_observer_1_, OnFontNameUpdated(_)).Times(1); + EXPECT_CALL(model_observer_1_, OnAXTreeDistilled(_, _)).Times(1); + EXPECT_CALL(model_observer_2_, OnFontNameUpdated(_)).Times(1); + EXPECT_CALL(model_observer_2_, OnAXTreeDistilled(_, _)).Times(1); + + model_->AddObserver(&model_observer_2_); +} + +TEST_F(ReadAnythingModelTest, RemovedModelObserversDoNotReceiveNotifications) { + model_->AddObserver(&model_observer_1_); + model_->AddObserver(&model_observer_2_); + + EXPECT_CALL(model_observer_1_, OnFontNameUpdated(_)).Times(1); + EXPECT_CALL(model_observer_1_, OnAXTreeDistilled(_, _)).Times(1); + EXPECT_CALL(model_observer_2_, OnFontNameUpdated(_)).Times(0); + EXPECT_CALL(model_observer_2_, OnAXTreeDistilled(_, _)).Times(0); + EXPECT_CALL(model_observer_3_, OnFontNameUpdated(_)).Times(1); + EXPECT_CALL(model_observer_3_, OnAXTreeDistilled(_, _)).Times(1); + + model_->RemoveObserver(&model_observer_2_); + model_->AddObserver(&model_observer_3_); +} + +TEST_F(ReadAnythingModelTest, NotificationsOnSetSelectedFontIndex) { + model_->AddObserver(&model_observer_1_); + + EXPECT_CALL(model_observer_1_, OnFontNameUpdated("Serif")).Times(1); + + model_->SetSelectedFontByIndex(2); +} + +TEST_F(ReadAnythingModelTest, NotifiationsOnSetDistilledAXTree) { + model_->AddObserver(&model_observer_1_); + + EXPECT_CALL(model_observer_1_, OnAXTreeDistilled(_, _)).Times(1); + + ui::AXTreeUpdate snapshot_; + std::vector<ui::AXNodeID> content_node_ids_; + model_->SetDistilledAXTree(snapshot_, content_node_ids_); +} + +TEST_F(ReadAnythingModelTest, NotificationsOnDecreasedFontSize) { + model_->AddObserver(&model_observer_1_); + + EXPECT_CALL(model_observer_1_, OnFontSizeChanged(FloatNear(15.0, 0.01))) + .Times(1); + + model_->DecreaseTextSize(); +} + +TEST_F(ReadAnythingModelTest, NotificationsOnIncreasedFontSize) { + model_->AddObserver(&model_observer_1_); + + EXPECT_CALL(model_observer_1_, OnFontSizeChanged(FloatNear(21.6, 0.01))) + .Times(1); + + model_->IncreaseTextSize(); +} + +TEST_F(ReadAnythingModelTest, FontModelIsValidFontName) { + EXPECT_TRUE(GetFontModel()->IsValidFontName("Standard font")); + EXPECT_TRUE(GetFontModel()->IsValidFontName("Sans-serif")); + EXPECT_TRUE(GetFontModel()->IsValidFontName("Serif")); + EXPECT_TRUE(GetFontModel()->IsValidFontName("Arial")); + EXPECT_TRUE(GetFontModel()->IsValidFontName("Open Sans")); + EXPECT_TRUE(GetFontModel()->IsValidFontName("Calibri")); + EXPECT_FALSE(GetFontModel()->IsValidFontName("xxyyzz")); +} + +TEST_F(ReadAnythingModelTest, FontModelGetCurrentFontName) { + EXPECT_EQ("Standard font", GetFontModel()->GetFontNameAt(0)); + EXPECT_EQ("Sans-serif", GetFontModel()->GetFontNameAt(1)); + EXPECT_EQ("Serif", GetFontModel()->GetFontNameAt(2)); + EXPECT_EQ("Arial", GetFontModel()->GetFontNameAt(3)); + EXPECT_EQ("Open Sans", GetFontModel()->GetFontNameAt(4)); + EXPECT_EQ("Calibri", GetFontModel()->GetFontNameAt(5)); +}
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 cb8362d..aab2e958 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
@@ -25,11 +25,10 @@ #include "ui/views/layout/layout_types.h" ReadAnythingToolbarView::ReadAnythingToolbarView( - ReadAnythingCoordinator* coordinator) - : coordinator_(std::move(coordinator)) { + ReadAnythingCoordinator* coordinator, + ReadAnythingToolbarView::Delegate* delegate) + : delegate_(delegate), coordinator_(std::move(coordinator)) { coordinator_->AddObserver(this); - delegate_ = static_cast<ReadAnythingToolbarView::Delegate*>( - coordinator_->GetController()); auto* font_model = coordinator_->GetModel()->GetFontModel(); // Create and set a BoxLayout LayoutManager for this view.
diff --git a/chrome/browser/ui/views/side_panel/read_anything/read_anything_toolbar_view.h b/chrome/browser/ui/views/side_panel/read_anything/read_anything_toolbar_view.h index d113a80..b1668b8 100644 --- a/chrome/browser/ui/views/side_panel/read_anything/read_anything_toolbar_view.h +++ b/chrome/browser/ui/views/side_panel/read_anything/read_anything_toolbar_view.h
@@ -29,7 +29,8 @@ virtual void OnFontSizeChanged(bool increase) = 0; }; - explicit ReadAnythingToolbarView(ReadAnythingCoordinator* coordinator); + ReadAnythingToolbarView(ReadAnythingCoordinator* coordinator, + ReadAnythingToolbarView::Delegate* delegate); ReadAnythingToolbarView(const ReadAnythingToolbarView&) = delete; ReadAnythingToolbarView& operator=(const ReadAnythingToolbarView&) = delete; ~ReadAnythingToolbarView() override; @@ -38,6 +39,8 @@ void OnCoordinatorDestroyed() override; private: + friend class ReadAnythingToolbarViewTest; + void FontNameChangedCallback(); void DecreaseFontSizeCallback(); void IncreaseFontSizeCallback();
diff --git a/chrome/browser/ui/views/side_panel/read_anything/read_anything_toolbar_view_browsertest.cc b/chrome/browser/ui/views/side_panel/read_anything/read_anything_toolbar_view_browsertest.cc new file mode 100644 index 0000000..b551f29 --- /dev/null +++ b/chrome/browser/ui/views/side_panel/read_anything/read_anything_toolbar_view_browsertest.cc
@@ -0,0 +1,91 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/views/side_panel/read_anything/read_anything_toolbar_view.h" + +#include "chrome/browser/ui/views/side_panel/read_anything/read_anything_coordinator.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "content/public/test/browser_test.h" +#include "testing/gmock/include/gmock/gmock.h" + +using testing::_; +using testing::IsFalse; +using testing::IsTrue; + +class MockReadAnythingToolbarViewDelegate + : public ReadAnythingToolbarView::Delegate { + public: + MOCK_METHOD(void, OnFontChoiceChanged, (int new_choice), (override)); + MOCK_METHOD(void, OnFontSizeChanged, (bool increase), (override)); +}; + +class MockReadAnythingCoordinator : public ReadAnythingCoordinator { + public: + explicit MockReadAnythingCoordinator(Browser* browser) + : ReadAnythingCoordinator(browser) {} + + MOCK_METHOD(void, + CreateAndRegisterEntry, + (SidePanelRegistry * global_registry)); + MOCK_METHOD(ReadAnythingController*, GetController, ()); + MOCK_METHOD(ReadAnythingModel*, GetModel, ()); + MOCK_METHOD(void, + AddObserver, + (ReadAnythingCoordinator::Observer * observer)); + MOCK_METHOD(void, + RemoveObserver, + (ReadAnythingCoordinator::Observer * observer)); +}; + +class ReadAnythingToolbarViewTest : public InProcessBrowserTest { + public: + ReadAnythingToolbarViewTest() = default; + ~ReadAnythingToolbarViewTest() override = default; + + // InProcessBrowserTest: + void SetUpOnMainThread() override { + coordinator_ = std::make_unique<MockReadAnythingCoordinator>(browser()); + + toolbar_view_ = std::make_unique<ReadAnythingToolbarView>( + coordinator_.get(), &delegate_); + } + + void TearDownOnMainThread() override { coordinator_ = nullptr; } + + // Wrapper methods around the ReadAnythingToolbarView. + + void FontNameChangedCallback() { toolbar_view_->FontNameChangedCallback(); } + + void DecreaseFontSizeCallback() { toolbar_view_->DecreaseFontSizeCallback(); } + + void IncreaseFontSizeCallback() { toolbar_view_->IncreaseFontSizeCallback(); } + + protected: + MockReadAnythingToolbarViewDelegate delegate_; + + private: + std::unique_ptr<ReadAnythingToolbarView> toolbar_view_; + std::unique_ptr<MockReadAnythingCoordinator> coordinator_; +}; + +IN_PROC_BROWSER_TEST_F(ReadAnythingToolbarViewTest, FontNameChanged) { + EXPECT_CALL(delegate_, OnFontChoiceChanged(_)).Times(1); + EXPECT_CALL(delegate_, OnFontSizeChanged(_)).Times(0); + + FontNameChangedCallback(); +} + +IN_PROC_BROWSER_TEST_F(ReadAnythingToolbarViewTest, DecreaseTextSizeClicked) { + EXPECT_CALL(delegate_, OnFontChoiceChanged(_)).Times(0); + EXPECT_CALL(delegate_, OnFontSizeChanged(IsFalse())).Times(1); + + DecreaseFontSizeCallback(); +} + +IN_PROC_BROWSER_TEST_F(ReadAnythingToolbarViewTest, IncreaseTextSizeClicked) { + EXPECT_CALL(delegate_, OnFontChoiceChanged(_)).Times(0); + EXPECT_CALL(delegate_, OnFontSizeChanged(IsTrue())).Times(1); + + IncreaseFontSizeCallback(); +}
diff --git a/chrome/browser/ui/views/tabs/tab_container.cc b/chrome/browser/ui/views/tabs/tab_container.cc index f9bf11f..70c0acc 100644 --- a/chrome/browser/ui/views/tabs/tab_container.cc +++ b/chrome/browser/ui/views/tabs/tab_container.cc
@@ -364,6 +364,16 @@ } } +void TabContainer::OnGroupContentsChanged(const tab_groups::TabGroupId& group) { + // If a tab was removed, the underline bounds might be stale. + group_views()[group]->UpdateBounds(); + + // The group header may be in the wrong place if the tab didn't actually + // move in terms of model indices. + OnGroupMoved(group); + StartBasicAnimation(); +} + void TabContainer::OnGroupMoved(const tab_groups::TabGroupId& group) { DCHECK(group_views()[group]);
diff --git a/chrome/browser/ui/views/tabs/tab_container.h b/chrome/browser/ui/views/tabs/tab_container.h index 62a80ae..e7b1b98 100644 --- a/chrome/browser/ui/views/tabs/tab_container.h +++ b/chrome/browser/ui/views/tabs/tab_container.h
@@ -62,6 +62,7 @@ // action to create the |group|. void OnGroupEditorOpened(const tab_groups::TabGroupId& group); void OnGroupMoved(const tab_groups::TabGroupId& group); + void OnGroupContentsChanged(const tab_groups::TabGroupId& group); void OnGroupClosed(const tab_groups::TabGroupId& group); void UpdateTabGroupVisuals(tab_groups::TabGroupId group_id);
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index 1814059..f6d5478 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -1109,10 +1109,7 @@ } void TabStrip::OnGroupContentsChanged(const tab_groups::TabGroupId& group) { - // The group header may be in the wrong place if the tab didn't actually - // move in terms of model indices. - OnGroupMoved(group); - tab_container_->StartBasicAnimation(); + tab_container_->OnGroupContentsChanged(group); } void TabStrip::OnGroupVisualsChanged(
diff --git a/chrome/browser/ui/webui/chromeos/notification_tester/notification_tester_handler.cc b/chrome/browser/ui/webui/chromeos/notification_tester/notification_tester_handler.cc index 87554571..d5967a65 100644 --- a/chrome/browser/ui/webui/chromeos/notification_tester/notification_tester_handler.cc +++ b/chrome/browser/ui/webui/chromeos/notification_tester/notification_tester_handler.cc
@@ -7,13 +7,13 @@ #include <string> #include "ash/constants/notifier_catalogs.h" -#include "ash/public/cpp/notification_utils.h" #include "base/bind.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/grit/chrome_unscaled_resources.h" #include "chrome/grit/theme_resources.h" +#include "ui/base/models/image_model.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" #include "ui/gfx/vector_icon_types.h" @@ -61,8 +61,10 @@ message_center::NotifierType::SYSTEM_COMPONENT, "test notifier id", ash::NotificationCatalogName::kTestCatalogName); - message_center::RichNotificationData optional_fields; - SetNotificationImage(*image, optional_fields); + message_center::RichNotificationData optional_fields = + DictToOptionalFields(notifObj); + + auto notification_icon = GetNotificationIconFromString(*icon); // Delegate does nothing. auto delegate = @@ -74,42 +76,141 @@ base::Time::Now().ToDeltaSinceWindowsEpoch().InMilliseconds(); std::string notification_id = base::NumberToString(current_time_in_ms); - std::unique_ptr<message_center::Notification> notification = - ash::CreateSystemNotification( - message_center::NOTIFICATION_TYPE_SIMPLE, notification_id, - base::UTF8ToUTF16(*title), base::UTF8ToUTF16(*message), - display_source, origin_url, notifier_id, optional_fields, delegate, - GetNotificationIcon(*icon), - message_center::SystemNotificationWarningLevel::NORMAL); + auto notification = std::make_unique<message_center::Notification>( + message_center::NotificationType::NOTIFICATION_TYPE_SIMPLE, + notification_id, base::UTF8ToUTF16(*title), base::UTF8ToUTF16(*message), + notification_icon, display_source, origin_url, notifier_id, + optional_fields, delegate); message_center::MessageCenter::Get()->AddNotification( std::move(notification)); } -const gfx::VectorIcon& NotificationTesterHandler::GetNotificationIcon( - const std::string& icon) { - if (icon == "kTerminalSshIcon") { +const ui::ImageModel NotificationTesterHandler::GetNotificationIconFromString( + const std::string& icon_name) { + if (icon_name == "chromium_logo") { + return ui::ImageModel::FromResourceId(IDR_PRODUCT_LOGO_32); + } else if (icon_name == "google_logo") { + return ui::ImageModel::FromResourceId(IDR_LOGO_GOOGLE_COLOR_90); + } else if (icon_name == "warning") { + return ui::ImageModel::FromResourceId(IDR_RESET_WARNING); + } + + return ui::ImageModel(); +} + +const gfx::Image NotificationTesterHandler::GetRichDataImageFromString( + const std::string& image_name) { + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); + if (image_name == "google_logo_small_png") { + return rb.GetImageNamed(IDR_LOGO_GOOGLE_COLOR_90); + } else if (image_name == "chromium_logo_large_png") { + return rb.GetImageNamed(IDR_CHROME_APP_ICON_192); + } + + return gfx::Image(); +} + +const gfx::VectorIcon& +NotificationTesterHandler::GetRichDataSmallImageFromString( + const std::string& small_image_name) { + if (small_image_name == "kTerminalSshIcon") { return kTerminalSshIcon; - } else if (icon == "kCreditCardIcon") { + } else if (small_image_name == "kCreditCardIcon") { return kCreditCardIcon; - } else if (icon == "kSmartphoneIcon") { + } else if (small_image_name == "kSmartphoneIcon") { return kSmartphoneIcon; } - return gfx::kNoneIcon; // Default Case + return gfx::kNoneIcon; } -// TODO(crbug/1341401): Need to switch from SetNotification...() to -// GetNotification...() -void NotificationTesterHandler::SetNotificationImage( - const std::string& image, - message_center::RichNotificationData& optional_fields) { - ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - if (image == "google_logo_small_png") { - optional_fields.image = rb.GetImageNamed(IDR_LOGO_GOOGLE_COLOR_90); - } else if (image == "chromium_logo_large_png") { - optional_fields.image = rb.GetImageNamed(IDR_CHROME_APP_ICON_192); +std::vector<message_center::ButtonInfo> +NotificationTesterHandler::GetRichDataButtons(int num_buttons) { + std::vector<message_center::ButtonInfo> buttons; + for (int i = 0; i < num_buttons; i++) { + buttons.emplace_back(u"Test Btn " + base::NumberToString16(i)); } + return buttons; +} + +std::vector<message_center::NotificationItem> +NotificationTesterHandler::GetRichDataNotifItems(int num_items) { + std::vector<message_center::NotificationItem> items; + for (int i = 0; i < num_items; i++) { + items.push_back({u"Item " + base::NumberToString16(i), u"item message"}); + } + return items; +} + +message_center::RichNotificationData +NotificationTesterHandler::DictToOptionalFields( + const base::Value::Dict* notifObj) { + message_center::RichNotificationData optional_fields; + // Unpack notification object and populate optional_fields. + const std::string* image = notifObj->FindString("richDataImage"); + DCHECK(image); + optional_fields.image = GetRichDataImageFromString(*image); + + const std::string* small_image = notifObj->FindString("richDataSmallImage"); + DCHECK(small_image); + optional_fields.vector_small_image = + &GetRichDataSmallImageFromString(*small_image); + + absl::optional<bool> never_timeout = + notifObj->FindBool("richDataNeverTimeout"); + DCHECK(never_timeout); + optional_fields.never_timeout = never_timeout.value(); + + absl::optional<int> priority = notifObj->FindInt("richDataPriority"); + DCHECK(priority); + optional_fields.priority = priority.value(); + + absl::optional<bool> pinned = notifObj->FindBool("richDataPinned"); + DCHECK(pinned); + optional_fields.pinned = pinned.value(); + + absl::optional<bool> renotify = notifObj->FindBool("richDataRenotify"); + DCHECK(renotify); + optional_fields.renotify = renotify.value(); + + absl::optional<bool> show_snooze = notifObj->FindBool("richDataShowSnooze"); + DCHECK(show_snooze); + optional_fields.should_show_snooze_button = show_snooze.value(); + + absl::optional<bool> show_settings = + notifObj->FindBool("richDataShowSettings"); + DCHECK(show_settings); + optional_fields.settings_button_handler = + show_settings.value() ? message_center::SettingsButtonHandler::INLINE + : message_center::SettingsButtonHandler::NONE; + + absl::optional<int> num_buttons = notifObj->FindInt("richDataNumButtons"); + DCHECK(num_buttons); + optional_fields.buttons = GetRichDataButtons(num_buttons.value()); + + // Set additional fields for specific notification types. + absl::optional<int> notification_type = notifObj->FindInt("notificationType"); + DCHECK(notification_type); + + if (notification_type == + message_center::NotificationType::NOTIFICATION_TYPE_PROGRESS) { + absl::optional<int> progress = notifObj->FindInt("richDataProgress"); + DCHECK(progress); + optional_fields.progress = progress.value(); + + const std::string* progress_status = + notifObj->FindString("richDataProgressStatus"); + DCHECK(progress_status); + optional_fields.progress_status = base::UTF8ToUTF16(*progress_status); + } else if (notification_type == + message_center::NotificationType::NOTIFICATION_TYPE_MULTIPLE) { + absl::optional<int> num_items = notifObj->FindInt("richDataNumNotifItems"); + DCHECK(num_items); + optional_fields.items = GetRichDataNotifItems(num_items.value()); + } + + return optional_fields; } } // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/notification_tester/notification_tester_handler.h b/chrome/browser/ui/webui/chromeos/notification_tester/notification_tester_handler.h index e282557..064ceab 100644 --- a/chrome/browser/ui/webui/chromeos/notification_tester/notification_tester_handler.h +++ b/chrome/browser/ui/webui/chromeos/notification_tester/notification_tester_handler.h
@@ -8,13 +8,20 @@ #include "content/public/browser/web_ui_message_handler.h" namespace gfx { +class Image; struct VectorIcon; } // namespace gfx namespace message_center { +struct ButtonInfo; +struct NotificationItem; class RichNotificationData; } // namespace message_center +namespace ui { +class ImageModel; +} // namespace ui + namespace chromeos { // WebUI message handler for chrome://notification-tester from the front-end to @@ -35,15 +42,32 @@ // message to generate a notification from the front-end. void HandleGenerateNotificationForm(const base::Value::List& args); - // Given the name of an icon such as 'kTerminalSshIcon', return the - // corresponding gfx::VectorIcon. - const gfx::VectorIcon& GetNotificationIcon(const std::string& icon); + // Given the name of an icon (string) within the notification tester + // resources, return the corresponding icon. + const ui::ImageModel GetNotificationIconFromString( + const std::string& icon_name); - // Given the name of an image within the notification tester resources, return - // the corresponding gfx::Image. - void SetNotificationImage( - const std::string& image, - message_center::RichNotificationData& optional_fields); + // Given the name of an image (string) within the notification tester + // resources, return the corresponding gfx::Image. + const gfx::Image GetRichDataImageFromString(const std::string& image_name); + + // Given the name of a small image (string) such as 'kTerminalSshIcon', + // return the corresponding gfx::VectorIcon. + const gfx::VectorIcon& GetRichDataSmallImageFromString( + const std::string& small_image_name); + + // Return a std::vector with 'num_buttons' ButtonInfo objects. + std::vector<message_center::ButtonInfo> GetRichDataButtons(int num_buttons); + + // Return a std::vector with 'num_items' NotificationItem structs. Used for + // NOTIFICATION_TYPE_MULTIPLE. + std::vector<message_center::NotificationItem> GetRichDataNotifItems( + int num_items); + + // Return a RichNotificationData object populated with the user-configured + // notification object from the front-end. + message_center::RichNotificationData DictToOptionalFields( + const base::Value::Dict* notifObj); }; } // namespace chromeos
diff --git a/chrome/browser/ui/webui/settings/chromeos/bluetooth_section.cc b/chrome/browser/ui/webui/settings/chromeos/bluetooth_section.cc index 870c9ac..acb7735 100644 --- a/chrome/browser/ui/webui/settings/chromeos/bluetooth_section.cc +++ b/chrome/browser/ui/webui/settings/chromeos/bluetooth_section.cc
@@ -162,7 +162,7 @@ pref_service_(pref_service), pref_change_registrar_(std::make_unique<PrefChangeRegistrar>()) { bool is_initialized = false; - if (base::FeatureList::IsEnabled(floss::features::kFlossEnabled)) { + if (floss::features::IsFlossEnabled()) { is_initialized = floss::FlossDBusManager::IsInitialized(); } else { is_initialized = bluez::BluezDBusManager::IsInitialized();
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index c536324..0f7583d 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -356,6 +356,7 @@ {"chromeColors", IDS_SETTINGS_CHROME_COLORS}, {"showHomeButton", IDS_SETTINGS_SHOW_HOME_BUTTON}, {"showBookmarksBar", IDS_SETTINGS_SHOW_BOOKMARKS_BAR}, + {"sidePanel", IDS_SETTINGS_SIDE_PANEL}, {"homePageNtp", IDS_SETTINGS_HOME_PAGE_NTP}, {"changeHomePage", IDS_SETTINGS_CHANGE_HOME_PAGE}, {"themesGalleryUrl", IDS_THEMES_GALLERY_URL}, @@ -371,6 +372,8 @@ {"minimumFont", IDS_SETTINGS_MINIMUM_FONT_SIZE_LABEL}, {"tiny", IDS_SETTINGS_TINY_FONT_SIZE}, {"huge", IDS_SETTINGS_HUGE_FONT_SIZE}, + {"sidePanelAlignLeft", IDS_SETTINGS_SIDE_PANEL_ALIGN_LEFT}, + {"sidePanelAlignRight", IDS_SETTINGS_SIDE_PANEL_ALIGN_RIGHT}, // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. #if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS) @@ -399,6 +402,9 @@ zoom::GetPresetZoomFactorsAsJSON()); html_source->AddBoolean("showReaderModeOption", dom_distiller::OfferReaderModeInSettings()); + html_source->AddBoolean( + "showSidePanelOptions", + base::FeatureList::IsEnabled(features::kUnifiedSidePanel)); // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete.
diff --git a/chrome/browser/web_applications/proto/web_app.proto b/chrome/browser/web_applications/proto/web_app.proto index df18dea8..fac1e6e 100644 --- a/chrome/browser/web_applications/proto/web_app.proto +++ b/chrome/browser/web_applications/proto/web_app.proto
@@ -344,5 +344,5 @@ // Contains customisations to the web app tab strip. Only present when the // display_mode is tabbed. - optional TabStripProto tab_strip = 57; + optional proto.TabStrip tab_strip = 57; }
diff --git a/chrome/browser/web_applications/proto/web_app_tab_strip.proto b/chrome/browser/web_applications/proto/web_app_tab_strip.proto index 216a57a..9dfc275e 100644 --- a/chrome/browser/web_applications/proto/web_app_tab_strip.proto +++ b/chrome/browser/web_applications/proto/web_app_tab_strip.proto
@@ -6,7 +6,7 @@ option optimize_for = LITE_RUNTIME; -package web_app; +package web_app.proto; message NewTabButtonParams { optional string url = 1; @@ -15,7 +15,7 @@ // A proto representing the "tab_strip" manifest field. // This mirrors ManifestTabStrip in: // third_party/blink/public/mojom/manifest/manifest.mojom -message TabStripProto { +message TabStrip { enum Visibility { AUTO = 0; ABSENT = 1;
diff --git a/chrome/browser/web_applications/web_app_database.cc b/chrome/browser/web_applications/web_app_database.cc index 90b7ba1..ebfa0ab 100644 --- a/chrome/browser/web_applications/web_app_database.cc +++ b/chrome/browser/web_applications/web_app_database.cc
@@ -249,22 +249,22 @@ } } -TabStripProto::Visibility TabStripVisibilityToProto( +proto::TabStrip::Visibility TabStripVisibilityToProto( TabStrip::Visibility visibility) { switch (visibility) { case TabStrip::Visibility::kAuto: - return TabStripProto_Visibility_AUTO; + return proto::TabStrip_Visibility_AUTO; case TabStrip::Visibility::kAbsent: - return TabStripProto_Visibility_ABSENT; + return proto::TabStrip_Visibility_ABSENT; } } TabStrip::Visibility ProtoToTabStripVisibility( - TabStripProto::Visibility visibility) { + proto::TabStrip::Visibility visibility) { switch (visibility) { - case TabStripProto_Visibility_AUTO: + case proto::TabStrip_Visibility_AUTO: return TabStrip::Visibility::kAuto; - case TabStripProto_Visibility_ABSENT: + case proto::TabStrip_Visibility_ABSENT: return TabStrip::Visibility::kAbsent; } }
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index cefd2ae..a634a3c 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1657195044-3da3f90aa1353824f081911d64c98f76df120c2d.profdata +chrome-mac-main-1657216488-3802952b982e7586a03ee3c25333016309d62186.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index b33eb4a..4f3ba80 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1657195044-193c962b3200db57362fb83e5aa3345b410bf261.profdata +chrome-win32-main-1657216488-a8c5fdc01bcc3053840f6798709fd8f47271c897.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 7305c13..2325736 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1657206003-8700049f94a1e67edaf33366fef93cd62e950a67.profdata +chrome-win64-main-1657227512-e426bd1bd9cb69b8348eeedd880ebb38b296177d.profdata
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index bb0d5d04..ebd99de 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc
@@ -1697,6 +1697,12 @@ const char kForceMajorVersionToMinorPositionInUserAgent[] = "force_major_version_to_minor_position_in_user_agent"; +#if (!BUILDFLAG(IS_ANDROID)) +// Boolean determining the side the side panel will be appear on (left / right). +// True when the side panel is aligned to the right. +const char kSidePanelHorizontalAlignment[] = "side_panel.is_right_aligned"; +#endif + // *************** LOCAL STATE *************** // These are attached to the machine/installation
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 37acb43..2729876 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h
@@ -1240,6 +1240,7 @@ #if !BUILDFLAG(IS_ANDROID) extern const char kLensRegionSearchEnabled[]; +extern const char kSidePanelHorizontalAlignment[]; #endif extern const char kPrivacyGuideViewed[];
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index fafd92e..f4ed5a6 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -5734,7 +5734,6 @@ "//components/reporting/encryption:test_support", "//components/reporting/encryption:testing_primitives", "//components/reporting/encryption:verification", - "//components/reporting/resources:resource_interface", "//components/reporting/storage:storage_uploader_interface", "//components/reporting/storage:test_support", "//components/reporting/util:backoff_settings", @@ -5777,6 +5776,7 @@ "//components/services/app_service/public/cpp:run_on_os_login", "//components/services/paint_preview_compositor/public/mojom", "//components/services/patch/content", + "//components/services/storage/public/cpp:prefs", "//components/services/unzip/content", "//components/site_engagement/content", "//components/site_engagement/core", @@ -7450,10 +7450,12 @@ } if (enable_spellcheck) { - sources += [ - "../browser/spellchecker/spellcheck_custom_dictionary_unittest.cc", - "../browser/spellchecker/spellcheck_language_policy_handlers_unittest.cc", - ] + sources += + [ "../browser/spellchecker/spellcheck_custom_dictionary_unittest.cc" ] + + if (is_chromeos || is_linux || is_win) { + sources += [ "../browser/spellchecker/spellcheck_language_policy_handlers_unittest.cc" ] + } if (is_mac) { sources += [ @@ -8467,6 +8469,7 @@ "../browser/ui/views/send_tab_to_self/send_tab_to_self_toolbar_bubble_view_unittest.cc", "../browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble_unittest.cc", "../browser/ui/views/side_panel/read_anything/read_anything_coordinator_unittest.cc", + "../browser/ui/views/side_panel/read_anything/read_anything_model_unittest.cc", "../browser/ui/views/side_panel/side_panel_coordinator_unittest.cc", "../browser/ui/views/side_panel/user_note/user_note_ui_coordinator_unittest.cc", "../browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views_unittest.cc", @@ -9091,6 +9094,7 @@ "../browser/ui/views/page_info/page_info_bubble_view_interactive_uitest.cc", "../browser/ui/views/privacy_sandbox/privacy_sandbox_dialog_view_interactive_ui_test.cc", "../browser/ui/views/privacy_sandbox/privacy_sandbox_notice_bubble_interactive_ui_test.cc", + "../browser/ui/views/side_panel/read_anything/read_anything_toolbar_view_browsertest.cc", "../browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_interactive_uitest.cc", "../browser/ui/views/web_dialog_view_browsertest.cc", "../browser/ui/webui/settings/settings_interactive_uitest.cc",
diff --git a/chrome/test/data/extensions/api_test/browser_action/popup_with_fencedframe/manifest.json b/chrome/test/data/extensions/api_test/browser_action/popup_with_fencedframe/manifest.json new file mode 100644 index 0000000..cb11e6c --- /dev/null +++ b/chrome/test/data/extensions/api_test/browser_action/popup_with_fencedframe/manifest.json
@@ -0,0 +1,9 @@ +{ + "name": "Popup with fenced frame", + "version": "0.1", + "manifest_version": 2, + "description": "Test a browser action popup with a fenced frame", + "browser_action": { + "default_popup": "popup.html" + } +}
diff --git a/chrome/test/data/extensions/api_test/browser_action/popup_with_fencedframe/popup.html b/chrome/test/data/extensions/api_test/browser_action/popup_with_fencedframe/popup.html new file mode 100644 index 0000000..458c155 --- /dev/null +++ b/chrome/test/data/extensions/api_test/browser_action/popup_with_fencedframe/popup.html
@@ -0,0 +1,10 @@ +<html> +<head> + <script src="popup.js"></script> +</head> +<body> + <div>This popup contains a fenced frame.</div> + <fencedframe name="child_frame" src="about:blank"></fencedframe> +</body> +</html> +
diff --git a/chrome/test/data/extensions/api_test/browser_action/popup_with_fencedframe/popup.js b/chrome/test/data/extensions/api_test/browser_action/popup_with_fencedframe/popup.js new file mode 100644 index 0000000..88ddd0c --- /dev/null +++ b/chrome/test/data/extensions/api_test/browser_action/popup_with_fencedframe/popup.js
@@ -0,0 +1,7 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +window.addEventListener('load', function() { + chrome.test.notifyPass(); +}, false);
diff --git a/chrome/test/data/extensions/api_test/simple_all_urls/manifest.json b/chrome/test/data/extensions/api_test/simple_all_urls/manifest.json new file mode 100644 index 0000000..26cbcab --- /dev/null +++ b/chrome/test/data/extensions/api_test/simple_all_urls/manifest.json
@@ -0,0 +1,6 @@ +{ + "name": "All Urls Extension", + "manifest_version": 3, + "version": "0.1", + "host_permissions": ["<all_urls>"] +}
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index 981b7e3..b467157 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json
@@ -18444,7 +18444,6 @@ "policies": {}, "prefs": { "policy.web_sql_access": { - "location": "local_state", "default_value": false } } @@ -18453,7 +18452,6 @@ "policies": { "WebSQLAccess": false }, "prefs": { "policy.web_sql_access": { - "location": "local_state", "value": false } } @@ -18462,7 +18460,6 @@ "policies": { "WebSQLAccess": true }, "prefs": { "policy.web_sql_access": { - "location": "local_state", "value": true } } @@ -18701,5 +18698,41 @@ } } ] + }, + "WebSQLNonSecureContextEnabled": { + "os": [ + "win", + "linux", + "mac", + "chromeos_ash", + "chromeos_lacros", + "android" + ], + "policy_pref_mapping_tests": [ + { + "policies": {}, + "prefs": { + "policy.web_sql_non_secure_context_enabled": { + "default_value": false + } + } + }, + { + "policies": { "WebSQLNonSecureContextEnabled": false }, + "prefs": { + "policy.web_sql_non_secure_context_enabled": { + "value": false + } + } + }, + { + "policies": { "WebSQLNonSecureContextEnabled": true }, + "prefs": { + "policy.web_sql_non_secure_context_enabled": { + "value": true + } + } + } + ] } }
diff --git a/chrome/test/data/popup_fencedframe.html b/chrome/test/data/popup_fencedframe.html new file mode 100644 index 0000000..8578744 --- /dev/null +++ b/chrome/test/data/popup_fencedframe.html
@@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html> +<head> +<script> +window.onload = function() { + domAutomationController.send("DONE"); +} +</script> +</head> +<body>fenced frame test</body> +</html>
diff --git a/chrome/test/data/popup_fencedframe.html.mock-http-headers b/chrome/test/data/popup_fencedframe.html.mock-http-headers new file mode 100644 index 0000000..263e89c4 --- /dev/null +++ b/chrome/test/data/popup_fencedframe.html.mock-http-headers
@@ -0,0 +1,2 @@ +HTTP/1.1 200 OK +Supports-Loading-Mode: fenced-frame \ No newline at end of file
diff --git a/chrome/test/data/webui/cr_components/help_bubble_mixin_test.ts b/chrome/test/data/webui/cr_components/help_bubble_mixin_test.ts index 0f41ab8..3b1df79 100644 --- a/chrome/test/data/webui/cr_components/help_bubble_mixin_test.ts +++ b/chrome/test/data/webui/cr_components/help_bubble_mixin_test.ts
@@ -17,6 +17,7 @@ const TITLE_NATIVE_ID: string = 'kHelpBubbleMixinTestTitleElementId'; const PARAGRAPH_NATIVE_ID: string = 'kHelpBubbleMixinTestParagraphElementId'; const LIST_NATIVE_ID: string = 'kHelpBubbleMixinTestListElementId'; +const CLOSE_BUTTON_ALT_TEXT: string = 'Close help bubble.'; const HelpBubbleMixinTestElementBase = HelpBubbleMixin(PolymerElement) as { new (): PolymerElement & HelpBubbleMixinInterface, @@ -58,7 +59,7 @@ getHelpBubbleFor(anchorId: string): HelpBubbleElement|null { - return this.shadowRoot!.querySelector<HelpBubbleElement>( + return this.shadowRoot!.querySelector( `help-bubble[anchor-id='${anchorId}']`); } } @@ -127,6 +128,19 @@ let testProxy: TestHelpBubbleProxy; let container: HelpBubbleMixinTestElement; + /** + * Waits for the current frame to render, which queues intersection events, + * and then waits for the intersection events to propagate to listeners, which + * triggers visibility messages. + * + * This takes a total of two frames. A single frame will cause the layout to + * be updated, but will not actually propagate the events. + */ + async function waitForVisibilityEvents() { + await waitAfterNextRender(container); + return waitAfterNextRender(container); + } + setup(() => { testProxy = new TestHelpBubbleProxy(); HelpBubbleProxyImpl.setInstance(testProxy); @@ -134,7 +148,7 @@ document.body.innerHTML = ''; container = document.createElement('help-bubble-mixin-test-element'); document.body.appendChild(container); - return waitAfterNextRender(container); + return waitForVisibilityEvents(); }); test('help bubble mixin reports bubble closed', () => { @@ -143,6 +157,7 @@ const defaultParams: HelpBubbleParams = new HelpBubbleParams(); defaultParams.nativeIdentifier = PARAGRAPH_NATIVE_ID; + defaultParams.closeButtonAltText = CLOSE_BUTTON_ALT_TEXT; defaultParams.position = HelpBubblePosition.ABOVE; defaultParams.bodyText = 'This is a help bubble.'; defaultParams.buttons = []; @@ -207,6 +222,16 @@ assertTrue(isVisible(bubble)); }); + test('help bubble mixin uses close button alt text', async () => { + testProxy.getCallbackRouterRemote().showHelpBubble(defaultParams); + await waitAfterNextRender(container); + assertTrue(container.isHelpBubbleShowing()); + const bubble = container.getHelpBubbleFor('p1')!; + const closeButton = bubble.shadowRoot!.querySelector<HTMLElement>('#close'); + assertTrue(!!closeButton); + assertEquals(CLOSE_BUTTON_ALT_TEXT, closeButton.getAttribute('aria-label')); + }); + test( 'help bubble mixin hides help bubble when called via proxy', async () => { testProxy.getCallbackRouterRemote().showHelpBubble(defaultParams); @@ -232,6 +257,7 @@ async () => { const params: HelpBubbleParams = new HelpBubbleParams(); params.nativeIdentifier = 'This is an unregistered identifier'; + params.closeButtonAltText = CLOSE_BUTTON_ALT_TEXT; params.position = HelpBubblePosition.ABOVE; params.bodyText = 'This is a help bubble.'; params.buttons = []; @@ -278,16 +304,8 @@ }); test('help bubble mixin sends event on lost visibility', async () => { - // Already waited for the container to render, but intersection events won't - // be sent until the following frame. - await waitAfterNextRender(container); - container.style.display = 'none'; - - // The same applies here. - await waitAfterNextRender(container); - await waitAfterNextRender(container); - + await waitForVisibilityEvents(); assertEquals( 6, testProxy.getHandler().getCallCount( @@ -307,17 +325,11 @@ test( 'help bubble mixin sends event on closed due to anchor losing visibility', async () => { - // Already waited for the container to render, but intersection events - // won't be sent until the following frame. - await waitAfterNextRender(container); container.showHelpBubble('p1', defaultParams); // Hiding the container will cause the bubble to be closed. container.$.p1.style.display = 'none'; - - // The same applies here. - await waitAfterNextRender(container); - await waitAfterNextRender(container); + await waitForVisibilityEvents(); assertEquals( 1, testProxy.getHandler().getCallCount('helpBubbleClosed')); @@ -327,22 +339,14 @@ assertFalse(container.isHelpBubbleShowing()); }); - test( 'help bubble mixin does not send event when non-anchor loses visibility', async () => { - // Already waited for the container to render, but intersection events - // won't be sent until the following frame. - await waitAfterNextRender(container); container.showHelpBubble('p1', defaultParams); // This is not the current bubble anchor, so should not send an event. container.$.title.style.display = 'none'; - - // The same applies here. - await waitAfterNextRender(container); - await waitAfterNextRender(container); - + await waitForVisibilityEvents(); assertEquals( 0, testProxy.getHandler().getCallCount('helpBubbleClosed')); assertTrue(container.isHelpBubbleShowing()); @@ -367,8 +371,10 @@ const secondParams: HelpBubbleParams = new HelpBubbleParams(); secondParams.nativeIdentifier = TITLE_NATIVE_ID; + secondParams.closeButtonAltText = CLOSE_BUTTON_ALT_TEXT; secondParams.position = HelpBubblePosition.BELOW; secondParams.bodyText = 'This is another help bubble.'; + secondParams.titleText = 'This is a title'; secondParams.buttons = []; test('help bubble mixin shows multiple bubbles', async () => { @@ -387,6 +393,21 @@ assertTrue(isVisible(bubble2)); }); + test('help bubble mixin shows bubbles with and without title', async () => { + testProxy.getCallbackRouterRemote().showHelpBubble(defaultParams); + await waitAfterNextRender(container); + testProxy.getCallbackRouterRemote().showHelpBubble(secondParams); + await waitAfterNextRender(container); + assertTrue(container.isHelpBubbleShowing()); + const titleBubble = container.getHelpBubbleFor('title')!; + const paragraphBubble = container.getHelpBubbleFor('p1')!; + // Testing that setting `titleText` will cause the title to display + // correctly is present in help_bubble_test.ts, so it is sufficient to + // verify that the property is set correctly. + assertEquals('', paragraphBubble.titleText); + assertEquals(secondParams.titleText, titleBubble.titleText); + }); + test('help bubble mixin hides multiple bubbles', async () => { testProxy.getCallbackRouterRemote().showHelpBubble(defaultParams); await waitAfterNextRender(container); @@ -409,4 +430,17 @@ assertEquals(null, container.getHelpBubbleFor('title')); assertEquals(null, container.getHelpBubbleFor('p1')); }); + + test('help bubble mixin sends event on closed via button', async () => { + container.showHelpBubble('p1', defaultParams); + + // Click the close button. + container.shadowRoot!.querySelector('help-bubble')!.$.close.click(); + await waitForVisibilityEvents(); + assertEquals(1, testProxy.getHandler().getCallCount('helpBubbleClosed')); + assertDeepEquals( + [[PARAGRAPH_NATIVE_ID, true]], + testProxy.getHandler().getArgs('helpBubbleClosed')); + assertFalse(container.isHelpBubbleShowing()); + }); });
diff --git a/chrome/test/data/webui/cr_components/help_bubble_test.ts b/chrome/test/data/webui/cr_components/help_bubble_test.ts index 6068ee0d..f9d14f7 100644 --- a/chrome/test/data/webui/cr_components/help_bubble_test.ts +++ b/chrome/test/data/webui/cr_components/help_bubble_test.ts
@@ -5,7 +5,7 @@ import 'chrome://webui-test/mojo_webui_test_support.js'; import 'chrome://resources/cr_components/help_bubble/help_bubble.js'; -import {HelpBubbleElement} from 'chrome://resources/cr_components/help_bubble/help_bubble.js'; +import {HelpBubbleDismissedEventDetail, HelpBubbleElement} from 'chrome://resources/cr_components/help_bubble/help_bubble.js'; import {HelpBubblePosition} from 'chrome://resources/cr_components/help_bubble/help_bubble.mojom-webui.js'; import {assertEquals, assertFalse, assertTrue} from 'chrome://webui-test/chai_assert.js'; import {isVisible} from 'chrome://webui-test/test_util.js'; @@ -35,27 +35,49 @@ }); const HELP_BUBBLE_BODY = 'help bubble body'; + const HELP_BUBBLE_TITLE = 'help bubble title'; test('help bubble shows and anchors correctly', () => { helpBubble.anchorId = 'p1'; helpBubble.position = HelpBubblePosition.BELOW; - helpBubble.body = HELP_BUBBLE_BODY; + helpBubble.bodyText = HELP_BUBBLE_BODY; helpBubble.show(); assertEquals( document.querySelector<HTMLElement>('#p1'), helpBubble.getAnchorElement()); - assertEquals( - HELP_BUBBLE_BODY, - helpBubble.shadowRoot!.querySelector<HTMLElement>( - 'div.body')!.textContent); + assertEquals(HELP_BUBBLE_BODY, helpBubble.$.body.textContent); assertTrue(isVisible(helpBubble)); }); + test('help bubble titles shows', () => { + helpBubble.anchorId = 'p1'; + helpBubble.position = HelpBubblePosition.BELOW; + helpBubble.bodyText = HELP_BUBBLE_BODY; + helpBubble.titleText = HELP_BUBBLE_TITLE; + helpBubble.show(); + + assertTrue(isVisible(helpBubble)); + const titleElement = helpBubble.$.title; + assertEquals(HELP_BUBBLE_TITLE, titleElement.textContent); + assertTrue(isVisible(titleElement)); + }); + + test('help bubble titles hides when no title set', () => { + helpBubble.anchorId = 'p1'; + helpBubble.position = HelpBubblePosition.BELOW; + helpBubble.bodyText = HELP_BUBBLE_BODY; + helpBubble.show(); + + assertTrue(isVisible(helpBubble)); + const titleElement = helpBubble.$.title; + assertFalse(isVisible(titleElement)); + }); + test('help bubble closes', () => { helpBubble.anchorId = 'title'; helpBubble.position = HelpBubblePosition.BELOW; - helpBubble.body = HELP_BUBBLE_BODY; + helpBubble.bodyText = HELP_BUBBLE_BODY; helpBubble.show(); assertEquals( @@ -70,17 +92,38 @@ test('help bubble open close open', () => { helpBubble.anchorId = 'title'; helpBubble.position = HelpBubblePosition.BELOW; - helpBubble.body = HELP_BUBBLE_BODY; + helpBubble.bodyText = HELP_BUBBLE_BODY; helpBubble.show(); helpBubble.hide(); helpBubble.show(); assertEquals( document.querySelector<HTMLElement>('#title'), helpBubble.getAnchorElement()); - assertEquals( - HELP_BUBBLE_BODY, - helpBubble.shadowRoot!.querySelector<HTMLElement>( - 'div.body')!.textContent); + assertEquals(HELP_BUBBLE_BODY, helpBubble.$.body.textContent); assertTrue(isVisible(helpBubble)); }); + + test('help bubble close button has correct alt text', () => { + const CLOSE_TEXT: string = 'Close button text.'; + helpBubble.closeText = CLOSE_TEXT; + assertEquals(CLOSE_TEXT, helpBubble.$.close.getAttribute('aria-label')); + }); + + test('help bubble click close button generates event', () => { + let clicked: number = 0; + const callback = (e: CustomEvent<HelpBubbleDismissedEventDetail>) => { + assertEquals('title', e.detail.anchorId); + assertFalse(e.detail.fromActionButton); + ++clicked; + }; + helpBubble.addEventListener('help-bubble-dismissed', callback); + helpBubble.anchorId = 'title'; + helpBubble.position = HelpBubblePosition.BELOW; + helpBubble.bodyText = HELP_BUBBLE_BODY; + helpBubble.show(); + const closeButton = helpBubble.$.close; + assertEquals(0, clicked); + closeButton.click(); + assertEquals(1, clicked); + }); });
diff --git a/chrome/test/data/webui/settings/appearance_page_test.ts b/chrome/test/data/webui/settings/appearance_page_test.ts index 5d6e573..aebc0ab 100644 --- a/chrome/test/data/webui/settings/appearance_page_test.ts +++ b/chrome/test/data/webui/settings/appearance_page_test.ts
@@ -7,6 +7,7 @@ import { AppearanceBrowserProxy, AppearanceBrowserProxyImpl,HomeUrlInputElement, SettingsAppearancePageElement} from 'chrome://settings/settings.js'; import { assertEquals,assertFalse, assertTrue} from 'chrome://webui-test/chai_assert.js'; import {TestBrowserProxy} from 'chrome://webui-test/test_browser_proxy.js'; +import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; // clang-format on class TestAppearanceBrowserProxy extends TestBrowserProxy implements @@ -279,7 +280,8 @@ }); test('show home button toggling', function() { - assertFalse(!!appearancePage.shadowRoot!.querySelector('.list-frame')); + assertFalse( + !!appearancePage.shadowRoot!.querySelector('#home-button-options')); appearancePage.set('prefs', { autogenerated: {theme: {policy: {color: {value: 0}}}}, browser: {show_home_button: {value: true}}, @@ -287,8 +289,24 @@ }); flush(); - assertTrue(!!appearancePage.shadowRoot!.querySelector('.list-frame')); + assertTrue( + !!appearancePage.shadowRoot!.querySelector('#home-button-options')); }); + + test('show side panel options', function() { + loadTimeData.overrideValues({ + showSidePanelOptions: true, + }); + createAppearancePage(); + assertTrue(!!appearancePage.shadowRoot!.querySelector('#side-panel')); + + loadTimeData.overrideValues({ + showSidePanelOptions: false, + }); + createAppearancePage(); + assertFalse(!!appearancePage.shadowRoot!.querySelector('#side-panel')); + }); + }); suite('HomeUrlInput', function() {
diff --git a/chrome/updater/app/server/win/com_classes_legacy.cc b/chrome/updater/app/server/win/com_classes_legacy.cc index 3ec12fae..1fb7a36 100644 --- a/chrome/updater/app/server/win/com_classes_legacy.cc +++ b/chrome/updater/app/server/win/com_classes_legacy.cc
@@ -48,62 +48,6 @@ return proc_handle.IsValid() ? S_OK : updater::HRESULTFromLastError(); } -std::wstring GetCommandToLaunch(const WCHAR* app_guid, const WCHAR* cmd_id) { - if (!app_guid || !cmd_id) - return std::wstring(); - - base::win::RegKey key(HKEY_LOCAL_MACHINE, CLIENTS_KEY, - updater::Wow6432(KEY_READ)); - if (key.OpenKey(app_guid, updater::Wow6432(KEY_READ)) != ERROR_SUCCESS) - return std::wstring(); - - std::wstring cmd_line; - key.ReadValue(cmd_id, &cmd_line); - return cmd_line; -} - -HRESULT LaunchCmd(const std::wstring& cmd, - const base::win::ScopedHandle& caller_proc_handle, - ULONG_PTR* proc_handle) { - if (cmd.empty() || !caller_proc_handle.IsValid() || !proc_handle) - return E_INVALIDARG; - - *proc_handle = NULL; - - STARTUPINFOW startup_info = {sizeof(startup_info)}; - PROCESS_INFORMATION process_information = {0}; - std::wstring cmd_line(cmd); - if (!::CreateProcess(nullptr, &cmd_line[0], nullptr, nullptr, FALSE, - CREATE_NO_WINDOW, nullptr, nullptr, &startup_info, - &process_information)) { - return updater::HRESULTFromLastError(); - } - - base::win::ScopedProcessInformation pi(process_information); - DCHECK(pi.IsValid()); - - HANDLE duplicate_proc_handle = NULL; - - bool res = ::DuplicateHandle( - ::GetCurrentProcess(), // Current process. - pi.process_handle(), // Process handle to duplicate. - caller_proc_handle.Get(), // Process receiving the handle. - &duplicate_proc_handle, // Duplicated handle. - PROCESS_QUERY_INFORMATION | - SYNCHRONIZE, // Access requested for the new handle. - FALSE, // Don't inherit the new handle. - 0) != 0; // Flags. - if (!res) { - HRESULT hr = updater::HRESULTFromLastError(); - VLOG(1) << "Failed to duplicate the handle " << hr; - return hr; - } - - // The caller must close this handle. - *proc_handle = reinterpret_cast<ULONG_PTR>(duplicate_proc_handle); - return S_OK; -} - // Extracts a string from a VARIANT if the VARIANT is VT_BSTR or VT_BSTR | // VT_BYREF. Returns absl::nullopt if the VARIANT is not a BSTR. absl::optional<std::wstring> StringFromVariant(const VARIANT& source) { @@ -522,34 +466,41 @@ } STDMETHODIMP LegacyProcessLauncherImpl::LaunchCmdElevated( - const WCHAR* app_guid, - const WCHAR* cmd_id, + const WCHAR* app_id, + const WCHAR* command_id, DWORD caller_proc_id, ULONG_PTR* proc_handle) { - VLOG(2) << "LegacyProcessLauncherImpl::LaunchCmdElevated: app " << app_guid - << ", cmd_id " << cmd_id << ", pid " << caller_proc_id; - - if (!cmd_id || !wcslen(cmd_id) || !proc_handle) { - VLOG(1) << "Invalid arguments"; - return E_INVALIDARG; + AppCommandRunner app_command_runner; + if (HRESULT hr = AppCommandRunner::LoadAppCommand( + UpdaterScope::kSystem, app_id, command_id, app_command_runner); + FAILED(hr)) { + return hr; } base::win::ScopedHandle caller_proc_handle; - HRESULT hr = OpenCallerProcessHandle(caller_proc_id, caller_proc_handle); - if (FAILED(hr)) { + if (HRESULT hr = OpenCallerProcessHandle(caller_proc_id, caller_proc_handle); + FAILED(hr)) { VLOG(1) << "failed to open caller's handle " << hr; return hr; } - std::wstring cmd = GetCommandToLaunch(app_guid, cmd_id); - if (cmd.empty()) { - VLOG(1) << "cmd not found"; - return HRESULT_FROM_WIN32(ERROR_NOT_FOUND); + base::Process process; + if (HRESULT hr = app_command_runner.Run({}, process); FAILED(hr)) { + return hr; } - VLOG(2) << "[LegacyProcessLauncherImpl::LaunchCmdElevated][cmd " << cmd - << "]"; - return LaunchCmd(cmd, caller_proc_handle, proc_handle); + HANDLE duplicate_proc_handle = NULL; + if (!::DuplicateHandle(::GetCurrentProcess(), process.Handle(), + caller_proc_handle.Get(), &duplicate_proc_handle, + PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, 0)) { + HRESULT hr = HRESULTFromLastError(); + VLOG(1) << "Failed to duplicate the handle " << hr; + return hr; + } + + // The caller must close this handle. + *proc_handle = reinterpret_cast<ULONG_PTR>(duplicate_proc_handle); + return S_OK; } STDMETHODIMP LegacyProcessLauncherImpl::LaunchCmdLineEx(
diff --git a/chrome/updater/app/server/win/com_classes_legacy.h b/chrome/updater/app/server/win/com_classes_legacy.h index f033f57..b2d64bb 100644 --- a/chrome/updater/app/server/win/com_classes_legacy.h +++ b/chrome/updater/app/server/win/com_classes_legacy.h
@@ -167,8 +167,8 @@ // Overrides for IProcessLauncher/IProcessLauncher2. IFACEMETHODIMP LaunchCmdLine(const WCHAR* cmd_line) override; IFACEMETHODIMP LaunchBrowser(DWORD browser_type, const WCHAR* url) override; - IFACEMETHODIMP LaunchCmdElevated(const WCHAR* app_guid, - const WCHAR* cmd_id, + IFACEMETHODIMP LaunchCmdElevated(const WCHAR* app_id, + const WCHAR* command_id, DWORD caller_proc_id, ULONG_PTR* proc_handle) override; IFACEMETHODIMP LaunchCmdLineEx(const WCHAR* cmd_line,
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 5959ca1..736ebc2 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -14959.0.0 \ No newline at end of file +14960.0.0
diff --git a/chromeos/ash/services/assistant/platform/audio_devices.cc b/chromeos/ash/services/assistant/platform/audio_devices.cc index 41f7ad2..086ab85 100644 --- a/chromeos/ash/services/assistant/platform/audio_devices.cc +++ b/chromeos/ash/services/assistant/platform/audio_devices.cc
@@ -99,6 +99,7 @@ continue; switch (device.type) { + case chromeos::AudioDeviceType::kMic: case chromeos::AudioDeviceType::kUsb: case chromeos::AudioDeviceType::kHeadphone: case chromeos::AudioDeviceType::kInternalMic:
diff --git a/chromeos/ash/services/assistant/platform/audio_devices_unittest.cc b/chromeos/ash/services/assistant/platform/audio_devices_unittest.cc index 804cf002..6c207c6 100644 --- a/chromeos/ash/services/assistant/platform/audio_devices_unittest.cc +++ b/chromeos/ash/services/assistant/platform/audio_devices_unittest.cc
@@ -155,6 +155,16 @@ EXPECT_EQ("<none>", observer.preferred_device_id()); } +TEST_F(AssistantAudioDevicesTest, ShouldSendMicDeviceToObserver) { + FakeAudioDevicesObserver observer; + audio_devices().AddAndFireObserver(&observer); + + UpdateDeviceList({DeviceBuilder(AudioDeviceType::kMic).WithId(221).Build()}); + + EXPECT_EQ("<none>", observer.hotword_device_id()); + EXPECT_EQ("221", observer.preferred_device_id()); +} + TEST_F(AssistantAudioDevicesTest, ShouldSendUsbDeviceToObserver) { FakeAudioDevicesObserver observer; audio_devices().AddAndFireObserver(&observer); @@ -198,6 +208,16 @@ EXPECT_EQ("555", observer.preferred_device_id()); } +TEST_F(AssistantAudioDevicesTest, ShouldNotSendHdmiDeviceToObserver) { + FakeAudioDevicesObserver observer; + audio_devices().AddAndFireObserver(&observer); + + UpdateDeviceList({DeviceBuilder(AudioDeviceType::kHdmi).WithId(999).Build()}); + + EXPECT_EQ("<none>", observer.hotword_device_id()); + EXPECT_EQ("<none>", observer.preferred_device_id()); +} + TEST_F(AssistantAudioDevicesTest, ShouldUseHighestPriorityHotwordDevice) { FakeAudioDevicesObserver observer; audio_devices().AddAndFireObserver(&observer);
diff --git a/chromeos/crosapi/mojom/crosapi.mojom b/chromeos/crosapi/mojom/crosapi.mojom index 174613d..2b5498a 100644 --- a/chromeos/crosapi/mojom/crosapi.mojom +++ b/chromeos/crosapi/mojom/crosapi.mojom
@@ -830,8 +830,8 @@ // If ash-chrome is newer than the browser, then some fields may not be // processed by the browser. // -// Next version: 46 -// Next id: 46 +// Next version: 47 +// Next id: 47 [Stable, RenamedFrom="crosapi.mojom.LacrosInitParams"] struct BrowserInitParams { // This is ash-chrome's version of the Crosapi interface. This is used by @@ -1116,6 +1116,10 @@ // printing. This corresponds to the USE_CUPS flag being enabled in ash. [MinVersion=45] bool use_cups_for_printing@45; + + // Tells lacros whether ash uses floss for bluetooth. + [MinVersion=46] + bool use_floss_bluetooth@46; }; // Parameters to specify OpenUrl behavior.
diff --git a/chromeos/dbus/arc/arc_data_snapshotd_client.cc b/chromeos/dbus/arc/arc_data_snapshotd_client.cc index 8775ac2..fc4dca2 100644 --- a/chromeos/dbus/arc/arc_data_snapshotd_client.cc +++ b/chromeos/dbus/arc/arc_data_snapshotd_client.cc
@@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/memory/weak_ptr.h" #include "base/threading/thread_task_runner_handle.h" +#include "chromeos/dbus/arc/fake_arc_data_snapshotd_client.h" #include "dbus/bus.h" #include "dbus/message.h" #include "third_party/cros_system_api/dbus/arc-data-snapshotd/dbus-constants.h" @@ -19,6 +20,8 @@ namespace { +ArcDataSnapshotdClient* g_instance = nullptr; + void OnBoolMethodCallback(VoidDBusMethodCallback callback, dbus::Response* response) { if (!response) { @@ -142,7 +145,6 @@ proxy_->WaitForServiceToBeAvailable(std::move(callback)); } - protected: void Init(dbus::Bus* bus) override { proxy_ = bus->GetObjectProxy( arc::data_snapshotd::kArcDataSnapshotdServiceName, @@ -184,12 +186,36 @@ } // namespace -ArcDataSnapshotdClient::ArcDataSnapshotdClient() = default; +// static +ArcDataSnapshotdClient* ArcDataSnapshotdClient::Get() { + return g_instance; +} -ArcDataSnapshotdClient::~ArcDataSnapshotdClient() = default; +// static +void ArcDataSnapshotdClient::Initialize(dbus::Bus* bus) { + CHECK(bus); + (new ArcDataSnapshotdClientImpl())->Init(bus); +} -std::unique_ptr<ArcDataSnapshotdClient> ArcDataSnapshotdClient::Create() { - return std::make_unique<ArcDataSnapshotdClientImpl>(); +// static +void ArcDataSnapshotdClient::InitializeFake() { + (new FakeArcDataSnapshotdClient())->Init(nullptr); +} + +// static +void ArcDataSnapshotdClient::Shutdown() { + CHECK(g_instance); + delete g_instance; +} + +ArcDataSnapshotdClient::ArcDataSnapshotdClient() { + CHECK(!g_instance); + g_instance = this; +} + +ArcDataSnapshotdClient::~ArcDataSnapshotdClient() { + CHECK_EQ(g_instance, this); + g_instance = nullptr; } } // namespace chromeos
diff --git a/chromeos/dbus/arc/arc_data_snapshotd_client.h b/chromeos/dbus/arc/arc_data_snapshotd_client.h index 127079d..cf284be 100644 --- a/chromeos/dbus/arc/arc_data_snapshotd_client.h +++ b/chromeos/dbus/arc/arc_data_snapshotd_client.h
@@ -20,7 +20,17 @@ class COMPONENT_EXPORT(CHROMEOS_DBUS_ARC) ArcDataSnapshotdClient : public DBusClient { public: - ~ArcDataSnapshotdClient() override; + // Returns the global instance if initialized. May return null. + static ArcDataSnapshotdClient* Get(); + + // Creates and initializes the global instance. |bus| must not be null. + static void Initialize(dbus::Bus* bus); + + // Creates and initializes a fake global instance. + static void InitializeFake(); + + // Destroys the global instance if it has been initialized. + static void Shutdown(); ArcDataSnapshotdClient(const ArcDataSnapshotdClient&) = delete; ArcDataSnapshotdClient& operator=(const ArcDataSnapshotdClient&) = delete; @@ -67,8 +77,9 @@ dbus::ObjectProxy::WaitForServiceToBeAvailableCallback callback) = 0; protected: - // Create() should be used instead. + // Initialize() should be used instead. ArcDataSnapshotdClient(); + ~ArcDataSnapshotdClient() override; }; } // namespace chromeos
diff --git a/chromeos/dbus/arc/arc_keymaster_client.cc b/chromeos/dbus/arc/arc_keymaster_client.cc index 4f02b6e..f469af3a 100644 --- a/chromeos/dbus/arc/arc_keymaster_client.cc +++ b/chromeos/dbus/arc/arc_keymaster_client.cc
@@ -1,6 +1,7 @@ // Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. + #include "chromeos/dbus/arc/arc_keymaster_client.h" #include <memory> @@ -9,6 +10,7 @@ #include "base/bind.h" #include "base/callback.h" #include "base/callback_helpers.h" +#include "chromeos/dbus/arc/fake_arc_keymaster_client.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_proxy.h" @@ -18,6 +20,8 @@ namespace { +ArcKeymasterClient* g_instance = nullptr; + void OnVoidDBusMethod(VoidDBusMethodCallback callback, dbus::Response* response) { std::move(callback).Run(response != nullptr); @@ -44,7 +48,6 @@ base::BindOnce(&OnVoidDBusMethod, std::move(callback))); } - protected: void Init(dbus::Bus* bus) override { proxy_ = bus->GetObjectProxy( arc::keymaster::kArcKeymasterServiceName, @@ -61,12 +64,36 @@ //////////////////////////////////////////////////////////////////////////////// // ArcKeymasterClient -ArcKeymasterClient::ArcKeymasterClient() = default; -ArcKeymasterClient::~ArcKeymasterClient() = default; +// static +ArcKeymasterClient* ArcKeymasterClient::Get() { + return g_instance; +} // static -std::unique_ptr<ArcKeymasterClient> ArcKeymasterClient::Create() { - return std::make_unique<ArcKeymasterClientImpl>(); +void ArcKeymasterClient::Initialize(dbus::Bus* bus) { + CHECK(bus); + (new ArcKeymasterClientImpl())->Init(bus); +} + +// static +void ArcKeymasterClient::InitializeFake() { + (new FakeArcKeymasterClient())->Init(nullptr); +} + +// static +void ArcKeymasterClient::Shutdown() { + CHECK(g_instance); + delete g_instance; +} + +ArcKeymasterClient::ArcKeymasterClient() { + CHECK(!g_instance); + g_instance = this; +} + +ArcKeymasterClient::~ArcKeymasterClient() { + CHECK_EQ(g_instance, this); + g_instance = nullptr; } } // namespace chromeos
diff --git a/chromeos/dbus/arc/arc_keymaster_client.h b/chromeos/dbus/arc/arc_keymaster_client.h index f756d425..ea91a1b 100644 --- a/chromeos/dbus/arc/arc_keymaster_client.h +++ b/chromeos/dbus/arc/arc_keymaster_client.h
@@ -5,10 +5,6 @@ #ifndef CHROMEOS_DBUS_ARC_ARC_KEYMASTER_CLIENT_H_ #define CHROMEOS_DBUS_ARC_ARC_KEYMASTER_CLIENT_H_ -#include <memory> -#include <string> - -#include "base/callback_forward.h" #include "base/files/scoped_file.h" #include "chromeos/dbus/common/dbus_client.h" #include "chromeos/dbus/common/dbus_method_call_status.h" @@ -20,22 +16,30 @@ class COMPONENT_EXPORT(CHROMEOS_DBUS_ARC) ArcKeymasterClient : public DBusClient { public: + // Returns the global instance if initialized. May return null. + static ArcKeymasterClient* Get(); + + // Creates and initializes the global instance. |bus| must not be null. + static void Initialize(dbus::Bus* bus); + + // Creates and initializes a fake global instance. + static void InitializeFake(); + + // Destroys the global instance if it has been initialized. + static void Shutdown(); + ArcKeymasterClient(const ArcKeymasterClient&) = delete; ArcKeymasterClient& operator=(const ArcKeymasterClient&) = delete; - ~ArcKeymasterClient() override; - - // Factory function. - static std::unique_ptr<ArcKeymasterClient> Create(); - // Bootstrap the Mojo connection between Chrome and the keymaster service. // Should pass in the child end of the Mojo pipe. virtual void BootstrapMojoConnection(base::ScopedFD fd, VoidDBusMethodCallback callback) = 0; protected: - // Create() should be used instead. + // Initialize() should be used instead. ArcKeymasterClient(); + ~ArcKeymasterClient() override; }; } // namespace chromeos
diff --git a/chromeos/dbus/dbus_clients_browser.cc b/chromeos/dbus/dbus_clients_browser.cc index 7cc04e11..48dc192 100644 --- a/chromeos/dbus/dbus_clients_browser.cc +++ b/chromeos/dbus/dbus_clients_browser.cc
@@ -5,14 +5,8 @@ #include "chromeos/dbus/dbus_clients_browser.h" #include "base/check.h" -#include "chromeos/dbus/arc/arc_appfuse_provider_client.h" -#include "chromeos/dbus/arc/arc_data_snapshotd_client.h" -#include "chromeos/dbus/arc/arc_keymaster_client.h" #include "chromeos/dbus/arc/arc_midis_client.h" #include "chromeos/dbus/arc/arc_obb_mounter_client.h" -#include "chromeos/dbus/arc/fake_arc_appfuse_provider_client.h" -#include "chromeos/dbus/arc/fake_arc_data_snapshotd_client.h" -#include "chromeos/dbus/arc/fake_arc_keymaster_client.h" #include "chromeos/dbus/arc/fake_arc_midis_client.h" #include "chromeos/dbus/arc/fake_arc_obb_mounter_client.h" #include "chromeos/dbus/cec_service/cec_service_client.h" @@ -28,8 +22,6 @@ #include "chromeos/dbus/fwupd/fwupd_client.h" #include "chromeos/dbus/gnubby/fake_gnubby_client.h" #include "chromeos/dbus/gnubby/gnubby_client.h" -#include "chromeos/dbus/image_burner/fake_image_burner_client.h" -#include "chromeos/dbus/image_burner/image_burner_client.h" namespace chromeos { @@ -46,10 +38,6 @@ #endif // USE_REAL_DBUS_CLIENTS DBusClientsBrowser::DBusClientsBrowser(bool use_real_clients) { - arc_data_snapshotd_client_ = - CREATE_DBUS_CLIENT(ArcDataSnapshotdClient, use_real_clients); - arc_keymaster_client_ = - CREATE_DBUS_CLIENT(ArcKeymasterClient, use_real_clients); arc_midis_client_ = CREATE_DBUS_CLIENT(ArcMidisClient, use_real_clients); arc_obb_mounter_client_ = CREATE_DBUS_CLIENT(ArcObbMounterClient, use_real_clients); @@ -60,8 +48,6 @@ easy_unlock_client_ = CREATE_DBUS_CLIENT(EasyUnlockClient, use_real_clients); fwupd_client_ = CREATE_DBUS_CLIENT(FwupdClient, use_real_clients); gnubby_client_ = CREATE_DBUS_CLIENT(GnubbyClient, use_real_clients); - image_burner_client_ = - CREATE_DBUS_CLIENT(ImageBurnerClient, use_real_clients); } DBusClientsBrowser::~DBusClientsBrowser() = default; @@ -69,8 +55,6 @@ void DBusClientsBrowser::Initialize(dbus::Bus* system_bus) { DCHECK(DBusThreadManager::IsInitialized()); - arc_data_snapshotd_client_->Init(system_bus); - arc_keymaster_client_->Init(system_bus); arc_midis_client_->Init(system_bus); arc_obb_mounter_client_->Init(system_bus); cec_service_client_->Init(system_bus); @@ -79,7 +63,6 @@ easy_unlock_client_->Init(system_bus); fwupd_client_->Init(system_bus); gnubby_client_->Init(system_bus); - image_burner_client_->Init(system_bus); } } // namespace chromeos
diff --git a/chromeos/dbus/dbus_clients_browser.h b/chromeos/dbus/dbus_clients_browser.h index 635e62d8..1f5fb92 100644 --- a/chromeos/dbus/dbus_clients_browser.h +++ b/chromeos/dbus/dbus_clients_browser.h
@@ -15,8 +15,6 @@ namespace chromeos { -class ArcDataSnapshotdClient; -class ArcKeymasterClient; class ArcMidisClient; class ArcObbMounterClient; class CecServiceClient; @@ -25,7 +23,6 @@ class EasyUnlockClient; class FwupdClient; class GnubbyClient; -class ImageBurnerClient; // Owns D-Bus clients. // TODO(jamescook): Rename this class. "Browser" refers to the browser process @@ -48,8 +45,6 @@ friend class DBusThreadManager; friend class DBusThreadManagerSetter; - std::unique_ptr<ArcDataSnapshotdClient> arc_data_snapshotd_client_; - std::unique_ptr<ArcKeymasterClient> arc_keymaster_client_; std::unique_ptr<ArcMidisClient> arc_midis_client_; std::unique_ptr<ArcObbMounterClient> arc_obb_mounter_client_; std::unique_ptr<CecServiceClient> cec_service_client_; @@ -58,7 +53,6 @@ std::unique_ptr<EasyUnlockClient> easy_unlock_client_; std::unique_ptr<FwupdClient> fwupd_client_; std::unique_ptr<GnubbyClient> gnubby_client_; - std::unique_ptr<ImageBurnerClient> image_burner_client_; }; } // namespace chromeos
diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc index defde21..c842a64 100644 --- a/chromeos/dbus/dbus_thread_manager.cc +++ b/chromeos/dbus/dbus_thread_manager.cc
@@ -10,8 +10,6 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/message_loop/message_pump_type.h" -#include "chromeos/dbus/arc/arc_data_snapshotd_client.h" -#include "chromeos/dbus/arc/arc_keymaster_client.h" #include "chromeos/dbus/arc/arc_midis_client.h" #include "chromeos/dbus/arc/arc_obb_mounter_client.h" #include "chromeos/dbus/cec_service/cec_service_client.h" @@ -21,7 +19,6 @@ #include "chromeos/dbus/debug_daemon/debug_daemon_client.h" #include "chromeos/dbus/easy_unlock/easy_unlock_client.h" #include "chromeos/dbus/gnubby/gnubby_client.h" -#include "chromeos/dbus/image_burner/image_burner_client.h" #include "chromeos/dbus/shill/shill_clients.h" namespace chromeos { @@ -44,16 +41,6 @@ ? g_setter->name.get() \ : (clients_browser_ ? clients_browser_->name.get() : nullptr) -ArcDataSnapshotdClient* DBusThreadManager::GetArcDataSnapshotdClient() { - return clients_browser_ ? clients_browser_->arc_data_snapshotd_client_.get() - : nullptr; -} - -ArcKeymasterClient* DBusThreadManager::GetArcKeymasterClient() { - return clients_browser_ ? clients_browser_->arc_keymaster_client_.get() - : nullptr; -} - ArcMidisClient* DBusThreadManager::GetArcMidisClient() { return clients_browser_ ? clients_browser_->arc_midis_client_.get() : nullptr; } @@ -85,10 +72,6 @@ RETURN_DBUS_CLIENT(gnubby_client_); } -ImageBurnerClient* DBusThreadManager::GetImageBurnerClient() { - RETURN_DBUS_CLIENT(image_burner_client_); -} - #undef RETURN_DBUS_CLIENT void DBusThreadManager::InitializeClients() { @@ -171,9 +154,4 @@ gnubby_client_ = std::move(client); } -void DBusThreadManagerSetter::SetImageBurnerClient( - std::unique_ptr<ImageBurnerClient> client) { - image_burner_client_ = std::move(client); -} - } // namespace chromeos
diff --git a/chromeos/dbus/dbus_thread_manager.h b/chromeos/dbus/dbus_thread_manager.h index 14b3f9e8..ba800c1b 100644 --- a/chromeos/dbus/dbus_thread_manager.h +++ b/chromeos/dbus/dbus_thread_manager.h
@@ -15,8 +15,6 @@ namespace chromeos { // Style Note: Clients are sorted by names. -class ArcDataSnapshotdClient; -class ArcKeymasterClient; class ArcMidisClient; class ArcObbMounterClient; class CecServiceClient; @@ -26,7 +24,6 @@ class DebugDaemonClient; class EasyUnlockClient; class GnubbyClient; -class ImageBurnerClient; // THIS CLASS IS BEING DEPRECATED. See README.md for guidelines and // https://crbug.com/647367 for details. @@ -63,8 +60,6 @@ // pointers after DBusThreadManager has been shut down. // TODO(jamescook): Replace this with calls to FooClient::Get(). // http://crbug.com/647367 - ArcDataSnapshotdClient* GetArcDataSnapshotdClient(); - ArcKeymasterClient* GetArcKeymasterClient(); ArcMidisClient* GetArcMidisClient(); ArcObbMounterClient* GetArcObbMounterClient(); CecServiceClient* GetCecServiceClient(); @@ -72,7 +67,6 @@ DebugDaemonClient* GetDebugDaemonClient(); EasyUnlockClient* GetEasyUnlockClient(); GnubbyClient* GetGnubbyClient(); - ImageBurnerClient* GetImageBurnerClient(); private: DBusThreadManager(); @@ -94,7 +88,6 @@ void SetCrosDisksClient(std::unique_ptr<CrosDisksClient> client); void SetDebugDaemonClient(std::unique_ptr<DebugDaemonClient> client); void SetGnubbyClient(std::unique_ptr<GnubbyClient> client); - void SetImageBurnerClient(std::unique_ptr<ImageBurnerClient> client); private: friend class DBusThreadManager; @@ -108,7 +101,6 @@ std::unique_ptr<CrosDisksClient> cros_disks_client_; std::unique_ptr<DebugDaemonClient> debug_daemon_client_; std::unique_ptr<GnubbyClient> gnubby_client_; - std::unique_ptr<ImageBurnerClient> image_burner_client_; }; } // namespace chromeos
diff --git a/chromeos/dbus/dbus_thread_manager_unittest.cc b/chromeos/dbus/dbus_thread_manager_unittest.cc index 987b6534..705fc9f 100644 --- a/chromeos/dbus/dbus_thread_manager_unittest.cc +++ b/chromeos/dbus/dbus_thread_manager_unittest.cc
@@ -25,7 +25,6 @@ EXPECT_TRUE(manager->GetCrosDisksClient()); EXPECT_TRUE(manager->GetDebugDaemonClient()); EXPECT_TRUE(manager->GetEasyUnlockClient()); - EXPECT_TRUE(manager->GetImageBurnerClient()); DBusThreadManager::Shutdown(); EXPECT_FALSE(DBusThreadManager::IsInitialized());
diff --git a/chromeos/dbus/image_burner/image_burner_client.cc b/chromeos/dbus/image_burner/image_burner_client.cc index ea405c9..b9f926b4 100644 --- a/chromeos/dbus/image_burner/image_burner_client.cc +++ b/chromeos/dbus/image_burner/image_burner_client.cc
@@ -7,8 +7,8 @@ #include <stdint.h> #include "base/bind.h" -#include "base/compiler_specific.h" #include "base/logging.h" +#include "chromeos/dbus/image_burner/fake_image_burner_client.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_path.h" @@ -19,6 +19,13 @@ namespace { +// NOTE: This does not use the typical pattern of a single `g_instance` variable +// due to test utilities shared between unit_tests and browser_tests, which have +// different initialization patterns. It's simplest to allow a test-only +// override. +ImageBurnerClient* g_instance = nullptr; +ImageBurnerClient* g_instance_for_test = nullptr; + // The ImageBurnerClient implementation. class ImageBurnerClientImpl : public ImageBurnerClient { public: @@ -58,7 +65,6 @@ burn_progress_update_handler_.Reset(); } - protected: void Init(dbus::Bus* bus) override { proxy_ = bus->GetObjectProxy(imageburn::kImageBurnServiceName, @@ -137,13 +143,42 @@ } // namespace +// static +ImageBurnerClient* ImageBurnerClient::Get() { + if (g_instance_for_test) + return g_instance_for_test; + return g_instance; +} + +// static +void ImageBurnerClient::Initialize(dbus::Bus* bus) { + CHECK(bus); + CHECK(!g_instance); + g_instance = new ImageBurnerClientImpl(); + g_instance->Init(bus); +} + +// static +void ImageBurnerClient::InitializeFake() { + CHECK(!g_instance); + g_instance = new FakeImageBurnerClient(); + g_instance->Init(nullptr); +} + +// static +void ImageBurnerClient::SetInstanceForTest(ImageBurnerClient* client) { + g_instance_for_test = client; +} + +// static +void ImageBurnerClient::Shutdown() { + CHECK(g_instance); + delete g_instance; + g_instance = nullptr; +} + ImageBurnerClient::ImageBurnerClient() = default; ImageBurnerClient::~ImageBurnerClient() = default; -// static -std::unique_ptr<ImageBurnerClient> ImageBurnerClient::Create() { - return std::make_unique<ImageBurnerClientImpl>(); -} - } // namespace chromeos
diff --git a/chromeos/dbus/image_burner/image_burner_client.h b/chromeos/dbus/image_burner/image_burner_client.h index cd01276..552acf9a 100644 --- a/chromeos/dbus/image_burner/image_burner_client.h +++ b/chromeos/dbus/image_burner/image_burner_client.h
@@ -22,11 +22,25 @@ class COMPONENT_EXPORT(CHROMEOS_DBUS_IMAGE_BURNER) ImageBurnerClient : public DBusClient { public: + // Returns the global instance if initialized. May return null. + static ImageBurnerClient* Get(); + + // Creates and initializes the global instance. |bus| must not be null. + static void Initialize(dbus::Bus* bus); + + // Creates and initializes a fake global instance. + static void InitializeFake(); + + // Sets a temporary instance for testing. Overrides the existing + // global instance, if any. + static void SetInstanceForTest(ImageBurnerClient* client); + + // Destroys the global instance if it has been initialized. + static void Shutdown(); + ImageBurnerClient(const ImageBurnerClient&) = delete; ImageBurnerClient& operator=(const ImageBurnerClient&) = delete; - ~ImageBurnerClient() override; - // A callback to be called when DBus method call fails. using ErrorCallback = base::OnceCallback<void()>; @@ -59,13 +73,10 @@ // signals are received. virtual void ResetEventHandlers() = 0; - // Factory function, creates a new instance and returns ownership. - // For normal usage, access the singleton via DBusThreadManager::Get(). - static std::unique_ptr<ImageBurnerClient> Create(); - protected: - // Create() should be used instead. + // Initialize() should be used instead. ImageBurnerClient(); + ~ImageBurnerClient() override; }; } // namespace chromeos
diff --git a/chromeos/lacros/dbus/lacros_dbus_helper.cc b/chromeos/lacros/dbus/lacros_dbus_helper.cc index 32bac438..d0ce36d 100644 --- a/chromeos/lacros/dbus/lacros_dbus_helper.cc +++ b/chromeos/lacros/dbus/lacros_dbus_helper.cc
@@ -38,7 +38,7 @@ void LacrosInitializeFeatureListDependentDBus() { dbus::Bus* bus = LacrosDBusThreadManager::Get()->GetSystemBus(); - if (base::FeatureList::IsEnabled(floss::features::kFlossEnabled)) { + if (floss::features::IsFlossEnabled()) { InitializeDBusClient<floss::FlossDBusManager>(bus); } else { InitializeDBusClient<bluez::BluezDBusManager>(bus); @@ -47,7 +47,7 @@ void LacrosShutdownDBus() { // Shut down D-Bus clients in reverse order of initialization. - if (base::FeatureList::IsEnabled(floss::features::kFlossEnabled)) { + if (floss::features::IsFlossEnabled()) { floss::FlossDBusManager::Shutdown(); } else { bluez::BluezDBusManager::Shutdown();
diff --git a/chromeos/services/bluetooth_config/discovery_session_manager_impl.cc b/chromeos/services/bluetooth_config/discovery_session_manager_impl.cc index 5346c8b..ccfd597 100644 --- a/chromeos/services/bluetooth_config/discovery_session_manager_impl.cc +++ b/chromeos/services/bluetooth_config/discovery_session_manager_impl.cc
@@ -66,7 +66,7 @@ // discovery session since doing so will clear the pairing handler which is // still needed. // TODO(b/222230887): Decouple pairing handler from discovery session. - if (base::FeatureList::IsEnabled(floss::features::kFlossEnabled)) + if (floss::features::IsFlossEnabled()) return; DestroyDiscoverySession();
diff --git a/chromeos/services/bluetooth_config/discovery_session_manager_impl_unittest.cc b/chromeos/services/bluetooth_config/discovery_session_manager_impl_unittest.cc index 9e5fbe67..c79afeb 100644 --- a/chromeos/services/bluetooth_config/discovery_session_manager_impl_unittest.cc +++ b/chromeos/services/bluetooth_config/discovery_session_manager_impl_unittest.cc
@@ -579,7 +579,7 @@ AdapterDiscoveringStopsDuringPairing_Floss) { base::test::ScopedFeatureList feature_list; feature_list.InitAndEnableFeature(floss::features::kFlossEnabled); - EXPECT_TRUE(base::FeatureList::IsEnabled(floss::features::kFlossEnabled)); + EXPECT_TRUE(floss::features::IsFlossEnabled()); std::unique_ptr<FakeBluetoothDiscoveryDelegate> delegate = StartDiscovery();
diff --git a/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc b/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc index 7c2bd3462..d99b4f7 100644 --- a/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc +++ b/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc
@@ -504,7 +504,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -513,7 +513,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -541,7 +541,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -551,7 +551,7 @@ ExpectFillableFormParsedUkm(2 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -605,7 +605,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data with credit card first and last name @@ -616,8 +616,8 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -649,7 +649,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data with credit card first and last name @@ -682,8 +682,8 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Master"; - credit_card_form.fields[1].value = u"Flo"; + credit_card_form.fields[0].value = u"Doe"; + credit_card_form.fields[1].value = u"Jane"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -713,7 +713,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form. @@ -722,7 +722,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, but don't include a expiration date, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = u""; credit_card_form.fields[3].value = u""; @@ -746,7 +746,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data with non_focusable form field. @@ -758,8 +758,8 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -793,7 +793,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data with non_focusable form field. @@ -805,8 +805,8 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -832,8 +832,8 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -865,8 +865,8 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -896,7 +896,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data with non_focusable form field. @@ -908,8 +908,8 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -935,7 +935,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data with non_focusable form field. @@ -947,8 +947,8 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -973,8 +973,8 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -1001,8 +1001,8 @@ FormsSeen(std::vector<FormData>(2, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -1033,8 +1033,8 @@ FormsSeen(std::vector<FormData>(2, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -1064,7 +1064,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data without any non_focusable form field. @@ -1075,8 +1075,8 @@ FormsSeen(std::vector<FormData>(2, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -1102,7 +1102,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data without any non_focusable form field. @@ -1113,8 +1113,8 @@ FormsSeen(std::vector<FormData>(2, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -1140,8 +1140,8 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -1167,7 +1167,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data with credit card first and last name @@ -1178,8 +1178,8 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -1223,7 +1223,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data with credit card first and last name @@ -1256,8 +1256,8 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Master"; - credit_card_form.fields[1].value = u"Flo"; + credit_card_form.fields[0].value = u"Doe"; + credit_card_form.fields[1].value = u"Jane"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -1305,7 +1305,7 @@ test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -1315,7 +1315,7 @@ // Edit the data, and submit. const char* const card_number = "4111111111111111"; - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = ASCIIToUTF16(card_number); credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -1336,7 +1336,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -1345,7 +1345,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -1373,7 +1373,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -1383,7 +1383,7 @@ ExpectFillableFormParsedUkm(2 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -1416,7 +1416,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -1425,7 +1425,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -1458,7 +1458,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -1486,7 +1486,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -1517,7 +1517,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. Note that CVC field is missing. @@ -1541,7 +1541,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -1574,7 +1574,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen({address_form}); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. Note that CVC field is missing. @@ -1600,7 +1600,7 @@ FormsSeen({credit_card_form}); // Enter an invalid cvc in "Random Field" and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -1634,7 +1634,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen({address_form}); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. Note that CVC field is missing. @@ -1660,7 +1660,7 @@ FormsSeen({credit_card_form}); // Enter a valid cvc in "Random Field" and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -1696,7 +1696,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen({address_form}); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. Note that CVC field is missing. @@ -1722,7 +1722,7 @@ FormsSeen({credit_card_form}); // Enter a valid cvc in "Random Field" and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -1758,7 +1758,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Bob Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -1796,7 +1796,7 @@ test::CreateTestAddressFormData(&address_form); FormsSeen({address_form}); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set the current time to another value. @@ -1808,7 +1808,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -1847,7 +1847,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -1936,7 +1936,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -1965,7 +1965,7 @@ CreateTestCreditCardFormData(&credit_card_form, CreditCardFormOptions()); FormsSeen(std::vector<FormData>(1, credit_card_form)); - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -2042,10 +2042,10 @@ FormsSeen(address_forms); ExpectFillableFormParsedUkm(2 /* num_fillable_forms_parsed */); - ManuallyFillAddressForm("Flo", "Master", "77401-8294", "US", &address_form1); + ManuallyFillAddressForm("Jane", "Doe", "77401-8294", "US", &address_form1); FormSubmitted(address_form1); - ManuallyFillAddressForm("Flo", "Master", "77401-1234", "US", &address_form2); + ManuallyFillAddressForm("Jane", "Doe", "77401-1234", "US", &address_form2); FormSubmitted(address_form2); // Set up our credit card form data. @@ -2055,7 +2055,7 @@ ExpectFillableFormParsedUkm(3 /* num_fillable_forms_parsed */); // Edit the data and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -2089,14 +2089,14 @@ // instead of submitting a form, because they're deduped on form submit. AutofillProfile profile1; profile1.set_guid("00000000-0000-0000-0000-000000000001"); - profile1.SetInfo(NAME_FULL, u"Flo Master", "en-US"); + profile1.SetInfo(NAME_FULL, u"Jane Doe", "en-US"); profile1.SetInfo(ADDRESS_HOME_ZIP, u"H3B2Y5", "en-US"); profile1.SetInfo(ADDRESS_HOME_COUNTRY, u"CA", "en-US"); personal_data().AddProfile(profile1); AutofillProfile profile2; profile2.set_guid("00000000-0000-0000-0000-000000000002"); - profile2.SetInfo(NAME_FULL, u"Flo Master", "en-US"); + profile2.SetInfo(NAME_FULL, u"Jane Doe", "en-US"); profile2.SetInfo(ADDRESS_HOME_ZIP, u"h3b 2y5", "en-US"); profile2.SetInfo(ADDRESS_HOME_COUNTRY, u"CA", "en-US"); personal_data().AddProfile(profile2); @@ -2107,7 +2107,7 @@ FormsSeen({credit_card_form}); // Edit the data and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -2146,10 +2146,10 @@ address_forms.push_back(address_form2); FormsSeen(address_forms); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form1); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form1); FormSubmitted(address_form1); - ManuallyFillAddressForm("Flo", "Master", "77401-8294", "US", &address_form2); + ManuallyFillAddressForm("Jane", "Doe", "77401-8294", "US", &address_form2); FormSubmitted(address_form2); // Set up our credit card form data. @@ -2158,7 +2158,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -2194,7 +2194,7 @@ // other countries which autofill requires a zip code for) would result in no // address being imported at all, and then we never reach the check for // missing zip code in the upload code. - ManuallyFillAddressForm("Flo", "Master", "" /* zip_code */, "Venezuela", + ManuallyFillAddressForm("Jane", "Doe", "" /* zip_code */, "Venezuela", &address_form); FormSubmitted(address_form); @@ -2204,7 +2204,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -2239,11 +2239,11 @@ FormsSeen({address_form1, address_form2}); // Names can be different case. - ManuallyFillAddressForm("flo", "master", "77401", "US", &address_form1); + ManuallyFillAddressForm("jane", "doe", "77401", "US", &address_form1); FormSubmitted(address_form1); // And they can have a middle initial even if the other names don't. - ManuallyFillAddressForm("Flo W", "Master", "77401", "US", &address_form2); + ManuallyFillAddressForm("Jane W", "Doe", "77401", "US", &address_form2); FormSubmitted(address_form2); // Set up our credit card form data. @@ -2253,7 +2253,7 @@ // Edit the data, but use the name with a middle initial *and* period, and // submit. - credit_card_form.fields[0].value = u"Flo W. Master"; + credit_card_form.fields[0].value = u"Jane W. Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -2285,9 +2285,9 @@ FormsSeen({address_form1, address_form2}); // Names can have different variations of middle initials. - ManuallyFillAddressForm("flo w.", "master", "77401", "US", &address_form1); + ManuallyFillAddressForm("jane w.", "doe", "77401", "US", &address_form1); FormSubmitted(address_form1); - ManuallyFillAddressForm("Flo W", "Master", "77401", "US", &address_form2); + ManuallyFillAddressForm("Jane W", "Doe", "77401", "US", &address_form2); FormSubmitted(address_form2); // Set up our credit card form data. @@ -2296,7 +2296,7 @@ FormsSeen({credit_card_form}); // Edit the data, but do not use middle initial. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -2424,10 +2424,10 @@ address_forms.push_back(address_form2); FormsSeen(address_forms); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form1); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form1); FormSubmitted(address_form1); - ManuallyFillAddressForm("Master", "Blaster", "77401", "US", &address_form2); + ManuallyFillAddressForm("John", "Smith", "77401", "US", &address_form2); FormSubmitted(address_form2); // Set up our credit card form data. @@ -2436,7 +2436,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, but use yet another name, and submit. - credit_card_form.fields[0].value = u"Bob Master"; + credit_card_form.fields[0].value = u"Different Person"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -2479,14 +2479,14 @@ test::CreateTestAddressFormData(&address_form2); FormsSeen({address_form1, address_form2}); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form1); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form1); FormSubmitted(address_form1); // Advance the current time. Since |address_form1| will not be a recently // used address profile, we will not include it in the candidate profiles. test_clock.SetNow(kMuchLaterTime); - ManuallyFillAddressForm("Master", "Blaster", "77401", "US", &address_form2); + ManuallyFillAddressForm("John", "Smith", "77401", "US", &address_form2); FormSubmitted(address_form2); // Set up our credit card form data. @@ -2495,7 +2495,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, but use yet another name, and submit. - credit_card_form.fields[0].value = u"Master Blaster"; + credit_card_form.fields[0].value = u"John Smith"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -2601,7 +2601,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. FormData credit_card_form; @@ -2610,7 +2610,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -2636,7 +2636,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. FormData credit_card_form; @@ -2646,7 +2646,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -2671,7 +2671,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -2680,7 +2680,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -2927,7 +2927,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -2936,7 +2936,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, but don't include a expiration date, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = u""; credit_card_form.fields[3].value = u""; @@ -2969,7 +2969,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -2978,7 +2978,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, but don't include a expiration date, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = u""; credit_card_form.fields[3].value = u""; @@ -3042,7 +3042,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -3340,7 +3340,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -3349,7 +3349,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -3378,13 +3378,13 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Add a masked credit card whose |TypeAndLastFourDigits| matches what we will // enter below. CreditCard credit_card(CreditCard::MASKED_SERVER_CARD, "a123"); - test::SetCreditCardInfo(&credit_card, "Flo Master", "1111", + test::SetCreditCardInfo(&credit_card, "Jane Doe", "1111", test::NextMonth().c_str(), test::NextYear().c_str(), "1"); credit_card.SetNetworkForMaskedCard(kVisaCard); @@ -3396,7 +3396,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4091,7 +4091,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -4100,7 +4100,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4189,7 +4189,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -4238,7 +4238,7 @@ // Set up a new address profile without a postal code. AutofillProfile profile; profile.set_guid("00000000-0000-0000-0000-000000000200"); - profile.SetInfo(NAME_FULL, u"Flo Master", "en-US"); + profile.SetInfo(NAME_FULL, u"Jane Doe", "en-US"); profile.SetInfo(ADDRESS_HOME_LINE1, u"123 Testing St.", "en-US"); profile.SetInfo(ADDRESS_HOME_CITY, u"Mountain View", "en-US"); profile.SetInfo(ADDRESS_HOME_STATE, u"California", "en-US"); @@ -4251,7 +4251,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4286,7 +4286,7 @@ // Set up two new address profiles with conflicting postal codes. AutofillProfile profile1; profile1.set_guid("00000000-0000-0000-0000-000000000200"); - profile1.SetInfo(NAME_FULL, u"Flo Master", "en-US"); + profile1.SetInfo(NAME_FULL, u"Jane Doe", "en-US"); profile1.SetInfo(ADDRESS_HOME_LINE1, u"123 Testing St.", "en-US"); profile1.SetInfo(ADDRESS_HOME_CITY, u"Mountain View", "en-US"); profile1.SetInfo(ADDRESS_HOME_STATE, u"California", "en-US"); @@ -4295,7 +4295,7 @@ personal_data().AddProfile(profile1); AutofillProfile profile2; profile2.set_guid("00000000-0000-0000-0000-000000000201"); - profile2.SetInfo(NAME_FULL, u"Flo Master", "en-US"); + profile2.SetInfo(NAME_FULL, u"Jane Doe", "en-US"); profile2.SetInfo(ADDRESS_HOME_LINE1, u"234 Other Place", "en-US"); profile2.SetInfo(ADDRESS_HOME_CITY, u"Fake City", "en-US"); profile2.SetInfo(ADDRESS_HOME_STATE, u"Stateland", "en-US"); @@ -4309,7 +4309,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4397,7 +4397,7 @@ // Add a local credit card whose |TypeAndLastFourDigits| matches what we will // enter below. CreditCard local_card; - test::SetCreditCardInfo(&local_card, "Flo Master", "4111111111111111", + test::SetCreditCardInfo(&local_card, "Jane Doe", "4111111111111111", test::NextMonth().c_str(), test::NextYear().c_str(), "1"); local_card.set_record_type(CreditCard::LOCAL_CARD); @@ -4410,7 +4410,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -4420,7 +4420,7 @@ ExpectFillableFormParsedUkm(2 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4450,7 +4450,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -4460,7 +4460,7 @@ ExpectFillableFormParsedUkm(2 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4493,7 +4493,7 @@ // Add a local credit card whose |TypeAndLastFourDigits| matches what we will // enter below. CreditCard local_card; - test::SetCreditCardInfo(&local_card, "Flo Master", "4111111111111111", + test::SetCreditCardInfo(&local_card, "Jane Doe", "4111111111111111", test::NextMonth().c_str(), test::NextYear().c_str(), "1"); local_card.set_record_type(CreditCard::LOCAL_CARD); @@ -4506,7 +4506,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -4516,7 +4516,7 @@ ExpectFillableFormParsedUkm(2 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4542,7 +4542,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -4551,7 +4551,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4572,7 +4572,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -4581,7 +4581,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4606,7 +4606,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -4615,7 +4615,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4634,7 +4634,7 @@ FormData address_form; test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -4643,7 +4643,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4674,7 +4674,7 @@ ExpectFillableFormParsedUkm(1 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4713,7 +4713,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -4723,7 +4723,7 @@ ExpectFillableFormParsedUkm(2 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4765,7 +4765,7 @@ ExpectFillableFormParsedUkm(1 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4805,7 +4805,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -4815,7 +4815,7 @@ ExpectFillableFormParsedUkm(2 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4863,7 +4863,7 @@ ExpectFillableFormParsedUkm(1 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4904,7 +4904,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -4914,7 +4914,7 @@ ExpectFillableFormParsedUkm(2 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -4956,7 +4956,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data with credit card first and last name @@ -4967,8 +4967,8 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -5004,7 +5004,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data with credit card first and last name @@ -5015,8 +5015,8 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo"; - credit_card_form.fields[1].value = u"Master"; + credit_card_form.fields[0].value = u"Jane"; + credit_card_form.fields[1].value = u"Doe"; credit_card_form.fields[2].value = u"4111111111111111"; credit_card_form.fields[3].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[4].value = ASCIIToUTF16(test::NextYear()); @@ -5051,7 +5051,7 @@ ExpectFillableFormParsedUkm(1 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -5082,7 +5082,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -5092,7 +5092,7 @@ ExpectFillableFormParsedUkm(2 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -5125,7 +5125,7 @@ ExpectFillableFormParsedUkm(1 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -5160,7 +5160,7 @@ FormsSeen(std::vector<FormData>(1, address_form)); ExpectUniqueFillableFormParsedUkm(); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -5170,7 +5170,7 @@ ExpectFillableFormParsedUkm(2 /* num_fillable_forms_parsed */); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -5234,7 +5234,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"5454545454545454"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -5262,14 +5262,14 @@ // Add a local credit card whose number matches what we will // enter below. CreditCard local_card; - test::SetCreditCardInfo(&local_card, "Flo Master", "5454545454545454", + test::SetCreditCardInfo(&local_card, "Jane Doe", "5454545454545454", test::NextMonth().c_str(), test::NextYear().c_str(), "1"); local_card.set_record_type(CreditCard::LOCAL_CARD); personal_data().AddCreditCard(local_card); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"5454545454545454"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -5294,7 +5294,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = u"4111111111111111"; credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -5318,7 +5318,7 @@ test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -5328,7 +5328,7 @@ // Edit the data, and submit. const char* const card_number = "4111111111111111"; - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = ASCIIToUTF16(card_number); credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear()); @@ -5356,7 +5356,7 @@ test::CreateTestAddressFormData(&address_form); FormsSeen(std::vector<FormData>(1, address_form)); - ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form); + ManuallyFillAddressForm("Jane", "Doe", "77401", "US", &address_form); FormSubmitted(address_form); // Set up our credit card form data. @@ -5366,7 +5366,7 @@ // Edit the data, and submit. const char* const card_number = "4111111111111111"; - credit_card_form.fields[0].value = u"Flo Master"; + credit_card_form.fields[0].value = u"Jane Doe"; credit_card_form.fields[1].value = ASCIIToUTF16(card_number); credit_card_form.fields[2].value = ASCIIToUTF16(test::NextMonth()); credit_card_form.fields[3].value = ASCIIToUTF16(test::NextYear());
diff --git a/components/autofill/core/browser/payments/local_card_migration_manager_unittest.cc b/components/autofill/core/browser/payments/local_card_migration_manager_unittest.cc index 3182b70..bdb96560 100644 --- a/components/autofill/core/browser/payments/local_card_migration_manager_unittest.cc +++ b/components/autofill/core/browser/payments/local_card_migration_manager_unittest.cc
@@ -174,12 +174,12 @@ std::make_unique<PaymentsCustomerData>(/*customer_id=*/"123456")); // Add a local credit card (but it will not match what we will enter below). - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); // Add another local credit card (but it will not match what we will enter // below). - AddLocalCreditCard(personal_data(), "Flo Master", "4444333322221111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4444333322221111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -189,7 +189,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "5555555555554444", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); } @@ -202,11 +202,11 @@ // Add a local credit card whose |TypeAndLastFourDigits| matches what we // will enter below. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); // Add another local credit card. - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -216,7 +216,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); } @@ -229,15 +229,15 @@ // Add a local credit card whose |TypeAndLastFourDigits| matches what we // will enter below. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); // Add other invalid local credit cards (invalid card number or expired), so // it will not trigger migration. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111112", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111112", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::LastYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -247,7 +247,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); } @@ -262,12 +262,12 @@ // what we will enter below. CreditCard credit_card(CreditCard::MASKED_SERVER_CARD, /*server_id=*/"a123"); - test::SetCreditCardInfo(&credit_card, "Flo Master", "1111", "11", + test::SetCreditCardInfo(&credit_card, "Jane Doe", "1111", "11", test::NextYear().c_str(), "1"); credit_card.SetNetworkForMaskedCard(kVisaCard); personal_data().AddServerCreditCard(credit_card); // Add one valid local credit card, so it will trigger migration - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -277,7 +277,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); } @@ -292,16 +292,16 @@ // will enter below. CreditCard credit_card(CreditCard::MASKED_SERVER_CARD, /*server_id=*/"a123"); - test::SetCreditCardInfo(&credit_card, "Flo Master", "1111", "11", + test::SetCreditCardInfo(&credit_card, "Jane Doe", "1111", "11", test::NextYear().c_str(), "1"); credit_card.SetNetworkForMaskedCard(kVisaCard); personal_data().AddServerCreditCard(credit_card); // Add other invalid local credit cards (invalid card number or expired), so // it will not trigger migration. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111112", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111112", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::LastYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -311,7 +311,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); } @@ -347,7 +347,7 @@ // Add a local credit card whose |TypeAndLastFourDigits| matches what we will // enter below. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -357,7 +357,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); EXPECT_FALSE(local_card_migration_manager_->LocalCardMigrationWasTriggered()); @@ -430,11 +430,11 @@ TEST_F(LocalCardMigrationManagerTest, MigrateCreditCard_NoPaymentsAccount) { // Add a local credit card whose |TypeAndLastFourDigits| matches what we will // enter below. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); // Add another local credit card. - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -444,7 +444,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); EXPECT_FALSE(local_card_migration_manager_->LocalCardMigrationWasTriggered()); @@ -462,17 +462,17 @@ // Add a masked server card whose |TypeAndLastFourDigits| matches a local // card. CreditCard server_card(CreditCard::MASKED_SERVER_CARD, "a123"); - test::SetCreditCardInfo(&server_card, "Flo Master", "1111", "11", + test::SetCreditCardInfo(&server_card, "Jane Doe", "1111", "11", test::NextYear().c_str(), "1"); server_card.SetNetworkForMaskedCard(kVisaCard); personal_data().AddServerCreditCard(server_card); // Add a local card whose |TypeAndLastFourDigits| matches a masked server // card. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); // Add another local credit card - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -482,7 +482,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "5555555555554444", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); EXPECT_FALSE(local_card_migration_manager_->LocalCardMigrationWasTriggered()); @@ -499,15 +499,15 @@ // Add a full server card whose number matches a local card. CreditCard server_card(CreditCard::FULL_SERVER_CARD, "a123"); - test::SetCreditCardInfo(&server_card, "Flo Master", "4111111111111111", "11", + test::SetCreditCardInfo(&server_card, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1"); personal_data().AddServerCreditCard(server_card); // Add a local credit card whose number matches a full server card. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); // Add another local credit card - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -517,7 +517,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "5555555555554444", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); EXPECT_FALSE(local_card_migration_manager_->LocalCardMigrationWasTriggered()); @@ -532,7 +532,7 @@ // Add a local credit card whose |TypeAndLastFourDigits| matches what we will // enter below. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); // Add another local credit card with a different cardholder name. @@ -546,7 +546,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); EXPECT_TRUE(local_card_migration_manager_->LocalCardMigrationWasTriggered()); @@ -565,7 +565,7 @@ // Add a local credit card whose |TypeAndLastFourDigits| matches what we will // enter below. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); // Add another local credit card without card holder name. @@ -578,7 +578,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); EXPECT_TRUE(local_card_migration_manager_->LocalCardMigrationWasTriggered()); @@ -644,7 +644,7 @@ // Add a local credit card. One migratable credit card will still trigger // migration on settings page. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -672,7 +672,7 @@ // Add a local credit card. One migratable credit card will still trigger // migration on settings page. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -704,7 +704,7 @@ std::make_unique<PaymentsCustomerData>(/*customer_id=*/"123456")); // Add a local credit card for migration. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -746,7 +746,7 @@ // Add a local credit card. One migratable credit card will still trigger // migration on settings page. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -789,7 +789,7 @@ // Add a local credit card. One migratable credit card will still trigger // migration on settings page. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -824,11 +824,11 @@ // Verify selected cards are correctly passed to manager. TEST_F(LocalCardMigrationManagerTest, MigrateCreditCard_ToggleIsChosen) { const base::GUID guid1 = base::GUID::GenerateRandomV4(); - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", guid1); const base::GUID guid2 = base::GUID::GenerateRandomV4(); - AddLocalCreditCard(personal_data(), "Flo Master", "5454545454545454", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5454545454545454", "11", test::NextYear().c_str(), "1", guid2); // Set the billing_customer_number to designate existence of a Payments @@ -853,7 +853,7 @@ TEST_F(LocalCardMigrationManagerTest, DeleteLocalCardViaMigrationDialog) { const base::GUID guid = base::GUID::GenerateRandomV4(); - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", guid); const std::string guid_str = guid.AsLowercaseString(); @@ -919,11 +919,11 @@ // strike count is logged. TEST_F(LocalCardMigrationManagerTest, MigrateCreditCard_StrikeCountUMALogged) { const base::GUID guid1 = base::GUID::GenerateRandomV4(); - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", guid1); const base::GUID guid2 = base::GUID::GenerateRandomV4(); - AddLocalCreditCard(personal_data(), "Flo Master", "5454545454545454", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5454545454545454", "11", test::NextYear().c_str(), "1", guid2); // Set the billing_customer_number to designate existence of a Payments @@ -962,11 +962,11 @@ // Add a local credit card whose |TypeAndLastFourDigits| matches what we will // enter below. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); // Add another local credit card. - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -982,7 +982,7 @@ payments_client_->SetSupportedBINRanges(supported_card_bin_ranges); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); EXPECT_FALSE(local_card_migration_manager_->IntermediatePromptWasShown()); @@ -999,11 +999,11 @@ // Add a local credit card whose |TypeAndLastFourDigits| matches what we will // enter below. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); // Add another local credit card. - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -1019,7 +1019,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); @@ -1046,12 +1046,12 @@ // Add a masked server credit card whose |TypeAndLastFourDigits| matches what // we will enter below. CreditCard credit_card(CreditCard::MASKED_SERVER_CARD, "a123"); - test::SetCreditCardInfo(&credit_card, "Flo Master", "1111", "11", + test::SetCreditCardInfo(&credit_card, "Jane Doe", "1111", "11", test::NextYear().c_str(), "1"); credit_card.SetNetworkForMaskedCard(kVisaCard); personal_data().AddServerCreditCard(credit_card); // Add one valid local credit card, so it will trigger migration - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -1067,7 +1067,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); @@ -1087,12 +1087,12 @@ // Add a masked server credit card whose |TypeAndLastFourDigits| matches what // we will enter below. CreditCard credit_card(CreditCard::MASKED_SERVER_CARD, "a123"); - test::SetCreditCardInfo(&credit_card, "Flo Master", "1111", "11", + test::SetCreditCardInfo(&credit_card, "Jane Doe", "1111", "11", test::NextYear().c_str(), "1"); credit_card.SetNetworkForMaskedCard(kVisaCard); personal_data().AddServerCreditCard(credit_card); // Add one valid local credit card, so it will trigger migration - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -1108,7 +1108,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); @@ -1200,7 +1200,7 @@ // Add a local credit card. One migratable credit card will still trigger // migration on settings page. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -1244,11 +1244,11 @@ base::HistogramTester histogram_tester; // Add a local credit card whose |TypeAndLastFourDigits| matches what we will // enter below. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); // Add another local credit card. - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -1258,7 +1258,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); @@ -1340,11 +1340,11 @@ // Add a local credit card whose |TypeAndLastFourDigits| matches what we will // enter below. - AddLocalCreditCard(personal_data(), "Flo Master", "4111111111111111", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); // Add another local credit card. - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -1361,7 +1361,7 @@ payments_client_->SetSupportedBINRanges(supported_card_bin_ranges); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); @@ -1383,12 +1383,12 @@ // Add a masked server credit card whose |TypeAndLastFourDigits| matches what // we will enter below. CreditCard credit_card(CreditCard::MASKED_SERVER_CARD, "a123"); - test::SetCreditCardInfo(&credit_card, "Flo Master", "1111", "11", + test::SetCreditCardInfo(&credit_card, "Jane Doe", "1111", "11", test::NextYear().c_str(), "1"); credit_card.SetNetworkForMaskedCard(kVisaCard); personal_data().AddServerCreditCard(credit_card); // Add one valid local credit card, so it will trigger migration - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -1405,7 +1405,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form); @@ -1427,12 +1427,12 @@ // Add a masked server credit card whose |TypeAndLastFourDigits| matches what // we will enter below. CreditCard credit_card(CreditCard::MASKED_SERVER_CARD, "a123"); - test::SetCreditCardInfo(&credit_card, "Flo Master", "1111", "11", + test::SetCreditCardInfo(&credit_card, "Jane Doe", "1111", "11", test::NextYear().c_str(), "1"); credit_card.SetNetworkForMaskedCard(kVisaCard); personal_data().AddServerCreditCard(credit_card); // Add one valid local credit card, so it will trigger migration - AddLocalCreditCard(personal_data(), "Flo Master", "5555555555554444", "11", + AddLocalCreditCard(personal_data(), "Jane Doe", "5555555555554444", "11", test::NextYear().c_str(), "1", base::GUID::GenerateRandomV4()); @@ -1449,7 +1449,7 @@ FormsSeen(std::vector<FormData>(1, credit_card_form)); // Edit the data, and submit. - EditCreditCardFrom(credit_card_form, "Flo Master", "4111111111111111", "11", + EditCreditCardFrom(credit_card_form, "Jane Doe", "4111111111111111", "11", test::NextYear().c_str(), "123"); FormSubmitted(credit_card_form);
diff --git a/components/browser_ui/photo_picker/android/features.cc b/components/browser_ui/photo_picker/android/features.cc index 7939f9e8..80b2761 100644 --- a/components/browser_ui/photo_picker/android/features.cc +++ b/components/browser_ui/photo_picker/android/features.cc
@@ -16,11 +16,15 @@ // in other locations in the code base (e.g. content_features.h), and must be // replicated in the same order in PhotoPickerFeatures.java. const base::Feature* kFeaturesExposedToJava[] = { + &kAndroidMediaPickerSupport, &kPhotoPickerVideoSupport, }; } // namespace +const base::Feature kAndroidMediaPickerSupport{ + "AndroidMediaPickerSupport", base::FEATURE_DISABLED_BY_DEFAULT}; + const base::Feature kPhotoPickerVideoSupport{"PhotoPickerVideoSupport", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/components/browser_ui/photo_picker/android/features.h b/components/browser_ui/photo_picker/android/features.h index 1834686..2048f6f 100644 --- a/components/browser_ui/photo_picker/android/features.h +++ b/components/browser_ui/photo_picker/android/features.h
@@ -10,6 +10,10 @@ namespace photo_picker { namespace features { +// Whether to use the Android stock media picker instead of the Chrome picker. +extern const base::Feature kAndroidMediaPickerSupport; + +// Whether the media picker supports videos. extern const base::Feature kPhotoPickerVideoSupport; } // namespace features
diff --git a/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/PhotoPickerDelegateBase.java b/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/PhotoPickerDelegateBase.java index 30b9217..6474ce5 100644 --- a/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/PhotoPickerDelegateBase.java +++ b/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/PhotoPickerDelegateBase.java
@@ -18,4 +18,9 @@ public boolean supportsVideos() { return PhotoPickerFeatures.PHOTO_PICKER_VIDEO_SUPPORT.isEnabled(); } + + @Override + public boolean preferAndroidMediaPicker() { + return PhotoPickerFeatures.ANDROID_MEDIA_PICKER_SUPPORT.isEnabled(); + } }
diff --git a/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/PhotoPickerFeatures.java b/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/PhotoPickerFeatures.java index c0ec0314..6de208f 100644 --- a/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/PhotoPickerFeatures.java +++ b/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/PhotoPickerFeatures.java
@@ -13,11 +13,14 @@ */ @JNINamespace("photo_picker::features") public class PhotoPickerFeatures extends Features { + public static final String ANDROID_MEDIA_PICKER_SUPPORT_NAME = "AndroidMediaPickerSupport"; public static final String PHOTO_PICKER_VIDEO_SUPPORT_NAME = "PhotoPickerVideoSupport"; // This list must be kept in sync with kFeaturesExposedToJava in native. + public static final PhotoPickerFeatures ANDROID_MEDIA_PICKER_SUPPORT = + new PhotoPickerFeatures(0, ANDROID_MEDIA_PICKER_SUPPORT_NAME); public static final PhotoPickerFeatures PHOTO_PICKER_VIDEO_SUPPORT = - new PhotoPickerFeatures(0, PHOTO_PICKER_VIDEO_SUPPORT_NAME); + new PhotoPickerFeatures(1, PHOTO_PICKER_VIDEO_SUPPORT_NAME); private final int mOrdinal;
diff --git a/components/browser_ui/widget/android/java/src/org/chromium/components/browser_ui/widget/animation/Interpolators.java b/components/browser_ui/widget/android/java/src/org/chromium/components/browser_ui/widget/animation/Interpolators.java index 0f36debf..e72ea6eb 100644 --- a/components/browser_ui/widget/android/java/src/org/chromium/components/browser_ui/widget/animation/Interpolators.java +++ b/components/browser_ui/widget/android/java/src/org/chromium/components/browser_ui/widget/animation/Interpolators.java
@@ -6,9 +6,11 @@ import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; +import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; import android.view.animation.OvershootInterpolator; +import androidx.core.view.animation.PathInterpolatorCompat; import androidx.interpolator.view.animation.FastOutLinearInInterpolator; import androidx.interpolator.view.animation.FastOutSlowInInterpolator; import androidx.interpolator.view.animation.LinearOutSlowInInterpolator; @@ -19,6 +21,10 @@ new AccelerateInterpolator(); public static final DecelerateInterpolator DECELERATE_INTERPOLATOR = new DecelerateInterpolator(); + public static final Interpolator EMPHASIZED_ACCELERATE = + PathInterpolatorCompat.create(0.3f, 0f, 0.8f, 0.15f); + public static final Interpolator EMPHASIZED_DECELERATE = + PathInterpolatorCompat.create(0.05f, 0.7f, 0.1f, 1f); public static final FastOutLinearInInterpolator FAST_OUT_LINEAR_IN_INTERPOLATOR = new FastOutLinearInInterpolator(); public static final FastOutSlowInInterpolator FAST_OUT_SLOW_IN_INTERPOLATOR =
diff --git a/components/discardable_memory/service/discardable_shared_memory_manager.cc b/components/discardable_memory/service/discardable_shared_memory_manager.cc index ad058b8..61c8a45a 100644 --- a/components/discardable_memory/service/discardable_shared_memory_manager.cc +++ b/components/discardable_memory/service/discardable_shared_memory_manager.cc
@@ -158,20 +158,20 @@ // Returns the default memory limit to use for discardable memory, taking // the amount physical memory available and other platform specific constraints // into account. -int64_t GetDefaultMemoryLimit() { - const int kMegabyte = 1024 * 1024; +uint64_t GetDefaultMemoryLimit() { + const uint64_t kMegabyte = 1024ull * 1024; #if BUILDFLAG(IS_CASTOS) || BUILDFLAG(IS_CAST_ANDROID) // Bypass IsLowEndDevice() check and fix max_default_memory_limit to 64MB on // Chromecast devices. Set value here as IsLowEndDevice() is used on some, but // not all Chromecast devices. - int64_t max_default_memory_limit = 64 * kMegabyte; + uint64_t max_default_memory_limit = 64 * kMegabyte; #else #if BUILDFLAG(IS_ANDROID) // Limits the number of FDs used to 32, assuming a 4MB allocation size. - int64_t max_default_memory_limit = 128 * kMegabyte; + uint64_t max_default_memory_limit = 128 * kMegabyte; #else - int64_t max_default_memory_limit = 512 * kMegabyte; + uint64_t max_default_memory_limit = 512 * kMegabyte; #endif // Use 1/8th of discardable memory on low-end devices. @@ -201,7 +201,8 @@ // Allow 1/2 of available shmem dir space to be used for discardable memory. max_default_memory_limit = - std::min(max_default_memory_limit, shmem_dir_amount_of_free_space / 2); + std::min(max_default_memory_limit, + static_cast<uint64_t>(shmem_dir_amount_of_free_space / 2)); } #endif
diff --git a/components/history_clusters/core/history_clusters_db_tasks.cc b/components/history_clusters/core/history_clusters_db_tasks.cc index d0117a0a..5d1b0f0 100644 --- a/components/history_clusters/core/history_clusters_db_tasks.cc +++ b/components/history_clusters/core/history_clusters_db_tasks.cc
@@ -261,8 +261,17 @@ annotated_visits_.back().visit_row.visit_time; continuation_params_.is_partial_day = true; } else { + DCHECK(!continuation_params_.exhausted_unclustered_visits || recent_first_); + // Prepare `continuation_time` for the next day of visits. It will include + // all unclustered visits iterated. Except, if `exhausted_unclustered_visits + // is true, which is only possible if `recent_first_` is true and it just + // reached the clustering boundary, then prepare `continuation_time` to + // re-iterate the last iterated day, as the to include the clustered visits + // of that day. continuation_params_.continuation_time = - recent_first_ ? options.begin_time : options.end_time; + (recent_first_ && !continuation_params_.exhausted_unclustered_visits) + ? options.begin_time + : options.end_time; continuation_params_.is_partial_day = false; // We've exhausted history if we've reached `begin_time_limit_` (bound to be
diff --git a/components/history_clusters/core/history_clusters_service_task_get_most_recent_clusters.cc b/components/history_clusters/core/history_clusters_service_task_get_most_recent_clusters.cc index 45e8f87..1b648c1 100644 --- a/components/history_clusters/core/history_clusters_service_task_get_most_recent_clusters.cc +++ b/components/history_clusters/core/history_clusters_service_task_get_most_recent_clusters.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/location.h" #include "base/metrics/histogram_functions.h" +#include "base/ranges/algorithm.h" #include "base/strings/stringprintf.h" #include "base/time/time_to_iso8601.h" #include "components/history/core/browser/history_service.h" @@ -19,6 +20,19 @@ namespace history_clusters { +namespace { + +// Get the most recent `ClusterVisit` in `cluster`. +history::ClusterVisit GetMostRecentClusterVisit(history::Cluster cluster) { + return *base::ranges::min_element( + cluster.visits, [](auto time1, auto time2) { return time1 < time2; }, + [](const auto& cluster_visit) { + return cluster_visit.annotated_visit.visit_row.visit_time; + }); +} + +} // namespace + HistoryClustersServiceTaskGetMostRecentClusters:: HistoryClustersServiceTaskGetMostRecentClusters( base::WeakPtr<HistoryClustersService> weak_history_clusters_service, @@ -51,14 +65,13 @@ DCHECK(!continuation_params_.exhausted_all_visits); if (!backend_ || continuation_params_.exhausted_unclustered_visits) { - // Early exit if we won't be able to cluster visits, either because null - // `backend_` or all unclustered visits have already been clustered and - // returned. + // If visits can't be clustered, either because `backend_` is null, or all + // unclustered visits have already been clustered and returned, then return + // persisted clusters. weak_history_clusters_service_->NotifyDebugMessage( "HistoryClustersService::QueryClusters Error: ClusteringBackend is " "nullptr. Returning empty cluster vector."); - done_ = true; - std::move(callback_).Run({}, QueryClustersContinuationParams::DoneParams()); + ReturnMostRecentPersistedClusters(continuation_params_.continuation_time); } else { history_service_get_annotated_visits_to_cluster_start_time_ = @@ -102,9 +115,9 @@ history_service_get_annotated_visits_to_cluster_start_time_); if (annotated_visits.empty()) { - // Early exit without calling backend if there's no annotated visits. - done_ = true; - std::move(callback_).Run({}, QueryClustersContinuationParams::DoneParams()); + // If there're no unclustered visits to cluster, then return persisted + // clusters. + ReturnMostRecentPersistedClusters(continuation_params.continuation_time); } else { if (weak_history_clusters_service_->ShouldNotifyDebugMessage()) { @@ -149,4 +162,26 @@ std::move(callback_).Run(clusters, continuation_params); } +void HistoryClustersServiceTaskGetMostRecentClusters:: + ReturnMostRecentPersistedClusters(base::Time exclusive_max_time) { + history_service_->GetMostRecentClusters( + begin_time_, exclusive_max_time, 1, + base::BindOnce(&HistoryClustersServiceTaskGetMostRecentClusters:: + OnGotMostRecentPersistedClusters, + weak_ptr_factory_.GetWeakPtr()), + &task_tracker_); +} + +void HistoryClustersServiceTaskGetMostRecentClusters:: + OnGotMostRecentPersistedClusters(std::vector<history::Cluster> clusters) { + auto continuation_params = + clusters.empty() ? QueryClustersContinuationParams::DoneParams() + : QueryClustersContinuationParams{ + GetMostRecentClusterVisit(clusters[0]) + .annotated_visit.visit_row.visit_time, + true, false, true, false}; + done_ = true; + std::move(callback_).Run(clusters, continuation_params); +} + } // namespace history_clusters
diff --git a/components/history_clusters/core/history_clusters_service_task_get_most_recent_clusters.h b/components/history_clusters/core/history_clusters_service_task_get_most_recent_clusters.h index 2de874c1..8686000 100644 --- a/components/history_clusters/core/history_clusters_service_task_get_most_recent_clusters.h +++ b/components/history_clusters/core/history_clusters_service_task_get_most_recent_clusters.h
@@ -10,15 +10,25 @@ #include "base/memory/weak_ptr.h" #include "base/task/cancelable_task_tracker.h" #include "base/time/time.h" -#include "components/history/core/browser/history_service.h" #include "components/history/core/browser/history_types.h" #include "components/history_clusters/core/clustering_backend.h" #include "components/history_clusters/core/history_clusters_types.h" +namespace history { +class HistoryService; +} + namespace history_clusters { class HistoryClustersService; +// `HistoryClustersServiceTaskGetMostRecentClusters` 1st gets newly generated +// clusters from the clustering backend using unclustered visits from the +// history backend. Then, once the unclustered visits are exhausted, it switches +// to getting persisted clusters from the history backend. +// It is an extension of `HistoryClustersService`; rather than pollute the +// latter's namespace with a bunch of callbacks, this class groups those +// callbacks. class HistoryClustersServiceTaskGetMostRecentClusters { public: HistoryClustersServiceTaskGetMostRecentClusters( @@ -35,6 +45,19 @@ bool Done() { return done_; } private: + // When there remain unclustered visits, cluster unclustered visits (possibly + // in combination with clustered visits) and return the newly created + // clusters: + // Start() -> + // OnGotAnnotatedVisitsToCluster() -> + // OnGotModelClusters() + // But when unclustered visits are or were exhausted, return persisted + // clusters: + // Start() -> + // [optional] OnGotAnnotatedVisitsToCluster() -> + // ReturnMostRecentPersistedClusters() -> + // OnGotMostRecentPersistedClusters() + // Invoked during construction. Will asyncly request annotated visits from // `GetAnnotatedVisitsToCluster`. void Start(); @@ -48,10 +71,18 @@ QueryClustersContinuationParams continuation_params); // Invoked after `OnGotAnnotatedVisitsToCluster()` asyncly obtains clusters. - // Will synchronously invoke `callback_`. + // Will syncly invoke `callback_`. void OnGotModelClusters(QueryClustersContinuationParams continuation_params, std::vector<history::Cluster> clusters); + // Invoked syncly when there are no unclustered visits to cluster. Will + // asyncly request existing (i.e. persisted) clusters from `HistoryService`. + void ReturnMostRecentPersistedClusters(base::Time exclusive_max_time); + + // Invoked after `ReturnMostRecentPersistedClusters()` asyncly fetches + // clusters. Will syncly invoke `callback_`. + void OnGotMostRecentPersistedClusters(std::vector<history::Cluster> clusters); + // Never nullptr. base::WeakPtr<HistoryClustersService> weak_history_clusters_service_; const IncompleteVisitMap incomplete_visit_context_annotations_;
diff --git a/components/history_clusters/core/history_clusters_service_unittest.cc b/components/history_clusters/core/history_clusters_service_unittest.cc index a1ee15b8..0b6ec7b 100644 --- a/components/history_clusters/core/history_clusters_service_unittest.cc +++ b/components/history_clusters/core/history_clusters_service_unittest.cc
@@ -272,7 +272,9 @@ // Persisted visits are ordered before incomplete visits. Persisted visits // are ordered newest first. Incomplete visits are ordered the same as they // were sent to the `HistoryClustersService`. - return {clusters, test_clustering_backend_->LastClusteredVisits()}; + return {clusters, expect_clustering_backend_call + ? test_clustering_backend_->LastClusteredVisits() + : std::vector<history::AnnotatedVisit>{}}; }; // Helper to repeatedly schedule a `GetAnnotatedVisitsToCluster` and return @@ -308,19 +310,18 @@ // unique day with at least 1 visit; i.e. `number_of_days_with_visits`. void FlushKeywordRequests(std::vector<history::Cluster> clusters, size_t number_of_days_with_visits) { - test_clustering_backend_->WaitForGetClustersCall(); - test_clustering_backend_->FulfillCallback(clusters); - // `Does[Query|URL]MatchAnyCluster()` will continue making history and // cluster backend requests until it has exhausted history. We have to flush // out these requests before it will populate the cache. - for (size_t i = 0; i < number_of_days_with_visits - 1; ++i) { + for (size_t i = 0; i < number_of_days_with_visits; ++i) { test_clustering_backend_->WaitForGetClustersCall(); - history::BlockUntilHistoryProcessesPendingRequests( - history_service_.get()); - test_clustering_backend_->FulfillCallback({}); + test_clustering_backend_->FulfillCallback( + i == 0 ? clusters : std::vector<history::Cluster>{}); } - // One last wait to flush out the last, empty history request. + // Flush out the last, empty history requests. There'll be 2 history + // requests: the 1st to exhaust visits to cluster requests, and the 2nd to + // exhaust persisted cluster requests. + history::BlockUntilHistoryProcessesPendingRequests(history_service_.get()); history::BlockUntilHistoryProcessesPendingRequests(history_service_.get()); }; @@ -503,12 +504,42 @@ EXPECT_FALSE(continuation_params.exhausted_unclustered_visits); EXPECT_FALSE(continuation_params.exhausted_all_visits); } - // 3rd query should set `exhausted_unclustered_visits` and - // `exhausted_all_visits`. No clusters should be returned (not implemented - // yet). + // Next 3 queries should return the persisted clusters. They should not make + // requests to the clustering backend. And they should set + // `exhausted_unclustered_visits`. { - const auto clusters = NextQueryClusters(continuation_params, false).first; + const auto [clusters, visits] = + NextQueryClusters(continuation_params, false); + ASSERT_THAT(GetClusterIds(clusters), testing::ElementsAre(1)); + EXPECT_THAT(GetVisitIds(clusters[0].visits), testing::ElementsAre(3)); + EXPECT_THAT(GetVisitIds(visits), testing::ElementsAre()); + EXPECT_TRUE(continuation_params.exhausted_unclustered_visits); + EXPECT_FALSE(continuation_params.exhausted_all_visits); + } + { + const auto [clusters, visits] = + NextQueryClusters(continuation_params, false); + ASSERT_THAT(GetClusterIds(clusters), testing::ElementsAre(2)); + EXPECT_THAT(GetVisitIds(clusters[0].visits), testing::ElementsAre(4)); + EXPECT_THAT(GetVisitIds(visits), testing::ElementsAre()); + EXPECT_TRUE(continuation_params.exhausted_unclustered_visits); + EXPECT_FALSE(continuation_params.exhausted_all_visits); + } + { + const auto [clusters, visits] = + NextQueryClusters(continuation_params, false); + ASSERT_THAT(GetClusterIds(clusters), testing::ElementsAre(3)); + EXPECT_THAT(GetVisitIds(clusters[0].visits), testing::ElementsAre(5)); + EXPECT_THAT(GetVisitIds(visits), testing::ElementsAre()); + EXPECT_TRUE(continuation_params.exhausted_unclustered_visits); + EXPECT_FALSE(continuation_params.exhausted_all_visits); + } + // The last query should set `exhausted_all_visits`. + { + const auto [clusters, visits] = + NextQueryClusters(continuation_params, false); EXPECT_THAT(GetClusterIds(clusters), testing::ElementsAre()); + EXPECT_THAT(GetVisitIds(visits), testing::ElementsAre()); EXPECT_TRUE(continuation_params.exhausted_unclustered_visits); EXPECT_TRUE(continuation_params.exhausted_all_visits); } @@ -554,11 +585,33 @@ EXPECT_TRUE(continuation_params.exhausted_unclustered_visits); EXPECT_FALSE(continuation_params.exhausted_all_visits); } - // 3rd query should set `exhausted_all_visits`. No clusters should be returned - // (not implemented yet). + // 3rd query should return the 1st cluster from 2 days ago; it shouldn't be + // skipped even though the 2nd query already returned a visit from 2 days ago. { - const auto clusters = NextQueryClusters(continuation_params, false).first; + const auto [clusters, visits] = + NextQueryClusters(continuation_params, false); + ASSERT_THAT(GetClusterIds(clusters), testing::ElementsAre(1)); + EXPECT_THAT(GetVisitIds(clusters[0].visits), testing::ElementsAre(3)); + EXPECT_THAT(GetVisitIds(visits), testing::ElementsAre()); + EXPECT_TRUE(continuation_params.exhausted_unclustered_visits); + EXPECT_FALSE(continuation_params.exhausted_all_visits); + } + // 4th query should return the non-mixed cluster. + { + const auto [clusters, visits] = + NextQueryClusters(continuation_params, false); + ASSERT_THAT(GetClusterIds(clusters), testing::ElementsAre(2)); + EXPECT_THAT(GetVisitIds(clusters[0].visits), testing::ElementsAre(4)); + EXPECT_THAT(GetVisitIds(visits), testing::ElementsAre()); + EXPECT_TRUE(continuation_params.exhausted_unclustered_visits); + EXPECT_FALSE(continuation_params.exhausted_all_visits); + } + // Last query should set `exhausted_all_visits`. + { + const auto [clusters, visits] = + NextQueryClusters(continuation_params, false); EXPECT_THAT(GetClusterIds(clusters), testing::ElementsAre()); + EXPECT_THAT(GetVisitIds(visits), testing::ElementsAre()); EXPECT_TRUE(continuation_params.exhausted_unclustered_visits); EXPECT_TRUE(continuation_params.exhausted_all_visits); } @@ -1200,11 +1253,6 @@ AddIncompleteVisit(6, 6, yesterday); AddIncompleteVisit(7, 7, yesterday); - // Kick off cluster request. - EXPECT_FALSE(history_clusters_service_->DoesQueryMatchAnyCluster("peach")); - test_clustering_backend_->WaitForGetClustersCall(); - ASSERT_EQ(test_clustering_backend_->LastClusteredVisits().size(), 7u); - // Create 4 clusters: std::vector<history::AnnotatedVisit> visits = test_clustering_backend_->LastClusteredVisits(); @@ -1212,11 +1260,7 @@ // 1) A cluster with 4 phrases and 6 words. The next cluster's keywords should // also be cached since we have less than 5 phrases. clusters.push_back( - history::Cluster(0, - { - test_clustering_backend_->GetVisitById(1), - test_clustering_backend_->GetVisitById(2), - }, + history::Cluster(0, {{}, {}}, {{u"one", history::ClusterKeywordData()}, {u"two", history::ClusterKeywordData()}, {u"three", history::ClusterKeywordData()}, @@ -1225,35 +1269,26 @@ // 2) The 2nd cluster has only 1 visit. Since it's keywords won't be cached, // they should not affect the max. clusters.push_back(history::Cluster( - 0, - { - test_clustering_backend_->GetVisitById(3), - }, + 0, {{}}, {{u"ignored not cached", history::ClusterKeywordData()}, {u"elephant penguin kangaroo", history::ClusterKeywordData()}}, /*should_show_on_prominent_ui_surfaces=*/true)); // 3) With this 3rd cluster, we'll have 5 phrases and 7 words. Now that we've // reached 5 phrases, the next cluster's keywords should not be cached. clusters.push_back( - history::Cluster(0, - { - test_clustering_backend_->GetVisitById(4), - test_clustering_backend_->GetVisitById(5), - }, - {{u"seven", history::ClusterKeywordData()}}, + history::Cluster(0, {{}, {}}, {{u"seven", history::ClusterKeywordData()}}, /*should_show_on_prominent_ui_surfaces=*/true)); // 4) The 4th cluster's keywords should not be cached since we've reached 5 // phrases. clusters.push_back( - history::Cluster(0, - { - test_clustering_backend_->GetVisitById(6), - test_clustering_backend_->GetVisitById(7), - }, - {{u"eight", history::ClusterKeywordData()}}, + history::Cluster(0, {{}, {}}, {{u"eight", history::ClusterKeywordData()}}, /*should_show_on_prominent_ui_surfaces=*/true)); - test_clustering_backend_->FulfillCallback(clusters); - history::BlockUntilHistoryProcessesPendingRequests(history_service_.get()); + + // Kick off cluster request. + EXPECT_FALSE(history_clusters_service_->DoesQueryMatchAnyCluster("peach")); + FlushKeywordRequests(clusters, 1); + + ASSERT_EQ(test_clustering_backend_->LastClusteredVisits().size(), 7u); // The 1st cluster's phrases should always be cached. EXPECT_TRUE(history_clusters_service_->DoesQueryMatchAnyCluster("one"));
diff --git a/components/permissions/bluetooth_delegate_impl.cc b/components/permissions/bluetooth_delegate_impl.cc index 76612dd..2f6a608c 100644 --- a/components/permissions/bluetooth_delegate_impl.cc +++ b/components/permissions/bluetooth_delegate_impl.cc
@@ -38,20 +38,13 @@ return client_->ShowBluetoothScanningPrompt(frame, event_handler); } -void BluetoothDelegateImpl::ShowDeviceCredentialsPrompt( +void BluetoothDelegateImpl::ShowDevicePairPrompt( RenderFrameHost* frame, const std::u16string& device_identifier, - CredentialsCallback callback) { - client_->ShowBluetoothDeviceCredentialsDialog(frame, device_identifier, - std::move(callback)); -} - -void BluetoothDelegateImpl::ShowDevicePairConfirmPrompt( - RenderFrameHost* frame, - const std::u16string& device_identifier, - PairConfirmCallback callback) { - client_->ShowBluetoothDevicePairConfirmDialog(frame, device_identifier, - std::move(callback)); + PairPromptCallback callback, + PairingKind pairing_kind) { + client_->ShowBluetoothDevicePairDialog(frame, device_identifier, + std::move(callback), pairing_kind); } WebBluetoothDeviceId BluetoothDelegateImpl::GetWebBluetoothDeviceId(
diff --git a/components/permissions/bluetooth_delegate_impl.h b/components/permissions/bluetooth_delegate_impl.h index fda295c5..850b423 100644 --- a/components/permissions/bluetooth_delegate_impl.h +++ b/components/permissions/bluetooth_delegate_impl.h
@@ -65,25 +65,18 @@ const content::BluetoothScanningPrompt::EventHandler& event_handler) = 0; - // Prompt the user for Bluetooth credentials (AKA Passkey). + // Prompt the user for pairing Bluetooth device. // // The |device_identifier| is a localized string (device name, address, // etc.) displayed to the user for identification purposes. When the // prompt is complete |callback| is called with the result. - virtual void ShowBluetoothDeviceCredentialsDialog( + // |pairing_kind| is to determine which pairing kind of prompt should be + // shown. + virtual void ShowBluetoothDevicePairDialog( content::RenderFrameHost* frame, const std::u16string& device_identifier, - content::BluetoothDelegate::CredentialsCallback callback) = 0; - - // Prompt the user to consent pairing device. - // - // The |device_identifier| is a localized string (device name, address, - // etc.) displayed to the user for identification purposes. When the - // prompt is complete |callback| is called with the result. - virtual void ShowBluetoothDevicePairConfirmDialog( - content::RenderFrameHost* frame, - const std::u16string& device_identifier, - content::BluetoothDelegate::PairConfirmCallback callback) = 0; + content::BluetoothDelegate::PairPromptCallback callback, + content::BluetoothDelegate::PairingKind pairng_kind) = 0; }; explicit BluetoothDelegateImpl(std::unique_ptr<Client> client); @@ -100,12 +93,12 @@ content::RenderFrameHost* frame, const content::BluetoothScanningPrompt::EventHandler& event_handler) override; - void ShowDeviceCredentialsPrompt(content::RenderFrameHost* frame, - const std::u16string& device_identifier, - CredentialsCallback callback) override; - void ShowDevicePairConfirmPrompt(content::RenderFrameHost* frame, - const std::u16string& device_identifier, - PairConfirmCallback callback) override; + + void ShowDevicePairPrompt(content::RenderFrameHost* frame, + const std::u16string& device_identifier, + PairPromptCallback callback, + PairingKind pairing_kind) override; + blink::WebBluetoothDeviceId GetWebBluetoothDeviceId( content::RenderFrameHost* frame, const std::string& device_address) override;
diff --git a/components/policy/core/common/policy_loader_common.cc b/components/policy/core/common/policy_loader_common.cc index 7e7edcc..db37bbab 100644 --- a/components/policy/core/common/policy_loader_common.cc +++ b/components/policy/core/common/policy_loader_common.cc
@@ -42,8 +42,6 @@ // Please keep the list in alphabetical order! const char* kSensitivePolicies[] = { key::kAutoOpenFileTypes, - key::kChromeCleanupEnabled, - key::kChromeCleanupReportingEnabled, key::kCommandLineFlagSecurityWarningsEnabled, key::kDefaultSearchProviderEnabled, key::kFirstPartySetsOverrides, @@ -55,9 +53,13 @@ key::kPasswordProtectionLoginURLs, key::kRestoreOnStartup, key::kRestoreOnStartupURLs, - key::kSafeBrowsingForTrustedSourcesEnabled, key::kSafeBrowsingEnabled, key::kSafeBrowsingAllowlistDomains, +#if BUILDFLAG(IS_WIN) + key::kChromeCleanupEnabled, + key::kChromeCleanupReportingEnabled, + key::kSafeBrowsingForTrustedSourcesEnabled, +#endif }; void RecordInvalidPolicies(const std::string& policy_name) {
diff --git a/components/policy/core/common/policy_pref_names.cc b/components/policy/core/common/policy_pref_names.cc index a9231c0..27402375 100644 --- a/components/policy/core/common/policy_pref_names.cc +++ b/components/policy/core/common/policy_pref_names.cc
@@ -107,9 +107,6 @@ const char kIsolatedAppsDeveloperModeAllowed[] = "policy.isolated_apps_developer_mode_allowed"; -// Boolean policy to force WebSQL to be enabled. -const char kWebSQLAccess[] = "policy.web_sql_access"; - #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) // Last time that a check for cloud policy management was done. This time is // recorded on Android and iOS so that retries aren't attempted on every
diff --git a/components/policy/core/common/policy_pref_names.h b/components/policy/core/common/policy_pref_names.h index 82d3eed..1f8e366 100644 --- a/components/policy/core/common/policy_pref_names.h +++ b/components/policy/core/common/policy_pref_names.h
@@ -40,7 +40,6 @@ POLICY_EXPORT extern const char kBackForwardCacheEnabled[]; #endif // BUILDFLAG(IS_ANDROID) POLICY_EXPORT extern const char kIsolatedAppsDeveloperModeAllowed[]; -POLICY_EXPORT extern const char kWebSQLAccess[]; #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) POLICY_EXPORT extern const char kLastPolicyCheckTime[]; #endif
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index d0d9a735..8778ee8c 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -31122,13 +31122,13 @@ }, { 'name': 'WebSQLAccess', - 'owners': ['arichiv@chromium.org'], + 'owners': ['arichiv@chromium.org', 'chrome-owp-storage@google.com'], 'type': 'main', 'schema': { 'type': 'boolean' }, 'supported_on': ['android:101-', 'chrome.*:101-', 'chrome_os:101-'], 'features': { 'dynamic_refresh': False, - 'per_profile': False, + 'per_profile': True, }, 'items': [ { @@ -31150,6 +31150,35 @@ If this policy is set to true, WebSQL cannot be disabled.''', }, { + 'name': 'WebSQLNonSecureContextEnabled', + 'owners': ['ayui@chromium.org', 'chrome-owp-storage@google.com'], + 'type': 'main', + 'schema': { 'type': 'boolean' }, + 'supported_on': ['android:105-110', 'chrome.*:105-110', 'chrome_os:105-110'], + 'features': { + 'dynamic_refresh': False, + 'per_profile': True, + }, + 'items': [ + { + 'value': True, + 'caption': 'Force WebSQL in non-secure contexts to be enabled.', + }, + { + 'value': False, + 'caption': 'Disable WebSQL in non-secure contexts unless enabled by Chrome flag.', + }, + ], + 'default': False, + 'example_value': True, + 'id': 993, + 'caption': '''Force WebSQL in non-secure contexts to be enabled.''', + 'tags': [], + 'desc': '''WebSQL in non-secure contexts is off by default as of M107 and will be fully removed in M110. + If this policy is set to false or unset, WebSQL in non-secure contexts will remain on until the end of M106, then off from M107. + If this policy is set to true, WebSQL in non-secure contexts will be enabled.''', + }, + { 'name': 'SetTimeoutWithout1MsClampEnabled', 'owners': ['file://third_party/blink/renderer/core/frame/OWNERS', 'shaseley@chromium.org', 'bokan@chromium.org', 'dcheng@chromium.org', 'japhet@chromium.org'], 'type': 'main', @@ -32509,6 +32538,6 @@ 'placeholders': [], 'deleted_policy_ids': [114, 115, 204, 205, 206, 341, 412, 476, 544, 546, 562, 569, 578, 583, 585, 586, 587, 588, 589, 590, 591, 600, 668, 669, 872], 'deleted_atomic_policy_group_ids': [19], - 'highest_id_currently_used': 992, + 'highest_id_currently_used': 993, 'highest_atomic_group_id_currently_used': 43 }
diff --git a/components/policy/tools/generate_policy_source.py b/components/policy/tools/generate_policy_source.py index ae46a935..724531af 100755 --- a/components/policy/tools/generate_policy_source.py +++ b/components/policy/tools/generate_policy_source.py
@@ -504,7 +504,7 @@ # Ensure only windows supported policies are returned when building for windows. # Eventually only supported policies on every platforms will be returned. def _GetSupportedPolicies(policies, target_platform): - if target_platform in ['win', 'linux']: + if target_platform in ['win', 'linux', 'mac']: return [policy for policy in policies if policy.is_supported] return [
diff --git a/components/policy/tools/generate_policy_source_test.py b/components/policy/tools/generate_policy_source_test.py index a1ddd2c3..6d810f7 100755 --- a/components/policy/tools/generate_policy_source_test.py +++ b/components/policy/tools/generate_policy_source_test.py
@@ -134,8 +134,7 @@ "type": "string" }, "supported_on": ["chrome_os:1-93", "android:1-93", "chrome.*:1-93"], - "id": - 7, + "id": 7, "tags": [], "caption": "DeprecatedButGenerated caption",
diff --git a/components/services/storage/DEPS b/components/services/storage/DEPS index 8c47aae7..47d0c5ee 100644 --- a/components/services/storage/DEPS +++ b/components/services/storage/DEPS
@@ -1,4 +1,5 @@ include_rules = [ + "+components/prefs", "+net", "+third_party/blink/public/common", "+third_party/blink/public/mojom",
diff --git a/components/services/storage/public/cpp/BUILD.gn b/components/services/storage/public/cpp/BUILD.gn index 867ebf9..d8ce4974 100644 --- a/components/services/storage/public/cpp/BUILD.gn +++ b/components/services/storage/public/cpp/BUILD.gn
@@ -2,6 +2,15 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +static_library("prefs") { + sources = [ + "storage_prefs.cc", + "storage_prefs.h", + ] + + deps = [ "//components/prefs:prefs" ] +} + component("cpp") { output_name = "storage_service_public"
diff --git a/components/services/storage/public/cpp/storage_prefs.cc b/components/services/storage/public/cpp/storage_prefs.cc new file mode 100644 index 0000000..7251833 --- /dev/null +++ b/components/services/storage/public/cpp/storage_prefs.cc
@@ -0,0 +1,23 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/services/storage/public/cpp/storage_prefs.h" + +#include "components/prefs/pref_registry_simple.h" + +namespace storage { + +// Boolean policy to force WebSQL to be enabled. +const char kWebSQLAccess[] = "policy.web_sql_access"; + +// Boolean policy to force WebSQL in non-secure contexts to be enabled. +const char kWebSQLNonSecureContextEnabled[] = + "policy.web_sql_non_secure_context_enabled"; + +void RegisterProfilePrefs(PrefRegistrySimple* registry) { + registry->RegisterBooleanPref(kWebSQLAccess, false); + registry->RegisterBooleanPref(kWebSQLNonSecureContextEnabled, false); +} + +} // namespace storage
diff --git a/components/services/storage/public/cpp/storage_prefs.h b/components/services/storage/public/cpp/storage_prefs.h new file mode 100644 index 0000000..91d378ee --- /dev/null +++ b/components/services/storage/public/cpp/storage_prefs.h
@@ -0,0 +1,20 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_SERVICES_STORAGE_PUBLIC_CPP_STORAGE_PREFS_H_ +#define COMPONENTS_SERVICES_STORAGE_PUBLIC_CPP_STORAGE_PREFS_H_ + +class PrefRegistrySimple; + +namespace storage { + +extern const char kWebSQLAccess[]; + +extern const char kWebSQLNonSecureContextEnabled[]; + +void RegisterProfilePrefs(PrefRegistrySimple* registry); + +} // namespace storage + +#endif // COMPONENTS_SERVICES_STORAGE_PUBLIC_CPP_STORAGE_PREFS_H_
diff --git a/components/test/data/webcrypto/aes_gcm.json b/components/test/data/webcrypto/aes_gcm.json deleted file mode 100644 index 2624f11..0000000 --- a/components/test/data/webcrypto/aes_gcm.json +++ /dev/null
@@ -1,61 +0,0 @@ -// These tests come from the NIST GCM test vectors: -// http://csrc.nist.gov/groups/STM/cavp/documents/mac/gcmtestvectors.zip -// -// Both encryption and decryption are expected to work. -[ - // [Keylen = 128] - // [IVlen = 96] - // [PTlen = 0] - // [AADlen = 0] - // [Taglen = 128] - { - "key": "cf063a34d4a9a76c2c86787d3f96db71", - "iv": "113b9785971864c83b01c787", - "plain_text": "", - "cipher_text": "", - "additional_data": "", - "authentication_tag": "72ac8493e3a5228b5d130a69d2510e42" - }, - - // [Keylen = 128] - // [IVlen = 96] - // [PTlen = 0] - // [AADlen = 128] - // [Taglen = 120] - { - "key": "6dfa1a07c14f978020ace450ad663d18", - "iv": "34edfa462a14c6969a680ec1", - "plain_text": "", - "cipher_text": "", - "additional_data": "2a35c7f5f8578e919a581c60500c04f6", - "authentication_tag": "751f3098d59cf4ea1d2fb0853bde1c" - }, - - // [Keylen = 128] - // [IVlen = 96] - // [PTlen = 128] - // [AADlen = 128] - // [Taglen = 112] - { - "key": "ed6cd876ceba555706674445c229c12d", - "iv": "92ecbf74b765bc486383ca2e", - "plain_text": "bfaaaea3880d72d4378561e2597a9b35", - "cipher_text": "bdd2ed6c66fa087dce617d7fd1ff6d93", - "additional_data": "95bd10d77dbe0e87fb34217f1a2e5efe", - "authentication_tag": "ba82e49c55a22ed02ca67da4ec6f" - }, - - // [Keylen = 256] - // [IVlen = 1024] - // [PTlen = 408] - // [AADlen = 720] - // [Taglen = 32] - { - "key": "e03548984a7ec8eaf0870637df0ac6bc17f7159315d0ae26a764fd224e483810", - "iv": "f4feb26b846be4cd224dbc5133a5ae13814ebe19d3032acdd3a006463fdb71e83a9d5d96679f26cc1719dd6b4feb3bab5b4b7993d0c0681f36d105ad3002fb66b201538e2b7479838ab83402b0d816cd6e0fe5857e6f4adf92de8ee72b122ba1ac81795024943b7d0151bbf84ce87c8911f512c397d14112296da7ecdd0da52a", - "cipher_text": "fda718aa1ec163487e21afc34f5a3a34795a9ee71dd3e7ee9a18fdb24181dc982b29c6ec723294a130ca2234952bb0ef68c0f3", - "additional_data": "aab26eb3e7acd09a034a9e2651636ab3868e51281590ecc948355e457da42b7ad1391c7be0d9e82895e506173a81857c3226829fbd6dfb3f9657a71a2934445d7c05fa9401cddd5109016ba32c3856afaadc48de80b8a01b57cb", - "authentication_tag": "4795fbe0", - "plain_text": "69fd0c9da10b56ec6786333f8d76d4b74f8a434195f2f241f088b2520fb5fa29455df9893164fb1638abe6617915d9497a8fe2" - } -]
diff --git a/components/update_client/protocol_serializer.cc b/components/update_client/protocol_serializer.cc index 16bd70b..408e99b 100644 --- a/components/update_client/protocol_serializer.cc +++ b/components/update_client/protocol_serializer.cc
@@ -37,9 +37,7 @@ // Returns the amount of physical memory in GB, rounded to the nearest GB. int GetPhysicalMemoryGB() { - const double kOneGB = 1024 * 1024 * 1024; - const int64_t phys_mem = base::SysInfo::AmountOfPhysicalMemory(); - return static_cast<int>(std::floor(0.5 + phys_mem / kOneGB)); + return base::ClampRound(base::SysInfo::AmountOfPhysicalMemoryMB() / 1024.0f); } std::string GetOSVersion() {
diff --git a/components/user_education/webui/help_bubble_handler.cc b/components/user_education/webui/help_bubble_handler.cc index b2b447c5..2dd59490 100644 --- a/components/user_education/webui/help_bubble_handler.cc +++ b/components/user_education/webui/help_bubble_handler.cc
@@ -123,6 +123,8 @@ auto mojom_params = help_bubble::mojom::HelpBubbleParams::New(); mojom_params->native_identifier = identifier.GetName(); mojom_params->body_text = base::UTF16ToUTF8(data.params->body_text); + mojom_params->close_button_alt_text = + base::UTF16ToUTF8(data.params->close_button_alt_text); mojom_params->position = HelpBubbleArrowToPosition(data.params->arrow); if (!data.params->title_text.empty()) { mojom_params->title_text = base::UTF16ToUTF8(data.params->title_text);
diff --git a/components/user_education/webui/help_bubble_handler_unittest.cc b/components/user_education/webui/help_bubble_handler_unittest.cc index f40b657..3d9c9a4d 100644 --- a/components/user_education/webui/help_bubble_handler_unittest.cc +++ b/components/user_education/webui/help_bubble_handler_unittest.cc
@@ -6,7 +6,9 @@ #include <vector> #include "base/memory/raw_ptr.h" +#include "base/strings/utf_string_conversions.h" #include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/common/help_bubble_params.h" #include "components/user_education/webui/help_bubble_handler.h" #include "components/user_education/webui/help_bubble_webui.h" #include "components/user_education/webui/tracked_element_webui.h" @@ -15,6 +17,8 @@ #include "ui/base/interaction/element_identifier.h" #include "ui/base/interaction/element_tracker.h" #include "ui/base/interaction/expect_call_in_scope.h" +#include "ui/webui/resources/cr_components/help_bubble/help_bubble.mojom-forward.h" +#include "ui/webui/resources/cr_components/help_bubble/help_bubble.mojom-shared.h" #include "ui/webui/resources/cr_components/help_bubble/help_bubble.mojom.h" namespace user_education { @@ -82,6 +86,24 @@ }; }; +MATCHER_P(MatchesHelpBubbleParams, expected, "") { + EXPECT_EQ(expected->body_text, arg->body_text); + EXPECT_EQ(expected->close_button_alt_text, arg->close_button_alt_text); + EXPECT_EQ(expected->native_identifier, arg->native_identifier); + EXPECT_EQ(expected->position, arg->position); + EXPECT_EQ(expected->title_text, arg->title_text); + + EXPECT_EQ(expected->buttons.size(), arg->buttons.size()); + if (expected->buttons.size() == arg->buttons.size()) { + for (size_t i = 0; i < expected->buttons.size(); ++i) { + EXPECT_EQ(expected->buttons[i]->text, arg->buttons[i]->text); + EXPECT_EQ(expected->buttons[i]->is_default, arg->buttons[i]->is_default); + } + } + + return true; +} + } // namespace // Tests the interaction of HelpBubbleHandler, HelpBubbleWebUI, and @@ -187,9 +209,20 @@ ASSERT_NE(nullptr, element); HelpBubbleParams params; params.body_text = u"Help bubble body."; + params.close_button_alt_text = u"Close button alt text."; params.arrow = HelpBubbleArrow::kTopCenter; - EXPECT_CALL(test_handler_->mock(), ShowHelpBubble(testing::_)); + // Check the parameters passed to the ShowHelpBubble mojo method. + help_bubble::mojom::HelpBubbleParamsPtr expected = + help_bubble::mojom::HelpBubbleParams::New(); + expected->native_identifier = element->identifier().GetName(); + expected->body_text = base::UTF16ToUTF8(params.body_text); + expected->close_button_alt_text = + base::UTF16ToUTF8(params.close_button_alt_text); + expected->position = help_bubble::mojom::HelpBubblePosition::BELOW; + + EXPECT_CALL(test_handler_->mock(), + ShowHelpBubble(MatchesHelpBubbleParams(expected.get()))); auto help_bubble = help_bubble_factory_registry_.CreateHelpBubble( element, std::move(params)); EXPECT_CALL(test_handler_->mock(), ShowHelpBubble(testing::_)).Times(0);
diff --git a/components/value_store/leveldb_value_store.cc b/components/value_store/leveldb_value_store.cc index 50bd89ae..a476933 100644 --- a/components/value_store/leveldb_value_store.cc +++ b/components/value_store/leveldb_value_store.cc
@@ -144,7 +144,7 @@ ValueStore::WriteResult LeveldbValueStore::Set( WriteOptions options, - const base::DictionaryValue& settings) { + const base::Value::Dict& settings) { Status status = EnsureDbIsOpen(); if (!status.ok()) return WriteResult(std::move(status)); @@ -152,9 +152,8 @@ leveldb::WriteBatch batch; ValueStoreChangeList changes; - for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd(); - it.Advance()) { - status.Merge(AddToBatch(options, it.key(), it.value(), &batch, &changes)); + for (const auto [key, value] : settings) { + status.Merge(AddToBatch(options, key, value, &batch, &changes)); if (!status.ok()) return WriteResult(std::move(status)); }
diff --git a/components/value_store/leveldb_value_store.h b/components/value_store/leveldb_value_store.h index 8741a1e..22029c1 100644 --- a/components/value_store/leveldb_value_store.h +++ b/components/value_store/leveldb_value_store.h
@@ -52,7 +52,7 @@ const std::string& key, const base::Value& value) override; WriteResult Set(ValueStore::WriteOptions options, - const base::DictionaryValue& values) override; + const base::Value::Dict& values) override; WriteResult Remove(const std::string& key) override; WriteResult Remove(const std::vector<std::string>& keys) override; WriteResult Clear() override;
diff --git a/components/value_store/testing_value_store.cc b/components/value_store/testing_value_store.cc index 42dc5b5..2a77c17 100644 --- a/components/value_store/testing_value_store.cc +++ b/components/value_store/testing_value_store.cc
@@ -79,29 +79,28 @@ ValueStore::WriteResult TestingValueStore::Set(WriteOptions options, const std::string& key, const base::Value& value) { - base::DictionaryValue settings; - settings.SetKey(key, value.Clone()); + base::Value::Dict settings; + settings.Set(key, value.Clone()); return Set(options, settings); } ValueStore::WriteResult TestingValueStore::Set( WriteOptions options, - const base::DictionaryValue& settings) { + const base::Value::Dict& settings) { write_count_++; if (!status_.ok()) return WriteResult(CreateStatusCopy(status_)); ValueStoreChangeList changes; - for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd(); - it.Advance()) { - base::Value* old_value = storage_.Find(it.key()); - if (!old_value || *old_value != it.value()) { - changes.emplace_back(it.key(), + for (const auto [key, value] : settings) { + base::Value* old_value = storage_.Find(key); + if (!old_value || *old_value != value) { + changes.emplace_back(key, old_value ? absl::optional<base::Value>(old_value->Clone()) : absl::nullopt, - it.value().Clone()); - storage_.Set(it.key(), it.value().Clone()); + value.Clone()); + storage_.Set(key, value.Clone()); } } return WriteResult(std::move(changes), CreateStatusCopy(status_));
diff --git a/components/value_store/testing_value_store.h b/components/value_store/testing_value_store.h index f82839b..733b1dee 100644 --- a/components/value_store/testing_value_store.h +++ b/components/value_store/testing_value_store.h
@@ -47,7 +47,7 @@ const std::string& key, const base::Value& value) override; WriteResult Set(WriteOptions options, - const base::DictionaryValue& values) override; + const base::Value::Dict& values) override; WriteResult Remove(const std::string& key) override; WriteResult Remove(const std::vector<std::string>& keys) override; WriteResult Clear() override;
diff --git a/components/value_store/value_store.h b/components/value_store/value_store.h index 6ff40e30..baf3cea 100644 --- a/components/value_store/value_store.h +++ b/components/value_store/value_store.h
@@ -183,7 +183,7 @@ // Sets multiple keys to new values. virtual WriteResult Set(WriteOptions options, - const base::DictionaryValue& values) = 0; + const base::Value::Dict& values) = 0; // Removes a key from the storage. virtual WriteResult Remove(const std::string& key) = 0;
diff --git a/components/value_store/value_store_test_suite.cc b/components/value_store/value_store_test_suite.cc index 48f2111..c0d2c48 100644 --- a/components/value_store/value_store_test_suite.cc +++ b/components/value_store/value_store_test_suite.cc
@@ -21,7 +21,7 @@ // Returns whether the read result of a storage operation has the expected // settings. -void ExpectSettingsEq(const base::DictionaryValue& expected, +void ExpectSettingsEq(const base::Value::Dict& expected, ValueStore::ReadResult actual_result) { ASSERT_TRUE(actual_result.status().ok()) << actual_result.status().message; EXPECT_EQ(expected, actual_result.settings()); @@ -54,10 +54,10 @@ } } -base::DictionaryValue MakeTestMap(std::map<std::string, std::string> pairs) { - base::DictionaryValue map; +base::Value::Dict MakeTestMap(std::map<std::string, std::string> pairs) { + base::Value::Dict map; for (const auto& it : pairs) - map.GetDict().Set(it.first, std::move(it.second)); + map.Set(it.first, std::move(it.second)); return map; } @@ -86,8 +86,7 @@ ValueStoreChange{"foo", absl::nullopt, base::Value{"baz"}}); expected_changes.push_back( ValueStoreChange{"bar", absl::nullopt, base::Value{"qux"}}); - base::DictionaryValue settings = - MakeTestMap({{"foo", "baz"}, {"bar", "qux"}}); + base::Value::Dict settings = MakeTestMap({{"foo", "baz"}, {"bar", "qux"}}); ExpectChangesEq(expected_changes, storage_->Set(DEFAULTS, settings)); } @@ -96,8 +95,7 @@ } TEST_P(ValueStoreTestSuite, RemoveSingleKeyProducesMatchingChanges) { - base::DictionaryValue settings = - MakeTestMap({{"foo", "baz"}, {"bar", "qux"}}); + base::Value::Dict settings = MakeTestMap({{"foo", "baz"}, {"bar", "qux"}}); storage_->Set(DEFAULTS, settings); ValueStoreChangeList changes; @@ -106,7 +104,7 @@ } TEST_P(ValueStoreTestSuite, RemoveKeyListProducesMatchingChanges) { - base::DictionaryValue settings = + base::Value::Dict settings = MakeTestMap({{"foo", "baz"}, {"bar", "qux"}, {"abc", "def"}}); storage_->Set(DEFAULTS, settings); @@ -118,55 +116,51 @@ } TEST_P(ValueStoreTestSuite, SetValuesCanBeRetrievedOneAtATime) { - base::DictionaryValue settings = - MakeTestMap({{"foo", "baz"}, {"bar", "qux"}}); + base::Value::Dict settings = MakeTestMap({{"foo", "baz"}, {"bar", "qux"}}); storage_->Set(DEFAULTS, settings); ExpectSettingsEq(MakeTestMap({{"foo", "baz"}}), storage_->Get("foo")); ExpectSettingsEq(MakeTestMap({{"bar", "qux"}}), storage_->Get("bar")); } TEST_P(ValueStoreTestSuite, SetValuesCanBeRetrievedWithKeyList) { - base::DictionaryValue settings = - MakeTestMap({{"foo", "baz"}, {"bar", "qux"}}); + base::Value::Dict settings = MakeTestMap({{"foo", "baz"}, {"bar", "qux"}}); storage_->Set(DEFAULTS, settings); ExpectSettingsEq(settings, storage_->Get(std::vector<std::string>{"foo", "bar"})); } TEST_P(ValueStoreTestSuite, MissingKeysSkippedInListRetrieve) { - base::DictionaryValue settings = - MakeTestMap({{"foo", "baz"}, {"bar", "qux"}}); + base::Value::Dict settings = MakeTestMap({{"foo", "baz"}, {"bar", "qux"}}); storage_->Set(DEFAULTS, settings); ExpectSettingsEq( settings, storage_->Get(std::vector<std::string>{"foo", "bar", "baz"})); } TEST_P(ValueStoreTestSuite, GetAllDoesGetAll) { - base::DictionaryValue settings = - MakeTestMap({{"foo", "baz"}, {"bar", "qux"}}); + base::Value::Dict settings = MakeTestMap({{"foo", "baz"}, {"bar", "qux"}}); storage_->Set(DEFAULTS, settings); ExpectSettingsEq(settings, storage_->Get()); } TEST_P(ValueStoreTestSuite, RemovedSingleValueIsGone) { - base::DictionaryValue settings = + base::Value::Dict settings = MakeTestMap({{"foo", "baz"}, {"bar", "qux"}, {"abc", "def"}}); storage_->Set(DEFAULTS, settings); ExpectSettingsEq(MakeTestMap({{"foo", "baz"}}), storage_->Get("foo")); storage_->Remove("foo"); - ExpectSettingsEq({}, storage_->Get("foo")); + ExpectSettingsEq(base::Value::Dict(), storage_->Get("foo")); ExpectSettingsEq(MakeTestMap({{"bar", "qux"}}), storage_->Get("bar")); } TEST_P(ValueStoreTestSuite, RemovedMultipleValuesAreGone) { - base::DictionaryValue settings = + base::Value::Dict settings = MakeTestMap({{"foo", "baz"}, {"bar", "qux"}, {"abc", "def"}}); storage_->Set(DEFAULTS, settings); ExpectSettingsEq(MakeTestMap({{"foo", "baz"}, {"bar", "qux"}}), storage_->Get(std::vector<std::string>{"foo", "bar"})); storage_->Remove(std::vector<std::string>{"foo", "bar"}); - ExpectSettingsEq({}, storage_->Get("foo")); - ExpectSettingsEq({}, storage_->Get("bar")); + ExpectSettingsEq(base::Value::Dict(), storage_->Get("foo")); + ExpectSettingsEq(base::Value::Dict(), storage_->Get("bar")); ExpectSettingsEq(MakeTestMap({{"abc", "def"}}), storage_->Get("abc")); } @@ -193,16 +187,16 @@ TEST_P(ValueStoreTestSuite, ClearedValuesAreGone) { storage_->Set(DEFAULTS, MakeTestMap({{"foo", "baz"}, {"bar", "qux"}})); storage_->Clear(); - ExpectSettingsEq({}, storage_->Get("foo")); - ExpectSettingsEq({}, storage_->Get("bar")); + ExpectSettingsEq(base::Value::Dict(), storage_->Get("foo")); + ExpectSettingsEq(base::Value::Dict(), storage_->Get("bar")); } TEST_P(ValueStoreTestSuite, DotsAllowedInKeyNames) { - base::DictionaryValue dict; - auto inner_dict = std::make_unique<base::DictionaryValue>(); - inner_dict->SetString("bar", "baz"); + base::Value::Dict dict; + base::Value::Dict inner_dict; + inner_dict.Set("bar", "baz"); dict.Set("foo", std::move(inner_dict)); - dict.SetStringKey("foo.bar", "qux"); + dict.Set("foo.bar", "qux"); storage_->Set(DEFAULTS, dict);
diff --git a/components/webcrypto/algorithms/aes_gcm_unittest.cc b/components/webcrypto/algorithms/aes_gcm_unittest.cc index 421540d..4415b57 100644 --- a/components/webcrypto/algorithms/aes_gcm_unittest.cc +++ b/components/webcrypto/algorithms/aes_gcm_unittest.cc
@@ -5,7 +5,7 @@ #include <stddef.h> #include <stdint.h> -#include "base/values.h" +#include "base/types/expected.h" #include "components/webcrypto/algorithm_dispatch.h" #include "components/webcrypto/algorithms/test_helpers.h" #include "components/webcrypto/status.h" @@ -34,74 +34,53 @@ key_length_bits); } -Status AesGcmEncrypt(const blink::WebCryptoKey& key, - const std::vector<uint8_t>& iv, - const std::vector<uint8_t>& additional_data, - unsigned int tag_length_bits, - const std::vector<uint8_t>& plain_text, - std::vector<uint8_t>* cipher_text, - std::vector<uint8_t>* authentication_tag) { +base::expected<std::vector<uint8_t>, Status> AesGcmEncrypt( + const blink::WebCryptoKey& key, + const std::vector<uint8_t>& iv, + const std::vector<uint8_t>& additional_data, + size_t tag_length_bits, + const std::vector<uint8_t>& plain_text) { blink::WebCryptoAlgorithm algorithm = CreateAesGcmAlgorithm(iv, additional_data, tag_length_bits); std::vector<uint8_t> output; Status status = Encrypt(algorithm, key, plain_text, &output); - if (status.IsError()) - return status; - - if ((tag_length_bits % 8) != 0) { - ADD_FAILURE() << "Encrypt should have failed."; - return Status::OperationError(); + if (status.IsError()) { + return base::unexpected(status); + } else { + return output; } - - size_t tag_length_bytes = tag_length_bits / 8; - - if (tag_length_bytes > output.size()) { - ADD_FAILURE() << "tag length is larger than output"; - return Status::OperationError(); - } - - // The encryption result is cipher text with authentication tag appended. - cipher_text->assign(output.begin(), - output.begin() + (output.size() - tag_length_bytes)); - authentication_tag->assign(output.begin() + cipher_text->size(), - output.end()); - - return Status::Success(); } -Status AesGcmDecrypt(const blink::WebCryptoKey& key, - const std::vector<uint8_t>& iv, - const std::vector<uint8_t>& additional_data, - unsigned int tag_length_bits, - const std::vector<uint8_t>& cipher_text, - const std::vector<uint8_t>& authentication_tag, - std::vector<uint8_t>* plain_text) { +base::expected<std::vector<uint8_t>, Status> AesGcmDecrypt( + const blink::WebCryptoKey& key, + const std::vector<uint8_t>& iv, + const std::vector<uint8_t>& additional_data, + unsigned int tag_length_bits, + const std::vector<uint8_t>& ciphertext) { blink::WebCryptoAlgorithm algorithm = CreateAesGcmAlgorithm(iv, additional_data, tag_length_bits); - // Join cipher text and authentication tag. - std::vector<uint8_t> cipher_text_with_tag; - cipher_text_with_tag.reserve(cipher_text.size() + authentication_tag.size()); - cipher_text_with_tag.insert(cipher_text_with_tag.end(), cipher_text.begin(), - cipher_text.end()); - cipher_text_with_tag.insert(cipher_text_with_tag.end(), - authentication_tag.begin(), - authentication_tag.end()); - - return Decrypt(algorithm, key, cipher_text_with_tag, plain_text); + std::vector<uint8_t> output; + Status status = Decrypt(algorithm, key, ciphertext, &output); + if (status.IsError()) { + return base::unexpected(status); + } else { + return output; + } } class WebCryptoAesGcmTest : public WebCryptoTestBase {}; TEST_F(WebCryptoAesGcmTest, GenerateKeyBadLength) { - blink::WebCryptoKey key; - for (auto len : {0, 127, 257}) { - SCOPED_TRACE(len); - EXPECT_EQ(Status::ErrorGenerateAesKeyLength(), - GenerateSecretKey(CreateAesGcmKeyGenAlgorithm(len), true, - blink::kWebCryptoKeyUsageDecrypt, &key)); - } + auto generate_key = [](size_t len) { + blink::WebCryptoKey key; + return GenerateSecretKey(CreateAesGcmKeyGenAlgorithm(len), true, + blink::kWebCryptoKeyUsageDecrypt, &key); + }; + EXPECT_EQ(generate_key(0), Status::ErrorGenerateAesKeyLength()); + EXPECT_EQ(generate_key(127), Status::ErrorGenerateAesKeyLength()); + EXPECT_EQ(generate_key(257), Status::ErrorGenerateAesKeyLength()); } TEST_F(WebCryptoAesGcmTest, GenerateKeyEmptyUsage) { @@ -125,89 +104,96 @@ "A256GCM"); } +struct AesGcmKnownAnswer { + const char* key; + const char* iv; + const char* plaintext; + const char* additional; + const char* ciphertext; + size_t tagbits; +}; + +// NIST GCM test vectors: +// http://csrc.nist.gov/groups/STM/cavp/documents/mac/gcmtestvectors.zip +const AesGcmKnownAnswer kAesGcmKnownAnswers[] = { + {"cf063a34d4a9a76c2c86787d3f96db71", "113b9785971864c83b01c787", "", "", + "72ac8493e3a5228b5d130a69d2510e42", 128}, + {"6dfa1a07c14f978020ace450ad663d18", "34edfa462a14c6969a680ec1", "", + "2a35c7f5f8578e919a581c60500c04f6", "751f3098d59cf4ea1d2fb0853bde1c", 120}, + {"ed6cd876ceba555706674445c229c12d", "92ecbf74b765bc486383ca2e", + "bfaaaea3880d72d4378561e2597a9b35", "95bd10d77dbe0e87fb34217f1a2e5efe", + "bdd2ed6c66fa087dce617d7fd1ff6d93ba82e49c55a22ed02ca67da4ec6f", 112}, + {"e03548984a7ec8eaf0870637df0ac6bc17f7159315d0ae26a764fd224e483810", + "f4feb26b846be4cd224dbc5133a5ae13814ebe19d3032acdd3a006463fdb71e83a9d5d966" + "79f26cc1719dd6b4feb3bab5b4b7993d0c0681f36d105ad3002fb66b201538e2b7479838a" + "b83402b0d816cd6e0fe5857e6f4adf92de8ee72b122ba1ac81795024943b7d0151bbf84ce" + "87c8911f512c397d14112296da7ecdd0da52a", + "69fd0c9da10b56ec6786333f8d76d4b74f8a434195f2f241f088b2520fb5fa29455df9893" + "164fb1638abe6617915d9497a8fe2", + "aab26eb3e7acd09a034a9e2651636ab3868e51281590ecc948355e457da42b7ad1391c7be" + "0d9e82895e506173a81857c3226829fbd6dfb3f9657a71a2934445d7c05fa9401cddd5109" + "016ba32c3856afaadc48de80b8a01b57cb", + "fda718aa1ec163487e21afc34f5a3a34795a9ee71dd3e7ee9a18fdb24181dc982b29c6ec7" + "23294a130ca2234952bb0ef68c0f34795fbe0", + 32}, +}; + // TODO(eroman): // * Test decryption when the tag length exceeds input size // * Test decryption with empty input // * Test decryption with tag length of 0. -TEST_F(WebCryptoAesGcmTest, SampleSets) { - base::Value::List tests = ReadJsonTestFileAsList("aes_gcm.json"); - +TEST_F(WebCryptoAesGcmTest, KnownAnswers) { // Note that WebCrypto appends the authentication tag to the ciphertext. - for (const auto& test_value : tests) { - SCOPED_TRACE(&test_value - &tests[0]); - ASSERT_TRUE(test_value.is_dict()); - const base::DictionaryValue* test = - &base::Value::AsDictionaryValue(test_value); + for (const auto& test : kAesGcmKnownAnswers) { + SCOPED_TRACE(&test - &kAesGcmKnownAnswers[0]); - const std::vector<uint8_t> test_key = GetBytesFromHexString(test, "key"); - const std::vector<uint8_t> test_iv = GetBytesFromHexString(test, "iv"); - const std::vector<uint8_t> test_additional_data = - GetBytesFromHexString(test, "additional_data"); - const std::vector<uint8_t> test_plain_text = - GetBytesFromHexString(test, "plain_text"); - const std::vector<uint8_t> test_authentication_tag = - GetBytesFromHexString(test, "authentication_tag"); - const unsigned int test_tag_size_bits = - static_cast<unsigned int>(test_authentication_tag.size()) * 8; - const std::vector<uint8_t> test_cipher_text = - GetBytesFromHexString(test, "cipher_text"); + auto key_bytes = HexStringToBytes(test.key); + auto iv_bytes = HexStringToBytes(test.iv); + auto plaintext_bytes = HexStringToBytes(test.plaintext); + auto additional_bytes = HexStringToBytes(test.additional); + auto ciphertext_bytes = HexStringToBytes(test.ciphertext); blink::WebCryptoKey key = ImportSecretKeyFromRaw( - test_key, CreateAlgorithm(blink::kWebCryptoAlgorithmIdAesGcm), + key_bytes, CreateAlgorithm(blink::kWebCryptoAlgorithmIdAesGcm), blink::kWebCryptoKeyUsageEncrypt | blink::kWebCryptoKeyUsageDecrypt); - // Verify exported raw key is identical to the imported data - std::vector<uint8_t> raw_key; - EXPECT_EQ(Status::Success(), - ExportKey(blink::kWebCryptoKeyFormatRaw, key, &raw_key)); + { + std::vector<uint8_t> exported_key; + EXPECT_EQ(Status::Success(), + ExportKey(blink::kWebCryptoKeyFormatRaw, key, &exported_key)); + EXPECT_BYTES_EQ(key_bytes, exported_key); + } - EXPECT_BYTES_EQ(test_key, raw_key); + auto encrypt_result = AesGcmEncrypt(key, iv_bytes, additional_bytes, + test.tagbits, plaintext_bytes); + ASSERT_TRUE(encrypt_result.has_value()) + << encrypt_result.error().error_details(); + EXPECT_BYTES_EQ(encrypt_result.value(), ciphertext_bytes); - // Test encryption. - std::vector<uint8_t> cipher_text; - std::vector<uint8_t> authentication_tag; - EXPECT_EQ( - Status::Success(), - AesGcmEncrypt(key, test_iv, test_additional_data, test_tag_size_bits, - test_plain_text, &cipher_text, &authentication_tag)); - - EXPECT_BYTES_EQ(test_cipher_text, cipher_text); - EXPECT_BYTES_EQ(test_authentication_tag, authentication_tag); - - // Test decryption. - std::vector<uint8_t> plain_text; - EXPECT_EQ( - Status::Success(), - AesGcmDecrypt(key, test_iv, test_additional_data, test_tag_size_bits, - test_cipher_text, test_authentication_tag, &plain_text)); - EXPECT_BYTES_EQ(test_plain_text, plain_text); + auto decrypt_result = AesGcmDecrypt(key, iv_bytes, additional_bytes, + test.tagbits, ciphertext_bytes); + ASSERT_TRUE(decrypt_result.has_value()) + << decrypt_result.error().error_details(); + EXPECT_BYTES_EQ(decrypt_result.value(), plaintext_bytes); // Decryption should fail if any of the inputs are tampered with. - EXPECT_EQ(Status::OperationError(), - AesGcmDecrypt(key, Corrupted(test_iv), test_additional_data, - test_tag_size_bits, test_cipher_text, - test_authentication_tag, &plain_text)); - EXPECT_EQ(Status::OperationError(), - AesGcmDecrypt(key, test_iv, Corrupted(test_additional_data), - test_tag_size_bits, test_cipher_text, - test_authentication_tag, &plain_text)); - EXPECT_EQ(Status::OperationError(), - AesGcmDecrypt(key, test_iv, test_additional_data, - test_tag_size_bits, Corrupted(test_cipher_text), - test_authentication_tag, &plain_text)); - EXPECT_EQ(Status::OperationError(), - AesGcmDecrypt(key, test_iv, test_additional_data, - test_tag_size_bits, test_cipher_text, - Corrupted(test_authentication_tag), &plain_text)); + EXPECT_EQ(base::unexpected(Status::OperationError()), + AesGcmDecrypt(key, Corrupted(iv_bytes), additional_bytes, + test.tagbits, ciphertext_bytes)); + EXPECT_EQ(base::unexpected(Status::OperationError()), + AesGcmDecrypt(key, iv_bytes, Corrupted(additional_bytes), + test.tagbits, ciphertext_bytes)); + EXPECT_EQ(base::unexpected(Status::OperationError()), + AesGcmDecrypt(key, iv_bytes, additional_bytes, test.tagbits, + Corrupted(ciphertext_bytes))); // Try different incorrect tag lengths for (unsigned int length : {0, 8, 96, 120, 128, 160, 255}) { - if (test_tag_size_bits == length) + if (test.tagbits == length) continue; - EXPECT_NE(Status::Success(), - AesGcmDecrypt(key, test_iv, test_additional_data, length, - test_cipher_text, test_authentication_tag, - &plain_text)); + auto result = AesGcmDecrypt(key, iv_bytes, additional_bytes, length, + ciphertext_bytes); + EXPECT_FALSE(result.has_value()); } } }
diff --git a/components/webxr/android/arcore_install_helper.cc b/components/webxr/android/arcore_install_helper.cc index bd8612e..c4a7806a 100644 --- a/components/webxr/android/arcore_install_helper.cc +++ b/components/webxr/android/arcore_install_helper.cc
@@ -8,6 +8,7 @@ #include <utility> #include "base/bind.h" +#include "base/time/time.h" #include "components/messages/android/message_dispatcher_bridge.h" #include "components/resources/android/theme_resources.h" #include "components/strings/grit/components_strings.h" @@ -21,6 +22,11 @@ namespace webxr { +namespace { +// Increase the timeout for the message to 60s from the default 10s. +constexpr base::TimeDelta kMessageTimeout = base::Seconds(60); +} // namespace + ArCoreInstallHelper::ArCoreInstallHelper() { // As per documentation, it's recommended to issue a call to // ArCoreApk.checkAvailability() early in application lifecycle & ignore the @@ -122,6 +128,7 @@ messages::MessageDispatcherBridge::Get(); message_->SetIconResourceId(message_dispatcher_bridge->MapToJavaDrawableId( IDR_ANDROID_AR_CORE_INSALL_ICON)); + message_->SetDuration(kMessageTimeout.InMilliseconds()); message_dispatcher_bridge->EnqueueMessage( message_.get(), GetWebContents(render_process_id, render_frame_id),
diff --git a/components/webxr_strings.grdp b/components/webxr_strings.grdp index 372a013..9a7f6e3 100644 --- a/components/webxr_strings.grdp +++ b/components/webxr_strings.grdp
@@ -3,13 +3,13 @@ <grit-part> <if expr="enable_arcore"> <!-- ARCore check message --> - <message name="IDS_AR_CORE_CHECK_MESSAGE_INSTALL_TITLE" desc="Title for the ARCore check message. When a WebXR page is loaded, if ARCore is needed to display AR content and it is not installed, a message will be shown to the user prompting them to install ARCore."> - Install ARCore? + <message name="IDS_AR_CORE_CHECK_MESSAGE_INSTALL_TITLE" desc="Title for the ARCore check message. When a WebXR page is loaded, if Google Play Services for AR is needed to display AR content and it is not installed, a message will be shown to the user prompting them to install that package."> + Install Google Play Services for AR? </message> - <message name="IDS_AR_CORE_CHECK_MESSAGE_UPDATE_TITLE" desc="Title for the ARCore check message. When a WebXR page is loaded, if ARCore is needed to display AR content and the installed ARCore is not up to date to the version needed by the implementation, a message will be shown to the user prompting them to update ARCore."> - Update ARCore? + <message name="IDS_AR_CORE_CHECK_MESSAGE_UPDATE_TITLE" desc="Title for the ARCore check message. When a WebXR page is loaded, if Google Play Services for AR is needed to display AR content and the installed ARCore is not up to date to the version needed by the implementation, a message will be shown to the user prompting them to update that package."> + Update Google Play Services for AR? </message> - <message name="IDS_AR_CORE_CHECK_MESSAGE_DESCRIPTION" desc="Description for the ARCore check message that will be prompted when a WebXR page requires ARCore to display AR content."> + <message name="IDS_AR_CORE_CHECK_MESSAGE_DESCRIPTION" desc="Description for the ARCore check message that will be prompted when a WebXR page requires Google Play Services for AR to display AR content."> View augmented reality content </message> </if>
diff --git a/components/webxr_strings_grdp/IDS_AR_CORE_CHECK_MESSAGE_INSTALL_TITLE.png.sha1 b/components/webxr_strings_grdp/IDS_AR_CORE_CHECK_MESSAGE_INSTALL_TITLE.png.sha1 index f6b8dbf..e45cd11 100644 --- a/components/webxr_strings_grdp/IDS_AR_CORE_CHECK_MESSAGE_INSTALL_TITLE.png.sha1 +++ b/components/webxr_strings_grdp/IDS_AR_CORE_CHECK_MESSAGE_INSTALL_TITLE.png.sha1
@@ -1 +1 @@ -af76610bcf354c0c285e09d9781b3a0239e48a29 \ No newline at end of file +707f758a0f5661efdbec629b925ea53d8f2a88e4 \ No newline at end of file
diff --git a/components/webxr_strings_grdp/IDS_AR_CORE_CHECK_MESSAGE_UPDATE_TITLE.png.sha1 b/components/webxr_strings_grdp/IDS_AR_CORE_CHECK_MESSAGE_UPDATE_TITLE.png.sha1 index 5c21ed40..d2f0e0fb 100644 --- a/components/webxr_strings_grdp/IDS_AR_CORE_CHECK_MESSAGE_UPDATE_TITLE.png.sha1 +++ b/components/webxr_strings_grdp/IDS_AR_CORE_CHECK_MESSAGE_UPDATE_TITLE.png.sha1
@@ -1 +1 @@ -ce1aa215b5273341279d5f6d00fdf637c1ed5705 \ No newline at end of file +b1bf4440da4e509c17301f1ec0b5de130e56e2f3 \ No newline at end of file
diff --git a/content/browser/bluetooth/web_bluetooth_pairing_manager_delegate.h b/content/browser/bluetooth/web_bluetooth_pairing_manager_delegate.h index 38f505e8b..4c033fe 100644 --- a/content/browser/bluetooth/web_bluetooth_pairing_manager_delegate.h +++ b/content/browser/bluetooth/web_bluetooth_pairing_manager_delegate.h
@@ -8,6 +8,7 @@ #include <string> #include "base/callback_forward.h" +#include "content/public/browser/bluetooth_delegate.h" #include "device/bluetooth/bluetooth_device.h" #include "mojo/public/cpp/bindings/associated_remote.h" #include "third_party/blink/public/common/bluetooth/web_bluetooth_device_id.h" @@ -20,23 +21,6 @@ // separated into a separate interface for readability and testing purposes. class WebBluetoothPairingManagerDelegate { public: - enum class PairPromptResult { - // User entered valid pin text or pressed OK (or equiv.) button for pairing - // confirmation. - kSuccess, - // User cancelled, or agent cancelled on their behalf. - kCancelled, - }; - - // Callback for bluetooth auth credential (PIN, Passkey) prompts. - // |result| is only valid when status is SUCCESS. - using BluetoothCredentialsCallback = - base::OnceCallback<void(PairPromptResult, const std::string& result)>; - - // Callback for bluetooth pair confirm prompts. - using BluetoothPairConfirmCallback = - base::OnceCallback<void(PairPromptResult)>; - // Return the cached device ID for the given characteric instance ID. // The returned device ID may be invalid - check before use. virtual blink::WebBluetoothDeviceId GetCharacteristicDeviceID( @@ -121,21 +105,15 @@ blink::mojom::WebBluetoothService:: RemoteCharacteristicStartNotificationsCallback callback) = 0; - // Display a dialog to prompt to user for their Bluetooth passkey. + // Display a dialog to prompt to user for Bluetooth pairing. // |device_identifier| is any string the caller wants to display to the user // to identify the device (MAC address, name, etc.). |callback| will be called - // with the dialog result. - virtual void PromptForBluetoothCredentials( + // with the dialog result. |pairng_kind| will be used to determined which + // prompt to show. + virtual void PromptForBluetoothPairing( const std::u16string& device_identifier, - BluetoothCredentialsCallback callback) = 0; - - // Display a dialog to prompt for user to confirm to pair with Bluetooth - // device. |device_identifier| is any string the caller wants to display to - // the user to identify the device (MAC address, name, etc.). |callback| will - // be called with the dialog result. - virtual void PromptForBluetoothPairConfirm( - const std::u16string& device_identifier, - BluetoothPairConfirmCallback callback) = 0; + BluetoothDelegate::PairPromptCallback callback, + BluetoothDelegate::PairingKind pairing_kind) = 0; }; } // namespace content
diff --git a/content/browser/bluetooth/web_bluetooth_pairing_manager_impl.cc b/content/browser/bluetooth/web_bluetooth_pairing_manager_impl.cc index 9aa8bd7..4988593 100644 --- a/content/browser/bluetooth/web_bluetooth_pairing_manager_impl.cc +++ b/content/browser/bluetooth/web_bluetooth_pairing_manager_impl.cc
@@ -9,6 +9,7 @@ #include "base/callback_helpers.h" #include "content/browser/bluetooth/web_bluetooth_pairing_manager_delegate.h" #include "content/browser/bluetooth/web_bluetooth_service_impl.h" +#include "content/public/browser/bluetooth_delegate.h" namespace content { @@ -259,34 +260,34 @@ void WebBluetoothPairingManagerImpl::RequestPinCode(BluetoothDevice* device) { blink::WebBluetoothDeviceId device_id = pairing_manager_delegate_->GetWebBluetoothDeviceId(device->GetAddress()); - pairing_manager_delegate_->PromptForBluetoothCredentials( + pairing_manager_delegate_->PromptForBluetoothPairing( device->GetNameForDisplay(), base::BindOnce(&WebBluetoothPairingManagerImpl::OnPinCodeResult, - weak_ptr_factory_.GetWeakPtr(), device_id)); + weak_ptr_factory_.GetWeakPtr(), device_id), + BluetoothDelegate::PairingKind::kProvidePin); } void WebBluetoothPairingManagerImpl::OnPinCodeResult( blink::WebBluetoothDeviceId device_id, - WebBluetoothPairingManagerDelegate::PairPromptResult status, - const std::string& result) { - switch (status) { - case WebBluetoothPairingManagerDelegate::PairPromptResult::kCancelled: + const BluetoothDelegate::PairPromptResult& result) { + switch (result.result_code) { + case BluetoothDelegate::PairPromptStatus::kCancelled: pairing_manager_delegate_->CancelPairing(device_id); break; - case WebBluetoothPairingManagerDelegate::PairPromptResult::kSuccess: - pairing_manager_delegate_->SetPinCode(device_id, result); + case BluetoothDelegate::PairPromptStatus::kSuccess: + pairing_manager_delegate_->SetPinCode(device_id, result.pin); break; } } void WebBluetoothPairingManagerImpl::OnPairConfirmResult( blink::WebBluetoothDeviceId device_id, - WebBluetoothPairingManagerDelegate::PairPromptResult status) { - switch (status) { - case WebBluetoothPairingManagerDelegate::PairPromptResult::kCancelled: + const BluetoothDelegate::PairPromptResult& result) { + switch (result.result_code) { + case BluetoothDelegate::PairPromptStatus::kCancelled: pairing_manager_delegate_->CancelPairing(device_id); break; - case WebBluetoothPairingManagerDelegate::PairPromptResult::kSuccess: + case BluetoothDelegate::PairPromptStatus::kSuccess: pairing_manager_delegate_->PairConfirmed(device_id); break; } @@ -325,10 +326,11 @@ void WebBluetoothPairingManagerImpl::AuthorizePairing(BluetoothDevice* device) { blink::WebBluetoothDeviceId device_id = pairing_manager_delegate_->GetWebBluetoothDeviceId(device->GetAddress()); - pairing_manager_delegate_->PromptForBluetoothPairConfirm( + pairing_manager_delegate_->PromptForBluetoothPairing( device->GetNameForDisplay(), base::BindOnce(&WebBluetoothPairingManagerImpl::OnPairConfirmResult, - weak_ptr_factory_.GetWeakPtr(), device_id)); + weak_ptr_factory_.GetWeakPtr(), device_id), + BluetoothDelegate::PairingKind::kConfirmOnly); } } // namespace content
diff --git a/content/browser/bluetooth/web_bluetooth_pairing_manager_impl.h b/content/browser/bluetooth/web_bluetooth_pairing_manager_impl.h index 3057feb..b084b09b 100644 --- a/content/browser/bluetooth/web_bluetooth_pairing_manager_impl.h +++ b/content/browser/bluetooth/web_bluetooth_pairing_manager_impl.h
@@ -95,14 +95,11 @@ device::BluetoothDevice::ConnectCallback callback, absl::optional<device::BluetoothDevice::ConnectErrorCode> error_code); - void OnPinCodeResult( - blink::WebBluetoothDeviceId device_id, - WebBluetoothPairingManagerDelegate::PairPromptResult status, - const std::string& result); + void OnPinCodeResult(blink::WebBluetoothDeviceId device_id, + const BluetoothDelegate::PairPromptResult& result); - void OnPairConfirmResult( - blink::WebBluetoothDeviceId device_id, - WebBluetoothPairingManagerDelegate::PairPromptResult status); + void OnPairConfirmResult(blink::WebBluetoothDeviceId device_id, + const BluetoothDelegate::PairPromptResult& result); // device::BluetoothDevice::PairingDelegate implementation: void RequestPinCode(device::BluetoothDevice* device) override;
diff --git a/content/browser/bluetooth/web_bluetooth_pairing_manager_impl_unittest.cc b/content/browser/bluetooth/web_bluetooth_pairing_manager_impl_unittest.cc index e4731c9..f1fd42f 100644 --- a/content/browser/bluetooth/web_bluetooth_pairing_manager_impl_unittest.cc +++ b/content/browser/bluetooth/web_bluetooth_pairing_manager_impl_unittest.cc
@@ -13,6 +13,7 @@ #include "content/browser/bluetooth/web_bluetooth_pairing_manager.h" #include "content/browser/bluetooth/web_bluetooth_pairing_manager_delegate.h" #include "content/browser/bluetooth/web_bluetooth_pairing_manager_impl.h" +#include "content/public/browser/bluetooth_delegate.h" #include "device/bluetooth/test/mock_bluetooth_device.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -30,6 +31,7 @@ using ::device::BluetoothDevice; using ::device::MockBluetoothDevice; using ::testing::Return; +using PairPromptResult = BluetoothDelegate::PairPromptResult; /** * A collection of related Bluetooth test data. @@ -279,23 +281,11 @@ std::move(callback).Run(WebBluetoothResult::CONNECT_AUTH_REJECTED); } - void PromptForBluetoothCredentials( + void PromptForBluetoothPairing( const std::u16string& device_identifier, - BluetoothCredentialsCallback callback) override { - switch (prompt_result_) { - case PairPromptResult::kSuccess: - std::move(callback).Run(prompt_result_, kValidTestData.pincode); - break; - case PairPromptResult::kCancelled: - std::move(callback).Run(prompt_result_, ""); - break; - } - } - - void PromptForBluetoothPairConfirm( - const std::u16string& device_identifier, - BluetoothPairConfirmCallback callback) override { - std::move(callback).Run(confirm_only_prompt_result_); + BluetoothDelegate::PairPromptCallback callback, + BluetoothDelegate::PairingKind pairing_kind) override { + std::move(callback).Run(prompt_result_); } void SetAuthBehavior(AuthBehavior auth_behavior) { @@ -304,14 +294,10 @@ int num_pair_attempts() const { return num_pair_attempts_; } - void SetCredentialPromptResult(PairPromptResult result) { + void SetPromptResult(PairPromptResult result) { prompt_result_ = result; } - void SetPairConfirmPromptResult(PairPromptResult result) { - confirm_only_prompt_result_ = result; - } - const std::vector<uint8_t>& characteristic_value() const { return characteristic_value_; } @@ -335,8 +321,7 @@ int num_pair_attempts_ = 0; bool device_paired_ = false; AuthBehavior auth_behavior_ = AuthBehavior::kUnspecified; - PairPromptResult prompt_result_ = PairPromptResult::kSuccess; - PairPromptResult confirm_only_prompt_result_ = PairPromptResult::kSuccess; + PairPromptResult prompt_result_; std::unique_ptr<WebBluetoothPairingManagerImpl> pairing_manager_; SingleThreadTaskEnvironment single_threaded_task_environment_; }; @@ -889,7 +874,10 @@ } TEST_F(BluetoothPairingManagerTest, CredentialPromptPINSuccess) { - SetCredentialPromptResult(PairPromptResult::kSuccess); + BluetoothDelegate::PairPromptResult result; + result.result_code = BluetoothDelegate::PairPromptStatus::kSuccess; + result.pin = kValidTestData.pincode; + SetPromptResult(result); MockBluetoothDevice device(/*adapter=*/nullptr, /*bluetooth_class=*/0, @@ -913,7 +901,9 @@ } TEST_F(BluetoothPairingManagerTest, CredentialPromptPINCancelled) { - SetCredentialPromptResult(PairPromptResult::kCancelled); + PairPromptResult result; + result.result_code = BluetoothDelegate::PairPromptStatus::kCancelled; + SetPromptResult(result); MockBluetoothDevice device(/*adapter=*/nullptr, /*bluetooth_class=*/0, @@ -951,7 +941,9 @@ } TEST_F(BluetoothPairingManagerTest, PairConfirmPromptSuccess) { - SetPairConfirmPromptResult(PairPromptResult::kSuccess); + PairPromptResult result; + result.result_code = BluetoothDelegate::PairPromptStatus::kSuccess; + SetPromptResult(result); MockBluetoothDevice device(/*adapter=*/nullptr, /*bluetooth_class=*/0, @@ -970,7 +962,9 @@ } TEST_F(BluetoothPairingManagerTest, PairConfirmPromptCancelled) { - SetPairConfirmPromptResult(PairPromptResult::kCancelled); + PairPromptResult result; + result.result_code = BluetoothDelegate::PairPromptStatus::kCancelled; + SetPromptResult(result); MockBluetoothDevice device(/*adapter=*/nullptr, /*bluetooth_class=*/0,
diff --git a/content/browser/bluetooth/web_bluetooth_service_impl.cc b/content/browser/bluetooth/web_bluetooth_service_impl.cc index f45b0106ee..45323244 100644 --- a/content/browser/bluetooth/web_bluetooth_service_impl.cc +++ b/content/browser/bluetooth/web_bluetooth_service_impl.cc
@@ -176,43 +176,6 @@ return HasValidFilter(options->filters); } -void BluetoothDelegateCredentialsCallback( - WebBluetoothPairingManagerDelegate::BluetoothCredentialsCallback callback, - BluetoothDelegate::DeviceCredentialsPromptResult status, - const std::u16string& result) { - WebBluetoothPairingManagerDelegate::PairPromptResult delegate_result; - switch (status) { - case BluetoothDelegate::DeviceCredentialsPromptResult::kSuccess: - delegate_result = - WebBluetoothPairingManagerDelegate::PairPromptResult::kSuccess; - break; - case BluetoothDelegate::DeviceCredentialsPromptResult::kCancelled: - delegate_result = - WebBluetoothPairingManagerDelegate::PairPromptResult::kCancelled; - break; - } - - std::move(callback).Run(delegate_result, base::UTF16ToUTF8(result)); -} - -void BluetoothDelegatePairConfirmCallback( - WebBluetoothPairingManagerDelegate::BluetoothPairConfirmCallback callback, - BluetoothDelegate::DevicePairConfirmPromptResult status) { - WebBluetoothPairingManagerDelegate::PairPromptResult delegate_result; - switch (status) { - case BluetoothDelegate::DevicePairConfirmPromptResult::kSuccess: - delegate_result = - WebBluetoothPairingManagerDelegate::PairPromptResult::kSuccess; - break; - case BluetoothDelegate::DevicePairConfirmPromptResult::kCancelled: - delegate_result = - WebBluetoothPairingManagerDelegate::PairPromptResult::kCancelled; - break; - } - - std::move(callback).Run(delegate_result); -} - bool& ShouldIgnoreVisibilityRequirementsForTesting() { static bool should_ignore_visibility_requirements = false; return should_ignore_visibility_requirements; @@ -2672,40 +2635,32 @@ device->ConfirmPairing(); } -void WebBluetoothServiceImpl::PromptForBluetoothCredentials( +void WebBluetoothServiceImpl::PromptForBluetoothPairing( const std::u16string& device_identifier, - BluetoothCredentialsCallback callback) { + BluetoothDelegate::PairPromptCallback callback, + BluetoothDelegate::PairingKind pairing_kind) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - BluetoothDelegate* delegate = GetContentClient()->browser()->GetBluetoothDelegate(); + if (!delegate) { - std::move(callback).Run( - WebBluetoothPairingManagerDelegate::PairPromptResult::kCancelled, ""); + std::move(callback).Run(BluetoothDelegate::PairPromptResult( + BluetoothDelegate::PairPromptStatus::kCancelled)); return; } - delegate->ShowDeviceCredentialsPrompt( - &render_frame_host(), device_identifier, - base::BindOnce(&BluetoothDelegateCredentialsCallback, - std::move(callback))); -} -void WebBluetoothServiceImpl::PromptForBluetoothPairConfirm( - const std::u16string& device_identifier, - BluetoothPairConfirmCallback callback) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - - BluetoothDelegate* delegate = - GetContentClient()->browser()->GetBluetoothDelegate(); - if (!delegate) { - std::move(callback).Run( - WebBluetoothPairingManagerDelegate::PairPromptResult::kCancelled); - return; + switch (pairing_kind) { + case BluetoothDelegate::PairingKind::kConfirmOnly: + case BluetoothDelegate::PairingKind::kProvidePin: + delegate->ShowDevicePairPrompt(&render_frame_host(), device_identifier, + std::move(callback), pairing_kind); + break; + default: + NOTREACHED(); + std::move(callback).Run(BluetoothDelegate::PairPromptResult( + BluetoothDelegate::PairPromptStatus::kCancelled)); + break; } - delegate->ShowDevicePairConfirmPrompt( - &render_frame_host(), device_identifier, - base::BindOnce(&BluetoothDelegatePairConfirmCallback, - std::move(callback))); } #if PAIR_BLUETOOTH_ON_DEMAND()
diff --git a/content/browser/bluetooth/web_bluetooth_service_impl.h b/content/browser/bluetooth/web_bluetooth_service_impl.h index f5d9ff7..7f0c2cb 100644 --- a/content/browser/bluetooth/web_bluetooth_service_impl.h +++ b/content/browser/bluetooth/web_bluetooth_service_impl.h
@@ -461,14 +461,10 @@ void CancelPairing(const blink::WebBluetoothDeviceId& device_id) override; void SetPinCode(const blink::WebBluetoothDeviceId& device_id, const std::string& pincode) override; - void PromptForBluetoothCredentials( + void PromptForBluetoothPairing( const std::u16string& device_identifier, - BluetoothCredentialsCallback callback) override; - - void PromptForBluetoothPairConfirm( - const std::u16string& device_identifier, - BluetoothPairConfirmCallback callback) override; - + BluetoothDelegate::PairPromptCallback callback, + BluetoothDelegate::PairingKind pairing_kind) override; void PairConfirmed(const blink::WebBluetoothDeviceId& device_id) override; // Used to open a BluetoothChooser and start a device discovery session. std::unique_ptr<BluetoothDeviceChooserController> device_chooser_controller_;
diff --git a/content/browser/bluetooth/web_bluetooth_service_impl_browsertest.cc b/content/browser/bluetooth/web_bluetooth_service_impl_browsertest.cc index c6b1bcd..f38b240c 100644 --- a/content/browser/bluetooth/web_bluetooth_service_impl_browsertest.cc +++ b/content/browser/bluetooth/web_bluetooth_service_impl_browsertest.cc
@@ -164,16 +164,14 @@ prompt_ = prompt.get(); return std::move(prompt); } - void ShowDeviceCredentialsPrompt(RenderFrameHost* frame, - const std::u16string& device_identifier, - CredentialsCallback callback) override { + + void ShowDevicePairPrompt(content::RenderFrameHost* frame, + const std::u16string& device_identifier, + PairPromptCallback callback, + PairingKind pairing_kind) override { NOTREACHED(); } - void ShowDevicePairConfirmPrompt(RenderFrameHost* frame, - const std::u16string& device_identifier, - PairConfirmCallback callback) override { - NOTREACHED(); - } + blink::WebBluetoothDeviceId GetWebBluetoothDeviceId( RenderFrameHost* frame, const std::string& device_address) override {
diff --git a/content/browser/bluetooth/web_bluetooth_service_impl_unittest.cc b/content/browser/bluetooth/web_bluetooth_service_impl_unittest.cc index 5b315ac..99cb9ae 100644 --- a/content/browser/bluetooth/web_bluetooth_service_impl_unittest.cc +++ b/content/browser/bluetooth/web_bluetooth_service_impl_unittest.cc
@@ -291,16 +291,14 @@ prompt_ = prompt.get(); return std::move(prompt); } - void ShowDeviceCredentialsPrompt(content::RenderFrameHost* frame, - const std::u16string& device_identifier, - CredentialsCallback callback) override { - std::move(callback).Run(DeviceCredentialsPromptResult::kCancelled, u""); - } - void ShowDevicePairConfirmPrompt(content::RenderFrameHost* frame, - const std::u16string& device_identifier, - PairConfirmCallback callback) override { - std::move(callback).Run(DevicePairConfirmPromptResult::kCancelled); - } + + void ShowDevicePairPrompt(content::RenderFrameHost* frame, + const std::u16string& device_identifier, + PairPromptCallback callback, + PairingKind pairing_kind) override { + std::move(callback).Run(PairPromptResult(PairPromptStatus::kCancelled)); + }; + blink::WebBluetoothDeviceId GetWebBluetoothDeviceId( RenderFrameHost* frame, const std::string& device_address) override {
diff --git a/content/browser/find_in_page_client.cc b/content/browser/find_in_page_client.cc index 8a15a57..55dd5b0 100644 --- a/content/browser/find_in_page_client.cc +++ b/content/browser/find_in_page_client.cc
@@ -46,10 +46,12 @@ HandleUpdateType(request_id, update_type); } +#if BUILDFLAG(IS_ANDROID) void FindInPageClient::ActivateNearestFindResult(int request_id, const gfx::PointF& point) { frame_->GetFindInPage()->ActivateNearestFindResult(request_id, point); } +#endif void FindInPageClient::HandleUpdateType( int request_id,
diff --git a/content/browser/find_in_page_client.h b/content/browser/find_in_page_client.h index 946c673..459dad5c 100644 --- a/content/browser/find_in_page_client.h +++ b/content/browser/find_in_page_client.h
@@ -6,6 +6,7 @@ #define CONTENT_BROWSER_FIND_IN_PAGE_CLIENT_H_ #include "base/memory/raw_ptr.h" +#include "build/build_config.h" #include "content/common/content_export.h" #include "mojo/public/cpp/bindings/receiver.h" #include "third_party/blink/public/mojom/frame/find_in_page.mojom.h" @@ -27,7 +28,9 @@ ~FindInPageClient() override; +#if BUILDFLAG(IS_ANDROID) void ActivateNearestFindResult(int request_id, const gfx::PointF& point); +#endif // Current number of matches for this frame. int number_of_matches() { return number_of_matches_; }
diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc index 53eaa95..b88a9d6 100644 --- a/content/browser/renderer_host/navigator.cc +++ b/content/browser/renderer_host/navigator.cc
@@ -845,9 +845,8 @@ } // Allow the delegate to cancel the cross-process navigation. - // TODO(crbug.com/1316388): With MPArch there may be multiple main frames and - // so is_main_frame should not be used to identify outermost main frames. - // Follow up to confirm correctness. + // With MPArch there may be multiple main frames and so is_main_frame should + // not be used to identify outermost main frames. if (!delegate_->ShouldAllowRendererInitiatedCrossProcessNavigation( render_frame_host->IsOutermostMainFrame())) return;
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index be33a7a..101e08d 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -1018,10 +1018,10 @@ case features::SubframeShutdownDelayType::kMemoryBased: { // See subframe-reuse design doc for more detail on these values. // docs.google.com/document/d/1x_h4Gg4ForILEj8A4rMBX6d84uHWyQ9RSXmGVqMlBTk - static constexpr int64_t kHighMemoryThreshold = 8000000000; - static constexpr int64_t kMaxMemoryThreshold = 16000000000; + static constexpr uint64_t kHighMemoryThreshold = 8'000'000'000; + static constexpr uint64_t kMaxMemoryThreshold = 16'000'000'000; - const int64_t available_memory = + const uint64_t available_memory = base::SysInfo::AmountOfAvailablePhysicalMemory(); if (available_memory <= kHighMemoryThreshold) return kShortDelay; @@ -1030,7 +1030,7 @@ // Scale delay linearly based on where |available_memory| lies between // |kHighMemoryThreshold| and |kMaxMemoryThreshold|. - const int64_t available_memory_factor = + const uint64_t available_memory_factor = (available_memory - kHighMemoryThreshold) / (kMaxMemoryThreshold - kHighMemoryThreshold); return kShortDelay + (kLongDelay - kShortDelay) * available_memory_factor; @@ -1942,10 +1942,11 @@ TRACE_EVENT0("navigation", "RenderFrameHostImpl::EnterBackForwardCache"); DCHECK(IsBackForwardCacheEnabled()); DCHECK_EQ(lifecycle_state(), LifecycleStateImpl::kActive); + bool was_in_primary_main_frame = IsInPrimaryMainFrame(); SetLifecycleState(LifecycleStateImpl::kInBackForwardCache); // Pages in the back-forward cache are automatically evicted after a certain // time. - if (!GetParent()) + if (was_in_primary_main_frame) StartBackForwardCacheEvictionTimer(); for (auto& child : children_) child->current_frame_host()->DidEnterBackForwardCache();
diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc index 064eb03..82816ed 100644 --- a/content/browser/service_worker/service_worker_browsertest.cc +++ b/content/browser/service_worker/service_worker_browsertest.cc
@@ -274,40 +274,39 @@ std::move(callback).Run(); } -int GetInt(const base::DictionaryValue& dict, base::StringPiece key) { - absl::optional<int> out = dict.FindIntKey(key); +int GetInt(const base::Value::Dict& dict, base::StringPiece key) { + absl::optional<int> out = dict.FindInt(key); EXPECT_TRUE(out.has_value()); return out.value_or(0); } -std::string GetString(const base::DictionaryValue& dict, - base::StringPiece key) { - const std::string* out = dict.FindStringKey(key); +std::string GetString(const base::Value::Dict& dict, base::StringPiece key) { + const std::string* out = dict.FindString(key); EXPECT_TRUE(out); return out ? *out : std::string(); } -bool GetBoolean(const base::DictionaryValue& dict, base::StringPiece key) { - absl::optional<bool> out = dict.FindBoolKey(key); +bool GetBoolean(const base::Value::Dict& dict, base::StringPiece key) { + absl::optional<bool> out = dict.FindBool(key); EXPECT_TRUE(out.has_value()); return out.value_or(false); } -bool CheckHeader(const base::DictionaryValue& dict, +bool CheckHeader(const base::Value::Dict& dict, base::StringPiece header_name, base::StringPiece header_value) { - const base::Value* headers = dict.FindListKey("headers"); + const base::Value::List* headers = dict.FindList("headers"); if (!headers) { ADD_FAILURE(); return false; } - for (const auto& header : headers->GetListDeprecated()) { + for (const auto& header : *headers) { if (!header.is_list()) { ADD_FAILURE(); return false; } - base::Value::ConstListView name_value_pair = header.GetListDeprecated(); + const base::Value::List& name_value_pair = header.GetList(); if (name_value_pair.size() != 2u) { ADD_FAILURE(); return false; @@ -330,20 +329,19 @@ return false; } -bool HasHeader(const base::DictionaryValue& dict, - base::StringPiece header_name) { - const base::Value* headers = dict.FindListKey("headers"); +bool HasHeader(const base::Value::Dict& dict, base::StringPiece header_name) { + const base::Value::List* headers = dict.FindList("headers"); if (!headers) { ADD_FAILURE(); return false; } - for (const auto& header : headers->GetListDeprecated()) { + for (const auto& header : *headers) { if (!header.is_list()) { ADD_FAILURE(); return false; } - base::Value::ConstListView name_value_pair = header.GetListDeprecated(); + const base::Value::List& name_value_pair = header.GetList(); if (name_value_pair.size() != 2u) { ADD_FAILURE(); return false; @@ -1943,14 +1941,14 @@ kWorkerUrl, kEnableNavigationPreloadScript + kPreloadResponseTestScript, "text/javascript"); - std::unique_ptr<base::Value> result = base::JSONReader::ReadDeprecated( + absl::optional<base::Value> result = base::JSONReader::Read( LoadNavigationPreloadTestPage(page_url, worker_url, "RESOLVED")); // The page request must be sent only once, since the worker responded with // a generated Response. EXPECT_EQ(1, GetRequestCount(kPageUrl)); - base::DictionaryValue* dict = nullptr; - ASSERT_TRUE(result->GetAsDictionary(&dict)); + base::Value::Dict* dict = result->GetIfDict(); + ASSERT_TRUE(dict); EXPECT_EQ("basic", GetString(*dict, "type")); EXPECT_EQ(page_url, GURL(GetString(*dict, "url"))); EXPECT_EQ(200, GetInt(*dict, "status")); @@ -1997,14 +1995,14 @@ kWorkerUrl, kEnableNavigationPreloadScript + kPreloadResponseTestScript, "text/javascript"); - std::unique_ptr<base::Value> result = base::JSONReader::ReadDeprecated( + absl::optional<base::Value> result = base::JSONReader::Read( LoadNavigationPreloadTestPage(page_url, worker_url, "RESOLVED")); // The page request must be sent only once, since the worker responded with // a generated Response. EXPECT_EQ(1, GetRequestCount(kPageUrl)); - base::DictionaryValue* dict = nullptr; - ASSERT_TRUE(result->GetAsDictionary(&dict)); + base::Value::Dict* dict = result->GetIfDict(); + ASSERT_TRUE(dict); EXPECT_EQ("basic", GetString(*dict, "type")); EXPECT_EQ(page_url, GURL(GetString(*dict, "url"))); EXPECT_EQ(201, GetInt(*dict, "status")); @@ -2905,8 +2903,10 @@ EvalJsResult result = EvalJs(shell()->web_contents()->GetPrimaryMainFrame(), "document.body.textContent"); ASSERT_TRUE(result.error.empty()); - std::unique_ptr<base::DictionaryValue> dict = base::DictionaryValue::From( - base::JSONReader::ReadDeprecated(result.ExtractString())); + absl::optional<base::Value> parsed_result = + base::JSONReader::Read(result.ExtractString()); + ASSERT_TRUE(parsed_result); + base::Value::Dict* dict = parsed_result->GetIfDict(); ASSERT_TRUE(dict); // Default headers are present. @@ -2956,9 +2956,9 @@ // Ensure the service worker did not see a fetch event for the PlzRedirect // URL, since throttles should have redirected before interception. - base::Value list(base::Value::Type::LIST); + base::Value::List list; list.Append(redirect_url.spec()); - EXPECT_EQ(list, + EXPECT_EQ(base::Value(std::move(list)), EvalJs(shell()->web_contents()->GetPrimaryMainFrame(), script)); SetBrowserClientForTesting(old_content_browser_client);
diff --git a/content/browser/service_worker/service_worker_file_upload_browsertest.cc b/content/browser/service_worker/service_worker_file_upload_browsertest.cc index 516f446..b82d441 100644 --- a/content/browser/service_worker/service_worker_file_upload_browsertest.cc +++ b/content/browser/service_worker/service_worker_file_upload_browsertest.cc
@@ -35,26 +35,26 @@ namespace { -void GetKey(const base::DictionaryValue& dict, +void GetKey(const base::Value::Dict& dict, const std::string& key, std::string* out_value) { - auto* value = dict.FindKeyOfType(key, base::Value::Type::STRING); + const std::string* value = dict.FindString(key); ASSERT_TRUE(value); - *out_value = value->GetString(); + *out_value = *value; } -void GetKey(const base::DictionaryValue& dict, +void GetKey(const base::Value::Dict& dict, const std::string& key, int* out_value) { - auto* value = dict.FindKeyOfType(key, base::Value::Type::INTEGER); + absl::optional<int> value = dict.FindInt(key); ASSERT_TRUE(value); - *out_value = value->GetInt(); + *out_value = *value; } // Helper since the default output of EXPECT_EQ isn't useful when debugging // failures, it doesn't recurse into the dictionary. -void ExpectEqual(const base::DictionaryValue& expected, - const base::DictionaryValue& actual) { +void ExpectEqual(const base::Value::Dict& expected, + const base::Value::Dict& actual) { EXPECT_EQ(expected, actual) << "\nExpected: " << expected << "\nActual: " << actual; } @@ -183,13 +183,14 @@ void RunRespondWithTest(const std::string& target_query, TargetOrigin target_origin, std::string* out_filename, - std::unique_ptr<base::DictionaryValue>* out_result) { + base::Value::Dict& out_result) { std::string result; RunTest(BuildTargetUrl("/service_worker/upload", target_query), TargetOrigin::kSameOrigin, out_filename, &result); - *out_result = - base::DictionaryValue::From(base::test::ParseJsonDeprecated(result)); - ASSERT_TRUE(*out_result); + absl::optional<base::Value> parsed_result = base::test::ParseJson(result); + ASSERT_TRUE(parsed_result); + ASSERT_TRUE(parsed_result->is_dict()); + out_result = std::move(parsed_result->GetDict()); } // Helper for tests where the service worker falls back to network. @@ -290,8 +291,7 @@ "\r\n" + kFileContent + "\r\n" + "--" + boundary + "--\r\n"; } - std::unique_ptr<base::DictionaryValue> BuildExpectedBodyAsFormData( - const std::string& filename) { + base::Value::Dict BuildExpectedBodyAsFormData(const std::string& filename) { std::string expectation = R"({ "entries": [ { @@ -321,9 +321,8 @@ base::ReplaceFirstSubstringAfterOffset(&expectation, 0, "@PATH@", filename); base::ReplaceFirstSubstringAfterOffset(&expectation, 0, "@SIZE@", base::NumberToString(kFileSize)); - - return base::DictionaryValue::From( - base::test::ParseJsonDeprecated(expectation)); + absl::optional<base::Value> result = base::test::ParseJson(expectation); + return std::move(result->GetDict()); } private: @@ -334,13 +333,13 @@ // Tests using Request.text(). IN_PROC_BROWSER_TEST_F(ServiceWorkerFileUploadTest, AsText) { std::string filename; - std::unique_ptr<base::DictionaryValue> dict; - RunRespondWithTest("getAs=text", TargetOrigin::kSameOrigin, &filename, &dict); + base::Value::Dict dict; + RunRespondWithTest("getAs=text", TargetOrigin::kSameOrigin, &filename, dict); std::string boundary; - GetKey(*dict, "boundary", &boundary); + GetKey(dict, "boundary", &boundary); std::string body; - GetKey(*dict, "body", &body); + GetKey(dict, "body", &body); std::string expected_body = BuildExpectedBodyAsText(boundary, filename); EXPECT_EQ(expected_body, body); } @@ -348,13 +347,13 @@ // Tests using Request.blob(). IN_PROC_BROWSER_TEST_F(ServiceWorkerFileUploadTest, AsBlob) { std::string filename; - std::unique_ptr<base::DictionaryValue> dict; - RunRespondWithTest("getAs=blob", TargetOrigin::kSameOrigin, &filename, &dict); + base::Value::Dict dict; + RunRespondWithTest("getAs=blob", TargetOrigin::kSameOrigin, &filename, dict); std::string boundary; - GetKey(*dict, "boundary", &boundary); + GetKey(dict, "boundary", &boundary); int size; - GetKey(*dict, "bodySize", &size); + GetKey(dict, "bodySize", &size); std::string expected_body = BuildExpectedBodyAsText(boundary, filename); EXPECT_EQ(base::MakeStrictNum(expected_body.size()), size); } @@ -362,11 +361,11 @@ // Tests using Request.formData(). IN_PROC_BROWSER_TEST_F(ServiceWorkerFileUploadTest, AsFormData) { std::string filename; - std::unique_ptr<base::DictionaryValue> dict; + base::Value::Dict dict; RunRespondWithTest("getAs=formData", TargetOrigin::kSameOrigin, &filename, - &dict); + dict); - ExpectEqual(*BuildExpectedBodyAsFormData(filename), *dict); + ExpectEqual(BuildExpectedBodyAsFormData(filename), dict); } // Tests network fallback. @@ -378,11 +377,11 @@ // target. Regression test for https://crbug.com/916070. IN_PROC_BROWSER_TEST_F(ServiceWorkerFileUploadTest, AsFormData_CrossOrigin) { std::string filename; - std::unique_ptr<base::DictionaryValue> dict; + base::Value::Dict dict; RunRespondWithTest("getAs=formData", TargetOrigin::kCrossOrigin, &filename, - &dict); + dict); - ExpectEqual(*BuildExpectedBodyAsFormData(filename), *dict); + ExpectEqual(BuildExpectedBodyAsFormData(filename), dict); } // Tests network fallback when the form was submitted to a cross-origin target.
diff --git a/content/browser/service_worker/service_worker_internals_ui.cc b/content/browser/service_worker/service_worker_internals_ui.cc index 59a716d4..5842c8a7 100644 --- a/content/browser/service_worker/service_worker_internals_ui.cc +++ b/content/browser/service_worker/service_worker_internals_ui.cc
@@ -81,136 +81,132 @@ return base::GetProcId(handle); } -void UpdateVersionInfo(const ServiceWorkerVersionInfo& version, Value* info) { +base::Value::Dict UpdateVersionInfo(const ServiceWorkerVersionInfo& version) { + base::Value::Dict info; switch (version.running_status) { case EmbeddedWorkerStatus::STOPPED: - info->SetStringKey("running_status", "STOPPED"); + info.Set("running_status", "STOPPED"); break; case EmbeddedWorkerStatus::STARTING: - info->SetStringKey("running_status", "STARTING"); + info.Set("running_status", "STARTING"); break; case EmbeddedWorkerStatus::RUNNING: - info->SetStringKey("running_status", "RUNNING"); + info.Set("running_status", "RUNNING"); break; case EmbeddedWorkerStatus::STOPPING: - info->SetStringKey("running_status", "STOPPING"); + info.Set("running_status", "STOPPING"); break; } switch (version.status) { case ServiceWorkerVersion::NEW: - info->SetStringKey("status", "NEW"); + info.Set("status", "NEW"); break; case ServiceWorkerVersion::INSTALLING: - info->SetStringKey("status", "INSTALLING"); + info.Set("status", "INSTALLING"); break; case ServiceWorkerVersion::INSTALLED: - info->SetStringKey("status", "INSTALLED"); + info.Set("status", "INSTALLED"); break; case ServiceWorkerVersion::ACTIVATING: - info->SetStringKey("status", "ACTIVATING"); + info.Set("status", "ACTIVATING"); break; case ServiceWorkerVersion::ACTIVATED: - info->SetStringKey("status", "ACTIVATED"); + info.Set("status", "ACTIVATED"); break; case ServiceWorkerVersion::REDUNDANT: - info->SetStringKey("status", "REDUNDANT"); + info.Set("status", "REDUNDANT"); break; } switch (version.fetch_handler_existence) { case ServiceWorkerVersion::FetchHandlerExistence::UNKNOWN: - info->SetStringKey("fetch_handler_existence", "UNKNOWN"); + info.Set("fetch_handler_existence", "UNKNOWN"); break; case ServiceWorkerVersion::FetchHandlerExistence::EXISTS: - info->SetStringKey("fetch_handler_existence", "EXISTS"); + info.Set("fetch_handler_existence", "EXISTS"); break; case ServiceWorkerVersion::FetchHandlerExistence::DOES_NOT_EXIST: - info->SetStringKey("fetch_handler_existence", "DOES_NOT_EXIST"); + info.Set("fetch_handler_existence", "DOES_NOT_EXIST"); break; } - info->SetStringKey("script_url", version.script_url.spec()); - info->SetStringKey("version_id", base::NumberToString(version.version_id)); - info->SetIntKey("process_id", - static_cast<int>(GetRealProcessId(version.process_id))); - info->SetIntKey("process_host_id", version.process_id); - info->SetIntKey("thread_id", version.thread_id); - info->SetIntKey("devtools_agent_route_id", version.devtools_agent_route_id); + info.Set("script_url", version.script_url.spec()); + info.Set("version_id", base::NumberToString(version.version_id)); + info.Set("process_id", + static_cast<int>(GetRealProcessId(version.process_id))); + info.Set("process_host_id", version.process_id); + info.Set("thread_id", version.thread_id); + info.Set("devtools_agent_route_id", version.devtools_agent_route_id); - base::Value::ListStorage clients; + base::Value::List clients; for (auto& it : version.clients) { - base::Value client(base::Value::Type::DICTIONARY); - client.SetStringKey("client_id", it.first); + base::Value::Dict client; + client.Set("client_id", it.first); if (it.second.type() == blink::mojom::ServiceWorkerClientType::kWindow) { RenderFrameHost* render_frame_host = RenderFrameHost::FromID(it.second.GetRenderFrameHostId()); if (render_frame_host) { - client.SetStringKey("url", - render_frame_host->GetLastCommittedURL().spec()); + client.Set("url", render_frame_host->GetLastCommittedURL().spec()); } } - clients.emplace_back(std::move(client)); + clients.Append(std::move(client)); } - info->SetKey("clients", base::Value(std::move(clients))); + info.Set("clients", std::move(clients)); + return info; } -base::Value::ListStorage GetRegistrationListValue( +base::Value::List GetRegistrationListValue( const std::vector<ServiceWorkerRegistrationInfo>& registrations) { - base::Value::ListStorage result; + base::Value::List result; for (const auto& registration : registrations) { - base::Value registration_info(base::Value::Type::DICTIONARY); - registration_info.SetStringKey("scope", registration.scope.spec()); - registration_info.SetBoolKey( + base::Value::Dict registration_info; + registration_info.Set("scope", registration.scope.spec()); + registration_info.Set( "third_party_storage_partitioning_enabled", registration.key.IsThirdPartyStoragePartitioningEnabled()); - registration_info.SetStringKey( - "ancestor_chain_bit", registration.key.ancestor_chain_bit() == - blink::mojom::AncestorChainBit::kCrossSite - ? "CrossSite" - : "SameSite"); - registration_info.SetStringKey("nonce", - registration.key.nonce().has_value() + registration_info.Set("ancestor_chain_bit", + registration.key.ancestor_chain_bit() == + blink::mojom::AncestorChainBit::kCrossSite + ? "CrossSite" + : "SameSite"); + registration_info.Set("nonce", registration.key.nonce().has_value() ? registration.key.nonce()->ToString() : "<null>"); - registration_info.SetStringKey("origin", - registration.key.origin().GetDebugString()); - registration_info.SetStringKey( - "top_level_site", registration.key.top_level_site().Serialize()); - registration_info.SetStringKey("storage_key", registration.key.Serialize()); - registration_info.SetStringKey( - "registration_id", base::NumberToString(registration.registration_id)); - registration_info.SetBoolKey("navigation_preload_enabled", - registration.navigation_preload_enabled); - registration_info.SetIntKey("navigation_preload_header_length", - registration.navigation_preload_header_length); + registration_info.Set("origin", registration.key.origin().GetDebugString()); + registration_info.Set("top_level_site", + registration.key.top_level_site().Serialize()); + registration_info.Set("storage_key", registration.key.Serialize()); + registration_info.Set("registration_id", + base::NumberToString(registration.registration_id)); + registration_info.Set("navigation_preload_enabled", + registration.navigation_preload_enabled); + registration_info.Set( + "navigation_preload_header_length", + static_cast<int>(registration.navigation_preload_header_length)); if (registration.active_version.version_id != blink::mojom::kInvalidServiceWorkerVersionId) { - base::Value active_info(base::Value::Type::DICTIONARY); - UpdateVersionInfo(registration.active_version, &active_info); - registration_info.SetKey("active", std::move(active_info)); + registration_info.Set("active", + UpdateVersionInfo(registration.active_version)); } if (registration.waiting_version.version_id != blink::mojom::kInvalidServiceWorkerVersionId) { - base::Value waiting_info(base::Value::Type::DICTIONARY); - UpdateVersionInfo(registration.waiting_version, &waiting_info); - registration_info.SetKey("waiting", std::move(waiting_info)); + registration_info.Set("waiting", + UpdateVersionInfo(registration.waiting_version)); } - result.emplace_back(std::move(registration_info)); + result.Append(std::move(registration_info)); } return result; } -base::Value::ListStorage GetVersionListValue( +base::Value::List GetVersionListValue( const std::vector<ServiceWorkerVersionInfo>& versions) { - base::Value::ListStorage result; + base::Value::List result; for (const auto& version : versions) { - base::Value info(base::Value::Type::DICTIONARY); - UpdateVersionInfo(version, &info); - result.emplace_back(std::move(info)); + result.Append(UpdateVersionInfo(version)); } return result; } @@ -291,14 +287,14 @@ if (!handler_) { return; } - base::Value details(base::Value::Type::DICTIONARY); - details.SetStringKey("message", info.error_message); - details.SetIntKey("lineNumber", info.line_number); - details.SetIntKey("columnNumber", info.column_number); - details.SetStringKey("sourceURL", info.source_url.spec()); + base::Value::Dict details; + details.Set("message", info.error_message); + details.Set("lineNumber", info.line_number); + details.Set("columnNumber", info.column_number); + details.Set("sourceURL", info.source_url.spec()); handler_->OnErrorEvent("error-reported", partition_id_, version_id, - std::move(details)); + base::Value(std::move(details))); } void OnReportConsoleMessage(int64_t version_id, const GURL& scope, @@ -308,14 +304,14 @@ if (!handler_) { return; } - base::Value details(base::Value::Type::DICTIONARY); - details.SetIntKey("sourceIdentifier", static_cast<int>(message.source)); - details.SetIntKey("message_level", static_cast<int>(message.message_level)); - details.SetStringKey("message", message.message); - details.SetIntKey("lineNumber", message.line_number); - details.SetStringKey("sourceURL", message.source_url.spec()); + base::Value::Dict details; + details.Set("sourceIdentifier", static_cast<int>(message.source)); + details.Set("message_level", static_cast<int>(message.message_level)); + details.Set("message", message.message); + details.Set("lineNumber", message.line_number); + details.Set("sourceURL", message.source_url.spec()); handler_->OnErrorEvent("console-message-reported", partition_id_, - version_id, std::move(details)); + version_id, base::Value(std::move(details))); } void OnRegistrationCompleted(int64_t registration_id, const GURL& scope, @@ -446,16 +442,13 @@ const std::vector<ServiceWorkerRegistrationInfo>& live_registrations, const std::vector<ServiceWorkerVersionInfo>& live_versions, const std::vector<ServiceWorkerRegistrationInfo>& stored_registrations) { - base::Value registrations(base::Value::Type::DICTIONARY); - registrations.SetKey( - "liveRegistrations", - base::Value(GetRegistrationListValue(live_registrations))); - registrations.SetKey("liveVersions", - base::Value(GetVersionListValue(live_versions))); - registrations.SetKey( - "storedRegistrations", - base::Value(GetRegistrationListValue(stored_registrations))); - FireWebUIListener("partition-data", std::move(registrations), + base::Value::Dict registrations; + registrations.Set("liveRegistrations", + GetRegistrationListValue(live_registrations)); + registrations.Set("liveVersions", GetVersionListValue(live_versions)); + registrations.Set("storedRegistrations", + GetRegistrationListValue(stored_registrations)); + FireWebUIListener("partition-data", base::Value(std::move(registrations)), base::Value(partition_id), base::Value(context_path.AsUTF8Unsafe())); }
diff --git a/content/browser/webid/idp_network_request_manager.cc b/content/browser/webid/idp_network_request_manager.cc index 9f5f4b43..9f7e844 100644 --- a/content/browser/webid/idp_network_request_manager.cc +++ b/content/browser/webid/idp_network_request_manager.cc
@@ -79,10 +79,6 @@ constexpr char kTokenKey[] = "token"; -// Token request body keys -constexpr char kTokenAccountKey[] = "account_id"; -constexpr char kTokenRequestKey[] = "request"; - // Revoke request body keys. constexpr char kClientIdKey[] = "client_id"; constexpr char kRevokeAccountKey[] = "account_id"; @@ -474,29 +470,6 @@ maxResponseSizeInKiB * 1024); } -// TODO(majidvp): Should accept request in base::Value form instead of string. -std::string CreateTokenRequestBody(const std::string& account, - const std::string& request) { - // Given account and id_request creates the following JSON - // ```json - // { - // "account_id": "1234", - // "request": "nonce=abc987987cba&client_id=89898" - // } - // }``` - base::Value request_data(base::Value::Type::DICTIONARY); - request_data.SetStringKey(kTokenAccountKey, account); - if (!request.empty()) - request_data.SetStringKey(kTokenRequestKey, request); - - std::string request_body; - if (!base::JSONWriter::Write(request_data, &request_body)) { - LOG(ERROR) << "Not able to serialize token request body."; - return std::string(); - } - return request_body; -} - void IdpNetworkRequestManager::SendTokenRequest(const GURL& token_url, const std::string& account, const std::string& request,
diff --git a/content/common/partition_alloc_support.cc b/content/common/partition_alloc_support.cc index cf99002..a525eb9d 100644 --- a/content/common/partition_alloc_support.cc +++ b/content/common/partition_alloc_support.cc
@@ -420,7 +420,7 @@ #if BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_32_BITS) // Devices almost always report less physical memory than what they actually // have, so anything above 3GiB will catch 4GiB and above. - if (base::SysInfo::AmountOfPhysicalMemory() <= int64_t{3500} * 1024 * 1024) + if (base::SysInfo::AmountOfPhysicalMemoryMB() <= 3500) largest_cached_size_ = ::partition_alloc::ThreadCacheLimits::kDefaultSizeThreshold; #endif // BUILDFLAG(IS_ANDROID) && !defined(ARCH_CPU_64_BITS)
diff --git a/content/public/browser/bluetooth_delegate.h b/content/public/browser/bluetooth_delegate.h index e36682f..264b6f91 100644 --- a/content/public/browser/bluetooth_delegate.h +++ b/content/public/browser/bluetooth_delegate.h
@@ -46,28 +46,38 @@ // class. class CONTENT_EXPORT BluetoothDelegate { public: - // The result of the prompt when requesting device authentication credentials + // The result of the prompt when requesting device pairing // from the user. - enum class DeviceCredentialsPromptResult { + enum class PairPromptStatus { kSuccess, // Result contains user credentials. kCancelled, // User cancelled, or agent cancelled on their behalf. }; - // The result of the prompt when requesting confirm-only pairing. - enum class DevicePairConfirmPromptResult { - kSuccess, // User grant permission for pairing. - kCancelled, // User cancelled, or agent cancelled on their behalf. + // Based on the pairing kinds defined by Windows but it also applies to any + // platform on which we support manual pairing through |PairingDelegate| Ref: + // https://docs.microsoft.com/en-us/uwp/api/windows.devices.enumeration.devicepairingkinds?view=winrt-22621 + enum class PairingKind { + kConfirmOnly, + kConfirmPinMatch, + kDisplayPin, + kProvidePasswordCredential, + kProvidePin }; - // Callback for Bluetooth device auth credential (i.e. PIN) prompt. - // |result| is only valid when status is SUCCESS. - using CredentialsCallback = - base::OnceCallback<void(DeviceCredentialsPromptResult status, - const std::u16string& result)>; + // Struct for pairing prompt result, include |pairing_kind| or |pin| or other + // needed fields added in future all other fieds should be meaniningful only + // if |result_code| is |kSuccess| + struct PairPromptResult { + PairPromptResult() = default; + explicit PairPromptResult(PairPromptStatus code) : result_code(code){} + ~PairPromptResult() = default; - // Callback for Bluetooth device confirm-only prompt. - using PairConfirmCallback = - base::OnceCallback<void(DevicePairConfirmPromptResult status)>; + PairPromptStatus result_code = PairPromptStatus::kCancelled; + std::string pin; + }; + + using PairPromptCallback = + base::OnceCallback<void(const PairPromptResult& result)>; // An observer used to track permission revocation events for a particular // render frame host. @@ -93,27 +103,17 @@ RenderFrameHost* frame, const BluetoothScanningPrompt::EventHandler& event_handler) = 0; - // Prompt the user (via dialog, etc.) for their Bluetooth credentials - // (i.e. PIN). |device_identifier| is any string the caller wants to display + // Prompt the user (via dialog, etc.) for pairing Bluetooth device + // |device_identifier| is any string the caller wants to display // to the user to identify the device (MAC address, name, etc.). |callback| // will be called with the prompt result. |callback| may be called immediately // from this function, for example, if a credential prompt for the given // |frame| is already displayed. - virtual void ShowDeviceCredentialsPrompt( - RenderFrameHost* frame, - const std::u16string& device_identifier, - CredentialsCallback callback) = 0; - - // Prompt the user to consent to pair Bluetooth device - // |device_identifier| is any string the caller wants to display - // to the user to identify the device (MAC address, name, etc.). |callback| - // will be called with the prompt result. |callback| may be called immediately - // from this function, for example, if a pair confirm prompt for the given - // |frame| is already displayed. - virtual void ShowDevicePairConfirmPrompt( - RenderFrameHost* frame, - const std::u16string& device_identifier, - PairConfirmCallback callback) = 0; + // |pairing_kind| is to determine which pairing kind of prompt to be created + virtual void ShowDevicePairPrompt(RenderFrameHost* frame, + const std::u16string& device_identifier, + PairPromptCallback callback, + PairingKind pairing_kind) = 0; // This should return the WebBluetoothDeviceId that corresponds to the device // with |device_address| in the current |frame|. If there is not a
diff --git a/content/web_test/browser/fake_bluetooth_delegate.cc b/content/web_test/browser/fake_bluetooth_delegate.cc index eb6533f..c64511c 100644 --- a/content/web_test/browser/fake_bluetooth_delegate.cc +++ b/content/web_test/browser/fake_bluetooth_delegate.cc
@@ -48,18 +48,13 @@ return std::make_unique<AlwaysAllowBluetoothScanning>(event_handler); } -void FakeBluetoothDelegate::ShowDeviceCredentialsPrompt( +void FakeBluetoothDelegate::ShowDevicePairPrompt( RenderFrameHost* frame, const std::u16string& device_identifier, - CredentialsCallback callback) { - std::move(callback).Run(DeviceCredentialsPromptResult::kCancelled, u""); -} - -void FakeBluetoothDelegate::ShowDevicePairConfirmPrompt( - RenderFrameHost* frame, - const std::u16string& device_identifier, - PairConfirmCallback callback) { - std::move(callback).Run(DevicePairConfirmPromptResult::kCancelled); + PairPromptCallback callback, + PairingKind pairing_kind) { + std::move(callback).Run(content::BluetoothDelegate::PairPromptResult( + content::BluetoothDelegate::PairPromptStatus::kCancelled)); } WebBluetoothDeviceId FakeBluetoothDelegate::GetWebBluetoothDeviceId(
diff --git a/content/web_test/browser/fake_bluetooth_delegate.h b/content/web_test/browser/fake_bluetooth_delegate.h index a23b40da..6f651d6 100644 --- a/content/web_test/browser/fake_bluetooth_delegate.h +++ b/content/web_test/browser/fake_bluetooth_delegate.h
@@ -50,12 +50,12 @@ std::unique_ptr<BluetoothScanningPrompt> ShowBluetoothScanningPrompt( RenderFrameHost* frame, const BluetoothScanningPrompt::EventHandler& event_handler) override; - void ShowDeviceCredentialsPrompt(RenderFrameHost* frame, - const std::u16string& device_identifier, - CredentialsCallback callback) override; - void ShowDevicePairConfirmPrompt(RenderFrameHost* frame, - const std::u16string& device_identifier, - PairConfirmCallback callback) override; + + void ShowDevicePairPrompt(RenderFrameHost* frame, + const std::u16string& device_identifier, + PairPromptCallback callback, + PairingKind pairing_kind) override; + blink::WebBluetoothDeviceId GetWebBluetoothDeviceId( RenderFrameHost* frame, const std::string& device_address) override;
diff --git a/device/bluetooth/adapter.cc b/device/bluetooth/adapter.cc index 37664c1..f028473 100644 --- a/device/bluetooth/adapter.cc +++ b/device/bluetooth/adapter.cc
@@ -109,8 +109,7 @@ adapter_info->name = adapter_->GetName(); #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) adapter_info->system_name = adapter_->GetSystemName(); - adapter_info->floss = - base::FeatureList::IsEnabled(floss::features::kFlossEnabled); + adapter_info->floss = floss::features::IsFlossEnabled(); #endif adapter_info->initialized = adapter_->IsInitialized(); adapter_info->present = adapter_->IsPresent();
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.cc b/device/bluetooth/bluetooth_adapter_chromeos.cc index 7383aba..c7c724f 100644 --- a/device/bluetooth/bluetooth_adapter_chromeos.cc +++ b/device/bluetooth/bluetooth_adapter_chromeos.cc
@@ -9,7 +9,7 @@ namespace device { scoped_refptr<device::BluetoothAdapter> BluetoothAdapter::CreateAdapter() { - if (base::FeatureList::IsEnabled(floss::features::kFlossEnabled)) { + if (floss::features::IsFlossEnabled()) { return floss::BluetoothAdapterFloss::CreateAdapter(); } else { return bluez::BluetoothAdapterBlueZ::CreateAdapter();
diff --git a/device/bluetooth/floss/floss_features.cc b/device/bluetooth/floss/floss_features.cc index b9e912d..15315a9 100644 --- a/device/bluetooth/floss/floss_features.cc +++ b/device/bluetooth/floss/floss_features.cc
@@ -4,11 +4,27 @@ #include "device/bluetooth/floss/floss_features.h" +#if BUILDFLAG(IS_CHROMEOS_LACROS) +#include "chromeos/startup/browser_init_params.h" +#endif + namespace floss { namespace features { +#if BUILDFLAG(IS_CHROMEOS_ASH) // Enables Floss client if supported by platform const base::Feature kFlossEnabled{"Floss", base::FEATURE_DISABLED_BY_DEFAULT}; +#endif + +bool IsFlossEnabled() { +#if BUILDFLAG(IS_CHROMEOS_ASH) + return base::FeatureList::IsEnabled(floss::features::kFlossEnabled); +#elif BUILDFLAG(IS_CHROMEOS_LACROS) + return chromeos::BrowserInitParams::Get()->use_floss_bluetooth; +#else + return false; +#endif +} } // namespace features } // namespace floss
diff --git a/device/bluetooth/floss/floss_features.h b/device/bluetooth/floss/floss_features.h index ebeb75b..5370b78 100644 --- a/device/bluetooth/floss/floss_features.h +++ b/device/bluetooth/floss/floss_features.h
@@ -6,12 +6,19 @@ #define DEVICE_BLUETOOTH_FLOSS_FLOSS_FEATURES_H_ #include "base/feature_list.h" +#include "build/chromeos_buildflags.h" #include "device/bluetooth/bluetooth_export.h" namespace floss { namespace features { +// The feature is defined in Ash and propagated to Lacros over crosapi. +#if BUILDFLAG(IS_CHROMEOS_ASH) extern const DEVICE_BLUETOOTH_EXPORT base::Feature kFlossEnabled; +#endif + +// A helper method that has the appropriate behavior on both Ash and Lacros. +bool DEVICE_BLUETOOTH_EXPORT IsFlossEnabled(); } // namespace features } // namespace floss
diff --git a/device/bluetooth/floss/floss_manager_client.cc b/device/bluetooth/floss/floss_manager_client.cc index f9c3b72..c90e50a 100644 --- a/device/bluetooth/floss/floss_manager_client.cc +++ b/device/bluetooth/floss/floss_manager_client.cc
@@ -359,8 +359,8 @@ RegisterWithManager(); // Enable Floss and retry a few times until it is set. - SetFlossEnabled(base::FeatureList::IsEnabled(floss::features::kFlossEnabled), - kSetFlossRetryCount, kSetFlossRetryDelayMs, + SetFlossEnabled(floss::features::IsFlossEnabled(), kSetFlossRetryCount, + kSetFlossRetryDelayMs, base::BindOnce(&FlossManagerClient::CompleteSetFlossEnabled, weak_ptr_factory_.GetWeakPtr())); }
diff --git a/docs/updater/functional_spec.md b/docs/updater/functional_spec.md index 1d8d8f6..2b35508 100644 --- a/docs/updater/functional_spec.md +++ b/docs/updater/functional_spec.md
@@ -693,6 +693,31 @@ ### Crash Reporting TODO(crbug.com/1035895): Document updater crash reporting. +### Process Launcher (Deprecated, please use the Application Commands feature) +The feature allows installed products to pre-register and later run elevated +command lines in the format `c:\program files\foo\exe.exe params`. Multiple +command lines can be registered per `app_id`. + +This feature is only for system applications. + +The program path is always an absolute path. Additionally, the program path is +also a child of %ProgramFiles% or %ProgramFiles(x86)%. For instance: +* `c:\path-to-exe\exe.exe` is an invalid path. +* `"c:\Program Files\subdir\exe.exe"` is a valid path. +* `"c:\Program Files (x86)\subdir\exe.exe"` is also a valid path. + +#### Registration +Commands are registered in the registry with the following format: + +``` + Update\Clients\{`app_id`} + REG_SZ `command_id` == "c:\Program Files\subdir\exe.exe p1 p2" +``` + +#### Usage +Once registered, commands may be invoked using the `LaunchCmdElevated` method in +the `IProcessLauncher` interface. + ### Application Commands (applicable to the Windows version of the Updater) The feature allows installed products to pre-register and later run command lines in the format `c:\path-to-exe\exe.exe {params}` (elevated for system
diff --git a/extensions/browser/api/storage/settings_quota_unittest.cc b/extensions/browser/api/storage/settings_quota_unittest.cc index 85da398..4044e60b 100644 --- a/extensions/browser/api/storage/settings_quota_unittest.cc +++ b/extensions/browser/api/storage/settings_quota_unittest.cc
@@ -63,7 +63,7 @@ // Returns whether the settings in |storage_| and |delegate_| are the same as // |settings|. - bool SettingsEqual(const base::DictionaryValue& settings) { + bool SettingsEqual(const base::Value::Dict& settings) { return settings == storage_->Get().settings() && settings == delegate_->Get().settings(); } @@ -81,7 +81,7 @@ }; TEST_F(ExtensionSettingsQuotaTest, ZeroQuotaBytes) { - base::DictionaryValue empty; + base::Value::Dict empty; CreateStorage(0, UINT_MAX, UINT_MAX); EXPECT_FALSE(storage_->Set(DEFAULTS, "a", byte_value_1_).status().ok()); @@ -91,7 +91,7 @@ } TEST_F(ExtensionSettingsQuotaTest, KeySizeTakenIntoAccount) { - base::DictionaryValue empty; + base::Value::Dict empty; CreateStorage(8u, UINT_MAX, UINT_MAX); EXPECT_FALSE( storage_->Set(DEFAULTS, "Really long key", byte_value_1_).status().ok()); @@ -99,11 +99,11 @@ } TEST_F(ExtensionSettingsQuotaTest, SmallByteQuota) { - base::DictionaryValue settings; + base::Value::Dict settings; CreateStorage(8u, UINT_MAX, UINT_MAX); EXPECT_TRUE(storage_->Set(DEFAULTS, "a", byte_value_1_).status().ok()); - settings.SetKey("a", byte_value_1_.Clone()); + settings.Set("a", byte_value_1_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); EXPECT_FALSE(storage_->Set(DEFAULTS, "b", byte_value_16_).status().ok()); @@ -112,21 +112,21 @@ } TEST_F(ExtensionSettingsQuotaTest, MediumByteQuota) { - base::DictionaryValue settings; + base::Value::Dict settings; CreateStorage(40, UINT_MAX, UINT_MAX); - base::DictionaryValue to_set; - to_set.SetKey("a", byte_value_1_.Clone()); - to_set.SetKey("b", byte_value_16_.Clone()); + base::Value::Dict to_set; + to_set.Set("a", byte_value_1_.Clone()); + to_set.Set("b", byte_value_16_.Clone()); EXPECT_TRUE(storage_->Set(DEFAULTS, to_set).status().ok()); - settings.SetKey("a", byte_value_1_.Clone()); - settings.SetKey("b", byte_value_16_.Clone()); + settings.Set("a", byte_value_1_.Clone()); + settings.Set("b", byte_value_16_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); // Should be able to set value to other under-quota value. - to_set.SetKey("a", byte_value_16_.Clone()); + to_set.Set("a", byte_value_16_.Clone()); EXPECT_TRUE(storage_->Set(DEFAULTS, to_set).status().ok()); - settings.SetKey("a", byte_value_16_.Clone()); + settings.Set("a", byte_value_16_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); EXPECT_FALSE(storage_->Set(DEFAULTS, "c", byte_value_256_).status().ok()); @@ -134,7 +134,7 @@ } TEST_F(ExtensionSettingsQuotaTest, ZeroMaxKeys) { - base::DictionaryValue empty; + base::Value::Dict empty; CreateStorage(UINT_MAX, UINT_MAX, 0); EXPECT_FALSE(storage_->Set(DEFAULTS, "a", byte_value_1_).status().ok()); @@ -144,16 +144,16 @@ } TEST_F(ExtensionSettingsQuotaTest, SmallMaxKeys) { - base::DictionaryValue settings; + base::Value::Dict settings; CreateStorage(UINT_MAX, UINT_MAX, 1); EXPECT_TRUE(storage_->Set(DEFAULTS, "a", byte_value_1_).status().ok()); - settings.SetKey("a", byte_value_1_.Clone()); + settings.Set("a", byte_value_1_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); // Should be able to set existing key to other value without going over quota. EXPECT_TRUE(storage_->Set(DEFAULTS, "a", byte_value_16_).status().ok()); - settings.SetKey("a", byte_value_16_.Clone()); + settings.Set("a", byte_value_16_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); EXPECT_FALSE(storage_->Set(DEFAULTS, "b", byte_value_16_).status().ok()); @@ -162,22 +162,22 @@ } TEST_F(ExtensionSettingsQuotaTest, MediumMaxKeys) { - base::DictionaryValue settings; + base::Value::Dict settings; CreateStorage(UINT_MAX, UINT_MAX, 2); - base::DictionaryValue to_set; - to_set.SetKey("a", byte_value_1_.Clone()); - to_set.SetKey("b", byte_value_16_.Clone()); + base::Value::Dict to_set; + to_set.Set("a", byte_value_1_.Clone()); + to_set.Set("b", byte_value_16_.Clone()); EXPECT_TRUE(storage_->Set(DEFAULTS, to_set).status().ok()); - settings.SetKey("a", byte_value_1_.Clone()); - settings.SetKey("b", byte_value_16_.Clone()); + settings.Set("a", byte_value_1_.Clone()); + settings.Set("b", byte_value_16_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); // Should be able to set existing keys to other values without going over // quota. - to_set.SetKey("a", byte_value_16_.Clone()); + to_set.Set("a", byte_value_16_.Clone()); EXPECT_TRUE(storage_->Set(DEFAULTS, to_set).status().ok()); - settings.SetKey("a", byte_value_16_.Clone()); + settings.Set("a", byte_value_16_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); EXPECT_FALSE(storage_->Set(DEFAULTS, "c", byte_value_256_).status().ok()); @@ -185,25 +185,25 @@ } TEST_F(ExtensionSettingsQuotaTest, RemovingExistingSettings) { - base::DictionaryValue settings; + base::Value::Dict settings; CreateStorage(266, UINT_MAX, 2); storage_->Set(DEFAULTS, "b", byte_value_16_); - settings.SetKey("b", byte_value_16_.Clone()); + settings.Set("b", byte_value_16_.Clone()); // Not enough quota. storage_->Set(DEFAULTS, "c", byte_value_256_); EXPECT_TRUE(SettingsEqual(settings)); // Try again with "b" removed, enough quota. EXPECT_TRUE(storage_->Remove("b").status().ok()); - settings.RemoveKey("b"); + settings.Remove("b"); EXPECT_TRUE(storage_->Set(DEFAULTS, "c", byte_value_256_).status().ok()); - settings.SetKey("c", byte_value_256_.Clone()); + settings.Set("c", byte_value_256_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); // Enough byte quota but max keys not high enough. EXPECT_TRUE(storage_->Set(DEFAULTS, "a", byte_value_1_).status().ok()); - settings.SetKey("a", byte_value_1_.Clone()); + settings.Set("a", byte_value_1_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); EXPECT_FALSE(storage_->Set(DEFAULTS, "b", byte_value_1_).status().ok()); @@ -211,23 +211,23 @@ // Back under max keys. EXPECT_TRUE(storage_->Remove("a").status().ok()); - settings.RemoveKey("a"); + settings.Remove("a"); EXPECT_TRUE(storage_->Set(DEFAULTS, "b", byte_value_1_).status().ok()); - settings.SetKey("b", byte_value_1_.Clone()); + settings.Set("b", byte_value_1_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); } TEST_F(ExtensionSettingsQuotaTest, RemovingNonexistentSettings) { - base::DictionaryValue settings; + base::Value::Dict settings; CreateStorage(36, UINT_MAX, 3); // Max out bytes. - base::DictionaryValue to_set; - to_set.SetKey("b1", byte_value_16_.Clone()); - to_set.SetKey("b2", byte_value_16_.Clone()); + base::Value::Dict to_set; + to_set.Set("b1", byte_value_16_.Clone()); + to_set.Set("b2", byte_value_16_.Clone()); storage_->Set(DEFAULTS, to_set); - settings.SetKey("b1", byte_value_16_.Clone()); - settings.SetKey("b2", byte_value_16_.Clone()); + settings.Set("b1", byte_value_16_.Clone()); + settings.Set("b2", byte_value_16_.Clone()); EXPECT_FALSE(storage_->Set(DEFAULTS, "a", byte_value_1_).status().ok()); EXPECT_TRUE(SettingsEqual(settings)); @@ -244,14 +244,14 @@ EXPECT_TRUE(SettingsEqual(settings)); // Max out key count. - to_set.DictClear(); - to_set.SetKey("b1", byte_value_1_.Clone()); - to_set.SetKey("b2", byte_value_1_.Clone()); + to_set.clear(); + to_set.Set("b1", byte_value_1_.Clone()); + to_set.Set("b2", byte_value_1_.Clone()); storage_->Set(DEFAULTS, to_set); - settings.SetKey("b1", byte_value_1_.Clone()); - settings.SetKey("b2", byte_value_1_.Clone()); + settings.Set("b1", byte_value_1_.Clone()); + settings.Set("b2", byte_value_1_.Clone()); storage_->Set(DEFAULTS, "b3", byte_value_1_); - settings.SetKey("b3", byte_value_1_.Clone()); + settings.Set("b3", byte_value_1_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); // Remove some settings that don't exist. @@ -268,14 +268,14 @@ } TEST_F(ExtensionSettingsQuotaTest, Clear) { - base::DictionaryValue settings; + base::Value::Dict settings; CreateStorage(40, UINT_MAX, 5); // Test running out of byte quota. { - base::DictionaryValue to_set; - to_set.SetKey("a", byte_value_16_.Clone()); - to_set.SetKey("b", byte_value_16_.Clone()); + base::Value::Dict to_set; + to_set.Set("a", byte_value_16_.Clone()); + to_set.Set("b", byte_value_16_.Clone()); EXPECT_TRUE(storage_->Set(DEFAULTS, to_set).status().ok()); EXPECT_FALSE(storage_->Set(DEFAULTS, "c", byte_value_16_).status().ok()); @@ -289,12 +289,12 @@ // Test reaching max keys. storage_->Clear(); { - base::DictionaryValue to_set; - to_set.SetKey("a", byte_value_1_.Clone()); - to_set.SetKey("b", byte_value_1_.Clone()); - to_set.SetKey("c", byte_value_1_.Clone()); - to_set.SetKey("d", byte_value_1_.Clone()); - to_set.SetKey("e", byte_value_1_.Clone()); + base::Value::Dict to_set; + to_set.Set("a", byte_value_1_.Clone()); + to_set.Set("b", byte_value_1_.Clone()); + to_set.Set("c", byte_value_1_.Clone()); + to_set.Set("d", byte_value_1_.Clone()); + to_set.Set("e", byte_value_1_.Clone()); EXPECT_TRUE(storage_->Set(DEFAULTS, to_set).status().ok()); EXPECT_FALSE(storage_->Set(DEFAULTS, "f", byte_value_1_).status().ok()); @@ -307,12 +307,12 @@ } TEST_F(ExtensionSettingsQuotaTest, ChangingUsedBytesWithSet) { - base::DictionaryValue settings; + base::Value::Dict settings; CreateStorage(20, UINT_MAX, UINT_MAX); // Change a setting to make it go over quota. storage_->Set(DEFAULTS, "a", byte_value_16_); - settings.SetKey("a", byte_value_16_.Clone()); + settings.Set("a", byte_value_16_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); EXPECT_FALSE(storage_->Set(DEFAULTS, "a", byte_value_256_).status().ok()); @@ -321,61 +321,61 @@ // Change a setting to reduce usage and room for another setting. EXPECT_FALSE(storage_->Set(DEFAULTS, "foobar", byte_value_1_).status().ok()); storage_->Set(DEFAULTS, "a", byte_value_1_); - settings.SetKey("a", byte_value_1_.Clone()); + settings.Set("a", byte_value_1_.Clone()); EXPECT_TRUE(storage_->Set(DEFAULTS, "foobar", byte_value_1_).status().ok()); - settings.SetKey("foobar", byte_value_1_.Clone()); + settings.Set("foobar", byte_value_1_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); } TEST_F(ExtensionSettingsQuotaTest, SetsOnlyEntirelyCompletedWithByteQuota) { - base::DictionaryValue settings; + base::Value::Dict settings; CreateStorage(40, UINT_MAX, UINT_MAX); storage_->Set(DEFAULTS, "a", byte_value_16_); - settings.SetKey("a", byte_value_16_.Clone()); + settings.Set("a", byte_value_16_.Clone()); // The entire change is over quota. - base::DictionaryValue to_set; - to_set.SetKey("b", byte_value_16_.Clone()); - to_set.SetKey("c", byte_value_16_.Clone()); + base::Value::Dict to_set; + to_set.Set("b", byte_value_16_.Clone()); + to_set.Set("c", byte_value_16_.Clone()); EXPECT_FALSE(storage_->Set(DEFAULTS, to_set).status().ok()); EXPECT_TRUE(SettingsEqual(settings)); // The entire change is over quota, but quota reduced in existing key. - to_set.SetKey("a", byte_value_1_.Clone()); + to_set.Set("a", byte_value_1_.Clone()); EXPECT_TRUE(storage_->Set(DEFAULTS, to_set).status().ok()); - settings.SetKey("a", byte_value_1_.Clone()); - settings.SetKey("b", byte_value_16_.Clone()); - settings.SetKey("c", byte_value_16_.Clone()); + settings.Set("a", byte_value_1_.Clone()); + settings.Set("b", byte_value_16_.Clone()); + settings.Set("c", byte_value_16_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); } TEST_F(ExtensionSettingsQuotaTest, SetsOnlyEntireCompletedWithMaxKeys) { - base::DictionaryValue settings; + base::Value::Dict settings; CreateStorage(UINT_MAX, UINT_MAX, 2); storage_->Set(DEFAULTS, "a", byte_value_1_); - settings.SetKey("a", byte_value_1_.Clone()); + settings.Set("a", byte_value_1_.Clone()); - base::DictionaryValue to_set; - to_set.SetKey("b", byte_value_16_.Clone()); - to_set.SetKey("c", byte_value_16_.Clone()); + base::Value::Dict to_set; + to_set.Set("b", byte_value_16_.Clone()); + to_set.Set("c", byte_value_16_.Clone()); EXPECT_FALSE(storage_->Set(DEFAULTS, to_set).status().ok()); EXPECT_TRUE(SettingsEqual(settings)); } TEST_F(ExtensionSettingsQuotaTest, WithInitialDataAndByteQuota) { - base::DictionaryValue settings; + base::Value::Dict settings; delegate_->Set(DEFAULTS, "a", byte_value_256_); - settings.SetKey("a", byte_value_256_.Clone()); + settings.Set("a", byte_value_256_.Clone()); CreateStorage(280, UINT_MAX, UINT_MAX); EXPECT_TRUE(SettingsEqual(settings)); // Add some data. EXPECT_TRUE(storage_->Set(DEFAULTS, "b", byte_value_16_).status().ok()); - settings.SetKey("b", byte_value_16_.Clone()); + settings.Set("b", byte_value_16_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); // Not enough quota. @@ -384,11 +384,11 @@ // Reduce usage of original setting so that "c" can fit. EXPECT_TRUE(storage_->Set(DEFAULTS, "a", byte_value_16_).status().ok()); - settings.SetKey("a", byte_value_16_.Clone()); + settings.Set("a", byte_value_16_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); EXPECT_TRUE(storage_->Set(DEFAULTS, "c", byte_value_16_).status().ok()); - settings.SetKey("c", byte_value_16_.Clone()); + settings.Set("c", byte_value_16_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); // Remove to free up some more data. @@ -398,23 +398,23 @@ to_remove.push_back("a"); to_remove.push_back("b"); storage_->Remove(to_remove); - settings.RemoveKey("a"); - settings.RemoveKey("b"); + settings.Remove("a"); + settings.Remove("b"); EXPECT_TRUE(SettingsEqual(settings)); EXPECT_TRUE(storage_->Set(DEFAULTS, "d", byte_value_256_).status().ok()); - settings.SetKey("d", byte_value_256_.Clone()); + settings.Set("d", byte_value_256_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); } TEST_F(ExtensionSettingsQuotaTest, WithInitialDataAndMaxKeys) { - base::DictionaryValue settings; + base::Value::Dict settings; delegate_->Set(DEFAULTS, "a", byte_value_1_); - settings.SetKey("a", byte_value_1_.Clone()); + settings.Set("a", byte_value_1_.Clone()); CreateStorage(UINT_MAX, UINT_MAX, 2); EXPECT_TRUE(storage_->Set(DEFAULTS, "b", byte_value_1_).status().ok()); - settings.SetKey("b", byte_value_1_.Clone()); + settings.Set("b", byte_value_1_.Clone()); EXPECT_FALSE(storage_->Set(DEFAULTS, "c", byte_value_1_).status().ok()); @@ -422,10 +422,10 @@ } TEST_F(ExtensionSettingsQuotaTest, InitiallyOverByteQuota) { - base::DictionaryValue settings; - settings.SetKey("a", byte_value_16_.Clone()); - settings.SetKey("b", byte_value_16_.Clone()); - settings.SetKey("c", byte_value_16_.Clone()); + base::Value::Dict settings; + settings.Set("a", byte_value_16_.Clone()); + settings.Set("b", byte_value_16_.Clone()); + settings.Set("c", byte_value_16_.Clone()); delegate_->Set(DEFAULTS, settings); CreateStorage(40, UINT_MAX, UINT_MAX); @@ -435,20 +435,20 @@ // Take under quota by reducing size of an existing setting EXPECT_TRUE(storage_->Set(DEFAULTS, "a", byte_value_1_).status().ok()); - settings.SetKey("a", byte_value_1_.Clone()); + settings.Set("a", byte_value_1_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); // Should be able set another small setting. EXPECT_TRUE(storage_->Set(DEFAULTS, "d", byte_value_1_).status().ok()); - settings.SetKey("d", byte_value_1_.Clone()); + settings.Set("d", byte_value_1_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); } TEST_F(ExtensionSettingsQuotaTest, InitiallyOverMaxKeys) { - base::DictionaryValue settings; - settings.SetKey("a", byte_value_16_.Clone()); - settings.SetKey("b", byte_value_16_.Clone()); - settings.SetKey("c", byte_value_16_.Clone()); + base::Value::Dict settings; + settings.Set("a", byte_value_16_.Clone()); + settings.Set("b", byte_value_16_.Clone()); + settings.Set("c", byte_value_16_.Clone()); delegate_->Set(DEFAULTS, settings); CreateStorage(UINT_MAX, UINT_MAX, 2); @@ -461,13 +461,13 @@ // Should be able after removing 2. storage_->Remove("a"); - settings.RemoveKey("a"); + settings.Remove("a"); storage_->Remove("b"); - settings.RemoveKey("b"); + settings.Remove("b"); EXPECT_TRUE(SettingsEqual(settings)); EXPECT_TRUE(storage_->Set(DEFAULTS, "e", byte_value_1_).status().ok()); - settings.SetKey("e", byte_value_1_.Clone()); + settings.Set("e", byte_value_1_.Clone()); EXPECT_TRUE(SettingsEqual(settings)); // Still can't set any. @@ -477,7 +477,7 @@ } TEST_F(ExtensionSettingsQuotaTest, ZeroQuotaBytesPerSetting) { - base::DictionaryValue empty; + base::Value::Dict empty; CreateStorage(UINT_MAX, 0, UINT_MAX); EXPECT_FALSE(storage_->Set(DEFAULTS, "a", byte_value_1_).status().ok()); @@ -487,25 +487,25 @@ } TEST_F(ExtensionSettingsQuotaTest, QuotaBytesPerSetting) { - base::DictionaryValue settings; + base::Value::Dict settings; CreateStorage(UINT_MAX, 20, UINT_MAX); EXPECT_TRUE(storage_->Set(DEFAULTS, "a", byte_value_1_).status().ok()); EXPECT_TRUE(storage_->Set(DEFAULTS, "a", byte_value_16_).status().ok()); - settings.SetKey("a", byte_value_16_.Clone()); + settings.Set("a", byte_value_16_.Clone()); EXPECT_FALSE(storage_->Set(DEFAULTS, "a", byte_value_256_).status().ok()); EXPECT_TRUE(storage_->Set(DEFAULTS, "b", byte_value_1_).status().ok()); EXPECT_TRUE(storage_->Set(DEFAULTS, "b", byte_value_16_).status().ok()); - settings.SetKey("b", byte_value_16_.Clone()); + settings.Set("b", byte_value_16_.Clone()); EXPECT_FALSE(storage_->Set(DEFAULTS, "b", byte_value_256_).status().ok()); EXPECT_TRUE(SettingsEqual(settings)); } TEST_F(ExtensionSettingsQuotaTest, QuotaBytesPerSettingWithInitialSettings) { - base::DictionaryValue settings; + base::Value::Dict settings; delegate_->Set(DEFAULTS, "a", byte_value_1_); delegate_->Set(DEFAULTS, "b", byte_value_16_); @@ -514,17 +514,17 @@ EXPECT_TRUE(storage_->Set(DEFAULTS, "a", byte_value_1_).status().ok()); EXPECT_TRUE(storage_->Set(DEFAULTS, "a", byte_value_16_).status().ok()); - settings.SetKey("a", byte_value_16_.Clone()); + settings.Set("a", byte_value_16_.Clone()); EXPECT_FALSE(storage_->Set(DEFAULTS, "a", byte_value_256_).status().ok()); EXPECT_TRUE(storage_->Set(DEFAULTS, "b", byte_value_1_).status().ok()); EXPECT_TRUE(storage_->Set(DEFAULTS, "b", byte_value_16_).status().ok()); - settings.SetKey("b", byte_value_16_.Clone()); + settings.Set("b", byte_value_16_.Clone()); EXPECT_FALSE(storage_->Set(DEFAULTS, "b", byte_value_256_).status().ok()); EXPECT_TRUE(storage_->Set(DEFAULTS, "c", byte_value_1_).status().ok()); EXPECT_TRUE(storage_->Set(DEFAULTS, "c", byte_value_16_).status().ok()); - settings.SetKey("c", byte_value_16_.Clone()); + settings.Set("c", byte_value_16_.Clone()); EXPECT_FALSE(storage_->Set(DEFAULTS, "c", byte_value_256_).status().ok()); EXPECT_TRUE(SettingsEqual(settings)); @@ -535,7 +535,7 @@ // This is a lazy test to make sure IGNORE_QUOTA lets through changes: the // test above copied, but using IGNORE_QUOTA and asserting nothing is ever // rejected... - base::DictionaryValue settings; + base::Value::Dict settings; delegate_->Set(DEFAULTS, "a", byte_value_1_); delegate_->Set(DEFAULTS, "b", byte_value_16_); @@ -545,16 +545,16 @@ EXPECT_TRUE(storage_->Set(IGNORE_QUOTA, "a", byte_value_1_).status().ok()); EXPECT_TRUE(storage_->Set(IGNORE_QUOTA, "a", byte_value_16_).status().ok()); EXPECT_TRUE(storage_->Set(IGNORE_QUOTA, "a", byte_value_256_).status().ok()); - settings.SetKey("a", byte_value_256_.Clone()); + settings.Set("a", byte_value_256_.Clone()); EXPECT_TRUE(storage_->Set(IGNORE_QUOTA, "b", byte_value_1_).status().ok()); EXPECT_TRUE(storage_->Set(IGNORE_QUOTA, "b", byte_value_16_).status().ok()); EXPECT_TRUE(storage_->Set(IGNORE_QUOTA, "b", byte_value_256_).status().ok()); - settings.SetKey("b", byte_value_256_.Clone()); + settings.Set("b", byte_value_256_.Clone()); EXPECT_TRUE(storage_->Set(IGNORE_QUOTA, "c", byte_value_1_).status().ok()); EXPECT_TRUE(storage_->Set(IGNORE_QUOTA, "c", byte_value_16_).status().ok()); - settings.SetKey("c", byte_value_16_.Clone()); + settings.Set("c", byte_value_16_.Clone()); // ... except the last. Make sure it can still fail. EXPECT_FALSE(storage_->Set(DEFAULTS, "c", byte_value_256_).status().ok());
diff --git a/extensions/browser/api/storage/settings_storage_quota_enforcer.cc b/extensions/browser/api/storage/settings_storage_quota_enforcer.cc index 18ee97dd..777fab9c 100644 --- a/extensions/browser/api/storage/settings_storage_quota_enforcer.cc +++ b/extensions/browser/api/storage/settings_storage_quota_enforcer.cc
@@ -137,16 +137,16 @@ } ValueStore::WriteResult SettingsStorageQuotaEnforcer::Set( - WriteOptions options, const base::DictionaryValue& values) { + WriteOptions options, + const base::Value::Dict& values) { LazyCalculateUsage(); size_t new_used_total = used_total_; std::map<std::string, size_t> new_used_per_setting = used_per_setting_; - for (base::DictionaryValue::Iterator it(values); !it.IsAtEnd(); - it.Advance()) { - Allocate(it.key(), it.value(), &new_used_total, &new_used_per_setting); + for (const auto [key, value] : values) { + Allocate(key, value, &new_used_total, &new_used_per_setting); if (!(options & IGNORE_QUOTA) && - new_used_per_setting[it.key()] > limits_.quota_bytes_per_item) { + new_used_per_setting[key] > limits_.quota_bytes_per_item) { return WriteResult(QuotaExceededError(QUOTA_BYTES_PER_ITEM)); } }
diff --git a/extensions/browser/api/storage/settings_storage_quota_enforcer.h b/extensions/browser/api/storage/settings_storage_quota_enforcer.h index 0d7d701..770acb7 100644 --- a/extensions/browser/api/storage/settings_storage_quota_enforcer.h +++ b/extensions/browser/api/storage/settings_storage_quota_enforcer.h
@@ -54,7 +54,7 @@ const std::string& key, const base::Value& value) override; WriteResult Set(WriteOptions options, - const base::DictionaryValue& values) override; + const base::Value::Dict& values) override; WriteResult Remove(const std::string& key) override; WriteResult Remove(const std::vector<std::string>& keys) override; WriteResult Clear() override;
diff --git a/extensions/browser/api/storage/storage_api.cc b/extensions/browser/api/storage/storage_api.cc index 28e3eb8..918fb917 100644 --- a/extensions/browser/api/storage/storage_api.cc +++ b/extensions/browser/api/storage/storage_api.cc
@@ -391,9 +391,8 @@ "extension_id", extension_id()); if (args().empty() || !args()[0].is_dict()) return BadMessage(); - const base::DictionaryValue& input = - base::Value::AsDictionaryValue(args()[0]); - return UseWriteResult(storage->Set(ValueStore::DEFAULTS, input)); + return UseWriteResult( + storage->Set(ValueStore::DEFAULTS, args()[0].GetDict())); } ExtensionFunction::ResponseValue StorageStorageAreaSetFunction::RunInSession() {
diff --git a/extensions/browser/api/storage/weak_unlimited_settings_storage.cc b/extensions/browser/api/storage/weak_unlimited_settings_storage.cc index 0618932..2bc649c 100644 --- a/extensions/browser/api/storage/weak_unlimited_settings_storage.cc +++ b/extensions/browser/api/storage/weak_unlimited_settings_storage.cc
@@ -48,7 +48,8 @@ } ValueStore::WriteResult WeakUnlimitedSettingsStorage::Set( - WriteOptions options, const base::DictionaryValue& values) { + WriteOptions options, + const base::Value::Dict& values) { return delegate_->Set(IGNORE_QUOTA, values); }
diff --git a/extensions/browser/api/storage/weak_unlimited_settings_storage.h b/extensions/browser/api/storage/weak_unlimited_settings_storage.h index b8ac4e8..9a39da5 100644 --- a/extensions/browser/api/storage/weak_unlimited_settings_storage.h +++ b/extensions/browser/api/storage/weak_unlimited_settings_storage.h
@@ -41,7 +41,7 @@ const std::string& key, const base::Value& value) override; WriteResult Set(WriteOptions options, - const base::DictionaryValue& values) override; + const base::Value::Dict& values) override; WriteResult Remove(const std::string& key) override; WriteResult Remove(const std::vector<std::string>& keys) override; WriteResult Clear() override;
diff --git a/extensions/browser/permissions_manager.cc b/extensions/browser/permissions_manager.cc index 91559c13..cda3fb4 100644 --- a/extensions/browser/permissions_manager.cc +++ b/extensions/browser/permissions_manager.cc
@@ -7,6 +7,7 @@ #include <memory> #include "base/containers/contains.h" +#include "base/feature_list.h" #include "base/no_destructor.h" #include "base/observer_list.h" #include "base/values.h" @@ -27,6 +28,7 @@ #include "extensions/browser/pref_types.h" #include "extensions/browser/renderer_startup_helper.h" #include "extensions/common/extension.h" +#include "extensions/common/extension_features.h" #include "extensions/common/manifest_handlers/permissions_parser.h" #include "extensions/common/mojom/renderer.mojom.h" #include "extensions/common/permissions/permission_set.h" @@ -535,16 +537,32 @@ ExtensionsBrowserClient::Get()->AddAdditionalAllowedHosts( desired_permissions, *granted_permissions); + URLPatternSet granted_scriptable_hosts = + granted_permissions->scriptable_hosts().Clone(); + URLPatternSet granted_explicit_hosts = + granted_permissions->explicit_hosts().Clone(); + + if (base::FeatureList::IsEnabled( + extensions_features::kExtensionsMenuAccessControl)) { + // Also add any hosts the user indicated extensions may always run on. + URLPatternSet user_allowed_sites; + for (const auto& site : user_permissions_.permitted_sites) { + user_allowed_sites.AddOrigin(Extension::kValidHostPermissionSchemes, + site); + } + + granted_scriptable_hosts.AddPatterns(user_allowed_sites); + granted_explicit_hosts.AddPatterns(user_allowed_sites); + } + // Host permissions may be withheld. The resulting set is the intersection of // the hosts the extension desires and the user has approved or should always // be granted. URLPatternSet new_scriptable_hosts = URLPatternSet::CreateIntersection( - desired_permissions.scriptable_hosts(), - granted_permissions->scriptable_hosts(), + desired_permissions.scriptable_hosts(), granted_scriptable_hosts, URLPatternSet::IntersectionBehavior::kDetailed); URLPatternSet new_explicit_hosts = URLPatternSet::CreateIntersection( - desired_permissions.explicit_hosts(), - granted_permissions->explicit_hosts(), + desired_permissions.explicit_hosts(), granted_explicit_hosts, URLPatternSet::IntersectionBehavior::kDetailed); // The total resulting permissions set includes the new host permissions and
diff --git a/gpu/command_buffer/client/shared_memory_limits.h b/gpu/command_buffer/client/shared_memory_limits.h index 238785d..d3e13c08 100644 --- a/gpu/command_buffer/client/shared_memory_limits.h +++ b/gpu/command_buffer/client/shared_memory_limits.h
@@ -21,7 +21,7 @@ // Do not use more than 5% of extra shared memory, and do not use any extra // for memory contrained devices (<=1GB). max_mapped_memory_for_texture_upload = - base::SysInfo::AmountOfPhysicalMemory() > 1024 * 1024 * 1024 + base::SysInfo::AmountOfPhysicalMemory() > 1024ULL * 1024 * 1024 ? base::saturated_cast<uint32_t>( base::SysInfo::AmountOfPhysicalMemory() / 20) : 0;
diff --git a/gpu/command_buffer/service/dawn_service_memory_transfer_service.cc b/gpu/command_buffer/service/dawn_service_memory_transfer_service.cc index 40a990ce..579cd3cb 100644 --- a/gpu/command_buffer/service/dawn_service_memory_transfer_service.cc +++ b/gpu/command_buffer/service/dawn_service_memory_transfer_service.cc
@@ -30,7 +30,8 @@ size_t offset, size_t size, void* serializePointer) override { - DCHECK_LE(size + offset, size_); + DCHECK_LE(offset, size_); + DCHECK_LE(size, size_ - offset); // Copy the data into the shared memory allocation. // In the case of buffer mapping, this is the mapped GPU memory which we // copy into client-visible shared memory. @@ -57,10 +58,16 @@ size_t size) override { // Nothing is serialized because we're using shared memory. DCHECK_EQ(deserialize_size, 0u); - DCHECK_LE(size + offset, size_); DCHECK(mTargetData); DCHECK(ptr_); + if (offset > mDataLength || size > mDataLength - offset) { + return false; + } + if (offset > size_ || size > size_ - offset) { + return false; + } + // Copy from shared memory into the target buffer. // mTargetData will always be the starting address // of the backing buffer after the dawn side change.
diff --git a/gpu/command_buffer/service/webgpu_decoder_impl.cc b/gpu/command_buffer/service/webgpu_decoder_impl.cc index 46c6b6e..1f2e169a 100644 --- a/gpu/command_buffer/service/webgpu_decoder_impl.cc +++ b/gpu/command_buffer/service/webgpu_decoder_impl.cc
@@ -1464,7 +1464,6 @@ "WebGPUDecoderImpl::HandleDawnCommands", "bytes", size); if (!wire_server_->HandleCommands(shm_commands, size)) { - NOTREACHED(); return error::kLostContext; }
diff --git a/gpu/config/skia_limits.cc b/gpu/config/skia_limits.cc index ee23325..390f820 100644 --- a/gpu/config/skia_limits.cc +++ b/gpu/config/skia_limits.cc
@@ -30,7 +30,7 @@ // Limits for glyph cache textures. constexpr size_t kMaxLowEndGlyphCacheTextureBytes = 1024 * 512 * 4; // High-end / low-end memory cutoffs. - constexpr int64_t kHighEndMemoryThreshold = 4096LL * 1024 * 1024; + constexpr uint64_t kHighEndMemoryThreshold = 4096ULL * 1024 * 1024; if (base::SysInfo::IsLowEndDevice()) { *max_resource_cache_bytes = kMaxLowEndGaneshResourceCacheBytes;
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index df4ea3c..ffea57e0 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -3317,7 +3317,7 @@ ' "builder_group": "chromium.fyi",' ' "recipe": "reclient_goma_comparison"' '}' - execution_timeout_secs: 36000 + execution_timeout_secs: 54000 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" experiments { @@ -3397,7 +3397,7 @@ ' "builder_group": "chromium.fyi",' ' "recipe": "reclient_goma_comparison"' '}' - execution_timeout_secs: 36000 + execution_timeout_secs: 54000 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" experiments { @@ -21050,6 +21050,10 @@ build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -21131,6 +21135,10 @@ build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -21212,6 +21220,10 @@ build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -21295,6 +21307,10 @@ build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -44504,6 +44520,65 @@ enable: true } } + builders { + name: "gofindit-culprit-verification" + swarming_host: "chromium-swarm.appspot.com" + dimensions: "builderless:1" + dimensions: "pool:luci.chromium.findit" + dimensions: "ssd:1" + exe { + cipd_package: "infra/chromium/bootstrapper/${platform}" + cipd_version: "latest" + cmd: "bootstrapper" + cmd: "-polymorphic" + cmd: "-properties-optional" + } + properties: + '{' + ' "$bootstrap/exe": {' + ' "exe": {' + ' "cipd_package": "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build",' + ' "cipd_version": "refs/heads/main",' + ' "cmd": [' + ' "luciexe"' + ' ]' + ' }' + ' },' + ' "$build/goma": {' + ' "rpc_extra_params": "?prod",' + ' "server_host": "goma.chromium.org",' + ' "use_luci_auth": true' + ' },' + ' "$build/reclient": {' + ' "instance": "rbe-chromium-trusted",' + ' "jobs": 250,' + ' "metrics_project": "chromium-reclient-metrics"' + ' },' + ' "$recipe_engine/resultdb/test_presentation": {' + ' "column_keys": [],' + ' "grouping_keys": [' + ' "status",' + ' "v.test_suite"' + ' ]' + ' },' + ' "led_builder_is_bootstrapped": true,' + ' "recipe": "gofindit/chromium/single_revision"' + '}' + execution_timeout_secs: 28800 + caches { + name: "win_toolchain" + path: "win_toolchain" + } + build_numbers: YES + service_account: "findit-builder@chops-service-accounts.iam.gserviceaccount.com" + experiments { + key: "luci.recipes.use_python3" + value: 100 + } + resultdb { + enable: true + } + } } } buckets {
diff --git a/infra/config/generated/luci/luci-milo.cfg b/infra/config/generated/luci/luci-milo.cfg index 99c5a85..3539e22 100644 --- a/infra/config/generated/luci/luci-milo.cfg +++ b/infra/config/generated/luci/luci-milo.cfg
@@ -14680,6 +14680,9 @@ builders { name: "buildbucket/luci.chromium.findit/findit-rerun" } + builders { + name: "buildbucket/luci.chromium.findit/gofindit-culprit-verification" + } builder_view_only: true } consoles {
diff --git a/infra/config/recipes.star b/infra/config/recipes.star index 0f8e032..c2a37dc 100644 --- a/infra/config/recipes.star +++ b/infra/config/recipes.star
@@ -201,6 +201,11 @@ ) build_recipe( + name = "recipe:gofindit/chromium/single_revision", + bootstrappable = POLYMORPHIC, +) + +build_recipe( name = "recipe:presubmit", )
diff --git a/infra/config/subprojects/chromium/ci/chromium.fyi.star b/infra/config/subprojects/chromium/ci/chromium.fyi.star index fadfd362..723cb302 100644 --- a/infra/config/subprojects/chromium/ci/chromium.fyi.star +++ b/infra/config/subprojects/chromium/ci/chromium.fyi.star
@@ -810,7 +810,7 @@ ), goma_jobs = 250, executable = "recipe:reclient_goma_comparison", - execution_timeout = 10 * time.hour, + execution_timeout = 15 * time.hour, reclient_cache_silo = "Comparison Android - cache siloed", reclient_instance = rbe_instance.DEFAULT, reclient_jobs = 250, @@ -943,7 +943,7 @@ ), goma_jobs = 250, executable = "recipe:reclient_goma_comparison", - execution_timeout = 10 * time.hour, + execution_timeout = 15 * time.hour, reclient_cache_silo = "Comparison Android CQ - cache siloed", reclient_instance = rbe_instance.TEST_CQ, reclient_jobs = 250,
diff --git a/infra/config/subprojects/chromium/ci/chromium.win.star b/infra/config/subprojects/chromium/ci/chromium.win.star index 15bbe95..ef018bd 100644 --- a/infra/config/subprojects/chromium/ci/chromium.win.star +++ b/infra/config/subprojects/chromium/ci/chromium.win.star
@@ -87,6 +87,9 @@ ), cores = 32, os = os.WINDOWS_ANY, + experiments = { + "luci.buildbucket.omit_python2": 100, + }, ) ci.builder( @@ -112,6 +115,9 @@ ), cores = 32, os = os.WINDOWS_ANY, + experiments = { + "luci.buildbucket.omit_python2": 100, + }, ) ci.builder( @@ -247,6 +253,9 @@ cores = 32, cq_mirrors_console_view = "mirrors", os = os.WINDOWS_ANY, + experiments = { + "luci.buildbucket.omit_python2": 100, + }, ) ci.builder( @@ -277,6 +286,9 @@ cores = 32, cq_mirrors_console_view = "mirrors", os = os.WINDOWS_ANY, + experiments = { + "luci.buildbucket.omit_python2": 100, + }, ) ci.builder(
diff --git a/infra/config/subprojects/findit/OWNERS b/infra/config/subprojects/findit/OWNERS new file mode 100644 index 0000000..ff53e63 --- /dev/null +++ b/infra/config/subprojects/findit/OWNERS
@@ -0,0 +1,7 @@ +abennetts@google.com +aredulla@google.com +mdraz@google.com +meiring@google.com +mwarton@google.com +nqmtuan@google.com +weiweilin@google.com \ No newline at end of file
diff --git a/infra/config/subprojects/findit/findit.star b/infra/config/subprojects/findit/findit.star index 385c7ba..8594a49 100644 --- a/infra/config/subprojects/findit/findit.star +++ b/infra/config/subprojects/findit/findit.star
@@ -65,3 +65,12 @@ reclient_instance = rbe_instance.DEFAULT, reclient_jobs = rbe_jobs.DEFAULT, ) + +# GoFindit builder to verify a culprit (go/gofindit-design-doc) +builder( + name = "gofindit-culprit-verification", + executable = "recipe:gofindit/chromium/single_revision", + goma_backend = goma.backend.RBE_PROD, + reclient_instance = rbe_instance.DEFAULT, + reclient_jobs = rbe_jobs.DEFAULT, +)
diff --git a/ios/chrome/browser/ui/browser_view/browser_coordinator.mm b/ios/chrome/browser/ui/browser_view/browser_coordinator.mm index 045650c..dd3fe48 100644 --- a/ios/chrome/browser/ui/browser_view/browser_coordinator.mm +++ b/ios/chrome/browser/ui/browser_view/browser_coordinator.mm
@@ -28,7 +28,6 @@ #import "ios/chrome/browser/follow/follow_tab_helper.h" #import "ios/chrome/browser/main/browser.h" #import "ios/chrome/browser/ntp/features.h" -#import "ios/chrome/browser/ntp/new_tab_page_tab_helper.h" #import "ios/chrome/browser/prerender/preload_controller_delegate.h" #import "ios/chrome/browser/prerender/prerender_service.h" #import "ios/chrome/browser/prerender/prerender_service_factory.h" @@ -1651,11 +1650,6 @@ CaptivePortalTabHelper::FromWebState(webState)->SetTabInsertionBrowserAgent( insertionAgent); } - - if (NewTabPageTabHelper::FromWebState(webState)) { - NewTabPageTabHelper::FromWebState(webState)->SetDelegate( - self.viewController); - } } // Uninstalls delegates for `webState`. @@ -1684,10 +1678,6 @@ CaptivePortalTabHelper::FromWebState(webState)->SetTabInsertionBrowserAgent( nil); } - - if (NewTabPageTabHelper::FromWebState(webState)) { - NewTabPageTabHelper::FromWebState(webState)->SetDelegate(nil); - } } #pragma mark - PasswordBreachCommands
diff --git a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm index f483ffa..ca8e64a 100644 --- a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm
@@ -992,10 +992,16 @@ DCHECK(!_isShutdown); _isShutdown = YES; - UrlLoadingNotifierBrowserAgent* notifier = - UrlLoadingNotifierBrowserAgent::FromBrowser(self.browser); - if (notifier) - notifier->RemoveObserver(_URLLoadingObserverBridge.get()); + UrlLoadingNotifierBrowserAgent* notifier = + UrlLoadingNotifierBrowserAgent::FromBrowser(self.browser); + if (notifier) + notifier->RemoveObserver(_URLLoadingObserverBridge.get()); + + // Uninstall delegates so that any delegate callbacks triggered by subsequent + // WebStateDestroyed() signals are not handled. + WebStateList* webStateList = self.browser->GetWebStateList(); + for (int index = 0; index < webStateList->count(); ++index) + [self uninstallDelegatesForWebState:webStateList->GetWebStateAt(index)]; // Disconnect child coordinators. if (base::FeatureList::IsEnabled(kModernTabStrip)) { @@ -1551,6 +1557,10 @@ UrlLoadingNotifierBrowserAgent::FromBrowser(self.browser) ->AddObserver(_URLLoadingObserverBridge.get()); + WebStateList* webStateList = self.browser->GetWebStateList(); + for (int index = 0; index < webStateList->count(); ++index) + [self installDelegatesForWebState:webStateList->GetWebStateAt(index)]; + // When starting the browser with an open tab, it is necessary to reset the // clipsToBounds property of the WKWebView so the page can bleed behind the // toolbar. @@ -2269,6 +2279,40 @@ #pragma mark - Private Methods: Tab creation and selection +// DEPRECATED -- Do not add further logic to this method. +// Add all delegates to the provided `webState`. +// Unregistration happens when the WebState is removed from the WebStateList. +// TODO(crbug.com/1290819): Remove this method. +- (void)installDelegatesForWebState:(web::WebState*)webState { + // If the WebState is unrealized, don't install the delegate. Instead they + // will be installed when -webStateRealized: method is called. + if (!webState->IsRealized()) + return; + + // TODO(crbug.com/1328039): Remove all use of the prerender service from BVC + // There should be no pre-rendered Tabs for this BrowserState. + DCHECK(!_prerenderService || + !_prerenderService->IsWebStatePrerendered(webState)); + + NewTabPageTabHelper::FromWebState(webState)->SetDelegate(self); +} + +// DEPRECATED -- Do not add further logic to this method. +// Remove delegates from the provided `webState`. +// TODO(crbug.com/1290819): Remove this method. +- (void)uninstallDelegatesForWebState:(web::WebState*)webState { + // If the WebState is unrealized, then the delegate had not been installed + // and thus don't need to be uninstalled. + if (!webState->IsRealized()) + return; + + // TODO(crbug.com/1300911): Have BrowserCoordinator manage the NTP. + // No need to stop _ntpCoordinator with Single NTP enabled since shutdown will + // do that. In addition, uninstallDelegatesForWebState: is called for + // individual WebState removals, which should not trigger a stop. + NewTabPageTabHelper::FromWebState(webState)->SetDelegate(nil); +} + // Called when a `webState` is selected in the WebStateList. Make any required // view changes. The notification will not be sent when the `webState` is // already the selected WebState. `notifyToolbar` indicates whether the toolbar @@ -2996,6 +3040,14 @@ } } +// TODO(crbug.com/1290819): When -installDelegatesForWebState is removed, this +// method can be removed as well. +- (void)webStateRealized:(web::WebState*)webState { + // The delegate were not installed because the WebState was not realized. + // Do it now so that the WebState behaves correctly. + [self installDelegatesForWebState:webState]; +} + #pragma mark - OmniboxPopupPresenterDelegate methods. - (UIView*)popupParentViewForPresenter:(OmniboxPopupPresenter*)presenter { @@ -3543,6 +3595,7 @@ } [self stopNTPIfNeeded]; + [self uninstallDelegatesForWebState:webState]; } - (void)webStateList:(WebStateList*)webStateList @@ -3558,6 +3611,9 @@ didReplaceWebState:(web::WebState*)oldWebState withWebState:(web::WebState*)newWebState atIndex:(int)atIndex { + [self uninstallDelegatesForWebState:oldWebState]; + [self installDelegatesForWebState:newWebState]; + // Add `newTab`'s view to the hierarchy if it's the current Tab. if (self.active && self.currentWebState == newWebState) [self displayWebState:newWebState]; @@ -3569,6 +3625,7 @@ atIndex:(int)index activating:(BOOL)activating { DCHECK(webState); + [self installDelegatesForWebState:webState]; DCHECK_EQ(self.browser->GetWebStateList(), webStateList);
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_module_container.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_module_container.mm index 5b19706..92187e5 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_module_container.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_module_container.mm
@@ -86,6 +86,7 @@ self.title.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; self.title.textColor = [UIColor colorNamed:kTextSecondaryColor]; + self.title.accessibilityTraits |= UIAccessibilityTraitHeader; self.title.translatesAutoresizingMaskIntoConstraints = NO; [self addSubview:self.title]; [NSLayoutConstraint activateConstraints:@[
diff --git a/ios/chrome/browser/ui/omnibox/popup/shared/popup_empty_space_view.swift b/ios/chrome/browser/ui/omnibox/popup/shared/popup_empty_space_view.swift index b5b38a2..4a86a2a 100644 --- a/ios/chrome/browser/ui/omnibox/popup/shared/popup_empty_space_view.swift +++ b/ios/chrome/browser/ui/omnibox/popup/shared/popup_empty_space_view.swift
@@ -6,11 +6,13 @@ /// An empty UIKit view wrapped in a SwiftUI view, /// to identity the empty space below the omnibox popup during hit testing. -final class PopupEmptySpaceView: UIView, UIViewRepresentable { - func makeUIView(context: Context) -> PopupEmptySpaceView { - PopupEmptySpaceView() - } +final class PopupEmptySpaceView: UIView { + struct View: UIViewRepresentable { + func makeUIView(context: Context) -> PopupEmptySpaceView { + PopupEmptySpaceView() + } - func updateUIView(_ uiView: PopupEmptySpaceView, context: Context) { + func updateUIView(_ uiView: PopupEmptySpaceView, context: Context) { + } } }
diff --git a/ios/chrome/browser/ui/omnibox/popup/shared/popup_view.swift b/ios/chrome/browser/ui/omnibox/popup/shared/popup_view.swift index 26ff1b8..c5fa9c12 100644 --- a/ios/chrome/browser/ui/omnibox/popup/shared/popup_view.swift +++ b/ios/chrome/browser/ui/omnibox/popup/shared/popup_view.swift
@@ -300,7 +300,7 @@ listContent(geometry: geometry) }, emptySpace: { - PopupEmptySpaceView() + PopupEmptySpaceView.View() } ) .frame(width: geometry.size.width, height: geometry.size.height)
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 b9ddfca..4c34e11 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 @@ -073e7d6588026f5a814f53f7a3dd5ba14aa69451 \ No newline at end of file +b8399b5c625e5e5efea5d7d142b56768bf0d0a25 \ 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 5ed1c155..152c652a 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 @@ -fdb749441fc4d30ae3ca96b768c044dc6945f203 \ No newline at end of file +30d671c5e016cf480744c992b9b7bdafc6f29c23 \ 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 b6d0c1d..b48a96f 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 @@ -c573abe7702e7298b645b73a1de5b9892b7f507d \ No newline at end of file +3e858fb8ac1d945860cb2ac1ce2b75b5a72ea81d \ 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 da5050af..41ccab1a 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 @@ -916a667ee742d3b6db9eb80aecd176df06a0c678 \ No newline at end of file +310089929f12a68289f272524c5e2f652ee83502 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 index 7628779..42936b9 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -6d09cec0265e874956435e23cfc8c7025d6ed588 \ No newline at end of file +9e12741c59237b385598efcf2da887987c19f2b3 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 index 01d4a5c..fc398e2b 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -8432474c2463afe454234c2dd17bba3bc08ffa2e \ No newline at end of file +ae824b7d2d7667ae31fa42320b4b29bc14ec4b20 \ 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 11feb3c..4d8be1ecf 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 @@ -982aeabcadfdc301ba340cbea2157ecdb29537ca \ No newline at end of file +12312a6f1c8b95fe9a1d6225786969d813148d00 \ 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 a5a0bf4..155f910 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 @@ -b0e42929a710e5b4e9480f06b17e59349cd561e5 \ No newline at end of file +078ca45e3aba5b09e29ede9d300dcd87983ee457 \ 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 5cb4c0e..2673ad1c 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 @@ -2a29be3006dd7c060225e7da4a6a0b09a97871d9 \ No newline at end of file +9039ff7de4d4b16e9650ad6eaf714b10ff53a167 \ 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 35d544ec..0b5bbe41 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 @@ -175efe30598ec748be477a112cbe4357fb5fcaa6 \ No newline at end of file +3faf388de96439187dcdaceddd8385f1e46a829f \ No newline at end of file
diff --git a/media/gpu/test/video_player/video_decoder_client.cc b/media/gpu/test/video_player/video_decoder_client.cc index 5a051ee9..ce77705 100644 --- a/media/gpu/test/video_player/video_decoder_client.cc +++ b/media/gpu/test/video_player/video_decoder_client.cc
@@ -64,7 +64,13 @@ VideoDecoderClient::~VideoDecoderClient() { DCHECK_CALLED_ON_VALID_SEQUENCE(video_player_sequence_checker_); - DestroyDecoder(); + if (decoder_client_thread_.IsRunning()) { + base::WaitableEvent done; + decoder_client_thread_.task_runner()->PostTask( + FROM_HERE, base::BindOnce(&VideoDecoderClient::DestroyDecoderTask, + weak_this_, &done)); + done.Wait(); + } // Wait until the renderer and frame processors are done before destroying // them. This needs to be done after destroying the decoder so no new frames @@ -111,20 +117,6 @@ return success; } -void VideoDecoderClient::DestroyDecoder() { - DCHECK_CALLED_ON_VALID_SEQUENCE(video_player_sequence_checker_); - - if (!decoder_client_thread_.IsRunning()) { - return; - } - - base::WaitableEvent done; - decoder_client_thread_.task_runner()->PostTask( - FROM_HERE, base::BindOnce(&VideoDecoderClient::DestroyDecoderTask, - weak_this_, &done)); - done.Wait(); -} - bool VideoDecoderClient::WaitForFrameProcessors() { bool success = true; for (auto& frame_processor : frame_processors_)
diff --git a/media/gpu/test/video_player/video_decoder_client.h b/media/gpu/test/video_player/video_decoder_client.h index 16b6246..f84ac7d 100644 --- a/media/gpu/test/video_player/video_decoder_client.h +++ b/media/gpu/test/video_player/video_decoder_client.h
@@ -49,9 +49,7 @@ // The video decoder client is responsible for the communication between the // video player and the video decoder. It also communicates with the frame // renderer and other components. The video decoder client can only have one -// active decoder at any time. To decode a different stream the DestroyDecoder() -// and CreateDecoder() functions have to be called to destroy and re-create the -// decoder. +// active decoder at any time. // // All communication with the decoder is done on the |decoder_client_thread_|, // so callbacks scheduled by the decoder can be executed asynchronously. This is @@ -112,13 +110,11 @@ // Create a new decoder, returns whether creating was successful. bool CreateDecoder(); - // Destroy the currently active decoder. - void DestroyDecoder(); - // Create a new video |decoder_| on the |decoder_client_thread_|. void CreateDecoderTask(bool* success, base::WaitableEvent* done); // Destroy the active video |decoder_| on the |decoder_client_thread_|. void DestroyDecoderTask(base::WaitableEvent* done); + // Initialize the video |decoder_| with |video| on the // |decoder_client_thread_|. void InitializeDecoderTask(const Video* video, base::WaitableEvent* done);
diff --git a/media/gpu/test/video_player/video_player.cc b/media/gpu/test/video_player/video_player.cc index f7fd9dc0..abfb9734 100644 --- a/media/gpu/test/video_player/video_player.cc +++ b/media/gpu/test/video_player/video_player.cc
@@ -112,16 +112,15 @@ DVLOGF(4); // Play until the end of the video. - PlayUntil(VideoPlayerEvent::kNumEvents, std::numeric_limits<size_t>::max()); + PlayUntil(VideoPlayerEvent::kNumEvents); } -void VideoPlayer::PlayUntil(VideoPlayerEvent event, size_t event_count) { +void VideoPlayer::PlayUntil(VideoPlayerEvent event) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_EQ(video_player_state_, VideoPlayerState::kIdle); DVLOGF(4); - // Start decoding the video. - play_until_ = std::make_pair(event, event_count); + play_until_ = event; video_player_state_ = VideoPlayerState::kDecoding; decoder_client_->Play(); } @@ -226,9 +225,7 @@ event_cv_.Signal(); // Check whether video playback should be paused after this event. - if (play_until_.first == event && - play_until_.second == - video_player_event_counts_[static_cast<size_t>(event)]) { + if (play_until_.has_value() && play_until_ == event) { video_player_state_ = VideoPlayerState::kIdle; return false; }
diff --git a/media/gpu/test/video_player/video_player.h b/media/gpu/test/video_player/video_player.h index 0703eff..ed999c4 100644 --- a/media/gpu/test/video_player/video_player.h +++ b/media/gpu/test/video_player/video_player.h
@@ -84,9 +84,9 @@ bool Initialize(const Video* video); // Play the video asynchronously. void Play(); - // Play the video asynchronously. Automatically pause decoding when the - // specified |event| occurred |event_count| times. - void PlayUntil(VideoPlayerEvent event, size_t event_count = 1); + // Play the video asynchronously. Automatically pause decoding when |event| + // occurs. + void PlayUntil(VideoPlayerEvent event); // Reset the decoder to the beginning of the video stream. void Reset(); // Flush the decoder. @@ -139,10 +139,8 @@ // The next event ID to start at, when waiting for events. size_t event_id_ GUARDED_BY(event_lock_); - // Automatically pause decoding once the video player has seen the specified - // number of events occur. - std::pair<VideoPlayerEvent, size_t> play_until_{ - VideoPlayerEvent::kNumEvents, std::numeric_limits<size_t>::max()}; + // Set by PlayUntil() to automatically pause decoding once this event occurs. + absl::optional<VideoPlayerEvent> play_until_; SEQUENCE_CHECKER(sequence_checker_); };
diff --git a/net/disk_cache/blockfile/backend_impl.cc b/net/disk_cache/blockfile/backend_impl.cc index a0f9d6d..9cdd801 100644 --- a/net/disk_cache/blockfile/backend_impl.cc +++ b/net/disk_cache/blockfile/backend_impl.cc
@@ -2106,18 +2106,17 @@ } int BackendImpl::MaxBuffersSize() { - static int64_t total_memory = base::SysInfo::AmountOfPhysicalMemory(); + static uint64_t total_memory = base::SysInfo::AmountOfPhysicalMemory(); static bool done = false; if (!done) { - const int kMaxBuffersSize = 30 * 1024 * 1024; - - // We want to use up to 2% of the computer's memory. - total_memory = total_memory * 2 / 100; - if (total_memory > kMaxBuffersSize || total_memory <= 0) - total_memory = kMaxBuffersSize; - done = true; + + // We want to use up to 2% of the computer's memory, limit 30 MB. + total_memory = total_memory * 2 / 100; + constexpr uint64_t kMaxBuffersSize = 30 * 1024 * 1024; + if (total_memory > kMaxBuffersSize || total_memory == 0) + total_memory = kMaxBuffersSize; } return static_cast<int>(total_memory);
diff --git a/net/disk_cache/memory/mem_backend_impl.cc b/net/disk_cache/memory/mem_backend_impl.cc index 951427d..ab9f041 100644 --- a/net/disk_cache/memory/mem_backend_impl.cc +++ b/net/disk_cache/memory/mem_backend_impl.cc
@@ -76,9 +76,9 @@ if (max_size_) return true; - int64_t total_memory = base::SysInfo::AmountOfPhysicalMemory(); + uint64_t total_memory = base::SysInfo::AmountOfPhysicalMemory(); - if (total_memory <= 0) { + if (total_memory == 0) { max_size_ = kDefaultInMemoryCacheSize; return true; } @@ -86,7 +86,7 @@ // We want to use up to 2% of the computer's memory, with a limit of 50 MB, // reached on system with more than 2.5 GB of RAM. total_memory = total_memory * 2 / 100; - if (total_memory > kDefaultInMemoryCacheSize * 5) + if (total_memory > static_cast<uint64_t>(kDefaultInMemoryCacheSize) * 5) max_size_ = kDefaultInMemoryCacheSize * 5; else max_size_ = static_cast<int32_t>(total_memory);
diff --git a/pdf/pdfium/pdfium_print_unittest.cc b/pdf/pdfium/pdfium_print_unittest.cc index dda46cad..30dfe137 100644 --- a/pdf/pdfium/pdfium_print_unittest.cc +++ b/pdf/pdfium/pdfium_print_unittest.cc
@@ -149,18 +149,7 @@ } } -// Tests fail on mac11-arm-64-rel-tests (https://crbug.com/1291973) -#if BUILDFLAG(IS_MAC) -#define MAYBE_AlterScalingDefault DISABLED_AlterScalingDefault -#define MAYBE_AlterScalingFitPaper DISABLED_AlterScalingFitPaper -#define MAYBE_AlterScalingFitPrintable DISABLED_AlterScalingFitPrintable -#else -#define MAYBE_AlterScalingDefault AlterScalingDefault -#define MAYBE_AlterScalingFitPaper AlterScalingFitPaper -#define MAYBE_AlterScalingFitPrintable AlterScalingFitPrintable -#endif - -TEST_F(PDFiumPrintTest, MAYBE_AlterScalingDefault) { +TEST_F(PDFiumPrintTest, AlterScalingDefault) { TestClient client; std::unique_ptr<PDFiumEngine> engine = InitializeEngine(&client, FILE_PATH_LITERAL("rectangles.pdf")); @@ -185,7 +174,7 @@ "alter_scaling_default_raster.png"); } -TEST_F(PDFiumPrintTest, MAYBE_AlterScalingFitPaper) { +TEST_F(PDFiumPrintTest, AlterScalingFitPaper) { TestClient client; std::unique_ptr<PDFiumEngine> engine = InitializeEngine(&client, FILE_PATH_LITERAL("rectangles.pdf")); @@ -212,7 +201,7 @@ "alter_scaling_fit-paper_raster.png"); } -TEST_F(PDFiumPrintTest, MAYBE_AlterScalingFitPrintable) { +TEST_F(PDFiumPrintTest, AlterScalingFitPrintable) { TestClient client; std::unique_ptr<PDFiumEngine> engine = InitializeEngine(&client, FILE_PATH_LITERAL("rectangles.pdf"));
diff --git a/remoting/build/config/BUILD.gn b/remoting/build/config/BUILD.gn index c8882e28..623b952 100644 --- a/remoting/build/config/BUILD.gn +++ b/remoting/build/config/BUILD.gn
@@ -22,12 +22,6 @@ ] } -config("enable_webrtc_remoting_client") { - if (!is_official_build) { - defines = [ "ENABLE_WEBRTC_REMOTING_CLIENT=1" ] - } -} - config("remoting_me2me_host") { defines = []
diff --git a/remoting/client/BUILD.gn b/remoting/client/BUILD.gn index 4915ef5..cd37cb7 100644 --- a/remoting/client/BUILD.gn +++ b/remoting/client/BUILD.gn
@@ -38,7 +38,6 @@ configs += [ "//build/config/compiler:wexit_time_destructors", "//remoting/build/config:version", - "//remoting/build/config:enable_webrtc_remoting_client", ] public_deps = [ "//remoting/base" ] @@ -93,10 +92,7 @@ "software_video_renderer_unittest.cc", ] - configs += [ - "//remoting/build/config:version", - "//remoting/build/config:enable_webrtc_remoting_client", - ] + configs += [ "//remoting/build/config:version" ] deps = [ ":client",
diff --git a/remoting/client/chromoting_client.cc b/remoting/client/chromoting_client.cc index c0df5ca..6b3fa828 100644 --- a/remoting/client/chromoting_client.cc +++ b/remoting/client/chromoting_client.cc
@@ -85,12 +85,7 @@ if (!connection_) { if (protocol_config_->webrtc_supported()) { - DCHECK(!protocol_config_->ice_supported()); -#if !defined(ENABLE_WEBRTC_REMOTING_CLIENT) LOG(FATAL) << "WebRTC is not supported."; -#else - connection_ = std::make_unique<protocol::WebrtcConnectionToHost>(); -#endif } else { DCHECK(protocol_config_->ice_supported()); connection_ = std::make_unique<protocol::IceConnectionToHost>();
diff --git a/remoting/client/chromoting_session.cc b/remoting/client/chromoting_session.cc index 2edc3ee..dd60ebe 100644 --- a/remoting/client/chromoting_session.cc +++ b/remoting/client/chromoting_session.cc
@@ -548,16 +548,6 @@ protocol::NetworkSettings::NAT_TRAVERSAL_FULL), protocol::TransportRole::CLIENT); -#if defined(ENABLE_WEBRTC_REMOTING_CLIENT) - if (session_context_->info.flags.find("useWebrtc") != std::string::npos) { - VLOG(0) << "Attempting to connect using WebRTC."; - std::unique_ptr<protocol::CandidateSessionConfig> protocol_config = - protocol::CandidateSessionConfig::CreateEmpty(); - protocol_config->set_webrtc_supported(true); - protocol_config->set_ice_supported(false); - client_->set_protocol_config(std::move(protocol_config)); - } -#endif // defined(ENABLE_WEBRTC_REMOTING_CLIENT) if (session_context_->info.pairing_id.length() && session_context_->info.pairing_secret.length()) { logger_->SetAuthMethod(ChromotingEvent::AuthMethod::PINLESS);
diff --git a/remoting/client/display/BUILD.gn b/remoting/client/display/BUILD.gn index a742feb..420cfd9 100644 --- a/remoting/client/display/BUILD.gn +++ b/remoting/client/display/BUILD.gn
@@ -85,10 +85,7 @@ "gl_renderer_unittest.cc", ] - configs += [ - "//remoting/build/config:version", - "//remoting/build/config:enable_webrtc_remoting_client", - ] + configs += [ "//remoting/build/config:version" ] deps = [ ":display",
diff --git a/remoting/client/input/BUILD.gn b/remoting/client/input/BUILD.gn index 9de3c0fc..43690ab 100644 --- a/remoting/client/input/BUILD.gn +++ b/remoting/client/input/BUILD.gn
@@ -76,10 +76,7 @@ "touch_input_scaler_unittest.cc", ] - configs += [ - "//remoting/build/config:version", - "//remoting/build/config:enable_webrtc_remoting_client", - ] + configs += [ "//remoting/build/config:version" ] deps = [ ":input", @@ -102,10 +99,7 @@ "normalizing_input_filter_win_unittest.cc", ] - configs += [ - "//remoting/build/config:version", - "//remoting/build/config:enable_webrtc_remoting_client", - ] + configs += [ "//remoting/build/config:version" ] deps = [ ":input",
diff --git a/remoting/client/jni/BUILD.gn b/remoting/client/jni/BUILD.gn index b892c68..b146c5e1 100644 --- a/remoting/client/jni/BUILD.gn +++ b/remoting/client/jni/BUILD.gn
@@ -52,10 +52,7 @@ "EGL", ] configs -= [ "//build/config/android:hide_all_but_jni_onload" ] - configs += [ - "//build/config/android:hide_all_but_jni", - "//remoting/build/config:enable_webrtc_remoting_client", - ] + configs += [ "//build/config/android:hide_all_but_jni" ] assert_no_deps = [ "//third_party/ffmpeg:*" ] }
diff --git a/remoting/host/linux/linux_me2me_host.py b/remoting/host/linux/linux_me2me_host.py index 6041ad0..3976680 100755 --- a/remoting/host/linux/linux_me2me_host.py +++ b/remoting/host/linux/linux_me2me_host.py
@@ -838,7 +838,7 @@ if (os.path.exists(chrome_profile) and not os.path.exists(chrome_config_home)): self.child_env["CHROME_USER_DATA_DIR"] = chrome_profile - else: + elif os.path.exists(chrome_config_home): self.child_env["CHROME_CONFIG_HOME"] = chrome_config_home if self.debug: @@ -1158,9 +1158,12 @@ self.child_env["DISPLAY"] = ":%d" % display self.child_env["CHROME_REMOTE_DESKTOP_SESSION"] = "1" - # Use a separate profile for any instances of Chrome that are started in - # the virtual session. Chrome doesn't support sharing a profile between - # multiple DISPLAYs, but Chrome Sync allows for a reasonable compromise. + # We used to create a separate profile/chrome config home for the virtual + # session since the virtual session was independent of the local session in + # curtain mode, and using the same Chrome profile between sessions would + # lead to cross talk issues. This is no longer the case given modern desktop + # environments don't support running two graphical sessions simultaneously. + # Therefore, we don't set the env var unless the directory already exists. # # M61 introduced CHROME_CONFIG_HOME, which allows specifying a different # config base path while still using different user data directories for @@ -1172,7 +1175,7 @@ if (os.path.exists(chrome_profile) and not os.path.exists(chrome_config_home)): self.child_env["CHROME_USER_DATA_DIR"] = chrome_profile - else: + elif os.path.exists(chrome_config_home): self.child_env["CHROME_CONFIG_HOME"] = chrome_config_home # Set SSH_AUTH_SOCK to the file name to listen on.
diff --git a/sandbox/policy/win/sandbox_win.cc b/sandbox/policy/win/sandbox_win.cc index f7b0de8..f83aa27 100644 --- a/sandbox/policy/win/sandbox_win.cc +++ b/sandbox/policy/win/sandbox_win.cc
@@ -543,13 +543,13 @@ size_t memory_limit = static_cast<size_t>(kDataSizeLimit); if (sandbox_type == Sandbox::kGpu || sandbox_type == Sandbox::kRenderer) { - int64_t GB = 1024 * 1024 * 1024; + constexpr uint64_t GB = 1024 * 1024 * 1024; // Allow the GPU/RENDERER process's sandbox to access more physical memory // if it's available on the system. // // Renderer processes are allowed to access 16 GB; the GPU process, up // to 64 GB. - int64_t physical_memory = base::SysInfo::AmountOfPhysicalMemory(); + uint64_t physical_memory = base::SysInfo::AmountOfPhysicalMemory(); if (sandbox_type == Sandbox::kGpu && physical_memory > 64 * GB) { memory_limit = 64 * GB; } else if (sandbox_type == Sandbox::kGpu && physical_memory > 32 * GB) {
diff --git a/services/viz/public/cpp/compositing/mojom_traits_unittest.cc b/services/viz/public/cpp/compositing/mojom_traits_unittest.cc index 33cf0110..632c8461 100644 --- a/services/viz/public/cpp/compositing/mojom_traits_unittest.cc +++ b/services/viz/public/cpp/compositing/mojom_traits_unittest.cc
@@ -198,7 +198,7 @@ cc::FilterOperation input = cc::FilterOperation::CreateReferenceFilter( sk_make_sp<cc::DropShadowPaintFilter>( SkIntToScalar(3), SkIntToScalar(8), SkIntToScalar(4), - SkIntToScalar(9), SK_ColorBLACK, + SkIntToScalar(9), SkColors::kBlack, cc::DropShadowPaintFilter::ShadowMode::kDrawShadowAndForeground, nullptr));
diff --git a/storage/browser/blob/blob_memory_controller.cc b/storage/browser/blob/blob_memory_controller.cc index f5d1e16..87c87f83 100644 --- a/storage/browser/blob/blob_memory_controller.cc +++ b/storage/browser/blob/blob_memory_controller.cc
@@ -82,11 +82,11 @@ BlobStorageLimits CalculateBlobStorageLimitsImpl( const FilePath& storage_dir, bool disk_enabled, - absl::optional<int64_t> optional_memory_size_for_testing) { + absl::optional<uint64_t> optional_memory_size_for_testing) { int64_t disk_size = 0ull; - int64_t memory_size = optional_memory_size_for_testing - ? optional_memory_size_for_testing.value() - : base::SysInfo::AmountOfPhysicalMemory(); + uint64_t memory_size = optional_memory_size_for_testing + ? optional_memory_size_for_testing.value() + : base::SysInfo::AmountOfPhysicalMemory(); if (disk_enabled && CreateBlobDirectory(storage_dir) == base::File::FILE_OK) disk_size = base::SysInfo::AmountOfTotalDiskSpace(storage_dir); @@ -99,9 +99,9 @@ constexpr size_t kTwoGigabytes = 2ull * 1024 * 1024 * 1024; limits.max_blob_in_memory_space = kTwoGigabytes; #elif BUILDFLAG(IS_ANDROID) - limits.max_blob_in_memory_space = static_cast<size_t>(memory_size / 100ll); + limits.max_blob_in_memory_space = static_cast<size_t>(memory_size / 100); #else - limits.max_blob_in_memory_space = static_cast<size_t>(memory_size / 5ll); + limits.max_blob_in_memory_space = static_cast<size_t>(memory_size / 5); #endif } // Devices just on the edge (RAM == 256MB) should not fail because
diff --git a/storage/browser/blob/blob_memory_controller.h b/storage/browser/blob/blob_memory_controller.h index ecb449b..168c100 100644 --- a/storage/browser/blob/blob_memory_controller.h +++ b/storage/browser/blob/blob_memory_controller.h
@@ -204,7 +204,7 @@ // synchronously. void CallWhenStorageLimitsAreKnown(base::OnceClosure callback); - void set_amount_of_physical_memory_for_testing(int64_t amount_of_memory) { + void set_amount_of_physical_memory_for_testing(uint64_t amount_of_memory) { amount_of_memory_for_testing_ = amount_of_memory; } @@ -283,7 +283,7 @@ bool did_calculate_storage_limits_ = false; std::vector<base::OnceClosure> on_calculate_limits_callbacks_; - absl::optional<int64_t> amount_of_memory_for_testing_; + absl::optional<uint64_t> amount_of_memory_for_testing_; // Memory bookkeeping. These numbers are all disjoint. // This is the amount of memory we're using for blobs in RAM, including the
diff --git a/storage/browser/file_system/obfuscated_file_util_memory_delegate.cc b/storage/browser/file_system/obfuscated_file_util_memory_delegate.cc index 326e9d85d..e9db5bb9 100644 --- a/storage/browser/file_system/obfuscated_file_util_memory_delegate.cc +++ b/storage/browser/file_system/obfuscated_file_util_memory_delegate.cc
@@ -10,6 +10,7 @@ #include "base/allocator/partition_allocator/partition_alloc_constants.h" #include "base/files/file_util.h" #include "base/numerics/checked_math.h" +#include "base/numerics/safe_conversions.h" #include "base/system/sys_info.h" #include "build/build_config.h" #include "net/base/io_buffer.h" @@ -26,14 +27,14 @@ // crash possibility. // Note that quota assignment is the same for on-disk filesystem and the // assigned quota is not guaranteed to be allocatable later. -bool IsMemoryAvailable(int64_t required_memory) { +bool IsMemoryAvailable(size_t required_memory) { #if BUILDFLAG(IS_FUCHSIA) // This function is not implemented on FUCHSIA, yet. (crbug.com/986608) return true; #else - int64_t max_allocatable = + uint64_t max_allocatable = std::min(base::SysInfo::AmountOfAvailablePhysicalMemory(), - static_cast<int64_t>(partition_alloc::MaxDirectMapped())); + static_cast<uint64_t>(partition_alloc::MaxDirectMapped())); return max_allocatable >= required_memory; #endif @@ -335,12 +336,13 @@ return base::File::FILE_ERROR_NOT_FOUND; // Fail if enough memory is not available. - if (static_cast<size_t>(length) > dp->entry->file_content.capacity() && - !IsMemoryAvailable(length)) { + if (!base::IsValueInRangeForNumericType<size_t>(length) || + (static_cast<size_t>(length) > dp->entry->file_content.capacity() && + !IsMemoryAvailable(static_cast<size_t>(length)))) { return base::File::FILE_ERROR_NO_SPACE; } - dp->entry->file_content.resize(length); + dp->entry->file_content.resize(static_cast<size_t>(length)); return base::File::FILE_OK; } @@ -620,7 +622,7 @@ } // Fail if enough memory is not available. - if (!IsMemoryAvailable(source_info.size)) + if (!IsMemoryAvailable(static_cast<size_t>(source_info.size))) return base::File::FILE_ERROR_NO_SPACE; // Create file.
diff --git a/storage/browser/quota/quota_device_info_helper.cc b/storage/browser/quota/quota_device_info_helper.cc index 8f41544..cf12c20 100644 --- a/storage/browser/quota/quota_device_info_helper.cc +++ b/storage/browser/quota/quota_device_info_helper.cc
@@ -17,7 +17,7 @@ return disk_space; } -int64_t QuotaDeviceInfoHelper::AmountOfPhysicalMemory() const { +uint64_t QuotaDeviceInfoHelper::AmountOfPhysicalMemory() const { return base::SysInfo::AmountOfPhysicalMemory(); }
diff --git a/storage/browser/quota/quota_device_info_helper.h b/storage/browser/quota/quota_device_info_helper.h index 2ce8b16..1f865d8 100644 --- a/storage/browser/quota/quota_device_info_helper.h +++ b/storage/browser/quota/quota_device_info_helper.h
@@ -25,7 +25,7 @@ virtual int64_t AmountOfTotalDiskSpace(const base::FilePath& path) const; - virtual int64_t AmountOfPhysicalMemory() const; + virtual uint64_t AmountOfPhysicalMemory() const; }; // class QuotaDeviceInfoHelper } // namespace storage
diff --git a/storage/browser/quota/quota_settings.cc b/storage/browser/quota/quota_settings.cc index c2a5a20..718e6cf 100644 --- a/storage/browser/quota/quota_settings.cc +++ b/storage/browser/quota/quota_settings.cc
@@ -37,7 +37,7 @@ } QuotaSettings CalculateIncognitoDynamicSettings( - int64_t physical_memory_amount) { + uint64_t physical_memory_amount) { // The incognito pool size is a fraction of the amount of system memory. double incognito_pool_size_ratio = kIncognitoQuotaRatioLowerBound +
diff --git a/storage/browser/quota/quota_settings_unittest.cc b/storage/browser/quota/quota_settings_unittest.cc index ef2bf9a..84e03cb 100644 --- a/storage/browser/quota/quota_settings_unittest.cc +++ b/storage/browser/quota/quota_settings_unittest.cc
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/callback.h" #include "base/files/scoped_temp_dir.h" +#include "base/numerics/safe_conversions.h" #include "base/run_loop.h" #include "base/test/bind.h" #include "base/test/scoped_feature_list.h" @@ -22,8 +23,8 @@ namespace { -constexpr int64_t kLowPhysicalMemory = 1024 * 1024; -constexpr int64_t kHighPhysicalMemory = 65536 * kLowPhysicalMemory; +constexpr uint64_t kLowPhysicalMemory = 1024 * 1024; +constexpr uint64_t kHighPhysicalMemory = 65536 * kLowPhysicalMemory; } // namespace @@ -33,7 +34,7 @@ public: MockQuotaDeviceInfoHelper() = default; MOCK_CONST_METHOD1(AmountOfTotalDiskSpace, int64_t(const base::FilePath&)); - MOCK_CONST_METHOD0(AmountOfPhysicalMemory, int64_t()); + MOCK_CONST_METHOD0(AmountOfPhysicalMemory, uint64_t()); }; class QuotaSettingsTest : public testing::Test { @@ -71,23 +72,25 @@ protected: void SetUpDeviceInfoHelper(const int expected_calls, - const int64_t physical_memory_amount) { + const uint64_t physical_memory_amount) { ON_CALL(device_info_helper_, AmountOfPhysicalMemory()) .WillByDefault(::testing::Return(physical_memory_amount)); EXPECT_CALL(device_info_helper_, AmountOfPhysicalMemory()) .Times(expected_calls); } - void GetAndTestSettings(const int64_t physical_memory_amount) { + void GetAndTestSettings(const uint64_t physical_memory_amount) { absl::optional<QuotaSettings> settings = GetSettings(true, &device_info_helper_); ASSERT_TRUE(settings.has_value()); + const uint64_t pool_size = + base::checked_cast<uint64_t>(settings->pool_size); EXPECT_LE( physical_memory_amount * GetIncognitoQuotaRatioLowerBound_ForTesting(), - settings->pool_size); + pool_size); EXPECT_GE( physical_memory_amount * GetIncognitoQuotaRatioUpperBound_ForTesting(), - settings->pool_size); + pool_size); } private:
diff --git a/styleguide/c++/c++-features.md b/styleguide/c++/c++-features.md index 0cc3dcc..fa8063c 100644 --- a/styleguide/c++/c++-features.md +++ b/styleguide/c++/c++-features.md
@@ -1623,6 +1623,24 @@ The following Abseil library features are allowed in the Chromium codebase. +### Attribute macros <sup>[allowed]</sup> + +```c++ +const char* name() ABSL_ATTRIBUTE_RETURNS_NONNULL { return "hello world"; } +``` + +**Description:** Macros that conditionally resolve to attributes. Prefer to use +standard C++ attributes, such as `[[fallthrough]]`. Use these macros for +non-standard attributes, which may not be present in all compilers. + +**Documentation:** +[attributes.h](https://source.chromium.org/chromium/chromium/src/+/main:third_party/abseil-cpp/absl/base/attributes.h) + +**Notes:** +*** promo +[Discussion thread](https://groups.google.com/a/chromium.org/g/cxx/c/vQmaBfbyBGM/m/HHOYUZ5YAwAJ) +*** + ### 128bit integer <sup>[allowed]</sup> ```c++
diff --git a/testing/buildbot/chromium.android.fyi.json b/testing/buildbot/chromium.android.fyi.json index 207f2b0..8b6ae59 100644 --- a/testing/buildbot/chromium.android.fyi.json +++ b/testing/buildbot/chromium.android.fyi.json
@@ -4670,7 +4670,8 @@ "--use-cmd-decoder=validating", "--gs-results-bucket=chromium-result-details", "--recover-devices", - "--avd-config=../../tools/android/avd/proto/generic_android24.textpb" + "--avd-config=../../tools/android/avd/proto/generic_android24.textpb", + "--test-launcher-filter-file=../../testing/buildbot/filters/android.emulator_n.gl_tests.filter" ], "isolate_profile_data": true, "merge": {
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 9ea56908..9966d643 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -74752,7 +74752,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -74804,7 +74804,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -74856,7 +74856,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -74908,7 +74908,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -74960,7 +74960,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75012,7 +75012,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75064,7 +75064,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75116,7 +75116,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75168,7 +75168,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75220,7 +75220,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75272,7 +75272,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75324,7 +75324,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75376,7 +75376,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75428,7 +75428,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75480,7 +75480,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75532,7 +75532,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75584,7 +75584,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75636,7 +75636,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75688,7 +75688,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75740,7 +75740,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75792,7 +75792,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75844,7 +75844,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75896,7 +75896,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -75948,7 +75948,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76000,7 +76000,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76052,7 +76052,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76104,7 +76104,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76156,7 +76156,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76209,7 +76209,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76262,7 +76262,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76315,7 +76315,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76368,7 +76368,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76421,7 +76421,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76474,7 +76474,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76527,7 +76527,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76580,7 +76580,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76633,7 +76633,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76686,7 +76686,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76740,7 +76740,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76794,7 +76794,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76848,7 +76848,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76902,7 +76902,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -76956,7 +76956,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77010,7 +77010,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77064,7 +77064,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77118,7 +77118,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77172,7 +77172,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77226,7 +77226,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77280,7 +77280,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77334,7 +77334,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77388,7 +77388,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77442,7 +77442,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77496,7 +77496,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77550,7 +77550,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77604,7 +77604,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77658,7 +77658,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77712,7 +77712,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77766,7 +77766,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77820,7 +77820,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77874,7 +77874,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77928,7 +77928,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -77982,7 +77982,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78036,7 +78036,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78090,7 +78090,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78144,7 +78144,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78197,7 +78197,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78250,7 +78250,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78303,7 +78303,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78356,7 +78356,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78409,7 +78409,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78462,7 +78462,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78515,7 +78515,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78568,7 +78568,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78621,7 +78621,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78675,7 +78675,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78729,7 +78729,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78783,7 +78783,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78837,7 +78837,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78891,7 +78891,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78945,7 +78945,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -78999,7 +78999,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79053,7 +79053,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79106,7 +79106,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79158,7 +79158,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79210,7 +79210,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79262,7 +79262,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79315,7 +79315,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79368,7 +79368,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79421,7 +79421,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79474,7 +79474,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79527,7 +79527,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79580,7 +79580,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79633,7 +79633,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79686,7 +79686,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79739,7 +79739,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79791,7 +79791,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79843,7 +79843,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79895,7 +79895,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -79948,7 +79948,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80001,7 +80001,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80054,7 +80054,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80106,7 +80106,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80159,7 +80159,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80212,7 +80212,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80265,7 +80265,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80317,7 +80317,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80369,7 +80369,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80422,7 +80422,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80475,7 +80475,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80528,7 +80528,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80581,7 +80581,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80634,7 +80634,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80687,7 +80687,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80740,7 +80740,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80793,7 +80793,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80846,7 +80846,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80898,7 +80898,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -80950,7 +80950,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81002,7 +81002,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81054,7 +81054,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81106,7 +81106,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81158,7 +81158,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81210,7 +81210,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81263,7 +81263,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81316,7 +81316,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81369,7 +81369,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81422,7 +81422,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81475,7 +81475,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81528,7 +81528,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81581,7 +81581,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81634,7 +81634,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81687,7 +81687,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81739,7 +81739,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81791,7 +81791,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81843,7 +81843,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81895,7 +81895,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81947,7 +81947,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -81999,7 +81999,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82051,7 +82051,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82103,7 +82103,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82155,7 +82155,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82207,7 +82207,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82259,7 +82259,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82311,7 +82311,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82363,7 +82363,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82415,7 +82415,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82467,7 +82467,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82519,7 +82519,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82571,7 +82571,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82623,7 +82623,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82675,7 +82675,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82727,7 +82727,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82779,7 +82779,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82831,7 +82831,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82883,7 +82883,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82935,7 +82935,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -82987,7 +82987,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -83039,7 +83039,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -83091,7 +83091,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -83143,7 +83143,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -83195,7 +83195,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -83247,7 +83247,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -83299,7 +83299,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -83351,7 +83351,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -99394,7 +99394,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99413,7 +99413,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99435,7 +99435,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99455,7 +99455,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99474,7 +99474,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99493,7 +99493,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99512,7 +99512,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99531,7 +99531,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99550,7 +99550,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99570,7 +99570,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99589,7 +99589,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99608,7 +99608,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99627,7 +99627,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99650,7 +99650,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99669,7 +99669,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99688,7 +99688,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99707,7 +99707,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99726,7 +99726,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99745,7 +99745,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99764,7 +99764,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99783,7 +99783,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99802,7 +99802,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99822,7 +99822,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99841,7 +99841,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99861,7 +99861,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99880,7 +99880,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99899,7 +99899,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99918,7 +99918,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99937,7 +99937,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99956,7 +99956,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99975,7 +99975,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -99994,7 +99994,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100013,7 +100013,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100032,7 +100032,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100051,7 +100051,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100070,7 +100070,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100089,7 +100089,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100108,7 +100108,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100127,7 +100127,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100146,7 +100146,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100165,7 +100165,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100184,7 +100184,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100204,7 +100204,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100224,7 +100224,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100243,7 +100243,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100262,7 +100262,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100281,7 +100281,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100300,7 +100300,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100319,7 +100319,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100338,7 +100338,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100357,7 +100357,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100376,7 +100376,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100396,7 +100396,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100415,7 +100415,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100434,7 +100434,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100453,7 +100453,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100472,7 +100472,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100491,7 +100491,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100510,7 +100510,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100529,7 +100529,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100548,7 +100548,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100567,7 +100567,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100586,7 +100586,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100605,7 +100605,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100624,7 +100624,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100643,7 +100643,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100662,7 +100662,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100681,7 +100681,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100700,7 +100700,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100719,7 +100719,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100738,7 +100738,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100757,7 +100757,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100781,7 +100781,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100800,7 +100800,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100819,7 +100819,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100838,7 +100838,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100857,7 +100857,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100877,7 +100877,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100896,7 +100896,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100922,7 +100922,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100958,7 +100958,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -100995,7 +100995,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -101023,7 +101023,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -101043,7 +101043,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -101068,7 +101068,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -101092,7 +101092,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -101116,7 +101116,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -101139,7 +101139,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -101159,7 +101159,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -101182,7 +101182,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -101205,7 +101205,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -101232,7 +101232,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -101261,7 +101261,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600, @@ -101288,7 +101288,7 @@ "dimension_sets": [ { "cpu": "x86-64", - "os": "Mac-12" + "os": "Mac-12.4" } ], "expiration": 21600,
diff --git a/testing/buildbot/filters/BUILD.gn b/testing/buildbot/filters/BUILD.gn index fc7ecc8..6ae1b616 100644 --- a/testing/buildbot/filters/BUILD.gn +++ b/testing/buildbot/filters/BUILD.gn
@@ -264,6 +264,7 @@ "//testing/buildbot/filters/android.emulator.gl_tests.filter", "//testing/buildbot/filters/android.emulator_11.gl_tests.filter", "//testing/buildbot/filters/android.emulator_12.gl_tests.filter", + "//testing/buildbot/filters/android.emulator_n.gl_tests.filter", "//testing/buildbot/filters/android.pie_arm64_rel.gl_tests.filter", ] }
diff --git a/testing/buildbot/filters/android.emulator_n.gl_tests.filter b/testing/buildbot/filters/android.emulator_n.gl_tests.filter new file mode 100644 index 0000000..39227d9 --- /dev/null +++ b/testing/buildbot/filters/android.emulator_n.gl_tests.filter
@@ -0,0 +1,10 @@ +# https://crbug.com/1342710 +-CopyType/GLCopyTextureCHROMIUMES3Test.CopyTextureCubeMap/0 +-CopyType/GLCopyTextureCHROMIUMES3Test.CopyTextureLevel/0 +-CopyType/GLCopyTextureCHROMIUMES3Test.FormatCombinations/0 +-CopyType/GLCopyTextureCHROMIUMES3Test.FormatCombinations/1 +-CopyType/GLCopyTextureCHROMIUMTest.ImmutableTexture/0 +-CopyType/GLCopyTextureCHROMIUMTest.ImmutableTexture/1 + +# https://crbug.com/1342713 +-GLBGRAMipMapTest.GenerateMipmapsSucceeds
diff --git a/testing/buildbot/mixins.pyl b/testing/buildbot/mixins.pyl index f0841ef..001eddeb 100644 --- a/testing/buildbot/mixins.pyl +++ b/testing/buildbot/mixins.pyl
@@ -857,7 +857,7 @@ 'swarming': { 'dimensions': { 'cpu': 'x86-64', - 'os': 'Mac-12', + 'os': 'Mac-12.4', }, }, },
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index edc78231..4c9e95c 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -2097,6 +2097,11 @@ '--test-launcher-filter-file=../../testing/buildbot/filters/android.emulator.gl_tests.filter', ], }, + 'android-nougat-x86-rel': { + 'args': [ + '--test-launcher-filter-file=../../testing/buildbot/filters/android.emulator_n.gl_tests.filter', + ], + }, 'android-pie-arm64-rel': { 'args': [ '--test-launcher-filter-file=../../testing/buildbot/filters/android.pie_arm64_rel.gl_tests.filter', # https://crbug.com/1034007
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 42ace420..aa8f1523 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -3394,7 +3394,9 @@ ], 'mixins': [ 'has_native_resultdb_integration', - 'mac_12_x64', + # TODO(crbug/1331347): + # revert this back to mac_12_x86 once all MacOS has been upgraded to 12.4+ in the pool + 'mac_beta_x64', 'mac_toolchain', 'out_dir_arg', 'xcode_14_beta',
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 4cf3376..ae3604e 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -247,19 +247,6 @@ ], "experiments": [ { - "name": "Enabled_30000_dialogV2_2022-04-18", - "params": { - "autodismiss_duration_ms_SaveCard": "30000", - "save_card_dialog_v2_enabled": "true", - "save_card_message_use_followup_button_text": "false", - "save_card_message_use_gpay_icon": "true" - }, - "enable_features": [ - "MessagesForAndroidInfrastructure", - "MessagesForAndroidSaveCard" - ] - }, - { "name": "Enabled_60000_dialogV2_2022-04-18", "params": { "autodismiss_duration_ms_SaveCard": "60000", @@ -4567,6 +4554,21 @@ ] } ], + "HttpsOnlyMode": [ + { + "platforms": [ + "ios" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "HttpsOnlyMode" + ] + } + ] + } + ], "IOSBookmarkString": [ { "platforms": [
diff --git a/third_party/blink/common/switches.cc b/third_party/blink/common/switches.cc index 39f3053a..8c64ef9 100644 --- a/third_party/blink/common/switches.cc +++ b/third_party/blink/common/switches.cc
@@ -161,6 +161,10 @@ // Controls whether WebSQL is force enabled. const char kWebSQLAccess[] = "web-sql-access"; +// Controls whether WebSQL for non-secure context is force enabled. +const char kWebSQLNonSecureContextEnabled[] = + "web-sql-non-secure-context-enabled"; + // Used to communicate managed policy for the EventPath feature. This feature is // typically controlled by base::Feature (see blink/common/features.*) but // requires an enterprise policy override. This is implicitly a tri-state, and
diff --git a/third_party/blink/public/common/switches.h b/third_party/blink/public/common/switches.h index 1a864506..4265cb3 100644 --- a/third_party/blink/public/common/switches.h +++ b/third_party/blink/public/common/switches.h
@@ -64,6 +64,7 @@ BLINK_COMMON_EXPORT extern const char kShowPaintRects[]; BLINK_COMMON_EXPORT extern const char kTouchTextSelectionStrategy[]; BLINK_COMMON_EXPORT extern const char kWebSQLAccess[]; +BLINK_COMMON_EXPORT extern const char kWebSQLNonSecureContextEnabled[]; } // namespace switches } // namespace blink
diff --git a/third_party/blink/public/mojom/frame/find_in_page.mojom b/third_party/blink/public/mojom/frame/find_in_page.mojom index dc2f5f8..5f95c6c 100644 --- a/third_party/blink/public/mojom/frame/find_in_page.mojom +++ b/third_party/blink/public/mojom/frame/find_in_page.mojom
@@ -26,8 +26,14 @@ // (and no longer highlight it with special coloring). ClearActiveFindMatch(); + // Sets the client for this FindInPage instance. Should be called before + // calling ActivateNearestFindResult. + // TODO(rakina): Remove the need for this? + SetClient(pending_remote<FindInPageClient> client); + // Request the distance to the nearest find result in a frame from |point| // defined in fractions of the content document's width and height. + [EnableIf=is_android] GetNearestFindResult(gfx.mojom.PointF point) => (float distance); // Activates a find result nearest to |point|, which is in fractions of the @@ -35,13 +41,9 @@ // SetActiveMatch or SetNumberOfMatches on the FindInPageClient for this // FindInPage instance. // TODO(rakina): Find a way to remove |request_id| + [EnableIf=is_android] ActivateNearestFindResult(int32 request_id, gfx.mojom.PointF point); - // Sets the client for this FindInPage instance. Should be called before - // calling ActivateNearestFindResult. - // TODO(rakina): Remove the need for this? - SetClient(pending_remote<FindInPageClient> client); - // Returns the bounding boxes of the find-in-page match markers from the // frame. The bounding boxes are returned in find-in-page coordinates. // @@ -60,6 +62,7 @@ // |active_rect| will contain the bounding box of the active find-in-page // match marker, in similarly normalized coords (or an empty rect if there // isn't one). + [EnableIf=is_android] FindMatchRects(int32 current_version) => (int32 version, array<gfx.mojom.RectF> rects, gfx.mojom.RectF active_match_rect);
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc index c1f153a..ab7f0b5 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
@@ -729,10 +729,8 @@ ArrayBufferAllocator() : total_allocation_(0) { // size_t may be equivalent to uint32_t or uint64_t, cast all values to // uint64_t to compare. - uint64_t virtual_size = - static_cast<uint64_t>(base::SysInfo::AmountOfVirtualMemory()); - uint64_t size_t_max = - static_cast<uint64_t>(std::numeric_limits<std::size_t>::max()); + uint64_t virtual_size = base::SysInfo::AmountOfVirtualMemory(); + uint64_t size_t_max = std::numeric_limits<std::size_t>::max(); DCHECK(virtual_size < size_t_max); // If AmountOfVirtualMemory() returns 0, there is no limit on virtual // memory, do not limit the total allocation. Otherwise, Limit the total
diff --git a/third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.cc b/third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.cc index 8e2ba7b..dec4baf 100644 --- a/third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.cc +++ b/third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.cc
@@ -69,21 +69,15 @@ } double MemoryThresholdParam() { - int64_t physical_memory = base::SysInfo::AmountOfPhysicalMemory(); - double memory_threshold_mb = kDefaultMemoryThresholdMB; - - if (physical_memory > 3.1 * 1024 * 1024 * 1024) - memory_threshold_mb = MemoryThresholdParamOf4GbDevices(); - else if (physical_memory > 2.1 * 1024 * 1024 * 1024) - memory_threshold_mb = MemoryThresholdParamOf3GbDevices(); - else if (physical_memory > 1.1 * 1024 * 1024 * 1024) - memory_threshold_mb = MemoryThresholdParamOf2GbDevices(); - else if (physical_memory > 600 * 1024 * 1024) - memory_threshold_mb = MemoryThresholdParamOf1GbDevices(); - else - memory_threshold_mb = MemoryThresholdParamOf512MbDevices(); - - return memory_threshold_mb; + int physical_memory_mb = base::SysInfo::AmountOfPhysicalMemoryMB(); + if (physical_memory_mb > 3.1 * 1024) + return MemoryThresholdParamOf4GbDevices(); + if (physical_memory_mb > 2.1 * 1024) + return MemoryThresholdParamOf3GbDevices(); + if (physical_memory_mb > 1.1 * 1024) + return MemoryThresholdParamOf2GbDevices(); + return (physical_memory_mb > 600) ? MemoryThresholdParamOf1GbDevices() + : MemoryThresholdParamOf512MbDevices(); } } // namespace
diff --git a/third_party/blink/renderer/core/css/css_math_expression_node.cc b/third_party/blink/renderer/core/css/css_math_expression_node.cc index 0d56ece..eecdf10 100644 --- a/third_party/blink/renderer/core/css/css_math_expression_node.cc +++ b/third_party/blink/renderer/core/css/css_math_expression_node.cc
@@ -177,12 +177,14 @@ absl::optional<PixelsAndPercent> EvaluateValueIfNaNorInfinity( scoped_refptr<const blink::CalculationExpressionNode> value, bool allows_negative_percentage_reference) { - float evaluated_value = value->Evaluate(1); + // |anchor_evaluator| is not needed because this function is just for handling + // inf and NaN. + float evaluated_value = value->Evaluate(1, /* anchor_evaluator */ nullptr); if (std::isnan(evaluated_value) || std::isinf(evaluated_value)) { return CreateClampedSamePixelsAndPercent(evaluated_value); } if (allows_negative_percentage_reference) { - evaluated_value = value->Evaluate(-1); + evaluated_value = value->Evaluate(-1, /* anchor_evaluator */ nullptr); if (std::isnan(evaluated_value) || std::isinf(evaluated_value)) { return CreateClampedSamePixelsAndPercent(evaluated_value); }
diff --git a/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc b/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc index affaa43f..b9a9df81 100644 --- a/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc +++ b/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc
@@ -1310,14 +1310,12 @@ CSSCustomIdentValue* ConsumeDashedIdent(CSSParserTokenRange& range, const CSSParserContext& context) { - CSSCustomIdentValue* custom_ident = ConsumeCustomIdent(range, context); - if (!custom_ident) + if (range.Peek().GetType() != kIdentToken) + return nullptr; + if (!range.Peek().Value().ToString().StartsWith(kTwoDashes)) return nullptr; - if (!custom_ident->Value().StartsWith(kTwoDashes)) - return nullptr; - - return custom_ident; + return ConsumeCustomIdent(range, context); } CSSStringValue* ConsumeString(CSSParserTokenRange& range) {
diff --git a/third_party/blink/renderer/core/dom/attribute.h b/third_party/blink/renderer/core/dom/attribute.h index eff6042a..f559152b 100644 --- a/third_party/blink/renderer/core/dom/attribute.h +++ b/third_party/blink/renderer/core/dom/attribute.h
@@ -32,6 +32,16 @@ namespace blink { +// This value is set fairly arbitrarily, to get above what we expect to be +// the maximum number of attributes on a normal element. It is used for +// preallocation in Vectors holding Attributes, e.g. to avoid allocations +// in HTMLAtomicToken (which is short-lived, and thus does not need to worry +// much about extra memory usage). +// +// Many places that use this constant don't actually care directly about +// preallocation, but the value tends to propagate out through APIs. +static constexpr int kAttributePrealloc = 10; + // This is the internal representation of an attribute, consisting of a name and // value. It is distinct from the web-exposed Attr, which also knows of the // element to which it attached, if any.
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index a9aa989d2..fc7c54c2 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc
@@ -3236,7 +3236,7 @@ } void Element::StripScriptingAttributes( - Vector<Attribute>& attribute_vector) const { + Vector<Attribute, kAttributePrealloc>& attribute_vector) const { wtf_size_t destination = 0; for (wtf_size_t source = 0; source < attribute_vector.size(); ++source) { if (IsScriptingAttribute(attribute_vector[source])) @@ -3250,7 +3250,8 @@ attribute_vector.Shrink(destination); } -void Element::ParserSetAttributes(const Vector<Attribute>& attribute_vector) { +void Element::ParserSetAttributes( + const Vector<Attribute, kAttributePrealloc>& attribute_vector) { DCHECK(!isConnected()); DCHECK(!parentNode()); DCHECK(!element_data_);
diff --git a/third_party/blink/renderer/core/dom/element.h b/third_party/blink/renderer/core/dom/element.h index 7e9b8cc..df2b4da 100644 --- a/third_party/blink/renderer/core/dom/element.h +++ b/third_party/blink/renderer/core/dom/element.h
@@ -605,11 +605,11 @@ virtual const QualifiedName& SubResourceAttributeName() const; // Only called by the parser immediately after element construction. - void ParserSetAttributes(const Vector<Attribute>&); + void ParserSetAttributes(const Vector<Attribute, kAttributePrealloc>&); // Remove attributes that might introduce scripting from the vector leaving // the element unchanged. - void StripScriptingAttributes(Vector<Attribute>&) const; + void StripScriptingAttributes(Vector<Attribute, kAttributePrealloc>&) const; bool SharesSameElementData(const Element& other) const { return GetElementData() == other.GetElementData();
diff --git a/third_party/blink/renderer/core/dom/element_data.cc b/third_party/blink/renderer/core/dom/element_data.cc index 10cae240..18858c5 100644 --- a/third_party/blink/renderer/core/dom/element_data.cc +++ b/third_party/blink/renderer/core/dom/element_data.cc
@@ -122,7 +122,8 @@ visitor->Trace(inline_style_); } -ShareableElementData::ShareableElementData(const Vector<Attribute>& attributes) +ShareableElementData::ShareableElementData( + const Vector<Attribute, kAttributePrealloc>& attributes) : ElementData(attributes.size()) { for (unsigned i = 0; i < bit_field_.get<ArraySize>(); ++i) new (&attribute_array_[i]) Attribute(attributes[i]); @@ -146,7 +147,7 @@ } ShareableElementData* ShareableElementData::CreateWithAttributes( - const Vector<Attribute>& attributes) { + const Vector<Attribute, kAttributePrealloc>& attributes) { return MakeGarbageCollected<ShareableElementData>( AdditionalBytesForShareableElementDataWithAttributeCount( attributes.size()),
diff --git a/third_party/blink/renderer/core/dom/element_data.h b/third_party/blink/renderer/core/dom/element_data.h index 937c4fa..cddb64b 100644 --- a/third_party/blink/renderer/core/dom/element_data.h +++ b/third_party/blink/renderer/core/dom/element_data.h
@@ -159,9 +159,10 @@ // duplicate sets of attributes (ex. the same classes). class ShareableElementData final : public ElementData { public: - static ShareableElementData* CreateWithAttributes(const Vector<Attribute>&); + static ShareableElementData* CreateWithAttributes( + const Vector<Attribute, kAttributePrealloc>&); - explicit ShareableElementData(const Vector<Attribute>&); + explicit ShareableElementData(const Vector<Attribute, kAttributePrealloc>&); explicit ShareableElementData(const UniqueElementData&); ~ShareableElementData();
diff --git a/third_party/blink/renderer/core/dom/element_data_cache.cc b/third_party/blink/renderer/core/dom/element_data_cache.cc index e8fd58ca..dae410c 100644 --- a/third_party/blink/renderer/core/dom/element_data_cache.cc +++ b/third_party/blink/renderer/core/dom/element_data_cache.cc
@@ -30,13 +30,15 @@ namespace blink { -inline unsigned AttributeHash(const Vector<Attribute>& attributes) { +inline unsigned AttributeHash( + const Vector<Attribute, kAttributePrealloc>& attributes) { return StringHasher::HashMemory(attributes.data(), attributes.size() * sizeof(Attribute)); } -inline bool HasSameAttributes(const Vector<Attribute>& attributes, - ShareableElementData& element_data) { +inline bool HasSameAttributes( + const Vector<Attribute, kAttributePrealloc>& attributes, + ShareableElementData& element_data) { if (attributes.size() != element_data.Attributes().size()) return false; return !memcmp(attributes.data(), element_data.attribute_array_, @@ -45,7 +47,7 @@ ShareableElementData* ElementDataCache::CachedShareableElementDataWithAttributes( - const Vector<Attribute>& attributes) { + const Vector<Attribute, kAttributePrealloc>& attributes) { DCHECK(!attributes.IsEmpty()); ShareableElementDataCache::ValueType* it =
diff --git a/third_party/blink/renderer/core/dom/element_data_cache.h b/third_party/blink/renderer/core/dom/element_data_cache.h index 8348ada..02ec607 100644 --- a/third_party/blink/renderer/core/dom/element_data_cache.h +++ b/third_party/blink/renderer/core/dom/element_data_cache.h
@@ -27,6 +27,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_ELEMENT_DATA_CACHE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_ELEMENT_DATA_CACHE_H_ +#include "third_party/blink/renderer/core/dom/attribute.h" #include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_map.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/wtf/text/string_hash.h" @@ -34,7 +35,6 @@ namespace blink { -class Attribute; class ShareableElementData; class ElementDataCache final : public GarbageCollected<ElementDataCache> { @@ -42,7 +42,7 @@ ElementDataCache(); ShareableElementData* CachedShareableElementDataWithAttributes( - const Vector<Attribute>&); + const Vector<Attribute, kAttributePrealloc>&); void Trace(Visitor*) const;
diff --git a/third_party/blink/renderer/core/editing/finder/text_finder.cc b/third_party/blink/renderer/core/editing/finder/text_finder.cc index 10f9c0ca..a26c4b5 100644 --- a/third_party/blink/renderer/core/editing/finder/text_finder.cc +++ b/third_party/blink/renderer/core/editing/finder/text_finder.cc
@@ -709,6 +709,7 @@ find_match_rects_are_valid_ = true; } +#if BUILDFLAG(IS_ANDROID) gfx::RectF TextFinder::ActiveFindMatchRect() { if (!current_active_match_frame_ || !active_match_) return gfx::RectF(); @@ -828,6 +829,7 @@ return active_match_index_ + 1; } +#endif // BUILDFLAG(IS_ANDROID) TextFinder::TextFinder(WebLocalFrameImpl& owner_frame) : owner_frame_(&owner_frame),
diff --git a/third_party/blink/renderer/core/editing/finder/text_finder.h b/third_party/blink/renderer/core/editing/finder/text_finder.h index 31cfa037..cf35ee3 100644 --- a/third_party/blink/renderer/core/editing/finder/text_finder.h +++ b/third_party/blink/renderer/core/editing/finder/text_finder.h
@@ -32,6 +32,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_FINDER_TEXT_FINDER_H_ #include "base/cancelable_callback.h" +#include "build/build_config.h" #include "third_party/blink/public/mojom/frame/find_in_page.mojom-blink.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/renderer/core/core_export.h" @@ -62,9 +63,11 @@ void StopFindingAndClearSelection(); void IncreaseMatchCount(int identifier, int count); int FindMatchMarkersVersion() const { return find_match_markers_version_; } +#if BUILDFLAG(IS_ANDROID) gfx::RectF ActiveFindMatchRect(); Vector<gfx::RectF> FindMatchRects(); int SelectNearestFindMatch(const gfx::PointF&, gfx::Rect* selection_rect); +#endif // Starts brand new scoping request: resets the scoping state and // asynchronously calls scopeStringMatches(). @@ -79,11 +82,13 @@ // the scoping effort. void ResetMatchCount(); +#if BUILDFLAG(IS_ANDROID) // Return the index in the find-in-page cache of the match closest to the // provided point in find-in-page coordinates, or -1 in case of error. // The squared distance to the closest match is returned in the // |distanceSquared| parameter. int NearestFindMatch(const gfx::PointF&, float* distance_squared); +#endif // Returns whether this frame has the active match. bool ActiveMatchFrame() const { return current_active_match_frame_; } @@ -184,11 +189,13 @@ // the matches cache. void InvalidateFindMatchRects(); +#if BUILDFLAG(IS_ANDROID) // Select a find-in-page match marker in the current frame using a cache // match index returned by nearestFindMatch. Returns the ordinal of the new // selected match or -1 in case of error. Also provides the bounding box of // the marker in window coordinates if selectionRect is not null. int SelectFindMatch(unsigned index, gfx::Rect* selection_rect); +#endif // Compute and cache the rects for FindMatches if required. // Rects are automatically invalidated in case of content size changes.
diff --git a/third_party/blink/renderer/core/editing/finder/text_finder_test.cc b/third_party/blink/renderer/core/editing/finder/text_finder_test.cc index 92bd8b95..b8a36ce 100644 --- a/third_party/blink/renderer/core/editing/finder/text_finder_test.cc +++ b/third_party/blink/renderer/core/editing/finder/text_finder_test.cc
@@ -331,6 +331,7 @@ EXPECT_EQ(3u, active_match->endOffset()); } +#if BUILDFLAG(IS_ANDROID) TEST_F(TextFinderTest, ScopeTextMatchesSimple) { GetDocument().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); @@ -602,6 +603,7 @@ EXPECT_EQ(FindInPageRect(text_in_i_element, 2, text_in_i_element, 8), match_rects[0]); } +#endif // BUILDFLAG(IS_ANDROID) TEST_F(TextFinderTest, ScopeWithTimeouts) { // Make a long string.
diff --git a/third_party/blink/renderer/core/editing/serializers/serialization.cc b/third_party/blink/renderer/core/editing/serializers/serialization.cc index 7adfb4ae..f219288 100644 --- a/third_party/blink/renderer/core/editing/serializers/serialization.cc +++ b/third_party/blink/renderer/core/editing/serializers/serialization.cc
@@ -762,6 +762,11 @@ Document& output_doc) { DocumentFragment* fragment = output_doc.createDocumentFragment(); + // The HTML spec says that we should execute scripts and set their already + // started flag to false for transformToFragment, so we use + // kAllowScriptingContentAndDoNotMarkAlreadyStarted in ParseHTML and ParseXML + // below. https://html.spec.whatwg.org/multipage/scripting.html#scriptTagXSLT + if (source_mime_type == "text/html") { // As far as I can tell, there isn't a spec for how transformToFragment is // supposed to work. Based on the documentation I can find, it looks like we @@ -770,11 +775,14 @@ // that effect here by passing in a fake body element as context for the // fragment. auto* fake_body = MakeGarbageCollected<HTMLBodyElement>(output_doc); - fragment->ParseHTML(source_string, fake_body); + fragment->ParseHTML(source_string, fake_body, + kAllowScriptingContentAndDoNotMarkAlreadyStarted); } else if (source_mime_type == "text/plain") { fragment->ParserAppendChild(Text::Create(output_doc, source_string)); } else { - bool successful_parse = fragment->ParseXML(source_string, nullptr); + bool successful_parse = + fragment->ParseXML(source_string, nullptr, + kAllowScriptingContentAndDoNotMarkAlreadyStarted); if (!successful_parse) return nullptr; }
diff --git a/third_party/blink/renderer/core/events/error_event.cc b/third_party/blink/renderer/core/events/error_event.cc index 9ad5431a..aa7b1113 100644 --- a/third_party/blink/renderer/core/events/error_event.cc +++ b/third_party/blink/renderer/core/events/error_event.cc
@@ -66,10 +66,6 @@ location_ = std::make_unique<SourceLocation>(initializer->filename(), String(), initializer->lineno(), initializer->colno(), nullptr); - // TODO(crbug.com/1070964): Remove this existence check. There is a bug that - // the current code generator does not initialize a ScriptValue with the - // v8::Null value despite that the dictionary member has the default value of - // IDL null. |hasError| guard is necessary here. if (initializer->hasError()) { v8::Local<v8::Value> error = initializer->error().V8Value(); // TODO(crbug.com/1070871): Remove the following IsNullOrUndefined() check. @@ -79,6 +75,9 @@ if (!error->IsNullOrUndefined()) { error_.Set(script_state->GetIsolate(), error); } + } else { + error_.Set(script_state->GetIsolate(), + v8::Undefined(script_state->GetIsolate())); } }
diff --git a/third_party/blink/renderer/core/events/error_event_init.idl b/third_party/blink/renderer/core/events/error_event_init.idl index 7df17a32..dc4e680 100644 --- a/third_party/blink/renderer/core/events/error_event_init.idl +++ b/third_party/blink/renderer/core/events/error_event_init.idl
@@ -9,5 +9,5 @@ DOMString filename = ""; unsigned long lineno = 0; unsigned long colno = 0; - any error = null; + any error; };
diff --git a/third_party/blink/renderer/core/frame/find_in_page.cc b/third_party/blink/renderer/core/frame/find_in_page.cc index 6b824bd..909cb4c 100644 --- a/third_party/blink/renderer/core/frame/find_in_page.cc +++ b/third_party/blink/renderer/core/frame/find_in_page.cc
@@ -215,6 +215,15 @@ return 0; } +void FindInPage::SetClient( + mojo::PendingRemote<mojom::blink::FindInPageClient> remote) { + // TODO(crbug.com/984878): Having to call reset() to try to bind a remote that + // might be bound is questionable behavior and suggests code may be buggy. + client_.reset(); + client_.Bind(std::move(remote)); +} + +#if BUILDFLAG(IS_ANDROID) gfx::RectF FindInPage::ActiveFindMatchRect() { if (GetTextFinder()) return GetTextFinder()->ActiveFindMatchRect(); @@ -237,14 +246,6 @@ true /* final_update */); } -void FindInPage::SetClient( - mojo::PendingRemote<mojom::blink::FindInPageClient> remote) { - // TODO(crbug.com/984878): Having to call reset() to try to bind a remote that - // might be bound is questionable behavior and suggests code may be buggy. - client_.reset(); - client_.Bind(std::move(remote)); -} - void FindInPage::GetNearestFindResult(const gfx::PointF& point, GetNearestFindResultCallback callback) { float distance; @@ -260,6 +261,7 @@ rects = EnsureTextFinder().FindMatchRects(); std::move(callback).Run(rects_version, rects, ActiveFindMatchRect()); } +#endif // BUILDFLAG(IS_ANDROID) void FindInPage::ClearActiveFindMatch() { // TODO(rakina): Do collapse selection as this currently does nothing.
diff --git a/third_party/blink/renderer/core/frame/find_in_page.h b/third_party/blink/renderer/core/frame/find_in_page.h index ed8bfa7f..7b2c29e 100644 --- a/third_party/blink/renderer/core/frame/find_in_page.h +++ b/third_party/blink/renderer/core/frame/find_in_page.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_FIND_IN_PAGE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_FIND_IN_PAGE_H_ +#include "build/build_config.h" #include "mojo/public/cpp/bindings/associated_receiver.h" #include "mojo/public/cpp/bindings/pending_associated_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" @@ -43,10 +44,12 @@ int FindMatchMarkersVersion() const; +#if BUILDFLAG(IS_ANDROID) // Returns the bounding box of the active find-in-page match marker or an // empty rect if no such marker exists. The rect is returned in find-in-page // coordinates. gfx::RectF ActiveFindMatchRect(); +#endif void ReportFindInPageMatchCount(int request_id, int count, bool final_update); @@ -59,25 +62,18 @@ void Find(int request_id, const String& search_text, mojom::blink::FindOptionsPtr) final; - - void SetClient(mojo::PendingRemote<mojom::blink::FindInPageClient>) final; - - void ActivateNearestFindResult(int request_id, const gfx::PointF&) final; - - // Stops the current find-in-page, following the given |action| void StopFinding(mojom::StopFindAction action) final; - - // Returns the distance (squared) to the closest find-in-page match from the - // provided point, in find-in-page coordinates. + void ClearActiveFindMatch() final; + void SetClient(mojo::PendingRemote<mojom::blink::FindInPageClient>) final; +#if BUILDFLAG(IS_ANDROID) void GetNearestFindResult(const gfx::PointF&, GetNearestFindResultCallback) final; - // Returns the bounding boxes of the find-in-page match markers in the frame, - // in find-in-page coordinates. + void ActivateNearestFindResult(int request_id, const gfx::PointF&) final; +#endif +#if BUILDFLAG(IS_ANDROID) void FindMatchRects(int current_version, FindMatchRectsCallback) final; - - // Clears the active find match in the frame, if one exists. - void ClearActiveFindMatch() final; +#endif TextFinder* GetTextFinder() const;
diff --git a/third_party/blink/renderer/core/frame/find_in_page_test.cc b/third_party/blink/renderer/core/frame/find_in_page_test.cc index 76dfe15..981b8a6 100644 --- a/third_party/blink/renderer/core/frame/find_in_page_test.cc +++ b/third_party/blink/renderer/core/frame/find_in_page_test.cc
@@ -81,6 +81,7 @@ bool is_called; }; +#if BUILDFLAG(IS_ANDROID) TEST_F(FindInPageTest, FindMatchRectsReturnsCorrectRects) { GetDocument().body()->setInnerHTML("aAaAbBaBbAaAaA"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); @@ -105,6 +106,7 @@ GetTextFinder().ActiveFindMatchRect())); EXPECT_TRUE(callback_receiver.IsCalled()); } +#endif TEST_F(FindInPageTest, FindAllAs) { std::ostringstream str;
diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc index 2f564e2f..d085b99 100644 --- a/third_party/blink/renderer/core/frame/web_frame_test.cc +++ b/third_party/blink/renderer/core/frame/web_frame_test.cc
@@ -5119,6 +5119,7 @@ mojo::Receiver<mojom::blink::FindInPageClient> receiver_{this}; }; +#if BUILDFLAG(IS_ANDROID) TEST_F(WebFrameTest, FindInPageMatchRects) { RegisterMockedHttpURLLoad("find_in_page_frame.html"); @@ -5196,6 +5197,7 @@ EXPECT_TRUE(main_frame->GetFindInPage()->FindMatchMarkersVersion() != rects_version); } +#endif // BUILDFLAG(IS_ANDROID) TEST_F(WebFrameTest, FindInPageActiveIndex) { RegisterMockedHttpURLLoad("find_match_count.html"); @@ -12123,6 +12125,7 @@ EXPECT_EQ(gfx::Point(800, 2000), original_tickmarks[0].origin()); } +#if BUILDFLAG(IS_ANDROID) TEST_F(WebFrameSimTest, FindInPageSelectNextMatch) { WebView().MainFrameViewWidget()->Resize(gfx::Size(500, 300)); WebView().GetPage()->GetSettings().SetTextAutosizingEnabled(false); @@ -12198,6 +12201,7 @@ << frame_view->GetScrollableArea()->VisibleContentRect().ToString() << "]"; } +#endif // BUILDFLAG(IS_ANDROID) // Check that removing an element whilst focusing it does not cause a null // pointer deference. This test passes if it does not crash.
diff --git a/third_party/blink/renderer/core/html/forms/html_input_element_test.cc b/third_party/blink/renderer/core/html/forms/html_input_element_test.cc index 0cbd611..d9b66c7 100644 --- a/third_party/blink/renderer/core/html/forms/html_input_element_test.cc +++ b/third_party/blink/renderer/core/html/forms/html_input_element_test.cc
@@ -140,7 +140,7 @@ input = MakeGarbageCollected<HTMLInputElement>( GetDocument(), CreateElementFlags::ByParser(&GetDocument())); EXPECT_EQ(nullptr, input->UserAgentShadowRoot()); - input->ParserSetAttributes(Vector<Attribute>()); + input->ParserSetAttributes(Vector<Attribute, kAttributePrealloc>()); EXPECT_NE(nullptr, input->UserAgentShadowRoot()); }
diff --git a/third_party/blink/renderer/core/html/html_frame_owner_element.cc b/third_party/blink/renderer/core/html/html_frame_owner_element.cc index 689d964..0b34a01 100644 --- a/third_party/blink/renderer/core/html/html_frame_owner_element.cc +++ b/third_party/blink/renderer/core/html/html_frame_owner_element.cc
@@ -298,15 +298,13 @@ // If kAutomaticLazyFrameLoadingToAds is enabled, calculate the timeout in // advance from the field trial param, otherwise return 0; -base::TimeDelta CalculateLazyAdsTimeoutMs() { +base::TimeDelta CalculateTimeoutMs(const base::Feature& feature) { static constexpr base::TimeDelta kDefaultTimeout{base::Milliseconds(0)}; - if (!base::FeatureList::IsEnabled(features::kAutomaticLazyFrameLoadingToAds)) + if (!base::FeatureList::IsEnabled(feature)) return kDefaultTimeout; const String timeout = - base::GetFieldTrialParamValueByFeature( - features::kAutomaticLazyFrameLoadingToAds, "timeout") - .c_str(); + base::GetFieldTrialParamValueByFeature(feature, "timeout").c_str(); if (timeout.IsEmpty()) return kDefaultTimeout; @@ -316,9 +314,18 @@ return base::Milliseconds(timeout_ms); } + +const base::TimeDelta GetLazyEmbedsTimeoutMs() { + DEFINE_STATIC_LOCAL( + base::TimeDelta, timeoutMs, + (CalculateTimeoutMs(features::kAutomaticLazyFrameLoadingToEmbeds))); + return timeoutMs; +} + const base::TimeDelta GetLazyAdsTimeoutMs() { - DEFINE_STATIC_LOCAL(base::TimeDelta, timeoutMs, - (CalculateLazyAdsTimeoutMs())); + DEFINE_STATIC_LOCAL( + base::TimeDelta, timeoutMs, + (CalculateTimeoutMs(features::kAutomaticLazyFrameLoadingToAds))); return timeoutMs; } @@ -680,17 +687,37 @@ if (RuntimeEnabledFeatures::LazyFrameVisibleLoadTimeMetricsEnabled()) lazy_load_frame_observer_->StartTrackingVisibilityMetrics(); - if (CheckAndRecordIfShouldLazilyLoadFrame( - GetDocument(), - /*is_loading_attr_lazy=*/loading_lazy_set, - /*is_eligible_for_lazy_embeds=*/ - IsEligibleForLazyEmbeds(url, GetDocument()), - /*is_eligible_for_lazy_ads=*/IsEligibleForLazyAds(url), - /*record_uma=*/true)) { + // TODO(crbug.com/1341892) Remove having multiple booleans here. We eventually + // select one reason to decide the timeout, so essentially we don't have to + // keep them. But currently we need these two booleans separately to record + // UKM in CheckAndRecordIfShouldLazilyLoadFrame. Once we confirm that we can + // ignore AutomaticLazyLoadReason::kBothEmbedsAndAds case due to the small + // amount of the data size, we remove these booleans and + // AutomaticLazyLoadReason::kBothEmbedsAndAds. + const bool is_eligible_for_lazy_embeds = + IsEligibleForLazyEmbeds(url, GetDocument()); + const bool is_eligible_for_lazy_ads = IsEligibleForLazyAds(url); + AutomaticLazyLoadReason auto_lazy_load_reason; + if (is_eligible_for_lazy_embeds && is_eligible_for_lazy_ads) { + auto_lazy_load_reason = AutomaticLazyLoadReason::kBothEmbedsAndAds; + } else if (is_eligible_for_lazy_embeds) { + auto_lazy_load_reason = AutomaticLazyLoadReason::kEmbeds; + } else if (is_eligible_for_lazy_ads) { + auto_lazy_load_reason = AutomaticLazyLoadReason::kAds; + } else { + auto_lazy_load_reason = AutomaticLazyLoadReason::kNotEligible; + } + base::UmaHistogramEnumeration("Blink.AutomaticLazyFrameLoad.Reason", + auto_lazy_load_reason); + + if (CheckAndRecordIfShouldLazilyLoadFrame(GetDocument(), loading_lazy_set, + is_eligible_for_lazy_embeds, + is_eligible_for_lazy_ads, + /*record_uma=*/true)) { lazy_load_frame_observer_->DeferLoadUntilNearViewport(request, frame_load_type); - MaybeSetTimeoutToStartAdFrameLoading( - url, /*is_loading_attr_lazy=*/loading_lazy_set); + MaybeSetTimeoutToStartFrameLoading(url, loading_lazy_set, + auto_lazy_load_reason); return true; } @@ -888,7 +915,7 @@ return content_frame_->IsAdSubframe(); } -void HTMLFrameOwnerElement::LoadIfLazyOnIdle(base::TimeTicks deadline) { +void HTMLFrameOwnerElement::LoadIfLazyAfterTimeout() { LoadImmediatelyIfLazy(); } @@ -898,30 +925,40 @@ return IsAdRelated() && !AreSameOrigin(GetDocument(), url); } -void HTMLFrameOwnerElement::MaybeSetTimeoutToStartAdFrameLoading( +void HTMLFrameOwnerElement::MaybeSetTimeoutToStartFrameLoading( const KURL& url, - bool is_loading_attr_lazy) { - if (!base::FeatureList::IsEnabled( - features::kAutomaticLazyFrameLoadingToAds)) { - return; - } - if (!IsEligibleForLazyAds(url)) { - return; - } + bool is_loading_attr_lazy, + AutomaticLazyLoadReason auto_lazy_load_reason) { // Even if the frame is ad related, respect the explicit loading="lazy" // attribute and won't set a timeout if the attribute exists. if (is_loading_attr_lazy) { return; } - // TODO(sisidovski) FrameScheduler should have the attribution of this task, - // but FrameScheduler doesn't expose - // SingleThreadIdleTaskRunner::PostIdleTask. So we call PostIdleTask here - // through the main thread scheduler. - ThreadScheduler::Current()->PostDelayedIdleTask( - FROM_HERE, GetLazyAdsTimeoutMs(), - WTF::Bind(&HTMLFrameOwnerElement::LoadIfLazyOnIdle, - WrapWeakPersistent(this))); + base::TimeDelta timeout_ms; + switch (auto_lazy_load_reason) { + case AutomaticLazyLoadReason::kAds: + timeout_ms = GetLazyAdsTimeoutMs(); + break; + // We prioritize LazyEmbeds if the frame is eligible for both reasons, at + // least until the LazyEmbeds experiment finishes to secure the chunk of + // group size. + case AutomaticLazyLoadReason::kBothEmbedsAndAds: + case AutomaticLazyLoadReason::kEmbeds: + timeout_ms = GetLazyEmbedsTimeoutMs(); + break; + case AutomaticLazyLoadReason::kNotEligible: + // If the auto lazy-load is not elibible, do nothing and return. + return; + } + + GetDocument() + .GetTaskRunner(TaskType::kInternalLoading) + ->PostDelayedTask( + FROM_HERE, + WTF::Bind(&HTMLFrameOwnerElement::LoadIfLazyAfterTimeout, + WrapWeakPersistent(this)), + timeout_ms); } mojom::blink::ColorScheme HTMLFrameOwnerElement::GetColorScheme() const {
diff --git a/third_party/blink/renderer/core/html/html_frame_owner_element.h b/third_party/blink/renderer/core/html/html_frame_owner_element.h index 0410332..8ea8172a 100644 --- a/third_party/blink/renderer/core/html/html_frame_owner_element.h +++ b/third_party/blink/renderer/core/html/html_frame_owner_element.h
@@ -190,6 +190,26 @@ bool IsCurrentlyWithinFrameLimit() const; private: + // These values are persisted to logs. Entries should not be renumbered and + // numeric values should never be reused. + // This enum represents which auto lazy-load mechanism is used. + enum class AutomaticLazyLoadReason { + // If the frame is neither embeds nor ads, or the flags are not enabled, + // mark it as not eligible. + kNotEligible = 0, + // For LazyEmbeds + kEmbeds = 1, + // For LazyAds + kAds = 2, + // It's possible that the frame is eligible for both LazyEmbeds and LazyAds. + // TOOD(crbug.com/1341892) Remove kBothEmbedsAndAds once we confirm that we + // can ignore + // this case because the impact on the analysis is minimal. + kBothEmbedsAndAds = 3, + + kMaxValue = kBothEmbedsAndAds, + }; + // Intentionally private to prevent redundant checks when the type is // already HTMLFrameOwnerElement. bool IsLocal() const final { return true; } @@ -200,11 +220,13 @@ } bool IsEligibleForLazyAds(const KURL& url); - void MaybeSetTimeoutToStartAdFrameLoading(const KURL& url, - bool is_loading_attr_lazy); - // This function is used for the call back of idle task. + void MaybeSetTimeoutToStartFrameLoading( + const KURL& url, + bool is_loading_attr_lazy, + AutomaticLazyLoadReason auto_lazy_load_reason); + // This function is used for the call back PostDelayedTask. // Trigger loading if the frame is lazy-loaded but not started yet. - void LoadIfLazyOnIdle(base::TimeTicks deadline); + void LoadIfLazyAfterTimeout(); // Check if the frame should be lazy-loaded and apply when conditions are // passed. Return true when lazy-load is applied.
diff --git a/third_party/blink/renderer/core/html/parser/atomic_html_token.h b/third_party/blink/renderer/core/html/parser/atomic_html_token.h index 0151fe37..0198aa2 100644 --- a/third_party/blink/renderer/core/html/parser/atomic_html_token.h +++ b/third_party/blink/renderer/core/html/parser/atomic_html_token.h
@@ -82,12 +82,12 @@ return FindAttributeInVector(attributes_, attribute_name); } - Vector<Attribute>& Attributes() { + Vector<Attribute, kAttributePrealloc>& Attributes() { DCHECK(UsesAttributes()); return attributes_; } - const Vector<Attribute>& Attributes() const { + const Vector<Attribute, kAttributePrealloc>& Attributes() const { DCHECK(UsesAttributes()); return attributes_; } @@ -206,7 +206,7 @@ bool duplicate_attribute_ = false; - Vector<Attribute> attributes_; + Vector<Attribute, kAttributePrealloc> attributes_; }; template <bool DedupWithHash>
diff --git a/third_party/blink/renderer/core/html/parser/html_token.h b/third_party/blink/renderer/core/html/parser/html_token.h index cef48f9..e8ba9cb 100644 --- a/third_party/blink/renderer/core/html/parser/html_token.h +++ b/third_party/blink/renderer/core/html/parser/html_token.h
@@ -58,9 +58,9 @@ static inline Attribute* FindAttributeInVector(base::span<Attribute> attributes, const QualifiedName& name) { - for (unsigned i = 0; i < attributes.size(); ++i) { - if (attributes[i].GetName().Matches(name)) - return &attributes[i]; + for (Attribute& attr : attributes) { + if (attr.GetName().Matches(name)) + return &attr; } return nullptr; } @@ -152,7 +152,7 @@ Range value_range_; }; - typedef Vector<Attribute, 10> AttributeList; + typedef Vector<Attribute, kAttributePrealloc> AttributeList; // By using an inline capacity of 256, we avoid spilling over into an malloced // buffer approximately 99% of the time based on a non-scientific browse
diff --git a/third_party/blink/renderer/core/layout/build.gni b/third_party/blink/renderer/core/layout/build.gni index 59b20c8..abd6416 100644 --- a/third_party/blink/renderer/core/layout/build.gni +++ b/third_party/blink/renderer/core/layout/build.gni
@@ -509,6 +509,7 @@ "ng/mathml/ng_mathml_paint_info.h", "ng/ng_absolute_utils.cc", "ng/ng_absolute_utils.h", + "ng/ng_anchor_query.cc", "ng/ng_anchor_query.h", "ng/ng_block_break_token.cc", "ng/ng_block_break_token.h",
diff --git a/third_party/blink/renderer/core/layout/layout_table_row.cc b/third_party/blink/renderer/core/layout/layout_table_row.cc index fabff17..cf2d8b8 100644 --- a/third_party/blink/renderer/core/layout/layout_table_row.cc +++ b/third_party/blink/renderer/core/layout/layout_table_row.cc
@@ -190,6 +190,9 @@ if (before_child && before_child->Parent() != this) before_child = SplitAnonymousBoxesAroundChild(before_child); + // TODO(crbug.com/1341619): Turn a SECURITY_DCHECK in |To| to a normal crash. + // This happens when |child| is a |LayoutNGTableCell|. + CHECK(IsA<LayoutTableCell>(child)); LayoutTableCell* cell = To<LayoutTableCell>(child); // In Legacy tables, cell writing mode must match row writing mode.
diff --git a/third_party/blink/renderer/core/layout/ng/ng_absolute_utils.cc b/third_party/blink/renderer/core/layout/ng/ng_absolute_utils.cc index 3022c4c..b504b2b 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_absolute_utils.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_absolute_utils.cc
@@ -263,28 +263,56 @@ NGLogicalOutOfFlowInsets ComputeOutOfFlowInsets( const ComputedStyle& style, - const LogicalSize& available_size) { - // TODO(crbug.com/1309178): Support anchor positioning. + const LogicalSize& available_size, + const NGLogicalAnchorQuery& anchor_query) { + struct AnchorEvaluatorImpl : public Length::AnchorEvaluator { + STACK_ALLOCATED(); + + public: + explicit AnchorEvaluatorImpl(const NGLogicalAnchorQuery& anchor_query) + : anchor_query(anchor_query) {} + + absl::optional<LayoutUnit> Evaluate( + const AtomicString& anchor_name, + AnchorValue anchor_value) const override { + return anchor_query.Evaluate(anchor_name, anchor_value, available_size, + is_block_direction, is_end); + } + + const NGLogicalAnchorQuery& anchor_query; + LayoutUnit available_size; + bool is_block_direction = false; + bool is_end = false; + } anchor_evaluator(anchor_query); + + anchor_evaluator.available_size = available_size.inline_size; absl::optional<LayoutUnit> inline_start; if (!style.LogicalInlineStart().IsAuto()) { - inline_start = MinimumValueForLength(style.LogicalInlineStart(), - available_size.inline_size); + inline_start = + MinimumValueForLength(style.LogicalInlineStart(), + available_size.inline_size, &anchor_evaluator); } absl::optional<LayoutUnit> inline_end; if (!style.LogicalInlineEnd().IsAuto()) { - inline_end = MinimumValueForLength(style.LogicalInlineEnd(), - available_size.inline_size); + anchor_evaluator.is_end = true; + inline_end = + MinimumValueForLength(style.LogicalInlineEnd(), + available_size.inline_size, &anchor_evaluator); } + anchor_evaluator.is_block_direction = true; + anchor_evaluator.available_size = available_size.block_size; absl::optional<LayoutUnit> block_start; if (!style.LogicalTop().IsAuto()) { - block_start = - MinimumValueForLength(style.LogicalTop(), available_size.block_size); + anchor_evaluator.is_end = false; + block_start = MinimumValueForLength( + style.LogicalTop(), available_size.block_size, &anchor_evaluator); } absl::optional<LayoutUnit> block_end; if (!style.LogicalBottom().IsAuto()) { - block_end = - MinimumValueForLength(style.LogicalBottom(), available_size.block_size); + anchor_evaluator.is_end = true; + block_end = MinimumValueForLength( + style.LogicalBottom(), available_size.block_size, &anchor_evaluator); } return {inline_start, inline_end, block_start, block_end};
diff --git a/third_party/blink/renderer/core/layout/ng/ng_absolute_utils.h b/third_party/blink/renderer/core/layout/ng/ng_absolute_utils.h index 9a6b49a..85b22f5 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_absolute_utils.h +++ b/third_party/blink/renderer/core/layout/ng/ng_absolute_utils.h
@@ -36,7 +36,8 @@ CORE_EXPORT NGLogicalOutOfFlowInsets ComputeOutOfFlowInsets(const ComputedStyle& style, - const LogicalSize& available_size); + const LogicalSize& available_size, + const NGLogicalAnchorQuery& anchor_query); CORE_EXPORT LogicalSize ComputeOutOfFlowAvailableSize(const NGBlockNode&,
diff --git a/third_party/blink/renderer/core/layout/ng/ng_absolute_utils_test.cc b/third_party/blink/renderer/core/layout/ng/ng_absolute_utils_test.cc index be226e2..445c9e22 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_absolute_utils_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_absolute_utils_test.cc
@@ -99,8 +99,9 @@ const NGLogicalStaticPosition& static_position, const WritingDirectionMode container_writing_direction, NGLogicalOutOfFlowDimensions* dimensions) { - const NGLogicalOutOfFlowInsets insets = - ComputeOutOfFlowInsets(node.Style(), space.AvailableSize()); + NGLogicalAnchorQuery anchor_query; + const NGLogicalOutOfFlowInsets insets = ComputeOutOfFlowInsets( + node.Style(), space.AvailableSize(), anchor_query); LogicalSize computed_available_size = ComputeOutOfFlowAvailableSize(node, space, insets, static_position); blink::ComputeOutOfFlowInlineDimensions( @@ -116,8 +117,9 @@ const NGLogicalStaticPosition& static_position, const WritingDirectionMode container_writing_direction, NGLogicalOutOfFlowDimensions* dimensions) { - const NGLogicalOutOfFlowInsets insets = - ComputeOutOfFlowInsets(node.Style(), space.AvailableSize()); + NGLogicalAnchorQuery anchor_query; + const NGLogicalOutOfFlowInsets insets = ComputeOutOfFlowInsets( + node.Style(), space.AvailableSize(), anchor_query); LogicalSize computed_available_size = ComputeOutOfFlowAvailableSize(node, space, insets, static_position); blink::ComputeOutOfFlowBlockDimensions(
diff --git a/third_party/blink/renderer/core/layout/ng/ng_anchor_query.cc b/third_party/blink/renderer/core/layout/ng/ng_anchor_query.cc new file mode 100644 index 0000000..f4467f1 --- /dev/null +++ b/third_party/blink/renderer/core/layout/ng/ng_anchor_query.cc
@@ -0,0 +1,53 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/layout/ng/ng_anchor_query.h" + +namespace blink { + +absl::optional<LayoutUnit> NGLogicalAnchorQuery::Evaluate( + const AtomicString& anchor_name, + AnchorValue anchor_value, + LayoutUnit available_size, + bool is_block_direction, + bool is_end) const { + const auto it = anchor_references.find(anchor_name); + if (it == anchor_references.end()) + return absl::nullopt; // No targets. + + LayoutUnit value; + switch (anchor_value) { + case AnchorValue::kLeft: + if (is_block_direction) + return absl::nullopt; // Wrong axis. + value = it->value.offset.inline_offset; + break; + case AnchorValue::kRight: + if (is_block_direction) + return absl::nullopt; // Wrong axis. + value = it->value.InlineEndOffset(); + break; + case AnchorValue::kTop: + if (!is_block_direction) + return absl::nullopt; // Wrong axis. + value = it->value.offset.block_offset; + break; + case AnchorValue::kBottom: + if (!is_block_direction) + return absl::nullopt; // Wrong axis. + value = it->value.BlockEndOffset(); + break; + default: + NOTREACHED(); + return absl::nullopt; + } + + // The |value| is for the "start" side of insets. For the "end" side of + // insets, return the distance from |available_size|. + if (is_end) + return available_size - value; + return value; +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/layout/ng/ng_anchor_query.h b/third_party/blink/renderer/core/layout/ng/ng_anchor_query.h index 921f165..82042dd 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_anchor_query.h +++ b/third_party/blink/renderer/core/layout/ng/ng_anchor_query.h
@@ -7,8 +7,10 @@ #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/renderer/core/layout/geometry/logical_rect.h" #include "third_party/blink/renderer/core/layout/geometry/physical_rect.h" +#include "third_party/blink/renderer/platform/geometry/anchor_query_enums.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h" @@ -24,6 +26,14 @@ struct NGLogicalAnchorQuery { bool IsEmpty() const { return anchor_references.IsEmpty(); } + // Evaluate the |anchor_name| for the |anchor_value|. Returns |nullopt| if + // the query is invalid (e.g., no targets or wrong axis.) + absl::optional<LayoutUnit> Evaluate(const AtomicString& anchor_name, + AnchorValue anchor_value, + LayoutUnit available_size, + bool is_block_direction, + bool is_end) const; + HashMap<AtomicString, LogicalRect> anchor_references; };
diff --git a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc index 5ec13bd..5096001 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc
@@ -1442,7 +1442,9 @@ } const NGLogicalOutOfFlowInsets insets = ComputeOutOfFlowInsets( - candidate_style, node_info.constraint_space.AvailableSize()); + candidate_style, node_info.constraint_space.AvailableSize(), + container_builder_->AnchorQuery()); + const LogicalSize computed_available_size = ComputeOutOfFlowAvailableSize(node_info.node, node_info.constraint_space, insets, node_info.static_position);
diff --git a/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker_test.cc b/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker_test.cc index fc843e0..0dbc94d 100644 --- a/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker_test.cc +++ b/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker_test.cc
@@ -73,9 +73,7 @@ }; class MobileFriendlinessCheckerTest : public testing::Test { - static void EvalMobileFriendliness(LocalFrameView* view, - int scroll_y_offset, - bool fixed_clock) { + static void EvalMobileFriendliness(LocalFrameView* view, bool fixed_clock) { DCHECK(view->GetFrame().IsLocalRoot()); ScopedTimeTicksOverride clock(fixed_clock); for (const Frame* frame = &view->GetFrame(); frame; @@ -86,10 +84,6 @@ } } - // Scroll the view to specified offset - view->LayoutViewport()->SetScrollOffsetUnconditionally( - ScrollOffset(0, scroll_y_offset)); - view->GetMobileFriendlinessChecker()->DidFinishLifecycleUpdate(*view); } @@ -127,7 +121,6 @@ MobileFriendliness CalculateMetricsForHTMLString(const std::string& html, float device_scale = 1.0, - int scroll_y_offset = 0, bool fixed_clock = true) { MFTestWebFrameClient web_frame_client; { @@ -137,15 +130,13 @@ helper->GetWebView()->MainFrameImpl(), html, url_test_helpers::ToKURL("about:blank")); EvalMobileFriendliness( - helper->GetWebView()->MainFrameImpl()->GetFrameView(), - scroll_y_offset, fixed_clock); + helper->GetWebView()->MainFrameImpl()->GetFrameView(), fixed_clock); } return web_frame_client.GetMobileFriendliness(); } MobileFriendliness CalculateMetricsForFile(const std::string& path, float device_scale = 1.0, - int scroll_y_offset = 0, bool fixed_clock = true) { MFTestWebFrameClient web_frame_client; { @@ -157,8 +148,7 @@ frame_test_helpers::LoadFrame(helper->GetWebView()->MainFrameImpl(), kBaseUrl + path); EvalMobileFriendliness( - helper->GetWebView()->MainFrameImpl()->GetFrameView(), - scroll_y_offset, fixed_clock); + helper->GetWebView()->MainFrameImpl()->GetFrameView(), fixed_clock); } return web_frame_client.GetMobileFriendliness(); } @@ -1477,7 +1467,6 @@ </html> )", /*device_scale=*/1.0, - /*scroll_y_offset=*/0, /*fixed_clock=*/false); EXPECT_EQ(actual_mf.bad_tap_targets_ratio, -2); }
diff --git a/third_party/blink/renderer/core/svg/unsafe_svg_attribute_sanitization_test.cc b/third_party/blink/renderer/core/svg/unsafe_svg_attribute_sanitization_test.cc index 72843d6..a72ae3f 100644 --- a/third_party/blink/renderer/core/svg/unsafe_svg_attribute_sanitization_test.cc +++ b/third_party/blink/renderer/core/svg/unsafe_svg_attribute_sanitization_test.cc
@@ -234,7 +234,7 @@ TEST(UnsafeSVGAttributeSanitizationTest, stripScriptingAttributes_animateElement) { - Vector<Attribute> attributes; + Vector<Attribute, kAttributePrealloc> attributes; attributes.push_back(Attribute(xlink_names::kHrefAttr, "javascript:alert()")); attributes.push_back(Attribute(svg_names::kHrefAttr, "javascript:alert()")); attributes.push_back(Attribute(svg_names::kFromAttr, "/home"));
diff --git a/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc b/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc index 424bcd90..9c638f0 100644 --- a/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc +++ b/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
@@ -504,9 +504,10 @@ CurrentThread() == g_libxml_loader_thread; } -static inline void SetAttributes(Element* element, - Vector<Attribute>& attribute_vector, - ParserContentPolicy parser_content_policy) { +static inline void SetAttributes( + Element* element, + Vector<Attribute, kAttributePrealloc>& attribute_vector, + ParserContentPolicy parser_content_policy) { if (!ScriptingContentIsAllowed(parser_content_policy)) element->StripScriptingAttributes(attribute_vector); element->ParserSetAttributes(attribute_vector); @@ -549,7 +550,7 @@ } #define xmlParseChunk \ - #error "Use parseChunk instead to select the correct encoding." +#error "Use parseChunk instead to select the correct encoding." static bool IsLibxmlDefaultCatalogFile(const String& url_string) { // On non-Windows platforms libxml with catalogs enabled asks for @@ -887,7 +888,7 @@ }; static inline void HandleNamespaceAttributes( - Vector<Attribute>& prefixed_attributes, + Vector<Attribute, kAttributePrealloc>& prefixed_attributes, const xmlChar** libxml_namespaces, int nb_namespaces, ExceptionState& exception_state) { @@ -918,7 +919,7 @@ }; static inline void HandleElementAttributes( - Vector<Attribute>& prefixed_attributes, + Vector<Attribute, kAttributePrealloc>& prefixed_attributes, const xmlChar** libxml_attributes, int nb_attributes, const HashMap<AtomicString, AtomicString>& initial_prefix_to_namespace_map, @@ -1000,7 +1001,7 @@ bool is_first_element = !saw_first_element_; saw_first_element_ = true; - Vector<Attribute> prefixed_attributes; + Vector<Attribute, kAttributePrealloc> prefixed_attributes; DummyExceptionStateForTesting exception_state; HandleNamespaceAttributes(prefixed_attributes, libxml_namespaces, nb_namespaces, exception_state);
diff --git a/third_party/blink/renderer/core/xml/parser/xml_errors.cc b/third_party/blink/renderer/core/xml/parser/xml_errors.cc index 64a41f4..def16f3 100644 --- a/third_party/blink/renderer/core/xml/parser/xml_errors.cc +++ b/third_party/blink/renderer/core/xml/parser/xml_errors.cc
@@ -100,7 +100,7 @@ QualifiedName(g_null_atom, "parsererror", html_names::xhtmlNamespaceURI), flags); - Vector<Attribute> report_attributes; + Vector<Attribute, kAttributePrealloc> report_attributes; report_attributes.push_back(Attribute( html_names::kStyleAttr, "display: block; white-space: pre; border: 2px solid #c77; padding: 0 " @@ -113,7 +113,7 @@ doc->createTextNode("This page contains the following errors:")); Element* fixed = doc->CreateRawElement(html_names::kDivTag, flags); - Vector<Attribute> fixed_attributes; + Vector<Attribute, kAttributePrealloc> fixed_attributes; fixed_attributes.push_back(Attribute(html_names::kStyleAttr, "font-family:monospace;font-size:12px")); fixed->ParserSetAttributes(fixed_attributes); @@ -171,7 +171,7 @@ CreateXHTMLParserErrorHeader(document_, error_messages); if (DocumentXSLT::HasTransformSourceDocument(*document_)) { - Vector<Attribute> attributes; + Vector<Attribute, kAttributePrealloc> attributes; attributes.push_back( Attribute(html_names::kStyleAttr, "white-space: normal")); Element* paragraph = document_->CreateRawElement(html_names::kPTag, flags);
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_state.cc b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_state.cc index 11a05a2..e72ce1a5 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_state.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_state.cc
@@ -598,9 +598,11 @@ using ShadowMode = DropShadowPaintFilter::ShadowMode; if (!shadow_only_image_filter_) { const auto sigma = BlurRadiusToStdDev(shadow_blur_); + // TODO(crbug/1308932): Remove FromColor and make all SkColor4f. shadow_only_image_filter_ = sk_make_sp<DropShadowPaintFilter>( - shadow_offset_.x(), shadow_offset_.y(), sigma, sigma, shadow_color_, - ShadowMode::kDrawShadowOnly, nullptr); + shadow_offset_.x(), shadow_offset_.y(), sigma, sigma, + SkColor4f::FromColor(shadow_color_), ShadowMode::kDrawShadowOnly, + nullptr); } return shadow_only_image_filter_; } @@ -610,8 +612,10 @@ using ShadowMode = DropShadowPaintFilter::ShadowMode; if (!shadow_and_foreground_image_filter_) { const auto sigma = BlurRadiusToStdDev(shadow_blur_); + // TODO(crbug/1308932): Remove FromColor and make all SkColor4f. shadow_and_foreground_image_filter_ = sk_make_sp<DropShadowPaintFilter>( - shadow_offset_.x(), shadow_offset_.y(), sigma, sigma, shadow_color_, + shadow_offset_.x(), shadow_offset_.y(), sigma, sigma, + SkColor4f::FromColor(shadow_color_), ShadowMode::kDrawShadowAndForeground, nullptr); } return shadow_and_foreground_image_filter_;
diff --git a/third_party/blink/renderer/modules/webdatabase/dom_window_web_database.cc b/third_party/blink/renderer/modules/webdatabase/dom_window_web_database.cc index 8d11a53..e753926 100644 --- a/third_party/blink/renderer/modules/webdatabase/dom_window_web_database.cc +++ b/third_party/blink/renderer/modules/webdatabase/dom_window_web_database.cc
@@ -81,15 +81,17 @@ } if (!window.GetExecutionContext()->IsSecureContext()) { - if (!base::FeatureList::IsEnabled( - blink::features::kWebSQLNonSecureContextAccess)) { + if (base::FeatureList::IsEnabled( + blink::features::kWebSQLNonSecureContextAccess) || + base::CommandLine::ForCurrentProcess()->HasSwitch( + blink::switches::kWebSQLNonSecureContextEnabled)) { + Deprecation::CountDeprecation( + &window, WebFeature::kOpenWebDatabaseInsecureContext); + } else { UseCounter::Count(window, WebFeature::kOpenWebDatabaseInsecureContext); exception_state.ThrowSecurityError( "Access to the WebDatabase API is denied in non-secure contexts."); return nullptr; - } else { - Deprecation::CountDeprecation( - &window, WebFeature::kOpenWebDatabaseInsecureContext); } }
diff --git a/third_party/blink/renderer/modules/webdatabase/dom_window_web_database_test.cc b/third_party/blink/renderer/modules/webdatabase/dom_window_web_database_test.cc index 9dc4a8d..b7816b5f 100644 --- a/third_party/blink/renderer/modules/webdatabase/dom_window_web_database_test.cc +++ b/third_party/blink/renderer/modules/webdatabase/dom_window_web_database_test.cc
@@ -115,6 +115,39 @@ static_cast<int>(DOMExceptionCode::kInvalidStateError)); } +TEST(DOMWindowWebDatabaseTest, WebSQLNonSecureContextFeatureOffSwitchOn) { + base::test::ScopedCommandLine scoped_command_line; + scoped_command_line.GetProcessCommandLine()->AppendSwitch( + blink::switches::kWebSQLNonSecureContextEnabled); + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndDisableFeature( + blink::features::kWebSQLNonSecureContextAccess); + V8TestingScope scope; + OpenWebDatabaseInWindow("http://example.test:0/", "first_party/empty.html", + scope.GetExceptionState()); + // Insufficient state exists to actually open a database, but this error + // means it was tried. + EXPECT_TRUE(scope.GetExceptionState().HadException()); + EXPECT_EQ(scope.GetExceptionState().Code(), + static_cast<int>(DOMExceptionCode::kInvalidStateError)); +} + +TEST(DOMWindowWebDatabaseTest, WebSQLNonSecureContextFeatureOffSwitchOff) { + base::test::ScopedCommandLine scoped_command_line; + scoped_command_line.GetProcessCommandLine()->RemoveSwitch( + blink::switches::kWebSQLNonSecureContextEnabled); + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndDisableFeature( + blink::features::kWebSQLNonSecureContextAccess); + V8TestingScope scope; + OpenWebDatabaseInWindow("http://example.test:0/", "first_party/empty.html", + scope.GetExceptionState()); + // This error means the database opening was rejected. + EXPECT_TRUE(scope.GetExceptionState().HadException()); + EXPECT_EQ(scope.GetExceptionState().Code(), + static_cast<int>(DOMExceptionCode::kSecurityError)); +} + TEST(DOMWindowWebDatabaseTest, WebSQLDefault) { V8TestingScope scope; OpenWebDatabaseInWindow("https://example.test:0/", "first_party/empty.html",
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.cc b/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.cc index 63ea54a..e5f0a43 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.cc +++ b/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.cc
@@ -400,9 +400,9 @@ // that errors can be generated in the appropriate error scope. device_ = descriptor->device(); - usage_ = AsDawnFlags<WGPUTextureUsage>(descriptor->usage()); - format_ = AsDawnEnum(descriptor->format()); - switch (format_) { + WGPUTextureUsage usage = AsDawnFlags<WGPUTextureUsage>(descriptor->usage()); + WGPUTextureFormat format = AsDawnEnum(descriptor->format()); + switch (format) { case WGPUTextureFormat_BGRA8Unorm: // TODO(crbug.com/1298618): support RGBA8Unorm on MAC. #if !BUILDFLAG(IS_MAC) @@ -454,6 +454,26 @@ return; } + swap_buffers_ = base::AdoptRef( + new WebGPUSwapBufferProvider(this, device_->GetDawnControlClient(), + device_->GetHandle(), usage, format)); + swap_buffers_->SetFilterQuality(filter_quality_); + + // Note: SetContentsOpaque is only an optimization hint. It doesn't + // actually make the contents opaque. + switch (alpha_mode_) { + case V8GPUCanvasAlphaMode::Enum::kOpaque: { + CcLayer()->SetContentsOpaque(true); + if (!alpha_clearer_ || !alpha_clearer_->IsCompatible(device_, format)) { + alpha_clearer_ = std::make_unique<TextureAlphaClearer>(device_, format); + } + break; + } + case V8GPUCanvasAlphaMode::Enum::kPremultiplied: + CcLayer()->SetContentsOpaque(false); + break; + } + // Set the size while configuring. if (descriptor->hasSize()) { // TODO(crbug.com/1326473): Remove this branch after deprecation period. @@ -485,41 +505,16 @@ configured_size_.SetSize(0, 0); ResizeSwapbuffers(Host()->Size()); } - - // Note: SetContentsOpaque is only an optimization hint. It doesn't - // actually make the contents opaque. - switch (alpha_mode_) { - case V8GPUCanvasAlphaMode::Enum::kOpaque: { - CcLayer()->SetContentsOpaque(true); - if (!alpha_clearer_ || alpha_clearer_->IsCompatible(device_, format_)) { - alpha_clearer_ = - std::make_unique<TextureAlphaClearer>(device_, format_); - } - break; - } - case V8GPUCanvasAlphaMode::Enum::kPremultiplied: - CcLayer()->SetContentsOpaque(false); - break; - } } void GPUCanvasContext::ResizeSwapbuffers(gfx::Size size) { size_ = size; // The spec indicates that when the canvas is resized the current texture is - // set to null. It will be reallocated on the next call to getCurrentTexture. - - // TODO(bajones): Currently the only way to clear the swap_buffers texture - // reference is to neuter it, which renders the swap_buffers unusable and - // requires a new one to be created. Resizing could be handled more - // efficiently if the swap_buffers internal texture reference could be - // discarded without needing to recreate the entire thing. - if (device_) { - UnconfigureInternal(); - swap_buffers_ = base::AdoptRef( - new WebGPUSwapBufferProvider(this, device_->GetDawnControlClient(), - device_->GetHandle(), usage_, format_)); - swap_buffers_->SetFilterQuality(filter_quality_); + // discarded and a new one allocated in it's place immediately. + if (swap_buffers_) { + swap_buffers_->DiscardCurrentSwapBuffer(); + ReplaceCurrentTexture(); } // If we don't notify the host that something has changed it may never check @@ -575,13 +570,6 @@ return GPUTexture::CreateError(device_); } - // As we are getting a new texture, if this is an offscreencanvas or if it is - // going to be presented to video, we have to notify the placeholder or - // listeners. - if (IsOffscreenCanvas() || - static_cast<HTMLCanvasElement*>(Host())->HasCanvasCapture()) - DidDraw(CanvasPerformanceMonitor::DrawType::kOther); - // Calling getCurrentTexture returns a texture that is valid until the // animation frame it gets presented. If getCurrentTexture is called multiple // time, the same texture should be returned. |texture_| is set to null when @@ -590,6 +578,22 @@ return texture_; } + return ReplaceCurrentTexture(); +} + +GPUTexture* GPUCanvasContext::ReplaceCurrentTexture() { + DCHECK(device_); + DCHECK(swap_buffers_); + + // As we are getting a new texture, if this is an offscreencanvas or if it is + // going to be presented to video, we have to notify the placeholder or + // listeners. + if (IsOffscreenCanvas() || + static_cast<HTMLCanvasElement*>(Host())->HasCanvasCapture()) + DidDraw(CanvasPerformanceMonitor::DrawType::kOther); + + texture_ = nullptr; + WGPUTexture dawn_client_texture = swap_buffers_->GetNewTexture(size_); if (!dawn_client_texture) { texture_ = GPUTexture::CreateError(device_);
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.h b/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.h index ce9b8398..9e6755e 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.h +++ b/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.h
@@ -110,6 +110,7 @@ private: void UnconfigureInternal(); + GPUTexture* ReplaceCurrentTexture(); void ResizeSwapbuffers(gfx::Size size); void InitializeAlphaModePipeline(WGPUTextureFormat format); @@ -135,11 +136,6 @@ std::unique_ptr<TextureAlphaClearer> alpha_clearer_; scoped_refptr<WebGPUSwapBufferProvider> swap_buffers_; - // TODO(bajones): These don't need to be tracked if swap_buffers can persist - // across resizes. - WGPUTextureUsage usage_; - WGPUTextureFormat format_; - gfx::Size size_; bool stopped_ = false;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_device.cc b/third_party/blink/renderer/modules/webgpu/gpu_device.cc index be9dd450..55bfe79 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_device.cc +++ b/third_party/blink/renderer/modules/webgpu/gpu_device.cc
@@ -108,7 +108,9 @@ } GPUDevice::~GPUDevice() { - DestroyAllExternalTextures(); + // Perform destruction that's safe to do inside a GC (as in it doesn't touch + // other GC objects). + // Clear the callbacks since we can't handle callbacks after finalization. // error_callback_, logging_callback_, and lost_callback_ will be deleted. GetProcs().deviceSetUncapturedErrorCallback(GetHandle(), nullptr, nullptr); @@ -598,6 +600,12 @@ EventTargetWithInlineData::Trace(visitor); } +void GPUDevice::Dispose() { + // This call accesses other GC objects, so it cannot be called inside GC + // objects destructors. Instead call it in the pre-finalizer. + DestroyAllExternalTextures(); +} + void GPUDevice::DestroyAllExternalTextures() { for (auto& external_texture : active_external_textures_) { external_texture->Destroy();
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_device.h b/third_party/blink/renderer/modules/webgpu/gpu_device.h index c4c9e0e..d9a5d0e 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_device.h +++ b/third_party/blink/renderer/modules/webgpu/gpu_device.h
@@ -60,6 +60,7 @@ public ExecutionContextClient, public DawnObject<WGPUDevice> { DEFINE_WRAPPERTYPEINFO(); + USING_PRE_FINALIZER(GPUDevice, Dispose); public: explicit GPUDevice(ExecutionContext* execution_context, @@ -152,6 +153,9 @@ using LostProperty = ScriptPromiseProperty<Member<GPUDeviceLostInfo>, ToV8UndefinedGenerator>; + // Used by USING_PRE_FINALIZER. + void Dispose(); + void DestroyAllExternalTextures(); void OnUncapturedError(WGPUErrorType errorType, const char* message);
diff --git a/third_party/blink/renderer/platform/geometry/calculation_expression_node.cc b/third_party/blink/renderer/platform/geometry/calculation_expression_node.cc index 5f13198..2238e5b 100644 --- a/third_party/blink/renderer/platform/geometry/calculation_expression_node.cc +++ b/third_party/blink/renderer/platform/geometry/calculation_expression_node.cc
@@ -10,7 +10,9 @@ // ------ CalculationExpressionNumberNode ------ -float CalculationExpressionNumberNode::Evaluate(float max_value) const { +float CalculationExpressionNumberNode::Evaluate( + float max_value, + const Length::AnchorEvaluator*) const { return value_; } @@ -37,7 +39,8 @@ // ------ CalculationExpressionPixelsAndPercentNode ------ float CalculationExpressionPixelsAndPercentNode::Evaluate( - float max_value) const { + float max_value, + const Length::AnchorEvaluator*) const { return value_.pixels + value_.percent / 100 * max_value; } @@ -178,45 +181,51 @@ } } -float CalculationExpressionOperationNode::Evaluate(float max_value) const { +float CalculationExpressionOperationNode::Evaluate( + float max_value, + const Length::AnchorEvaluator* anchor_evaluator) const { switch (operator_) { case CalculationOperator::kAdd: { DCHECK_EQ(children_.size(), 2u); - float left = children_[0]->Evaluate(max_value); - float right = children_[1]->Evaluate(max_value); + float left = children_[0]->Evaluate(max_value, anchor_evaluator); + float right = children_[1]->Evaluate(max_value, anchor_evaluator); return left + right; } case CalculationOperator::kSubtract: { DCHECK_EQ(children_.size(), 2u); - float left = children_[0]->Evaluate(max_value); - float right = children_[1]->Evaluate(max_value); + float left = children_[0]->Evaluate(max_value, anchor_evaluator); + float right = children_[1]->Evaluate(max_value, anchor_evaluator); return left - right; } case CalculationOperator::kMultiply: { DCHECK_EQ(children_.size(), 2u); - float left = children_[0]->Evaluate(max_value); - float right = children_[1]->Evaluate(max_value); + float left = children_[0]->Evaluate(max_value, anchor_evaluator); + float right = children_[1]->Evaluate(max_value, anchor_evaluator); return left * right; } case CalculationOperator::kMin: { DCHECK(!children_.IsEmpty()); - float minimum = children_[0]->Evaluate(max_value); - for (auto& child : children_) - minimum = std::min(minimum, child->Evaluate(max_value)); + float minimum = children_[0]->Evaluate(max_value, anchor_evaluator); + for (auto& child : children_) { + minimum = + std::min(minimum, child->Evaluate(max_value, anchor_evaluator)); + } return minimum; } case CalculationOperator::kMax: { DCHECK(!children_.IsEmpty()); - float maximum = children_[0]->Evaluate(max_value); - for (auto& child : children_) - maximum = std::max(maximum, child->Evaluate(max_value)); + float maximum = children_[0]->Evaluate(max_value, anchor_evaluator); + for (auto& child : children_) { + maximum = + std::max(maximum, child->Evaluate(max_value, anchor_evaluator)); + } return maximum; } case CalculationOperator::kClamp: { DCHECK(!children_.IsEmpty()); - float min = children_[0]->Evaluate(max_value); - float val = children_[1]->Evaluate(max_value); - float max = children_[2]->Evaluate(max_value); + float min = children_[0]->Evaluate(max_value, anchor_evaluator); + float val = children_[1]->Evaluate(max_value, anchor_evaluator); + float max = children_[2]->Evaluate(max_value, anchor_evaluator); // clamp(MIN, VAL, MAX) is identical to max(MIN, min(VAL, MAX)) return std::max(min, std::min(val, max)); } @@ -387,8 +396,15 @@ type_, anchor_name_, value_, side_percentage_, fallback_.Zoom(factor)); } -float CalculationExpressionAnchorQueryNode::Evaluate(float) const { - // TODO(crbug.com/1309178): Implement. +float CalculationExpressionAnchorQueryNode::Evaluate( + float max_value, + const Length::AnchorEvaluator* anchor_evaluator) const { + if (anchor_evaluator) { + if (const absl::optional<LayoutUnit> value = + anchor_evaluator->Evaluate(anchor_name_, AnchorSide())) + return value->ToFloat(); + } + // TODO(crbug.com/1309178): Support fallback. return 0; }
diff --git a/third_party/blink/renderer/platform/geometry/calculation_expression_node.h b/third_party/blink/renderer/platform/geometry/calculation_expression_node.h index ab0d1f9..85e697c 100644 --- a/third_party/blink/renderer/platform/geometry/calculation_expression_node.h +++ b/third_party/blink/renderer/platform/geometry/calculation_expression_node.h
@@ -31,7 +31,8 @@ class PLATFORM_EXPORT CalculationExpressionNode : public RefCounted<CalculationExpressionNode> { public: - virtual float Evaluate(float max_value) const = 0; + virtual float Evaluate(float max_value, + const Length::AnchorEvaluator*) const = 0; virtual bool operator==(const CalculationExpressionNode& other) const = 0; bool operator!=(const CalculationExpressionNode& other) const { return !operator==(other); @@ -69,7 +70,7 @@ float Value() const { return value_; } // Implement |CalculationExpressionNode|: - float Evaluate(float max_value) const final; + float Evaluate(float max_value, const Length::AnchorEvaluator*) const final; bool operator==(const CalculationExpressionNode& other) const final; scoped_refptr<const CalculationExpressionNode> Zoom( double factor) const final; @@ -106,7 +107,7 @@ PixelsAndPercent GetPixelsAndPercent() const { return value_; } // Implement |CalculationExpressionNode|: - float Evaluate(float max_value) const final; + float Evaluate(float max_value, const Length::AnchorEvaluator*) const final; bool operator==(const CalculationExpressionNode& other) const final; scoped_refptr<const CalculationExpressionNode> Zoom( double factor) const final; @@ -149,7 +150,7 @@ CalculationOperator GetOperator() const { return operator_; } // Implement |CalculationExpressionNode|: - float Evaluate(float max_value) const final; + float Evaluate(float max_value, const Length::AnchorEvaluator*) const final; bool operator==(const CalculationExpressionNode& other) const final; scoped_refptr<const CalculationExpressionNode> Zoom( double factor) const final; @@ -206,7 +207,7 @@ const Length& GetFallback() const { return fallback_; } // Implement |CalculationExpressionNode|: - float Evaluate(float max_value) const final; + float Evaluate(float max_value, const Length::AnchorEvaluator*) const final; bool operator==(const CalculationExpressionNode& other) const final; scoped_refptr<const CalculationExpressionNode> Zoom( double factor) const final;
diff --git a/third_party/blink/renderer/platform/geometry/calculation_value.cc b/third_party/blink/renderer/platform/geometry/calculation_value.cc index 465d033b..b6c96f3f 100644 --- a/third_party/blink/renderer/platform/geometry/calculation_value.cc +++ b/third_party/blink/renderer/platform/geometry/calculation_value.cc
@@ -44,10 +44,12 @@ data_.value.~PixelsAndPercent(); } -float CalculationValue::Evaluate(float max_value) const { - float value = - ClampTo<float>(is_expression_ ? data_.expression->Evaluate(max_value) - : Pixels() + Percent() / 100 * max_value); +float CalculationValue::Evaluate( + float max_value, + const Length::AnchorEvaluator* anchor_evaluator) const { + float value = ClampTo<float>( + is_expression_ ? data_.expression->Evaluate(max_value, anchor_evaluator) + : Pixels() + Percent() / 100 * max_value); return (IsNonNegative() && value < 0) ? 0 : value; }
diff --git a/third_party/blink/renderer/platform/geometry/calculation_value.h b/third_party/blink/renderer/platform/geometry/calculation_value.h index 9e588a0..69e4201 100644 --- a/third_party/blink/renderer/platform/geometry/calculation_value.h +++ b/third_party/blink/renderer/platform/geometry/calculation_value.h
@@ -59,7 +59,8 @@ ~CalculationValue(); - float Evaluate(float max_value) const; + float Evaluate(float max_value, + const Length::AnchorEvaluator* = nullptr) const; bool operator==(const CalculationValue& o) const; bool IsExpression() const { return is_expression_; } bool IsNonNegative() const { return is_non_negative_; }
diff --git a/third_party/blink/renderer/platform/geometry/length.cc b/third_party/blink/renderer/platform/geometry/length.cc index 82a07ce..cb9b5a7 100644 --- a/third_party/blink/renderer/platform/geometry/length.cc +++ b/third_party/blink/renderer/platform/geometry/length.cc
@@ -176,9 +176,12 @@ CalcHandles().DecrementRef(CalculationHandle()); } -float Length::NonNanCalculatedValue(LayoutUnit max_value) const { +float Length::NonNanCalculatedValue( + LayoutUnit max_value, + const AnchorEvaluator* anchor_evaluator) const { DCHECK(IsCalculated()); - float result = GetCalculationValue().Evaluate(max_value.ToFloat()); + float result = + GetCalculationValue().Evaluate(max_value.ToFloat(), anchor_evaluator); if (std::isnan(result)) return 0; return result;
diff --git a/third_party/blink/renderer/platform/geometry/length.h b/third_party/blink/renderer/platform/geometry/length.h index 58b5d07..6dff375 100644 --- a/third_party/blink/renderer/platform/geometry/length.h +++ b/third_party/blink/renderer/platform/geometry/length.h
@@ -28,6 +28,8 @@ #include "base/check_op.h" #include "base/notreached.h" +#include "third_party/abseil-cpp/absl/types/optional.h" +#include "third_party/blink/renderer/platform/geometry/anchor_query_enums.h" #include "third_party/blink/renderer/platform/geometry/layout_unit.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" @@ -299,7 +301,17 @@ DCHECK(!IsNone()); return is_float_ ? float_value_ : int_value_; } - float NonNanCalculatedValue(LayoutUnit max_value) const; + + class AnchorEvaluator { + public: + // Evaluate the |anchor_name| for the |anchor_value|. Returns |nullopt| if + // the query is invalid (e.g., no targets or wrong axis.) + virtual absl::optional<LayoutUnit> Evaluate( + const AtomicString& anchor_name, + AnchorValue anchor_value) const = 0; + }; + float NonNanCalculatedValue(LayoutUnit max_value, + const AnchorEvaluator* = nullptr) const; Length SubtractFromOneHundredPercent() const;
diff --git a/third_party/blink/renderer/platform/geometry/length_functions.cc b/third_party/blink/renderer/platform/geometry/length_functions.cc index 7928913..ff77c61 100644 --- a/third_party/blink/renderer/platform/geometry/length_functions.cc +++ b/third_party/blink/renderer/platform/geometry/length_functions.cc
@@ -62,8 +62,10 @@ return 0; } -LayoutUnit MinimumValueForLengthInternal(const Length& length, - LayoutUnit maximum_value) { +LayoutUnit MinimumValueForLengthInternal( + const Length& length, + LayoutUnit maximum_value, + Length::AnchorEvaluator* anchor_evaluator) { switch (length.GetType()) { case Length::kPercent: // Don't remove the extra cast to float. It is needed for rounding on @@ -71,7 +73,8 @@ return LayoutUnit( static_cast<float>(maximum_value * length.Percent() / 100.0f)); case Length::kCalculated: - return LayoutUnit(length.NonNanCalculatedValue(maximum_value)); + return LayoutUnit( + length.NonNanCalculatedValue(maximum_value, anchor_evaluator)); case Length::kFillAvailable: case Length::kAuto: return LayoutUnit();
diff --git a/third_party/blink/renderer/platform/geometry/length_functions.h b/third_party/blink/renderer/platform/geometry/length_functions.h index a2412b2..37de920 100644 --- a/third_party/blink/renderer/platform/geometry/length_functions.h +++ b/third_party/blink/renderer/platform/geometry/length_functions.h
@@ -44,14 +44,18 @@ PLATFORM_EXPORT int IntValueForLength(const Length&, int maximum_value); PLATFORM_EXPORT float FloatValueForLength(const Length&, float maximum_value); PLATFORM_EXPORT LayoutUnit -MinimumValueForLengthInternal(const Length&, LayoutUnit maximum_value); +MinimumValueForLengthInternal(const Length&, + LayoutUnit maximum_value, + Length::AnchorEvaluator*); -inline LayoutUnit MinimumValueForLength(const Length& length, - LayoutUnit maximum_value) { +inline LayoutUnit MinimumValueForLength( + const Length& length, + LayoutUnit maximum_value, + Length::AnchorEvaluator* anchor_evaluator = nullptr) { if (LIKELY(length.IsFixed())) return LayoutUnit(length.Value()); - return MinimumValueForLengthInternal(length, maximum_value); + return MinimumValueForLengthInternal(length, maximum_value, anchor_evaluator); } PLATFORM_EXPORT LayoutUnit ValueForLength(const Length&,
diff --git a/third_party/blink/renderer/platform/geometry/length_test.cc b/third_party/blink/renderer/platform/geometry/length_test.cc index f7892df..2aec2fd 100644 --- a/third_party/blink/renderer/platform/geometry/length_test.cc +++ b/third_party/blink/renderer/platform/geometry/length_test.cc
@@ -417,7 +417,8 @@ const auto& non_simplified_calc_value = non_simplified.GetCalculationValue(); EXPECT_TRUE(non_simplified_calc_value.IsExpression()); float result_for_non_simplified = - non_simplified_calc_value.GetOrCreateExpression()->Evaluate(100); + non_simplified_calc_value.GetOrCreateExpression()->Evaluate( + 100, /* anchor_evaluator */ nullptr); EXPECT_EQ(60.0f, result_for_non_simplified); Length simplified =
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_drop_shadow.cc b/third_party/blink/renderer/platform/graphics/filters/fe_drop_shadow.cc index 364001e..07be3e2 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_drop_shadow.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_drop_shadow.cc
@@ -73,9 +73,10 @@ Color color = AdaptColorToOperatingInterpolationSpace( shadow_color_.CombineWithAlpha(shadow_opacity_)); absl::optional<PaintFilter::CropRect> crop_rect = GetCropRect(); + // TODO(crbug/1308932): Remove FromColor and make all SkColor4f. return sk_make_sp<DropShadowPaintFilter>( SkFloatToScalar(dx), SkFloatToScalar(dy), SkFloatToScalar(std_x), - SkFloatToScalar(std_y), color.Rgb(), + SkFloatToScalar(std_y), SkColor4f::FromColor(color.Rgb()), DropShadowPaintFilter::ShadowMode::kDrawShadowAndForeground, std::move(input), base::OptionalOrNullptr(crop_rect)); }
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_lighting.cc b/third_party/blink/renderer/platform/graphics/filters/fe_lighting.cc index 225c518..474d0471 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_lighting.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_lighting.cc
@@ -92,9 +92,11 @@ const SkPoint3 direction = SkPoint3::Make( cosf(azimuth_rad) * cosf(elevation_rad), sinf(azimuth_rad) * cosf(elevation_rad), sinf(elevation_rad)); + // TODO(crbug/1308932): Remove FromColor and make all SkColor4f. return sk_make_sp<LightingDistantPaintFilter>( - GetLightingType(), direction, light_color.Rgb(), surface_scale_, - GetFilterConstant(), specular_exponent_, std::move(input), rect); + GetLightingType(), direction, SkColor4f::FromColor(light_color.Rgb()), + surface_scale_, GetFilterConstant(), specular_exponent_, + std::move(input), rect); } case kLsPoint: { PointLightSource* point_light_source = @@ -102,8 +104,10 @@ const gfx::Point3F position = point_light_source->GetPosition(); const SkPoint3 sk_position = SkPoint3::Make(position.x(), position.y(), position.z()); + // TODO(crbug/1308932): Remove FromColor and make all SkColor4f. return sk_make_sp<LightingPointPaintFilter>( - GetLightingType(), sk_position, light_color.Rgb(), surface_scale_, + GetLightingType(), sk_position, + SkColor4f::FromColor(light_color.Rgb()), surface_scale_, GetFilterConstant(), specular_exponent_, std::move(input), rect); } case kLsSpot: { @@ -121,10 +125,12 @@ if (!limiting_cone_angle || limiting_cone_angle > 90 || limiting_cone_angle < -90) limiting_cone_angle = 90; + // TODO(crbug/1308932): Remove FromColor and make all SkColor4f. return sk_make_sp<LightingSpotPaintFilter>( GetLightingType(), location, target, specular_exponent, - limiting_cone_angle, light_color.Rgb(), surface_scale_, - GetFilterConstant(), specular_exponent_, std::move(input), rect); + limiting_cone_angle, SkColor4f::FromColor(light_color.Rgb()), + surface_scale_, GetFilterConstant(), specular_exponent_, + std::move(input), rect); } default: NOTREACHED();
diff --git a/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.cc b/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.cc index 7aa3a6b9..a5287eb4 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.cc
@@ -94,16 +94,7 @@ } } -void WebGPUSwapBufferProvider::Neuter() { - if (neutered_) { - return; - } - - if (layer_) { - layer_->ClearClient(); - layer_ = nullptr; - } - +void WebGPUSwapBufferProvider::DiscardCurrentSwapBuffer() { if (current_swap_buffer_) { if (auto context_provider = GetContextProviderWeakPtr()) { gpu::webgpu::WebGPUInterface* webgpu = @@ -126,6 +117,19 @@ } current_swap_buffer_ = nullptr; } +} + +void WebGPUSwapBufferProvider::Neuter() { + if (neutered_) { + return; + } + + if (layer_) { + layer_->ClearClient(); + layer_ = nullptr; + } + + DiscardCurrentSwapBuffer(); client_ = nullptr; neutered_ = true;
diff --git a/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.h b/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.h index 57b1632..4f1736d 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.h +++ b/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.h
@@ -46,6 +46,7 @@ cc::Layer* CcLayer(); void SetFilterQuality(cc::PaintFlags::FilterQuality); void Neuter(); + void DiscardCurrentSwapBuffer(); WGPUTexture GetNewTexture(const gfx::Size& size); struct WebGPUMailboxTextureAndSize {
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index cd83e2f8..262c6d9 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -137,6 +137,28 @@ # ====== Synchronous, budgeted HTML parser tests to here ======================== +# ====== Timed HTML parser budget tests from here ======================== +# See crbug.com/1342718 for details. +# These tests either started failing outright, or became flaky, when the HTML +# parser switched to using a time based budget instead of a token based budget. +# All of these are bugs/issues with the test itself. + +crbug.com/1341693 [ Linux ] external/wpt/dom/nodes/MutationObserver-document.html [ Skip ] +crbug.com/1339293 [ Linux ] external/wpt/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-invoke-load.html [ Failure Pass ] +crbug.com/1339293 [ Linux ] external/wpt/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-invoke-pause.html [ Failure Pass ] +crbug.com/1339293 [ Linux ] external/wpt/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-invoke-play.html [ Failure Pass ] +crbug.com/1339293 [ Linux ] external/wpt/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-remove-source.html [ Failure Pass ] +crbug.com/1339293 [ Linux ] external/wpt/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-remove-src.html [ Failure Pass ] +crbug.com/1339293 external/wpt/content-security-policy/media-src/media-src-7_1_2.sub.html [ Skip ] +crbug.com/1339293 [ Linux ] external/wpt/content-security-policy/media-src/media-src-blocked.sub.html [ Failure Pass Timeout ] +crbug.com/1339293 [ Linux ] fast/frames/empty-frame-src.html [ Failure Pass ] +crbug.com/1339293 [ Linux ] fast/frames/frame-scrolling-attribute.html [ Failure Pass ] +crbug.com/1339293 [ Linux ] media/controls/rotated-video-has-right-panel-width.html [ Failure Pass ] +crbug.com/1339293 [ Linux ] media/media-controls-overflow-hidden.html [ Failure Pass ] +crbug.com/1339293 [ Linux ] external/wpt/html/semantics/scripting-1/the-script-element/execution-timing/029.html [ Failure Pass ] + +# ====== Timed HTML parser budget tests to here ======================== + crbug.com/1197502 [ Win ] http/tests/intersection-observer/cross-origin-iframe-with-nesting.html [ Failure Pass ] # ====== Site Isolation failures from here ====== @@ -7109,20 +7131,8 @@ # Sheriff 2022-06-24 crbug.com/1339211 [ Mac ] external/wpt/css/css-text-decor/text-decoration-thickness-fixed.html [ Failure Pass ] crbug.com/1339214 [ Mac ] external/wpt/webaudio/the-audio-api/the-convolvernode-interface/realtime-conv.html [ Failure Pass ] -crbug.com/1339293 external/wpt/content-security-policy/media-src/media-src-7_1_2.sub.html [ Skip ] -crbug.com/1339293 [ Linux ] external/wpt/content-security-policy/media-src/media-src-blocked.sub.html [ Failure Pass Timeout ] -crbug.com/1339293 [ Linux ] external/wpt/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-invoke-load.html [ Failure Pass ] -crbug.com/1339293 [ Linux ] external/wpt/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-invoke-pause.html [ Failure Pass ] -crbug.com/1339293 [ Linux ] external/wpt/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-invoke-play.html [ Failure Pass ] -crbug.com/1339293 [ Linux ] external/wpt/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-remove-source.html [ Failure Pass ] -crbug.com/1339293 [ Linux ] external/wpt/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-remove-src.html [ Failure Pass ] -crbug.com/1339293 [ Linux ] external/wpt/html/semantics/embedded-content/the-img-element/invisible-image.html [ Failure Pass ] -crbug.com/1339293 [ Linux ] fast/frames/empty-frame-src.html [ Failure Pass ] -crbug.com/1339293 [ Linux ] fast/frames/frame-scrolling-attribute.html [ Failure Pass ] crbug.com/1339293 [ Linux ] http/tests/devtools/network/network-initiator.js [ Failure Pass ] -crbug.com/1339293 [ Linux ] media/controls/rotated-video-has-right-panel-width.html [ Failure Pass ] -crbug.com/1339293 [ Linux ] media/media-controls-overflow-hidden.html [ Failure Pass ] -crbug.com/1339293 [ Linux ] external/wpt/html/semantics/scripting-1/the-script-element/execution-timing/029.html [ Failure Pass ] +crbug.com/1339293 [ Linux ] external/wpt/html/semantics/embedded-content/the-img-element/invisible-image.html [ Failure Pass ] crbug.com/1339293 [ Linux ] virtual/threaded/external/wpt/requestidlecallback/deadline-max-rAF-dynamic.html [ Failure Pass ] crbug.com/webrtc/14228 external/wpt/webrtc/protocol/h264-profile-levels.https.html [ Failure Pass ] @@ -7148,7 +7158,6 @@ # Sheriff 2022-07-04 crbug.com/1340981 virtual/conversions-debug-mode/wpt_internal/attribution-reporting/source-registration.sub.https.html [ Timeout ] -crbug.com/1341693 [ Linux ] external/wpt/dom/nodes/MutationObserver-document.html [ Skip ] # Sheriff 2022-07-05 crbug.com/1321217 [ Mac ] http/tests/devtools/layers/layer-canvas-log.js [ Failure Pass ] @@ -7164,3 +7173,4 @@ crbug.com/1339538 [ Mac ] fast/frames/002.html [ Failure Pass ] crbug.com/1339538 [ Linux ] fast/frames/002.html [ Failure Pass ] crbug.com/1097040 media/controls/overflow-menu-always-visible.html [ Failure Pass ] +crbug.com/1342526 external/wpt/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-body.html [ Failure Pass ]
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites index 04b228e..49e9b65 100644 --- a/third_party/blink/web_tests/VirtualTestSuites +++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -1086,7 +1086,7 @@ "platforms": ["Linux", "Mac", "Win"], "bases": ["wpt_internal/lazyembed"], "args": [ - "--enable-features=AutomaticLazyFrameLoadingToEmbeds,AutomaticLazyFrameLoadingToEmbedUrls:allowed_websites/http%3A%2F%2Fbad3p.test%3A3001%7C%2Fembed", + "--enable-features=AutomaticLazyFrameLoadingToEmbeds:timeout/1000,AutomaticLazyFrameLoadingToEmbedUrls:allowed_websites/http%3A%2F%2Fbad3p.test%3A3001%7C%2Fembed,AutomaticLazyFrameLoadingToAds:timeout/5000", "--disable-field-trial-config" ] },
diff --git a/third_party/blink/web_tests/external/wpt/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.html b/third_party/blink/web_tests/external/wpt/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.html index a5416119..4165bea 100644 --- a/third_party/blink/web_tests/external/wpt/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.html +++ b/third_party/blink/web_tests/external/wpt/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.html
@@ -41,4 +41,20 @@ assert_equals(e.colno, 0); assert_equals(e.error, undefined); }, "Initial values of ErrorEvent members") + +test(() => { + const e = new ErrorEvent("error", {error : null}); + assert_equals(e.error, null); +}, "error member can be set to null") + +test(() => { + const e = new ErrorEvent("error", {error : undefined}); + assert_equals(e.error, undefined); +}, "error member can be set to undefined") + +test(() => { + const e = new ErrorEvent("error", {error : "foo"}); + assert_equals(e.error, "foo"); +}, "error member can be set to arbitrary") + </script>
diff --git a/third_party/blink/web_tests/platform/generic/external/wpt/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent-expected.txt b/third_party/blink/web_tests/platform/generic/external/wpt/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent-expected.txt deleted file mode 100644 index 5bfc1594..0000000 --- a/third_party/blink/web_tests/platform/generic/external/wpt/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -This is a testharness.js-based test. -FAIL error event is normal (return true does not cancel; one arg) on Document, with a synthetic ErrorEvent assert_equals: expected (undefined) undefined but got (object) null -FAIL Initial values of ErrorEvent members assert_equals: expected (undefined) undefined but got (object) null -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/generic/external/wpt/xslt/transformToFragment.tentative.window-expected.txt b/third_party/blink/web_tests/platform/generic/external/wpt/xslt/transformToFragment.tentative.window-expected.txt deleted file mode 100644 index 8e39712..0000000 --- a/third_party/blink/web_tests/platform/generic/external/wpt/xslt/transformToFragment.tentative.window-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -This is a testharness.js-based test. -FAIL internal script assert_true: script element from XSLTProcessor.transformToFragment() is evaluated expected true got undefined -FAIL external script assert_true: script element from XSLTProcessor.transformToFragment() is evaluated expected true got undefined -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/external/wpt/dom/xslt/transformToFragment.tentative.window-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.15/external/wpt/dom/xslt/transformToFragment.tentative.window-expected.txt deleted file mode 100644 index 8e39712..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.15/external/wpt/dom/xslt/transformToFragment.tentative.window-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -This is a testharness.js-based test. -FAIL internal script assert_true: script element from XSLTProcessor.transformToFragment() is evaluated expected true got undefined -FAIL external script assert_true: script element from XSLTProcessor.transformToFragment() is evaluated expected true got undefined -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/external/wpt/dom/xslt/transformToFragment.tentative.window-expected.txt b/third_party/blink/web_tests/platform/mac-mac12-arm64/external/wpt/dom/xslt/transformToFragment.tentative.window-expected.txt deleted file mode 100644 index 8e39712..0000000 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/external/wpt/dom/xslt/transformToFragment.tentative.window-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -This is a testharness.js-based test. -FAIL internal script assert_true: script element from XSLTProcessor.transformToFragment() is evaluated expected true got undefined -FAIL external script assert_true: script element from XSLTProcessor.transformToFragment() is evaluated expected true got undefined -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/mac/external/wpt/dom/xslt/transformToFragment.tentative.window-expected.txt b/third_party/blink/web_tests/platform/mac/external/wpt/dom/xslt/transformToFragment.tentative.window-expected.txt deleted file mode 100644 index 8e39712..0000000 --- a/third_party/blink/web_tests/platform/mac/external/wpt/dom/xslt/transformToFragment.tentative.window-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -This is a testharness.js-based test. -FAIL internal script assert_true: script element from XSLTProcessor.transformToFragment() is evaluated expected true got undefined -FAIL external script assert_true: script element from XSLTProcessor.transformToFragment() is evaluated expected true got undefined -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/win/external/wpt/dom/xslt/transformToFragment.tentative.window-expected.txt b/third_party/blink/web_tests/platform/win/external/wpt/dom/xslt/transformToFragment.tentative.window-expected.txt deleted file mode 100644 index 8e39712..0000000 --- a/third_party/blink/web_tests/platform/win/external/wpt/dom/xslt/transformToFragment.tentative.window-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -This is a testharness.js-based test. -FAIL internal script assert_true: script element from XSLTProcessor.transformToFragment() is evaluated expected true got undefined -FAIL external script assert_true: script element from XSLTProcessor.transformToFragment() is evaluated expected true got undefined -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/wpt_internal/attribution-reporting/attributionsrc-request-format.sub.https.html b/third_party/blink/web_tests/wpt_internal/attribution-reporting/attributionsrc-request-format.sub.https.html index 9104c98..0697d44e 100644 --- a/third_party/blink/web_tests/wpt_internal/attribution-reporting/attributionsrc-request-format.sub.https.html +++ b/third_party/blink/web_tests/wpt_internal/attribution-reporting/attributionsrc-request-format.sub.https.html
@@ -5,6 +5,7 @@ <meta name=variant content="?method=img&eligible&expected=event-source, trigger"> <meta name=variant content="?method=open&expected=navigation-source"> <meta name=variant content="?method=script&expected=event-source, trigger"> +<meta name=variant content="?method=script&eligible&expected=event-source, trigger"> <script src="/resources/testdriver.js"></script> <script src="/resources/testdriver-vendor.js"></script> <script src="/resources/testharness.js"></script>
diff --git a/third_party/blink/web_tests/wpt_internal/css/css-anchor-position/anchor-position-001.html b/third_party/blink/web_tests/wpt_internal/css/css-anchor-position/anchor-position-001.html new file mode 100644 index 0000000..866e4aa --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/css/css-anchor-position/anchor-position-001.html
@@ -0,0 +1,50 @@ +<!DOCTYPE html> +<title>Tests `anchor` function for top/left/bottom/right properties</title> +<link rel="help" href="https://tabatkins.github.io/specs/css-anchor-position/#propdef-anchor-name"> +<link rel="author" href="mailto:kojii@chromium.org"> +<link ref="match" href="reference/anchor-position-001-ref.html"> +<style> +#container { + position: relative; +} +#a1 { + anchor-name: --a1; + background: orange; + position: absolute; + left: 100px; + top: 100px; + width: 100px; + height: 100px; +} +#a2 { + anchor-name: --a2; + background: purple; + position: absolute; + left: 500px; + top: 300px; + width: 100px; + height: 100px; +} +#target { + background: green; + position: absolute; + left: anchor(--a1 right); + top: anchor(--a1 bottom); + right: anchor(--a2 left); + bottom: anchor(--a2 top); +} +#ref { + background: red; + position: absolute; + left: 200px; + top: 200px; + width: 300px; + height: 100px; +} +</style> +<body id="container"> + <div id="a1"></div> + <div id="a2"></div> + <div id="ref"></div> + <div id="target"></div> +</body>
diff --git a/third_party/blink/web_tests/wpt_internal/css/css-anchor-position/reference/anchor-position-001-ref.html b/third_party/blink/web_tests/wpt_internal/css/css-anchor-position/reference/anchor-position-001-ref.html new file mode 100644 index 0000000..6fbb0f7 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/css/css-anchor-position/reference/anchor-position-001-ref.html
@@ -0,0 +1,37 @@ +<!DOCTYPE html> +<style> +#container { + position: relative; +} +#a1 { + anchor-name: --a1; + background: orange; + position: absolute; + left: 100px; + top: 100px; + width: 100px; + height: 100px; +} +#a2 { + anchor-name: --a2; + background: purple; + position: absolute; + left: 500px; + top: 300px; + width: 100px; + height: 100px; +} +#ref { + background: green; + position: absolute; + left: 200px; + top: 200px; + width: 300px; + height: 100px; +} +</style> +<body id="container"> + <div id="a1"></div> + <div id="a2"></div> + <div id="ref"></div> +</body>
diff --git a/third_party/blink/web_tests/wpt_internal/lazyembed/automatic-lazy-frame-loading.sub.html b/third_party/blink/web_tests/wpt_internal/lazyembed/automatic-lazy-frame-loading.sub.html index 1f1a33b0..d70288d 100644 --- a/third_party/blink/web_tests/wpt_internal/lazyembed/automatic-lazy-frame-loading.sub.html +++ b/third_party/blink/web_tests/wpt_internal/lazyembed/automatic-lazy-frame-loading.sub.html
@@ -9,19 +9,36 @@ <div id="atf_div"></div> <div style="height:1000vh;"></div> <div id="btf_div"></div> - </iframe> <script> - const loaded_ids = []; - const createFrame = (id, src) => { + let loaded_ids = []; + const _createSimpleFrame = () => { const iframe = document.createElement('iframe'); iframe.witdh = "100"; iframe.height = "100"; + return iframe; + }; + + const _setAttributes = (iframe, id, src) => { iframe.id = id; iframe.src = src; iframe.onload = () => { loaded_ids.push(id); }; - return iframe; + } + + const appendFrame = (id, src, parentElement) => { + const iframe = _createSimpleFrame(); + _setAttributes(iframe, id, src); + parentElement.appendChild(iframe); + }; + + const appendAdFrame = (id, src, parentElement) => { + const iframe = _createSimpleFrame(); + // In order to mark the frame as ad, we need to append it in advance. + parentElement.appendChild(iframe); + internals.setIsAdSubframe(iframe); + // After the ad tagging, set other attributes including src. + _setAttributes(iframe, id, src); }; const isElementLoaded = (id) => loaded_ids.includes(id); @@ -39,16 +56,49 @@ }); }; - const defaultEmbedUrl = "http://{{host}}:{{ports[http][0]}}/wpt_internal/lazyembed/resources/embed.html"; - const lazyEmbedUrl = "http://bad3p.test:{{ports[http][0]}}/wpt_internal/lazyembed/resources/embed.html"; + const defaultEmbedUrl = "http://{{host}}:{{ports[http][0]}}/" + + "/wpt_internal/lazyembed/resources/embed.html"; + const lazyEmbedUrl = "http://bad3p.test:{{ports[http][0]}}" + + "/wpt_internal/lazyembed/resources/embed.html"; + const atf = document.querySelector('#atf_div'); const btf = document.querySelector('#btf_div'); - atf.appendChild(createFrame("atf_default", defaultEmbedUrl)); - atf.appendChild(createFrame("atf_lazy", lazyEmbedUrl)); - btf.appendChild(createFrame("btf_default", defaultEmbedUrl)); - btf.appendChild(createFrame("btf_lazy", lazyEmbedUrl)); + + const appendFrames = () => { + appendFrame("atf_default", defaultEmbedUrl, atf); + appendFrame("atf_lazy", lazyEmbedUrl, atf); + appendFrame("btf_default", defaultEmbedUrl, btf); + appendFrame("btf_lazy", lazyEmbedUrl, btf); + } + + const removeIframes = () => { + document.querySelectorAll('iframe').forEach(e => e.remove()); + }; + + const cleanup = () => { + removeIframes(); + loaded_ids = []; + window.scroll({top: 0}) + } + + const wait = (t, ms, id) => { + return new Promise(resolve => { + t.step_timeout(() => { + resolve(isElementLoaded(id)); + }, ms); + }) + }; + + const waitUntilIdle = () => { + return new Promise(resolve => { + window.requestIdleCallback(() => resolve()); + }); + }; promise_test(async t => { + t.add_cleanup(cleanup); + appendFrames(); + let result; // Test above the fold iframes. result = await waitForElementLoad("atf_default"); @@ -60,12 +110,10 @@ result = await waitForElementLoad("btf_default"); assert_true(result, "iframe below the fold is successfully loaded"); - // To detect the frame src is not loaded, wait for 1 sec. - result = await new Promise(resolve => { - t.step_timeout(() => { - resolve(isElementLoaded("btf_lazy")); - }, 1000); - }); + // Test config passes 1000ms as a test param, but this test want to check + // if the frame is loaded via scrolling. To detect the frame src is still + // not loaded, just wait for 500ms. + result = await wait(t, 500, "btf_lazy"); assert_false(result, "iframe with lazy loadable url below the fold is not loaded on navigation"); // Then scroll to below the fold. @@ -75,5 +123,44 @@ result = await waitForElementLoad("btf_lazy"); assert_true(result, "iframe with lazy loadable url below the fold is loaded when close to the element"); }, "Automatic lazy frame loading"); + + promise_test(async t => { + t.add_cleanup(cleanup); + + const id = "btf_lazy" + appendFrame(id, lazyEmbedUrl, btf); + + const timeoutMs = 1000; + let result; + // To detect the frame src is not loaded, wait until the timeout. + result = await wait(t, timeoutMs, id); + assert_false(result, "iframe is not loaded yet right after the timeout"); + + await waitUntilIdle(); + result = await waitForElementLoad(id); + assert_true(result, "iframe with lazy loadable url below the fold is " + + "loaded when after the timeout and idle"); + }, "Automatic lazy frame loading with timeout"); + + promise_test(async t => { + t.add_cleanup(cleanup); + + const id = "btf_lazy" + appendAdFrame(id, lazyEmbedUrl, btf); + + // The timeout setting of LazyEmbeds. + // LazyAds timeout is set as 5000ms in VirtualTestSuites. + const timeoutMs = 1000; + let result; + // To detect the frame src is not loaded, wait until the timeout. + result = await wait(t, timeoutMs, id); + assert_false(result, "iframe is not loaded yet right after the timeout"); + + await waitUntilIdle(); + result = await waitForElementLoad(id); + assert_true( + result, "iframe is loaded after passing the LazyEmbeds timeout"); + }, "LazyEmbeds timeout is prioritized than LazyAds whtn the frame is " + + "eligible for both"); </script> </body>
diff --git a/third_party/freetype/README.chromium b/third_party/freetype/README.chromium index f6b722ba..564d049 100644 --- a/third_party/freetype/README.chromium +++ b/third_party/freetype/README.chromium
@@ -1,7 +1,7 @@ Name: FreeType URL: http://www.freetype.org/ -Version: VER-2-12-1-46-gd5d048bbf -Revision: d5d048bbfe1bcfae18fa5948284c95f89d8f33a0 +Version: VER-2-12-1-47-g8a9192f68 +Revision: 8a9192f68ef0100649502bd8fe17df7f51211521 CPEPrefix: cpe:/a:freetype:freetype:2.11.1 License: Custom license "inspired by the BSD, Artistic, and IJG (Independent JPEG Group) licenses"
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 4ab5a7b3..e70820a 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -9618,6 +9618,13 @@ <int value="3" label="[Deprecated] AUTO_LAUNCH_FOREGROUND_USELESS"/> </enum> +<enum name="AutomaticLazyFrameLoadReason"> + <int value="0" label="Not eligible"/> + <int value="1" label="Eligible for LazyEmbeds"/> + <int value="2" label="Eligible for LazyAds"/> + <int value="3" label="Eligible for both"/> +</enum> + <enum name="AutomaticLazyLoadFrameState"> <int value="0" label="Feature is not enabled"/> <int value="1" label="Target frames not found"/> @@ -31912,6 +31919,7 @@ <int value="990" label="EventPathEnabled"/> <int value="991" label="OnFileTransferEnterpriseConnector"/> <int value="992" label="ChromeRootStoreEnabled"/> + <int value="993" label="WebSQLNonSecureContextEnabled"/> </enum> <enum name="EnterprisePoliciesSources"> @@ -55237,6 +55245,7 @@ <int value="-2097895488" label="NotificationScrollBar:enabled"/> <int value="-2097515669" label="disable-cast"/> <int value="-2095519429" label="FtpProtocol:enabled"/> + <int value="-2094986558" label="AndroidMediaPickerSupport:enabled"/> <int value="-2094897448" label="TranslateIntent:disabled"/> <int value="-2093047873" label="AbusiveOriginNotificationPermissionRevocation:enabled"/> @@ -60153,6 +60162,7 @@ <int value="1047110483" label="ShelfHotseat:disabled"/> <int value="1049339770" label="AppMenuMobileSiteOption:enabled"/> <int value="1049346775" label="OmniboxDocumentProviderAso:disabled"/> + <int value="1049475027" label="AndroidMediaPickerSupport:disabled"/> <int value="1049885154" label="OfflinePagesPrefetching:disabled"/> <int value="1050048304" label="enable-font-cache-scaling"/> <int value="1050321458" label="new-profile-management"/> @@ -64087,6 +64097,12 @@ <int value="9" label="Timeout and failed"/> </enum> +<enum name="MediaPickerShown"> + <int value="0" label="Chrome Media Picker"/> + <int value="1" label="Android Media Picker"/> + <int value="2" label="None (null delegate)"/> +</enum> + <enum name="MediaPlaybackPowerTypes"> <int value="0" label="H264 360p 30fps embedded"/> <int value="1" label="VP9P0 360p 30fps embedded"/>
diff --git a/tools/metrics/histograms/metadata/android/histograms.xml b/tools/metrics/histograms/metadata/android/histograms.xml index 6a71cb1..a7cd14aa 100644 --- a/tools/metrics/histograms/metadata/android/histograms.xml +++ b/tools/metrics/histograms/metadata/android/histograms.xml
@@ -2124,6 +2124,16 @@ </summary> </histogram> +<histogram name="Android.MediaPickerShown" enum="MediaPickerShown" + expires_after="2023-06-01"> + <owner>finnur@chromium.org</owner> + <owner>peter@chromium.org</owner> + <summary> + Recorded once per batch of files uploaded, when Chrome has made the + determination of what media picker to show to the user. + </summary> +</histogram> + <histogram name="Android.MemoryPressureMonitor.GetMyMemoryState.Failed.Time" units="microseconds" expires_after="M77"> <owner>ssid@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/blink/histograms.xml b/tools/metrics/histograms/metadata/blink/histograms.xml index f031c73..021cb13 100644 --- a/tools/metrics/histograms/metadata/blink/histograms.xml +++ b/tools/metrics/histograms/metadata/blink/histograms.xml
@@ -117,6 +117,17 @@ </summary> </histogram> +<histogram name="Blink.AutomaticLazyFrameLoad.Reason" + enum="AutomaticLazyFrameLoadReason" expires_after="2022-12-18"> + <owner>sisidovski@chromium.org</owner> + <owner>chikamune@chromium.org</owner> + <owner>kouhei@chromium.org</owner> + <summary> + Records if the frame is eligible for automatic lazy-load mechanisms. This is + recorded when each frame having a url in the page is created. + </summary> +</histogram> + <histogram name="Blink.AutomaticLazyLoadFrame" enum="AutomaticLazyLoadFrameState" expires_after="2022-12-18"> <owner>sisidovski@google.com</owner> @@ -3125,7 +3136,7 @@ </histogram> <histogram name="Blink.{CookieOperation}Time.Manager{ManagerState}" units="ms" - expires_after="2022-08-09"> + expires_after="2023-08-09"> <owner>cduvall@chromium.org</owner> <owner>jam@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/ios/histograms.xml b/tools/metrics/histograms/metadata/ios/histograms.xml index 264380d..cbadb942 100644 --- a/tools/metrics/histograms/metadata/ios/histograms.xml +++ b/tools/metrics/histograms/metadata/ios/histograms.xml
@@ -64,12 +64,16 @@ <histogram name="IOS.ColdStartBackgroundTime" units="msec" expires_after="2023-04-27"> + <obsolete> + This metric is obsolete as of M105, because the max bucket did reach the + desired hour-level granularity. IOS.BackgroundTimeBeforeColdStart is the new + metric. + </obsolete> <owner>thegreenfrog@chromium.org</owner> <owner>bling-team@google.com</owner> <summary> This event is recorded on every cold start app open. The value represents - how long the app was away from the foreground. NOTE: this metric is - obsolete, IOS.BackgroundTimeBeforeColdStart is the new metric. + how long the app was away from the foreground. </summary> </histogram> @@ -1687,12 +1691,16 @@ <histogram name="IOS.WarmStartBackgroundTime" units="msec" expires_after="2023-04-27"> + <obsolete> + This metric is obsolete as of M105, because the max bucket did reach the + desired hour-level granularity. IOS.BackgroundTimeBeforeWarmStart is the new + metric. + </obsolete> <owner>thegreenfrog@chromium.org</owner> <owner>bling-team@google.com</owner> <summary> This event is recorded on every warm start app open. The value represents - how long the app was away from the foreground. NOTE: this metric is - obsolete, IOS.BackgroundTimeBeforeWarmStart is the new metric. + how long the app was away from the foreground. </summary> </histogram>
diff --git a/tools/metrics/histograms/metadata/navigation/histograms.xml b/tools/metrics/histograms/metadata/navigation/histograms.xml index 0820978..78bf9b2 100644 --- a/tools/metrics/histograms/metadata/navigation/histograms.xml +++ b/tools/metrics/histograms/metadata/navigation/histograms.xml
@@ -1193,7 +1193,7 @@ </histogram> <histogram name="Navigation.SendCommitNavigationTime.{FrameType}" units="ms" - expires_after="2022-08-15"> + expires_after="2023-08-15"> <owner>cduvall@chromium.org</owner> <owner>jam@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/page/histograms.xml b/tools/metrics/histograms/metadata/page/histograms.xml index 25f8378af..602242c 100644 --- a/tools/metrics/histograms/metadata/page/histograms.xml +++ b/tools/metrics/histograms/metadata/page/histograms.xml
@@ -1680,7 +1680,7 @@ <histogram name="PageLoad.Experimental.PageTiming.CachedResourceLoadTime.{RequestDestination}" - units="ms" expires_after="2022-10-05"> + units="ms" expires_after="2023-08-07"> <owner>cduvall@chromium.org</owner> <owner>jam@chromium.org</owner> <summary> @@ -1705,7 +1705,7 @@ <histogram name="PageLoad.Experimental.PageTiming.NavigationToFirstSubresourceLoadStart" - units="ms" expires_after="2022-08-07"> + units="ms" expires_after="2023-08-07"> <owner>cduvall@chromium.org</owner> <owner>jam@chromium.org</owner> <summary> @@ -1716,7 +1716,7 @@ <histogram name="PageLoad.Experimental.PageTiming.ResourceLoadTime.{RequestDestination}" - units="ms" expires_after="2022-10-05"> + units="ms" expires_after="2023-08-07"> <owner>cduvall@chromium.org</owner> <owner>jam@chromium.org</owner> <summary> @@ -1729,7 +1729,7 @@ <histogram name="PageLoad.Experimental.PageTiming.TotalSubresourceLoadTimeAtFirstContentfulPaint" - units="ms" expires_after="2022-08-07"> + units="ms" expires_after="2023-08-07"> <owner>cduvall@chromium.org</owner> <owner>jam@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/security/histograms.xml b/tools/metrics/histograms/metadata/security/histograms.xml index 79a5759d..46d95d0 100644 --- a/tools/metrics/histograms/metadata/security/histograms.xml +++ b/tools/metrics/histograms/metadata/security/histograms.xml
@@ -536,7 +536,7 @@ </histogram> <histogram name="Security.SecurityLevel.FormSubmission" enum="SecurityLevel" - expires_after="2022-06-30"> + expires_after="2023-06-30"> <owner>carlosil@chromium.org</owner> <owner>cthomp@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/windows/histograms.xml b/tools/metrics/histograms/metadata/windows/histograms.xml index 6ca0315b..aac6f6a 100644 --- a/tools/metrics/histograms/metadata/windows/histograms.xml +++ b/tools/metrics/histograms/metadata/windows/histograms.xml
@@ -67,6 +67,23 @@ </summary> </histogram> +<histogram name="Windows.DragEventsAfterPress" units="events" + expires_after="2023-01-01"> + <owner>davidbienvenu@chromium.org</owner> + <owner>jessemckenna@google.com</owner> + <summary> + The number of drag events after a press event before we got a mouse move to + 0, 0 that is more than 200 pixels away from the current cursor position. + This will be used to change the detection of spurious 0,0 move move events + to a much smaller value (e.g., 20 pixels) but with the addition of a check + that we've only received a few mouse move events, once we've determined the + distribution of the number of drag events we receive before the 0,0 mouse + move events. Recorded in HWNDMessageHandler::HandleMouseEventInternal when + we see a mouse drag to 0,0 that is more than 200 pixels from the cursor + position. + </summary> +</histogram> + <histogram name="Windows.FileDeleteRetryCount" units="attempts" expires_after="2022-12-18"> <owner>grt@chromium.org</owner>
diff --git a/tools/perf/benchmarks/benchmark_unittest.py b/tools/perf/benchmarks/benchmark_unittest.py index 1d98c76a..a7d3ad8 100644 --- a/tools/perf/benchmarks/benchmark_unittest.py +++ b/tools/perf/benchmarks/benchmark_unittest.py
@@ -43,9 +43,10 @@ for b in all_benchmarks: names_to_benchmarks[b.Name()].append(b) for n in names_to_benchmarks: - self.assertEquals(1, len(names_to_benchmarks[n]), - 'Multiple benchmarks with the same name %s are ' - 'found: %s' % (n, str(names_to_benchmarks[n]))) + self.assertEqual( + 1, len(names_to_benchmarks[n]), + 'Multiple benchmarks with the same name %s are ' + 'found: %s' % (n, str(names_to_benchmarks[n]))) class TestBenchmarkNamingMobile(unittest.TestCase): @@ -74,11 +75,11 @@ def runTest(self): all_benchmarks = _GetAllPerfBenchmarks() for benchmark in all_benchmarks: - self.assertEquals(True, issubclass(benchmark, - perf_benchmark.PerfBenchmark), - 'Benchmark %s needs to subclass from PerfBenchmark' - % benchmark.Name()) - self.assertEquals( + self.assertEqual( + True, issubclass(benchmark, perf_benchmark.PerfBenchmark), + 'Benchmark %s needs to subclass from PerfBenchmark' % + benchmark.Name()) + self.assertEqual( benchmark.CustomizeOptions, perf_benchmark.PerfBenchmark.CustomizeOptions, 'Benchmark %s should not override CustomizeOptions' %
diff --git a/tools/perf/benchmarks/blink_perf_unittest.py b/tools/perf/benchmarks/blink_perf_unittest.py index 6ebda287..84887044 100644 --- a/tools/perf/benchmarks/blink_perf_unittest.py +++ b/tools/perf/benchmarks/blink_perf_unittest.py
@@ -55,12 +55,12 @@ frame_view_layouts = measurements['LocalFrameView::layout']['samples'] # append-child-measure-time.html specifies 5 iterationCount. - self.assertEquals(len(frame_view_layouts), 5) + self.assertEqual(len(frame_view_layouts), 5) self.assertGreater(_Mean(frame_view_layouts), 0.001) update_layout_trees = measurements['UpdateLayoutTree']['samples'] # append-child-measure-time.html specifies 5 iterationCount. - self.assertEquals(len(update_layout_trees), 5) + self.assertEqual(len(update_layout_trees), 5) self.assertGreater(_Mean(update_layout_trees), 0.001) @decorators.Disabled('chromeos') # Flaky: https://crbug.com/1284873 @@ -73,13 +73,13 @@ 'LocalFrameView::RunPrePaintLifecyclePhase']['samples'] # color-changes-measure-frame-time.html specifies 10 iterationCount. - self.assertEquals(len(frame_view_prepaints), 10) + self.assertEqual(len(frame_view_prepaints), 10) self.assertGreater(_Mean(frame_view_prepaints), 0.001) frame_view_painttrees = measurements[ 'LocalFrameView::RunPaintLifecyclePhase']['samples'] # color-changes-measure-frame-time.html specifies 10 iterationCount. - self.assertEquals(len(frame_view_painttrees), 10) + self.assertEqual(len(frame_view_painttrees), 10) self.assertGreater(_Mean(frame_view_painttrees), 0.001) @decorators.Disabled('linux', @@ -92,13 +92,13 @@ create_child_frame = measurements[ 'WebLocalFrameImpl::createChildframe']['samples'] # color-changes-measure-frame-time.html specifies 7 iterationCount. - self.assertEquals(len(create_child_frame), 7) + self.assertEqual(len(create_child_frame), 7) self.assertGreater(_Mean(create_child_frame), 0.001) post_layout_task = measurements[ 'LocalFrameView::performPostLayoutTasks']['samples'] # color-changes-measure-frame-time.html specifies 7 iterationCount. - self.assertEquals(len(post_layout_task), 7) + self.assertEqual(len(post_layout_task), 7) self.assertGreater(_Mean(post_layout_task), 0.001) @decorators.Disabled('mac', # Flaky on mac: crbug.com/960554 @@ -111,24 +111,24 @@ blob_requests = measurements['BlobRequest']['samples'] blob_readers = measurements['BlobReader']['samples'] # simple-blob-measure-async.html specifies 6 iterationCount. - self.assertEquals(len(blob_requests), 6) - self.assertEquals(len(blob_readers), 6) + self.assertEqual(len(blob_requests), 6) + self.assertEqual(len(blob_readers), 6) # TODO(mek): Delete non-mojo code paths when blobs are always using mojo. using_mojo = _Mean(blob_readers) > 0.001 if using_mojo: - self.assertEquals(_Mean(blob_requests), 0) + self.assertEqual(_Mean(blob_requests), 0) self.assertGreater(_Mean(blob_readers), 0.001) else: self.assertGreater(_Mean(blob_requests), 0.001) - self.assertEquals(_Mean(blob_readers), 0) + self.assertEqual(_Mean(blob_readers), 0) if using_mojo: read_data = measurements['BlobReader::ReadMore']['samples'] else: read_data = measurements['BlobRequest::ReadRawData']['samples'] # simple-blob-measure-async.html specifies 6 iterationCount. - self.assertEquals(len(read_data), 6) + self.assertEqual(len(read_data), 6) self.assertGreater(_Mean(read_data), 0.001) def testBlinkPerfLifecycleMethods(self): @@ -186,10 +186,13 @@ renderer_main.BeginSlice('blink', 'baz', 500, 520) renderer_main.EndSlice(600, 590) - self.assertEquals( + self.assertEqual( blink_perf._ComputeTraceEventsThreadTimeForBlinkPerf( - model, renderer_main, ['foo', 'bar', 'baz']), - {'foo': [15], 'bar': [18], 'baz': [35]}) + model, renderer_main, ['foo', 'bar', 'baz']), { + 'foo': [15], + 'bar': [18], + 'baz': [35] + }) def testTraceEventMetricsMultiBlinkTest(self): model = model_module.TimelineModel() @@ -220,10 +223,13 @@ renderer_main.BeginSlice('blink', 'foo', 500, 520) renderer_main.EndSlice(600, 560) - self.assertEquals( + self.assertEqual( blink_perf._ComputeTraceEventsThreadTimeForBlinkPerf( - model, renderer_main, ['foo', 'bar', 'baz']), - {'foo': [15, 32], 'bar': [18, 0], 'baz': [0, 0]}) + model, renderer_main, ['foo', 'bar', 'baz']), { + 'foo': [15, 32], + 'bar': [18, 0], + 'baz': [0, 0] + }) def testTraceEventMetricsNoThreadTimeAvailable(self): model = model_module.TimelineModel() @@ -246,10 +252,12 @@ renderer_main.BeginSlice('blink', 'bar', 400) renderer_main.EndSlice(420) - self.assertEquals( + self.assertEqual( blink_perf._ComputeTraceEventsThreadTimeForBlinkPerf( - model, renderer_main, ['foo', 'bar']), - {'foo': [20], 'bar': [20]}) + model, renderer_main, ['foo', 'bar']), { + 'foo': [20], + 'bar': [20] + }) def testTraceEventMetricsMultiBlinkTestCrossProcesses(self): model = model_module.TimelineModel() @@ -285,10 +293,13 @@ foo_thread.BeginSlice('blink', 'foo', 500, 520) foo_thread.EndSlice(600, 560) - self.assertEquals( + self.assertEqual( blink_perf._ComputeTraceEventsThreadTimeForBlinkPerf( - model, renderer_main, ['foo', 'bar', 'baz']), - {'foo': [15, 32], 'bar': [20, 0], 'baz': [0, 0]}) + model, renderer_main, ['foo', 'bar', 'baz']), { + 'foo': [15, 32], + 'bar': [20, 0], + 'baz': [0, 0] + }) def testTraceEventMetricsNoDoubleCountingBasic(self): model = model_module.TimelineModel() @@ -318,7 +329,7 @@ renderer_main.BeginSlice('blink', 'foo', 440, 455) renderer_main.EndSlice(510, 505) - self.assertEquals( + self.assertEqual( blink_perf._ComputeTraceEventsThreadTimeForBlinkPerf( model, renderer_main, ['foo']), {'foo': [330]}) @@ -353,10 +364,12 @@ renderer_main.EndSlice(510, 510) renderer_main.EndSlice(510, 505) - self.assertEquals( + self.assertEqual( blink_perf._ComputeTraceEventsThreadTimeForBlinkPerf( - model, renderer_main, ['foo', 'bar']), - {'foo': [300], 'bar': [320]}) + model, renderer_main, ['foo', 'bar']), { + 'foo': [300], + 'bar': [320] + }) def testAsyncTraceEventMetricsOverlapping(self): model = model_module.TimelineModel() @@ -377,10 +390,12 @@ self._AddAsyncSlice(renderer_main, 'blink', 'foo', 120, 140) self._AddAsyncSlice(renderer_main, 'blink', 'bar', 400, 420) - self.assertEquals( + self.assertEqual( blink_perf._ComputeTraceEventsThreadTimeForBlinkPerf( - model, renderer_main, ['foo', 'bar']), - {'foo': [30], 'bar': [20]}) + model, renderer_main, ['foo', 'bar']), { + 'foo': [30], + 'bar': [20] + }) def testAsyncTraceEventMetricsMultipleTests(self): model = model_module.TimelineModel() @@ -403,7 +418,9 @@ self._AddAsyncSlice(renderer_main, 'blink', 'foo', 80, 500) self._AddAsyncSlice(renderer_main, 'blink', 'bar', 90, 510) - self.assertEquals( + self.assertEqual( blink_perf._ComputeTraceEventsThreadTimeForBlinkPerf( - model, renderer_main, ['foo', 'bar']), - {'foo': [100, 100], 'bar': [100, 100]}) + model, renderer_main, ['foo', 'bar']), { + 'foo': [100, 100], + 'bar': [100, 100] + })
diff --git a/tools/perf/benchmarks/smoketests_versions_validator_unittest.py b/tools/perf/benchmarks/smoketests_versions_validator_unittest.py index b2466172..d2f153e 100644 --- a/tools/perf/benchmarks/smoketests_versions_validator_unittest.py +++ b/tools/perf/benchmarks/smoketests_versions_validator_unittest.py
@@ -16,8 +16,7 @@ 'a:2018', 'b:2018']) stories = system_health_smoke_test.find_multi_version_stories( all_stories, disabled_stories) - self.assertEquals(0, len(stories), - "Should be no result from version check") + self.assertEqual(0, len(stories), "Should be no result from version check") def test_version_check_multi_colon_prefix_with_version(self): all_stories = [ @@ -25,8 +24,7 @@ disabled_stories = frozenset(['story:name:a:2018']) stories = system_health_smoke_test.find_multi_version_stories( all_stories, disabled_stories) - self.assertEquals(0, len(stories), - "Should be no result from version check") + self.assertEqual(0, len(stories), "Should be no result from version check") def test_version_check_multi_colon_prefix_without_version(self): all_stories = [ @@ -34,16 +32,14 @@ disabled_stories = frozenset(['story:name:a:2019']) stories = system_health_smoke_test.find_multi_version_stories( all_stories, disabled_stories) - self.assertEquals(0, len(stories), - "Should be no result from version check") + self.assertEqual(0, len(stories), "Should be no result from version check") def test_version_check_fail_without_version(self): all_stories = ['a', 'a:2019', 'b:2019'] disabled_stories = frozenset(['x']) stories = system_health_smoke_test.find_multi_version_stories( all_stories, disabled_stories) - self.assertEquals(1, len(stories), - 'Expecting 1 item in stories.') + self.assertEqual(1, len(stories), 'Expecting 1 item in stories.') self.assertIn('a', stories) self.assertIn('a', stories['a']) self.assertIn('a:2019', stories['a']) @@ -53,8 +49,7 @@ disabled_stories = frozenset(['a']) stories = system_health_smoke_test.find_multi_version_stories( all_stories, disabled_stories) - self.assertEquals(1, len(stories), - 'Expecting 1 item in stories.') + self.assertEqual(1, len(stories), 'Expecting 1 item in stories.') self.assertIn('a', stories) self.assertIn('a:2018', stories['a']) self.assertIn('a:2019', stories['a']) @@ -64,8 +59,7 @@ disabled_stories = frozenset(['x']) stories = system_health_smoke_test.find_multi_version_stories( all_stories, disabled_stories) - self.assertEquals(2, len(stories), - 'Expecting 2 item in stories.') + self.assertEqual(2, len(stories), 'Expecting 2 item in stories.') self.assertIn('a', stories) self.assertIn('a', stories['a']) self.assertIn('a:2019', stories['a'])
diff --git a/tools/perf/benchmarks/startup_mobile.py b/tools/perf/benchmarks/startup_mobile.py index 4e2b1f1..c15c812 100644 --- a/tools/perf/benchmarks/startup_mobile.py +++ b/tools/perf/benchmarks/startup_mobile.py
@@ -210,12 +210,12 @@ return True -def _DriveMobileStartupWithIntent(state, flush_caches): - for _ in range(state.number_of_iterations): +def _DriveMobileStartupWithIntent(shared_state, flush_caches): + for _ in range(shared_state.number_of_iterations): # TODO(pasko): Find a way to fail the benchmark when WPR is set up # incorrectly and error pages get loaded. - state.LaunchBrowser('http://bbc.co.uk', flush_caches) - with state.FindBrowser() as browser: + shared_state.LaunchBrowser('http://bbc.co.uk', flush_caches) + with shared_state.FindBrowser() as browser: action_runner = browser.foreground_tab.action_runner action_runner.tab.WaitForDocumentReadyStateToBeComplete() @@ -225,8 +225,8 @@ super(_MobileStartupWithIntentStory, self).__init__( _MobileStartupSharedState, name='intent:coldish:bbc') - def Run(self, state): - _DriveMobileStartupWithIntent(state, flush_caches=True) + def Run(self, shared_state): + _DriveMobileStartupWithIntent(shared_state, flush_caches=True) class _MobileStartupWithIntentStoryWarm(story_module.Story): @@ -234,8 +234,8 @@ super(_MobileStartupWithIntentStoryWarm, self).__init__( _MobileStartupSharedState, name='intent:warm:bbc') - def Run(self, state): - _DriveMobileStartupWithIntent(state, flush_caches=False) + def Run(self, shared_state): + _DriveMobileStartupWithIntent(shared_state, flush_caches=False) class _MobileStartupWithCctIntentStory(story_module.Story): @@ -243,10 +243,10 @@ super(_MobileStartupWithCctIntentStory, self).__init__( _MobileStartupSharedState, name='cct:coldish:bbc') - def Run(self, state): - for _ in range(state.number_of_iterations): - state.LaunchCCT('http://bbc.co.uk') - with state.FindBrowser() as browser: + def Run(self, shared_state): + for _ in range(shared_state.number_of_iterations): + shared_state.LaunchCCT('http://bbc.co.uk') + with shared_state.FindBrowser() as browser: action_runner = browser.foreground_tab.action_runner action_runner.tab.WaitForDocumentReadyStateToBeComplete() @@ -256,11 +256,11 @@ super(_MapsPwaStartupStory, self).__init__( _MobileStartupSharedState, name='maps_pwa:with_http_cache') - def Run(self, state): - for _ in range(state.number_of_iterations): + def Run(self, shared_state): + for _ in range(shared_state.number_of_iterations): # TODO(pasko): Flush HTTP cache for 'maps_pwa:no_http_cache'. - state.LaunchMapsPwa() - with state.FindBrowser() as browser: + shared_state.LaunchMapsPwa() + with shared_state.FindBrowser() as browser: action_runner = browser.foreground_tab.action_runner action_runner.tab.WaitForDocumentReadyStateToBeComplete()
diff --git a/tools/perf/benchmarks/system_health_unittest.py b/tools/perf/benchmarks/system_health_unittest.py index 8ce6900..b27f2e9c 100644 --- a/tools/perf/benchmarks/system_health_unittest.py +++ b/tools/perf/benchmarks/system_health_unittest.py
@@ -59,7 +59,8 @@ # so they explicitly override RunPageInteractions method. if s.name.startswith('long_running:'): continue - self.assertEquals(s.__class__.RunPageInteractions, + self.assertEqual( + s.__class__.RunPageInteractions, system_health_story.SystemHealthStory.RunPageInteractions, 'Story %s overrides RunPageInteractions. Override _DidLoadDocument ' 'instead' % s.name)
diff --git a/tools/perf/contrib/cluster_telemetry/ct_benchmarks_unittest.py b/tools/perf/contrib/cluster_telemetry/ct_benchmarks_unittest.py index 2e89b9aa..253422e 100644 --- a/tools/perf/contrib/cluster_telemetry/ct_benchmarks_unittest.py +++ b/tools/perf/contrib/cluster_telemetry/ct_benchmarks_unittest.py
@@ -45,17 +45,14 @@ benchmark.ProcessCommandLineArgs(None, parser) ct_page_set = benchmark.CreateStorySet(parser) - self.assertEquals( - len(self.urls_list.split(',')), len(ct_page_set.stories)) - self.assertEquals( - self.archive_data_file, ct_page_set.archive_data_file) + self.assertEqual(len(self.urls_list.split(',')), len(ct_page_set.stories)) + self.assertEqual(self.archive_data_file, ct_page_set.archive_data_file) for i in range(len(self.urls_list.split(','))): url = self.urls_list.split(',')[i] story = ct_page_set.stories[i] - self.assertEquals(url, story.url) - self.assertEquals( - self.shared_page_state_class, story.shared_state_class) - self.assertEquals(self.archive_data_file, story.archive_data_file) + self.assertEqual(url, story.url) + self.assertEqual(self.shared_page_state_class, story.shared_state_class) + self.assertEqual(self.archive_data_file, story.archive_data_file) def testCTBenchmarks_wrongAgent(self): for benchmark in self.ct_benchmarks: @@ -70,7 +67,7 @@ benchmark.CreateStorySet(parser) self.fail('Expected ValueError') except ValueError as e: - self.assertEquals('user_agent mobileeeeee is unrecognized', str(e)) + self.assertEqual('user_agent mobileeeeee is unrecognized', str(e)) def testCTBenchmarks_missingDataFile(self): for benchmark in self.ct_benchmarks: @@ -93,13 +90,13 @@ expected_error = ( "'OptionParser' object has no attribute 'archive_data_file'") actual_error = str(e) - self.assertEquals(actual_error, expected_error) + self.assertEqual(actual_error, expected_error) # Now add an empty archive_data_file. parser.archive_data_file = '' benchmark.ProcessCommandLineArgs(self.mock_parser, parser) - self.assertEquals( - 'Please specify --archive-data-file.', self.mock_parser.err_msg) + self.assertEqual('Please specify --archive-data-file.', + self.mock_parser.err_msg) def testCTBenchmarks_missingDataFileUseLiveSites(self): for benchmark in self.ct_benchmarks: @@ -127,13 +124,13 @@ self.fail('Expected AttributeError') except AttributeError as e: if six.PY2: - self.assertEquals( - "OptionParser instance has no attribute 'urls_list'", str(e)) + self.assertEqual("OptionParser instance has no attribute 'urls_list'", + str(e)) else: - self.assertEquals( - "'OptionParser' object has no attribute 'urls_list'", str(e)) + self.assertEqual("'OptionParser' object has no attribute 'urls_list'", + str(e)) # Now add an empty urls_list. parser.urls_list = '' benchmark.ProcessCommandLineArgs(self.mock_parser, parser) - self.assertEquals('Please specify --urls-list.', self.mock_parser.err_msg) + self.assertEqual('Please specify --urls-list.', self.mock_parser.err_msg)
diff --git a/tools/perf/contrib/leak_detection/leak_detection.py b/tools/perf/contrib/leak_detection/leak_detection.py index 95b88b7..e55c0ca5 100644 --- a/tools/perf/contrib/leak_detection/leak_detection.py +++ b/tools/perf/contrib/leak_detection/leak_detection.py
@@ -24,11 +24,12 @@ tbm_options.AddTimelineBasedMetric('leakDetectionMetric') return tbm_options - def CustomizeOptions(self, options, possible_browser=None): + def CustomizeOptions(self, finder_options, possible_browser=None): # TODO(crbug.com/936805): Note this is a hack. Perf benchmarks should not # override the CustomizeOptions method. - options.browser_options.AppendExtraBrowserArgs('--js-flags=--expose-gc') - options.browser_options.AppendExtraBrowserArgs('--disable-perfetto') + finder_options.browser_options.AppendExtraBrowserArgs( + '--js-flags=--expose-gc') + finder_options.browser_options.AppendExtraBrowserArgs('--disable-perfetto') def CustomizeBrowserOptions(self, _): # TODO(crbug.com/936805): Note this is a hack. Perf benchmarks should not
diff --git a/tools/perf/contrib/vr_benchmarks/shared_vr_page_state.py b/tools/perf/contrib/vr_benchmarks/shared_vr_page_state.py index ec2ff8d..9d5c84f5 100644 --- a/tools/perf/contrib/vr_benchmarks/shared_vr_page_state.py +++ b/tools/perf/contrib/vr_benchmarks/shared_vr_page_state.py
@@ -162,8 +162,8 @@ 'gvr-android-sdk', 'test-apks', 'vr_keyboard', 'vr_keyboard_current.apk')) - def WillRunStory(self, page): - super(AndroidSharedVrPageState, self).WillRunStory(page) + def WillRunStory(self, story): + super(AndroidSharedVrPageState, self).WillRunStory(story) if not self._finder_options.disable_screen_reset: self._CycleScreen() @@ -230,8 +230,8 @@ self._finder_options, self._possible_browser) self._desktop_runtime.Setup() - def WillRunStory(self, page): - super(WindowsSharedVrPageState, self).WillRunStory(page) + def WillRunStory(self, story): + super(WindowsSharedVrPageState, self).WillRunStory(story) self._desktop_runtime.WillRunStory() def TearDownState(self):
diff --git a/tools/perf/core/benchmark_finders_unittest.py b/tools/perf/core/benchmark_finders_unittest.py index c1efeeeb..9a98976 100644 --- a/tools/perf/core/benchmark_finders_unittest.py +++ b/tools/perf/core/benchmark_finders_unittest.py
@@ -15,22 +15,20 @@ os.path.join(os.path.dirname(__file__), 'test_data')) def testListSimpleBenchmarksDefinedInOneFile(self): - self.assertEquals( + self.assertEqual( benchmark_finders.GetBenchmarkNamesForFile( self.top_level_dir, - os.path.join( - self.top_level_dir, - 'simple_benchmarks_case.py')), - ['test_benchmark_1', 'test_benchmark_2', 'test_benchmark_subclass_1', - 'test_benchmark_subclass_2']) + os.path.join(self.top_level_dir, 'simple_benchmarks_case.py')), [ + 'test_benchmark_1', 'test_benchmark_2', + 'test_benchmark_subclass_1', 'test_benchmark_subclass_2' + ]) @decorators.Disabled('all') # http://crbug.com/637938 def testListSimpleBenchmarksDefinedInOneFileComplex(self): - self.assertEquals( + self.assertEqual( benchmark_finders.GetBenchmarkNamesForFile( self.top_level_dir, - os.path.join( - self.top_level_dir, - 'complex_benchmarks_case.py')), - ['test_benchmark_complex_1', 'test_benchmark_complex_subclass', - 'test_benchmark_complex_subclass_from_other_module']) + os.path.join(self.top_level_dir, 'complex_benchmarks_case.py')), [ + 'test_benchmark_complex_1', 'test_benchmark_complex_subclass', + 'test_benchmark_complex_subclass_from_other_module' + ])
diff --git a/tools/perf/core/benchmark_utils_unittest.py b/tools/perf/core/benchmark_utils_unittest.py index a288dc5..31506a05 100644 --- a/tools/perf/core/benchmark_utils_unittest.py +++ b/tools/perf/core/benchmark_utils_unittest.py
@@ -25,4 +25,4 @@ def testGetBenchmarkStoryNamesOrdering(self): story_names = benchmark_utils.GetBenchmarkStoryNames( ThousandAndOneStoriesBenchmark()) - self.assertEquals(story_names, ['story-number-%i' % i for i in range(1001)]) + self.assertEqual(story_names, ['story-number-%i' % i for i in range(1001)])
diff --git a/tools/perf/core/find_dependencies_unittest.py b/tools/perf/core/find_dependencies_unittest.py index f3377362..079c20f 100644 --- a/tools/perf/core/find_dependencies_unittest.py +++ b/tools/perf/core/find_dependencies_unittest.py
@@ -25,7 +25,7 @@ cat_object_path = os.path.join(cat_module_path, 'cat_object.py') dependencies = set( p for p in find_dependencies.FindPythonDependencies(dog_object_path)) - self.assertEquals(dependencies, { + self.assertEqual(dependencies, { dog_object_path, cat_module_path, cat_module_init_path, cat_object_path }) @@ -42,10 +42,11 @@ horn_module_path = os.path.join(moose_module_path, 'horn') horn_module_init_path = os.path.join(horn_module_path, '__init__.py') horn_object_path = os.path.join(horn_module_path, 'horn_object.py') - self.assertEquals( - set(p for p in - find_dependencies.FindPythonDependencies(moose_object_path)), - {moose_object_path, - horn_module_path, horn_module_init_path, horn_object_path}) + self.assertEqual( + set(p for p in find_dependencies.FindPythonDependencies( + moose_object_path)), { + moose_object_path, horn_module_path, horn_module_init_path, + horn_object_path + }) except ImportError: # crbug.com/559527 pass
diff --git a/tools/perf/core/minidump_unittest.py b/tools/perf/core/minidump_unittest.py index 61f51f20..f95124e 100644 --- a/tools/perf/core/minidump_unittest.py +++ b/tools/perf/core/minidump_unittest.py
@@ -130,7 +130,7 @@ # information if this is hit on the bots. if len(all_paths) != 1: self._browser.CollectDebugData(logging.ERROR) - self.assertEquals(len(all_paths), 1) + self.assertEqual(len(all_paths), 1) self.assertEqual(all_paths[0], first_crash_path) all_unsymbolized_paths = self._browser.GetAllUnsymbolizedMinidumpPaths() self.assertTrue(len(all_unsymbolized_paths) == 1) @@ -166,7 +166,7 @@ if second_crash_all_unsymbolized_paths is not None: logging.info('testMultipleCrashMinidumps: second crash all unsymbolized ' 'paths: ' + ''.join(second_crash_all_unsymbolized_paths)) - self.assertEquals(len(second_crash_all_paths), 2) + self.assertEqual(len(second_crash_all_paths), 2) # Check that both paths are now present and unsymbolized self.assertTrue(first_crash_path in second_crash_all_paths) self.assertTrue(second_crash_path in second_crash_all_paths) @@ -183,15 +183,14 @@ if after_symbolize_all_paths is not None: logging.info('testMultipleCrashMinidumps: after symbolize all paths: ' + ''.join(after_symbolize_all_paths)) - self.assertEquals(len(after_symbolize_all_paths), 2) + self.assertEqual(len(after_symbolize_all_paths), 2) after_symbolize_all_unsymbolized_paths = \ self._browser.GetAllUnsymbolizedMinidumpPaths() if after_symbolize_all_unsymbolized_paths is not None: logging.info('testMultipleCrashMinidumps: after symbolize all ' + 'unsymbolized paths: ' + ''.join(after_symbolize_all_unsymbolized_paths)) - self.assertEquals(after_symbolize_all_unsymbolized_paths, - [first_crash_path]) + self.assertEqual(after_symbolize_all_unsymbolized_paths, [first_crash_path]) # Explicitly ignore the remaining minidump so that it isn't detected during # teardown by the test runner.
diff --git a/tools/perf/core/path_util_unittest.py b/tools/perf/core/path_util_unittest.py index dd92f01..a81db31 100644 --- a/tools/perf/core/path_util_unittest.py +++ b/tools/perf/core/path_util_unittest.py
@@ -16,5 +16,5 @@ sys_path_within_context = list(sys.path) sys_path_after = list(sys.path) - self.assertEquals(sys_path_before, sys_path_after) - self.assertEquals(sys_path_before + ['_test_dir'], sys_path_within_context) + self.assertEqual(sys_path_before, sys_path_after) + self.assertEqual(sys_path_before + ['_test_dir'], sys_path_within_context)
diff --git a/tools/perf/core/perf_data_generator_unittest.py b/tools/perf/core/perf_data_generator_unittest.py index b944fc1..9804abb9 100644 --- a/tools/perf/core/perf_data_generator_unittest.py +++ b/tools/perf/core/perf_data_generator_unittest.py
@@ -26,7 +26,7 @@ class PerfDataGeneratorTest(unittest.TestCase): def setUp(self): # Test config can be big, so set maxDiff to None to see the full comparision - # diff when assertEquals fails. + # diff when assertEqual fails. self.maxDiff = None def test_get_scheduled_non_telemetry_benchmarks(self): @@ -94,8 +94,8 @@ valid = perf_data_generator.is_perf_benchmarks_scheduling_valid( 'dummy', self.test_stream) - self.assertEquals(self.test_stream.getvalue(), '') - self.assertEquals(valid, True) + self.assertEqual(self.test_stream.getvalue(), '') + self.assertEqual(valid, True) def test_UnscheduledCppBenchmarks(self): self.get_non_telemetry_benchmarks.return_value = {'honda'} @@ -108,7 +108,7 @@ valid = perf_data_generator.is_perf_benchmarks_scheduling_valid( 'dummy', self.test_stream) - self.assertEquals(valid, False) + self.assertEqual(valid, False) self.assertIn('Benchmark toyota is tracked but not scheduled', self.test_stream.getvalue()) @@ -122,7 +122,7 @@ valid = perf_data_generator.is_perf_benchmarks_scheduling_valid( 'dummy', self.test_stream) - self.assertEquals(valid, False) + self.assertEqual(valid, False) self.assertIn( 'Benchmark tesla is scheduled on perf waterfall but not tracked', self.test_stream.getvalue())
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index e1e1bab..fae3c5f 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -5,24 +5,24 @@ "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux_arm64/49b4b5dcbc312d8d2c3751cf29238b8efeb4e494/trace_processor_shell" }, "win": { - "hash": "c2034168e4a9eef267eaeff968d7098bf272c7cf", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/3c4bdd0f331990d7fae52ae52f56f5762614cc33/trace_processor_shell.exe" + "hash": "6a60287982c53d9a6f658dba9b30925fc64e9108", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/a9181a27b59a2e431c946d91cfcd33b7ae6a2b80/trace_processor_shell.exe" }, "linux_arm": { "hash": "58893933be305d3bfe0a72ebebcacde2ac3ca893", "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux_arm/49b4b5dcbc312d8d2c3751cf29238b8efeb4e494/trace_processor_shell" }, "mac": { - "hash": "ea39ef671b3c4df3b9ec3ee56a9e1b82e0bc0d3a", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/84a3c77dcdf0c06d4b077a41e494a39024320b3a/trace_processor_shell" + "hash": "b703de4b0c4254a2f20eca3d6226af3f7de8ba00", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/3c4bdd0f331990d7fae52ae52f56f5762614cc33/trace_processor_shell" }, "mac_arm64": { "hash": "e1ad4861384b06d911a65f035317914b8cc975c6", "full_remote_path": "perfetto-luci-artifacts/v25.0/mac-arm64/trace_processor_shell" }, "linux": { - "hash": "fe1ec6d9316a0b6b959acfcdc11cfbfb70267e7f", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/acc008eff9c38f106b21ee30f6fac8741cb77878/trace_processor_shell" + "hash": "3dcbf036a1a9b47a0f80716f0c1adde728b084cb", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/f56e4abd18a85f6719dcff6fcdc305673d0f3f4e/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/tools/perf/core/results_dashboard.py b/tools/perf/core/results_dashboard.py index 04566ed..dda44c6 100755 --- a/tools/perf/core/results_dashboard.py +++ b/tools/perf/core/results_dashboard.py
@@ -358,7 +358,7 @@ # branch in the chromium/src repo. revision_supplemental_columns[prefix + 'commit_pos'] = revision except ValueError: - logging.warn('Revision has non-integer value: "%s".', data['rev']) + logging.warning('Revision has non-integer value: "%s".', data['rev']) # The dashboard requires ordered integer revision numbers. If the revision # is not an integer or None, assume it's a git hash and send a timestamp. revision = _GetTimestamp() @@ -492,9 +492,9 @@ try: token = json.loads(content).get('token') if not token: - logging.warn( + logging.warning( 'Error fetching upload completion token: Badly formatted token dict.') else: logging.info('Upload completion token created. Token id: %s' % token) except Exception as e: # pylint: disable=broad-except - logging.warn('Error fetching upload completion token: %s' % e) + logging.warning('Error fetching upload completion token: %s' % e)
diff --git a/tools/perf/core/sharding_map_generator_unittest.py b/tools/perf/core/sharding_map_generator_unittest.py index 5506582..28518e82 100644 --- a/tools/perf/core/sharding_map_generator_unittest.py +++ b/tools/perf/core/sharding_map_generator_unittest.py
@@ -70,15 +70,21 @@ ] sharding_map = sharding_map_generator.generate_sharding_map( benchmarks_data, timing_data, 3, None) - self.assertEquals( - sharding_map['0']['benchmarks'], - collections.OrderedDict([('a_benchmark', {'abridged': False})])) - self.assertEquals( - sharding_map['1']['benchmarks'], - collections.OrderedDict([('b_benchmark', {'abridged': False})])) - self.assertEquals( - sharding_map['2']['benchmarks'], - collections.OrderedDict([('c_benchmark', {'abridged': False})])) + self.assertEqual( + sharding_map['0']['benchmarks'], + collections.OrderedDict([('a_benchmark', { + 'abridged': False + })])) + self.assertEqual( + sharding_map['1']['benchmarks'], + collections.OrderedDict([('b_benchmark', { + 'abridged': False + })])) + self.assertEqual( + sharding_map['2']['benchmarks'], + collections.OrderedDict([('c_benchmark', { + 'abridged': False + })])) def testGeneratePerfSharding(self): test_data_dir = os.path.join(os.path.dirname(__file__), 'test_data')
diff --git a/tools/perf/core/tbmv3/trace_processor.py b/tools/perf/core/tbmv3/trace_processor.py index 717d452e..0bcaa2b2 100644 --- a/tools/perf/core/tbmv3/trace_processor.py +++ b/tools/perf/core/tbmv3/trace_processor.py
@@ -331,7 +331,7 @@ annotations = root_annotations.get(full_metric_name, None) metric_proto = measurements.get(full_metric_name, None) if metric_proto is None: - logging.warn("Metric not found in the output: %s", metric_name) + logging.warning("Metric not found in the output: %s", metric_name) continue elif annotations is None: logging.info("Skipping metric %s because it has no field with unit.",
diff --git a/tools/perf/measurements/skpicture_printer_unittest.py b/tools/perf/measurements/skpicture_printer_unittest.py index 8f01445e..01baeeb 100644 --- a/tools/perf/measurements/skpicture_printer_unittest.py +++ b/tools/perf/measurements/skpicture_printer_unittest.py
@@ -15,5 +15,5 @@ page_test = skpicture_printer.SkpicturePrinter(self.options.output_dir) measurements = self.RunPageTest(page_test, 'file://blank.html') saved_picture_count = measurements['saved_picture_count']['samples'] - self.assertEquals(len(saved_picture_count), 1) + self.assertEqual(len(saved_picture_count), 1) self.assertGreater(saved_picture_count[0], 0)
diff --git a/tools/perf/page_sets/android_screen_restoration_shared_state.py b/tools/perf/page_sets/android_screen_restoration_shared_state.py index ae39bba..72bd720c 100644 --- a/tools/perf/page_sets/android_screen_restoration_shared_state.py +++ b/tools/perf/page_sets/android_screen_restoration_shared_state.py
@@ -8,8 +8,8 @@ class AndroidScreenRestorationSharedState(shared_page_state.SharedPageState): """ Ensures the screen is on before and after each user story is run. """ - def WillRunStory(self, page): - super(AndroidScreenRestorationSharedState, self).WillRunStory(page) + def WillRunStory(self, story): + super(AndroidScreenRestorationSharedState, self).WillRunStory(story) self._EnsureScreenOn() def DidRunStory(self, results):
diff --git a/tools/perf/page_sets/idle_platform.py b/tools/perf/page_sets/idle_platform.py index d5b2427..bd583d6 100644 --- a/tools/perf/page_sets/idle_platform.py +++ b/tools/perf/page_sets/idle_platform.py
@@ -4,7 +4,7 @@ import time from telemetry.page import shared_page_state -from telemetry import story +from telemetry import story as story_module class _IdleSharedState(shared_page_state.SharedPageState): @@ -13,8 +13,8 @@ test, finder_options, story_set, possible_browser) self._current_story = None - def WillRunStory(self, current_story): - self._current_story = current_story + def WillRunStory(self, story): + self._current_story = story assert self.platform.tracing_controller.is_tracing_running def RunStory(self, _): @@ -24,7 +24,7 @@ self._current_story = None -class _IdleStory(story.Story): +class _IdleStory(story_module.Story): def __init__(self, name, duration): super(_IdleStory, self).__init__( shared_state_class=_IdleSharedState, name=name) @@ -43,7 +43,7 @@ return self._url -class IdleStorySet(story.StorySet): +class IdleStorySet(story_module.StorySet): def __init__(self): super(IdleStorySet, self).__init__() self.AddStory(_IdleStory('IdleStory_10s', 10))
diff --git a/tools/perf/page_sets/rendering/rendering_shared_state.py b/tools/perf/page_sets/rendering/rendering_shared_state.py index 48b8a94..a376922a 100644 --- a/tools/perf/page_sets/rendering/rendering_shared_state.py +++ b/tools/perf/page_sets/rendering/rendering_shared_state.py
@@ -51,11 +51,11 @@ return 'unknown_gpu' - def WillRunStory(self, page): - super(RenderingSharedState, self).WillRunStory(page) + def WillRunStory(self, story): + super(RenderingSharedState, self).WillRunStory(story) if not self._finder_options.allow_software_compositing: self._EnsureNotSwiftShader() - if page.TAGS and story_tags.KEY_IDLE_POWER in page.TAGS: + if story.TAGS and story_tags.KEY_IDLE_POWER in story.TAGS: self._EnsureScreenOn() def DidRunStory(self, results):
diff --git a/tools/perf/page_sets/system_health/system_health_story.py b/tools/perf/page_sets/system_health/system_health_story.py index 193e6c8..e660bc5 100644 --- a/tools/perf/page_sets/system_health/system_health_story.py +++ b/tools/perf/page_sets/system_health/system_health_story.py
@@ -7,7 +7,7 @@ from page_sets.system_health import platforms from page_sets.system_health import story_tags -from telemetry.page import page +from telemetry.page import page as page_module from telemetry.page import shared_page_state from telemetry.util import wpr_modes @@ -24,12 +24,12 @@ disabling stories temporarily use story expectations in ./expectations.py. """ - def CanRunOnBrowser(self, browser_info, story): - if (browser_info.browser_type.startswith('android-webview') and - story.WEBVIEW_NOT_SUPPORTED): + def CanRunOnBrowser(self, browser_info, page): + if (browser_info.browser_type.startswith('android-webview') + and page.WEBVIEW_NOT_SUPPORTED): return False - if story.TAGS and story_tags.WEBGL in story.TAGS: + if page.TAGS and story_tags.WEBGL in page.TAGS: return browser_info.HasWebGLSupport() return True @@ -48,7 +48,8 @@ return cls.__dict__.get('ABSTRACT_STORY', False) -class SystemHealthStory(six.with_metaclass(_MetaSystemHealthStory, page.Page)): +class SystemHealthStory( + six.with_metaclass(_MetaSystemHealthStory, page_module.Page)): """Abstract base class for System Health user stories.""" # The full name of a single page story has the form CASE:GROUP:PAGE:[VERSION]
diff --git a/tools/perf/process_perf_results.py b/tools/perf/process_perf_results.py index c411a351..91b7b4a 100755 --- a/tools/perf/process_perf_results.py +++ b/tools/perf/process_perf_results.py
@@ -502,7 +502,7 @@ return cpu_count except NotImplementedError: if log: - logging.warn( + logging.warning( 'Failed to get a CPU count for this bot. See crbug.com/947035.') # TODO(crbug.com/948281): This is currently set to 4 since the mac masters # only have 4 cores. Once we move to all-linux, this can be increased or
diff --git a/tools/perf/scripts_smoke_unittest.py b/tools/perf/scripts_smoke_unittest.py index 78338e5..5aba28a 100644 --- a/tools/perf/scripts_smoke_unittest.py +++ b/tools/perf/scripts_smoke_unittest.py
@@ -42,7 +42,7 @@ def testRunBenchmarkHelp(self): return_code, stdout = self.RunPerfScript('run_benchmark --help') - self.assertEquals(return_code, 0, stdout) + self.assertEqual(return_code, 0, stdout) self.assertIn('usage: run_benchmark', stdout) @decorators.Disabled('chromeos') # crbug.com/754913 @@ -60,22 +60,26 @@ return cmdline.extend(['--browser-executable', self.options.browser_executable]) return_code, stdout = self.RunPerfScript(cmdline) - self.assertRegexpMatches(stdout, r'Available benchmarks .*? are:') + if sys.version_info.major == 3: + self.assertRegex(stdout, r'Available benchmarks .*? are:') + else: + # TODO: (crbug/1342770) clean up after python migration is done. + self.assertRegexpMatches(stdout, r'Available benchmarks .*? are:') # pylint: disable=deprecated-method self.assertEqual(return_code, 0) def testRunBenchmarkRunListsOutBenchmarks(self): return_code, stdout = self.RunPerfScript('run_benchmark run') self.assertIn('Pass --browser to list benchmarks', stdout) - self.assertNotEquals(return_code, 0) + self.assertNotEqual(return_code, 0) def testRunBenchmarkRunNonExistingBenchmark(self): return_code, stdout = self.RunPerfScript('run_benchmark foo') self.assertIn('no such benchmark: foo', stdout) - self.assertNotEquals(return_code, 0) + self.assertNotEqual(return_code, 0) def testRunRecordWprHelp(self): return_code, stdout = self.RunPerfScript('record_wpr') - self.assertEquals(return_code, 0, stdout) + self.assertEqual(return_code, 0, stdout) self.assertIn('optional arguments:', stdout) @decorators.Disabled('chromeos') # crbug.com/814068 @@ -86,7 +90,7 @@ # crbug.com/561668 if 'ImportError: cannot import name small_profile_extender' in stdout: self.skipTest('small_profile_extender is missing') - self.assertEquals(return_code, 0, stdout) + self.assertEqual(return_code, 0, stdout) self.assertIn('kraken', stdout) @decorators.Disabled('chromeos') # crbug.com/754913 @@ -112,7 +116,7 @@ return cmdline += ' --browser-executable=%s' % self.options.browser_executable return_code, stdout = self.RunPerfScript(cmdline) - self.assertEquals(return_code, 0, stdout) + self.assertEqual(return_code, 0, stdout) try: with open(os.path.join(tempdir, 'output.json')) as f: test_results = json.load(f) @@ -207,7 +211,7 @@ ), env=env) test_results = None try: - self.assertEquals(return_code, 0) + self.assertEqual(return_code, 0) expected_benchmark_folders = ( 'dummy_benchmark.stable_benchmark_1', 'dummy_benchmark.stable_benchmark_1.reference', @@ -263,7 +267,7 @@ os.path.join(tempdir, 'output.json') )) try: - self.assertEquals(return_code, 0, stdout) + self.assertEqual(return_code, 0, stdout) except AssertionError: try: with open(os.path.join(tempdir, benchmark, 'benchmark_log.txt')) as fh:
diff --git a/tools/typescript/ts_library.gni b/tools/typescript/ts_library.gni index 47858eda..1c74cff 100644 --- a/tools/typescript/ts_library.gni +++ b/tools/typescript/ts_library.gni
@@ -16,6 +16,7 @@ "tsconfig_base", "manifest_excludes", "testonly", + "visibility", ]) inputs = [ "//tools/typescript/tsconfig_base.json" ]
diff --git a/ui/android/java/src/org/chromium/ui/base/PhotoPickerDelegate.java b/ui/android/java/src/org/chromium/ui/base/PhotoPickerDelegate.java index 13ef085..96da8a2 100644 --- a/ui/android/java/src/org/chromium/ui/base/PhotoPickerDelegate.java +++ b/ui/android/java/src/org/chromium/ui/base/PhotoPickerDelegate.java
@@ -24,4 +24,9 @@ * Returns whether video decoding support is supported in the photo picker. */ boolean supportsVideos(); + + /** + * Returns whether the Android media picker is preferred over the Chrome media picker. + */ + boolean preferAndroidMediaPicker(); }
diff --git a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java index 6ac136e..20356f6 100644 --- a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java +++ b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
@@ -52,6 +52,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Locale; import java.util.concurrent.TimeUnit; /** @@ -95,6 +96,17 @@ SELECT_FILE_DIALOG_SCOPE_IMAGES_AND_VIDEOS + 1; /** + * The Android Media Picker enumerations, used to measure which type of picker is shown to the + * user. Values must be kept in sync with their definition in + * //tools/metrics/histograms/histograms.xml, and both the numbering and meaning of the values + * must remain constant as they're recorded by UMA. + */ + static final int SHOWING_CHROME_PICKER = 0; + static final int SHOWING_ANDROID_PICKER = 1; + static final int SHOWING_SUPPRESSED = 2; + static final int SHOWING_ENUM_COUNT = SHOWING_SUPPRESSED + 1; + + /** * The FileSelectAction tracks how many media files were uploaded, using either the MediaPicker * or an external source (such as the Android picker). These values are persisted to logs. * Entries should not be renumbered and numeric values should never be reused. @@ -430,11 +442,15 @@ // Use the new photo picker, if available. List<String> imageMimeTypes = convertToSupportedPhotoPickerTypes(mFileTypes); if (shouldUsePhotoPicker() - && showPhotoPicker(mWindowAndroid, this, mAllowMultiple, imageMimeTypes)) { + && showPhotoPicker(mWindowAndroid, /* intentCallback= */ this, /* listener= */ this, + mAllowMultiple, imageMimeTypes)) { mMediaPickerWasUsed = true; return; } else { mMediaPickerWasUsed = false; + if (!shouldUsePhotoPicker()) { + logMediaPickerShown(SHOWING_SUPPRESSED); + } } showExternalPicker(camera, videoCapture, soundRecorder); @@ -497,7 +513,7 @@ /** * Determines whether the photo picker should be used for this select file request. To be * applicable for the photo picker, the following must be true: - * 1.) Only image types were requested in the file request + * 1.) Only media types were requested in the file request * 2.) The file request did not explicitly ask to capture camera directly. * 3.) The photo picker is supported by the embedder (i.e. Chrome). * 4.) There is a valid Android Activity associated with the file request. @@ -1212,7 +1228,92 @@ return sPhotoPickerDelegate.supportsVideos(); } + private static boolean preferAndroidMediaPicker() { + if (!BuildInfo.isAtLeastT()) return false; + if (!shouldShowPhotoPicker()) return false; + return sPhotoPickerDelegate.preferAndroidMediaPicker(); + } + + /** + * The Android media picker currently doesn't fully support multiple mime types. It can only do + * a single specific mime type, all images, all videos, or all media (images/videos). + */ + private static String singleMimeTypeForAndroidPicker(List<String> mimeTypes) { + if (mimeTypes.size() == 1) { + return mimeTypes.get(0); + } + + boolean showImages = false; + boolean showVideos = false; + for (String mimeType : mimeTypes) { + String type = mimeType.toLowerCase(Locale.ROOT); + if (type.startsWith(IMAGE_TYPE)) { + showImages = true; + } else if (type.startsWith(VIDEO_TYPE)) { + showVideos = true; + } + + if (showImages && showVideos) break; + } + + if (showImages && showVideos) { + return ALL_TYPES; + } else if (showVideos) { + return VIDEO_TYPE + "/*"; + } else if (showImages) { + return IMAGE_TYPE + "/*"; + } else { + return ""; + } + } + + private static void logMediaPickerShown(int value) { + RecordHistogram.recordEnumeratedHistogram( + "Android.MediaPickerShown", value, SHOWING_ENUM_COUNT); + } + private static boolean showPhotoPicker(WindowAndroid windowAndroid, + WindowAndroid.IntentCallback intentCallback, PhotoPickerListener listener, + boolean allowMultiple, List<String> mimeTypes) { + if (preferAndroidMediaPicker()) { + logMediaPickerShown(SHOWING_ANDROID_PICKER); + return showAndroidMediaPicker(windowAndroid, intentCallback, allowMultiple, mimeTypes); + } else { + logMediaPickerShown(SHOWING_CHROME_PICKER); + return showChromeMediaPicker(windowAndroid, listener, allowMultiple, mimeTypes); + } + } + + private static boolean showAndroidMediaPicker(WindowAndroid windowAndroid, + WindowAndroid.IntentCallback intentCallback, boolean allowMultiple, + List<String> mimeTypes) { + // Switch to MediaStore.ACTION_PICK_IMAGES when available in new SDK. + String actionPickImages = "android.provider.action.PICK_IMAGES"; + // Switch to MediaStore.EXTRA_PICK_IMAGES_MAX when available in new SDK. + String extraPickImagesMax = "android.provider.extra.PICK_IMAGES_MAX"; + // Switch to MediaStore.getPickImagesMaxLimit() when available in new SDK. + int maxImagesForUpload = 50; + + Intent intent = new Intent(actionPickImages); + if (allowMultiple) { + intent.putExtra(extraPickImagesMax, maxImagesForUpload); + } + + String mimeType = singleMimeTypeForAndroidPicker(mimeTypes); + if (mimeType.isEmpty()) { + return false; + } + intent.setType(mimeType); + + if (!windowAndroid.showIntent( + intent, intentCallback, /* errorId= */ R.string.opening_android_media_picker)) { + Log.e(TAG, "showIntent call failed for Android Media Picker"); + } + + return true; + } + + private static boolean showChromeMediaPicker(WindowAndroid windowAndroid, PhotoPickerListener listener, boolean allowMultiple, List<String> mimeTypes) { if (sPhotoPickerDelegate == null) return false; assert sPhotoPicker == null;
diff --git a/ui/android/java/strings/android_ui_strings.grd b/ui/android/java/strings/android_ui_strings.grd index 2081542b..ad25299 100644 --- a/ui/android/java/strings/android_ui_strings.grd +++ b/ui/android/java/strings/android_ui_strings.grd
@@ -178,6 +178,9 @@ <message name="IDS_OPENING_FILE_ERROR" desc="Toast when the browser is unable to open a file for upload. [CHAR_LIMIT=32]"> Failed to open selected file </message> + <message name="IDS_OPENING_ANDROID_MEDIA_PICKER" desc="Toast when the browser is unable to open the Android Media picker (when uploading files). [CHAR_LIMIT=32]"> + Unable to open the photo picker + </message> <!-- Clipboard --> <message name="IDS_COPY_TO_CLIPBOARD_FAILURE_MESSAGE" desc="Notification for when copying to the clipboard fails. [CHAR_LIMIT=64]">
diff --git a/ui/android/java/strings/android_ui_strings_grd/IDS_OPENING_ANDROID_MEDIA_PICKER.png.sha1 b/ui/android/java/strings/android_ui_strings_grd/IDS_OPENING_ANDROID_MEDIA_PICKER.png.sha1 new file mode 100644 index 0000000..944b806 --- /dev/null +++ b/ui/android/java/strings/android_ui_strings_grd/IDS_OPENING_ANDROID_MEDIA_PICKER.png.sha1
@@ -0,0 +1 @@ +d633d566a6431e7063d69c9d2e2e29a07d7c9e2f \ No newline at end of file
diff --git a/ui/views/focus/focus_manager.cc b/ui/views/focus/focus_manager.cc index ed6ed43b..5e0e3c0 100644 --- a/ui/views/focus/focus_manager.cc +++ b/ui/views/focus/focus_manager.cc
@@ -489,31 +489,25 @@ bool reverse) { FocusTraversable* new_focus_traversable = nullptr; View* new_starting_view = nullptr; - auto can_go_into_anchored_dialog = + const FocusSearch::AnchoredDialogPolicy can_go_into_anchored_dialog = FocusSearch::AnchoredDialogPolicy::kCanGoIntoAnchoredDialog; - View* v = focus_traversable->GetFocusSearch()->FindNextFocusableView( - starting_view, + const FocusSearch::SearchDirection search_direction = reverse ? FocusSearch::SearchDirection::kBackwards - : FocusSearch::SearchDirection::kForwards, - FocusSearch::TraversalDirection::kDown, - FocusSearch::StartingViewPolicy::kSkipStartingView, - can_go_into_anchored_dialog, &new_focus_traversable, &new_starting_view); + : FocusSearch::SearchDirection::kForwards; + View* v = nullptr; // Let's go down the FocusTraversable tree as much as we can. - while (new_focus_traversable) { - DCHECK(!v); - focus_traversable = new_focus_traversable; - new_focus_traversable = nullptr; - starting_view = nullptr; + do { v = focus_traversable->GetFocusSearch()->FindNextFocusableView( - starting_view, - reverse ? FocusSearch::SearchDirection::kBackwards - : FocusSearch::SearchDirection::kForwards, - FocusSearch::TraversalDirection::kDown, + starting_view, search_direction, FocusSearch::TraversalDirection::kDown, FocusSearch::StartingViewPolicy::kSkipStartingView, can_go_into_anchored_dialog, &new_focus_traversable, &new_starting_view); - } + DCHECK(!new_focus_traversable || !v); + focus_traversable = std::exchange(new_focus_traversable, nullptr); + starting_view = nullptr; + } while (focus_traversable); + return v; }
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index 827f6fc..1e6326a 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc
@@ -3236,6 +3236,7 @@ point.x = event.x(); point.y = event.y(); ::ClientToScreen(hwnd(), &point); + num_drag_events_after_press_++; // Windows sometimes sends spurious WM_MOUSEMOVEs at 0,0. If this happens // after a mouse down on a tab, it can cause a detach of the tab to 0,0. // In general, it would cause weird behavior while dragging, so ignore @@ -3244,13 +3245,25 @@ POINT cursor_pos; ::GetCursorPos(&cursor_pos); constexpr int kMinSpuriousDistance = 200; + constexpr int kMaxDragEvents = 10; auto distance = sqrt(pow(static_cast<float>(abs(cursor_pos.x)), 2) + pow(static_cast<float>(abs(cursor_pos.y)), 2)); + // TODO(crbug.com/1270828): If this stat shows that + // `num_drag_events_after_press_` is predominantly less than some small + // number, add a check for that below and reduce kMinSpurious distance + // to something like 20 or 30 to reduce the chance of one of the first + // tab or two being detached incorrectly. Also fix the comment above the + // declaration of `num_drag_events_after_press_` to reflect this. if (distance > kMinSpuriousDistance) { + base::UmaHistogramExactLinear("Windows.DragEventsAfterPress", + num_drag_events_after_press_, + kMaxDragEvents + 1); SetMsgHandled(true); return 0; } } + } else if (event.type() == ui::ET_MOUSE_PRESSED) { + num_drag_events_after_press_ = 0; } // Don't send right mouse button up to the delegate when displaying system
diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h index 73337f6b..65bf924 100644 --- a/ui/views/win/hwnd_message_handler.h +++ b/ui/views/win/hwnd_message_handler.h
@@ -812,6 +812,13 @@ // call HandleWindowMinimizedOrRestored() when we get a WM_ACTIVATE message. bool notify_restore_on_activate_ = false; + // Counts the number of drag events received after a drag started event. + // This will be used to ignore a drag event to 0, 0, if it is one of the + // first few drag events after a drag started event. We randomly receive + // bogus 0, 0 drag events after the start of a drag. See + // https://crbug.com/1270828. + int num_drag_events_after_press_ = 0; + // This tracks headless window visibility, fullscreen and min/max states. In // headless mode the platform window is never made visible or change its // state, so this structure holds the requested state for reporting.
diff --git a/ui/webui/resources/cr_components/help_bubble/help_bubble.html b/ui/webui/resources/cr_components/help_bubble/help_bubble.html index 81084528..3b233f4 100644 --- a/ui/webui/resources/cr_components/help_bubble/help_bubble.html +++ b/ui/webui/resources/cr_components/help_bubble/help_bubble.html
@@ -45,11 +45,28 @@ top: calc(50% - 8px); } - .body { + #topContainer { + align-items: flex-start; + display: flex; + } + + #body { + flex: auto; font-size: 14px; } - .help-bubble { + #title { + flex: auto; + font-size: 16px; + font-weight: bold; + margin-bottom: 8px; + } + + /* Note: help bubbles have the same color treatment in both light and dark + * themes, which is why the values below do not change based on theme + * preference. */ + + .help-bubble { --help-bubble-background: var(--google-blue-700); --help-bubble-text-color: var(--google-grey-200); background-color: var(--help-bubble-background); @@ -58,9 +75,36 @@ padding: 12px 16px; width: 362px; } + + cr-icon-button { + --cr-icon-button-fill-color: var(--help-bubble-text-color); + --cr-icon-button-hover-background-color: + rgba(var(--google-blue-300-rgb), .3); + --cr-icon-button-icon-size: 16px; + --cr-icon-button-size: 20px; + --cr-icon-button-stroke-color: var(--help-bubble-text-color); + display: block; + flex: none; + float: right; + margin: 0; + margin-inline-end: 4px; + margin-inline-start: 12px; + order: 2; + } + + cr-icon-button:focus { + border: 2px solid var(--help-bubble-text-color); + } </style> <div class="help-bubble"> - <div class="body">[[body]]</div> + <div id="topContainer"> + <cr-icon-button id="close" iron-icon="cr:close" + aria-label="[[closeText]]" on-click="dismiss_"> + </cr-icon-button> + <div id="title"></div> + <div id="body"></div> + </div> + <div id="main"></div> <div class="arrow"></div> </div>
diff --git a/ui/webui/resources/cr_components/help_bubble/help_bubble.mojom b/ui/webui/resources/cr_components/help_bubble/help_bubble.mojom index 9f819c3..c749af0 100644 --- a/ui/webui/resources/cr_components/help_bubble/help_bubble.mojom +++ b/ui/webui/resources/cr_components/help_bubble/help_bubble.mojom
@@ -38,6 +38,7 @@ HelpBubblePosition position = HelpBubblePosition.BELOW; string? title_text; string body_text; + string close_button_alt_text; array<HelpBubbleButtonParams> buttons; };
diff --git a/ui/webui/resources/cr_components/help_bubble/help_bubble.ts b/ui/webui/resources/cr_components/help_bubble/help_bubble.ts index 6ca1dfd..45ed2e4 100644 --- a/ui/webui/resources/cr_components/help_bubble/help_bubble.ts +++ b/ui/webui/resources/cr_components/help_bubble/help_bubble.ts
@@ -8,7 +8,10 @@ * implementation detail and subject to change (you should not add them to your * components directly). */ +import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.m.js'; +import 'chrome://resources/cr_elements/icons.m.js'; +import {CrIconButtonElement} from '//resources/cr_elements/cr_icon_button/cr_icon_button.m.js'; import {assert, assertNotReached} from '//resources/js/assert_ts.js'; import {PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; @@ -17,6 +20,22 @@ const ANCHOR_HIGHLIGHT_CLASS = 'help-anchor-highlight'; +export type HelpBubbleDismissedEventDetail = { + anchorId: string, + fromActionButton: boolean, + buttonIndex?: number, +}; + +export interface HelpBubbleElement { + $: { + body: HTMLElement, + close: CrIconButtonElement, + main: HTMLElement, + title: HTMLElement, + topContainer: HTMLElement, + }; +} + export class HelpBubbleElement extends PolymerElement { static get is() { return 'help-bubble'; @@ -33,11 +52,14 @@ value: '', reflectToAttribute: true, }, + closeText: String, }; } anchorId: string; - body: string; + bodyText: string; + titleText: string; + closeText: string; position: HelpBubblePosition; /** @@ -49,6 +71,18 @@ * Shows the bubble. */ show() { + // If there is no title, the body element should be in the top container + // with the close button, else it should be in the main container. + if (this.titleText) { + this.$.title.style.display = 'block'; + this.$.title.innerText = this.titleText; + this.$.main.appendChild(this.$.body); + } else { + this.$.title.style.display = 'none'; + this.$.topContainer.appendChild(this.$.body); + } + this.$.body.innerText = this.bodyText; + this.anchorElement_ = this.parentElement!.querySelector<HTMLElement>(`#${this.anchorId}`)!; assert( @@ -83,6 +117,16 @@ return this.anchorElement_; } + private dismiss_() { + assert(this.anchorId); + this.dispatchEvent(new CustomEvent('help-bubble-dismissed', { + detail: { + anchorId: this.anchorId, + fromActionButton: false, + }, + })); + } + /** * Sets the bubble position, as relative to that of the anchor element and * |this.position|. @@ -155,4 +199,7 @@ interface HTMLElementTagNameMap { 'help-bubble': HelpBubbleElement; } + interface HTMLElementEventMap { + 'help-bubble-dismissed': CustomEvent<HelpBubbleDismissedEventDetail>; + } }
diff --git a/ui/webui/resources/cr_components/help_bubble/help_bubble_mixin.ts b/ui/webui/resources/cr_components/help_bubble/help_bubble_mixin.ts index 97dc492..da44d81 100644 --- a/ui/webui/resources/cr_components/help_bubble/help_bubble_mixin.ts +++ b/ui/webui/resources/cr_components/help_bubble/help_bubble_mixin.ts
@@ -19,9 +19,10 @@ */ import {assert} from 'chrome://resources/js/assert_ts.js'; +import {EventTracker} from 'chrome://resources/js/event_tracker.m.js'; import {dedupingMixin, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {HelpBubbleElement} from './help_bubble.js'; +import {HelpBubbleDismissedEventDetail, HelpBubbleElement} from './help_bubble.js'; import {HelpBubbleClientCallbackRouter, HelpBubbleHandlerInterface, HelpBubbleParams} from './help_bubble.mojom-webui.js'; import {HelpBubbleProxyImpl} from './help_bubble_proxy.js'; @@ -51,6 +52,7 @@ * visibility. */ private targetVisibility_: Map<string, boolean> = new Map(); + private dismissedEventTracker_: EventTracker = new EventTracker(); constructor(...args: any[]) { super(...args); @@ -159,10 +161,15 @@ const anchor = this.findAnchorElement_(anchorId); assert(anchor, 'Help bubble anchor element not found ' + anchorId); anchor.parentNode!.insertBefore(bubble, anchor); + this.dismissedEventTracker_.add( + bubble, 'help-bubble-dismissed', + this.onHelpBubbleDismissed_.bind(this)); bubble.anchorId = anchorId; + bubble.closeText = params.closeButtonAltText; bubble.position = params.position; - bubble.body = params.bodyText; + bubble.bodyText = params.bodyText; + bubble.titleText = params.titleText || ''; bubble.show(); anchor!.focus(); } @@ -176,7 +183,7 @@ if (!bubble) { return false; } - + this.dismissedEventTracker_.remove(bubble, 'help-bubble-dismissed'); bubble.hide(); bubble.remove(); return true; @@ -266,6 +273,21 @@ return this.shadowRoot!.querySelector( `help-bubble[anchor-id='${anchorId}']`); } + + private onHelpBubbleDismissed_( + e: CustomEvent<HelpBubbleDismissedEventDetail>) { + const hidden = this.hideHelpBubble(e.detail.anchorId); + assert(hidden); + const nativeId = this.getNativeIdForAnchor_(e.detail.anchorId); + if (nativeId) { + if (e.detail.fromActionButton) { + this.helpBubbleHandler_.helpBubbleButtonPressed( + nativeId, e.detail.buttonIndex!); + } else { + this.helpBubbleHandler_.helpBubbleClosed(nativeId, true); + } + } + } } return HelpBubbleMixin;
diff --git a/ui/webui/resources/tools/generate_grd.gni b/ui/webui/resources/tools/generate_grd.gni index 8f8836f7..889b47b 100644 --- a/ui/webui/resources/tools/generate_grd.gni +++ b/ui/webui/resources/tools/generate_grd.gni
@@ -11,6 +11,7 @@ "deps", "public_deps", "testonly", + "visibility", ]) inputs = []
diff --git a/weblayer/browser/bluetooth/weblayer_bluetooth_delegate_impl_client.cc b/weblayer/browser/bluetooth/weblayer_bluetooth_delegate_impl_client.cc index 9b31379..bbf016d 100644 --- a/weblayer/browser/bluetooth/weblayer_bluetooth_delegate_impl_client.cc +++ b/weblayer/browser/bluetooth/weblayer_bluetooth_delegate_impl_client.cc
@@ -59,25 +59,15 @@ #endif } -void WebLayerBluetoothDelegateImplClient::ShowBluetoothDeviceCredentialsDialog( +void WebLayerBluetoothDelegateImplClient::ShowBluetoothDevicePairDialog( content::RenderFrameHost* frame, const std::u16string& device_identifier, - content::BluetoothDelegate::CredentialsCallback callback) { + content::BluetoothDelegate::PairPromptCallback callback, + content::BluetoothDelegate::PairingKind) { // Web Bluetooth is not supported for desktop in WebLayer and Android already // bonds on demand, so this should not be called on any platform. - std::move(callback).Run( - content::BluetoothDelegate::DeviceCredentialsPromptResult::kCancelled, - /*result=*/std::u16string()); + std::move(callback).Run(content::BluetoothDelegate::PairPromptResult( + content::BluetoothDelegate::PairPromptStatus::kCancelled)); NOTREACHED(); } - -void WebLayerBluetoothDelegateImplClient::ShowBluetoothDevicePairConfirmDialog( - content::RenderFrameHost* frame, - const std::u16string& device_identifier, - content::BluetoothDelegate::PairConfirmCallback callback) { - // Web Bluetooth is not supported for desktop in WebLayer and Android already - // bonds on demand, so this should not be called on any platform. - NOTREACHED(); -} - } // namespace weblayer
diff --git a/weblayer/browser/bluetooth/weblayer_bluetooth_delegate_impl_client.h b/weblayer/browser/bluetooth/weblayer_bluetooth_delegate_impl_client.h index 9eb8028..e8370fba 100644 --- a/weblayer/browser/bluetooth/weblayer_bluetooth_delegate_impl_client.h +++ b/weblayer/browser/bluetooth/weblayer_bluetooth_delegate_impl_client.h
@@ -43,14 +43,12 @@ content::RenderFrameHost* frame, const content::BluetoothScanningPrompt::EventHandler& event_handler) override; - void ShowBluetoothDeviceCredentialsDialog( + + void ShowBluetoothDevicePairDialog( content::RenderFrameHost* frame, const std::u16string& device_identifier, - content::BluetoothDelegate::CredentialsCallback callback) override; - void ShowBluetoothDevicePairConfirmDialog( - content::RenderFrameHost* frame, - const std::u16string& device_identifier, - content::BluetoothDelegate::PairConfirmCallback callback) override; + content::BluetoothDelegate::PairPromptCallback callback, + content::BluetoothDelegate::PairingKind) override; }; } // namespace weblayer