diff --git a/DEPS b/DEPS index e7ac8734..7d72aff 100644 --- a/DEPS +++ b/DEPS
@@ -234,15 +234,15 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': 'e2a038f956ff4e7564c40c8653a236aae5e630d1', + 'skia_revision': 'a0ad6db14184e7815e1b05bd58e997bb4fe83e79', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '1c2d77879f60d814bec5902aa8d1d77b20f42164', + 'v8_revision': 'b2d7879f825d93c8554c51ce57f2c502c504c2ee', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': 'a56d3c13303b1807ea47c17e1a60865b9c2d29d9', + 'angle_revision': '00d0b79fdae0423a1d92234311d6a729d000b300', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -281,7 +281,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': '64e26ad3a2ef2e07190b2027b113a6b3f6eb8b0d', + 'freetype_revision': '3b45f564e94fde897c0e6e168c660a6e1ec5c679', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. @@ -309,7 +309,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': '19b714a6936e90642ad6b0170410fdd14216e2c9', + 'devtools_frontend_revision': 'c7c4938178885cd37b679662f8396fb5439c28df', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -349,7 +349,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': '33a044ea5f8ef2d5bf1c42040d6517eba48462d3', + 'dawn_revision': '349062fb7231c1d1716176e8417d2cf81d4307ca', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -603,7 +603,7 @@ Var('chromium_git') + '/external/github.com/toji/webvr.info.git' + '@' + 'c58ae99b9ff9e2aa4c524633519570bf33536248', 'src/docs/website': { - 'url': Var('chromium_git') + '/website.git' + '@' + 'd1d2e86198867d96fa22ad999354ae4fb25f1a68', + 'url': Var('chromium_git') + '/website.git' + '@' + '9308f80e507f48b9b8216f81291020f6c945b326', }, 'src/ios/third_party/earl_grey2/src': { @@ -1010,7 +1010,7 @@ # Tools used when building Chrome for Chrome OS. This affects both the Simple # Chrome workflow, as well as the chromeos-chrome ebuild. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'dea458fb61a38ff77808c6aa7bd6f8037ea7db67', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '844ab98c8d102144ceee9a0412bf001c48b2d9ec', 'condition': 'checkout_chromeos', }, @@ -1025,12 +1025,12 @@ # For Linux and Chromium OS. 'src/third_party/cros_system_api': { - 'url': Var('chromium_git') + '/chromiumos/platform2/system_api.git' + '@' + 'eddfad34242e54fe5441469b80f643a5ba766dc0', + 'url': Var('chromium_git') + '/chromiumos/platform2/system_api.git' + '@' + 'a2f3b1690899d89d3d979bb04b3ad751b7a21ac1', 'condition': 'checkout_linux', }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '02f4003fdbfd383192fa725886af79116b1032aa', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '51d99b2f3a76cbd88f0520014714ae8b33a32d47', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -1413,7 +1413,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '889d9a924c20a88305e1c82ab9a4273e664c0410', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'b9dad73621357b1698837d1abb64c020c5547172', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1516,7 +1516,7 @@ 'packages': [ { 'package': 'chromium/third_party/r8', - 'version': 'CokGsfuGfcV-GjGwN98h28Phet4ai_xhPGZkGCqotWMC', + 'version': 'KOlWWUU4CAY1EqgiZ6iljOP7ycIjceTEFcwWxL14HFoC', }, ], 'condition': 'checkout_android', @@ -1549,7 +1549,7 @@ Var('chromium_git') + '/external/smhasher.git' + '@' + 'e87738e57558e0ec472b2fc3a643b838e5b6e88f', 'src/third_party/snappy/src': - Var('chromium_git') + '/external/github.com/google/snappy.git' + '@' + '9c1be17938429574cdec8fbf820f2d9d5ea66c5c', + Var('chromium_git') + '/external/github.com/google/snappy.git' + '@' + '65dc7b383985eb4f63cd3e752136db8d9b4be8c0', 'src/third_party/sqlite/src': Var('chromium_git') + '/chromium/deps/sqlite.git' + '@' + '369afe94faeeeac33fca2e478aaab8bb85813d79', @@ -1574,7 +1574,7 @@ }, 'src/third_party/tflite/src': - Var('chromium_git') + '/external/github.com/tensorflow/tensorflow.git' + '@' + '86611dc427e52921638e9715877678ae46d292e3', + Var('chromium_git') + '/external/github.com/tensorflow/tensorflow.git' + '@' + '84af5b08335d9099de320bd0409e250289865507', 'src/third_party/turbine': { 'packages': [ @@ -1634,7 +1634,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'f6f0c1129dffbd7f2c862ea6f7543f3cba582b4c', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'ee225438297bb02b9f689e25719870bddcd4991f', + Var('webrtc_git') + '/src.git' + '@' + '6844e51f470eefd5086351779d021ec1c7b4c5b1', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1692,7 +1692,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@0045ab90642dc17c18b4bfb35cbc7584be722005', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@f4f583fbac42fc2a7b4c4bf89db27c2a991b7079', 'condition': 'checkout_src_internal', },
diff --git a/PRESUBMIT_test_mocks.py b/PRESUBMIT_test_mocks.py index 430f98f..69a36ea 100644 --- a/PRESUBMIT_test_mocks.py +++ b/PRESUBMIT_test_mocks.py
@@ -101,7 +101,7 @@ raise TypeError('files_to_check should be an iterable of strings') for pattern in files_to_check: compiled_pattern = re.compile(pattern) - if compiled_pattern.search(local_path): + if compiled_pattern.match(local_path): found_in_files_to_check = True break if files_to_skip: @@ -109,7 +109,7 @@ raise TypeError('files_to_skip should be an iterable of strings') for pattern in files_to_skip: compiled_pattern = re.compile(pattern) - if compiled_pattern.search(local_path): + if compiled_pattern.match(local_path): return False return found_in_files_to_check
diff --git a/ash/app_list/views/folder_header_view.cc b/ash/app_list/views/folder_header_view.cc index ca9f492d..04b35236 100644 --- a/ash/app_list/views/folder_header_view.cc +++ b/ash/app_list/views/folder_header_view.cc
@@ -412,13 +412,13 @@ return; folder_item_->RemoveObserver(this); - // Enforce the maximum folder name length in UI. + // Enforce the maximum folder name length in UI by trimming `new_contents` + // when it is longer than the max length. if (new_contents.length() > kMaxFolderNameChars) { - folder_name_view_->SetText(previous_folder_name_.value()); - sender->SetSelectedRange(gfx::Range(previous_cursor_position_.value(), - previous_cursor_position_.value())); + std::u16string trimmed_new_contents = new_contents; + trimmed_new_contents.resize(kMaxFolderNameChars); + folder_name_view_->SetText(trimmed_new_contents); } else { - previous_folder_name_ = new_contents; delegate_->SetItemName(folder_item_, base::UTF16ToUTF8(new_contents)); } @@ -438,6 +438,11 @@ bool FolderHeaderView::HandleKeyEvent(views::Textfield* sender, const ui::KeyEvent& key_event) { if (ShouldNameViewClearFocus(key_event)) { + // If the user presses the escape key, we should revert the text in + // `folder_name_view_`. + if (key_event.key_code() == ui::VKEY_ESCAPE) + sender->SetText(previous_folder_name_); + folder_name_view_->GetFocusManager()->ClearFocus(); return true; } @@ -446,22 +451,8 @@ return ProcessLeftRightKeyTraversalForTextfield(folder_name_view_, key_event); } -void FolderHeaderView::OnBeforeUserAction(views::Textfield* sender) { - previous_cursor_position_ = sender->GetCursorPosition(); -} - void FolderHeaderView::ItemNameChanged() { Update(); } -void FolderHeaderView::SetPreviousCursorPositionForTest( - const size_t cursor_position) { - previous_cursor_position_ = cursor_position; -} - -void FolderHeaderView::SetPreviousFolderNameForTest( - const std::u16string& previous_name) { - previous_folder_name_ = previous_name; -} - } // namespace ash
diff --git a/ash/app_list/views/folder_header_view.h b/ash/app_list/views/folder_header_view.h index 5bf93d8..d41219aa 100644 --- a/ash/app_list/views/folder_header_view.h +++ b/ash/app_list/views/folder_header_view.h
@@ -86,25 +86,10 @@ const std::u16string& new_contents) override; bool HandleKeyEvent(views::Textfield* sender, const ui::KeyEvent& key_event) override; - void OnBeforeUserAction(views::Textfield* sender) override; // AppListItemObserver overrides: void ItemNameChanged() override; - // Sets the |previous_cursor_position_|, only for testing use - void SetPreviousCursorPositionForTest(const size_t cursor_position); - - // Sets the |previous_folder_name_|, only for testing use - void SetPreviousFolderNameForTest(const std::u16string& previous_name); - - // Used to restore the folder name if the new folder name is longer than the - // max chars folder length allowed - absl::optional<std::u16string> previous_folder_name_; - - // Used to restore the cursor position to its last known location when - // resetting the folder name in textfield - absl::optional<size_t> previous_cursor_position_; - AppListFolderItem* folder_item_; // Not owned. FolderNameView* folder_name_view_; // Owned by views hierarchy. @@ -116,6 +101,9 @@ bool folder_name_visible_; bool is_tablet_mode_; + + // Used to restore the folder name when the user presses the escape key. + std::u16string previous_folder_name_; }; } // namespace ash
diff --git a/ash/app_list/views/folder_header_view_unittest.cc b/ash/app_list/views/folder_header_view_unittest.cc index d1adc9e..9f43856 100644 --- a/ash/app_list/views/folder_header_view_unittest.cc +++ b/ash/app_list/views/folder_header_view_unittest.cc
@@ -21,6 +21,8 @@ #include "base/compiler_specific.h" #include "base/strings/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/events/event.h" +#include "ui/events/keycodes/keyboard_codes_posix.h" #include "ui/events/test/event_generator.h" #include "ui/views/controls/textfield/textfield.h" #include "ui/views/test/views_test_base.h" @@ -104,13 +106,17 @@ return folder_header_view_->IsFolderNameEnabledForTest(); } - void UpdatePreviousCursorPosition(const size_t previous_cursor_position) { - folder_header_view_->SetPreviousCursorPositionForTest( - previous_cursor_position); - } + void FocusText() { folder_header_view_->SetTextFocus(); } - void UpdatePreviousFolderName(const std::u16string& previous_name) { - folder_header_view_->SetPreviousFolderNameForTest(previous_name); + bool HasTextFocus() { return folder_header_view_->HasTextFocus(); } + + void SendKey(ui::KeyboardCode key_code, int flags = ui::EF_NONE) { + folder_header_view_->HandleKeyEvent( + folder_header_view_->GetFolderNameViewForTest(), + ui::KeyEvent(ui::ET_KEY_PRESSED, key_code, flags)); + folder_header_view_->HandleKeyEvent( + folder_header_view_->GetFolderNameViewForTest(), + ui::KeyEvent(ui::ET_KEY_RELEASED, key_code, flags)); } TestAppListColorProvider color_provider_; // Needed by AppListView. @@ -121,18 +127,6 @@ std::unique_ptr<views::Widget> widget_; }; -TEST_F(FolderHeaderViewTest, SetFolderName) { - // Creating a folder with empty folder name. - AppListFolderItem* folder_item = model_->CreateAndPopulateFolderWithApps(2); - folder_header_view_->SetFolderItem(folder_item); - EXPECT_EQ("", GetFolderNameFromUI()); - EXPECT_TRUE(CanEditFolderName()); - - // Update UI to set folder name to "test folder". - UpdateFolderName("test folder"); - EXPECT_EQ("test folder", delegate_->folder_name()); -} - TEST_F(FolderHeaderViewTest, WhitespaceCollapsedWhenFolderNameViewLosesFocus) { AppListFolderItem* folder_item = model_->CreateAndPopulateFolderWithApps(2); folder_header_view_->SetFolderItem(folder_item); @@ -163,8 +157,6 @@ max_len_name += "a"; } std::string too_long_name = max_len_name + "a"; - UpdatePreviousCursorPosition(0); - UpdatePreviousFolderName(std::u16string()); // Expect that the folder name does not change, and does not truncate UpdateFolderName(too_long_name); @@ -192,7 +184,7 @@ // Sends a tap gesture with events corresponding to touch-down and touch-up. // This is a template to support a |handler| with an OnGestureEvent() method -// that isn't a ui::EventHandler implementation. +// such as views::Widget or views::View. template <typename GestureHandler> void SendTap(GestureHandler* handler, const gfx::Point& location) { ui::GestureEvent tap_down( @@ -258,5 +250,54 @@ EXPECT_FALSE(name_view->HasFocus()); } +// Test that hitting the return key sets the folder name. +TEST_F(FolderHeaderViewTest, SetFolderNameOnReturn) { + // Create a folder with empty folder name. + AppListFolderItem* folder_item = model_->CreateAndPopulateFolderWithApps(2); + folder_header_view_->SetFolderItem(folder_item); + ASSERT_EQ("", GetFolderNameFromUI()); + ASSERT_TRUE(CanEditFolderName()); + + // Focus the text. + FocusText(); + ASSERT_TRUE(HasTextFocus()); + + // Set the folder name. + UpdateFolderName("ret"); + EXPECT_EQ("ret", GetFolderNameFromUI()); + + // Press return. + SendKey(ui::VKEY_RETURN); + + // Make sure the return press unfocused the text and registered the name + // change. + EXPECT_FALSE(HasTextFocus()); + EXPECT_EQ("ret", delegate_->folder_name()); +} + +// Test that hitting the escape key reverts the folder name. +TEST_F(FolderHeaderViewTest, RevertFolderNameOnEscape) { + // Create a folder with empty folder name. + AppListFolderItem* folder_item = model_->CreateAndPopulateFolderWithApps(2); + folder_header_view_->SetFolderItem(folder_item); + ASSERT_EQ("", GetFolderNameFromUI()); + ASSERT_TRUE(CanEditFolderName()); + + // Focus the text. + FocusText(); + ASSERT_TRUE(HasTextFocus()); + + // Set the folder name. + UpdateFolderName("esc"); + EXPECT_EQ("esc", GetFolderNameFromUI()); + + // Press escape. + SendKey(ui::VKEY_ESCAPE); + + // Make sure the escape press unfocused the text and reverted the name change. + EXPECT_FALSE(HasTextFocus()); + EXPECT_EQ("", delegate_->folder_name()); +} + } // namespace test } // namespace ash
diff --git a/ash/capture_mode/capture_mode_controller.cc b/ash/capture_mode/capture_mode_controller.cc index 3255691b..5d23239 100644 --- a/ash/capture_mode/capture_mode_controller.cc +++ b/ash/capture_mode/capture_mode_controller.cc
@@ -614,36 +614,19 @@ } void CaptureModeController::CaptureScreenshotsOfAllDisplays() { + if (pending_dlp_check_on_session_init_) + return; + if (!delegate_->IsCaptureAllowedByPolicy()) { ShowDisabledNotification(CaptureAllowance::kDisallowedByPolicy); return; } - if (delegate_->IsCaptureModeInitRestrictedByDlp()) { - ShowDisabledNotification(CaptureAllowance::kDisallowedByDlp); - return; - } - // Get a vector of RootWindowControllers with primary root window at first. - const std::vector<RootWindowController*> controllers = - RootWindowController::root_window_controllers(); - // Capture screenshot for each individual display. - int display_index = 1; - for (RootWindowController* controller : controllers) { - // TODO(shidi): Check with UX what notification should show if - // some (but not all) of the displays have restricted content and - // whether we should localize the display name. - const CaptureParams capture_params{controller->GetRootWindow(), - controller->GetRootWindow()->bounds()}; - CaptureImage(capture_params, controllers.size() == 1 - ? BuildImagePath() - : BuildImagePathForDisplay(display_index)); - ++display_index; - } - // Since this doesn't create a capture mode session, log metrics here. - RecordCaptureModeEntryType(CaptureModeEntryType::kCaptureAllDisplays); - RecordCaptureModeConfiguration(CaptureModeType::kImage, - CaptureModeSource::kFullscreen, - /*audio_on=*/false); + pending_dlp_check_on_session_init_ = true; + delegate_->CheckCaptureModeInitRestrictionByDlp(base::BindOnce( + &CaptureModeController:: + OnDlpRestrictionCheckedAtCaptureScreenshotsOfAllDisplays, + weak_ptr_factory_.GetWeakPtr())); } void CaptureModeController::PerformCapture() { @@ -1511,6 +1494,43 @@ recording_start_time_ = base::TimeTicks(); } +void CaptureModeController:: + OnDlpRestrictionCheckedAtCaptureScreenshotsOfAllDisplays(bool proceed) { + pending_dlp_check_on_session_init_ = false; + if (!proceed) + return; + + // Due to fact that the DLP warning dialog may take a while, check policy + // again even though we checked in CaptureScreenshotsOfAllDisplays(). + if (!delegate_->IsCaptureAllowedByPolicy()) { + ShowDisabledNotification(CaptureAllowance::kDisallowedByPolicy); + return; + } + + // Get a vector of RootWindowControllers with primary root window at first. + const std::vector<RootWindowController*> controllers = + RootWindowController::root_window_controllers(); + // Capture screenshot for each individual display. + int display_index = 1; + for (RootWindowController* controller : controllers) { + // TODO(shidi): Check with UX what notification should show if + // some (but not all) of the displays have restricted content and + // whether we should localize the display name. + const CaptureParams capture_params{controller->GetRootWindow(), + controller->GetRootWindow()->bounds()}; + CaptureImage(capture_params, controllers.size() == 1 + ? BuildImagePath() + : BuildImagePathForDisplay(display_index)); + ++display_index; + } + + // Since this doesn't create a capture mode session, log metrics here. + RecordCaptureModeEntryType(CaptureModeEntryType::kCaptureAllDisplays); + RecordCaptureModeConfiguration(CaptureModeType::kImage, + CaptureModeSource::kFullscreen, + /*audio_on=*/false); +} + CaptureModeSaveToLocation CaptureModeController::GetSaveToOption( const base::FilePath& path) { DCHECK(Shell::Get()->session_controller()->IsActiveUserSessionStarted());
diff --git a/ash/capture_mode/capture_mode_controller.h b/ash/capture_mode/capture_mode_controller.h index f90cf7d..b72190a0 100644 --- a/ash/capture_mode/capture_mode_controller.h +++ b/ash/capture_mode/capture_mode_controller.h
@@ -405,6 +405,11 @@ bool in_projector_mode, bool proceed); + // Bound to a callback that will be called by DLP manager to let the user know + // whether full screen capture on all displays should `proceed` or abort due + // to some restricted contents on the screen. + void OnDlpRestrictionCheckedAtCaptureScreenshotsOfAllDisplays(bool proceed); + // Gets the corresponding `SaveLocation` enum value on the given `path`. CaptureModeSaveToLocation GetSaveToOption(const base::FilePath& path);
diff --git a/ash/components/arc/BUILD.gn b/ash/components/arc/BUILD.gn index 2422a81aa..7b7370e 100644 --- a/ash/components/arc/BUILD.gn +++ b/ash/components/arc/BUILD.gn
@@ -276,8 +276,8 @@ ] public_deps = [ + "//ash/components/arc/mojom:notifications", "//ash/components/arc/session:connection_holder", - "//components/arc/mojom:notifications", ] }
diff --git a/components/arc/bitmap/OWNERS b/ash/components/arc/bitmap/OWNERS similarity index 100% rename from components/arc/bitmap/OWNERS rename to ash/components/arc/bitmap/OWNERS
diff --git a/components/arc/bitmap/bitmap_mojom_traits.cc b/ash/components/arc/bitmap/bitmap_mojom_traits.cc similarity index 95% rename from components/arc/bitmap/bitmap_mojom_traits.cc rename to ash/components/arc/bitmap/bitmap_mojom_traits.cc index 9abd471..03f2e05 100644 --- a/components/arc/bitmap/bitmap_mojom_traits.cc +++ b/ash/components/arc/bitmap/bitmap_mojom_traits.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/bitmap/bitmap_mojom_traits.h" +#include "ash/components/arc/bitmap/bitmap_mojom_traits.h" namespace mojo {
diff --git a/components/arc/bitmap/bitmap_mojom_traits.h b/ash/components/arc/bitmap/bitmap_mojom_traits.h similarity index 78% rename from components/arc/bitmap/bitmap_mojom_traits.h rename to ash/components/arc/bitmap/bitmap_mojom_traits.h index e2d2424..3fe1027 100644 --- a/components/arc/bitmap/bitmap_mojom_traits.h +++ b/ash/components/arc/bitmap/bitmap_mojom_traits.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_BITMAP_BITMAP_MOJOM_TRAITS_H_ -#define COMPONENTS_ARC_BITMAP_BITMAP_MOJOM_TRAITS_H_ +#ifndef ASH_COMPONENTS_ARC_BITMAP_BITMAP_MOJOM_TRAITS_H_ +#define ASH_COMPONENTS_ARC_BITMAP_BITMAP_MOJOM_TRAITS_H_ +#include "ash/components/arc/mojom/bitmap.mojom-shared.h" #include "base/containers/span.h" -#include "components/arc/mojom/bitmap.mojom-shared.h" #include "third_party/skia/include/core/SkBitmap.h" namespace mojo { @@ -28,4 +28,4 @@ } // namespace mojo -#endif // COMPONENTS_ARC_BITMAP_BITMAP_MOJOM_TRAITS_H_ +#endif // ASH_COMPONENTS_ARC_BITMAP_BITMAP_MOJOM_TRAITS_H_
diff --git a/ash/components/arc/mojom/BUILD.gn b/ash/components/arc/mojom/BUILD.gn new file mode 100644 index 0000000..93e3b4b0 --- /dev/null +++ b/ash/components/arc/mojom/BUILD.gn
@@ -0,0 +1,79 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/chromeos/ui_mode.gni") +import("//mojo/public/tools/bindings/mojom.gni") + +# This needs to be conditionally-compiled since the typemaps are +# unconditionally-included from //mojo/public/tools/bindings/mojom.gni. The +# inclusion is done through read_file(), which does not respect the global +# defines for GN, so it itself cannot use the "is_chromeos" variable. +if (is_chromeos_ash) { + mojom("camera_intent") { + sources = [ "camera_intent.mojom" ] + webui_module_path = "/ash/components/arc/mojom" + } + + mojom("notifications") { + sources = [ + "bitmap.mojom", + "notifications.mojom", + ] + + deps = [ "//components/arc/mojom:media" ] # for gfx.mojom + + cpp_typemaps = [ + { + types = [ + { + mojom = "arc.mojom.ArcBitmap" + cpp = "::SkBitmap" + }, + ] + traits_headers = [ "//ash/components/arc/bitmap/bitmap_mojom_traits.h" ] + traits_sources = + [ "//ash/components/arc/bitmap/bitmap_mojom_traits.cc" ] + traits_public_deps = [ "//skia" ] + }, + ] + } + + mojom("oemcrypto") { + sources = [ "oemcrypto.mojom" ] + } + + mojom("protected_buffer_manager") { + sources = [ "protected_buffer_manager.mojom" ] + public_deps = [ "//sandbox/policy/mojom" ] + } + + source_set("mojom_traits") { + sources = [ + "ime_mojom_traits.cc", + "ime_mojom_traits.h", + ] + + deps = [ + "//components/arc/mojom:mojom", + "//ui/base/ime:text_input_types", + "//ui/events", + "//ui/events/ozone/layout", + ] + } + source_set("unit_tests") { + testonly = true + sources = [ + "ime_mojom_traits_unittest.cc", + "video_accelerator_mojom_traits_unittest.cc", + ] + + deps = [ + ":mojom_traits", + "//components/arc/mojom:mojom", + "//media", + "//mojo/public/cpp/test_support:test_utils", + "//testing/gtest", + ] + } +}
diff --git a/ash/components/arc/mojom/OWNERS b/ash/components/arc/mojom/OWNERS new file mode 100644 index 0000000..4b221a85 --- /dev/null +++ b/ash/components/arc/mojom/OWNERS
@@ -0,0 +1,7 @@ +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS +per-file *.mojom=file://chromeos/SECURITY_OWNERS + +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS +per-file *_mojom_traits*.*=file://chromeos/SECURITY_OWNERS
diff --git a/components/arc/mojom/bitmap.mojom b/ash/components/arc/mojom/bitmap.mojom similarity index 100% rename from components/arc/mojom/bitmap.mojom rename to ash/components/arc/mojom/bitmap.mojom
diff --git a/components/arc/mojom/camera_intent.mojom b/ash/components/arc/mojom/camera_intent.mojom similarity index 100% rename from components/arc/mojom/camera_intent.mojom rename to ash/components/arc/mojom/camera_intent.mojom
diff --git a/components/arc/mojom/ime_mojom_traits.cc b/ash/components/arc/mojom/ime_mojom_traits.cc similarity index 96% rename from components/arc/mojom/ime_mojom_traits.cc rename to ash/components/arc/mojom/ime_mojom_traits.cc index eaf27c0..a961716 100644 --- a/components/arc/mojom/ime_mojom_traits.cc +++ b/ash/components/arc/mojom/ime_mojom_traits.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/mojom/ime_mojom_traits.h" +#include "ash/components/arc/mojom/ime_mojom_traits.h" #include "ui/events/keycodes/dom/dom_code.h" #include "ui/events/keycodes/dom/keycode_converter.h"
diff --git a/components/arc/mojom/ime_mojom_traits.h b/ash/components/arc/mojom/ime_mojom_traits.h similarity index 96% rename from components/arc/mojom/ime_mojom_traits.h rename to ash/components/arc/mojom/ime_mojom_traits.h index e09faad0..e30fd361 100644 --- a/components/arc/mojom/ime_mojom_traits.h +++ b/ash/components/arc/mojom/ime_mojom_traits.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_MOJOM_IME_MOJOM_TRAITS_H_ -#define COMPONENTS_ARC_MOJOM_IME_MOJOM_TRAITS_H_ +#ifndef ASH_COMPONENTS_ARC_MOJOM_IME_MOJOM_TRAITS_H_ +#define ASH_COMPONENTS_ARC_MOJOM_IME_MOJOM_TRAITS_H_ #include "components/arc/mojom/ime.mojom-shared.h" #include "ui/base/ime/text_input_type.h" @@ -139,4 +139,4 @@ } // namespace mojo -#endif // COMPONENTS_ARC_MOJOM_IME_MOJOM_TRAITS_H_ +#endif // ASH_COMPONENTS_ARC_MOJOM_IME_MOJOM_TRAITS_H_
diff --git a/components/arc/mojom/ime_mojom_traits_unittest.cc b/ash/components/arc/mojom/ime_mojom_traits_unittest.cc similarity index 100% rename from components/arc/mojom/ime_mojom_traits_unittest.cc rename to ash/components/arc/mojom/ime_mojom_traits_unittest.cc
diff --git a/components/arc/mojom/notifications.mojom b/ash/components/arc/mojom/notifications.mojom similarity index 99% rename from components/arc/mojom/notifications.mojom rename to ash/components/arc/mojom/notifications.mojom index 248c550..e32a2f1e0 100644 --- a/components/arc/mojom/notifications.mojom +++ b/ash/components/arc/mojom/notifications.mojom
@@ -6,7 +6,7 @@ module arc.mojom; -import "components/arc/mojom/bitmap.mojom"; +import "ash/components/arc/mojom/bitmap.mojom"; import "components/arc/mojom/gfx.mojom"; // These values must be matched with the NOTIFICATION_EVENT_* constants in
diff --git a/components/arc/mojom/oemcrypto.mojom b/ash/components/arc/mojom/oemcrypto.mojom similarity index 100% rename from components/arc/mojom/oemcrypto.mojom rename to ash/components/arc/mojom/oemcrypto.mojom
diff --git a/components/arc/mojom/protected_buffer_manager.mojom b/ash/components/arc/mojom/protected_buffer_manager.mojom similarity index 100% rename from components/arc/mojom/protected_buffer_manager.mojom rename to ash/components/arc/mojom/protected_buffer_manager.mojom
diff --git a/components/arc/mojom/video_accelerator_mojom_traits_unittest.cc b/ash/components/arc/mojom/video_accelerator_mojom_traits_unittest.cc similarity index 100% rename from components/arc/mojom/video_accelerator_mojom_traits_unittest.cc rename to ash/components/arc/mojom/video_accelerator_mojom_traits_unittest.cc
diff --git a/ash/components/arc/session/arc_bridge_host_impl.cc b/ash/components/arc/session/arc_bridge_host_impl.cc index 3812bb2..6030ab1 100644 --- a/ash/components/arc/session/arc_bridge_host_impl.cc +++ b/ash/components/arc/session/arc_bridge_host_impl.cc
@@ -7,6 +7,8 @@ #include <algorithm> #include <utility> +#include "ash/components/arc/mojom/notifications.mojom.h" +#include "ash/components/arc/mojom/oemcrypto.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/mojo_channel.h" #include "ash/public/cpp/external_arc/message_center/arc_notification_manager.h" @@ -49,9 +51,7 @@ #include "components/arc/mojom/midis.mojom.h" #include "components/arc/mojom/nearby_share.mojom.h" #include "components/arc/mojom/net.mojom.h" -#include "components/arc/mojom/notifications.mojom.h" #include "components/arc/mojom/obb_mounter.mojom.h" -#include "components/arc/mojom/oemcrypto.mojom.h" #include "components/arc/mojom/payment_app.mojom.h" #include "components/arc/mojom/pip.mojom.h" #include "components/arc/mojom/policy.mojom.h"
diff --git a/ash/components/arc/session/arc_bridge_service.cc b/ash/components/arc/session/arc_bridge_service.cc index 5459220c..25c6be1 100644 --- a/ash/components/arc/session/arc_bridge_service.cc +++ b/ash/components/arc/session/arc_bridge_service.cc
@@ -5,6 +5,7 @@ #include "ash/components/arc/session/arc_bridge_service.h" // These header is necessary for instantiation of ConnectionHolder. +#include "ash/components/arc/mojom/oemcrypto.mojom.h" #include "components/arc/mojom/accessibility_helper.mojom.h" #include "components/arc/mojom/adbd.mojom.h" #include "components/arc/mojom/app.mojom.h" @@ -39,7 +40,6 @@ #include "components/arc/mojom/nearby_share.mojom.h" #include "components/arc/mojom/net.mojom.h" #include "components/arc/mojom/obb_mounter.mojom.h" -#include "components/arc/mojom/oemcrypto.mojom.h" #include "components/arc/mojom/payment_app.mojom.h" #include "components/arc/mojom/pip.mojom.h" #include "components/arc/mojom/policy.mojom.h"
diff --git a/ash/components/arc/test/fake_arc_bridge_host.cc b/ash/components/arc/test/fake_arc_bridge_host.cc index a74ca25..bb56354f 100644 --- a/ash/components/arc/test/fake_arc_bridge_host.cc +++ b/ash/components/arc/test/fake_arc_bridge_host.cc
@@ -4,6 +4,8 @@ #include "ash/components/arc/test/fake_arc_bridge_host.h" +#include "ash/components/arc/mojom/notifications.mojom.h" +#include "ash/components/arc/mojom/oemcrypto.mojom.h" #include "components/arc/mojom/accessibility_helper.mojom.h" #include "components/arc/mojom/adbd.mojom.h" #include "components/arc/mojom/app.mojom.h" @@ -38,9 +40,7 @@ #include "components/arc/mojom/midis.mojom.h" #include "components/arc/mojom/nearby_share.mojom.h" #include "components/arc/mojom/net.mojom.h" -#include "components/arc/mojom/notifications.mojom.h" #include "components/arc/mojom/obb_mounter.mojom.h" -#include "components/arc/mojom/oemcrypto.mojom.h" #include "components/arc/mojom/pip.mojom.h" #include "components/arc/mojom/policy.mojom.h" #include "components/arc/mojom/power.mojom.h"
diff --git a/ash/components/arc/test/fake_notifications_instance.h b/ash/components/arc/test/fake_notifications_instance.h index aa642a0..2b816ecc 100644 --- a/ash/components/arc/test/fake_notifications_instance.h +++ b/ash/components/arc/test/fake_notifications_instance.h
@@ -9,7 +9,7 @@ #include <utility> #include <vector> -#include "components/arc/mojom/notifications.mojom.h" +#include "ash/components/arc/mojom/notifications.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" namespace arc {
diff --git a/ash/components/arc/video_accelerator/protected_buffer_manager_proxy.h b/ash/components/arc/video_accelerator/protected_buffer_manager_proxy.h index d8fe68f3..553aa89 100644 --- a/ash/components/arc/video_accelerator/protected_buffer_manager_proxy.h +++ b/ash/components/arc/video_accelerator/protected_buffer_manager_proxy.h
@@ -5,7 +5,7 @@ #ifndef ASH_COMPONENTS_ARC_VIDEO_ACCELERATOR_PROTECTED_BUFFER_MANAGER_PROXY_H_ #define ASH_COMPONENTS_ARC_VIDEO_ACCELERATOR_PROTECTED_BUFFER_MANAGER_PROXY_H_ -#include "components/arc/mojom/protected_buffer_manager.mojom.h" +#include "ash/components/arc/mojom/protected_buffer_manager.mojom.h" namespace arc {
diff --git a/ash/public/cpp/BUILD.gn b/ash/public/cpp/BUILD.gn index aa5ee54..9e8b32c 100644 --- a/ash/public/cpp/BUILD.gn +++ b/ash/public/cpp/BUILD.gn
@@ -375,6 +375,7 @@ ] public_deps = [ + "//ash/components/arc/mojom:notifications", "//ash/components/security_token_pin", "//ash/public/mojom", "//ash/webui/personalization_app/proto", @@ -385,7 +386,6 @@ "//chromeos/services/cellular_setup/public/mojom", "//chromeos/services/network_config/public/mojom", "//components/app_restore", - "//components/arc/mojom:notifications", "//components/session_manager:base", "//components/user_manager", "//ui/base/ime/ash:ime_types",
diff --git a/ash/public/cpp/external_arc/BUILD.gn b/ash/public/cpp/external_arc/BUILD.gn index 42547cd..c5a76521 100644 --- a/ash/public/cpp/external_arc/BUILD.gn +++ b/ash/public/cpp/external_arc/BUILD.gn
@@ -38,12 +38,12 @@ "//ash", "//ash/components/arc:arc_base_utils", "//ash/components/arc:arc_metrics_constants", + "//ash/components/arc/mojom:notifications", "//ash/components/arc/session:connection_holder", "//ash/constants", "//ash/public/cpp", "//base", "//components/account_id", - "//components/arc/mojom:notifications", "//components/exo", "//mojo/public/cpp/system", "//ui/accessibility:accessibility",
diff --git a/ash/public/cpp/external_arc/message_center/DEPS b/ash/public/cpp/external_arc/message_center/DEPS index b8dc5c2..f9fb7906 100644 --- a/ash/public/cpp/external_arc/message_center/DEPS +++ b/ash/public/cpp/external_arc/message_center/DEPS
@@ -1,9 +1,9 @@ include_rules = [ + "+ash/components/arc/mojom/notifications.mojom.h", "+ash/components/arc/session/connection_holder.h", "+ash/components/arc/session/connection_observer.h", "+ash/components/arc/session/mojo_channel.h", "+ash/system/message_center/message_view_factory.h", - "+components/arc/mojom/notifications.mojom.h", "+components/arc/metrics/arc_metrics_constants.h", "+components/arc/test/connection_holder_util.h", "+components/arc/test/fake_notifications_instance.h",
diff --git a/ash/public/cpp/external_arc/message_center/arc_notification_item.h b/ash/public/cpp/external_arc/message_center/arc_notification_item.h index bc780d1..c43b4a5 100644 --- a/ash/public/cpp/external_arc/message_center/arc_notification_item.h +++ b/ash/public/cpp/external_arc/message_center/arc_notification_item.h
@@ -5,7 +5,7 @@ #ifndef ASH_PUBLIC_CPP_EXTERNAL_ARC_MESSAGE_CENTER_ARC_NOTIFICATION_ITEM_H_ #define ASH_PUBLIC_CPP_EXTERNAL_ARC_MESSAGE_CENTER_ARC_NOTIFICATION_ITEM_H_ -#include "components/arc/mojom/notifications.mojom.h" +#include "ash/components/arc/mojom/notifications.mojom.h" #include "ui/gfx/image/image_skia.h" namespace ash {
diff --git a/ash/public/cpp/external_arc/message_center/arc_notification_manager.h b/ash/public/cpp/external_arc/message_center/arc_notification_manager.h index adf0edbe7..1a3f491 100644 --- a/ash/public/cpp/external_arc/message_center/arc_notification_manager.h +++ b/ash/public/cpp/external_arc/message_center/arc_notification_manager.h
@@ -9,13 +9,13 @@ #include <string> #include <unordered_map> +#include "ash/components/arc/mojom/notifications.mojom.h" #include "ash/components/arc/session/connection_holder.h" #include "ash/components/arc/session/connection_observer.h" #include "ash/public/cpp/message_center/arc_notification_manager_base.h" #include "base/memory/weak_ptr.h" #include "base/observer_list_types.h" #include "components/account_id/account_id.h" -#include "components/arc/mojom/notifications.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "ui/message_center/message_center.h"
diff --git a/ash/public/cpp/message_center/DEPS b/ash/public/cpp/message_center/DEPS index 660f7c2e..85a1961 100644 --- a/ash/public/cpp/message_center/DEPS +++ b/ash/public/cpp/message_center/DEPS
@@ -1,3 +1,3 @@ include_rules = [ - "+components/arc/mojom/notifications.mojom.h", + "+ash/components/arc/mojom/notifications.mojom.h", ]
diff --git a/ash/webui/camera_app_ui/BUILD.gn b/ash/webui/camera_app_ui/BUILD.gn index 1365e87..da705e1 100644 --- a/ash/webui/camera_app_ui/BUILD.gn +++ b/ash/webui/camera_app_ui/BUILD.gn
@@ -112,8 +112,8 @@ sources = [ "camera_app_helper.mojom" ] deps = [ + "//ash/components/arc/mojom:camera_intent", "//chromeos/services/machine_learning/public/mojom:document_scanner_param_types", - "//components/arc/mojom:camera_intent", "//ui/gfx/geometry/mojom", ] webui_module_path = "/ash/webui/camera_app_ui" @@ -184,9 +184,9 @@ generate_grd("build_mojo_grdp") { deps = [ + "//ash/components/arc/mojom:camera_intent_js", "//ash/webui/camera_app_ui:mojo_bindings_js", "//chromeos/services/machine_learning/public/mojom:document_scanner_param_types_js", - "//components/arc/mojom:camera_intent_js", "//media/capture/mojom:image_capture_js", "//media/capture/video/chromeos/mojom:cros_camera_js", ] @@ -202,9 +202,9 @@ # (https://github.com/google/closure-compiler/issues/2257), this clean-up is # blocked by migration to TypeScript. input_files = [ + "ash/components/arc/mojom/camera_intent.mojom-webui.js", "ash/webui/camera_app_ui/camera_app_helper.mojom-webui.js", "chromeos/services/machine_learning/public/mojom/document_scanner_param_types.mojom-webui.js", - "components/arc/mojom/camera_intent.mojom-webui.js", "media/capture/mojom/image_capture.mojom-webui.js", "media/capture/video/chromeos/mojom/camera3.mojom-webui.js", "media/capture/video/chromeos/mojom/camera_app.mojom-webui.js",
diff --git a/ash/webui/camera_app_ui/camera_app_helper.mojom b/ash/webui/camera_app_ui/camera_app_helper.mojom index 421be29..84ca371 100644 --- a/ash/webui/camera_app_ui/camera_app_helper.mojom +++ b/ash/webui/camera_app_ui/camera_app_helper.mojom
@@ -4,8 +4,8 @@ module ash.camera_app.mojom; +import "ash/components/arc/mojom/camera_intent.mojom"; import "chromeos/services/machine_learning/public/mojom/document_scanner_param_types.mojom"; -import "components/arc/mojom/camera_intent.mojom"; import "ui/gfx/geometry/mojom/geometry.mojom"; // Interface for monitoring tablet mode state of device. The state is detected
diff --git a/ash/webui/camera_app_ui/resources/js/BUILD.gn b/ash/webui/camera_app_ui/resources/js/BUILD.gn index aa0a9ae..a9a09c2 100644 --- a/ash/webui/camera_app_ui/resources/js/BUILD.gn +++ b/ash/webui/camera_app_ui/resources/js/BUILD.gn
@@ -56,8 +56,8 @@ deps = [ ":preload_images", + "//ash/components/arc/mojom:camera_intent_webui_js", "//ash/webui/camera_app_ui:mojo_bindings_webui_js", - "//components/arc/mojom:camera_intent_webui_js", "//media/capture/mojom:image_capture_webui_js", "//media/capture/video/chromeos/mojom:cros_camera_common_webui_js", ]
diff --git a/ash/webui/camera_app_ui/resources/js/mojo/chrome_helper.js b/ash/webui/camera_app_ui/resources/js/mojo/chrome_helper.js index f330994b..80b5330a 100644 --- a/ash/webui/camera_app_ui/resources/js/mojo/chrome_helper.js +++ b/ash/webui/camera_app_ui/resources/js/mojo/chrome_helper.js
@@ -22,7 +22,7 @@ /* eslint-enable max-len */ import { CameraIntentAction, -} from '/components/arc/mojom/camera_intent.mojom-webui.js'; +} from '/ash/components/arc/mojom/camera_intent.mojom-webui.js'; import { PointF, // eslint-disable-line no-unused-vars } from 'chrome://resources/mojo/ui/gfx/geometry/mojom/geometry.mojom-webui.js';
diff --git a/ash/webui/firmware_update_ui/firmware_update_app_ui.cc b/ash/webui/firmware_update_ui/firmware_update_app_ui.cc index 301a326c..8e871d8 100644 --- a/ash/webui/firmware_update_ui/firmware_update_app_ui.cc +++ b/ash/webui/firmware_update_ui/firmware_update_app_ui.cc
@@ -45,7 +45,8 @@ {"hasBeenUpdated", IDS_FIRMWARE_HAS_BEEN_UPDATED_TEXT}, {"updatingInfo", IDS_FIRMWARE_UPDATING_INFO_TEXT}, {"installing", IDS_FIRMWARE_INSTALLING_TEXT}, - {"upToDate", IDS_FIRMWARE_UP_TO_DATE_TEXT}}; + {"upToDate", IDS_FIRMWARE_UP_TO_DATE_TEXT}, + {"versionText", IDS_FIRMWARE_VERSION_TEXT}}; source->AddLocalizedStrings(kLocalizedStrings); source->UseStringsJs();
diff --git a/ash/webui/firmware_update_ui/resources/firmware_shared_fonts.html b/ash/webui/firmware_update_ui/resources/firmware_shared_fonts.html index c73997d4..c027ecd 100644 --- a/ash/webui/firmware_update_ui/resources/firmware_shared_fonts.html +++ b/ash/webui/firmware_update_ui/resources/firmware_shared_fonts.html
@@ -9,6 +9,8 @@ /** Font sizes */ --firmware-default-font-size: 14px; --firmware-header-font-size: 22px; + --firmware-version-font-size: 13px; + --firmware-description-font-size: 13px; /** Font weights */ --firmware-regular-font-weight: 400; @@ -16,6 +18,10 @@ /** Line heights */ --firmware-header-line-height: 28px; + --firmware-name-line-height: 20px; + --firmware-version-line-height: 20px; + --firmware-description-line-height: 20px; + } .firmware-default-font { @@ -32,5 +38,28 @@ line-height: var(--firmware-header-line-height); } + .firmware-name-font { + color: var(--cros-text-color-primary); + font-family: var(--firmware-roboto-font-family); + font-size: var(--firmware-default-font-size); + font-weight: var(--firmware-medium-font-weight); + line-height: var(--firmware-name-line-height); + } + + .firmware-version-font { + color: var(--cros-text-color-primary); + font-family: var(--firmware-roboto-font-family); + font-size: var(--firmware-version-font-size); + font-weight: var(--firmware-regular-font-weight); + line-height: var(--firmware-version-line-height); + } + + .firmware-description-font { + color: var(--cros-text-color-secondary); + font-family: var(--firmware-roboto-font-family); + font-size: var(--firmware-description-font-size); + font-weight: var(--firmware-regular-font-weight); + line-height: var(--firmware-description-line-height); + } </style> </template>
diff --git a/ash/webui/firmware_update_ui/resources/update_card.html b/ash/webui/firmware_update_ui/resources/update_card.html index f4e78d6..611f8da 100644 --- a/ash/webui/firmware_update_ui/resources/update_card.html +++ b/ash/webui/firmware_update_ui/resources/update_card.html
@@ -3,7 +3,19 @@ border-bottom: var(--cr-separator-line); display: flex; justify-content: space-between; - margin: 8px 0; + margin-bottom: 12px; + } + + #description { + margin-bottom: 8px; + } + + #name { + margin-bottom: 2px; + } + + #version { + margin-bottom: 4px; } #priorityText::before { @@ -12,7 +24,7 @@ } .update-info { - width: 80%; + margin-inline-end: 48px; } .update-info > div { @@ -21,15 +33,19 @@ </style> <div id="container"> <div class="update-info"> - <div id="name">[[update.deviceName]]</div> - <div id="version"> - <span>[[update.version]]</span> + <div id="name" class="firmware-name-font"> + [[update.deviceName]] + </div> + <div id="version" class="firmware-version-font"> + <span>[[computeVersionText_(update.version)]]</span> <span id ="priorityText" hidden$="[[!isCriticalUpdate_(update.priority)]]"> [[i18n('criticalUpdate')]] </span> </div> - <div id="description">[[update.description]]</div> + <div id="description" class="firmware-description-font"> + [[update.description]] + </div> </div> <cr-button id="updateButton" on-click="onUpdateButtonClicked_"> [[i18n('updateButton')]]
diff --git a/ash/webui/firmware_update_ui/resources/update_card.js b/ash/webui/firmware_update_ui/resources/update_card.js index 2340efc..f7a9043 100644 --- a/ash/webui/firmware_update_ui/resources/update_card.js +++ b/ash/webui/firmware_update_ui/resources/update_card.js
@@ -59,6 +59,18 @@ eventName, {bubbles: true, composed: true, detail: {update: this.update}})); } + + /** + * @protected + * @return {string} + */ + computeVersionText_() { + if (!this.update.version) { + return ''; + } + + return this.i18n('versionText', this.update.version); + } } customElements.define(UpdateCardElement.is, UpdateCardElement);
diff --git a/ash/webui/shimless_rma/backend/shimless_rma_service.cc b/ash/webui/shimless_rma/backend/shimless_rma_service.cc index f1edc49..57c1acf3a 100644 --- a/ash/webui/shimless_rma/backend/shimless_rma_service.cc +++ b/ash/webui/shimless_rma/backend/shimless_rma_service.cc
@@ -32,8 +32,8 @@ namespace { -mojom::RmaState RmadStateToMojo(rmad::RmadState::StateCase rmadState) { - return mojo::EnumTraits<ash::shimless_rma::mojom::RmaState, +mojom::State RmadStateToMojo(rmad::RmadState::StateCase rmadState) { + return mojo::EnumTraits<ash::shimless_rma::mojom::State, rmad::RmadState::StateCase>::ToMojom(rmadState); } @@ -119,7 +119,7 @@ void ShimlessRmaService::BeginFinalization(BeginFinalizationCallback callback) { if (state_proto_.state_case() != rmad::RmadState::kWelcome || - mojo_state_ != mojom::RmaState::kWelcomeScreen) { + mojo_state_ != mojom::State::kWelcomeScreen) { LOG(ERROR) << "FinalizeRepair called from incorrect state " << state_proto_.state_case(); std::move(callback).Run(RmadStateToMojo(state_proto_.state_case()), @@ -147,7 +147,7 @@ void ShimlessRmaService::NetworkSelectionComplete( NetworkSelectionCompleteCallback callback) { if (state_proto_.state_case() != rmad::RmadState::kWelcome || - mojo_state_ != mojom::RmaState::kConfigureNetwork) { + mojo_state_ != mojom::State::kConfigureNetwork) { LOG(ERROR) << "NetworkSelectionComplete called from incorrect state " << state_proto_.state_case() << " / " << mojo_state_; std::move(callback).Run(RmadStateToMojo(state_proto_.state_case()), @@ -174,7 +174,7 @@ void ShimlessRmaService::CheckForOsUpdates(CheckForOsUpdatesCallback callback) { if (state_proto_.state_case() != rmad::RmadState::kWelcome || - mojo_state_ != mojom::RmaState::kUpdateOs) { + mojo_state_ != mojom::State::kUpdateOs) { LOG(ERROR) << "CheckForOsUpdates called from incorrect state " << state_proto_.state_case() << " / " << mojo_state_; std::move(callback).Run(false, ""); @@ -192,7 +192,7 @@ void ShimlessRmaService::UpdateOs(UpdateOsCallback callback) { if (state_proto_.state_case() != rmad::RmadState::kWelcome || - mojo_state_ != mojom::RmaState::kUpdateOs) { + mojo_state_ != mojom::State::kUpdateOs) { LOG(ERROR) << "UpdateOs called from incorrect state " << state_proto_.state_case() << " / " << mojo_state_; std::move(callback).Run(false); @@ -203,7 +203,7 @@ void ShimlessRmaService::UpdateOsSkipped(UpdateOsSkippedCallback callback) { if (state_proto_.state_case() != rmad::RmadState::kWelcome || - mojo_state_ != mojom::RmaState::kUpdateOs) { + mojo_state_ != mojom::State::kUpdateOs) { LOG(ERROR) << "UpdateOsSkipped called from incorrect state " << state_proto_.state_case() << " / " << mojo_state_; std::move(callback).Run(RmadStateToMojo(state_proto_.state_case()), @@ -215,8 +215,7 @@ LOG(ERROR) << "UpdateOsSkipped called while UpdateEngine active"; // Override the rmad state (kWelcome) with the mojo sub-state for OS // updates. - std::move(callback).Run(mojom::RmaState::kUpdateOs, can_abort_, - can_go_back_, + std::move(callback).Run(mojom::State::kUpdateOs, can_abort_, can_go_back_, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); return; } @@ -962,7 +961,7 @@ LOG(ERROR) << "Failed to call rmadClient"; // TODO(gavindodd): This needs better handling. Maybe display an error and // force a chrome update? - std::move(callback).Run(mojom::RmaState::kUnknown, false, false, + std::move(callback).Run(mojom::State::kUnknown, false, false, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); return; } @@ -1003,8 +1002,8 @@ switch (network->type) { case NetworkType::kWiFi: case NetworkType::kEthernet: - mojo_state_ = mojom::RmaState::kUpdateOs; - std::move(callback).Run(mojom::RmaState::kUpdateOs, can_abort_, + mojo_state_ = mojom::State::kUpdateOs; + std::move(callback).Run(mojom::State::kUpdateOs, can_abort_, can_go_back_, rmad::RmadErrorCode::RMAD_ERROR_OK); return; @@ -1018,8 +1017,8 @@ } } } - mojo_state_ = mojom::RmaState::kConfigureNetwork; - std::move(callback).Run(mojom::RmaState::kConfigureNetwork, can_abort_, + mojo_state_ = mojom::State::kConfigureNetwork; + std::move(callback).Run(mojom::State::kConfigureNetwork, can_abort_, can_go_back_, rmad::RmadErrorCode::RMAD_ERROR_OK); } @@ -1068,9 +1067,9 @@ if (version.empty()) { TransitionNextStateGeneric(std::move(callback)); } else { - mojo_state_ = mojom::RmaState::kUpdateOs; - std::move(callback).Run(mojom::RmaState::kUpdateOs, can_abort_, - can_go_back_, rmad::RmadErrorCode::RMAD_ERROR_OK); + mojo_state_ = mojom::State::kUpdateOs; + std::move(callback).Run(mojom::State::kUpdateOs, can_abort_, can_go_back_, + rmad::RmadErrorCode::RMAD_ERROR_OK); } }
diff --git a/ash/webui/shimless_rma/backend/shimless_rma_service.h b/ash/webui/shimless_rma/backend/shimless_rma_service.h index 00a52510..f94c8698 100644 --- a/ash/webui/shimless_rma/backend/shimless_rma_service.h +++ b/ash/webui/shimless_rma/backend/shimless_rma_service.h
@@ -167,8 +167,8 @@ void OsUpdateProgress(update_engine::Operation operation, double progress); private: - using TransitionStateCallback = base::OnceCallback< - void(mojom::RmaState, bool, bool, rmad::RmadErrorCode)>; + using TransitionStateCallback = + base::OnceCallback<void(mojom::State, bool, bool, rmad::RmadErrorCode)>; template <class Callback> void TransitionNextStateGeneric(Callback callback); @@ -197,7 +197,7 @@ bool can_abort_ = false; bool can_go_back_ = false; // Used to validate mojo only states such as kConfigureNetwork - mojom::RmaState mojo_state_; + mojom::State mojo_state_; absl::optional<rmad::CalibrationComponentStatus> last_calibration_progress_; absl::optional<rmad::CalibrationOverallStatus>
diff --git a/ash/webui/shimless_rma/backend/shimless_rma_service_unittest.cc b/ash/webui/shimless_rma/backend/shimless_rma_service_unittest.cc index 85d7ba4..c6fb346 100644 --- a/ash/webui/shimless_rma/backend/shimless_rma_service_unittest.cc +++ b/ash/webui/shimless_rma/backend/shimless_rma_service_unittest.cc
@@ -235,9 +235,9 @@ // Initialize current state, can_cancel=true, can_go_back=false shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); EXPECT_EQ(can_cancel, true); EXPECT_EQ(can_go_back, false); @@ -246,9 +246,9 @@ // Next state, can_cancel=false, can_go_back=true shimless_rma_provider_->SetSameOwner(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kSelectComponents); + EXPECT_EQ(state, mojom::State::kSelectComponents); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); EXPECT_EQ(can_cancel, false); EXPECT_EQ(can_go_back, true); @@ -256,9 +256,9 @@ run_loop.RunUntilIdle(); // Previous state, can_cancel=true, can_go_back=false shimless_rma_provider_->TransitionPreviousState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); EXPECT_EQ(can_cancel, true); EXPECT_EQ(can_go_back, false); @@ -280,18 +280,18 @@ // Initialize current state shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kWelcomeScreen); + EXPECT_EQ(state, mojom::State::kWelcomeScreen); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); // With a WiFi network it should redirect to kUpdateOs shimless_rma_provider_->BeginFinalization(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kUpdateOs); + EXPECT_EQ(state, mojom::State::kUpdateOs); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -309,9 +309,9 @@ // Initialize current state shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kWelcomeScreen); + EXPECT_EQ(state, mojom::State::kWelcomeScreen); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -321,9 +321,9 @@ // No network should prompt select network page shimless_rma_provider_->BeginFinalization(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kConfigureNetwork); + EXPECT_EQ(state, mojom::State::kConfigureNetwork); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -341,18 +341,18 @@ // Initialize current state shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kWelcomeScreen); + EXPECT_EQ(state, mojom::State::kWelcomeScreen); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); // No network should prompt select network page shimless_rma_provider_->BeginFinalization(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kConfigureNetwork); + EXPECT_EQ(state, mojom::State::kConfigureNetwork); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -360,9 +360,9 @@ // With a WiFi network it should redirect to kUpdateOs shimless_rma_provider_->NetworkSelectionComplete(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kUpdateOs); + EXPECT_EQ(state, mojom::State::kUpdateOs); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -380,27 +380,27 @@ // Initialize current state shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kWelcomeScreen); + EXPECT_EQ(state, mojom::State::kWelcomeScreen); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); // No network should prompt select network page shimless_rma_provider_->BeginFinalization(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kConfigureNetwork); + EXPECT_EQ(state, mojom::State::kConfigureNetwork); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); // With no network it should redirect to next rmad state shimless_rma_provider_->NetworkSelectionComplete(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kSelectComponents); + EXPECT_EQ(state, mojom::State::kSelectComponents); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -419,9 +419,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -433,9 +433,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kUnknown); + EXPECT_EQ(state, mojom::State::kUnknown); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_RMA_NOT_REQUIRED); run_loop.Quit(); })); @@ -451,23 +451,23 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->SetSameOwner(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kSelectComponents); + EXPECT_EQ(state, mojom::State::kSelectComponents); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->TransitionPreviousState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -484,9 +484,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->TransitionPreviousState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_TRANSITION_FAILED); run_loop.Quit(); })); @@ -499,16 +499,16 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->TransitionPreviousState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_TRANSITION_FAILED); run_loop.Quit(); })); @@ -557,17 +557,17 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->SetSameOwner(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kRestock); + EXPECT_EQ(state, mojom::State::kRestock); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -580,17 +580,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kRestock); + EXPECT_EQ(state, mojom::State::kRestock); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->SetSameOwner(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kRestock); + EXPECT_EQ(state, mojom::State::kRestock); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -611,17 +611,17 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->SetDifferentOwner(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kRestock); + EXPECT_EQ(state, mojom::State::kRestock); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -634,16 +634,16 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kRestock); + EXPECT_EQ(state, mojom::State::kRestock); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->SetDifferentOwner(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kRestock); + EXPECT_EQ(state, mojom::State::kRestock); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -665,18 +665,18 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseWriteProtectDisableMethod); + EXPECT_EQ(state, mojom::State::kChooseWriteProtectDisableMethod); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ChooseManuallyDisableWriteProtect( - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -690,18 +690,18 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ChooseManuallyDisableWriteProtect( - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -722,18 +722,18 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseWriteProtectDisableMethod); + EXPECT_EQ(state, mojom::State::kChooseWriteProtectDisableMethod); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ChooseRsuDisableWriteProtect( - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -746,18 +746,18 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ChooseRsuDisableWriteProtect( - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -775,9 +775,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kEnterRSUWPDisableCode); + EXPECT_EQ(state, mojom::State::kEnterRSUWPDisableCode); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -801,9 +801,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kEnterRSUWPDisableCode); + EXPECT_EQ(state, mojom::State::kEnterRSUWPDisableCode); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -827,9 +827,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kEnterRSUWPDisableCode); + EXPECT_EQ(state, mojom::State::kEnterRSUWPDisableCode); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -886,19 +886,19 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kEnterRSUWPDisableCode); + EXPECT_EQ(state, mojom::State::kEnterRSUWPDisableCode); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->SetRsuDisableWriteProtectCode( "test RSU unlock code", - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -912,19 +912,19 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->SetRsuDisableWriteProtectCode( "test RSU unlock code", - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -940,18 +940,18 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kWaitForManualWPDisable); + EXPECT_EQ(state, mojom::State::kWaitForManualWPDisable); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->WriteProtectManuallyDisabled( - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -965,18 +965,18 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->WriteProtectManuallyDisabled( - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -992,18 +992,18 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kWPDisableComplete); + EXPECT_EQ(state, mojom::State::kWPDisableComplete); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ConfirmManualWpDisableComplete( - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -1017,18 +1017,18 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ConfirmManualWpDisableComplete( - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -1062,9 +1062,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kSelectComponents); + EXPECT_EQ(state, mojom::State::kSelectComponents); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1094,9 +1094,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1158,9 +1158,9 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kSelectComponents); + EXPECT_EQ(state, mojom::State::kSelectComponents); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1177,10 +1177,10 @@ shimless_rma_provider_->SetComponentList( std::move(components), - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -1193,9 +1193,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1208,10 +1208,10 @@ shimless_rma_provider_->SetComponentList( std::move(components), - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -1250,17 +1250,17 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kSelectComponents); + EXPECT_EQ(state, mojom::State::kSelectComponents); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ReworkMainboard(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -1273,17 +1273,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ReworkMainboard(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -1298,9 +1298,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseFirmwareReimageMethod); + EXPECT_EQ(state, mojom::State::kChooseFirmwareReimageMethod); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1326,9 +1326,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseFirmwareReimageMethod); + EXPECT_EQ(state, mojom::State::kChooseFirmwareReimageMethod); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1347,9 +1347,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1382,17 +1382,17 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseFirmwareReimageMethod); + EXPECT_EQ(state, mojom::State::kChooseFirmwareReimageMethod); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ReimageSkipped(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -1407,17 +1407,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseFirmwareReimageMethod); + EXPECT_EQ(state, mojom::State::kChooseFirmwareReimageMethod); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ReimageSkipped(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseFirmwareReimageMethod); + EXPECT_EQ(state, mojom::State::kChooseFirmwareReimageMethod); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -1430,9 +1430,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1460,17 +1460,17 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseFirmwareReimageMethod); + EXPECT_EQ(state, mojom::State::kChooseFirmwareReimageMethod); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ReimageFromDownload(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -1483,17 +1483,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ReimageFromDownload(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -1516,17 +1516,17 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseFirmwareReimageMethod); + EXPECT_EQ(state, mojom::State::kChooseFirmwareReimageMethod); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ReimageFromUsb(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -1539,17 +1539,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ReimageFromUsb(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -1570,17 +1570,17 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kRestock); + EXPECT_EQ(state, mojom::State::kRestock); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ShutdownForRestock(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -1593,17 +1593,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ShutdownForRestock(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -1624,18 +1624,18 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kRestock); + EXPECT_EQ(state, mojom::State::kRestock); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ContinueFinalizationAfterRestock( - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -1649,18 +1649,18 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ContinueFinalizationAfterRestock( - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -1683,9 +1683,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kUpdateDeviceInformation); + EXPECT_EQ(state, mojom::State::kUpdateDeviceInformation); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1704,9 +1704,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1735,9 +1735,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kUpdateDeviceInformation); + EXPECT_EQ(state, mojom::State::kUpdateDeviceInformation); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1756,9 +1756,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1787,9 +1787,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kUpdateDeviceInformation); + EXPECT_EQ(state, mojom::State::kUpdateDeviceInformation); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1808,9 +1808,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1838,19 +1838,19 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kUpdateDeviceInformation); + EXPECT_EQ(state, mojom::State::kUpdateDeviceInformation); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->SetDeviceInformation( "serial number", 1, 2, - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -1863,19 +1863,19 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->SetDeviceInformation( "serial number", 1, 2, - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -1904,9 +1904,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kCheckCalibration); + EXPECT_EQ(state, mojom::State::kCheckCalibration); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1926,9 +1926,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1957,9 +1957,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kSetupCalibration); + EXPECT_EQ(state, mojom::State::kSetupCalibration); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -1983,9 +1983,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -2025,9 +2025,9 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kCheckCalibration); + EXPECT_EQ(state, mojom::State::kCheckCalibration); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -2044,10 +2044,10 @@ shimless_rma_provider_->StartCalibration( std::move(components), - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -2062,9 +2062,9 @@ base::BindRepeating([](const rmad::RmadState& state) { NOTREACHED(); }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -2079,10 +2079,10 @@ shimless_rma_provider_->StartCalibration( std::move(components), - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -2097,17 +2097,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kSetupCalibration); + EXPECT_EQ(state, mojom::State::kSetupCalibration); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->RunCalibrationStep(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -2120,17 +2120,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->RunCalibrationStep(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -2144,17 +2144,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kRunCalibration); + EXPECT_EQ(state, mojom::State::kRunCalibration); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ContinueCalibration(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -2167,17 +2167,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ContinueCalibration(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -2192,17 +2192,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kRunCalibration); + EXPECT_EQ(state, mojom::State::kRunCalibration); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->CalibrationComplete(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -2215,17 +2215,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->CalibrationComplete(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -2240,17 +2240,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kProvisionDevice); + EXPECT_EQ(state, mojom::State::kProvisionDevice); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ProvisioningComplete(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -2263,17 +2263,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->ProvisioningComplete(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -2288,17 +2288,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kFinalize); + EXPECT_EQ(state, mojom::State::kFinalize); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->FinalizationComplete(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -2311,17 +2311,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->FinalizationComplete(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -2336,18 +2336,18 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kWaitForManualWPEnable); + EXPECT_EQ(state, mojom::State::kWaitForManualWPEnable); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->WriteProtectManuallyEnabled( - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -2360,18 +2360,18 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->WriteProtectManuallyEnabled( - base::BindLambdaForTesting([&](mojom::RmaState state, bool can_cancel, + base::BindLambdaForTesting([&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -2384,9 +2384,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kRepairComplete); + EXPECT_EQ(state, mojom::State::kRepairComplete); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -2402,9 +2402,9 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); @@ -2428,17 +2428,17 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kRepairComplete); + EXPECT_EQ(state, mojom::State::kRepairComplete); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->EndRmaAndReboot(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -2451,17 +2451,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->EndRmaAndReboot(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -2482,17 +2482,17 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kRepairComplete); + EXPECT_EQ(state, mojom::State::kRepairComplete); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->EndRmaAndShutdown(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -2505,17 +2505,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->EndRmaAndShutdown(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); })); @@ -2537,17 +2537,17 @@ }); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kRepairComplete); + EXPECT_EQ(state, mojom::State::kRepairComplete); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->EndRmaAndCutoffBattery(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); run_loop.Quit(); })); @@ -2560,17 +2560,17 @@ fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states)); base::RunLoop run_loop; shimless_rma_provider_->GetCurrentState(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_OK); })); run_loop.RunUntilIdle(); shimless_rma_provider_->EndRmaAndCutoffBattery(base::BindLambdaForTesting( - [&](mojom::RmaState state, bool can_cancel, bool can_go_back, + [&](mojom::State state, bool can_cancel, bool can_go_back, rmad::RmadErrorCode error) { - EXPECT_EQ(state, mojom::RmaState::kChooseDestination); + EXPECT_EQ(state, mojom::State::kChooseDestination); EXPECT_EQ(error, rmad::RmadErrorCode::RMAD_ERROR_REQUEST_INVALID); run_loop.Quit(); }));
diff --git a/ash/webui/shimless_rma/mojom/shimless_rma.mojom b/ash/webui/shimless_rma/mojom/shimless_rma.mojom index 08f0f55..412910c 100644 --- a/ash/webui/shimless_rma/mojom/shimless_rma.mojom +++ b/ash/webui/shimless_rma/mojom/shimless_rma.mojom
@@ -42,8 +42,7 @@ // This must remain in sync with RmadState.StateCase (generated from the member // `oneof state`) in //third_party/cros_system_api/dbus/rmad/rmad.proto. // See shimless_rma_mojom_traits.cc\h. -// TODO(crbug.com/1218175): Remove Rma prefix from name. -enum RmaState { +enum State { // Used as a safety fallback default, and therefore should always trigger safe // fallback behavior when present. kUnknown, @@ -393,12 +392,12 @@ // Used on application start to determine the location in the RMA flow. // Due to reboots it may not always be the welcome screen. GetCurrentState() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); // Attempt to roll back to the previous RMA state. // Returns the updated state to display and an error code. TransitionPreviousState() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); // Attempts to abort the RMA. @@ -410,7 +409,7 @@ // // User has confirmed they wish to finalize RMA. BeginFinalization() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// @@ -419,7 +418,7 @@ // Called when next is clicked after a network is successfully connected or // the user skips connecting to a network. NetworkSelectionComplete() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// @@ -433,7 +432,7 @@ UpdateOs() => (bool update_started); // Skips OS update. UpdateOsSkipped() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// @@ -442,12 +441,12 @@ // Set the RMA state for the device to be kept by the current owner. // Returns the next state to display and an error code. SetSameOwner() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); // Set the RMA state for the device to be given to a different owner. // Returns the next state to display and an error code. SetDifferentOwner() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// @@ -459,14 +458,14 @@ // TODO(crbug.com/1218175): Rename SetManuallyDisableWriteProtect for // consistency with other methods. ChooseManuallyDisableWriteProtect() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); // Choose to disable HWWP using the RSU code method. // Returns the next state to display and an error code. // TODO(crbug.com/1218175): Rename SetRsuDisableWriteProtect for // consistency with other methods. ChooseRsuDisableWriteProtect() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// @@ -484,7 +483,7 @@ // Attempt to disable HWWP using a RSU code. // Returns the next state to display and an error code. SetRsuDisableWriteProtectCode(string code) - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// @@ -493,7 +492,7 @@ // Transition to next state after manual write protect disabled signal has // been received. WriteProtectManuallyDisabled() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); // Returns a display string and QR Code image representing the URL that takes // users to the manufacturer specific instructions page for manually disabling @@ -513,7 +512,7 @@ // User acknowledges manual HWWP disable is complete and transitions to next // state. ConfirmManualWpDisableComplete() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// @@ -527,11 +526,11 @@ // This list only needs to contain the components set as repaired (any others // included will be ignored by rmad service). SetComponentList(array<Component> components) - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); // Go to rework flow. ReworkMainboard() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// @@ -543,18 +542,18 @@ // next state. // Returns the next state to display and an error code. ReimageSkipped() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); // TODO(gavindod): Does reimaging require an observer? // Attempt to reimage by downloading the firmware. // Returns the next state to display and an error code. ReimageFromDownload() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); // Attempt to reimage with firmware loaded from a USB drive. // Returns the next state to display and an error code. ReimageFromUsb() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// @@ -563,11 +562,11 @@ // Shutdown the device so mainboard can be restocked. // Note: This will only return a result if there is an error. ShutdownForRestock() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); // Continue RMA finalization after mainboard is used in another device. ContinueFinalizationAfterRestock() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// @@ -587,7 +586,7 @@ // Returns the next state to display and an error code. SetDeviceInformation( string serial_number, uint8 region_index, uint8 sku_index) - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// @@ -613,35 +612,35 @@ // Next state will be kSetupCalibration if setup is required, or // kRunCalibration if not. StartCalibration(array<CalibrationComponentStatus> components) - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); // Request transition from kSetupCalibration to run this calibration step. RunCalibrationStep() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); // Request transition from kRunCalibration to the next setup state. ContinueCalibration() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); // Request transition from kRunCalibratoin to the next RMA state. // This can only be called after kCalibrationOverallComplete has been // observed. CalibrationComplete() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// // Methods for kProvisionDevice state // ProvisioningComplete() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// // Methods for kFinalize state // FinalizationComplete() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// @@ -650,7 +649,7 @@ // Transition to next state after manual write protect enabled signal has been // received. WriteProtectManuallyEnabled() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); /////////////////////////////////////// @@ -663,17 +662,17 @@ // Complete RMA and reboot. // Returns an error indicating success or a failure. EndRmaAndReboot() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); // Complete RMA and shutdown. // Returns an error indicating success or a failure. EndRmaAndShutdown() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); // Attempt to cut off the device battery and shutdown. // Returns an error indicating success or a failure. EndRmaAndCutoffBattery() - => (RmaState state, bool can_cancel, bool can_go_back, + => (State state, bool can_cancel, bool can_go_back, RmadErrorCode error); ///////////////////////////////////////
diff --git a/ash/webui/shimless_rma/mojom/shimless_rma_mojom_traits.cc b/ash/webui/shimless_rma/mojom/shimless_rma_mojom_traits.cc index fc77476..6468afc5 100644 --- a/ash/webui/shimless_rma/mojom/shimless_rma_mojom_traits.cc +++ b/ash/webui/shimless_rma/mojom/shimless_rma_mojom_traits.cc
@@ -12,7 +12,7 @@ namespace mojo { namespace { -using MojomRmaState = ash::shimless_rma::mojom::RmaState; +using MojomRmaState = ash::shimless_rma::mojom::State; using ProtoRmadState = rmad::RmadState::StateCase; using MojomRmadErrorCode = ash::shimless_rma::mojom::RmadErrorCode;
diff --git a/ash/webui/shimless_rma/mojom/shimless_rma_mojom_traits.h b/ash/webui/shimless_rma/mojom/shimless_rma_mojom_traits.h index 124f724..570913f 100644 --- a/ash/webui/shimless_rma/mojom/shimless_rma_mojom_traits.h +++ b/ash/webui/shimless_rma/mojom/shimless_rma_mojom_traits.h
@@ -13,9 +13,8 @@ namespace mojo { template <> -struct EnumTraits<ash::shimless_rma::mojom::RmaState, - rmad::RmadState::StateCase> { - static ash::shimless_rma::mojom::RmaState ToMojom( +struct EnumTraits<ash::shimless_rma::mojom::State, rmad::RmadState::StateCase> { + static ash::shimless_rma::mojom::State ToMojom( rmad::RmadState::StateCase key_status); };
diff --git a/ash/webui/shimless_rma/mojom/shimless_rma_mojom_traits_unittest.cc b/ash/webui/shimless_rma/mojom/shimless_rma_mojom_traits_unittest.cc index 95745d0..bc29d8f 100644 --- a/ash/webui/shimless_rma/mojom/shimless_rma_mojom_traits_unittest.cc +++ b/ash/webui/shimless_rma/mojom/shimless_rma_mojom_traits_unittest.cc
@@ -63,46 +63,43 @@ }; TEST_F(ShimlessRmaMojoToProtoTest, StatesMatch) { - constexpr auto enums = base::MakeFixedFlatMap<mojom::RmaState, + constexpr auto enums = base::MakeFixedFlatMap<mojom::State, rmad::RmadState::StateCase>( - {{mojom::RmaState::kWelcomeScreen, rmad::RmadState::kWelcome}, - {mojom::RmaState::kSelectComponents, rmad::RmadState::kComponentsRepair}, - {mojom::RmaState::kChooseDestination, - rmad::RmadState::kDeviceDestination}, - {mojom::RmaState::kChooseWriteProtectDisableMethod, + {{mojom::State::kWelcomeScreen, rmad::RmadState::kWelcome}, + {mojom::State::kSelectComponents, rmad::RmadState::kComponentsRepair}, + {mojom::State::kChooseDestination, rmad::RmadState::kDeviceDestination}, + {mojom::State::kChooseWriteProtectDisableMethod, rmad::RmadState::kWpDisableMethod}, - {mojom::RmaState::kEnterRSUWPDisableCode, - rmad::RmadState::kWpDisableRsu}, - {mojom::RmaState::kWaitForManualWPDisable, + {mojom::State::kEnterRSUWPDisableCode, rmad::RmadState::kWpDisableRsu}, + {mojom::State::kWaitForManualWPDisable, rmad::RmadState::kWpDisablePhysical}, - {mojom::RmaState::kWPDisableComplete, - rmad::RmadState::kWpDisableComplete}, - {mojom::RmaState::kChooseFirmwareReimageMethod, + {mojom::State::kWPDisableComplete, rmad::RmadState::kWpDisableComplete}, + {mojom::State::kChooseFirmwareReimageMethod, rmad::RmadState::kUpdateRoFirmware}, - {mojom::RmaState::kRestock, rmad::RmadState::kRestock}, - {mojom::RmaState::kUpdateDeviceInformation, + {mojom::State::kRestock, rmad::RmadState::kRestock}, + {mojom::State::kUpdateDeviceInformation, rmad::RmadState::kUpdateDeviceInfo}, - {mojom::RmaState::kCheckCalibration, rmad::RmadState::kCheckCalibration}, - {mojom::RmaState::kSetupCalibration, rmad::RmadState::kSetupCalibration}, - {mojom::RmaState::kRunCalibration, rmad::RmadState::kRunCalibration}, - {mojom::RmaState::kProvisionDevice, rmad::RmadState::kProvisionDevice}, - {mojom::RmaState::kWaitForManualWPEnable, + {mojom::State::kCheckCalibration, rmad::RmadState::kCheckCalibration}, + {mojom::State::kSetupCalibration, rmad::RmadState::kSetupCalibration}, + {mojom::State::kRunCalibration, rmad::RmadState::kRunCalibration}, + {mojom::State::kProvisionDevice, rmad::RmadState::kProvisionDevice}, + {mojom::State::kWaitForManualWPEnable, rmad::RmadState::kWpEnablePhysical}, - {mojom::RmaState::kFinalize, rmad::RmadState::kFinalize}, - {mojom::RmaState::kRepairComplete, rmad::RmadState::kRepairComplete}}); + {mojom::State::kFinalize, rmad::RmadState::kFinalize}, + {mojom::State::kRepairComplete, rmad::RmadState::kRepairComplete}}); // rmad::RmadState::STATE_NOT_SET is used when RMA is not active so the // toMojo conversion is reachable, unlike most other enums. - EXPECT_EQ(static_cast<int32_t>(mojom::RmaState::kUnknown), 0); + EXPECT_EQ(static_cast<int32_t>(mojom::State::kUnknown), 0); EXPECT_EQ(static_cast<int32_t>(rmad::RmadState::STATE_NOT_SET), 0); // This test hits a NOTREACHED so it is a release mode only test. EXPECT_EQ( - (mojo::EnumTraits<mojom::RmaState, rmad::RmadState::StateCase>::ToMojom( + (mojo::EnumTraits<mojom::State, rmad::RmadState::StateCase>::ToMojom( rmad::RmadState::STATE_NOT_SET)), - mojom::RmaState::kUnknown); + mojom::State::kUnknown); for (auto enum_pair : enums) { EXPECT_EQ( - (mojo::EnumTraits<mojom::RmaState, rmad::RmadState::StateCase>::ToMojom( + (mojo::EnumTraits<mojom::State, rmad::RmadState::StateCase>::ToMojom( enum_pair.second)), enum_pair.first) << "enum " << enum_pair.first << " != " << enum_pair.second;
diff --git a/ash/webui/shimless_rma/resources/fake_data.js b/ash/webui/shimless_rma/resources/fake_data.js index 5b9a758..f114d9a 100644 --- a/ash/webui/shimless_rma/resources/fake_data.js +++ b/ash/webui/shimless_rma/resources/fake_data.js
@@ -4,120 +4,120 @@ import {OncMojo} from 'chrome://resources/cr_components/chromeos/network/onc_mojo.m.js'; -import {CalibrationComponentStatus, CalibrationStatus, Component, ComponentRepairStatus, ComponentType, Network, QrCode, RmadErrorCode, RmaState, StateResult} from './shimless_rma_types.js'; +import {CalibrationComponentStatus, CalibrationStatus, Component, ComponentRepairStatus, ComponentType, Network, QrCode, RmadErrorCode, State, StateResult} from './shimless_rma_types.js'; /** @type {!Array<!StateResult>} */ export const fakeStates = [ { - state: RmaState.kWelcomeScreen, + state: State.kWelcomeScreen, canCancel: true, canGoBack: false, error: RmadErrorCode.kOk }, { - state: RmaState.kConfigureNetwork, + state: State.kConfigureNetwork, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kUpdateOs, + state: State.kUpdateOs, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kSelectComponents, + state: State.kSelectComponents, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kChooseDestination, + state: State.kChooseDestination, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kChooseWriteProtectDisableMethod, + state: State.kChooseWriteProtectDisableMethod, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kEnterRSUWPDisableCode, + state: State.kEnterRSUWPDisableCode, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kWaitForManualWPDisable, + state: State.kWaitForManualWPDisable, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kWPDisableComplete, + state: State.kWPDisableComplete, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kChooseFirmwareReimageMethod, + state: State.kChooseFirmwareReimageMethod, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kUpdateDeviceInformation, + state: State.kUpdateDeviceInformation, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kRestock, + state: State.kRestock, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kCheckCalibration, + state: State.kCheckCalibration, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kSetupCalibration, + state: State.kSetupCalibration, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kRunCalibration, + state: State.kRunCalibration, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kProvisionDevice, + state: State.kProvisionDevice, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kWaitForManualWPEnable, + state: State.kWaitForManualWPEnable, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kFinalize, + state: State.kFinalize, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk }, { - state: RmaState.kRepairComplete, + state: State.kRepairComplete, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk
diff --git a/ash/webui/shimless_rma/resources/fake_shimless_rma_service.js b/ash/webui/shimless_rma/resources/fake_shimless_rma_service.js index 6b7c6c39..a31dada 100644 --- a/ash/webui/shimless_rma/resources/fake_shimless_rma_service.js +++ b/ash/webui/shimless_rma/resources/fake_shimless_rma_service.js
@@ -6,7 +6,7 @@ import {FakeObservables} from 'chrome://resources/ash/common/fake_observables.js'; import {assert} from 'chrome://resources/js/assert.m.js'; -import {CalibrationComponentStatus, CalibrationObserverRemote, CalibrationOverallStatus, CalibrationSetupInstruction, CalibrationStatus, Component, ComponentType, ErrorObserverRemote, FinalizationObserverRemote, FinalizationStatus, HardwareVerificationStatusObserverRemote, HardwareWriteProtectionStateObserverRemote, OsUpdateObserverRemote, OsUpdateOperation, PowerCableStateObserverRemote, ProvisioningObserverRemote, ProvisioningStatus, QrCode, RmadErrorCode, RmaState, ShimlessRmaServiceInterface, StateResult, WriteProtectDisableCompleteState} from './shimless_rma_types.js'; +import {CalibrationComponentStatus, CalibrationObserverRemote, CalibrationOverallStatus, CalibrationSetupInstruction, CalibrationStatus, Component, ComponentType, ErrorObserverRemote, FinalizationObserverRemote, FinalizationStatus, HardwareVerificationStatusObserverRemote, HardwareWriteProtectionStateObserverRemote, OsUpdateObserverRemote, OsUpdateOperation, PowerCableStateObserverRemote, ProvisioningObserverRemote, ProvisioningStatus, QrCode, RmadErrorCode, ShimlessRmaServiceInterface, State, StateResult, WriteProtectDisableCompleteState} from './shimless_rma_types.js'; /** @implements {ShimlessRmaServiceInterface} */ export class FakeShimlessRmaService { @@ -120,7 +120,7 @@ // of this function the result must be set at the time of the call. if (this.states_.length === 0) { this.setFakeCurrentState_( - RmaState.kUnknown, false, false, RmadErrorCode.kRmaNotRequired); + State.kUnknown, false, false, RmadErrorCode.kRmaNotRequired); } else { // It should not be possible for stateIndex_ to be out of range unless // there is a bug in the fake. @@ -141,7 +141,7 @@ // of this function the result must be set at the time of the call. if (this.states_.length === 0) { this.setFakePrevState_( - RmaState.kUnknown, false, false, RmadErrorCode.kRmaNotRequired); + State.kUnknown, false, false, RmadErrorCode.kRmaNotRequired); } else if (this.stateIndex_ === 0) { // It should not be possible for stateIndex_ to be out of range unless // there is a bug in the fake. @@ -180,7 +180,7 @@ */ beginFinalization() { return this.getNextStateForMethod_( - 'beginFinalization', RmaState.kWelcomeScreen); + 'beginFinalization', State.kWelcomeScreen); } /** @@ -188,7 +188,7 @@ */ networkSelectionComplete() { return this.getNextStateForMethod_( - 'networkSelectionComplete', RmaState.kConfigureNetwork); + 'networkSelectionComplete', State.kConfigureNetwork); } /** @@ -251,7 +251,7 @@ * @return {!Promise<!StateResult>} */ updateOsSkipped() { - return this.getNextStateForMethod_('updateOsSkipped', RmaState.kUpdateOs); + return this.getNextStateForMethod_('updateOsSkipped', State.kUpdateOs); } /** @@ -259,7 +259,7 @@ */ setSameOwner() { return this.getNextStateForMethod_( - 'setSameOwner', RmaState.kChooseDestination); + 'setSameOwner', State.kChooseDestination); } /** @@ -267,7 +267,7 @@ */ setDifferentOwner() { return this.getNextStateForMethod_( - 'setDifferentOwner', RmaState.kChooseDestination); + 'setDifferentOwner', State.kChooseDestination); } /** @@ -291,7 +291,7 @@ chooseManuallyDisableWriteProtect() { return this.getNextStateForMethod_( 'chooseManuallyDisableWriteProtect', - RmaState.kChooseWriteProtectDisableMethod); + State.kChooseWriteProtectDisableMethod); } /** @@ -299,8 +299,7 @@ */ chooseRsuDisableWriteProtect() { return this.getNextStateForMethod_( - 'chooseRsuDisableWriteProtect', - RmaState.kChooseWriteProtectDisableMethod); + 'chooseRsuDisableWriteProtect', State.kChooseWriteProtectDisableMethod); } /** @@ -355,7 +354,7 @@ */ setRsuDisableWriteProtectCode(code) { return this.getNextStateForMethod_( - 'setRsuDisableWriteProtectCode', RmaState.kEnterRSUWPDisableCode); + 'setRsuDisableWriteProtectCode', State.kEnterRSUWPDisableCode); } /** @@ -363,7 +362,7 @@ */ writeProtectManuallyDisabled() { return this.getNextStateForMethod_( - 'writeProtectManuallyDisabled', RmaState.kWaitForManualWPDisable); + 'writeProtectManuallyDisabled', State.kWaitForManualWPDisable); } /** @@ -400,7 +399,7 @@ */ confirmManualWpDisableComplete() { return this.getNextStateForMethod_( - 'confirmManualWpDisableComplete', RmaState.kWPDisableComplete); + 'confirmManualWpDisableComplete', State.kWPDisableComplete); } /** @@ -424,7 +423,7 @@ */ setComponentList(components) { return this.getNextStateForMethod_( - 'setComponentList', RmaState.kSelectComponents); + 'setComponentList', State.kSelectComponents); } /** @@ -432,7 +431,7 @@ */ reworkMainboard() { return this.getNextStateForMethod_( - 'reworkMainboard', RmaState.kSelectComponents); + 'reworkMainboard', State.kSelectComponents); } /** @@ -454,7 +453,7 @@ */ reimageSkipped() { return this.getNextStateForMethod_( - 'reimageSkipped', RmaState.kChooseFirmwareReimageMethod); + 'reimageSkipped', State.kChooseFirmwareReimageMethod); } /** @@ -462,7 +461,7 @@ */ reimageFromDownload() { return this.getNextStateForMethod_( - 'reimageFromDownload', RmaState.kChooseFirmwareReimageMethod); + 'reimageFromDownload', State.kChooseFirmwareReimageMethod); } /** @@ -470,7 +469,7 @@ */ reimageFromUsb() { return this.getNextStateForMethod_( - 'reimageFromUsb', RmaState.kChooseFirmwareReimageMethod); + 'reimageFromUsb', State.kChooseFirmwareReimageMethod); } /** @@ -478,7 +477,7 @@ * */ shutdownForRestock() { - return this.getNextStateForMethod_('shutdownForRestock', RmaState.kRestock); + return this.getNextStateForMethod_('shutdownForRestock', State.kRestock); } /** @@ -486,7 +485,7 @@ */ continueFinalizationAfterRestock() { return this.getNextStateForMethod_( - 'continueFinalizationAfterRestock', RmaState.kRestock); + 'continueFinalizationAfterRestock', State.kRestock); } /** @@ -569,7 +568,7 @@ setDeviceInformation(serialNumber, regionIndex, skuIndex) { // TODO(gavindodd): Validate range of region and sku. return this.getNextStateForMethod_( - 'setDeviceInformation', RmaState.kUpdateDeviceInformation); + 'setDeviceInformation', State.kUpdateDeviceInformation); } /** @@ -610,7 +609,7 @@ */ startCalibration(unused) { return this.getNextStateForMethod_( - 'startCalibration', RmaState.kCheckCalibration); + 'startCalibration', State.kCheckCalibration); } /** @@ -618,7 +617,7 @@ */ runCalibrationStep() { return this.getNextStateForMethod_( - 'runCalibrationStep', RmaState.kSetupCalibration); + 'runCalibrationStep', State.kSetupCalibration); } /** @@ -626,7 +625,7 @@ */ continueCalibration() { return this.getNextStateForMethod_( - 'continueCalibration', RmaState.kRunCalibration); + 'continueCalibration', State.kRunCalibration); } /** @@ -634,7 +633,7 @@ */ calibrationComplete() { return this.getNextStateForMethod_( - 'calibrationComplete', RmaState.kRunCalibration); + 'calibrationComplete', State.kRunCalibration); } /** @@ -642,15 +641,14 @@ */ provisioningComplete() { return this.getNextStateForMethod_( - 'provisioningComplete', RmaState.kProvisionDevice); + 'provisioningComplete', State.kProvisionDevice); } /** * @return {!Promise<!StateResult>} */ finalizationComplete() { - return this.getNextStateForMethod_( - 'finalizationComplete', RmaState.kFinalize); + return this.getNextStateForMethod_('finalizationComplete', State.kFinalize); } /** @@ -658,7 +656,7 @@ */ writeProtectManuallyEnabled() { return this.getNextStateForMethod_( - 'writeProtectManuallyEnabled', RmaState.kWaitForManualWPEnable); + 'writeProtectManuallyEnabled', State.kWaitForManualWPEnable); } /** @return {!Promise<{log: string}>} */ @@ -680,7 +678,7 @@ */ endRmaAndReboot() { return this.getNextStateForMethod_( - 'endRmaAndReboot', RmaState.kRepairComplete); + 'endRmaAndReboot', State.kRepairComplete); } /** @@ -688,7 +686,7 @@ */ endRmaAndShutdown() { return this.getNextStateForMethod_( - 'endRmaAndShutdown', RmaState.kRepairComplete); + 'endRmaAndShutdown', State.kRepairComplete); } /** @@ -696,7 +694,7 @@ */ endRmaAndCutoffBattery() { return this.getNextStateForMethod_( - 'endRmaAndCutoffBattery', RmaState.kRepairComplete); + 'endRmaAndCutoffBattery', State.kRepairComplete); } /** @@ -867,8 +865,7 @@ this.automaticallyTriggerDisableWriteProtectionObservation_) { assert(this.stateIndex_ < this.states_.length); this.triggerHardwareWriteProtectionObserver( - this.states_[this.stateIndex_].state === - RmaState.kWaitForManualWPEnable, + this.states_[this.stateIndex_].state === State.kWaitForManualWPEnable, 3000); } } @@ -1202,14 +1199,13 @@ /** * @private * @param {string} method - * @param {!RmaState} expectedState + * @param {!State} expectedState * @returns {!Promise<!StateResult>} */ getNextStateForMethod_(method, expectedState) { if (this.states_.length === 0) { this.setFakeStateForMethod_( - method, RmaState.kUnknown, false, false, - RmadErrorCode.kRmaNotRequired); + method, State.kUnknown, false, false, RmadErrorCode.kRmaNotRequired); } else if (this.stateIndex_ >= this.states_.length - 1) { // It should not be possible for stateIndex_ to be out of range unless // there is a bug in the fake. @@ -1238,7 +1234,7 @@ /** * Sets the value that will be returned when calling getCurrent(). * @private - * @param {!RmaState} state + * @param {!State} state * @param {boolean} canCancel, * @param {boolean} canGoBack, * @param {!RmadErrorCode} error @@ -1252,7 +1248,7 @@ * Sets the value that will be returned when calling * transitionPreviousState(). * @private - * @param {!RmaState} state + * @param {!State} state * @param {boolean} canCancel, * @param {boolean} canGoBack, * @param {!RmadErrorCode} error @@ -1267,7 +1263,7 @@ * that update state. e.g. setSameOwner() * @private * @param {string} method - * @param {!RmaState} state + * @param {!State} state * @param {boolean} canCancel, * @param {boolean} canGoBack, * @param {!RmadErrorCode} error
diff --git a/ash/webui/shimless_rma/resources/shimless_rma.js b/ash/webui/shimless_rma/resources/shimless_rma.js index 79b99e0..8b2d9ac8 100644 --- a/ash/webui/shimless_rma/resources/shimless_rma.js +++ b/ash/webui/shimless_rma/resources/shimless_rma.js
@@ -30,7 +30,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getShimlessRmaService, rmadErrorString} from './mojo_interface_provider.js'; -import {ErrorObserverInterface, ErrorObserverReceiver, RmadErrorCode, RmaState, ShimlessRmaServiceInterface, StateResult} from './shimless_rma_types.js'; +import {ErrorObserverInterface, ErrorObserverReceiver, RmadErrorCode, ShimlessRmaServiceInterface, State, StateResult} from './shimless_rma_types.js'; /** * Enum for button states. @@ -55,17 +55,17 @@ let PageInfo; /** - * @type {!Object<!RmaState, !PageInfo>} + * @type {!Object<!State, !PageInfo>} */ const StateComponentMapping = { - [RmaState.kUnknown]: { + [State.kUnknown]: { componentIs: 'badcomponent', requiresReloadWhenShown: false, buttonNext: ButtonState.HIDDEN, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kWelcomeScreen]: { + [State.kWelcomeScreen]: { componentIs: 'onboarding-landing-page', requiresReloadWhenShown: false, buttonNext: ButtonState.DISABLED, @@ -73,7 +73,7 @@ buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kConfigureNetwork]: { + [State.kConfigureNetwork]: { componentIs: 'onboarding-network-page', requiresReloadWhenShown: false, buttonNext: ButtonState.DISABLED, @@ -81,118 +81,118 @@ buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kUpdateOs]: { + [State.kUpdateOs]: { componentIs: 'onboarding-update-page', requiresReloadWhenShown: false, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kSelectComponents]: { + [State.kSelectComponents]: { componentIs: 'onboarding-select-components-page', requiresReloadWhenShown: false, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kChooseDestination]: { + [State.kChooseDestination]: { componentIs: 'onboarding-choose-destination-page', requiresReloadWhenShown: false, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kChooseWriteProtectDisableMethod]: { + [State.kChooseWriteProtectDisableMethod]: { componentIs: 'onboarding-choose-wp-disable-method-page', requiresReloadWhenShown: false, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kEnterRSUWPDisableCode]: { + [State.kEnterRSUWPDisableCode]: { componentIs: 'onboarding-enter-rsu-wp-disable-code-page', requiresReloadWhenShown: true, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kWaitForManualWPDisable]: { + [State.kWaitForManualWPDisable]: { componentIs: 'onboarding-wait-for-manual-wp-disable-page', requiresReloadWhenShown: true, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kWPDisableComplete]: { + [State.kWPDisableComplete]: { componentIs: 'onboarding-wp-disable-complete-page', requiresReloadWhenShown: false, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kChooseFirmwareReimageMethod]: { + [State.kChooseFirmwareReimageMethod]: { componentIs: 'reimaging-firmware-update-page', requiresReloadWhenShown: false, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kUpdateDeviceInformation]: { + [State.kUpdateDeviceInformation]: { componentIs: 'reimaging-device-information-page', requiresReloadWhenShown: false, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kCheckCalibration]: { + [State.kCheckCalibration]: { componentIs: 'reimaging-calibration-page', requiresReloadWhenShown: true, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kRunCalibration]: { + [State.kRunCalibration]: { componentIs: 'reimaging-calibration-run-page', requiresReloadWhenShown: true, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kSetupCalibration]: { + [State.kSetupCalibration]: { componentIs: 'reimaging-calibration-setup-page', requiresReloadWhenShown: true, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kProvisionDevice]: { + [State.kProvisionDevice]: { componentIs: 'reimaging-provisioning-page', requiresReloadWhenShown: true, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kWaitForManualWPEnable]: { + [State.kWaitForManualWPEnable]: { componentIs: 'wrapup-wait-for-manual-wp-enable-page', requiresReloadWhenShown: true, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kRestock]: { + [State.kRestock]: { componentIs: 'wrapup-restock-page', requiresReloadWhenShown: false, buttonNext: ButtonState.DISABLED, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kFinalize]: { + [State.kFinalize]: { componentIs: 'wrapup-finalize-page', buttonNext: ButtonState.VISIBLE, buttonCancel: ButtonState.HIDDEN, buttonBack: ButtonState.HIDDEN, }, - [RmaState.kRepairComplete]: { + [State.kRepairComplete]: { componentIs: 'wrapup-repair-complete-page', requiresReloadWhenShown: false, buttonNext: ButtonState.HIDDEN, @@ -374,7 +374,7 @@ /** * @private - * @param {!RmaState} state + * @param {!State} state * @param {boolean} canCancel * @param {boolean} canGoBack */
diff --git a/ash/webui/shimless_rma/resources/shimless_rma_types.js b/ash/webui/shimless_rma/resources/shimless_rma_types.js index 5146d08..52cda95 100644 --- a/ash/webui/shimless_rma/resources/shimless_rma_types.js +++ b/ash/webui/shimless_rma/resources/shimless_rma_types.js
@@ -18,7 +18,7 @@ * Convenience type as mojo-lite does not define types for method results and * this is used frequently. * @typedef {{ - * state: !RmaState, + * state: !State, * canCancel: boolean, * canGoBack: boolean, * error: !RmadErrorCode @@ -27,9 +27,9 @@ export let StateResult; /** - * @typedef {ash.shimlessRma.mojom.RmaState} + * @typedef {ash.shimlessRma.mojom.State} */ -export const RmaState = ash.shimlessRma.mojom.RmaState; +export const State = ash.shimlessRma.mojom.State; /** * @typedef {ash.shimlessRma.mojom.RmadErrorCode}
diff --git a/ash/wm/desks/templates/desks_templates_presenter.cc b/ash/wm/desks/templates/desks_templates_presenter.cc index aa8d137..b08396e 100644 --- a/ash/wm/desks/templates/desks_templates_presenter.cc +++ b/ash/wm/desks/templates/desks_templates_presenter.cc
@@ -190,7 +190,7 @@ void DesksTemplatesPresenter::OnGetAllEntries( desks_storage::DeskModel::GetAllEntriesStatus status, - std::vector<DeskTemplate*> entries) { + const std::vector<DeskTemplate*>& entries) { if (status != desks_storage::DeskModel::GetAllEntriesStatus::kOk) return;
diff --git a/ash/wm/desks/templates/desks_templates_presenter.h b/ash/wm/desks/templates/desks_templates_presenter.h index c70369fd..a59035f 100644 --- a/ash/wm/desks/templates/desks_templates_presenter.h +++ b/ash/wm/desks/templates/desks_templates_presenter.h
@@ -82,7 +82,7 @@ // Callback ran after querying the model for a list of entries. This function // also contains logic for updating the UI. void OnGetAllEntries(desks_storage::DeskModel::GetAllEntriesStatus status, - std::vector<DeskTemplate*> entries); + const std::vector<DeskTemplate*>& entries); // Callback after deleting an entry. Will then call `GetAllEntries` to update // the UI with the most up to date list of templates.
diff --git a/ash/wm/desks/templates/desks_templates_test_util.cc b/ash/wm/desks/templates/desks_templates_test_util.cc index c3391cb..c8a5fd5 100644 --- a/ash/wm/desks/templates/desks_templates_test_util.cc +++ b/ash/wm/desks/templates/desks_templates_test_util.cc
@@ -6,6 +6,8 @@ #include "ash/shell.h" #include "ash/wm/desks/desks_bar_view.h" +#include "ash/wm/desks/expanded_desks_bar_button.h" +#include "ash/wm/desks/templates/desks_templates_item_view.h" #include "ash/wm/desks/templates/desks_templates_presenter.h" #include "ash/wm/desks/zero_state_button.h" #include "ash/wm/overview/overview_grid.h" @@ -64,6 +66,25 @@ DesksTemplatesIconViewTestApi::~DesksTemplatesIconViewTestApi() = default; +DesksTemplatesItemView* GetItemViewFromOverviewGrid(int grid_item_index) { + const auto* overview_grid = GetPrimaryOverviewGrid(); + if (!overview_grid) + return nullptr; + + views::Widget* grid_widget = overview_grid->desks_templates_grid_widget(); + DCHECK(grid_widget); + + const DesksTemplatesGridView* templates_grid_view = + static_cast<DesksTemplatesGridView*>(grid_widget->GetContentsView()); + DCHECK(templates_grid_view); + + std::vector<DesksTemplatesItemView*> grid_items = + DesksTemplatesGridViewTestApi(templates_grid_view).grid_items(); + DesksTemplatesItemView* item_view = grid_items.at(grid_item_index); + DCHECK(item_view); + return item_view; +} + views::Button* GetZeroStateDesksTemplatesButton() { const auto* overview_grid = GetPrimaryOverviewGrid(); if (!overview_grid) @@ -75,6 +96,19 @@ : nullptr; } +views::Button* GetExpandedStateDesksTemplatesButton() { + const auto* overview_grid = GetPrimaryOverviewGrid(); + if (!overview_grid) + return nullptr; + + // May be null in tablet mode. + const auto* desks_bar_view = overview_grid->desks_bar_view(); + return desks_bar_view + ? desks_bar_view->expanded_state_desks_templates_button() + ->inner_button() + : nullptr; +} + views::Button* GetSaveDeskAsTemplateButton() { const auto* overview_grid = GetPrimaryOverviewGrid(); if (!overview_grid) @@ -85,4 +119,19 @@ : nullptr; } +views::Button* GetTemplateItemButton(int index) { + auto* item = GetItemViewFromOverviewGrid(index); + return item ? static_cast<views::Button*>(item) : nullptr; +} + +void WaitForDesksTemplatesUI() { + auto* overview_session = GetOverviewSession(); + DCHECK(overview_session); + + base::RunLoop run_loop; + DesksTemplatesPresenterTestApi(overview_session->desks_templates_presenter()) + .SetOnUpdateUiClosure(run_loop.QuitClosure()); + run_loop.Run(); +} + } // namespace ash
diff --git a/ash/wm/desks/templates/desks_templates_test_util.h b/ash/wm/desks/templates/desks_templates_test_util.h index 213a71f..c863710 100644 --- a/ash/wm/desks/templates/desks_templates_test_util.h +++ b/ash/wm/desks/templates/desks_templates_test_util.h
@@ -127,9 +127,21 @@ const DesksTemplatesIconView* desks_templates_icon_view_; }; +// Return the `grid_item_index`th DesksTemplatesItemView from the first +// OverviewGrid in `GetOverviewGridList()`. +DesksTemplatesItemView* GetItemViewFromOverviewGrid(int grid_item_index); + // These buttons are the ones on the primary root window. views::Button* GetZeroStateDesksTemplatesButton(); +views::Button* GetExpandedStateDesksTemplatesButton(); views::Button* GetSaveDeskAsTemplateButton(); +views::Button* GetTemplateItemButton(int index); + +// A lot of the UI relies on calling into the local desk data manager to +// update, which sends callbacks via posting tasks. Call +// `WaitForDesksTemplatesUI()` if testing a piece of the UI which calls into the +// desk model. +void WaitForDesksTemplatesUI(); } // namespace ash
diff --git a/ash/wm/desks/templates/desks_templates_unittest.cc b/ash/wm/desks/templates/desks_templates_unittest.cc index ed0fdff..9f56e94 100644 --- a/ash/wm/desks/templates/desks_templates_unittest.cc +++ b/ash/wm/desks/templates/desks_templates_unittest.cc
@@ -114,25 +114,6 @@ return restore_data; } - // Return the `grid_item_index`th DesksTemplatesItemView from the first - // OverviewGrid in `GetOverviewGridList()`. - DesksTemplatesItemView* GetItemViewFromOverviewGrid(int grid_item_index) { - views::Widget* grid_widget = - GetOverviewGridList().front()->desks_templates_grid_widget(); - DCHECK(grid_widget); - - const DesksTemplatesGridView* templates_grid_view = - static_cast<DesksTemplatesGridView*>(grid_widget->GetContentsView()); - DCHECK(templates_grid_view); - - std::vector<DesksTemplatesItemView*> grid_items = - DesksTemplatesGridViewTestApi(templates_grid_view).grid_items(); - DesksTemplatesItemView* item_view = grid_items.at(grid_item_index); - DCHECK(item_view); - - return item_view; - } - // Gets the current list of template entries from the desk model directly // without updating the UI. const std::vector<DeskTemplate*> GetAllEntries() { @@ -141,7 +122,7 @@ base::RunLoop loop; desk_model()->GetAllEntries(base::BindLambdaForTesting( [&](desks_storage::DeskModel::GetAllEntriesStatus status, - std::vector<DeskTemplate*> entries) { + const std::vector<DeskTemplate*>& entries) { EXPECT_EQ(desks_storage::DeskModel::GetAllEntriesStatus::kOk, status); templates = entries; loop.Quit(); @@ -164,20 +145,6 @@ loop.Run(); } - // A lot of the UI relies on calling into the local desk data manager to - // update, which sends callbacks via posting tasks. Call `WaitForUI()` if - // testing a piece of the UI which calls into the desk model. - void WaitForUI() { - auto* overview_session = GetOverviewSession(); - DCHECK(overview_session); - - base::RunLoop run_loop; - DesksTemplatesPresenterTestApi( - overview_session->desks_templates_presenter()) - .SetOnUpdateUiClosure(run_loop.QuitClosure()); - run_loop.Run(); - } - views::View* GetDesksTemplatesButtonForRoot(aura::Window* root_window, bool zero_state) { auto* overview_session = GetOverviewSession(); @@ -271,7 +238,7 @@ ->widget_delegate() ->AsDialogDelegate(); dialog_delegate->AcceptDialog(); - WaitForUI(); + WaitForDesksTemplatesUI(); } // Open overview mode if we're not in overview mode yet, and then show the @@ -279,11 +246,11 @@ void OpenOverviewAndShowTemplatesGrid() { if (!GetOverviewSession()) { ToggleOverview(); - WaitForUI(); + WaitForDesksTemplatesUI(); } ShowDesksTemplatesGrids(); - WaitForUI(); + WaitForDesksTemplatesUI(); } void ClickOnView(const views::View* view) { @@ -321,13 +288,13 @@ void OpenOverviewAndSaveTemplate(aura::Window* root) { if (!GetOverviewSession()) { ToggleOverview(); - WaitForUI(); + WaitForDesksTemplatesUI(); } auto* save_template = GetSaveDeskAsTemplateButtonForRoot(root); ASSERT_TRUE(save_template->IsVisible()); ClickOnView(save_template->GetContentsView()); - WaitForUI(); + WaitForDesksTemplatesUI(); for (auto& overview_grid : GetOverviewGridList()) ASSERT_TRUE(overview_grid->IsShowingDesksTemplatesGrid()); } @@ -387,7 +354,7 @@ // There are no entries initially, so the none of the desks templates buttons // are visible. ToggleOverview(); - WaitForUI(); + WaitForDesksTemplatesUI(); verify_button_visibilities(/*zero_state_shown=*/false, /*expanded_state_shown=*/false, /*trace_string=*/"one-desk-zero-entries"); @@ -400,7 +367,7 @@ // Reenter overview and verify the zero state desks templates buttons are // visible since there is one entry to view. ToggleOverview(); - WaitForUI(); + WaitForDesksTemplatesUI(); verify_button_visibilities(/*zero_state_shown=*/true, /*expanded_state_shown=*/false, /*trace_string=*/"one-desk-one-entry"); @@ -419,7 +386,7 @@ // Reenter overview and verify the expanded state desks templates buttons are // visible since there is one entry to view. ToggleOverview(); - WaitForUI(); + WaitForDesksTemplatesUI(); verify_button_visibilities(/*zero_state_shown=*/false, /*expanded_state_shown=*/true, /*trace_string=*/"two-desk-one-entry"); @@ -430,7 +397,7 @@ // Reenter overview and verify neither of the buttons are shown. ToggleOverview(); - WaitForUI(); + WaitForDesksTemplatesUI(); verify_button_visibilities(/*zero_state_shown=*/false, /*expanded_state_shown=*/false, /*trace_string=*/"two-desk-zero-entries"); @@ -446,7 +413,7 @@ // Start overview mode. The no windows widget should be visible. ToggleOverview(); - WaitForUI(); + WaitForDesksTemplatesUI(); auto& grid_list = GetOverviewGridList(); ASSERT_EQ(2u, grid_list.size()); EXPECT_TRUE(grid_list[0]->no_windows_widget()); @@ -468,7 +435,7 @@ // Start overview mode. The window is visible in the overview mode. ToggleOverview(); - WaitForUI(); + WaitForDesksTemplatesUI(); ASSERT_TRUE(GetOverviewSession()); EXPECT_EQ(1.0f, test_window->layer()->opacity()); @@ -509,7 +476,7 @@ // Start overview mode. `test_window_2` should be visible in overview mode. ToggleOverview(); - WaitForUI(); + WaitForDesksTemplatesUI(); ASSERT_TRUE(GetOverviewSession()); EXPECT_EQ(1.0f, test_window_2->layer()->opacity()); auto& overview_grid = GetOverviewGridList()[0]; @@ -518,7 +485,7 @@ // Open the desk templates grid. This should hide `test_window_2`. ShowDesksTemplatesGrids(); - WaitForUI(); + WaitForDesksTemplatesUI(); EXPECT_EQ(0.0f, test_window_2->layer()->opacity()); // While in the desk templates grid, delete the active desk by clicking on the @@ -709,7 +676,7 @@ // There are no saved template entries and one test window initially. auto test_window = CreateAppWindow(); ToggleOverview(); - WaitForUI(); + WaitForDesksTemplatesUI(); // The `save_desk_as_template_widget` is visible when at least one window is // open. @@ -743,7 +710,7 @@ { DeskSwitchAnimationWaiter waiter; ClickOnView(GetItemViewFromOverviewGrid(/*grid_item_index=*/0)); - WaitForUI(); + WaitForDesksTemplatesUI(); waiter.Wait(); } @@ -763,7 +730,7 @@ DesksTemplatesItemView* item_view = GetItemViewFromOverviewGrid( /*grid_item_index=*/0); ClickOnView(DesksTemplatesItemViewTestApi(item_view).launch_button()); - WaitForUI(); + WaitForDesksTemplatesUI(); waiter.Wait(); } @@ -1026,7 +993,7 @@ // Test that the templates buttons are created but invisible. The save desk as // template button is not created. ToggleOverview(); - WaitForUI(); + WaitForDesksTemplatesUI(); aura::Window* root = Shell::GetPrimaryRootWindow(); auto* zero_state = GetDesksTemplatesButtonForRoot(root, /*zero_state=*/true); @@ -1048,7 +1015,7 @@ // Test that on entering overview, the zero state desks templates button and // the save template button are visible. ToggleOverview(); - WaitForUI(); + WaitForDesksTemplatesUI(); aura::Window* root = Shell::GetPrimaryRootWindow(); auto* zero_state = GetDesksTemplatesButtonForRoot(root, /*zero_state=*/true); @@ -1167,7 +1134,7 @@ // dialog should show up. auto* root = Shell::Get()->GetPrimaryRootWindow(); ToggleOverview(); - WaitForUI(); + WaitForDesksTemplatesUI(); auto* save_template = GetSaveDeskAsTemplateButtonForRoot(root); ASSERT_TRUE(save_template->IsVisible()); ClickOnView(save_template->GetContentsView()); @@ -1196,7 +1163,7 @@ ->widget_delegate() ->AsDialogDelegate() ->AcceptDialog(); - WaitForUI(); + WaitForDesksTemplatesUI(); EXPECT_TRUE(GetOverviewSession()); EXPECT_TRUE(GetOverviewGridList()[0]->desks_templates_grid_widget()); @@ -1291,7 +1258,7 @@ ClickOnView(GetItemViewFromOverviewGrid(/*grid_item_index=*/0)); // Launching a template fetches it from the desk model asynchronously. Make // sure the async call is done before waiting. - WaitForUI(); + WaitForDesksTemplatesUI(); waiter.Wait(); EXPECT_FALSE(InOverviewSession());
diff --git a/base/android/application_status_listener.cc b/base/android/application_status_listener.cc index 0828dd2..a323452fa 100644 --- a/base/android/application_status_listener.cc +++ b/base/android/application_status_listener.cc
@@ -7,6 +7,7 @@ #include <jni.h> #include "base/base_jni_headers/ApplicationStatus_jni.h" +#include "base/callback.h" #include "base/lazy_instance.h" #include "base/metrics/user_metrics.h" #include "base/observer_list_threadsafe.h"
diff --git a/base/android/application_status_listener.h b/base/android/application_status_listener.h index 2be738a34..70b130f 100644 --- a/base/android/application_status_listener.h +++ b/base/android/application_status_listener.h
@@ -10,8 +10,8 @@ #include "base/android/jni_android.h" #include "base/base_export.h" +#include "base/callback_forward.h" #include "base/memory/ref_counted.h" -#include "base/memory/singleton.h" namespace base { namespace android {
diff --git a/base/android/java/src/org/chromium/base/process_launcher/ChildServiceConnectionImpl.java b/base/android/java/src/org/chromium/base/process_launcher/ChildServiceConnectionImpl.java index eabd63ee..3d2f4e4 100644 --- a/base/android/java/src/org/chromium/base/process_launcher/ChildServiceConnectionImpl.java +++ b/base/android/java/src/org/chromium/base/process_launcher/ChildServiceConnectionImpl.java
@@ -70,8 +70,14 @@ @Override public void updateGroupImportance(int group, int importanceInGroup) { + // ChildProcessConnection checks there is a real connection to the service before calling + // this, and this `isBound` check should in theory be unnecessary. However this is still + // tripped on some devices where another service connection bound successfully but this + // service connection failed in `bindServiceConnection`. Such a case is not expected OS + // behavior and is not handled. However, avoid crashing in `updateServiceGroup` by doing + // this check here. if (!isBound()) { - throw new IllegalStateException(); + return; } if (BindService.supportVariableConnections()) { try {
diff --git a/base/bind_internal.h b/base/bind_internal.h index cc37bd8..b8670d6 100644 --- a/base/bind_internal.h +++ b/base/bind_internal.h
@@ -869,17 +869,22 @@ DCHECK(receiver); // It's error prone to make the implicit first reference to ref-counted types. - // In the example below, base::BindOnce() makes the implicit first reference - // to the ref-counted Foo. If PostTask() failed or the posted task ran fast - // enough, the newly created instance can be destroyed before |oo| makes - // another reference. + // In the example below, base::BindOnce() would make the implicit first + // reference to the ref-counted Foo. If PostTask() failed or the posted task + // ran fast enough, the newly created instance could be destroyed before `oo` + // makes another reference. // Foo::Foo() { // base::PostTask(FROM_HERE, base::BindOnce(&Foo::Bar, this)); // } // // scoped_refptr<Foo> oo = new Foo(); // - // Instead of doing like above, please consider adding a static constructor, + // Hence, base::Bind{Once,Repeating}() refuses to create the first reference + // to ref-counted objects, and DCHECK()s otherwise. As above, that typically + // happens around PostTask() in their constructor, and such objects can be + // destroyed before `new` returns if the task resolves fast enough. + // + // Instead of doing the above, please consider adding a static constructor, // and keep the first reference alive explicitly. // // static // scoped_refptr<Foo> Foo::Create() { @@ -891,11 +896,8 @@ // Foo::Foo() {} // // scoped_refptr<Foo> oo = Foo::Create(); - DCHECK(receiver->HasAtLeastOneRef()) - << "base::Bind{Once,Repeating}() refuses to create the first reference " - "to ref-counted objects. That typically happens around PostTask() in " - "their constructor, and such objects can be destroyed before `new` " - "returns if the task resolves fast enough."; + // + DCHECK(receiver->HasAtLeastOneRef()); } // BindState<>
diff --git a/build/android/resource_sizes.py b/build/android/resource_sizes.py index c248dc7..3622fe48 100755 --- a/build/android/resource_sizes.py +++ b/build/android/resource_sizes.py
@@ -826,7 +826,7 @@ histogram_path = os.path.join(args.output_dir, 'perf_results.json') logging.critical('Dumping histograms to %s', histogram_path) - with open(histogram_path, 'w') as json_file: + with open(histogram_path, 'wb') as json_file: json_file.write(histogram_result.stdout)
diff --git a/build/lacros/BUILD.gn b/build/lacros/BUILD.gn index 216010a..09777f3 100644 --- a/build/lacros/BUILD.gn +++ b/build/lacros/BUILD.gn
@@ -18,3 +18,16 @@ output = "$root_out_dir/metadata.json" process_only = true } + +# Lacros is built with "{arch}-generic" configuration. However, in Chrome +# OS, it is just "one board variation", so the libraries on the *-generic +# boards may not be compatible with the ones on the actual DUTs. +# One of the common pattern recently we hit is symbols exposed by libgcc. +# The symbols start to be exposed recently because of libunwind transition +# and along with it they are or are not re-exposed by other libraries, too, +# depending on per-board implementation. +# To mitigate the situation, marking -shared-libgcc to look up the system +# libgcc always. +config("optional_shared_libgcc") { + ldflags = [ "-shared-libgcc" ] +}
diff --git a/cc/paint/paint_op_reader.cc b/cc/paint/paint_op_reader.cc index 8a78f40..d71230c 100644 --- a/cc/paint/paint_op_reader.cc +++ b/cc/paint/paint_op_reader.cc
@@ -1158,6 +1158,14 @@ return; } + // RecordPaintFilter also requires kRasterAtScale to have {1.f, 1.f} as the + // raster_scale, since that is intended for kFixedScale + if (scaling_behavior == PaintShader::ScalingBehavior::kRasterAtScale && + (raster_scale.width() != 1.f || raster_scale.height() != 1.f)) { + SetInvalid(DeserializationError::kInvalidRasterScale); + return; + } + Read(&record); if (!valid_) return;
diff --git a/cc/paint/paint_shader.h b/cc/paint/paint_shader.h index 84092d348..80519ed 100644 --- a/cc/paint/paint_shader.h +++ b/cc/paint/paint_shader.h
@@ -9,7 +9,6 @@ #include <vector> #include "base/gtest_prod_util.h" -#include "base/stl_util.h" #include "cc/paint/image_analysis_state.h" #include "cc/paint/paint_export.h" #include "cc/paint/paint_flags.h" @@ -146,9 +145,6 @@ return image_; } - const gfx::SizeF* tile_scale() const { - return base::OptionalOrNullptr(tile_scale_); - } const sk_sp<PaintRecord>& paint_record() const { return record_; } bool GetRasterizationTileRect(const SkMatrix& ctm, SkRect* tile_rect) const { return GetClampedRasterizationTileRect(ctm, /*max_texture_size=*/0,
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn index b137978..3dd6126 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn
@@ -342,17 +342,8 @@ configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ] } - # Lacros is built with "{arch}-generic" configuration. However, in Chrome - # OS, it is just "one board variation", so the libraries on the *-generic - # boards may not be compatible with the ones on the actual DUTs. - # One of the common pattern recently we hit is symbols exposed by libgcc. - # The symbols start to be exposed recently because of libunwind transition - # and along with it they are or are not re-exposed by other libraries, too, - # depending on per-board implementation. - # To mitigate the situation, marking -shared-libgcc to look up the system - # libgcc always. if (is_chromeos_lacros && is_chromeos_device) { - ldflags += [ "-shared-libgcc" ] + configs += [ "//build/lacros:optional_shared_libgcc" ] } data_deps += [
diff --git a/chrome/DEPS b/chrome/DEPS index f6ce49f..cd90b83b 100644 --- a/chrome/DEPS +++ b/chrome/DEPS
@@ -7,7 +7,6 @@ "+printing", "+sandbox/policy", "+sql", - "+ui/lottie", # Browser, renderer, common and tests access V8 for various purposes. "-v8", "+v8/include",
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index 76b557c..0d12476b 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -23,7 +23,6 @@ import("//chrome/browser/commerce/subscriptions/android/java_sources.gni") import( "//chrome/browser/commerce/subscriptions/test/android/test_java_sources.gni") -import("//chrome/browser/feed/buildflags.gni") import("//chrome/browser/share/android/java_sources.gni") import("//chrome/chrome_paks.gni") import("//chrome/common/features.gni") @@ -281,6 +280,7 @@ java_group("delegate_public_impl_java") { deps = [ ":app_hooks_java", + "//chrome/browser/feed/android:hooks_public_impl_java", "//chrome/browser/lens:delegate_public_impl_java", "//chrome/browser/locale:delegate_public_impl_java", "//chrome/browser/password_manager/android:backend_interface_public_impl_java", @@ -290,9 +290,6 @@ "//components/externalauth/android:google_delegate_public_impl_java", "//components/language/android:ulp_delegate_public_java", ] - if (enable_new_feed_hooks) { - deps += [ "//chrome/browser/feed/android:hooks_public_impl_java" ] - } } java_cpp_template("vr_build_config") {
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index 9a99902..25a7cf4d 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -72,6 +72,7 @@ "java/src/org/chromium/chrome/browser/app/appmenu/UpdateMenuItemViewBinder.java", "java/src/org/chromium/chrome/browser/app/feed/FeedActionDelegateImpl.java", "java/src/org/chromium/chrome/browser/app/feed/NavigationRecorder.java", + "java/src/org/chromium/chrome/browser/app/feed/ProcessScopeDependencyProviderFactory.java", "java/src/org/chromium/chrome/browser/app/feed/feedmanagement/FeedManagementActivity.java", "java/src/org/chromium/chrome/browser/app/feed/followmanagement/FollowManagementActivity.java", "java/src/org/chromium/chrome/browser/app/flags/ChromeCachedFlags.java",
diff --git a/chrome/android/features/start_surface/internal/java/src/org/chromium/chrome/features/start_surface/ExploreSurfaceCoordinator.java b/chrome/android/features/start_surface/internal/java/src/org/chromium/chrome/features/start_surface/ExploreSurfaceCoordinator.java index 4ac290e3..e60f88d 100644 --- a/chrome/android/features/start_surface/internal/java/src/org/chromium/chrome/features/start_surface/ExploreSurfaceCoordinator.java +++ b/chrome/android/features/start_surface/internal/java/src/org/chromium/chrome/features/start_surface/ExploreSurfaceCoordinator.java
@@ -23,7 +23,6 @@ import org.chromium.chrome.browser.feed.FeedSwipeRefreshLayout; import org.chromium.chrome.browser.feed.ScrollableContainerDelegate; import org.chromium.chrome.browser.feed.componentinterfaces.SurfaceCoordinator; -import org.chromium.chrome.browser.feed.hooks.FeedHooksImpl; import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncherImpl; import org.chromium.chrome.browser.ntp.NewTabPageLaunchOrigin; import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl; @@ -81,7 +80,7 @@ feedLaunchReliabilityLoggingState, swipeRefreshLayout, /*overScrollDisabled=*/true, parentView, new ExploreSurfaceActionDelegate(snackbarManager, new BookmarkBridge(profile)), - HelpAndFeedbackLauncherImpl.getInstance(), FeedHooksImpl.getInstance()); + HelpAndFeedbackLauncherImpl.getInstance()); mFeedSurfaceCoordinator.getView().setId(R.id.start_surface_explore_view); // TODO(crbug.com/982018): Customize surface background for incognito and dark mode.
diff --git a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinator.java b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinator.java index 0fb6413..1c95533 100644 --- a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinator.java +++ b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinator.java
@@ -37,12 +37,10 @@ import org.chromium.chrome.browser.feature_engagement.TrackerFactory; import org.chromium.chrome.browser.feed.componentinterfaces.SurfaceCoordinator; import org.chromium.chrome.browser.feed.componentinterfaces.SurfaceCoordinator.StreamTabId; -import org.chromium.chrome.browser.feed.hooks.FeedHooks; import org.chromium.chrome.browser.feed.sections.SectionHeaderListProperties; import org.chromium.chrome.browser.feed.sections.SectionHeaderView; import org.chromium.chrome.browser.feed.sections.SectionHeaderViewBinder; import org.chromium.chrome.browser.feed.settings.FeedAutoplaySettingsFragment; -import org.chromium.chrome.browser.feed.v2.FeedServiceBridgeDelegateImpl; import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncher; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.ntp.NewTabPageLaunchOrigin; @@ -280,9 +278,7 @@ FeedLaunchReliabilityLoggingState launchReliabilityLoggingState, @Nullable FeedSwipeRefreshLayout swipeRefreshLayout, boolean overScrollDisabled, @Nullable ViewGroup viewportView, FeedActionDelegate actionDelegate, - HelpAndFeedbackLauncher helpAndFeedbackLauncher, FeedHooks feedHooks) { - FeedSurfaceTracker.getInstance().initServiceBridge( - new FeedServiceBridgeDelegateImpl(feedHooks)); + HelpAndFeedbackLauncher helpAndFeedbackLauncher) { mActivity = activity; mSnackbarManager = snackbarManager; mNtpHeader = ntpHeader;
diff --git a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedServiceBridgeDelegateImpl.java b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedServiceBridgeDelegateImpl.java deleted file mode 100644 index ed87f050..0000000 --- a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedServiceBridgeDelegateImpl.java +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package org.chromium.chrome.browser.feed.v2; - -import org.chromium.chrome.GoogleAPIKeys; -import org.chromium.chrome.browser.feed.FeedProcessScopeDependencyProvider; -import org.chromium.chrome.browser.feed.FeedServiceBridge; -import org.chromium.chrome.browser.feed.FeedSurfaceTracker; -import org.chromium.chrome.browser.feed.hooks.FeedHooks; -import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl; -import org.chromium.chrome.browser.xsurface.ProcessScope; - -/** - * Implementation of {@link FeedServiceBridge.Delegate}. - */ -public class FeedServiceBridgeDelegateImpl implements FeedServiceBridge.Delegate { - private final FeedHooks mFeedHooks; - private ProcessScope mXSurfaceProcessScope; - - public FeedServiceBridgeDelegateImpl(FeedHooks feedHooks) { - mFeedHooks = feedHooks; - } - - @Override - public ProcessScope getProcessScope() { - if (mXSurfaceProcessScope == null) { - FeedProcessScopeDependencyProvider dependencies = - new FeedProcessScopeDependencyProvider(GoogleAPIKeys.GOOGLE_API_KEY, - PrivacyPreferencesManagerImpl.getInstance()); - if (mFeedHooks.isEnabled()) { - mXSurfaceProcessScope = mFeedHooks.createProcessScope(dependencies); - } - } - return mXSurfaceProcessScope; - } - - @Override - public void clearAll() { - FeedSurfaceTracker.getInstance().clearAll(); - } -}
diff --git a/chrome/android/feed/feed_java_sources.gni b/chrome/android/feed/feed_java_sources.gni index 6043d81..290960c4 100644 --- a/chrome/android/feed/feed_java_sources.gni +++ b/chrome/android/feed/feed_java_sources.gni
@@ -24,7 +24,6 @@ "//chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceMediator.java", "//chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/NtpFeedSurfaceLifecycleManager.java", "//chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/shared/ui/MaterialSpinnerView.java", - "//chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedServiceBridgeDelegateImpl.java", ] feed_srcjar_deps = []
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/feed/ProcessScopeDependencyProviderFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/app/feed/ProcessScopeDependencyProviderFactory.java new file mode 100644 index 0000000..db513512 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/feed/ProcessScopeDependencyProviderFactory.java
@@ -0,0 +1,25 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.app.feed; + +import org.chromium.base.annotations.UsedByReflection; +import org.chromium.chrome.GoogleAPIKeys; +import org.chromium.chrome.browser.feed.FeedProcessScopeDependencyProvider; +import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl; + +/** + * Creates a ProcessScopeDependencyProvider. + * + * Note that because ProcessScopeDependencyProvider is sometimes needed in response to a Native + * call, we use this through reflection rather than simply injecting an instance. + */ +@UsedByReflection("FeedServiceBridge") +public class ProcessScopeDependencyProviderFactory { + @UsedByReflection("FeedServiceBridge") + public static FeedProcessScopeDependencyProvider create() { + return new FeedProcessScopeDependencyProvider( + GoogleAPIKeys.GOOGLE_API_KEY, PrivacyPreferencesManagerImpl.getInstance()); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java index c2786ff..042f7dc 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java
@@ -25,8 +25,11 @@ import org.chromium.base.metrics.RecordHistogram; import org.chromium.chrome.R; import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl; +import org.chromium.chrome.browser.signin.services.FREMobileIdentityConsistencyFieldTrial; +import org.chromium.chrome.browser.ui.signin.fre.FreUMADialogCoordinator; import org.chromium.chrome.browser.version.ChromeVersionInfo; import org.chromium.components.signin.ChildAccountStatus; +import org.chromium.ui.modaldialog.ModalDialogManagerHolder; import org.chromium.ui.text.NoUnderlineClickableSpan; import org.chromium.ui.text.SpanApplier; import org.chromium.ui.text.SpanApplier.SpanInfo; @@ -36,7 +39,8 @@ * Privacy Notice, and to opt-in to the usage statistics and crash reports collection ("UMA", * User Metrics Analysis) as defined in the Chrome Privacy Notice. */ -public class ToSAndUMAFirstRunFragment extends Fragment implements FirstRunFragment { +public class ToSAndUMAFirstRunFragment + extends Fragment implements FirstRunFragment, FreUMADialogCoordinator.Listener { /** Alerts about some methods once ToSAndUMAFirstRunFragment executes them. */ public interface Observer { /** See {@link #onNativeInitialized}. */ @@ -50,6 +54,8 @@ private boolean mNativeInitialized; private boolean mTosButtonClicked; + // TODO(https://crbug.com/1274145): Rename mAllowCrashUpload field. + private boolean mAllowCrashUpload; private Button mAcceptButton; private CheckBox mSendReportCheckBox; @@ -75,6 +81,7 @@ @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); + mAllowCrashUpload = getUmaCheckBoxInitialState(); mTitle = view.findViewById(R.id.title); mProgressSpinner = view.findViewById(R.id.progress_spinner); @@ -85,14 +92,22 @@ mAcceptButton.setOnClickListener((v) -> onTosButtonClicked()); - mSendReportCheckBox.setChecked(getUmaCheckBoxInitialState()); + mSendReportCheckBox.setChecked(mAllowCrashUpload); + mSendReportCheckBox.setOnCheckedChangeListener( + ((compoundButton, isChecked) -> mAllowCrashUpload = isChecked)); if (!canShowUmaCheckBox()) { + if (!FREMobileIdentityConsistencyFieldTrial.shouldShowOldFreWithUmaDialog()) { + mAllowCrashUpload = + sShowUmaCheckBoxForTesting || ChromeVersionInfo.isOfficialBuild(); + } mSendReportCheckBox.setVisibility(View.GONE); } mTosAndPrivacy.setMovementMethod(LinkMovementMethod.getInstance()); Resources resources = getResources(); + final boolean showUmaDialog = + FREMobileIdentityConsistencyFieldTrial.shouldShowOldFreWithUmaDialog(); NoUnderlineClickableSpan clickableGoogleTermsSpan = new NoUnderlineClickableSpan(resources, (view1) -> { if (!isAdded()) return; @@ -106,7 +121,9 @@ NoUnderlineClickableSpan clickableFamilyLinkPrivacySpan = new NoUnderlineClickableSpan(resources, (view1) -> { if (!isAdded()) return; - getPageDelegate().showInfoPage(R.string.family_link_privacy_policy_url); + getPageDelegate().showInfoPage(showUmaDialog + ? R.string.google_privacy_policy_url + : R.string.family_link_privacy_policy_url); }); final CharSequence tosText; @@ -114,15 +131,33 @@ @ChildAccountStatus.Status int childAccountStatus = freProperties.getInt( SyncConsentFirstRunFragment.CHILD_ACCOUNT_STATUS, ChildAccountStatus.NOT_CHILD); - if (childAccountStatus == ChildAccountStatus.REGULAR_CHILD) { - tosText = SpanApplier.applySpans(getString(R.string.fre_tos_and_privacy_child_account), - new SpanInfo("<LINK1>", "</LINK1>", clickableGoogleTermsSpan), - new SpanInfo("<LINK2>", "</LINK2>", clickableChromeAdditionalTermsSpan), - new SpanInfo("<LINK3>", "</LINK3>", clickableFamilyLinkPrivacySpan)); + if (showUmaDialog) { + final NoUnderlineClickableSpan clickableUMADialogSpan = + new NoUnderlineClickableSpan(resources, (view1) -> openUmaDialog()); + if (childAccountStatus == ChildAccountStatus.REGULAR_CHILD) { + tosText = SpanApplier.applySpans( + getString(R.string.signin_fre_footer_supervised_user), + new SpanInfo("<TOS_LINK>", "</TOS_LINK>", clickableGoogleTermsSpan), + new SpanInfo("<PRIVACY_LINK>", "</PRIVACY_LINK>", + clickableFamilyLinkPrivacySpan), + new SpanInfo("<UMA_LINK>", "</UMA_LINK>", clickableUMADialogSpan)); + } else { + tosText = SpanApplier.applySpans(getString(R.string.signin_fre_footer), + new SpanInfo("<TOS_LINK>", "</TOS_LINK>", clickableGoogleTermsSpan), + new SpanInfo("<UMA_LINK>", "</UMA_LINK>", clickableUMADialogSpan)); + } } else { - tosText = SpanApplier.applySpans(getString(R.string.fre_tos), - new SpanInfo("<LINK1>", "</LINK1>", clickableGoogleTermsSpan), - new SpanInfo("<LINK2>", "</LINK2>", clickableChromeAdditionalTermsSpan)); + if (childAccountStatus == ChildAccountStatus.REGULAR_CHILD) { + tosText = SpanApplier.applySpans( + getString(R.string.fre_tos_and_privacy_child_account), + new SpanInfo("<LINK1>", "</LINK1>", clickableGoogleTermsSpan), + new SpanInfo("<LINK2>", "</LINK2>", clickableChromeAdditionalTermsSpan), + new SpanInfo("<LINK3>", "</LINK3>", clickableFamilyLinkPrivacySpan)); + } else { + tosText = SpanApplier.applySpans(getString(R.string.fre_tos), + new SpanInfo("<LINK1>", "</LINK1>", clickableGoogleTermsSpan), + new SpanInfo("<LINK2>", "</LINK2>", clickableChromeAdditionalTermsSpan)); + } } mTosAndPrivacy.setText(tosText); @@ -184,7 +219,19 @@ assert !isWaitingForNativeAndPolicyInit(); setSpinnerVisible(false); - mSendReportCheckBox.setChecked(getUmaCheckBoxInitialState()); + mSendReportCheckBox.setChecked(mAllowCrashUpload); + } + + /** Implements {@link FreUMADialogCoordinator.Listener} */ + @Override + public void onAllowCrashUploadChecked(boolean allowCrashUpload) { + mAllowCrashUpload = allowCrashUpload; + } + + private void openUmaDialog() { + new FreUMADialogCoordinator(requireContext(), + ((ModalDialogManagerHolder) getActivity()).getModalDialogManager(), this, + mAllowCrashUpload); } private void onTosButtonClicked() { @@ -211,8 +258,7 @@ RecordHistogram.recordTimesHistogram("MobileFre.TosFragment.SpinnerVisibleDuration", SystemClock.elapsedRealtime() - mTosAcceptedTime); } - boolean allowCrashUpload = canShowUmaCheckBox() && mSendReportCheckBox.isChecked(); - getPageDelegate().acceptTermsOfService(allowCrashUpload); + getPageDelegate().acceptTermsOfService(mAllowCrashUpload); } private void setSpinnerVisible(boolean spinnerVisible) { @@ -260,7 +306,8 @@ * with whether other non-spinner elements can generally be shown. */ protected boolean canShowUmaCheckBox() { - return sShowUmaCheckBoxForTesting || ChromeVersionInfo.isOfficialBuild(); + return !FREMobileIdentityConsistencyFieldTrial.shouldShowOldFreWithUmaDialog() + && (sShowUmaCheckBoxForTesting || ChromeVersionInfo.isOfficialBuild()); } @VisibleForTesting
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java index 5873a55f..9a4448a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
@@ -47,7 +47,6 @@ import org.chromium.chrome.browser.feed.FeedSwipeRefreshLayout; import org.chromium.chrome.browser.feed.NtpFeedSurfaceLifecycleManager; import org.chromium.chrome.browser.feed.componentinterfaces.SurfaceCoordinator; -import org.chromium.chrome.browser.feed.hooks.FeedHooksImpl; import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncherImpl; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; import org.chromium.chrome.browser.lifecycle.LifecycleObserver; @@ -470,7 +469,7 @@ new FeedLaunchReliabilityLoggingState(SurfaceType.NEW_TAB_PAGE, mConstructedTimeNs), FeedSwipeRefreshLayout.create(activity, R.id.toolbar_container), /* overScrollDisabled= */ false, /* viewportView= */ null, actionDelegate, - HelpAndFeedbackLauncherImpl.getInstance(), FeedHooksImpl.getInstance()); + HelpAndFeedbackLauncherImpl.getInstance()); // Record the timestamp at which the new tab page's construction started. uma.trackTimeToFirstDraw(mFeedSurfaceProvider.getView(), mConstructedTimeNs);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoAboutThisSiteController.java b/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoAboutThisSiteController.java index cee38efc..ea63080 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoAboutThisSiteController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoAboutThisSiteController.java
@@ -15,6 +15,7 @@ import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tab.TabUtils; import org.chromium.chrome.browser.tabmodel.document.TabDelegate; +import org.chromium.components.page_info.PageInfoAction; import org.chromium.components.page_info.PageInfoControllerDelegate; import org.chromium.components.page_info.PageInfoMainController; import org.chromium.components.page_info.PageInfoRowView; @@ -49,6 +50,7 @@ } private void launchSubpage() { + mMainController.recordAction(PageInfoAction.PAGE_INFO_ABOUT_THIS_SITE_PAGE_OPENED); mMainController.launchSubpage(this); } @@ -67,6 +69,8 @@ assert !mDelegate.isIncognito(); AboutThisSiteView view = new AboutThisSiteView(parent.getContext(), null); view.setSiteInfo(mSiteInfo, () -> { + mMainController.recordAction( + PageInfoAction.PAGE_INFO_ABOUT_THIS_SITE_SOURCE_LINK_CLICKED); new TabDelegate(/*incognito=*/false) .createNewTab( new LoadUrlParams(mSiteInfo.getDescription().getSource().getUrl()),
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/DEPS b/chrome/android/java/src/org/chromium/chrome/browser/tab/DEPS index 957dad2b..553931ce 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/DEPS +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/DEPS
@@ -74,8 +74,6 @@ "+components/url_formatter/android", "+components/navigation_interception/android/java/src/org/chromium/components/navigation_interception", "+components/security_state/content/android/java/src/org/chromium/components/security_state/SecurityStateModel.java", - "+ui/android/java/src/org/chromium/ui/base", - "+ui/android/java/src/org/chromium/ui/mojom", ], 'TabStateBrowserControlsVisibilityDelegate\.java': [ "+chrome/browser/util/android/java/src/org/chromium/chrome/browser/util/ChromeAccessibilityUtil.java",
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java index 01917af7..72fd66e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java
@@ -345,6 +345,8 @@ observer.onActivityAttachmentChanged(this, window); } } + + updateInteractableState(); } /** @@ -1483,7 +1485,8 @@ */ private void updateInteractableState() { boolean currentState = !mIsHidden && !isFrozen() - && (mIsViewAttachedToWindow || VrModuleProvider.getDelegate().isInVr()); + && (mIsViewAttachedToWindow || VrModuleProvider.getDelegate().isInVr()) + && !isDetached(this); if (currentState == mInteractableState) return;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/TosAndUmaFirstRunFragmentWithEnterpriseSupportTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/TosAndUmaFirstRunFragmentWithEnterpriseSupportTest.java index 833e5ac..0e45ac4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/TosAndUmaFirstRunFragmentWithEnterpriseSupportTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/TosAndUmaFirstRunFragmentWithEnterpriseSupportTest.java
@@ -31,7 +31,6 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.TestRule; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; @@ -44,7 +43,6 @@ import org.chromium.base.CommandLine; import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.test.util.CallbackHelper; -import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Criteria; import org.chromium.base.test.util.CriteriaHelper; import org.chromium.base.test.util.DisabledTest; @@ -59,9 +57,12 @@ import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl; +import org.chromium.chrome.browser.signin.services.FREMobileIdentityConsistencyFieldTrial; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.util.ChromeRenderTestRule; +import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule; import org.chromium.components.policy.PolicyService; +import org.chromium.components.signin.test.util.FakeAccountInfoService; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.ui.test.util.DisableAnimationsTestRule; @@ -77,7 +78,6 @@ * workflow and UI transition. */ @RunWith(ChromeJUnit4ClassRunner.class) -@CommandLineFlags.Add({ChromeSwitches.FORCE_DISABLE_SIGNIN_FRE}) public class TosAndUmaFirstRunFragmentWithEnterpriseSupportTest { @IntDef({FragmentState.LOADING, FragmentState.NO_POLICY, FragmentState.HAS_POLICY, FragmentState.WAITING_UNTIL_NEXT_PAGE}) @@ -111,7 +111,8 @@ .setDescription(RENDER_TEST_REVISION_DESCRIPTION) .build(); @Rule - public TestRule mCommandLineFlagsRule = CommandLineFlags.getTestRule(); + public final AccountManagerTestRule mAccountManagerTestRule = + new AccountManagerTestRule(new FakeAccountInfoService()); @Mock public FirstRunAppRestrictionInfo mMockAppRestrictionInfo; @@ -162,6 +163,8 @@ FirstRunUtils.setDisableDelayOnExitFreForTest(true); FirstRunUtilsJni.TEST_HOOKS.setInstanceForTesting(mFirstRunUtils); EnterpriseInfo.setInstanceForTest(mMockEnterpriseInfo); + FREMobileIdentityConsistencyFieldTrial.setFirstRunTrialGroupForTesting( + FREMobileIdentityConsistencyFieldTrial.DISABLED_GROUP); setAppRestrictionsMockNotInitialized(); setPolicyServiceMockNotInitialized(); @@ -533,6 +536,49 @@ renderWithPortraitAndLandscape(tosAndUmaFragment, "fre_tosanduma_nopolicy"); } + /** Tests TosAndUmaFirstRunFragment with uma dialog */ + @Test + @SmallTest + @Feature({"RenderTest", "FirstRun"}) + public void testRenderWithUmaDialog() throws Exception { + FREMobileIdentityConsistencyFieldTrial.setFirstRunTrialGroupForTesting( + FREMobileIdentityConsistencyFieldTrial.OLD_FRE_WITH_UMA_DIALOG_GROUP); + launchFirstRunThroughCustomTab(); + setAppRestrictionsMockInitialized(false); + // Clear the focus on view to avoid unexpected highlight on background. + View tosAndUmaFragment = + mActivity.getSupportFragmentManager().getFragments().get(0).getView(); + Assert.assertNotNull(tosAndUmaFragment); + TestThreadUtils.runOnUiThreadBlocking(tosAndUmaFragment::clearFocus); + + Assert.assertEquals( + "Uma checkbox should not be visible.", View.GONE, mUmaCheckBox.getVisibility()); + renderWithPortraitAndLandscape(tosAndUmaFragment, "fre_tosandumadialog_nopolicy"); + } + + /** Tests TosAndUmaFirstRunFragment with uma dialog */ + @Test + @SmallTest + @Feature({"RenderTest", "FirstRun"}) + public void testRenderWithUmaDialogForChildAccount() throws Exception { + FREMobileIdentityConsistencyFieldTrial.setFirstRunTrialGroupForTesting( + FREMobileIdentityConsistencyFieldTrial.OLD_FRE_WITH_UMA_DIALOG_GROUP); + mAccountManagerTestRule.addAccount( + AccountManagerTestRule.createChildAccount("account@gmail.com").name); + launchFirstRunThroughCustomTab(); + setAppRestrictionsMockInitialized(false); + // Clear the focus on view to avoid unexpected highlight on background. + View tosAndUmaFragment = + mActivity.getSupportFragmentManager().getFragments().get(0).getView(); + Assert.assertNotNull(tosAndUmaFragment); + TestThreadUtils.runOnUiThreadBlocking(tosAndUmaFragment::clearFocus); + + Assert.assertEquals( + "Uma checkbox should not be visible.", View.GONE, mUmaCheckBox.getVisibility()); + renderWithPortraitAndLandscape( + tosAndUmaFragment, "fre_tosandumadialog_childaccount_nopolicy"); + } + @Test @SmallTest @Feature({"RenderTest", "FirstRun"})
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoAboutThisSiteTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoAboutThisSiteTest.java index db78070b..3b9a5ef4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoAboutThisSiteTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoAboutThisSiteTest.java
@@ -54,6 +54,7 @@ import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule; import org.chromium.chrome.test.util.ChromeRenderTestRule; import org.chromium.chrome.test.util.browser.Features; +import org.chromium.components.page_info.PageInfoAction; import org.chromium.components.page_info.PageInfoController; import org.chromium.components.page_info.proto.AboutThisSiteMetadataProto.Hyperlink; import org.chromium.components.page_info.proto.AboutThisSiteMetadataProto.SiteDescription; @@ -118,6 +119,7 @@ RecordHistogram.forgetHistogramForTesting("Security.PageInfo.TimeOpen.AboutThisSiteShown"); RecordHistogram.forgetHistogramForTesting( "Security.PageInfo.TimeOpen.AboutThisSiteNotShown"); + RecordHistogram.forgetHistogramForTesting("WebsiteSettings.Action"); } private void openPageInfo() { @@ -237,10 +239,19 @@ @MediumTest public void testAboutThisSiteSubPageSourceClicked() throws ExecutionException, TimeoutException { + assertEquals(0, RecordHistogram.getHistogramTotalCountForTesting("WebsiteSettings.Action")); mockResponse(createDescription()); openPageInfo(); - onView(withId(PageInfoAboutThisSiteController.ROW_ID)).perform(click()); + assertEquals(1, RecordHistogram.getHistogramTotalCountForTesting("WebsiteSettings.Action")); + assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + "WebsiteSettings.Action", PageInfoAction.PAGE_INFO_OPENED)); + onView(withId(PageInfoAboutThisSiteController.ROW_ID)).perform(click()); + assertEquals(2, RecordHistogram.getHistogramTotalCountForTesting("WebsiteSettings.Action")); + assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting("WebsiteSettings.Action", + PageInfoAction.PAGE_INFO_ABOUT_THIS_SITE_PAGE_OPENED)); final CallbackHelper onTabAdded = new CallbackHelper(); final TabModelObserver observer = new TabModelObserver() { @Override @@ -255,5 +266,9 @@ onView(withText(containsString("Example Source"))).perform(click()); onTabAdded.waitForCallback(callCount); TestThreadUtils.runOnUiThreadBlocking(() -> tabModel.removeObserver(observer)); + assertEquals(3, RecordHistogram.getHistogramTotalCountForTesting("WebsiteSettings.Action")); + assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting("WebsiteSettings.Action", + PageInfoAction.PAGE_INFO_ABOUT_THIS_SITE_SOURCE_LINK_CLICKED)); } } \ No newline at end of file
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinatorTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinatorTest.java index c715a3d3..b2a1b1f 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinatorTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinatorTest.java
@@ -43,7 +43,6 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.bookmarks.BookmarkBridge; import org.chromium.chrome.browser.feed.componentinterfaces.SurfaceCoordinator; -import org.chromium.chrome.browser.feed.hooks.FeedHooks; import org.chromium.chrome.browser.feed.sections.SectionHeaderListProperties; import org.chromium.chrome.browser.feed.sections.SectionHeaderView; import org.chromium.chrome.browser.feed.webfeed.WebFeedBridge; @@ -64,7 +63,6 @@ import org.chromium.chrome.browser.xsurface.FeedLaunchReliabilityLogger.SurfaceType; import org.chromium.chrome.browser.xsurface.HybridListRenderer; import org.chromium.chrome.browser.xsurface.ProcessScope; -import org.chromium.chrome.browser.xsurface.ProcessScopeDependencyProvider; import org.chromium.chrome.browser.xsurface.SurfaceScope; import org.chromium.chrome.browser.xsurface.SurfaceScopeDependencyProvider; import org.chromium.chrome.test.util.browser.Features; @@ -160,8 +158,6 @@ // Mocked xSurface setup. @Mock - private FeedHooks mFeedHooks; - @Mock private ProcessScope mProcessScope; @Mock private SurfaceScope mSurfaceScope; @@ -234,10 +230,8 @@ mRecyclerView = new RecyclerView(mActivity); mRecyclerView.setAdapter(mAdapter); - // XSurface setup. - when(mFeedHooks.createProcessScope(any(ProcessScopeDependencyProvider.class))) - .thenReturn(mProcessScope); - when(mFeedHooks.isEnabled()).thenReturn(true); + FeedServiceBridge.setProcessScopeForTesting(mProcessScope); + when(mProcessScope.obtainSurfaceScope(any(SurfaceScopeDependencyProvider.class))) .thenReturn(mSurfaceScope); when(mSurfaceScope.provideListRenderer()).thenReturn(mRenderer); @@ -260,6 +254,7 @@ FeedFeatures.setFakePrefsForTest(null); FeedSurfaceMediator.setPrefForTest(null, null); TemplateUrlServiceFactory.setInstanceForTesting(null); + FeedServiceBridge.setProcessScopeForTesting(null); } @Test @@ -359,6 +354,6 @@ -> { return null; }, new FeedLaunchReliabilityLoggingState(SURFACE_TYPE, SURFACE_CREATION_TIME_NS), null, false, /*viewportView=*/null, mFeedActionDelegate, - /*helpAndFeedbackLauncher=*/null, mFeedHooks); + /*helpAndFeedbackLauncher=*/null); } }
diff --git a/chrome/app_shim/app_shim_controller.mm b/chrome/app_shim/app_shim_controller.mm index d1939ce..54cebbd77 100644 --- a/chrome/app_shim/app_shim_controller.mm +++ b/chrome/app_shim/app_shim_controller.mm
@@ -506,8 +506,9 @@ [item setTag:mojo_item->menu_index]; [item setState:mojo_item->active ? NSOnState : NSOffState]; [item setTarget:profile_menu_target_.get()]; - gfx::Image icon(mojo_item->icon); - [item setImage:icon.ToNSImage()]; + // TODO(https://crbug.com/1274236, https://crbug.com/898608): Fix + // crashes in gfx::Image::ToNSImage, and re-add the profile icon to + // the menu. [menu insertItem:item atIndex:i]; } }
diff --git a/chrome/app_shim/chrome_main_app_mode_mac.mm b/chrome/app_shim/chrome_main_app_mode_mac.mm index d3ce6af..9b666ec 100644 --- a/chrome/app_shim/chrome_main_app_mode_mac.mm +++ b/chrome/app_shim/chrome_main_app_mode_mac.mm
@@ -75,6 +75,12 @@ base::mac::SetOverrideFrameworkBundlePath( base::FilePath(info->chrome_framework_path)); + // Note that `info->user_data_dir` for shims contains the app data path, + // <user_data_dir>/<profile_dir>/Web Applications/_crx_extensionid/. + const base::FilePath user_data_dir = + base::FilePath(info->user_data_dir).DirName().DirName().DirName(); + + // TODO(https://crbug.com/1274807): Specify `user_data_dir` to CrashPad. ChromeCrashReporterClient::Create(); crash_reporter::InitializeCrashpad(true, "app_shim"); @@ -136,10 +142,7 @@ base::PlatformThread::SetName("CrAppShimMain"); AppShimController::Params controller_params; - // Note that |info->user_data_dir| for shims contains the app data path, - // <user_data_dir>/<profile_dir>/Web Applications/_crx_extensionid/. - controller_params.user_data_dir = - base::FilePath(info->user_data_dir).DirName().DirName().DirName(); + controller_params.user_data_dir = user_data_dir; // Similarly, extract the full profile path from |info->user_data_dir|. // Ignore |info->profile_dir| because it is only the relative path (unless // it is empty, in which case this is a profile-agnostic app).
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 43be395..53601c9 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS
@@ -533,11 +533,6 @@ # DBus interface to highlight a file within its parent folder "+dbus" ], - "platform_util_mac.mm": [ - # The following is used to forward methods to an NSWindow in another - # process, via the views::Widget API. - "+ui/views/widget/widget.h", - ], "exo_parts\.cc": [ "+ash/shell.h", ],
diff --git a/chrome/browser/ash/DEPS b/chrome/browser/ash/DEPS index 1bea36f..38cb2ad61 100644 --- a/chrome/browser/ash/DEPS +++ b/chrome/browser/ash/DEPS
@@ -37,9 +37,6 @@ ".*fuzz.*": [ "+third_party/libFuzzer/src/utils", # This contains FuzzedDataProvider. ], - "assistant_util_unittest\.cc": [ - "+ui/events/devices/device_data_manager.h", - ], "child_status_collector_browsertest.cc": [ "+mojo/core/embedder/embedder.h", ], @@ -49,9 +46,6 @@ "legacy_device_status_collector_browsertest.cc": [ "+mojo/core/embedder/embedder.h", ], - "event_rewriter_unittest\.cc": [ - "+ui/events/devices/device_data_manager.h", - ], "external_protocol_dialog\.cc": [ "+chrome/browser/ui/views/external_protocol_dialog.h", ],
diff --git a/chrome/browser/ash/arc/input_method_manager/arc_input_method_manager_service.cc b/chrome/browser/ash/arc/input_method_manager/arc_input_method_manager_service.cc index 3f83410..f0dc86f 100644 --- a/chrome/browser/ash/arc/input_method_manager/arc_input_method_manager_service.cc +++ b/chrome/browser/ash/arc/input_method_manager/arc_input_method_manager_service.cc
@@ -8,6 +8,7 @@ #include <utility> #include "ash/components/arc/arc_browser_context_keyed_service_factory_base.h" +#include "ash/components/arc/mojom/ime_mojom_traits.h" #include "ash/constants/ash_pref_names.h" #include "ash/public/cpp/keyboard/arc/arc_input_method_bounds_tracker.h" #include "ash/public/cpp/keyboard/keyboard_switches.h" @@ -23,7 +24,6 @@ #include "chrome/browser/ash/arc/input_method_manager/arc_input_method_manager_bridge_impl.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h" -#include "components/arc/mojom/ime_mojom_traits.h" #include "components/crx_file/id_util.h" #include "components/prefs/pref_service.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager.cc b/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager.cc index 5e88b57..ce7d8ac 100644 --- a/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager.cc +++ b/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager.cc
@@ -116,11 +116,64 @@ } void ArcInputOverlayManager::NotifyTextInputState() { - auto it = input_overlay_enabled_windows_.find(registered_window_); + auto it = input_overlay_enabled_windows_.find(registered_top_level_window_); if (it != input_overlay_enabled_windows_.end()) it->second->NotifyTextInputState(is_text_input_active_); } +void ArcInputOverlayManager::AddObserverToInputMethod() { + if (!registered_top_level_window_) + return; + DCHECK(registered_top_level_window_->GetHost()); + DCHECK(!input_method_); + input_method_ = registered_top_level_window_->GetHost()->GetInputMethod(); + if (input_method_) + input_method_->AddObserver(input_method_observer_.get()); +} + +void ArcInputOverlayManager::RemoveObserverFromInputMethod() { + if (!input_method_) + return; + input_method_->RemoveObserver(input_method_observer_.get()); + input_method_ = nullptr; +} + +void ArcInputOverlayManager::RegisterWindow(aura::Window* top_level_window) { + if (!top_level_window || registered_top_level_window_ == top_level_window) + return; + auto it = input_overlay_enabled_windows_.find(top_level_window); + if (it == input_overlay_enabled_windows_.end()) + return; + DCHECK(!registered_top_level_window_); + it->second->RegisterEventRewriter(); + registered_top_level_window_ = top_level_window; + AddObserverToInputMethod(); + // If the window is on the extended window, it turns out only primary root + // window catches the key event. So it needs to forward the key event from + // primary root window to extended root window event source. + if (registered_top_level_window_->GetRootWindow() != + ash::Shell::GetPrimaryRootWindow()) { + key_event_source_rewriter_ = + std::make_unique<KeyEventSourceRewriter>(registered_top_level_window_); + } +} + +void ArcInputOverlayManager::UnRegisterWindow(aura::Window* top_level_window) { + if (!registered_top_level_window_ || + registered_top_level_window_ != top_level_window) { + return; + } + auto it = input_overlay_enabled_windows_.find(registered_top_level_window_); + DCHECK(it != input_overlay_enabled_windows_.end()); + if (it == input_overlay_enabled_windows_.end()) + return; + if (key_event_source_rewriter_) + key_event_source_rewriter_.reset(); + it->second->UnRegisterEventRewriter(); + registered_top_level_window_ = nullptr; + RemoveObserverFromInputMethod(); +} + //////////////////////////////////////////////////////////////////////////////// // Overridden from aura::EnvObserver: void ArcInputOverlayManager::OnWindowInitialized(aura::Window* new_window) { @@ -145,31 +198,36 @@ if (!package_name || package_name->empty()) return; ReadData(*package_name, top_level_window); - - // Add input method observer if it is not added. - if (!input_method_ && window->GetHost()) { - input_method_ = window->GetHost()->GetInputMethod(); - if (input_method_) - input_method_->AddObserver(input_method_observer_.get()); - } } } void ArcInputOverlayManager::OnWindowDestroying(aura::Window* window) { - if (input_overlay_enabled_windows_.contains(window)) - input_overlay_enabled_windows_.erase(window); - if (window_observations_.IsObservingSource(window)) window_observations_.RemoveObservation(window); + UnRegisterWindow(window); + input_overlay_enabled_windows_.erase(window); +} + +void ArcInputOverlayManager::OnWindowAddedToRootWindow(aura::Window* window) { + if (!window) + return; + RegisterWindow(window->GetToplevelWindow()); +} + +void ArcInputOverlayManager::OnWindowRemovingFromRootWindow( + aura::Window* window, + aura::Window* new_root) { + if (!window) + return; + // There might be child window surface removing, we don't unregister window + // until the top_level_window is removed from the root. + UnRegisterWindow(window); } //////////////////////////////////////////////////////////////////////////////// // KeyedService: void ArcInputOverlayManager::Shutdown() { - if (input_method_) { - input_method_->RemoveObserver(input_method_observer_.get()); - input_method_ = nullptr; - } + UnRegisterWindow(registered_top_level_window_); } //////////////////////////////////////////////////////////////////////////////// @@ -184,23 +242,12 @@ if (gained_focus) gained_focus_top_level_window = gained_focus->GetToplevelWindow(); - else - registered_window_ = nullptr; if (lost_focus_top_level_window == gained_focus_top_level_window) return; - auto it = input_overlay_enabled_windows_.find(lost_focus_top_level_window); - if (it != input_overlay_enabled_windows_.end()) { - it->second->UnRegisterEventRewriter(); - registered_window_ = nullptr; - } - - it = input_overlay_enabled_windows_.find(gained_focus_top_level_window); - if (it != input_overlay_enabled_windows_.end()) { - it->second->RegisterEventRewriter(); - registered_window_ = gained_focus_top_level_window; - } + UnRegisterWindow(lost_focus_top_level_window); + RegisterWindow(gained_focus_top_level_window); } } // namespace arc
diff --git a/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager.h b/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager.h index d04f1b31..20a4d1c 100644 --- a/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager.h +++ b/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager.h
@@ -9,6 +9,7 @@ #include "base/scoped_multi_source_observation.h" #include "base/scoped_observation.h" #include "base/strings/string_util.h" +#include "chrome/browser/ash/arc/input_overlay/key_event_source_rewriter.h" #include "chrome/browser/ash/arc/input_overlay/touch_injector.h" #include "components/keyed_service/core/keyed_service.h" #include "ui/aura/client/focus_change_observer.h" @@ -51,8 +52,10 @@ void OnWindowPropertyChanged(aura::Window* window, const void* key, intptr_t old) override; - void OnWindowDestroying(aura::Window* window) override; + void OnWindowAddedToRootWindow(aura::Window* window) override; + void OnWindowRemovingFromRootWindow(aura::Window* window, + aura::Window* new_root) override; // KeyedService overrides: void Shutdown() override; @@ -79,11 +82,16 @@ std::unique_ptr<InputMethodObserver> input_method_observer_; // Only one window is registered since there is only one window can be focused // each time. - aura::Window* registered_window_ = nullptr; + aura::Window* registered_top_level_window_ = nullptr; + std::unique_ptr<KeyEventSourceRewriter> key_event_source_rewriter_; void ReadData(const std::string& package_name, aura::Window* top_level_window); void NotifyTextInputState(); + void AddObserverToInputMethod(); + void RemoveObserverFromInputMethod(); + void RegisterWindow(aura::Window* top_level_window); + void UnRegisterWindow(aura::Window* top_level_window); base::WeakPtrFactory<ArcInputOverlayManager> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager_unittest.cc b/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager_unittest.cc index 8bd81117..5de3f82 100644 --- a/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager_unittest.cc +++ b/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager_unittest.cc
@@ -5,26 +5,40 @@ #include "chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager.h" #include "ash/public/cpp/window_properties.h" +#include "ash/shell.h" +#include "ash/test/ash_test_base.h" +#include "chrome/browser/ash/arc/input_overlay/test/event_capturer.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/aura/test/aura_test_base.h" #include "ui/aura/test/test_window_delegate.h" -#include "ui/aura/test/test_windows.h" #include "ui/aura/window.h" #include "ui/base/ime/dummy_text_input_client.h" #include "ui/base/ime/init/input_method_factory.h" +#include "ui/views/widget/widget.h" namespace arc { +namespace { -class ArcInputOverlayManagerTest : public aura::test::AuraTestBase { +std::unique_ptr<aura::Window> CreateArcWindowWithRootAndPackage( + aura::Window* root, + const std::string& package_name) { + views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); + params.bounds = gfx::Rect(); + params.context = root; + views::Widget* widget = new views::Widget(); + widget->Init(std::move(params)); + widget->GetNativeWindow()->SetTitle(u"foo"); + widget->GetNativeWindow()->SetProperty(ash::kArcPackageNameKey, package_name); + widget->Show(); + widget->Activate(); + return base::WrapUnique(widget->GetNativeWindow()); +} + +} // namespace + +class ArcInputOverlayManagerTest : public ash::AshTestBase { public: ArcInputOverlayManagerTest() = default; - std::unique_ptr<aura::Window> CreateFakeArcWindow(int window_id, - aura::Window* root) { - return base::WrapUnique(aura::test::CreateTestWindowWithDelegate( - &dummy_delegate_, window_id, gfx::Rect(), root)); - } - bool IsInputOverlayEnabled(const aura::Window* window) const { return arc_test_input_overlay_manager_->input_overlay_enabled_windows_ .contains(window); @@ -55,7 +69,11 @@ } aura::Window* GetRegisteredWindow() { - return arc_test_input_overlay_manager_->registered_window_; + return arc_test_input_overlay_manager_->registered_top_level_window_; + } + + KeyEventSourceRewriter* GetKeyEventSourceRewriter() { + return arc_test_input_overlay_manager_->key_event_source_rewriter_.get(); } protected: @@ -65,7 +83,7 @@ aura::test::TestWindowDelegate dummy_delegate_; void SetUp() override { - aura::test::AuraTestBase::SetUp(); + ash::AshTestBase::SetUp(); arc_test_input_overlay_manager_ = base::WrapUnique(new ArcInputOverlayManager(nullptr, nullptr)); } @@ -73,17 +91,14 @@ void TearDown() override { arc_test_input_overlay_manager_->Shutdown(); arc_test_input_overlay_manager_.reset(); - aura::test::AuraTestBase::TearDown(); + ash::AshTestBase::TearDown(); } }; TEST_F(ArcInputOverlayManagerTest, TestPropertyChangeAndWindowDestroy) { // Test app with input overlay data. - auto arc_window = CreateFakeArcWindow(11, nullptr); - EXPECT_FALSE(IsInputOverlayEnabled(arc_window.get())); - arc_window->SetProperty( - ash::kArcPackageNameKey, - new std::string("org.chromium.arc.testapp.inputoverlay")); + auto arc_window = CreateArcWindowWithRootAndPackage( + nullptr, "org.chromium.arc.testapp.inputoverlay"); EXPECT_TRUE(IsInputOverlayEnabled(arc_window.get())); // Test app with input overlay data when window is destroyed. @@ -91,22 +106,18 @@ EXPECT_FALSE(IsInputOverlayEnabled(arc_window.get())); // Test app without input overlay data. - auto arc_window_no_data = CreateFakeArcWindow(22, nullptr); - EXPECT_FALSE(IsInputOverlayEnabled(arc_window_no_data.get())); - arc_window_no_data->SetProperty( - ash::kArcPackageNameKey, - new std::string("org.chromium.arc.testapp.inputoverlay_no_data")); + auto arc_window_no_data = CreateArcWindowWithRootAndPackage( + nullptr, "org.chromium.arc.testapp.inputoverlay_no_data"); EXPECT_FALSE(IsInputOverlayEnabled(arc_window_no_data.get())); } TEST_F(ArcInputOverlayManagerTest, TestInputMethodObsever) { ASSERT_FALSE(GetInputMethod()); ASSERT_FALSE(IsTextInputActive()); - auto arc_window = CreateFakeArcWindow(11, root_window()); - EXPECT_FALSE(IsInputOverlayEnabled(arc_window.get())); - arc_window->SetProperty( - ash::kArcPackageNameKey, - new std::string("org.chromium.arc.testapp.inputoverlay")); + auto arc_window = CreateArcWindowWithRootAndPackage( + ash::Shell::GetPrimaryRootWindow(), + "org.chromium.arc.testapp.inputoverlay"); + arc_test_input_overlay_manager_->OnWindowFocused(arc_window.get(), nullptr); ui::InputMethod* input_method = GetInputMethod(); EXPECT_TRUE(GetInputMethod()); input_method->SetFocusedTextInputClient(nullptr); @@ -122,15 +133,12 @@ } TEST_F(ArcInputOverlayManagerTest, TestWindowFocusChange) { - auto arc_window = CreateFakeArcWindow(11, root_window()); - arc_window->SetProperty( - ash::kArcPackageNameKey, - new std::string("org.chromium.arc.testapp.inputoverlay")); - auto arc_window_no_data = CreateFakeArcWindow(22, nullptr); - EXPECT_FALSE(IsInputOverlayEnabled(arc_window_no_data.get())); - arc_window_no_data->SetProperty( - ash::kArcPackageNameKey, - new std::string("org.chromium.arc.testapp.inputoverlay_no_data")); + auto arc_window = CreateArcWindowWithRootAndPackage( + ash::Shell::GetPrimaryRootWindow(), + "org.chromium.arc.testapp.inputoverlay"); + auto arc_window_no_data = CreateArcWindowWithRootAndPackage( + ash::Shell::GetPrimaryRootWindow(), + "org.chromium.arc.testapp.inputoverlay_no_data"); EXPECT_EQ(1, EnabledWindows()); auto* injector = GetTouchInjector(arc_window.get()); @@ -147,4 +155,91 @@ EXPECT_TRUE(!GetRegisteredWindow()); } +TEST_F(ArcInputOverlayManagerTest, TestKeyEventSourceRewriterForMultiDisplay) { + UpdateDisplay("1000x900,1000x900"); + aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); + display::Display display0 = display::Screen::GetScreen()->GetDisplayMatching( + root_windows[0]->GetBoundsInScreen()); + display::Display display1 = display::Screen::GetScreen()->GetDisplayMatching( + root_windows[1]->GetBoundsInScreen()); + + // Test when launching input overlay window on the secondary display, there + // should be |key_event_source_rewriter_| registered on the primary root + // window. + EXPECT_FALSE(GetKeyEventSourceRewriter()); + auto arc_window = CreateArcWindowWithRootAndPackage( + root_windows[1], "org.chromium.arc.testapp.inputoverlay"); + arc_window->SetBoundsInScreen(gfx::Rect(1010, 910, 100, 100), display1); + EXPECT_TRUE(GetKeyEventSourceRewriter()); + // Simulate the fact that key events are only sent to primary root window + // when there is no text input focus. Make sure the input overlay window can + // receive simulated touch events on the secondary window. + auto event_generator = + std::make_unique<ui::test::EventGenerator>(root_windows[0]); + input_overlay::test::EventCapturer event_capturer; + root_windows[1]->AddPostTargetHandler(&event_capturer); + event_generator->PressKey(ui::VKEY_A, ui::EF_NONE, 1 /* keyboard id */); + EXPECT_TRUE(event_capturer.key_events().empty()); + EXPECT_TRUE(event_capturer.touch_events().size() == 1); + event_generator->ReleaseKey(ui::VKEY_A, ui::EF_NONE, 1); + EXPECT_TRUE(event_capturer.key_events().empty()); + EXPECT_TRUE(event_capturer.touch_events().size() == 2); + event_capturer.Clear(); + root_windows[1]->RemovePostTargetHandler(&event_capturer); + // Move to the primary display. + arc_window->SetBoundsInScreen(gfx::Rect(10, 10, 100, 100), display0); + EXPECT_FALSE(GetKeyEventSourceRewriter()); + // Move back to the secondary display. + arc_window->SetBoundsInScreen(gfx::Rect(1010, 910, 100, 100), display1); + EXPECT_TRUE(GetKeyEventSourceRewriter()); + arc_window.reset(); + + // Test when launching input overlay window on the primary display, there + // shouldn't be |key_event_source_rewriter_|. + EXPECT_FALSE(GetKeyEventSourceRewriter()); + arc_window = CreateArcWindowWithRootAndPackage( + root_windows[0], "org.chromium.arc.testapp.inputoverlay"); + EXPECT_FALSE(GetKeyEventSourceRewriter()); + // Move to the secondary display. + arc_window->SetBoundsInScreen(gfx::Rect(1010, 910, 100, 100), display1); + EXPECT_TRUE(GetKeyEventSourceRewriter()); + // When losing focus, |key_event_source_rewriter_| should be destroyed too. + arc_test_input_overlay_manager_->OnWindowFocused(nullptr, arc_window.get()); + EXPECT_FALSE(GetKeyEventSourceRewriter()); + arc_window.reset(); + + // Test when this is non input overlay window launched on the secondry + // display, there shouldn't be |key_event_source_rewriter_|. + auto arc_window_no_data = CreateArcWindowWithRootAndPackage( + root_windows[1], "org.chromium.arc.testapp.inputoverlay_no_data"); + EXPECT_FALSE(GetKeyEventSourceRewriter()); + arc_window_no_data.reset(); + + // Test with no text input focused, when input overlay window on the secondary + // root window is registered/focused, primary window shouldn't receive any key + // events. When input overlay window on the secondary root window is not + // registered/not focused, primary window should receive key events. + root_windows[0]->AddPostTargetHandler(&event_capturer); + arc_window = CreateArcWindowWithRootAndPackage( + root_windows[1], "org.chromium.arc.testapp.inputoverlay"); + arc_window_no_data = CreateArcWindowWithRootAndPackage( + root_windows[0], "org.chromium.arc.testapp.inputoverlay_no_data"); + // Focus on window without input overlay. + arc_test_input_overlay_manager_->OnWindowFocused(arc_window_no_data.get(), + nullptr); + event_generator->PressKey(ui::VKEY_A, ui::EF_NONE, 1 /* keyboard id */); + event_generator->ReleaseKey(ui::VKEY_A, ui::EF_NONE, 1 /* keyboard id */); + EXPECT_TRUE(event_capturer.key_events().size() == 2); + event_capturer.Clear(); + // Focus input overlay window. + arc_test_input_overlay_manager_->OnWindowFocused(arc_window.get(), + arc_window_no_data.get()); + EXPECT_TRUE(GetKeyEventSourceRewriter()); + event_generator->PressKey(ui::VKEY_A, ui::EF_NONE, 1 /* keyboard id */); + event_generator->ReleaseKey(ui::VKEY_A, ui::EF_NONE, 1 /* keyboard id */); + EXPECT_TRUE(event_capturer.key_events().empty()); + event_capturer.Clear(); + root_windows[0]->RemovePostTargetHandler(&event_capturer); +} + } // namespace arc
diff --git a/chrome/browser/ash/arc/input_overlay/key_event_source_rewriter.cc b/chrome/browser/ash/arc/input_overlay/key_event_source_rewriter.cc new file mode 100644 index 0000000..0dd3947 --- /dev/null +++ b/chrome/browser/ash/arc/input_overlay/key_event_source_rewriter.cc
@@ -0,0 +1,30 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/arc/input_overlay/key_event_source_rewriter.h" + +#include "ash/shell.h" + +namespace arc { + +KeyEventSourceRewriter::KeyEventSourceRewriter(aura::Window* top_level_window) + : top_level_window_{top_level_window} { + observation_.Observe( + ash::Shell::GetPrimaryRootWindow()->GetHost()->GetEventSource()); +} + +KeyEventSourceRewriter::~KeyEventSourceRewriter() = default; + +//////////////////////////////////////////////////////////////////////////////// +// ui::EventRewriter +ui::EventDispatchDetails KeyEventSourceRewriter::RewriteEvent( + const ui::Event& event, + const Continuation continuation) { + if (!event.IsKeyEvent()) + return SendEvent(continuation, &event); + auto* root_window = top_level_window_->GetRootWindow(); + return root_window->GetHost()->GetEventSource()->SendEventToSink(&event); +} + +} // namespace arc
diff --git a/chrome/browser/ash/arc/input_overlay/key_event_source_rewriter.h b/chrome/browser/ash/arc/input_overlay/key_event_source_rewriter.h new file mode 100644 index 0000000..12a62392 --- /dev/null +++ b/chrome/browser/ash/arc/input_overlay/key_event_source_rewriter.h
@@ -0,0 +1,40 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_ARC_INPUT_OVERLAY_KEY_EVENT_SOURCE_REWRITER_H_ +#define CHROME_BROWSER_ASH_ARC_INPUT_OVERLAY_KEY_EVENT_SOURCE_REWRITER_H_ + +#include "base/scoped_observation.h" +#include "ui/aura/window.h" +#include "ui/aura/window_tree_host.h" +#include "ui/events/event_rewriter.h" + +namespace arc { +// KeyEventSourceRewriter forwards the key event from primary root window to the +// extended root window event source when the input-overlay enabled window is on +// the extended display. +class KeyEventSourceRewriter : public ui::EventRewriter { + public: + explicit KeyEventSourceRewriter(aura::Window* top_level_window); + KeyEventSourceRewriter(const KeyEventSourceRewriter&) = delete; + KeyEventSourceRewriter& operator=(const KeyEventSourceRewriter&) = delete; + ~KeyEventSourceRewriter() override; + + // Overridden from ui::EventRewriter + ui::EventDispatchDetails RewriteEvent( + const ui::Event& event, + const Continuation continuation) override; + + private: + aura::Window* top_level_window_; + base::ScopedObservation<ui::EventSource, + ui::EventRewriter, + &ui::EventSource::AddEventRewriter, + &ui::EventSource::RemoveEventRewriter> + observation_{this}; +}; + +} // namespace arc + +#endif // CHROME_BROWSER_ASH_ARC_INPUT_OVERLAY_KEY_EVENT_SOURCE_REWRITER_H_
diff --git a/chrome/browser/ash/arc/input_overlay/test/event_capturer.cc b/chrome/browser/ash/arc/input_overlay/test/event_capturer.cc new file mode 100644 index 0000000..d8e01f5 --- /dev/null +++ b/chrome/browser/ash/arc/input_overlay/test/event_capturer.cc
@@ -0,0 +1,27 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/arc/input_overlay/test/event_capturer.h" + +namespace arc { +namespace input_overlay { +namespace test { +EventCapturer::EventCapturer() = default; +EventCapturer::~EventCapturer() = default; + +void EventCapturer::Clear() { + key_events_.clear(); + touch_events_.clear(); +} + +void EventCapturer::OnKeyEvent(ui::KeyEvent* event) { + key_events_.emplace_back(std::make_unique<ui::KeyEvent>(*event)); +} + +void EventCapturer::OnTouchEvent(ui::TouchEvent* event) { + touch_events_.emplace_back(std::make_unique<ui::TouchEvent>(*event)); +} +} // namespace test +} // namespace input_overlay +} // namespace arc
diff --git a/chrome/browser/ash/arc/input_overlay/test/event_capturer.h b/chrome/browser/ash/arc/input_overlay/test/event_capturer.h new file mode 100644 index 0000000..ebfa6cd --- /dev/null +++ b/chrome/browser/ash/arc/input_overlay/test/event_capturer.h
@@ -0,0 +1,44 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_ARC_INPUT_OVERLAY_TEST_EVENT_CAPTURER_H_ +#define CHROME_BROWSER_ASH_ARC_INPUT_OVERLAY_TEST_EVENT_CAPTURER_H_ + +#include "ui/events/event.h" +#include "ui/events/event_handler.h" + +namespace arc { +namespace input_overlay { +namespace test { + +// EventCapturer captures events of different types for unit tests. +class EventCapturer : public ui::EventHandler { + public: + EventCapturer(); + EventCapturer(const EventCapturer&) = delete; + EventCapturer& operator=(const EventCapturer&) = delete; + ~EventCapturer() override; + + void Clear(); + + std::vector<std::unique_ptr<ui::KeyEvent>>& key_events() { + return key_events_; + } + std::vector<std::unique_ptr<ui::TouchEvent>>& touch_events() { + return touch_events_; + } + + private: + // EventHandler overrides: + void OnKeyEvent(ui::KeyEvent* event) override; + void OnTouchEvent(ui::TouchEvent* event) override; + + std::vector<std::unique_ptr<ui::KeyEvent>> key_events_; + std::vector<std::unique_ptr<ui::TouchEvent>> touch_events_; +}; +} // namespace test +} // namespace input_overlay +} // namespace arc + +#endif // CHROME_BROWSER_ASH_ARC_INPUT_OVERLAY_TEST_EVENT_CAPTURER_H_
diff --git a/chrome/browser/ash/arc/input_overlay/touch_injector_unittest.cc b/chrome/browser/ash/arc/input_overlay/touch_injector_unittest.cc index 07f1ffe..d89e6ba7 100644 --- a/chrome/browser/ash/arc/input_overlay/touch_injector_unittest.cc +++ b/chrome/browser/ash/arc/input_overlay/touch_injector_unittest.cc
@@ -9,6 +9,7 @@ #include "base/json/json_reader.h" #include "chrome/browser/ash/arc/input_overlay/actions/action_tap_key.h" #include "chrome/browser/ash/arc/input_overlay/input_overlay_resources_util.h" +#include "chrome/browser/ash/arc/input_overlay/test/event_capturer.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/test/aura_test_base.h" @@ -107,39 +108,6 @@ })json"; } // namespace -// Records all key events for testing. -class EventCapturer : public ui::EventHandler { - public: - EventCapturer() = default; - EventCapturer(const EventCapturer&) = delete; - EventCapturer& operator=(const EventCapturer&) = delete; - ~EventCapturer() override = default; - - void Clear() { - key_events_.clear(); - touch_events_.clear(); - } - - std::vector<std::unique_ptr<ui::KeyEvent>>& key_events() { - return key_events_; - } - std::vector<std::unique_ptr<ui::TouchEvent>>& touch_events() { - return touch_events_; - } - - private: - void OnKeyEvent(ui::KeyEvent* event) override { - key_events_.emplace_back(std::make_unique<ui::KeyEvent>(*event)); - } - - void OnTouchEvent(ui::TouchEvent* event) override { - touch_events_.emplace_back(std::make_unique<ui::TouchEvent>(*event)); - } - - std::vector<std::unique_ptr<ui::KeyEvent>> key_events_; - std::vector<std::unique_ptr<ui::TouchEvent>> touch_events_; -}; - class TouchInjectorTest : public views::ViewsTestBase { protected: TouchInjectorTest() @@ -181,7 +149,7 @@ aura::Window* root_window() { return GetContext(); } - EventCapturer event_capturer_; + input_overlay::test::EventCapturer event_capturer_; std::unique_ptr<ui::test::EventGenerator> event_generator_; std::unique_ptr<views::Widget> widget_;
diff --git a/chrome/browser/ash/arc/oemcrypto/arc_oemcrypto_bridge.cc b/chrome/browser/ash/arc/oemcrypto/arc_oemcrypto_bridge.cc index 9f562bb..16f60b2 100644 --- a/chrome/browser/ash/arc/oemcrypto/arc_oemcrypto_bridge.cc +++ b/chrome/browser/ash/arc/oemcrypto/arc_oemcrypto_bridge.cc
@@ -7,12 +7,12 @@ #include <utility> #include "ash/components/arc/arc_browser_context_keyed_service_factory_base.h" +#include "ash/components/arc/mojom/protected_buffer_manager.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "base/bind.h" #include "base/memory/singleton.h" #include "chrome/browser/ash/settings/cros_settings.h" #include "chromeos/components/cdm_factory_daemon/cdm_factory_daemon_proxy_ash.h" -#include "components/arc/mojom/protected_buffer_manager.mojom.h" #include "content/public/browser/gpu_service_registry.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/chrome/browser/ash/arc/oemcrypto/arc_oemcrypto_bridge.h b/chrome/browser/ash/arc/oemcrypto/arc_oemcrypto_bridge.h index 79db3ef..c9cfaf3 100644 --- a/chrome/browser/ash/arc/oemcrypto/arc_oemcrypto_bridge.h +++ b/chrome/browser/ash/arc/oemcrypto/arc_oemcrypto_bridge.h
@@ -7,8 +7,8 @@ #include <stdint.h> -#include "components/arc/mojom/oemcrypto.mojom.h" -#include "components/arc/mojom/protected_buffer_manager.mojom.h" +#include "ash/components/arc/mojom/oemcrypto.mojom.h" +#include "ash/components/arc/mojom/protected_buffer_manager.mojom.h" #include "components/keyed_service/core/keyed_service.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/chrome/browser/ash/arc/optin/arc_terms_of_service_oobe_negotiator.cc b/chrome/browser/ash/arc/optin/arc_terms_of_service_oobe_negotiator.cc index b0fe77082..62f3625 100644 --- a/chrome/browser/ash/arc/optin/arc_terms_of_service_oobe_negotiator.cc +++ b/chrome/browser/ash/arc/optin/arc_terms_of_service_oobe_negotiator.cc
@@ -96,4 +96,9 @@ HandleTermsAccepted(true); } +void ArcTermsOfServiceOobeNegotiator::OnConsolidatedConsentScreenDestroyed() { + DCHECK(chromeos::features::IsOobeConsolidatedConsentEnabled()); + HandleTermsAccepted(false); +} + } // namespace arc
diff --git a/chrome/browser/ash/arc/optin/arc_terms_of_service_oobe_negotiator.h b/chrome/browser/ash/arc/optin/arc_terms_of_service_oobe_negotiator.h index 3b58413a..4fbe532 100644 --- a/chrome/browser/ash/arc/optin/arc_terms_of_service_oobe_negotiator.h +++ b/chrome/browser/ash/arc/optin/arc_terms_of_service_oobe_negotiator.h
@@ -50,6 +50,7 @@ // chromeos::ConsolidatedConsentScreen::Observer: void OnConsolidatedConsentAccept() override; + void OnConsolidatedConsentScreenDestroyed() override; // ArcTermsOfServiceNegotiator: void StartNegotiationImpl() override;
diff --git a/chrome/browser/ash/chrome_browser_main_parts_ash.cc b/chrome/browser/ash/chrome_browser_main_parts_ash.cc index d30f91d8..0e00678 100644 --- a/chrome/browser/ash/chrome_browser_main_parts_ash.cc +++ b/chrome/browser/ash/chrome_browser_main_parts_ash.cc
@@ -1349,6 +1349,8 @@ debugd_notification_handler_.reset(); shortcut_mapping_pref_service_.reset(); quick_answers_controller_.reset(); + if (features::IsBluetoothRevampEnabled()) + bluetooth_pref_state_observer_.reset(); // Detach D-Bus clients before DBusThreadManager is shut down. idle_action_warning_observer_.reset();
diff --git a/chrome/browser/ash/crostini/crostini_manager.h b/chrome/browser/ash/crostini/crostini_manager.h index 17cb72e..94ad21d 100644 --- a/chrome/browser/ash/crostini/crostini_manager.h +++ b/chrome/browser/ash/crostini/crostini_manager.h
@@ -12,7 +12,6 @@ #include "base/callback_helpers.h" #include "base/files/file_path.h" -#include "base/memory/singleton.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/unguessable_token.h"
diff --git a/chrome/browser/ash/customization/customization_document.cc b/chrome/browser/ash/customization/customization_document.cc index f191cb8..70976a39 100644 --- a/chrome/browser/ash/customization/customization_document.cc +++ b/chrome/browser/ash/customization/customization_document.cc
@@ -734,7 +734,8 @@ std::string app_id; std::unique_ptr<base::DictionaryValue> entry; const base::Value& app_entry_value = apps_list->GetList()[i]; - if (apps_list->GetString(i, &app_id)) { + if (app_entry_value.is_string()) { + app_id = app_entry_value.GetString(); entry = std::make_unique<base::DictionaryValue>(); } else if (app_entry_value.is_dict()) { const base::DictionaryValue& app_entry =
diff --git a/chrome/browser/ash/file_manager/documents_provider_root_manager.cc b/chrome/browser/ash/file_manager/documents_provider_root_manager.cc index 8b38953..59c17ad 100644 --- a/chrome/browser/ash/file_manager/documents_provider_root_manager.cc +++ b/chrome/browser/ash/file_manager/documents_provider_root_manager.cc
@@ -12,12 +12,12 @@ #include <utility> #include "ash/components/arc/arc_features.h" +#include "ash/components/arc/mojom/bitmap.mojom.h" #include "base/base64.h" #include "base/bind.h" #include "base/strings/string_util.h" #include "chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.h" #include "chrome/browser/profiles/profile.h" -#include "components/arc/mojom/bitmap.mojom.h" #include "content/public/browser/browser_thread.h" #include "ui/gfx/codec/png_codec.h" #include "ui/gfx/image/image_skia_operations.h"
diff --git a/chrome/browser/ash/file_system_provider/registry_unittest.cc b/chrome/browser/ash/file_system_provider/registry_unittest.cc index 2c8fba8a..346880e 100644 --- a/chrome/browser/ash/file_system_provider/registry_unittest.cc +++ b/chrome/browser/ash/file_system_provider/registry_unittest.cc
@@ -245,10 +245,11 @@ ASSERT_GT(fake_watcher_.subscribers.size(), persistent_origins->GetList().size()); ASSERT_EQ(1u, persistent_origins->GetList().size()); - std::string persistent_origin; - EXPECT_TRUE(persistent_origins->GetString(0, &persistent_origin)); + const std::string* persistent_origin = + persistent_origins->GetList()[0].GetIfString(); + ASSERT_TRUE(persistent_origin); const auto& fake_subscriber_it = - fake_watcher_.subscribers.find(GURL(persistent_origin)); + fake_watcher_.subscribers.find(GURL(*persistent_origin)); ASSERT_NE(fake_watcher_.subscribers.end(), fake_subscriber_it); EXPECT_TRUE(fake_subscriber_it->second.persistent); }
diff --git a/chrome/browser/ash/input_method/component_extension_ime_manager_delegate_impl.cc b/chrome/browser/ash/input_method/component_extension_ime_manager_delegate_impl.cc index e56985e..5ecedfe1 100644 --- a/chrome/browser/ash/input_method/component_extension_ime_manager_delegate_impl.cc +++ b/chrome/browser/ash/input_method/component_extension_ime_manager_delegate_impl.cc
@@ -286,9 +286,11 @@ if (!dict.GetList(extensions::manifest_keys::kLayouts, &layouts)) return false; - if (layouts->GetList().empty() || !layouts->GetString(0, &out->layout)) { + base::Value::ConstListView layouts_list = layouts->GetList(); + if (!layouts_list.empty() && layouts_list[0].is_string()) + out->layout = layouts_list[0].GetString(); + else out->layout = "us"; - } std::string url_string; #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
diff --git a/chrome/browser/ash/login/screens/consolidated_consent_screen.cc b/chrome/browser/ash/login/screens/consolidated_consent_screen.cc index b095e10d..ba185f25 100644 --- a/chrome/browser/ash/login/screens/consolidated_consent_screen.cc +++ b/chrome/browser/ash/login/screens/consolidated_consent_screen.cc
@@ -92,6 +92,9 @@ if (view_) { view_->Unbind(); } + + for (auto& observer : observer_list_) + observer.OnConsolidatedConsentScreenDestroyed(); } void ConsolidatedConsentScreen::OnViewDestroyed(
diff --git a/chrome/browser/ash/login/screens/consolidated_consent_screen.h b/chrome/browser/ash/login/screens/consolidated_consent_screen.h index c37dd447..e66f85ae 100644 --- a/chrome/browser/ash/login/screens/consolidated_consent_screen.h +++ b/chrome/browser/ash/login/screens/consolidated_consent_screen.h
@@ -42,6 +42,7 @@ public: // Called when the user accepts terms of service. virtual void OnConsolidatedConsentAccept() = 0; + virtual void OnConsolidatedConsentScreenDestroyed() = 0; }; using TView = ConsolidatedConsentScreenView;
diff --git a/chrome/browser/ash/login/test/fake_arc_tos_mixin.cc b/chrome/browser/ash/login/test/fake_arc_tos_mixin.cc new file mode 100644 index 0000000..61f6c2e --- /dev/null +++ b/chrome/browser/ash/login/test/fake_arc_tos_mixin.cc
@@ -0,0 +1,79 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/login/test/fake_arc_tos_mixin.h" + +#include "ash/constants/ash_switches.h" +#include "base/bind.h" +#include "net/test/embedded_test_server/embedded_test_server.h" +#include "net/test/embedded_test_server/http_request.h" +#include "net/test/embedded_test_server/http_response.h" + +namespace ash { +namespace { + +using ::net::test_server::BasicHttpResponse; + +constexpr char kArcTosPath[] = "/about/play-terms.html"; +constexpr char kPrivacyPolicyPath[] = "/policies/privacy/"; + +} // namespace + +FakeArcTosMixin::FakeArcTosMixin(InProcessBrowserTestMixinHost* host, + net::EmbeddedTestServer* test_server) + : InProcessBrowserTestMixin(host), test_server_(test_server) {} + +FakeArcTosMixin::~FakeArcTosMixin() = default; + +void FakeArcTosMixin::SetUp() { + test_server_->RegisterRequestHandler(base::BindRepeating( + &FakeArcTosMixin::HandleRequest, base::Unretained(this))); +} + +void FakeArcTosMixin::SetUpCommandLine(base::CommandLine* command_line) { + command_line->AppendSwitchASCII(switches::kArcTosHostForTests, + TestServerBaseUrl()); +} + +// Returns the base URL of the embedded test server. +// The string will have the format "http://127.0.0.1:${PORT_NUMBER}" where +// PORT_NUMBER is a randomly assigned port number. +std::string FakeArcTosMixin::TestServerBaseUrl() { + return std::string(base::TrimString( + test_server_->base_url().DeprecatedGetOriginAsURL().spec(), "/", + base::TrimPositions::TRIM_TRAILING)); +} + +std::unique_ptr<HttpResponse> FakeArcTosMixin::HandleRequest( + const HttpRequest& request) { + if (request.relative_url != kArcTosPath && + request.relative_url != kPrivacyPolicyPath) { + return nullptr; + } + + std::string content; + if (request.relative_url == kArcTosPath) { + // The terms of service screen determines the URL of the privacy policy + // by scanning the terms of service http response. It looks for an <a> tag + // with with href that matches '/policies/privacy/' that is also a child of + // an element with class 'play-footer'. + std::string href = TestServerBaseUrl() + kPrivacyPolicyPath; + std::string footer = base::StringPrintf( + "<div class='play-footer'><a href='%s'>Privacy Policy</a></div>", + href.c_str()); + + content = kArcTosContent + footer; + } else { + content = kPrivacyPolicyContent; + } + + std::unique_ptr<BasicHttpResponse> http_response = + std::make_unique<BasicHttpResponse>(); + http_response->set_code(net::HTTP_OK); + http_response->set_content_type("text/html"); + http_response->set_content(content); + return std::move(http_response); +} + +} // namespace ash
diff --git a/chrome/browser/ash/login/test/fake_arc_tos_mixin.h b/chrome/browser/ash/login/test/fake_arc_tos_mixin.h new file mode 100644 index 0000000..0813e393 --- /dev/null +++ b/chrome/browser/ash/login/test/fake_arc_tos_mixin.h
@@ -0,0 +1,47 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_LOGIN_TEST_FAKE_ARC_TOS_MIXIN_H_ +#define CHROME_BROWSER_ASH_LOGIN_TEST_FAKE_ARC_TOS_MIXIN_H_ + +#include "chrome/test/base/mixin_based_in_process_browser_test.h" + +namespace net { +namespace test_server { +struct HttpRequest; +class EmbeddedTestServer; +class HttpResponse; +} // namespace test_server +} // namespace net + +namespace ash { + +using ::net::test_server::HttpRequest; +using ::net::test_server::HttpResponse; + +// Mixin that serves fake ARC terms of service for OOBE. +class FakeArcTosMixin : public InProcessBrowserTestMixin { + public: + FakeArcTosMixin(InProcessBrowserTestMixinHost* host, + net::EmbeddedTestServer* test_server); + + void SetUp() override; + void SetUpCommandLine(base::CommandLine* command_line) override; + + ~FakeArcTosMixin() override; + + const std::string& GetArcTosContent() { return kArcTosContent; } + const std::string& GetPrivacyPolicyContent() { return kPrivacyPolicyContent; } + + private: + std::unique_ptr<HttpResponse> HandleRequest(const HttpRequest& request); + std::string TestServerBaseUrl(); + const std::string kArcTosContent = "ARC TOS for test."; + const std::string kPrivacyPolicyContent = "ARC Privacy Policy for test."; + net::EmbeddedTestServer* test_server_; +}; + +} // namespace ash + +#endif // CHROME_BROWSER_ASH_LOGIN_TEST_FAKE_ARC_TOS_MIXIN_H_
diff --git a/chrome/browser/ash/login/ui/login_display_host_mojo.cc b/chrome/browser/ash/login/ui/login_display_host_mojo.cc index 5c551e1..7abc0874 100644 --- a/chrome/browser/ash/login/ui/login_display_host_mojo.cc +++ b/chrome/browser/ash/login/ui/login_display_host_mojo.cc
@@ -92,12 +92,11 @@ const base::ListValue* allowlist = nullptr; if (!cros_settings->GetList(kAccountsPrefUsers, &allowlist) || !allowlist) return false; - for (size_t i = 0; i < allowlist->GetList().size(); ++i) { - std::string allowlisted_user; + for (const base::Value& i : allowlist->GetList()) { + const std::string* allowlisted_user = i.GetIfString(); // NB: Wildcards in the allowlist are also detected as not present here. - if (!allowlist->GetString(i, &allowlisted_user) || - !user_manager->IsKnownUser( - AccountId::FromUserEmail(allowlisted_user))) { + if (!allowlisted_user || !user_manager->IsKnownUser( + AccountId::FromUserEmail(*allowlisted_user))) { return false; } }
diff --git a/chrome/browser/ash/login/ui/login_display_host_webui.cc b/chrome/browser/ash/login/ui/login_display_host_webui.cc index 3424956..5f0b2648 100644 --- a/chrome/browser/ash/login/ui/login_display_host_webui.cc +++ b/chrome/browser/ash/login/ui/login_display_host_webui.cc
@@ -343,12 +343,11 @@ // Currently, only the first element is used. The setting is a list for future // compatibility, if dynamically switching locales on the login screen will be // implemented. - std::string login_screen_locale; if (login_screen_locales->GetList().empty() || - !login_screen_locales->GetString(0, &login_screen_locale)) + !login_screen_locales->GetList()[0].is_string()) return std::string(); - return login_screen_locale; + return login_screen_locales->GetList()[0].GetString(); } // Disables virtual keyboard overscroll. Login UI will scroll user pods
diff --git a/chrome/browser/breadcrumbs/breadcrumb_manager_tab_helper.cc b/chrome/browser/breadcrumbs/breadcrumb_manager_tab_helper.cc index c966798..1a8808c4 100644 --- a/chrome/browser/breadcrumbs/breadcrumb_manager_tab_helper.cc +++ b/chrome/browser/breadcrumbs/breadcrumb_manager_tab_helper.cc
@@ -79,6 +79,10 @@ const auto visible_security_state = security_state::GetVisibleSecurityState(&GetWebContents()); DCHECK(visible_security_state); + + // Note that mixed content is auto-upgraded to HTTPS in almost all cases on + // desktop (the user has to specifically allow it on a per-site basis in + // settings), so this is unlikely. const bool displayed_mixed_content = visible_security_state->displayed_mixed_content;
diff --git a/chrome/browser/breadcrumbs/breadcrumb_manager_tab_helper_desktop_browsertest.cc b/chrome/browser/breadcrumbs/breadcrumb_manager_tab_helper_desktop_browsertest.cc index 5cf91116..d229e28 100644 --- a/chrome/browser/breadcrumbs/breadcrumb_manager_tab_helper_desktop_browsertest.cc +++ b/chrome/browser/breadcrumbs/breadcrumb_manager_tab_helper_desktop_browsertest.cc
@@ -17,7 +17,6 @@ #include "content/public/test/browser_test.h" #include "content/public/test/download_test_observer.h" #include "net/test/embedded_test_server/embedded_test_server.h" -#include "third_party/blink/public/common/features.h" namespace { @@ -83,8 +82,6 @@ : public CertVerifierBrowserTest { public: BreadcrumbManagerTabHelperSecurityStateBrowserTest() { - feature_list_.InitAndDisableFeature( - blink::features::kMixedContentAutoupgrade); https_server_.ServeFilesFromSourceDirectory(GetChromeTestDataDir()); } @@ -114,48 +111,9 @@ } raw_ptr<breadcrumbs::BreadcrumbManagerKeyedService> breadcrumb_service_; - base::test::ScopedFeatureList feature_list_; net::EmbeddedTestServer https_server_{net::EmbeddedTestServer::TYPE_HTTPS}; }; -// Mixed content. -IN_PROC_BROWSER_TEST_F(BreadcrumbManagerTabHelperSecurityStateBrowserTest, - MixedContent) { - ASSERT_EQ(0ul, - breadcrumb_service_->GetEvents(/*event_count_limit=*/0).size()); - SetUpMockCertVerifierForHttpsServer(0, net::OK); - - // Normal HTTPS navigation; no change in security state should be logged. - ASSERT_TRUE(ui_test_utils::NavigateToURL( - browser(), https_server_.GetURL("/title1.html"))); - auto events = breadcrumb_service_->GetEvents(/*event_count_limit=*/0); - EXPECT_EQ(std::string::npos, - events.back().find( - breadcrumbs::kBreadcrumbDidChangeVisibleSecurityState)); - - // Append insecure content to the HTTPS navigation. - content::WebContents* web_contents = - browser()->tab_strip_model()->GetActiveWebContents(); - SecurityStyleTestObserver observer(web_contents); - ASSERT_TRUE(content::ExecuteScript(web_contents, - "var i = document.createElement('img');" - "i.src = 'http://example.test';" - "document.body.appendChild(i);")); - observer.WaitForDidChangeVisibleSecurityState(); - - // The breadcrumb event for mixed content should have been logged. - events = breadcrumb_service_->GetEvents(/*event_count_limit=*/0); - EXPECT_NE(std::string::npos, - events.back().find( - breadcrumbs::kBreadcrumbDidChangeVisibleSecurityState)); - EXPECT_NE(std::string::npos, - events.back().find(breadcrumbs::kBreadcrumbMixedContent)) - << events.back(); - EXPECT_EQ(std::string::npos, - events.back().find(breadcrumbs::kBreadcrumbAuthenticationBroken)) - << events.back(); -} - // Broken authentication. IN_PROC_BROWSER_TEST_F(BreadcrumbManagerTabHelperSecurityStateBrowserTest, BrokenAuthentication) {
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 9a202f2..7ea080bb 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -83,6 +83,7 @@ "//ash/components/arc/enterprise", "//ash/components/arc/input_overlay/resources:resources_grit", "//ash/components/arc/media_session", + "//ash/components/arc/mojom:mojom_traits", "//ash/components/attestation", "//ash/components/audio", "//ash/components/device_activity", @@ -328,7 +329,6 @@ "//chromeos/utils", "//components/app_restore", "//components/arc", - "//components/arc/mojom:mojom_traits", "//components/autofill/core/browser", "//components/browser_sync", "//components/captive_portal/core", @@ -851,6 +851,8 @@ "../ash/arc/input_overlay/arc_input_overlay_manager.h", "../ash/arc/input_overlay/input_overlay_resources_util.cc", "../ash/arc/input_overlay/input_overlay_resources_util.h", + "../ash/arc/input_overlay/key_event_source_rewriter.cc", + "../ash/arc/input_overlay/key_event_source_rewriter.h", "../ash/arc/input_overlay/touch_id_manager.cc", "../ash/arc/input_overlay/touch_id_manager.h", "../ash/arc/input_overlay/touch_injector.cc", @@ -3905,6 +3907,8 @@ "../ash/arc/input_overlay/actions/position_unittest.cc", "../ash/arc/input_overlay/arc_input_overlay_manager_unittest.cc", "../ash/arc/input_overlay/input_overlay_resources_util_unittest.cc", + "../ash/arc/input_overlay/test/event_capturer.cc", + "../ash/arc/input_overlay/test/event_capturer.h", "../ash/arc/input_overlay/touch_id_manager_unittest.cc", "../ash/arc/input_overlay/touch_injector_unittest.cc", "../ash/arc/instance_throttle/arc_active_window_throttle_observer_unittest.cc",
diff --git a/chrome/browser/chromeos/DEPS b/chrome/browser/chromeos/DEPS index b1efdd6f..085e7bd 100644 --- a/chrome/browser/chromeos/DEPS +++ b/chrome/browser/chromeos/DEPS
@@ -35,9 +35,6 @@ ".*fuzz.*": [ "+third_party/libFuzzer/src/utils", # This contains FuzzedDataProvider. ], - "assistant_util_unittest\.cc": [ - "+ui/events/devices/device_data_manager.h", - ], "child_status_collector_browsertest.cc": [ "+mojo/core/embedder/embedder.h", ],
diff --git a/chrome/browser/chromeos/extensions/default_app_order.cc b/chrome/browser/chromeos/extensions/default_app_order.cc index e41e29f1..ae634cd 100644 --- a/chrome/browser/chromeos/extensions/default_app_order.cc +++ b/chrome/browser/chromeos/extensions/default_app_order.cc
@@ -233,12 +233,12 @@ ReadExternalOrdinalFile(ordinals_file); if (ordinals_value) { std::string locale = g_browser_process->GetApplicationLocale(); - for (size_t i = 0; i < ordinals_value->GetList().size(); ++i) { - std::string app_id; - base::DictionaryValue* dict = NULL; - if (ordinals_value->GetString(i, &app_id)) { + for (const base::Value& i : ordinals_value->GetList()) { + const base::DictionaryValue* dict = nullptr; + if (i.is_string()) { + std::string app_id = i.GetString(); app_ids_.push_back(app_id); - } else if (ordinals_value->GetDictionary(i, &dict)) { + } else if (i.GetAsDictionary(&dict)) { bool flag = false; if (dict->GetBoolean(kOemAppsFolderAttr, &flag) && flag) { oem_apps_folder_name_ = GetLocaleSpecificStringImpl(
diff --git a/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller.cc b/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller.cc index 48dfdde..5698619 100644 --- a/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller.cc +++ b/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller.cc
@@ -50,7 +50,7 @@ if (!data_dst || !data_dst->IsUrlType()) return false; - GURL url = data_dst->origin()->GetURL(); + GURL url = data_dst->GetOrigin()->GetURL(); return url.has_scheme() && url.SchemeIs(extensions::kExtensionScheme) && url.has_host() && url.host() == extension_misc::kFilesManagerAppId; } @@ -91,7 +91,7 @@ return DlpRulesManager::Level::kAllow; } - const GURL src_url = data_src->origin()->GetURL(); + const GURL src_url = data_src->GetOrigin()->GetURL(); ui::EndpointType dst_type = data_dst ? data_dst->type() : ui::EndpointType::kDefault; @@ -133,7 +133,7 @@ } case ui::EndpointType::kUrl: { - GURL dst_url = data_dst->origin()->GetURL(); + GURL dst_url = data_dst->GetOrigin()->GetURL(); level = dlp_rules_manager.IsRestrictedDestination( src_url, dst_url, DlpRulesManager::Restriction::kClipboard, src_pattern, dst_pattern);
diff --git a/chrome/browser/chromeos/policy/dlp/dlp_clipboard_notifier.cc b/chrome/browser/chromeos/policy/dlp/dlp_clipboard_notifier.cc index 03f6ad2..bac55df15 100644 --- a/chrome/browser/chromeos/policy/dlp/dlp_clipboard_notifier.cc +++ b/chrome/browser/chromeos/policy/dlp/dlp_clipboard_notifier.cc
@@ -112,9 +112,9 @@ const ui::DataTransferEndpoint* const data_src, const ui::DataTransferEndpoint* const data_dst) { DCHECK(data_src); - DCHECK(data_src->origin()); + DCHECK(data_src->GetOrigin()); const std::u16string host_name = - base::UTF8ToUTF16(data_src->origin()->host()); + base::UTF8ToUTF16(data_src->GetOrigin()->host()); #if BUILDFLAG(IS_CHROMEOS_ASH) if (data_dst) { if (data_dst->type() == ui::EndpointType::kCrostini) { @@ -149,12 +149,12 @@ const ui::DataTransferEndpoint* const data_src, const ui::DataTransferEndpoint* const data_dst) { DCHECK(data_src); - DCHECK(data_src->origin()); + DCHECK(data_src->GetOrigin()); CloseWidget(widget_.get(), views::Widget::ClosedReason::kUnspecified); const std::u16string host_name = - base::UTF8ToUTF16(data_src->origin()->host()); + base::UTF8ToUTF16(data_src->GetOrigin()->host()); #if BUILDFLAG(IS_CHROMEOS_ASH) if (data_dst) { if (data_dst->type() == ui::EndpointType::kCrostini) { @@ -199,12 +199,12 @@ content::WebContents* web_contents, base::OnceCallback<void(bool)> paste_cb) { DCHECK(data_src); - DCHECK(data_src->origin()); + DCHECK(data_src->GetOrigin()); CloseWidget(widget_.get(), views::Widget::ClosedReason::kUnspecified); const std::u16string host_name = - base::UTF8ToUTF16(data_src->origin()->host()); + base::UTF8ToUTF16(data_src->GetOrigin()->host()); blink_paste_cb_ = std::move(paste_cb); Observe(web_contents);
diff --git a/chrome/browser/chromeos/policy/dlp/dlp_drag_drop_notifier.cc b/chrome/browser/chromeos/policy/dlp/dlp_drag_drop_notifier.cc index e2d5a71..c7e638e 100644 --- a/chrome/browser/chromeos/policy/dlp/dlp_drag_drop_notifier.cc +++ b/chrome/browser/chromeos/policy/dlp/dlp_drag_drop_notifier.cc
@@ -24,9 +24,9 @@ const ui::DataTransferEndpoint* const data_src, const ui::DataTransferEndpoint* const data_dst) { DCHECK(data_src); - DCHECK(data_src->origin()); + DCHECK(data_src->GetOrigin()); const std::u16string host_name = - base::UTF8ToUTF16(data_src->origin()->host()); + base::UTF8ToUTF16(data_src->GetOrigin()->host()); ShowBlockBubble(l10n_util::GetStringFUTF16( IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_PASTE, host_name)); @@ -37,12 +37,12 @@ const ui::DataTransferEndpoint* const data_dst, base::OnceClosure drop_cb) { DCHECK(data_src); - DCHECK(data_src->origin()); + DCHECK(data_src->GetOrigin()); CloseWidget(widget_.get(), views::Widget::ClosedReason::kUnspecified); const std::u16string host_name = - base::UTF8ToUTF16(data_src->origin()->host()); + base::UTF8ToUTF16(data_src->GetOrigin()->host()); drop_cb_ = std::move(drop_cb); auto proceed_cb = base::BindRepeating(&DlpDragDropNotifier::ProceedPressed,
diff --git a/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsDialog.java b/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsDialog.java index 0b0cd0d..8cb700dd 100644 --- a/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsDialog.java +++ b/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsDialog.java
@@ -53,7 +53,8 @@ mContentView = getActivity().getLayoutInflater().inflate(R.layout.reactions_dialog, null); setBackgroundImage(); mSceneCoordinator.setSceneBackground( - mContentView.findViewById(R.id.lightweight_reactions_scene)); + mContentView.findViewById(R.id.lightweight_reactions_scene), + mContentView.findViewById(R.id.lightweight_reactions_background)); builder.setView(mContentView); if (mDialogObserver != null) {
diff --git a/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsMediator.java b/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsMediator.java index 0710421..983ab24 100644 --- a/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsMediator.java +++ b/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsMediator.java
@@ -7,6 +7,7 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.net.Uri; +import android.util.Size; import org.chromium.base.Callback; import org.chromium.base.StreamUtil; @@ -151,22 +152,34 @@ encoder.setQuality(GIF_QUALITY); encoder.setRepeat(GIF_REPEAT); encoder.start(fos); + // The encoder will keep invoking the host's prepareFrame() and drawFrame() until this // many frames have been generated. int frameCount = sceneCoordinator.getFrameCount(); assert frameCount != 0; mFramesGenerated = 0; - // For performance reasons, the scene might need to be scaled down in the final - // GIF. Determine the scale factor based on the largest scene dimension. - int width = sceneCoordinator.getWidth(); - int height = sceneCoordinator.getHeight(); - int largestDimension = Math.max(width, height); + // For performance reasons, the result might need to be scaled down for devices with + // very large display sizes. Determine the scale factor based on the largest dimension + // of the background screenshot and the maximum output dimension. + Size screenshotSize = sceneCoordinator.getScreenshotDisplaySize(); + int screenshotWidth = screenshotSize.getWidth(); + int screenshotHeight = screenshotSize.getHeight(); + int largestDimension = Math.max(screenshotWidth, screenshotHeight); float scaleFactor = largestDimension <= GIF_MAX_DIMENSION_PX ? 1f : (float) GIF_MAX_DIMENSION_PX / largestDimension; - int scaledWidth = (int) (width * scaleFactor); - int scaledHeight = (int) (height * scaleFactor); + int scaledScreenshotWidth = (int) (screenshotWidth * scaleFactor); + int scaledScreenshotHeight = (int) (screenshotHeight * scaleFactor); + + // The raw frames need to be cropped on the sides to account for the grey background + // bars. Calculate the X offset at which to start the crop. Also remember the scene + // dimensions for drawing the raw frames. + int sceneWidth = sceneCoordinator.getSceneWidth(); + int sceneHeight = sceneCoordinator.getSceneHeight(); + int scaledSceneWidth = (int) (sceneWidth * scaleFactor); + int scaledSceneHeight = (int) (sceneHeight * scaleFactor); + int cropOffsetX = (scaledSceneWidth - scaledScreenshotWidth) / 2; Callback<Void> prepareFrameCallback = new Callback<Void>() { @Override @@ -180,14 +193,17 @@ StreamUtil.closeQuietly(fos); return; } + // The next frame is ready to be drawn and encoded. Use ARGB_8888 config for the // bitmap, which is a standard configuration that allows transparency. - Bitmap frame = - Bitmap.createBitmap(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888); - Canvas canvas = new Canvas(frame); + Bitmap rawFrame = Bitmap.createBitmap( + scaledSceneWidth, scaledSceneHeight, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(rawFrame); canvas.scale(scaleFactor, scaleFactor); host.drawFrame(canvas); - encoder.addFrame(frame); + Bitmap croppedFrame = Bitmap.createBitmap(rawFrame, cropOffsetX, 0, + scaledScreenshotWidth, scaledScreenshotHeight); + encoder.addFrame(croppedFrame); ++mFramesGenerated; progressDialog.setProgress((int) (100.0 * mFramesGenerated / frameCount));
diff --git a/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/scene/SceneCoordinator.java b/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/scene/SceneCoordinator.java index 3ac163c..51b26f7 100644 --- a/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/scene/SceneCoordinator.java +++ b/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/scene/SceneCoordinator.java
@@ -8,6 +8,9 @@ import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Canvas; +import android.graphics.Matrix; +import android.util.Size; +import android.widget.ImageView; import android.widget.RelativeLayout; import org.chromium.base.Callback; @@ -41,6 +44,7 @@ private ReactionLayout mActiveReaction; private RelativeLayout mSceneBackground; + private ImageView mScreenshotView; private int mNbReactionsAdded; private int mNbTypeChange; @@ -67,9 +71,10 @@ mNbMove = 0; } - public void setSceneBackground(RelativeLayout sceneBackground) { + public void setSceneBackground(RelativeLayout sceneBackground, ImageView screenshotView) { mSceneBackground = sceneBackground; mSceneBackground.setOnClickListener((view) -> { clearSelection(); }); + mScreenshotView = screenshotView; } public void addReactionInDefaultLocation(ReactionMetadata reaction) { @@ -149,20 +154,35 @@ } /** - * Gets the width of the current scene, in pixels. + * Gets the width of the scene view, in pixels. */ - public int getWidth() { + public int getSceneWidth() { return mSceneBackground.getWidth(); } /** - * Gets the height of the current scene, in pixels. + * Gets the height of the scene view, in pixels. */ - public int getHeight() { + public int getSceneHeight() { return mSceneBackground.getHeight(); } /** + * Gets the actual display dimensions of the screenshot image, in pixels. + */ + public Size getScreenshotDisplaySize() { + float[] imageMatrix = new float[9]; + mScreenshotView.getImageMatrix().getValues(imageMatrix); + int intrinsicWidth = mScreenshotView.getDrawable().getIntrinsicWidth(); + int intrinsicHeight = mScreenshotView.getDrawable().getIntrinsicHeight(); + float scaleX = imageMatrix[Matrix.MSCALE_X]; + float scaleY = imageMatrix[Matrix.MSCALE_Y]; + int actualWidth = Math.round(intrinsicWidth * scaleX); + int actualHeight = Math.round(intrinsicHeight * scaleY); + return new Size(actualWidth, actualHeight); + } + + /** * Draws the scene view to the provided canvas. */ public void drawScene(Canvas canvas) {
diff --git a/chrome/browser/devtools/device/devtools_android_bridge_browsertest.cc b/chrome/browser/devtools/device/devtools_android_bridge_browsertest.cc index 156883894..ec59705f 100644 --- a/chrome/browser/devtools/device/devtools_android_bridge_browsertest.cc +++ b/chrome/browser/devtools/device/devtools_android_bridge_browsertest.cc
@@ -108,9 +108,10 @@ EXPECT_EQ(2ul, targets->GetList().size()); std::set<std::string> actual; - for (size_t i = 0; i < targets->GetList().size(); i++) { + for (const base::Value& item : targets->GetList()) { std::string value; - targets->GetString(i, &value); + if (item.is_string()) + value = item.GetString(); actual.insert(value); } EXPECT_STREQ("localhost:9222, localhost:9229", SetToString(actual).c_str());
diff --git a/chrome/browser/download/android/mock_download_controller.h b/chrome/browser/download/android/mock_download_controller.h index 1b56516..9a62747 100644 --- a/chrome/browser/download/android/mock_download_controller.h +++ b/chrome/browser/download/android/mock_download_controller.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_DOWNLOAD_ANDROID_MOCK_DOWNLOAD_CONTROLLER_H_ #include "base/callback.h" -#include "base/memory/singleton.h" #include "chrome/browser/download/android/download_controller_base.h" namespace chrome {
diff --git a/chrome/browser/download/internal/android/DEPS b/chrome/browser/download/internal/android/DEPS index d8bcf0f..e18091b3 100644 --- a/chrome/browser/download/internal/android/DEPS +++ b/chrome/browser/download/internal/android/DEPS
@@ -25,6 +25,5 @@ "+third_party/hamcrest", "+third_party/junit", "+third_party/mockito", - "+ui/android", ]
diff --git a/chrome/browser/extensions/DEPS b/chrome/browser/extensions/DEPS index 3406b3a..89d7433 100644 --- a/chrome/browser/extensions/DEPS +++ b/chrome/browser/extensions/DEPS
@@ -3,7 +3,6 @@ "+components/live_caption", "+extensions/strings/grit/extensions_strings.h", "+services/network/public", - "+ui/base", # For access to testing command line switches. "+ppapi/shared_impl",
diff --git a/chrome/browser/extensions/extension_security_exploit_browsertest.cc b/chrome/browser/extensions/extension_security_exploit_browsertest.cc index 10d0f8f..ce2bc30 100644 --- a/chrome/browser/extensions/extension_security_exploit_browsertest.cc +++ b/chrome/browser/extensions/extension_security_exploit_browsertest.cc
@@ -355,10 +355,15 @@ // Inject the malformed/mutated IPC and verify that the renderer is terminated // as expected. - // - // TODO(https://crbug.com/1212918: Once the bug is fixed, re-enable the test - // assertion that verifies that `kill_waiter.Wait()` returns - // EMF_INVALID_EXTENSION_ID_FOR_CONTENT_SCRIPT. + content::RenderProcessHost* main_frame_process = + web_contents->GetMainFrame()->GetProcess(); + RenderProcessHostBadIpcMessageWaiter kill_waiter(main_frame_process); + IPC::IpcSecurityTestUtil::PwnMessageReceived( + main_frame_process->GetChannel(), + ExtensionHostMsg_OpenChannelToExtension(source_context, info, + channel_name, port_id)); + EXPECT_EQ(bad_message::EMF_INVALID_EXTENSION_ID_FOR_CONTENT_SCRIPT, + kill_waiter.Wait()); } IN_PROC_BROWSER_TEST_F(OpenChannelToExtensionExploitTest,
diff --git a/chrome/browser/feed/android/BUILD.gn b/chrome/browser/feed/android/BUILD.gn index 402048e..e07d2ad 100644 --- a/chrome/browser/feed/android/BUILD.gn +++ b/chrome/browser/feed/android/BUILD.gn
@@ -6,7 +6,6 @@ import("//build/config/android/rules.gni") import("//chrome/android/features/android_library_factory_tmpl.gni") import("//chrome/browser/buildflags.gni") -import("//chrome/browser/feed/buildflags.gni") android_library("java") { sources = [
diff --git a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedServiceBridge.java b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedServiceBridge.java index ae435bc..18d0c21 100644 --- a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedServiceBridge.java +++ b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedServiceBridge.java
@@ -14,11 +14,15 @@ import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.NativeClassQualifiedName; import org.chromium.base.annotations.NativeMethods; +import org.chromium.chrome.browser.feed.hooks.FeedHooks; +import org.chromium.chrome.browser.feed.hooks.FeedHooksImpl; import org.chromium.chrome.browser.feed.v2.ContentOrder; import org.chromium.chrome.browser.feed.v2.FeedUserActionType; import org.chromium.chrome.browser.xsurface.ImageCacheHelper; import org.chromium.chrome.browser.xsurface.ProcessScope; +import org.chromium.chrome.browser.xsurface.ProcessScopeDependencyProvider; +import java.lang.reflect.InvocationTargetException; import java.util.Locale; /** @@ -33,27 +37,45 @@ return FeedServiceBridgeJni.TEST_HOOKS; } - /** - * Interface to chrome_java. Eventually, we will move some of these pieces into the Feed module - * to eliminate the need for an interface here. - */ - public static interface Delegate { - default ProcessScope getProcessScope() { - return null; - } - /** Called when state of the feed must be cleared. */ - default void clearAll() {} - } - - private static Delegate sDelegate = new Delegate() {}; - public static void setDelegate(Delegate delegate) { - sDelegate = delegate; - } + private static ProcessScope sXSurfaceProcessScope; public static ProcessScope xSurfaceProcessScope() { - ProcessScope ps = sDelegate.getProcessScope(); - return ps; + if (sXSurfaceProcessScope != null) { + return sXSurfaceProcessScope; + } + FeedHooks feedHooks = FeedHooksImpl.getInstance(); + if (!feedHooks.isEnabled()) { + return null; + } + Class<?> dependencyProviderFactoryClazz; + try { + dependencyProviderFactoryClazz = Class.forName( + "org.chromium.chrome.browser.app.feed.ProcessScopeDependencyProviderFactory"); + } catch (ClassNotFoundException e) { + return null; + } + + ProcessScopeDependencyProvider dependencyProvider = null; + try { + dependencyProvider = (ProcessScopeDependencyProvider) dependencyProviderFactoryClazz + .getDeclaredMethod("create") + .invoke(null); + } catch (NoSuchMethodException e) { + } catch (InvocationTargetException e) { + } catch (IllegalAccessException e) { + } + if (dependencyProvider == null) { + return null; + } + + sXSurfaceProcessScope = feedHooks.createProcessScope(dependencyProvider); + return sXSurfaceProcessScope; } + + public static void setProcessScopeForTesting(ProcessScope processScope) { + sXSurfaceProcessScope = processScope; + } + public static boolean isEnabled() { return FeedServiceBridgeJni.get().isEnabled(); } @@ -81,7 +103,7 @@ @CalledByNative public static void clearAll() { - sDelegate.clearAll(); + FeedSurfaceTracker.getInstance().clearAll(); } @CalledByNative
diff --git a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedStream.java b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedStream.java index 276ed862..4be81f7 100644 --- a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedStream.java +++ b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedStream.java
@@ -488,26 +488,30 @@ mScrollReporter.trackScroll(dx, dy); } }; + // Only watch for unread content on the web feed, not for-you feed. // Sort options only available for web feed right now. - if (!isInterestFeed && ChromeFeatureList.isEnabled(ChromeFeatureList.WEB_FEED_SORT)) { + if (!isInterestFeed) { mUnreadContentObserver = new UnreadContentObserver(/*isWebFeed=*/true); - @ContentOrder - int currentSort = FeedServiceBridge.getContentOrderForWebFeed(); + if (ChromeFeatureList.isEnabled(ChromeFeatureList.WEB_FEED_SORT)) { + @ContentOrder + int currentSort = FeedServiceBridge.getContentOrderForWebFeed(); - mSortView = LayoutInflater.from(activity).inflate(R.layout.feed_options_panel, null); - SortView chipView = mSortView.findViewById(R.id.button_bar); - ListModel<PropertyModel> sortModel = new ListModel<>(); - ListModelChangeProcessor<ListModel<PropertyModel>, SortView, Void> processor = - new ListModelChangeProcessor<>(sortModel, chipView, new SortViewBinder()); - sortModel.addObserver(processor); + mSortView = + LayoutInflater.from(activity).inflate(R.layout.feed_options_panel, null); + SortView chipView = mSortView.findViewById(R.id.button_bar); + ListModel<PropertyModel> sortModel = new ListModel<>(); + ListModelChangeProcessor<ListModel<PropertyModel>, SortView, Void> processor = + new ListModelChangeProcessor<>(sortModel, chipView, new SortViewBinder()); + sortModel.addObserver(processor); - sortModel.add( - createSortModel(ContentOrder.REVERSE_CHRON, R.string.latest, currentSort)); + sortModel.add( + createSortModel(ContentOrder.REVERSE_CHRON, R.string.latest, currentSort)); - sortModel.add(createSortModel( - ContentOrder.GROUPED, R.string.feed_sort_publisher, currentSort)); + sortModel.add(createSortModel( + ContentOrder.GROUPED, R.string.feed_sort_publisher, currentSort)); + } } } @@ -1041,6 +1045,11 @@ return mMainScrollListener; } + @VisibleForTesting + UnreadContentObserver getUnreadContentObserverForTest() { + return mUnreadContentObserver; + } + // Scroll state can't be restored until enough items are added to the recycler view adapter. // Attempts to restore scroll state every time new items are added to the adapter. class RestoreScrollObserver extends RecyclerView.AdapterDataObserver { @@ -1100,7 +1109,8 @@ } } - private class UnreadContentObserver extends FeedServiceBridge.UnreadContentObserver { + @VisibleForTesting + class UnreadContentObserver extends FeedServiceBridge.UnreadContentObserver { ObservableSupplierImpl<Boolean> mHasUnreadContent = new ObservableSupplierImpl<>(); UnreadContentObserver(boolean isWebFeed) {
diff --git a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedStreamTest.java b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedStreamTest.java index 5f08661..f1a2d56 100644 --- a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedStreamTest.java +++ b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedStreamTest.java
@@ -10,6 +10,8 @@ import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.instanceOf; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; @@ -685,6 +687,47 @@ not(hasDescendant(instanceOf(FeedPlaceholderLayout.class)))); } + @Test + @SmallTest + public void testUnreadContentObserver_nullInterestFeed() { + FeedStream stream = new FeedStream(mActivity, mSnackbarManager, mBottomSheetController, + /* isPlaceholderShown= */ false, mWindowAndroid, mShareDelegateSupplier, + /* isInterestFeed= */ true, + /* FeedAutoplaySettingsDelegate= */ null, mActionDelegate, + /*helpAndFeedbackLauncher=*/null); + assertNull(stream.getUnreadContentObserverForTest()); + } + + @Test + @SmallTest + public void testUnreadContentObserver_notNullWebFeed_sortOff() { + Map<String, Boolean> features = new HashMap<>(); + features.put(ChromeFeatureList.WEB_FEED_SORT, false); + FeatureList.setTestFeatures(features); + FeedStream stream = new FeedStream(mActivity, mSnackbarManager, mBottomSheetController, + /* isPlaceholderShown= */ false, mWindowAndroid, mShareDelegateSupplier, + /* isInterestFeed= */ false, + /* FeedAutoplaySettingsDelegate= */ null, mActionDelegate, + /*helpAndFeedbackLauncher=*/null); + assertNotNull(stream.getUnreadContentObserverForTest()); + FeatureList.setTestFeatures(null); + } + + @Test + @SmallTest + public void testUnreadContentObserver_notNullWebFeed_sortOn() { + Map<String, Boolean> features = new HashMap<>(); + features.put(ChromeFeatureList.WEB_FEED_SORT, true); + FeatureList.setTestFeatures(features); + FeedStream stream = new FeedStream(mActivity, mSnackbarManager, mBottomSheetController, + /* isPlaceholderShown= */ false, mWindowAndroid, mShareDelegateSupplier, + /* isInterestFeed= */ false, + /* FeedAutoplaySettingsDelegate= */ null, mActionDelegate, + /*helpAndFeedbackLauncher=*/null); + assertNotNull(stream.getUnreadContentObserverForTest()); + FeatureList.setTestFeatures(null); + } + private int getLoadMoreTriggerScrollDistance() { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, LOAD_MORE_TRIGGER_SCROLL_DISTANCE_DP,
diff --git a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedSurfaceTracker.java b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedSurfaceTracker.java index 02aa62296..06bd485 100644 --- a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedSurfaceTracker.java +++ b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedSurfaceTracker.java
@@ -30,19 +30,8 @@ // the correct sign-in state is used if attaching the surface triggers a fetch. private boolean mStartupCalled; - private boolean mSetServiceBridgeDelegate; private ObserverList<Observer> mObservers = new ObserverList<>(); - /** - * Initializes the FeedServiceBridge. We do this once at startup, either in startup(), or - * in FeedStreamSurface's constructor, whichever comes first. - */ - void initServiceBridge(FeedServiceBridge.Delegate delegate) { - if (mSetServiceBridgeDelegate) return; - mSetServiceBridgeDelegate = true; - FeedServiceBridge.setDelegate(delegate); - } - // Tracks all the instances of FeedSurfaceCoordinator. @VisibleForTesting HashSet<SurfaceCoordinator> mCoordinators; @@ -136,6 +125,5 @@ @VisibleForTesting public void resetForTest() { mStartupCalled = false; - mSetServiceBridgeDelegate = false; } }
diff --git a/chrome/browser/feed/buildflags.gni b/chrome/browser/feed/buildflags.gni index 58fef0c..5bdf6429 100644 --- a/chrome/browser/feed/buildflags.gni +++ b/chrome/browser/feed/buildflags.gni
@@ -1,5 +1,2 @@ declare_args() { - # Migration away from AppHooks, will be turned on by default when the - # we no longer need AppHooks. - enable_new_feed_hooks = true }
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 0cfdd26..7ca0e1d8 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -4218,7 +4218,7 @@ { "name": "omnibox-tab-switch-suggestions", "owners": [ "gangwu", "chrome-omnibox-team@google.com" ], - "expiry_milestone": 97 + "expiry_milestone": 104 }, { "name": "omnibox-trending-zero-prefix-suggestions-on-ntp",
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc index 5b95fa3..e4227d8 100644 --- a/chrome/browser/lifetime/application_lifetime.cc +++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -116,11 +116,12 @@ // If a policy mandates the login screen locale, use it. ash::CrosSettings* cros_settings = ash::CrosSettings::Get(); const base::ListValue* login_screen_locales = nullptr; - std::string login_screen_locale; if (cros_settings->GetList(ash::kDeviceLoginScreenLocales, &login_screen_locales) && !login_screen_locales->GetList().empty() && - login_screen_locales->GetString(0, &login_screen_locale)) { + login_screen_locales->GetList()[0].is_string()) { + std::string login_screen_locale = + login_screen_locales->GetList()[0].GetString(); local_state->SetString(language::prefs::kApplicationLocale, login_screen_locale); return true;
diff --git a/chrome/browser/metrics/perf/perf_events_collector.cc b/chrome/browser/metrics/perf/perf_events_collector.cc index 7468e67..54927ba 100644 --- a/chrome/browser/metrics/perf/perf_events_collector.cc +++ b/chrome/browser/metrics/perf/perf_events_collector.cc
@@ -289,8 +289,9 @@ } void CollectProcessTypes(SampledProfile* sampled_profile) { + std::vector<uint32_t> lacros_pids; std::map<uint32_t, Process> process_types = - ProcessTypeCollector::ChromeProcessTypes(); + ProcessTypeCollector::ChromeProcessTypes(lacros_pids); std::map<uint32_t, Thread> thread_types = ProcessTypeCollector::ChromeThreadTypes(); if (!process_types.empty() && !thread_types.empty()) { @@ -299,6 +300,10 @@ sampled_profile->mutable_thread_types()->insert(thread_types.begin(), thread_types.end()); } + if (!lacros_pids.empty()) { + sampled_profile->mutable_lacros_pids()->Add(lacros_pids.begin(), + lacros_pids.end()); + } } } // namespace
diff --git a/chrome/browser/metrics/perf/process_type_collector.cc b/chrome/browser/metrics/perf/process_type_collector.cc index fb9d0af4..ea39482 100644 --- a/chrome/browser/metrics/perf/process_type_collector.cc +++ b/chrome/browser/metrics/perf/process_type_collector.cc
@@ -26,13 +26,18 @@ // Matches both Ash-Chrome and Lacros binaries. const LazyRE2 kChromeExePathMatcher = { - R"(/(opt/google/chrome|)" - R"(run/lacros|)" - R"(run/imageloader/lacros\S*/[\d.]*)/chrome\s*)"}; + R"(((/opt/google/chrome/chrome|)" + R"(/run/lacros/chrome|)" + R"(/run/imageloader/lacros\S*/[\d.]*/chrome)\s*))"}; +// Matches Lacros binaries. +const LazyRE2 kLacrosExePathMatcher = { + R"(/run/lacros/chrome|)" + R"(/run/imageloader/lacros\S*/[\d.]*/chrome)"}; } // namespace -std::map<uint32_t, Process> ProcessTypeCollector::ChromeProcessTypes() { +std::map<uint32_t, Process> ProcessTypeCollector::ChromeProcessTypes( + std::vector<uint32_t>& lacros_pids) { std::string output; if (!base::GetAppOutput(std::vector<std::string>({"ps", "-ewwo", "pid,cmd"}), &output)) { @@ -41,7 +46,7 @@ return std::map<uint32_t, Process>(); } - return ParseProcessTypes(output); + return ParseProcessTypes(output, lacros_pids); } std::map<uint32_t, Thread> ProcessTypeCollector::ChromeThreadTypes() { @@ -58,7 +63,8 @@ } std::map<uint32_t, Process> ProcessTypeCollector::ParseProcessTypes( - re2::StringPiece contents) { + re2::StringPiece contents, + std::vector<uint32_t>& lacros_pids) { static const LazyRE2 kLineMatcher = { R"(\s*(\d+))" // PID R"(\s+(.+)\n?)" // COMMAND LINE @@ -89,10 +95,16 @@ continue; } - if (!RE2::Consume(&cmd_line, *kChromeExePathMatcher)) { + re2::StringPiece cmd; + if (!RE2::Consume(&cmd_line, *kChromeExePathMatcher, &cmd)) { continue; } + // Use a second match to record any Lacros PID. + if (RE2::Consume(&cmd, *kLacrosExePathMatcher)) { + lacros_pids.emplace_back(pid); + } + std::string type; RE2::Consume(&cmd_line, *kTypeFlagMatcher, &type);
diff --git a/chrome/browser/metrics/perf/process_type_collector.h b/chrome/browser/metrics/perf/process_type_collector.h index ac39ea5..1524b4c 100644 --- a/chrome/browser/metrics/perf/process_type_collector.h +++ b/chrome/browser/metrics/perf/process_type_collector.h
@@ -20,8 +20,10 @@ // that disallows blocking, should post a task with MayBlock() task trait to // execute these methods or make sure to call these methods asynchronously. // Collects process types by running ps command and returns a map of Chrome - // PIDs to their process types. - static std::map<uint32_t, Process> ChromeProcessTypes(); + // PIDs to their process types. It also populates a list of Lacros PID's, + // if any. + static std::map<uint32_t, Process> ChromeProcessTypes( + std::vector<uint32_t>& lacros_pids); // Collects thread types by running ps command and returns a map of Chrome // TIDs to their thread types. @@ -31,9 +33,11 @@ ProcessTypeCollector() = delete; ~ProcessTypeCollector() = delete; // Parses the output of `ps -ewwo pid,cmd` command and returns a map of Chrome - // PIDs to their process types. + // PIDs to their process types. It also populates a list of Lacros PID's, + // if any. static std::map<uint32_t, Process> ParseProcessTypes( - re2::StringPiece contents); + re2::StringPiece contents, + std::vector<uint32_t>& lacros_pids); // Parses the output of `ps -ewLo pid,lwp,comm` command and returns a map of // Chrome TIDs to their thread types.
diff --git a/chrome/browser/metrics/perf/process_type_collector_unittest.cc b/chrome/browser/metrics/perf/process_type_collector_unittest.cc index 6ee606a..ac76b52 100644 --- a/chrome/browser/metrics/perf/process_type_collector_unittest.cc +++ b/chrome/browser/metrics/perf/process_type_collector_unittest.cc
@@ -12,7 +12,8 @@ namespace { void GetExampleProcessTypeDataset(std::string* ps_output, - std::map<uint32_t, Process>* process_types) { + std::map<uint32_t, Process>* process_types, + std::vector<uint32_t>* lacros_pids) { *ps_output = R"(PID CMD 1000 /opt/google/chrome/chrome --type= 1500 /opt/google/chrome/chrome --type= --some-flag @@ -79,6 +80,17 @@ 24000, Process::UTILITY_PROCESS)); process_types->insert(google::protobuf::MapPair<uint32_t, Process>( 25000, Process::ZYGOTE_PROCESS)); + + lacros_pids->emplace_back(11000); + lacros_pids->emplace_back(12000); + lacros_pids->emplace_back(13000); + lacros_pids->emplace_back(14000); + lacros_pids->emplace_back(15000); + lacros_pids->emplace_back(21000); + lacros_pids->emplace_back(22000); + lacros_pids->emplace_back(23000); + lacros_pids->emplace_back(24000); + lacros_pids->emplace_back(25000); } void GetExampleThreadTypeDataset(std::string* ps_output, @@ -203,52 +215,68 @@ TEST(ProcessTypeCollectorTest, ValidProcessTypeInput) { std::map<uint32_t, Process> want_process_types; std::string input; - GetExampleProcessTypeDataset(&input, &want_process_types); + std::vector<uint32_t> want_lacros_pids; + GetExampleProcessTypeDataset(&input, &want_process_types, &want_lacros_pids); EXPECT_FALSE(input.empty()); EXPECT_FALSE(want_process_types.empty()); + EXPECT_FALSE(want_lacros_pids.empty()); base::HistogramTester histogram_tester; + std::vector<uint32_t> got_lacros_pids; std::map<uint32_t, Process> got_process_types = - TestProcessTypeCollector::ParseProcessTypes(input); + TestProcessTypeCollector::ParseProcessTypes(input, got_lacros_pids); histogram_tester.ExpectBucketCount( "ChromeOS.CWP.CollectProcessTypes", TestProcessTypeCollector::CollectionAttemptStatus::kProcessTypeSuccess, 1); EXPECT_EQ(got_process_types, want_process_types); + EXPECT_EQ(got_lacros_pids, want_lacros_pids); } TEST(ProcessTypeCollectorTest, ProcessTypeInputWithCorruptedLine) { std::string input = R"text(PPID CMD COMMAND PID /opt/google/chrome/chrome --type= - 1000 /opt/google/chrome/chrome --type=)text"; + 1000 /opt/google/chrome/chrome --type= + PID /run/lacros/chrome --type= + 2000 /run/lacros/chrome --type=)text"; std::map<uint32_t, Process> want_process_types; want_process_types.emplace(1000, Process::BROWSER_PROCESS); + want_process_types.emplace(2000, Process::BROWSER_PROCESS); + std::vector<uint32_t> want_lacros_pids(1, 2000); base::HistogramTester histogram_tester; + std::vector<uint32_t> got_lacros_pids; std::map<uint32_t, Process> got_process_types = - TestProcessTypeCollector::ParseProcessTypes(input); + TestProcessTypeCollector::ParseProcessTypes(input, got_lacros_pids); histogram_tester.ExpectBucketCount( "ChromeOS.CWP.CollectProcessTypes", TestProcessTypeCollector::CollectionAttemptStatus::kProcessTypeTruncated, 1); EXPECT_EQ(got_process_types, want_process_types); + EXPECT_EQ(got_lacros_pids, want_lacros_pids); } TEST(ProcessTypeCollectorTest, ProcessTypeInputWithDuplicatePIDs) { std::string input = R"text(PID CMD 1000 /opt/google/chrome/chrome --type= - 1000 /opt/google/chrome/chrome --type=)text"; + 1000 /opt/google/chrome/chrome --type= + 2000 /run/lacros/chrome --type= + 2000 /run/lacros/chrome --type=)text"; std::map<uint32_t, Process> want_process_types; want_process_types.emplace(1000, Process::BROWSER_PROCESS); + want_process_types.emplace(2000, Process::BROWSER_PROCESS); + std::vector<uint32_t> want_lacros_pids(1, 2000); base::HistogramTester histogram_tester; + std::vector<uint32_t> got_lacros_pids; std::map<uint32_t, Process> got_process_types = - TestProcessTypeCollector::ParseProcessTypes(input); + TestProcessTypeCollector::ParseProcessTypes(input, got_lacros_pids); histogram_tester.ExpectBucketCount( "ChromeOS.CWP.CollectProcessTypes", TestProcessTypeCollector::CollectionAttemptStatus::kProcessTypeTruncated, 1); EXPECT_EQ(got_process_types, want_process_types); + EXPECT_EQ(got_lacros_pids, want_lacros_pids); } TEST(ProcessTypeCollectorTest, ProcessTypeInputWithEmptyLine) { @@ -256,16 +284,19 @@ 1000 /opt/google/chrome/chrome --type= )text"; std::map<uint32_t, Process> want_process_types; + std::vector<uint32_t> want_lacros_pids; want_process_types.emplace(1000, Process::BROWSER_PROCESS); base::HistogramTester histogram_tester; + std::vector<uint32_t> got_lacros_pids; std::map<uint32_t, Process> got_process_types = - TestProcessTypeCollector::ParseProcessTypes(input); + TestProcessTypeCollector::ParseProcessTypes(input, got_lacros_pids); histogram_tester.ExpectBucketCount( "ChromeOS.CWP.CollectProcessTypes", TestProcessTypeCollector::CollectionAttemptStatus::kProcessTypeTruncated, 1); EXPECT_EQ(got_process_types, want_process_types); + EXPECT_EQ(got_lacros_pids, want_lacros_pids); } TEST(ProcessTypeCollectorTest, ValidThreadTypeInput) {
diff --git a/chrome/browser/metrics/power/power_metrics_provider_mac.h b/chrome/browser/metrics/power/power_metrics_provider_mac.h index 0ea6c7fa..77aa420 100644 --- a/chrome/browser/metrics/power/power_metrics_provider_mac.h +++ b/chrome/browser/metrics/power/power_metrics_provider_mac.h
@@ -7,8 +7,8 @@ #include "components/metrics/metrics_provider.h" -#include "base/bind.h" -#include "chrome/browser/metrics/power/battery_level_provider.h" +#include "base/threading/sequence_bound.h" +#include "third_party/abseil-cpp/absl/types/optional.h" class PowerMetricsProvider : public metrics::MetricsProvider { public: @@ -23,8 +23,9 @@ void OnRecordingDisabled() override; private: + // Records metrics from the ThreadPool. class Impl; - scoped_refptr<Impl> impl_; + absl::optional<base::SequenceBound<Impl>> impl_; }; #endif // CHROME_BROWSER_METRICS_POWER_POWER_METRICS_PROVIDER_MAC_H_
diff --git a/chrome/browser/metrics/power/power_metrics_provider_mac.mm b/chrome/browser/metrics/power/power_metrics_provider_mac.mm index 579be225..02853bc 100644 --- a/chrome/browser/metrics/power/power_metrics_provider_mac.mm +++ b/chrome/browser/metrics/power/power_metrics_provider_mac.mm
@@ -4,25 +4,23 @@ #include "chrome/browser/metrics/power/power_metrics_provider_mac.h" +#import <Foundation/Foundation.h> + +#include <memory> #include <utility> -#import <Foundation/Foundation.h> -#include <libkern/OSByteOrder.h> - #include "base/bind.h" -#include "base/callback.h" -#include "base/mac/scoped_ioobject.h" -#include "base/memory/scoped_refptr.h" +#include "base/location.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/power_monitor/power_monitor.h" #include "base/process/process.h" -#include "base/task/post_task.h" -#include "base/task/sequenced_task_runner.h" +#include "base/strings/strcat.h" +#include "base/strings/string_piece.h" #include "base/task/thread_pool.h" #include "base/time/time.h" -#include "chrome/browser/ui/browser_finder.h" -#include "third_party/abseil-cpp/absl/types/optional.h" +#include "base/timer/timer.h" +#include "components/power_metrics/smc_mac.h" namespace { constexpr base::TimeDelta kStartupPowerMetricsCollectionDuration = @@ -32,145 +30,6 @@ constexpr base::TimeDelta kPostStartupPowerMetricsCollectionInterval = base::Seconds(60); -// This API is undocumented. It can read hardware sensors including -// temperature, voltage, and power. A useful tool for discovering new keys is -// <https://github.com/theopolis/smc-fuzzer>. The following definitions are -// from -// <https://opensource.apple.com/source/PowerManagement/PowerManagement-271.1.1/pmconfigd/PrivateLib.c.auto.html>. -struct SMCParamStruct { - enum { - kSMCUserClientOpen = 0, - kSMCUserClientClose = 1, - kSMCHandleYPCEvent = 2, - kSMCReadKey = 5, - kSMCGetKeyInfo = 9, - }; - - enum class SMCKey : uint32_t { - TotalPower = 'PSTR', // Power: System Total Rail (watts) - CPUPower = 'PCPC', // Power: CPU Package CPU (watts) - iGPUPower = 'PCPG', // Power: CPU Package GPU (watts) - GPU0Power = 'PG0R', // Power: GPU 0 Rail (watts) - GPU1Power = 'PG1R', // Power: GPU 1 Rail (watts) - }; - - // SMC keys are typed, and there are a number of numeric types. Support for - // decoding the ones in this enum is implemented below, but there are more - // types (and more may appear in future hardware). Implement as needed. - enum class DataType : uint32_t { - flt = 'flt ', // Floating point - sp78 = 'sp78', // Fixed point: SIIIIIIIFFFFFFFF - sp87 = 'sp87', // Fixed point: SIIIIIIIIFFFFFFF - spa5 = 'spa5', // Fixed point: SIIIIIIIIIIFFFFF - }; - - struct SMCVersion { - unsigned char major; - unsigned char minor; - unsigned char build; - unsigned char reserved; - unsigned short release; - }; - - struct SMCPLimitData { - uint16_t version; - uint16_t length; - uint32_t cpuPLimit; - uint32_t gpuPLimit; - uint32_t memPLimit; - }; - - struct SMCKeyInfoData { - IOByteCount dataSize; - DataType dataType; - uint8_t dataAttributes; - }; - - SMCKey key; - SMCVersion vers; - SMCPLimitData pLimitData; - SMCKeyInfoData keyInfo; - uint8_t result; - uint8_t status; - uint8_t data8; - uint32_t data32; - uint8_t bytes[32]; -}; - -float FromSMCFixedPoint(uint8_t* bytes, size_t fraction_bits) { - return static_cast<int16_t>(OSReadBigInt16(bytes, 0)) / - static_cast<float>(1 << fraction_bits); -} - -class SMCKey { - public: - SMCKey(base::mac::ScopedIOObject<io_object_t> connect, - SMCParamStruct::SMCKey key) - : connect_(std::move(connect)), key_(key) { - SMCParamStruct out{}; - if (CallSMCFunction(SMCParamStruct::kSMCGetKeyInfo, &out)) - keyInfo_ = out.keyInfo; - } - - bool Exists() { return keyInfo_.dataSize > 0; } - - float Read() { - if (!Exists()) - return 0; - - SMCParamStruct out{}; - if (!CallSMCFunction(SMCParamStruct::kSMCReadKey, &out)) - return 0; - switch (keyInfo_.dataType) { - case SMCParamStruct::DataType::flt: - return *reinterpret_cast<float*>(out.bytes); - case SMCParamStruct::DataType::sp78: - return FromSMCFixedPoint(out.bytes, 8); - case SMCParamStruct::DataType::sp87: - return FromSMCFixedPoint(out.bytes, 7); - case SMCParamStruct::DataType::spa5: - return FromSMCFixedPoint(out.bytes, 5); - default: - break; - } - return 0; - } - - private: - bool CallSMCFunction(uint8_t which, SMCParamStruct* out) { - if (!connect_) - return false; - if (IOConnectCallMethod(connect_, SMCParamStruct::kSMCUserClientOpen, - nullptr, 0, nullptr, 0, nullptr, nullptr, nullptr, - nullptr)) { - connect_.reset(); - return false; - } - - SMCParamStruct in{}; - in.key = key_; - in.keyInfo.dataSize = keyInfo_.dataSize; - in.data8 = which; - - size_t out_size = sizeof(*out); - bool success = IOConnectCallStructMethod( - connect_, SMCParamStruct::kSMCHandleYPCEvent, &in, - sizeof(in), out, &out_size) == kIOReturnSuccess; - - if (IOConnectCallMethod(connect_, SMCParamStruct::kSMCUserClientClose, - nullptr, 0, nullptr, 0, nullptr, nullptr, nullptr, - nullptr)) - connect_.reset(); - - // Even if the close failed, report whether the actual call succeded. - return success; - } - - base::mac::ScopedIOObject<io_object_t> connect_; - SMCParamStruct::SMCKey key_; - SMCParamStruct::SMCKeyInfoData keyInfo_{}; -}; - // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. enum class ThermalStateUMA { @@ -194,34 +53,29 @@ } } +void RecordSMCHistogram(base::StringPiece prefix, + base::StringPiece suffix, + absl::optional<double> watts) { + if (watts.has_value()) { + double milliwatts = watts.value() * 1000; + base::UmaHistogramCounts100000(base::StrCat({prefix, suffix}), milliwatts); + } +} + } // namespace -class PowerMetricsProvider::Impl : public base::RefCountedThreadSafe<Impl> { +class PowerMetricsProvider::Impl { public: - static scoped_refptr<Impl> Create( - base::mac::ScopedIOObject<io_object_t> connect) { - scoped_refptr<Impl> impl = new Impl(std::move(connect)); - impl->ScheduleCollection(); - return impl; + Impl() : smc_reader_(power_metrics::SMCReader::Create()) { + ScheduleCollection(); } + ~Impl() = default; + Impl(const Impl&) = delete; Impl& operator=(const Impl&) = delete; private: - friend class base::RefCountedThreadSafe<Impl>; - Impl(base::mac::ScopedIOObject<io_object_t> connect) - : task_runner_(base::ThreadPool::CreateSequencedTaskRunner( - {base::MayBlock(), base::TaskPriority::USER_VISIBLE, - base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})), - system_total_power_key_(connect, SMCParamStruct::SMCKey::TotalPower), - cpu_package_cpu_power_key_(connect, SMCParamStruct::SMCKey::CPUPower), - cpu_package_gpu_power_key_(connect, SMCParamStruct::SMCKey::iGPUPower), - gpu_0_power_key_(connect, SMCParamStruct::SMCKey::GPU0Power), - gpu_1_power_key_(connect, SMCParamStruct::SMCKey::GPU0Power) {} - - ~Impl() = default; - bool IsInStartup() { if (could_be_in_startup_) { const base::TimeDelta process_uptime = @@ -233,10 +87,10 @@ } void ScheduleCollection() { - task_runner_->PostDelayedTask( - FROM_HERE, base::BindOnce(&Impl::Collect, this), - IsInStartup() ? kStartupPowerMetricsCollectionInterval - : kPostStartupPowerMetricsCollectionInterval); + timer_.Start(FROM_HERE, + IsInStartup() ? kStartupPowerMetricsCollectionInterval + : kPostStartupPowerMetricsCollectionInterval, + this, &Impl::Collect); } void Collect() { @@ -251,30 +105,27 @@ } } - void RecordSMC(const std::string& name) { - const struct { - const char* uma_prefix; - SMCKey& smc_key; - } sensors[] = { - {"Power.Mac.Total.", system_total_power_key_}, - {"Power.Mac.CPU.", cpu_package_cpu_power_key_}, - {"Power.Mac.GPUi.", cpu_package_gpu_power_key_}, - {"Power.Mac.GPU0.", gpu_0_power_key_}, - {"Power.Mac.GPU1.", gpu_1_power_key_}, - }; - for (const auto& sensor : sensors) { - if (sensor.smc_key.Exists()) { - if (auto power_mw = sensor.smc_key.Read() * 1000) - base::UmaHistogramCounts100000(sensor.uma_prefix + name, power_mw); - } - } + void RecordSMC(base::StringPiece suffix) { + if (!smc_reader_) + return; + + RecordSMCHistogram("Power.Mac.Total.", suffix, + smc_reader_->ReadTotalPowerW()); + RecordSMCHistogram("Power.Mac.CPU.", suffix, + smc_reader_->ReadCPUPackageCPUPowerW()); + RecordSMCHistogram("Power.Mac.GPUi.", suffix, + smc_reader_->ReadCPUPackageGPUPowerW()); + RecordSMCHistogram("Power.Mac.GPU0.", suffix, + smc_reader_->ReadGPU0PowerW()); + RecordSMCHistogram("Power.Mac.GPU1.", suffix, + smc_reader_->ReadGPU1PowerW()); } void RecordIsOnBattery() { - bool is_on_battery = false; - if (base::PowerMonitor::IsInitialized()) - is_on_battery = base::PowerMonitor::IsOnBatteryPower(); - UMA_HISTOGRAM_BOOLEAN("Power.Mac.IsOnBattery2", is_on_battery); + if (base::PowerMonitor::IsInitialized()) { + UMA_HISTOGRAM_BOOLEAN("Power.Mac.IsOnBattery2", + base::PowerMonitor::IsOnBatteryPower()); + } } void RecordThermal() { @@ -283,30 +134,18 @@ ThermalStateToUmaEnumValue([[NSProcessInfo processInfo] thermalState])); } - scoped_refptr<base::SequencedTaskRunner> task_runner_; + base::OneShotTimer timer_; + std::unique_ptr<power_metrics::SMCReader> smc_reader_; bool could_be_in_startup_ = true; - - SMCKey system_total_power_key_; - SMCKey cpu_package_cpu_power_key_; - SMCKey cpu_package_gpu_power_key_; - SMCKey gpu_0_power_key_; - SMCKey gpu_1_power_key_; }; PowerMetricsProvider::PowerMetricsProvider() = default; PowerMetricsProvider::~PowerMetricsProvider() = default; void PowerMetricsProvider::OnRecordingEnabled() { - const base::mac::ScopedIOObject<io_service_t> smc_service( - IOServiceGetMatchingService(kIOMasterPortDefault, - IOServiceMatching("AppleSMC"))); - io_object_t connect; - bool service_opened = IOServiceOpen(smc_service, mach_task_self(), 1, - &connect) == kIOReturnSuccess; - UMA_HISTOGRAM_BOOLEAN("Power.Mac.AppleSMCOpened", service_opened); - if (!service_opened) - return; - impl_ = Impl::Create(base::mac::ScopedIOObject<io_object_t>(connect)); + impl_ = base::SequenceBound<Impl>(base::ThreadPool::CreateSequencedTaskRunner( + {base::MayBlock(), base::TaskPriority::USER_VISIBLE, + base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})); } void PowerMetricsProvider::OnRecordingDisabled() {
diff --git a/chrome/browser/prefs/pref_metrics_service.cc b/chrome/browser/prefs/pref_metrics_service.cc index 731641b..27f74ee 100644 --- a/chrome/browser/prefs/pref_metrics_service.cc +++ b/chrome/browser/prefs/pref_metrics_service.cc
@@ -78,10 +78,10 @@ const base::ListValue* url_list = prefs_->GetList(prefs::kURLsToRestoreOnStartup); // Similarly, check startup pages for known search engine TLD+1s. - std::string url_text; - for (size_t i = 0; i < url_list->GetList().size(); ++i) { - if (url_list->GetString(i, &url_text)) { - GURL start_url(url_text); + for (const base::Value& i : url_list->GetList()) { + const std::string* url_text = i.GetIfString(); + if (url_text) { + GURL start_url(*url_text); if (start_url.is_valid()) { UMA_HISTOGRAM_ENUMERATION("Settings.StartupPageEngineTypes", SearchEngineUtils::GetEngineType(start_url),
diff --git a/chrome/browser/prefs/session_startup_pref.cc b/chrome/browser/prefs/session_startup_pref.cc index 51f45a7e..1622dc92 100644 --- a/chrome/browser/prefs/session_startup_pref.cc +++ b/chrome/browser/prefs/session_startup_pref.cc
@@ -31,10 +31,10 @@ void URLListToPref(const base::ListValue* url_list, SessionStartupPref* pref) { pref->urls.clear(); - for (size_t i = 0; i < url_list->GetList().size(); ++i) { - std::string url_text; - if (url_list->GetString(i, &url_text)) { - GURL fixed_url = url_formatter::FixupURL(url_text, std::string()); + for (const base::Value& i : url_list->GetList()) { + const std::string* url_text = i.GetIfString(); + if (url_text) { + GURL fixed_url = url_formatter::FixupURL(*url_text, std::string()); pref->urls.push_back(fixed_url); } }
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc index 59e3af7..3915ec4 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -1276,8 +1276,6 @@ const Browser* browser = GetBrowser(); const bool in_app = browser && (browser->is_type_app() || browser->is_type_app_popup()); - WebContents* active_web_contents = - browser ? browser->tab_strip_model()->GetActiveWebContents() : nullptr; Profile* profile = GetProfile(); absl::optional<web_app::SystemAppType> link_system_app_type = @@ -1413,26 +1411,25 @@ SendTabToSelfSyncServiceFactory::GetForProfile(profile), params_.link_url); if (browser && !ShouldUseShareMenu() && should_offer_to_share_url) { - if (send_tab_to_self::GetValidDeviceCount(GetBrowser()->profile()) == 1) { + if (send_tab_to_self::GetValidDeviceCount(GetProfile()) == 1) { #if defined(OS_MAC) - menu_model_.AddItem(IDC_CONTENT_LINK_SEND_TAB_TO_SELF_SINGLE_TARGET, - l10n_util::GetStringFUTF16( - IDS_LINK_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET, - send_tab_to_self::GetSingleTargetDeviceName( - GetBrowser()->profile()))); + menu_model_.AddItem( + IDC_CONTENT_LINK_SEND_TAB_TO_SELF_SINGLE_TARGET, + l10n_util::GetStringFUTF16( + IDS_LINK_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET, + send_tab_to_self::GetSingleTargetDeviceName(GetProfile()))); #else menu_model_.AddItemWithIcon( IDC_CONTENT_LINK_SEND_TAB_TO_SELF_SINGLE_TARGET, l10n_util::GetStringFUTF16( IDS_LINK_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET, - send_tab_to_self::GetSingleTargetDeviceName( - GetBrowser()->profile())), + send_tab_to_self::GetSingleTargetDeviceName(GetProfile())), ui::ImageModel::FromVectorIcon(kSendTabToSelfIcon)); #endif } else { send_tab_to_self_sub_menu_model_ = std::make_unique<send_tab_to_self::SendTabToSelfSubMenuModel>( - active_web_contents, + source_web_contents_, send_tab_to_self::SendTabToSelfMenuType::kLink, params_.link_url); #if defined(OS_MAC) @@ -1715,30 +1712,28 @@ // Send-Tab-To-Self (user's other devices), page level. bool send_tab_to_self_menu_present = false; if (GetBrowser() && !ShouldUseShareMenu() && - send_tab_to_self::ShouldOfferFeature( - GetBrowser()->tab_strip_model()->GetActiveWebContents())) { + send_tab_to_self::ShouldOfferFeature(source_web_contents_)) { menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); send_tab_to_self_menu_present = true; - if (send_tab_to_self::GetValidDeviceCount(GetBrowser()->profile()) == 1) { + if (send_tab_to_self::GetValidDeviceCount(GetProfile()) == 1) { #if defined(OS_MAC) - menu_model_.AddItem(IDC_SEND_TAB_TO_SELF_SINGLE_TARGET, - l10n_util::GetStringFUTF16( - IDS_CONTEXT_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET, - send_tab_to_self::GetSingleTargetDeviceName( - GetBrowser()->profile()))); + menu_model_.AddItem( + IDC_SEND_TAB_TO_SELF_SINGLE_TARGET, + l10n_util::GetStringFUTF16( + IDS_CONTEXT_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET, + send_tab_to_self::GetSingleTargetDeviceName(GetProfile()))); #else menu_model_.AddItemWithIcon( IDC_SEND_TAB_TO_SELF_SINGLE_TARGET, l10n_util::GetStringFUTF16( IDS_CONTEXT_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET, - send_tab_to_self::GetSingleTargetDeviceName( - GetBrowser()->profile())), + send_tab_to_self::GetSingleTargetDeviceName(GetProfile())), ui::ImageModel::FromVectorIcon(kSendTabToSelfIcon)); #endif } else { send_tab_to_self_sub_menu_model_ = std::make_unique<send_tab_to_self::SendTabToSelfSubMenuModel>( - GetBrowser()->tab_strip_model()->GetActiveWebContents(), + source_web_contents_, send_tab_to_self::SendTabToSelfMenuType::kContent); #if defined(OS_MAC) menu_model_.AddSubMenuWithStringId( @@ -2639,25 +2634,22 @@ break; case IDC_SEND_TAB_TO_SELF_SINGLE_TARGET: - send_tab_to_self::ShareToSingleTarget( - GetBrowser()->tab_strip_model()->GetActiveWebContents()); + send_tab_to_self::ShareToSingleTarget(source_web_contents_); send_tab_to_self::RecordDeviceClicked( send_tab_to_self::ShareEntryPoint::kContentMenu); break; case IDC_CONTENT_LINK_SEND_TAB_TO_SELF_SINGLE_TARGET: - send_tab_to_self::ShareToSingleTarget( - GetBrowser()->tab_strip_model()->GetActiveWebContents(), - params_.link_url); + send_tab_to_self::ShareToSingleTarget(source_web_contents_, + params_.link_url); send_tab_to_self::RecordDeviceClicked( send_tab_to_self::ShareEntryPoint::kLinkMenu); break; case IDC_CONTENT_CONTEXT_GENERATE_QR_CODE: { - auto* web_contents = - GetBrowser()->tab_strip_model()->GetActiveWebContents(); auto* bubble_controller = - qrcode_generator::QRCodeGeneratorBubbleController::Get(web_contents); + qrcode_generator::QRCodeGeneratorBubbleController::Get( + source_web_contents_); if (params_.media_type == ContextMenuDataMediaType::kImage) { base::RecordAction( UserMetricsAction("SharingQRCode.DialogLaunched.ContextMenuImage"));
diff --git a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/speech_parser.js b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/speech_parser.js index defa3940..ed75584 100644 --- a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/speech_parser.js +++ b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/speech_parser.js
@@ -2,6 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +/** + * @fileoverview Handles speech parsing for dictation. + */ + import {InputController} from './input_controller.js'; import {InputTextViewMacro, NewLineMacro} from './macros/input_text_view_macro.js'; import {ListCommandsMacro} from './macros/list_commands_macro.js'; @@ -13,17 +17,140 @@ // or exclude_pumpkin.js in the BUILD rule. import {PumpkinAvailability} from './pumpkin/pumpkin_availability.js'; - -// TODO(crbug.com/1264544): Consider refactoring into a class. /** * @typedef {{ - * commandString: string, - * createMacro: function():Macro, - * matchesMacro: function(string):boolean, - * matchesInputTextViewMacro: function(string):boolean, + * messageId: string, + * build: function(): Macro, * }} */ -let ActionInfo; +let MacroData; + +/** + * SimpleMacroFactory helps SpeechParser convert spoken strings into Macros + * using string matching. Used as a fall-back when Pumpkin is not available. + */ +class SimpleMacroFactory { + /** + * @param {!MacroName} macroName + * @param {!InputController} inputController + * @param {boolean} isRTLLocale + */ + constructor(macroName, inputController, isRTLLocale) { + /** @private {!MacroName} */ + this.macroName_ = macroName; + /** @private {!InputController} */ + this.inputController_ = inputController; + /** @private {boolean} */ + this.isRTLLocale_ = isRTLLocale; + + /** @private {Object<MacroName, MacroData>} */ + this.data_ = { + [MacroName.DELETE_PREV_CHAR]: { + messageId: 'dictation_command_delete_prev_char', + build: () => new RepeatableKeyPressMacro.DeletePreviousCharacterMacro() + }, + [MacroName.NAV_PREV_CHAR]: { + messageId: 'dictation_command_nav_prev_char', + build: () => + new RepeatableKeyPressMacro.NavPreviousCharMacro(this.isRTLLocale_) + }, + [MacroName.NAV_NEXT_CHAR]: { + messageId: 'dictation_command_nav_next_char', + build: () => + new RepeatableKeyPressMacro.NavNextCharMacro(this.isRTLLocale_) + }, + [MacroName.NAV_PREV_LINE]: { + messageId: 'dictation_command_nav_prev_line', + build: () => new RepeatableKeyPressMacro.NavPreviousLineMacro() + }, + [MacroName.NAV_NEXT_LINE]: { + messageId: 'dictation_command_nav_next_line', + build: () => new RepeatableKeyPressMacro.NavNextLineMacro() + }, + [MacroName.COPY_SELECTED_TEXT]: { + messageId: 'dictation_command_copy_selected_text', + build: () => new RepeatableKeyPressMacro.CopySelectedTextMacro() + }, + [MacroName.PASTE_TEXT]: { + messageId: 'dictation_command_paste_text', + build: () => new RepeatableKeyPressMacro.PasteTextMacro() + }, + [MacroName.CUT_SELECTED_TEXT]: { + messageId: 'dictation_command_cut_selected_text', + build: () => new RepeatableKeyPressMacro.CutSelectedTextMacro() + }, + [MacroName.UNDO_TEXT_EDIT]: { + messageId: 'dictation_command_undo_text_edit', + build: () => new RepeatableKeyPressMacro.UndoTextEditMacro() + }, + [MacroName.REDO_ACTION]: { + messageId: 'dictation_command_redo_action', + build: () => new RepeatableKeyPressMacro.RedoActionMacro() + }, + [MacroName.SELECT_ALL_TEXT]: { + messageId: 'dictation_command_select_all_text', + build: () => new RepeatableKeyPressMacro.SelectAllTextMacro() + }, + [MacroName.UNSELECT_TEXT]: { + messageId: 'dictation_command_unselect_text', + build: () => + new RepeatableKeyPressMacro.UnselectTextMacro(this.isRTLLocale_) + }, + [MacroName.LIST_COMMANDS]: { + messageId: 'dictation_command_list_commands', + build: () => new ListCommandsMacro() + }, + [MacroName.NEW_LINE]: { + messageId: 'dictation_command_new_line', + build: () => new NewLineMacro(this.inputController_) + }, + }; + + if (!this.data_[this.macroName_]) { + throw new Error( + 'Macro is not supported by SimpleMacroFactory: ' + this.macroName_); + } + + /** @private {string} */ + this.commandString_ = + chrome.i18n.getMessage(this.data_[this.macroName_].messageId); + } + + /** @return {Macro} */ + createMacro() { + return this.data_[this.macroName_].build(); + } + + /** + * Checks whether a string matches `commandString_`, ignoring case and + * whitespace. + * @param {string} text + * @return {boolean} + */ + matchesMacro(text) { + return text.trim().toLowerCase() === this.commandString_; + } + + // TODO(crbug.com/1216111): Create a factory for InputTextViewMacro and remove + // this method. + /** + * Checks whether a string matches a request to type a command, i.e. for the + * command 'delete', it would match 'type delete', ignoring case and + * whitespace. + * @param {string} text + * @return {boolean} + */ + matchesInputTextViewMacro(text) { + const expected = chrome.i18n.getMessage( + 'dictation_command_input_text_view', this.commandString_); + return text.trim().toLowerCase() === expected; + } + + /** @return {string} */ + getCommandString() { + return this.commandString_; + } +} /** * PumpkinTagger Hypothesis argument names. These should match the variable @@ -42,18 +169,17 @@ */ export class SpeechParser { /** - * @param {InputController} inputController to interact with the IME. + * @param {!InputController} inputController to interact with the IME. */ constructor(inputController) { /** @private {boolean} */ this.commandsFeatureEnabled_ = false; /** - * Map of command action IDs to information about that command. - * This object uses localized strings. - * @private {!Map<MacroName, ActionInfo>} + * Map of macro names to a factory for that macro. + * @private {!Map<!MacroName, !SimpleMacroFactory>} */ - this.commandMap_ = new Map(); + this.macroFactoryMap_ = new Map(); /** @private {boolean} */ this.isRTLLocale_ = false; @@ -61,7 +187,7 @@ /** @private {speech.pumpkin.api.js.PumpkinTagger.PumpkinTagger} */ this.pumpkinTagger_ = null; - /** @private {InputController} */ + /** @private {!InputController} */ this.inputController_ = inputController; /** @private {?Promise} */ @@ -120,12 +246,12 @@ } // If Pumpkin is not available we can fall back to a hard-coded list - // of possible commands. First, see if the text matches a command action. - for (const [action, info] of this.commandMap_) { - if (info.matchesMacro(text)) { - return info.createMacro(); - } else if (info.matchesInputTextViewMacro(text)) { - text = info.commandString; + // of possible macros. + for (const [name, factory] of this.macroFactoryMap_) { + if (factory.matchesMacro(text)) { + return factory.createMacro(); + } else if (factory.matchesInputTextViewMacro(text)) { + text = factory.getCommandString(); break; } } @@ -152,118 +278,19 @@ this.pumpkinTagger_ = null; } - // Does pre-work to parse commands: gets translated command strings and - // generates a map of commands to regular expressions that would match them. - // These are used as a fall-back when Pumpkin is not available. - // TODO(crbug.com/1264544): Don't generate commands for all names when - // Pumpkin is available. Just generate "new line" (the only non-pumpkin - // command) or nothing at all. for (const key in MacroName) { - const actionId = MacroName[key]; - let messageId; - let createMacro; - switch (actionId) { - case MacroName.DELETE_PREV_CHAR: - messageId = 'dictation_command_delete_prev_char'; - createMacro = () => { - return new RepeatableKeyPressMacro.DeletePreviousCharacterMacro(); - }; - break; - case MacroName.NAV_PREV_CHAR: - messageId = 'dictation_command_nav_prev_char'; - createMacro = () => { - return new RepeatableKeyPressMacro.NavPreviousCharMacro( - this.isRTLLocale_); - }; - break; - case MacroName.NAV_NEXT_CHAR: - messageId = 'dictation_command_nav_next_char'; - createMacro = () => { - return new RepeatableKeyPressMacro.NavNextCharMacro( - this.isRTLLocale_); - }; - break; - case MacroName.NAV_PREV_LINE: - messageId = 'dictation_command_nav_prev_line'; - createMacro = () => { - return new RepeatableKeyPressMacro.NavPreviousLineMacro(); - }; - break; - case MacroName.NAV_NEXT_LINE: - messageId = 'dictation_command_nav_next_line'; - createMacro = () => { - return new RepeatableKeyPressMacro.NavNextLineMacro(); - }; - break; - case MacroName.COPY_SELECTED_TEXT: - messageId = 'dictation_command_copy_selected_text'; - createMacro = () => { - return new RepeatableKeyPressMacro.CopySelectedTextMacro(); - }; - break; - case MacroName.PASTE_TEXT: - messageId = 'dictation_command_paste_text'; - createMacro = () => { - return new RepeatableKeyPressMacro.PasteTextMacro(); - }; - break; - case MacroName.CUT_SELECTED_TEXT: - messageId = 'dictation_command_cut_selected_text'; - createMacro = () => { - return new RepeatableKeyPressMacro.CutSelectedTextMacro(); - }; - break; - case MacroName.UNDO_TEXT_EDIT: - messageId = 'dictation_command_undo_text_edit'; - createMacro = () => { - return new RepeatableKeyPressMacro.UndoTextEditMacro(); - }; - break; - case MacroName.REDO_ACTION: - messageId = 'dictation_command_redo_action'; - createMacro = () => { - return new RepeatableKeyPressMacro.RedoActionMacro(); - }; - break; - case MacroName.SELECT_ALL_TEXT: - messageId = 'dictation_command_select_all_text'; - createMacro = () => { - return new RepeatableKeyPressMacro.SelectAllTextMacro(); - }; - break; - case MacroName.UNSELECT_TEXT: - messageId = 'dictation_command_unselect_text'; - createMacro = () => { - return new RepeatableKeyPressMacro.UnselectTextMacro( - this.isRTLLocale_); - }; - break; - case MacroName.LIST_COMMANDS: - messageId = 'dictation_command_list_commands'; - createMacro = () => { - return new ListCommandsMacro(); - }; - break; - case MacroName.NEW_LINE: - messageId = 'dictation_command_new_line'; - createMacro = () => { - return new NewLineMacro(this.inputController_); - }; - break; - default: - // Other macros are not supported by regular expressions and - // should go through Pumpkin. Strongly encouraged not to add any - // new actions manually unless they are needed by users who do not - // use languages with Pumpkin translations. - continue; + const name = MacroName[key]; + // TODO(crbug.com/1264544): Don't generate parsers for all macros when + // Pumpkin is available. Just generate "new line" (the only non-pumpkin + // command) or nothing at all. + if (name === MacroName.INPUT_TEXT_VIEW) { + continue; } - const commandString = chrome.i18n.getMessage(messageId); - this.commandMap_.set(actionId, { - commandString, - createMacro, - matchesMacro: this.commandMatcher_(commandString), - matchesInputTextViewMacro: this.inputTextViewMatcher_(commandString) - }); + + this.macroFactoryMap_.set( + name, + new SimpleMacroFactory( + name, this.inputController_, this.isRTLLocale_)); } } @@ -420,37 +447,6 @@ return null; } } - - /** - * Gets a function that checks whether a string matches a - * command string, ignoring case and whitespace. - * @param {string} commandString - * @return {function(string):boolean} - * @private - */ - commandMatcher_(commandString) { - const re = new RegExp('^[\\s]*' + commandString + '[\\s]*$', 'im'); - return text => { - return re.exec(text); - }; - } - - /** - * Gets a function that checks whether a string matches - * a request to type a command, i.e. for the command 'delete', it would - * match 'type delete', ignoring case and whitespace. - * @param {string} commandString - * @return {function(string):boolean} - * @private - */ - inputTextViewMatcher_(commandString) { - const query = chrome.i18n.getMessage( - 'dictation_command_input_text_view', commandString); - const re = new RegExp('^[\\s]*' + query + '[\\s]*$', 'im'); - return text => { - return re.exec(text); - }; - } } // All RTL locales from Dictation::GetAllSupportedLocales.
diff --git a/chrome/browser/signin/services/android/java/src/org/chromium/chrome/browser/signin/services/FREMobileIdentityConsistencyFieldTrial.java b/chrome/browser/signin/services/android/java/src/org/chromium/chrome/browser/signin/services/FREMobileIdentityConsistencyFieldTrial.java index c73a4b6..16a5e4b 100644 --- a/chrome/browser/signin/services/android/java/src/org/chromium/chrome/browser/signin/services/FREMobileIdentityConsistencyFieldTrial.java +++ b/chrome/browser/signin/services/android/java/src/org/chromium/chrome/browser/signin/services/FREMobileIdentityConsistencyFieldTrial.java
@@ -6,6 +6,7 @@ import androidx.annotation.AnyThread; import androidx.annotation.MainThread; +import androidx.annotation.VisibleForTesting; import org.chromium.base.CommandLine; import org.chromium.base.annotations.CalledByNative; @@ -29,8 +30,11 @@ public class FREMobileIdentityConsistencyFieldTrial { private static final Object LOCK = new Object(); private static final String ENABLED_GROUP = "Enabled"; - private static final String DISABLED_GROUP = "Disabled"; + @VisibleForTesting + public static final String DISABLED_GROUP = "Disabled"; private static final String DEFAULT_GROUP = "Default"; + @VisibleForTesting + public static final String OLD_FRE_WITH_UMA_DIALOG_GROUP = "OldFreWithUmaDialog"; @AnyThread public static boolean isEnabled() { @@ -42,6 +46,15 @@ || ENABLED_GROUP.equals(getFirstRunTrialGroup()); } + @MainThread + public static boolean shouldShowOldFreWithUmaDialog() { + // Switch used for tests. + if (CommandLine.getInstance().hasSwitch(ChromeSwitches.FORCE_DISABLE_SIGNIN_FRE)) { + return false; + } + return OLD_FRE_WITH_UMA_DIALOG_GROUP.equals(getFirstRunTrialGroup()); + } + @CalledByNative @AnyThread public static String getFirstRunTrialGroup() { @@ -103,4 +116,12 @@ ChromePreferenceKeys.FIRST_RUN_FIELD_TRIAL_GROUP, group); } } + + @AnyThread + public static void setFirstRunTrialGroupForTesting(String group) { + synchronized (LOCK) { + SharedPreferencesManager.getInstance().writeString( + ChromePreferenceKeys.FIRST_RUN_FIELD_TRIAL_GROUP, group); + } + } } \ No newline at end of file
diff --git a/chrome/browser/speech/extension_api/tts_extension_api.cc b/chrome/browser/speech/extension_api/tts_extension_api.cc index 51a50d3..2b9e476 100644 --- a/chrome/browser/speech/extension_api/tts_extension_api.cc +++ b/chrome/browser/speech/extension_api/tts_extension_api.cc
@@ -259,10 +259,12 @@ base::ListValue* list; EXTENSION_FUNCTION_VALIDATE( options->GetList(constants::kRequiredEventTypesKey, &list)); - for (size_t i = 0; i < list->GetList().size(); ++i) { - std::string event_type; - if (list->GetString(i, &event_type)) - required_event_types.insert(TtsEventTypeFromString(event_type.c_str())); + for (const base::Value& i : list->GetList()) { + const std::string* event_type = i.GetIfString(); + if (event_type) { + required_event_types.insert( + TtsEventTypeFromString(event_type->c_str())); + } } } @@ -271,10 +273,10 @@ base::ListValue* list; EXTENSION_FUNCTION_VALIDATE( options->GetList(constants::kDesiredEventTypesKey, &list)); - for (size_t i = 0; i < list->GetList().size(); ++i) { - std::string event_type; - if (list->GetString(i, &event_type)) - desired_event_types.insert(TtsEventTypeFromString(event_type.c_str())); + for (const base::Value& i : list->GetList()) { + const std::string* event_type = i.GetIfString(); + if (event_type) + desired_event_types.insert(TtsEventTypeFromString(event_type->c_str())); } }
diff --git a/chrome/browser/supervised_user/supervised_user_error_page/DEPS b/chrome/browser/supervised_user/supervised_user_error_page/DEPS index 4388b2f..2b85ef17a 100644 --- a/chrome/browser/supervised_user/supervised_user_error_page/DEPS +++ b/chrome/browser/supervised_user/supervised_user_error_page/DEPS
@@ -3,7 +3,6 @@ "+chrome/browser:resources_grit", "+content/public/renderer", "+third_party/blink", - "+ui/base", "+url", "+v8", ]
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index abcdd694..3f1ee74 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -450,6 +450,7 @@ "//components/blocked_content", "//components/bookmarks/browser", "//components/bookmarks/managed", + "//components/breadcrumbs/core", "//components/breadcrumbs/core:feature_flags", "//components/browser_sync", "//components/browsing_data/content", @@ -950,6 +951,8 @@ "bookmarks/bookmark_utils_desktop.h", "bookmarks/recently_used_folders_combo_model.cc", "bookmarks/recently_used_folders_combo_model.h", + "breadcrumb_manager_browser_agent.cc", + "breadcrumb_manager_browser_agent.h", "browser.cc", "browser.h", "browser_command_controller.cc",
diff --git a/chrome/browser/ui/android/omnibox/DEPS b/chrome/browser/ui/android/omnibox/DEPS index b9528df9..16e50a3 100644 --- a/chrome/browser/ui/android/omnibox/DEPS +++ b/chrome/browser/ui/android/omnibox/DEPS
@@ -14,6 +14,5 @@ "+components/search_engines/android", "+components/signin/public/android", "+content/public/android", - "+ui/android", "+url/android", ]
diff --git a/chrome/browser/ui/android/signin/java/res/layout/fre_uma_dialog.xml b/chrome/browser/ui/android/signin/java/res/layout/fre_uma_dialog.xml index a56e026..a7daae01 100644 --- a/chrome/browser/ui/android/signin/java/res/layout/fre_uma_dialog.xml +++ b/chrome/browser/ui/android/signin/java/res/layout/fre_uma_dialog.xml
@@ -7,22 +7,21 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingTop="@dimen/signin_fre_uma_dialog_padding" android:paddingBottom="@dimen/signin_fre_uma_dialog_padding" - android:paddingStart="@dimen/signin_fre_uma_dialog_padding" android:orientation="vertical"> <ScrollView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" - android:requiresFadingEdge="vertical" - android:overScrollMode="ifContentScrolls"> + android:requiresFadingEdge="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/signin_fre_uma_dialog_padding" + android:paddingTop="@dimen/signin_fre_uma_dialog_padding" + android:paddingStart="@dimen/signin_fre_uma_dialog_padding" + android:paddingEnd="@dimen/signin_fre_uma_dialog_padding" android:orientation="vertical"> <TextView
diff --git a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java index 1e7a5d49..ef28d03f 100644 --- a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java +++ b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java
@@ -279,7 +279,8 @@ * A global layout listener used to capture a new texture when the experimental toolbar button * is added or removed. */ - private ViewTreeObserver.OnGlobalLayoutListener mOptionalButtonLayoutListener; + private ViewTreeObserver.OnGlobalLayoutListener mOptionalButtonLayoutListener = + () -> requestLayoutHostUpdateForOptionalButton(); // The following are some properties used during animation. We use explicit property classes // to avoid the cost of reflection for each animation setup. @@ -2521,7 +2522,6 @@ } else { ApiCompatibilityUtils.setImageTintList(mOptionalButton, null); } - mOptionalButtonLayoutListener = () -> requestLayoutHostUpdateForOptionalButton(); if (mTabSwitcherState == STATIC_TAB) { if (!mUrlFocusChangeInProgress && !urlHasFocus() && mOptionalButton.getVisibility() == View.GONE) {
diff --git a/chrome/browser/ui/ash/capture_mode/capture_mode_browsertest.cc b/chrome/browser/ui/ash/capture_mode/capture_mode_browsertest.cc index 52b0ee97..8aca4ce5 100644 --- a/chrome/browser/ui/ash/capture_mode/capture_mode_browsertest.cc +++ b/chrome/browser/ui/ash/capture_mode/capture_mode_browsertest.cc
@@ -23,6 +23,8 @@ #include "content/public/test/browser_test.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" +#include "ui/events/event_constants.h" +#include "ui/events/keycodes/keyboard_codes_posix.h" #include "ui/events/test/event_generator.h" #include "ui/wm/core/window_util.h" @@ -101,11 +103,13 @@ EXPECT_FALSE(test_api.IsVideoRecordingInProgress()); } -void SendKeyEvent(Browser* browser, ui::KeyboardCode key_code) { +void SendKeyEvent(Browser* browser, + ui::KeyboardCode key_code, + int flags = ui::EF_NONE) { auto* browser_window = GetBrowserWindow(browser); ui::test::EventGenerator event_generator{browser_window->GetRootWindow(), browser_window}; - event_generator.PressAndReleaseKey(key_code); + event_generator.PressAndReleaseKey(key_code, flags); } } // namespace @@ -228,6 +232,60 @@ EXPECT_FALSE(test_api.IsPendingDlpCheckOnSessionInit()); } +IN_PROC_BROWSER_TEST_F( + CaptureModeBrowserTest, + DlpWarningDialogOnCaptureScreenshotsOfAllDisplaysDismissed) { + ASSERT_TRUE(browser()); + + MarkActiveTabAsDlpWarnedForScreenCapture(browser()); + ash::CaptureModeTestApi test_api; + EXPECT_FALSE(test_api.IsPendingDlpCheckOnSessionInit()); + + // The screenshots should not be taken immediately through the keyboard + // shortcut. The controller should be in a pending state waiting for a reply + // from the DLP manager. + SendKeyEvent(browser(), ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_CONTROL_DOWN); + EXPECT_TRUE(test_api.IsPendingDlpCheckOnSessionInit()); + + // Dismiss the dialog by hitting the ESCAPE key. The screenshot should be + // aborted and the pending state should end. + SendKeyEvent(browser(), ui::VKEY_ESCAPE); + EXPECT_FALSE(test_api.IsPendingDlpCheckOnSessionInit()); +} + +IN_PROC_BROWSER_TEST_F( + CaptureModeBrowserTest, + DlpWarningDialogOnFullscreenScreenCaptureShortcutAccepted) { + ASSERT_TRUE(browser()); + + MarkActiveTabAsDlpWarnedForScreenCapture(browser()); + ash::CaptureModeTestApi test_api; + EXPECT_FALSE(test_api.IsPendingDlpCheckOnSessionInit()); + + // The screenshots should not be taken immediately through the keyboard + // shortcut. The controller should be in a pending state waiting for a reply + // from the DLP manager. + SendKeyEvent(browser(), ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_CONTROL_DOWN); + EXPECT_TRUE(test_api.IsPendingDlpCheckOnSessionInit()); + + // Set up a waiter to wait for the file to be saved. + base::RunLoop loop; + test_api.SetOnCaptureFileSavedCallback( + base::BindLambdaForTesting([&loop](const base::FilePath& path) { + base::ScopedAllowBlockingForTesting allow_blocking; + EXPECT_TRUE(base::PathExists(path)); + loop.Quit(); + })); + + // Accept the dialog by hitting the ENTER key. The screenshot should be taken + // and the pending state should end. + SendKeyEvent(browser(), ui::VKEY_RETURN); + EXPECT_FALSE(test_api.IsPendingDlpCheckOnSessionInit()); + + // Wait for the file to be saved. + loop.Run(); +} + class AdvancedSettingsCaptureModeBrowserTest : public extensions::ExtensionBrowserTest { public:
diff --git a/chrome/browser/ui/ash/clipboard_history_browsertest.cc b/chrome/browser/ui/ash/clipboard_history_browsertest.cc index 599c25e..43140256 100644 --- a/chrome/browser/ui/ash/clipboard_history_browsertest.cc +++ b/chrome/browser/ui/ash/clipboard_history_browsertest.cc
@@ -1172,7 +1172,7 @@ // For other data destinations, only the data from `allowed_origin_` // should be accessible. return data_src && data_src->IsUrlType() && - (*data_src->origin() == allowed_origin_); + (*data_src->GetOrigin() == allowed_origin_); } void PasteIfAllowed(const ui::DataTransferEndpoint* const data_src,
diff --git a/chrome/browser/ui/ash/desks_templates/desks_templates_client.cc b/chrome/browser/ui/ash/desks_templates/desks_templates_client.cc index 4e02085..be14b85 100644 --- a/chrome/browser/ui/ash/desks_templates/desks_templates_client.cc +++ b/chrome/browser/ui/ash/desks_templates/desks_templates_client.cc
@@ -375,7 +375,7 @@ void DesksTemplatesClient::OnGetAllTemplates( GetDeskTemplatesCallback callback, desks_storage::DeskModel::GetAllEntriesStatus status, - std::vector<ash::DeskTemplate*> entries) { + const std::vector<ash::DeskTemplate*>& entries) { std::move(callback).Run( entries, std::string(status != desks_storage::DeskModel::GetAllEntriesStatus::kOk
diff --git a/chrome/browser/ui/ash/desks_templates/desks_templates_client.h b/chrome/browser/ui/ash/desks_templates/desks_templates_client.h index 95be144..5c71776d 100644 --- a/chrome/browser/ui/ash/desks_templates/desks_templates_client.h +++ b/chrome/browser/ui/ash/desks_templates/desks_templates_client.h
@@ -160,7 +160,7 @@ // storage. void OnGetAllTemplates(GetDeskTemplatesCallback callback, desks_storage::DeskModel::GetAllEntriesStatus status, - std::vector<ash::DeskTemplate*> entries); + const std::vector<ash::DeskTemplate*>& entries); // Callback function that is called once the DesksController has captured the // active desk as a template. Invokes |callback| with |desk_template| as an
diff --git a/chrome/browser/ui/ash/desks_templates/desks_templates_client_browsertest.cc b/chrome/browser/ui/ash/desks_templates/desks_templates_client_browsertest.cc index b625230..9e68329 100644 --- a/chrome/browser/ui/ash/desks_templates/desks_templates_client_browsertest.cc +++ b/chrome/browser/ui/ash/desks_templates/desks_templates_client_browsertest.cc
@@ -55,6 +55,8 @@ #include "components/keep_alive_registry/keep_alive_types.h" #include "components/keep_alive_registry/scoped_keep_alive.h" #include "content/public/test/browser_test.h" +#include "content/public/test/test_navigation_observer.h" +#include "content/public/test/test_utils.h" #include "extensions/common/constants.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -96,7 +98,7 @@ TabStripModel* tab_strip_model = browser->tab_strip_model(); std::vector<GURL> urls; for (int i = 0; i < tab_strip_model->count(); ++i) - urls.push_back(tab_strip_model->GetWebContentsAt(i)->GetLastCommittedURL()); + urls.push_back(tab_strip_model->GetWebContentsAt(i)->GetVisibleURL()); return urls; } @@ -249,10 +251,14 @@ Browser::CreateParams params(Browser::TYPE_NORMAL, profile(), /*user_gesture=*/false); Browser* browser = Browser::Create(params); + // Create a new tab and make sure the urls have loaded. for (int i = 0; i < urls.size(); i++) { + content::TestNavigationObserver navigation_observer(urls[i]); + navigation_observer.StartWatchingNewWebContents(); chrome::AddTabAt( browser, urls[i], /*index=*/-1, /*foreground=*/!active_url_index || active_url_index.value() == i); + navigation_observer.Wait(); } browser->window()->Show(); return browser; @@ -677,6 +683,9 @@ // Set the template we created as the template we want to launch. SetAndLaunchTemplate(std::move(desk_template)); + // Wait for the tabs to load. + content::RunAllTasksUntilIdle(); + // Verify that the browser was launched with the correct urls and active tab. Browser* new_browser = FindBrowser(browser_window_id); ASSERT_TRUE(new_browser); @@ -974,6 +983,9 @@ // Tests that basic operations using the native UI work as expected. IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, NativeUIBasic) { + auto* desk_model = DesksTemplatesClient::Get()->GetDeskModel(); + ASSERT_EQ(0, desk_model->GetEntryCount()); + ash::ToggleOverview(); ash::WaitForOverviewEnterAnimation(); @@ -991,22 +1003,95 @@ ASSERT_TRUE(save_desk_as_template_button); ClickButton(save_desk_as_template_button); - // TODO(sophiewen): The desks templates button doesn't show up currently - // after saving a desk. Leave and reenter overview for now. - ash::ToggleOverview(); - ash::WaitForOverviewExitAnimation(); + ash::WaitForDesksTemplatesUI(); + + EXPECT_EQ(1, desk_model->GetEntryCount()); + + // Tests that since we have one template right now, so that the expanded state + // desk button is shown, and the desk templates grid has one item. + auto* expanded_state_templates_button = + ash::GetExpandedStateDesksTemplatesButton(); + ASSERT_TRUE(expanded_state_templates_button); + EXPECT_TRUE(expanded_state_templates_button->GetVisible()); + + views::Button* template_item = ash::GetTemplateItemButton(/*index=*/0); + EXPECT_TRUE(template_item); +} + +// Tests launching a template with a browser window. +IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, NativeUILaunchBrowser) { + // Create a new browser and add a few tabs to it, and specify the active tab + // index. + const int browser_active_index = 1; + Browser* browser = CreateBrowser( + {GURL(kExampleUrl1), GURL(kExampleUrl2), GURL(kExampleUrl3)}, + /*active_url_index=*/browser_active_index); + + // Verify that the active tab is correct. + EXPECT_EQ(browser_active_index, browser->tab_strip_model()->active_index()); + + aura::Window* window = browser->window()->GetNativeWindow(); + const int32_t browser_window_id = + window->GetProperty(app_restore::kWindowIdKey); + // Get current tabs from browser. + const std::vector<GURL> urls = GetURLsForBrowserWindow(browser); + + // There are two browser windows currently, the default one and the one we + // just created. + ASSERT_EQ(2u, BrowserList::GetInstance()->size()); + + // Enter overview and save the current desk as a template. ash::ToggleOverview(); ash::WaitForOverviewEnterAnimation(); + views::Button* save_desk_as_template_button = + ash::GetSaveDeskAsTemplateButton(); + ASSERT_TRUE(save_desk_as_template_button); + ClickButton(save_desk_as_template_button); - // Tests that since we have one template right now, so the desks templates - // button is shown. - zero_state_templates_button = ash::GetZeroStateDesksTemplatesButton(); - ASSERT_TRUE(zero_state_templates_button); - EXPECT_TRUE(zero_state_templates_button->GetVisible()); + ash::WaitForDesksTemplatesUI(); - // TODO(richui): Add tests for launching and deleting. + views::Button* template_item = ash::GetTemplateItemButton(/*index=*/0); + ASSERT_TRUE(template_item); + ClickButton(template_item); + + // TODO(sammiequon): Investigate a better wait here after the new desk from + // template behavior is finalized and implemented. + base::RunLoop run_loop; + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( + FROM_HERE, run_loop.QuitClosure(), base::Seconds(1)); + run_loop.Run(); + + // Wait for the tabs to load. + content::RunAllTasksUntilIdle(); + + // There are a total of four browser windows now. The two initial ones and the + // two created from our template. + EXPECT_EQ(4u, BrowserList::GetInstance()->size()); + + // Test that the created browser has the same tabs and the same active tab. + Browser* new_browser = FindBrowser(browser_window_id); + ASSERT_TRUE(new_browser); + EXPECT_EQ(urls, GetURLsForBrowserWindow(new_browser)); + EXPECT_EQ(browser_active_index, + new_browser->tab_strip_model()->active_index()); + + // Verify that the browser window has been launched on the new desk (desk B). + EXPECT_EQ(1, ash::DesksController::Get()->GetActiveDeskIndex()); + aura::Window* browser_window = new_browser->window()->GetNativeWindow(); + ASSERT_TRUE(browser_window); + EXPECT_EQ(ash::Shell::GetContainer(browser_window->GetRootWindow(), + ash::kShellWindowId_DeskContainerB), + browser_window->parent()); } +// TODO(crbug.com/1273532): Add more tests: +// - Deleting templates. +// - Launching templates with uninstalled apps. +// - Launching ARC apps. +// - Port tests that use `DesksTemplatesClient` directly. These were meant to +// test launching while the prototype extension was being built, but now we +// can do end to end tests with the native UI. + class DesksTemplatesClientMultiProfileTest : public ash::LoginManagerTest { public: DesksTemplatesClientMultiProfileTest() : ash::LoginManagerTest() {
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_client_impl_browsertest.cc b/chrome/browser/ui/ash/holding_space/holding_space_client_impl_browsertest.cc index 73984e9..5db273a9 100644 --- a/chrome/browser/ui/ash/holding_space/holding_space_client_impl_browsertest.cc +++ b/chrome/browser/ui/ash/holding_space/holding_space_client_impl_browsertest.cc
@@ -6,6 +6,7 @@ #include <string> +#include "ash/constants/ash_features.h" #include "ash/public/cpp/holding_space/holding_space_controller.h" #include "ash/public/cpp/holding_space/holding_space_image.h" #include "ash/public/cpp/holding_space/holding_space_item.h" @@ -192,6 +193,11 @@ auto* holding_space_client = HoldingSpaceController::Get()->client(); ASSERT_TRUE(holding_space_client); + if (ash::features::IsFileManagerSwaEnabled()) { + // OpenItems() depends on the Files app. Install the Files SWA. + WaitForTestSystemAppInstall(); + } + // Verify no failures have yet been recorded. base::HistogramTester histogram_tester; histogram_tester.ExpectTotalCount("HoldingSpace.Item.FailureToLaunch", 0);
diff --git a/chrome/browser/ui/breadcrumb_manager_browser_agent.cc b/chrome/browser/ui/breadcrumb_manager_browser_agent.cc new file mode 100644 index 0000000..df6919e5 --- /dev/null +++ b/chrome/browser/ui/breadcrumb_manager_browser_agent.cc
@@ -0,0 +1,94 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/breadcrumb_manager_browser_agent.h" + +#include "chrome/browser/breadcrumbs/breadcrumb_manager_keyed_service_factory.h" +#include "chrome/browser/breadcrumbs/breadcrumb_manager_tab_helper.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/browser.h" +#include "components/breadcrumbs/core/breadcrumb_manager_keyed_service.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace { + +int GetTabId(const content::WebContents* const web_contents) { + const BreadcrumbManagerTabHelper* const tab_helper = + BreadcrumbManagerTabHelper::FromWebContents(web_contents); + DCHECK(tab_helper); + return tab_helper->GetUniqueId(); +} + +} // namespace + +BreadcrumbManagerBrowserAgent::BreadcrumbManagerBrowserAgent(Browser* browser) + : browser_(browser) { + browser_->tab_strip_model()->AddObserver(this); +} + +BreadcrumbManagerBrowserAgent::~BreadcrumbManagerBrowserAgent() { + browser_->tab_strip_model()->RemoveObserver(this); +} + +void BreadcrumbManagerBrowserAgent::PlatformLogEvent(const std::string& event) { + BreadcrumbManagerKeyedServiceFactory::GetForBrowserContext( + browser_->profile()) + ->AddEvent(event); +} + +void BreadcrumbManagerBrowserAgent::OnTabStripModelChanged( + TabStripModel* tab_strip_model, + const TabStripModelChange& change, + const TabStripSelectionChange& selection) { + switch (change.type()) { + case TabStripModelChange::kInserted: { + const auto& inserted_tabs = change.GetInsert()->contents; + const int num_inserted_tabs = inserted_tabs.size(); + if (num_inserted_tabs == 1) { + LogTabInsertedAt(GetTabId(inserted_tabs[0].contents), + inserted_tabs[0].index, + selection.active_tab_changed()); + } else { + LogTabsInserted(num_inserted_tabs); + } + return; + } + case TabStripModelChange::kRemoved: { + const auto& closed_tabs = change.GetRemove()->contents; + const int num_closed_tabs = closed_tabs.size(); + if (num_closed_tabs == 1) { + LogTabClosedAt(GetTabId(closed_tabs[0].contents), closed_tabs[0].index); + } else { + LogTabsClosed(num_closed_tabs); + } + return; + } + case TabStripModelChange::kMoved: { + const auto* const move = change.GetMove(); + LogTabMoved(GetTabId(move->contents), move->from_index, move->to_index); + return; + } + case TabStripModelChange::kReplaced: { + const auto* const replace = change.GetReplace(); + LogTabReplaced(GetTabId(replace->old_contents), + GetTabId(replace->new_contents), replace->index); + return; + } + case TabStripModelChange::kSelectionOnly: { + if (selection.active_tab_changed()) { + absl::optional<int> old_tab_id = + selection.old_contents + ? absl::optional<int>(GetTabId(selection.old_contents)) + : absl::nullopt; + absl::optional<int> new_tab_id = + selection.new_contents + ? absl::optional<int>(GetTabId(selection.new_contents)) + : absl::nullopt; + LogActiveTabChanged(old_tab_id, new_tab_id, + selection.new_model.active()); + } + return; + } + } +}
diff --git a/chrome/browser/ui/breadcrumb_manager_browser_agent.h b/chrome/browser/ui/breadcrumb_manager_browser_agent.h new file mode 100644 index 0000000..15436d0 --- /dev/null +++ b/chrome/browser/ui/breadcrumb_manager_browser_agent.h
@@ -0,0 +1,43 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_BREADCRUMB_MANAGER_BROWSER_AGENT_H_ +#define CHROME_BROWSER_UI_BREADCRUMB_MANAGER_BROWSER_AGENT_H_ + +#include <string> + +#include "chrome/browser/ui/tabs/tab_strip_model_observer.h" +#include "components/breadcrumbs/core/breadcrumb_manager_browser_agent.h" + +class Browser; +class TabStripModel; +class TabStripModelChange; +struct TabStripSelectionChange; + +class BreadcrumbManagerBrowserAgent + : public breadcrumbs::BreadcrumbManagerBrowserAgent, + public TabStripModelObserver { + public: + explicit BreadcrumbManagerBrowserAgent(Browser* browser); + BreadcrumbManagerBrowserAgent(const BreadcrumbManagerBrowserAgent&) = delete; + BreadcrumbManagerBrowserAgent& operator=( + const BreadcrumbManagerBrowserAgent&) = delete; + ~BreadcrumbManagerBrowserAgent() override; + + private: + // breadcrumbs::BreadcrumbManagerBrowserAgent: + void PlatformLogEvent(const std::string& event) override; + + // TabStripModelObserver: + void OnTabStripModelChanged( + TabStripModel* tab_strip_model, + const TabStripModelChange& change, + const TabStripSelectionChange& selection) override; + + // The browser whose tab strip this agent observes. Can't be nullptr because + // |browser_| owns this object. + Browser* browser_; +}; + +#endif // CHROME_BROWSER_UI_BREADCRUMB_MANAGER_BROWSER_AGENT_H_
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 05435a3f..5ae65ab 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc
@@ -98,6 +98,7 @@ #include "chrome/browser/ui/blocked_content/framebust_block_tab_helper.h" #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" #include "chrome/browser/ui/bookmarks/bookmark_utils.h" +#include "chrome/browser/ui/breadcrumb_manager_browser_agent.h" #include "chrome/browser/ui/browser_command_controller.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" @@ -161,6 +162,7 @@ #include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/browser/bookmark_utils.h" #include "components/bookmarks/common/bookmark_pref_names.h" +#include "components/breadcrumbs/core/features.h" #include "components/captive_portal/core/buildflags.h" #include "components/content_settings/browser/page_specific_content_settings.h" #include "components/content_settings/core/browser/host_content_settings_map.h" @@ -479,7 +481,11 @@ command_controller_(new chrome::BrowserCommandController(this)), window_has_shown_(false), user_title_(params.user_title), - signin_view_controller_(this) + signin_view_controller_(this), + breadcrumb_manager_browser_agent_( + base::FeatureList::IsEnabled(breadcrumbs::kLogBreadcrumbs) + ? std::make_unique<BreadcrumbManagerBrowserAgent>(this) + : nullptr) #if BUILDFLAG(ENABLE_EXTENSIONS) , extension_browser_window_helper_(
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 475ad86e..3c4525ae 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h
@@ -50,6 +50,7 @@ #endif class BackgroundContents; +class BreadcrumbManagerBrowserAgent; class BrowserContentSettingBubbleModelDelegate; class BrowserInstantController; class BrowserSyncedWindowDelegate; @@ -1235,6 +1236,10 @@ // Controls both signin and sync consent. SigninViewController signin_view_controller_; + // Listens for browser-related breadcrumb events to be added to crash reports. + std::unique_ptr<BreadcrumbManagerBrowserAgent> + breadcrumb_manager_browser_agent_; + std::unique_ptr<ScopedKeepAlive> keep_alive_; WarnBeforeClosingCallback warn_before_closing_callback_;
diff --git a/chrome/browser/ui/views/DEPS b/chrome/browser/ui/views/DEPS index 640070d..31fd86c 100644 --- a/chrome/browser/ui/views/DEPS +++ b/chrome/browser/ui/views/DEPS
@@ -8,6 +8,10 @@ ] specific_include_rules = { + "authenticator_qr_sheet_view\.*": [ + "+chrome/services/qrcode_generator/public/cpp/qrcode_generator_service.h", + "+chrome/services/qrcode_generator/public/mojom/qrcode_generator.mojom.h", + ], "chrome_views_delegate_chromeos\.cc": [ "+ash/shell.h", ],
diff --git a/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.cc b/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.cc index a21b40092..573639a8 100644 --- a/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.cc +++ b/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.cc
@@ -4,194 +4,30 @@ #include "chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.h" -#include "base/base64url.h" -#include "base/memory/raw_ptr.h" -#include "base/rand_util.h" -#include "base/strings/string_piece.h" -#include "components/qr_code_generator/dino_image.h" -#include "components/qr_code_generator/qr_code_generator.h" +#include "base/bind.h" +#include "base/callback.h" +#include "chrome/services/qrcode_generator/public/cpp/qrcode_generator_service.h" +#include "chrome/services/qrcode_generator/public/mojom/qrcode_generator.mojom.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/metadata/metadata_impl_macros.h" -#include "ui/gfx/canvas.h" +#include "ui/gfx/image/image_skia.h" +#include "ui/views/background.h" +#include "ui/views/controls/image_view.h" #include "ui/views/layout/box_layout.h" +#include "ui/views/layout/layout_provider.h" #include "ui/views/view.h" -using QRCode = QRCodeGenerator; - namespace { -// kMinimumQRVersion is the minimum QR version (i.e. size) that we support. -// The amount of input already precludes smaller versions with the current -// encoder but it's possible that a low-ECC configuration could be added that -// would otherwise cause a smaller version to be used. This minimum ensures -// that the UI sizing remains constant and that the dino image doesn't -// obscure too much of the QR code -constexpr int kMinimumQRVersion = 5; +constexpr int kQrCodeMargin = 40; +constexpr int kQrCodeImageSize = 240; -// QRView displays a QR code. -class QRView : public views::View { - public: - METADATA_HEADER(QRView); - - // kTilePixels is the height and width, in pixels, of a single tile from the - // QR code. - static constexpr int kTilePixels = 10; - // kDinoTilePixels is the height and width, in pixels, of a single bit from - // the dino image. - static constexpr int kDinoTilePixels = 3; - // kMid is the pixel offset from the top (or left) to the middle of the - // displayed QR code. - static constexpr int kMid = (kTilePixels * (2 + QRCode::V5::kSize + 2)) / 2; - // kDinoX is the x-coordinate of the dino image. - static constexpr int kDinoX = - kMid - (dino_image::kDinoWidth * kDinoTilePixels) / 2; - // kDinoY is the y-coordinate of the dino image. - static constexpr int kDinoY = - kMid - (dino_image::kDinoHeight * kDinoTilePixels) / 2; - - explicit QRView(const std::string& qr_string) { - absl::optional<QRCode::GeneratedCode> code = qr_.Generate( - base::as_bytes(base::make_span(qr_string)), kMinimumQRVersion); - DCHECK(code); - // The QR Encoder supports dynamic sizing but we expect our data to fit in - // a version five code. - CHECK_EQ(code->qr_size, QRCode::V5::kSize); - qr_tiles_ = code->data; - } - - QRView(const QRView&) = delete; - QRView& operator=(const QRView&) = delete; - ~QRView() override = default; - - void RefreshQRCode(const std::string& qr_string) { - state_ = (state_ + 1) % 6; - absl::optional<QRCode::GeneratedCode> code = - qr_.Generate(base::as_bytes(base::make_span(qr_string)), - kMinimumQRVersion, /*mask=*/state_); - DCHECK(code); - CHECK_EQ(code->qr_size, QRCode::V5::kSize); - qr_tiles_ = code->data; - SchedulePaint(); - } - - // View: - gfx::Size CalculatePreferredSize() const override { - // A two-tile border is required around the QR code. - return gfx::Size((2 + QRCode::V5::kSize + 2) * kTilePixels, - (2 + QRCode::V5::kSize + 2) * kTilePixels); - } - - void OnPaint(gfx::Canvas* canvas) override { - const SkColor off = SkColorSetARGB(0xff, 0xff, 0xff, 0xff); - - // kV is the intensity of the colors in the QR code. - constexpr uint8_t kV = 0x70; - SkColor on; - switch (state_) { - case 0: - on = SkColorSetARGB(0xff, kV, 0, 0); - break; - case 1: - on = SkColorSetARGB(0xff, 0, kV, 0); - break; - case 2: - on = SkColorSetARGB(0xff, 0, 0, kV); - break; - case 3: - on = SkColorSetARGB(0xff, kV, kV, 0); - break; - case 4: - on = SkColorSetARGB(0xff, kV, 0, kV); - break; - case 5: - on = SkColorSetARGB(0xff, 0, kV, kV); - break; - } - - // Draw the two-tile border around the edge. - // Top. - canvas->FillRect(gfx::Rect(0, 0, (2 + QRCode::V5::kSize + 2) * kTilePixels, - 2 * kTilePixels), - off); - // Bottom. - canvas->FillRect( - gfx::Rect(0, (2 + QRCode::V5::kSize) * kTilePixels, - (2 + QRCode::V5::kSize + 2) * kTilePixels, 2 * kTilePixels), - off); - // Left - canvas->FillRect(gfx::Rect(0, 2 * kTilePixels, 2 * kTilePixels, - QRCode::V5::kSize * kTilePixels), - off); - // Right - canvas->FillRect( - gfx::Rect((2 + QRCode::V5::kSize) * kTilePixels, 2 * kTilePixels, - 2 * kTilePixels, QRCode::V5::kSize * kTilePixels), - off); - - // Paint the QR code. - int index = 0; - for (int y = 0; y < QRCode::V5::kSize; y++) { - for (int x = 0; x < QRCode::V5::kSize; x++) { - SkColor tile_color = qr_tiles_[index++] & 1 ? on : off; - canvas->FillRect(gfx::Rect((x + 2) * kTilePixels, (y + 2) * kTilePixels, - kTilePixels, kTilePixels), - tile_color); - } - } - - PaintDinoSegment( - canvas, - (state_ & 1) ? dino_image::kDinoHeadLeft : dino_image::kDinoHeadRight, - dino_image::kDinoHeadHeight, 0); - PaintDinoSegment(canvas, dino_image::kDinoBody, - dino_image::kDinoHeight - dino_image::kDinoHeadHeight, - dino_image::kDinoHeadHeight); - } - - private: - void PaintDinoSegment(gfx::Canvas* canvas, - const uint8_t* data, - const int rows, - const int y_offset) { - const SkColor color = SkColorSetARGB(0xff, 0x00, 0x00, 0x00); - - for (int y = 0; y < rows; y++) { - uint8_t current_byte; - int bits = 0; - - for (int x = 0; x < dino_image::kDinoWidth; x++) { - if (bits == 0) { - current_byte = *data++; - bits = 8; - } - const bool is_set = (current_byte & 128) != 0; - current_byte <<= 1; - bits--; - - if (is_set) { - canvas->FillRect(gfx::Rect(kDinoX + x * kDinoTilePixels, - kDinoY + (y + y_offset) * kDinoTilePixels, - kDinoTilePixels, kDinoTilePixels), - color); - } - } - } - } - - QRCode qr_; - base::span<const uint8_t> qr_tiles_; - int state_ = 0; -}; - -BEGIN_METADATA(QRView, views::View) -END_METADATA - -} // anonymous namespace +} // namespace class AuthenticatorQRViewCentered : public views::View { public: METADATA_HEADER(AuthenticatorQRViewCentered); - explicit AuthenticatorQRViewCentered(const std::string& qr_data) { + explicit AuthenticatorQRViewCentered(const std::string& qr_string) { views::BoxLayout* layout = SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kHorizontal)); @@ -199,15 +35,72 @@ views::BoxLayout::MainAxisAlignment::kCenter); layout->set_cross_axis_alignment( views::BoxLayout::CrossAxisAlignment::kCenter); - qr_view_ = new QRView(qr_data); - AddChildView(qr_view_.get()); + const int border_radius = + views::LayoutProvider::Get()->GetCornerRadiusMetric( + views::Emphasis::kHigh); + qr_code_image_ = AddChildViewAt(std::make_unique<views::ImageView>(), 0); + qr_code_image_->SetBorder(views::CreateRoundedRectBorder( + /*thickness=*/2, border_radius, gfx::kGoogleGrey200)); + qr_code_image_->SetHorizontalAlignment( + views::ImageView::Alignment::kCenter); + qr_code_image_->SetVerticalAlignment(views::ImageView::Alignment::kCenter); + qr_code_image_->SetImageSize(qrCodeImageSize()); + qr_code_image_->SetPreferredSize(qrCodeImageSize() + + gfx::Size(kQrCodeMargin, kQrCodeMargin)); + qr_code_image_->SetBackground( + views::CreateRoundedRectBackground(SK_ColorWHITE, border_radius)); + + qrcode_generator::mojom::GenerateQRCodeRequestPtr request = + qrcode_generator::mojom::GenerateQRCodeRequest::New(); + request->data = qr_string; + request->should_render = true; + request->render_dino = true; + request->render_module_style = + qrcode_generator::mojom::ModuleStyle::CIRCLES; + request->render_locator_style = + qrcode_generator::mojom::LocatorStyle::DEFAULT_SQUARE; + + // Deleting the view will close the channel so base::Unretained is safe + // here. + auto callback = + base::BindOnce(&AuthenticatorQRViewCentered::OnQrCodeGenerated, + base::Unretained(this)); + qr_code_service()->GenerateQRCode(std::move(request), std::move(callback)); } - void RefreshQRCode(const std::string& new_qr_data) { - qr_view_->RefreshQRCode(new_qr_data); + ~AuthenticatorQRViewCentered() override = default; + + AuthenticatorQRViewCentered(const AuthenticatorQRViewCentered&) = delete; + AuthenticatorQRViewCentered& operator=(const AuthenticatorQRViewCentered&) = + delete; + + private: + qrcode_generator::mojom::QRCodeGeneratorService* qr_code_service() { + if (!qr_code_service_remote_) + qr_code_service_remote_ = + qrcode_generator::LaunchQRCodeGeneratorService(); + return qr_code_service_remote_.get(); } - raw_ptr<QRView> qr_view_; + gfx::Size qrCodeImageSize() const { + return gfx::Size(kQrCodeImageSize, kQrCodeImageSize); + } + + void OnQrCodeGenerated( + const qrcode_generator::mojom::GenerateQRCodeResponsePtr response) { + DCHECK(response->error_code == + qrcode_generator::mojom::QRCodeGeneratorError::NONE); + qr_code_image_->SetImage( + gfx::ImageSkia::CreateFrom1xBitmap(response->bitmap)); + qr_code_image_->SetVisible(true); + } + + std::string qr_string_; + views::ImageView* qr_code_image_; + + // Service instance for QR code image generation. + mojo::Remote<qrcode_generator::mojom::QRCodeGeneratorService> + qr_code_service_remote_; }; BEGIN_METADATA(AuthenticatorQRViewCentered, views::View) @@ -228,11 +121,5 @@ auto qr_view = std::make_unique<AuthenticatorQRViewCentered>(qr_string_); qr_view_ = qr_view.get(); - timer_.Start(FROM_HERE, base::Milliseconds(600), this, - &AuthenticatorQRSheetView::Update); return std::make_pair(std::move(qr_view), AutoFocus::kYes); } - -void AuthenticatorQRSheetView::Update() { - qr_view_->RefreshQRCode(qr_string_); -}
diff --git a/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.h b/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.h index 7a351a6..7288837f 100644 --- a/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.h +++ b/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.h
@@ -7,9 +7,7 @@ #include <memory> -#include "base/containers/span.h" #include "base/memory/raw_ptr.h" -#include "base/timer/timer.h" #include "chrome/browser/ui/views/webauthn/authenticator_request_sheet_view.h" #include "chrome/browser/ui/webauthn/sheet_models.h" @@ -25,18 +23,13 @@ ~AuthenticatorQRSheetView() override; - // RefreshQRCode causes a fresh QR code to be painted. - void RefreshQRCode(base::span<const uint8_t> new_qr_data); - private: // AuthenticatorRequestSheetView: std::pair<std::unique_ptr<views::View>, AutoFocus> BuildStepSpecificContent() override; - void Update(); raw_ptr<AuthenticatorQRViewCentered> qr_view_ = nullptr; const std::string qr_string_; - base::RepeatingTimer timer_; }; #endif // CHROME_BROWSER_UI_VIEWS_WEBAUTHN_AUTHENTICATOR_QR_SHEET_VIEW_H_
diff --git a/chrome/browser/ui/web_applications/test/web_app_browsertest_util.cc b/chrome/browser/ui/web_applications/test/web_app_browsertest_util.cc index ef5e9cf0..b8e20f7 100644 --- a/chrome/browser/ui/web_applications/test/web_app_browsertest_util.cc +++ b/chrome/browser/ui/web_applications/test/web_app_browsertest_util.cc
@@ -376,4 +376,19 @@ removed_run_loop_.Quit(); } +UpdateAwaiter::UpdateAwaiter(WebAppRegistrar& registrar) { + scoped_observation_.Observe(®istrar); +} + +UpdateAwaiter::~UpdateAwaiter() = default; + +void UpdateAwaiter::AwaitUpdate() { + run_loop_.Run(); +} + +void UpdateAwaiter::OnWebAppManifestUpdated(const AppId& app_id, + base::StringPiece old_name) { + run_loop_.Quit(); +} + } // namespace web_app
diff --git a/chrome/browser/ui/web_applications/test/web_app_browsertest_util.h b/chrome/browser/ui/web_applications/test/web_app_browsertest_util.h index 87f81910..a0f38cc 100644 --- a/chrome/browser/ui/web_applications/test/web_app_browsertest_util.h +++ b/chrome/browser/ui/web_applications/test/web_app_browsertest_util.h
@@ -6,8 +6,11 @@ #define CHROME_BROWSER_UI_WEB_APPLICATIONS_TEST_WEB_APP_BROWSERTEST_UTIL_H_ #include "base/memory/raw_ptr.h" +#include "base/scoped_observation.h" #include "chrome/browser/ui/browser_list_observer.h" +#include "chrome/browser/web_applications/app_registrar_observer.h" #include "chrome/browser/web_applications/web_app_id.h" +#include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/browser/web_applications/web_application_info.h" #include "url/gurl.h" @@ -110,6 +113,22 @@ raw_ptr<Browser> removed_browser_ = nullptr; }; +class UpdateAwaiter : public AppRegistrarObserver { + public: + explicit UpdateAwaiter(WebAppRegistrar& registrar); + ~UpdateAwaiter() override; + void AwaitUpdate(); + + // AppRegistrarObserver: + void OnWebAppManifestUpdated(const AppId& app_id, + base::StringPiece old_name) override; + + private: + base::RunLoop run_loop_; + base::ScopedObservation<WebAppRegistrar, AppRegistrarObserver> + scoped_observation_{this}; +}; + } // namespace web_app #endif // CHROME_BROWSER_UI_WEB_APPLICATIONS_TEST_WEB_APP_BROWSERTEST_UTIL_H_
diff --git a/chrome/browser/ui/web_applications/web_app_launch_handler_browsertest.cc b/chrome/browser/ui/web_applications/web_app_launch_handler_browsertest.cc index e5f2a30..98997a15 100644 --- a/chrome/browser/ui/web_applications/web_app_launch_handler_browsertest.cc +++ b/chrome/browser/ui/web_applications/web_app_launch_handler_browsertest.cc
@@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/test/bind.h" #include "base/test/scoped_feature_list.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" @@ -10,15 +11,18 @@ #include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h" +#include "chrome/browser/web_applications/manifest_update_task.h" #include "chrome/browser/web_applications/os_integration_manager.h" #include "chrome/browser/web_applications/test/web_app_install_test_utils.h" #include "chrome/browser/web_applications/web_app.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/test/base/in_process_browser_test.h" +#include "components/embedder_support/switches.h" #include "components/page_load_metrics/browser/page_load_metrics_test_waiter.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/url_loader_interceptor.h" #include "third_party/blink/public/common/features.h" #include "ui/base/page_transition_types.h" @@ -325,4 +329,133 @@ EXPECT_FALSE(EvalJs(web_contents, "!!window.LaunchParams").ExtractBool()); } +class WebAppLaunchHandlerOriginTrialBrowserTest : public InProcessBrowserTest { + public: + WebAppLaunchHandlerOriginTrialBrowserTest() { + feature_list_.InitAndDisableFeature( + blink::features::kWebAppEnableLaunchHandler); + } + ~WebAppLaunchHandlerOriginTrialBrowserTest() override = default; + + // InProcessBrowserTest: + void SetUpCommandLine(base::CommandLine* command_line) override { + // Using the test public key from docs/origin_trials_integration.md#Testing. + command_line->AppendSwitchASCII( + embedder_support::kOriginTrialPublicKey, + "dRCs+TocuKkocNKa0AtZ4awrt9XKH2SQCI6o4FY6BNA="); + } + void SetUpOnMainThread() override { + InProcessBrowserTest::SetUpOnMainThread(); + web_app::test::WaitUntilReady( + web_app::WebAppProvider::GetForTest(browser()->profile())); + } + + private: + base::test::ScopedFeatureList feature_list_; + ScopedOsHooksSuppress os_hooks_suppress_{ + OsIntegrationManager::ScopedSuppressOsHooksForTesting()}; +}; +namespace { + +// InstallableManager requires https or localhost to load the manifest. Go with +// localhost to avoid having to set up cert servers. +constexpr char kTestWebAppUrl[] = "http://127.0.0.1:8000/"; +constexpr char kTestWebAppHeaders[] = + "HTTP/1.1 200 OK\nContent-Type: text/html; charset=utf-8\n"; +constexpr char kTestWebAppBody[] = R"( + <!DOCTYPE html> + <head> + <link rel="manifest" href="manifest.webmanifest"> + <meta http-equiv="origin-trial" content="$1"> + </head> +)"; + +constexpr char kTestIconUrl[] = "http://127.0.0.1:8000/icon.png"; +constexpr char kTestManifestUrl[] = + "http://127.0.0.1:8000/manifest.webmanifest"; +constexpr char kTestManifestHeaders[] = + "HTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\n"; +constexpr char kTestManifestBody[] = R"({ + "name": "Test app", + "display": "standalone", + "start_url": "/", + "scope": "/", + "icons": [{ + "src": "icon.png", + "sizes": "192x192", + "type": "image/png" + }], + "launch_handler": { + "route_to": "existing-client", + "navigate_existing_client": "never" + } +})"; + +// Generated from script: +// $ tools/origin_trials/generate_token.py http://127.0.0.1:8000 "Launch +// Handler" --expire-timestamp=2000000000 +constexpr char kOriginTrialToken[] = + "A12ynArMVnf0OepZoKB23txoJ/" + "jicU25In+" + "UseVdaSziSYtPMfobhyEhFdVasQ90uo4LMf2G6AIyRFxALB4oQgEAAABWeyJvcmlnaW4iOiAia" + "HR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiTGF1bmNoIEhhbmRsZXIiLCAiZXh" + "waXJ5IjogMjAwMDAwMDAwMH0="; + +} // namespace + +IN_PROC_BROWSER_TEST_F(WebAppLaunchHandlerOriginTrialBrowserTest, OriginTrial) { + ManifestUpdateTask::BypassWindowCloseWaitingForTesting() = true; + + bool serve_token = true; + content::URLLoaderInterceptor interceptor(base::BindLambdaForTesting( + [&serve_token]( + content::URLLoaderInterceptor::RequestParams* params) -> bool { + if (params->url_request.url.spec() == kTestWebAppUrl) { + content::URLLoaderInterceptor::WriteResponse( + kTestWebAppHeaders, + base::ReplaceStringPlaceholders( + kTestWebAppBody, {serve_token ? kOriginTrialToken : ""}, + nullptr), + params->client.get()); + return true; + } + if (params->url_request.url.spec() == kTestManifestUrl) { + content::URLLoaderInterceptor::WriteResponse( + kTestManifestHeaders, kTestManifestBody, params->client.get()); + return true; + } + if (params->url_request.url.spec() == kTestIconUrl) { + content::URLLoaderInterceptor::WriteResponse( + "chrome/test/data/web_apps/basic-192.png", params->client.get()); + return true; + } + return false; + })); + + // Install web app with origin trial token. + AppId app_id = + web_app::InstallWebAppFromPage(browser(), GURL(kTestWebAppUrl)); + + // Origin trial should grant the app access. + WebAppProvider& provider = *WebAppProvider::GetForTest(browser()->profile()); + EXPECT_EQ(provider.registrar().GetAppById(app_id)->launch_handler(), + (LaunchHandler{LaunchHandler::RouteTo::kExistingClient, + LaunchHandler::NavigateExistingClient::kNever})); + + // Open the page again with the token missing. + { + UpdateAwaiter update_awaiter(provider.registrar()); + + serve_token = false; + NavigateToURLAndWait(browser(), GURL(kTestWebAppUrl)); + + update_awaiter.AwaitUpdate(); + } + + // The app should update to no longer have launch_handler defined without the + // origin trial. + EXPECT_EQ(provider.registrar().GetAppById(app_id)->launch_handler(), + absl::nullopt); +} + } // namespace web_app
diff --git a/chrome/browser/ui/webui/welcome/DEPS b/chrome/browser/ui/webui/welcome/DEPS index cbcb3569..ee4e34b 100644 --- a/chrome/browser/ui/webui/welcome/DEPS +++ b/chrome/browser/ui/webui/welcome/DEPS
@@ -5,5 +5,4 @@ "+components/prefs", "+components/favicon", "+content/public/browser", - "+ui/base", ]
diff --git a/chrome/browser/webshare/win/share_operation.cc b/chrome/browser/webshare/win/share_operation.cc index 2cb0b15..ec1738ad 100644 --- a/chrome/browser/webshare/win/share_operation.cc +++ b/chrome/browser/webshare/win/share_operation.cc
@@ -356,7 +356,7 @@ const GURL& url, std::vector<blink::mojom::SharedFilePtr> files, content::WebContents* web_contents) - : content::WebContentsObserver(web_contents), + : web_contents_(web_contents->GetWeakPtr()), title_(std::move(title)), text_(std::move(text)), url_(std::move(url)), @@ -384,7 +384,7 @@ // If the corresponding web_contents have already been cleaned up, cancel // the operation. - if (!web_contents()) { + if (!web_contents_) { Complete(blink::mojom::ShareError::CANCELED); return; } @@ -394,7 +394,7 @@ // If the source cannot be determined, does not appear to be valid, // or is longer than the max length supported by the IAttachmentExecute // service, use a generic value that reliably maps to the Internet zone. - GURL source_url = web_contents()->GetLastCommittedURL(); + GURL source_url = web_contents_->GetLastCommittedURL(); std::wstring source = (source_url.is_valid() && source_url.spec().size() <= INTERNET_MAX_URL_LENGTH) ? base::UTF8ToWide(source_url.spec()) @@ -434,7 +434,7 @@ // with the WebContents. HWND hwnd = nullptr; content::RenderWidgetHostView* host_view = - web_contents()->GetRenderWidgetHostView(); + web_contents_->GetRenderWidgetHostView(); if (host_view) { ui::AXPlatformNode* platform_node = ui::AXPlatformNode::FromNativeViewAccessible( @@ -451,8 +451,7 @@ // position as nicely. This is unexpected in most cases, but can happen if, // for example, Windows has explicitly destroyed said HWND. if (!hwnd) { - hwnd = - views::HWNDForNativeWindow(web_contents()->GetTopLevelNativeWindow()); + hwnd = views::HWNDForNativeWindow(web_contents_->GetTopLevelNativeWindow()); } show_share_ui_for_window_operation_ = @@ -465,7 +464,7 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); blink::mojom::ShareError share_result; - if (!web_contents()) { + if (!web_contents_) { share_result = blink::mojom::ShareError::CANCELED; } else if (PutShareContentInEventArgs(event_args)) { share_result = blink::mojom::ShareError::OK; @@ -572,7 +571,7 @@ // target app has finished fully processing the shared content this could // be updated to be owned/maintained by this ShareOperation instance. auto operation = base::MakeRefCounted<OutputStreamWriteOperation>( - web_contents()->GetBrowserContext()->GetBlobStorageContext(), + web_contents_->GetBrowserContext()->GetBlobStorageContext(), file_bytes_shared, file->blob->uuid); auto name_h = base::win::ScopedHString::Create(file->name); auto raw_data_requested_callback =
diff --git a/chrome/browser/webshare/win/share_operation.h b/chrome/browser/webshare/win/share_operation.h index e4fe937..7c85c3ac 100644 --- a/chrome/browser/webshare/win/share_operation.h +++ b/chrome/browser/webshare/win/share_operation.h
@@ -10,7 +10,6 @@ #include "base/memory/weak_ptr.h" #include "base/win/core_winrt_util.h" -#include "content/public/browser/web_contents_observer.h" #include "third_party/blink/public/mojom/webshare/webshare.mojom.h" #include "url/gurl.h" @@ -40,11 +39,15 @@ } // namespace win } // namespace base +namespace content { +class WebContents; +} // namespace content + namespace webshare { class ShowShareUIForWindowOperation; -class ShareOperation final : content::WebContentsObserver { +class ShareOperation final { public: static void SetMaxFileBytesForTesting(uint64_t max_file_bytes); @@ -59,7 +62,7 @@ content::WebContents* web_contents); ShareOperation(const ShareOperation&) = delete; ShareOperation& operator=(const ShareOperation&) = delete; - ~ShareOperation() final; + ~ShareOperation(); base::WeakPtr<ShareOperation> AsWeakPtr(); @@ -82,6 +85,7 @@ Microsoft::WRL::ComPtr<ABI::Windows::Storage::IStorageFile> storage_file); void Complete(const blink::mojom::ShareError share_error); + const base::WeakPtr<content::WebContents> web_contents_; const std::string title_; const std::string text_; const GURL url_;
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 1ec8cef5..dc61deb 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1638187072-b450ad1e8ee0d7f09f6ce94610f4e7c47d20e7aa.profdata +chrome-mac-main-1638208578-2704e860eca892b16af388ee2bea77450509589a.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index ebfee43b..50895a7 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1638197998-5dd69ba961935af86cd81a28b3a06c2dfdf5e460.profdata +chrome-win32-main-1638208578-49deee551295a9e9b223417245467eb4803d210f.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 94c1822..a2277ae1 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1638197998-ee5dc921d19358fe7a268d772324944bf2617f73.profdata +chrome-win64-main-1638208578-12a073a02d8a474ae516bdfdd552f36833e74799.profdata
diff --git a/chrome/gpu/DEPS b/chrome/gpu/DEPS index ce0b4c1..730f496 100644 --- a/chrome/gpu/DEPS +++ b/chrome/gpu/DEPS
@@ -1,4 +1,5 @@ include_rules = [ + "+ash/components/arc/mojom", "+ash/components/arc/video_accelerator", "+chromeos/components/cdm_factory_daemon", "+components/arc/mojom",
diff --git a/chrome/gpu/browser_exposed_gpu_interfaces.cc b/chrome/gpu/browser_exposed_gpu_interfaces.cc index 3443cda7..2dc44216 100644 --- a/chrome/gpu/browser_exposed_gpu_interfaces.cc +++ b/chrome/gpu/browser_exposed_gpu_interfaces.cc
@@ -14,12 +14,12 @@ #include "mojo/public/cpp/bindings/self_owned_receiver.h" #if BUILDFLAG(IS_CHROMEOS_ASH) +#include "ash/components/arc/mojom/protected_buffer_manager.mojom.h" #include "ash/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h" #include "ash/components/arc/video_accelerator/gpu_arc_video_encode_accelerator.h" #include "ash/components/arc/video_accelerator/gpu_arc_video_protected_buffer_allocator.h" #include "ash/components/arc/video_accelerator/protected_buffer_manager.h" #include "ash/components/arc/video_accelerator/protected_buffer_manager_proxy.h" -#include "components/arc/mojom/protected_buffer_manager.mojom.h" #include "components/arc/mojom/video_decode_accelerator.mojom.h" #include "components/arc/mojom/video_encode_accelerator.mojom.h" #include "components/arc/mojom/video_protected_buffer_allocator.mojom.h"
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 02f85e2..50a1f49 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -3270,6 +3270,8 @@ "../browser/ash/login/test/enrollment_helper_mixin.h", "../browser/ash/login/test/enrollment_ui_mixin.cc", "../browser/ash/login/test/enrollment_ui_mixin.h", + "../browser/ash/login/test/fake_arc_tos_mixin.cc", + "../browser/ash/login/test/fake_arc_tos_mixin.h", "../browser/ash/login/test/fake_eula_mixin.cc", "../browser/ash/login/test/fake_eula_mixin.h", "../browser/ash/login/test/guest_session_mixin.cc",
diff --git a/chrome/test/DEPS b/chrome/test/DEPS index 2ad359a..f6b6327 100644 --- a/chrome/test/DEPS +++ b/chrome/test/DEPS
@@ -97,5 +97,4 @@ "+third_party/blink/public", "+third_party/webrtc", "+third_party/re2", - "+ui/base", ]
diff --git a/chrome/test/data/webui/BUILD.gn b/chrome/test/data/webui/BUILD.gn index 3b24931..b60db9a 100644 --- a/chrome/test/data/webui/BUILD.gn +++ b/chrome/test/data/webui/BUILD.gn
@@ -616,6 +616,7 @@ ":build_web_ui_test_mojo_grdp", "bookmarks:build_grdp", "downloads:build_grdp", + "read_later:build_grdp", "settings:build_grdp", ] @@ -623,6 +624,7 @@ "$target_gen_dir/bookmarks/resources.grdp", "$target_gen_dir/chai_resources.grdp", "$target_gen_dir/downloads/resources.grdp", + "$target_gen_dir/read_later/resources.grdp", "$target_gen_dir/settings/resources.grdp", "$target_gen_dir/web_ui_test_mojo_resources.grdp", ]
diff --git a/chrome/test/data/webui/chromeos/firmware_update/update_card_test.js b/chrome/test/data/webui/chromeos/firmware_update/update_card_test.js index 04b193a..f0121514 100644 --- a/chrome/test/data/webui/chromeos/firmware_update/update_card_test.js +++ b/chrome/test/data/webui/chromeos/firmware_update/update_card_test.js
@@ -61,7 +61,8 @@ assertEquals( fakeFirmwareUpdate.deviceName, updateCardElement.$.name.innerText); assertEquals( - fakeFirmwareUpdate.version, updateCardElement.$.version.innerText); + `Version ${fakeFirmwareUpdate.version}`, + updateCardElement.$.version.innerText); assertEquals( fakeFirmwareUpdate.description, updateCardElement.$.description.innerText);
diff --git a/chrome/test/data/webui/chromeos/shimless_rma/fake_shimless_rma_service_test.js b/chrome/test/data/webui/chromeos/shimless_rma/fake_shimless_rma_service_test.js index 363d7c8a..e4f4adf 100644 --- a/chrome/test/data/webui/chromeos/shimless_rma/fake_shimless_rma_service_test.js +++ b/chrome/test/data/webui/chromeos/shimless_rma/fake_shimless_rma_service_test.js
@@ -4,7 +4,7 @@ import {fakeCalibrationComponents} from 'chrome://shimless-rma/fake_data.js'; import {FakeShimlessRmaService} from 'chrome://shimless-rma/fake_shimless_rma_service.js'; -import {CalibrationComponentStatus, CalibrationObserverRemote, CalibrationOverallStatus, CalibrationSetupInstruction, CalibrationStatus, ComponentRepairStatus, ComponentType, ErrorObserverRemote, FinalizationObserverRemote, FinalizationStatus, HardwareVerificationStatusObserverRemote, HardwareWriteProtectionStateObserverRemote, OsUpdateObserverRemote, OsUpdateOperation, PowerCableStateObserverRemote, ProvisioningObserverRemote, ProvisioningStatus, RmadErrorCode, RmaState, WriteProtectDisableCompleteState} from 'chrome://shimless-rma/shimless_rma_types.js'; +import {CalibrationComponentStatus, CalibrationObserverRemote, CalibrationOverallStatus, CalibrationSetupInstruction, CalibrationStatus, ComponentRepairStatus, ComponentType, ErrorObserverRemote, FinalizationObserverRemote, FinalizationStatus, HardwareVerificationStatusObserverRemote, HardwareWriteProtectionStateObserverRemote, OsUpdateObserverRemote, OsUpdateOperation, PowerCableStateObserverRemote, ProvisioningObserverRemote, ProvisioningStatus, RmadErrorCode, State, WriteProtectDisableCompleteState} from 'chrome://shimless-rma/shimless_rma_types.js'; import {assertDeepEquals, assertEquals, assertFalse, assertTrue} from '../../chai_assert.js'; @@ -23,7 +23,7 @@ test('GetCurrentStateDefaultRmaNotRequired', () => { return service.getCurrentState().then((state) => { - assertEquals(state.state, RmaState.kUnknown); + assertEquals(state.state, State.kUnknown); assertEquals(state.error, RmadErrorCode.kRmaNotRequired); }); }); @@ -31,7 +31,7 @@ test('GetCurrentStateWelcomeOk', () => { let states = [ { - state: RmaState.kWelcomeScreen, + state: State.kWelcomeScreen, canCancel: true, canGoBack: false, error: RmadErrorCode.kOk @@ -40,7 +40,7 @@ service.setStates(states); return service.getCurrentState().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertTrue(state.canCancel); assertFalse(state.canGoBack); assertEquals(state.error, RmadErrorCode.kOk); @@ -49,41 +49,41 @@ test('GetCurrentStateWelcomeError', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kMissingComponent}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kMissingComponent}, ]; service.setStates(states); return service.getCurrentState().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kMissingComponent); }); }); test('TransitionPreviousStateWelcomeOk', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); service.beginFinalization().then((state) => { - assertEquals(state.state, RmaState.kUpdateOs); + assertEquals(state.state, State.kUpdateOs); assertEquals(state.error, RmadErrorCode.kOk); }); return service.transitionPreviousState().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('TransitionPreviousStateWelcomeTransitionFailed', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.transitionPreviousState().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kTransitionFailed); }); }); @@ -132,150 +132,144 @@ test('UpdateOsSkippedOk', () => { let states = [ - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.updateOsSkipped().then((state) => { - assertEquals(state.state, RmaState.kChooseDestination); + assertEquals(state.state, State.kChooseDestination); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('UpdateOsSkippedWhenRmaNotRequired', () => { return service.updateOsSkipped().then((state) => { - assertEquals(state.state, RmaState.kUnknown); + assertEquals(state.state, State.kUnknown); assertEquals(state.error, RmadErrorCode.kRmaNotRequired); }); }); test('UpdateOsSkippedWrongStateFails', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.updateOsSkipped().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kRequestInvalid); }); }); test('SetSameOwnerOk', () => { let states = [ - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.setSameOwner().then((state) => { - assertEquals(state.state, RmaState.kUpdateOs); + assertEquals(state.state, State.kUpdateOs); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('SetSameOwnerWhenRmaNotRequired', () => { return service.setSameOwner().then((state) => { - assertEquals(state.state, RmaState.kUnknown); + assertEquals(state.state, State.kUnknown); assertEquals(state.error, RmadErrorCode.kRmaNotRequired); }); }); test('SetSameOwnerWrongStateFails', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.setSameOwner().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kRequestInvalid); }); }); test('SetDifferentOwnerOk', () => { let states = [ - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.setDifferentOwner().then((state) => { - assertEquals(state.state, RmaState.kUpdateOs); + assertEquals(state.state, State.kUpdateOs); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('SetDifferentOwnerWrongStateFails', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.setDifferentOwner().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kRequestInvalid); }); }); test('ChooseManuallyDisableWriteProtectOk', () => { let states = [ - { - state: RmaState.kChooseWriteProtectDisableMethod, - error: RmadErrorCode.kOk - }, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kChooseWriteProtectDisableMethod, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.chooseManuallyDisableWriteProtect().then((state) => { - assertEquals(state.state, RmaState.kUpdateOs); + assertEquals(state.state, State.kUpdateOs); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('ChooseManuallyDisableWriteProtectWrongStateFails', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.chooseManuallyDisableWriteProtect().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kRequestInvalid); }); }); test('ChooseRsuDisableWriteProtectOk', () => { let states = [ - { - state: RmaState.kChooseWriteProtectDisableMethod, - error: RmadErrorCode.kOk - }, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kChooseWriteProtectDisableMethod, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.chooseRsuDisableWriteProtect().then((state) => { - assertEquals(state.state, RmaState.kUpdateOs); + assertEquals(state.state, State.kUpdateOs); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('ChooseRsuDisableWriteProtectWrongStateFails', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.chooseRsuDisableWriteProtect().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kRequestInvalid); }); }); @@ -296,26 +290,26 @@ test('SetRsuDisableWriteProtectCodeOk', () => { let states = [ - {state: RmaState.kEnterRSUWPDisableCode, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kEnterRSUWPDisableCode, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.setRsuDisableWriteProtectCode('ignored').then((state) => { - assertEquals(state.state, RmaState.kUpdateOs); + assertEquals(state.state, State.kUpdateOs); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('SetRsuDisableWriteProtectCodeWrongStateFails', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.setRsuDisableWriteProtectCode('ignored').then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kRequestInvalid); }); }); @@ -351,13 +345,13 @@ }, ]; let states = [ - {state: RmaState.kSelectComponents, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kSelectComponents, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.setComponentList(components).then((state) => { - assertEquals(state.state, RmaState.kUpdateOs); + assertEquals(state.state, State.kUpdateOs); assertEquals(state.error, RmadErrorCode.kOk); }); }); @@ -370,39 +364,39 @@ }, ]; let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.setComponentList(components).then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kRequestInvalid); }); }); test('ReworkMainboardOk', () => { let states = [ - {state: RmaState.kSelectComponents, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kSelectComponents, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.reworkMainboard().then((state) => { - assertEquals(state.state, RmaState.kUpdateOs); + assertEquals(state.state, State.kUpdateOs); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('ReworkMainboardWrongStateFails', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.reworkMainboard().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kRequestInvalid); }); }); @@ -424,78 +418,78 @@ test('ReimageSkippedOk', () => { let states = [ - {state: RmaState.kChooseFirmwareReimageMethod, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kChooseFirmwareReimageMethod, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.reimageSkipped().then((state) => { - assertEquals(state.state, RmaState.kUpdateOs); + assertEquals(state.state, State.kUpdateOs); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('ReimageSkippedWrongStateFails', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.reimageSkipped().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kRequestInvalid); }); }); test('ReimageFromDownloadOk', () => { let states = [ - {state: RmaState.kChooseFirmwareReimageMethod, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kChooseFirmwareReimageMethod, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.reimageFromDownload().then((state) => { - assertEquals(state.state, RmaState.kUpdateOs); + assertEquals(state.state, State.kUpdateOs); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('ReimageFromDownloadWrongStateFails', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.reimageFromDownload().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kRequestInvalid); }); }); test('ReimageFromUsbOk', () => { let states = [ - {state: RmaState.kChooseFirmwareReimageMethod, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kChooseFirmwareReimageMethod, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.reimageFromUsb().then((state) => { - assertEquals(state.state, RmaState.kUpdateOs); + assertEquals(state.state, State.kUpdateOs); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('ReimageFromUsbWrongStateFails', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kUpdateOs, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.reimageFromUsb().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kRequestInvalid); }); }); @@ -572,21 +566,21 @@ test('SetDeviceInformationOk', () => { let states = [ - {state: RmaState.kUpdateDeviceInformation, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kUpdateDeviceInformation, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.setDeviceInformation('serial number', 1, 2).then((state) => { - assertEquals(state.state, RmaState.kChooseDestination); + assertEquals(state.state, State.kChooseDestination); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('GetCalibrationComponentList', () => { let states = [ - {state: RmaState.kCheckCalibration, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kCheckCalibration, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); let expectedCalibrationComponents = [ @@ -612,8 +606,8 @@ test('GetCalibrationInstructions', () => { let states = [ - {state: RmaState.kCheckCalibration, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kCheckCalibration, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); service.setGetCalibrationSetupInstructionsResult( @@ -630,8 +624,8 @@ test('StartCalibrationOk', () => { let states = [ - {state: RmaState.kCheckCalibration, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kCheckCalibration, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); service.setGetCalibrationSetupInstructionsResult( @@ -639,52 +633,52 @@ .kCalibrationInstructionPlaceBaseOnFlatSurface); return service.startCalibration(fakeCalibrationComponents).then((state) => { - assertEquals(state.state, RmaState.kChooseDestination); + assertEquals(state.state, State.kChooseDestination); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('RunCalibrationStepOk', () => { let states = [ - {state: RmaState.kSetupCalibration, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kSetupCalibration, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.runCalibrationStep().then((state) => { - assertEquals(state.state, RmaState.kChooseDestination); + assertEquals(state.state, State.kChooseDestination); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('ContinueCalibrationOk', () => { let states = [ - {state: RmaState.kRunCalibration, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kRunCalibration, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.continueCalibration().then((state) => { - assertEquals(state.state, RmaState.kChooseDestination); + assertEquals(state.state, State.kChooseDestination); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('CalibrationCompleteOk', () => { let states = [ - {state: RmaState.kRunCalibration, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kRunCalibration, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.calibrationComplete().then((state) => { - assertEquals(state.state, RmaState.kChooseDestination); + assertEquals(state.state, State.kChooseDestination); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('GetLog', () => { - let states = [{state: RmaState.kRepairComplete, error: RmadErrorCode.kOk}]; + let states = [{state: State.kRepairComplete, error: RmadErrorCode.kOk}]; service.setStates(states); const expectedLog = 'fake log'; service.setGetLogResult(expectedLog); @@ -695,99 +689,99 @@ test('EndRmaAndRebootOk', () => { let states = [ - {state: RmaState.kRepairComplete, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kRepairComplete, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.endRmaAndReboot().then((state) => { - assertEquals(state.state, RmaState.kChooseDestination); + assertEquals(state.state, State.kChooseDestination); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('EndRmaAndRebootWhenRmaNotRequired', () => { return service.endRmaAndReboot().then((state) => { - assertEquals(state.state, RmaState.kUnknown); + assertEquals(state.state, State.kUnknown); assertEquals(state.error, RmadErrorCode.kRmaNotRequired); }); }); test('EndRmaAndRebootWrongStateFails', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.endRmaAndReboot().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kRequestInvalid); }); }); test('EndRmaAndShutdownOk', () => { let states = [ - {state: RmaState.kRepairComplete, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kRepairComplete, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.endRmaAndShutdown().then((state) => { - assertEquals(state.state, RmaState.kChooseDestination); + assertEquals(state.state, State.kChooseDestination); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('EndRmaAndShutdownWhenRmaNotRequired', () => { return service.endRmaAndShutdown().then((state) => { - assertEquals(state.state, RmaState.kUnknown); + assertEquals(state.state, State.kUnknown); assertEquals(state.error, RmadErrorCode.kRmaNotRequired); }); }); test('EndRmaAndShutdownWrongStateFails', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.endRmaAndShutdown().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kRequestInvalid); }); }); test('EndRmaAndCutoffBatteryOk', () => { let states = [ - {state: RmaState.kRepairComplete, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kRepairComplete, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.endRmaAndCutoffBattery().then((state) => { - assertEquals(state.state, RmaState.kChooseDestination); + assertEquals(state.state, State.kChooseDestination); assertEquals(state.error, RmadErrorCode.kOk); }); }); test('EndRmaAndCutoffBatteryWhenRmaNotRequired', () => { return service.endRmaAndCutoffBattery().then((state) => { - assertEquals(state.state, RmaState.kUnknown); + assertEquals(state.state, State.kUnknown); assertEquals(state.error, RmadErrorCode.kRmaNotRequired); }); }); test('EndRmaAndCutoffBatteryWrongStateFails', () => { let states = [ - {state: RmaState.kWelcomeScreen, error: RmadErrorCode.kOk}, - {state: RmaState.kChooseDestination, error: RmadErrorCode.kOk}, + {state: State.kWelcomeScreen, error: RmadErrorCode.kOk}, + {state: State.kChooseDestination, error: RmadErrorCode.kOk}, ]; service.setStates(states); return service.endRmaAndCutoffBattery().then((state) => { - assertEquals(state.state, RmaState.kWelcomeScreen); + assertEquals(state.state, State.kWelcomeScreen); assertEquals(state.error, RmadErrorCode.kRequestInvalid); }); });
diff --git a/chrome/test/data/webui/chromeos/shimless_rma/onboarding_landing_page_test.js b/chrome/test/data/webui/chromeos/shimless_rma/onboarding_landing_page_test.js index be3caac..a9f7fd3 100644 --- a/chrome/test/data/webui/chromeos/shimless_rma/onboarding_landing_page_test.js +++ b/chrome/test/data/webui/chromeos/shimless_rma/onboarding_landing_page_test.js
@@ -7,7 +7,7 @@ import {FakeShimlessRmaService} from 'chrome://shimless-rma/fake_shimless_rma_service.js'; import {setShimlessRmaServiceForTesting} from 'chrome://shimless-rma/mojo_interface_provider.js'; import {OnboardingLandingPage} from 'chrome://shimless-rma/onboarding_landing_page.js'; -import {RmaState} from 'chrome://shimless-rma/shimless_rma_types.js'; +import {State} from 'chrome://shimless-rma/shimless_rma_types.js'; import {assertDeepEquals, assertEquals, assertFalse, assertTrue} from '../../chai_assert.js'; import {flushTasks, isVisible} from '../../test_util.js';
diff --git a/chrome/test/data/webui/chromeos/shimless_rma/shimless_rma_app_test.js b/chrome/test/data/webui/chromeos/shimless_rma/shimless_rma_app_test.js index 11ec089..2718cd2 100644 --- a/chrome/test/data/webui/chromeos/shimless_rma/shimless_rma_app_test.js +++ b/chrome/test/data/webui/chromeos/shimless_rma/shimless_rma_app_test.js
@@ -8,7 +8,7 @@ import {FakeShimlessRmaService} from 'chrome://shimless-rma/fake_shimless_rma_service.js'; import {setShimlessRmaServiceForTesting} from 'chrome://shimless-rma/mojo_interface_provider.js'; import {ButtonState, ShimlessRma} from 'chrome://shimless-rma/shimless_rma.js'; -import {RmadErrorCode, RmaState, StateResult} from 'chrome://shimless-rma/shimless_rma_types.js'; +import {RmadErrorCode, State, StateResult} from 'chrome://shimless-rma/shimless_rma_types.js'; import {assertEquals, assertFalse, assertTrue} from '../../chai_assert.js'; import {flushTasks, isVisible} from '../../test_util.js'; @@ -164,7 +164,7 @@ await clickNext(); assertFalse(initialPage.hidden); - resolver.resolve({state: RmaState.kUpdateOs, error: RmadErrorCode.kOk}); + resolver.resolve({state: State.kUpdateOs, error: RmadErrorCode.kOk}); await flushTasks(); const updatePage = @@ -209,7 +209,7 @@ test('UpdateNextButtonLabel', async () => { await initializeShimlessRMAApp( [{ - state: RmaState.kSelectComponents, + state: State.kSelectComponents, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk @@ -233,7 +233,7 @@ test('ErrorSignalShowsErrorCode', async () => { await initializeShimlessRMAApp( [{ - state: RmaState.kSelectComponents, + state: State.kSelectComponents, canCancel: true, canGoBack: true, error: RmadErrorCode.kOk
diff --git a/chrome/test/data/webui/read_later/BUILD.gn b/chrome/test/data/webui/read_later/BUILD.gn new file mode 100644 index 0000000..e76c1ed --- /dev/null +++ b/chrome/test/data/webui/read_later/BUILD.gn
@@ -0,0 +1,23 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//ui/webui/resources/tools/generate_grd.gni") + +generate_grd("build_grdp") { + grd_prefix = "webui_read_later" + out_grd = "$target_gen_dir/resources.grdp" + + input_files = [ + "read_later_app_test.js", + "side_panel/bookmark_folder_test.js", + "side_panel/bookmarks_drag_manager_test.js", + "side_panel/bookmarks_list_test.js", + "side_panel/side_panel_app_test.js", + "side_panel/test_bookmarks_api_proxy.js", + "test_read_later_api_proxy.js", + ] + input_files_base_dir = rebase_path(".", "//") + + resource_path_prefix = "read_later" +}
diff --git a/chrome/test/data/webui/read_later/read_later_browsertest.js b/chrome/test/data/webui/read_later/read_later_browsertest.js index 467b334..61b42ef3 100644 --- a/chrome/test/data/webui/read_later/read_later_browsertest.js +++ b/chrome/test/data/webui/read_later/read_later_browsertest.js
@@ -24,7 +24,7 @@ var ReadLaterAppTest = class extends ReadLaterBrowserTest { /** @override */ get browsePreload() { - return 'chrome://read-later.top-chrome/test_loader.html?module=read_later/read_later_app_test.js'; + return 'chrome://read-later.top-chrome/test_loader.html?module=read_later/read_later_app_test.js&host=webui-test'; } };
diff --git a/chrome/test/data/webui/read_later/side_panel/side_panel_browsertest.js b/chrome/test/data/webui/read_later/side_panel/side_panel_browsertest.js index db2a9b7b..a7beecb 100644 --- a/chrome/test/data/webui/read_later/side_panel/side_panel_browsertest.js +++ b/chrome/test/data/webui/read_later/side_panel/side_panel_browsertest.js
@@ -31,7 +31,7 @@ var SidePanelAppTest = class extends SidePanelBrowserTest { /** @override */ get browsePreload() { - return 'chrome://read-later.top-chrome/test_loader.html?module=read_later/side_panel/side_panel_app_test.js'; + return 'chrome://read-later.top-chrome/test_loader.html?module=read_later/side_panel/side_panel_app_test.js&host=webui-test'; } }; @@ -42,7 +42,7 @@ var SidePanelBookmarksListTest = class extends SidePanelBrowserTest { /** @override */ get browsePreload() { - return 'chrome://read-later.top-chrome/test_loader.html?module=read_later/side_panel/bookmarks_list_test.js'; + return 'chrome://read-later.top-chrome/test_loader.html?module=read_later/side_panel/bookmarks_list_test.js&host=webui-test'; } }; @@ -54,7 +54,7 @@ var SidePanelBookmarkFolderTest = class extends SidePanelBrowserTest { /** @override */ get browsePreload() { - return 'chrome://read-later.top-chrome/test_loader.html?module=read_later/side_panel/bookmark_folder_test.js'; + return 'chrome://read-later.top-chrome/test_loader.html?module=read_later/side_panel/bookmark_folder_test.js&host=webui-test'; } }; @@ -66,7 +66,7 @@ var SidePanelBookmarksDragManagerTest = class extends SidePanelBrowserTest { /** @override */ get browsePreload() { - return 'chrome://read-later.top-chrome/test_loader.html?module=read_later/side_panel/bookmarks_drag_manager_test.js'; + return 'chrome://read-later.top-chrome/test_loader.html?module=read_later/side_panel/bookmarks_drag_manager_test.js&host=webui-test'; } };
diff --git a/chrome/updater/app/server/win/com_classes_legacy.cc b/chrome/updater/app/server/win/com_classes_legacy.cc index a959d36..347c5681 100644 --- a/chrome/updater/app/server/win/com_classes_legacy.cc +++ b/chrome/updater/app/server/win/com_classes_legacy.cc
@@ -25,17 +25,6 @@ namespace { -// Constants from Google Update. -// TODO(crbug/1094024): once group policy manager code is available, the -// server must respond with the following errors: -// const HRESULT GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY = 0x80040813; -// const HRESULT GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY_MANUAL = 0x8004081f; - -// This is a GoogleUpdate error code, which must be retained by this -// implementation in order to be backward compatible with the existing -// update client code in Chrome. -const HRESULT GOOPDATEINSTALL_E_INSTALLER_FAILED = 0x80040902; - HRESULT OpenCallerProcessHandle(DWORD proc_id, base::win::ScopedHandle& proc_handle) { proc_handle.Set(::OpenProcess(PROCESS_DUP_HANDLE, false, proc_id));
diff --git a/chrome/updater/constants.h b/chrome/updater/constants.h index 6eb83110..1d82fcd 100644 --- a/chrome/updater/constants.h +++ b/chrome/updater/constants.h
@@ -237,6 +237,14 @@ // while waiting for the first app registration. constexpr int kMaxServerStartsBeforeFirstReg = 24; +// These are GoogleUpdate error codes, which must be retained by this +// implementation in order to be backward compatible with the existing update +// client code in Chrome. +constexpr int GOOPDATE_E_APP_INSTALL_DISABLED_BY_POLICY = 0x80040812; +constexpr int GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY = 0x80040813; +constexpr int GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY_MANUAL = 0x8004081f; +constexpr int GOOPDATEINSTALL_E_INSTALLER_FAILED = 0x80040902; + } // namespace updater #endif // CHROME_UPDATER_CONSTANTS_H_
diff --git a/chrome/updater/test/integration_test_commands.h b/chrome/updater/test/integration_test_commands.h index ccfab8bb..1475022 100644 --- a/chrome/updater/test/integration_test_commands.h +++ b/chrome/updater/test/integration_test_commands.h
@@ -63,7 +63,9 @@ #if defined(OS_WIN) virtual void ExpectInterfacesRegistered() const = 0; virtual void ExpectLegacyUpdate3WebSucceeds( - const std::string& app_id) const = 0; + const std::string& app_id, + int expected_final_state, + int expected_error_code) const = 0; virtual void ExpectLegacyProcessLauncherSucceeds() const = 0; virtual void RunUninstallCmdLine() const = 0; virtual void SetUpTestService() const = 0;
diff --git a/chrome/updater/test/integration_test_commands_system.cc b/chrome/updater/test/integration_test_commands_system.cc index 8dd7cd3..26b0d36 100644 --- a/chrome/updater/test/integration_test_commands_system.cc +++ b/chrome/updater/test/integration_test_commands_system.cc
@@ -154,9 +154,15 @@ RunCommand("expect_interfaces_registered"); } - void ExpectLegacyUpdate3WebSucceeds( - const std::string& app_id) const override { - RunCommand("expect_legacy_update3web_succeeds", {Param("app_id", app_id)}); + void ExpectLegacyUpdate3WebSucceeds(const std::string& app_id, + int expected_final_state, + int expected_error_code) const override { + RunCommand("expect_legacy_update3web_succeeds", + {Param("app_id", app_id), + Param("expected_final_state", + base::NumberToString(expected_final_state)), + Param("expected_error_code", + base::NumberToString(expected_error_code))}); } void ExpectLegacyProcessLauncherSucceeds() const override {
diff --git a/chrome/updater/test/integration_test_commands_user.cc b/chrome/updater/test/integration_test_commands_user.cc index 31a47726..3e2f8fd 100644 --- a/chrome/updater/test/integration_test_commands_user.cc +++ b/chrome/updater/test/integration_test_commands_user.cc
@@ -143,9 +143,11 @@ updater::test::ExpectInterfacesRegistered(updater_scope_); } - void ExpectLegacyUpdate3WebSucceeds( - const std::string& app_id) const override { - updater::test::ExpectLegacyUpdate3WebSucceeds(updater_scope_, app_id); + void ExpectLegacyUpdate3WebSucceeds(const std::string& app_id, + int expected_final_state, + int expected_error_code) const override { + updater::test::ExpectLegacyUpdate3WebSucceeds( + updater_scope_, app_id, expected_final_state, expected_error_code); } void ExpectLegacyProcessLauncherSucceeds() const override {
diff --git a/chrome/updater/test/integration_tests.cc b/chrome/updater/test/integration_tests.cc index 69174c1..dd9f558 100644 --- a/chrome/updater/test/integration_tests.cc +++ b/chrome/updater/test/integration_tests.cc
@@ -38,7 +38,13 @@ #include "url/gurl.h" #if defined(OS_WIN) +#include <shlobj.h> + #include "base/strings/utf_string_conversions.h" +#include "base/win/registry.h" +#include "chrome/updater/app/server/win/updater_legacy_idl.h" +#include "chrome/updater/win/win_constants.h" +#include "chrome/updater/win/win_util.h" #endif // OS_WIN namespace updater { @@ -141,8 +147,11 @@ test_commands_->ExpectInterfacesRegistered(); } - void ExpectLegacyUpdate3WebSucceeds(const std::string& app_id) { - test_commands_->ExpectLegacyUpdate3WebSucceeds(app_id); + void ExpectLegacyUpdate3WebSucceeds(const std::string& app_id, + int expected_final_state, + int expected_error_code) { + test_commands_->ExpectLegacyUpdate3WebSucceeds(app_id, expected_final_state, + expected_error_code); } void ExpectLegacyProcessLauncherSucceeds() { @@ -435,11 +444,36 @@ RegisterApp(kAppId); ExpectNoUpdateSequence(&test_server, kAppId); - ExpectLegacyUpdate3WebSucceeds(kAppId); + ExpectLegacyUpdate3WebSucceeds(kAppId, STATE_NO_UPDATE, S_OK); ExpectUpdateSequence(&test_server, kAppId, base::Version("0.1"), base::Version("0.2")); - ExpectLegacyUpdate3WebSucceeds(kAppId); + ExpectLegacyUpdate3WebSucceeds(kAppId, STATE_INSTALL_COMPLETE, S_OK); + + // TODO(crbug.com/1272853) - Need administrative access to be able to write + // under the policies key. + if (::IsUserAnAdmin()) { + base::win::RegKey key(HKEY_LOCAL_MACHINE, UPDATER_POLICIES_KEY, + Wow6432(KEY_ALL_ACCESS)); + + EXPECT_EQ(ERROR_SUCCESS, + key.WriteValue( + base::StrCat({L"Update", base::UTF8ToWide(kAppId)}).c_str(), + kPolicyAutomaticUpdatesOnly)); + ExpectLegacyUpdate3WebSucceeds( + kAppId, STATE_ERROR, GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY_MANUAL); + + EXPECT_EQ(ERROR_SUCCESS, + key.WriteValue( + base::StrCat({L"Update", base::UTF8ToWide(kAppId)}).c_str(), + static_cast<DWORD>(kPolicyDisabled))); + ExpectLegacyUpdate3WebSucceeds(kAppId, STATE_ERROR, + GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY); + + EXPECT_EQ(ERROR_SUCCESS, + base::win::RegKey(HKEY_LOCAL_MACHINE, L"", Wow6432(DELETE)) + .DeleteKey(UPDATER_POLICIES_KEY)); + } Uninstall(); }
diff --git a/chrome/updater/test/integration_tests_helper.cc b/chrome/updater/test/integration_tests_helper.cc index 08f49861..2a7670d 100644 --- a/chrome/updater/test/integration_tests_helper.cc +++ b/chrome/updater/test/integration_tests_helper.cc
@@ -196,8 +196,11 @@ {"expect_interfaces_registered", WithSystemScope(Wrap(&ExpectInterfacesRegistered))}, {"expect_legacy_update3web_succeeds", - WithSwitch("app_id", - WithSystemScope(Wrap(&ExpectLegacyUpdate3WebSucceeds)))}, + WithSwitch("expected_error_code", + WithSwitch("expected_final_state", + WithSwitch("app_id", + WithSystemScope(Wrap( + &ExpectLegacyUpdate3WebSucceeds)))))}, {"expect_legacy_process_launcher_succeeds", WithSystemScope(Wrap(&ExpectLegacyProcessLauncherSucceeds))}, {"run_uninstall_cmd_line", WithSystemScope(Wrap(&RunUninstallCmdLine))},
diff --git a/chrome/updater/test/integration_tests_impl.h b/chrome/updater/test/integration_tests_impl.h index 618de44c7..49c1b6ec8 100644 --- a/chrome/updater/test/integration_tests_impl.h +++ b/chrome/updater/test/integration_tests_impl.h
@@ -148,7 +148,9 @@ #if defined(OS_WIN) void ExpectInterfacesRegistered(UpdaterScope scope); void ExpectLegacyUpdate3WebSucceeds(UpdaterScope scope, - const std::string& app_id); + const std::string& app_id, + int expected_final_state, + int expected_error_code); void ExpectLegacyProcessLauncherSucceeds(UpdaterScope scope); void RunTestServiceCommand(const std::string& sub_command);
diff --git a/chrome/updater/test/integration_tests_win.cc b/chrome/updater/test/integration_tests_win.cc index ab01e69..e7bbeacb 100644 --- a/chrome/updater/test/integration_tests_win.cc +++ b/chrome/updater/test/integration_tests_win.cc
@@ -514,13 +514,17 @@ return S_OK; } -HRESULT DoLoopUntilDone(Microsoft::WRL::ComPtr<IAppBundleWeb> bundle) { +HRESULT DoLoopUntilDone(Microsoft::WRL::ComPtr<IAppBundleWeb> bundle, + int expected_final_state, + HRESULT expected_error_code) { bool done = false; static const base::TimeDelta kExpirationTimeout = base::Minutes(1); base::ElapsedTimer timer; EXPECT_TRUE(timer.Elapsed() < kExpirationTimeout); + LONG state_value = 0; + LONG error_code = 0; while (!done && (timer.Elapsed() < kExpirationTimeout)) { EXPECT_TRUE(bundle); @@ -537,7 +541,6 @@ std::wstring stateDescription; std::wstring extraData; - LONG state_value = 0; EXPECT_HRESULT_SUCCEEDED(state->get_stateValue(&state_value)); switch (state_value) { @@ -633,7 +636,6 @@ case STATE_ERROR: { stateDescription = L"Error!"; - LONG error_code = 0; EXPECT_HRESULT_SUCCEEDED(state->get_errorCode(&error_code)); base::win::ScopedBstr completion_message; @@ -665,22 +667,30 @@ } EXPECT_TRUE(done); + EXPECT_EQ(expected_final_state, state_value); + EXPECT_EQ(expected_error_code, error_code); return S_OK; } -HRESULT DoUpdate(UpdaterScope scope, const base::win::ScopedBstr& appid) { +HRESULT DoUpdate(UpdaterScope scope, + const base::win::ScopedBstr& appid, + int expected_final_state, + HRESULT expected_error_code) { Microsoft::WRL::ComPtr<IAppBundleWeb> bundle; EXPECT_HRESULT_SUCCEEDED(InitializeBundle(scope, bundle)); EXPECT_HRESULT_SUCCEEDED(bundle->createInstalledApp(appid.Get())); EXPECT_HRESULT_SUCCEEDED(bundle->checkForUpdate()); - return DoLoopUntilDone(bundle); + return DoLoopUntilDone(bundle, expected_final_state, expected_error_code); } void ExpectLegacyUpdate3WebSucceeds(UpdaterScope scope, - const std::string& app_id) { + const std::string& app_id, + int expected_final_state, + int expected_error_code) { EXPECT_HRESULT_SUCCEEDED( - DoUpdate(scope, base::win::ScopedBstr(base::UTF8ToWide(app_id).c_str()))); + DoUpdate(scope, base::win::ScopedBstr(base::UTF8ToWide(app_id).c_str()), + expected_final_state, expected_error_code)); } void SetFcLaunchCmd(const std::wstring& id) {
diff --git a/chrome/updater/update_service_impl.cc b/chrome/updater/update_service_impl.cc index 1557259..1512c47b 100644 --- a/chrome/updater/update_service_impl.cc +++ b/chrome/updater/update_service_impl.cc
@@ -15,6 +15,7 @@ #include "base/containers/queue.h" #include "base/logging.h" #include "base/run_loop.h" +#include "base/task/bind_post_task.h" #include "base/task/post_task.h" #include "base/task/sequenced_task_runner.h" #include "base/threading/sequenced_task_runner_handle.h" @@ -295,12 +296,20 @@ void UpdateServiceImpl::Update( const std::string& app_id, Priority priority, - PolicySameVersionUpdate /*policy_same_version_update*/, + PolicySameVersionUpdate policy_same_version_update, StateChangeCallback state_update, Callback callback) { VLOG(1) << __func__; DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + int policy = kPolicyEnabled; + if (IsUpdateDisabledByPolicy(app_id, priority, policy_same_version_update, + policy)) { + HandleUpdateDisabledByPolicy(app_id, policy, policy_same_version_update, + state_update, std::move(callback)); + return; + } + std::vector<std::string> ids = {app_id}; ShouldBlockUpdateForMeteredNetwork( priority, @@ -309,6 +318,58 @@ UpdateService::PolicySameVersionUpdate::kNotAllowed)); } +bool UpdateServiceImpl::IsUpdateDisabledByPolicy( + const std::string& app_id, + Priority priority, + PolicySameVersionUpdate policy_same_version_update, + int& policy) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + policy = kPolicyEnabled; + + // The Install case is inferred by the presence of + // `PolicySameVersionUpdate::kAllowed`. + if (policy_same_version_update == PolicySameVersionUpdate::kAllowed) { + return config_->GetPolicyService()->GetEffectivePolicyForAppInstalls( + app_id, nullptr, &policy) && + (policy == kPolicyDisabled || (config_->IsPerUserInstall() && + policy == kPolicyEnabledMachineOnly)); + } else { + return config_->GetPolicyService()->GetEffectivePolicyForAppUpdates( + app_id, nullptr, &policy) && + (policy == kPolicyDisabled || + ((policy == kPolicyManualUpdatesOnly) && + (priority != Priority::kForeground)) || + ((policy == kPolicyAutomaticUpdatesOnly) && + (priority == Priority::kForeground))); + } +} + +void UpdateServiceImpl::HandleUpdateDisabledByPolicy( + const std::string& app_id, + int policy, + PolicySameVersionUpdate policy_same_version_update, + StateChangeCallback state_update, + Callback callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + UpdateState update_state; + update_state.app_id = app_id; + update_state.state = UpdateService::UpdateState::State::kUpdateError; + update_state.error_category = UpdateService::ErrorCategory::kUpdateCheck; + update_state.error_code = + policy_same_version_update == PolicySameVersionUpdate::kAllowed + ? GOOPDATE_E_APP_INSTALL_DISABLED_BY_POLICY + : policy != kPolicyAutomaticUpdatesOnly + ? GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY + : GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY_MANUAL; + update_state.extra_code1 = 0; + + base::BindPostTask(main_task_runner_, state_update).Run(update_state); + base::BindPostTask(main_task_runner_, std::move(callback)) + .Run(UpdateService::Result::kUpdateCheckFailed); +} + void UpdateServiceImpl::OnShouldBlockUpdateForMeteredNetwork( StateChangeCallback state_update, Callback callback,
diff --git a/chrome/updater/update_service_impl.h b/chrome/updater/update_service_impl.h index f11a72a..305dfe2 100644 --- a/chrome/updater/update_service_impl.h +++ b/chrome/updater/update_service_impl.h
@@ -60,6 +60,18 @@ // Run `callback`, pops `tasks_`, and calls TaskStart. void TaskDone(base::OnceClosure callback); + bool IsUpdateDisabledByPolicy( + const std::string& app_id, + Priority priority, + PolicySameVersionUpdate policy_same_version_update, + int& policy); + void HandleUpdateDisabledByPolicy( + const std::string& app_id, + int policy, + PolicySameVersionUpdate policy_same_version_update, + StateChangeCallback state_update, + Callback callback); + void OnShouldBlockUpdateForMeteredNetwork( StateChangeCallback state_update, Callback callback,
diff --git a/chromeos/chromeos_strings.grd b/chromeos/chromeos_strings.grd index e98e687..5d7e04d 100644 --- a/chromeos/chromeos_strings.grd +++ b/chromeos/chromeos_strings.grd
@@ -2540,6 +2540,9 @@ <message name="IDS_FIRMWARE_UP_TO_DATE_TEXT" desc="Label shown when no firmware updates are available."> All peripherals are up to date </message> + <message name="IDS_FIRMWARE_VERSION_TEXT" desc="Label for the update's version."> + Version <ph name="VERSION">$1<ex>3.0.2</ex></ph> + </message> </messages> </release> </grit>
diff --git a/chromeos/chromeos_strings_grd/IDS_FIRMWARE_VERSION_TEXT.png.sha1 b/chromeos/chromeos_strings_grd/IDS_FIRMWARE_VERSION_TEXT.png.sha1 new file mode 100644 index 0000000..c0c49fcf4 --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_FIRMWARE_VERSION_TEXT.png.sha1
@@ -0,0 +1 @@ +31599eb55ffacda8cb7f6da0037d1065bdf35647 \ No newline at end of file
diff --git a/chromeos/components/cdm_factory_daemon/DEPS b/chromeos/components/cdm_factory_daemon/DEPS index 0b3c536f..71baed22 100644 --- a/chromeos/components/cdm_factory_daemon/DEPS +++ b/chromeos/components/cdm_factory_daemon/DEPS
@@ -1,4 +1,5 @@ include_rules = [ + "+ash/components/arc/mojom", "+ash/shell.h", "+components/arc/mojom", "+content/public/browser", @@ -7,4 +8,4 @@ "+media/cdm", "+media/mojo/mojom", "+ui/display", -] \ No newline at end of file +]
diff --git a/chromeos/components/cdm_factory_daemon/mojom/BUILD.gn b/chromeos/components/cdm_factory_daemon/mojom/BUILD.gn index f3dc438..bd399f8 100644 --- a/chromeos/components/cdm_factory_daemon/mojom/BUILD.gn +++ b/chromeos/components/cdm_factory_daemon/mojom/BUILD.gn
@@ -19,8 +19,8 @@ ] if (is_chromeos_ash) { public_deps += [ - "//components/arc/mojom:oemcrypto", - "//components/arc/mojom:protected_buffer_manager", + "//ash/components/arc/mojom:oemcrypto", + "//ash/components/arc/mojom:protected_buffer_manager", ] }
diff --git a/chromeos/components/cdm_factory_daemon/mojom/cdm_factory_daemon.mojom b/chromeos/components/cdm_factory_daemon/mojom/cdm_factory_daemon.mojom index 484cf856..655808b4 100644 --- a/chromeos/components/cdm_factory_daemon/mojom/cdm_factory_daemon.mojom +++ b/chromeos/components/cdm_factory_daemon/mojom/cdm_factory_daemon.mojom
@@ -13,13 +13,13 @@ module chromeos.cdm.mojom; +[EnableIf=is_chromeos_ash] +import "ash/components/arc/mojom/oemcrypto.mojom"; +[EnableIf=is_chromeos_ash] +import "ash/components/arc/mojom/protected_buffer_manager.mojom"; import "chromeos/components/cdm_factory_daemon/mojom/cdm_storage.mojom"; import "chromeos/components/cdm_factory_daemon/mojom/content_decryption_module.mojom"; import "chromeos/components/cdm_factory_daemon/mojom/output_protection.mojom"; -[EnableIf=is_chromeos_ash] -import "components/arc/mojom/oemcrypto.mojom"; -[EnableIf=is_chromeos_ash] -import "components/arc/mojom/protected_buffer_manager.mojom"; // Next Method ID: 2 [Stable, Uuid="732a934d-8e2a-4305-b637-ccbe74ee8b88"]
diff --git a/chromeos/components/tether/tether_host_response_recorder.cc b/chromeos/components/tether/tether_host_response_recorder.cc index 39e8b53..b067e67e 100644 --- a/chromeos/components/tether/tether_host_response_recorder.cc +++ b/chromeos/components/tether/tether_host_response_recorder.cc
@@ -78,9 +78,12 @@ const std::string& device_id, const std::string& pref_name) { const base::ListValue* ids = pref_service_->GetList(pref_name); + base::Value::ConstListView ids_list = ids->GetList(); std::string first_device_id_in_list; - ids->GetString(0u, &first_device_id_in_list); + if (!ids_list.empty() && ids_list[0].is_string()) + first_device_id_in_list = ids_list[0].GetString(); + if (device_id == first_device_id_in_list) { // If the device ID that is being inserted is already at the front of the // list, there is nothing to do.
diff --git a/chromeos/dbus/cros_disks/cros_disks_client.cc b/chromeos/dbus/cros_disks/cros_disks_client.cc index 609fdc2b..a17689a 100644 --- a/chromeos/dbus/cros_disks/cros_disks_client.cc +++ b/chromeos/dbus/cros_disks/cros_disks_client.cc
@@ -772,10 +772,12 @@ if (media_type_double.has_value()) device_type_ = DeviceMediaTypeToDeviceType(media_type_double.value()); - base::ListValue* mount_paths = NULL; - if (properties->GetListWithoutPathExpansion(cros_disks::kDeviceMountPaths, - &mount_paths)) - mount_paths->GetString(0, &mount_path_); + base::Value* mount_paths = + properties->FindListKey(cros_disks::kDeviceMountPaths); + if (mount_paths && !mount_paths->GetList().empty() && + mount_paths->GetList()[0].is_string()) { + mount_path_ = mount_paths->GetList()[0].GetString(); + } } ////////////////////////////////////////////////////////////////////////////////
diff --git a/chromeos/network/network_profile_handler.cc b/chromeos/network/network_profile_handler.cc index 75a0e40..b95f6d8d 100644 --- a/chromeos/network/network_profile_handler.cc +++ b/chromeos/network/network_profile_handler.cc
@@ -26,11 +26,11 @@ bool ConvertListValueToStringVector(const base::ListValue& string_list, std::vector<std::string>* result) { - for (size_t i = 0; i < string_list.GetList().size(); ++i) { - std::string str; - if (!string_list.GetString(i, &str)) + for (const base::Value& i : string_list.GetList()) { + const std::string* str = i.GetIfString(); + if (!str) return false; - result->push_back(str); + result->push_back(*str); } return true; }
diff --git a/components/BUILD.gn b/components/BUILD.gn index 297be2e..c7a567d7 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn
@@ -475,9 +475,9 @@ deps += [ # TODO(b/206686476): Move this target to //ash/components:unit_tests "//ash/components/arc:unit_tests", + "//ash/components/arc/mojom:unit_tests", "//ash/components/arc/session:unit_tests", "//components/arc:unit_tests", - "//components/arc/mojom:unit_tests", "//components/desks_storage:unit_tests", "//components/guest_os:unit_tests", "//components/metrics/structured:unit_tests",
diff --git a/components/arc/mojom/BUILD.gn b/components/arc/mojom/BUILD.gn index cccef19..dddd8a9 100644 --- a/components/arc/mojom/BUILD.gn +++ b/components/arc/mojom/BUILD.gn
@@ -77,10 +77,10 @@ ] public_deps = [ - ":camera_intent", ":media", - ":notifications", - ":oemcrypto", + "//ash/components/arc/mojom:camera_intent", + "//ash/components/arc/mojom:notifications", + "//ash/components/arc/mojom:oemcrypto", "//chromeos/components/sensors/mojom:mojom", "//components/payments/mojom:mojom", "//media/capture/video/chromeos/mojom:cros_camera", @@ -166,7 +166,7 @@ move_only = true }, ] - traits_headers = [ "ime_mojom_traits.h" ] + traits_headers = [ "//ash/components/arc/mojom/ime_mojom_traits.h" ] traits_public_deps = [ "//ui/base/ime", "//ui/events", @@ -253,34 +253,6 @@ ] } - mojom("camera_intent") { - sources = [ "camera_intent.mojom" ] - webui_module_path = "/components/arc/mojom" - } - - mojom("notifications") { - sources = [ - "bitmap.mojom", - "notifications.mojom", - ] - - deps = [ ":media" ] # for gfx.mojom - - cpp_typemaps = [ - { - types = [ - { - mojom = "arc.mojom.ArcBitmap" - cpp = "::SkBitmap" - }, - ] - traits_headers = [ "//components/arc/bitmap/bitmap_mojom_traits.h" ] - traits_sources = [ "//components/arc/bitmap/bitmap_mojom_traits.cc" ] - traits_public_deps = [ "//skia" ] - }, - ] - } - # Media related mojo interfaces. These are used by # //services/viz/public/mojom. We have this separate mojom target to # avoid pulling in unnecessary interfaces. @@ -295,7 +267,7 @@ ] public_deps = [ - ":protected_buffer_manager", + "//ash/components/arc/mojom:protected_buffer_manager", "//sandbox/policy/mojom", "//ui/gfx/geometry/mojom", ] @@ -390,43 +362,4 @@ }, ] } - - mojom("oemcrypto") { - sources = [ "oemcrypto.mojom" ] - } - - mojom("protected_buffer_manager") { - sources = [ "protected_buffer_manager.mojom" ] - public_deps = [ "//sandbox/policy/mojom" ] - } - - source_set("mojom_traits") { - sources = [ - "ime_mojom_traits.cc", - "ime_mojom_traits.h", - ] - - deps = [ - ":mojom", - "//ui/base/ime:text_input_types", - "//ui/events", - "//ui/events/ozone/layout", - ] - } - - source_set("unit_tests") { - testonly = true - sources = [ - "ime_mojom_traits_unittest.cc", - "video_accelerator_mojom_traits_unittest.cc", - ] - - deps = [ - ":mojom", - ":mojom_traits", - "//media", - "//mojo/public/cpp/test_support:test_utils", - "//testing/gtest", - ] - } }
diff --git a/components/arc/mojom/arc_bridge.mojom b/components/arc/mojom/arc_bridge.mojom index d65caf2..eb6c353 100644 --- a/components/arc/mojom/arc_bridge.mojom +++ b/components/arc/mojom/arc_bridge.mojom
@@ -4,6 +4,8 @@ module arc.mojom; +import "ash/components/arc/mojom/notifications.mojom"; +import "ash/components/arc/mojom/oemcrypto.mojom"; import "components/arc/mojom/accessibility_helper.mojom"; import "components/arc/mojom/adbd.mojom"; import "components/arc/mojom/app.mojom"; @@ -39,9 +41,7 @@ import "components/arc/mojom/midis.mojom"; import "components/arc/mojom/nearby_share.mojom"; import "components/arc/mojom/net.mojom"; -import "components/arc/mojom/notifications.mojom"; import "components/arc/mojom/obb_mounter.mojom"; -import "components/arc/mojom/oemcrypto.mojom"; import "components/arc/mojom/payment_app.mojom"; import "components/arc/mojom/pip.mojom"; import "components/arc/mojom/policy.mojom";
diff --git a/components/arc/mojom/file_system.mojom b/components/arc/mojom/file_system.mojom index cb916f7..a979df08 100644 --- a/components/arc/mojom/file_system.mojom +++ b/components/arc/mojom/file_system.mojom
@@ -6,8 +6,8 @@ module arc.mojom; +import "ash/components/arc/mojom/bitmap.mojom"; import "components/arc/mojom/app.mojom"; -import "components/arc/mojom/bitmap.mojom"; import "components/arc/mojom/gfx.mojom"; import "components/arc/mojom/intent_common.mojom"; import "components/arc/mojom/video_common.mojom";
diff --git a/components/arc/mojom/intent_helper.mojom b/components/arc/mojom/intent_helper.mojom index 7e821ad..122eccf 100644 --- a/components/arc/mojom/intent_helper.mojom +++ b/components/arc/mojom/intent_helper.mojom
@@ -6,9 +6,9 @@ module arc.mojom; +import "ash/components/arc/mojom/bitmap.mojom"; +import "ash/components/arc/mojom/camera_intent.mojom"; import "components/arc/mojom/app.mojom"; -import "components/arc/mojom/bitmap.mojom"; -import "components/arc/mojom/camera_intent.mojom"; import "components/arc/mojom/intent_common.mojom"; import "components/arc/mojom/scale_factor.mojom"; import "mojo/public/mojom/base/safe_base_name.mojom";
diff --git a/components/browser_ui/styles/android/BUILD.gn b/components/browser_ui/styles/android/BUILD.gn index a2b9d1e..90ca2131 100644 --- a/components/browser_ui/styles/android/BUILD.gn +++ b/components/browser_ui/styles/android/BUILD.gn
@@ -23,14 +23,6 @@ android_resources("java_resources") { sources = [ - "java/res/color-v23/default_icon_color_accent1_tint_list.xml", - "java/res/color-v23/default_icon_color_secondary_tint_list.xml", - "java/res/color-v23/default_icon_color_tint_list.xml", - "java/res/color-v23/default_text_color_disabled_list.xml", - "java/res/color-v23/default_text_color_hint_list.xml", - "java/res/color-v23/default_text_color_list.xml", - "java/res/color-v23/default_text_color_secondary_list.xml", - "java/res/color-v23/text_highlight_color.xml", "java/res/color/checkbox_tint.xml", "java/res/color/default_icon_color_accent1_tint_list.xml", "java/res/color/default_icon_color_light_tint_list.xml",
diff --git a/components/browser_ui/styles/android/java/res/color-v23/default_icon_color_accent1_tint_list.xml b/components/browser_ui/styles/android/java/res/color-v23/default_icon_color_accent1_tint_list.xml deleted file mode 100644 index cffb877..0000000 --- a/components/browser_ui/styles/android/java/res/color-v23/default_icon_color_accent1_tint_list.xml +++ /dev/null
@@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2021 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="@macro/default_icon_color_accent1" /> -</selector>
diff --git a/components/browser_ui/styles/android/java/res/color-v23/default_icon_color_secondary_tint_list.xml b/components/browser_ui/styles/android/java/res/color-v23/default_icon_color_secondary_tint_list.xml deleted file mode 100644 index 800cc34..0000000 --- a/components/browser_ui/styles/android/java/res/color-v23/default_icon_color_secondary_tint_list.xml +++ /dev/null
@@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2021 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" tools:ignore="UnusedResources"> - <item android:alpha="@dimen/default_disabled_alpha" - android:color="@macro/default_icon_color" android:state_enabled="false"/> - <item android:color="?attr/default_icon_color_secondary" /> -</selector>
diff --git a/components/browser_ui/styles/android/java/res/color-v23/default_icon_color_tint_list.xml b/components/browser_ui/styles/android/java/res/color-v23/default_icon_color_tint_list.xml deleted file mode 100644 index 0cc1fec..0000000 --- a/components/browser_ui/styles/android/java/res/color-v23/default_icon_color_tint_list.xml +++ /dev/null
@@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2021 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. ---> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:alpha="@dimen/default_disabled_alpha" - android:state_enabled="false" android:color="@macro/default_icon_color" /> - <item android:state_selected="true" android:color="@macro/default_icon_color" /> - <item android:state_focused="true" android:color="@macro/default_icon_color" /> - <item android:state_pressed="true" android:color="@macro/default_icon_color" /> - <item android:state_activated="true" android:color="@macro/default_icon_color" /> - <item android:color="@macro/default_icon_color"/> -</selector>
diff --git a/components/browser_ui/styles/android/java/res/color-v23/default_text_color_disabled_list.xml b/components/browser_ui/styles/android/java/res/color-v23/default_text_color_disabled_list.xml deleted file mode 100644 index 7a1973d..0000000 --- a/components/browser_ui/styles/android/java/res/color-v23/default_text_color_disabled_list.xml +++ /dev/null
@@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2021 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:alpha="@dimen/default_disabled_alpha" android:color="?attr/colorOnSurface" /> -</selector>
diff --git a/components/browser_ui/styles/android/java/res/color-v23/default_text_color_hint_list.xml b/components/browser_ui/styles/android/java/res/color-v23/default_text_color_hint_list.xml deleted file mode 100644 index 0376101..0000000 --- a/components/browser_ui/styles/android/java/res/color-v23/default_text_color_hint_list.xml +++ /dev/null
@@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2021 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:alpha="@dimen/default_disabled_alpha" android:color="?attr/colorOnSurface" - android:state_enabled="false"/> - <item android:color="?attr/colorOnSurfaceVariant" /> -</selector>
diff --git a/components/browser_ui/styles/android/java/res/color-v23/default_text_color_list.xml b/components/browser_ui/styles/android/java/res/color-v23/default_text_color_list.xml deleted file mode 100644 index abe4ba1..0000000 --- a/components/browser_ui/styles/android/java/res/color-v23/default_text_color_list.xml +++ /dev/null
@@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2021 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:alpha="@dimen/default_disabled_alpha" - android:color="?attr/colorOnSurface" android:state_enabled="false"/> - <item android:color="?attr/colorOnSurface" /> -</selector>
diff --git a/components/browser_ui/styles/android/java/res/color-v23/default_text_color_secondary_list.xml b/components/browser_ui/styles/android/java/res/color-v23/default_text_color_secondary_list.xml deleted file mode 100644 index 710d85ab..0000000 --- a/components/browser_ui/styles/android/java/res/color-v23/default_text_color_secondary_list.xml +++ /dev/null
@@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2021 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:alpha="@dimen/default_disabled_alpha" - android:color="?attr/colorOnSurfaceVariant" android:state_enabled="false"/> - <item android:color="?attr/colorOnSurfaceVariant" /> -</selector>
diff --git a/components/browser_ui/styles/android/java/res/color-v23/text_highlight_color.xml b/components/browser_ui/styles/android/java/res/color-v23/text_highlight_color.xml deleted file mode 100644 index 72cb3e6..0000000 --- a/components/browser_ui/styles/android/java/res/color-v23/text_highlight_color.xml +++ /dev/null
@@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2021 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. --> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:alpha="@dimen/text_highlight_alpha" android:color="?attr/colorPrimary" /> -</selector>
diff --git a/components/browser_ui/styles/android/java/res/color/default_icon_color_accent1_tint_list.xml b/components/browser_ui/styles/android/java/res/color/default_icon_color_accent1_tint_list.xml index ab2333e..cffb877 100644 --- a/components/browser_ui/styles/android/java/res/color/default_icon_color_accent1_tint_list.xml +++ b/components/browser_ui/styles/android/java/res/color/default_icon_color_accent1_tint_list.xml
@@ -1,11 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2014 The Chromium Authors. All rights reserved. +<!-- Copyright 2021 The Chromium Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> -<!-- TODO(https://crbug.com/1239289): Delete this once the min API is 23. --> -<selector xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - tools:ignore="UnusedResources" > - <item android:color="@color/default_icon_color_accent1_baseline" /> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:color="@macro/default_icon_color_accent1" /> </selector>
diff --git a/components/browser_ui/styles/android/java/res/color/default_icon_color_secondary_tint_list.xml b/components/browser_ui/styles/android/java/res/color/default_icon_color_secondary_tint_list.xml index 7ad0d6a..800cc34 100644 --- a/components/browser_ui/styles/android/java/res/color/default_icon_color_secondary_tint_list.xml +++ b/components/browser_ui/styles/android/java/res/color/default_icon_color_secondary_tint_list.xml
@@ -1,14 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2019 The Chromium Authors. All rights reserved. +<!-- Copyright 2021 The Chromium Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> -<!-- ColorStateList in Android L does not work as expected when pointing to - attributes. This file should be replaced with the one in color-v23 once we - stop supporting Android L. See https://crbug.com/1242283. --> <selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" tools:ignore="UnusedResources"> <item android:alpha="@dimen/default_disabled_alpha" - android:color="@color/default_icon_color" android:state_enabled="false"/> - <item android:color="@color/default_icon_color_secondary" /> + android:color="@macro/default_icon_color" android:state_enabled="false"/> + <item android:color="?attr/default_icon_color_secondary" /> </selector>
diff --git a/components/browser_ui/styles/android/java/res/color/default_icon_color_tint_list.xml b/components/browser_ui/styles/android/java/res/color/default_icon_color_tint_list.xml index 05731fbc..0cc1fec 100644 --- a/components/browser_ui/styles/android/java/res/color/default_icon_color_tint_list.xml +++ b/components/browser_ui/styles/android/java/res/color/default_icon_color_tint_list.xml
@@ -1,17 +1,15 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2014 The Chromium Authors. All rights reserved. +<!-- Copyright 2021 The Chromium Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> -<!-- ColorStateList in Android L does not work as expected when pointing to - attributes. This file should be replaced with the one in color-v23 once we - stop supporting Android L. See https://crbug.com/1242283. --> + <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:alpha="@dimen/default_disabled_alpha" - android:state_enabled="false" android:color="@color/default_icon_color" /> - <item android:state_selected="true" android:color="@color/default_icon_color" /> - <item android:state_focused="true" android:color="@color/default_icon_color" /> - <item android:state_pressed="true" android:color="@color/default_icon_color" /> - <item android:state_activated="true" android:color="@color/default_icon_color" /> - <item android:color="@color/default_icon_color"/> + android:state_enabled="false" android:color="@macro/default_icon_color" /> + <item android:state_selected="true" android:color="@macro/default_icon_color" /> + <item android:state_focused="true" android:color="@macro/default_icon_color" /> + <item android:state_pressed="true" android:color="@macro/default_icon_color" /> + <item android:state_activated="true" android:color="@macro/default_icon_color" /> + <item android:color="@macro/default_icon_color"/> </selector>
diff --git a/components/browser_ui/styles/android/java/res/color/default_text_color_disabled_list.xml b/components/browser_ui/styles/android/java/res/color/default_text_color_disabled_list.xml index 04897e37..7a1973d 100644 --- a/components/browser_ui/styles/android/java/res/color/default_text_color_disabled_list.xml +++ b/components/browser_ui/styles/android/java/res/color/default_text_color_disabled_list.xml
@@ -3,10 +3,6 @@ Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> - -<!-- Color state lists don't work well with attributes on Lollipop. See https://crbug.com/1245235. - There is an attr version of this in color-v23. - TODO(https://crbug.com/1239289): Delete this once the min API is 23. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:alpha="@dimen/default_disabled_alpha" android:color="@color/default_text_color_baseline" /> + <item android:alpha="@dimen/default_disabled_alpha" android:color="?attr/colorOnSurface" /> </selector>
diff --git a/components/browser_ui/styles/android/java/res/color/default_text_color_hint_list.xml b/components/browser_ui/styles/android/java/res/color/default_text_color_hint_list.xml index 3f5dc2a..0376101 100644 --- a/components/browser_ui/styles/android/java/res/color/default_text_color_hint_list.xml +++ b/components/browser_ui/styles/android/java/res/color/default_text_color_hint_list.xml
@@ -3,12 +3,8 @@ Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> - -<!-- Color state lists don't work well with attributes on Lollipop. See https://crbug.com/1245235. - There is an attr version of this in color-v23. - TODO(https://crbug.com/1239289): Delete this once the min API is 23. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:alpha="@dimen/default_disabled_alpha" android:color="@color/default_text_color_baseline" + <item android:alpha="@dimen/default_disabled_alpha" android:color="?attr/colorOnSurface" android:state_enabled="false"/> - <item android:color="@color/default_text_color_secondary" /> + <item android:color="?attr/colorOnSurfaceVariant" /> </selector>
diff --git a/components/browser_ui/styles/android/java/res/color/default_text_color_list.xml b/components/browser_ui/styles/android/java/res/color/default_text_color_list.xml index 25507ba..abe4ba1 100644 --- a/components/browser_ui/styles/android/java/res/color/default_text_color_list.xml +++ b/components/browser_ui/styles/android/java/res/color/default_text_color_list.xml
@@ -1,14 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2018 The Chromium Authors. All rights reserved. +<!-- Copyright 2021 The Chromium Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> - -<!-- Color state lists don't work well with attributes on Lollipop. See https://crbug.com/1245235. - There is an attr version of this in color-v23. - TODO(https://crbug.com/1239289): Delete this once the min API is 23. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:alpha="@dimen/default_disabled_alpha" - android:color="@color/default_text_color_baseline" android:state_enabled="false"/> - <item android:color="@color/default_text_color_baseline" /> + android:color="?attr/colorOnSurface" android:state_enabled="false"/> + <item android:color="?attr/colorOnSurface" /> </selector>
diff --git a/components/browser_ui/styles/android/java/res/color/default_text_color_secondary_list.xml b/components/browser_ui/styles/android/java/res/color/default_text_color_secondary_list.xml index 3255c938..710d85ab 100644 --- a/components/browser_ui/styles/android/java/res/color/default_text_color_secondary_list.xml +++ b/components/browser_ui/styles/android/java/res/color/default_text_color_secondary_list.xml
@@ -3,12 +3,8 @@ Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> - -<!-- Color state lists don't work well with attributes on Lollipop. See https://crbug.com/1245235. - There is an attr version of this in color-v23. - TODO(https://crbug.com/1239289): Delete this once the min API is 23. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:alpha="@dimen/default_disabled_alpha" - android:color="@color/default_text_color_secondary" android:state_enabled="false"/> - <item android:color="@color/default_text_color_secondary" /> + android:color="?attr/colorOnSurfaceVariant" android:state_enabled="false"/> + <item android:color="?attr/colorOnSurfaceVariant" /> </selector>
diff --git a/components/browser_ui/styles/android/java/res/color/text_highlight_color.xml b/components/browser_ui/styles/android/java/res/color/text_highlight_color.xml index 44b26b9..72cb3e6 100644 --- a/components/browser_ui/styles/android/java/res/color/text_highlight_color.xml +++ b/components/browser_ui/styles/android/java/res/color/text_highlight_color.xml
@@ -4,6 +4,5 @@ found in the LICENSE file. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:alpha="@dimen/text_highlight_alpha" - android:color="@color/default_control_color_active" /> + <item android:alpha="@dimen/text_highlight_alpha" android:color="?attr/colorPrimary" /> </selector>
diff --git a/components/cast_streaming/public/BUILD.gn b/components/cast_streaming/public/BUILD.gn index ca5a3fb4..a6f01af 100644 --- a/components/cast_streaming/public/BUILD.gn +++ b/components/cast_streaming/public/BUILD.gn
@@ -31,11 +31,36 @@ ] } +source_set("remoting_utils") { + sources = [ + "remoting_proto_enum_utils.cc", + "remoting_proto_enum_utils.h", + "remoting_proto_utils.cc", + "remoting_proto_utils.h", + ] + + public_configs = + [ "//third_party/openscreen/src/build:openscreen_include_dirs" ] + + deps = [ + "//components/openscreen_platform:openscreen_platform", + "//components/openscreen_platform:openscreen_platform_network_service", + ] + + public_deps = [ + "//base", + "//media", + "//third_party/openscreen/src/cast/streaming:common", + "//third_party/openscreen/src/cast/streaming:remoting_proto", + ] +} + source_set("unit_tests") { testonly = true deps = [ ":config_conversions", ":public", + ":remoting_utils", "//base/test:test_support", "//media:test_support", "//media/mojo:test_support", @@ -43,5 +68,8 @@ "//testing/gtest", "//third_party/openscreen/src/cast/streaming:streaming_configs", ] - sources = [ "config_conversions_unittest.cc" ] + sources = [ + "config_conversions_unittest.cc", + "remoting_proto_utils_unittest.cc", + ] }
diff --git a/media/remoting/proto_enum_utils.cc b/components/cast_streaming/public/remoting_proto_enum_utils.cc similarity index 89% rename from media/remoting/proto_enum_utils.cc rename to components/cast_streaming/public/remoting_proto_enum_utils.cc index 25c2827..69a19e9a 100644 --- a/media/remoting/proto_enum_utils.cc +++ b/components/cast_streaming/public/remoting_proto_enum_utils.cc
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "media/remoting/proto_enum_utils.h" +#include "components/cast_streaming/public/remoting_proto_enum_utils.h" -namespace media { +namespace cast_streaming { namespace remoting { #define CASE_RETURN_OTHER(x) \ @@ -15,10 +15,10 @@ case OriginType::x: \ return OtherType::y -absl::optional<AudioCodec> ToMediaAudioCodec( +absl::optional<media::AudioCodec> ToMediaAudioCodec( openscreen::cast::AudioDecoderConfig::Codec value) { using OriginType = openscreen::cast::AudioDecoderConfig; - using OtherType = AudioCodec; + using OtherType = media::AudioCodec; switch (value) { CASE_RETURN_ORIGIN_TO_OTHER(kUnknownAudioCodec, kUnknown); CASE_RETURN_ORIGIN_TO_OTHER(kCodecAAC, kAAC); @@ -44,8 +44,8 @@ } absl::optional<openscreen::cast::AudioDecoderConfig::Codec> -ToProtoAudioDecoderConfigCodec(AudioCodec value) { - using OriginType = AudioCodec; +ToProtoAudioDecoderConfigCodec(media::AudioCodec value) { + using OriginType = media::AudioCodec; using OtherType = openscreen::cast::AudioDecoderConfig; switch (value) { CASE_RETURN_ORIGIN_TO_OTHER(kUnknown, kUnknownAudioCodec); @@ -71,10 +71,10 @@ } } -absl::optional<SampleFormat> ToMediaSampleFormat( +absl::optional<media::SampleFormat> ToMediaSampleFormat( openscreen::cast::AudioDecoderConfig::SampleFormat value) { using OriginType = openscreen::cast::AudioDecoderConfig; - using OtherType = SampleFormat; + using OtherType = media::SampleFormat; switch (value) { CASE_RETURN_OTHER(kUnknownSampleFormat); CASE_RETURN_OTHER(kSampleFormatU8); @@ -95,8 +95,8 @@ } absl::optional<openscreen::cast::AudioDecoderConfig::SampleFormat> -ToProtoAudioDecoderConfigSampleFormat(SampleFormat value) { - using OriginType = SampleFormat; +ToProtoAudioDecoderConfigSampleFormat(media::SampleFormat value) { + using OriginType = media::SampleFormat; using OtherType = openscreen::cast::AudioDecoderConfig; switch (value) { CASE_RETURN_OTHER(kUnknownSampleFormat); @@ -117,10 +117,10 @@ } } -absl::optional<ChannelLayout> ToMediaChannelLayout( +absl::optional<media::ChannelLayout> ToMediaChannelLayout( openscreen::cast::AudioDecoderConfig::ChannelLayout value) { using OriginType = openscreen::cast::AudioDecoderConfig; - using OtherType = ChannelLayout; + using OtherType = media::ChannelLayout; switch (value) { CASE_RETURN_OTHER(CHANNEL_LAYOUT_NONE); CASE_RETURN_OTHER(CHANNEL_LAYOUT_UNSUPPORTED); @@ -161,8 +161,8 @@ } absl::optional<openscreen::cast::AudioDecoderConfig::ChannelLayout> -ToProtoAudioDecoderConfigChannelLayout(ChannelLayout value) { - using OriginType = ChannelLayout; +ToProtoAudioDecoderConfigChannelLayout(media::ChannelLayout value) { + using OriginType = media::ChannelLayout; using OtherType = openscreen::cast::AudioDecoderConfig; switch (value) { CASE_RETURN_OTHER(CHANNEL_LAYOUT_NONE); @@ -203,10 +203,10 @@ } } -absl::optional<VideoCodec> ToMediaVideoCodec( +absl::optional<media::VideoCodec> ToMediaVideoCodec( openscreen::cast::VideoDecoderConfig::Codec value) { using OriginType = openscreen::cast::VideoDecoderConfig; - using OtherType = VideoCodec; + using OtherType = media::VideoCodec; switch (value) { CASE_RETURN_ORIGIN_TO_OTHER(kUnknownVideoCodec, kUnknown); CASE_RETURN_ORIGIN_TO_OTHER(kCodecH264, kH264); @@ -225,8 +225,8 @@ } absl::optional<openscreen::cast::VideoDecoderConfig::Codec> -ToProtoVideoDecoderConfigCodec(VideoCodec value) { - using OriginType = VideoCodec; +ToProtoVideoDecoderConfigCodec(media::VideoCodec value) { + using OriginType = media::VideoCodec; using OtherType = openscreen::cast::VideoDecoderConfig; switch (value) { CASE_RETURN_ORIGIN_TO_OTHER(kUnknown, kUnknownVideoCodec); @@ -245,10 +245,10 @@ } } -absl::optional<VideoCodecProfile> ToMediaVideoCodecProfile( +absl::optional<media::VideoCodecProfile> ToMediaVideoCodecProfile( openscreen::cast::VideoDecoderConfig::Profile value) { using OriginType = openscreen::cast::VideoDecoderConfig; - using OtherType = VideoCodecProfile; + using OtherType = media::VideoCodecProfile; switch (value) { CASE_RETURN_OTHER(VIDEO_CODEC_PROFILE_UNKNOWN); CASE_RETURN_OTHER(H264PROFILE_BASELINE); @@ -286,8 +286,8 @@ } absl::optional<openscreen::cast::VideoDecoderConfig::Profile> -ToProtoVideoDecoderConfigProfile(VideoCodecProfile value) { - using OriginType = VideoCodecProfile; +ToProtoVideoDecoderConfigProfile(media::VideoCodecProfile value) { + using OriginType = media::VideoCodecProfile; using OtherType = openscreen::cast::VideoDecoderConfig; switch (value) { CASE_RETURN_OTHER(VIDEO_CODEC_PROFILE_UNKNOWN); @@ -325,10 +325,10 @@ } } -absl::optional<VideoPixelFormat> ToMediaVideoPixelFormat( +absl::optional<media::VideoPixelFormat> ToMediaVideoPixelFormat( openscreen::cast::VideoDecoderConfig::Format value) { using OriginType = openscreen::cast::VideoDecoderConfig; - using OtherType = VideoPixelFormat; + using OtherType = media::VideoPixelFormat; switch (value) { CASE_RETURN_OTHER(PIXEL_FORMAT_UNKNOWN); CASE_RETURN_OTHER(PIXEL_FORMAT_I420); @@ -366,10 +366,10 @@ } } -absl::optional<BufferingState> ToMediaBufferingState( +absl::optional<media::BufferingState> ToMediaBufferingState( openscreen::cast::RendererClientOnBufferingStateChange::State value) { using OriginType = openscreen::cast::RendererClientOnBufferingStateChange; - using OtherType = BufferingState; + using OtherType = media::BufferingState; switch (value) { CASE_RETURN_OTHER(BUFFERING_HAVE_NOTHING); CASE_RETURN_OTHER(BUFFERING_HAVE_ENOUGH); @@ -379,8 +379,8 @@ } absl::optional<openscreen::cast::RendererClientOnBufferingStateChange::State> -ToProtoMediaBufferingState(BufferingState value) { - using OriginType = BufferingState; +ToProtoMediaBufferingState(media::BufferingState value) { + using OriginType = media::BufferingState; using OtherType = openscreen::cast::RendererClientOnBufferingStateChange; switch (value) { CASE_RETURN_OTHER(BUFFERING_HAVE_NOTHING); @@ -390,10 +390,10 @@ } } -absl::optional<DemuxerStream::Status> ToDemuxerStreamStatus( +absl::optional<media::DemuxerStream::Status> ToDemuxerStreamStatus( openscreen::cast::DemuxerStreamReadUntilCallback::Status value) { using OriginType = openscreen::cast::DemuxerStreamReadUntilCallback; - using OtherType = DemuxerStream; + using OtherType = media::DemuxerStream; switch (value) { CASE_RETURN_OTHER(kOk); CASE_RETURN_OTHER(kAborted); @@ -405,8 +405,8 @@ } absl::optional<openscreen::cast::DemuxerStreamReadUntilCallback::Status> -ToProtoDemuxerStreamStatus(DemuxerStream::Status value) { - using OriginType = DemuxerStream; +ToProtoDemuxerStreamStatus(media::DemuxerStream::Status value) { + using OriginType = media::DemuxerStream; using OtherType = openscreen::cast::DemuxerStreamReadUntilCallback; switch (value) { CASE_RETURN_OTHER(kOk); @@ -419,4 +419,4 @@ } } // namespace remoting -} // namespace media +} // namespace cast_streaming
diff --git a/media/remoting/proto_enum_utils.h b/components/cast_streaming/public/remoting_proto_enum_utils.h similarity index 63% rename from media/remoting/proto_enum_utils.h rename to components/cast_streaming/public/remoting_proto_enum_utils.h index 1748d4f..c21149d 100644 --- a/media/remoting/proto_enum_utils.h +++ b/components/cast_streaming/public/remoting_proto_enum_utils.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_REMOTING_PROTO_ENUM_UTILS_H_ -#define MEDIA_REMOTING_PROTO_ENUM_UTILS_H_ +#ifndef COMPONENTS_CAST_STREAMING_PUBLIC_REMOTING_PROTO_ENUM_UTILS_H_ +#define COMPONENTS_CAST_STREAMING_PUBLIC_REMOTING_PROTO_ENUM_UTILS_H_ #include "media/base/audio_codecs.h" #include "media/base/buffering_state.h" @@ -15,7 +15,7 @@ #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/openscreen/src/cast/streaming/remoting.pb.h" -namespace media { +namespace cast_streaming { namespace remoting { // The following functions map between the enum values in media/base modules and @@ -27,45 +27,45 @@ // Each returns a absl::optional value. If it is not set, that indicates the // conversion failed. -absl::optional<AudioCodec> ToMediaAudioCodec( +absl::optional<media::AudioCodec> ToMediaAudioCodec( openscreen::cast::AudioDecoderConfig::Codec value); absl::optional<openscreen::cast::AudioDecoderConfig::Codec> -ToProtoAudioDecoderConfigCodec(AudioCodec value); +ToProtoAudioDecoderConfigCodec(media::AudioCodec value); -absl::optional<SampleFormat> ToMediaSampleFormat( +absl::optional<media::SampleFormat> ToMediaSampleFormat( openscreen::cast::AudioDecoderConfig::SampleFormat value); absl::optional<openscreen::cast::AudioDecoderConfig::SampleFormat> -ToProtoAudioDecoderConfigSampleFormat(SampleFormat value); +ToProtoAudioDecoderConfigSampleFormat(media::SampleFormat value); -absl::optional<ChannelLayout> ToMediaChannelLayout( +absl::optional<media::ChannelLayout> ToMediaChannelLayout( openscreen::cast::AudioDecoderConfig::ChannelLayout value); absl::optional<openscreen::cast::AudioDecoderConfig::ChannelLayout> -ToProtoAudioDecoderConfigChannelLayout(ChannelLayout value); +ToProtoAudioDecoderConfigChannelLayout(media::ChannelLayout value); -absl::optional<VideoCodec> ToMediaVideoCodec( +absl::optional<media::VideoCodec> ToMediaVideoCodec( openscreen::cast::VideoDecoderConfig::Codec value); absl::optional<openscreen::cast::VideoDecoderConfig::Codec> -ToProtoVideoDecoderConfigCodec(VideoCodec value); +ToProtoVideoDecoderConfigCodec(media::VideoCodec value); -absl::optional<VideoCodecProfile> ToMediaVideoCodecProfile( +absl::optional<media::VideoCodecProfile> ToMediaVideoCodecProfile( openscreen::cast::VideoDecoderConfig::Profile value); absl::optional<openscreen::cast::VideoDecoderConfig::Profile> -ToProtoVideoDecoderConfigProfile(VideoCodecProfile value); +ToProtoVideoDecoderConfigProfile(media::VideoCodecProfile value); -absl::optional<VideoPixelFormat> ToMediaVideoPixelFormat( +absl::optional<media::VideoPixelFormat> ToMediaVideoPixelFormat( openscreen::cast::VideoDecoderConfig::Format value); -absl::optional<BufferingState> ToMediaBufferingState( +absl::optional<media::BufferingState> ToMediaBufferingState( openscreen::cast::RendererClientOnBufferingStateChange::State value); absl::optional<openscreen::cast::RendererClientOnBufferingStateChange::State> -ToProtoMediaBufferingState(BufferingState value); +ToProtoMediaBufferingState(media::BufferingState value); -absl::optional<DemuxerStream::Status> ToDemuxerStreamStatus( +absl::optional<media::DemuxerStream::Status> ToDemuxerStreamStatus( openscreen::cast::DemuxerStreamReadUntilCallback::Status value); absl::optional<openscreen::cast::DemuxerStreamReadUntilCallback::Status> -ToProtoDemuxerStreamStatus(DemuxerStream::Status value); +ToProtoDemuxerStreamStatus(media::DemuxerStream::Status value); } // namespace remoting -} // namespace media +} // namespace cast_streaming -#endif // MEDIA_REMOTING_PROTO_ENUM_UTILS_H_ +#endif // COMPONENTS_CAST_STREAMING_PUBLIC_REMOTING_PROTO_ENUM_UTILS_H_
diff --git a/media/remoting/proto_utils.cc b/components/cast_streaming/public/remoting_proto_utils.cc similarity index 83% rename from media/remoting/proto_utils.cc rename to components/cast_streaming/public/remoting_proto_utils.cc index 0d746eb..faab555 100644 --- a/media/remoting/proto_utils.cc +++ b/components/cast_streaming/public/remoting_proto_utils.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "media/remoting/proto_utils.h" +#include "components/cast_streaming/public/remoting_proto_utils.h" #include <algorithm> @@ -10,11 +10,11 @@ #include "base/logging.h" #include "base/time/time.h" #include "base/values.h" +#include "components/cast_streaming/public/remoting_proto_enum_utils.h" #include "media/base/encryption_scheme.h" #include "media/base/timestamp_constants.h" -#include "media/remoting/proto_enum_utils.h" -namespace media { +namespace cast_streaming { namespace remoting { namespace { @@ -23,12 +23,12 @@ constexpr size_t kProtoBufferHeaderSize = sizeof(uint16_t); constexpr size_t kDataBufferHeaderSize = sizeof(uint32_t); -scoped_refptr<DecoderBuffer> ConvertProtoToDecoderBuffer( +scoped_refptr<media::DecoderBuffer> ConvertProtoToDecoderBuffer( const openscreen::cast::DecoderBuffer& buffer_message, - scoped_refptr<DecoderBuffer> buffer) { + scoped_refptr<media::DecoderBuffer> buffer) { if (buffer_message.is_eos()) { VLOG(1) << "EOS data"; - return DecoderBuffer::CreateEOSBuffer(); + return media::DecoderBuffer::CreateEOSBuffer(); } if (buffer_message.has_timestamp_usec()) { @@ -58,7 +58,7 @@ if (has_discard) { buffer->set_discard_padding( - DecoderBuffer::DiscardPadding(front_discard, back_discard)); + media::DecoderBuffer::DiscardPadding(front_discard, back_discard)); } if (buffer_message.has_side_data()) { @@ -71,7 +71,7 @@ } void ConvertDecoderBufferToProto( - const DecoderBuffer& decoder_buffer, + const media::DecoderBuffer& decoder_buffer, openscreen::cast::DecoderBuffer* buffer_message) { if (decoder_buffer.end_of_stream()) { buffer_message->set_is_eos(true); @@ -98,8 +98,9 @@ } // namespace -scoped_refptr<DecoderBuffer> ByteArrayToDecoderBuffer(const uint8_t* data, - uint32_t size) { +scoped_refptr<media::DecoderBuffer> ByteArrayToDecoderBuffer( + const uint8_t* data, + uint32_t size) { base::BigEndianReader reader(data, size); uint8_t payload_version = 0; uint16_t proto_size = 0; @@ -113,10 +114,11 @@ // Deserialize proto buffer. It passes the pre allocated DecoderBuffer into // the function because the proto buffer may overwrite DecoderBuffer since // it may be EOS buffer. - scoped_refptr<DecoderBuffer> decoder_buffer = ConvertProtoToDecoderBuffer( - segment, - DecoderBuffer::CopyFrom(reinterpret_cast<const uint8_t*>(reader.ptr()), - buffer_size)); + scoped_refptr<media::DecoderBuffer> decoder_buffer = + ConvertProtoToDecoderBuffer( + segment, + media::DecoderBuffer::CopyFrom( + reinterpret_cast<const uint8_t*>(reader.ptr()), buffer_size)); return decoder_buffer; } @@ -124,7 +126,7 @@ } std::vector<uint8_t> DecoderBufferToByteArray( - const DecoderBuffer& decoder_buffer) { + const media::DecoderBuffer& decoder_buffer) { openscreen::cast::DecoderBuffer decoder_buffer_message; ConvertDecoderBufferToProto(decoder_buffer, &decoder_buffer_message); @@ -158,7 +160,7 @@ } void ConvertAudioDecoderConfigToProto( - const AudioDecoderConfig& audio_config, + const media::AudioDecoderConfig& audio_config, openscreen::cast::AudioDecoderConfig* audio_message) { DCHECK(audio_config.IsValidConfig()); DCHECK(audio_message); @@ -184,7 +186,7 @@ bool ConvertProtoToAudioDecoderConfig( const openscreen::cast::AudioDecoderConfig& audio_message, - AudioDecoderConfig* audio_config) { + media::AudioDecoderConfig* audio_config) { DCHECK(audio_config); audio_config->Initialize( ToMediaAudioCodec(audio_message.codec()).value(), @@ -193,14 +195,14 @@ audio_message.samples_per_second(), std::vector<uint8_t>(audio_message.extra_data().begin(), audio_message.extra_data().end()), - EncryptionScheme::kUnencrypted, + media::EncryptionScheme::kUnencrypted, base::Microseconds(audio_message.seek_preroll_usec()), audio_message.codec_delay()); return audio_config->IsValidConfig(); } void ConvertVideoDecoderConfigToProto( - const VideoDecoderConfig& video_config, + const media::VideoDecoderConfig& video_config, openscreen::cast::VideoDecoderConfig* video_message) { DCHECK(video_config.IsValidConfig()); DCHECK(video_message); @@ -211,18 +213,21 @@ ToProtoVideoDecoderConfigProfile(video_config.profile()).value()); // TODO(dalecurtis): Remove |format| it's now unused. video_message->set_format( - video_config.alpha_mode() == VideoDecoderConfig::AlphaMode::kHasAlpha + video_config.alpha_mode() == + media::VideoDecoderConfig::AlphaMode::kHasAlpha ? openscreen::cast::VideoDecoderConfig::PIXEL_FORMAT_I420A : openscreen::cast::VideoDecoderConfig::PIXEL_FORMAT_I420); // TODO(hubbe): Update proto to use color_space_info() - if (video_config.color_space_info() == VideoColorSpace::JPEG()) { + if (video_config.color_space_info() == media::VideoColorSpace::JPEG()) { video_message->set_color_space( openscreen::cast::VideoDecoderConfig::COLOR_SPACE_JPEG); - } else if (video_config.color_space_info() == VideoColorSpace::REC709()) { + } else if (video_config.color_space_info() == + media::VideoColorSpace::REC709()) { video_message->set_color_space( openscreen::cast::VideoDecoderConfig::COLOR_SPACE_HD_REC709); - } else if (video_config.color_space_info() == VideoColorSpace::REC601()) { + } else if (video_config.color_space_info() == + media::VideoColorSpace::REC601()) { video_message->set_color_space( openscreen::cast::VideoDecoderConfig::COLOR_SPACE_SD_REC601); } else { @@ -255,31 +260,31 @@ bool ConvertProtoToVideoDecoderConfig( const openscreen::cast::VideoDecoderConfig& video_message, - VideoDecoderConfig* video_config) { + media::VideoDecoderConfig* video_config) { DCHECK(video_config); // TODO(hubbe): Update pb to use VideoColorSpace - VideoColorSpace color_space; + media::VideoColorSpace color_space; switch (video_message.color_space()) { case openscreen::cast::VideoDecoderConfig::COLOR_SPACE_UNSPECIFIED: break; case openscreen::cast::VideoDecoderConfig::COLOR_SPACE_JPEG: - color_space = VideoColorSpace::JPEG(); + color_space = media::VideoColorSpace::JPEG(); break; case openscreen::cast::VideoDecoderConfig::COLOR_SPACE_HD_REC709: - color_space = VideoColorSpace::REC709(); + color_space = media::VideoColorSpace::REC709(); break; case openscreen::cast::VideoDecoderConfig::COLOR_SPACE_SD_REC601: - color_space = VideoColorSpace::REC601(); + color_space = media::VideoColorSpace::REC601(); break; } video_config->Initialize( ToMediaVideoCodec(video_message.codec()).value(), ToMediaVideoCodecProfile(video_message.profile()).value(), IsOpaque(ToMediaVideoPixelFormat(video_message.format()).value()) - ? VideoDecoderConfig::AlphaMode::kIsOpaque - : VideoDecoderConfig::AlphaMode::kHasAlpha, - color_space, kNoTransformation, + ? media::VideoDecoderConfig::AlphaMode::kIsOpaque + : media::VideoDecoderConfig::AlphaMode::kHasAlpha, + color_space, media::kNoTransformation, gfx::Size(video_message.coded_size().width(), video_message.coded_size().height()), gfx::Rect(video_message.visible_rect().x(), @@ -290,13 +295,13 @@ video_message.natural_size().height()), std::vector<uint8_t>(video_message.extra_data().begin(), video_message.extra_data().end()), - EncryptionScheme::kUnencrypted); + media::EncryptionScheme::kUnencrypted); return video_config->IsValidConfig(); } void ConvertProtoToPipelineStatistics( const openscreen::cast::PipelineStatistics& stats_message, - PipelineStatistics* stats) { + media::PipelineStatistics* stats) { stats->audio_bytes_decoded = stats_message.audio_bytes_decoded(); stats->video_bytes_decoded = stats_message.video_bytes_decoded(); stats->video_frames_decoded = stats_message.video_frames_decoded(); @@ -315,20 +320,20 @@ if (stats_message.has_audio_decoder_info()) { auto audio_info = stats_message.audio_decoder_info(); stats->audio_pipeline_info.decoder_type = - static_cast<AudioDecoderType>(audio_info.decoder_type()); + static_cast<media::AudioDecoderType>(audio_info.decoder_type()); stats->audio_pipeline_info.is_platform_decoder = audio_info.is_platform_decoder(); stats->audio_pipeline_info.has_decrypting_demuxer_stream = false; - stats->audio_pipeline_info.encryption_type = EncryptionType::kClear; + stats->audio_pipeline_info.encryption_type = media::EncryptionType::kClear; } if (stats_message.has_video_decoder_info()) { auto video_info = stats_message.video_decoder_info(); stats->video_pipeline_info.decoder_type = - static_cast<VideoDecoderType>(video_info.decoder_type()); + static_cast<media::VideoDecoderType>(video_info.decoder_type()); stats->video_pipeline_info.is_platform_decoder = video_info.is_platform_decoder(); stats->video_pipeline_info.has_decrypting_demuxer_stream = false; - stats->video_pipeline_info.encryption_type = EncryptionType::kClear; + stats->video_pipeline_info.encryption_type = media::EncryptionType::kClear; } if (stats_message.has_video_frame_duration_average_usec()) { stats->video_frame_duration_average = @@ -337,4 +342,4 @@ } } // namespace remoting -} // namespace media +} // namespace cast_streaming
diff --git a/media/remoting/proto_utils.h b/components/cast_streaming/public/remoting_proto_utils.h similarity index 79% rename from media/remoting/proto_utils.h rename to components/cast_streaming/public/remoting_proto_utils.h index 074e9e34..0fc4faa 100644 --- a/media/remoting/proto_utils.h +++ b/components/cast_streaming/public/remoting_proto_utils.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_REMOTING_PROTO_UTILS_H_ -#define MEDIA_REMOTING_PROTO_UTILS_H_ +#ifndef COMPONENTS_CAST_STREAMING_PUBLIC_REMOTING_PROTO_UTILS_H_ +#define COMPONENTS_CAST_STREAMING_PUBLIC_REMOTING_PROTO_UTILS_H_ #include <cstdint> #include <vector> @@ -16,7 +16,7 @@ #include "media/base/video_decoder_config.h" #include "third_party/openscreen/src/cast/streaming/remoting.pb.h" -namespace media { +namespace cast_streaming { namespace remoting { // Utility class to convert data between media::DecoderBuffer and byte array. @@ -47,34 +47,35 @@ // Converts DecoderBufferSegment into byte array. std::vector<uint8_t> DecoderBufferToByteArray( - const DecoderBuffer& decoder_buffer); + const media::DecoderBuffer& decoder_buffer); // Converts byte array into DecoderBufferSegment. -scoped_refptr<DecoderBuffer> ByteArrayToDecoderBuffer(const uint8_t* data, - uint32_t size); +scoped_refptr<media::DecoderBuffer> ByteArrayToDecoderBuffer( + const uint8_t* data, + uint32_t size); // Data type conversion between media::AudioDecoderConfig and proto buffer. void ConvertAudioDecoderConfigToProto( - const AudioDecoderConfig& audio_config, + const media::AudioDecoderConfig& audio_config, openscreen::cast::AudioDecoderConfig* audio_message); bool ConvertProtoToAudioDecoderConfig( const openscreen::cast::AudioDecoderConfig& audio_message, - AudioDecoderConfig* audio_config); + media::AudioDecoderConfig* audio_config); // Data type conversion between media::VideoDecoderConfig and proto buffer. void ConvertVideoDecoderConfigToProto( - const VideoDecoderConfig& video_config, + const media::VideoDecoderConfig& video_config, openscreen::cast::VideoDecoderConfig* video_message); bool ConvertProtoToVideoDecoderConfig( const openscreen::cast::VideoDecoderConfig& video_message, - VideoDecoderConfig* video_config); + media::VideoDecoderConfig* video_config); // Data type conversion between media::VideoDecoderConfig and proto buffer. void ConvertProtoToPipelineStatistics( const openscreen::cast::PipelineStatistics& stats_message, - PipelineStatistics* stats); + media::PipelineStatistics* stats); } // namespace remoting -} // namespace media +} // namespace cast_streaming -#endif // MEDIA_REMOTING_PROTO_UTILS_H_ +#endif // COMPONENTS_CAST_STREAMING_PUBLIC_REMOTING_PROTO_UTILS_H_
diff --git a/media/remoting/proto_utils_unittest.cc b/components/cast_streaming/public/remoting_proto_utils_unittest.cc similarity index 83% rename from media/remoting/proto_utils_unittest.cc rename to components/cast_streaming/public/remoting_proto_utils_unittest.cc index c22d932..47dc1fd5 100644 --- a/media/remoting/proto_utils_unittest.cc +++ b/components/cast_streaming/public/remoting_proto_utils_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "media/remoting/proto_utils.h" +#include "components/cast_streaming/public/remoting_proto_utils.h" #include <memory> #include <string> @@ -24,7 +24,7 @@ using testing::Invoke; using testing::Return; -namespace media { +namespace cast_streaming { namespace remoting { class ProtoUtilsTest : public testing::Test { @@ -34,13 +34,14 @@ TEST_F(ProtoUtilsTest, PassEOSDecoderBuffer) { // 1. To DecoderBuffer - scoped_refptr<DecoderBuffer> input_buffer = DecoderBuffer::CreateEOSBuffer(); + scoped_refptr<media::DecoderBuffer> input_buffer = + media::DecoderBuffer::CreateEOSBuffer(); // 2. To Byte Array std::vector<uint8_t> data = DecoderBufferToByteArray(*input_buffer); // 3. To DecoderBuffer - scoped_refptr<DecoderBuffer> output_buffer = + scoped_refptr<media::DecoderBuffer> output_buffer = ByteArrayToDecoderBuffer(data.data(), data.size()); DCHECK(output_buffer); @@ -67,8 +68,9 @@ base::TimeDelta pts = base::Milliseconds(5); // 1. To DecoderBuffer - scoped_refptr<DecoderBuffer> input_buffer = DecoderBuffer::CopyFrom( - buffer, buffer_size, side_buffer, side_buffer_size); + scoped_refptr<media::DecoderBuffer> input_buffer = + media::DecoderBuffer::CopyFrom(buffer, buffer_size, side_buffer, + side_buffer_size); input_buffer->set_timestamp(pts); input_buffer->set_is_key_frame(true); @@ -76,7 +78,7 @@ std::vector<uint8_t> data = DecoderBufferToByteArray(*input_buffer); // 3. To DecoderBuffer - scoped_refptr<DecoderBuffer> output_buffer = + scoped_refptr<media::DecoderBuffer> output_buffer = ByteArrayToDecoderBuffer(data.data(), data.size()); DCHECK(output_buffer); @@ -97,16 +99,17 @@ TEST_F(ProtoUtilsTest, AudioDecoderConfigConversionTest) { const char extra_data[4] = {'A', 'C', 'E', 'G'}; - AudioDecoderConfig audio_config( - AudioCodec::kAAC, kSampleFormatF32, CHANNEL_LAYOUT_MONO, 48000, + media::AudioDecoderConfig audio_config( + media::AudioCodec::kAAC, media::kSampleFormatF32, + media::CHANNEL_LAYOUT_MONO, 48000, std::vector<uint8_t>(std::begin(extra_data), std::end(extra_data)), - EncryptionScheme::kUnencrypted); + media::EncryptionScheme::kUnencrypted); ASSERT_TRUE(audio_config.IsValidConfig()); openscreen::cast::AudioDecoderConfig audio_message; ConvertAudioDecoderConfigToProto(audio_config, &audio_message); - AudioDecoderConfig audio_output_config; + media::AudioDecoderConfig audio_output_config; ASSERT_TRUE( ConvertProtoToAudioDecoderConfig(audio_message, &audio_output_config)); @@ -114,7 +117,7 @@ } TEST_F(ProtoUtilsTest, PipelineStatisticsConversion) { - PipelineStatistics original; + media::PipelineStatistics original; // NOTE: all fields should be initialised here. original.audio_bytes_decoded = 123; original.video_bytes_decoded = 456; @@ -157,16 +160,18 @@ pb_audio_info->set_is_platform_decoder( original.audio_pipeline_info.is_platform_decoder); - PipelineStatistics converted; + media::PipelineStatistics converted; // NOTE: fields will all be initialized with 0xcd. Forcing the conversion to // properly assigned them. Since nested structs have strings, memsetting must // be done infividually for them. memset(&converted, 0xcd, - sizeof(converted) - sizeof(AudioPipelineInfo) - - sizeof(VideoPipelineInfo)); - memset(&converted.audio_pipeline_info, 0xcd, sizeof(AudioPipelineInfo)); - memset(&converted.video_pipeline_info, 0xcd, sizeof(VideoPipelineInfo)); + sizeof(converted) - sizeof(media::AudioPipelineInfo) - + sizeof(media::VideoPipelineInfo)); + memset(&converted.audio_pipeline_info, 0xcd, + sizeof(media::AudioPipelineInfo)); + memset(&converted.video_pipeline_info, 0xcd, + sizeof(media::VideoPipelineInfo)); ConvertProtoToPipelineStatistics(pb_stats, &converted); @@ -176,14 +181,15 @@ } TEST_F(ProtoUtilsTest, VideoDecoderConfigConversionTest) { - const VideoDecoderConfig video_config = TestVideoConfig::Normal(); + const media::VideoDecoderConfig video_config = + media::TestVideoConfig::Normal(); ASSERT_TRUE(video_config.IsValidConfig()); openscreen::cast::VideoDecoderConfig message; ConvertVideoDecoderConfigToProto(video_config, &message); - VideoDecoderConfig converted; + media::VideoDecoderConfig converted; ASSERT_TRUE(ConvertProtoToVideoDecoderConfig(message, &converted)); ASSERT_TRUE(converted.Matches(video_config)); } } // namespace remoting -} // namespace media +} // namespace cast_streaming
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc index 446a087..f0146fca 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc
@@ -51,11 +51,10 @@ // Returns the value at |index| of |list_value| as an int64_t. int64_t GetInt64PrefValue(const base::ListValue& list_value, size_t index) { int64_t val = 0; - std::string pref_value; - bool rv = list_value.GetString(index, &pref_value); - DCHECK(rv); - if (rv) { - rv = base::StringToInt64(pref_value, &val); + base::Value::ConstListView list_value_view = list_value.GetList(); + if (index < list_value_view.size() && list_value_view[index].is_string()) { + std::string pref_value = list_value_view[index].GetString(); + bool rv = base::StringToInt64(pref_value, &val); DCHECK(rv); } return val;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc index 81ffa6f..254e98c9 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc
@@ -41,7 +41,12 @@ int64_t GetListPrefInt64Value(const base::ListValue& list_update, size_t index) { std::string string_value; - EXPECT_TRUE(list_update.GetString(index, &string_value)); + base::Value::ConstListView list_view = list_update.GetList(); + if (index < list_view.size() && list_view[index].is_string()) { + string_value = list_view[index].GetString(); + } else { + ADD_FAILURE() << "invalid index or [index] not a string"; + } int64_t value = 0; EXPECT_TRUE(base::StringToInt64(string_value, &value));
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs_unittest.cc index ba79166..455de14 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs_unittest.cc
@@ -50,10 +50,14 @@ int64_t starting_value, PrefService* pref_service) { const base::ListValue* list_value = pref_service->GetList(pref_name); + base::Value::ConstListView list_view = list_value->GetList(); for (int64_t i = 0; i < 10L; ++i) { std::string string_value; int64_t value; - list_value->GetString(i, &string_value); + if (static_cast<size_t>(i) < list_view.size() && + list_view[i].is_string()) { + string_value = list_view[i].GetString(); + } base::StringToInt64(string_value, &value); EXPECT_EQ(i + starting_value, value); }
diff --git a/components/desks_storage/core/desk_model.h b/components/desks_storage/core/desk_model.h index 591dedc0..d68b047d 100644 --- a/components/desks_storage/core/desk_model.h +++ b/components/desks_storage/core/desk_model.h
@@ -65,7 +65,7 @@ using GetAllEntriesCallback = base::OnceCallback<void(GetAllEntriesStatus status, - std::vector<ash::DeskTemplate*> entries)>; + const std::vector<ash::DeskTemplate*>& entries)>; // Returns a vector of entries in the model. virtual void GetAllEntries(GetAllEntriesCallback callback) = 0; @@ -145,4 +145,4 @@ } // namespace desks_storage -#endif // COMPONENTS_DESKS_STORAGE_CORE_DESK_MODEL_H_ \ No newline at end of file +#endif // COMPONENTS_DESKS_STORAGE_CORE_DESK_MODEL_H_
diff --git a/components/desks_storage/core/desk_sync_bridge_unittest.cc b/components/desks_storage/core/desk_sync_bridge_unittest.cc index 8770a49..a0e35ec 100644 --- a/components/desks_storage/core/desk_sync_bridge_unittest.cc +++ b/components/desks_storage/core/desk_sync_bridge_unittest.cc
@@ -552,9 +552,9 @@ EXPECT_EQ(4ul, bridge()->GetAllEntryUuids().size()); base::RunLoop loop; - bridge()->GetAllEntries( - base::BindLambdaForTesting([&](DeskModel::GetAllEntriesStatus status, - std::vector<ash::DeskTemplate*> entries) { + bridge()->GetAllEntries(base::BindLambdaForTesting( + [&](DeskModel::GetAllEntriesStatus status, + const std::vector<ash::DeskTemplate*>& entries) { EXPECT_EQ(status, DeskModel::GetAllEntriesStatus::kOk); EXPECT_EQ(entries.size(), 4ul);
diff --git a/components/desks_storage/core/local_desks_data_manager_unittests.cc b/components/desks_storage/core/local_desks_data_manager_unittests.cc index f6e0362..ba11cf1 100644 --- a/components/desks_storage/core/local_desks_data_manager_unittests.cc +++ b/components/desks_storage/core/local_desks_data_manager_unittests.cc
@@ -256,9 +256,9 @@ base::BindOnce(&VerifyEntryAddedCorrectly)); base::RunLoop loop; - data_manager_->GetAllEntries( - base::BindLambdaForTesting([&](DeskModel::GetAllEntriesStatus status, - std::vector<ash::DeskTemplate*> entries) { + data_manager_->GetAllEntries(base::BindLambdaForTesting( + [&](DeskModel::GetAllEntriesStatus status, + const std::vector<ash::DeskTemplate*>& entries) { EXPECT_EQ(status, DeskModel::GetAllEntriesStatus::kOk); EXPECT_EQ(entries.size(), 3ul); EXPECT_TRUE(FindUuidInUuidList(kTestUuid1, entries)); @@ -285,9 +285,9 @@ data_manager_->SetPolicyDeskTemplates(kPolicyWithOneTemplate); base::RunLoop loop; - data_manager_->GetAllEntries( - base::BindLambdaForTesting([&](DeskModel::GetAllEntriesStatus status, - std::vector<ash::DeskTemplate*> entries) { + data_manager_->GetAllEntries(base::BindLambdaForTesting( + [&](DeskModel::GetAllEntriesStatus status, + const std::vector<ash::DeskTemplate*>& entries) { EXPECT_EQ(status, DeskModel::GetAllEntriesStatus::kOk); EXPECT_EQ(entries.size(), 4ul); EXPECT_TRUE(FindUuidInUuidList(kTestUuid1, entries)); @@ -325,9 +325,9 @@ base::BindOnce(&VerifyEntryAddedCorrectly)); base::RunLoop loop; - data_manager_->GetAllEntries( - base::BindLambdaForTesting([&](DeskModel::GetAllEntriesStatus status, - std::vector<ash::DeskTemplate*> entries) { + data_manager_->GetAllEntries(base::BindLambdaForTesting( + [&](DeskModel::GetAllEntriesStatus status, + const std::vector<ash::DeskTemplate*>& entries) { EXPECT_EQ(status, DeskModel::GetAllEntriesStatus::kOk); EXPECT_EQ(entries.size(), 3ul); EXPECT_TRUE(FindUuidInUuidList(kTestUuid1, entries)); @@ -363,9 +363,9 @@ base::BindOnce(&VerifyEntryAddedCorrectly)); base::RunLoop loop; - data_manager_->GetAllEntries( - base::BindLambdaForTesting([&](DeskModel::GetAllEntriesStatus status, - std::vector<ash::DeskTemplate*> entries) { + data_manager_->GetAllEntries(base::BindLambdaForTesting( + [&](DeskModel::GetAllEntriesStatus status, + const std::vector<ash::DeskTemplate*>& entries) { EXPECT_EQ(status, DeskModel::GetAllEntriesStatus::kOk); EXPECT_EQ(entries.size(), 3ul); EXPECT_TRUE(FindUuidInUuidList(kTestUuid7, entries)); @@ -488,9 +488,9 @@ EXPECT_EQ(status, DeskModel::DeleteEntryStatus::kOk); })); - data_manager_->GetAllEntries( - base::BindLambdaForTesting([&](DeskModel::GetAllEntriesStatus status, - std::vector<ash::DeskTemplate*> entries) { + data_manager_->GetAllEntries(base::BindLambdaForTesting( + [&](DeskModel::GetAllEntriesStatus status, + const std::vector<ash::DeskTemplate*>& entries) { EXPECT_EQ(status, DeskModel::GetAllEntriesStatus::kOk); EXPECT_EQ(entries.size(), 0ul); loop.Quit(); @@ -516,9 +516,9 @@ EXPECT_EQ(status, DeskModel::DeleteEntryStatus::kOk); })); - data_manager_->GetAllEntries( - base::BindLambdaForTesting([&](DeskModel::GetAllEntriesStatus status, - std::vector<ash::DeskTemplate*> entries) { + data_manager_->GetAllEntries(base::BindLambdaForTesting( + [&](DeskModel::GetAllEntriesStatus status, + const std::vector<ash::DeskTemplate*>& entries) { EXPECT_EQ(status, DeskModel::GetAllEntriesStatus::kOk); EXPECT_EQ(entries.size(), 0ul); loop.Quit();
diff --git a/components/download/internal/common/BUILD.gn b/components/download/internal/common/BUILD.gn index 02bfc598..d411fe0 100644 --- a/components/download/internal/common/BUILD.gn +++ b/components/download/internal/common/BUILD.gn
@@ -159,6 +159,7 @@ "download_path_reservation_tracker_unittest.cc", "download_stats_unittest.cc", "download_ukm_helper_unittest.cc", + "download_utils_unittest.cc", "parallel_download_job_unittest.cc", "parallel_download_utils_unittest.cc", "rate_estimator_unittest.cc",
diff --git a/components/download/internal/common/download_job_factory.cc b/components/download/internal/common/download_job_factory.cc index 36fa704..31d7222 100644 --- a/components/download/internal/common/download_job_factory.cc +++ b/components/download/internal/common/download_job_factory.cc
@@ -85,10 +85,21 @@ bool range_support_allowed = create_info.accept_range == RangeRequestSupportType::kSupport || create_info.accept_range == RangeRequestSupportType::kUnknown; + bool is_parallelizable = has_strong_validator && range_support_allowed && has_content_length && satisfy_min_file_size && satisfy_connection_type && http_get_method && can_support_parallel_requests; + + if (base::FeatureList::IsEnabled(features::kDownloadRange)) { + // Don't use parallel download if the caller wants to fetch with range + // request explicitly. + bool arbitrary_range_request = + create_info.save_info && + create_info.save_info->IsArbitraryRangeRequest(); + is_parallelizable = is_parallelizable && !arbitrary_range_request; + } + return is_parallelizable; }
diff --git a/components/download/internal/common/download_utils.cc b/components/download/internal/common/download_utils.cc index 666deb4..0925ff9c 100644 --- a/components/download/internal/common/download_utils.cc +++ b/components/download/internal/common/download_utils.cc
@@ -88,6 +88,11 @@ headers->SetHeaderIfMissing(header.first, header.second); } +// Return whether the download is explicitly to fetch part of the file. +bool IsArbitraryRangeRequest(DownloadSaveInfo* save_info) { + return save_info && save_info->IsArbitraryRangeRequest(); +} + } // namespace const uint32_t DownloadItem::kInvalidId = 0; @@ -186,9 +191,30 @@ result = DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED; } + // Handle normal errors which are not related to range requests. if (result != DOWNLOAD_INTERRUPT_REASON_NONE && !fetch_error_body) return result; + int64_t first_byte = -1; + int64_t last_byte = -1; + int64_t length = -1; + + // Explicitly range request. + if (base::FeatureList::IsEnabled(features::kDownloadRange) && + IsArbitraryRangeRequest(save_info)) { + // Only 206 response is allowed. + if (http_headers.response_code() != net::HTTP_PARTIAL_CONTENT) { + return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; + } + + // Must has valid range response header. + if (!http_headers.GetContentRangeFor206(&first_byte, &last_byte, &length)) { + return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; + } + + return DOWNLOAD_INTERRUPT_REASON_NONE; + } + // The caller is expecting a partial response. if (save_info && save_info->offset > 0) { if (http_headers.response_code() != net::HTTP_PARTIAL_CONTENT) { @@ -203,9 +229,6 @@ return DOWNLOAD_INTERRUPT_REASON_NONE; } - int64_t first_byte = -1; - int64_t last_byte = -1; - int64_t length = -1; if (!http_headers.GetContentRangeFor206(&first_byte, &last_byte, &length)) return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; DCHECK_GE(first_byte, 0); @@ -219,6 +242,7 @@ return DOWNLOAD_INTERRUPT_REASON_NONE; } + // For non range request. if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT;
diff --git a/components/download/internal/common/download_utils_unittest.cc b/components/download/internal/common/download_utils_unittest.cc new file mode 100644 index 0000000..d3d5a43 --- /dev/null +++ b/components/download/internal/common/download_utils_unittest.cc
@@ -0,0 +1,54 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/download/public/common/download_utils.h" + +#include "base/test/scoped_feature_list.h" +#include "components/download/public/common/download_features.h" +#include "net/http/http_response_headers.h" +#include "net/http/http_status_code.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace download { +namespace { + +TEST(DownloadUtilsTest, HandleServerResponse200) { + scoped_refptr<net::HttpResponseHeaders> headers( + new net::HttpResponseHeaders("HTTP/1.1 200 OK")); + EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, + HandleSuccessfulServerResponse(*headers.get(), nullptr, + /*fetch_error_body=*/false)); +} + +TEST(DownloadUtilsTest, HandleServerResponse200_RangeRequest) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndEnableFeature(features::kDownloadRange); + + // Arbitrary range request must expect HTTP 204 as a successful response. + scoped_refptr<net::HttpResponseHeaders> headers( + new net::HttpResponseHeaders("HTTP/1.1 200 OK")); + DownloadSaveInfo save_info; + save_info.range_request_to = 100; + EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT, + HandleSuccessfulServerResponse(*headers.get(), &save_info, + /*fetch_error_body=*/false)); +} + +TEST(DownloadUtilsTest, HandleServerResponse206_RangeRequest) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndEnableFeature(features::kDownloadRange); + + scoped_refptr<net::HttpResponseHeaders> headers( + new net::HttpResponseHeaders("HTTP/1.1 206 Partial Content")); + headers->AddHeader("Content-Range", "bytes 105-125/500"); + DownloadSaveInfo save_info; + save_info.range_request_from = 100; + EXPECT_TRUE(save_info.IsArbitraryRangeRequest()); + EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, + HandleSuccessfulServerResponse(*headers.get(), &save_info, + /*fetch_error_body=*/false)); +} + +} // namespace +} // namespace download
diff --git a/components/download/public/common/download_features.cc b/components/download/public/common/download_features.cc index 9629168..d448a91 100644 --- a/components/download/public/common/download_features.cc +++ b/components/download/public/common/download_features.cc
@@ -75,8 +75,8 @@ #endif }; -const base::Feature kAllowSavePackageScanning{ - "AllowSavePackageScanning", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kAllowSavePackageScanning{"AllowSavePackageScanning", + base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kIncognitoDownloadsWarning{ "IncognitoDownloadsWarning", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/components/download/public/common/download_save_info.cc b/components/download/public/common/download_save_info.cc index c66a6003f..864e113 100644 --- a/components/download/public/common/download_save_info.cc +++ b/components/download/public/common/download_save_info.cc
@@ -15,8 +15,13 @@ DownloadSaveInfo::DownloadSaveInfo(DownloadSaveInfo&& that) = default; -int64_t DownloadSaveInfo::GetStartingFileWriteOffset() { +int64_t DownloadSaveInfo::GetStartingFileWriteOffset() const { return file_offset >= 0 ? file_offset : offset; } +bool DownloadSaveInfo::IsArbitraryRangeRequest() const { + return range_request_from != kInvalidRange || + range_request_to != kInvalidRange; +} + } // namespace download
diff --git a/components/download/public/common/download_save_info.h b/components/download/public/common/download_save_info.h index 07b6170..9ef0a040 100644 --- a/components/download/public/common/download_save_info.h +++ b/components/download/public/common/download_save_info.h
@@ -37,7 +37,9 @@ ~DownloadSaveInfo(); - int64_t GetStartingFileWriteOffset(); + int64_t GetStartingFileWriteOffset() const; + + bool IsArbitraryRangeRequest() const; // If non-empty, contains the full target path of the download that has been // determined prior to download initiation. This is considered to be a trusted
diff --git a/components/embedder_support/origin_trials/component_updater_utils_unittest.cc b/components/embedder_support/origin_trials/component_updater_utils_unittest.cc index edd9e6a5..6216df3 100644 --- a/components/embedder_support/origin_trials/component_updater_utils_unittest.cc +++ b/components/embedder_support/origin_trials/component_updater_utils_unittest.cc
@@ -102,14 +102,14 @@ ASSERT_EQ(features.size(), disabled_feature_list->GetList().size()); - std::string disabled_feature; for (size_t i = 0; i < features.size(); ++i) { - const bool found = disabled_feature_list->GetString(i, &disabled_feature); - EXPECT_TRUE(found) << "Entry not found or not a string at index " << i; - if (!found) { + const std::string* disabled_feature = + disabled_feature_list->GetList()[i].GetIfString(); + if (!disabled_feature) { + ADD_FAILURE() << "Entry not found or not a string at index " << i; continue; } - EXPECT_EQ(features[i], disabled_feature) + EXPECT_EQ(features[i], *disabled_feature) << "Feature lists differ at index " << i; } } @@ -136,14 +136,15 @@ ASSERT_EQ(tokens.size(), disabled_token_list->GetList().size()); - std::string disabled_token; for (size_t i = 0; i < tokens.size(); ++i) { - const bool found = disabled_token_list->GetString(i, &disabled_token); - EXPECT_TRUE(found) << "Entry not found or not a string at index " << i; - if (!found) { + const std::string* disabled_token = + disabled_token_list->GetList()[i].GetIfString(); + + if (!disabled_token) { + ADD_FAILURE() << "Entry not found or not a string at index " << i; continue; } - EXPECT_EQ(tokens[i], disabled_token) + EXPECT_EQ(tokens[i], *disabled_token) << "Token lists differ at index " << i; } }
diff --git a/components/history_clusters/core/BUILD.gn b/components/history_clusters/core/BUILD.gn index fbd45ff..a3807df 100644 --- a/components/history_clusters/core/BUILD.gn +++ b/components/history_clusters/core/BUILD.gn
@@ -30,8 +30,6 @@ "history_clusters_types.h", "memories_features.cc", "memories_features.h", - "remote_clustering_backend.cc", - "remote_clustering_backend.h", ] if (build_with_on_device_clustering_backend) { sources += [ @@ -86,7 +84,6 @@ sources = [ "history_clusters_db_tasks_unittest.cc", "history_clusters_service_unittest.cc", - "remote_clustering_backend_unittest.cc", ] if (build_with_on_device_clustering_backend) { sources += [
diff --git a/components/history_clusters/core/history_clusters_service.cc b/components/history_clusters/core/history_clusters_service.cc index a117953f..9983f50 100644 --- a/components/history_clusters/core/history_clusters_service.cc +++ b/components/history_clusters/core/history_clusters_service.cc
@@ -35,7 +35,6 @@ #include "components/history_clusters/core/history_clusters_db_tasks.h" #include "components/history_clusters/core/history_clusters_types.h" #include "components/history_clusters/core/memories_features.h" -#include "components/history_clusters/core/remote_clustering_backend.h" #include "components/optimization_guide/core/entity_metadata_provider.h" #include "components/search_engines/template_url_service.h" #include "components/site_engagement/core/site_engagement_score_provider.h" @@ -297,19 +296,10 @@ visit_deletion_observer_.AttachToHistoryService(history_service); #if BUILDFLAG(BUILD_WITH_ON_DEVICE_CLUSTERING_BACKEND) - if (kUseOnDeviceClusteringBackend.Get()) { - backend_ = std::make_unique<OnDeviceClusteringBackend>( - template_url_service, entity_metadata_provider, - engagement_score_provider); - } + backend_ = std::make_unique<OnDeviceClusteringBackend>( + template_url_service, entity_metadata_provider, + engagement_score_provider); #endif - - if (!backend_ && RemoteModelEndpoint().is_valid() && url_loader_factory) { - backend_ = std::make_unique<RemoteClusteringBackend>( - url_loader_factory, - base::BindRepeating(&HistoryClustersService::NotifyDebugMessage, - weak_ptr_factory_.GetWeakPtr())); - } } HistoryClustersService::~HistoryClustersService() = default;
diff --git a/components/history_clusters/core/memories_features.cc b/components/history_clusters/core/memories_features.cc index 3cd6afd..22810409 100644 --- a/components/history_clusters/core/memories_features.cc +++ b/components/history_clusters/core/memories_features.cc
@@ -18,18 +18,8 @@ base::FEATURE_ENABLED_BY_DEFAULT; #endif -const base::FeatureParam<std::string> kRemoteModelEndpoint{ - &kRemoteModelForDebugging, "JourneysRemoteModelEndpoint", ""}; - } // namespace -GURL RemoteModelEndpoint() { - return GURL(kRemoteModelEndpoint.Get()); -} - -const base::FeatureParam<std::string> kRemoteModelEndpointExperimentName{ - &kJourneys, "JourneysExperimentName", ""}; - const base::FeatureParam<int> kMaxVisitsToCluster{ &kJourneys, "JourneysMaxVisitsToCluster", 1000}; @@ -44,9 +34,6 @@ const base::FeatureParam<bool> kPersistClustersInHistoryDb{ &kJourneys, "JourneysPersistClustersInHistoryDb", false}; -const base::FeatureParam<bool> kUseOnDeviceClusteringBackend{ - &kJourneys, "JourneysOnDeviceClusteringBackend", true}; - const base::FeatureParam<double> kMinScoreToAlwaysShowAboveTheFold{ &kJourneys, "JourneysMinScoreToAlwaysShowAboveTheFold", 0.5}; @@ -69,9 +56,6 @@ const base::Feature kUserVisibleDebug{"JourneysUserVisibleDebug", base::FEATURE_DISABLED_BY_DEFAULT}; -const base::Feature kRemoteModelForDebugging{"JourneysRemoteModelForDebugging", - base::FEATURE_DISABLED_BY_DEFAULT}; - const base::Feature kPersistContextAnnotationsInHistoryDb{ "JourneysPersistContextAnnotationsInHistoryDb", enabled_by_default_desktop_only};
diff --git a/components/history_clusters/core/memories_features.h b/components/history_clusters/core/memories_features.h index 77d9fc7..9c2f7e0 100644 --- a/components/history_clusters/core/memories_features.h +++ b/components/history_clusters/core/memories_features.h
@@ -13,23 +13,8 @@ // Params & helpers functions -// Returns the remote model debug endpoint used to cluster visits into memories. -// Returns an empty GURL() when the remote model debug endpoint is disabled. -// Note, the on-device backend (enabled by default) takes precedence over the -// remote model endpoint. The on-device backend has to be separately disabled -// to access the remote model endpoint. -GURL RemoteModelEndpoint(); - -// Returns the experiment name to pass through to the remote model debug -// endpoint to control how the visits get clustered. Returns an empty string if -// this client should just use be returned the default clustering or if the -// remote model debug endpoint is disabled. -extern const base::FeatureParam<std::string> kRemoteModelEndpointExperimentName; - -// The max number of visits to use for each clustering iteration. When using the -// remote model, this limits the number of visits sent. Only applies when using -// persisted visit context annotations; i.e. -// `kPersistContextAnnotationsInHistoryDb` is true. +// The max number of visits to use for each clustering iteration. This limits +// the number of visits sent to the clustering backend per batch. extern const base::FeatureParam<int> kMaxVisitsToCluster; // The recency threshold controlling which visits will be clustered. This isn't @@ -82,10 +67,6 @@ // Does nothing if `kJourneys` is disabled. extern const base::Feature kUserVisibleDebug; -// Enables using a remote model endpoint for Memories clustering for debugging -// purposes. This should not be ever enabled in production. -extern const base::Feature kRemoteModelForDebugging; - // Enables persisting context annotations in the History DB. They are always // calculated anyways. This just enables storing them. This is expected to be // enabled for all users shortly. This just provides a killswitch.
diff --git a/components/history_clusters/core/remote_clustering_backend.cc b/components/history_clusters/core/remote_clustering_backend.cc deleted file mode 100644 index 5c89bb3..0000000 --- a/components/history_clusters/core/remote_clustering_backend.cc +++ /dev/null
@@ -1,217 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/history_clusters/core/remote_clustering_backend.h" - -#include <utility> - -#include "base/base64.h" -#include "base/bind.h" -#include "base/json/json_writer.h" -#include "base/ranges/algorithm.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" -#include "base/values.h" -#include "components/history/core/browser/history_types.h" -#include "components/history_clusters/core/memories_features.h" -#include "components/history_clusters/core/proto/clusters.pb.h" -#include "net/base/net_errors.h" -#include "services/network/public/cpp/simple_url_loader.h" -#include "services/network/public/mojom/url_response_head.mojom.h" - -namespace history_clusters { - -namespace { - -// Also writes one line of debug information per visit to `debug_string`, if -// the parameter is non-nullptr. -proto::GetClustersRequest CreateRequestProto( - const std::vector<history::AnnotatedVisit>& visits) { - proto::GetClustersRequest request; - request.set_experiment_name(kRemoteModelEndpointExperimentName.Get()); - - for (auto& visit : visits) { - // TODO(tommycli): Still need to set `site_engagement_score` and - // `is_from_google_search` - proto::AnnotatedVisit* request_visit = request.add_visits(); - request_visit->set_visit_id(visit.visit_row.visit_id); - request_visit->set_url(visit.url_row.url().spec()); - request_visit->set_origin( - visit.url_row.url().DeprecatedGetOriginAsURL().spec()); - request_visit->set_foreground_time_secs( - visit.visit_row.visit_duration.InSeconds()); - request_visit->set_navigation_time_ms( - visit.visit_row.visit_time.ToDeltaSinceWindowsEpoch().InMilliseconds()); - request_visit->set_page_end_reason( - visit.context_annotations.page_end_reason); - request_visit->set_page_transition( - static_cast<int>(visit.visit_row.transition)); - request_visit->set_referring_visit_id( - visit.referring_visit_of_redirect_chain_start); - } - return request; -} - -std::vector<history::Cluster> ParseResponseProto( - const std::vector<history::AnnotatedVisit>& visits, - const proto::GetClustersResponse& response_proto) { - std::vector<history::Cluster> clusters; - for (const proto::Cluster& cluster_proto : response_proto.clusters()) { - history::Cluster cluster; - for (const std::string& keyword : cluster_proto.keywords()) - cluster.keywords.push_back(base::UTF8ToUTF16(keyword)); - for (const proto::ClusterVisit& cluster_visit_proto : - cluster_proto.cluster_visits()) { - const auto visits_it = base::ranges::find( - visits, cluster_visit_proto.visit_id(), - [](const auto& visit) { return visit.visit_row.visit_id; }); - if (visits_it != visits.end()) { - history::ClusterVisit new_cluster_visit; - new_cluster_visit.annotated_visit = *visits_it; - new_cluster_visit.score = cluster_visit_proto.score(); - cluster.visits.push_back(new_cluster_visit); - } - } - clusters.push_back(cluster); - } - - return clusters; -} - -} // namespace - -RemoteClusteringBackend::RemoteClusteringBackend( - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - absl::optional<DebugLoggerCallback> debug_logger) - : url_loader_factory_(url_loader_factory), debug_logger_(debug_logger) {} - -RemoteClusteringBackend::~RemoteClusteringBackend() = default; - -void RemoteClusteringBackend::GetClusters( - ClustersCallback callback, - const std::vector<history::AnnotatedVisit>& visits) { - const GURL endpoint(RemoteModelEndpoint()); - DCHECK(endpoint.is_valid()); - if (debug_logger_) - debug_logger_->Run("RemoteClusteringBackend::GetClusters()"); - - if (visits.empty()) { - std::move(callback).Run({}); - return; - } - - // It's weird but the endpoint only accepts JSON, so wrap our serialized proto - // like this: {"data":"<base64-encoded-proto-serialization>"} - proto::GetClustersRequest request_proto = CreateRequestProto(visits); - const std::string serialized_request_proto = - request_proto.SerializeAsString(); - std::string request_proto_base64; - base::Base64Encode(serialized_request_proto, &request_proto_base64); - - base::DictionaryValue container_value; - container_value.SetStringPath("data", request_proto_base64); - - std::string request_body; - base::JSONWriter::Write(container_value, &request_body); - - // Also dump the encoded request, as it allows us to repro server-side errors. - if (debug_logger_) - debug_logger_->Run(request_body); - - auto url_loader = CreateLoader(CreateRequest(endpoint), request_body); - network::SimpleURLLoader* unowned_url_loader = url_loader.get(); - - // Retry 3 times (chosen arbitrarily) for transient-type network issues. - int retry_mode = - network::SimpleURLLoader::RetryMode::RETRY_ON_5XX | - network::SimpleURLLoader::RetryMode::RETRY_ON_NETWORK_CHANGE | - network::SimpleURLLoader::RetryMode::RETRY_ON_NAME_NOT_RESOLVED; - unowned_url_loader->SetRetryOptions(3, retry_mode); - - unowned_url_loader->DownloadToString( - url_loader_factory_.get(), - base::BindOnce( - [](std::unique_ptr<network::SimpleURLLoader> url_loader, - absl::optional<DebugLoggerCallback> debug_logger, - const std::vector<history::AnnotatedVisit>& visits, - std::unique_ptr<std::string> response) { - if (!response) { - if (debug_logger) { - debug_logger->Run("RemoteClusteringBackend response nullptr"); - debug_logger->Run(base::StringPrintf("Net Error Code: %d", - url_loader->NetError())); - debug_logger->Run("Net Error String: " + - net::ErrorToString(url_loader->NetError())); - if (url_loader->ResponseInfo() && - url_loader->ResponseInfo()->headers) { - debug_logger->Run(base::StringPrintf( - "HTTP response code: %d", - url_loader->ResponseInfo()->headers->response_code())); - } - } - return std::vector<history::Cluster>{}; - } - proto::GetClustersResponse response_proto; - response_proto.ParseFromString(*response); - return ParseResponseProto(visits, response_proto); - }, - std::move(url_loader), debug_logger_, visits) - .Then(std::move(callback)), - network::SimpleURLLoader::kMaxBoundedStringDownloadSize); -} - -// static -std::unique_ptr<network::ResourceRequest> -RemoteClusteringBackend::CreateRequest(const GURL& endpoint) { - auto request = std::make_unique<network::ResourceRequest>(); - request->url = GURL(endpoint); - request->method = "POST"; - return request; -} - -// static -std::unique_ptr<network::SimpleURLLoader> RemoteClusteringBackend::CreateLoader( - std::unique_ptr<network::ResourceRequest> request, - const std::string& request_body) { - const net::NetworkTrafficAnnotationTag traffic_annotation = - net::DefineNetworkTrafficAnnotation("memories_remote_model_request", R"( - semantics { - sender: "Memories" - description: - "chrome://memories clusters the user's history entries into " - "'memories' for easier browsing and searching. This request is " - "made only if the user explicitly sets the appropriate feature and " - "param through the command line. The param is intentionally not in " - "chrome://flags to avoid users accidentally setting it. The " - "request will send the user's previous navigations and searches. " - trigger: "User must set a command line param. The request is sent " - "for both explicit user actions (e.g. navigating, visiting " - "chrome://memories, or typing in the omnibox) and passively (e.g. " - " on browser startup or periodically)." - data: "The user's navigation and search history." - destination: OTHER - destination_other: "With the expected param configuration, the " - "destination will be a GOOGLE_OWNED_SERVICE. As the endpoint is " - "set through a command line param, a user could set it to any " - "destination." - } - policy { - cookies_allowed: YES - cookies_store: "user" - setting: - "Disabled unless the user explicitly enables the 'Memories' " - "feature and sets the 'MemoriesRemoteModelEndpoint' param to a " - "valid URL." - policy_exception_justification: - "The request is only made if the user explicitly configures it." - })"); - std::unique_ptr<network::SimpleURLLoader> loader = - network::SimpleURLLoader::Create(std::move(request), traffic_annotation); - if (!request_body.empty()) - loader->AttachStringForUpload(request_body, "application/json"); - return loader; -} - -} // namespace history_clusters
diff --git a/components/history_clusters/core/remote_clustering_backend.h b/components/history_clusters/core/remote_clustering_backend.h deleted file mode 100644 index b8c62a26..0000000 --- a/components/history_clusters/core/remote_clustering_backend.h +++ /dev/null
@@ -1,59 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_HISTORY_CLUSTERS_CORE_REMOTE_CLUSTERING_BACKEND_H_ -#define COMPONENTS_HISTORY_CLUSTERS_CORE_REMOTE_CLUSTERING_BACKEND_H_ - -#include <memory> -#include <string> -#include <vector> - -#include "base/callback.h" -#include "base/memory/scoped_refptr.h" -#include "components/history_clusters/core/clustering_backend.h" -#include "services/network/public/cpp/resource_request.h" -#include "services/network/public/cpp/shared_url_loader_factory.h" -#include "services/network/public/cpp/simple_url_loader.h" -#include "third_party/abseil-cpp/absl/types/optional.h" -#include "url/gurl.h" - -namespace history_clusters { - -using DebugLoggerCallback = base::RepeatingCallback<void(const std::string&)>; - -// A helper class to communicate with the remote model. Forms requests from -// `history::AnnotatedVisit`s and parses the response into -// `history::Cluster`s. -class RemoteClusteringBackend : public ClusteringBackend { - public: - // Pass in a defined `debug_logger` to enable debug logging from this class. - RemoteClusteringBackend( - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - absl::optional<DebugLoggerCallback> debug_logger); - ~RemoteClusteringBackend() override; - - // ClusteringBackend: - void GetClusters(ClustersCallback callback, - const std::vector<history::AnnotatedVisit>& visits) override; - - private: - // Helpers for making requests used by `GetMemories()`. - static std::unique_ptr<network::ResourceRequest> CreateRequest( - const GURL& endpoint); - static std::unique_ptr<network::SimpleURLLoader> CreateLoader( - std::unique_ptr<network::ResourceRequest> request, - const std::string& request_body); - - // Used to make requests. - const scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; - - // This should be set to absl::nullopt if debug logging is disabled. - // This is absl::optional, so we can skip the expense of constructing the log - // messages if the logger is disabled. - absl::optional<DebugLoggerCallback> debug_logger_; -}; - -} // namespace history_clusters - -#endif // COMPONENTS_HISTORY_CLUSTERS_CORE_REMOTE_CLUSTERING_BACKEND_H_
diff --git a/components/history_clusters/core/remote_clustering_backend_unittest.cc b/components/history_clusters/core/remote_clustering_backend_unittest.cc deleted file mode 100644 index e975b802..0000000 --- a/components/history_clusters/core/remote_clustering_backend_unittest.cc +++ /dev/null
@@ -1,312 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/history_clusters/core/history_clusters_service.h" - -#include <memory> -#include <string> - -#include "base/base64.h" -#include "base/json/json_reader.h" -#include "base/memory/scoped_refptr.h" -#include "base/run_loop.h" -#include "base/test/bind.h" -#include "base/test/gtest_util.h" -#include "base/test/scoped_feature_list.h" -#include "base/test/task_environment.h" -#include "base/values.h" -#include "components/history/core/browser/history_types.h" -#include "components/history/core/browser/url_row.h" -#include "components/history_clusters/core/history_clusters_service_test_api.h" -#include "components/history_clusters/core/memories_features.h" -#include "components/history_clusters/core/proto/clusters.pb.h" -#include "components/history_clusters/core/remote_clustering_backend.h" -#include "services/network/public/cpp/data_element.h" -#include "services/network/public/cpp/resource_request_body.h" -#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" -#include "services/network/test/test_url_loader_factory.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace history_clusters { - -namespace { - -static constexpr char kFakeExperimentName[] = "FakeExperimentName"; -static constexpr char kFakeEndpoint[] = "https://endpoint.com/"; - -class RemoteClusteringBackendTest : public testing::Test { - public: - RemoteClusteringBackendTest() - : task_environment_( - base::test::SingleThreadTaskEnvironment::TimeSource::MOCK_TIME), - shared_url_loader_factory_( - base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( - &test_url_loader_factory_)), - run_loop_quit_(run_loop_.QuitClosure()) { - scoped_feature_list_ = std::make_unique<base::test::ScopedFeatureList>(); - scoped_feature_list_->InitWithFeaturesAndParameters( - { - { - kJourneys, - { - {"JourneysExperimentName", kFakeExperimentName}, - }, - }, - { - kRemoteModelForDebugging, - { - {"JourneysRemoteModelEndpoint", kFakeEndpoint}, - }, - }, - }, - {}); - - remote_clustering_backend_ = std::make_unique<RemoteClusteringBackend>( - shared_url_loader_factory_, absl::nullopt); - } - - RemoteClusteringBackendTest(const RemoteClusteringBackendTest&) = delete; - RemoteClusteringBackendTest& operator=(const RemoteClusteringBackendTest&) = - delete; - - // Helper to get the most recent remote request body. - std::string GetPendingRequestBody() { - const scoped_refptr<network::ResourceRequestBody>& request_body = - test_url_loader_factory_.GetPendingRequest(0)->request.request_body; - const network::DataElement& element = (*request_body->elements())[0]; - return std::string(element.As<network::DataElementBytes>().AsStringPiece()); - } - - protected: - base::test::TaskEnvironment task_environment_; - - std::unique_ptr<base::test::ScopedFeatureList> scoped_feature_list_; - - network::TestURLLoaderFactory test_url_loader_factory_; - scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_; - - std::unique_ptr<RemoteClusteringBackend> remote_clustering_backend_; - - // Used to verify the async callback is invoked. - base::RunLoop run_loop_; - base::RepeatingClosure run_loop_quit_; -}; - -TEST_F(RemoteClusteringBackendTest, EndToEnd) { - remote_clustering_backend_->GetClusters( - base::BindLambdaForTesting( - [&](std::vector<history::Cluster> clusters) { - ASSERT_EQ(clusters.size(), 2u); - - ASSERT_EQ(clusters[0].visits.size(), 2u); - EXPECT_EQ(clusters[0].visits[0].annotated_visit.url_row.url(), - "https://google.com/"); - EXPECT_FLOAT_EQ(clusters[0].visits[0].score, 0.66); - EXPECT_EQ(clusters[0].visits[1].annotated_visit.url_row.url(), - "https://github.com/"); - EXPECT_FLOAT_EQ(clusters[0].visits[1].score, 0.66); - - ASSERT_EQ(clusters[1].visits.size(), 1u); - EXPECT_EQ(clusters[1].visits[0].annotated_visit.url_row.url(), - "https://github.com/"); - EXPECT_FLOAT_EQ(clusters[1].visits[0].score, 0.66); - - run_loop_quit_.Run(); - }), - GetHardcodedTestVisits()); - - // This below block verifies the proto request sent to the remote endpoint. - { - EXPECT_TRUE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - - absl::optional<base::Value> value = - base::JSONReader::Read(GetPendingRequestBody()); - ASSERT_TRUE(value); - std::string* encoded = value->FindStringKey("data"); - ASSERT_TRUE(encoded); - - std::string decoded; - ASSERT_TRUE(base::Base64Decode(*encoded, &decoded)); - - proto::GetClustersRequest request; - ASSERT_TRUE(request.ParseFromString(decoded)); - - EXPECT_EQ(request.experiment_name(), kFakeExperimentName); - ASSERT_EQ(request.visits_size(), 4); - - auto visit = request.visits().at(0); - EXPECT_EQ(visit.visit_id(), 1); - EXPECT_EQ(visit.navigation_time_ms(), - GetHardcodedTestVisits()[0] - .visit_row.visit_time.ToDeltaSinceWindowsEpoch() - .InMilliseconds()); - EXPECT_EQ(visit.foreground_time_secs(), 5); - EXPECT_EQ(visit.url(), "https://google.com/"); - EXPECT_EQ(visit.page_end_reason(), 3); - - visit = request.visits().at(1); - EXPECT_EQ(visit.visit_id(), 2); - EXPECT_EQ(visit.navigation_time_ms(), - GetHardcodedTestVisits()[1] - .visit_row.visit_time.ToDeltaSinceWindowsEpoch() - .InMilliseconds()); - EXPECT_EQ(visit.foreground_time_secs(), 20); - EXPECT_EQ(visit.url(), "https://github.com/"); - EXPECT_EQ(visit.page_end_reason(), 5); - // TODO(tommycli): Add back visit.referring_visit_id() check after updating - // the HistoryService test methods to support that field. - - // Don't verify the visit 3 because it's a synched visit and would be - // filtered by `GetAnnotatedVisitsToCluster` in history clusters service in - // the real world; it's bypassed by these tests so it's we assert all 3 - // visits were sent. - // TODO(manukh): Once we move the filtering from - // `GetAnnotatedVisitsToCluster` to the backend model, we won't need to do - // this 'trick' and this test will match the real world; i.e. both cases - // will send all 3 visits. - } - - // This block sends a fake proto response back via the URL loader. - { - proto::GetClustersResponse response; - - auto* cluster = response.add_clusters(); - auto* visit = cluster->add_cluster_visits(); - visit->set_visit_id(1); - visit->set_score(0.66); - visit = cluster->add_cluster_visits(); - visit->set_visit_id(2); - visit->set_score(0.66); - - cluster = response.add_clusters(); - visit = cluster->add_cluster_visits(); - visit->set_visit_id(2); - visit->set_score(0.66); - - test_url_loader_factory_.AddResponse(kFakeEndpoint, - response.SerializeAsString()); - EXPECT_FALSE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - } - - // Verify the callback is invoked. - run_loop_.Run(); -} - -TEST_F(RemoteClusteringBackendTest, EmptyVisitsRequest) { - remote_clustering_backend_->GetClusters( - base::BindLambdaForTesting([&](std::vector<history::Cluster> clusters) { - EXPECT_TRUE(clusters.empty()); - run_loop_quit_.Run(); - }), - std::vector<history::AnnotatedVisit>()); - - // Verify no request is made. - EXPECT_FALSE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - - // Verify the callback is invoked. - run_loop_.Run(); -} - -TEST_F(RemoteClusteringBackendTest, EmptyResponse) { - EXPECT_FALSE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - remote_clustering_backend_->GetClusters( - base::BindLambdaForTesting([&](std::vector<history::Cluster> clusters) { - EXPECT_TRUE(clusters.empty()); - run_loop_quit_.Run(); - }), - GetHardcodedTestVisits()); - - // Verify a request is made. - EXPECT_TRUE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - - // Fake an empty but valid response from the endpoint. - test_url_loader_factory_.AddResponse( - kFakeEndpoint, proto::GetClustersResponse().SerializeAsString()); - EXPECT_FALSE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - - // Verify the callback is invoked. - run_loop_.Run(); -} - -TEST_F(RemoteClusteringBackendTest, InvalidJsonResponse) { - EXPECT_FALSE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - remote_clustering_backend_->GetClusters( - base::BindLambdaForTesting([&](std::vector<history::Cluster> clusters) { - EXPECT_TRUE(clusters.empty()); - run_loop_quit_.Run(); - }), - GetHardcodedTestVisits()); - - // Verify a request is made. - EXPECT_TRUE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - - // Fake a junk response from the endpoint. - test_url_loader_factory_.AddResponse(kFakeEndpoint, - "{waka404woko.weke) !*(&,"); - EXPECT_FALSE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - - // Verify the callback is invoked. - run_loop_.Run(); -} - -TEST_F(RemoteClusteringBackendTest, EmptyJsonResponse) { - EXPECT_FALSE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - remote_clustering_backend_->GetClusters( - base::BindLambdaForTesting([&](std::vector<history::Cluster> clusters) { - EXPECT_TRUE(clusters.empty()); - run_loop_quit_.Run(); - }), - GetHardcodedTestVisits()); - - // Verify a request is made. - EXPECT_TRUE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - - // Fake an empty but valid response from the endpoint. - test_url_loader_factory_.AddResponse( - kFakeEndpoint, proto::GetClustersResponse().SerializeAsString()); - EXPECT_FALSE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - - // Verify the callback is invoked. - run_loop_.Run(); -} - -TEST_F(RemoteClusteringBackendTest, TwoSimultaneousRequests) { - remote_clustering_backend_->GetClusters( - base::BindLambdaForTesting([&](std::vector<history::Cluster> clusters) { - EXPECT_EQ(clusters.size(), 2u); - // Don't quit the run loop. We want to use the second request's - // response as the complete-condition for this test. - }), - GetHardcodedTestVisits()); - - // Verify there's a single request to the endpoint. - EXPECT_TRUE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - EXPECT_EQ(test_url_loader_factory_.NumPending(), 1); - - remote_clustering_backend_->GetClusters( - base::BindLambdaForTesting([&](std::vector<history::Cluster> clusters) { - EXPECT_EQ(clusters.size(), 2u); - run_loop_quit_.Run(); - }), - GetHardcodedTestVisits()); - - // Verify there are two requests to the endpoint. - EXPECT_TRUE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - EXPECT_EQ(test_url_loader_factory_.NumPending(), 2); - - // Fake a response from the endpoint with two clusters. - proto::GetClustersResponse response; - response.add_clusters(); - response.add_clusters(); - test_url_loader_factory_.AddResponse(kFakeEndpoint, - response.SerializeAsString()); - EXPECT_FALSE(test_url_loader_factory_.IsPending(kFakeEndpoint)); - - // Verify both callbacks are invoked. - run_loop_.Run(); -} - -} // namespace - -} // namespace history_clusters
diff --git a/components/login/base_screen_handler_utils.cc b/components/login/base_screen_handler_utils.cc index f08da2a..c984d7bd 100644 --- a/components/login/base_screen_handler_utils.cc +++ b/components/login/base_screen_handler_utils.cc
@@ -11,15 +11,25 @@ namespace { +// Helpers to let ParseListString produce output of appropriate type. +void ConvertFromUTF8(const std::string& in, std::string& out) { + out = in; +} + +void ConvertFromUTF8(const std::string& in, std::u16string& out) { + out = base::UTF8ToUTF16(in); +} + template <typename StringListType> bool ParseStringList(const base::Value* value, StringListType* out_value) { - const base::ListValue* list = nullptr; - if (!value->GetAsList(&list)) + if (!value->is_list()) return false; - out_value->resize(list->GetList().size()); - for (size_t i = 0; i < list->GetList().size(); ++i) { - if (!list->GetString(i, &((*out_value)[i]))) + base::Value::ConstListView list = value->GetList(); + out_value->resize(list.size()); + for (size_t i = 0; i < list.size(); ++i) { + if (!list[i].is_string()) return false; + ConvertFromUTF8(list[i].GetString(), (*out_value)[i]); } return true; }
diff --git a/components/permissions/permission_actions_history.h b/components/permissions/permission_actions_history.h index 70e28a9..15abf5d8 100644 --- a/components/permissions/permission_actions_history.h +++ b/components/permissions/permission_actions_history.h
@@ -6,7 +6,6 @@ #define COMPONENTS_PERMISSIONS_PERMISSION_ACTIONS_HISTORY_H_ #include "base/memory/raw_ptr.h" -#include "base/memory/singleton.h" #include "base/notreached.h" #include "base/time/time.h" #include "components/keyed_service/core/keyed_service.h"
diff --git a/components/permissions/permission_decision_auto_blocker.h b/components/permissions/permission_decision_auto_blocker.h index 61dcc405..e44f1fd 100644 --- a/components/permissions/permission_decision_auto_blocker.h +++ b/components/permissions/permission_decision_auto_blocker.h
@@ -10,7 +10,6 @@ #include "base/callback.h" #include "base/gtest_prod_util.h" #include "base/memory/raw_ptr.h" -#include "base/memory/singleton.h" #include "base/time/default_clock.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/common/content_settings_types.h"
diff --git a/components/policy/core/browser/url_util.cc b/components/policy/core/browser/url_util.cc index 255fe07..7f0b856b 100644 --- a/components/policy/core/browser/url_util.cc +++ b/components/policy/core/browser/url_util.cc
@@ -400,12 +400,16 @@ std::map<url_matcher::URLMatcherConditionSet::ID, url_util::FilterComponents>* filters) { URLMatcherConditionSet::Vector all_conditions; - size_t size = std::min(kMaxFiltersPerPolicy, patterns->GetList().size()); - std::string pattern; + base::Value::ConstListView patterns_list = patterns->GetList(); + size_t size = std::min(kMaxFiltersPerPolicy, patterns_list.size()); scoped_refptr<URLMatcherConditionSet> condition_set; for (size_t i = 0; i < size; ++i) { - bool success = patterns->GetString(i, &pattern); - DCHECK(success); + std::string pattern; + if (patterns_list[i].is_string()) { + pattern = patterns_list[i].GetString(); + } else { + DCHECK(false); + } FilterComponents components; components.allow = allow; if (!FilterToComponents(pattern, &components.scheme, &components.host,
diff --git a/components/power_metrics/BUILD.gn b/components/power_metrics/BUILD.gn index 5f66fc7..547b8df 100644 --- a/components/power_metrics/BUILD.gn +++ b/components/power_metrics/BUILD.gn
@@ -12,6 +12,9 @@ "resource_coalition_internal_types_mac.h", "resource_coalition_mac.h", "resource_coalition_mac.mm", + "smc_internal_types_mac.h", + "smc_mac.h", + "smc_mac.mm", ] deps = [ "//base" ]
diff --git a/components/power_metrics/smc_internal_types_mac.h b/components/power_metrics/smc_internal_types_mac.h new file mode 100644 index 0000000..b9c7b7c5 --- /dev/null +++ b/components/power_metrics/smc_internal_types_mac.h
@@ -0,0 +1,74 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_POWER_METRICS_SMC_INTERNAL_TYPES_MAC_H_ +#define COMPONENTS_POWER_METRICS_SMC_INTERNAL_TYPES_MAC_H_ + +#import <Foundation/Foundation.h> +#include <stdint.h> + +// List of known SMC key identifiers. +enum class SMCKeyIdentifier : uint32_t { + TotalPower = 'PSTR', // Power: System Total Rail (watts) + CPUPower = 'PCPC', // Power: CPU Package CPU (watts) + iGPUPower = 'PCPG', // Power: CPU Package GPU (watts) + GPU0Power = 'PG0R', // Power: GPU 0 Rail (watts) + GPU1Power = 'PG1R', // Power: GPU 1 Rail (watts) +}; + +// Types from PowerManagement/pmconfigd/PrivateLib.c +// (https://opensource.apple.com/source/PowerManagement/PowerManagement-494.1.2/pmconfigd/PrivateLib.c.auto.html) +struct SMCVersion { + unsigned char major; + unsigned char minor; + unsigned char build; + unsigned char reserved; + unsigned short release; +}; + +struct SMCPLimitData { + uint16_t version; + uint16_t length; + uint32_t cpuPLimit; + uint32_t gpuPLimit; + uint32_t memPLimit; +}; + +enum class SMCDataType : uint32_t { + flt = 'flt ', // Floating point + sp78 = 'sp78', // Fixed point: SIIIIIIIFFFFFFFF + sp87 = 'sp87', // Fixed point: SIIIIIIIIFFFFFFF + spa5 = 'spa5', // Fixed point: SIIIIIIIIIIFFFFF +}; + +struct SMCKeyInfoData { + IOByteCount dataSize; + SMCDataType dataType; + uint8_t dataAttributes; +}; + +struct SMCParamStruct { + SMCKeyIdentifier key; + SMCVersion vers; + SMCPLimitData pLimitData; + SMCKeyInfoData keyInfo; + uint8_t result; + uint8_t status; + uint8_t data8; + uint32_t data32; + uint8_t bytes[32]; +}; + +enum { + kSMCUserClientOpen = 0, + kSMCUserClientClose = 1, + kSMCHandleYPCEvent = 2, + kSMCReadKey = 5, + kSMCWriteKey = 6, + kSMCGetKeyCount = 7, + kSMCGetKeyFromIndex = 8, + kSMCGetKeyInfo = 9 +}; + +#endif // COMPONENTS_POWER_METRICS_SMC_INTERNAL_TYPES_MAC_H_
diff --git a/components/power_metrics/smc_mac.h b/components/power_metrics/smc_mac.h new file mode 100644 index 0000000..66a261f --- /dev/null +++ b/components/power_metrics/smc_mac.h
@@ -0,0 +1,67 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// The System Management Controller (SMC) is a hardware component that controls +// the power functions of Intel-based Macs. This file defines a class to read +// known SMC keys. + +#ifndef COMPONENTS_POWER_METRICS_SMC_MAC_H_ +#define COMPONENTS_POWER_METRICS_SMC_MAC_H_ + +#import <Foundation/Foundation.h> + +#include <memory> + +#include "base/mac/scoped_ioobject.h" +#include "components/power_metrics/smc_internal_types_mac.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace power_metrics { + +class SMCReader { + public: + // Creates an SMC Reader. Returns nullptr in case of failure. + static std::unique_ptr<SMCReader> Create(); + + virtual ~SMCReader(); + + // Returns the power consumption of various hardware components in watts. + // Virtual for testing. + virtual absl::optional<double> ReadTotalPowerW(); + virtual absl::optional<double> ReadCPUPackageCPUPowerW(); + virtual absl::optional<double> ReadCPUPackageGPUPowerW(); + virtual absl::optional<double> ReadGPU0PowerW(); + virtual absl::optional<double> ReadGPU1PowerW(); + + protected: + explicit SMCReader(base::mac::ScopedIOObject<io_object_t> connect); + + private: + class SMCKey { + public: + SMCKey(base::mac::ScopedIOObject<io_object_t> connect, + SMCKeyIdentifier key_identifier); + ~SMCKey(); + + bool Exists() const; + absl::optional<double> Read(); + + private: + bool CallSMCFunction(uint8_t function, SMCParamStruct* out); + + base::mac::ScopedIOObject<io_object_t> connect_; + const SMCKeyIdentifier key_identifier_; + SMCKeyInfoData key_info_; + }; + + SMCKey total_power_key_; + SMCKey cpu_package_cpu_power_key_; + SMCKey cpu_package_gpu_power_key_; + SMCKey gpu0_power_key_; + SMCKey gpu1_power_key_; +}; + +} // namespace power_metrics + +#endif // COMPONENTS_POWER_METRICS_SMC_MAC_H_
diff --git a/components/power_metrics/smc_mac.mm b/components/power_metrics/smc_mac.mm new file mode 100644 index 0000000..964a0d0 --- /dev/null +++ b/components/power_metrics/smc_mac.mm
@@ -0,0 +1,134 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/power_metrics/smc_mac.h" + +#include <libkern/OSByteOrder.h> +#include <utility> + +#include "base/memory/ptr_util.h" + +namespace power_metrics { + +namespace { + +double FromSMCFixedPoint(uint8_t* bytes, size_t fraction_bits) { + return OSReadBigInt16(bytes, 0) / static_cast<double>(1 << fraction_bits); +} + +} // namespace + +// static +std::unique_ptr<SMCReader> SMCReader::Create() { + const base::mac::ScopedIOObject<io_service_t> smc_service( + IOServiceGetMatchingService(kIOMasterPortDefault, + IOServiceMatching("AppleSMC"))); + base::mac::ScopedIOObject<io_object_t> connect; + if (IOServiceOpen(smc_service, mach_task_self(), 1, + connect.InitializeInto()) != kIOReturnSuccess) { + return nullptr; + } + + return base::WrapUnique(new SMCReader(std::move(connect))); +} + +SMCReader::~SMCReader() = default; + +absl::optional<double> SMCReader::ReadTotalPowerW() { + return total_power_key_.Read(); +} + +absl::optional<double> SMCReader::ReadCPUPackageCPUPowerW() { + return cpu_package_cpu_power_key_.Read(); +} + +absl::optional<double> SMCReader::ReadCPUPackageGPUPowerW() { + return cpu_package_gpu_power_key_.Read(); +} + +absl::optional<double> SMCReader::ReadGPU0PowerW() { + return gpu0_power_key_.Read(); +} + +absl::optional<double> SMCReader::ReadGPU1PowerW() { + return gpu1_power_key_.Read(); +} + +SMCReader::SMCKey::SMCKey(base::mac::ScopedIOObject<io_object_t> connect, + SMCKeyIdentifier key_identifier) + : connect_(std::move(connect)), key_identifier_(key_identifier) { + // Read key information. + SMCParamStruct out{}; + if (CallSMCFunction(kSMCGetKeyInfo, &out)) + key_info_ = out.keyInfo; +} + +SMCReader::SMCKey::~SMCKey() = default; + +bool SMCReader::SMCKey::Exists() const { + return key_info_.dataSize > 0; +} + +absl::optional<double> SMCReader::SMCKey::Read() { + if (!Exists()) + return absl::nullopt; + + SMCParamStruct out{}; + if (!CallSMCFunction(kSMCReadKey, &out)) + return absl::nullopt; + switch (key_info_.dataType) { + case SMCDataType::flt: + return *reinterpret_cast<float*>(out.bytes); + case SMCDataType::sp78: + return FromSMCFixedPoint(out.bytes, 8); + case SMCDataType::sp87: + return FromSMCFixedPoint(out.bytes, 7); + case SMCDataType::spa5: + return FromSMCFixedPoint(out.bytes, 5); + default: + return absl::nullopt; + } +} + +bool SMCReader::SMCKey::CallSMCFunction(uint8_t function, SMCParamStruct* out) { + if (!connect_) + return false; + + // TODO: In local tests, removing the calls to `kSMCUserClientOpen` and + // `kSMCUserClientClose` doesn't seem to affect behavior. Consider removing + // them. + + if (IOConnectCallMethod(connect_, kSMCUserClientOpen, nullptr, 0, nullptr, 0, + nullptr, nullptr, nullptr, nullptr)) { + connect_.reset(); + return false; + } + + SMCParamStruct in{}; + in.key = key_identifier_; + in.keyInfo.dataSize = key_info_.dataSize; + in.data8 = function; + + size_t out_size = sizeof(*out); + const bool success = + IOConnectCallStructMethod(connect_, kSMCHandleYPCEvent, &in, sizeof(in), + out, &out_size) == kIOReturnSuccess; + + if (IOConnectCallMethod(connect_, kSMCUserClientClose, nullptr, 0, nullptr, 0, + nullptr, nullptr, nullptr, nullptr)) { + connect_.reset(); + } + + // Even if the close failed, report whether the actual call succeded. + return success; +} + +SMCReader::SMCReader(base::mac::ScopedIOObject<io_object_t> connect) + : total_power_key_(connect, SMCKeyIdentifier::TotalPower), + cpu_package_cpu_power_key_(connect, SMCKeyIdentifier::CPUPower), + cpu_package_gpu_power_key_(connect, SMCKeyIdentifier::iGPUPower), + gpu0_power_key_(connect, SMCKeyIdentifier::GPU0Power), + gpu1_power_key_(connect, SMCKeyIdentifier::GPU1Power) {} + +} // namespace power_metrics
diff --git a/components/search_engines/prepopulated_engines.json b/components/search_engines/prepopulated_engines.json index d683def..0cdeda1 100644 --- a/components/search_engines/prepopulated_engines.json +++ b/components/search_engines/prepopulated_engines.json
@@ -23,7 +23,7 @@ // When adding new engines, increment this number and use it as the new // max ID. This is used by UMA stats and must be updated to include the full // range or else not all engines will be counted in stats. - "kMaxPrepopulatedEngineID": 101, + "kMaxPrepopulatedEngineID": 102, // Increment this if you change the data in ways that mean users with // existing data should get a new version. Otherwise, existing data may @@ -157,6 +157,15 @@ "id": 67 }, + "petal_search": { + "name": "Petal Search", + "keyword": "petalsearch.com", + "favicon_url": "https://search-static-dre.dbankcdn.com/pc/v1/favicon.ico", + "search_url": "https://petalsearch.com/search?query={searchTerms}", + "type": "SEARCH_ENGINE_PETALSEARCH", + "id": 102 + }, + "qwant": { "name": "Qwant", "keyword": "qwant.com",
diff --git a/components/search_engines/search_engine_type.h b/components/search_engines/search_engine_type.h index d785553..7c972b57 100644 --- a/components/search_engines/search_engine_type.h +++ b/components/search_engines/search_engine_type.h
@@ -74,6 +74,7 @@ SEARCH_ENGINE_OCEANHERO = 57, SEARCH_ENGINE_PRIVACYWALL = 58, SEARCH_ENGINE_ECOSIA = 59, + SEARCH_ENGINE_PETALSEARCH = 60, SEARCH_ENGINE_MAX // Bounding value needed for UMA histogram macro. };
diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc index 9e21c28..c9c39340 100644 --- a/components/search_engines/template_url_prepopulate_data.cc +++ b/components/search_engines/template_url_prepopulate_data.cc
@@ -36,6 +36,7 @@ // Note, the below entries are sorted by country code, not the name in comment. // Engine selection by country ------------------------------------------------ +// clang-format off // United Arab Emirates const PrepopulatedEngine* const engines_AE[] = { &google, @@ -87,6 +88,7 @@ &bing, &yahoo, &duckduckgo, + &yandex_com, }; // Belgium @@ -113,7 +115,7 @@ &bing, &yahoo, &duckduckgo, - &ecosia, + &yandex_com, }; // Burundi @@ -167,7 +169,7 @@ &bing, &yahoo, &duckduckgo, - &ask, + &ecosia, }; // Canada @@ -192,17 +194,17 @@ const PrepopulatedEngine* const engines_CL[] = { &google, &bing, - &yahoo_es, + &yahoo_cl, &duckduckgo, &ecosia, }; // China const PrepopulatedEngine* const engines_CN[] = { - &baidu, &sogou, - &google, + &baidu, &bing, + &google, &so_360, }; @@ -210,7 +212,7 @@ const PrepopulatedEngine* const engines_CO[] = { &google, &bing, - &yahoo_es, + &yahoo_co, &ecosia, &duckduckgo, }; @@ -237,8 +239,8 @@ const PrepopulatedEngine* const engines_DE[] = { &google, &bing, - &duckduckgo, &ecosia, + &duckduckgo, &yahoo_de, }; @@ -263,9 +265,9 @@ // Algeria const PrepopulatedEngine* const engines_DZ[] = { &google, - &yahoo_uk, &bing, - &yandex_ru, + &yahoo_fr, + &yandex_com, &duckduckgo, }; @@ -274,8 +276,8 @@ &google, &bing, &yahoo, - &duckduckgo, &ecosia, + &duckduckgo, }; // Estonia @@ -283,15 +285,15 @@ &google, &bing, &yandex_ru, + &duckduckgo, &yahoo, - &mail_ru, }; // Egypt const PrepopulatedEngine* const engines_EG[] = { &google, - &yahoo, &bing, + &yahoo, &yandex_com, &duckduckgo, }; @@ -347,7 +349,7 @@ &bing, &yahoo, &duckduckgo, - &yandex_com, + &yandex_ru, }; // Guatemala @@ -383,7 +385,7 @@ &bing, &yahoo, &duckduckgo, - &yandex_ru, + &ecosia, }; // Hungary @@ -392,7 +394,7 @@ &bing, &yahoo, &duckduckgo, - &ecosia, + &yandex_com, }; // Indonesia @@ -400,15 +402,15 @@ &google, &yahoo_id, &bing, - &duckduckgo, &yandex_com, + &duckduckgo, }; // Ireland const PrepopulatedEngine* const engines_IE[] = { &google, &bing, - &yahoo, + &yahoo_uk, &duckduckgo, &ecosia, }; @@ -428,15 +430,15 @@ &bing, &yahoo_in, &duckduckgo, - &ecosia, + &info_com, }; // Iraq const PrepopulatedEngine* const engines_IQ[] = { &google, &bing, - &yahoo_uk, - &yandex_com, + &yahoo, + &yandex_tr, &duckduckgo, }; @@ -446,15 +448,15 @@ &bing, &yahoo, &ask, - &naver, + &duckduckgo, }; // Iceland const PrepopulatedEngine* const engines_IS[] = { &google, &bing, - &yahoo, &duckduckgo, + &yahoo, &ecosia, }; @@ -490,8 +492,8 @@ &google, &yahoo_jp, &bing, - &baidu, &duckduckgo, + &baidu, }; // Kenya @@ -507,8 +509,8 @@ const PrepopulatedEngine* const engines_KR[] = { &google, &naver, - &bing, &daum, + &bing, &yahoo, }; @@ -527,7 +529,7 @@ &yandex_kz, &mail_ru, &bing, - &yahoo, + &duckduckgo, }; // Lebanon @@ -536,7 +538,7 @@ &bing, &yahoo, &duckduckgo, - &yandex_ru, + &ecosia, }; // Liechtenstein @@ -553,8 +555,8 @@ &google, &bing, &yahoo, - &yandex_ru, &duckduckgo, + &yandex_ru, }; // Luxembourg @@ -587,8 +589,8 @@ // Morocco const PrepopulatedEngine* const engines_MA[] = { &google, - &yahoo_fr, &bing, + &yahoo_fr, &yandex_com, &duckduckgo, }; @@ -597,17 +599,17 @@ const PrepopulatedEngine* const engines_MC[] = { &google, &bing, - &yahoo, &duckduckgo, - &qwant, + &yahoo_fr, + &ecosia, }; // Moldova const PrepopulatedEngine* const engines_MD[] = { &google, &yandex_ru, - &mail_ru, &bing, + &mail_ru, &yahoo, }; @@ -626,7 +628,7 @@ &bing, &yahoo, &duckduckgo, - &baidu, + &yandex_ru, }; // Mexico @@ -644,7 +646,7 @@ &bing, &yahoo_my, &duckduckgo, - &baidu, + &ecosia, }; // Nicaragua @@ -660,8 +662,8 @@ const PrepopulatedEngine* const engines_NL[] = { &google, &bing, - &duckduckgo, &yahoo_nl, + &duckduckgo, &ecosia, }; @@ -689,14 +691,14 @@ &bing, &yahoo, &duckduckgo, - &ask, + &petal_search, }; // Panama const PrepopulatedEngine* const engines_PA[] = { &google, &bing, - &yahoo, + &yahoo_es, &duckduckgo, &ecosia, }; @@ -705,7 +707,7 @@ const PrepopulatedEngine* const engines_PE[] = { &google, &bing, - &yahoo_es, + &yahoo_pe, &ecosia, &duckduckgo, }; @@ -722,8 +724,8 @@ // Pakistan const PrepopulatedEngine* const engines_PK[] = { &google, - &yahoo, &bing, + &yahoo, &duckduckgo, &yandex_com, }; @@ -734,6 +736,7 @@ &bing, &yahoo, &duckduckgo, + &yandex_ru, }; // Puerto Rico @@ -758,7 +761,7 @@ const PrepopulatedEngine* const engines_PY[] = { &google, &bing, - &yahoo, + &yahoo_es, &duckduckgo, &ecosia, }; @@ -769,7 +772,7 @@ &bing, &yahoo, &duckduckgo, - &ecosia, + &yandex_tr, }; // Romania @@ -778,7 +781,7 @@ &bing, &yahoo, &duckduckgo, - &yandex_ru, + &yandex_tr, }; // Serbia @@ -830,9 +833,9 @@ const PrepopulatedEngine* const engines_SG[] = { &google, &bing, - &yahoo, - &baidu, + &yahoo_sg, &duckduckgo, + &baidu, }; // Slovenia @@ -841,22 +844,23 @@ &bing, &duckduckgo, &yahoo, + &yandex_com, }; // Slovakia const PrepopulatedEngine* const engines_SK[] = { &google, &bing, - &yahoo, &duckduckgo, - &seznam_cz, + &yahoo, + &yandex_com, }; // El Salvador const PrepopulatedEngine* const engines_SV[] = { &google, &bing, - &yahoo, + &yahoo_es, &duckduckgo, &ecosia, }; @@ -866,7 +870,7 @@ &google, &bing, &yahoo, - &yandex_ru, + &yandex_com, &duckduckgo, }; @@ -874,18 +878,18 @@ const PrepopulatedEngine* const engines_TH[] = { &google, &bing, - &yahoo, - &duckduckgo, - &baidu, + &yahoo_th, + &yandex_ru, + &mail_ru, }; // Tunisia const PrepopulatedEngine* const engines_TN[] = { &google, - &yahoo_fr, &bing, + &yahoo_fr, &duckduckgo, - &yandex_ru, + &yandex_com, }; // Turkey @@ -912,7 +916,7 @@ &yahoo_tw, &bing, &baidu, - &ecosia, + &duckduckgo, }; // Tanzania @@ -921,7 +925,7 @@ &bing, &yahoo, &duckduckgo, - &ecosia, + &baidu, }; // Ukraine @@ -946,7 +950,7 @@ const PrepopulatedEngine* const engines_UY[] = { &google, &bing, - &yahoo, + &yahoo_es, &duckduckgo, &ecosia, }; @@ -954,8 +958,8 @@ // Venezuela const PrepopulatedEngine* const engines_VE[] = { &google, - &yahoo_ve, &bing, + &yahoo_es, &duckduckgo, &ecosia, }; @@ -964,9 +968,9 @@ const PrepopulatedEngine* const engines_VN[] = { &google, &coccoc, - &bing, &yahoo, - &baidu, + &bing, + &yandex_ru, }; // Yemen @@ -974,7 +978,7 @@ &google, &bing, &yahoo, - &yandex_ru, + &yandex_com, &duckduckgo, }; @@ -993,8 +997,10 @@ &bing, &yahoo, &duckduckgo, - &ask, + &ecosia, }; + +// clang-format on // ---------------------------------------------------------------------------- std::vector<std::unique_ptr<TemplateURLData>> GetPrepopulationSetFromCountryID(
diff --git a/components/soda/constants.cc b/components/soda/constants.cc index a2c14b35..aea5cd1 100644 --- a/components/soda/constants.cc +++ b/components/soda/constants.cc
@@ -63,11 +63,12 @@ } const base::FilePath GetSodaTestResourcesDirectory() { - base::FilePath source_root; - base::PathService::Get(base::DIR_SOURCE_ROOT, &source_root); - return source_root.empty() + base::FilePath test_data_root; + base::PathService::Get(base::DIR_SRC_TEST_DATA_ROOT, &test_data_root); + DCHECK(!test_data_root.empty()); + return test_data_root.empty() ? base::FilePath() - : source_root.Append(kSodaTestResourcesRelativePath); + : test_data_root.Append(kSodaTestResourcesRelativePath); } const base::FilePath GetLatestSodaLanguagePackDirectory(
diff --git a/components/spellcheck/browser/spelling_service_client.cc b/components/spellcheck/browser/spelling_service_client.cc index b640414..27f76cc 100644 --- a/components/spellcheck/browser/spelling_service_client.cc +++ b/components/spellcheck/browser/spelling_service_client.cc
@@ -71,8 +71,12 @@ DCHECK(pref); std::string dictionary; - pref->GetList(spellcheck::prefs::kSpellCheckDictionaries) - ->GetString(0, &dictionary); + const base::Value* dicts_list = + pref->GetList(spellcheck::prefs::kSpellCheckDictionaries); + DCHECK(dicts_list->is_list()); + base::Value::ConstListView dicts_lists_view = dicts_list->GetList(); + if (0u < dicts_lists_view.size() && dicts_lists_view[0].is_string()) + dictionary = dicts_lists_view[0].GetString(); std::string language_code; std::string country_code; @@ -176,8 +180,13 @@ // If the locale for spelling has not been set, the user has not decided to // use spellcheck so we don't do anything remote (suggest or spelling). std::string locale; - pref->GetList(spellcheck::prefs::kSpellCheckDictionaries) - ->GetString(0, &locale); + const base::Value* dicts_list = + pref->GetList(spellcheck::prefs::kSpellCheckDictionaries); + DCHECK(dicts_list->is_list()); + base::Value::ConstListView dicts_lists_view = dicts_list->GetList(); + if (0u < dicts_lists_view.size() && dicts_lists_view[0].is_string()) + locale = dicts_lists_view[0].GetString(); + if (locale.empty()) return false;
diff --git a/components/subresource_filter/content/browser/ruleset_publisher_impl.cc b/components/subresource_filter/content/browser/ruleset_publisher_impl.cc index 4075f176..450c132 100644 --- a/components/subresource_filter/content/browser/ruleset_publisher_impl.cc +++ b/components/subresource_filter/content/browser/ruleset_publisher_impl.cc
@@ -21,9 +21,6 @@ #include "components/subresource_filter/core/mojom/subresource_filter.mojom.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/notification_service.h" -#include "content/public/browser/notification_source.h" -#include "content/public/browser/notification_types.h" #include "content/public/browser/render_process_host.h" namespace subresource_filter { @@ -37,12 +34,6 @@ best_effort_task_runner_ = content::GetUIThreadTaskRunner({base::TaskPriority::BEST_EFFORT}); DCHECK(best_effort_task_runner_->BelongsToCurrentThread()); - // Must rely on notifications as RenderProcessHostObserver::RenderProcessReady - // would only be called after queued IPC messages (potentially triggering a - // navigation) had already been sent to the new renderer. - notification_registrar_.Add( - this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, - content::NotificationService::AllBrowserContextsAndSources()); } RulesetPublisherImpl::~RulesetPublisherImpl() = default; @@ -100,16 +91,11 @@ unindexed_ruleset_info); } -void RulesetPublisherImpl::Observe( - int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - DCHECK_EQ(type, content::NOTIFICATION_RENDERER_PROCESS_CREATED); +void RulesetPublisherImpl::OnRenderProcessHostCreated( + content::RenderProcessHost* rph) { if (!ruleset_data_ || !ruleset_data_->IsValid()) return; - SendRulesetToRenderProcess( - ruleset_data_.get(), - content::Source<content::RenderProcessHost>(source).ptr()); + SendRulesetToRenderProcess(ruleset_data_.get(), rph); } void RulesetPublisherImpl::SendRulesetToRenderProcess(
diff --git a/components/subresource_filter/content/browser/ruleset_publisher_impl.h b/components/subresource_filter/content/browser/ruleset_publisher_impl.h index 571aeeb5..8120b4c1 100644 --- a/components/subresource_filter/content/browser/ruleset_publisher_impl.h +++ b/components/subresource_filter/content/browser/ruleset_publisher_impl.h
@@ -16,9 +16,8 @@ #include "components/subresource_filter/content/browser/ruleset_publisher.h" #include "components/subresource_filter/content/browser/ruleset_version.h" #include "components/subresource_filter/content/browser/verified_ruleset_dealer.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_registrar.h" #include "content/public/browser/render_process_host.h" +#include "content/public/browser/render_process_host_creation_observer.h" namespace subresource_filter { @@ -30,7 +29,7 @@ // renderer processes, where they will be memory-mapped as-needed by the // UnverifiedRulesetDealer. class RulesetPublisherImpl : public RulesetPublisher, - public content::NotificationObserver { + public content::RenderProcessHostCreationObserver { public: RulesetPublisherImpl( RulesetService* ruleset_service, @@ -61,12 +60,9 @@ content::RenderProcessHost* rph); private: - // content::NotificationObserver: - void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override; + // content::RenderProcessHostCreationObserver: + void OnRenderProcessHostCreated(content::RenderProcessHost* rph) override; - content::NotificationRegistrar notification_registrar_; RulesetFilePtr ruleset_data_{nullptr, base::OnTaskRunnerDeleter{nullptr}}; base::OnceClosure ruleset_published_callback_;
diff --git a/components/subresource_filter/content/browser/ruleset_publisher_impl_unittest.cc b/components/subresource_filter/content/browser/ruleset_publisher_impl_unittest.cc index 5867e790..88cd6be 100644 --- a/components/subresource_filter/content/browser/ruleset_publisher_impl_unittest.cc +++ b/components/subresource_filter/content/browser/ruleset_publisher_impl_unittest.cc
@@ -27,9 +27,6 @@ #include "components/subresource_filter/core/common/test_ruleset_creator.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" -#include "content/public/browser/notification_service.h" -#include "content/public/browser/notification_source.h" -#include "content/public/browser/notification_types.h" #include "content/public/test/browser_task_environment.h" #include "content/public/test/mock_render_process_host.h" #include "content/public/test/test_browser_context.h" @@ -48,12 +45,11 @@ class NotifyingMockRenderProcessHost : public content::MockRenderProcessHost { public: explicit NotifyingMockRenderProcessHost( - content::BrowserContext* browser_context) + content::BrowserContext* browser_context, + content::RenderProcessHostCreationObserver* observer) : content::MockRenderProcessHost(browser_context) { - content::NotificationService::current()->Notify( - content::NOTIFICATION_RENDERER_PROCESS_CREATED, - content::Source<content::RenderProcessHost>(this), - content::NotificationService::NoDetails()); + if (observer) + observer->OnRenderProcessHostCreated(this); } }; @@ -69,7 +65,7 @@ class SubresourceFilterRulesetPublisherImplTest : public ::testing::Test { public: SubresourceFilterRulesetPublisherImplTest() - : existing_renderer_(&browser_context_) {} + : existing_renderer_(&browser_context_, nullptr) {} SubresourceFilterRulesetPublisherImplTest( const SubresourceFilterRulesetPublisherImplTest&) = delete; @@ -130,10 +126,10 @@ }; TEST_F(SubresourceFilterRulesetPublisherImplTest, NoRuleset_NoIPCMessages) { - NotifyingMockRenderProcessHost existing_renderer(browser_context()); + NotifyingMockRenderProcessHost existing_renderer(browser_context(), nullptr); MockRulesetPublisherImpl service(nullptr, base::ThreadTaskRunnerHandle::Get()); - NotifyingMockRenderProcessHost new_renderer(browser_context()); + NotifyingMockRenderProcessHost new_renderer(browser_context(), &service); base::RunLoop().RunUntilIdle(); EXPECT_EQ(0u, service.RulesetSent()); } @@ -149,12 +145,13 @@ base::File::FLAG_OPEN | base::File::FLAG_READ), base::OnTaskRunnerDeleter(base::SequencedTaskRunnerHandle::Get())); - NotifyingMockRenderProcessHost existing_renderer(browser_context()); + NotifyingMockRenderProcessHost existing_renderer(browser_context(), nullptr); MockClosureTarget publish_callback_target; MockRulesetPublisherImpl service(nullptr, base::ThreadTaskRunnerHandle::Get()); service.SetRulesetPublishedCallbackForTesting(base::BindOnce( &MockClosureTarget::Call, base::Unretained(&publish_callback_target))); + EXPECT_CALL(publish_callback_target, Call()).Times(1); service.PublishNewRulesetVersion(std::move(file)); base::RunLoop().RunUntilIdle(); @@ -164,7 +161,7 @@ ASSERT_NO_FATAL_FAILURE(AssertSetRulesetFileWithContent( service.RulesetFileForProcess(&existing_renderer), kTestFileContents)); - NotifyingMockRenderProcessHost second_renderer(browser_context()); + NotifyingMockRenderProcessHost second_renderer(browser_context(), &service); base::RunLoop().RunUntilIdle(); ASSERT_EQ(3u, service.RulesetSent()); @@ -209,7 +206,7 @@ base::MakeRefCounted<base::TestSimpleTaskRunner>(); scoped_refptr<base::TestSimpleTaskRunner> background_task_runner = base::MakeRefCounted<base::TestSimpleTaskRunner>(); - NotifyingMockRenderProcessHost renderer_host(browser_context()); + NotifyingMockRenderProcessHost renderer_host(browser_context(), nullptr); base::RunLoop callback_waiter; auto content_service = std::make_unique<MockRulesetPublisherImpl>(nullptr, blocking_task_runner);
diff --git a/components/sync/base/model_type_unittest.cc b/components/sync/base/model_type_unittest.cc index d1fa0e7..52551b2 100644 --- a/components/sync/base/model_type_unittest.cc +++ b/components/sync/base/model_type_unittest.cc
@@ -30,12 +30,13 @@ const ModelTypeSet model_types(BOOKMARKS, APPS); std::unique_ptr<base::ListValue> value(ModelTypeSetToValue(model_types)); - EXPECT_EQ(2u, value->GetList().size()); - std::string types[2]; - EXPECT_TRUE(value->GetString(0, &types[0])); - EXPECT_TRUE(value->GetString(1, &types[1])); - EXPECT_EQ("Bookmarks", types[0]); - EXPECT_EQ("Apps", types[1]); + ASSERT_TRUE(value->is_list()); + base::Value::ConstListView value_list = value->GetList(); + ASSERT_EQ(2u, value_list.size()); + ASSERT_TRUE(value_list[0].is_string()); + EXPECT_EQ("Bookmarks", value_list[0].GetString()); + ASSERT_TRUE(value_list[1].is_string()); + EXPECT_EQ("Apps", value_list[1].GetString()); } TEST_F(ModelTypeTest, IsRealDataType) {
diff --git a/components/user_manager/user_manager_base.cc b/components/user_manager/user_manager_base.cc index dc23d91..e9b87e21 100644 --- a/components/user_manager/user_manager_base.cc +++ b/components/user_manager/user_manager_base.cc
@@ -522,19 +522,20 @@ std::set<AccountId>* users_set) { users_vector->clear(); users_set->clear(); - for (size_t i = 0; i < users_list.GetList().size(); ++i) { - std::string email; - if (!users_list.GetString(i, &email) || email.empty()) { + base::Value::ConstListView users_list_view = users_list.GetList(); + for (size_t i = 0; i < users_list_view.size(); ++i) { + const std::string* email = users_list_view[i].GetIfString(); + if (!email || email->empty()) { LOG(ERROR) << "Corrupt entry in user list at index " << i << "."; continue; } const AccountId account_id = known_user::GetAccountId( - email, std::string() /* id */, AccountType::UNKNOWN); + *email, std::string() /* id */, AccountType::UNKNOWN); if (existing_users.find(account_id) != existing_users.end() || !users_set->insert(account_id).second) { - LOG(ERROR) << "Duplicate user: " << email; + LOG(ERROR) << "Duplicate user: " << *email; continue; } users_vector->push_back(account_id); @@ -885,9 +886,9 @@ bool UserManagerBase::UserExistsInList(const AccountId& account_id) const { const base::ListValue* user_list = GetLocalState()->GetList(kRegularUsersPref); - for (size_t i = 0; i < user_list->GetList().size(); ++i) { - std::string email; - if (user_list->GetString(i, &email) && (account_id.GetUserEmail() == email)) + for (const base::Value& i : user_list->GetList()) { + const std::string* email = i.GetIfString(); + if (email && (account_id.GetUserEmail() == *email)) return true; } return false;
diff --git a/components/viz/BUILD.gn b/components/viz/BUILD.gn index 71a7ee4..ab595a7 100644 --- a/components/viz/BUILD.gn +++ b/components/viz/BUILD.gn
@@ -7,6 +7,11 @@ import("//testing/test.gni") viz_test("viz_unittests") { + configs = [] + if (is_chromeos_lacros && is_chromeos_device) { + configs += [ "//build/lacros:optional_shared_libgcc" ] + } + use_xvfb = use_xvfb_in_this_config sources = [ "test/run_all_unittests.cc" ]
diff --git a/content/browser/accessibility/accessibility_tree_formatter_utils_mac.h b/content/browser/accessibility/accessibility_tree_formatter_utils_mac.h index 7a46c274..da26a17d 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_utils_mac.h +++ b/content/browser/accessibility/accessibility_tree_formatter_utils_mac.h
@@ -8,11 +8,13 @@ #include "content/browser/accessibility/accessibility_tools_utils_mac.h" #include "content/browser/accessibility/browser_accessibility_cocoa.h" #include "content/common/content_export.h" +#include "ui/accessibility/platform/inspect/ax_optional.h" #include "ui/accessibility/platform/inspect/ax_tree_indexer.h" namespace ui { class AXPropertyNode; -} + +} // namespace ui namespace content { namespace a11y { @@ -34,56 +36,8 @@ using LineIndexer = ui::AXTreeIndexer<GetDOMId, NSArray*, ChildrenOf, NodeComparator>; -// Implements stateful id values. Similar to absl::optional, but -// multi-state allowing nullable values. -class CONTENT_EXPORT OptionalNSObject final { - public: - enum { - // Indicates a valid value; can be nil. - kId, - - // Indicates a call error, and may also indicate a parser error. - kError, - - // Indicates a called property is not applicable to the object. - kNotApplicable, - - // Indicates the property can't have an associated object. - kUnsupported, - }; - - static OptionalNSObject Unsupported() { - return OptionalNSObject(kUnsupported); - } - static OptionalNSObject Error() { return OptionalNSObject(kError); } - static OptionalNSObject NotApplicable() { - return OptionalNSObject(kNotApplicable); - } - static OptionalNSObject NotNilOrError(id other_value) { - return OptionalNSObject(other_value, other_value != nil ? kId : kError); - } - static OptionalNSObject NotNullOrNotApplicable(id other_value) { - return OptionalNSObject(other_value, - other_value != nil ? kId : kNotApplicable); - } - - explicit OptionalNSObject(int flag) : value(nil), flag(flag) {} - explicit OptionalNSObject(id value, int flag = kId) - : value(value), flag(flag) {} - - bool IsUnsupported() const { return flag == kUnsupported; } - bool IsNotApplicable() const { return flag == kNotApplicable; } - bool IsError() const { return flag == kError; } - bool IsNotNil() const { return value != nil; } - bool HasValue() { return flag == kId; } - constexpr const id& operator*() const& { return value; } - - std::string ToString() const; - - private: - id value; - int flag; -}; +// Optional tri-state id object. +using OptionalNSObject = ui::AXOptional<id>; // Invokes attributes matching the given property filter. class CONTENT_EXPORT AttributeInvoker final {
diff --git a/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm b/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm index 5c89502..ceb01f7 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm +++ b/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm
@@ -20,6 +20,18 @@ } // extern "C" #endif +namespace ui { + +// Template specialization Nit: ui::AXOptional<id>. +template <> +std::string ui::AXOptional<id>::ToString() const { + if (IsNotNull()) + return base::SysNSStringToUTF8([NSString stringWithFormat:@"%@", value_]); + return StateToString(); +} + +} // namespace ui + namespace content { namespace a11y { @@ -50,22 +62,6 @@ } // namespace -// OptionalNSObject - -std::string OptionalNSObject::ToString() const { - if (IsNotApplicable()) { - return "<n/a>"; - } else if (IsUnsupported()) { - return "<unsupported>"; - } else if (IsError()) { - return "<error>"; - } else if (value == nil) { - return "<nil>"; - } else { - return base::SysNSStringToUTF8([NSString stringWithFormat:@"%@", value]); - } -} - // AttributeInvoker AttributeInvoker::AttributeInvoker(const LineIndexer* line_indexer, @@ -203,7 +199,7 @@ } if (property_node.name_or_value == "AXPerformAction") { OptionalNSObject param = ParamByPropertyNode(property_node); - if (param.IsNotNil()) { + if (param.IsNotNull()) { PerformAction(target, *param); return OptionalNSObject::Unsupported(); } @@ -216,7 +212,7 @@ // Setter if (property_node.rvalue) { OptionalNSObject rvalue = Invoke(*property_node.rvalue); - if (rvalue.IsNotNil()) { + if (rvalue.IsNotNull()) { SetAttributeValueOf(target, attribute, *rvalue); return {rvalue}; } @@ -233,7 +229,7 @@ for (NSString* attribute : ParameterizedAttributeNamesOf(target)) { if (property_node.IsMatching(base::SysNSStringToUTF8(attribute))) { OptionalNSObject param = ParamByPropertyNode(property_node); - if (param.IsNotNil()) { + if (param.IsNotNull()) { return OptionalNSObject( ParameterizedAttributeValueOf(target, attribute, *param)); } @@ -337,7 +333,7 @@ NSString* key = PropertyNodeToString(property_node); NSDictionary* dictionary = target; - return OptionalNSObject::NotNilOrError(dictionary[key]); + return OptionalNSObject::NotNullOrError(dictionary[key]); } OptionalNSObject AttributeInvoker::ParamByPropertyNode( @@ -360,35 +356,35 @@ const std::string& property_name = property_node.name_or_value; if (property_name == "AXLineForIndex" || property_name == "AXTextMarkerForIndex") { // Int - return OptionalNSObject::NotNilOrError(PropertyNodeToInt(arg_node)); + return OptionalNSObject::NotNullOrError(PropertyNodeToInt(arg_node)); } if (property_name == "AXPerformAction") { - return OptionalNSObject::NotNilOrError(PropertyNodeToString(arg_node)); + return OptionalNSObject::NotNullOrError(PropertyNodeToString(arg_node)); } if (property_name == "AXCellForColumnAndRow") { // IntArray - return OptionalNSObject::NotNilOrError(PropertyNodeToIntArray(arg_node)); + return OptionalNSObject::NotNullOrError(PropertyNodeToIntArray(arg_node)); } if (property_name == "AXTextMarkerRangeForUnorderedTextMarkers") { // TextMarkerArray - return OptionalNSObject::NotNilOrError( + return OptionalNSObject::NotNullOrError( PropertyNodeToTextMarkerArray(arg_node)); } if (property_name == "AXStringForRange") { // NSRange - return OptionalNSObject::NotNilOrError(PropertyNodeToRange(arg_node)); + return OptionalNSObject::NotNullOrError(PropertyNodeToRange(arg_node)); } if (property_name == "AXIndexForChildUIElement" || property_name == "AXTextMarkerRangeForUIElement") { // UIElement - return OptionalNSObject::NotNilOrError(PropertyNodeToUIElement(arg_node)); + return OptionalNSObject::NotNullOrError(PropertyNodeToUIElement(arg_node)); } if (property_name == "AXIndexForTextMarker" || property_name == "AXNextWordEndTextMarkerForTextMarker" || property_name == "AXPreviousWordStartTextMarkerForTextMarker") { // TextMarker - return OptionalNSObject::NotNilOrError(PropertyNodeToTextMarker(arg_node)); + return OptionalNSObject::NotNullOrError(PropertyNodeToTextMarker(arg_node)); } if (property_name == "AXSelectedTextMarkerRangeAttribute" || property_name == "AXStringForTextMarkerRange") { // TextMarkerRange - return OptionalNSObject::NotNilOrError( + return OptionalNSObject::NotNullOrError( PropertyNodeToTextMarkerRange(arg_node)); } @@ -477,7 +473,7 @@ [[NSMutableArray alloc] initWithCapacity:arraynode.arguments.size()]; for (const auto& paramnode : arraynode.arguments) { OptionalNSObject text_marker = Invoke(paramnode); - if (!text_marker.IsNotNil()) { + if (!text_marker.IsNotNull()) { if (log_failure) INTARRAY_FAIL(arraynode, paramnode.ToFlatString() + "is not a text marker")
diff --git a/content/browser/accessibility/dump_accessibility_node_browsertest.cc b/content/browser/accessibility/dump_accessibility_node_browsertest.cc index 9905b27d..433c8fd 100644 --- a/content/browser/accessibility/dump_accessibility_node_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_node_browsertest.cc
@@ -302,6 +302,12 @@ } IN_PROC_BROWSER_TEST_P(DumpAccessibilityAccNameTest, + DescFromContentOfDescribedbyElementRecursive) { + RunAccNameTest(FILE_PATH_LITERAL( + "desc-from-content-of-describedby-element-recursive.html")); +} + +IN_PROC_BROWSER_TEST_P(DumpAccessibilityAccNameTest, DescImgAltDescribedbyHidden) { RunAccNameTest(FILE_PATH_LITERAL("desc-img-alt-describedby-hidden.html")); } @@ -864,6 +870,12 @@ RunAccNameTest(FILE_PATH_LITERAL("name-reset-button.html")); } +IN_PROC_BROWSER_TEST_P(DumpAccessibilityAccNameTest, + NameTextContentOfLabelledByElementRecursive) { + RunAccNameTest(FILE_PATH_LITERAL( + "name-text-content-of-labelledby-element-recursive.html")); +} + IN_PROC_BROWSER_TEST_P(DumpAccessibilityAccNameTest, NameTextCssAfterInLabel) { RunAccNameTest(FILE_PATH_LITERAL("name-text-css-after-in-label.html")); }
diff --git a/content/browser/devtools/protocol/devtools_download_manager_delegate.h b/content/browser/devtools/protocol/devtools_download_manager_delegate.h index 3cd5e8af..f810033 100644 --- a/content/browser/devtools/protocol/devtools_download_manager_delegate.h +++ b/content/browser/devtools/protocol/devtools_download_manager_delegate.h
@@ -12,7 +12,6 @@ #include "base/compiler_specific.h" #include "base/files/file_util.h" #include "base/memory/ref_counted.h" -#include "base/memory/singleton.h" #include "base/memory/weak_ptr.h" #include "content/public/browser/download_manager_delegate.h"
diff --git a/content/browser/gpu/compositor_util.cc b/content/browser/gpu/compositor_util.cc index 5ac0eb37..c79e573 100644 --- a/content/browser/gpu/compositor_util.cc +++ b/content/browser/gpu/compositor_util.cc
@@ -221,6 +221,8 @@ !features::IsUsingSkiaRenderer(), DisableInfo::NotProblem(), false}, {"raw_draw", gpu::kGpuFeatureStatusEnabled, !features::IsUsingRawDraw(), DisableInfo::NotProblem(), false}, + {"direct_rendering_display_compositor", gpu::kGpuFeatureStatusEnabled, + !features::IsDrDcEnabled(), DisableInfo::NotProblem(), false}, }; DCHECK(index < base::size(kGpuFeatureData)); *eof = (index == base::size(kGpuFeatureData) - 1); @@ -255,6 +257,7 @@ // Features undergoing a finch controlled roll out. if (gpu_feature_data.name == "skia_renderer" || gpu_feature_data.name == "raw_draw" || + gpu_feature_data.name == "direct_rendering_display_compositor" || gpu_feature_data.name == "viz_hit_test_surface_layer") { status = (gpu_feature_data.disabled ? "disabled_off_ok" : "enabled_on"); } else if (gpu_feature_data.disabled || gpu_access_blocked ||
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.h b/content/browser/gpu/gpu_data_manager_impl_private.h index 040add1d..8ae871aa 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private.h +++ b/content/browser/gpu/gpu_data_manager_impl_private.h
@@ -18,7 +18,6 @@ #include "base/gtest_prod_util.h" #include "base/memory/raw_ptr.h" #include "base/memory/ref_counted.h" -#include "base/memory/singleton.h" #include "base/observer_list_threadsafe.h" #include "base/timer/timer.h" #include "base/values.h"
diff --git a/content/browser/media/media_internals_unittest.cc b/content/browser/media/media_internals_unittest.cc index dbcc19b..96c2d7a 100644 --- a/content/browser/media/media_internals_unittest.cc +++ b/content/browser/media/media_internals_unittest.cc
@@ -92,10 +92,12 @@ const size_t actual_size = actual_list->GetList().size(); ASSERT_EQ(expected_size, actual_size); for (size_t i = 0; i < expected_size; ++i) { - std::string expected_value, actual_value; - ASSERT_TRUE(expected_list.GetString(i, &expected_value)); - ASSERT_TRUE(actual_list->GetString(i, &actual_value)); - EXPECT_EQ(expected_value, actual_value); + const std::string* expected_value = + expected_list.GetList()[i].GetIfString(); + const std::string* actual_value = actual_list->GetList()[i].GetIfString(); + ASSERT_TRUE(expected_value); + ASSERT_TRUE(actual_value); + EXPECT_EQ(*expected_value, *actual_value); } }
diff --git a/content/browser/payments/payment_app_info_fetcher.cc b/content/browser/payments/payment_app_info_fetcher.cc index d8aa1cb..6e40727 100644 --- a/content/browser/payments/payment_app_info_fetcher.cc +++ b/content/browser/payments/payment_app_info_fetcher.cc
@@ -89,47 +89,44 @@ continue; } - // Get the main frame since web app manifest is only available in the main - // frame's document by definition. The main frame's document must come from - // the same origin. - RenderFrameHostImpl* top_level_render_frame_host = render_frame_host; - while (top_level_render_frame_host->GetParent() != nullptr) { - top_level_render_frame_host = top_level_render_frame_host->GetParent(); - } - WebContentsImpl* top_level_web_content = static_cast<WebContentsImpl*>( - WebContents::FromRenderFrameHost(top_level_render_frame_host)); - if (!top_level_web_content) { - top_level_render_frame_host->AddMessageToConsole( + // Get the WebContents associated with the frame and print console messages + // to the main frame of the WebContents since web app manifest is only + // available in the main frame's document by definition. The main frame's + // document must come from the same origin. + WebContentsImpl* web_content = static_cast<WebContentsImpl*>( + WebContents::FromRenderFrameHost(render_frame_host)); + if (!web_content) { + render_frame_host->AddMessageToConsole( blink::mojom::ConsoleMessageLevel::kError, "Unable to find the web page for \"" + context_url.spec() + "\" to fetch payment handler manifest (for name and icon)."); continue; } - if (top_level_web_content->IsHidden()) { - top_level_render_frame_host->AddMessageToConsole( + if (web_content->IsHidden()) { + web_content->GetMainFrame()->AddMessageToConsole( blink::mojom::ConsoleMessageLevel::kError, "Unable to fetch payment handler manifest (for name and icon) for " "\"" + context_url.spec() + "\" from a hidden top level web page \"" + - top_level_web_content->GetLastCommittedURL().spec() + "\"."); + web_content->GetLastCommittedURL().spec() + "\"."); continue; } if (!url::IsSameOriginWith(context_url, - top_level_web_content->GetLastCommittedURL())) { - top_level_render_frame_host->AddMessageToConsole( + web_content->GetLastCommittedURL())) { + web_content->GetMainFrame()->AddMessageToConsole( blink::mojom::ConsoleMessageLevel::kError, "Unable to fetch payment handler manifest (for name and icon) for " "\"" + context_url.spec() + "\" from a cross-origin top level web page \"" + - top_level_web_content->GetLastCommittedURL().spec() + "\"."); + web_content->GetLastCommittedURL().spec() + "\"."); continue; } - web_contents_ = top_level_web_content->GetWeakPtr(); - top_level_render_frame_host->GetPage().GetManifest( + web_contents_ = web_content->GetWeakPtr(); + web_contents_->GetMainFrame()->GetPage().GetManifest( base::BindOnce(&PaymentAppInfoFetcher::SelfDeleteFetcher:: FetchPaymentAppManifestCallback, weak_ptr_factory_.GetWeakPtr()));
diff --git a/content/browser/payments/respond_with_callback.h b/content/browser/payments/respond_with_callback.h index b74838af..2b8317bb7 100644 --- a/content/browser/payments/respond_with_callback.h +++ b/content/browser/payments/respond_with_callback.h
@@ -6,7 +6,6 @@ #define CONTENT_BROWSER_PAYMENTS_RESPOND_WITH_CALLBACK_H_ #include "base/callback_forward.h" -#include "base/memory/singleton.h" #include "base/metrics/histogram_macros.h" #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/public/browser/browser_context.h"
diff --git a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc index 52b49f2..1443cbd 100644 --- a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc +++ b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
@@ -265,8 +265,8 @@ DCHECK_CURRENTLY_ON(BrowserThread::IO); scoped_refptr<media::VideoCaptureBufferPool> buffer_pool = - new media::VideoCaptureBufferPoolImpl( - requested_buffer_type, buffer_pool_max_buffer_count); + new media::VideoCaptureBufferPoolImpl(requested_buffer_type, + buffer_pool_max_buffer_count); #if BUILDFLAG(IS_CHROMEOS_ASH) return std::make_unique<media::VideoCaptureDeviceClient>( @@ -476,7 +476,8 @@ return; } auto video_capture_device = - fake_device_factory_->CreateDevice(devices_info.front().descriptor); + fake_device_factory_->CreateDevice(devices_info.front().descriptor) + .ReleaseDevice(); video_capture_device->AllocateAndStart(params, std::move(device_client)); std::move(result_callback).Run(std::move(video_capture_device)); }
diff --git a/content/browser/renderer_host/media/video_capture_manager_unittest.cc b/content/browser/renderer_host/media/video_capture_manager_unittest.cc index 2fb1f25..99c773c 100644 --- a/content/browser/renderer_host/media/video_capture_manager_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_manager_unittest.cc
@@ -110,10 +110,13 @@ ~WrappedDeviceFactory() override = default; - std::unique_ptr<media::VideoCaptureDevice> CreateDevice( + media::VideoCaptureErrorOrDevice CreateDevice( const media::VideoCaptureDeviceDescriptor& device_descriptor) override { - return std::make_unique<WrappedDevice>( - FakeVideoCaptureDeviceFactory::CreateDevice(device_descriptor), this); + auto device = std::make_unique<WrappedDevice>( + FakeVideoCaptureDeviceFactory::CreateDevice(device_descriptor) + .ReleaseDevice(), + this); + return media::VideoCaptureErrorOrDevice(std::move(device)); } void GetDevicesInfo(GetDevicesInfoCallback callback) override { @@ -138,9 +141,7 @@ MOCK_METHOD0(WillResumeDevice, void()); private: - void OnDeviceCreated(WrappedDevice* device) { - devices_.push_back(device); - } + void OnDeviceCreated(WrappedDevice* device) { devices_.push_back(device); } void OnDeviceDestroyed(WrappedDevice* device) { const auto it = std::find(devices_.begin(), devices_.end(), device); @@ -330,12 +331,8 @@ media::VideoCaptureParams params; params.requested_format = media::VideoCaptureFormat( gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420); - vcm_->ResumeCaptureForClient( - session_id, - params, - controllers_[client_id], - client_id, - frame_observer_.get()); + vcm_->ResumeCaptureForClient(session_id, params, controllers_[client_id], + client_id, frame_observer_.get()); // Allow possible VideoCaptureDevice::Resume() task to run. base::RunLoop().RunUntilIdle(); } @@ -389,7 +386,7 @@ TEST_F(VideoCaptureManagerTest, CreateAndCloseMultipleTimes) { InSequence s; - for (int i = 1 ; i < 3 ; ++i) { + for (int i = 1; i < 3; ++i) { EXPECT_CALL(*listener_, Opened(blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE, _)); EXPECT_CALL(*frame_observer_, OnStarted(_)); @@ -480,7 +477,7 @@ // Connect and disconnect devices. TEST_F(VideoCaptureManagerTest, ConnectAndDisconnectDevices) { int number_of_devices_keep = - video_capture_device_factory_->number_of_devices(); + video_capture_device_factory_->number_of_devices(); // Simulate we remove 1 fake device. video_capture_device_factory_->SetToDefaultDevicesConfig(1);
diff --git a/content/browser/resources/gpu/info_view.js b/content/browser/resources/gpu/info_view.js index e494b5e8..ff677b7 100644 --- a/content/browser/resources/gpu/info_view.js +++ b/content/browser/resources/gpu/info_view.js
@@ -280,6 +280,8 @@ 'canvas_oop_rasterization': 'Canvas out-of-process rasterization', 'raw_draw': 'Raw Draw', 'video_encode': 'Video Encode', + 'direct_rendering_display_compositor': + 'Direct Rendering Display Compositor', }; const statusMap = {
diff --git a/content/browser/ukm_internals_ui.cc b/content/browser/ukm_internals_ui.cc index 3e05759..5a1d125 100644 --- a/content/browser/ukm_internals_ui.cc +++ b/content/browser/ukm_internals_ui.cc
@@ -63,11 +63,13 @@ UkmMessageHandler::~UkmMessageHandler() {} void UkmMessageHandler::HandleRequestUkmData(const base::ListValue* args) { + base::Value::ConstListView args_list = args->GetList(); AllowJavascript(); // Identifies the callback, used for when resolving. std::string callback_id; - args->GetString(0, &callback_id); + if (0u < args_list.size() && args_list[0].is_string()) + callback_id = args_list[0].GetString(); base::Value ukm_debug_data = ukm::debug::UkmDebugDataExtractor::GetStructuredData(ukm_service_);
diff --git a/content/browser/web_contents/web_contents_view_aura_unittest.cc b/content/browser/web_contents/web_contents_view_aura_unittest.cc index 026cb35..618b429 100644 --- a/content/browser/web_contents/web_contents_view_aura_unittest.cc +++ b/content/browser/web_contents/web_contents_view_aura_unittest.cc
@@ -624,7 +624,7 @@ EXPECT_TRUE(exchange_data); EXPECT_TRUE(exchange_data->GetSource()); EXPECT_TRUE(exchange_data->GetSource()->IsUrlType()); - EXPECT_TRUE(exchange_data->GetSource()->origin()->IsSameOriginWith( + EXPECT_TRUE(exchange_data->GetSource()->GetOrigin()->IsSameOriginWith( url::Origin::Create(GURL(kGmailUrl)))); }
diff --git a/content/browser/webauth/authenticator_common.cc b/content/browser/webauth/authenticator_common.cc index fa1c6118..b7052d3 100644 --- a/content/browser/webauth/authenticator_common.cc +++ b/content/browser/webauth/authenticator_common.cc
@@ -83,6 +83,7 @@ kLargeBlobWrite, kCredBlob, kGetCredBlob, + kMinPINLength, }; namespace { @@ -866,6 +867,10 @@ requested_extensions_.insert(RequestExtension::kCredBlob); ctap_make_credential_request_->cred_blob = *options->cred_blob; } + if (options->min_pin_length_requested) { + requested_extensions_.insert(RequestExtension::kMinPINLength); + ctap_make_credential_request_->min_pin_length_requested = true; + } make_credential_options_->large_blob_support = options->large_blob_enable; ctap_make_credential_request_->app_id_exclude = std::move(appid_exclude); make_credential_options_->is_off_the_record_context = @@ -1693,6 +1698,14 @@ response->echo_cred_blob = true; response->cred_blob = did_store_cred_blob; break; + case RequestExtension::kMinPINLength: + // Ignore. The spec says[1] that there's no client (i.e. browser) + // extension output (as opposed to the output in the returned + // authenticator data). This may have been a mistake but it can always + // be added later. + // [1] + // https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-minpinlength-extension + break; case RequestExtension::kAppID: case RequestExtension::kLargeBlobRead: case RequestExtension::kLargeBlobWrite: @@ -1822,6 +1835,7 @@ case RequestExtension::kCredProps: case RequestExtension::kLargeBlobEnable: case RequestExtension::kCredBlob: + case RequestExtension::kMinPINLength: NOTREACHED(); break; }
diff --git a/content/browser/webauth/authenticator_impl_unittest.cc b/content/browser/webauth/authenticator_impl_unittest.cc index 1f96172..fdc98b4 100644 --- a/content/browser/webauth/authenticator_impl_unittest.cc +++ b/content/browser/webauth/authenticator_impl_unittest.cc
@@ -4267,6 +4267,33 @@ } } +TEST_F(AuthenticatorImplTest, MinPINLength) { + NavigateAndCommit(GURL(kTestOrigin1)); + + device::VirtualCtap2Device::Config config; + virtual_device_factory_->SetCtap2Config(config); + + for (const bool min_pin_length_requested : {false, true}) { + PublicKeyCredentialCreationOptionsPtr options = + GetTestPublicKeyCredentialCreationOptions(); + options->min_pin_length_requested = min_pin_length_requested; + auto result = AuthenticatorMakeCredential(std::move(options)); + ASSERT_EQ(result.status, AuthenticatorStatus::SUCCESS); + + const device::AuthenticatorData auth_data = + AuthDataFromMakeCredentialResponse(result.response); + bool has_min_pin_length = false; + if (auth_data.extensions().has_value()) { + const cbor::Value::MapValue& extensions = + auth_data.extensions()->GetMap(); + const auto it = + extensions.find(cbor::Value(device::kExtensionMinPINLength)); + has_min_pin_length = it != extensions.end() && it->second.is_unsigned(); + } + ASSERT_EQ(has_min_pin_length, min_pin_length_requested); + } +} + TEST_F(AuthenticatorImplTest, GoogleLegacyAppidSupport) { struct TestCase { std::string url;
diff --git a/content/browser/webauth/webauth_browsertest.cc b/content/browser/webauth/webauth_browsertest.cc index 6f03e37..ac34b7f 100644 --- a/content/browser/webauth/webauth_browsertest.cc +++ b/content/browser/webauth/webauth_browsertest.cc
@@ -571,7 +571,8 @@ /*enforce_protection_policy=*/false, /*appid_exclude=*/absl::nullopt, /*cred_props=*/false, device::LargeBlobSupport::kNotRequested, /*is_payment_credential_creation=*/false, /*cred_blob=*/absl::nullopt, - /*google_legacy_app_id_support=*/false); + /*google_legacy_app_id_support=*/false, + /*min_pin_length_requested=*/false); return mojo_options; }
diff --git a/content/common/child_process_host_impl.h b/content/common/child_process_host_impl.h index 122e1d90..6262b8c0 100644 --- a/content/common/child_process_host_impl.h +++ b/content/common/child_process_host_impl.h
@@ -13,7 +13,6 @@ #include <vector> #include "base/memory/raw_ptr.h" -#include "base/memory/singleton.h" #include "base/process/process.h" #include "build/build_config.h" #include "content/common/child_process.mojom.h"
diff --git a/content/common/font_cache_dispatcher_win.cc b/content/common/font_cache_dispatcher_win.cc index 1deefc4..81609185 100644 --- a/content/common/font_cache_dispatcher_win.cc +++ b/content/common/font_cache_dispatcher_win.cc
@@ -12,6 +12,7 @@ #include "base/containers/contains.h" #include "base/logging.h" +#include "base/memory/singleton.h" #include "base/numerics/checked_math.h" #include "base/thread_annotations.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h"
diff --git a/content/public/browser/message_port_provider.h b/content/public/browser/message_port_provider.h index 2442b1b..ec85374 100644 --- a/content/public/browser/message_port_provider.h +++ b/content/public/browser/message_port_provider.h
@@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "base/memory/singleton.h" #include "build/build_config.h" #include "build/chromecast_buildflags.h" #include "content/common/content_export.h"
diff --git a/content/public/common/font_cache_dispatcher_win.h b/content/public/common/font_cache_dispatcher_win.h index d73fa9ec..5e5fd59 100644 --- a/content/public/common/font_cache_dispatcher_win.h +++ b/content/public/common/font_cache_dispatcher_win.h
@@ -7,7 +7,6 @@ #include <windows.h> -#include "base/memory/singleton.h" #include "content/common/content_export.h" #include "content/public/common/font_cache_win.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h"
diff --git a/content/test/data/accessibility/accname/desc-from-content-of-describedby-element-recursive-expected-blink.txt b/content/test/data/accessibility/accname/desc-from-content-of-describedby-element-recursive-expected-blink.txt new file mode 100644 index 0000000..614df4e --- /dev/null +++ b/content/test/data/accessibility/accname/desc-from-content-of-describedby-element-recursive-expected-blink.txt
@@ -0,0 +1 @@ +textField description='Description text' name='Label text' nameFrom=relatedElement descriptionFrom=relatedElement
diff --git a/content/test/data/accessibility/accname/desc-from-content-of-describedby-element-recursive.html b/content/test/data/accessibility/accname/desc-from-content-of-describedby-element-recursive.html new file mode 100644 index 0000000..f6184df --- /dev/null +++ b/content/test/data/accessibility/accname/desc-from-content-of-describedby-element-recursive.html
@@ -0,0 +1,13 @@ +<!doctype html> +<html> +<body> +<label for="test">Label text</label> +<input id="test" type="text" aria-describedby="desc2"> +<div id="desc2"> + <!-- role=status normally doesn't support name-from-contents, but when + performing name-from-contents on behalf of aria-describedby, it should + contribute its text. --> + <div role="status"> + Description text + </div> +</div>
diff --git a/content/test/data/accessibility/accname/name-text-content-of-labelledby-element-recursive-expected-blink.txt b/content/test/data/accessibility/accname/name-text-content-of-labelledby-element-recursive-expected-blink.txt new file mode 100644 index 0000000..bc974ba --- /dev/null +++ b/content/test/data/accessibility/accname/name-text-content-of-labelledby-element-recursive-expected-blink.txt
@@ -0,0 +1 @@ +textField name='Label text' nameFrom=relatedElement
diff --git a/content/test/data/accessibility/accname/name-text-content-of-labelledby-element-recursive.html b/content/test/data/accessibility/accname/name-text-content-of-labelledby-element-recursive.html new file mode 100644 index 0000000..56b020a --- /dev/null +++ b/content/test/data/accessibility/accname/name-text-content-of-labelledby-element-recursive.html
@@ -0,0 +1,12 @@ +<!doctype html> +<html> +<body> +<input id="test" type="text" aria-labelledby="label"> +<div id="label"> + <!-- role=status normally doesn't support name-from-contents, but when + performing name-from-contents on behalf of aria-labelledby, it should + contribute its text. --> + <div role="status"> + Label text + </div> +</div>
diff --git a/content/test/gpu/fuchsia_util.py b/content/test/gpu/fuchsia_util.py index 6b7c3291..a290abba 100644 --- a/content/test/gpu/fuchsia_util.py +++ b/content/test/gpu/fuchsia_util.py
@@ -53,6 +53,13 @@ with GetDeploymentTargetForArgs(runner_script_args) as target: target.Start() target.StartSystemLog(package_paths) + + # It is necessary to run GC to clear up package space on the device. + return_code = self.RunCommand(['pkgctl', 'gc']) + if return_code != 0: + raise Exception( + 'Error code {} while running `pkgctl gc`'.format(return_code)) + fuchsia_device_address, fuchsia_ssh_port = target._GetEndpoint() script_cmd.extend( ['--chromium-output-directory', runner_script_args.out_dir])
diff --git a/content/utility/speech/speech_recognition_sandbox_hook_linux.cc b/content/utility/speech/speech_recognition_sandbox_hook_linux.cc index c7440d4..7722f68 100644 --- a/content/utility/speech/speech_recognition_sandbox_hook_linux.cc +++ b/content/utility/speech/speech_recognition_sandbox_hook_linux.cc
@@ -53,6 +53,8 @@ bool SpeechRecognitionPreSandboxHook( sandbox::policy::SandboxLinux::Options options) { #if BUILDFLAG(ENABLE_SODA) + DVLOG(0) << "SODA test binary path: " + << GetSodaTestBinaryPath().value().c_str(); void* soda_test_library = dlopen(GetSodaTestBinaryPath().value().c_str(), RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); DCHECK(soda_test_library);
diff --git a/device/base/BUILD.gn b/device/base/BUILD.gn index d81d501..9d172504 100644 --- a/device/base/BUILD.gn +++ b/device/base/BUILD.gn
@@ -36,7 +36,9 @@ "device_info_query_win.h", "device_monitor_win.cc", "device_monitor_win.h", + "event_utils_winrt.h", ] + public_deps += [ "//third_party/abseil-cpp:absl" ] libs = [ "setupapi.lib" ] } }
diff --git a/device/base/event_utils_winrt.h b/device/base/event_utils_winrt.h new file mode 100644 index 0000000..ad10a132 --- /dev/null +++ b/device/base/event_utils_winrt.h
@@ -0,0 +1,72 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DEVICE_BASE_EVENT_UTILS_WINRT_H_ +#define DEVICE_BASE_EVENT_UTILS_WINRT_H_ + +#include <windows.foundation.h> +#include <wrl/client.h> +#include <wrl/event.h> + +#include <ios> +#include <utility> + +#include "base/bind.h" +#include "base/callback.h" +#include "base/location.h" +#include "base/logging.h" +#include "base/memory/scoped_refptr.h" +#include "base/task/sequenced_task_runner.h" +#include "base/threading/sequenced_task_runner_handle.h" +#include "base/win/windows_types.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace device { + +namespace internal { + +template <typename Interface, typename... Args> +using IMemberFunction = HRESULT (__stdcall Interface::*)(Args...); + +} // namespace internal + +// Convenience template function to construct an IEventHandler from a +// RepeatingCallback of a matching signature. In case of success, the +// EventRegistrationToken is returned to the caller. A return value of +// nullopt indicates a failure. Events will be posted to the same sequence +// the event handler was created on. +template <typename Interface, + typename Args, + typename SenderAbi, + typename ArgsAbi> +absl::optional<EventRegistrationToken> AddEventHandler( + Interface* interface_called, + internal::IMemberFunction<Interface, + ABI::Windows::Foundation::IEventHandler<Args*>*, + EventRegistrationToken*> function, + base::RepeatingCallback<void(SenderAbi*, ArgsAbi*)> callback) { + EventRegistrationToken token; + HRESULT hr = ((*interface_called).*function)( + Microsoft::WRL::Callback<ABI::Windows::Foundation::IEventHandler<Args*>>( + [task_runner = base::SequencedTaskRunnerHandle::Get(), + callback = std::move(callback)](SenderAbi* sender, ArgsAbi* args) { + task_runner->PostTask( + FROM_HERE, + BindOnce(callback, Microsoft::WRL::ComPtr<SenderAbi>(sender), + Microsoft::WRL::ComPtr<ArgsAbi>(args))); + return S_OK; + }) + .Get(), + &token); + if (FAILED(hr)) { + DVLOG(2) << "Adding EventHandler failed: " + << "0x" << std::hex << hr; + return absl::nullopt; + } + return token; +} + +} // namespace device + +#endif // DEVICE_BASE_EVENT_UTILS_WINRT_H_
diff --git a/device/fido/ctap_make_credential_request.cc b/device/fido/ctap_make_credential_request.cc index c5e6344f..6c52282 100644 --- a/device/fido/ctap_make_credential_request.cc +++ b/device/fido/ctap_make_credential_request.cc
@@ -159,6 +159,11 @@ return absl::nullopt; } request.cred_blob = extension.second.GetBytestring(); + } else if (extension_name == kExtensionMinPINLength) { + if (!extension.second.is_bool()) { + return absl::nullopt; + } + request.min_pin_length_requested = extension.second.GetBool(); } } } @@ -293,6 +298,10 @@ extensions.emplace(kExtensionCredBlob, *request.cred_blob); } + if (request.min_pin_length_requested) { + extensions.emplace(kExtensionMinPINLength, true); + } + if (!extensions.empty()) { cbor_map[cbor::Value(6)] = cbor::Value(std::move(extensions)); }
diff --git a/device/fido/ctap_make_credential_request.h b/device/fido/ctap_make_credential_request.h index d3292ff..b6bc96d 100644 --- a/device/fido/ctap_make_credential_request.h +++ b/device/fido/ctap_make_credential_request.h
@@ -115,6 +115,14 @@ // authenticators to consider, i.e. for the Windows API. bool cred_protect_enforce = false; + // min_pin_length_requested indicates that the minPinLength extension[1] + // should be sent to request that the authenticator report the minimum allowed + // PIN length configured. + // + // [1] + // https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-minpinlength-extension + bool min_pin_length_requested = false; + // cred_blob contains an optional credBlob extension. // https://fidoalliance.org/specs/fido-v2.1-rd-20201208/fido-client-to-authenticator-protocol-v2.1-rd-20201208.html#sctn-credBlob-extension absl::optional<std::vector<uint8_t>> cred_blob;
diff --git a/device/fido/fido_constants.cc b/device/fido/fido_constants.cc index d147702..94c10a5 100644 --- a/device/fido/fido_constants.cc +++ b/device/fido/fido_constants.cc
@@ -75,6 +75,7 @@ const char kExtensionCredProtect[] = "credProtect"; const char kExtensionLargeBlobKey[] = "largeBlobKey"; const char kExtensionCredBlob[] = "credBlob"; +const char kExtensionMinPINLength[] = "minPinLength"; const base::TimeDelta kBleDevicePairingModeWaitingInterval = base::Seconds(2);
diff --git a/device/fido/fido_constants.h b/device/fido/fido_constants.h index 24683a0..0e9357c 100644 --- a/device/fido/fido_constants.h +++ b/device/fido/fido_constants.h
@@ -451,6 +451,7 @@ COMPONENT_EXPORT(DEVICE_FIDO) extern const char kExtensionCredProtect[]; COMPONENT_EXPORT(DEVICE_FIDO) extern const char kExtensionLargeBlobKey[]; COMPONENT_EXPORT(DEVICE_FIDO) extern const char kExtensionCredBlob[]; +COMPONENT_EXPORT(DEVICE_FIDO) extern const char kExtensionMinPINLength[]; // Maximum number of seconds the browser waits for Bluetooth authenticator to // send packets that advertises that the device is in pairing mode before
diff --git a/device/fido/make_credential_request_handler.cc b/device/fido/make_credential_request_handler.cc index 0ad6325..e6d38aa 100644 --- a/device/fido/make_credential_request_handler.cc +++ b/device/fido/make_credential_request_handler.cc
@@ -304,6 +304,10 @@ if (!request.cred_blob || !it.second.is_bool()) { return false; } + } else if (ext_name == kExtensionMinPINLength) { + if (!request.min_pin_length_requested || !it.second.is_unsigned()) { + return false; + } } else { // Authenticators may not return unknown extensions. return false;
diff --git a/device/fido/virtual_ctap2_device.cc b/device/fido/virtual_ctap2_device.cc index 5f93405..35dbcc3 100644 --- a/device/fido/virtual_ctap2_device.cc +++ b/device/fido/virtual_ctap2_device.cc
@@ -1177,6 +1177,11 @@ extensions_map.emplace(kExtensionCredBlob, true); } + if (request.min_pin_length_requested) { + extensions_map.emplace(kExtensionMinPINLength, + static_cast<int>(mutable_state()->min_pin_length)); + } + if (config_.add_extra_extension) { extensions_map.emplace(cbor::Value("unsolicited"), cbor::Value(42)); }
diff --git a/device/fido/win/webauthn_api.cc b/device/fido/win/webauthn_api.cc index c720cf5d..6d13ef62 100644 --- a/device/fido/win/webauthn_api.cc +++ b/device/fido/win/webauthn_api.cc
@@ -313,6 +313,17 @@ }); } + if (request.min_pin_length_requested && + api_version >= WEBAUTHN_API_VERSION_3) { + static const BOOL kRequestMinPINLength = TRUE; + extensions.emplace_back(WEBAUTHN_EXTENSION{ + /*pwszExtensionIdentifier=*/ + WEBAUTHN_EXTENSIONS_IDENTIFIER_MIN_PIN_LENGTH, + /*cbExtension=*/sizeof(kRequestMinPINLength), + /*pvExtension=*/const_cast<BOOL*>(&kRequestMinPINLength), + }); + } + DWORD enterprise_attestation = WEBAUTHN_ENTERPRISE_ATTESTATION_NONE; switch (request.attestation_preference) { case AttestationConveyancePreference::kEnterpriseIfRPListedOnAuthenticator:
diff --git a/device/gamepad/BUILD.gn b/device/gamepad/BUILD.gn index c6a83fd..d8979fa 100644 --- a/device/gamepad/BUILD.gn +++ b/device/gamepad/BUILD.gn
@@ -86,6 +86,7 @@ "xinput_haptic_gamepad_win.cc", "xinput_haptic_gamepad_win.h", ] + deps += [ "//device/base" ] libs = [ "hid.lib" ] }
diff --git a/device/gamepad/test_support/fake_igamepad.cc b/device/gamepad/test_support/fake_igamepad.cc index fb4673ce..edc0f909 100644 --- a/device/gamepad/test_support/fake_igamepad.cc +++ b/device/gamepad/test_support/fake_igamepad.cc
@@ -11,20 +11,20 @@ FakeIGamepad::FakeIGamepad() = default; FakeIGamepad::~FakeIGamepad() = default; -HRESULT WINAPI -FakeIGamepad::get_Vibration(ABI::Windows::Gaming::Input::GamepadVibration*) { +HRESULT WINAPI FakeIGamepad::get_Vibration( + ABI::Windows::Gaming::Input::GamepadVibration* gamepad_vibration) { NOTIMPLEMENTED(); return E_NOTIMPL; } -HRESULT WINAPI -FakeIGamepad::put_Vibration(ABI::Windows::Gaming::Input::GamepadVibration) { +HRESULT WINAPI FakeIGamepad::put_Vibration( + ABI::Windows::Gaming::Input::GamepadVibration gamepad_vibration) { NOTIMPLEMENTED(); return E_NOTIMPL; } -HRESULT WINAPI -FakeIGamepad::GetCurrentReading(ABI::Windows::Gaming::Input::GamepadReading*) { +HRESULT WINAPI FakeIGamepad::GetCurrentReading( + ABI::Windows::Gaming::Input::GamepadReading* gamepad_reading) { NOTIMPLEMENTED(); return E_NOTIMPL; }
diff --git a/device/gamepad/test_support/fake_igamepad.h b/device/gamepad/test_support/fake_igamepad.h index 6b12c37..4bbc860 100644 --- a/device/gamepad/test_support/fake_igamepad.h +++ b/device/gamepad/test_support/fake_igamepad.h
@@ -21,12 +21,12 @@ FakeIGamepad& operator=(const FakeIGamepad&) = delete; // ABI::Windows::Gaming::Input::IGamepad fake implementation. - HRESULT WINAPI - get_Vibration(ABI::Windows::Gaming::Input::GamepadVibration*) override; - HRESULT WINAPI - put_Vibration(ABI::Windows::Gaming::Input::GamepadVibration) override; - HRESULT WINAPI - GetCurrentReading(ABI::Windows::Gaming::Input::GamepadReading*) override; + HRESULT WINAPI get_Vibration(ABI::Windows::Gaming::Input::GamepadVibration* + gamepad_vibration) override; + HRESULT WINAPI put_Vibration( + ABI::Windows::Gaming::Input::GamepadVibration gamepad_vibration) override; + HRESULT WINAPI GetCurrentReading( + ABI::Windows::Gaming::Input::GamepadReading* gamepad_reading) override; private: ~FakeIGamepad() final;
diff --git a/device/gamepad/test_support/fake_igamepad_statics.cc b/device/gamepad/test_support/fake_igamepad_statics.cc index 762465d..f433420 100644 --- a/device/gamepad/test_support/fake_igamepad_statics.cc +++ b/device/gamepad/test_support/fake_igamepad_statics.cc
@@ -5,6 +5,10 @@ #include "device/gamepad/test_support/fake_igamepad_statics.h" #include "base/notreached.h" +#include "base/run_loop.h" +#include "base/task/post_task.h" +#include "base/task/sequenced_task_runner.h" +#include "base/task/thread_pool.h" namespace device { @@ -58,14 +62,22 @@ HRESULT WINAPI FakeIGamepadStatics::remove_GamepadAdded(EventRegistrationToken token) { - NOTIMPLEMENTED(); - return E_NOTIMPL; + size_t items_removed = base::EraseIf( + gamepad_added_event_handler_map_, + [=](const auto& entry) { return entry.first == token.value; }); + if (items_removed == 0) + return E_FAIL; + return S_OK; } HRESULT WINAPI FakeIGamepadStatics::remove_GamepadRemoved(EventRegistrationToken token) { - NOTIMPLEMENTED(); - return E_NOTIMPL; + size_t items_removed = base::EraseIf( + gamepad_removed_event_handler_map_, + [=](const auto& entry) { return entry.first == token.value; }); + if (items_removed == 0) + return E_FAIL; + return S_OK; } HRESULT WINAPI FakeIGamepadStatics::get_Gamepads( @@ -75,22 +87,33 @@ return E_NOTIMPL; } +void FakeIGamepadStatics::SimulateGamepadEvent( + const Microsoft::WRL::ComPtr<ABI::Windows::Gaming::Input::IGamepad>& + gamepad, + GamepadEventTriggerCallback callback) { + scoped_refptr<base::SequencedTaskRunner> task_runner = + base::ThreadPool::CreateSequencedTaskRunner({}); + base::RunLoop run_loop; + task_runner->PostTask( + FROM_HERE, base::BindOnce(callback, base::Unretained(this), gamepad)); + task_runner->PostTask(FROM_HERE, run_loop.QuitClosure()); + run_loop.Run(); +} + void FakeIGamepadStatics::SimulateGamepadAdded( const Microsoft::WRL::ComPtr<ABI::Windows::Gaming::Input::IGamepad>& gamepad_to_add) { - // Iterate through |gamepad_added_event_handler_map_| invoking each - // callback with |gamepad_to_add|. - for (const auto& entry : gamepad_added_event_handler_map_) - entry.second->Invoke(this, gamepad_to_add.Get()); + SimulateGamepadEvent( + gamepad_to_add, + &FakeIGamepadStatics::TriggerGamepadAddedCallbackOnRandomThread); } void FakeIGamepadStatics::SimulateGamepadRemoved( const Microsoft::WRL::ComPtr<ABI::Windows::Gaming::Input::IGamepad>& gamepad_to_remove) { - // Iterate through |gamepad_removed_event_handler_map_| invoking each - // callback with |gamepad_to_remove|. - for (const auto& entry : gamepad_removed_event_handler_map_) - entry.second->Invoke(this, gamepad_to_remove.Get()); + SimulateGamepadEvent( + gamepad_to_remove, + &FakeIGamepadStatics::TriggerGamepadRemovedCallbackOnRandomThread); } void FakeIGamepadStatics::SetAddGamepadAddedStatus(HRESULT value) { @@ -109,4 +132,26 @@ return gamepad_removed_event_handler_map_.size(); } +void FakeIGamepadStatics::TriggerGamepadAddedCallbackOnRandomThread( + const Microsoft::WRL::ComPtr<ABI::Windows::Gaming::Input::IGamepad> + gamepad_to_add) { + for (const auto& it : gamepad_added_event_handler_map_) { + // Invokes the callback on a random thread. + it.second->Invoke( + static_cast<ABI::Windows::Gaming::Input::IGamepadStatics*>(this), + gamepad_to_add.Get()); + } +} + +void FakeIGamepadStatics::TriggerGamepadRemovedCallbackOnRandomThread( + const Microsoft::WRL::ComPtr<ABI::Windows::Gaming::Input::IGamepad> + gamepad_to_remove) { + for (auto& it : gamepad_removed_event_handler_map_) { + // Invokes the callback on a random thread. + it.second->Invoke( + static_cast<ABI::Windows::Gaming::Input::IGamepadStatics*>(this), + gamepad_to_remove.Get()); + } +} + } // namespace device
diff --git a/device/gamepad/test_support/fake_igamepad_statics.h b/device/gamepad/test_support/fake_igamepad_statics.h index 3635a6e..eb9bfaf 100644 --- a/device/gamepad/test_support/fake_igamepad_statics.h +++ b/device/gamepad/test_support/fake_igamepad_statics.h
@@ -6,6 +6,8 @@ #define DEVICE_GAMEPAD_TEST_SUPPORT_FAKE_IGAMEPAD_STATICS_H_ #include <Windows.Gaming.Input.h> +#include <inspectable.h> +#include <windows.foundation.collections.h> #include <wrl.h> #include "base/containers/flat_map.h" @@ -41,11 +43,19 @@ ABI::Windows::Gaming::Input::Gamepad*>** value) final; // Adds a fake gamepad to simulate a gamepad connection operation for test. + // Due to the multi-threaded apartment nature of IGamepadStatics COM API, the + // callback would return on a different thread. We are using a separate + // `SequencedTaskRunner` in this fake implementation to simulate this + // behavior. void SimulateGamepadAdded( const Microsoft::WRL::ComPtr<ABI::Windows::Gaming::Input::IGamepad>& gamepad_to_add); // Uses a fake gamepad to simulate a gamepad disconnection operation for test. + // Due to the multi-threaded apartment nature of IGamepadStatics COM API, the + // callback would return on a different thread. We are using a separate + // `SequencedTaskRunner` in this fake implementation to simulate this + // behavior. void SimulateGamepadRemoved( const Microsoft::WRL::ComPtr<ABI::Windows::Gaming::Input::IGamepad>& gamepad_to_remove); @@ -65,8 +75,24 @@ ABI::Windows::Gaming::Input::Gamepad*>>> EventHandlerMap; + using GamepadEventTriggerCallback = void (FakeIGamepadStatics::*)( + const Microsoft::WRL::ComPtr<ABI::Windows::Gaming::Input::IGamepad> + gamepad); + ~FakeIGamepadStatics() final; + void SimulateGamepadEvent(const Microsoft::WRL::ComPtr< + ABI::Windows::Gaming::Input::IGamepad>& gamepad, + GamepadEventTriggerCallback callback); + + void TriggerGamepadAddedCallbackOnRandomThread( + const Microsoft::WRL::ComPtr<ABI::Windows::Gaming::Input::IGamepad> + gamepad_to_add); + + void TriggerGamepadRemovedCallbackOnRandomThread( + const Microsoft::WRL::ComPtr<ABI::Windows::Gaming::Input::IGamepad> + gamepad_to_remove); + int64_t next_event_registration_token_ = 0; // Status variable to direct tests to test Windows.Gaming.Input error
diff --git a/device/gamepad/wgi_data_fetcher_win.cc b/device/gamepad/wgi_data_fetcher_win.cc index dbf62ad..792db569 100644 --- a/device/gamepad/wgi_data_fetcher_win.cc +++ b/device/gamepad/wgi_data_fetcher_win.cc
@@ -6,26 +6,33 @@ #include <wrl/event.h> +#include <string> + +#include "base/containers/cxx20_erase.h" +#include "base/sequence_checker.h" +#include "base/strings/string_util_win.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "base/win/core_winrt_util.h" #include "base/win/hstring_reference.h" -#include "base/win/scoped_hstring.h" +#include "device/base/event_utils_winrt.h" namespace device { -using GamepadPlugAndPlayHandler = ABI::Windows::Foundation::IEventHandler< - ABI::Windows::Gaming::Input::Gamepad*>; - WgiDataFetcherWin::WgiDataFetcherWin() { + DETACH_FROM_SEQUENCE(sequence_checker_); get_activation_factory_function_ = &base::win::RoGetActivationFactory; } -WgiDataFetcherWin::~WgiDataFetcherWin() = default; +WgiDataFetcherWin::~WgiDataFetcherWin() { + UnregisterEventHandlers(); +} GamepadSource WgiDataFetcherWin::source() { return Factory::static_source(); } void WgiDataFetcherWin::OnAddedToProvider() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!base::win::HStringReference::ResolveCoreWinRTStringDelayload()) { initialization_state_ = InitializationState::kCoreWinrtStringDelayLoadFailed; @@ -41,25 +48,30 @@ return; } - EventRegistrationToken added_event_token; - hr = gamepad_statics_->add_GamepadAdded( - Microsoft::WRL::Callback<GamepadPlugAndPlayHandler>( - this, &WgiDataFetcherWin::OnGamepadAdded) - .Get(), - &added_event_token); - if (FAILED(hr)) { + // Create a Windows::Foundation::IEventHandler that runs a + // base::RepeatingCallback() on the gamepad polling thread when a gamepad + // is added or removed. This callback stores the current sequence task runner + // and weak pointer, so those two objects would remain active until the + // callback returns. + added_event_token_ = AddEventHandler( + gamepad_statics_.Get(), + &ABI::Windows::Gaming::Input::IGamepadStatics::add_GamepadAdded, + base::BindRepeating(&WgiDataFetcherWin::OnGamepadAdded, + weak_factory_.GetWeakPtr())); + if (!added_event_token_) { initialization_state_ = InitializationState::kAddGamepadAddedFailed; + UnregisterEventHandlers(); return; } - EventRegistrationToken removed_event_token; - hr = gamepad_statics_->add_GamepadRemoved( - Microsoft::WRL::Callback<GamepadPlugAndPlayHandler>( - this, &WgiDataFetcherWin::OnGamepadRemoved) - .Get(), - &removed_event_token); - if (FAILED(hr)) { + removed_event_token_ = AddEventHandler( + gamepad_statics_.Get(), + &ABI::Windows::Gaming::Input::IGamepadStatics::add_GamepadRemoved, + base::BindRepeating(&WgiDataFetcherWin::OnGamepadRemoved, + weak_factory_.GetWeakPtr())); + if (!removed_event_token_) { initialization_state_ = InitializationState::kAddGamepadRemovedFailed; + UnregisterEventHandlers(); return; } @@ -71,16 +83,24 @@ get_activation_factory_function_ = value; } -HRESULT WgiDataFetcherWin::OnGamepadAdded( +void WgiDataFetcherWin::OnGamepadAdded( IInspectable* /* sender */, ABI::Windows::Gaming::Input::IGamepad* gamepad) { + // While base::win::AddEventHandler stores the sequence_task_runner in the + // callback function object, it post the task back to the same sequence - the + // gamepad polling thread when the callback is returned on a different thread + // from the IGamepadStatics COM API. Thus `OnGamepadAdded` is also running on + // gamepad polling thread, it is the only thread that is able to access the + // `gamepads_` object, making it thread-safe. + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + if (initialization_state_ != InitializationState::kInitialized) - return S_OK; + return; int source_id = next_source_id_++; PadState* state = GetPadState(source_id); if (!state) - return S_OK; + return; state->is_initialized = true; Gamepad& pad = state->data; pad.connected = true; @@ -88,29 +108,24 @@ pad.vibration_actuator.not_null = false; pad.mapping = GamepadMapping::kStandard; gamepads_.push_back({source_id, gamepad}); - return S_OK; } -HRESULT WgiDataFetcherWin::OnGamepadRemoved( +void WgiDataFetcherWin::OnGamepadRemoved( IInspectable* /* sender */, ABI::Windows::Gaming::Input::IGamepad* gamepad) { - if (initialization_state_ != InitializationState::kInitialized) - return S_OK; + // While ::device::AddEventHandler stores the sequence_task_runner in the + // callback function object, it post the task back to the same sequence - the + // gamepad polling thread when the callback is returned on a different thread + // from the IGamepadStatics COM API. Thus `OnGamepadRemoved` is also running + // on gamepad polling thread, it is the only thread that is able to access the + // `gamepads_` object, making it thread-safe. + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK_EQ(initialization_state_, InitializationState::kInitialized); - auto gamepad_it = - std::find_if(gamepads_.begin(), gamepads_.end(), - [=](const WindowsGamingInputControllerMapping& mapping) { - return mapping.gamepad.Get() == gamepad; - }); - - if (gamepad_it != gamepads_.end()) { - PadState* state = GetPadState(gamepad_it->source_id); - if (!state) - return S_OK; - state->source = GAMEPAD_SOURCE_NONE; - gamepads_.erase(gamepad_it); - } - return S_OK; + base::EraseIf(gamepads_, + [=](const WindowsGamingInputControllerMapping& mapping) { + return mapping.gamepad.Get() == gamepad; + }); } void WgiDataFetcherWin::GetGamepadData(bool devices_changed_hint) { @@ -128,6 +143,26 @@ return initialization_state_; } +void WgiDataFetcherWin::UnregisterEventHandlers() { + if (added_event_token_) { + HRESULT hr = + gamepad_statics_->remove_GamepadAdded(added_event_token_.value()); + if (FAILED(hr)) { + DLOG(ERROR) << "Removing GamepadAdded Handler failed: " + << logging::SystemErrorCodeToString(hr); + } + } + + if (removed_event_token_) { + HRESULT hr = + gamepad_statics_->remove_GamepadRemoved(removed_event_token_.value()); + if (FAILED(hr)) { + DLOG(ERROR) << "Removing GamepadRemoved Handler failed: " + << logging::SystemErrorCodeToString(hr); + } + } +} + WgiDataFetcherWin::WindowsGamingInputControllerMapping:: WindowsGamingInputControllerMapping( int input_source_id, @@ -136,10 +171,26 @@ : source_id(input_source_id), gamepad(input_gamepad) {} WgiDataFetcherWin::WindowsGamingInputControllerMapping:: - ~WindowsGamingInputControllerMapping() = default; + WindowsGamingInputControllerMapping( + const WgiDataFetcherWin::WindowsGamingInputControllerMapping& other) = + default; + +WgiDataFetcherWin::WindowsGamingInputControllerMapping& +WgiDataFetcherWin::WindowsGamingInputControllerMapping:: + WindowsGamingInputControllerMapping::operator=( + const WgiDataFetcherWin::WindowsGamingInputControllerMapping& other) = + default; WgiDataFetcherWin::WindowsGamingInputControllerMapping:: WindowsGamingInputControllerMapping( - const WindowsGamingInputControllerMapping& other) = default; + WgiDataFetcherWin::WindowsGamingInputControllerMapping&& other) = + default; + +WgiDataFetcherWin::WindowsGamingInputControllerMapping& +WgiDataFetcherWin::WindowsGamingInputControllerMapping::operator=( + WgiDataFetcherWin::WindowsGamingInputControllerMapping&&) = default; + +WgiDataFetcherWin::WindowsGamingInputControllerMapping:: + ~WindowsGamingInputControllerMapping() = default; } // namespace device
diff --git a/device/gamepad/wgi_data_fetcher_win.h b/device/gamepad/wgi_data_fetcher_win.h index f37e9c43..ea0ff64 100644 --- a/device/gamepad/wgi_data_fetcher_win.h +++ b/device/gamepad/wgi_data_fetcher_win.h
@@ -10,6 +10,9 @@ #include <Windows.Gaming.Input.h> #include <wrl/event.h> +#include "base/sequence_checker.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + namespace device { class DEVICE_GAMEPAD_EXPORT WgiDataFetcherWin final @@ -21,8 +24,19 @@ int input_source_id, Microsoft::WRL::ComPtr<ABI::Windows::Gaming::Input::IGamepad> input_gamepad); + WindowsGamingInputControllerMapping( const WindowsGamingInputControllerMapping& other); + + WindowsGamingInputControllerMapping( + WindowsGamingInputControllerMapping&& other); + + WindowsGamingInputControllerMapping& operator=( + const WindowsGamingInputControllerMapping& other); + + WindowsGamingInputControllerMapping& operator=( + WindowsGamingInputControllerMapping&&); + ~WindowsGamingInputControllerMapping(); int source_id; @@ -68,13 +82,16 @@ private: // Set the state of the new connected gamepad to initialized, update // gamepad state connection status, and add a new controller mapping for - // |gamepad| to |gamepads_|. - HRESULT OnGamepadAdded(IInspectable* /* sender */, - ABI::Windows::Gaming::Input::IGamepad* gamepad); + // `gamepad` to `gamepads_` on gamepad polling thread. + void OnGamepadAdded(IInspectable* /* sender */, + ABI::Windows::Gaming::Input::IGamepad* gamepad); - // Remove the gamepad from the connected WGI gamepad list. - HRESULT OnGamepadRemoved(IInspectable* /* sender */, - ABI::Windows::Gaming::Input::IGamepad* gamepad); + // Remove the corresponding controller mapping of `gamepad` in `gamepads_` + // on gamepad polling thread. + void OnGamepadRemoved(IInspectable* /* sender */, + ABI::Windows::Gaming::Input::IGamepad* gamepad); + + void UnregisterEventHandlers(); int next_source_id_ = 0; InitializationState initialization_state_ = @@ -86,6 +103,13 @@ gamepad_statics_; GetActivationFactoryFunction get_activation_factory_function_; + + absl::optional<EventRegistrationToken> added_event_token_; + absl::optional<EventRegistrationToken> removed_event_token_; + + SEQUENCE_CHECKER(sequence_checker_); + + base::WeakPtrFactory<WgiDataFetcherWin> weak_factory_{this}; }; } // namespace device
diff --git a/device/gamepad/wgi_data_fetcher_win_unittest.cc b/device/gamepad/wgi_data_fetcher_win_unittest.cc index ed06c31..0a2199a 100644 --- a/device/gamepad/wgi_data_fetcher_win_unittest.cc +++ b/device/gamepad/wgi_data_fetcher_win_unittest.cc
@@ -6,9 +6,12 @@ #include "base/memory/raw_ptr.h" #include "base/run_loop.h" +#include "base/task/sequenced_task_runner.h" +#include "base/task/thread_pool/thread_pool_instance.h" #include "base/threading/thread.h" #include "base/win/scoped_hstring.h" #include "base/win/windows_version.h" +#include "device/gamepad/gamepad_pad_state_provider.h" #include "device/gamepad/gamepad_provider.h" #include "device/gamepad/test_support/fake_igamepad.h" #include "device/gamepad/test_support/fake_igamepad_statics.h" @@ -44,12 +47,21 @@ /*connection_change_client=*/nullptr, std::move(fetcher), std::move(polling_thread)); - RunUntilIdle(); + FlushPollingThread(); } - void RunUntilIdle() { - base::RunLoop().RunUntilIdle(); - polling_thread_->FlushForTesting(); + void FlushPollingThread() { polling_thread_->FlushForTesting(); } + + void CheckGamepadAdded(PadState* pad_state) { + // Check if the recently added gamepad state has been initialized correctly. + EXPECT_TRUE(pad_state->is_initialized); + const Gamepad& gamepad = pad_state->data; + EXPECT_TRUE(gamepad.connected); + EXPECT_FALSE(gamepad.vibration_actuator.not_null); + } + + void CheckGamepadRemoved() { + EXPECT_TRUE(fetcher().GetGamepadsForTesting().empty()); } WgiDataFetcherWin& fetcher() const { return *fetcher_; } @@ -75,24 +87,31 @@ EXPECT_EQ(fake_gamepad_statics->GetGamepadAddedEventHandlerCount(), 1u); EXPECT_EQ(fake_gamepad_statics->GetGamepadRemovedEventHandlerCount(), 1u); - // Add a simulated WGI device. + // Simulate the gamepad adding behavior by passing an IGamepad, and make + // the gamepad-adding callback return on a different thread, demonstrated the + // multi-threaded apartments setting of the GamepadStatics COM API. + // Corresponding threading simulation is in FakeIGamepadStatics class. fake_gamepad_statics->SimulateGamepadAdded(fake_gamepad); - // Check size of connected gamepad list and ensure gamepad state - // is initialized correctly. - EXPECT_EQ(fetcher().GetGamepadsForTesting().size(), 1u); - PadState* state = fetcher().GetPadState( - fetcher().GetGamepadsForTesting().front().source_id); - EXPECT_TRUE(state->is_initialized); - Gamepad& pad = state->data; - EXPECT_TRUE(pad.connected); - EXPECT_FALSE(pad.vibration_actuator.not_null); + // Wait for the gampad polling thread to handle the gamepad added event. + FlushPollingThread(); - // Remove the device. + // Assert that the gamepad has been added to the DataFetcher. + const std::vector<WgiDataFetcherWin::WindowsGamingInputControllerMapping>& + gamepads = fetcher().GetGamepadsForTesting(); + ASSERT_EQ(gamepads.size(), 1u); + CheckGamepadAdded(fetcher().GetPadState(gamepads.front().source_id)); + + // Simulate the gamepad removing behavior, and make the gamepad-removing + // callback return on a different thread, demonstrated the multi-threaded + // apartments setting of the GamepadStatics COM API. Corresponding threading + // simulation is in FakeIGamepadStatics class. fake_gamepad_statics->SimulateGamepadRemoved(fake_gamepad); - // Check that the device was removed. - EXPECT_TRUE(fetcher().GetGamepadsForTesting().empty()); + // Wait for the gampad polling thread to handle the gamepad removed event. + FlushPollingThread(); + + CheckGamepadRemoved(); } TEST_F(WgiDataFetcherWinTest, VerifyGamepadAddedErrorHandling) {
diff --git a/docs/linux/build_instructions.md b/docs/linux/build_instructions.md index 5f8f75b..ef4c354 100644 --- a/docs/linux/build_instructions.md +++ b/docs/linux/build_instructions.md
@@ -161,11 +161,12 @@ line-by-line debugging. Setting `symbol_level=0` will include no debug symbols at all. Either will speed up the build compared to full symbols. -#### Disable debug symbols for Blink +#### Disable debug symbols for Blink and v8 Due to its extensive use of templates, the Blink code produces about half of our debug symbols. If you don't ever need to debug Blink, you can set -the GN arg `blink_symbol_level=0`. +the GN arg `blink_symbol_level=0`. Similarly, if you don't need to debug v8 you +can improve build speeds by setting the GN arg `v8_symbol_level=0`. #### Use Icecc
diff --git a/docs/profiling.md b/docs/profiling.md index 4f9b149..02a8efe7 100644 --- a/docs/profiling.md +++ b/docs/profiling.md
@@ -272,8 +272,11 @@ # Most profiling techniques on macOS will work with minimal symbols for local builds. # You should try and use minimal symbols when starting out because most tools will take # an incredibly long time to process the symbols and in some cases will freeze the application - # while doing so. + # while doing so. symbol_level sets the level for all parts of Chromium. The + # blink and v8 settings allow overriding this to set higher or lower levels + # for those components. blink_symbol_level = 0 + v8_symbol_level = 0 symbol_level = 0 ## Viewing traces.
diff --git a/docs/windows_build_instructions.md b/docs/windows_build_instructions.md index 4b9f530..9bf6883 100644 --- a/docs/windows_build_instructions.md +++ b/docs/windows_build_instructions.md
@@ -216,6 +216,8 @@ don't' set enable_nacl = false then build times may get worse. * `blink_symbol_level = 0` - turn off source-level debugging for blink to reduce build times, appropriate if you don't plan to debug blink. +* `v8_symbol_level = 0` - turn off source-level debugging for v8 to reduce +build times, appropriate if you don't plan to debug v8. In order to speed up linking you can set `symbol_level = 1` or `symbol_level = 0` - these options reduce the work the compiler and linker have
diff --git a/extensions/browser/extension_message_filter.cc b/extensions/browser/extension_message_filter.cc index 8cb026958..c061d03 100644 --- a/extensions/browser/extension_message_filter.cc +++ b/extensions/browser/extension_message_filter.cc
@@ -111,25 +111,23 @@ ContentScriptTracker::DidProcessRunContentScriptFromExtension( process, extension_id); if (!is_content_script_expected) { - // TODO(https://crbug.com/1212918): Re-enable the enforcement (i.e. - // replace the UmaHistogramSparse call with a call to - // ReceivedBadMessage and returning false) after investigating and - // fixing the root cause of incorrect behavior reports coming from the - // end users. + // TODO(https://crbug.com/1212918): Remove some of the more excessive + // tracing once there are no more bad message reports to investigate. + // (Remove here + in ContentScriptTracker.) TRACE_EVENT_INSTANT("extensions", "IsValidMessagingSource: kTab: bad message", ChromeTrackEvent::kRenderProcessHost, process, ChromeTrackEvent::kChromeExtensionId, ExtensionIdForTracing(extension_id)); - base::UmaHistogramSparse( - "Stability.BadMessageTerminated.Extensions", + bad_message::ReceivedBadMessage( + &process, bad_message::EMF_INVALID_EXTENSION_ID_FOR_CONTENT_SCRIPT); - } else { - TRACE_EVENT_INSTANT("extensions", "IsValidMessagingSource: kTab: ok", - ChromeTrackEvent::kRenderProcessHost, process, - ChromeTrackEvent::kChromeExtensionId, - ExtensionIdForTracing(extension_id)); + return false; } + TRACE_EVENT_INSTANT("extensions", "IsValidMessagingSource: kTab: ok", + ChromeTrackEvent::kRenderProcessHost, process, + ChromeTrackEvent::kChromeExtensionId, + ExtensionIdForTracing(extension_id)); } return true; }
diff --git a/infra/config/generated/builders/ci/Dawn Linux x64 Builder/properties.textpb b/infra/config/generated/builders/ci/Dawn Linux x64 Builder/properties.textpb index 9de08acc..7073447 100644 --- a/infra/config/generated/builders/ci/Dawn Linux x64 Builder/properties.textpb +++ b/infra/config/generated/builders/ci/Dawn Linux x64 Builder/properties.textpb
@@ -1,9 +1,8 @@ { - "$build/goma": { - "enable_ats": true, - "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": [],
diff --git a/infra/config/generated/builders/ci/Dawn Linux x64 DEPS Builder/properties.textpb b/infra/config/generated/builders/ci/Dawn Linux x64 DEPS Builder/properties.textpb index 9de08acc..7073447 100644 --- a/infra/config/generated/builders/ci/Dawn Linux x64 DEPS Builder/properties.textpb +++ b/infra/config/generated/builders/ci/Dawn Linux x64 DEPS Builder/properties.textpb
@@ -1,9 +1,8 @@ { - "$build/goma": { - "enable_ats": true, - "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": [],
diff --git a/infra/config/subprojects/chromium/ci.star b/infra/config/subprojects/chromium/ci.star index 3ba0d63..e773e02 100644 --- a/infra/config/subprojects/chromium/ci.star +++ b/infra/config/subprojects/chromium/ci.star
@@ -2790,6 +2790,9 @@ category = "ToT|Linux|Builder", short_name = "x64", ), + goma_backend = None, + reclient_jobs = rbe_jobs.DEFAULT, + reclient_instance = rbe_instance.DEFAULT, ) ci.dawn_linux_builder( @@ -2801,6 +2804,9 @@ ), cq_mirrors_console_view = "mirrors", main_console_view = main_console_if_on_branch(), + goma_backend = None, + reclient_jobs = rbe_jobs.DEFAULT, + reclient_instance = rbe_instance.DEFAULT, ) ci.dawn_thin_tester(
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm index aba23bf..1aa9ba26 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
@@ -166,7 +166,7 @@ self.collectionView.backgroundColor = ntp_home::kNTPBackgroundColor(); self.styler.cellStyle = MDCCollectionViewCellStyleCard; self.styler.cardBorderRadius = kCardBorderRadius; - self.styler.separatorColor = [UIColor colorNamed:kSeparatorColor]; + self.styler.separatorColor = [UIColor clearColor]; self.collectionView.translatesAutoresizingMaskIntoConstraints = NO; ApplyVisualConstraints(@[ @"V:|[collection]|", @"H:|[collection]|" ],
diff --git a/ios/chrome/browser/ui/passwords/password_breach_mediator.mm b/ios/chrome/browser/ui/passwords/password_breach_mediator.mm index 4244da4..203af909 100644 --- a/ios/chrome/browser/ui/passwords/password_breach_mediator.mm +++ b/ios/chrome/browser/ui/passwords/password_breach_mediator.mm
@@ -85,6 +85,10 @@ [self.presenter startPasswordCheck]; } +- (void)confirmationAlertSecondaryAction { + [self confirmationAlertDismissAction]; +} + - (void)confirmationAlertLearnMoreAction { [self.presenter presentLearnMore]; }
diff --git a/ios/chrome/browser/ui/passwords/password_breach_view_controller.mm b/ios/chrome/browser/ui/passwords/password_breach_view_controller.mm index 5090b739..98b3257 100644 --- a/ios/chrome/browser/ui/passwords/password_breach_view_controller.mm +++ b/ios/chrome/browser/ui/passwords/password_breach_view_controller.mm
@@ -4,7 +4,9 @@ #import "ios/chrome/browser/ui/passwords/password_breach_view_controller.h" +#include "components/strings/grit/components_strings.h" #import "ios/chrome/browser/ui/passwords/password_constants.h" +#include "ios/chrome/browser/ui/ui_feature_flags.h" #import "ios/chrome/common/ui/confirmation_alert/confirmation_alert_action_handler.h" #include "ios/chrome/grit/ios_strings.h" #include "ui/base/l10n/l10n_util.h" @@ -13,16 +15,48 @@ #error "This file requires ARC support." #endif +namespace { + +// Picture width of the branding. +constexpr CGFloat kLogoWidth = 180; + +} // namespace + @implementation PasswordBreachViewController #pragma mark - Public - (void)loadView { - self.image = [UIImage imageNamed:@"password_breach_illustration"]; self.helpButtonAvailable = YES; self.helpButtonAccessibilityLabel = l10n_util::GetNSString(IDS_IOS_HELP_ACCESSIBILITY_LABEL); + if (base::FeatureList::IsEnabled(kIOSEnablePasswordManagerBrandingUpdate)) { + self.image = [UIImage imageNamed:@"password_breach_illustration"]; + self.secondaryActionString = l10n_util::GetNSString(IDS_NOT_NOW); + self.showDismissBarButton = NO; + self.pinSpecificContentAboveButton = YES; + + UIImageView* imageView = [[UIImageView alloc] + initWithImage:[UIImage imageNamed:@"passwords_logo"]]; + imageView.contentMode = UIViewContentModeScaleAspectFit; + imageView.translatesAutoresizingMaskIntoConstraints = NO; + [self.specificContentView addSubview:imageView]; + + [NSLayoutConstraint activateConstraints:@[ + [imageView.topAnchor + constraintGreaterThanOrEqualToAnchor:self.specificContentView + .topAnchor], + [imageView.centerXAnchor + constraintEqualToAnchor:self.specificContentView.centerXAnchor], + [imageView.widthAnchor constraintLessThanOrEqualToConstant:kLogoWidth], + [imageView.bottomAnchor + constraintEqualToAnchor:self.specificContentView.bottomAnchor], + ]]; + } else { + self.image = [UIImage imageNamed:@"legacy_password_breach_illustration"]; + } + [super loadView]; }
diff --git a/ios/chrome/browser/ui/passwords/password_protection_view_controller.mm b/ios/chrome/browser/ui/passwords/password_protection_view_controller.mm index fa5ede5..ca40892 100644 --- a/ios/chrome/browser/ui/passwords/password_protection_view_controller.mm +++ b/ios/chrome/browser/ui/passwords/password_protection_view_controller.mm
@@ -17,7 +17,7 @@ #pragma mark - Public - (void)viewDidLoad { - self.image = [UIImage imageNamed:@"password_breach_illustration"]; + self.image = [UIImage imageNamed:@"legacy_password_breach_illustration"]; self.helpButtonAvailable = NO; self.titleString = l10n_util::GetNSString( IDS_PAGE_INFO_CHANGE_PASSWORD_SAVED_PASSWORD_SUMMARY);
diff --git a/ios/chrome/browser/ui/passwords/resources/BUILD.gn b/ios/chrome/browser/ui/passwords/resources/BUILD.gn index 9788246..b2cc5ec1 100644 --- a/ios/chrome/browser/ui/passwords/resources/BUILD.gn +++ b/ios/chrome/browser/ui/passwords/resources/BUILD.gn
@@ -6,13 +6,35 @@ import("//build/config/ios/rules.gni") group("resources") { - deps = [ ":password_breach_illustration" ] + deps = [ + ":legacy_password_breach_illustration", + ":password_breach_illustration", + ":passwords_logo", + ] } imageset("password_breach_illustration") { sources = [ "password_breach_illustration.imageset/Contents.json", - "password_breach_illustration.imageset/illustration_dark.png", - "password_breach_illustration.imageset/illustration_light.png", + "password_breach_illustration.imageset/password_check_alert@2x.png", + "password_breach_illustration.imageset/password_check_alert@3x.png", + "password_breach_illustration.imageset/password_check_alert_dark@2x.png", + "password_breach_illustration.imageset/password_check_alert_dark@3x.png", + ] +} + +imageset("passwords_logo") { + sources = [ + "passwords_logo.imageset/Contents.json", + "passwords_logo.imageset/passwords_logo@2x.png", + "passwords_logo.imageset/passwords_logo@3x.png", + ] +} + +imageset("legacy_password_breach_illustration") { + sources = [ + "legacy_password_breach_illustration.imageset/Contents.json", + "legacy_password_breach_illustration.imageset/illustration_dark.png", + "legacy_password_breach_illustration.imageset/illustration_light.png", ] }
diff --git a/ios/chrome/browser/ui/passwords/resources/legacy_password_breach_illustration.imageset/Contents.json b/ios/chrome/browser/ui/passwords/resources/legacy_password_breach_illustration.imageset/Contents.json new file mode 100644 index 0000000..d7c99272 --- /dev/null +++ b/ios/chrome/browser/ui/passwords/resources/legacy_password_breach_illustration.imageset/Contents.json
@@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "illustration_light.png" + }, + { + "idiom" : "universal", + "filename" : "illustration_dark.png", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ] + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
diff --git a/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/illustration_dark.png b/ios/chrome/browser/ui/passwords/resources/legacy_password_breach_illustration.imageset/illustration_dark.png similarity index 100% rename from ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/illustration_dark.png rename to ios/chrome/browser/ui/passwords/resources/legacy_password_breach_illustration.imageset/illustration_dark.png Binary files differ
diff --git a/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/illustration_light.png b/ios/chrome/browser/ui/passwords/resources/legacy_password_breach_illustration.imageset/illustration_light.png similarity index 100% rename from ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/illustration_light.png rename to ios/chrome/browser/ui/passwords/resources/legacy_password_breach_illustration.imageset/illustration_light.png Binary files differ
diff --git a/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/Contents.json b/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/Contents.json index e5b1b4d6..fa0a227 100644 --- a/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/Contents.json +++ b/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/Contents.json
@@ -2,11 +2,29 @@ "images" : [ { "idiom" : "universal", - "filename" : "illustration_light.png" + "filename" : "password_check_alert@2x.png", + "scale" : "2x" }, { "idiom" : "universal", - "filename" : "illustration_dark.png", + "filename" : "password_check_alert_dark@2x.png", + "scale" : "2x", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ] + }, + { + "idiom" : "universal", + "filename" : "password_check_alert@3x.png", + "scale" : "3x" + }, + { + "idiom" : "universal", + "filename" : "password_check_alert_dark@3x.png", + "scale" : "3x", "appearances" : [ { "appearance" : "luminosity", @@ -19,4 +37,4 @@ "version" : 1, "author" : "xcode" } -} \ No newline at end of file +}
diff --git a/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/password_check_alert@2x.png b/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/password_check_alert@2x.png new file mode 100644 index 0000000..e5b93e94 --- /dev/null +++ b/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/password_check_alert@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/password_check_alert@3x.png b/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/password_check_alert@3x.png new file mode 100644 index 0000000..95a090c1 --- /dev/null +++ b/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/password_check_alert@3x.png Binary files differ
diff --git a/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/password_check_alert_dark@2x.png b/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/password_check_alert_dark@2x.png new file mode 100644 index 0000000..d11d1b8b --- /dev/null +++ b/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/password_check_alert_dark@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/password_check_alert_dark@3x.png b/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/password_check_alert_dark@3x.png new file mode 100644 index 0000000..546b5bf --- /dev/null +++ b/ios/chrome/browser/ui/passwords/resources/password_breach_illustration.imageset/password_check_alert_dark@3x.png Binary files differ
diff --git a/ios/chrome/browser/ui/passwords/resources/passwords_logo.imageset/Contents.json b/ios/chrome/browser/ui/passwords/resources/passwords_logo.imageset/Contents.json new file mode 100644 index 0000000..d459457 --- /dev/null +++ b/ios/chrome/browser/ui/passwords/resources/passwords_logo.imageset/Contents.json
@@ -0,0 +1,18 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "passwords_logo@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "passwords_logo@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
diff --git a/ios/chrome/browser/ui/passwords/resources/passwords_logo.imageset/passwords_logo@2x.png b/ios/chrome/browser/ui/passwords/resources/passwords_logo.imageset/passwords_logo@2x.png new file mode 100644 index 0000000..9353544 --- /dev/null +++ b/ios/chrome/browser/ui/passwords/resources/passwords_logo.imageset/passwords_logo@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/passwords/resources/passwords_logo.imageset/passwords_logo@3x.png b/ios/chrome/browser/ui/passwords/resources/passwords_logo.imageset/passwords_logo@3x.png new file mode 100644 index 0000000..7839ced --- /dev/null +++ b/ios/chrome/browser/ui/passwords/resources/passwords_logo.imageset/passwords_logo@3x.png Binary files differ
diff --git a/ios/chrome/browser/ui/settings/block_popups_table_view_controller.mm b/ios/chrome/browser/ui/settings/block_popups_table_view_controller.mm index c8e94120..1c79e40 100644 --- a/ios/chrome/browser/ui/settings/block_popups_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/block_popups_table_view_controller.mm
@@ -386,19 +386,21 @@ [model setHeader:header forSectionWithIdentifier:SectionIdentifierExceptions]; // Populate the exception items set by the user. - for (size_t i = 0; i < _exceptions.GetList().size(); ++i) { + for (const base::Value& exception : _exceptions.GetList()) { std::string allowed_url; - _exceptions.GetString(i, &allowed_url); + if (exception.is_string()) + allowed_url = exception.GetString(); TableViewDetailTextItem* item = [[TableViewDetailTextItem alloc] initWithType:ItemTypeException]; item.text = base::SysUTF8ToNSString(allowed_url); [model addItem:item toSectionWithIdentifier:SectionIdentifierExceptions]; } - // Populate the exception items set by the policy. - for (size_t l = 0; l < _allowPopupsByPolicy.GetList().size(); ++l) { + // Populate the allowed popup items set by the policy. + for (const base::Value& l : _allowPopupsByPolicy.GetList()) { std::string allowed_url_by_policy; - _allowPopupsByPolicy.GetString(l, &allowed_url_by_policy); + if (l.is_string()) + allowed_url_by_policy = l.GetString(); TableViewDetailTextItem* item = [[TableViewDetailTextItem alloc] initWithType:ItemTypeExceptionByPolicy]; item.text = base::SysUTF8ToNSString(allowed_url_by_policy);
diff --git a/ios/chrome/browser/ui/webui/flags_ui.cc b/ios/chrome/browser/ui/webui/flags_ui.cc index ee3d8bd8..e0b330a 100644 --- a/ios/chrome/browser/ui/webui/flags_ui.cc +++ b/ios/chrome/browser/ui/webui/flags_ui.cc
@@ -148,19 +148,19 @@ void FlagsDOMHandler::HandleEnableExperimentalFeatureMessage( const base::ListValue* args) { + base::Value::ConstListView args_list = args->GetList(); DCHECK(flags_storage_); - DCHECK_EQ(2u, args->GetList().size()); - if (args->GetList().size() != 2) + DCHECK_EQ(2u, args_list.size()); + if (args_list.size() != 2) return; - std::string entry_internal_name; - std::string enable_str; - if (!args->GetString(0, &entry_internal_name) || - !args->GetString(1, &enable_str)) + const std::string* entry_internal_name = args_list[0].GetIfString(); + const std::string* enable_str = args_list[1].GetIfString(); + if (!entry_internal_name || !enable_str) return; - SetFeatureEntryEnabled(flags_storage_.get(), entry_internal_name, - enable_str == "true"); + SetFeatureEntryEnabled(flags_storage_.get(), *entry_internal_name, + *enable_str == "true"); flags_storage_->CommitPendingWrites(); }
diff --git a/ios/chrome/browser/ui/webui/signin_internals_ui_ios.cc b/ios/chrome/browser/ui/webui/signin_internals_ui_ios.cc index 57d05b6..e86c366 100644 --- a/ios/chrome/browser/ui/webui/signin_internals_ui_ios.cc +++ b/ios/chrome/browser/ui/webui/signin_internals_ui_ios.cc
@@ -67,8 +67,9 @@ void SignInInternalsHandlerIOS::HandleGetSignInInfo( const base::ListValue* args) { - std::string callback_id; - CHECK(args->GetString(0, &callback_id)); + base::Value::ConstListView args_list = args->GetList(); + CHECK_GE(args_list.size(), 1u); + std::string callback_id = args_list[0].GetString(); // CHECKs if non-string. base::Value callback(callback_id); base::Value success(true);
diff --git a/ios/chrome/browser/ui/webui/ukm_internals_ui.cc b/ios/chrome/browser/ui/webui/ukm_internals_ui.cc index 3d8a16d..35c734d 100644 --- a/ios/chrome/browser/ui/webui/ukm_internals_ui.cc +++ b/ios/chrome/browser/ui/webui/ukm_internals_ui.cc
@@ -61,11 +61,14 @@ } void UkmMessageHandler::HandleRequestUkmData(const base::ListValue* args) { + base::Value::ConstListView args_list = args->GetList(); base::Value ukm_debug_data = ukm::debug::UkmDebugDataExtractor::GetStructuredData(ukm_service_); std::string callback_id; - args->GetString(0, &callback_id); + if (!args_list.empty() && args_list[0].is_string()) + callback_id = args_list[0].GetString(); + web_ui()->ResolveJavascriptCallback(base::Value(callback_id), std::move(ukm_debug_data)); }
diff --git a/ios/chrome/browser/ui/webui/version_handler.cc b/ios/chrome/browser/ui/webui/version_handler.cc index 1515ac7..c94e91292 100644 --- a/ios/chrome/browser/ui/webui/version_handler.cc +++ b/ios/chrome/browser/ui/webui/version_handler.cc
@@ -25,9 +25,8 @@ void VersionHandler::HandleRequestVariationInfo(const base::ListValue* args) { // Respond with the variations info immediately. - std::string callback_id; CHECK_EQ(2U, args->GetList().size()); - CHECK(args->GetString(0, &callback_id)); + std::string callback_id = args->GetList()[0].GetString(); base::Value response(base::Value::Type::DICTIONARY); response.SetKey(version_ui::kKeyVariationsList,
diff --git a/ios/chrome/common/ui/confirmation_alert/confirmation_alert_view_controller.h b/ios/chrome/common/ui/confirmation_alert/confirmation_alert_view_controller.h index 6809944..ff83e6f 100644 --- a/ios/chrome/common/ui/confirmation_alert/confirmation_alert_view_controller.h +++ b/ios/chrome/common/ui/confirmation_alert/confirmation_alert_view_controller.h
@@ -86,6 +86,15 @@ // The action handler for interactions in this View Controller. @property(nonatomic, weak) id<ConfirmationAlertActionHandler> actionHandler; +// The container view for the screen-specific content. Derived view controllers +// should add their UI elements to it, before the VC is loaded. +@property(nonatomic, strong, readonly) UIView* specificContentView; + +// If NO (default) the scroll view is centered. If YES, the scroll view is no +// longer centered and UI element in |specificContentView| can be constrained to +// be to just above the buttons. Must be set before the VC is loaded. +@property(nonatomic) BOOL pinSpecificContentAboveButton; + @end #endif // IOS_CHROME_COMMON_UI_CONFIRMATION_ALERT_CONFIRMATION_ALERT_VIEW_CONTROLLER_H_
diff --git a/ios/chrome/common/ui/confirmation_alert/confirmation_alert_view_controller.mm b/ios/chrome/common/ui/confirmation_alert/confirmation_alert_view_controller.mm index f4e752c2..c04b52e 100644 --- a/ios/chrome/common/ui/confirmation_alert/confirmation_alert_view_controller.mm +++ b/ios/chrome/common/ui/confirmation_alert/confirmation_alert_view_controller.mm
@@ -69,6 +69,8 @@ _customSpacingAfterImage = kStackViewSpacingAfterIllustration; _showDismissBarButton = YES; _dismissBarButtonSystemItem = UIBarButtonSystemItemDone; + _specificContentView = [[UIView alloc] init]; + _specificContentView.translatesAutoresizingMaskIntoConstraints = NO; } return self; } @@ -93,6 +95,7 @@ UIScrollView* scrollView = [self createScrollView]; [scrollView addSubview:stackView]; + [scrollView addSubview:self.specificContentView]; [self.view addSubview:scrollView]; self.view.preservesSuperviewLayoutMargins = YES; @@ -110,8 +113,16 @@ // horizontal scroll. [NSLayoutConstraint activateConstraints:@[ [stackView.topAnchor constraintEqualToAnchor:scrollView.topAnchor], - [stackView.bottomAnchor constraintEqualToAnchor:scrollView.bottomAnchor - constant:-kScrollViewBottomInsets] + [stackView.bottomAnchor + constraintEqualToAnchor:self.specificContentView.topAnchor + constant:-kScrollViewBottomInsets], + + [self.specificContentView.bottomAnchor + constraintEqualToAnchor:scrollView.bottomAnchor], + [self.specificContentView.centerXAnchor + constraintEqualToAnchor:self.view.centerXAnchor], + [self.specificContentView.widthAnchor + constraintLessThanOrEqualToAnchor:scrollView.widthAnchor], ]]; // Scroll View constraints to the height of its content. This allows to center @@ -174,10 +185,19 @@ scrollViewBottomAnchor = actionStackView.topAnchor; } - [NSLayoutConstraint activateConstraints:@[ + if (self.pinSpecificContentAboveButton && + ([self.specificContentView.subviews count] > 0)) { + [scrollView.bottomAnchor constraintEqualToAnchor:scrollViewBottomAnchor + constant:-kScrollViewBottomInsets] + .active = YES; + } else { [scrollView.bottomAnchor constraintLessThanOrEqualToAnchor:scrollViewBottomAnchor - constant:-kScrollViewBottomInsets], + constant:-kScrollViewBottomInsets] + .active = YES; + } + + [NSLayoutConstraint activateConstraints:@[ [scrollView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor], [scrollView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor],
diff --git a/ios/components/webui/sync_internals/sync_internals_message_handler.mm b/ios/components/webui/sync_internals/sync_internals_message_handler.mm index 5c1c0c1..225b737 100644 --- a/ios/components/webui/sync_internals/sync_internals_message_handler.mm +++ b/ios/components/webui/sync_internals/sync_internals_message_handler.mm
@@ -148,10 +148,13 @@ void SyncInternalsMessageHandler::HandleGetAllNodes( const base::ListValue* args) { - DCHECK_EQ(1U, args->GetList().size()); + base::Value::ConstListView args_list = args->GetList(); + DCHECK_EQ(1U, args_list.size()); std::string callback_id; - bool success = args->GetString(0, &callback_id); - DCHECK(success); + if (args_list[0].is_string()) + callback_id = args_list[0].GetString(); + else + DCHECK(false); syncer::SyncService* service = GetSyncService(); if (service) {
diff --git a/ios/web/webui/web_ui_ios_message_handler.cc b/ios/web/webui/web_ui_ios_message_handler.cc index 91030d3d..d39459a 100644 --- a/ios/web/webui/web_ui_ios_message_handler.cc +++ b/ios/web/webui/web_ui_ios_message_handler.cc
@@ -37,9 +37,9 @@ std::u16string WebUIIOSMessageHandler::ExtractStringValue( const base::ListValue* value) { - std::u16string string16_value; - if (value->GetString(0, &string16_value)) - return string16_value; + base::Value::ConstListView value_list = value->GetList(); + if (!value_list.empty() && value_list[0].is_string()) + return base::UTF8ToUTF16(value_list[0].GetString()); NOTREACHED(); return std::u16string(); }
diff --git a/media/capture/video/android/video_capture_device_factory_android.cc b/media/capture/video/android/video_capture_device_factory_android.cc index bf610ef..aeddd59 100644 --- a/media/capture/video/android/video_capture_device_factory_android.cc +++ b/media/capture/video/android/video_capture_device_factory_android.cc
@@ -32,13 +32,14 @@ VideoCaptureDeviceFactoryAndroid::VideoCaptureDeviceFactoryAndroid() = default; VideoCaptureDeviceFactoryAndroid::~VideoCaptureDeviceFactoryAndroid() = default; -std::unique_ptr<VideoCaptureDevice> -VideoCaptureDeviceFactoryAndroid::CreateDevice( +VideoCaptureErrorOrDevice VideoCaptureDeviceFactoryAndroid::CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) { DCHECK(thread_checker_.CalledOnValidThread()); int id; if (!base::StringToInt(device_descriptor.device_id, &id)) - return nullptr; + return VideoCaptureErrorOrDevice( + VideoCaptureError:: + kVideoCaptureControllerInvalidOrUnsupportedVideoCaptureParametersRequested); std::unique_ptr<VideoCaptureDeviceAndroid> video_capture_device( new VideoCaptureDeviceAndroid(device_descriptor)); @@ -46,11 +47,12 @@ if (video_capture_device->Init()) { if (test_mode_) video_capture_device->ConfigureForTesting(); - return std::move(video_capture_device); + return VideoCaptureErrorOrDevice(std::move(video_capture_device)); } DLOG(ERROR) << "Error creating Video Capture Device."; - return nullptr; + return VideoCaptureErrorOrDevice( + VideoCaptureError::kAndroidApi2ErrorConfiguringCamera); } void VideoCaptureDeviceFactoryAndroid::GetDevicesInfo(
diff --git a/media/capture/video/android/video_capture_device_factory_android.h b/media/capture/video/android/video_capture_device_factory_android.h index bd8bb1f4..3eef79c 100644 --- a/media/capture/video/android/video_capture_device_factory_android.h +++ b/media/capture/video/android/video_capture_device_factory_android.h
@@ -33,7 +33,7 @@ ~VideoCaptureDeviceFactoryAndroid() override; - std::unique_ptr<VideoCaptureDevice> CreateDevice( + VideoCaptureErrorOrDevice CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) override; void GetDevicesInfo(GetDevicesInfoCallback callback) override;
diff --git a/media/capture/video/chromeos/video_capture_device_factory_chromeos.cc b/media/capture/video/chromeos/video_capture_device_factory_chromeos.cc index 02d527b..c340d37 100644 --- a/media/capture/video/chromeos/video_capture_device_factory_chromeos.cc +++ b/media/capture/video/chromeos/video_capture_device_factory_chromeos.cc
@@ -36,15 +36,21 @@ camera_hal_ipc_thread_.Stop(); } -std::unique_ptr<VideoCaptureDevice> -VideoCaptureDeviceFactoryChromeOS::CreateDevice( +VideoCaptureErrorOrDevice VideoCaptureDeviceFactoryChromeOS::CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) { DCHECK(thread_checker_.CalledOnValidThread()); if (!initialized_) { - return nullptr; + return VideoCaptureErrorOrDevice( + VideoCaptureError:: + kCrosHalV3DeviceDelegateFailedToInitializeCameraDevice); } - return camera_hal_delegate_->CreateDevice(task_runner_for_screen_observer_, - device_descriptor); + auto device = camera_hal_delegate_->CreateDevice( + task_runner_for_screen_observer_, device_descriptor); + return device + ? VideoCaptureErrorOrDevice(std::move(device)) + : VideoCaptureErrorOrDevice( + VideoCaptureError:: + kVideoCaptureControllerInvalidOrUnsupportedVideoCaptureParametersRequested); } void VideoCaptureDeviceFactoryChromeOS::GetDevicesInfo(
diff --git a/media/capture/video/chromeos/video_capture_device_factory_chromeos.h b/media/capture/video/chromeos/video_capture_device_factory_chromeos.h index e4ad9b3..00e1543 100644 --- a/media/capture/video/chromeos/video_capture_device_factory_chromeos.h +++ b/media/capture/video/chromeos/video_capture_device_factory_chromeos.h
@@ -33,7 +33,7 @@ ~VideoCaptureDeviceFactoryChromeOS() override; // VideoCaptureDeviceFactory interface implementations. - std::unique_ptr<VideoCaptureDevice> CreateDevice( + VideoCaptureErrorOrDevice CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) final; void GetDevicesInfo(GetDevicesInfoCallback callback) override;
diff --git a/media/capture/video/fake_video_capture_device_factory.cc b/media/capture/video/fake_video_capture_device_factory.cc index 222e0ab..34c4da2 100644 --- a/media/capture/video/fake_video_capture_device_factory.cc +++ b/media/capture/video/fake_video_capture_device_factory.cc
@@ -187,16 +187,21 @@ devices_config_ = config; } -std::unique_ptr<VideoCaptureDevice> FakeVideoCaptureDeviceFactory::CreateDevice( +VideoCaptureErrorOrDevice FakeVideoCaptureDeviceFactory::CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) { DCHECK(thread_checker_.CalledOnValidThread()); for (const auto& entry : devices_config_) { if (device_descriptor.device_id != entry.device_id) continue; - return CreateDeviceWithSettings(entry); + auto device = CreateDeviceWithSettings(entry); + return device ? VideoCaptureErrorOrDevice(std::move(device)) + : VideoCaptureErrorOrDevice( + VideoCaptureError:: + kErrorFakeDeviceIntentionallyEmittingErrorEvent); } - return nullptr; + return VideoCaptureErrorOrDevice( + VideoCaptureError::kErrorFakeDeviceIntentionallyEmittingErrorEvent); } void FakeVideoCaptureDeviceFactory::GetDevicesInfo(
diff --git a/media/capture/video/fake_video_capture_device_factory.h b/media/capture/video/fake_video_capture_device_factory.h index fd83b09..95003be 100644 --- a/media/capture/video/fake_video_capture_device_factory.h +++ b/media/capture/video/fake_video_capture_device_factory.h
@@ -80,7 +80,7 @@ const std::vector<FakeVideoCaptureDeviceSettings>& config); // VideoCaptureDeviceFactory implementation: - std::unique_ptr<VideoCaptureDevice> CreateDevice( + VideoCaptureErrorOrDevice CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) override; void GetDevicesInfo(GetDevicesInfoCallback callback) override;
diff --git a/media/capture/video/fake_video_capture_device_unittest.cc b/media/capture/video/fake_video_capture_device_unittest.cc index b75a4ad3..6c7c57a 100644 --- a/media/capture/video/fake_video_capture_device_unittest.cc +++ b/media/capture/video/fake_video_capture_device_unittest.cc
@@ -436,9 +436,11 @@ EXPECT_EQ(1u, devices_info_.size()); VideoCaptureFormats& supported_formats = devices_info_[0].supported_formats; EXPECT_EQ(0u, supported_formats.size()); - auto device = + + VideoCaptureErrorOrDevice device_status = video_capture_device_factory_->CreateDevice(devices_info_[0].descriptor); - EXPECT_TRUE(device.get()); + ASSERT_TRUE(device_status.ok()); + auto device = device_status.ReleaseDevice(); auto client = CreateClient(); EXPECT_CALL(*client, OnError(_, _, _)); @@ -474,9 +476,10 @@ supported_formats_entry.pixel_format); } - std::unique_ptr<VideoCaptureDevice> device = + VideoCaptureErrorOrDevice device_status = video_capture_device_factory_->CreateDevice(device_info.descriptor); - ASSERT_TRUE(device); + ASSERT_TRUE(device_status.ok()); + std::unique_ptr<VideoCaptureDevice> device = device_status.ReleaseDevice(); VideoCaptureParams capture_params; capture_params.requested_format.frame_size.SetSize(1280, 720);
diff --git a/media/capture/video/file_video_capture_device_factory.cc b/media/capture/video/file_video_capture_device_factory.cc index 7c47a23..7ff8e82 100644 --- a/media/capture/video/file_video_capture_device_factory.cc +++ b/media/capture/video/file_video_capture_device_factory.cc
@@ -26,16 +26,16 @@ return command_line_file_path; } -std::unique_ptr<VideoCaptureDevice> FileVideoCaptureDeviceFactory::CreateDevice( +VideoCaptureErrorOrDevice FileVideoCaptureDeviceFactory::CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) { DCHECK(thread_checker_.CalledOnValidThread()); base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, base::BlockingType::MAY_BLOCK); #if defined(OS_WIN) - return std::unique_ptr<VideoCaptureDevice>(new FileVideoCaptureDevice( + return VideoCaptureErrorOrDevice(std::make_unique<FileVideoCaptureDevice>( base::FilePath(base::SysUTF8ToWide(device_descriptor.display_name())))); #else - return std::unique_ptr<VideoCaptureDevice>(new FileVideoCaptureDevice( + return VideoCaptureErrorOrDevice(std::make_unique<FileVideoCaptureDevice>( base::FilePath(device_descriptor.display_name()))); #endif }
diff --git a/media/capture/video/file_video_capture_device_factory.h b/media/capture/video/file_video_capture_device_factory.h index 5c8e059..503dc594 100644 --- a/media/capture/video/file_video_capture_device_factory.h +++ b/media/capture/video/file_video_capture_device_factory.h
@@ -21,7 +21,7 @@ FileVideoCaptureDeviceFactory() {} ~FileVideoCaptureDeviceFactory() override {} - std::unique_ptr<VideoCaptureDevice> CreateDevice( + VideoCaptureErrorOrDevice CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) override; void GetDevicesInfo(GetDevicesInfoCallback callback) override; };
diff --git a/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.cc b/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.cc index ab3f4fe..958e54d 100644 --- a/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.cc +++ b/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.cc
@@ -113,8 +113,7 @@ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } -std::unique_ptr<VideoCaptureDevice> -VideoCaptureDeviceFactoryFuchsia::CreateDevice( +VideoCaptureErrorOrDevice VideoCaptureDeviceFactoryFuchsia::CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); uint64_t device_id; @@ -123,7 +122,9 @@ // Test may call CreateDevice() with an invalid |device_id|. if (!converted) - return nullptr; + return VideoCaptureErrorOrDevice( + VideoCaptureError:: + kVideoCaptureControllerInvalidOrUnsupportedVideoCaptureParametersRequested); // CreateDevice() may be called before GetDeviceDescriptors(). Make sure // |device_watcher_| is initialized. @@ -132,7 +133,8 @@ fidl::InterfaceHandle<fuchsia::camera3::Device> device; device_watcher_->ConnectToDevice(device_id, device.NewRequest()); - return std::make_unique<VideoCaptureDeviceFuchsia>(std::move(device)); + return VideoCaptureErrorOrDevice( + std::make_unique<VideoCaptureDeviceFuchsia>(std::move(device))); } void VideoCaptureDeviceFactoryFuchsia::GetDevicesInfo(
diff --git a/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h b/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h index eeafa46..49ea546 100644 --- a/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h +++ b/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h
@@ -27,7 +27,7 @@ const VideoCaptureDeviceFactoryFuchsia&) = delete; // VideoCaptureDeviceFactory implementation. - std::unique_ptr<VideoCaptureDevice> CreateDevice( + VideoCaptureErrorOrDevice CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) override; void GetDevicesInfo(GetDevicesInfoCallback callback) override;
diff --git a/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc b/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc index 6348448..aa8e473 100644 --- a/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc +++ b/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc
@@ -222,7 +222,8 @@ void CreateDevice() { auto devices_info = GetDevicesInfo(); ASSERT_EQ(devices_info.size(), 1U); - device_ = device_factory_.CreateDevice(devices_info[0].descriptor); + device_ = device_factory_.CreateDevice(devices_info[0].descriptor) + .ReleaseDevice(); } FakeCameraStream* GetDefaultCameraStream() { @@ -404,7 +405,8 @@ base::RunLoop().RunUntilIdle(); // The factory is expected to reconnect DeviceWatcher. - device_ = device_factory_.CreateDevice(devices_info[0].descriptor); + device_ = + device_factory_.CreateDevice(devices_info[0].descriptor).ReleaseDevice(); StartCapturer();
diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc index 6724957..c544563 100644 --- a/media/capture/video/linux/video_capture_device_factory_linux.cc +++ b/media/capture/video/linux/video_capture_device_factory_linux.cc
@@ -130,8 +130,7 @@ device_provider_ = std::move(device_provider); } -std::unique_ptr<VideoCaptureDevice> -VideoCaptureDeviceFactoryLinux::CreateDevice( +VideoCaptureErrorOrDevice VideoCaptureDeviceFactoryLinux::CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) { DCHECK(thread_checker_.CalledOnValidThread()); auto self = @@ -145,10 +144,11 @@ HANDLE_EINTR(v4l2_->open(device_descriptor.device_id.c_str(), O_RDONLY))); if (!fd.is_valid()) { DLOG(ERROR) << "Cannot open device"; - return nullptr; + return VideoCaptureErrorOrDevice( + VideoCaptureError::kV4L2FailedToOpenV4L2DeviceDriverFile); } - return self; + return VideoCaptureErrorOrDevice(std::move(self)); } void VideoCaptureDeviceFactoryLinux::GetDevicesInfo(
diff --git a/media/capture/video/linux/video_capture_device_factory_linux.h b/media/capture/video/linux/video_capture_device_factory_linux.h index 62fdaead..c80fae4 100644 --- a/media/capture/video/linux/video_capture_device_factory_linux.h +++ b/media/capture/video/linux/video_capture_device_factory_linux.h
@@ -46,7 +46,7 @@ scoped_refptr<V4L2CaptureDevice> v4l2, std::unique_ptr<DeviceProvider> device_provider); - std::unique_ptr<VideoCaptureDevice> CreateDevice( + VideoCaptureErrorOrDevice CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) override; void GetDevicesInfo(GetDevicesInfoCallback callback) override;
diff --git a/media/capture/video/linux/video_capture_device_factory_linux_unittest.cc b/media/capture/video/linux/video_capture_device_factory_linux_unittest.cc index a98b8c0..8fe2587 100644 --- a/media/capture/video/linux/video_capture_device_factory_linux_unittest.cc +++ b/media/capture/video/linux/video_capture_device_factory_linux_unittest.cc
@@ -100,7 +100,7 @@ fake_v4l2_->AddDevice(stub_device_id, FakeV4L2DeviceConfig(descriptor)); // Exercise - auto device = factory_->CreateDevice(descriptor); + auto device = factory_->CreateDevice(descriptor).ReleaseDevice(); VideoCaptureParams arbitrary_params; arbitrary_params.requested_format.frame_size = gfx::Size(1280, 720); arbitrary_params.requested_format.frame_rate = 30.0f;
diff --git a/media/capture/video/mac/video_capture_device_factory_mac.h b/media/capture/video/mac/video_capture_device_factory_mac.h index a8263c3..1f6dda8 100644 --- a/media/capture/video/mac/video_capture_device_factory_mac.h +++ b/media/capture/video/mac/video_capture_device_factory_mac.h
@@ -26,7 +26,7 @@ static void SetGetDevicesInfoRetryCount(int count); static int GetGetDevicesInfoRetryCount(); - std::unique_ptr<VideoCaptureDevice> CreateDevice( + VideoCaptureErrorOrDevice CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) override; void GetDevicesInfo(GetDevicesInfoCallback callback) override; };
diff --git a/media/capture/video/mac/video_capture_device_factory_mac.mm b/media/capture/video/mac/video_capture_device_factory_mac.mm index 5dc79bd..b475552 100644 --- a/media/capture/video/mac/video_capture_device_factory_mac.mm +++ b/media/capture/video/mac/video_capture_device_factory_mac.mm
@@ -112,7 +112,7 @@ return get_device_descriptors_retry_count; } -std::unique_ptr<VideoCaptureDevice> VideoCaptureDeviceFactoryMac::CreateDevice( +VideoCaptureErrorOrDevice VideoCaptureDeviceFactoryMac::CreateDevice( const VideoCaptureDeviceDescriptor& descriptor) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_NE(descriptor.capture_api, VideoCaptureApi::UNKNOWN); @@ -130,7 +130,9 @@ capture_device.reset(); } } - return std::unique_ptr<VideoCaptureDevice>(std::move(capture_device)); + return capture_device ? VideoCaptureErrorOrDevice(std::move(capture_device)) + : VideoCaptureErrorOrDevice( + VideoCaptureError::kMacSetCaptureDeviceFailed); } void VideoCaptureDeviceFactoryMac::GetDevicesInfo(
diff --git a/media/capture/video/mock_device_factory.cc b/media/capture/video/mock_device_factory.cc index ee8b9ed..dad140b 100644 --- a/media/capture/video/mock_device_factory.cc +++ b/media/capture/video/mock_device_factory.cc
@@ -66,12 +66,15 @@ devices_.clear(); } -std::unique_ptr<media::VideoCaptureDevice> MockDeviceFactory::CreateDevice( +VideoCaptureErrorOrDevice MockDeviceFactory::CreateDevice( const media::VideoCaptureDeviceDescriptor& device_descriptor) { if (devices_.find(device_descriptor) == devices_.end()) - return nullptr; - return std::make_unique<RawPointerVideoCaptureDevice>( - devices_[device_descriptor]); + return VideoCaptureErrorOrDevice( + VideoCaptureError:: + kVideoCaptureControllerInvalidOrUnsupportedVideoCaptureParametersRequested); + return VideoCaptureErrorOrDevice( + std::make_unique<RawPointerVideoCaptureDevice>( + devices_[device_descriptor])); } void MockDeviceFactory::GetDevicesInfo(GetDevicesInfoCallback callback) {
diff --git a/media/capture/video/mock_device_factory.h b/media/capture/video/mock_device_factory.h index 2a87dd1d..2cacc0e 100644 --- a/media/capture/video/mock_device_factory.h +++ b/media/capture/video/mock_device_factory.h
@@ -23,7 +23,7 @@ void RemoveAllDevices(); // media::VideoCaptureDeviceFactory implementation. - std::unique_ptr<media::VideoCaptureDevice> CreateDevice( + VideoCaptureErrorOrDevice CreateDevice( const media::VideoCaptureDeviceDescriptor& device_descriptor) override; void GetDevicesInfo(GetDevicesInfoCallback callback) override;
diff --git a/media/capture/video/video_capture_device_factory.cc b/media/capture/video/video_capture_device_factory.cc index dc66805..963bcdd 100644 --- a/media/capture/video/video_capture_device_factory.cc +++ b/media/capture/video/video_capture_device_factory.cc
@@ -15,6 +15,29 @@ namespace media { +VideoCaptureErrorOrDevice::VideoCaptureErrorOrDevice( + std::unique_ptr<VideoCaptureDevice> video_device) + : device_(std::move(video_device)), error_code_(VideoCaptureError::kNone) {} + +VideoCaptureErrorOrDevice::VideoCaptureErrorOrDevice(VideoCaptureError err_code) + : error_code_(err_code) { + DCHECK_NE(error_code_, VideoCaptureError::kNone); +} + +VideoCaptureErrorOrDevice::~VideoCaptureErrorOrDevice() = default; + +VideoCaptureErrorOrDevice::VideoCaptureErrorOrDevice( + VideoCaptureErrorOrDevice&& other) + : device_(std::move(other.device_)), error_code_(other.error_code_) {} + +std::unique_ptr<VideoCaptureDevice> VideoCaptureErrorOrDevice::ReleaseDevice() { + DCHECK_EQ(error_code_, VideoCaptureError::kNone); + + error_code_ = VideoCaptureError:: + kVideoCaptureControllerInvalidOrUnsupportedVideoCaptureParametersRequested; + return std::move(device_); +} + VideoCaptureDeviceFactory::VideoCaptureDeviceFactory() { thread_checker_.DetachFromThread(); }
diff --git a/media/capture/video/video_capture_device_factory.h b/media/capture/video/video_capture_device_factory.h index 462c42f..210b41f 100644 --- a/media/capture/video/video_capture_device_factory.h +++ b/media/capture/video/video_capture_device_factory.h
@@ -14,6 +14,29 @@ namespace media { +// VideoCaptureErrorOrDevice stores the result of CreateDevice function. This is +// designed to pass information such that when device creation fails, instead of +// returning a null_ptr, this would store an error_code explaining why the +// creation failed. +class CAPTURE_EXPORT VideoCaptureErrorOrDevice { + public: + explicit VideoCaptureErrorOrDevice( + std::unique_ptr<VideoCaptureDevice> video_device); + explicit VideoCaptureErrorOrDevice(VideoCaptureError err_code); + ~VideoCaptureErrorOrDevice(); + + VideoCaptureErrorOrDevice(VideoCaptureErrorOrDevice&& other); + + bool ok() const { return error_code_ == VideoCaptureError::kNone; } + VideoCaptureError error() const { return error_code_; } + + std::unique_ptr<VideoCaptureDevice> ReleaseDevice(); + + private: + std::unique_ptr<VideoCaptureDevice> device_; + VideoCaptureError error_code_; +}; + // VideoCaptureDeviceFactory is the base class for creation of video capture // devices in the different platforms. VCDFs are created by MediaStreamManager // on UI thread and plugged into VideoCaptureManager, who owns and operates them @@ -35,8 +58,10 @@ virtual ~VideoCaptureDeviceFactory(); - // Creates a VideoCaptureDevice object. Returns NULL if something goes wrong. - virtual std::unique_ptr<VideoCaptureDevice> CreateDevice( + // Return type is VideoCaptureErrorOrDevice which can be used to access a + // VideoCaptureDevice, if device creation is successful, or a + // VideoCaptureError, if something goes wrong. + virtual VideoCaptureErrorOrDevice CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) = 0; // Enumerates video capture devices and passes the results to the supplied
diff --git a/media/capture/video/video_capture_device_unittest.cc b/media/capture/video/video_capture_device_unittest.cc index b7d1fc46..5fdd3412 100644 --- a/media/capture/video/video_capture_device_unittest.cc +++ b/media/capture/video/video_capture_device_unittest.cc
@@ -497,12 +497,14 @@ #elif defined(OS_MAC) invalid_descriptor.capture_api = VideoCaptureApi::MACOSX_AVFOUNDATION; #endif - std::unique_ptr<VideoCaptureDevice> device = + VideoCaptureErrorOrDevice device_status = video_capture_device_factory_->CreateDevice(invalid_descriptor); #if !defined(OS_MAC) - EXPECT_FALSE(device); + EXPECT_FALSE(device_status.ok()); #else + ASSERT_TRUE(device_status.ok()); + std::unique_ptr<VideoCaptureDevice> device = device_status.ReleaseDevice(); // The presence of the actual device is only checked on AllocateAndStart() // and not on creation. EXPECT_CALL(*video_capture_client_, OnError(_, _, _)).Times(1); @@ -539,9 +541,10 @@ const int width = size.width(); const int height = size.height(); - std::unique_ptr<VideoCaptureDevice> device( - video_capture_device_factory_->CreateDevice(device_info->descriptor)); - ASSERT_TRUE(device); + VideoCaptureErrorOrDevice device_status = + video_capture_device_factory_->CreateDevice(device_info->descriptor); + ASSERT_TRUE(device_status.ok()); + std::unique_ptr<VideoCaptureDevice> device(device_status.ReleaseDevice()); EXPECT_CALL(*video_capture_client_, OnError(_, _, _)).Times(0); EXPECT_CALL(*video_capture_client_, OnStarted()); @@ -586,9 +589,10 @@ const auto device_info = FindUsableDevice(); ASSERT_TRUE(device_info); - std::unique_ptr<VideoCaptureDevice> device( - video_capture_device_factory_->CreateDevice(device_info->descriptor)); - ASSERT_TRUE(device); + VideoCaptureErrorOrDevice device_status = + video_capture_device_factory_->CreateDevice(device_info->descriptor); + ASSERT_TRUE(device_status.ok()); + std::unique_ptr<VideoCaptureDevice> device(device_status.ReleaseDevice()); EXPECT_CALL(*video_capture_client_, OnError(_, _, _)).Times(0); EXPECT_CALL(*video_capture_client_, OnStarted()); @@ -621,8 +625,10 @@ // First, do a number of very fast device start/stops. for (int i = 0; i <= 5; i++) { video_capture_client_ = CreateDeviceClient(); - std::unique_ptr<VideoCaptureDevice> device( - video_capture_device_factory_->CreateDevice(device_info->descriptor)); + VideoCaptureErrorOrDevice device_status = + video_capture_device_factory_->CreateDevice(device_info->descriptor); + ASSERT_TRUE(device_status.ok()); + std::unique_ptr<VideoCaptureDevice> device(device_status.ReleaseDevice()); gfx::Size resolution; if (i % 2) resolution = gfx::Size(640, 480); @@ -644,8 +650,10 @@ capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; video_capture_client_ = CreateDeviceClient(); - std::unique_ptr<VideoCaptureDevice> device( - video_capture_device_factory_->CreateDevice(device_info->descriptor)); + VideoCaptureErrorOrDevice device_status = + video_capture_device_factory_->CreateDevice(device_info->descriptor); + ASSERT_TRUE(device_status.ok()); + std::unique_ptr<VideoCaptureDevice> device(device_status.ReleaseDevice()); device->AllocateAndStart(capture_params, std::move(video_capture_client_)); WaitForCapturedFrame(); @@ -679,9 +687,10 @@ return; } #endif - std::unique_ptr<VideoCaptureDevice> device( - video_capture_device_factory_->CreateDevice(device_info->descriptor)); - ASSERT_TRUE(device); + VideoCaptureErrorOrDevice device_status = + video_capture_device_factory_->CreateDevice(device_info->descriptor); + ASSERT_TRUE(device_status.ok()); + std::unique_ptr<VideoCaptureDevice> device(device_status.ReleaseDevice()); EXPECT_CALL(*video_capture_client_, OnError(_, _, _)).Times(0); EXPECT_CALL(*video_capture_client_, OnStarted()); @@ -735,9 +744,10 @@ const gfx::Size frame_size = device_info->supported_formats.front().frame_size; - std::unique_ptr<VideoCaptureDevice> device( - video_capture_device_factory_->CreateDevice(device_info->descriptor)); - ASSERT_TRUE(device); + VideoCaptureErrorOrDevice device_status = + video_capture_device_factory_->CreateDevice(device_info->descriptor); + ASSERT_TRUE(device_status.ok()); + std::unique_ptr<VideoCaptureDevice> device(device_status.ReleaseDevice()); EXPECT_CALL(*video_capture_client_, OnError(_, _, _)).Times(0); EXPECT_CALL(*video_capture_client_, OnStarted()).Times(testing::AtLeast(1)); @@ -778,9 +788,10 @@ const gfx::Size frame_size = device_info->supported_formats.front().frame_size; - std::unique_ptr<VideoCaptureDevice> device( - video_capture_device_factory_->CreateDevice(device_info->descriptor)); - ASSERT_TRUE(device); + VideoCaptureErrorOrDevice device_status = + video_capture_device_factory_->CreateDevice(device_info->descriptor); + ASSERT_TRUE(device_status.ok()); + std::unique_ptr<VideoCaptureDevice> device(device_status.ReleaseDevice()); EXPECT_CALL(*video_capture_client_, OnError(_, _, _)).Times(0); EXPECT_CALL(*video_capture_client_, OnStarted()); @@ -826,9 +837,10 @@ EXPECT_CALL(*video_capture_client_, OnError(_, _, _)).Times(0); EXPECT_CALL(*video_capture_client_, OnStarted()); - std::unique_ptr<VideoCaptureDevice> device( - video_capture_device_factory_->CreateDevice(device_info->descriptor)); - ASSERT_TRUE(device); + VideoCaptureErrorOrDevice device_status = + video_capture_device_factory_->CreateDevice(device_info->descriptor); + ASSERT_TRUE(device_status.ok()); + std::unique_ptr<VideoCaptureDevice> device(device_status.ReleaseDevice()); VideoCaptureParams capture_params; capture_params.requested_format.frame_size.SetSize(320, 240);
diff --git a/media/capture/video/video_capture_system_impl.cc b/media/capture/video/video_capture_system_impl.cc index 5ff3745..4a61897 100644 --- a/media/capture/video/video_capture_system_impl.cc +++ b/media/capture/video/video_capture_system_impl.cc
@@ -10,6 +10,7 @@ #include "base/callback_helpers.h" #include "build/build_config.h" #include "media/base/bind_to_current_loop.h" +#include "media/capture/video/video_capture_device_factory.h" #include "media/capture/video/video_capture_metrics.h" namespace { @@ -91,7 +92,8 @@ const VideoCaptureDeviceInfo* device_info = LookupDeviceInfoFromId(device_id); if (!device_info) return nullptr; - return factory_->CreateDevice(device_info->descriptor); + auto device_status = factory_->CreateDevice(device_info->descriptor); + return device_status.ok() ? device_status.ReleaseDevice() : nullptr; } const VideoCaptureDeviceInfo* VideoCaptureSystemImpl::LookupDeviceInfoFromId(
diff --git a/media/capture/video/win/video_capture_device_factory_win.cc b/media/capture/video/win/video_capture_device_factory_win.cc index ef2afeb..e463d2e5 100644 --- a/media/capture/video/win/video_capture_device_factory_win.cc +++ b/media/capture/video/win/video_capture_device_factory_win.cc
@@ -353,7 +353,7 @@ } } -std::unique_ptr<VideoCaptureDevice> VideoCaptureDeviceFactoryWin::CreateDevice( +VideoCaptureErrorOrDevice VideoCaptureDeviceFactoryWin::CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) { DCHECK(thread_checker_.CalledOnValidThread()); switch (device_descriptor.capture_api) { @@ -372,7 +372,7 @@ DVLOG(1) << " MediaFoundation Device: " << device_descriptor.display_name(); if (device->Init()) - return device; + return VideoCaptureErrorOrDevice(std::move(device)); break; } case VideoCaptureApi::WIN_DIRECT_SHOW: { @@ -385,14 +385,16 @@ device_descriptor, std::move(capture_filter)); DVLOG(1) << " DirectShow Device: " << device_descriptor.display_name(); if (device->Init()) - return device; + return VideoCaptureErrorOrDevice(std::move(device)); break; } default: NOTREACHED(); break; } - return nullptr; + return VideoCaptureErrorOrDevice( + VideoCaptureError:: + kVideoCaptureControllerInvalidOrUnsupportedVideoCaptureParametersRequested); } bool VideoCaptureDeviceFactoryWin::CreateDeviceEnumMonikerDirectShow( @@ -584,18 +586,17 @@ &VideoCaptureDeviceFactoryWin::FoundAllDevicesUWP, base::Unretained(factory), base::Passed(&devices_info), base::Passed(&result_callback)); - auto callback = - Microsoft::WRL::Callback< - ABI::Windows::Foundation::IAsyncOperationCompletedHandler< - DeviceInformationCollection*>>( - [com_thread_runner, device_info_callback]( - IAsyncOperation<DeviceInformationCollection*>* operation, - AsyncStatus status) -> HRESULT { - com_thread_runner->PostTask( - FROM_HERE, base::BindOnce(device_info_callback, - base::Unretained(operation))); - return S_OK; - }); + auto callback = Microsoft::WRL::Callback< + ABI::Windows::Foundation::IAsyncOperationCompletedHandler< + DeviceInformationCollection*>>( + [com_thread_runner, device_info_callback]( + IAsyncOperation<DeviceInformationCollection*>* operation, + AsyncStatus status) -> HRESULT { + com_thread_runner->PostTask( + FROM_HERE, + base::BindOnce(device_info_callback, base::Unretained(operation))); + return S_OK; + }); ComPtr<ABI::Windows::Devices::Enumeration::IDeviceInformationStatics> dev_info_statics;
diff --git a/media/capture/video/win/video_capture_device_factory_win.h b/media/capture/video/win/video_capture_device_factory_win.h index 8f323d2f..f08fbd13 100644 --- a/media/capture/video/win/video_capture_device_factory_win.h +++ b/media/capture/video/win/video_capture_device_factory_win.h
@@ -39,7 +39,7 @@ ~VideoCaptureDeviceFactoryWin() override; - std::unique_ptr<VideoCaptureDevice> CreateDevice( + VideoCaptureErrorOrDevice CreateDevice( const VideoCaptureDeviceDescriptor& device_descriptor) override; void GetDevicesInfo(GetDevicesInfoCallback callback) override;
diff --git a/media/remoting/BUILD.gn b/media/remoting/BUILD.gn index f77d14a..e45a3ea 100644 --- a/media/remoting/BUILD.gn +++ b/media/remoting/BUILD.gn
@@ -6,32 +6,6 @@ import("//testing/test.gni") import("//third_party/protobuf/proto_library.gni") -# This target is separate from "remoting" because this code is shared by the -# receiver implementation (currently outside of the Chromium project). -source_set("rpc") { - sources = [ - "proto_enum_utils.cc", - "proto_enum_utils.h", - "proto_utils.cc", - "proto_utils.h", - ] - - public_configs = - [ "//third_party/openscreen/src/build:openscreen_include_dirs" ] - - deps = [ - "//base", - "//components/openscreen_platform:openscreen_platform", - "//components/openscreen_platform:openscreen_platform_network_service", - "//media", - ] - - public_deps = [ - "//third_party/openscreen/src/cast/streaming:common", - "//third_party/openscreen/src/cast/streaming:remoting_proto", - ] -} - source_set("remoting_sender") { sources = [ "courier_renderer_factory.cc", @@ -65,7 +39,7 @@ # Consumers of the CourierRenderer implicitly take a dependency on the # generated remoting.pb.h file. - public_deps += [ ":rpc" ] + public_deps += [ "//components/cast_streaming/public:remoting_utils" ] } } @@ -87,14 +61,14 @@ deps = [ ":remoting_constants", - ":rpc", + "//components/cast_streaming/public:remoting_utils", "//media/mojo/common:common", "//media/mojo/mojom:remoting", ] # Consumers of the ReceiverController implicitly take a dependency on the # generated remoting.pb.h file. - public_deps = [ ":rpc" ] + public_deps = [ "//components/cast_streaming/public:remoting_utils" ] } source_set("media_remoting_tests") { @@ -114,9 +88,9 @@ deps = [ ":remoting_renderer", ":remoting_sender", - ":rpc", "//base", "//base/test:test_support", + "//components/cast_streaming/public:remoting_utils", "//media:test_support", "//media/mojo/common", "//media/mojo/mojom:remoting", @@ -135,11 +109,10 @@ "fake_media_resource.h", "integration_test.cc", "metrics_unittest.cc", - "proto_utils_unittest.cc", ] deps += [ - ":rpc", + "//components/cast_streaming/public:remoting_utils", "//media/test:pipeline_integration_test_base", "//services/service_manager/public/cpp:cpp", "//ui/gfx:test_support",
diff --git a/media/remoting/DEPS b/media/remoting/DEPS index d7d8ee5b..82eddc3 100644 --- a/media/remoting/DEPS +++ b/media/remoting/DEPS
@@ -1,4 +1,5 @@ include_rules = [ + "+components/cast_streaming/public", "+mojo/public", "+third_party/openscreen/src/cast/streaming", "+third_party/openscreen/src/util",
diff --git a/media/remoting/courier_renderer.cc b/media/remoting/courier_renderer.cc index b7e1f7e..ab3293a1 100644 --- a/media/remoting/courier_renderer.cc +++ b/media/remoting/courier_renderer.cc
@@ -16,6 +16,8 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/time/default_tick_clock.h" #include "base/time/time.h" +#include "components/cast_streaming/public/remoting_proto_enum_utils.h" +#include "components/cast_streaming/public/remoting_proto_utils.h" #include "media/base/bind_to_current_loop.h" #include "media/base/buffering_state.h" #include "media/base/media_resource.h" @@ -23,8 +25,6 @@ #include "media/base/video_renderer_sink.h" #include "media/base/waiting.h" #include "media/remoting/demuxer_stream_adapter.h" -#include "media/remoting/proto_enum_utils.h" -#include "media/remoting/proto_utils.h" #include "media/remoting/renderer_controller.h" using openscreen::cast::RpcMessenger; @@ -531,8 +531,9 @@ OnFatalError(RPC_INVALID); return; } - absl::optional<BufferingState> state = ToMediaBufferingState( - message->rendererclient_onbufferingstatechange_rpc().state()); + absl::optional<BufferingState> state = + cast_streaming::remoting::ToMediaBufferingState( + message->rendererclient_onbufferingstatechange_rpc().state()); BufferingStateChangeReason reason = BUFFERING_CHANGE_REASON_UNKNOWN; if (!state.has_value()) return; @@ -564,7 +565,8 @@ const openscreen::cast::AudioDecoderConfig pb_audio_config = audio_config_message->audio_decoder_config(); AudioDecoderConfig out_audio_config; - ConvertProtoToAudioDecoderConfig(pb_audio_config, &out_audio_config); + cast_streaming::remoting::ConvertProtoToAudioDecoderConfig(pb_audio_config, + &out_audio_config); DCHECK(out_audio_config.IsValidConfig()); client_->OnAudioConfigChange(out_audio_config); @@ -585,7 +587,8 @@ const openscreen::cast::VideoDecoderConfig pb_video_config = video_config_message->video_decoder_config(); VideoDecoderConfig out_video_config; - ConvertProtoToVideoDecoderConfig(pb_video_config, &out_video_config); + cast_streaming::remoting::ConvertProtoToVideoDecoderConfig(pb_video_config, + &out_video_config); DCHECK(out_video_config.IsValidConfig()); client_->OnVideoConfigChange(out_video_config); @@ -626,7 +629,7 @@ return; } PipelineStatistics stats; - ConvertProtoToPipelineStatistics( + cast_streaming::remoting::ConvertProtoToPipelineStatistics( message->rendererclient_onstatisticsupdate_rpc(), &stats); // Note: Each field in |stats| is a delta, not the aggregate amount. if (stats.audio_bytes_decoded > 0 || stats.video_frames_decoded > 0 ||
diff --git a/media/remoting/courier_renderer_unittest.cc b/media/remoting/courier_renderer_unittest.cc index c27a481..10ab0670 100644 --- a/media/remoting/courier_renderer_unittest.cc +++ b/media/remoting/courier_renderer_unittest.cc
@@ -14,14 +14,14 @@ #include "base/test/simple_test_tick_clock.h" #include "base/test/task_environment.h" #include "base/threading/thread_task_runner_handle.h" +#include "components/cast_streaming/public/remoting_proto_enum_utils.h" +#include "components/cast_streaming/public/remoting_proto_utils.h" #include "media/base/media_util.h" #include "media/base/pipeline_status.h" #include "media/base/renderer_client.h" #include "media/base/test_helpers.h" #include "media/remoting/fake_media_resource.h" #include "media/remoting/fake_remoter.h" -#include "media/remoting/proto_enum_utils.h" -#include "media/remoting/proto_utils.h" #include "media/remoting/renderer_controller.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -449,7 +449,7 @@ void IssuesBufferingStateRpc(BufferingState state) { absl::optional< openscreen::cast::RendererClientOnBufferingStateChange::State> - pb_state = ToProtoMediaBufferingState(state); + pb_state = cast_streaming::remoting::ToProtoMediaBufferingState(state); if (!pb_state.has_value()) return; std::unique_ptr<openscreen::cast::RpcMessage> rpc( @@ -665,7 +665,8 @@ rpc->mutable_rendererclient_onaudioconfigchange_rpc(); openscreen::cast::AudioDecoderConfig* proto_audio_config = audio_config_change_message->mutable_audio_decoder_config(); - ConvertAudioDecoderConfigToProto(kNewAudioConfig, proto_audio_config); + cast_streaming::remoting::ConvertAudioDecoderConfigToProto( + kNewAudioConfig, proto_audio_config); OnReceivedRpc(std::move(rpc)); RunPendingTasks(); ASSERT_TRUE(render_client_->audio_decoder_config().Matches(kNewAudioConfig)); @@ -689,7 +690,8 @@ rpc->mutable_rendererclient_onvideoconfigchange_rpc(); openscreen::cast::VideoDecoderConfig* proto_video_config = video_config_change_message->mutable_video_decoder_config(); - ConvertVideoDecoderConfigToProto(kNewVideoConfig, proto_video_config); + cast_streaming::remoting::ConvertVideoDecoderConfigToProto( + kNewVideoConfig, proto_video_config); OnReceivedRpc(std::move(rpc)); RunPendingTasks(); ASSERT_TRUE(render_client_->video_decoder_config().Matches(kNewVideoConfig));
diff --git a/media/remoting/demuxer_stream_adapter.cc b/media/remoting/demuxer_stream_adapter.cc index 9fc8f17f..0729d34 100644 --- a/media/remoting/demuxer_stream_adapter.cc +++ b/media/remoting/demuxer_stream_adapter.cc
@@ -10,11 +10,11 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/task/single_thread_task_runner.h" +#include "components/cast_streaming/public/remoting_proto_enum_utils.h" +#include "components/cast_streaming/public/remoting_proto_utils.h" #include "media/base/bind_to_current_loop.h" #include "media/base/decoder_buffer.h" #include "media/base/timestamp_constants.h" -#include "media/remoting/proto_enum_utils.h" -#include "media/remoting/proto_utils.h" // Convenience logging macro used throughout this file. #define DEMUXER_VLOG(level) VLOG(level) << __func__ << "[" << name_ << "]: " @@ -170,14 +170,16 @@ audio_config_ = demuxer_stream_->audio_decoder_config(); openscreen::cast::AudioDecoderConfig* audio_message = init_cb_message->mutable_audio_decoder_config(); - ConvertAudioDecoderConfigToProto(audio_config_, audio_message); + cast_streaming::remoting::ConvertAudioDecoderConfigToProto(audio_config_, + audio_message); break; } case DemuxerStream::Type::VIDEO: { video_config_ = demuxer_stream_->video_decoder_config(); openscreen::cast::VideoDecoderConfig* video_message = init_cb_message->mutable_video_decoder_config(); - ConvertVideoDecoderConfigToProto(video_config_, video_message); + cast_streaming::remoting::ConvertVideoDecoderConfigToProto(video_config_, + video_message); break; } default: @@ -291,7 +293,8 @@ DCHECK(pending_frame_.empty()); if (!data_pipe_writer_.IsPipeValid()) return; // Do not start sending (due to previous fatal error). - pending_frame_ = DecoderBufferToByteArray(*input); + pending_frame_ = + cast_streaming::remoting::DecoderBufferToByteArray(*input); pending_frame_is_eos_ = input->end_of_stream(); WriteFrame(); } break; @@ -353,16 +356,20 @@ rpc->set_proc(openscreen::cast::RpcMessage::RPC_DS_READUNTIL_CALLBACK); auto* message = rpc->mutable_demuxerstream_readuntilcb_rpc(); message->set_count(last_count_); - message->set_status(ToProtoDemuxerStreamStatus(media_status_).value()); + message->set_status( + cast_streaming::remoting::ToProtoDemuxerStreamStatus(media_status_) + .value()); if (media_status_ == DemuxerStream::kConfigChanged) { if (audio_config_.IsValidConfig()) { openscreen::cast::AudioDecoderConfig* audio_message = message->mutable_audio_decoder_config(); - ConvertAudioDecoderConfigToProto(audio_config_, audio_message); + cast_streaming::remoting::ConvertAudioDecoderConfigToProto(audio_config_, + audio_message); } else if (video_config_.IsValidConfig()) { openscreen::cast::VideoDecoderConfig* video_message = message->mutable_video_decoder_config(); - ConvertVideoDecoderConfigToProto(video_config_, video_message); + cast_streaming::remoting::ConvertVideoDecoderConfigToProto(video_config_, + video_message); } else { NOTREACHED(); }
diff --git a/media/remoting/demuxer_stream_adapter_unittest.cc b/media/remoting/demuxer_stream_adapter_unittest.cc index a137aef..17218b3 100644 --- a/media/remoting/demuxer_stream_adapter_unittest.cc +++ b/media/remoting/demuxer_stream_adapter_unittest.cc
@@ -12,11 +12,11 @@ #include "base/run_loop.h" #include "base/task/single_thread_task_runner.h" #include "base/test/task_environment.h" +#include "components/cast_streaming/public/remoting_proto_utils.h" #include "media/base/decoder_buffer.h" #include "media/base/demuxer_stream.h" #include "media/remoting/fake_media_resource.h" #include "media/remoting/fake_remoter.h" -#include "media/remoting/proto_utils.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/media/remoting/end2end_test_renderer.cc b/media/remoting/end2end_test_renderer.cc index 580dd27..c2ea359 100644 --- a/media/remoting/end2end_test_renderer.cc +++ b/media/remoting/end2end_test_renderer.cc
@@ -13,12 +13,12 @@ #include "base/check.h" #include "base/notreached.h" #include "base/threading/thread_task_runner_handle.h" +#include "components/cast_streaming/public/remoting_proto_utils.h" #include "media/base/demuxer_stream.h" #include "media/mojo/common/mojo_data_pipe_read_write.h" #include "media/mojo/common/mojo_decoder_buffer_converter.h" #include "media/mojo/mojom/remoting.mojom.h" #include "media/remoting/courier_renderer.h" -#include "media/remoting/proto_utils.h" #include "media/remoting/receiver.h" #include "media/remoting/receiver_controller.h" #include "media/remoting/renderer_controller.h" @@ -408,7 +408,8 @@ const std::vector<uint8_t>& frame, DemuxerStream::Type type) { scoped_refptr<DecoderBuffer> decoder_buffer = - ByteArrayToDecoderBuffer(frame.data(), frame.size()); + cast_streaming::remoting::ByteArrayToDecoderBuffer(frame.data(), + frame.size()); if (type == DemuxerStream::Type::AUDIO) { media_remotee_->OnAudioFrame(frame_count, decoder_buffer); } else if (type == DemuxerStream::Type::VIDEO) {
diff --git a/media/remoting/fake_remoter.cc b/media/remoting/fake_remoter.cc index 4252330..18ec3a2b 100644 --- a/media/remoting/fake_remoter.cc +++ b/media/remoting/fake_remoter.cc
@@ -17,7 +17,7 @@ #include "testing/gtest/include/gtest/gtest.h" #if BUILDFLAG(ENABLE_MEDIA_REMOTING_RPC) -#include "media/remoting/proto_utils.h" // nogncheck +#include "components/cast_streaming/public/remoting_proto_utils.h" // nogncheck #endif namespace media { @@ -52,7 +52,8 @@ #if BUILDFLAG(ENABLE_MEDIA_REMOTING_RPC) const std::vector<uint8_t>& data = received_frame_list[index]; scoped_refptr<DecoderBuffer> media_buffer = - ByteArrayToDecoderBuffer(data.data(), data.size()); + cast_streaming::remoting::ByteArrayToDecoderBuffer(data.data(), + data.size()); // Checks if pts is correct or not if (media_buffer->timestamp().InMilliseconds() != pts_ms) {
diff --git a/media/remoting/receiver.cc b/media/remoting/receiver.cc index 6dd234d..aa95e7d 100644 --- a/media/remoting/receiver.cc +++ b/media/remoting/receiver.cc
@@ -12,10 +12,10 @@ #include "base/task/bind_post_task.h" #include "base/task/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" +#include "components/cast_streaming/public/remoting_proto_enum_utils.h" +#include "components/cast_streaming/public/remoting_proto_utils.h" #include "media/base/decoder_buffer.h" #include "media/base/renderer.h" -#include "media/remoting/proto_enum_utils.h" -#include "media/remoting/proto_utils.h" #include "media/remoting/receiver_controller.h" #include "media/remoting/stream_provider.h" @@ -308,7 +308,8 @@ rpc->set_handle(remote_handle_); rpc->set_proc(openscreen::cast::RpcMessage::RPC_RC_ONBUFFERINGSTATECHANGE); auto* message = rpc->mutable_rendererclient_onbufferingstatechange_rpc(); - message->set_state(ToProtoMediaBufferingState(state).value()); + message->set_state( + cast_streaming::remoting::ToProtoMediaBufferingState(state).value()); SendRpcMessageOnMainThread(std::move(rpc)); } @@ -324,7 +325,8 @@ auto* message = rpc->mutable_rendererclient_onaudioconfigchange_rpc(); openscreen::cast::AudioDecoderConfig* proto_audio_config = message->mutable_audio_decoder_config(); - ConvertAudioDecoderConfigToProto(config, proto_audio_config); + cast_streaming::remoting::ConvertAudioDecoderConfigToProto( + config, proto_audio_config); SendRpcMessageOnMainThread(std::move(rpc)); } @@ -335,7 +337,8 @@ auto* message = rpc->mutable_rendererclient_onvideoconfigchange_rpc(); openscreen::cast::VideoDecoderConfig* proto_video_config = message->mutable_video_decoder_config(); - ConvertVideoDecoderConfigToProto(config, proto_video_config); + cast_streaming::remoting::ConvertVideoDecoderConfigToProto( + config, proto_video_config); SendRpcMessageOnMainThread(std::move(rpc)); }
diff --git a/media/remoting/receiver_unittest.cc b/media/remoting/receiver_unittest.cc index 8f82e1e..490598a 100644 --- a/media/remoting/receiver_unittest.cc +++ b/media/remoting/receiver_unittest.cc
@@ -10,6 +10,8 @@ #include "base/memory/raw_ptr.h" #include "base/test/gmock_callback_support.h" #include "base/test/task_environment.h" +#include "components/cast_streaming/public/remoting_proto_enum_utils.h" +#include "components/cast_streaming/public/remoting_proto_utils.h" #include "media/base/audio_decoder_config.h" #include "media/base/media_util.h" #include "media/base/mock_filters.h" @@ -17,8 +19,6 @@ #include "media/base/test_helpers.h" #include "media/base/video_decoder_config.h" #include "media/remoting/mock_receiver_controller.h" -#include "media/remoting/proto_enum_utils.h" -#include "media/remoting/proto_utils.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -81,8 +81,9 @@ break; } case openscreen::cast::RpcMessage::RPC_RC_ONBUFFERINGSTATECHANGE: { - absl::optional<BufferingState> state = ToMediaBufferingState( - message->rendererclient_onbufferingstatechange_rpc().state()); + absl::optional<BufferingState> state = + cast_streaming::remoting::ToMediaBufferingState( + message->rendererclient_onbufferingstatechange_rpc().state()); if (state.has_value()) OnBufferingStateChange(state.value()); break; @@ -100,7 +101,8 @@ const openscreen::cast::AudioDecoderConfig pb_audio_config = audio_config_message->audio_decoder_config(); AudioDecoderConfig out_audio_config; - ConvertProtoToAudioDecoderConfig(pb_audio_config, &out_audio_config); + cast_streaming::remoting::ConvertProtoToAudioDecoderConfig( + pb_audio_config, &out_audio_config); DCHECK(out_audio_config.IsValidConfig()); OnAudioConfigChange(out_audio_config); break; @@ -112,7 +114,8 @@ const openscreen::cast::VideoDecoderConfig pb_video_config = video_config_message->video_decoder_config(); VideoDecoderConfig out_video_config; - ConvertProtoToVideoDecoderConfig(pb_video_config, &out_video_config); + cast_streaming::remoting::ConvertProtoToVideoDecoderConfig( + pb_video_config, &out_video_config); DCHECK(out_video_config.IsValidConfig()); OnVideoConfigChange(out_video_config);
diff --git a/media/remoting/stream_provider.cc b/media/remoting/stream_provider.cc index 13407ca..9df45502 100644 --- a/media/remoting/stream_provider.cc +++ b/media/remoting/stream_provider.cc
@@ -13,12 +13,12 @@ #include "base/task/bind_post_task.h" #include "base/task/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" +#include "components/cast_streaming/public/remoting_proto_enum_utils.h" +#include "components/cast_streaming/public/remoting_proto_utils.h" #include "media/base/bind_to_current_loop.h" #include "media/base/decoder_buffer.h" #include "media/base/video_transformation.h" #include "media/mojo/common/mojo_decoder_buffer_converter.h" -#include "media/remoting/proto_enum_utils.h" -#include "media/remoting/proto_utils.h" #include "media/remoting/receiver_controller.h" #include "third_party/openscreen/src/cast/streaming/rpc_messenger.h" @@ -205,7 +205,8 @@ callback_message.has_audio_decoder_config()) { const openscreen::cast::AudioDecoderConfig audio_message = callback_message.audio_decoder_config(); - ConvertProtoToAudioDecoderConfig(audio_message, &audio_decoder_config_); + cast_streaming::remoting::ConvertProtoToAudioDecoderConfig( + audio_message, &audio_decoder_config_); if (!audio_decoder_config_.IsValidConfig()) { OnError("Invalid audio config"); return; @@ -214,7 +215,8 @@ callback_message.has_video_decoder_config()) { const openscreen::cast::VideoDecoderConfig video_message = callback_message.video_decoder_config(); - ConvertProtoToVideoDecoderConfig(video_message, &video_decoder_config_); + cast_streaming::remoting::ConvertProtoToVideoDecoderConfig( + video_message, &video_decoder_config_); if (!video_decoder_config_.IsValidConfig()) { OnError("Invalid video config"); return; @@ -257,7 +259,8 @@ message->demuxerstream_readuntilcb_rpc(); total_received_frame_count_ = callback_message.count(); - if (ToDemuxerStreamStatus(callback_message.status()) == kConfigChanged) { + if (cast_streaming::remoting::ToDemuxerStreamStatus( + callback_message.status()) == kConfigChanged) { if (callback_message.has_audio_decoder_config()) { const openscreen::cast::AudioDecoderConfig audio_message = callback_message.audio_decoder_config(); @@ -284,7 +287,8 @@ const openscreen::cast::AudioDecoderConfig& audio_message) { DCHECK(type_ == AUDIO); AudioDecoderConfig audio_config; - ConvertProtoToAudioDecoderConfig(audio_message, &audio_config); + cast_streaming::remoting::ConvertProtoToAudioDecoderConfig(audio_message, + &audio_config); if (!audio_config.IsValidConfig()) { OnError("Invalid audio config"); return; @@ -296,7 +300,8 @@ const openscreen::cast::VideoDecoderConfig& video_message) { DCHECK(type_ == VIDEO); VideoDecoderConfig video_config; - ConvertProtoToVideoDecoderConfig(video_message, &video_config); + cast_streaming::remoting::ConvertProtoToVideoDecoderConfig(video_message, + &video_config); if (!video_config.IsValidConfig()) { OnError("Invalid video config"); return;
diff --git a/media/remoting/stream_provider_unittest.cc b/media/remoting/stream_provider_unittest.cc index d5e9c9bf..669c6a3 100644 --- a/media/remoting/stream_provider_unittest.cc +++ b/media/remoting/stream_provider_unittest.cc
@@ -6,14 +6,14 @@ #include "base/memory/raw_ptr.h" #include "base/test/task_environment.h" +#include "components/cast_streaming/public/remoting_proto_enum_utils.h" +#include "components/cast_streaming/public/remoting_proto_utils.h" #include "media/base/audio_decoder_config.h" #include "media/base/demuxer_stream.h" #include "media/base/media_util.h" #include "media/base/test_helpers.h" #include "media/base/video_decoder_config.h" #include "media/remoting/mock_receiver_controller.h" -#include "media/remoting/proto_enum_utils.h" -#include "media/remoting/proto_utils.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -105,14 +105,16 @@ case DemuxerStream::Type::AUDIO: { openscreen::cast::AudioDecoderConfig* audio_message = init_cb_message->mutable_audio_decoder_config(); - ConvertAudioDecoderConfigToProto(audio_config_, audio_message); + cast_streaming::remoting::ConvertAudioDecoderConfigToProto( + audio_config_, audio_message); break; } case DemuxerStream::Type::VIDEO: { openscreen::cast::VideoDecoderConfig* video_message = init_cb_message->mutable_video_decoder_config(); - ConvertVideoDecoderConfigToProto(video_config_, video_message); + cast_streaming::remoting::ConvertVideoDecoderConfigToProto( + video_config_, video_message); break; } @@ -186,8 +188,9 @@ rpc.set_proc(openscreen::cast::RpcMessage::RPC_DS_READUNTIL_CALLBACK); auto* message = rpc.mutable_demuxerstream_readuntilcb_rpc(); message->set_count(0); - message->set_status( - ToProtoDemuxerStreamStatus(DemuxerStream::Status::kOk).value()); + message->set_status(cast_streaming::remoting::ToProtoDemuxerStreamStatus( + DemuxerStream::Status::kOk) + .value()); rpc_messenger_->SendMessageToRemote(rpc); }
diff --git a/mojo/public/c/system/functions.h b/mojo/public/c/system/functions.h index 257b601..2d5d345b 100644 --- a/mojo/public/c/system/functions.h +++ b/mojo/public/c/system/functions.h
@@ -9,10 +9,6 @@ #ifndef MOJO_PUBLIC_C_SYSTEM_FUNCTIONS_H_ #define MOJO_PUBLIC_C_SYSTEM_FUNCTIONS_H_ -#include <stddef.h> -#include <stdint.h> - -#include "mojo/public/c/system/invitation.h" #include "mojo/public/c/system/system_export.h" #include "mojo/public/c/system/types.h"
diff --git a/mojo/public/cpp/system/functions.cc b/mojo/public/cpp/system/functions.cc index 74aee1a..4618c80 100644 --- a/mojo/public/cpp/system/functions.cc +++ b/mojo/public/cpp/system/functions.cc
@@ -6,6 +6,7 @@ #include "base/callback.h" #include "base/no_destructor.h" +#include "mojo/public/c/system/invitation.h" namespace mojo {
diff --git a/net/cert/internal/parse_name.cc b/net/cert/internal/parse_name.cc index 6dc6a9c8..e3e4d68 100644 --- a/net/cert/internal/parse_name.cc +++ b/net/cert/internal/parse_name.cc
@@ -170,6 +170,19 @@ return der::Input(oid); } +der::Input TypeEmailAddressOid() { + // RFC 5280 section A.1: + // + // pkcs-9 OBJECT IDENTIFIER ::= + // { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 9 } + // + // id-emailAddress AttributeType ::= { pkcs-9 1 } + // + // In dotted form: 1.2.840.113549.1.9.1 + const uint8_t oid[] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01}; + return der::Input(oid); +} + bool X509NameAttribute::ValueAsString(std::string* out) const { switch (value_tag) { case der::kTeletexString: { @@ -269,6 +282,8 @@ type_string = "OU"; } else if (type == TypeGivenNameOid()) { type_string = "GN"; + } else if (type == TypeEmailAddressOid()) { + type_string = "emailAddress"; } else { type_string = OidToString(type); if (type_string.empty())
diff --git a/net/cert/internal/parse_name.h b/net/cert/internal/parse_name.h index 27faf43a0..5d5a75f 100644 --- a/net/cert/internal/parse_name.h +++ b/net/cert/internal/parse_name.h
@@ -29,6 +29,7 @@ NET_EXPORT der::Input TypeInitialsOid(); NET_EXPORT der::Input TypeGenerationQualifierOid(); NET_EXPORT der::Input TypeDomainComponentOid(); +NET_EXPORT der::Input TypeEmailAddressOid(); // X509NameAttribute contains a representation of a DER-encoded RFC 2253 // "AttributeTypeAndValue".
diff --git a/net/cert/internal/verify_name_match.cc b/net/cert/internal/verify_name_match.cc index c887e94..53bec4b 100644 --- a/net/cert/internal/verify_name_match.cc +++ b/net/cert/internal/verify_name_match.cc
@@ -23,17 +23,6 @@ namespace { -// RFC 5280 section A.1: -// -// pkcs-9 OBJECT IDENTIFIER ::= -// { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 9 } -// -// id-emailAddress AttributeType ::= { pkcs-9 1 } -// -// In dotted form: 1.2.840.113549.1.9.1 -const uint8_t kOidEmailAddress[] = {0x2A, 0x86, 0x48, 0x86, 0xF7, - 0x0D, 0x01, 0x09, 0x01}; - // Types of character set checking that NormalizeDirectoryString can perform. enum CharsetEnforcement { NO_ENFORCEMENT, @@ -414,7 +403,7 @@ return false; for (const auto& type_and_value : type_and_values) { - if (type_and_value.type == der::Input(kOidEmailAddress)) { + if (type_and_value.type == TypeEmailAddressOid()) { *contained_email_address = true; return true; }
diff --git a/net/data/verify_certificate_chain_unittest/pkits_errors/4.13.29.txt b/net/data/verify_certificate_chain_unittest/pkits_errors/4.13.29.txt index 460dcbd..df0ad64 100644 --- a/net/data/verify_certificate_chain_unittest/pkits_errors/4.13.29.txt +++ b/net/data/verify_certificate_chain_unittest/pkits_errors/4.13.29.txt
@@ -1,3 +1,3 @@ ------ Certificate i=0 (1.2.840.113549.1.9.1=#546573743239454540696E76616C69646365727469666963617465732E676F76,CN=Invalid DN and RFC822 nameConstraints EE Certificate Test29,OU=permittedSubtree1,O=Test Certificates 2011,C=US) ----- +----- Certificate i=0 (emailAddress=Test29EE@invalidcertificates.gov,CN=Invalid DN and RFC822 nameConstraints EE Certificate Test29,OU=permittedSubtree1,O=Test Certificates 2011,C=US) ----- ERROR: Not permitted by name constraints
diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc index 2e5d207..2f53b8f 100644 --- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc +++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc
@@ -153,7 +153,9 @@ BPF_TEST_C(BaselinePolicy, SystemEperm, BaselinePolicy) { errno = 0; int ret_val = system("echo SHOULD NEVER RUN"); - BPF_ASSERT_EQ(-1, ret_val); + // glibc >= 2.33 changed the ret code: 127 is now expected on bits 15-8 + // previously it was simply -1, so check for not zero + BPF_ASSERT_NE(0, ret_val); BPF_ASSERT_EQ(EPERM, errno); }
diff --git a/services/viz/privileged/mojom/gl/gpu_service.mojom b/services/viz/privileged/mojom/gl/gpu_service.mojom index dd24181b..82cd58f 100644 --- a/services/viz/privileged/mojom/gl/gpu_service.mojom +++ b/services/viz/privileged/mojom/gl/gpu_service.mojom
@@ -5,7 +5,7 @@ module viz.mojom; [EnableIf=is_chromeos_ash] -import "components/arc/mojom/protected_buffer_manager.mojom"; +import "ash/components/arc/mojom/protected_buffer_manager.mojom"; [EnableIf=is_chromeos_ash] import "components/arc/mojom/video_decode_accelerator.mojom"; [EnableIf=is_chromeos_ash]
diff --git a/storage/browser/file_system/isolated_context.h b/storage/browser/file_system/isolated_context.h index 70610bd..3b09ee2a 100644 --- a/storage/browser/file_system/isolated_context.h +++ b/storage/browser/file_system/isolated_context.h
@@ -13,7 +13,6 @@ #include "base/component_export.h" #include "base/files/file_path.h" #include "base/lazy_instance.h" -#include "base/memory/singleton.h" #include "base/synchronization/lock.h" #include "storage/browser/file_system/mount_points.h" #include "storage/common/file_system/file_system_types.h"
diff --git a/testing/buildbot/chrome.json b/testing/buildbot/chrome.json index 0874e7f..f5b639b 100644 --- a/testing/buildbot/chrome.json +++ b/testing/buildbot/chrome.json
@@ -1015,46 +1015,6 @@ "test_id_prefix": "ninja://chrome/browser/metrics/perf:profile_provider_unittest/" }, { - "args": [ - "--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.sandbox_linux_unittests.filter" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86", - "kvm": "1", - "os": "Ubuntu-18.04", - "pool": "chrome.tests" - } - ], - "named_caches": [ - { - "name": "cros_vm", - "path": "magic_cros_vm_cache" - } - ], - "optional_dimensions": { - "60": [ - { - "caches": "cros_vm" - } - ] - }, - "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "sandbox_linux_unittests", - "test_id_prefix": "ninja://sandbox/linux:sandbox_linux_unittests/" - }, - { "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py"
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index 4ad64fe0..f54d4aa 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -913,46 +913,6 @@ "test_id_prefix": "ninja://chrome/browser/metrics/perf:profile_provider_unittest/" }, { - "args": [ - "--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.sandbox_linux_unittests.filter" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86", - "kvm": "1", - "os": "Ubuntu-18.04", - "pool": "chromium.tests" - } - ], - "named_caches": [ - { - "name": "cros_vm", - "path": "magic_cros_vm_cache" - } - ], - "optional_dimensions": { - "60": [ - { - "caches": "cros_vm" - } - ] - }, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "sandbox_linux_unittests", - "test_id_prefix": "ninja://sandbox/linux:sandbox_linux_unittests/" - }, - { "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py"
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index c92d274..3baf17cf 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -16628,46 +16628,6 @@ "test_id_prefix": "ninja://chrome/browser/metrics/perf:profile_provider_unittest/" }, { - "args": [ - "--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.sandbox_linux_unittests.filter" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86", - "kvm": "1", - "os": "Ubuntu-18.04", - "pool": "chromium.tests" - } - ], - "named_caches": [ - { - "name": "cros_vm", - "path": "magic_cros_vm_cache" - } - ], - "optional_dimensions": { - "60": [ - { - "caches": "cros_vm" - } - ] - }, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "sandbox_linux_unittests", - "test_id_prefix": "ninja://sandbox/linux:sandbox_linux_unittests/" - }, - { "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -17906,46 +17866,6 @@ "test_id_prefix": "ninja://chrome/browser/metrics/perf:profile_provider_unittest/" }, { - "args": [ - "--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.sandbox_linux_unittests.filter" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86", - "kvm": "1", - "os": "Ubuntu-18.04", - "pool": "chromium.tests" - } - ], - "named_caches": [ - { - "name": "cros_vm", - "path": "magic_cros_vm_cache" - } - ], - "optional_dimensions": { - "60": [ - { - "caches": "cros_vm" - } - ] - }, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "sandbox_linux_unittests", - "test_id_prefix": "ninja://sandbox/linux:sandbox_linux_unittests/" - }, - { "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py"
diff --git a/testing/buildbot/filters/BUILD.gn b/testing/buildbot/filters/BUILD.gn index d84a744f..f3f08fb 100644 --- a/testing/buildbot/filters/BUILD.gn +++ b/testing/buildbot/filters/BUILD.gn
@@ -97,7 +97,6 @@ "//testing/buildbot/filters/chromeos.base_unittests.filter", "//testing/buildbot/filters/chromeos.browser_tests.filter", "//testing/buildbot/filters/chromeos.media_unittests.filter", - "//testing/buildbot/filters/chromeos.sandbox_linux_unittests.filter", "//testing/buildbot/filters/chromeos.services_unittests.filter", "//testing/buildbot/filters/chromeos.unit_tests.filter", ]
diff --git a/testing/buildbot/filters/chromeos.sandbox_linux_unittests.filter b/testing/buildbot/filters/chromeos.sandbox_linux_unittests.filter deleted file mode 100644 index d06368a..0000000 --- a/testing/buildbot/filters/chromeos.sandbox_linux_unittests.filter +++ /dev/null
@@ -1,2 +0,0 @@ -# b/206128425 --BaselinePolicy.SystemEperm
diff --git a/testing/buildbot/filters/fuchsia.components_unittests.filter b/testing/buildbot/filters/fuchsia.components_unittests.filter index 62d34d14..7e61e3f 100644 --- a/testing/buildbot/filters/fuchsia.components_unittests.filter +++ b/testing/buildbot/filters/fuchsia.components_unittests.filter
@@ -2,7 +2,6 @@ -All/AutofillServer* -All/AutofillUpload* -All/UserAgentUtilsTest.UserAgentStringOrdering* --ArchiveManagerTest.Get* -ArchiveManagerTest.Try* -BaseFileTest.Readonly* -BaseFileTest.RenameWith* @@ -28,9 +27,6 @@ -NetworkTimeTrackerTest.Update* -OfflinePageMetadataStoreTest.LoadStore* -OfflinePageMetadataStoreTest.LoadVersion* --OfflinePageModelTaskifiedTest.Clear* --OfflinePageModelTaskifiedTest.Persistent* --OfflinePageModelTaskifiedTest.SavePageSuccessful -PaintPreviewSerialUtils.TestSerialTypeface -PaintPreviewSubset* -PersonalDataManagerTest.Should* @@ -44,6 +40,7 @@ -SyncHttpBridgeTest.Http* -SyncHttpBridgeTest.TestExtra* -SyncHttpBridgeTest.TestResponse* +-SystemMemoryPressureEvaluatorFuchsiaDeath* -UIDev* -VariationsCrash* -WebAppOriginAssociationFetcher*
diff --git a/testing/buildbot/internal.chromeos.fyi.json b/testing/buildbot/internal.chromeos.fyi.json index 52e6637d0..8099255 100644 --- a/testing/buildbot/internal.chromeos.fyi.json +++ b/testing/buildbot/internal.chromeos.fyi.json
@@ -863,46 +863,6 @@ "test_id_prefix": "ninja://chrome/browser/metrics/perf:profile_provider_unittest/" }, { - "args": [ - "--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.sandbox_linux_unittests.filter" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86", - "kvm": "1", - "os": "Ubuntu-18.04", - "pool": "chrome.tests" - } - ], - "named_caches": [ - { - "name": "cros_vm", - "path": "magic_cros_vm_cache" - } - ], - "optional_dimensions": { - "60": [ - { - "caches": "cros_vm" - } - ] - }, - "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "sandbox_linux_unittests", - "test_id_prefix": "ninja://sandbox/linux:sandbox_linux_unittests/" - }, - { "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py"
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index fdfa1452..b6ed105 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -872,11 +872,6 @@ '--test-launcher-jobs=1', ], }, - 'sandbox_linux_unittests': { - 'args': [ - '--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.sandbox_linux_unittests.filter', - ], - }, 'sql_unittests': {}, 'url_unittests': {}, 'vaapi_unittest': {
diff --git a/testing/scripts/run_isolated_script_test.py b/testing/scripts/run_isolated_script_test.py index a5dc82e..71e20d1 100755 --- a/testing/scripts/run_isolated_script_test.py +++ b/testing/scripts/run_isolated_script_test.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env vpython3 # Copyright 2015 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.
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 81e42c5..7b214873 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -762,6 +762,33 @@ ] } ], + "ApplyNativeOcclusionToCompositor": [ + { + "platforms": [ + "windows" + ], + "experiments": [ + { + "name": "Release_6", + "params": { + "type": "release" + }, + "enable_features": [ + "ApplyNativeOcclusionToCompositor" + ] + }, + { + "name": "Throttle_6", + "params": { + "type": "throttle" + }, + "enable_features": [ + "ApplyNativeOcclusionToCompositor" + ] + } + ] + } + ], "ArcEnableThrottlingNotification": [ { "platforms": [ @@ -2818,6 +2845,30 @@ ] } ], + "DeprioritizeTimersUntilDOMContentLoaded": [ + { + "platforms": [ + "android", + "chromeos", + "chromeos_lacros", + "ios", + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "DeprioritizeTimersUntilDOMContentLoaded_20211112", + "params": { + "DeprioritizeDOMTimersPhase": "ondomcontentloaded" + }, + "enable_features": [ + "DeprioritizeDOMTimersDuringPageLoading" + ] + } + ] + } + ], "DesktopBookmarksBarAppShortcut": [ { "platforms": [
diff --git a/third_party/.gitignore b/third_party/.gitignore index dd76f75..940e1fb 100644 --- a/third_party/.gitignore +++ b/third_party/.gitignore
@@ -101,7 +101,6 @@ /glfw/src /gn/ /gnu_binutils/ -/google_appengine_cloudstorage /google_benchmark/src /google_toolbox_for_mac/src /googlemac
diff --git a/third_party/blink/public/mojom/webauthn/authenticator.mojom b/third_party/blink/public/mojom/webauthn/authenticator.mojom index c93c05a1..ed9f764de 100644 --- a/third_party/blink/public/mojom/webauthn/authenticator.mojom +++ b/third_party/blink/public/mojom/webauthn/authenticator.mojom
@@ -528,6 +528,10 @@ // migration. // https://groups.google.com/a/chromium.org/g/blink-dev/c/xHC3AtU_65A bool google_legacy_app_id_support = false; + + // Whether the minPinLength extension was set to true. + // https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-minpinlength-extension + bool min_pin_length_requested = false; }; enum PublicKeyCredentialType {
diff --git a/third_party/blink/renderer/bindings/bindings.gni b/third_party/blink/renderer/bindings/bindings.gni index 77e4162..5a20cf8f 100644 --- a/third_party/blink/renderer/bindings/bindings.gni +++ b/third_party/blink/renderer/bindings/bindings.gni
@@ -100,8 +100,6 @@ "core/v8/script_promise_resolver.h", "core/v8/script_regexp.cc", "core/v8/script_regexp.h", - "core/v8/script_source_code.cc", - "core/v8/script_source_code.h", "core/v8/script_source_location_type.h", "core/v8/script_streamer.cc", "core/v8/script_streamer.h",
diff --git a/third_party/blink/renderer/bindings/core/v8/activity_logger_test.cc b/third_party/blink/renderer/bindings/core/v8/activity_logger_test.cc index 40a4725b..2aadbd7 100644 --- a/third_party/blink/renderer/bindings/core/v8/activity_logger_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/activity_logger_test.cc
@@ -5,7 +5,6 @@ #include "base/memory/ptr_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/web_cache.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" #include "third_party/blink/renderer/core/frame/frame_test_helpers.h" @@ -90,14 +89,14 @@ } void ExecuteScriptInMainWorld(const String& script) const { - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(script)) - ->RunScript(local_frame_->DomWindow()); + ClassicScript::CreateUnspecifiedScript(script)->RunScript( + local_frame_->DomWindow()); PumpPendingRequestsForFrameToLoad(web_view_helper_.LocalMainFrame()); } void ExecuteScriptInIsolatedWorld(const String& script) const { v8::HandleScope scope(v8::Isolate::GetCurrent()); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(script)) + ClassicScript::CreateUnspecifiedScript(script) ->RunScriptInIsolatedWorldAndReturnValue(local_frame_->DomWindow(), kIsolatedWorldId); PumpPendingRequestsForFrameToLoad(web_view_helper_.LocalMainFrame());
diff --git a/third_party/blink/renderer/bindings/core/v8/custom/v8_window_custom.cc b/third_party/blink/renderer/bindings/core/v8/custom/v8_window_custom.cc index 2a4197e0..50a0ad1 100644 --- a/third_party/blink/renderer/bindings/core/v8/custom/v8_window_custom.cc +++ b/third_party/blink/renderer/bindings/core/v8/custom/v8_window_custom.cc
@@ -33,7 +33,6 @@ #include "third_party/blink/renderer/bindings/core/v8/binding_security.h" #include "third_party/blink/renderer/bindings/core/v8/js_based_event_listener.h" #include "third_party/blink/renderer/bindings/core/v8/script_controller.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_event.h" #include "third_party/blink/renderer/bindings/core/v8/v8_html_collection.h"
diff --git a/third_party/blink/renderer/bindings/core/v8/module_record_test.cc b/third_party/blink/renderer/bindings/core/v8/module_record_test.cc index 2820a117..61a8c2e 100644 --- a/third_party/blink/renderer/bindings/core/v8/module_record_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/module_record_test.cc
@@ -10,7 +10,6 @@ #include "third_party/blink/renderer/bindings/core/v8/module_request.h" #include "third_party/blink/renderer/bindings/core/v8/script_function.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" #include "third_party/blink/renderer/core/frame/local_frame.h" @@ -281,7 +280,7 @@ .GetResultType(), ScriptEvaluationResult::ResultType::kSuccess); v8::Local<v8::Value> value = - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode("window.foo")) + ClassicScript::CreateUnspecifiedScript("window.foo") ->RunScriptAndReturnValue(&scope.GetWindow()); ASSERT_TRUE(value->IsString()); EXPECT_EQ("bar", ToCoreString(v8::Local<v8::String>::Cast(value)));
diff --git a/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc b/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc index d85b100..841b78ed 100644 --- a/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc +++ b/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc
@@ -33,7 +33,6 @@ #include "third_party/blink/public/mojom/web_feature/web_feature.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/binding_security.h" #include "third_party/blink/renderer/bindings/core/v8/script_evaluation_result.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_function.h" @@ -147,11 +146,12 @@ // TODO(crbug.com/1133238): Plumb base URL etc. from the initializing script. DVLOG(1) << "ScheduledAction::execute " << this << ": executing from source"; v8::HandleScope scope(script_state_->GetIsolate()); - ClassicScript* script = MakeGarbageCollected<ClassicScript>( - ScriptSourceCode(code_, - ScriptSourceLocationType::kEvalForScheduledAction), - KURL(), ScriptFetchOptions(), SanitizeScriptErrors::kDoNotSanitize); - script->RunScriptOnScriptStateAndReturnValue(script_state_->Get()); + ClassicScript* script = + ClassicScript::Create(code_, KURL(), KURL(), ScriptFetchOptions(), + ScriptSourceLocationType::kEvalForScheduledAction, + SanitizeScriptErrors::kDoNotSanitize); + ignore_result( + script->RunScriptOnScriptStateAndReturnValue(script_state_->Get())); } void ScheduledAction::Trace(Visitor* visitor) const {
diff --git a/third_party/blink/renderer/bindings/core/v8/script_controller.cc b/third_party/blink/renderer/bindings/core/v8/script_controller.cc index 6afb237..8530b5d 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_controller.cc +++ b/third_party/blink/renderer/bindings/core/v8/script_controller.cc
@@ -36,7 +36,6 @@ #include <utility> #include "base/callback_helpers.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" #include "third_party/blink/renderer/bindings/core/v8/v8_script_runner.h" @@ -205,9 +204,10 @@ // // We pass |SanitizeScriptErrors::kDoNotSanitize| because |muted errors| is // false by default. - ClassicScript* script = MakeGarbageCollected<ClassicScript>( - ScriptSourceCode(script_source, ScriptSourceLocationType::kJavascriptUrl), - base_url, ScriptFetchOptions(), SanitizeScriptErrors::kDoNotSanitize); + ClassicScript* script = ClassicScript::Create( + script_source, KURL(), base_url, ScriptFetchOptions(), + ScriptSourceLocationType::kJavascriptUrl, + SanitizeScriptErrors::kDoNotSanitize); DCHECK_EQ(&window_->GetScriptController(), this); v8::HandleScope handle_scope(GetIsolate());
diff --git a/third_party/blink/renderer/bindings/core/v8/script_source_code.cc b/third_party/blink/renderer/bindings/core/v8/script_source_code.cc deleted file mode 100644 index 73dd9c0..0000000 --- a/third_party/blink/renderer/bindings/core/v8/script_source_code.cc +++ /dev/null
@@ -1,116 +0,0 @@ -// Copyright 2015 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/bindings/core/v8/script_source_code.h" - -#include "base/feature_list.h" -#include "third_party/blink/renderer/core/loader/resource/script_resource.h" -#include "third_party/blink/renderer/platform/loader/fetch/url_loader/cached_metadata_handler.h" - -namespace blink { - -namespace { - -ParkableString TreatNullSourceAsEmpty(const ParkableString& source) { - // ScriptSourceCode allows for the representation of the null/not-there-really - // ScriptSourceCode value. Encoded by way of a source_.IsNull() being true, - // with the nullary constructor to be used to construct such a value. - // - // Should the other constructors be passed a null string, that is interpreted - // as representing the empty script. Consequently, we need to disambiguate - // between such null string occurrences. Do that by converting the latter - // case's null strings into empty ones. - if (source.IsNull()) - return ParkableString(); - - return source; -} - -KURL StripFragmentIdentifier(const KURL& url) { - if (url.IsEmpty()) - return KURL(); - - if (!url.HasFragmentIdentifier()) - return url; - - KURL copy = url; - copy.RemoveFragmentIdentifier(); - return copy; -} - -String SourceMapUrlFromResponse(const ResourceResponse& response) { - String source_map_url = response.HttpHeaderField(http_names::kSourceMap); - if (!source_map_url.IsEmpty()) - return source_map_url; - - // Try to get deprecated header. - return response.HttpHeaderField(http_names::kXSourceMap); -} - -} // namespace - -ScriptSourceCode::ScriptSourceCode( - const ParkableString& source, - ScriptSourceLocationType source_location_type, - SingleCachedMetadataHandler* cache_handler, - const KURL& url, - const TextPosition& start_position) - : source_(TreatNullSourceAsEmpty(source)), - cache_handler_(cache_handler), - not_streaming_reason_(ScriptStreamer::NotStreamingReason::kInlineScript), - url_(StripFragmentIdentifier(url)), - start_position_(start_position), - source_location_type_(source_location_type) { - // External files should use a ScriptResource. - DCHECK(source_location_type != ScriptSourceLocationType::kExternalFile); -} - -ScriptSourceCode::ScriptSourceCode( - const String& source, - ScriptSourceLocationType source_location_type, - SingleCachedMetadataHandler* cache_handler, - const KURL& url, - const TextPosition& start_position) - : ScriptSourceCode(ParkableString(source.Impl()), - source_location_type, - cache_handler, - url, - start_position) {} - -ScriptSourceCode::ScriptSourceCode(ScriptStreamer* streamer, - ScriptCacheConsumer* cache_consumer, - ScriptResource* resource, - ScriptStreamer::NotStreamingReason reason) - : source_(TreatNullSourceAsEmpty(resource->SourceText())), - cache_handler_(resource->CacheHandler()), - streamer_(streamer), - cache_consumer_(cache_consumer), - not_streaming_reason_(reason), - url_(StripFragmentIdentifier(resource->Url())), - source_map_url_(SourceMapUrlFromResponse(resource->GetResponse())), - start_position_(TextPosition::MinimumPosition()), - source_location_type_(ScriptSourceLocationType::kExternalFile) { - DCHECK_EQ(!streamer, reason != ScriptStreamer::NotStreamingReason::kInvalid); -} - -ScriptSourceCode::ScriptSourceCode(const String& source, - SingleCachedMetadataHandler* cache_handler, - const KURL& url) - : source_(TreatNullSourceAsEmpty(ParkableString(source.Impl()))), - cache_handler_(cache_handler), - not_streaming_reason_( - ScriptStreamer::NotStreamingReason::kWorkerTopLevelScript), - url_(url), - start_position_(TextPosition::MinimumPosition()), - source_location_type_(ScriptSourceLocationType::kUnknown) {} - -ScriptSourceCode::~ScriptSourceCode() = default; - -void ScriptSourceCode::Trace(Visitor* visitor) const { - visitor->Trace(cache_handler_); - visitor->Trace(streamer_); - visitor->Trace(cache_consumer_); -} - -} // namespace blink
diff --git a/third_party/blink/renderer/bindings/core/v8/script_source_code.h b/third_party/blink/renderer/bindings/core/v8/script_source_code.h deleted file mode 100644 index 989bc00..0000000 --- a/third_party/blink/renderer/bindings/core/v8/script_source_code.h +++ /dev/null
@@ -1,132 +0,0 @@ -/* - * Copyright (C) 2008, 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_SCRIPT_SOURCE_CODE_H_ -#define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_SCRIPT_SOURCE_CODE_H_ - -#include "third_party/blink/renderer/bindings/core/v8/script_source_location_type.h" -#include "third_party/blink/renderer/bindings/core/v8/script_streamer.h" -#include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/platform/bindings/parkable_string.h" -#include "third_party/blink/renderer/platform/heap/handle.h" -#include "third_party/blink/renderer/platform/weborigin/kurl.h" -#include "third_party/blink/renderer/platform/wtf/text/text_position.h" -#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" - -namespace blink { - -class ScriptResource; -class ScriptCacheConsumer; -class SingleCachedMetadataHandler; - -class CORE_EXPORT ScriptSourceCode final { - DISALLOW_NEW(); - - public: - // For inline scripts. - ScriptSourceCode( - const String& source, - ScriptSourceLocationType = ScriptSourceLocationType::kUnknown, - SingleCachedMetadataHandler* = nullptr, - const KURL& = KURL(), - const TextPosition& = TextPosition::MinimumPosition()); - - // For external scripts. - // - // We lose the encoding information from ScriptResource. - // Not sure if that matters. - ScriptSourceCode(ScriptStreamer*, - ScriptCacheConsumer*, - ScriptResource*, - ScriptStreamer::NotStreamingReason); - - // For (external) worker scripts. Leaves url fragment intact. - // - // If we move worker top-level script fetch to the worker thread, this could - // probably be merged in to the main external script constructor. - // - // NOTE: It is import to keep the url fragment in this case so that errors in - // worker scripts can include the fragment when reporting the location of the - // failure. This is enforced by several tests in - // external/wpt/workers/interfaces/WorkerGlobalScope/onerror/. - ScriptSourceCode(const String& source, - SingleCachedMetadataHandler*, - const KURL&); - - ~ScriptSourceCode(); - void Trace(Visitor*) const; - - const ParkableString& Source() const { return source_; } - SingleCachedMetadataHandler* CacheHandler() const { return cache_handler_; } - const KURL& Url() const { return url_; } - const TextPosition& StartPosition() const { return start_position_; } - ScriptSourceLocationType SourceLocationType() const { - return source_location_type_; - } - const String& SourceMapUrl() const { return source_map_url_; } - - ScriptStreamer* Streamer() const { return streamer_; } - ScriptStreamer::NotStreamingReason NotStreamingReason() const { - return not_streaming_reason_; - } - - ScriptCacheConsumer* CacheConsumer() const { return cache_consumer_; } - - private: - ScriptSourceCode( - const ParkableString& source, - ScriptSourceLocationType = ScriptSourceLocationType::kUnknown, - SingleCachedMetadataHandler* cache_handler = nullptr, - const KURL& = KURL(), - const TextPosition& start_position = TextPosition::MinimumPosition()); - - const ParkableString source_; - Member<SingleCachedMetadataHandler> cache_handler_; - Member<ScriptStreamer> streamer_; - Member<ScriptCacheConsumer> cache_consumer_; - ScriptStreamer::NotStreamingReason not_streaming_reason_; - - // The URL of the source code, which is primarily intended for DevTools - // javascript debugger. - // - // Note that this can be different from the resulting script's base URL - // (#concept-script-base-url) for inline classic scripts. - const KURL url_; - - const String source_map_url_; - const TextPosition start_position_; - const ScriptSourceLocationType source_location_type_; -}; - -} // namespace blink - -WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::ScriptSourceCode) - -#endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_SCRIPT_SOURCE_CODE_H_
diff --git a/third_party/blink/renderer/bindings/core/v8/script_source_location_type.h b/third_party/blink/renderer/bindings/core/v8/script_source_location_type.h index afde4e29..29cf942 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_source_location_type.h +++ b/third_party/blink/renderer/bindings/core/v8/script_source_location_type.h
@@ -32,9 +32,8 @@ // by the parser. kInlineInsideGeneratedElement, - // Other values. Never have a ScriptResource and the corresponding - // ScriptSourceCode or source string is created outside of - // ClassicPendingScript. + // Other values. Never have a ScriptResource and source string is created + // outside of ClassicPendingScript. // A chrome-internal source. kInternal,
diff --git a/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc b/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc index 4ce0beb..6e5f2d38f 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc
@@ -19,7 +19,6 @@ #include "third_party/blink/public/platform/web_url_loader_mock_factory.h" #include "third_party/blink/public/platform/web_url_request_extra_data.h" #include "third_party/blink/renderer/bindings/core/v8/referrer_script_info.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" #include "third_party/blink/renderer/bindings/core/v8/v8_code_cache.h" @@ -174,16 +173,17 @@ ScriptCacheConsumer* cache_consumer = resource_->TakeCacheConsumer(); if (streamer) { if (streamer->IsStreamingSuppressed()) { - return ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(nullptr, cache_consumer, resource_, - streamer->StreamingSuppressedReason())); + return ClassicScript::CreateFromResource( + resource_, KURL(), ScriptFetchOptions(), nullptr, + streamer->StreamingSuppressedReason(), cache_consumer); } - return ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(streamer, cache_consumer, resource_, - ScriptStreamer::NotStreamingReason::kInvalid)); + return ClassicScript::CreateFromResource( + resource_, KURL(), ScriptFetchOptions(), streamer, + ScriptStreamer::NotStreamingReason::kInvalid, cache_consumer); } - return ClassicScript::CreateUnspecifiedScript(ScriptSourceCode( - nullptr, cache_consumer, resource_, resource_->NoStreamerReason())); + return ClassicScript::CreateFromResource( + resource_, KURL(), ScriptFetchOptions(), nullptr, + resource_->NoStreamerReason(), cache_consumer); } Settings* GetSettings() const { @@ -260,7 +260,7 @@ RunUntilResourceLoaded(); EXPECT_TRUE(resource_client_->Finished()); ClassicScript* classic_script = CreateClassicScript(); - EXPECT_TRUE(classic_script->GetScriptSourceCode().Streamer()); + EXPECT_TRUE(classic_script->Streamer()); v8::TryCatch try_catch(scope.GetIsolate()); v8::Local<v8::Script> script; v8::Local<v8::Data> host_defined_options; @@ -295,7 +295,7 @@ RunUntilResourceLoaded(); EXPECT_TRUE(resource_client_->Finished()); ClassicScript* classic_script = CreateClassicScript(); - EXPECT_TRUE(classic_script->GetScriptSourceCode().Streamer()); + EXPECT_TRUE(classic_script->Streamer()); v8::TryCatch try_catch(scope.GetIsolate()); v8::Local<v8::Script> script; v8::Local<v8::Data> host_defined_options; @@ -387,10 +387,10 @@ EXPECT_TRUE(resource_client_->Finished()); ClassicScript* classic_script = CreateClassicScript(); - // ScriptSourceCode doesn't refer to the streamer, since we have suppressed + // ClassicScript doesn't refer to the streamer, since we have suppressed // the streaming and resumed the non-streaming code path for script // compilation. - EXPECT_FALSE(classic_script->GetScriptSourceCode().Streamer()); + EXPECT_FALSE(classic_script->Streamer()); } TEST_F(ScriptStreamingTest, EmptyScripts) { @@ -405,7 +405,7 @@ EXPECT_TRUE(resource_client_->Finished()); ClassicScript* classic_script = CreateClassicScript(); - EXPECT_FALSE(classic_script->GetScriptSourceCode().Streamer()); + EXPECT_FALSE(classic_script->Streamer()); } TEST_F(ScriptStreamingTest, SmallScripts) { @@ -423,7 +423,7 @@ EXPECT_TRUE(resource_client_->Finished()); ClassicScript* classic_script = CreateClassicScript(); - EXPECT_FALSE(classic_script->GetScriptSourceCode().Streamer()); + EXPECT_FALSE(classic_script->Streamer()); } TEST_F(ScriptStreamingTest, ScriptsWithSmallFirstChunk) { @@ -447,7 +447,7 @@ RunUntilResourceLoaded(); EXPECT_TRUE(resource_client_->Finished()); ClassicScript* classic_script = CreateClassicScript(); - EXPECT_TRUE(classic_script->GetScriptSourceCode().Streamer()); + EXPECT_TRUE(classic_script->Streamer()); v8::TryCatch try_catch(scope.GetIsolate()); v8::Local<v8::Script> script; v8::Local<v8::Data> host_defined_options; @@ -481,7 +481,7 @@ RunUntilResourceLoaded(); EXPECT_TRUE(resource_client_->Finished()); ClassicScript* classic_script = CreateClassicScript(); - EXPECT_TRUE(classic_script->GetScriptSourceCode().Streamer()); + EXPECT_TRUE(classic_script->Streamer()); v8::TryCatch try_catch(scope.GetIsolate()); v8::Local<v8::Script> script; v8::Local<v8::Data> host_defined_options; @@ -516,7 +516,7 @@ RunUntilResourceLoaded(); EXPECT_TRUE(resource_client_->Finished()); ClassicScript* classic_script = CreateClassicScript(); - EXPECT_TRUE(classic_script->GetScriptSourceCode().Streamer()); + EXPECT_TRUE(classic_script->Streamer()); v8::TryCatch try_catch(scope.GetIsolate()); v8::Local<v8::Script> script; v8::Local<v8::Data> host_defined_options;
diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc index 847223d..0974ffb 100644 --- a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc
@@ -9,7 +9,6 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/web_blob_info.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/unpacked_serialized_script_value.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_deserializer.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" @@ -111,7 +110,7 @@ } v8::Local<v8::Value> Eval(const String& source, V8TestingScope& scope) { - return ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source)) + return ClassicScript::CreateUnspecifiedScript(source) ->RunScriptAndReturnValue(&scope.GetWindow()); }
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc b/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc index 0e82369..cc59853 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc
@@ -10,7 +10,6 @@ #include "third_party/blink/public/web/web_settings.h" #include "third_party/blink/renderer/bindings/core/v8/module_record.h" #include "third_party/blink/renderer/bindings/core/v8/referrer_script_info.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_initializer.h" #include "third_party/blink/renderer/core/inspector/inspector_trace_events.h" @@ -105,10 +104,9 @@ v8::ScriptCompiler::NoCacheReason> V8CodeCache::GetCompileOptions(mojom::blink::V8CacheOptions cache_options, const ClassicScript& classic_script) { - const ScriptSourceCode& source = classic_script.GetScriptSourceCode(); - return GetCompileOptions(cache_options, source.CacheHandler(), - source.Source().length(), - source.SourceLocationType()); + return GetCompileOptions(cache_options, classic_script.CacheHandler(), + classic_script.SourceText().length(), + classic_script.SourceLocationType()); } std::tuple<v8::ScriptCompiler::CompileOptions,
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_gc_controller.cc b/third_party/blink/renderer/bindings/core/v8/v8_gc_controller.cc index 99cb0f3..b82a10d9 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_gc_controller.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_gc_controller.cc
@@ -35,7 +35,6 @@ #include "third_party/blink/public/platform/blame_context.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/bindings/core/v8/active_script_wrappable.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_node.h" #include "third_party/blink/renderer/bindings/core/v8/v8_script_runner.h"
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc b/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc index 76c5906..d33bfaf6 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc
@@ -34,7 +34,6 @@ #include "third_party/blink/renderer/bindings/core/v8/script_cache_consumer.h" #include "third_party/blink/renderer/bindings/core/v8/script_evaluation_result.h" #include "third_party/blink/renderer/bindings/core/v8/script_function.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/script_streamer.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_code_cache.h" @@ -122,13 +121,11 @@ v8::ScriptCompiler::NoCacheReason no_cache_reason, absl::optional<inspector_compile_script_event::V8ConsumeCacheResult>* cache_result) { - v8::Local<v8::String> code = - V8String(isolate, classic_script.GetScriptSourceCode().Source()); + v8::Local<v8::String> code = V8String(isolate, classic_script.SourceText()); // TODO(kouhei): Plumb the ScriptState into this function and replace all // Isolate->GetCurrentContext in this function with ScriptState->GetContext. - if (ScriptStreamer* streamer = - classic_script.GetScriptSourceCode().Streamer()) { + if (ScriptStreamer* streamer = classic_script.Streamer()) { // Final compile call for a streamed compilation. // Streaming compilation may involve use of code cache. // TODO(leszeks): Add compile timer to streaming compilation. @@ -166,9 +163,8 @@ case v8::ScriptCompiler::kConsumeCodeCache: { // Compile a script, and consume a V8 cache that was generated previously. SingleCachedMetadataHandler* cache_handler = - classic_script.GetScriptSourceCode().CacheHandler(); - ScriptCacheConsumer* cache_consumer = - classic_script.GetScriptSourceCode().CacheConsumer(); + classic_script.CacheHandler(); + ScriptCacheConsumer* cache_consumer = classic_script.CacheConsumer(); scoped_refptr<CachedMetadata> cached_metadata = V8CodeCache::GetCachedMetadata(cache_handler); v8::ScriptCompiler::Source source( @@ -234,15 +230,13 @@ v8::ScriptCompiler::NoCacheReason no_cache_reason, v8::Local<v8::Data> host_defined_options) { v8::Isolate* isolate = script_state->GetIsolate(); - if (classic_script.GetScriptSourceCode().Source().length() >= - v8::String::kMaxLength) { + if (classic_script.SourceText().length() >= v8::String::kMaxLength) { V8ThrowException::ThrowError(isolate, "Source file too large."); return v8::Local<v8::Script>(); } - const String& file_name = classic_script.GetScriptSourceCode().Url(); - const TextPosition& script_start_position = - classic_script.GetScriptSourceCode().StartPosition(); + const String& file_name = classic_script.SourceUrl(); + const TextPosition& script_start_position = classic_script.StartPosition(); constexpr const char* kTraceEventCategoryGroup = "v8,devtools.timeline"; TRACE_EVENT_BEGIN1(kTraceEventCategoryGroup, "v8.compile", "fileName", @@ -255,14 +249,14 @@ const SanitizeScriptErrors sanitize_script_errors = classic_script.GetSanitizeScriptErrors(); - // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at + // NOTE: For compatibility with WebCore, ClassicScript's line starts at // 1, whereas v8 starts at 0. v8::ScriptOrigin origin( isolate, V8String(isolate, file_name), script_start_position.line_.ZeroBasedInt(), script_start_position.column_.ZeroBasedInt(), sanitize_script_errors == SanitizeScriptErrors::kDoNotSanitize, -1, - V8String(isolate, classic_script.GetScriptSourceCode().SourceMapUrl()), + V8String(isolate, classic_script.SourceMapUrl()), sanitize_script_errors == SanitizeScriptErrors::kSanitize, false, // is_wasm false, // is_module @@ -284,8 +278,7 @@ inspector_compile_script_event::Data( std::move(context), file_name, script_start_position, cache_result, compile_options == v8::ScriptCompiler::kEagerCompile, - classic_script.GetScriptSourceCode().Streamer(), - classic_script.GetScriptSourceCode().NotStreamingReason()); + classic_script.Streamer(), classic_script.NotStreamingReason()); }); return script; } @@ -479,7 +472,6 @@ } v8::Isolate* isolate = script_state->GetIsolate(); - const ScriptSourceCode& source = classic_script->GetScriptSourceCode(); const SanitizeScriptErrors sanitize_script_errors = classic_script->GetSanitizeScriptErrors(); @@ -504,7 +496,7 @@ DEVTOOLS_TIMELINE_TRACE_EVENT( "EvaluateScript", inspector_evaluate_script_event::Data, frame, - source.Url().GetString(), source.StartPosition()); + classic_script->SourceUrl().GetString(), classic_script->StartPosition()); // Scope for |v8::TryCatch|. { @@ -524,14 +516,14 @@ v8::Local<v8::Script> script; - if (source.CacheHandler()) { - source.CacheHandler()->Check( + if (classic_script->CacheHandler()) { + classic_script->CacheHandler()->Check( ExecutionContext::GetCodeCacheHostFromContext(execution_context), - source.Source()); + classic_script->SourceText()); } v8::Local<v8::Data> host_defined_options = - referrer_info.ToV8HostDefinedOptions( - isolate, classic_script->GetScriptSourceCode().Url()); + referrer_info.ToV8HostDefinedOptions(isolate, + classic_script->SourceUrl()); v8::ScriptCompiler::CompileOptions compile_options; V8CodeCache::ProduceCacheOptions produce_cache_options; v8::ScriptCompiler::NoCacheReason no_cache_reason; @@ -572,16 +564,18 @@ // script state as a weak persistent. WrapPersistent(script_state), v8::Global<v8::Script>(isolate, script), - WrapPersistent(source.CacheHandler()), - source.Source().length(), source.Url(), - source.StartPosition()), + WrapPersistent(classic_script->CacheHandler()), + classic_script->SourceText().length(), + classic_script->SourceUrl(), + classic_script->StartPosition()), delay); } else { V8CodeCache::ProduceCache( isolate, ExecutionContext::GetCodeCacheHostFromContext(execution_context), - script, source.CacheHandler(), source.Source().length(), - source.Url(), source.StartPosition(), produce_cache_options); + script, classic_script->CacheHandler(), + classic_script->SourceText().length(), classic_script->SourceUrl(), + classic_script->StartPosition(), produce_cache_options); } } @@ -651,11 +645,10 @@ const ClassicScript& classic_script) { DCHECK_EQ(isolate, script_state->GetIsolate()); - const ScriptSourceCode& source_code = classic_script.GetScriptSourceCode(); const ReferrerScriptInfo referrer_info(classic_script.BaseURL(), classic_script.FetchOptions()); v8::Local<v8::Data> host_defined_options = - referrer_info.ToV8HostDefinedOptions(isolate, source_code.Url()); + referrer_info.ToV8HostDefinedOptions(isolate, classic_script.SourceUrl()); v8::ScriptCompiler::CompileOptions compile_options; V8CodeCache::ProduceCacheOptions produce_cache_options;
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_script_runner_test.cc b/third_party/blink/renderer/bindings/core/v8/v8_script_runner_test.cc index 3018bd2..7feeed3b 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_script_runner_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_script_runner_test.cc
@@ -11,7 +11,6 @@ #include "third_party/blink/public/common/features.h" #include "third_party/blink/renderer/bindings/core/v8/referrer_script_info.h" #include "third_party/blink/renderer/bindings/core/v8/script_cache_consumer_client.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" #include "third_party/blink/renderer/bindings/core/v8/v8_code_cache.h" @@ -77,11 +76,10 @@ const ClassicScript& classic_script, mojom::blink::V8CacheOptions cache_options) { ExecutionContext* execution_context = ExecutionContext::From(script_state); - const ScriptSourceCode& source_code = classic_script.GetScriptSourceCode(); - if (source_code.CacheHandler()) { - source_code.CacheHandler()->Check( + if (classic_script.CacheHandler()) { + classic_script.CacheHandler()->Check( ExecutionContext::GetCodeCacheHostFromContext(execution_context), - source_code.Source()); + classic_script.SourceText()); } v8::ScriptCompiler::CompileOptions compile_options; V8CodeCache::ProduceCacheOptions produce_cache_options; @@ -98,9 +96,9 @@ V8CodeCache::ProduceCache( isolate, ExecutionContext::GetCodeCacheHostFromContext(execution_context), - compiled_script.ToLocalChecked(), source_code.CacheHandler(), - source_code.Source().length(), source_code.Url(), - source_code.StartPosition(), produce_cache_options); + compiled_script.ToLocalChecked(), classic_script.CacheHandler(), + classic_script.SourceText().length(), classic_script.SourceUrl(), + classic_script.StartPosition(), produce_cache_options); return true; } @@ -111,11 +109,10 @@ v8::ScriptCompiler::NoCacheReason no_cache_reason, V8CodeCache::ProduceCacheOptions produce_cache_options) { ExecutionContext* execution_context = ExecutionContext::From(script_state); - const ScriptSourceCode& source_code = classic_script.GetScriptSourceCode(); - if (source_code.CacheHandler()) { - source_code.CacheHandler()->Check( + if (classic_script.CacheHandler()) { + classic_script.CacheHandler()->Check( ExecutionContext::GetCodeCacheHostFromContext(execution_context), - source_code.Source()); + classic_script.SourceText()); } v8::Local<v8::Data> host_defined_options; v8::MaybeLocal<v8::Script> compiled_script = V8ScriptRunner::CompileScript( @@ -127,9 +124,9 @@ V8CodeCache::ProduceCache( isolate, ExecutionContext::GetCodeCacheHostFromContext(execution_context), - compiled_script.ToLocalChecked(), source_code.CacheHandler(), - source_code.Source().length(), source_code.Url(), - source_code.StartPosition(), produce_cache_options); + compiled_script.ToLocalChecked(), classic_script.CacheHandler(), + classic_script.SourceText().length(), classic_script.SourceUrl(), + classic_script.StartPosition(), produce_cache_options); return true; } @@ -170,9 +167,9 @@ ClassicScript* CreateScript(ScriptResource* resource, ScriptCacheConsumer* cache_consumer = nullptr) { - return ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(nullptr, cache_consumer, resource, - ScriptStreamer::NotStreamingReason::kScriptTooSmall)); + return ClassicScript::CreateFromResource( + resource, KURL(), ScriptFetchOptions(), nullptr, + ScriptStreamer::NotStreamingReason::kScriptTooSmall, cache_consumer); } Vector<uint8_t> CreateCachedData() { @@ -182,7 +179,7 @@ // Set timestamp to simulate a warm run. ScriptCachedMetadataHandler* cache_handler = static_cast<ScriptCachedMetadataHandler*>( - classic_script->GetScriptSourceCode().CacheHandler()); + classic_script->CacheHandler()); ExecutionContext* execution_context = ExecutionContext::From(scope.GetScriptState()); SetCacheTimeStamp( @@ -256,9 +253,9 @@ TEST_F(V8ScriptRunnerTest, resourcelessShouldPass) { V8TestingScope scope; - ClassicScript* classic_script = ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(Code(), ScriptSourceLocationType::kInternal, - nullptr /* cache_handler */, Url())); + ClassicScript* classic_script = + ClassicScript::Create(Code(), Url(), Url(), ScriptFetchOptions(), + ScriptSourceLocationType::kInternal); EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), *classic_script, mojom::blink::V8CacheOptions::kNone)); @@ -275,8 +272,7 @@ TEST_F(V8ScriptRunnerTest, codeOption) { V8TestingScope scope; ClassicScript* classic_script = CreateScript(CreateResource(UTF8Encoding())); - SingleCachedMetadataHandler* cache_handler = - classic_script->GetScriptSourceCode().CacheHandler(); + SingleCachedMetadataHandler* cache_handler = classic_script->CacheHandler(); ExecutionContext* execution_context = ExecutionContext::From(scope.GetScriptState()); SetCacheTimeStamp( @@ -301,8 +297,7 @@ V8TestingScope scope; ClassicScript* classic_script = CreateScript(CreateResource(UTF8Encoding())); // Set timestamp to simulate a warm run. - SingleCachedMetadataHandler* cache_handler = - classic_script->GetScriptSourceCode().CacheHandler(); + SingleCachedMetadataHandler* cache_handler = classic_script->CacheHandler(); ExecutionContext* execution_context = ExecutionContext::From(scope.GetScriptState()); SetCacheTimeStamp( @@ -340,8 +335,7 @@ V8TestingScope scope; ClassicScript* classic_script = CreateScript(CreateResource(UTF8Encoding())); // Set timestamp to simulate a warm run. - SingleCachedMetadataHandler* cache_handler = - classic_script->GetScriptSourceCode().CacheHandler(); + SingleCachedMetadataHandler* cache_handler = classic_script->CacheHandler(); ExecutionContext* execution_context = ExecutionContext::From(scope.GetScriptState()); SetCacheTimeStamp( @@ -387,8 +381,7 @@ blink::features::kDiscardCodeCacheAfterFirstUse); V8TestingScope scope; ClassicScript* classic_script = CreateScript(CreateResource(UTF8Encoding())); - SingleCachedMetadataHandler* cache_handler = - classic_script->GetScriptSourceCode().CacheHandler(); + SingleCachedMetadataHandler* cache_handler = classic_script->CacheHandler(); // Cold run - should set the timestamp. EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), @@ -426,8 +419,7 @@ blink::features::kDiscardCodeCacheAfterFirstUse); V8TestingScope scope; ClassicScript* classic_script = CreateScript(CreateResource(UTF8Encoding())); - SingleCachedMetadataHandler* cache_handler = - classic_script->GetScriptSourceCode().CacheHandler(); + SingleCachedMetadataHandler* cache_handler = classic_script->CacheHandler(); // Cold run - should set the timestamp. EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), @@ -466,8 +458,7 @@ blink::features::kDiscardCodeCacheAfterFirstUse); V8TestingScope scope; ClassicScript* classic_script = CreateScript(CreateResource(UTF8Encoding())); - SingleCachedMetadataHandler* cache_handler = - classic_script->GetScriptSourceCode().CacheHandler(); + SingleCachedMetadataHandler* cache_handler = classic_script->CacheHandler(); base::HistogramTester tester; HistogramCounter counter(tester); EXPECT_FALSE( @@ -481,8 +472,7 @@ blink::features::kDiscardCodeCacheAfterFirstUse); V8TestingScope scope; ClassicScript* classic_script = CreateScript(CreateResource(UTF8Encoding())); - SingleCachedMetadataHandler* cache_handler = - classic_script->GetScriptSourceCode().CacheHandler(); + SingleCachedMetadataHandler* cache_handler = classic_script->CacheHandler(); EXPECT_FALSE( cache_handler->GetCachedMetadata(TagForTimeStamp(cache_handler))); EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), @@ -505,8 +495,7 @@ "codecachewithhashing"); code_cache_with_hashing_scheme_ = true; ClassicScript* classic_script = CreateScript(CreateResource(UTF8Encoding())); - SingleCachedMetadataHandler* cache_handler = - classic_script->GetScriptSourceCode().CacheHandler(); + SingleCachedMetadataHandler* cache_handler = classic_script->CacheHandler(); EXPECT_TRUE(cache_handler->HashRequired()); // Cold run - should set the timestamp. @@ -550,7 +539,7 @@ CreateScript(CreateResource(UTF8Encoding())); ScriptCachedMetadataHandlerWithHashing* cache_handler_1 = static_cast<ScriptCachedMetadataHandlerWithHashing*>( - classic_script_1->GetScriptSourceCode().CacheHandler()); + classic_script_1->CacheHandler()); EXPECT_TRUE(cache_handler_1->HashRequired()); // Cold run - should set the timestamp. @@ -568,7 +557,7 @@ UTF8Encoding(), cache_handler_1->GetSerializedCachedMetadata())); ScriptCachedMetadataHandlerWithHashing* cache_handler_2 = static_cast<ScriptCachedMetadataHandlerWithHashing*>( - classic_script_2->GetScriptSourceCode().CacheHandler()); + classic_script_2->CacheHandler()); EXPECT_TRUE(cache_handler_2->HashRequired()); // Warm run - should produce code cache. @@ -585,7 +574,7 @@ DifferentCode())); ScriptCachedMetadataHandlerWithHashing* cache_handler_3 = static_cast<ScriptCachedMetadataHandlerWithHashing*>( - classic_script_3->GetScriptSourceCode().CacheHandler()); + classic_script_3->CacheHandler()); EXPECT_TRUE(cache_handler_3->HashRequired()); // Since the third script's text doesn't match the first two, the hash check @@ -605,7 +594,7 @@ UTF8Encoding(), cache_handler_3->GetSerializedCachedMetadata())); ScriptCachedMetadataHandlerWithHashing* cache_handler_4 = static_cast<ScriptCachedMetadataHandlerWithHashing*>( - classic_script_4->GetScriptSourceCode().CacheHandler()); + classic_script_4->CacheHandler()); EXPECT_TRUE(cache_handler_4->HashRequired()); // Running the original script again once again sets the timestamp since the
diff --git a/third_party/blink/renderer/bindings/modules/v8/v8_element_test.cc b/third_party/blink/renderer/bindings/modules/v8/v8_element_test.cc index 93e5c79..667c619 100644 --- a/third_party/blink/renderer/bindings/modules/v8/v8_element_test.cc +++ b/third_party/blink/renderer/bindings/modules/v8/v8_element_test.cc
@@ -2,7 +2,6 @@ // 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/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" #include "third_party/blink/renderer/core/script/classic_script.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" @@ -29,7 +28,7 @@ }; v8::Local<v8::Value> Eval(const String& source, V8TestingScope& scope) { - return ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source)) + return ClassicScript::CreateUnspecifiedScript(source) ->RunScriptAndReturnValue(&scope.GetWindow()); }
diff --git a/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl b/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl index 20c8df0..38a9baaa 100644 --- a/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl +++ b/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl
@@ -392,14 +392,15 @@ OrderedNamedGridLines ordered_named_grid_lines; NamedGridLinesMap auto_repeat_named_grid_lines; OrderedNamedGridLines auto_repeat_ordered_named_grid_lines; - AutoRepeatType autoRepeatType = ComputedStyleInitialValues::InitialGridAutoRepeatType(); + AutoRepeatType auto_repeat_type = ComputedStyleInitialValues::InitialGridAutoRepeatType(); wtf_size_t auto_repeat_insertion_point = ComputedStyleInitialValues::InitialGridAutoRepeatInsertionPoint(); + GridAxisType grid_axis_type = ComputedStyleInitialValues::InitialGridAxisType(); StyleBuilderConverter::ConvertGridTrackList( value, track_sizes, named_grid_lines, ordered_named_grid_lines, auto_repeat_track_sizes, auto_repeat_named_grid_lines, auto_repeat_ordered_named_grid_lines, auto_repeat_insertion_point, - autoRepeatType, state); + auto_repeat_type, grid_axis_type, state); const NamedGridAreaMap& named_grid_areas = state.Style()->NamedGridArea(); if (!named_grid_areas.IsEmpty()) { StyleBuilderConverter::CreateImplicitNamedGridLinesFromGridArea( @@ -414,7 +415,8 @@ state.Style()->SetAutoRepeatNamedGrid{{type}}Lines(auto_repeat_named_grid_lines); state.Style()->SetAutoRepeatOrderedNamedGrid{{type}}Lines( auto_repeat_ordered_named_grid_lines); - state.Style()->SetGridAutoRepeat{{type}}sType(autoRepeatType); + state.Style()->SetGridAutoRepeat{{type}}sType(auto_repeat_type); + state.Style()->SetGrid{{type}}sAxisType(grid_axis_type); {% endcall %} {% endif %} {%- endmacro %}
diff --git a/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl b/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl index d5b44fc..4a59f9c 100644 --- a/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl +++ b/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl
@@ -48,6 +48,9 @@ static AutoRepeatType InitialGridAutoRepeatType() { return AutoRepeatType::kNoAutoRepeat; } + static GridAxisType InitialGridAxisType() { + return GridAxisType::kStandaloneAxis; + } // FIXME: Remove letter-spacing/word-spacing and replace them with respective // FontBuilder calls.
diff --git a/third_party/blink/renderer/controller/dev_tools_frontend_impl.cc b/third_party/blink/renderer/controller/dev_tools_frontend_impl.cc index 999383d..da695d4 100644 --- a/third_party/blink/renderer/controller/dev_tools_frontend_impl.cc +++ b/third_party/blink/renderer/controller/dev_tools_frontend_impl.cc
@@ -100,7 +100,7 @@ } if (!api_script_.IsEmpty()) { - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(api_script_)) + ClassicScript::CreateUnspecifiedScript(api_script_) ->RunScript(GetSupplementable()->DomWindow()); } }
diff --git a/third_party/blink/renderer/core/css/container_query_test.cc b/third_party/blink/renderer/core/css/container_query_test.cc index 9503376..85bceb03 100644 --- a/third_party/blink/renderer/core/css/container_query_test.cc +++ b/third_party/blink/renderer/core/css/container_query_test.cc
@@ -51,9 +51,12 @@ } PhysicalAxes QueriedAxes(String query) { - ContainerQuery* container_query = ParseContainerQuery(query); - DCHECK(container_query); - return container_query->QueriedAxes(); + // This does not use ParseContainerQuery, since we want to allow queries + // with "unknown" parts. + auto* rule = DynamicTo<StyleRuleContainer>(css_test_helpers::ParseRule( + GetDocument(), "@container " + query + " {}")); + DCHECK(rule); + return rule->GetContainerQuery().QueriedAxes(); } String SerializeCondition(StyleRuleContainer* container) { @@ -132,6 +135,27 @@ EXPECT_FALSE(ParseAtContainer("@container size(width) or size(height) {}")); } +TEST_F(ContainerQueryTest, ValidFeatures) { + // https://drafts.csswg.org/css-contain-3/#size-container + EXPECT_TRUE(ParseAtContainer("@container size(width) {}")); + EXPECT_TRUE(ParseAtContainer("@container size(min-width: 0px) {}")); + EXPECT_TRUE(ParseAtContainer("@container size(max-width: 0px) {}")); + EXPECT_TRUE(ParseAtContainer("@container size(height) {}")); + EXPECT_TRUE(ParseAtContainer("@container size(min-height: 0px) {}")); + EXPECT_TRUE(ParseAtContainer("@container size(max-height: 0px) {}")); + EXPECT_TRUE(ParseAtContainer("@container size(aspect-ratio) {}")); + EXPECT_TRUE(ParseAtContainer("@container size(min-aspect-ratio: 1/2) {}")); + EXPECT_TRUE(ParseAtContainer("@container size(max-aspect-ratio: 1/2) {}")); + EXPECT_TRUE(ParseAtContainer("@container size(orientation: portrait) {}")); + + EXPECT_FALSE(ParseAtContainer("@container (grid) {}")); + EXPECT_FALSE(ParseAtContainer("@container size(color) {}")); + EXPECT_FALSE(ParseAtContainer("@container size(color-index) {}")); + EXPECT_FALSE(ParseAtContainer("@container size(color-index >= 1) {}")); + EXPECT_FALSE(ParseAtContainer("@container size(grid) {}")); + EXPECT_FALSE(ParseAtContainer("@container size(resolution: 150dpi) {}")); +} + TEST_F(ContainerQueryTest, RuleParsing) { StyleRuleContainer* container = ParseAtContainer(R"CSS( @container size(min-width: 100px) { @@ -246,13 +270,14 @@ EXPECT_EQ(both, QueriedAxes("size((width: 1px) and (height: 1px))")); EXPECT_EQ(both, QueriedAxes("size((min-width: 1px) and (max-height: 1px))")); - // TODO(crbug.com/1145970): We want to test the case where no axes are - // queried (kPhysicalAxisNone). This can (for now) be achieved by using - // some media query feature (e.g. "resolution"). Ultimately, using - // "resolution" will not be allowed in @container: we will then need to find - // another way to author a container query that queries no axes (or make it - // illegal altogether). - EXPECT_EQ(none, QueriedAxes("size(resolution: 150dpi)")); + EXPECT_EQ(both, QueriedAxes("size(aspect-ratio: 1/2)")); + EXPECT_EQ(both, QueriedAxes("size(min-aspect-ratio: 1/2)")); + EXPECT_EQ(both, QueriedAxes("size(min-aspect-ratio: 1/2)")); + + EXPECT_EQ(both, QueriedAxes("size(orientation: portrait)")); + EXPECT_EQ(both, QueriedAxes("size(orientation: landscape)")); + + EXPECT_EQ(none, QueriedAxes("size(unknown)")); } TEST_F(ContainerQueryTest, QueryZoom) { @@ -1032,11 +1057,13 @@ ASSERT_TRUE(locker->GetDisplayLockContext()); EXPECT_TRUE(locker->GetDisplayLockContext()->IsLocked()); - // TODO(crbug.com/1202618): - // EXPECT_FALSE(locker->firstChild()->GetComputedStyle()) << "The #locker - // element should get content-visibility:hidden as part of the lifecycle - // update and its descendants should not have been styled"; - EXPECT_TRUE(locker->firstChild()->GetComputedStyle()); + EXPECT_TRUE(locker->firstChild()->GetComputedStyle()) + << "The #locker element does not get content-visibility:hidden on the " + "first pass over its children during the lifecycle update because we " + "do not have the container laid out at that point. This is not a spec " + "violation since it says the work _should_ be avoided. If this " + "expectation changes because we are able to optimize this case, that " + "is fine too."; } TEST_F(ContainerQueryTest, NoContainerQueryEvaluatorWhenDisabled) {
diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 index ad9b53a..a4ceb96 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5
@@ -2415,7 +2415,7 @@ }, { name: "grid-auto-columns", - property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], + property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "InitialValue"], field_group: "*", field_template: "external", include_paths: ["third_party/blink/renderer/core/style/grid_track_list.h"], @@ -2428,7 +2428,7 @@ }, { name: "grid-auto-flow", - property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], + property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "InitialValue"], field_group: "*", field_size: 4, // FIXME: Make this use "kGridAutoFlowBits". field_template: "primitive", @@ -2441,7 +2441,7 @@ }, { name: "grid-auto-rows", - property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], + property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "InitialValue"], field_group: "*", field_template: "external", include_paths: ["third_party/blink/renderer/core/style/grid_track_list.h"], @@ -2502,14 +2502,14 @@ }, { name: "grid-template-areas", - property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], + property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "InitialValue"], style_builder_custom_functions: ["initial", "inherit", "value"], keywords: ["none"], typedom_types: ["Keyword"], }, { name: "grid-template-columns", - property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], + property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "InitialValue"], layout_dependent: true, field_group: "*", field_template: "external", @@ -2525,7 +2525,7 @@ }, { name: "grid-template-rows", - property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], + property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "InitialValue"], layout_dependent: true, field_group: "*", field_template: "external",
diff --git a/third_party/blink/renderer/core/css/media_query_exp.cc b/third_party/blink/renderer/core/css/media_query_exp.cc index a979a5dc..e69feeb4 100644 --- a/third_party/blink/renderer/core/css/media_query_exp.cc +++ b/third_party/blink/renderer/core/css/media_query_exp.cc
@@ -308,7 +308,8 @@ media_feature_ == media_feature_names::kMaxWidthMediaFeature || media_feature_ == media_feature_names::kAspectRatioMediaFeature || media_feature_ == media_feature_names::kMinAspectRatioMediaFeature || - media_feature_ == media_feature_names::kMaxAspectRatioMediaFeature; + media_feature_ == media_feature_names::kMaxAspectRatioMediaFeature || + media_feature_ == media_feature_names::kOrientationMediaFeature; } bool MediaQueryExp::IsHeightDependent() const { @@ -317,7 +318,8 @@ media_feature_ == media_feature_names::kMaxHeightMediaFeature || media_feature_ == media_feature_names::kAspectRatioMediaFeature || media_feature_ == media_feature_names::kMinAspectRatioMediaFeature || - media_feature_ == media_feature_names::kMaxAspectRatioMediaFeature; + media_feature_ == media_feature_names::kMaxAspectRatioMediaFeature || + media_feature_ == media_feature_names::kOrientationMediaFeature; } MediaQueryExp::MediaQueryExp(const MediaQueryExp& other)
diff --git a/third_party/blink/renderer/core/css/parser/container_query_parser.cc b/third_party/blink/renderer/core/css/parser/container_query_parser.cc index 9a5e55c..4ae9c23 100644 --- a/third_party/blink/renderer/core/css/parser/container_query_parser.cc +++ b/third_party/blink/renderer/core/css/parser/container_query_parser.cc
@@ -67,6 +67,24 @@ return result; } +class SizeFeatureSet : public MediaQueryParser::FeatureSet { + STACK_ALLOCATED(); + + public: + bool IsAllowed(const String& name) const override { + return name == media_feature_names::kWidthMediaFeature || + name == media_feature_names::kMinWidthMediaFeature || + name == media_feature_names::kMaxWidthMediaFeature || + name == media_feature_names::kHeightMediaFeature || + name == media_feature_names::kMinHeightMediaFeature || + name == media_feature_names::kMaxHeightMediaFeature || + name == media_feature_names::kAspectRatioMediaFeature || + name == media_feature_names::kMinAspectRatioMediaFeature || + name == media_feature_names::kMaxAspectRatioMediaFeature || + name == media_feature_names::kOrientationMediaFeature; + } +}; + } // namespace ContainerQueryParser::ContainerQueryParser(const CSSParserContext& context) @@ -145,7 +163,7 @@ auto block = range.ConsumeBlock(); block.ConsumeWhitespace(); range.ConsumeWhitespace(); - auto query = ConsumeFeatureQuery(block); + auto query = ConsumeFeatureQuery(block, SizeFeatureSet()); if (query && block.AtEnd()) return MediaQueryExpNode::Function(std::move(query), "size"); } @@ -165,28 +183,31 @@ } std::unique_ptr<MediaQueryExpNode> ContainerQueryParser::ConsumeFeatureQuery( - CSSParserTokenRange& range) { + CSSParserTokenRange& range, + const FeatureSet& feature_set) { CSSParserTokenRange original_range = range; - if (auto feature = ConsumeFeature(range)) + if (auto feature = ConsumeFeature(range, feature_set)) return feature; range = original_range; - if (auto node = ConsumeFeatureCondition(range)) + if (auto node = ConsumeFeatureCondition(range, feature_set)) return node; return nullptr; } std::unique_ptr<MediaQueryExpNode> -ContainerQueryParser::ConsumeFeatureQueryInParens(CSSParserTokenRange& range) { +ContainerQueryParser::ConsumeFeatureQueryInParens( + CSSParserTokenRange& range, + const FeatureSet& feature_set) { CSSParserTokenRange original_range = range; if (range.Peek().GetType() == kLeftParenthesisToken) { auto block = range.ConsumeBlock(); block.ConsumeWhitespace(); range.ConsumeWhitespace(); - auto query = ConsumeFeatureQuery(block); + auto query = ConsumeFeatureQuery(block, feature_set); if (query && block.AtEnd()) return MediaQueryExpNode::Nested(std::move(query)); } @@ -196,17 +217,19 @@ } std::unique_ptr<MediaQueryExpNode> -ContainerQueryParser::ConsumeFeatureCondition(CSSParserTokenRange& range) { +ContainerQueryParser::ConsumeFeatureCondition(CSSParserTokenRange& range, + const FeatureSet& feature_set) { return ConsumeNotAndOr( - [this](CSSParserTokenRange& range) { - return this->ConsumeFeatureQueryInParens(range); + [this, &feature_set](CSSParserTokenRange& range) { + return this->ConsumeFeatureQueryInParens(range, feature_set); }, range); } std::unique_ptr<MediaQueryExpNode> ContainerQueryParser::ConsumeFeature( - CSSParserTokenRange& range) { - return media_query_parser_.ConsumeFeature(range); + CSSParserTokenRange& range, + const FeatureSet& feature_set) { + return media_query_parser_.ConsumeFeature(range, feature_set); } } // namespace blink
diff --git a/third_party/blink/renderer/core/css/parser/container_query_parser.h b/third_party/blink/renderer/core/css/parser/container_query_parser.h index bae1ff4..23665a2 100644 --- a/third_party/blink/renderer/core/css/parser/container_query_parser.h +++ b/third_party/blink/renderer/core/css/parser/container_query_parser.h
@@ -29,16 +29,22 @@ std::unique_ptr<MediaQueryExpNode> ParseQuery(CSSParserTokenRange); private: + using FeatureSet = MediaQueryParser::FeatureSet; + std::unique_ptr<MediaQueryExpNode> ConsumeContainerQuery( CSSParserTokenRange&); std::unique_ptr<MediaQueryExpNode> ConsumeContainerCondition( CSSParserTokenRange&); - std::unique_ptr<MediaQueryExpNode> ConsumeFeatureQuery(CSSParserTokenRange&); + std::unique_ptr<MediaQueryExpNode> ConsumeFeatureQuery(CSSParserTokenRange&, + const FeatureSet&); std::unique_ptr<MediaQueryExpNode> ConsumeFeatureQueryInParens( - CSSParserTokenRange&); + CSSParserTokenRange&, + const FeatureSet&); std::unique_ptr<MediaQueryExpNode> ConsumeFeatureCondition( - CSSParserTokenRange&); - std::unique_ptr<MediaQueryExpNode> ConsumeFeature(CSSParserTokenRange&); + CSSParserTokenRange&, + const FeatureSet&); + std::unique_ptr<MediaQueryExpNode> ConsumeFeature(CSSParserTokenRange&, + const FeatureSet&); const CSSParserContext& context_; MediaQueryParser media_query_parser_;
diff --git a/third_party/blink/renderer/core/css/parser/media_query_parser.cc b/third_party/blink/renderer/core/css/parser/media_query_parser.cc index dd96b6a..e1585bf9 100644 --- a/third_party/blink/renderer/core/css/parser/media_query_parser.cc +++ b/third_party/blink/renderer/core/css/parser/media_query_parser.cc
@@ -18,6 +18,26 @@ using css_parsing_utils::ConsumeIfDelimiter; using css_parsing_utils::ConsumeIfIdent; +namespace { + +class MediaQueryFeatureSet : public MediaQueryParser::FeatureSet { + STACK_ALLOCATED(); + + public: + explicit MediaQueryFeatureSet(CSSParserMode parser_mode) + : parser_mode_(parser_mode) {} + + bool IsAllowed(const String& feature) const override { + return parser_mode_ == kUASheetMode || + feature != media_feature_names::kImmersiveMediaFeature; + } + + private: + CSSParserMode parser_mode_; +}; + +} // namespace + scoped_refptr<MediaQuerySet> MediaQueryParser::ParseMediaQuerySet( const String& query_string, const ExecutionContext* execution_context) { @@ -159,19 +179,21 @@ return MediaQueryOperator::kNone; } -String MediaQueryParser::ConsumeAllowedName(CSSParserTokenRange& range) { +String MediaQueryParser::ConsumeAllowedName(CSSParserTokenRange& range, + const FeatureSet& feature_set) { if (range.Peek().GetType() != kIdentToken) return g_null_atom; String name = AttemptStaticStringCreation(range.Peek().Value().ToString().LowerASCII()); - if (!IsMediaFeatureAllowedInMode(name)) + if (!feature_set.IsAllowed(name)) return g_null_atom; range.ConsumeIncludingWhitespace(); return name; } -String MediaQueryParser::ConsumeUnprefixedName(CSSParserTokenRange& range) { - String name = ConsumeAllowedName(range); +String MediaQueryParser::ConsumeUnprefixedName(CSSParserTokenRange& range, + const FeatureSet& feature_set) { + String name = ConsumeAllowedName(range, feature_set); if (name.IsNull()) return name; DCHECK_EQ(name, name.LowerASCII()); @@ -184,11 +206,12 @@ CSSParserTokenRange lhs, MediaQueryOperator op, CSSParserTokenRange rhs, - NameAffinity name_affinity) { + NameAffinity name_affinity, + const FeatureSet& feature_set) { if (name_affinity == NameAffinity::kRight) std::swap(lhs, rhs); - String feature_name = ConsumeUnprefixedName(lhs); + String feature_name = ConsumeUnprefixedName(lhs, feature_set); if (feature_name.IsNull() || !lhs.AtEnd()) return nullptr; @@ -209,7 +232,8 @@ } std::unique_ptr<MediaQueryExpNode> MediaQueryParser::ConsumeFeature( - CSSParserTokenRange& range) { + CSSParserTokenRange& range, + const FeatureSet& feature_set) { // Because we don't know exactly where <mf-name> appears in the grammar, we // split |range| on top-level separators, and parse each segment // individually. @@ -227,7 +251,7 @@ // <mf-boolean> = <mf-name> if (range.AtEnd()) { - String feature_name = ConsumeAllowedName(segment1); + String feature_name = ConsumeAllowedName(segment1, feature_set); if (feature_name.IsNull() || !segment1.AtEnd()) return nullptr; auto exp = MediaQueryExp::Create(feature_name, range, fake_context_, @@ -242,7 +266,7 @@ range.ConsumeIncludingWhitespace(); if (range.AtEnd()) return nullptr; - String feature_name = ConsumeAllowedName(segment1); + String feature_name = ConsumeAllowedName(segment1, feature_set); if (feature_name.IsNull() || !segment1.AtEnd()) return nullptr; auto exp = MediaQueryExp::Create(feature_name, range, fake_context_, @@ -276,14 +300,14 @@ // try both. if (range.AtEnd()) { // Try: <mf-name> <mf-comparison> <mf-value> - if (auto node = ParseNameValueComparison(segment1, op1, segment2, - NameAffinity::kLeft)) { + if (auto node = ParseNameValueComparison( + segment1, op1, segment2, NameAffinity::kLeft, feature_set)) { return node; } // Otherwise: <mf-value> <mf-comparison> <mf-name> return ParseNameValueComparison(segment1, op1, segment2, - NameAffinity::kRight); + NameAffinity::kRight, feature_set); } // Otherwise, the feature must be on the form: @@ -305,7 +329,7 @@ if (range.AtEnd()) return nullptr; - String feature_name = ConsumeUnprefixedName(segment2); + String feature_name = ConsumeUnprefixedName(segment2, feature_set); if (feature_name.IsNull() || !segment2.AtEnd()) return nullptr; @@ -373,7 +397,7 @@ block = original_block; // ( <media-feature> ) - auto feature = ConsumeFeature(block); + auto feature = ConsumeFeature(block, MediaQueryFeatureSet(mode_)); if (feature && block.AtEnd()) return MediaQueryExpNode::Nested(std::move(feature)); } @@ -480,12 +504,6 @@ return query_set_; } -bool MediaQueryParser::IsMediaFeatureAllowedInMode( - const String& media_feature) const { - return mode_ == kUASheetMode || - media_feature != media_feature_names::kImmersiveMediaFeature; -} - bool MediaQueryParser::IsNotKeywordEnabled() const { // Support for 'not' was shipped for kMediaConditionParser before // RuntimeEnabledFeatures::CSSMediaQueries4 existed, hence it's always
diff --git a/third_party/blink/renderer/core/css/parser/media_query_parser.h b/third_party/blink/renderer/core/css/parser/media_query_parser.h index 859a632..75aa9be 100644 --- a/third_party/blink/renderer/core/css/parser/media_query_parser.h +++ b/third_party/blink/renderer/core/css/parser/media_query_parser.h
@@ -38,6 +38,14 @@ CSSParserMode, const ExecutionContext*); + // Passed to ConsumeFeature to determine which features are allowed. + class FeatureSet { + STACK_ALLOCATED(); + + public: + virtual bool IsAllowed(const String&) const = 0; + }; + private: friend class ContainerQueryParser; @@ -72,13 +80,13 @@ // https://drafts.csswg.org/mediaqueries-4/#typedef-mf-name // - // The <mf-name> is only consumed if the name is allowed in the current - // mode. - String ConsumeAllowedName(CSSParserTokenRange&); + // The <mf-name> is only consumed if the name is allowed by the specified + // FeatureSet. + String ConsumeAllowedName(CSSParserTokenRange&, const FeatureSet&); // Like ConsumeAllowedName, except returns null if the name has a min- // or max- prefix. - String ConsumeUnprefixedName(CSSParserTokenRange&); + String ConsumeUnprefixedName(CSSParserTokenRange&, const FeatureSet&); enum class NameAffinity { // <mf-name> appears on the left, e.g. width < 10px. @@ -100,12 +108,14 @@ CSSParserTokenRange lhs, MediaQueryOperator op, CSSParserTokenRange rhs, - NameAffinity); + NameAffinity, + const FeatureSet&); // https://drafts.csswg.org/mediaqueries-4/#typedef-media-feature // // Currently, only <mf-boolean> and <mf-plain> productions are supported. - std::unique_ptr<MediaQueryExpNode> ConsumeFeature(CSSParserTokenRange&); + std::unique_ptr<MediaQueryExpNode> ConsumeFeature(CSSParserTokenRange&, + const FeatureSet&); enum class ConditionMode { // https://drafts.csswg.org/mediaqueries-4/#typedef-media-condition @@ -138,8 +148,6 @@ scoped_refptr<MediaQuerySet> ParseImpl(CSSParserTokenRange); - bool IsMediaFeatureAllowedInMode(const String& media_feature) const; - // True if <media-not> is enabled. bool IsNotKeywordEnabled() const;
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 171fba7..fd87300 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
@@ -4249,12 +4249,13 @@ return true; } -bool ConsumeGridTemplateRowsAndAreasAndColumns(bool important, - CSSParserTokenRange& range, - const CSSParserContext& context, - CSSValue*& template_rows, - CSSValue*& template_columns, - CSSValue*& template_areas) { +bool ConsumeGridTemplateRowsAndAreasAndColumns( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSValue*& template_rows, + const CSSValue*& template_columns, + const CSSValue*& template_areas) { DCHECK(!template_rows); DCHECK(!template_columns); DCHECK(!template_areas); @@ -4552,9 +4553,9 @@ bool ConsumeGridTemplateShorthand(bool important, CSSParserTokenRange& range, const CSSParserContext& context, - CSSValue*& template_rows, - CSSValue*& template_columns, - CSSValue*& template_areas) { + const CSSValue*& template_rows, + const CSSValue*& template_columns, + const CSSValue*& template_areas) { DCHECK(!template_rows); DCHECK(!template_columns); DCHECK(!template_areas);
diff --git a/third_party/blink/renderer/core/css/properties/css_parsing_utils.h b/third_party/blink/renderer/core/css/properties/css_parsing_utils.h index 8573420b..1f8e5f68 100644 --- a/third_party/blink/renderer/core/css/properties/css_parsing_utils.h +++ b/third_party/blink/renderer/core/css/properties/css_parsing_utils.h
@@ -418,9 +418,9 @@ bool ConsumeGridTemplateShorthand(bool important, CSSParserTokenRange&, const CSSParserContext&, - CSSValue*& template_rows, - CSSValue*& template_columns, - CSSValue*& template_areas); + const CSSValue*& template_rows, + const CSSValue*& template_columns, + const CSSValue*& template_areas); // The fragmentation spec says that page-break-(after|before|inside) are to be // treated as shorthands for their break-(after|before|inside) counterparts.
diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc index ab44d68c..2f73755 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc
@@ -3257,6 +3257,10 @@ return ComputedStyleUtils::ValueForGridTrackSizeList(kForColumns, style); } +const CSSValue* GridAutoColumns::InitialValue() const { + return CSSIdentifierValue::Create(CSSValueID::kAuto); +} + const CSSValue* GridAutoFlow::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, @@ -3317,6 +3321,10 @@ return list; } +const CSSValue* GridAutoFlow::InitialValue() const { + return CSSIdentifierValue::Create(CSSValueID::kRow); +} + const CSSValue* GridAutoRows::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, @@ -3332,6 +3340,10 @@ return ComputedStyleUtils::ValueForGridTrackSizeList(kForRows, style); } +const CSSValue* GridAutoRows::InitialValue() const { + return CSSIdentifierValue::Create(CSSValueID::kAuto); +} + const CSSValue* GridColumnEnd::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, @@ -3484,6 +3496,10 @@ grid_template_areas_value.ColumnCount()); } +const CSSValue* GridTemplateAreas::InitialValue() const { + return CSSIdentifierValue::Create(CSSValueID::kNone); +} + const CSSValue* GridTemplateColumns::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, @@ -3504,6 +3520,10 @@ style); } +const CSSValue* GridTemplateColumns::InitialValue() const { + return CSSIdentifierValue::Create(CSSValueID::kNone); +} + const CSSValue* GridTemplateRows::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, @@ -3524,6 +3544,10 @@ style); } +const CSSValue* GridTemplateRows::InitialValue() const { + return CSSIdentifierValue::Create(CSSValueID::kNone); +} + const CSSValue* Height::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const {
diff --git a/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc b/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc index 36c4272..bcc8107 100644 --- a/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc
@@ -1562,8 +1562,9 @@ namespace { -CSSValueList* ConsumeImplicitAutoFlow(CSSParserTokenRange& range, - const CSSValue& flow_direction) { +CSSValueList* ConsumeImplicitAutoFlow( + CSSParserTokenRange& range, + const CSSIdentifierValue& flow_direction) { // [ auto-flow && dense? ] CSSValue* dense_algorithm = nullptr; if ((css_parsing_utils::ConsumeIdent<CSSValueID::kAutoFlow>(range))) { @@ -1578,7 +1579,8 @@ return nullptr; } CSSValueList* list = CSSValueList::CreateSpaceSeparated(); - list->Append(flow_direction); + if (flow_direction.GetValueID() == CSSValueID::kColumn || !dense_algorithm) + list->Append(flow_direction); if (dense_algorithm) list->Append(*dense_algorithm); return list; @@ -1595,9 +1597,9 @@ CSSParserTokenRange range_copy = range; - CSSValue* template_rows = nullptr; - CSSValue* template_columns = nullptr; - CSSValue* template_areas = nullptr; + const CSSValue* template_rows = nullptr; + const CSSValue* template_columns = nullptr; + const CSSValue* template_areas = nullptr; if (css_parsing_utils::ConsumeGridTemplateShorthand( important, range, context, template_rows, template_columns, @@ -1624,24 +1626,25 @@ // their initial value, as normal for shorthands. css_parsing_utils::AddProperty( CSSPropertyID::kGridAutoFlow, CSSPropertyID::kGrid, - *CSSInitialValue::Create(), important, + *(To<Longhand>(GetCSSPropertyGridAutoFlow()).InitialValue()), important, css_parsing_utils::IsImplicitProperty::kNotImplicit, properties); css_parsing_utils::AddProperty( CSSPropertyID::kGridAutoColumns, CSSPropertyID::kGrid, - *CSSInitialValue::Create(), important, - css_parsing_utils::IsImplicitProperty::kNotImplicit, properties); + *(To<Longhand>(GetCSSPropertyGridAutoColumns()).InitialValue()), + important, css_parsing_utils::IsImplicitProperty::kNotImplicit, + properties); css_parsing_utils::AddProperty( CSSPropertyID::kGridAutoRows, CSSPropertyID::kGrid, - *CSSInitialValue::Create(), important, + *(To<Longhand>(GetCSSPropertyGridAutoRows()).InitialValue()), important, css_parsing_utils::IsImplicitProperty::kNotImplicit, properties); return true; } range = range_copy; - CSSValue* auto_columns_value = nullptr; - CSSValue* auto_rows_value = nullptr; - CSSValueList* grid_auto_flow = nullptr; + const CSSValue* auto_columns_value = nullptr; + const CSSValue* auto_rows_value = nullptr; + const CSSValueList* grid_auto_flow = nullptr; template_rows = nullptr; template_columns = nullptr; @@ -1654,7 +1657,8 @@ if (!grid_auto_flow) return false; if (css_parsing_utils::ConsumeSlashIncludingWhitespace(range)) { - auto_rows_value = CSSInitialValue::Create(); + auto_rows_value = + To<Longhand>(GetCSSPropertyGridAutoRows()).InitialValue(); } else { auto_rows_value = css_parsing_utils::ConsumeGridTrackList( range, context, css_parsing_utils::TrackListType::kGridAuto); @@ -1667,8 +1671,10 @@ css_parsing_utils::ConsumeGridTemplatesRowsOrColumns(range, context))) return false; - template_rows = CSSInitialValue::Create(); - auto_columns_value = CSSInitialValue::Create(); + template_rows = + To<Longhand>(GetCSSPropertyGridTemplateRows()).InitialValue(); + auto_columns_value = + To<Longhand>(GetCSSPropertyGridAutoColumns()).InitialValue(); } else { // 3- <grid-template-rows> / [ auto-flow && dense? ] <grid-auto-columns>? template_rows = @@ -1682,15 +1688,17 @@ if (!grid_auto_flow) return false; if (range.AtEnd()) { - auto_columns_value = CSSInitialValue::Create(); + auto_columns_value = + To<Longhand>(GetCSSPropertyGridAutoColumns()).InitialValue(); } else { auto_columns_value = css_parsing_utils::ConsumeGridTrackList( range, context, css_parsing_utils::TrackListType::kGridAuto); if (!auto_columns_value) return false; } - template_columns = CSSInitialValue::Create(); - auto_rows_value = CSSInitialValue::Create(); + template_columns = + To<Longhand>(GetCSSPropertyGridTemplateColumns()).InitialValue(); + auto_rows_value = To<Longhand>(GetCSSPropertyGridAutoRows()).InitialValue(); } if (!range.AtEnd()) @@ -1709,8 +1717,9 @@ properties); css_parsing_utils::AddProperty( CSSPropertyID::kGridTemplateAreas, CSSPropertyID::kGrid, - *CSSInitialValue::Create(), important, - css_parsing_utils::IsImplicitProperty::kNotImplicit, properties); + *(To<Longhand>(GetCSSPropertyGridTemplateAreas()).InitialValue()), + important, css_parsing_utils::IsImplicitProperty::kNotImplicit, + properties); css_parsing_utils::AddProperty( CSSPropertyID::kGridAutoFlow, CSSPropertyID::kGrid, *grid_auto_flow, important, css_parsing_utils::IsImplicitProperty::kNotImplicit, @@ -1837,9 +1846,9 @@ const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - CSSValue* template_rows = nullptr; - CSSValue* template_columns = nullptr; - CSSValue* template_areas = nullptr; + const CSSValue* template_rows = nullptr; + const CSSValue* template_columns = nullptr; + const CSSValue* template_areas = nullptr; if (!css_parsing_utils::ConsumeGridTemplateShorthand( important, range, context, template_rows, template_columns, template_areas))
diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc index 263a9fb..23fe69a 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
@@ -874,12 +874,17 @@ GridAutoFlow StyleBuilderConverter::ConvertGridAutoFlow(StyleResolverState&, const CSSValue& value) { - const auto& list = To<CSSValueList>(value); + const auto* list = DynamicTo<CSSValueList>(&value); + if (list) + DCHECK_GE(list->length(), 1u); + else + DCHECK(value.IsIdentifierValue()); - DCHECK_GE(list.length(), 1u); - const CSSIdentifierValue& first = To<CSSIdentifierValue>(list.Item(0)); + const CSSIdentifierValue& first = + To<CSSIdentifierValue>(list ? list->Item(0) : value); const CSSIdentifierValue* second = - list.length() == 2 ? &To<CSSIdentifierValue>(list.Item(1)) : nullptr; + list && list->length() == 2 ? &To<CSSIdentifierValue>(list->Item(1)) + : nullptr; switch (first.GetValueID()) { case CSSValueID::kRow: @@ -1006,6 +1011,13 @@ GridTrackList StyleBuilderConverter::ConvertGridTrackSizeList( StyleResolverState& state, const CSSValue& value) { + const CSSValueList* list = DynamicTo<CSSValueList>(value); + if (!list) { + const auto& ident = To<CSSIdentifierValue>(value); + DCHECK_EQ(ident.GetValueID(), CSSValueID::kAuto); + return GridTrackList(GridTrackSize(Length::Auto())); + } + Vector<GridTrackSize, 1> track_sizes; for (auto& curr_value : To<CSSValueList>(value)) { DCHECK(!curr_value->IsGridLineNamesValue()); @@ -1027,6 +1039,7 @@ OrderedNamedGridLines& auto_repeat_ordered_named_grid_lines, wtf_size_t& auto_repeat_insertion_point, AutoRepeatType& auto_repeat_type, + GridAxisType& grid_axis_type, StyleResolverState& state) { if (auto* identifier_value = DynamicTo<CSSIdentifierValue>(value)) { DCHECK_EQ(identifier_value->GetValueID(), CSSValueID::kNone); @@ -1041,16 +1054,31 @@ ConvertGridLineNamesList(curr_value, current_named_grid_line, named_grid_lines, ordered_named_grid_lines, is_in_repeat, is_first_repeat); + if (grid_axis_type == GridAxisType::kSubgriddedAxis) + ++current_named_grid_line; } else { + DCHECK_EQ(grid_axis_type, GridAxisType::kStandaloneAxis); ++current_named_grid_line; track_sizes.LegacyTrackList().push_back( ConvertGridTrackSize(state, curr_value)); } }; - for (auto curr_value : To<CSSValueList>(value)) { + const auto& values = To<CSSValueList>(value); + auto* curr_value = values.begin(); + + if (RuntimeEnabledFeatures::LayoutNGSubgridEnabled()) { + auto* identifier_value = DynamicTo<CSSIdentifierValue>(curr_value->Get()); + if (identifier_value && + identifier_value->GetValueID() == CSSValueID::kSubgrid) { + grid_axis_type = GridAxisType::kSubgriddedAxis; + ++curr_value; + } + } + + for (; curr_value != values.end(); ++curr_value) { if (auto* grid_auto_repeat_value = - DynamicTo<cssvalue::CSSGridAutoRepeatValue>(curr_value.Get())) { + DynamicTo<cssvalue::CSSGridAutoRepeatValue>(curr_value->Get())) { Vector<GridTrackSize, 1> repeated_track_sizes; wtf_size_t auto_repeat_index = 0; CSSValueID auto_repeat_id = grid_auto_repeat_value->AutoRepeatID(); @@ -1059,11 +1087,13 @@ auto_repeat_type = auto_repeat_id == CSSValueID::kAutoFill ? AutoRepeatType::kAutoFill : AutoRepeatType::kAutoFit; - for (auto auto_repeat_value : To<CSSValueList>(*curr_value)) { + for (auto auto_repeat_value : To<CSSValueList>(**curr_value)) { if (auto_repeat_value->IsGridLineNamesValue()) { ConvertGridLineNamesList(*auto_repeat_value, auto_repeat_index, auto_repeat_named_grid_lines, auto_repeat_ordered_named_grid_lines); + if (grid_axis_type == GridAxisType::kSubgriddedAxis) + ++auto_repeat_index; continue; } ++auto_repeat_index; @@ -1082,7 +1112,7 @@ } if (auto* grid_integer_repeat_value = - DynamicTo<cssvalue::CSSGridIntegerRepeatValue>(curr_value.Get())) { + DynamicTo<cssvalue::CSSGridIntegerRepeatValue>(curr_value->Get())) { const wtf_size_t repetitions = grid_integer_repeat_value->Repetitions(); for (wtf_size_t i = 0; i < repetitions; ++i) { @@ -1093,7 +1123,8 @@ } } - if (RuntimeEnabledFeatures::LayoutNGGridEnabled()) { + if (RuntimeEnabledFeatures::LayoutNGGridEnabled() && + (grid_axis_type == GridAxisType::kStandaloneAxis)) { Vector<GridTrackSize, 1> repeater_track_sizes; for (auto integer_repeat_value : *grid_integer_repeat_value) { if (!integer_repeat_value->IsGridLineNamesValue()) { @@ -1108,18 +1139,20 @@ continue; } - ConvertLineNameOrTrackSize(*curr_value); + ConvertLineNameOrTrackSize(**curr_value); if (RuntimeEnabledFeatures::LayoutNGGridEnabled() && - !curr_value->IsGridLineNamesValue()) { + !curr_value->Get()->IsGridLineNamesValue()) { track_sizes.NGTrackList().AddRepeater( - {ConvertGridTrackSize(state, *curr_value)}); + {ConvertGridTrackSize(state, **curr_value)}); } } - // The parser should have rejected any <track-list> without any <track-size> - // as this is not conformant to the syntax. + // Unless the axis is subgridded, the parser should have rejected any + // <track-list> without any <track-size> as this is not conformant to + // the syntax. DCHECK(!track_sizes.LegacyTrackList().IsEmpty() || - !auto_repeat_track_sizes.IsEmpty()); + !auto_repeat_track_sizes.IsEmpty() || + (grid_axis_type == GridAxisType::kSubgriddedAxis)); } void StyleBuilderConverter::CreateImplicitNamedGridLinesFromGridArea(
diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.h b/third_party/blink/renderer/core/css/resolver/style_builder_converter.h index ee73b90..26a0818 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.h +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.h
@@ -235,6 +235,7 @@ OrderedNamedGridLines&, wtf_size_t& auto_repeat_insertion_point, AutoRepeatType&, + GridAxisType&, StyleResolverState&); static void CreateImplicitNamedGridLinesFromGridArea( const NamedGridAreaMap&,
diff --git a/third_party/blink/renderer/core/document_transition/document_transition_origin_trial_test.cc b/third_party/blink/renderer/core/document_transition/document_transition_origin_trial_test.cc index 8b42b07..db3a070c 100644 --- a/third_party/blink/renderer/core/document_transition/document_transition_origin_trial_test.cc +++ b/third_party/blink/renderer/core/document_transition/document_transition_origin_trial_test.cc
@@ -9,7 +9,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/common/origin_trials/scoped_test_origin_trial_policy.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/core/document_transition/document_transition_supplement.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" @@ -74,9 +73,9 @@ document.head()->appendChild(meta); v8::HandleScope scope(v8::Isolate::GetCurrent()); - auto value = ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("!!document.documentTransition")) - ->RunScriptAndReturnValue(document.domWindow()); + auto value = + ClassicScript::CreateUnspecifiedScript("!!document.documentTransition") + ->RunScriptAndReturnValue(document.domWindow()); NonThrowableExceptionState exceptionState; bool enabled = ToBoolean(scope.GetIsolate(), value, exceptionState);
diff --git a/third_party/blink/renderer/core/dom/events/event_target_test.cc b/third_party/blink/renderer/core/dom/events/event_target_test.cc index 1d19bda..6e8411ae 100644 --- a/third_party/blink/renderer/core/dom/events/event_target_test.cc +++ b/third_party/blink/renderer/core/dom/events/event_target_test.cc
@@ -19,8 +19,8 @@ GetDocument().IsUseCounted(WebFeature::kPassiveTouchEventListener)); GetDocument().GetSettings()->SetScriptEnabled(true); ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("window.addEventListener('touchstart', function() {}, " - "{passive: true});")) + "window.addEventListener('touchstart', function() {}, " + "{passive: true});") ->RunScript(GetDocument().domWindow()); EXPECT_TRUE( GetDocument().IsUseCounted(WebFeature::kPassiveTouchEventListener)); @@ -33,8 +33,8 @@ GetDocument().IsUseCounted(WebFeature::kNonPassiveTouchEventListener)); GetDocument().GetSettings()->SetScriptEnabled(true); ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("window.addEventListener('touchstart', function() {}, " - "{passive: false});")) + "window.addEventListener('touchstart', function() {}, " + "{passive: false});") ->RunScript(GetDocument().domWindow()); EXPECT_TRUE( GetDocument().IsUseCounted(WebFeature::kNonPassiveTouchEventListener)); @@ -47,7 +47,7 @@ GetDocument().IsUseCounted(WebFeature::kPassiveTouchEventListener)); GetDocument().GetSettings()->SetScriptEnabled(true); ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("window.addEventListener('touchstart', function() {});")) + "window.addEventListener('touchstart', function() {});") ->RunScript(GetDocument().domWindow()); EXPECT_TRUE( GetDocument().IsUseCounted(WebFeature::kPassiveTouchEventListener)); @@ -59,11 +59,11 @@ EXPECT_FALSE( GetDocument().IsUseCounted(WebFeature::kBeforematchHandlerRegistered)); GetDocument().GetSettings()->SetScriptEnabled(true); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(R"HTML( + ClassicScript::CreateUnspecifiedScript(R"HTML( const element = document.createElement('div'); document.body.appendChild(element); element.addEventListener('beforematch', () => {}); - )HTML")) + )HTML") ->RunScript(GetDocument().domWindow()); EXPECT_TRUE( GetDocument().IsUseCounted(WebFeature::kBeforematchHandlerRegistered)); @@ -73,12 +73,12 @@ EXPECT_FALSE( GetDocument().IsUseCounted(WebFeature::kAddEventListenerWithAbortSignal)); GetDocument().GetSettings()->SetScriptEnabled(true); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(R"HTML( + ClassicScript::CreateUnspecifiedScript(R"HTML( const element = document.createElement('div'); const ac = new AbortController(); element.addEventListener( 'test', () => {}, {signal: ac.signal}); - )HTML")) + )HTML") ->RunScript(GetDocument().domWindow()); EXPECT_TRUE( GetDocument().IsUseCounted(WebFeature::kAddEventListenerWithAbortSignal));
diff --git a/third_party/blink/renderer/core/editing/build.gni b/third_party/blink/renderer/core/editing/build.gni index a420e13c..10a81bbe 100644 --- a/third_party/blink/renderer/core/editing/build.gni +++ b/third_party/blink/renderer/core/editing/build.gni
@@ -219,6 +219,8 @@ "markers/highlight_marker_list_impl.h", "markers/highlight_pseudo_marker.cc", "markers/highlight_pseudo_marker.h", + "markers/highlight_pseudo_marker_list_impl.cc", + "markers/highlight_pseudo_marker_list_impl.h", "markers/sorted_document_marker_list_editor.cc", "markers/sorted_document_marker_list_editor.h", "markers/spell_check_marker.cc", @@ -243,8 +245,6 @@ "markers/text_fragment_marker.h", "markers/text_fragment_marker_list_impl.cc", "markers/text_fragment_marker_list_impl.h", - "markers/text_marker_base_list_impl.cc", - "markers/text_marker_base_list_impl.h", "markers/text_match_marker.cc", "markers/text_match_marker.h", "markers/text_match_marker_list_impl.cc",
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 c4d8b02f..2329b57 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
@@ -9,7 +9,6 @@ #include "third_party/blink/public/mojom/frame/find_in_page.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/web/web_document.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" #include "third_party/blink/renderer/core/display_lock/display_lock_document_state.h" #include "third_party/blink/renderer/core/dom/comment.h" @@ -74,8 +73,7 @@ }; v8::Local<v8::Value> TextFinderTest::EvalJs(const std::string& script) { - return ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(script.c_str())) + return ClassicScript::CreateUnspecifiedScript(script.c_str()) ->RunScriptAndReturnValue(GetDocument().domWindow()); }
diff --git a/third_party/blink/renderer/core/editing/markers/highlight_marker_list_impl.cc b/third_party/blink/renderer/core/editing/markers/highlight_marker_list_impl.cc index 522b3b5..bf035c6 100644 --- a/third_party/blink/renderer/core/editing/markers/highlight_marker_list_impl.cc +++ b/third_party/blink/renderer/core/editing/markers/highlight_marker_list_impl.cc
@@ -4,68 +4,10 @@ #include "third_party/blink/renderer/core/editing/markers/highlight_marker_list_impl.h" -#include "third_party/blink/renderer/core/editing/markers/unsorted_document_marker_list_editor.h" - namespace blink { DocumentMarker::MarkerType HighlightMarkerListImpl::MarkerType() const { return DocumentMarker::kHighlight; } -bool HighlightMarkerListImpl::IsEmpty() const { - return markers_.IsEmpty(); -} - -void HighlightMarkerListImpl::Add(DocumentMarker* marker) { - DCHECK_EQ(DocumentMarker::kHighlight, marker->GetType()); - markers_.push_back(marker); -} - -void HighlightMarkerListImpl::Clear() { - markers_.clear(); -} - -const HeapVector<Member<DocumentMarker>>& HighlightMarkerListImpl::GetMarkers() - const { - return markers_; -} - -DocumentMarker* HighlightMarkerListImpl::FirstMarkerIntersectingRange( - unsigned start_offset, - unsigned end_offset) const { - return UnsortedDocumentMarkerListEditor::FirstMarkerIntersectingRange( - markers_, start_offset, end_offset); -} - -HeapVector<Member<DocumentMarker>> -HighlightMarkerListImpl::MarkersIntersectingRange(unsigned start_offset, - unsigned end_offset) const { - return UnsortedDocumentMarkerListEditor::MarkersIntersectingRange( - markers_, start_offset, end_offset); -} - -bool HighlightMarkerListImpl::MoveMarkers(int length, - DocumentMarkerList* dst_markers_) { - return UnsortedDocumentMarkerListEditor::MoveMarkers(&markers_, length, - dst_markers_); -} - -bool HighlightMarkerListImpl::RemoveMarkers(unsigned start_offset, int length) { - return UnsortedDocumentMarkerListEditor::RemoveMarkers(&markers_, - start_offset, length); -} - -bool HighlightMarkerListImpl::ShiftMarkers(const String&, - unsigned offset, - unsigned old_length, - unsigned new_length) { - return UnsortedDocumentMarkerListEditor::ShiftMarkersContentIndependent( - &markers_, offset, old_length, new_length); -} - -void HighlightMarkerListImpl::Trace(blink::Visitor* visitor) const { - visitor->Trace(markers_); - DocumentMarkerList::Trace(visitor); -} - } // namespace blink
diff --git a/third_party/blink/renderer/core/editing/markers/highlight_marker_list_impl.h b/third_party/blink/renderer/core/editing/markers/highlight_marker_list_impl.h index fd8765e..ba25715 100644 --- a/third_party/blink/renderer/core/editing/markers/highlight_marker_list_impl.h +++ b/third_party/blink/renderer/core/editing/markers/highlight_marker_list_impl.h
@@ -5,43 +5,30 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_HIGHLIGHT_MARKER_LIST_IMPL_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_HIGHLIGHT_MARKER_LIST_IMPL_H_ -#include "third_party/blink/renderer/core/editing/markers/document_marker_list.h" -#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h" +#include "third_party/blink/renderer/core/editing/markers/highlight_pseudo_marker_list_impl.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" namespace blink { -// Implementation of HighlightMarkerList for Highlight markers. -class CORE_EXPORT HighlightMarkerListImpl final : public DocumentMarkerList { +// Implementation of HighlightPseudoMarkerListImpl for Highlight markers. +class CORE_EXPORT HighlightMarkerListImpl final + : public HighlightPseudoMarkerListImpl { public: HighlightMarkerListImpl() = default; HighlightMarkerListImpl(const HighlightMarkerListImpl&) = delete; HighlightMarkerListImpl& operator=(const HighlightMarkerListImpl&) = delete; DocumentMarker::MarkerType MarkerType() const final; +}; - bool IsEmpty() const final; - - void Add(DocumentMarker*) final; - void Clear() final; - - const HeapVector<Member<DocumentMarker>>& GetMarkers() const final; - DocumentMarker* FirstMarkerIntersectingRange(unsigned start_offset, - unsigned end_offset) const final; - HeapVector<Member<DocumentMarker>> MarkersIntersectingRange( - unsigned start_offset, - unsigned end_offset) const final; - - bool MoveMarkers(int length, DocumentMarkerList* dst_list) final; - bool RemoveMarkers(unsigned start_offset, int length) final; - bool ShiftMarkers(const String& node_text, - unsigned offset, - unsigned old_length, - unsigned new_length) final; - - void Trace(blink::Visitor*) const override; - - private: - HeapVector<Member<DocumentMarker>> markers_; +template <> +struct DowncastTraits<HighlightMarkerListImpl> { + static bool AllowFrom(const DocumentMarkerList& list) { + return list.MarkerType() == DocumentMarker::kHighlight; + } + static bool AllowFrom(const HighlightPseudoMarkerListImpl& list) { + return list.MarkerType() == DocumentMarker::kHighlight; + } }; } // namespace blink
diff --git a/third_party/blink/renderer/core/editing/markers/highlight_pseudo_marker_list_impl.cc b/third_party/blink/renderer/core/editing/markers/highlight_pseudo_marker_list_impl.cc new file mode 100644 index 0000000..1bd51639 --- /dev/null +++ b/third_party/blink/renderer/core/editing/markers/highlight_pseudo_marker_list_impl.cc
@@ -0,0 +1,71 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/editing/markers/highlight_pseudo_marker_list_impl.h" + +#include "third_party/blink/renderer/core/editing/markers/unsorted_document_marker_list_editor.h" + +namespace blink { + +bool HighlightPseudoMarkerListImpl::IsEmpty() const { + return markers_.IsEmpty(); +} + +void HighlightPseudoMarkerListImpl::Add(DocumentMarker* marker) { + DCHECK(marker->GetType() == DocumentMarker::kHighlight || + marker->GetType() == DocumentMarker::kTextFragment); + markers_.push_back(marker); +} + +void HighlightPseudoMarkerListImpl::Clear() { + markers_.clear(); +} + +const HeapVector<Member<DocumentMarker>>& +HighlightPseudoMarkerListImpl::GetMarkers() const { + return markers_; +} + +DocumentMarker* HighlightPseudoMarkerListImpl::FirstMarkerIntersectingRange( + unsigned start_offset, + unsigned end_offset) const { + return UnsortedDocumentMarkerListEditor::FirstMarkerIntersectingRange( + markers_, start_offset, end_offset); +} + +HeapVector<Member<DocumentMarker>> +HighlightPseudoMarkerListImpl::MarkersIntersectingRange( + unsigned start_offset, + unsigned end_offset) const { + return UnsortedDocumentMarkerListEditor::MarkersIntersectingRange( + markers_, start_offset, end_offset); +} + +bool HighlightPseudoMarkerListImpl::MoveMarkers( + int length, + DocumentMarkerList* dst_markers_) { + return UnsortedDocumentMarkerListEditor::MoveMarkers(&markers_, length, + dst_markers_); +} + +bool HighlightPseudoMarkerListImpl::RemoveMarkers(unsigned start_offset, + int length) { + return UnsortedDocumentMarkerListEditor::RemoveMarkers(&markers_, + start_offset, length); +} + +bool HighlightPseudoMarkerListImpl::ShiftMarkers(const String&, + unsigned offset, + unsigned old_length, + unsigned new_length) { + return UnsortedDocumentMarkerListEditor::ShiftMarkersContentIndependent( + &markers_, offset, old_length, new_length); +} + +void HighlightPseudoMarkerListImpl::Trace(blink::Visitor* visitor) const { + visitor->Trace(markers_); + DocumentMarkerList::Trace(visitor); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/editing/markers/highlight_pseudo_marker_list_impl.h b/third_party/blink/renderer/core/editing/markers/highlight_pseudo_marker_list_impl.h new file mode 100644 index 0000000..34fdd53 --- /dev/null +++ b/third_party/blink/renderer/core/editing/markers/highlight_pseudo_marker_list_impl.h
@@ -0,0 +1,59 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_HIGHLIGHT_PSEUDO_MARKER_LIST_IMPL_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_HIGHLIGHT_PSEUDO_MARKER_LIST_IMPL_H_ + +#include "third_party/blink/renderer/core/editing/markers/document_marker_list.h" +#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" + +namespace blink { + +// Implementation of HighlightPseudoMarkerList for HighlightPseudo markers. +class CORE_EXPORT HighlightPseudoMarkerListImpl : public DocumentMarkerList { + public: + HighlightPseudoMarkerListImpl(const HighlightPseudoMarkerListImpl&) = delete; + HighlightPseudoMarkerListImpl& operator=( + const HighlightPseudoMarkerListImpl&) = delete; + + bool IsEmpty() const final; + + void Add(DocumentMarker*) final; + void Clear() final; + + const HeapVector<Member<DocumentMarker>>& GetMarkers() const final; + DocumentMarker* FirstMarkerIntersectingRange(unsigned start_offset, + unsigned end_offset) const final; + HeapVector<Member<DocumentMarker>> MarkersIntersectingRange( + unsigned start_offset, + unsigned end_offset) const final; + + bool MoveMarkers(int length, DocumentMarkerList* dst_list) final; + bool RemoveMarkers(unsigned start_offset, int length) final; + bool ShiftMarkers(const String& node_text, + unsigned offset, + unsigned old_length, + unsigned new_length) final; + + void Trace(blink::Visitor*) const override; + + protected: + HighlightPseudoMarkerListImpl() = default; + + private: + HeapVector<Member<DocumentMarker>> markers_; +}; + +template <> +struct DowncastTraits<HighlightPseudoMarkerListImpl> { + static bool AllowFrom(const DocumentMarkerList& list) { + return list.MarkerType() == DocumentMarker::kHighlight || + list.MarkerType() == DocumentMarker::kTextFragment; + } +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_HIGHLIGHT_PSEUDO_MARKER_LIST_IMPL_H_
diff --git a/third_party/blink/renderer/core/editing/markers/text_fragment_marker_list_impl.h b/third_party/blink/renderer/core/editing/markers/text_fragment_marker_list_impl.h index 26936a8c..1ea87d7a 100644 --- a/third_party/blink/renderer/core/editing/markers/text_fragment_marker_list_impl.h +++ b/third_party/blink/renderer/core/editing/markers/text_fragment_marker_list_impl.h
@@ -5,14 +5,14 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_TEXT_FRAGMENT_MARKER_LIST_IMPL_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_TEXT_FRAGMENT_MARKER_LIST_IMPL_H_ -#include "third_party/blink/renderer/core/editing/markers/text_marker_base_list_impl.h" +#include "third_party/blink/renderer/core/editing/markers/highlight_pseudo_marker_list_impl.h" #include "third_party/blink/renderer/platform/wtf/casting.h" namespace blink { // Implementation of TextMarkerBaseListImpl for TextFragment markers. class CORE_EXPORT TextFragmentMarkerListImpl final - : public TextMarkerBaseListImpl { + : public HighlightPseudoMarkerListImpl { public: TextFragmentMarkerListImpl() = default; TextFragmentMarkerListImpl(const TextFragmentMarkerListImpl&) = delete; @@ -28,7 +28,7 @@ static bool AllowFrom(const DocumentMarkerList& list) { return list.MarkerType() == DocumentMarker::kTextFragment; } - static bool AllowFrom(const TextMarkerBaseListImpl& list) { + static bool AllowFrom(const HighlightPseudoMarkerListImpl& list) { return list.MarkerType() == DocumentMarker::kTextFragment; } };
diff --git a/third_party/blink/renderer/core/editing/markers/text_marker_base_list_impl.cc b/third_party/blink/renderer/core/editing/markers/text_marker_base_list_impl.cc deleted file mode 100644 index 35044d6..0000000 --- a/third_party/blink/renderer/core/editing/markers/text_marker_base_list_impl.cc +++ /dev/null
@@ -1,67 +0,0 @@ -// 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 "third_party/blink/renderer/core/editing/markers/text_marker_base_list_impl.h" -#include "third_party/blink/renderer/core/editing/markers/sorted_document_marker_list_editor.h" - -namespace blink { - -bool TextMarkerBaseListImpl::IsEmpty() const { - return markers_.IsEmpty(); -} - -void TextMarkerBaseListImpl::Add(DocumentMarker* marker) { - DCHECK_EQ(marker->GetType(), MarkerType()); - SortedDocumentMarkerListEditor::AddMarkerWithoutMergingOverlapping(&markers_, - marker); -} - -void TextMarkerBaseListImpl::Clear() { - markers_.clear(); -} - -const HeapVector<Member<DocumentMarker>>& TextMarkerBaseListImpl::GetMarkers() - const { - return markers_; -} - -DocumentMarker* TextMarkerBaseListImpl::FirstMarkerIntersectingRange( - unsigned start_offset, - unsigned end_offset) const { - return SortedDocumentMarkerListEditor::FirstMarkerIntersectingRange( - markers_, start_offset, end_offset); -} - -HeapVector<Member<DocumentMarker>> -TextMarkerBaseListImpl::MarkersIntersectingRange(unsigned start_offset, - unsigned end_offset) const { - return SortedDocumentMarkerListEditor::MarkersIntersectingRange( - markers_, start_offset, end_offset); -} - -bool TextMarkerBaseListImpl::MoveMarkers(int length, - DocumentMarkerList* dst_list) { - return SortedDocumentMarkerListEditor::MoveMarkers(&markers_, length, - dst_list); -} - -bool TextMarkerBaseListImpl::RemoveMarkers(unsigned start_offset, int length) { - return SortedDocumentMarkerListEditor::RemoveMarkers(&markers_, start_offset, - length); -} - -bool TextMarkerBaseListImpl::ShiftMarkers(const String&, - unsigned offset, - unsigned old_length, - unsigned new_length) { - return SortedDocumentMarkerListEditor::ShiftMarkersContentDependent( - &markers_, offset, old_length, new_length); -} - -void TextMarkerBaseListImpl::Trace(Visitor* visitor) const { - visitor->Trace(markers_); - DocumentMarkerList::Trace(visitor); -} - -} // namespace blink
diff --git a/third_party/blink/renderer/core/editing/markers/text_marker_base_list_impl.h b/third_party/blink/renderer/core/editing/markers/text_marker_base_list_impl.h deleted file mode 100644 index 4ffbb95..0000000 --- a/third_party/blink/renderer/core/editing/markers/text_marker_base_list_impl.h +++ /dev/null
@@ -1,61 +0,0 @@ -// 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. - -#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_TEXT_MARKER_BASE_LIST_IMPL_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_TEXT_MARKER_BASE_LIST_IMPL_H_ - -#include "third_party/blink/renderer/core/editing/markers/document_marker_list.h" -#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h" -#include "third_party/blink/renderer/platform/wtf/casting.h" - -namespace blink { - -// Nearly-complete implementation of DocumentMarkerList for text match or text -// fragment markers (subclassed by TextMatchMarkerListImpl and -// TextFragmentMarkerListImpl to implement the MarkerType() method). -// TODO(rego): Remove this class and add a HighlightPseudoMarkerListImpl instead -// (to match HighlightPseudoMarker classes). -class CORE_EXPORT TextMarkerBaseListImpl : public DocumentMarkerList { - public: - TextMarkerBaseListImpl(const TextMarkerBaseListImpl&) = delete; - TextMarkerBaseListImpl& operator=(const TextMarkerBaseListImpl&) = delete; - - // DocumentMarkerList implementations - bool IsEmpty() const final; - - void Add(DocumentMarker*) final; - void Clear() final; - - const HeapVector<Member<DocumentMarker>>& GetMarkers() const final; - DocumentMarker* FirstMarkerIntersectingRange(unsigned start_offset, - unsigned end_offset) const final; - HeapVector<Member<DocumentMarker>> MarkersIntersectingRange( - unsigned start_offset, - unsigned end_offset) const final; - - bool MoveMarkers(int length, DocumentMarkerList* dst_list) final; - bool RemoveMarkers(unsigned start_offset, int length) final; - bool ShiftMarkers(const String& node_text, - unsigned offset, - unsigned old_length, - unsigned new_length) final; - - void Trace(Visitor*) const override; - - protected: - TextMarkerBaseListImpl() = default; - HeapVector<Member<DocumentMarker>> markers_; -}; - -template <> -struct DowncastTraits<TextMarkerBaseListImpl> { - static bool AllowFrom(const DocumentMarkerList& list) { - return list.MarkerType() == DocumentMarker::kTextMatch || - list.MarkerType() == DocumentMarker::kTextFragment; - } -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_TEXT_MARKER_BASE_LIST_IMPL_H_
diff --git a/third_party/blink/renderer/core/editing/markers/text_match_marker_list_impl.cc b/third_party/blink/renderer/core/editing/markers/text_match_marker_list_impl.cc index f9c8599d..70b2a5f 100644 --- a/third_party/blink/renderer/core/editing/markers/text_match_marker_list_impl.cc +++ b/third_party/blink/renderer/core/editing/markers/text_match_marker_list_impl.cc
@@ -8,6 +8,7 @@ #include "third_party/blink/renderer/core/dom/node.h" #include "third_party/blink/renderer/core/dom/range.h" #include "third_party/blink/renderer/core/editing/ephemeral_range.h" +#include "third_party/blink/renderer/core/editing/markers/sorted_document_marker_list_editor.h" #include "third_party/blink/renderer/core/editing/markers/text_match_marker.h" #include "third_party/blink/renderer/core/editing/visible_units.h" #include "third_party/blink/renderer/core/frame/local_frame.h" @@ -20,6 +21,63 @@ return DocumentMarker::kTextMatch; } +bool TextMatchMarkerListImpl::IsEmpty() const { + return markers_.IsEmpty(); +} + +void TextMatchMarkerListImpl::Add(DocumentMarker* marker) { + DCHECK_EQ(marker->GetType(), MarkerType()); + SortedDocumentMarkerListEditor::AddMarkerWithoutMergingOverlapping(&markers_, + marker); +} + +void TextMatchMarkerListImpl::Clear() { + markers_.clear(); +} + +const HeapVector<Member<DocumentMarker>>& TextMatchMarkerListImpl::GetMarkers() + const { + return markers_; +} + +DocumentMarker* TextMatchMarkerListImpl::FirstMarkerIntersectingRange( + unsigned start_offset, + unsigned end_offset) const { + return SortedDocumentMarkerListEditor::FirstMarkerIntersectingRange( + markers_, start_offset, end_offset); +} + +HeapVector<Member<DocumentMarker>> +TextMatchMarkerListImpl::MarkersIntersectingRange(unsigned start_offset, + unsigned end_offset) const { + return SortedDocumentMarkerListEditor::MarkersIntersectingRange( + markers_, start_offset, end_offset); +} + +bool TextMatchMarkerListImpl::MoveMarkers(int length, + DocumentMarkerList* dst_list) { + return SortedDocumentMarkerListEditor::MoveMarkers(&markers_, length, + dst_list); +} + +bool TextMatchMarkerListImpl::RemoveMarkers(unsigned start_offset, int length) { + return SortedDocumentMarkerListEditor::RemoveMarkers(&markers_, start_offset, + length); +} + +bool TextMatchMarkerListImpl::ShiftMarkers(const String&, + unsigned offset, + unsigned old_length, + unsigned new_length) { + return SortedDocumentMarkerListEditor::ShiftMarkersContentDependent( + &markers_, offset, old_length, new_length); +} + +void TextMatchMarkerListImpl::Trace(Visitor* visitor) const { + visitor->Trace(markers_); + DocumentMarkerList::Trace(visitor); +} + static void UpdateMarkerLayoutRect(const Node& node, TextMatchMarker& marker) { DCHECK(node.GetDocument().GetFrame()); LocalFrameView* frame_view = node.GetDocument().GetFrame()->View();
diff --git a/third_party/blink/renderer/core/editing/markers/text_match_marker_list_impl.h b/third_party/blink/renderer/core/editing/markers/text_match_marker_list_impl.h index 6a1b6d9..af033fe 100644 --- a/third_party/blink/renderer/core/editing/markers/text_match_marker_list_impl.h +++ b/third_party/blink/renderer/core/editing/markers/text_match_marker_list_impl.h
@@ -5,7 +5,8 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_TEXT_MATCH_MARKER_LIST_IMPL_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_TEXT_MATCH_MARKER_LIST_IMPL_H_ -#include "third_party/blink/renderer/core/editing/markers/text_marker_base_list_impl.h" +#include "third_party/blink/renderer/core/editing/markers/document_marker_list.h" +#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h" #include "third_party/blink/renderer/platform/wtf/casting.h" namespace blink { @@ -13,11 +14,10 @@ class IntRect; class Node; -// Implementation of TextMarkerBaseListImpl for TextMatch markers. +// Nearly-complete implementation of DocumentMarkerList for text match markers. // Markers are kept sorted by start offset, under the assumption that // TextMatch markers are typically inserted in an order. -class CORE_EXPORT TextMatchMarkerListImpl final - : public TextMarkerBaseListImpl { +class CORE_EXPORT TextMatchMarkerListImpl final : public DocumentMarkerList { public: TextMatchMarkerListImpl() = default; TextMatchMarkerListImpl(const TextMatchMarkerListImpl&) = delete; @@ -25,6 +25,26 @@ // DocumentMarkerList implementations DocumentMarker::MarkerType MarkerType() const final; + bool IsEmpty() const final; + + void Add(DocumentMarker*) final; + void Clear() final; + + const HeapVector<Member<DocumentMarker>>& GetMarkers() const final; + DocumentMarker* FirstMarkerIntersectingRange(unsigned start_offset, + unsigned end_offset) const final; + HeapVector<Member<DocumentMarker>> MarkersIntersectingRange( + unsigned start_offset, + unsigned end_offset) const final; + + bool MoveMarkers(int length, DocumentMarkerList* dst_list) final; + bool RemoveMarkers(unsigned start_offset, int length) final; + bool ShiftMarkers(const String& node_text, + unsigned offset, + unsigned old_length, + unsigned new_length) final; + + void Trace(Visitor*) const override; // TextMatchMarkerListImpl-specific Vector<IntRect> LayoutRects(const Node&) const; @@ -33,6 +53,9 @@ bool SetTextMatchMarkersActive(unsigned start_offset, unsigned end_offset, bool); + + private: + HeapVector<Member<DocumentMarker>> markers_; }; template <> @@ -40,9 +63,6 @@ static bool AllowFrom(const DocumentMarkerList& list) { return list.MarkerType() == DocumentMarker::kTextMatch; } - static bool AllowFrom(const TextMarkerBaseListImpl& list) { - return list.MarkerType() == DocumentMarker::kTextMatch; - } }; } // namespace blink
diff --git a/third_party/blink/renderer/core/events/message_event_test.cc b/third_party/blink/renderer/core/events/message_event_test.cc index e37b9cb..479573c 100644 --- a/third_party/blink/renderer/core/events/message_event_test.cc +++ b/third_party/blink/renderer/core/events/message_event_test.cc
@@ -7,7 +7,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/bindings/core/v8/script_controller.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" #include "third_party/blink/renderer/core/frame/local_frame.h"
diff --git a/third_party/blink/renderer/core/events/touch_event_test.cc b/third_party/blink/renderer/core/events/touch_event_test.cc index 31388c1d..eeb303d9 100644 --- a/third_party/blink/renderer/core/events/touch_event_test.cc +++ b/third_party/blink/renderer/core/events/touch_event_test.cc
@@ -103,8 +103,8 @@ "document.dispatchEvent(touch_event);"; GetDocument().GetSettings()->SetScriptEnabled(true); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(script)) - ->RunScript(GetDocument().domWindow()); + ClassicScript::CreateUnspecifiedScript(script)->RunScript( + GetDocument().domWindow()); } class TouchEventTestNoFrame : public testing::Test {};
diff --git a/third_party/blink/renderer/core/exported/web_plugin_container_impl.cc b/third_party/blink/renderer/core/exported/web_plugin_container_impl.cc index e63a0685..a9843a0 100644 --- a/third_party/blink/renderer/core/exported/web_plugin_container_impl.cc +++ b/third_party/blink/renderer/core/exported/web_plugin_container_impl.cc
@@ -49,7 +49,6 @@ #include "third_party/blink/public/web/web_print_preset_options.h" #include "third_party/blink/public/web/web_view_client.h" #include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_element.h" #include "third_party/blink/renderer/core/clipboard/clipboard_utilities.h"
diff --git a/third_party/blink/renderer/core/frame/dom_timer_test.cc b/third_party/blink/renderer/core/frame/dom_timer_test.cc index f6bf354..dba92a1 100644 --- a/third_party/blink/renderer/core/frame/dom_timer_test.cc +++ b/third_party/blink/renderer/core/frame/dom_timer_test.cc
@@ -10,7 +10,6 @@ #include "third_party/blink/public/common/features.h" #include "third_party/blink/renderer/bindings/core/v8/idl_types.h" #include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/script/classic_script.h" @@ -62,7 +61,7 @@ } v8::Local<v8::Value> EvalExpression(const char* expr) { - return ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(expr)) + return ClassicScript::CreateUnspecifiedScript(expr) ->RunScriptAndReturnValue(GetDocument().domWindow()); } @@ -79,9 +78,8 @@ } void ExecuteScriptAndWaitUntilIdle(const char* script_text) { - ScriptSourceCode script(script_text); - ClassicScript::CreateUnspecifiedScript(script)->RunScript( - GetDocument().domWindow()); + ClassicScript::CreateUnspecifiedScript(String(script_text)) + ->RunScript(GetDocument().domWindow()); platform()->RunUntilIdle(); } };
diff --git a/third_party/blink/renderer/core/frame/local_frame_back_forward_cache_test.cc b/third_party/blink/renderer/core/frame/local_frame_back_forward_cache_test.cc index d17b433..413fbb9 100644 --- a/third_party/blink/renderer/core/frame/local_frame_back_forward_cache_test.cc +++ b/third_party/blink/renderer/core/frame/local_frame_back_forward_cache_test.cc
@@ -105,8 +105,7 @@ // hand, the case 2) can happen. See https://crbug.com/994169 Microtask::EnqueueMicrotask(base::BindOnce( [](LocalFrame* frame) { - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("console.log('hi');")) + ClassicScript::CreateUnspecifiedScript("console.log('hi');") ->RunScript(frame->DomWindow()); }, frame));
diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc index a07cd4d..c5c8c290b 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
@@ -249,8 +249,8 @@ } createShadowRootWithin(document.body); )"; - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(script, ScriptSourceLocationType::kInternal)) + ClassicScript::CreateUnspecifiedScript(script, + ScriptSourceLocationType::kInternal) ->RunScript(web_frame_->GetFrame()->DomWindow(), ExecuteScriptPolicy::kExecuteScriptWhenScriptsDisabled); }
diff --git a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc index 90f98cf..9c780940 100644 --- a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc +++ b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc
@@ -885,7 +885,8 @@ // `kDoNotSanitize` is used because this is only for tests and some tests // need `kDoNotSanitize` for dynamic imports. ClassicScript* script = ClassicScript::CreateUnspecifiedScript( - javascript, SanitizeScriptErrors::kDoNotSanitize); + javascript, ScriptSourceLocationType::kUnknown, + SanitizeScriptErrors::kDoNotSanitize); if (world_id == DOMWrapperWorld::kMainWorldId) { result = script->RunScriptAndReturnValue(DomWindow());
diff --git a/third_party/blink/renderer/core/frame/pausable_script_executor.cc b/third_party/blink/renderer/core/frame/pausable_script_executor.cc index bda1c02..0de6b69 100644 --- a/third_party/blink/renderer/core/frame/pausable_script_executor.cc +++ b/third_party/blink/renderer/core/frame/pausable_script_executor.cc
@@ -17,7 +17,6 @@ #include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h" #include "third_party/blink/renderer/bindings/core/v8/script_function.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/window_proxy.h" #include "third_party/blink/renderer/core/dom/document.h"
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc index a8b77e9d..bba0ce47 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
@@ -141,7 +141,6 @@ #include "third_party/blink/renderer/bindings/core/v8/isolated_world_csp.h" #include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h" #include "third_party/blink/renderer/bindings/core/v8/script_controller.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/bindings/core/v8/source_location.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
diff --git a/third_party/blink/renderer/core/inspector/dev_tools_host.cc b/third_party/blink/renderer/core/inspector/dev_tools_host.cc index 090b8f0..056bf63 100644 --- a/third_party/blink/renderer/core/inspector/dev_tools_host.cc +++ b/third_party/blink/renderer/core/inspector/dev_tools_host.cc
@@ -131,7 +131,7 @@ V8ScriptRunner::CompileAndRunInternalScript( script_state->GetIsolate(), script_state, *ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(expression, ScriptSourceLocationType::kInternal), + expression, ScriptSourceLocationType::kInternal, SanitizeScriptErrors::kDoNotSanitize)); }
diff --git a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc index a0de3d9d..6fbb3d9 100644 --- a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc
@@ -40,7 +40,6 @@ #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_data.h" #include "third_party/blink/public/resources/grit/inspector_overlay_resources_map.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_inspector_overlay_host.h" #include "third_party/blink/renderer/core/display_lock/display_lock_utilities.h" @@ -1326,11 +1325,9 @@ std::vector<uint8_t> json; ConvertCBORToJSON(SpanFrom(command->Serialize()), &json); ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode( - "dispatch(" + - String(reinterpret_cast<const char*>(json.data()), json.size()) + - ")", - ScriptSourceLocationType::kInspector)) + "dispatch(" + + String(reinterpret_cast<const char*>(json.data()), json.size()) + ")", + ScriptSourceLocationType::kInspector) ->RunScript(To<LocalFrame>(OverlayMainFrame())->DomWindow(), ExecuteScriptPolicy::kExecuteScriptWhenScriptsDisabled); } @@ -1345,11 +1342,9 @@ std::vector<uint8_t> json; ConvertCBORToJSON(SpanFrom(command->Serialize()), &json); ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode( - "dispatch(" + - String(reinterpret_cast<const char*>(json.data()), json.size()) + - ")", - ScriptSourceLocationType::kInspector)) + "dispatch(" + + String(reinterpret_cast<const char*>(json.data()), json.size()) + ")", + ScriptSourceLocationType::kInspector) ->RunScript(To<LocalFrame>(OverlayMainFrame())->DomWindow(), ExecuteScriptPolicy::kExecuteScriptWhenScriptsDisabled); } @@ -1359,7 +1354,7 @@ v8::HandleScope handle_scope(ToIsolate(OverlayMainFrame())); v8::Local<v8::Value> string = ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(script, ScriptSourceLocationType::kInspector)) + script, ScriptSourceLocationType::kInspector) ->RunScriptAndReturnValue( To<LocalFrame>(OverlayMainFrame())->DomWindow(), ExecuteScriptPolicy::kExecuteScriptWhenScriptsDisabled);
diff --git a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc index 045bec00..34780f2 100644 --- a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc
@@ -40,7 +40,6 @@ #include "third_party/blink/public/mojom/ad_tagging/ad_evidence.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/script_controller.h" #include "third_party/blink/renderer/bindings/core/v8/script_regexp.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/document_timing.h" #include "third_party/blink/renderer/core/dom/dom_node_ids.h" @@ -947,13 +946,11 @@ v8_inspector::V8ContextInfo::executionContextId( script_state->GetContext())); DCHECK(scope); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source)) - ->RunScript(window, - ExecuteScriptPolicy::kExecuteScriptWhenScriptsDisabled); + ClassicScript::CreateUnspecifiedScript(source)->RunScript( + window, ExecuteScriptPolicy::kExecuteScriptWhenScriptsDisabled); } else { - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source)) - ->RunScript(window, - ExecuteScriptPolicy::kExecuteScriptWhenScriptsDisabled); + ClassicScript::CreateUnspecifiedScript(source)->RunScript( + window, ExecuteScriptPolicy::kExecuteScriptWhenScriptsDisabled); } continue; } @@ -975,17 +972,16 @@ v8_inspector::V8ContextInfo::executionContextId( script_state->GetContext())); DCHECK(scope); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source)) + ClassicScript::CreateUnspecifiedScript(source) ->RunScriptInIsolatedWorldAndReturnValue(window, world->GetWorldId()); } else { - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source)) + ClassicScript::CreateUnspecifiedScript(source) ->RunScriptInIsolatedWorldAndReturnValue(window, world->GetWorldId()); } } if (!script_to_evaluate_on_load_once_.IsEmpty()) { - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(script_to_evaluate_on_load_once_)) + ClassicScript::CreateUnspecifiedScript(script_to_evaluate_on_load_once_) ->RunScript(frame->DomWindow(), ExecuteScriptPolicy::kExecuteScriptWhenScriptsDisabled); } @@ -1677,16 +1673,15 @@ const ClassicScript& classic_script, v8::ScriptCompiler::CachedData** cached_data, v8::ScriptCompiler::CompileOptions* compile_options) { - if (classic_script.GetScriptSourceCode().SourceLocationType() != + if (classic_script.SourceLocationType() != ScriptSourceLocationType::kExternalFile) return; - if (classic_script.GetScriptSourceCode().Url().IsEmpty()) + if (classic_script.SourceUrl().IsEmpty()) return; - auto it = compilation_cache_.find( - classic_script.GetScriptSourceCode().Url().GetString()); + auto it = compilation_cache_.find(classic_script.SourceUrl().GetString()); if (it == compilation_cache_.end()) { auto requested = requested_compilation_cache_.find( - classic_script.GetScriptSourceCode().Url().GetString()); + classic_script.SourceUrl().GetString()); if (requested != requested_compilation_cache_.end() && requested->value) *compile_options = v8::ScriptCompiler::kEagerCompile; return; @@ -1700,7 +1695,7 @@ void InspectorPageAgent::DidProduceCompilationCache( const ClassicScript& classic_script, v8::Local<v8::Script> script) { - KURL url = classic_script.GetScriptSourceCode().Url(); + KURL url = classic_script.SourceUrl(); if (url.IsEmpty()) return; String url_string = url.GetString(); @@ -1708,15 +1703,14 @@ if (requested == requested_compilation_cache_.end()) return; requested_compilation_cache_.erase(requested); - if (classic_script.GetScriptSourceCode().SourceLocationType() != + if (classic_script.SourceLocationType() != ScriptSourceLocationType::kExternalFile) return; // TODO(caseq): should we rather issue updates if compiled code differs? if (compilation_cache_.Contains(url_string)) return; static const int kMinimalCodeLength = 1024; - if (classic_script.GetScriptSourceCode().Source().length() < - kMinimalCodeLength) + if (classic_script.SourceText().length() < kMinimalCodeLength) return; std::unique_ptr<v8::ScriptCompiler::CachedData> cached_data( v8::ScriptCompiler::CreateCodeCache(script->GetUnboundScript()));
diff --git a/third_party/blink/renderer/core/inspector/inspector_trace_events.cc b/third_party/blink/renderer/core/inspector/inspector_trace_events.cc index b9c1dd3..7da7a28 100644 --- a/third_party/blink/renderer/core/inspector/inspector_trace_events.cc +++ b/third_party/blink/renderer/core/inspector/inspector_trace_events.cc
@@ -10,7 +10,6 @@ #include "cc/layers/picture_layer.h" #include "third_party/blink/public/mojom/loader/request_context_frame_type.mojom-blink.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/source_location.h" #include "third_party/blink/renderer/core/animation/animation.h" #include "third_party/blink/renderer/core/animation/keyframe_effect.h"
diff --git a/third_party/blink/renderer/core/inspector/thread_debugger.cc b/third_party/blink/renderer/core/inspector/thread_debugger.cc index 7e4372a..176ad7e6 100644 --- a/third_party/blink/renderer/core/inspector/thread_debugger.cc +++ b/third_party/blink/renderer/core/inspector/thread_debugger.cc
@@ -363,15 +363,14 @@ v8::Local<v8::Value> function_value; // `kDoNotSanitize` is used for internal scripts for keeping the existing // behavior. - bool success = - V8ScriptRunner::CompileAndRunInternalScript( - isolate_, ScriptState::From(context), - *ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("(function(e) { console.log(e.type, e); })", - ScriptSourceLocationType::kInternal), - SanitizeScriptErrors::kDoNotSanitize)) - .ToLocal(&function_value) && - function_value->IsFunction(); + bool success = V8ScriptRunner::CompileAndRunInternalScript( + isolate_, ScriptState::From(context), + *ClassicScript::CreateUnspecifiedScript( + "(function(e) { console.log(e.type, e); })", + ScriptSourceLocationType::kInternal, + SanitizeScriptErrors::kDoNotSanitize)) + .ToLocal(&function_value) && + function_value->IsFunction(); DCHECK(success); CreateFunctionPropertyWithData( context, object, "monitorEvents", ThreadDebugger::MonitorEventsCallback,
diff --git a/third_party/blink/renderer/core/intersection_observer/intersection_observer_test.cc b/third_party/blink/renderer/core/intersection_observer/intersection_observer_test.cc index b282e63f..bb7cf51 100644 --- a/third_party/blink/renderer/core/intersection_observer/intersection_observer_test.cc +++ b/third_party/blink/renderer/core/intersection_observer/intersection_observer_test.cc
@@ -7,7 +7,6 @@ #include "build/build_config.h" #include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h" #include "third_party/blink/renderer/bindings/core/v8/script_controller.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" #include "third_party/blink/renderer/bindings/core/v8/v8_intersection_observer_init.h" #include "third_party/blink/renderer/bindings/core/v8/v8_union_document_element.h"
diff --git a/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.cc b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.cc index bc2d5b3..01ec8af 100644 --- a/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.cc
@@ -6,7 +6,6 @@ #include "mojo/public/cpp/bindings/pending_remote.h" #include "third_party/blink/public/mojom/script/script_type.mojom-blink.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h"
diff --git a/third_party/blink/renderer/core/layout/ng/flex/ng_flex_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/flex/ng_flex_layout_algorithm.cc index a714eedc..cf639175 100644 --- a/third_party/blink/renderer/core/layout/ng/flex/ng_flex_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/flex/ng_flex_layout_algorithm.cc
@@ -1026,9 +1026,11 @@ : line_contexts[0].cross_axis_offset_; LayoutUnit final_content_main_size = - container_builder_.InlineSize() - BorderScrollbarPadding().InlineSum(); + (container_builder_.InlineSize() - BorderScrollbarPadding().InlineSum()) + .ClampNegativeToZero(); LayoutUnit final_content_cross_size = - total_block_size_ - BorderScrollbarPadding().BlockSum(); + (total_block_size_ - BorderScrollbarPadding().BlockSum()) + .ClampNegativeToZero(); if (is_column_) std::swap(final_content_main_size, final_content_cross_size); @@ -1061,10 +1063,12 @@ LayoutUnit final_content_cross_size; if (is_column_) { final_content_cross_size = - container_builder_.InlineSize() - BorderScrollbarPadding().InlineSum(); + (container_builder_.InlineSize() - BorderScrollbarPadding().InlineSum()) + .ClampNegativeToZero(); } else { final_content_cross_size = - total_block_size_ - BorderScrollbarPadding().BlockSum(); + (total_block_size_ - BorderScrollbarPadding().BlockSum()) + .ClampNegativeToZero(); } absl::optional<LayoutUnit> fallback_baseline;
diff --git a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm_test.cc b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm_test.cc index 4e30cdb..cc9d9c8b 100644 --- a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm_test.cc +++ b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm_test.cc
@@ -36,11 +36,13 @@ class NGGridLayoutAlgorithmTest : public NGBaseLayoutAlgorithmTest, private ScopedLayoutNGGridForTest, - private ScopedLayoutNGBlockFragmentationForTest { + private ScopedLayoutNGBlockFragmentationForTest, + private ScopedLayoutNGSubgridForTest { protected: NGGridLayoutAlgorithmTest() : ScopedLayoutNGGridForTest(true), - ScopedLayoutNGBlockFragmentationForTest(true) {} + ScopedLayoutNGBlockFragmentationForTest(true), + ScopedLayoutNGSubgridForTest(true) {} void SetUp() override { NGBaseLayoutAlgorithmTest::SetUp(); } @@ -205,9 +207,6 @@ }; TEST_F(NGGridLayoutAlgorithmTest, NGGridLayoutAlgorithmBaseSetSizes) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - SetBodyInnerHTML(R"HTML( <style> #grid1 { @@ -247,9 +246,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, NGGridLayoutAlgorithmRanges) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - SetBodyInnerHTML(R"HTML( <style> #grid1 { @@ -304,9 +300,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, NGGridLayoutAlgorithmRangesWithAutoRepeater) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - SetBodyInnerHTML(R"HTML( <style> #grid1 { @@ -374,9 +367,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, NGGridLayoutAlgorithmRangesImplicit) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - SetBodyInnerHTML(R"HTML( <style> #grid1 { @@ -449,9 +439,6 @@ TEST_F(NGGridLayoutAlgorithmTest, NGGridLayoutAlgorithmRangesImplicitAutoColumns) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - SetBodyInnerHTML(R"HTML( <style> #grid1 { @@ -516,9 +503,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, NGGridLayoutAlgorithmRangesImplicitAutoRows) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - SetBodyInnerHTML(R"HTML( <style> #grid1 { @@ -586,9 +570,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, NGGridLayoutAlgorithmRangesImplicitMixed) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - SetBodyInnerHTML(R"HTML( <style> #grid1 { @@ -645,9 +626,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, NGGridLayoutAlgorithmAutoGridPositions) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - SetBodyInnerHTML(R"HTML( <style> body { @@ -722,9 +700,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, NGGridLayoutAlgorithmAutoDense) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - SetBodyInnerHTML(R"HTML( <style> #grid { @@ -881,9 +856,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, NGGridLayoutAlgorithmGridPositions) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - SetBodyInnerHTML(R"HTML( <style> #grid { @@ -948,9 +920,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, NGGridLayoutAlgorithmResolveFixedTrackSizes) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - SetBodyInnerHTML(R"HTML( <style> #grid { @@ -1009,9 +978,6 @@ TEST_F(NGGridLayoutAlgorithmTest, NGGridLayoutAlgorithmDetermineGridItemsSpanningIntrinsicOrFlexTracks) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - SetBodyInnerHTML(R"HTML( <style> #grid { @@ -1094,9 +1060,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, FixedSizePositioning) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - LoadAhem(); SetBodyInnerHTML(R"HTML( <style> @@ -1146,9 +1109,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, FixedSizePositioningAutoRows) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - LoadAhem(); SetBodyInnerHTML(R"HTML( <style> @@ -1206,9 +1166,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, SpecifiedPositionsOutOfOrder) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - LoadAhem(); SetBodyInnerHTML(R"HTML( <style> @@ -1283,9 +1240,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, GridWithGap) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - LoadAhem(); SetBodyInnerHTML(R"HTML( <style> @@ -1336,9 +1290,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, GridWithPercentGap) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - LoadAhem(); SetBodyInnerHTML(R"HTML( <style> @@ -1393,9 +1344,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, AutoSizedGridWithGap) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - LoadAhem(); SetBodyInnerHTML(R"HTML( <style> @@ -1450,9 +1398,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, AutoSizedGridWithPercentageGap) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - SetBodyInnerHTML(R"HTML( <style> #grid { @@ -1498,9 +1443,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, ItemsSizeWithGap) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - LoadAhem(); SetBodyInnerHTML(R"HTML( <style> @@ -1562,9 +1504,6 @@ } TEST_F(NGGridLayoutAlgorithmTest, PositionedOutOfFlowItems) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; - SetBodyInnerHTML(R"HTML( <style> #grid { @@ -1704,4 +1643,134 @@ EXPECT_EQ(expectation, dump); } +TEST_F(NGGridLayoutAlgorithmTest, NGGridAxisType) { + SetBodyInnerHTML(R"HTML( + <style> + #grid { + display: grid; + } + + #subgrid { + grid-template-columns: subgrid; + grid-template-rows: subgrid [a]; + } + + </style> + <div id="grid"> + <div id="subgrid"></div> + </div> + )HTML"); + + NGBlockNode grid_node(GetLayoutBoxByElementId("grid")); + NGBlockNode subgrid_node(GetLayoutBoxByElementId("subgrid")); + const ComputedStyle& grid_style = grid_node.Style(); + const ComputedStyle& subgrid_style = subgrid_node.Style(); + + EXPECT_EQ(grid_style.GridColumnsAxisType(), GridAxisType::kStandaloneAxis); + EXPECT_EQ(grid_style.GridRowsAxisType(), GridAxisType::kStandaloneAxis); + EXPECT_EQ(subgrid_style.GridColumnsAxisType(), GridAxisType::kSubgriddedAxis); + EXPECT_EQ(subgrid_style.GridRowsAxisType(), GridAxisType::kSubgriddedAxis); +} + +TEST_F(NGGridLayoutAlgorithmTest, SubgridLineNameList) { + SetBodyInnerHTML(R"HTML( + <style> + #grid { + display: grid; + } + + #subgrid { + grid-template-columns: subgrid; + grid-template-rows: subgrid [a] [b] [c]; + } + + </style> + <div id="grid"> + <div id="subgrid"></div> + </div> + )HTML"); + + NGBlockNode subgrid_node(GetLayoutBoxByElementId("subgrid")); + const ComputedStyle& subgrid_style = subgrid_node.Style(); + + EXPECT_EQ(subgrid_style.GridColumnsAxisType(), GridAxisType::kSubgriddedAxis); + EXPECT_EQ(subgrid_style.GridRowsAxisType(), GridAxisType::kSubgriddedAxis); + + EXPECT_TRUE(subgrid_style.OrderedNamedGridColumnLines().IsEmpty()); + + const OrderedNamedGridLines& ordered_named_grid_row_lines = + subgrid_style.OrderedNamedGridRowLines(); + EXPECT_EQ(ordered_named_grid_row_lines.size(), 3u); + + const Vector<NamedGridLine> row_named_lines = { + NamedGridLine("a"), NamedGridLine("b"), NamedGridLine("c")}; + for (wtf_size_t i = 0; i < 3; ++i) { + EXPECT_EQ(ordered_named_grid_row_lines.find(i)->value[0], + row_named_lines[i]); + } +} + +TEST_F(NGGridLayoutAlgorithmTest, SubgridLineNameListWithRepeaters) { + SetBodyInnerHTML(R"HTML( + <style> + #grid { + display: grid; + } + + #subgrid { + grid-template-columns: subgrid [a] repeat(auto-fill, [b] [c]) [d]; + grid-template-rows: subgrid [a] repeat(2, [b] [c]) [d]; + } + + </style> + <div id="grid"> + <div id="subgrid"></div> + </div> + )HTML"); + + NGBlockNode subgrid_node(GetLayoutBoxByElementId("subgrid")); + const ComputedStyle& subgrid_style = subgrid_node.Style(); + + EXPECT_EQ(subgrid_style.GridColumnsAxisType(), GridAxisType::kSubgriddedAxis); + EXPECT_EQ(subgrid_style.GridRowsAxisType(), GridAxisType::kSubgriddedAxis); + + const OrderedNamedGridLines& ordered_named_grid_column_lines = + subgrid_style.OrderedNamedGridColumnLines(); + const OrderedNamedGridLines& auto_repeat_ordered_named_grid_column_lines = + subgrid_style.AutoRepeatOrderedNamedGridColumnLines(); + + EXPECT_EQ(ordered_named_grid_column_lines.size(), 2u); + EXPECT_EQ(auto_repeat_ordered_named_grid_column_lines.size(), 2u); + + const Vector<NamedGridLine> column_named_lines = { + NamedGridLine("a"), NamedGridLine("b"), NamedGridLine("c"), + NamedGridLine("d")}; + + EXPECT_EQ(ordered_named_grid_column_lines.find(0)->value[0], + column_named_lines[0]); + EXPECT_EQ(ordered_named_grid_column_lines.find(2)->value[0], + column_named_lines[3]); + for (wtf_size_t i = 0; i < 2; ++i) { + EXPECT_EQ(auto_repeat_ordered_named_grid_column_lines.find(i)->value[0], + column_named_lines[i + 1]); + } + + const OrderedNamedGridLines& ordered_named_grid_row_lines = + subgrid_style.OrderedNamedGridRowLines(); + EXPECT_EQ(ordered_named_grid_row_lines.size(), 6u); + + const Vector<NamedGridLine> row_named_lines = { + NamedGridLine("a"), + NamedGridLine("b", /* is_in_repeat */ true, /* is_first_repeat */ true), + NamedGridLine("c", /* is_in_repeat */ true, /* is_first_repeat */ true), + NamedGridLine("b", /* is_in_repeat */ true), + NamedGridLine("c", /* is_in_repeat */ true), + NamedGridLine("d")}; + + for (wtf_size_t i = 0; i < 6; ++i) { + EXPECT_EQ(ordered_named_grid_row_lines.find(i)->value[0], + row_named_lines[i]); + } +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc index 3cde28f9..727e11f9 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc
@@ -501,7 +501,6 @@ Current().IsLineBreak() && // This is for old compatible that old doesn't paint last br in a page. !IsLastBRInPage(*Current().GetLayoutObject())) { - DCHECK(!logical_rect.size.inline_size); logical_rect.size.inline_size = LayoutUnit(Current().Style().GetFont().SpaceWidth()); }
diff --git a/third_party/blink/renderer/core/probe/core_probes.json5 b/third_party/blink/renderer/core/probe/core_probes.json5 index d2efca4..0d15e265 100644 --- a/third_party/blink/renderer/core/probe/core_probes.json5 +++ b/third_party/blink/renderer/core/probe/core_probes.json5
@@ -4,7 +4,6 @@ export_symbol: "CORE_EXPORT", include_path: "third_party/blink/renderer/core/inspector", includes: [ - "third_party/blink/renderer/bindings/core/v8/script_source_code.h", "third_party/blink/renderer/core/animation/animation.h", "third_party/blink/renderer/core/core_probe_sink.h", "third_party/blink/renderer/core/dom/character_data.h",
diff --git a/third_party/blink/renderer/core/resize_observer/resize_observer_test.cc b/third_party/blink/renderer/core/resize_observer/resize_observer_test.cc index 5403e533b..6077227 100644 --- a/third_party/blink/renderer/core/resize_observer/resize_observer_test.cc +++ b/third_party/blink/renderer/core/resize_observer/resize_observer_test.cc
@@ -6,7 +6,6 @@ #include "third_party/blink/public/web/web_heap.h" #include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" #include "third_party/blink/renderer/bindings/core/v8/v8_resize_observer_options.h" #include "third_party/blink/renderer/core/exported/web_view_impl.h" @@ -256,11 +255,11 @@ // Test whether ResizeObserver is kept alive by direct JS reference // ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("var ro = new ResizeObserver( entries => {});")) + "var ro = new ResizeObserver( entries => {});") ->RunScript(&Window(), ExecuteScriptPolicy::kExecuteScriptWhenScriptsDisabled); ASSERT_EQ(observers.size(), 1U); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode("ro = undefined;")) + ClassicScript::CreateUnspecifiedScript("ro = undefined;") ->RunScript(&Window(), ExecuteScriptPolicy::kExecuteScriptWhenScriptsDisabled); ThreadState::Current()->CollectAllGarbageForTesting(); @@ -271,17 +270,17 @@ // Test whether ResizeObserver is kept alive by an Element // ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("var ro = new ResizeObserver( () => {});" - "var el = document.createElement('div');" - "ro.observe(el);" - "ro = undefined;")) + "var ro = new ResizeObserver( () => {});" + "var el = document.createElement('div');" + "ro.observe(el);" + "ro = undefined;") ->RunScript(&Window(), ExecuteScriptPolicy::kExecuteScriptWhenScriptsDisabled); ASSERT_EQ(observers.size(), 1U); ThreadState::Current()->CollectAllGarbageForTesting(); WebHeap::CollectAllGarbageForTesting(); ASSERT_EQ(observers.size(), 1U); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode("el = undefined;")) + ClassicScript::CreateUnspecifiedScript("el = undefined;") ->RunScript(&Window(), ExecuteScriptPolicy::kExecuteScriptWhenScriptsDisabled); ThreadState::Current()->CollectAllGarbageForTesting();
diff --git a/third_party/blink/renderer/core/scheduler_integration_tests/frame_throttling_test.cc b/third_party/blink/renderer/core/scheduler_integration_tests/frame_throttling_test.cc index 34ac154..f9ce3269 100644 --- a/third_party/blink/renderer/core/scheduler_integration_tests/frame_throttling_test.cc +++ b/third_party/blink/renderer/core/scheduler_integration_tests/frame_throttling_test.cc
@@ -12,7 +12,6 @@ #include "third_party/blink/public/test/test_web_frame_content_dumper.h" #include "third_party/blink/public/web/web_hit_test_result.h" #include "third_party/blink/public/web/web_settings.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_intersection_observer_init.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/element.h" @@ -1083,7 +1082,7 @@ EXPECT_TRUE(frame_element->contentDocument()->View()->CanThrottleRendering()); ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("document.body.innerHTML = 'throttled'")) + "document.body.innerHTML = 'throttled'") ->RunScript(To<LocalDOMWindow>(frame_element->contentWindow())); EXPECT_FALSE(Compositor().NeedsBeginFrame()); @@ -1324,14 +1323,13 @@ auto* second_frame_element = To<HTMLIFrameElement>(GetDocument().getElementById("second")); ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode( - "window.requestAnimationFrame(function() {\n" - " var throttledFrame = window.parent.frames.first;\n" - " throttledFrame.document.documentElement.style = 'margin: 50px';\n" - " " - "throttledFrame.document.querySelector('#d').getBoundingClientRect();" - "\n" - "});\n")) + "window.requestAnimationFrame(function() {\n" + " var throttledFrame = window.parent.frames.first;\n" + " throttledFrame.document.documentElement.style = 'margin: 50px';\n" + " " + "throttledFrame.document.querySelector('#d').getBoundingClientRect();" + "\n" + "});\n") ->RunScript(To<LocalDOMWindow>(second_frame_element->contentWindow())); CompositeFrame(); } @@ -1361,7 +1359,7 @@ v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::Local<v8::Value> result = - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode("window.didRaf;")) + ClassicScript::CreateUnspecifiedScript("window.didRaf;") ->RunScriptAndReturnValue( To<LocalDOMWindow>(frame_element->contentWindow())); EXPECT_TRUE(result->IsTrue());
diff --git a/third_party/blink/renderer/core/script/classic_pending_script.cc b/third_party/blink/renderer/core/script/classic_pending_script.cc index 7147c4c7..b30c7d6 100644 --- a/third_party/blink/renderer/core/script/classic_pending_script.cc +++ b/third_party/blink/renderer/core/script/classic_pending_script.cc
@@ -6,7 +6,6 @@ #include "third_party/blink/public/mojom/script/script_type.mojom-blink-forward.h" #include "third_party/blink/public/platform/task_type.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/script_streamer.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/core/dom/document.h" @@ -332,12 +331,12 @@ GetSchedulingType(), false, ScriptStreamer::NotStreamingReason::kInlineScript); - ScriptSourceCode source_code(source_text_for_inline_script_, - source_location_type_, cache_handler, - document_url, StartingPosition()); - return MakeGarbageCollected<ClassicScript>( - source_code, base_url_for_inline_script_, options_, - SanitizeScriptErrors::kDoNotSanitize); + return ClassicScript::Create( + source_text_for_inline_script_, + ClassicScript::StripFragmentIdentifier(document_url), + base_url_for_inline_script_, options_, source_location_type_, + SanitizeScriptErrors::kDoNotSanitize, cache_handler, + StartingPosition()); } DCHECK(GetResource()->IsLoaded()); @@ -373,18 +372,14 @@ TRACE_EVENT_FLAG_FLOW_IN, "not_streamed_reason", not_streamed_reason); - ScriptSourceCode source_code(streamer, cache_consumer_, resource, - not_streamed_reason); // The base URL for external classic script is // // <spec href="https://html.spec.whatwg.org/C/#concept-script-base-url"> // ... the URL from which the script was obtained, ...</spec> const KURL& base_url = resource->GetResponse().ResponseUrl(); - return MakeGarbageCollected<ClassicScript>( - source_code, base_url, options_, - resource->GetResponse().IsCorsSameOrigin() - ? SanitizeScriptErrors::kDoNotSanitize - : SanitizeScriptErrors::kSanitize); + return ClassicScript::CreateFromResource(resource, base_url, options_, + streamer, not_streamed_reason, + cache_consumer_); } // static
diff --git a/third_party/blink/renderer/core/script/classic_script.cc b/third_party/blink/renderer/core/script/classic_script.cc index 8811a64c..1471de8 100644 --- a/third_party/blink/renderer/core/script/classic_script.cc +++ b/third_party/blink/renderer/core/script/classic_script.cc
@@ -6,7 +6,6 @@ #include "third_party/blink/public/web/web_script_source.h" #include "third_party/blink/renderer/bindings/core/v8/script_controller.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h" @@ -16,6 +15,25 @@ namespace { +ParkableString TreatNullSourceAsEmpty(const ParkableString& source) { + // The following is the historical comment for this method, while this might + // be already obsolete, because `TreatNullSourceAsEmpty()` has been applied in + // all constructors since before. + // + // ScriptSourceCode allows for the representation of the null/not-there-really + // ScriptSourceCode value. Encoded by way of a source_.IsNull() being true, + // with the nullary constructor to be used to construct such a value. + // + // Should the other constructors be passed a null string, that is interpreted + // as representing the empty script. Consequently, we need to disambiguate + // between such null string occurrences. Do that by converting the latter + // case's null strings into empty ones. + if (source.IsNull()) + return ParkableString(); + + return source; +} + KURL SanitizeBaseUrl(const KURL& raw_base_url, SanitizeScriptErrors sanitize_script_errors) { // https://html.spec.whatwg.org/C/#creating-a-classic-script @@ -28,35 +46,120 @@ return raw_base_url; } +String SourceMapUrlFromResponse(const ResourceResponse& response) { + String source_map_url = response.HttpHeaderField(http_names::kSourceMap); + if (!source_map_url.IsEmpty()) + return source_map_url; + + // Try to get deprecated header. + return response.HttpHeaderField(http_names::kXSourceMap); +} + } // namespace -ClassicScript::ClassicScript(const ScriptSourceCode& script_source_code, - const KURL& base_url, - const ScriptFetchOptions& fetch_options, - SanitizeScriptErrors sanitize_script_errors) - : Script(fetch_options, SanitizeBaseUrl(base_url, sanitize_script_errors)), - script_source_code_(script_source_code), - sanitize_script_errors_(sanitize_script_errors) {} +KURL ClassicScript::StripFragmentIdentifier(const KURL& url) { + if (url.IsEmpty()) + return KURL(); + + if (!url.HasFragmentIdentifier()) + return url; + + KURL copy = url; + copy.RemoveFragmentIdentifier(); + return copy; +} + +ClassicScript* ClassicScript::Create( + const String& source_text, + const KURL& source_url, + const KURL& base_url, + const ScriptFetchOptions& fetch_options, + ScriptSourceLocationType source_location_type, + SanitizeScriptErrors sanitize_script_errors, + SingleCachedMetadataHandler* cache_handler, + const TextPosition& start_position, + ScriptStreamer::NotStreamingReason not_streaming_reason) { + // External files should use CreateFromResource(). + DCHECK(source_location_type != ScriptSourceLocationType::kExternalFile); + + return MakeGarbageCollected<ClassicScript>( + ParkableString(source_text.Impl()), source_url, base_url, fetch_options, + source_location_type, sanitize_script_errors, cache_handler, + start_position, nullptr, not_streaming_reason); +} + +ClassicScript* ClassicScript::CreateFromResource( + ScriptResource* resource, + const KURL& base_url, + const ScriptFetchOptions& fetch_options, + ScriptStreamer* streamer, + ScriptStreamer::NotStreamingReason not_streamed_reason, + ScriptCacheConsumer* cache_consumer) { + DCHECK_EQ(!streamer, not_streamed_reason != + ScriptStreamer::NotStreamingReason::kInvalid); + + // We lose the encoding information from ScriptResource. + // Not sure if that matters. + return MakeGarbageCollected<ClassicScript>( + resource->SourceText(), StripFragmentIdentifier(resource->Url()), + base_url, fetch_options, ScriptSourceLocationType::kExternalFile, + resource->GetResponse().IsCorsSameOrigin() + ? SanitizeScriptErrors::kDoNotSanitize + : SanitizeScriptErrors::kSanitize, + resource->CacheHandler(), TextPosition::MinimumPosition(), streamer, + not_streamed_reason, cache_consumer, + SourceMapUrlFromResponse(resource->GetResponse())); +} ClassicScript* ClassicScript::CreateUnspecifiedScript( - const ScriptSourceCode& script_source_code, + const String& source_text, + ScriptSourceLocationType source_location_type, SanitizeScriptErrors sanitize_script_errors) { return MakeGarbageCollected<ClassicScript>( - script_source_code, KURL(), ScriptFetchOptions(), sanitize_script_errors); + ParkableString(source_text.Impl()), KURL(), KURL(), ScriptFetchOptions(), + source_location_type, sanitize_script_errors); } ClassicScript* ClassicScript::CreateUnspecifiedScript( const WebScriptSource& source, SanitizeScriptErrors sanitize_script_errors) { - return ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(source.code, ScriptSourceLocationType::kUnknown, - nullptr /* cache_handler */, source.url), + return MakeGarbageCollected<ClassicScript>( + ParkableString(String(source.code).Impl()), + StripFragmentIdentifier(source.url), KURL() /* base_url */, + ScriptFetchOptions(), ScriptSourceLocationType::kUnknown, sanitize_script_errors); } +ClassicScript::ClassicScript( + const ParkableString& source_text, + const KURL& source_url, + const KURL& base_url, + const ScriptFetchOptions& fetch_options, + ScriptSourceLocationType source_location_type, + SanitizeScriptErrors sanitize_script_errors, + SingleCachedMetadataHandler* cache_handler, + const TextPosition& start_position, + ScriptStreamer* streamer, + ScriptStreamer::NotStreamingReason not_streaming_reason, + ScriptCacheConsumer* cache_consumer, + const String& source_map_url) + : Script(fetch_options, SanitizeBaseUrl(base_url, sanitize_script_errors)), + source_text_(TreatNullSourceAsEmpty(source_text)), + source_url_(source_url), + source_location_type_(source_location_type), + sanitize_script_errors_(sanitize_script_errors), + cache_handler_(cache_handler), + start_position_(start_position), + streamer_(streamer), + not_streaming_reason_(not_streaming_reason), + cache_consumer_(cache_consumer), + source_map_url_(source_map_url) {} + void ClassicScript::Trace(Visitor* visitor) const { Script::Trace(visitor); - visitor->Trace(script_source_code_); + visitor->Trace(cache_handler_); + visitor->Trace(streamer_); + visitor->Trace(cache_consumer_); } ScriptEvaluationResult ClassicScript::RunScriptOnScriptStateAndReturnValue( @@ -124,11 +227,8 @@ std::pair<size_t, size_t> ClassicScript::GetClassicScriptSizes() const { size_t cached_metadata_size = - GetScriptSourceCode().CacheHandler() - ? GetScriptSourceCode().CacheHandler()->GetCodeCacheSize() - : 0; - return std::pair<size_t, size_t>(GetScriptSourceCode().Source().length(), - cached_metadata_size); + CacheHandler() ? CacheHandler()->GetCodeCacheSize() : 0; + return std::pair<size_t, size_t>(SourceText().length(), cached_metadata_size); } } // namespace blink
diff --git a/third_party/blink/renderer/core/script/classic_script.h b/third_party/blink/renderer/core/script/classic_script.h index e50a710..cb7fd80 100644 --- a/third_party/blink/renderer/core/script/classic_script.h +++ b/third_party/blink/renderer/core/script/classic_script.h
@@ -6,7 +6,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_SCRIPT_CLASSIC_SCRIPT_H_ #include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" +#include "third_party/blink/renderer/bindings/core/v8/script_source_location_type.h" #include "third_party/blink/renderer/bindings/core/v8/v8_script_runner.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/loader/resource/script_resource.h" @@ -19,13 +19,29 @@ class CORE_EXPORT ClassicScript final : public Script { public: - // For scripts specified in the HTML spec. + // For `source_url`. + static KURL StripFragmentIdentifier(const KURL&); + + // For scripts specified in the HTML spec or for tests. // Please leave spec comments and spec links that explain given argument - // values at callers. - ClassicScript(const ScriptSourceCode&, - const KURL& base_url, - const ScriptFetchOptions&, - SanitizeScriptErrors); + // values at non-test callers. + static ClassicScript* Create( + const String& source_text, + const KURL& source_url, + const KURL& base_url, + const ScriptFetchOptions&, + ScriptSourceLocationType = ScriptSourceLocationType::kUnknown, + SanitizeScriptErrors = SanitizeScriptErrors::kSanitize, + SingleCachedMetadataHandler* = nullptr, + const TextPosition& start_position = TextPosition::MinimumPosition(), + ScriptStreamer::NotStreamingReason = + ScriptStreamer::NotStreamingReason::kInlineScript); + static ClassicScript* CreateFromResource(ScriptResource*, + const KURL& base_url, + const ScriptFetchOptions&, + ScriptStreamer*, + ScriptStreamer::NotStreamingReason, + ScriptCacheConsumer*); // For scripts not specified in the HTML spec. // @@ -35,21 +51,54 @@ // TODO(crbug/1112266): Use kSanitize for all existing callers if possible, or // otherwise add comments why kDoNotSanitize should be used. static ClassicScript* CreateUnspecifiedScript( - const ScriptSourceCode&, + const String& source_text, + ScriptSourceLocationType = ScriptSourceLocationType::kUnknown, SanitizeScriptErrors = SanitizeScriptErrors::kSanitize); static ClassicScript* CreateUnspecifiedScript( const WebScriptSource&, SanitizeScriptErrors = SanitizeScriptErrors::kSanitize); + // Use Create*() helpers above. + ClassicScript( + const ParkableString& source_text, + const KURL& source_url, + const KURL& base_url, + const ScriptFetchOptions&, + ScriptSourceLocationType, + SanitizeScriptErrors, + SingleCachedMetadataHandler* = nullptr, + const TextPosition& start_position = TextPosition::MinimumPosition(), + ScriptStreamer* = nullptr, + ScriptStreamer::NotStreamingReason = + ScriptStreamer::NotStreamingReason::kInlineScript, + ScriptCacheConsumer* = nullptr, + const String& source_map_url = String()); + void Trace(Visitor*) const override; - const ScriptSourceCode& GetScriptSourceCode() const { - return script_source_code_; + const ParkableString& SourceText() const { return source_text_; } + const KURL& SourceUrl() const { return source_url_; } + + ScriptSourceLocationType SourceLocationType() const { + return source_location_type_; } + SanitizeScriptErrors GetSanitizeScriptErrors() const { return sanitize_script_errors_; } + SingleCachedMetadataHandler* CacheHandler() const { return cache_handler_; } + const TextPosition& StartPosition() const { return start_position_; } + + ScriptStreamer* Streamer() const { return streamer_; } + ScriptStreamer::NotStreamingReason NotStreamingReason() const { + return not_streaming_reason_; + } + + ScriptCacheConsumer* CacheConsumer() const { return cache_consumer_; } + + const String& SourceMapUrl() const { return source_map_url_; } + // TODO(crbug.com/1111134): Methods with ExecuteScriptPolicy are declared and // overloaded here to avoid modifying Script::RunScript*(), because this is a // tentative interface. When crbug/1111134 is done, these should be gone. @@ -82,8 +131,41 @@ std::pair<size_t, size_t> GetClassicScriptSizes() const override; - const ScriptSourceCode script_source_code_; + const ParkableString source_text_; + + // The URL of the script, which is primarily intended for DevTools + // javascript debugger, and can be observed as: + // 1) The 'source-file' in CSP violations reports. + // 2) The URL(s) in javascript stack traces. + // 3) How relative source map are resolved. + // + // The fragment is stripped due to https://crbug.com/306239 (except for worker + // top-level scripts), at the callers of Create(), or inside + // CreateFromResource() and CreateUnspecifiedScript(). + // + // It is important to keep the url fragment for worker top-level scripts so + // that errors in worker scripts can include the fragment when reporting the + // location of the failure. This is enforced by several tests in + // external/wpt/workers/interfaces/WorkerGlobalScope/onerror/. + // + // Note that this can be different from the script's base URL + // (`Script::BaseURL()`, #concept-script-base-url). + const KURL source_url_; + + const ScriptSourceLocationType source_location_type_; + const SanitizeScriptErrors sanitize_script_errors_; + + const Member<SingleCachedMetadataHandler> cache_handler_; + + const TextPosition start_position_; + + const Member<ScriptStreamer> streamer_; + const ScriptStreamer::NotStreamingReason not_streaming_reason_; + + const Member<ScriptCacheConsumer> cache_consumer_; + + const String source_map_url_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/script/module_script_test.cc b/third_party/blink/renderer/core/script/module_script_test.cc index 531feaf..adff78e 100644 --- a/third_party/blink/renderer/core/script/module_script_test.cc +++ b/third_party/blink/renderer/core/script/module_script_test.cc
@@ -8,7 +8,6 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/features.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" #include "third_party/blink/renderer/core/loader/modulescript/module_script_creation_params.h" @@ -55,6 +54,14 @@ bool IsServedFromCacheStorage() override { return false; } }; +ClassicScript* CreateClassicScript(const String& source_text, + SingleCachedMetadataHandler* cache_handler) { + return ClassicScript::Create(source_text, KURL(), KURL(), + ScriptFetchOptions(), + ScriptSourceLocationType::kInternal, + SanitizeScriptErrors::kSanitize, cache_handler); +} + static const int kScriptRepeatLength = 500; } // namespace @@ -98,14 +105,13 @@ // test. static void TestFoo(V8TestingScope& scope) { v8::Local<v8::Value> value = - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode("window.foo")) + ClassicScript::CreateUnspecifiedScript("window.foo") ->RunScriptAndReturnValue(&scope.GetWindow()); EXPECT_TRUE(value->IsNumber()); EXPECT_EQ(kScriptRepeatLength, value->NumberValue(scope.GetContext()).ToChecked()); - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("window.foo = undefined;")) + ClassicScript::CreateUnspecifiedScript("window.foo = undefined;") ->RunScript(&scope.GetWindow()); } @@ -239,13 +245,7 @@ EXPECT_CALL(*sender_ptr, Send(_, _, _)); EXPECT_CALL(checkpoint, Call(4)); - // In actual cases CachedMetadataHandler and its code cache data are passed - // via ScriptSourceCode+ScriptResource, but here they are passed via - // ScriptSourceCode constructor for inline scripts. So far, this is sufficient - // for unit testing. - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(LargeSourceText(), ScriptSourceLocationType::kInternal, - cache_handler)) + CreateClassicScript(LargeSourceText(), cache_handler) ->RunScript(&scope.GetWindow()); checkpoint.Call(4); @@ -378,13 +378,7 @@ // CachedMetadata after it has been cleared. EXPECT_CALL(checkpoint, Call(4)); - // In actual cases CachedMetadataHandler and its code cache data are passed - // via ScriptSourceCode+ScriptResource, but here they are passed via - // ScriptSourceCode constructor for inline scripts. So far, this is sufficient - // for unit testing. - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(LargeSourceText(), ScriptSourceLocationType::kInternal, - cache_handler)) + CreateClassicScript(LargeSourceText(), cache_handler) ->RunScript(&scope.GetWindow()); checkpoint.Call(4);
diff --git a/third_party/blink/renderer/core/style/computed_style_diff_functions.json5 b/third_party/blink/renderer/core/style/computed_style_diff_functions.json5 index 8179db2..e5d8136 100644 --- a/third_party/blink/renderer/core/style/computed_style_diff_functions.json5 +++ b/third_party/blink/renderer/core/style/computed_style_diff_functions.json5
@@ -95,8 +95,8 @@ "NamedGridAreaRowCount", "NamedGridAreaColumnCount", "GridAutoRepeatColumns", "GridAutoRepeatRows", "GridAutoRepeatColumnsInsertionPoint", "GridAutoRepeatRowsInsertionPoint", "grid-auto-flow", "GridAutoRepeatColumnsType", - "GridAutoRepeatRowsType", "-webkit-box-flex", - "-webkit-box-ordinal-group", "flex-basis", + "GridAutoRepeatRowsType", "GridColumnsAxisType", "GridRowsAxisType", + "-webkit-box-flex", "-webkit-box-ordinal-group", "flex-basis", "flex-shrink", "flex-grow", "flex-direction", "flex-wrap", "-webkit-box-align", "-webkit-box-decoration-break", "-webkit-box-pack", "-webkit-box-orient", "grid-row-start", "grid-row-end", "grid-column-start", "grid-column-end",
diff --git a/third_party/blink/renderer/core/style/computed_style_extra_fields.json5 b/third_party/blink/renderer/core/style/computed_style_extra_fields.json5 index ab1c996..03408f9 100644 --- a/third_party/blink/renderer/core/style/computed_style_extra_fields.json5 +++ b/third_party/blink/renderer/core/style/computed_style_extra_fields.json5
@@ -971,6 +971,22 @@ keywords: ["no-auto-repeat", "auto-fill", "auto-fit"], default_value: "no-auto-repeat", }, + { + name: "GridColumnsAxisType", + field_template: "keyword", + type_name: "GridAxisType", + field_group: "*->grid", + keywords: ["standalone-axis", "subgridded-axis"], + default_value: "standalone-axis", + }, + { + name: "GridRowsAxisType", + field_template: "keyword", + type_name: "GridAxisType", + field_group: "*->grid", + keywords: ["standalone-axis", "subgridded-axis"], + default_value: "standalone-axis", + }, // We only create and store ComputedStyle objects for elements in // display:none subtrees if we need it for e.g. getComputedStyle. This flag // is true for such ComputedStyle objects.
diff --git a/third_party/blink/renderer/core/style/ordered_named_grid_lines.h b/third_party/blink/renderer/core/style/ordered_named_grid_lines.h index 0aa64d67..abab2e4 100644 --- a/third_party/blink/renderer/core/style/ordered_named_grid_lines.h +++ b/third_party/blink/renderer/core/style/ordered_named_grid_lines.h
@@ -13,7 +13,9 @@ namespace blink { struct NamedGridLine { - NamedGridLine(const String line_name, bool is_in_repeat, bool is_first_repeat) + explicit NamedGridLine(const String line_name, + bool is_in_repeat = false, + bool is_first_repeat = false) : line_name(line_name), is_in_repeat(is_in_repeat), is_first_repeat(is_first_repeat) {}
diff --git a/third_party/blink/renderer/core/workers/worker_global_scope.cc b/third_party/blink/renderer/core/workers/worker_global_scope.cc index 30b2e852..04ad96b 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worker_global_scope.cc
@@ -35,7 +35,6 @@ #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_url_request.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/source_location.h" #include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h" #include "third_party/blink/renderer/bindings/core/v8/v8_void_function.h" @@ -334,11 +333,10 @@ SingleCachedMetadataHandler* handler( CreateWorkerScriptCachedMetadataHandler(complete_url, std::move(cached_meta_data))); - ClassicScript* script = MakeGarbageCollected<ClassicScript>( - ScriptSourceCode(source_code, ScriptSourceLocationType::kUnknown, - handler, complete_url), + ClassicScript* script = ClassicScript::Create( + source_code, ClassicScript::StripFragmentIdentifier(complete_url), response_url /* base_url */, ScriptFetchOptions(), - sanitize_script_errors); + ScriptSourceLocationType::kUnknown, sanitize_script_errors, handler); // Step 5.2: "Run the classic script script, with the rethrow errors // argument set to true." @@ -438,9 +436,11 @@ std::move(cached_meta_data)); // Cross-origin workers are disallowed, so use // SanitizeScriptErrors::kDoNotSanitize. - Script* worker_script = MakeGarbageCollected<ClassicScript>( - ScriptSourceCode(source_code, handler, script_url), script_url, - ScriptFetchOptions(), SanitizeScriptErrors::kDoNotSanitize); + Script* worker_script = ClassicScript::Create( + source_code, script_url, script_url /* base_url */, ScriptFetchOptions(), + ScriptSourceLocationType::kUnknown, SanitizeScriptErrors::kDoNotSanitize, + handler, TextPosition::MinimumPosition(), + ScriptStreamer::NotStreamingReason::kWorkerTopLevelScript); WorkerScriptFetchFinished(*worker_script, stack_id); }
diff --git a/third_party/blink/renderer/core/workers/worker_thread.cc b/third_party/blink/renderer/core/workers/worker_thread.cc index 660bda7..3d29142 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.cc +++ b/third_party/blink/renderer/core/workers/worker_thread.cc
@@ -35,7 +35,6 @@ #include "third_party/blink/public/common/loader/worker_main_script_load_parameters.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/task_type.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/core/execution_context/agent.h" #include "third_party/blink/renderer/core/inspector/console_message_storage.h"
diff --git a/third_party/blink/renderer/core/workers/worklet_global_scope.cc b/third_party/blink/renderer/core/workers/worklet_global_scope.cc index 6af7345..4f7f099 100644 --- a/third_party/blink/renderer/core/workers/worklet_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worklet_global_scope.cc
@@ -10,7 +10,6 @@ #include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h" #include "third_party/blink/public/platform/task_type.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/source_location.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/core/execution_context/agent.h"
diff --git a/third_party/blink/renderer/core/xml/document_xml_tree_viewer.cc b/third_party/blink/renderer/core/xml/document_xml_tree_viewer.cc index 3fa95d9c..28937fbf 100644 --- a/third_party/blink/renderer/core/xml/document_xml_tree_viewer.cc +++ b/third_party/blink/renderer/core/xml/document_xml_tree_viewer.cc
@@ -5,7 +5,6 @@ #include "third_party/blink/renderer/core/xml/document_xml_tree_viewer.h" #include "third_party/blink/public/resources/grit/blink_resources.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/frame/local_frame.h" @@ -24,8 +23,8 @@ v8::HandleScope handle_scope(V8PerIsolateData::MainThreadIsolate()); - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(script_string, ScriptSourceLocationType::kInternal)) + ClassicScript::CreateUnspecifiedScript(script_string, + ScriptSourceLocationType::kInternal) ->RunScriptInIsolatedWorldAndReturnValue( document.domWindow(), IsolatedWorldId::kDocumentXMLTreeViewerWorldId);
diff --git a/third_party/blink/renderer/modules/accessibility/ax_node_object.cc b/third_party/blink/renderer/modules/accessibility/ax_node_object.cc index a7db68a..3bf9c5cd 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_node_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_node_object.cc
@@ -2916,7 +2916,7 @@ // An ARIA combobox can get value from inner contents. if (AriaRoleAttribute() == ax::mojom::blink::Role::kComboBoxMenuButton) { AXObjectSet visited; - return TextFromDescendants(visited, false); + return TextFromDescendants(visited, nullptr, false); } return String(); @@ -3230,12 +3230,14 @@ name_sources->back().type = name_from; } - if (auto* text_node = DynamicTo<Text>(node)) + if (auto* text_node = DynamicTo<Text>(node)) { text_alternative = text_node->data(); - else if (IsA<HTMLBRElement>(node)) + } else if (IsA<HTMLBRElement>(node)) { text_alternative = String("\n"); - else - text_alternative = TextFromDescendants(visited, false); + } else { + text_alternative = + TextFromDescendants(visited, aria_label_or_description_root, false); + } if (!text_alternative.IsEmpty()) { if (name_sources) { @@ -3367,8 +3369,10 @@ return false; } -String AXNodeObject::TextFromDescendants(AXObjectSet& visited, - bool recursive) const { +String AXNodeObject::TextFromDescendants( + AXObjectSet& visited, + const AXObject* aria_label_or_description_root, + bool recursive) const { if (!CanHaveChildren()) return recursive ? String() : GetElement()->GetInnerTextWithoutUpdate(); @@ -3442,10 +3446,11 @@ ax::mojom::blink::NameFrom::kUninitialized; String result; if (child->IsPresentational()) { - result = child->TextFromDescendants(visited, true); + result = child->TextFromDescendants(visited, + aria_label_or_description_root, true); } else { - result = - RecursiveTextAlternative(*child, nullptr, visited, child_name_from); + result = RecursiveTextAlternative(*child, aria_label_or_description_root, + visited, child_name_from); } if (!result.IsEmpty() && previous && accumulated_text.length() && @@ -5544,7 +5549,7 @@ } AXObjectSet visited; - description = TextFromDescendants(visited, false); + description = TextFromDescendants(visited, nullptr, false); if (!description.IsEmpty()) { if (description_sources) {
diff --git a/third_party/blink/renderer/modules/accessibility/ax_node_object.h b/third_party/blink/renderer/modules/accessibility/ax_node_object.h index 082ce4d1..3bd6d0a 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_node_object.h +++ b/third_party/blink/renderer/modules/accessibility/ax_node_object.h
@@ -174,6 +174,7 @@ String GetValueForControl() const override; String SlowGetValueForControlIncludingContentEditable() const override; String TextFromDescendants(AXObjectSet& visited, + const AXObject* aria_label_or_description_root, bool recursive) const override; // ARIA attributes.
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.h b/third_party/blink/renderer/modules/accessibility/ax_object.h index 33e5c9c0..c30c73e 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.h +++ b/third_party/blink/renderer/modules/accessibility/ax_object.h
@@ -562,8 +562,10 @@ NameSources* name_sources) const { return String(); } - virtual String TextFromDescendants(AXObjectSet& visited, - bool recursive) const { + virtual String TextFromDescendants( + AXObjectSet& visited, + const AXObject* aria_label_or_description_root, + bool recursive) const { return String(); }
diff --git a/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc b/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc index 9d7f66a9..5b9de2a 100644 --- a/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc +++ b/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc
@@ -10,7 +10,6 @@ #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/renderer/bindings/core/v8/module_record.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/core/dom/document.h" @@ -106,9 +105,8 @@ base::WaitableEvent* waitable_event) { ASSERT_TRUE(thread->IsCurrentThread()); auto* global_scope = To<AnimationWorkletGlobalScope>(thread->GlobalScope()); - ASSERT_TRUE( - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source_code)) - ->RunScriptOnWorkerOrWorklet(*global_scope)); + ASSERT_TRUE(ClassicScript::CreateUnspecifiedScript(source_code) + ->RunScriptOnWorkerOrWorklet(*global_scope)); waitable_event->Signal(); } @@ -128,9 +126,8 @@ animate () {} }); )JS"; - ASSERT_TRUE( - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source_code)) - ->RunScriptOnWorkerOrWorklet(*global_scope)); + ASSERT_TRUE(ClassicScript::CreateUnspecifiedScript(source_code) + ->RunScriptOnWorkerOrWorklet(*global_scope)); AnimatorDefinition* definition = global_scope->FindDefinitionForTest("test"); @@ -141,9 +138,8 @@ // registerAnimator() with a null class definition should fail to define // an animator. String source_code = "registerAnimator('null', null);"; - ASSERT_FALSE( - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source_code)) - ->RunScriptOnWorkerOrWorklet(*global_scope)); + ASSERT_FALSE(ClassicScript::CreateUnspecifiedScript(source_code) + ->RunScriptOnWorkerOrWorklet(*global_scope)); EXPECT_FALSE(global_scope->FindDefinitionForTest("null")); } @@ -162,7 +158,7 @@ v8::HandleScope scope(isolate); ClassicScript* classic_script = - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(script)); + ClassicScript::CreateUnspecifiedScript(script); ScriptEvaluationResult result = classic_script->RunScriptOnScriptStateAndReturnValue(script_state); @@ -194,9 +190,8 @@ } }); )JS"; - ASSERT_TRUE( - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source_code)) - ->RunScriptOnWorkerOrWorklet(*global_scope)); + ASSERT_TRUE(ClassicScript::CreateUnspecifiedScript(source_code) + ->RunScriptOnWorkerOrWorklet(*global_scope)); EXPECT_FALSE(RunScriptAndGetBoolean( global_scope, "Function('return this')().constructed")) @@ -254,9 +249,8 @@ registerAnimator('stateless_animator', Stateless); registerAnimator('foo', Foo); )JS"; - ASSERT_TRUE( - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source_code)) - ->RunScriptOnWorkerOrWorklet(*global_scope)); + ASSERT_TRUE(ClassicScript::CreateUnspecifiedScript(source_code) + ->RunScriptOnWorkerOrWorklet(*global_scope)); AnimatorDefinition* first_definition = global_scope->FindDefinitionForTest("stateful_animator"); @@ -277,14 +271,13 @@ static_cast<AnimationWorkletGlobalScope*>(thread->GlobalScope()); ASSERT_TRUE(global_scope); ASSERT_TRUE(global_scope->IsAnimationWorkletGlobalScope()); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode( - R"JS( + ClassicScript::CreateUnspecifiedScript(R"JS( registerAnimator('test', class { animate (currentTime, effect) { effect.localTime = 123; } }); - )JS")) + )JS") ->RunScriptOnWorkerOrWorklet(*global_scope); // Passing a new input state with a new animation id should cause the @@ -316,14 +309,13 @@ ASSERT_TRUE(global_scope); ASSERT_TRUE(global_scope->IsAnimationWorkletGlobalScope()); EXPECT_EQ(global_scope->GetAnimatorsSizeForTest(), 0u); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode( - R"JS( + ClassicScript::CreateUnspecifiedScript(R"JS( registerAnimator('test', class { animate (currentTime, effect) { effect.localTime = 123; } }); - )JS")) + )JS") ->RunScriptOnWorkerOrWorklet(*global_scope); cc::WorkletAnimationId animation_id = {1, 1}; @@ -364,14 +356,13 @@ ASSERT_TRUE(global_scope); ASSERT_TRUE(global_scope->IsAnimationWorkletGlobalScope()); EXPECT_EQ(global_scope->GetAnimatorsSizeForTest(), 0u); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode( - R"JS( + ClassicScript::CreateUnspecifiedScript(R"JS( registerAnimator('test', class { animate (currentTime, effect) { effect.localTime = 123; } }); - )JS")) + )JS") ->RunScriptOnWorkerOrWorklet(*global_scope); cc::WorkletAnimationId animation_id = {1, 1};
diff --git a/third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client_test.cc b/third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client_test.cc index ca81f237..6e12d61 100644 --- a/third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client_test.cc +++ b/third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client_test.cc
@@ -11,7 +11,6 @@ #include "base/test/test_simple_task_runner.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/core/inspector/console_message.h" #include "third_party/blink/renderer/core/script/classic_script.h" #include "third_party/blink/renderer/core/testing/core_unit_test_helper.h" @@ -178,12 +177,10 @@ registerAnimator('stateless_animator', Stateless); )JS"; - ASSERT_TRUE( - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source_code)) - ->RunScriptOnWorkerOrWorklet(*first_global_scope)); - ASSERT_TRUE( - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source_code)) - ->RunScriptOnWorkerOrWorklet(*second_global_scope)); + ASSERT_TRUE(ClassicScript::CreateUnspecifiedScript(source_code) + ->RunScriptOnWorkerOrWorklet(*first_global_scope)); + ASSERT_TRUE(ClassicScript::CreateUnspecifiedScript(source_code) + ->RunScriptOnWorkerOrWorklet(*second_global_scope)); std::unique_ptr<AnimationWorkletInput> state = std::make_unique<AnimationWorkletInput>();
diff --git a/third_party/blink/renderer/modules/credentialmanager/authentication_extensions_client_inputs.idl b/third_party/blink/renderer/modules/credentialmanager/authentication_extensions_client_inputs.idl index 534c35da..3149602 100644 --- a/third_party/blink/renderer/modules/credentialmanager/authentication_extensions_client_inputs.idl +++ b/third_party/blink/renderer/modules/credentialmanager/authentication_extensions_client_inputs.idl
@@ -23,6 +23,9 @@ USVString credentialProtectionPolicy; boolean enforceCredentialProtectionPolicy = false; + // https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-minpinlength-extension + boolean minPinLength; + // https://w3c.github.io/webauthn/#sctn-authenticator-credential-properties-extension [RuntimeEnabled=WebAuthenticationResidentKeyRequirement] boolean credProps = false;
diff --git a/third_party/blink/renderer/modules/credentialmanager/credential_manager_type_converters.cc b/third_party/blink/renderer/modules/credentialmanager/credential_manager_type_converters.cc index b239869..246e1f8f 100644 --- a/third_party/blink/renderer/modules/credentialmanager/credential_manager_type_converters.cc +++ b/third_party/blink/renderer/modules/credentialmanager/credential_manager_type_converters.cc
@@ -591,6 +591,9 @@ extensions->payment()->isPayment()) { mojo_options->is_payment_credential_creation = true; } + if (extensions->hasMinPinLength() && extensions->minPinLength()) { + mojo_options->min_pin_length_requested = true; + } } return mojo_options;
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.cc b/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.cc index 73c905e..1a3d630 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.cc +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.cc
@@ -6,7 +6,6 @@ #include "mojo/public/cpp/bindings/pending_remote.h" #include "third_party/blink/public/mojom/script/script_type.mojom-blink.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h"
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_test.cc b/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_test.cc index 0476a2e..d8159d2 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_test.cc +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_test.cc
@@ -5,7 +5,6 @@ #include "third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope.h" #include "base/synchronization/waitable_event.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/core/inspector/worker_devtools_params.h" #include "third_party/blink/renderer/core/origin_trials/origin_trial_context.h" #include "third_party/blink/renderer/core/script/classic_script.h" @@ -81,9 +80,8 @@ paint (ctx, size) {} }); )JS"; - ASSERT_TRUE( - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source_code)) - ->RunScriptOnWorkerOrWorklet(*global_scope)); + ASSERT_TRUE(ClassicScript::CreateUnspecifiedScript(source_code) + ->RunScriptOnWorkerOrWorklet(*global_scope)); CSSPaintDefinition* definition = global_scope->FindDefinition("test"); ASSERT_TRUE(definition); } @@ -92,9 +90,8 @@ // registerPaint() with a null class definition should fail to define a // painter. String source_code = "registerPaint('null', null);"; - ASSERT_FALSE( - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(source_code)) - ->RunScriptOnWorkerOrWorklet(*global_scope)); + ASSERT_FALSE(ClassicScript::CreateUnspecifiedScript(source_code) + ->RunScriptOnWorkerOrWorklet(*global_scope)); EXPECT_FALSE(global_scope->FindDefinition("null")); }
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client_test.cc b/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client_test.cc index c1a9d85..ee66d12b 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client_test.cc +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client_test.cc
@@ -10,7 +10,6 @@ #include "base/synchronization/waitable_event.h" #include "base/test/test_simple_task_runner.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/core/css/cssom/cross_thread_style_value.h" #include "third_party/blink/renderer/core/css/cssom/css_paint_worklet_input.h" #include "third_party/blink/renderer/core/script/classic_script.h" @@ -73,8 +72,7 @@ // this with a specialised AddGlobalScopeForTesting method, we just use the // standard flow. ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode( - "registerPaint('add_global_scope', class { paint() { } });")) + "registerPaint('add_global_scope', class { paint() { } });") ->RunScriptOnWorkerOrWorklet(*worker_thread->GlobalScope()); waitable_event->Signal(); } @@ -212,7 +210,7 @@ // Register the painter on all global scopes. for (const auto& global_scope : proxy_client->GetGlobalScopesForTesting()) { ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("registerPaint('foo', class { paint() { } });")) + "registerPaint('foo', class { paint() { } });") ->RunScriptOnWorkerOrWorklet(*global_scope); } @@ -256,47 +254,42 @@ document_definition_map = proxy_client->DocumentDefinitionMapForTesting(); // Differing native properties. - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(R"JS(registerPaint('test1', class { + ClassicScript::CreateUnspecifiedScript(R"JS(registerPaint('test1', class { static get inputProperties() { return ['border-image', 'color']; } paint() { } - });)JS")) + });)JS") ->RunScriptOnWorkerOrWorklet(*global_scopes[0]); EXPECT_NE(document_definition_map.at("test1"), nullptr); - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(R"JS(registerPaint('test1', class { + ClassicScript::CreateUnspecifiedScript(R"JS(registerPaint('test1', class { static get inputProperties() { return ['left']; } paint() { } - });)JS")) + });)JS") ->RunScriptOnWorkerOrWorklet(*global_scopes[1]); EXPECT_EQ(document_definition_map.at("test1"), nullptr); // Differing custom properties. - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(R"JS(registerPaint('test2', class { + ClassicScript::CreateUnspecifiedScript(R"JS(registerPaint('test2', class { static get inputProperties() { return ['--foo', '--bar']; } paint() { } - });)JS")) + });)JS") ->RunScriptOnWorkerOrWorklet(*global_scopes[0]); EXPECT_NE(document_definition_map.at("test2"), nullptr); - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(R"JS(registerPaint('test2', class { + ClassicScript::CreateUnspecifiedScript(R"JS(registerPaint('test2', class { static get inputProperties() { return ['--zoinks']; } paint() { } - });)JS")) + });)JS") ->RunScriptOnWorkerOrWorklet(*global_scopes[1]); EXPECT_EQ(document_definition_map.at("test2"), nullptr); // Differing alpha values. The default is 'true'. ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("registerPaint('test3', class { paint() { } });")) + "registerPaint('test3', class { paint() { } });") ->RunScriptOnWorkerOrWorklet(*global_scopes[0]); EXPECT_NE(document_definition_map.at("test3"), nullptr); - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode(R"JS(registerPaint('test3', class { + ClassicScript::CreateUnspecifiedScript(R"JS(registerPaint('test3', class { static get contextOptions() { return {alpha: false}; } paint() { } - });)JS")) + });)JS") ->RunScriptOnWorkerOrWorklet(*global_scopes[1]); EXPECT_EQ(document_definition_map.at("test3"), nullptr); @@ -358,14 +351,14 @@ proxy_client->GetGlobalScopesForTesting(); for (wtf_size_t i = 0; i < global_scopes.size() - 1; i++) { ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("registerPaint('foo', class { paint() { } });")) + "registerPaint('foo', class { paint() { } });") ->RunScriptOnWorkerOrWorklet(*global_scopes[i]); EXPECT_FALSE(fake_runner.TaskHasBeenPosted()); } // Now register the final one; the task should then be posted. ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("registerPaint('foo', class { paint() { } });")) + "registerPaint('foo', class { paint() { } });") ->RunScriptOnWorkerOrWorklet(*global_scopes.back()); EXPECT_TRUE(fake_runner.TaskHasBeenPosted());
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc b/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc index c8e5230..0d734c2 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc
@@ -7,7 +7,6 @@ #include <memory> #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" #include "third_party/blink/renderer/core/css/css_syntax_definition.h" #include "third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.h" @@ -121,7 +120,7 @@ TEST_F(PaintWorkletTest, PaintWithNullPaintArguments) { PaintWorkletGlobalScope* global_scope = GetProxy()->global_scope(); ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("registerPaint('foo', class { paint() { } });")) + "registerPaint('foo', class { paint() { } });") ->RunScriptOnWorkerOrWorklet(*global_scope); CSSPaintDefinition* definition = global_scope->FindDefinition("foo"); @@ -153,7 +152,7 @@ TEST_F(PaintWorkletTest, SinglyRegisteredDocumentDefinitionNotUsed) { PaintWorkletGlobalScope* global_scope = GetProxy()->global_scope(); ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("registerPaint('foo', class { paint() { } });")) + "registerPaint('foo', class { paint() { } });") ->RunScriptOnWorkerOrWorklet(*global_scope); CSSPaintImageGeneratorImpl* generator = @@ -273,21 +272,21 @@ paint() {} });)JS"; - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(foo0)) - ->RunScriptOnWorkerOrWorklet(*global_scopes[0]); + ClassicScript::CreateUnspecifiedScript(foo0)->RunScriptOnWorkerOrWorklet( + *global_scopes[0]); EXPECT_TRUE(global_scopes[0]->FindDefinition("foo")); EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("foo")); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(foo1)) - ->RunScriptOnWorkerOrWorklet(*global_scopes[1]); + ClassicScript::CreateUnspecifiedScript(foo1)->RunScriptOnWorkerOrWorklet( + *global_scopes[1]); // foo0 and foo1 have the same name but different definitions, therefore // this definition must become invalid. EXPECT_FALSE(paint_worklet_to_test->GetDocumentDefinitionMap().at("foo")); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(bar)) - ->RunScriptOnWorkerOrWorklet(*global_scopes[0]); + ClassicScript::CreateUnspecifiedScript(bar)->RunScriptOnWorkerOrWorklet( + *global_scopes[0]); EXPECT_TRUE(global_scopes[0]->FindDefinition("bar")); EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("bar")); @@ -298,8 +297,8 @@ if (!RuntimeEnabledFeatures::OffMainThreadCSSPaintEnabled()) EXPECT_CALL(*observer, PaintImageGeneratorReady).Times(1); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(bar)) - ->RunScriptOnWorkerOrWorklet(*global_scopes[1]); + ClassicScript::CreateUnspecifiedScript(bar)->RunScriptOnWorkerOrWorklet( + *global_scopes[1]); EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("bar")); } @@ -394,14 +393,14 @@ });)JS"; // Definition invalidated before cross thread check - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(foo0)) - ->RunScriptOnWorkerOrWorklet(*global_scopes[0]); + ClassicScript::CreateUnspecifiedScript(foo0)->RunScriptOnWorkerOrWorklet( + *global_scopes[0]); EXPECT_TRUE(global_scopes[0]->FindDefinition("foo")); EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("foo")); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(foo1)) - ->RunScriptOnWorkerOrWorklet(*global_scopes[1]); + ClassicScript::CreateUnspecifiedScript(foo1)->RunScriptOnWorkerOrWorklet( + *global_scopes[1]); EXPECT_FALSE(paint_worklet_to_test->GetDocumentDefinitionMap().at("foo")); @@ -419,14 +418,14 @@ EXPECT_FALSE(paint_worklet_to_test->GetDocumentDefinitionMap().at("foo")); // Definition invalidated by cross thread check - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(bar0)) - ->RunScriptOnWorkerOrWorklet(*global_scopes[0]); + ClassicScript::CreateUnspecifiedScript(bar0)->RunScriptOnWorkerOrWorklet( + *global_scopes[0]); EXPECT_TRUE(global_scopes[0]->FindDefinition("bar")); EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("bar")); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(bar0)) - ->RunScriptOnWorkerOrWorklet(*global_scopes[1]); + ClassicScript::CreateUnspecifiedScript(bar0)->RunScriptOnWorkerOrWorklet( + *global_scopes[1]); EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("bar")); @@ -446,8 +445,8 @@ EXPECT_FALSE(paint_worklet_to_test->GetDocumentDefinitionMap().at("bar")); // Definition invalidated by second main thread call after cross thread check - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(loo0)) - ->RunScriptOnWorkerOrWorklet(*global_scopes[0]); + ClassicScript::CreateUnspecifiedScript(loo0)->RunScriptOnWorkerOrWorklet( + *global_scopes[0]); EXPECT_TRUE(global_scopes[0]->FindDefinition("loo")); EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("loo")); @@ -465,8 +464,8 @@ EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("loo")); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(loo1)) - ->RunScriptOnWorkerOrWorklet(*global_scopes[1]); + ClassicScript::CreateUnspecifiedScript(loo1)->RunScriptOnWorkerOrWorklet( + *global_scopes[1]); // Although the first main thread call and the cross thread definition are the // same, the second main thread call differs so the definition must become @@ -474,8 +473,8 @@ EXPECT_FALSE(paint_worklet_to_test->GetDocumentDefinitionMap().at("loo")); // Definition invalidated by cross thread check before second main thread call - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(gar0)) - ->RunScriptOnWorkerOrWorklet(*global_scopes[0]); + ClassicScript::CreateUnspecifiedScript(gar0)->RunScriptOnWorkerOrWorklet( + *global_scopes[0]); EXPECT_TRUE(global_scopes[0]->FindDefinition("gar")); EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("gar")); @@ -492,8 +491,8 @@ EXPECT_FALSE(paint_worklet_to_test->GetDocumentDefinitionMap().at("gar")); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(gar0)) - ->RunScriptOnWorkerOrWorklet(*global_scopes[1]); + ClassicScript::CreateUnspecifiedScript(gar0)->RunScriptOnWorkerOrWorklet( + *global_scopes[1]); // Although the main thread definitions were the same, the definition sent // cross thread differed from the main thread definitions so it must stay @@ -530,14 +529,14 @@ paint() {} });)JS"; - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(foo)) - ->RunScriptOnWorkerOrWorklet(*global_scopes[0]); + ClassicScript::CreateUnspecifiedScript(foo)->RunScriptOnWorkerOrWorklet( + *global_scopes[0]); EXPECT_TRUE(global_scopes[0]->FindDefinition("foo")); EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("foo")); - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(foo)) - ->RunScriptOnWorkerOrWorklet(*global_scopes[1]); + ClassicScript::CreateUnspecifiedScript(foo)->RunScriptOnWorkerOrWorklet( + *global_scopes[1]); EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("foo"));
diff --git a/third_party/blink/renderer/modules/file_system_access/global_file_system_access_test.cc b/third_party/blink/renderer/modules/file_system_access/global_file_system_access_test.cc index 91097ca..31dab049 100644 --- a/third_party/blink/renderer/modules/file_system_access/global_file_system_access_test.cc +++ b/third_party/blink/renderer/modules/file_system_access/global_file_system_access_test.cc
@@ -130,8 +130,7 @@ [](MockFileSystemAccessManager::ChooseEntriesCallback callback) { FAIL(); })); - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("window.showOpenFilePicker();")) + ClassicScript::CreateUnspecifiedScript("window.showOpenFilePicker();") ->RunScript(GetFrame().DomWindow()); base::RunLoop().RunUntilIdle(); EXPECT_FALSE(frame->HasStickyUserActivation()); @@ -166,8 +165,7 @@ std::move(callback).Run(std::move(error), std::move(entries)); })); - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("window.showOpenFilePicker();")) + ClassicScript::CreateUnspecifiedScript("window.showOpenFilePicker();") ->RunScript(GetFrame().DomWindow()); manager_run_loop.Run(); @@ -216,8 +214,7 @@ std::move(callback).Run(std::move(error), std::move(entries)); }, status)); - ClassicScript::CreateUnspecifiedScript( - ScriptSourceCode("window.showOpenFilePicker();")) + ClassicScript::CreateUnspecifiedScript("window.showOpenFilePicker();") ->RunScript(GetFrame().DomWindow()); manager_run_loop.Run();
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_factory_test.cc b/third_party/blink/renderer/modules/indexeddb/idb_factory_test.cc index fd5aff9e..6a04842 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_factory_test.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_factory_test.cc
@@ -31,24 +31,16 @@ namespace blink { namespace { -class TestHelperFunction : public ScriptFunction { +class TestHelperFunction : public NewScriptFunction::Callable { public: - static v8::Local<v8::Function> CreateFunction(ScriptState* script_state, - bool* called_flag) { - auto* self = - MakeGarbageCollected<TestHelperFunction>(script_state, called_flag); - return self->BindToV8Function(); - } + explicit TestHelperFunction(bool* called_flag) : called_flag_(called_flag) {} - TestHelperFunction(ScriptState* script_state, bool* called_flag) - : ScriptFunction(script_state), called_flag_(called_flag) {} - - private: - ScriptValue Call(ScriptValue value) override { + ScriptValue Call(ScriptState* script_state, ScriptValue value) override { *called_flag_ = true; return value; } + private: bool* called_flag_; }; @@ -142,9 +134,12 @@ bool on_fulfilled = false; bool on_rejected = false; - promise.Then( - TestHelperFunction::CreateFunction(scope.GetScriptState(), &on_fulfilled), - TestHelperFunction::CreateFunction(scope.GetScriptState(), &on_rejected)); + promise.Then(MakeGarbageCollected<NewScriptFunction>( + scope.GetScriptState(), + MakeGarbageCollected<TestHelperFunction>(&on_fulfilled)), + MakeGarbageCollected<NewScriptFunction>( + scope.GetScriptState(), + MakeGarbageCollected<TestHelperFunction>(&on_rejected))); EXPECT_FALSE(on_fulfilled); EXPECT_FALSE(on_rejected); @@ -187,9 +182,12 @@ bool on_fulfilled = false; bool on_rejected = false; - promise.Then( - TestHelperFunction::CreateFunction(scope.GetScriptState(), &on_fulfilled), - TestHelperFunction::CreateFunction(scope.GetScriptState(), &on_rejected)); + promise.Then(MakeGarbageCollected<NewScriptFunction>( + scope.GetScriptState(), + MakeGarbageCollected<TestHelperFunction>(&on_fulfilled)), + MakeGarbageCollected<NewScriptFunction>( + scope.GetScriptState(), + MakeGarbageCollected<TestHelperFunction>(&on_rejected))); EXPECT_FALSE(on_fulfilled); EXPECT_FALSE(on_rejected);
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_underlying_sink_test.cc b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_underlying_sink_test.cc index 44297022..64faa40a 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_underlying_sink_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_underlying_sink_test.cc
@@ -81,9 +81,10 @@ ScriptValue CreateEncodedAudioFrameChunk(ScriptState* script_state) { RTCEncodedAudioFrame* frame = MakeGarbageCollected<RTCEncodedAudioFrame>( std::make_unique<FakeAudioFrame>()); - return ScriptValue(script_state->GetIsolate(), - ToV8(frame, script_state->GetContext()->Global(), - script_state->GetIsolate())); + return ScriptValue( + script_state->GetIsolate(), + ToV8Traits<RTCEncodedAudioFrame>::ToV8(script_state, frame) + .ToLocalChecked()); } protected:
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_sink_test.cc b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_sink_test.cc index a3e5ad4f..29923bc6 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_sink_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_sink_test.cc
@@ -109,9 +109,10 @@ ON_CALL(*mock_frame.get(), GetDirection).WillByDefault(Return(direction)); RTCEncodedVideoFrame* frame = MakeGarbageCollected<RTCEncodedVideoFrame>(std::move(mock_frame)); - return ScriptValue(script_state->GetIsolate(), - ToV8(frame, script_state->GetContext()->Global(), - script_state->GetIsolate())); + return ScriptValue( + script_state->GetIsolate(), + ToV8Traits<RTCEncodedVideoFrame>::ToV8(script_state, frame) + .ToLocalChecked()); } protected:
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_test.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_test.cc index 27d7e0e9..32d27722 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_test.cc
@@ -820,9 +820,9 @@ } ScriptValue ToScriptValue(V8TestingScope& scope, RTCOfferOptions* value) { - v8::Isolate* isolate = scope.GetIsolate(); - return ScriptValue(isolate, - ToV8(value, scope.GetContext()->Global(), isolate)); + return ScriptValue(scope.GetIsolate(), ToV8Traits<RTCOfferOptions>::ToV8( + scope.GetScriptState(), value) + .ToLocalChecked()); } private:
diff --git a/third_party/blink/renderer/modules/scheduler/dom_scheduler_test.cc b/third_party/blink/renderer/modules/scheduler/dom_scheduler_test.cc index b1071b1..04d6b386 100644 --- a/third_party/blink/renderer/modules/scheduler/dom_scheduler_test.cc +++ b/third_party/blink/renderer/modules/scheduler/dom_scheduler_test.cc
@@ -6,7 +6,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" @@ -31,8 +30,8 @@ } void ExecuteScript(const char* script) { - ClassicScript::CreateUnspecifiedScript(ScriptSourceCode(script)) - ->RunScript(GetFrame().DomWindow()); + ClassicScript::CreateUnspecifiedScript(script)->RunScript( + GetFrame().DomWindow()); } wtf_size_t GetTrackedSignalCount() const {
diff --git a/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope_test.cc b/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope_test.cc index 10ce14b..09beffc 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope_test.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope_test.cc
@@ -12,7 +12,6 @@ #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/renderer/bindings/core/v8/module_record.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" #include "third_party/blink/renderer/bindings/core/v8/source_location.h"
diff --git a/third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc b/third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc index 8a45a67..0fe7d80 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc
@@ -15,7 +15,6 @@ #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/renderer/bindings/core/v8/module_record.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/source_location.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h"
diff --git a/third_party/blink/renderer/modules/worklet/animation_and_paint_worklet_thread_test.cc b/third_party/blink/renderer/modules/worklet/animation_and_paint_worklet_thread_test.cc index 16d0a25a..2170e8b 100644 --- a/third_party/blink/renderer/modules/worklet/animation_and_paint_worklet_thread_test.cc +++ b/third_party/blink/renderer/modules/worklet/animation_and_paint_worklet_thread_test.cc
@@ -9,7 +9,6 @@ #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/renderer/bindings/core/v8/module_record.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/source_location.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h"
diff --git a/third_party/blink/renderer/platform/fonts/script_run_iterator.cc b/third_party/blink/renderer/platform/fonts/script_run_iterator.cc index 155dda5..7ac9f40 100644 --- a/third_party/blink/renderer/platform/fonts/script_run_iterator.cc +++ b/third_party/blink/renderer/platform/fonts/script_run_iterator.cc
@@ -7,7 +7,9 @@ #include <algorithm> #include "base/logging.h" +#include "base/notreached.h" #include "third_party/blink/renderer/platform/text/icu_error.h" +#include "third_party/blink/renderer/platform/wtf/text/character_names.h" #include "third_party/blink/renderer/platform/wtf/threading.h" namespace blink { @@ -44,6 +46,69 @@ return USCRIPT_INVALID_CODE; } +ScriptRunIterator::UScriptCodeList GetHanScriptExtensions() { + ICUError status; + ScriptRunIterator::UScriptCodeList list; + list.resize(ScriptRunIterator::kMaxScriptCount - 1); + // Get the list from one of the CJK punctuation in the CJK Symbols and + // Punctuation block. + int count = uscript_getScriptExtensions(kLeftCornerBracket, &list[0], + list.size(), &status); + if (U_SUCCESS(status)) { + DCHECK_GT(count, 0); + list.resize(count); + return list; + } + NOTREACHED(); + return ScriptRunIterator::UScriptCodeList(); +} + +// This function updates the script list to the Han ideographic-based scripts if +// the East Asian Width property[1] indicates it is an East Asian character. +// +// Most East Asian punctuation characters have East Asian scripts in the script +// extensions. However, not all of them are so. For example, when they are +// halfwidth/fullwidth forms, they must have the same properties as their +// canonical equivalent[2] code points that are not East Asian. Such code points +// can split runs in the middle of consecutive CJK punctuation characters when +// they are preceded by non-CJK characters, and prevent applying font features +// to consecutive CJK punctuation characters. +// +// TODO(crbug.com/1273998): This function is not needed if Unicode changes the +// script extension for these code points. +// +// [1]: https://www.unicode.org/reports/tr11/ +// [2]: https://unicode.org/reports/tr15/#Canon_Compat_Equivalence +void FixScriptsByEastAsianWidth(UChar32 ch, + ScriptRunIterator::UScriptCodeList* set) { + // Replace the list only if it is the `COMMON` script. If `COMMON`, there + // should be only one entry. + DCHECK(!set->IsEmpty()); + if (set->size() > 1 || set->front() != USCRIPT_COMMON) { + DCHECK(!set->Contains(USCRIPT_COMMON)); + return; + } + + // It's an East Asian character when the EAW property is W, F, or H. + // https://www.unicode.org/reports/tr11/#Set_Relations + const auto eaw = static_cast<UEastAsianWidth>( + u_getIntPropertyValue(ch, UCHAR_EAST_ASIAN_WIDTH)); + if (eaw == U_EA_WIDE || eaw == U_EA_FULLWIDTH || eaw == U_EA_HALFWIDTH) { + // Replace the list with the list of Han ideographic scripts, as seen for + // U+300C in https://www.unicode.org/Public/UNIDATA/ScriptExtensions.txt. + DEFINE_STATIC_LOCAL(ScriptRunIterator::UScriptCodeList, han_scripts, + (GetHanScriptExtensions())); + if (UNLIKELY(han_scripts.IsEmpty())) { + // When |GetHanScriptExtensions| returns an empty list, replacing with it + // will crash later, which makes the analysis complicated. + NOTREACHED(); + return; + } + set->Shrink(0); + set->AppendVector(han_scripts); + } +} + } // namespace typedef ScriptData::PairedBracketType PairedBracketType; @@ -229,6 +294,7 @@ --brackets_fixup_depth_; } } + FixScriptsByEastAsianWidth(ch, next_set_.get()); brackets_.push_back(BracketRec({ch, USCRIPT_COMMON})); ++brackets_fixup_depth_; }
diff --git a/third_party/blink/renderer/platform/fonts/script_run_iterator_test.cc b/third_party/blink/renderer/platform/fonts/script_run_iterator_test.cc index 4c4dfc83..03872e4b 100644 --- a/third_party/blink/renderer/platform/fonts/script_run_iterator_test.cc +++ b/third_party/blink/renderer/platform/fonts/script_run_iterator_test.cc
@@ -565,6 +565,28 @@ {"」", USCRIPT_BOPOMOFO}}); } +TEST_F(ScriptRunIteratorTest, CJKConsecutiveParensLatin1) { + CHECK_SCRIPT_RUNS({{"「", USCRIPT_BOPOMOFO}, // See CJKConsecutiveParens4 + {"A", USCRIPT_LATIN}, + {"「", USCRIPT_BOPOMOFO}, + {"A", USCRIPT_LATIN}, + {"」」", USCRIPT_BOPOMOFO}}); +} + +TEST_F(ScriptRunIteratorTest, CJKConsecutiveParensLatin2) { + CHECK_SCRIPT_RUNS({{"「", USCRIPT_BOPOMOFO}, // See CJKConsecutiveParens4 + {"A", USCRIPT_LATIN}, + {"(", USCRIPT_BOPOMOFO}, + {"A", USCRIPT_LATIN}, + {")」", USCRIPT_BOPOMOFO}}); +} + +TEST_F(ScriptRunIteratorTest, CJKConsecutiveParensLatin3) { + CHECK_SCRIPT_RUNS({{"「", USCRIPT_BOPOMOFO}, // See CJKConsecutiveParens4 + {"A", USCRIPT_LATIN}, + {"(国)」", USCRIPT_HAN}}); +} + // Emojies are resolved to the leading script. TEST_F(ScriptRunIteratorTest, EmojiCommon) { CHECK_SCRIPT_RUNS({{"百家姓🌱🌲🌳🌴", USCRIPT_HAN}});
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc index 5d9ebd6..219b33ea 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc
@@ -1889,6 +1889,19 @@ } resource->VirtualTimePauser().UnpauseVirtualTime(); + + // A response should not serve partial content if it was not requested via a + // Range header: https://fetch.spec.whatwg.org/#main-fetch so keep it out + // of the preload cache in case of a non-206 response (which generates an + // error). + if (resource->GetResponse().GetType() == + network::mojom::FetchResponseType::kOpaque && + resource->GetResponse().HasRangeRequested() && + !resource->GetResourceRequest().HttpHeaderFields().Contains( + net::HttpRequestHeaders::kRange)) { + RemovePreload(resource); + } + if (type == kDidFinishLoading) { resource->Finish(response_end, freezable_task_runner_.get());
diff --git a/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_stream_adapter.cc b/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_stream_adapter.cc index 784297ef..469c2601 100644 --- a/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_stream_adapter.cc +++ b/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_stream_adapter.cc
@@ -21,6 +21,7 @@ #include "base/task/sequenced_task_runner.h" #include "base/threading/thread_restrictions.h" #include "base/time/time.h" +#include "base/trace_event/base_tracing.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "media/base/media_log.h" @@ -294,6 +295,8 @@ void RTCVideoDecoderStreamAdapter::InitializeOrReinitializeSync() { DVLOG(3) << __func__; + TRACE_EVENT0("webrtc", + "RTCVideoDecoderStreamAdapter::InitializeOrReinitializeSync"); // Can be called on |worker_thread_| or |decoding_thread_|. DCHECK(!media_task_runner_->RunsTasksInCurrentSequence()); @@ -314,6 +317,7 @@ bool RTCVideoDecoderStreamAdapter::Configure(const Settings& settings) { DVLOG(1) << __func__; DCHECK_CALLED_ON_VALID_SEQUENCE(decoding_sequence_checker_); + TRACE_EVENT0("webrtc", "RTCVideoDecoderStreamAdapter::Configure"); video_codec_type_ = settings.codec_type(); DCHECK_EQ(webrtc::PayloadStringToCodecType(format_.name), video_codec_type_); @@ -338,6 +342,9 @@ void RTCVideoDecoderStreamAdapter::AttemptLogInitializationState_Locked() { lock_.AssertAcquired(); + TRACE_EVENT0( + "webrtc", + "RTCVideoDecoderStreamAdapter::AttemptLogInitializationState_Locked"); // Don't log more than once. if (logged_init_status_) @@ -367,6 +374,7 @@ int64_t render_time_ms) { DVLOG(2) << __func__; DCHECK_CALLED_ON_VALID_SEQUENCE(decoding_sequence_checker_); + TRACE_EVENT0("webrtc", "RTCVideoDecoderStreamAdapter::Decode"); #if defined(OS_ANDROID) && !BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) const bool has_software_fallback = @@ -580,6 +588,8 @@ DVLOG(2) << __func__; DCHECK_CALLED_ON_VALID_SEQUENCE(decoding_sequence_checker_); DCHECK(callback); + TRACE_EVENT0("webrtc", + "RTCVideoDecoderStreamAdapter::RegisterDecodeCompleteCallback"); base::AutoLock auto_lock(lock_); decode_complete_callback_ = callback; @@ -594,6 +604,7 @@ int32_t RTCVideoDecoderStreamAdapter::Release() { DVLOG(1) << __func__; + TRACE_EVENT0("webrtc", "RTCVideoDecoderStreamAdapter::Release"); base::AutoLock auto_lock(lock_); @@ -621,6 +632,8 @@ InitCB init_cb) { DVLOG(3) << __func__; DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); + TRACE_EVENT0("webrtc", + "RTCVideoDecoderStreamAdapter::InitializeOnMediaThread"); // There's no re-init these days. If we ever need to re-init, such as to // clear an error, then `decoder_stream_` and `demuxer_stream_` should be @@ -675,6 +688,8 @@ void RTCVideoDecoderStreamAdapter::OnInitializeDone(base::TimeTicks start_time, bool success) { + TRACE_EVENT1("webrtc", "RTCVideoDecoderStreamAdapter::OnInitializeDone", + "success", success); RecordInitializationLatency(base::TimeTicks::Now() - start_time); { base::AutoLock auto_lock(lock_); @@ -700,6 +715,7 @@ std::unique_ptr<PendingBuffer> pending_buffer) { DVLOG(4) << __func__; DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); + TRACE_EVENT0("webrtc", "RTCVideoDecoderStreamAdapter::DecodeOnMediaThread"); { base::AutoLock auto_lock(lock_); @@ -726,6 +742,8 @@ media::VideoDecoderStream::ReadResult result) { DVLOG(3) << __func__; DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); + TRACE_EVENT1("webrtc", "RTCVideoDecoderStreamAdapter::OnFrameReady", + "success", result.has_value()); pending_read_ = false; @@ -795,6 +813,7 @@ void RTCVideoDecoderStreamAdapter::AttemptRead() { DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); + TRACE_EVENT0("webrtc", "RTCVideoDecoderStreamAdapter::AttemptRead"); { base::AutoLock auto_lock(lock_); @@ -820,6 +839,9 @@ bool RTCVideoDecoderStreamAdapter::ShouldReinitializeForSettingHDRColorSpace( const webrtc::EncodedImage& input_image) const { DCHECK_CALLED_ON_VALID_SEQUENCE(decoding_sequence_checker_); + TRACE_EVENT0("webrtc", + "RTCVideoDecoderStreamAdapter::" + "ShouldReinitializeForSettingHDRColorSpace"); if (config_.profile() == media::VP9PROFILE_PROFILE2 && input_image.ColorSpace()) { @@ -838,6 +860,7 @@ DVLOG(3) << __func__; DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); DCHECK(!pending_reset_); + TRACE_EVENT0("webrtc", "RTCVideoDecoderStreamAdapter::ResetOnMediaThread"); // A pending read is okay. We may decide to reset at any time, even if a read // is in progress. It'll be aborted when we reset `decoder_stream_`, and no // new read will be issued until the reset completes. @@ -888,6 +911,7 @@ void RTCVideoDecoderStreamAdapter::ShutdownOnMediaThread() { DVLOG(3) << __func__; DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); + TRACE_EVENT0("webrtc", "RTCVideoDecoderStreamAdapter::ShutdownOnMediaThread"); base::AutoLock auto_lock(lock_); weak_this_factory_.InvalidateWeakPtrs(); @@ -912,6 +936,9 @@ media::VideoDecoder* decoder) { DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); base::AutoLock auto_lock(lock_); + TRACE_EVENT1("webrtc", "RTCVideoDecoderStreamAdapter::OnDecoderChanged", + "decoder", + (decoder ? static_cast<int>(decoder->GetDecoderType()) : -1)); if (!decoder) { decoder_configured_ = false; @@ -971,6 +998,8 @@ void RTCVideoDecoderStreamAdapter::RestartDecoderStreamOnMedia() { DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); + TRACE_EVENT0("webrtc", + "RTCVideoDecoderStreamAdapter::RestartDecoderStreamOnMedia"); // Shut down and begin re-init. It's okay if there has not been an init // before this. @@ -989,6 +1018,8 @@ int32_t RTCVideoDecoderStreamAdapter::FallBackToSoftwareLocked() { DCHECK_CALLED_ON_VALID_SEQUENCE(decoding_sequence_checker_); lock_.AssertAcquired(); + TRACE_EVENT0("webrtc", + "RTCVideoDecoderStreamAdapter::FallBackToSoftwareLocked"); // We will either prefer software decoders by asking DecodersStream, or prefer // them by asking rtc to use rtc sw decoders. Either way, we don't contribute
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index d63b622..498a835 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -2410,6 +2410,7 @@ }, { name: "WebAppLaunchHandler", + origin_trial_feature_name: "Launch Handler", status: "experimental", }, {
diff --git a/third_party/blink/renderer/platform/wtf/text/character_names.h b/third_party/blink/renderer/platform/wtf/text/character_names.h index f18acae6..e01561fd5 100644 --- a/third_party/blink/renderer/platform/wtf/text/character_names.h +++ b/third_party/blink/renderer/platform/wtf/text/character_names.h
@@ -110,6 +110,7 @@ const UChar kLatinCapitalLetterIWithDotAbove = 0x0130; const UChar kLatinSmallLetterDotlessI = 0x0131; const UChar kLatinSmallLetterDotlessJ = 0x0237; +const UChar kLeftCornerBracket = 0x300C; const UChar kLeftDoubleQuotationMarkCharacter = 0x201C; const UChar kLeftSingleQuotationMarkCharacter = 0x2018; const UChar32 kLeftSpeechBubbleCharacter = 0x1F5E8; @@ -264,6 +265,7 @@ using WTF::unicode::kLatinCapitalLetterIWithDotAbove; using WTF::unicode::kLatinSmallLetterDotlessI; using WTF::unicode::kLatinSmallLetterDotlessJ; +using WTF::unicode::kLeftCornerBracket; using WTF::unicode::kLeftDoubleQuotationMarkCharacter; using WTF::unicode::kLeftSingleQuotationMarkCharacter; using WTF::unicode::kLeftSpeechBubbleCharacter;
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 0c8550a..75933ce7 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -4394,57 +4394,52 @@ crbug.com/764235 external/wpt/css/css-grid/alignment/grid-baseline-justify-001.html [ Failure ] # [css-subgrid] -crbug.com/618969 external/wpt/css/css-grid/subgrid/abs-pos-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/abs-pos-002.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/abs-pos-003.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/abs-pos-004.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/auto-track-sizing-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/baseline-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/contain-strict-subgrid-crash.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/contain-strict-nested-subgrid-crash.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-002.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-003.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-004.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-005.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-006.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-007.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-008.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-009.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-larger-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-larger-002.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-normal-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-smaller-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-template-computed-nogrid.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-template-parsing-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/item-percentage-height-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-002.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-003.html [ Crash ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/abs-pos-002.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/abs-pos-003.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/abs-pos-004.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/baseline-001.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-001.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-002.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-003.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-004.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-005.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-006.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-007.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-008.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-009.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-larger-001.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-larger-002.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-normal-001.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-gap-smaller-001.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/grid-template-computed-nogrid.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/item-percentage-height-001.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-001.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-002.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-003.html [ Failure ] crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-004.html [ Failure ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-005.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-006.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-007.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-008.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/orthogonal-writing-mode-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/orthogonal-writing-mode-002.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/orthogonal-writing-mode-003.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/orthogonal-writing-mode-004.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/parent-repeat-auto-fit-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/parent-repeat-auto-fit-002.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-002.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-003.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-004.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-005.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-006.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-007.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-008.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/subgrid-item-block-size-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/subgrid-mbp-overflow-001.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/subgrid-mbp-overflow-002.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/subgrid-mbp-overflow-003.html [ Crash ] -crbug.com/618969 external/wpt/css/css-grid/subgrid/subgrid-mbp-overflow-004.html [ Crash ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-005.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-006.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-007.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/line-names-008.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/orthogonal-writing-mode-001.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/orthogonal-writing-mode-002.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/orthogonal-writing-mode-003.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/orthogonal-writing-mode-004.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/parent-repeat-auto-fit-001.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/parent-repeat-auto-fit-002.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-001.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-002.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-003.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-004.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-005.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-006.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-007.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/repeat-auto-fill-008.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/subgrid-item-block-size-001.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/subgrid-mbp-overflow-001.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/subgrid-mbp-overflow-002.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/subgrid-mbp-overflow-003.html [ Failure ] +crbug.com/618969 external/wpt/css/css-grid/subgrid/subgrid-mbp-overflow-004.html [ Failure ] ### Tests failing with SVGTextNG enabled: crbug.com/1179585 svg/custom/visibility-collapse.html [ Failure ]
diff --git a/third_party/blink/web_tests/external/wpt/css/css-flexbox/negative-available-size-crash.html b/third_party/blink/web_tests/external/wpt/css/css-flexbox/negative-available-size-crash.html new file mode 100644 index 0000000..837fdae --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-flexbox/negative-available-size-crash.html
@@ -0,0 +1,4 @@ +<!DOCTYPE html> +<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1274476"> +<div style="display: flex;"> + <div style="display: flex; height: 0; overflow-x: scroll;">a
diff --git a/third_party/blink/web_tests/external/wpt/css/css-grid/parsing/grid-shorthand-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-grid/parsing/grid-shorthand-expected.txt deleted file mode 100644 index d2c4b0fd..0000000 --- a/third_party/blink/web_tests/external/wpt/css/css-grid/parsing/grid-shorthand-expected.txt +++ /dev/null
@@ -1,60 +0,0 @@ -This is a testharness.js-based test. -Found 56 tests; 31 PASS, 25 FAIL, 0 TIMEOUT, 0 NOTRUN. -FAIL e.style['grid'] = "none" should set grid-auto-columns assert_equals: grid-auto-columns should be canonical expected "auto" but got "initial" -FAIL e.style['grid'] = "none" should set grid-auto-flow assert_equals: grid-auto-flow should be canonical expected "row" but got "initial" -FAIL e.style['grid'] = "none" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial" -PASS e.style['grid'] = "none" should set grid-template-areas -PASS e.style['grid'] = "none" should set grid-template-columns -PASS e.style['grid'] = "none" should set grid-template-rows -PASS e.style['grid'] = "none" should not set unrelated longhands -FAIL e.style['grid'] = "10px / 20%" should set grid-auto-columns assert_equals: grid-auto-columns should be canonical expected "auto" but got "initial" -FAIL e.style['grid'] = "10px / 20%" should set grid-auto-flow assert_equals: grid-auto-flow should be canonical expected "row" but got "initial" -FAIL e.style['grid'] = "10px / 20%" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial" -PASS e.style['grid'] = "10px / 20%" should set grid-template-areas -PASS e.style['grid'] = "10px / 20%" should set grid-template-columns -PASS e.style['grid'] = "10px / 20%" should set grid-template-rows -PASS e.style['grid'] = "10px / 20%" should not set unrelated longhands -FAIL e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-auto-columns assert_equals: grid-auto-columns should be canonical expected "auto" but got "initial" -FAIL e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-auto-flow assert_equals: grid-auto-flow should be canonical expected "row" but got "initial" -FAIL e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial" -PASS e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-template-areas -PASS e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-template-columns -PASS e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-template-rows -PASS e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should not set unrelated longhands -FAIL e.style['grid'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-auto-columns assert_equals: grid-auto-columns should be canonical expected "auto" but got "initial" -FAIL e.style['grid'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-auto-flow assert_equals: grid-auto-flow should be canonical expected "row" but got "initial" -FAIL e.style['grid'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial" -PASS e.style['grid'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-template-areas -PASS e.style['grid'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-template-columns -PASS e.style['grid'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should set grid-template-rows -PASS e.style['grid'] = "[header-top] \"a a a\" [header-bottom] [main-top] \"b b b\" 1fr [main-bottom] / auto 1fr auto" should not set unrelated longhands -FAIL e.style['grid'] = " \"a a a\" \"b b b\" 1fr/ auto 1fr auto" should set grid-auto-columns assert_equals: grid-auto-columns should be canonical expected "auto" but got "initial" -FAIL e.style['grid'] = " \"a a a\" \"b b b\" 1fr/ auto 1fr auto" should set grid-auto-flow assert_equals: grid-auto-flow should be canonical expected "row" but got "initial" -FAIL e.style['grid'] = " \"a a a\" \"b b b\" 1fr/ auto 1fr auto" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial" -PASS e.style['grid'] = " \"a a a\" \"b b b\" 1fr/ auto 1fr auto" should set grid-template-areas -PASS e.style['grid'] = " \"a a a\" \"b b b\" 1fr/ auto 1fr auto" should set grid-template-columns -PASS e.style['grid'] = " \"a a a\" \"b b b\" 1fr/ auto 1fr auto" should set grid-template-rows -PASS e.style['grid'] = " \"a a a\" \"b b b\" 1fr/ auto 1fr auto" should not set unrelated longhands -FAIL e.style['grid'] = " [] \"a a a\" [] [] \"b b b\" 1fr [] / [] auto 1fr [] auto []" should set grid-auto-columns assert_equals: grid-auto-columns should be canonical expected "auto" but got "initial" -FAIL e.style['grid'] = " [] \"a a a\" [] [] \"b b b\" 1fr [] / [] auto 1fr [] auto []" should set grid-auto-flow assert_equals: grid-auto-flow should be canonical expected "row" but got "initial" -FAIL e.style['grid'] = " [] \"a a a\" [] [] \"b b b\" 1fr [] / [] auto 1fr [] auto []" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial" -PASS e.style['grid'] = " [] \"a a a\" [] [] \"b b b\" 1fr [] / [] auto 1fr [] auto []" should set grid-template-areas -PASS e.style['grid'] = " [] \"a a a\" [] [] \"b b b\" 1fr [] / [] auto 1fr [] auto []" should set grid-template-columns -PASS e.style['grid'] = " [] \"a a a\" [] [] \"b b b\" 1fr [] / [] auto 1fr [] auto []" should set grid-template-rows -PASS e.style['grid'] = " [] \"a a a\" [] [] \"b b b\" 1fr [] / [] auto 1fr [] auto []" should not set unrelated longhands -PASS e.style['grid'] = "10px / auto-flow dense 20px" should set grid-auto-columns -PASS e.style['grid'] = "10px / auto-flow dense 20px" should set grid-auto-flow -FAIL e.style['grid'] = "10px / auto-flow dense 20px" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial" -FAIL e.style['grid'] = "10px / auto-flow dense 20px" should set grid-template-areas assert_equals: grid-template-areas should be canonical expected "none" but got "initial" -FAIL e.style['grid'] = "10px / auto-flow dense 20px" should set grid-template-columns assert_equals: grid-template-columns should be canonical expected "none" but got "initial" -PASS e.style['grid'] = "10px / auto-flow dense 20px" should set grid-template-rows -PASS e.style['grid'] = "10px / auto-flow dense 20px" should not set unrelated longhands -FAIL e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-auto-columns assert_equals: grid-auto-columns should be canonical expected "auto" but got "initial" -FAIL e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-auto-flow assert_equals: grid-auto-flow should be canonical expected "dense" but got "row dense" -PASS e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-auto-rows -FAIL e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-template-areas assert_equals: grid-template-areas should be canonical expected "none" but got "initial" -PASS e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-template-columns -FAIL e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-template-rows assert_equals: grid-template-rows should be canonical expected "none" but got "initial" -PASS e.style['grid'] = "auto-flow dense 30px / 40px" should not set unrelated longhands -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/fetch/range/resources/partial-text.py b/third_party/blink/web_tests/external/wpt/fetch/range/resources/partial-text.py new file mode 100644 index 0000000..a005855 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/fetch/range/resources/partial-text.py
@@ -0,0 +1,47 @@ +""" +This generates a partial response for a 100-byte text file. +""" +import re + +from wptserve.utils import isomorphic_decode + +def main(request, response): + total_length = int(request.GET.first(b'length', b'100')) + partial_code = int(request.GET.first(b'partial', b'206')) + range_header = request.headers.get(b'Range', b'') + + # Send a 200 if there is no range request + if not range_header: + to_send = ''.zfill(total_length) + response.headers.set(b"Content-Type", b"text/plain") + response.headers.set(b"Cache-Control", b"no-cache") + response.headers.set(b"Content-Length", total_length) + response.content = to_send + return + + # Simple range parsing, requires specifically "bytes=xxx-xxxx" + range_header_match = re.search(r'^bytes=(\d*)-(\d*)$', isomorphic_decode(range_header)) + start, end = range_header_match.groups() + start = int(start) + end = int(end) if end else total_length + length = end - start + + # Error the request if the range goes beyond the length + if length <= 0 or end > total_length: + response.set_error(416, u"Range Not Satisfiable") + response.write() + return + + # Generate a partial response of the requested length + to_send = ''.zfill(length) + response.headers.set(b"Content-Type", b"text/plain") + response.headers.set(b"Accept-Ranges", b"bytes") + response.headers.set(b"Cache-Control", b"no-cache") + response.status = partial_code + + content_range = b"bytes %d-%d/%d" % (start, end, total_length) + + response.headers.set(b"Content-Range", content_range) + response.headers.set(b"Content-Length", length) + + response.content = to_send
diff --git a/third_party/blink/web_tests/external/wpt/fetch/range/resources/range-sw.js b/third_party/blink/web_tests/external/wpt/fetch/range/resources/range-sw.js index 3680c0c4..b47823f 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/range/resources/range-sw.js +++ b/third_party/blink/web_tests/external/wpt/fetch/range/resources/range-sw.js
@@ -12,7 +12,7 @@ } } -addEventListener('fetch', event => { +addEventListener('fetch', async event => { /** @type Request */ const request = event.request; const url = new URL(request.url); @@ -34,6 +34,11 @@ case 'broadcast-accept-encoding': broadcastAcceptEncoding(event); return; + case 'record-media-range-request': + return recordMediaRangeRequest(event); + case 'use-media-range-request': + useMediaRangeRequest(event); + return; } }); @@ -157,3 +162,57 @@ // Just send back any response, it isn't important for the test. event.respondWith(new Response('')); } + +let rangeResponse = {}; + +async function recordMediaRangeRequest(event) { + /** @type Request */ + const request = event.request; + const url = new URL(request.url); + const urlParams = new URLSearchParams(url.search); + const size = urlParams.get("size"); + const id = urlParams.get('id'); + const key = 'size' + size; + + if (key in rangeResponse) { + // Don't re-fetch ranges we already have. + const clonedResponse = rangeResponse[key].clone(); + event.respondWith(clonedResponse); + } else if (event.request.headers.get("range") === "bytes=0-") { + // Generate a bogus 206 response to trigger subsequent range requests + // of the desired size. + const length = urlParams.get("length") + 100; + const body = "A".repeat(Number(size)); + event.respondWith(new Response(body, {status: 206, headers: { + "Content-Type": "audio/mp4", + "Content-Range": `bytes 0-1/${length}` + }})); + } else if (event.request.headers.get("range") === `bytes=${Number(size)}-`) { + // Pass through actual range requests which will attempt to fetch up to the + // length in the original response which is bigger than the actual resource + // to make sure 206 and 416 responses are treated the same. + rangeResponse[key] = await fetch(event.request); + + // Let the client know we have the range response for the given ID + broadcast({id}); + } else { + event.respondWith(Promise.reject(Error("Invalid Request"))); + } +} + +function useMediaRangeRequest(event) { + /** @type Request */ + const request = event.request; + const url = new URL(request.url); + const urlParams = new URLSearchParams(url.search); + const size = urlParams.get("size"); + const key = 'size' + size; + + // Send a clone of the range response to preload. + if (key in rangeResponse) { + const clonedResponse = rangeResponse[key].clone(); + event.respondWith(clonedResponse); + } else { + event.respondWith(Promise.reject(Error("Invalid Request"))); + } +}
diff --git a/third_party/blink/web_tests/external/wpt/fetch/range/resources/utils.js b/third_party/blink/web_tests/external/wpt/fetch/range/resources/utils.js index 16ed737..ad2853b 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/range/resources/utils.js +++ b/third_party/blink/web_tests/external/wpt/fetch/range/resources/utils.js
@@ -8,6 +8,18 @@ }) } +function preloadImage(url, { doc = document }={}) { + return new Promise((resolve, reject) => { + const preload = doc.createElement('link'); + preload.rel = 'preload'; + preload.as = 'image'; + preload.onload = () => resolve(); + preload.onerror = () => resolve(); + preload.href = url; + doc.body.appendChild(preload); + }) +} + /** * * @param {Document} document
diff --git a/third_party/blink/web_tests/external/wpt/fetch/range/sw.https.window-expected.txt b/third_party/blink/web_tests/external/wpt/fetch/range/sw.https.window-expected.txt index 134b0a7..a9577f01 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/range/sw.https.window-expected.txt +++ b/third_party/blink/web_tests/external/wpt/fetch/range/sw.https.window-expected.txt
@@ -4,6 +4,7 @@ PASS Ranged response not allowed following no-cors ranged request PASS Non-opaque ranged response executed FAIL Accept-Encoding should not appear in a service worker assert_equals: Accept-Encoding should not be set for media expected (object) null but got (string) "identity;q=1, *;q=0" +PASS Opaque range preload successes and failures should be indistinguishable PASS Range headers correctly preserved PASS Range headers correctly removed PASS Headers correctly filtered
diff --git a/third_party/blink/web_tests/external/wpt/fetch/range/sw.https.window.js b/third_party/blink/web_tests/external/wpt/fetch/range/sw.https.window.js index 76f80e9..42e4ac6 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/range/sw.https.window.js +++ b/third_party/blink/web_tests/external/wpt/fetch/range/sw.https.window.js
@@ -149,3 +149,78 @@ assert_equals((await audioBroadcast).acceptEncoding, null, "Accept-Encoding should not be set for media"); }, `Accept-Encoding should not appear in a service worker`); + +promise_test(async t => { + const scope = BASE_SCOPE + Math.random(); + await setupRegistration(t, scope); + const iframe = await with_iframe(scope); + const w = iframe.contentWindow; + const length = 100; + const count = 3; + const counts = {}; + + // test a single range request size + async function testSizedRange(size, partialResponseCode) { + const rangeId = Math.random() + ''; + const rangeBroadcast = awaitMessage(w.navigator.serviceWorker, rangeId); + + // Create a bogus audo element to trick the browser into sending + // cross-origin range requests that can be manipulated by the service worker. + const sound_url = new URL('partial-text.py', w.location); + sound_url.hostname = REMOTE_HOST; + sound_url.searchParams.set('action', 'record-media-range-request'); + sound_url.searchParams.set('length', length); + sound_url.searchParams.set('size', size); + sound_url.searchParams.set('partial', partialResponseCode); + sound_url.searchParams.set('id', rangeId); + appendAudio(w.document, sound_url); + + // wait for the range requests to happen + await rangeBroadcast; + + // Create multiple preload requests and count the number of resource timing + // entries that get created to make sure 206 and 416 range responses are treated + // the same. + const url = new URL('partial-text.py', w.location); + url.searchParams.set('action', 'use-media-range-request'); + url.searchParams.set('size', size); + counts['size' + size] = 0; + for (let i = 0; i < count; i++) { + await preloadImage(url, { doc: w.document }); + } + } + + // Test range requests from 1 smaller than the correct size to 1 larger than + // the correct size to exercise the various permutations using the default 206 + // response code for successful range requests. + for (let size = length - 1; size <= length + 1; size++) { + await testSizedRange(size, '206'); + } + + // Test a successful range request using a 200 response. + await testSizedRange(length - 2, '200'); + + // Check the resource timing entries and count the reported number of fetches of each type + const resources = w.performance.getEntriesByType("resource"); + for (const entry of resources) { + const url = new URL(entry.name); + if (url.searchParams.has('action') && + url.searchParams.get('action') == 'use-media-range-request' && + url.searchParams.has('size')) { + counts['size' + url.searchParams.get('size')]++; + } + } + + // Make sure there are a non-zero number of preload requests and they are all the same + let counts_valid = true; + const first = 'size' + (length - 2); + for (let size = length - 2; size <= length + 1; size++) { + let key = 'size' + size; + if (!(key in counts) || counts[key] <= 0 || counts[key] != counts[first]) { + counts_valid = false; + break; + } + } + + assert_true(counts_valid, `Opaque range request preloads were different for error and success`); +}, `Opaque range preload successes and failures should be indistinguishable`);
diff --git a/third_party/blink/web_tests/external/wpt/webauthn/createcredential-minpinlength.https.html b/third_party/blink/web_tests/external/wpt/webauthn/createcredential-minpinlength.https.html new file mode 100644 index 0000000..09b045d4 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/webauthn/createcredential-minpinlength.https.html
@@ -0,0 +1,36 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>navigator.credentials.create() largeBlob extension tests with authenticator support</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src=helpers.js></script> +<body></body> +<script> +standardSetup(function() { + "use strict"; + + promise_test(async t => { + const credential = await createCredential({ + options: { + publicKey: { + extensions: { + minPinLength: true, + }, + }, + }, + }); + // The extension results will be in the authenticator outputs. + assert_true(new Uint8Array(credential.response.getAuthenticatorData()) + .toString() + .includes(new TextEncoder("utf-8") + .encode("minPinLength") + .toString())); + }, "navigator.credentials.create() with minPinLength requested"); +}, { + protocol: "ctap2_1", + extensions: ["minPinLength"], +}); +</script>
diff --git a/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set-expected.txt b/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set-expected.txt index 3acf233..96ccb1e 100644 --- a/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set-expected.txt +++ b/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set-expected.txt
@@ -202,11 +202,11 @@ PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none" PASS element.style.gridTemplateAreas is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "row" -PASS element.style.gridAutoFlow is "initial" +PASS element.style.gridAutoFlow is "row" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "auto" -PASS element.style.gridAutoColumns is "initial" +PASS element.style.gridAutoColumns is "auto" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto" -PASS element.style.gridAutoRows is "initial" +PASS element.style.gridAutoRows is "auto" PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "10px" PASS element.style.gridTemplateColumns is "10px" PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "[line] 20px" @@ -214,59 +214,59 @@ PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "\"a\"" PASS element.style.gridTemplateAreas is "\"a\"" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "row" -PASS element.style.gridAutoFlow is "initial" +PASS element.style.gridAutoFlow is "row" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "auto" -PASS element.style.gridAutoColumns is "initial" +PASS element.style.gridAutoColumns is "auto" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto" -PASS element.style.gridAutoRows is "initial" +PASS element.style.gridAutoRows is "auto" PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none" PASS element.style.gridTemplateColumns is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none" -PASS element.style.gridTemplateRows is "initial" +PASS element.style.gridTemplateRows is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none" -PASS element.style.gridTemplateAreas is "initial" +PASS element.style.gridTemplateAreas is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "dense" -PASS element.style.gridAutoFlow is "row dense" +PASS element.style.gridAutoFlow is "dense" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "auto" -PASS element.style.gridAutoColumns is "initial" +PASS element.style.gridAutoColumns is "auto" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "20px" PASS element.style.gridAutoRows is "20px" PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none" -PASS element.style.gridTemplateColumns is "initial" +PASS element.style.gridTemplateColumns is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "20px" PASS element.style.gridTemplateRows is "20px" PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none" -PASS element.style.gridTemplateAreas is "initial" +PASS element.style.gridTemplateAreas is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "column" PASS element.style.gridAutoFlow is "column" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "10px" PASS element.style.gridAutoColumns is "10px" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto" -PASS element.style.gridAutoRows is "initial" +PASS element.style.gridAutoRows is "auto" PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none" -PASS element.style.gridTemplateColumns is "initial" +PASS element.style.gridTemplateColumns is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none" PASS element.style.gridTemplateRows is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none" -PASS element.style.gridTemplateAreas is "initial" +PASS element.style.gridTemplateAreas is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "column dense" PASS element.style.gridAutoFlow is "column dense" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "20px" PASS element.style.gridAutoColumns is "20px" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto" -PASS element.style.gridAutoRows is "initial" +PASS element.style.gridAutoRows is "auto" PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none" -PASS element.style.gridTemplateColumns is "initial" +PASS element.style.gridTemplateColumns is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "10px" PASS element.style.gridTemplateRows is "10px" PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none" -PASS element.style.gridTemplateAreas is "initial" +PASS element.style.gridTemplateAreas is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "column" PASS element.style.gridAutoFlow is "column" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "20px" PASS element.style.gridAutoColumns is "20px" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto" -PASS element.style.gridAutoRows is "initial" +PASS element.style.gridAutoRows is "auto" Test the initial value @@ -286,17 +286,17 @@ Test setting grid-template-columns and grid-template-rows back to 'none' through JS PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none" -PASS element.style.gridTemplateColumns is "initial" +PASS element.style.gridTemplateColumns is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "10px" PASS element.style.gridTemplateRows is "10px" PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none" -PASS element.style.gridTemplateAreas is "initial" +PASS element.style.gridTemplateAreas is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "column" PASS element.style.gridAutoFlow is "column" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "20px" PASS element.style.gridAutoColumns is "20px" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto" -PASS element.style.gridAutoRows is "initial" +PASS element.style.gridAutoRows is "auto" PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none" PASS element.style.gridTemplateColumns is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none" @@ -304,23 +304,23 @@ PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none" PASS element.style.gridTemplateAreas is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "row" -PASS element.style.gridAutoFlow is "initial" +PASS element.style.gridAutoFlow is "row" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "auto" -PASS element.style.gridAutoColumns is "initial" +PASS element.style.gridAutoColumns is "auto" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto" -PASS element.style.gridAutoRows is "initial" +PASS element.style.gridAutoRows is "auto" PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none" -PASS element.style.gridTemplateColumns is "initial" +PASS element.style.gridTemplateColumns is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "20px" PASS element.style.gridTemplateRows is "20px" PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none" -PASS element.style.gridTemplateAreas is "initial" +PASS element.style.gridTemplateAreas is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "column" PASS element.style.gridAutoFlow is "column" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "10px" PASS element.style.gridAutoColumns is "10px" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto" -PASS element.style.gridAutoRows is "initial" +PASS element.style.gridAutoRows is "auto" PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none" PASS element.style.gridTemplateColumns is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none" @@ -328,11 +328,11 @@ PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none" PASS element.style.gridTemplateAreas is "none" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "row" -PASS element.style.gridAutoFlow is "initial" +PASS element.style.gridAutoFlow is "row" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "auto" -PASS element.style.gridAutoColumns is "initial" +PASS element.style.gridAutoColumns is "auto" PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto" -PASS element.style.gridAutoRows is "initial" +PASS element.style.gridAutoRows is "auto" Test the inherit value does not affect gutter properties (grid-*-gap)
diff --git a/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set.html b/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set.html index d834bb77..710bfe4 100644 --- a/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set.html +++ b/third_party/blink/web_tests/fast/css-grid-layout/grid-shorthand-get-set.html
@@ -178,12 +178,12 @@ debug(""); debug("Test getting and setting 'grid' shorthand through JS"); - testGridDefinitionsSetJSValues("20px / 10px", "10px", "20px", "none", "row", "auto", "auto", "10px", "20px", "none", "initial", "initial", "initial"); - testGridDefinitionsSetJSValues("[line] 'a' 20px / 10px", "10px", "[line] 20px", "\"a\"", "row", "auto", "auto", "10px", "[line] 20px", "\"a\"", "initial", "initial", "initial"); - testGridDefinitionsSetJSValues("auto-flow dense 20px / none", "none", "none", "none", "dense", "auto", "20px", "none", "initial", "initial", "row dense", "initial", "20px"); - testGridDefinitionsSetJSValues("20px / auto-flow 10px", "none", "20px", "none", "column", "10px", "auto", "initial", "20px", "initial", "column", "10px", "initial"); - testGridDefinitionsSetJSValues("none / auto-flow dense 20px", "none", "none", "none", "column dense", "20px", "auto", "initial", "none", "initial", "column dense", "20px", "initial"); - testGridDefinitionsSetJSValues("10px / auto-flow 20px", "none", "10px", "none", "column", "20px", "auto", "initial", "10px", "initial", "column", "20px", "initial"); + testGridDefinitionsSetJSValues("20px / 10px", "10px", "20px", "none", "row", "auto", "auto", "10px", "20px", "none", "row", "auto", "auto"); + testGridDefinitionsSetJSValues("[line] 'a' 20px / 10px", "10px", "[line] 20px", "\"a\"", "row", "auto", "auto", "10px", "[line] 20px", "\"a\"", "row", "auto", "auto"); + testGridDefinitionsSetJSValues("auto-flow dense 20px / none", "none", "none", "none", "dense", "auto", "20px", "none", "none", "none", "dense", "auto", "20px"); + testGridDefinitionsSetJSValues("20px / auto-flow 10px", "none", "20px", "none", "column", "10px", "auto", "none", "20px", "none", "column", "10px", "auto"); + testGridDefinitionsSetJSValues("none / auto-flow dense 20px", "none", "none", "none", "column dense", "20px", "auto", "none", "none", "none", "column dense", "20px", "auto"); + testGridDefinitionsSetJSValues("10px / auto-flow 20px", "none", "10px", "none", "column", "20px", "auto", "none", "10px", "none", "column", "20px", "auto"); debug(""); debug("Test the initial value"); @@ -199,10 +199,10 @@ debug(""); debug("Test setting grid-template-columns and grid-template-rows back to 'none' through JS"); - testGridDefinitionsSetJSValues("10px / auto-flow 20px", "none", "10px", "none", "column", "20px", "auto", "initial", "10px", "initial", "column", "20px", "initial"); - testGridDefinitionsSetJSValues("none", "none", "none", "none", "row", "auto", "auto", "none", "none", "none", "initial", "initial", "initial"); - testGridDefinitionsSetJSValues("20px / auto-flow 10px", "none", "20px", "none", "column", "10px", "auto", "initial", "20px", "initial", "column", "10px", "initial"); - testGridDefinitionsSetJSValues("none", "none", "none", "none", "row", "auto", "auto", "none", "none", "none", "initial", "initial", "initial"); + testGridDefinitionsSetJSValues("10px / auto-flow 20px", "none", "10px", "none", "column", "20px", "auto", "none", "10px", "none", "column", "20px", "auto"); + testGridDefinitionsSetJSValues("none", "none", "none", "none", "row", "auto", "auto", "none", "none", "none", "row", "auto", "auto"); + testGridDefinitionsSetJSValues("20px / auto-flow 10px", "none", "20px", "none", "column", "10px", "auto", "none", "20px", "none", "column", "10px", "auto"); + testGridDefinitionsSetJSValues("none", "none", "none", "none", "row", "auto", "auto", "none", "none", "none", "row", "auto", "auto"); debug(""); debug("Test the inherit value does not affect gutter properties (grid-*-gap)");
diff --git a/third_party/blink/web_tests/wpt_internal/css/css-conditional/container-queries/at-container-parsing.html b/third_party/blink/web_tests/wpt_internal/css/css-conditional/container-queries/at-container-parsing.html index ea1adca..805e01a 100644 --- a/third_party/blink/web_tests/wpt_internal/css/css-conditional/container-queries/at-container-parsing.html +++ b/third_party/blink/web_tests/wpt_internal/css/css-conditional/container-queries/at-container-parsing.html
@@ -28,8 +28,9 @@ }, query); } - // Tests that 1) the query parses, and 2) it does not evaluate to "unknown". - function test_query_known(query) { + // Tests that 1) the query parses, and 2) is either "unknown" or not, as + // specified. + function test_query_valid(query, unknown) { test(t => { t.add_cleanup(cleanup_main); let style = set_style(` @@ -37,10 +38,19 @@ @container (${query} or (not ${query})) { main { --match:true; } } `); assert_equals(style.sheet.rules.length, 2); - assert_equals(getComputedStyle(main).getPropertyValue('--match'), 'true'); + const expected = unknown ? '' : 'true'; + assert_equals(getComputedStyle(main).getPropertyValue('--match'), expected); }, query); } + function test_query_known(query) { + test_query_valid(query, false /* unknown */); + } + + function test_query_unknown(query) { + test_query_valid(query, true /* unknown */); + } + function test_container_selector_invalid(container_selector) { test(t => { t.add_cleanup(cleanup_main); @@ -57,6 +67,17 @@ }, `Container selector: ${container_selector}`); } + test_query_known('size(width)'); + test_query_known('size(min-width: 0px)'); + test_query_known('size(max-width: 0px)'); + test_query_known('size(height)'); + test_query_known('size(min-height: 0px)'); + test_query_known('size(max-height: 0px)'); + test_query_known('size(aspect-ratio)'); + test_query_known('size(min-aspect-ratio: 1/2)'); + test_query_known('size(max-aspect-ratio: 1/2)'); + test_query_known('size(orientation: portrait)'); + test_query_known('size(width: 100px)'); test_query_known('size((width: 100px))'); test_query_known('size(not (width: 100px))'); @@ -66,6 +87,17 @@ test_query_known('size(100px < width)'); test_query_known('size(100px < width < 200px)'); + test_query_unknown('foo(width)'); + test_query_unknown('size(asdf)'); + test_query_unknown('size(resolution > 100dpi)'); + test_query_unknown('size(resolution: 150dpi)'); + test_query_unknown('size(color)'); + test_query_unknown('size(min-color: 1)'); + test_query_unknown('size(color-index >= 1)'); + test_query_unknown('(color-index >= 1)'); + test_query_unknown('size(grid)'); + test_query_unknown('(grid)'); + test_query_invalid('screen'); test_query_invalid('print'); test_query_invalid('not print');
diff --git a/third_party/freetype/README.chromium b/third_party/freetype/README.chromium index 32e9f98..e3a66ae 100644 --- a/third_party/freetype/README.chromium +++ b/third_party/freetype/README.chromium
@@ -1,7 +1,7 @@ Name: FreeType URL: http://www.freetype.org/ -Version: VER-2-11-0-186-g64e26ad3a -Revision: 64e26ad3a2ef2e07190b2027b113a6b3f6eb8b0d +Version: VER-2-11-0-187-g3b45f564e +Revision: 3b45f564e94fde897c0e6e168c660a6e1ec5c679 CPEPrefix: cpe:/a:freetype:freetype:2.10.4 License: Custom license "inspired by the BSD, Artistic, and IJG (Independent JPEG Group) licenses"
diff --git a/third_party/google_appengine_cloudstorage/OWNERS b/third_party/google_appengine_cloudstorage/OWNERS deleted file mode 100644 index 90019ea..0000000 --- a/third_party/google_appengine_cloudstorage/OWNERS +++ /dev/null
@@ -1,3 +0,0 @@ -file://chrome/common/extensions/docs/server2/OWNERS -jyasskin@chromium.org -rockot@google.com
diff --git a/third_party/google_appengine_cloudstorage/README b/third_party/google_appengine_cloudstorage/README deleted file mode 100644 index bcfa9f69..0000000 --- a/third_party/google_appengine_cloudstorage/README +++ /dev/null
@@ -1,7 +0,0 @@ -AppEngine Google Cloud Storage clients -====================================== - -Official site: http://code.google.com/p/appengine-gcs-client/ - -Check the site for up to date status, latest version, getting started & user -guides.
diff --git a/third_party/google_appengine_cloudstorage/README.chromium b/third_party/google_appengine_cloudstorage/README.chromium deleted file mode 100644 index 073f575..0000000 --- a/third_party/google_appengine_cloudstorage/README.chromium +++ /dev/null
@@ -1,17 +0,0 @@ -Name: Google AppEngine Cloud Storage Python client -Short Name: appengine-gcs-client -URL: https://code.google.com/p/appengine-gcs-client/source -Date: 2014-Feb-14 -Revision: trunk -License: Apache 2.0 -License File: NOT_SHIPPED -Security Critical: no - -Description: -Python libraries to access Google Cloud Storage buckets from Google AppEngine -server, used in the documentation server to access parts of docs that are -hosted in Google Cloud Storage. - -Local Modifications: -- removed test and demo directories -- removed MANIFEST.in, setup.py and distribute_setup.py
diff --git a/third_party/google_appengine_cloudstorage/cloudstorage/__init__.py b/third_party/google_appengine_cloudstorage/cloudstorage/__init__.py deleted file mode 100644 index 349a021a..0000000 --- a/third_party/google_appengine_cloudstorage/cloudstorage/__init__.py +++ /dev/null
@@ -1,29 +0,0 @@ -# Copyright 2014 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -# either express or implied. See the License for the specific -# language governing permissions and limitations under the License. - -"""Client Library for Google Cloud Storage.""" - - - - -from .api_utils import RetryParams -from .api_utils import set_default_retry_params -from cloudstorage_api import * -from .common import CSFileStat -from .common import GCSFileStat -from .common import validate_bucket_name -from .common import validate_bucket_path -from .common import validate_file_path -from errors import * -from storage_api import *
diff --git a/third_party/google_appengine_cloudstorage/cloudstorage/api_utils.py b/third_party/google_appengine_cloudstorage/cloudstorage/api_utils.py deleted file mode 100644 index 49092d0..0000000 --- a/third_party/google_appengine_cloudstorage/cloudstorage/api_utils.py +++ /dev/null
@@ -1,315 +0,0 @@ -# Copyright 2013 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -# either express or implied. See the License for the specific -# language governing permissions and limitations under the License. - -"""Util functions and classes for cloudstorage_api.""" - - - -__all__ = ['set_default_retry_params', - 'RetryParams', - ] - -import copy -import httplib -import logging -import math -import os -import threading -import time -import urllib - - -try: - from google.appengine.api import urlfetch - from google.appengine.datastore import datastore_rpc - from google.appengine.ext.ndb import eventloop - from google.appengine.ext.ndb import utils - from google.appengine import runtime - from google.appengine.runtime import apiproxy_errors -except ImportError: - from google.appengine.api import urlfetch - from google.appengine.datastore import datastore_rpc - from google.appengine import runtime - from google.appengine.runtime import apiproxy_errors - from google.appengine.ext.ndb import eventloop - from google.appengine.ext.ndb import utils - - -_RETRIABLE_EXCEPTIONS = (urlfetch.DownloadError, - apiproxy_errors.Error) - -_thread_local_settings = threading.local() -_thread_local_settings.default_retry_params = None - - -def set_default_retry_params(retry_params): - """Set a default RetryParams for current thread current request.""" - _thread_local_settings.default_retry_params = copy.copy(retry_params) - - -def _get_default_retry_params(): - """Get default RetryParams for current request and current thread. - - Returns: - A new instance of the default RetryParams. - """ - default = getattr(_thread_local_settings, 'default_retry_params', None) - if default is None or not default.belong_to_current_request(): - return RetryParams() - else: - return copy.copy(default) - - -def _quote_filename(filename): - """Quotes filename to use as a valid URI path. - - Args: - filename: user provided filename. /bucket/filename. - - Returns: - The filename properly quoted to use as URI's path component. - """ - return urllib.quote(filename) - - -def _unquote_filename(filename): - """Unquotes a valid URI path back to its filename. - - This is the opposite of _quote_filename. - - Args: - filename: a quoted filename. /bucket/some%20filename. - - Returns: - The filename unquoted. - """ - return urllib.unquote(filename) - - -def _should_retry(resp): - """Given a urlfetch response, decide whether to retry that request.""" - return (resp.status_code == httplib.REQUEST_TIMEOUT or - (resp.status_code >= 500 and - resp.status_code < 600)) - - -class RetryParams(object): - """Retry configuration parameters.""" - - @datastore_rpc._positional(1) - def __init__(self, - backoff_factor=2.0, - initial_delay=0.1, - max_delay=10.0, - min_retries=2, - max_retries=5, - max_retry_period=30.0, - urlfetch_timeout=None, - save_access_token=False): - """Init. - - This object is unique per request per thread. - - Library will retry according to this setting when App Engine Server - can't call urlfetch, urlfetch timed out, or urlfetch got a 408 or - 500-600 response. - - Args: - backoff_factor: exponential backoff multiplier. - initial_delay: seconds to delay for the first retry. - max_delay: max seconds to delay for every retry. - min_retries: min number of times to retry. This value is automatically - capped by max_retries. - max_retries: max number of times to retry. Set this to 0 for no retry. - max_retry_period: max total seconds spent on retry. Retry stops when - this period passed AND min_retries has been attempted. - urlfetch_timeout: timeout for urlfetch in seconds. Could be None, - in which case the value will be chosen by urlfetch module. - save_access_token: persist access token to datastore to avoid - excessive usage of GetAccessToken API. Usually the token is cached - in process and in memcache. In some cases, memcache isn't very - reliable. - """ - self.backoff_factor = self._check('backoff_factor', backoff_factor) - self.initial_delay = self._check('initial_delay', initial_delay) - self.max_delay = self._check('max_delay', max_delay) - self.max_retry_period = self._check('max_retry_period', max_retry_period) - self.max_retries = self._check('max_retries', max_retries, True, int) - self.min_retries = self._check('min_retries', min_retries, True, int) - if self.min_retries > self.max_retries: - self.min_retries = self.max_retries - - self.urlfetch_timeout = None - if urlfetch_timeout is not None: - self.urlfetch_timeout = self._check('urlfetch_timeout', urlfetch_timeout) - self.save_access_token = self._check('save_access_token', save_access_token, - True, bool) - - self._request_id = os.getenv('REQUEST_LOG_ID') - - def __eq__(self, other): - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - return not self.__eq__(other) - - @classmethod - def _check(cls, name, val, can_be_zero=False, val_type=float): - """Check init arguments. - - Args: - name: name of the argument. For logging purpose. - val: value. Value has to be non negative number. - can_be_zero: whether value can be zero. - val_type: Python type of the value. - - Returns: - The value. - - Raises: - ValueError: when invalid value is passed in. - TypeError: when invalid value type is passed in. - """ - valid_types = [val_type] - if val_type is float: - valid_types.append(int) - - if type(val) not in valid_types: - raise TypeError( - 'Expect type %s for parameter %s' % (val_type.__name__, name)) - if val < 0: - raise ValueError( - 'Value for parameter %s has to be greater than 0' % name) - if not can_be_zero and val == 0: - raise ValueError( - 'Value for parameter %s can not be 0' % name) - return val - - def belong_to_current_request(self): - return os.getenv('REQUEST_LOG_ID') == self._request_id - - def delay(self, n, start_time): - """Calculate delay before the next retry. - - Args: - n: the number of current attempt. The first attempt should be 1. - start_time: the time when retry started in unix time. - - Returns: - Number of seconds to wait before next retry. -1 if retry should give up. - """ - if (n > self.max_retries or - (n > self.min_retries and - time.time() - start_time > self.max_retry_period)): - return -1 - return min( - math.pow(self.backoff_factor, n-1) * self.initial_delay, - self.max_delay) - - -def _retry_fetch(url, retry_params, **kwds): - """A blocking fetch function similar to urlfetch.fetch. - - This function should be used when a urlfetch has timed out or the response - shows http request timeout. This function will put current thread to - sleep between retry backoffs. - - Args: - url: url to fetch. - retry_params: an instance of RetryParams. - **kwds: keyword arguments for urlfetch. If deadline is specified in kwds, - it precedes the one in RetryParams. If none is specified, it's up to - urlfetch to use its own default. - - Returns: - A urlfetch response from the last retry. None if no retry was attempted. - - Raises: - Whatever exception encountered during the last retry. - """ - n = 1 - start_time = time.time() - delay = retry_params.delay(n, start_time) - if delay <= 0: - return - - logging.info('Will retry request to %s.', url) - while delay > 0: - resp = None - try: - logging.info('Retry in %s seconds.', delay) - time.sleep(delay) - resp = urlfetch.fetch(url, **kwds) - except runtime.DeadlineExceededError: - logging.info( - 'Urlfetch retry %s will exceed request deadline ' - 'after %s seconds total', n, time.time() - start_time) - raise - except _RETRIABLE_EXCEPTIONS, e: - pass - - n += 1 - delay = retry_params.delay(n, start_time) - if resp and not _should_retry(resp): - break - elif resp: - logging.info( - 'Got status %s from GCS.', resp.status_code) - else: - logging.info( - 'Got exception "%r" while contacting GCS.', e) - - if resp: - return resp - - logging.info('Urlfetch failed after %s retries and %s seconds in total.', - n - 1, time.time() - start_time) - raise - - -def _run_until_rpc(): - """Eagerly evaluate tasklets until it is blocking on some RPC. - - Usually ndb eventloop el isn't run until some code calls future.get_result(). - - When an async tasklet is called, the tasklet wrapper evaluates the tasklet - code into a generator, enqueues a callback _help_tasklet_along onto - the el.current queue, and returns a future. - - _help_tasklet_along, when called by the el, will - get one yielded value from the generator. If the value if another future, - set up a callback _on_future_complete to invoke _help_tasklet_along - when the dependent future fulfills. If the value if a RPC, set up a - callback _on_rpc_complete to invoke _help_tasklet_along when the RPC fulfills. - Thus _help_tasklet_along drills down - the chain of futures until some future is blocked by RPC. El runs - all callbacks and constantly check pending RPC status. - """ - el = eventloop.get_event_loop() - while el.current: - el.run0() - - -def _eager_tasklet(tasklet): - """Decorator to turn tasklet to run eagerly.""" - - @utils.wrapping(tasklet) - def eager_wrapper(*args, **kwds): - fut = tasklet(*args, **kwds) - _run_until_rpc() - return fut - - return eager_wrapper
diff --git a/third_party/google_appengine_cloudstorage/cloudstorage/cloudstorage_api.py b/third_party/google_appengine_cloudstorage/cloudstorage/cloudstorage_api.py deleted file mode 100644 index 51b4c84..0000000 --- a/third_party/google_appengine_cloudstorage/cloudstorage/cloudstorage_api.py +++ /dev/null
@@ -1,448 +0,0 @@ -# Copyright 2012 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -# either express or implied. See the License for the specific -# language governing permissions and limitations under the License. - -"""File Interface for Google Cloud Storage.""" - - - -from __future__ import with_statement - - - -__all__ = ['delete', - 'listbucket', - 'open', - 'stat', - ] - -import logging -import StringIO -import urllib -import xml.etree.cElementTree as ET -from . import api_utils -from . import common -from . import errors -from . import storage_api - - - -def open(filename, - mode='r', - content_type=None, - options=None, - read_buffer_size=storage_api.ReadBuffer.DEFAULT_BUFFER_SIZE, - retry_params=None, - _account_id=None): - """Opens a Google Cloud Storage file and returns it as a File-like object. - - Args: - filename: A Google Cloud Storage filename of form '/bucket/filename'. - mode: 'r' for reading mode. 'w' for writing mode. - In reading mode, the file must exist. In writing mode, a file will - be created or be overrode. - content_type: The MIME type of the file. str. Only valid in writing mode. - options: A str->basestring dict to specify additional headers to pass to - GCS e.g. {'x-goog-acl': 'private', 'x-goog-meta-foo': 'foo'}. - Supported options are x-goog-acl, x-goog-meta-, cache-control, - content-disposition, and content-encoding. - Only valid in writing mode. - See https://developers.google.com/storage/docs/reference-headers - for details. - read_buffer_size: The buffer size for read. Read keeps a buffer - and prefetches another one. To minimize blocking for large files, - always read by buffer size. To minimize number of RPC requests for - small files, set a large buffer size. Max is 30MB. - retry_params: An instance of api_utils.RetryParams for subsequent calls - to GCS from this file handle. If None, the default one is used. - _account_id: Internal-use only. - - Returns: - A reading or writing buffer that supports File-like interface. Buffer - must be closed after operations are done. - - Raises: - errors.AuthorizationError: if authorization failed. - errors.NotFoundError: if an object that's expected to exist doesn't. - ValueError: invalid open mode or if content_type or options are specified - in reading mode. - """ - common.validate_file_path(filename) - api = storage_api._get_storage_api(retry_params=retry_params, - account_id=_account_id) - filename = api_utils._quote_filename(filename) - - if mode == 'w': - common.validate_options(options) - return storage_api.StreamingBuffer(api, filename, content_type, options) - elif mode == 'r': - if content_type or options: - raise ValueError('Options and content_type can only be specified ' - 'for writing mode.') - return storage_api.ReadBuffer(api, - filename, - buffer_size=read_buffer_size) - else: - raise ValueError('Invalid mode %s.' % mode) - - -def delete(filename, retry_params=None, _account_id=None): - """Delete a Google Cloud Storage file. - - Args: - filename: A Google Cloud Storage filename of form '/bucket/filename'. - retry_params: An api_utils.RetryParams for this call to GCS. If None, - the default one is used. - _account_id: Internal-use only. - - Raises: - errors.NotFoundError: if the file doesn't exist prior to deletion. - """ - api = storage_api._get_storage_api(retry_params=retry_params, - account_id=_account_id) - common.validate_file_path(filename) - filename = api_utils._quote_filename(filename) - status, resp_headers, _ = api.delete_object(filename) - errors.check_status(status, [204], filename, resp_headers=resp_headers) - - -def stat(filename, retry_params=None, _account_id=None): - """Get GCSFileStat of a Google Cloud storage file. - - Args: - filename: A Google Cloud Storage filename of form '/bucket/filename'. - retry_params: An api_utils.RetryParams for this call to GCS. If None, - the default one is used. - _account_id: Internal-use only. - - Returns: - a GCSFileStat object containing info about this file. - - Raises: - errors.AuthorizationError: if authorization failed. - errors.NotFoundError: if an object that's expected to exist doesn't. - """ - common.validate_file_path(filename) - api = storage_api._get_storage_api(retry_params=retry_params, - account_id=_account_id) - status, headers, _ = api.head_object(api_utils._quote_filename(filename)) - errors.check_status(status, [200], filename, resp_headers=headers) - file_stat = common.GCSFileStat( - filename=filename, - st_size=headers.get('content-length'), - st_ctime=common.http_time_to_posix(headers.get('last-modified')), - etag=headers.get('etag'), - content_type=headers.get('content-type'), - metadata=common.get_metadata(headers)) - - return file_stat - - -def _copy2(src, dst, metadata=None, retry_params=None): - """Copy the file content from src to dst. - - Internal use only! - - Args: - src: /bucket/filename - dst: /bucket/filename - metadata: a dict of metadata for this copy. If None, old metadata is copied. - For example, {'x-goog-meta-foo': 'bar'}. - retry_params: An api_utils.RetryParams for this call to GCS. If None, - the default one is used. - - Raises: - errors.AuthorizationError: if authorization failed. - errors.NotFoundError: if an object that's expected to exist doesn't. - """ - common.validate_file_path(src) - common.validate_file_path(dst) - - if metadata is None: - metadata = {} - copy_meta = 'COPY' - else: - copy_meta = 'REPLACE' - metadata.update({'x-goog-copy-source': src, - 'x-goog-metadata-directive': copy_meta}) - - api = storage_api._get_storage_api(retry_params=retry_params) - status, resp_headers, _ = api.put_object( - api_utils._quote_filename(dst), headers=metadata) - errors.check_status(status, [200], src, metadata, resp_headers) - - -def listbucket(path_prefix, marker=None, prefix=None, max_keys=None, - delimiter=None, retry_params=None, _account_id=None): - """Returns a GCSFileStat iterator over a bucket. - - Optional arguments can limit the result to a subset of files under bucket. - - This function has two modes: - 1. List bucket mode: Lists all files in the bucket without any concept of - hierarchy. GCS doesn't have real directory hierarchies. - 2. Directory emulation mode: If you specify the 'delimiter' argument, - it is used as a path separator to emulate a hierarchy of directories. - In this mode, the "path_prefix" argument should end in the delimiter - specified (thus designates a logical directory). The logical directory's - contents, both files and subdirectories, are listed. The names of - subdirectories returned will end with the delimiter. So listbucket - can be called with the subdirectory name to list the subdirectory's - contents. - - Args: - path_prefix: A Google Cloud Storage path of format "/bucket" or - "/bucket/prefix". Only objects whose fullpath starts with the - path_prefix will be returned. - marker: Another path prefix. Only objects whose fullpath starts - lexicographically after marker will be returned (exclusive). - prefix: Deprecated. Use path_prefix. - max_keys: The limit on the number of objects to return. int. - For best performance, specify max_keys only if you know how many objects - you want. Otherwise, this method requests large batches and handles - pagination for you. - delimiter: Use to turn on directory mode. str of one or multiple chars - that your bucket uses as its directory separator. - retry_params: An api_utils.RetryParams for this call to GCS. If None, - the default one is used. - _account_id: Internal-use only. - - Examples: - For files "/bucket/a", - "/bucket/bar/1" - "/bucket/foo", - "/bucket/foo/1", "/bucket/foo/2/1", "/bucket/foo/3/1", - - Regular mode: - listbucket("/bucket/f", marker="/bucket/foo/1") - will match "/bucket/foo/2/1", "/bucket/foo/3/1". - - Directory mode: - listbucket("/bucket/", delimiter="/") - will match "/bucket/a, "/bucket/bar/" "/bucket/foo", "/bucket/foo/". - listbucket("/bucket/foo/", delimiter="/") - will match "/bucket/foo/1", "/bucket/foo/2/", "/bucket/foo/3/" - - Returns: - Regular mode: - A GCSFileStat iterator over matched files ordered by filename. - The iterator returns GCSFileStat objects. filename, etag, st_size, - st_ctime, and is_dir are set. - - Directory emulation mode: - A GCSFileStat iterator over matched files and directories ordered by - name. The iterator returns GCSFileStat objects. For directories, - only the filename and is_dir fields are set. - - The last name yielded can be used as next call's marker. - """ - if prefix: - common.validate_bucket_path(path_prefix) - bucket = path_prefix - else: - bucket, prefix = common._process_path_prefix(path_prefix) - - if marker and marker.startswith(bucket): - marker = marker[len(bucket) + 1:] - - api = storage_api._get_storage_api(retry_params=retry_params, - account_id=_account_id) - options = {} - if marker: - options['marker'] = marker - if max_keys: - options['max-keys'] = max_keys - if prefix: - options['prefix'] = prefix - if delimiter: - options['delimiter'] = delimiter - - return _Bucket(api, bucket, options) - - -class _Bucket(object): - """A wrapper for a GCS bucket as the return value of listbucket.""" - - def __init__(self, api, path, options): - """Initialize. - - Args: - api: storage_api instance. - path: bucket path of form '/bucket'. - options: a dict of listbucket options. Please see listbucket doc. - """ - self._init(api, path, options) - - def _init(self, api, path, options): - self._api = api - self._path = path - self._options = options.copy() - self._get_bucket_fut = self._api.get_bucket_async( - self._path + '?' + urllib.urlencode(self._options)) - self._last_yield = None - self._new_max_keys = self._options.get('max-keys') - - def __getstate__(self): - options = self._options - if self._last_yield: - options['marker'] = self._last_yield.filename[len(self._path) + 1:] - if self._new_max_keys is not None: - options['max-keys'] = self._new_max_keys - return {'api': self._api, - 'path': self._path, - 'options': options} - - def __setstate__(self, state): - self._init(state['api'], state['path'], state['options']) - - def __iter__(self): - """Iter over the bucket. - - Yields: - GCSFileStat: a GCSFileStat for an object in the bucket. - They are ordered by GCSFileStat.filename. - """ - total = 0 - max_keys = self._options.get('max-keys') - - while self._get_bucket_fut: - status, resp_headers, content = self._get_bucket_fut.get_result() - errors.check_status(status, [200], self._path, resp_headers=resp_headers, - extras=self._options) - - if self._should_get_another_batch(content): - self._get_bucket_fut = self._api.get_bucket_async( - self._path + '?' + urllib.urlencode(self._options)) - else: - self._get_bucket_fut = None - - root = ET.fromstring(content) - dirs = self._next_dir_gen(root) - files = self._next_file_gen(root) - next_file = files.next() - next_dir = dirs.next() - - while ((max_keys is None or total < max_keys) and - not (next_file is None and next_dir is None)): - total += 1 - if next_file is None: - self._last_yield = next_dir - next_dir = dirs.next() - elif next_dir is None: - self._last_yield = next_file - next_file = files.next() - elif next_dir < next_file: - self._last_yield = next_dir - next_dir = dirs.next() - elif next_file < next_dir: - self._last_yield = next_file - next_file = files.next() - else: - logging.error( - 'Should never reach. next file is %r. next dir is %r.', - next_file, next_dir) - if self._new_max_keys: - self._new_max_keys -= 1 - yield self._last_yield - - def _next_file_gen(self, root): - """Generator for next file element in the document. - - Args: - root: root element of the XML tree. - - Yields: - GCSFileStat for the next file. - """ - for e in root.getiterator(common._T_CONTENTS): - st_ctime, size, etag, key = None, None, None, None - for child in e.getiterator('*'): - if child.tag == common._T_LAST_MODIFIED: - st_ctime = common.dt_str_to_posix(child.text) - elif child.tag == common._T_ETAG: - etag = child.text - elif child.tag == common._T_SIZE: - size = child.text - elif child.tag == common._T_KEY: - key = child.text - yield common.GCSFileStat(self._path + '/' + key, - size, etag, st_ctime) - e.clear() - yield None - - def _next_dir_gen(self, root): - """Generator for next directory element in the document. - - Args: - root: root element in the XML tree. - - Yields: - GCSFileStat for the next directory. - """ - for e in root.getiterator(common._T_COMMON_PREFIXES): - yield common.GCSFileStat( - self._path + '/' + e.find(common._T_PREFIX).text, - st_size=None, etag=None, st_ctime=None, is_dir=True) - e.clear() - yield None - - def _should_get_another_batch(self, content): - """Whether to issue another GET bucket call. - - Args: - content: response XML. - - Returns: - True if should, also update self._options for the next request. - False otherwise. - """ - if ('max-keys' in self._options and - self._options['max-keys'] <= common._MAX_GET_BUCKET_RESULT): - return False - - elements = self._find_elements( - content, set([common._T_IS_TRUNCATED, - common._T_NEXT_MARKER])) - if elements.get(common._T_IS_TRUNCATED, 'false').lower() != 'true': - return False - - next_marker = elements.get(common._T_NEXT_MARKER) - if next_marker is None: - self._options.pop('marker', None) - return False - self._options['marker'] = next_marker - return True - - def _find_elements(self, result, elements): - """Find interesting elements from XML. - - This function tries to only look for specified elements - without parsing the entire XML. The specified elements is better - located near the beginning. - - Args: - result: response XML. - elements: a set of interesting element tags. - - Returns: - A dict from element tag to element value. - """ - element_mapping = {} - result = StringIO.StringIO(result) - for _, e in ET.iterparse(result, events=('end',)): - if not elements: - break - if e.tag in elements: - element_mapping[e.tag] = e.text - elements.remove(e.tag) - return element_mapping
diff --git a/third_party/google_appengine_cloudstorage/cloudstorage/common.py b/third_party/google_appengine_cloudstorage/cloudstorage/common.py deleted file mode 100644 index 9976b91..0000000 --- a/third_party/google_appengine_cloudstorage/cloudstorage/common.py +++ /dev/null
@@ -1,409 +0,0 @@ -# Copyright 2012 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -# either express or implied. See the License for the specific -# language governing permissions and limitations under the License. - -"""Helpers shared by cloudstorage_stub and cloudstorage_api.""" - - - - - -__all__ = ['CS_XML_NS', - 'CSFileStat', - 'dt_str_to_posix', - 'local_api_url', - 'LOCAL_GCS_ENDPOINT', - 'local_run', - 'get_access_token', - 'get_metadata', - 'GCSFileStat', - 'http_time_to_posix', - 'memory_usage', - 'posix_time_to_http', - 'posix_to_dt_str', - 'set_access_token', - 'validate_options', - 'validate_bucket_name', - 'validate_bucket_path', - 'validate_file_path', - ] - - -import calendar -import datetime -from email import utils as email_utils -import logging -import os -import re - -try: - from google.appengine.api import runtime -except ImportError: - from google.appengine.api import runtime - - -_GCS_BUCKET_REGEX_BASE = r'[a-z0-9\.\-_]{3,63}' -_GCS_BUCKET_REGEX = re.compile(_GCS_BUCKET_REGEX_BASE + r'$') -_GCS_BUCKET_PATH_REGEX = re.compile(r'/' + _GCS_BUCKET_REGEX_BASE + r'$') -_GCS_PATH_PREFIX_REGEX = re.compile(r'/' + _GCS_BUCKET_REGEX_BASE + r'.*') -_GCS_FULLPATH_REGEX = re.compile(r'/' + _GCS_BUCKET_REGEX_BASE + r'/.*') -_GCS_METADATA = ['x-goog-meta-', - 'content-disposition', - 'cache-control', - 'content-encoding'] -_GCS_OPTIONS = _GCS_METADATA + ['x-goog-acl'] -CS_XML_NS = 'http://doc.s3.amazonaws.com/2006-03-01' -LOCAL_GCS_ENDPOINT = '/_ah/gcs' -_access_token = '' - - -_MAX_GET_BUCKET_RESULT = 1000 - - -def set_access_token(access_token): - """Set the shared access token to authenticate with Google Cloud Storage. - - When set, the library will always attempt to communicate with the - real Google Cloud Storage with this token even when running on dev appserver. - Note the token could expire so it's up to you to renew it. - - When absent, the library will automatically request and refresh a token - on appserver, or when on dev appserver, talk to a Google Cloud Storage - stub. - - Args: - access_token: you can get one by run 'gsutil -d ls' and copy the - str after 'Bearer'. - """ - global _access_token - _access_token = access_token - - -def get_access_token(): - """Returns the shared access token.""" - return _access_token - - -class GCSFileStat(object): - """Container for GCS file stat.""" - - def __init__(self, - filename, - st_size, - etag, - st_ctime, - content_type=None, - metadata=None, - is_dir=False): - """Initialize. - - For files, the non optional arguments are always set. - For directories, only filename and is_dir is set. - - Args: - filename: a Google Cloud Storage filename of form '/bucket/filename'. - st_size: file size in bytes. long compatible. - etag: hex digest of the md5 hash of the file's content. str. - st_ctime: posix file creation time. float compatible. - content_type: content type. str. - metadata: a str->str dict of user specified options when creating - the file. Possible keys are x-goog-meta-, content-disposition, - content-encoding, and cache-control. - is_dir: True if this represents a directory. False if this is a real file. - """ - self.filename = filename - self.is_dir = is_dir - self.st_size = None - self.st_ctime = None - self.etag = None - self.content_type = content_type - self.metadata = metadata - - if not is_dir: - self.st_size = long(st_size) - self.st_ctime = float(st_ctime) - if etag[0] == '"' and etag[-1] == '"': - etag = etag[1:-1] - self.etag = etag - - def __repr__(self): - if self.is_dir: - return '(directory: %s)' % self.filename - - return ( - '(filename: %(filename)s, st_size: %(st_size)s, ' - 'st_ctime: %(st_ctime)s, etag: %(etag)s, ' - 'content_type: %(content_type)s, ' - 'metadata: %(metadata)s)' % - dict(filename=self.filename, - st_size=self.st_size, - st_ctime=self.st_ctime, - etag=self.etag, - content_type=self.content_type, - metadata=self.metadata)) - - def __cmp__(self, other): - if not isinstance(other, self.__class__): - raise ValueError('Argument to cmp must have the same type. ' - 'Expect %s, got %s', self.__class__.__name__, - other.__class__.__name__) - if self.filename > other.filename: - return 1 - elif self.filename < other.filename: - return -1 - return 0 - - def __hash__(self): - if self.etag: - return hash(self.etag) - return hash(self.filename) - - -CSFileStat = GCSFileStat - - -def get_metadata(headers): - """Get user defined options from HTTP response headers.""" - return dict((k, v) for k, v in headers.iteritems() - if any(k.lower().startswith(valid) for valid in _GCS_METADATA)) - - -def validate_bucket_name(name): - """Validate a Google Storage bucket name. - - Args: - name: a Google Storage bucket name with no prefix or suffix. - - Raises: - ValueError: if name is invalid. - """ - _validate_path(name) - if not _GCS_BUCKET_REGEX.match(name): - raise ValueError('Bucket should be 3-63 characters long using only a-z,' - '0-9, underscore, dash or dot but got %s' % name) - - -def validate_bucket_path(path): - """Validate a Google Cloud Storage bucket path. - - Args: - path: a Google Storage bucket path. It should have form '/bucket'. - - Raises: - ValueError: if path is invalid. - """ - _validate_path(path) - if not _GCS_BUCKET_PATH_REGEX.match(path): - raise ValueError('Bucket should have format /bucket ' - 'but got %s' % path) - - -def validate_file_path(path): - """Validate a Google Cloud Storage file path. - - Args: - path: a Google Storage file path. It should have form '/bucket/filename'. - - Raises: - ValueError: if path is invalid. - """ - _validate_path(path) - if not _GCS_FULLPATH_REGEX.match(path): - raise ValueError('Path should have format /bucket/filename ' - 'but got %s' % path) - - -def _process_path_prefix(path_prefix): - """Validate and process a Google Cloud Stoarge path prefix. - - Args: - path_prefix: a Google Cloud Storage path prefix of format '/bucket/prefix' - or '/bucket/' or '/bucket'. - - Raises: - ValueError: if path is invalid. - - Returns: - a tuple of /bucket and prefix. prefix can be None. - """ - _validate_path(path_prefix) - if not _GCS_PATH_PREFIX_REGEX.match(path_prefix): - raise ValueError('Path prefix should have format /bucket, /bucket/, ' - 'or /bucket/prefix but got %s.' % path_prefix) - bucket_name_end = path_prefix.find('/', 1) - bucket = path_prefix - prefix = None - if bucket_name_end != -1: - bucket = path_prefix[:bucket_name_end] - prefix = path_prefix[bucket_name_end + 1:] or None - return bucket, prefix - - -def _validate_path(path): - """Basic validation of Google Storage paths. - - Args: - path: a Google Storage path. It should have form '/bucket/filename' - or '/bucket'. - - Raises: - ValueError: if path is invalid. - TypeError: if path is not of type basestring. - """ - if not path: - raise ValueError('Path is empty') - if not isinstance(path, basestring): - raise TypeError('Path should be a string but is %s (%s).' % - (path.__class__, path)) - - -def validate_options(options): - """Validate Google Cloud Storage options. - - Args: - options: a str->basestring dict of options to pass to Google Cloud Storage. - - Raises: - ValueError: if option is not supported. - TypeError: if option is not of type str or value of an option - is not of type basestring. - """ - if not options: - return - - for k, v in options.iteritems(): - if not isinstance(k, str): - raise TypeError('option %r should be a str.' % k) - if not any(k.lower().startswith(valid) for valid in _GCS_OPTIONS): - raise ValueError('option %s is not supported.' % k) - if not isinstance(v, basestring): - raise TypeError('value %r for option %s should be of type basestring.' % - (v, k)) - - -def http_time_to_posix(http_time): - """Convert HTTP time format to posix time. - - See http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 - for http time format. - - Args: - http_time: time in RFC 2616 format. e.g. - "Mon, 20 Nov 1995 19:12:08 GMT". - - Returns: - A float of secs from unix epoch. - """ - if http_time is not None: - return email_utils.mktime_tz(email_utils.parsedate_tz(http_time)) - - -def posix_time_to_http(posix_time): - """Convert posix time to HTML header time format. - - Args: - posix_time: unix time. - - Returns: - A datatime str in RFC 2616 format. - """ - if posix_time: - return email_utils.formatdate(posix_time, usegmt=True) - - -_DT_FORMAT = '%Y-%m-%dT%H:%M:%S' - - -def dt_str_to_posix(dt_str): - """format str to posix. - - datetime str is of format %Y-%m-%dT%H:%M:%S.%fZ, - e.g. 2013-04-12T00:22:27.978Z. According to ISO 8601, T is a separator - between date and time when they are on the same line. - Z indicates UTC (zero meridian). - - A pointer: http://www.cl.cam.ac.uk/~mgk25/iso-time.html - - This is used to parse LastModified node from GCS's GET bucket XML response. - - Args: - dt_str: A datetime str. - - Returns: - A float of secs from unix epoch. By posix definition, epoch is midnight - 1970/1/1 UTC. - """ - parsable, _ = dt_str.split('.') - dt = datetime.datetime.strptime(parsable, _DT_FORMAT) - return calendar.timegm(dt.utctimetuple()) - - -def posix_to_dt_str(posix): - """Reverse of str_to_datetime. - - This is used by GCS stub to generate GET bucket XML response. - - Args: - posix: A float of secs from unix epoch. - - Returns: - A datetime str. - """ - dt = datetime.datetime.utcfromtimestamp(posix) - dt_str = dt.strftime(_DT_FORMAT) - return dt_str + '.000Z' - - -def local_run(): - """Whether we should hit GCS dev appserver stub.""" - server_software = os.environ.get('SERVER_SOFTWARE') - if server_software is None: - return True - if 'remote_api' in server_software: - return False - if server_software.startswith(('Development', 'testutil')): - return True - return False - - -def local_api_url(): - """Return URL for GCS emulation on dev appserver.""" - return 'http://%s%s' % (os.environ.get('HTTP_HOST'), LOCAL_GCS_ENDPOINT) - - -def memory_usage(method): - """Log memory usage before and after a method.""" - def wrapper(*args, **kwargs): - logging.info('Memory before method %s is %s.', - method.__name__, runtime.memory_usage().current()) - result = method(*args, **kwargs) - logging.info('Memory after method %s is %s', - method.__name__, runtime.memory_usage().current()) - return result - return wrapper - - -def _add_ns(tagname): - return '{%(ns)s}%(tag)s' % {'ns': CS_XML_NS, - 'tag': tagname} - - -_T_CONTENTS = _add_ns('Contents') -_T_LAST_MODIFIED = _add_ns('LastModified') -_T_ETAG = _add_ns('ETag') -_T_KEY = _add_ns('Key') -_T_SIZE = _add_ns('Size') -_T_PREFIX = _add_ns('Prefix') -_T_COMMON_PREFIXES = _add_ns('CommonPrefixes') -_T_NEXT_MARKER = _add_ns('NextMarker') -_T_IS_TRUNCATED = _add_ns('IsTruncated')
diff --git a/third_party/google_appengine_cloudstorage/cloudstorage/errors.py b/third_party/google_appengine_cloudstorage/cloudstorage/errors.py deleted file mode 100644 index 9f116ac..0000000 --- a/third_party/google_appengine_cloudstorage/cloudstorage/errors.py +++ /dev/null
@@ -1,140 +0,0 @@ -# Copyright 2012 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -# either express or implied. See the License for the specific -# language governing permissions and limitations under the License. - -"""Google Cloud Storage specific Files API calls.""" - - - - - -__all__ = ['AuthorizationError', - 'check_status', - 'Error', - 'FatalError', - 'FileClosedError', - 'ForbiddenError', - 'NotFoundError', - 'ServerError', - 'TimeoutError', - 'TransientError', - ] - -import httplib - - -class Error(Exception): - """Base error for all gcs operations. - - Error can happen on GAE side or GCS server side. - For details on a particular GCS HTTP response code, see - https://developers.google.com/storage/docs/reference-status#standardcodes - """ - - -class TransientError(Error): - """TransientError could be retried.""" - - -class TimeoutError(TransientError): - """HTTP 408 timeout.""" - - -class FatalError(Error): - """FatalError shouldn't be retried.""" - - -class FileClosedError(FatalError): - """File is already closed. - - This can happen when the upload has finished but 'write' is called on - a stale upload handle. - """ - - -class NotFoundError(FatalError): - """HTTP 404 resource not found.""" - - -class ForbiddenError(FatalError): - """HTTP 403 Forbidden. - - While GCS replies with a 403 error for many reasons, the most common one - is due to bucket permission not correctly setup for your app to access. - """ - - -class AuthorizationError(FatalError): - """HTTP 401 authentication required. - - Unauthorized request has been received by GCS. - - This error is mostly handled by GCS client. GCS client will request - a new access token and retry the request. - """ - - -class InvalidRange(FatalError): - """HTTP 416 RequestRangeNotSatifiable.""" - - -class ServerError(TransientError): - """HTTP >= 500 server side error.""" - - -def check_status(status, expected, path, headers=None, - resp_headers=None, extras=None): - """Check HTTP response status is expected. - - Args: - status: HTTP response status. int. - expected: a list of expected statuses. A list of ints. - path: filename or a path prefix. - headers: HTTP request headers. - resp_headers: HTTP response headers. - extras: extra info to be logged verbatim if error occurs. - - Raises: - AuthorizationError: if authorization failed. - NotFoundError: if an object that's expected to exist doesn't. - TimeoutError: if HTTP request timed out. - ServerError: if server experienced some errors. - FatalError: if any other unexpected errors occurred. - """ - if status in expected: - return - - msg = ('Expect status %r from Google Storage. But got status %d.\n' - 'Path: %r.\n' - 'Request headers: %r.\n' - 'Response headers: %r.\n' - 'Extra info: %r.\n' % - (expected, status, path, headers, resp_headers, extras)) - - if status == httplib.UNAUTHORIZED: - raise AuthorizationError(msg) - elif status == httplib.FORBIDDEN: - raise ForbiddenError(msg) - elif status == httplib.NOT_FOUND: - raise NotFoundError(msg) - elif status == httplib.REQUEST_TIMEOUT: - raise TimeoutError(msg) - elif status == httplib.REQUESTED_RANGE_NOT_SATISFIABLE: - raise InvalidRange(msg) - elif (status == httplib.OK and 308 in expected and - httplib.OK not in expected): - raise FileClosedError(msg) - elif status >= 500: - raise ServerError(msg) - else: - raise FatalError(msg)
diff --git a/third_party/google_appengine_cloudstorage/cloudstorage/rest_api.py b/third_party/google_appengine_cloudstorage/cloudstorage/rest_api.py deleted file mode 100644 index ed0683c1..0000000 --- a/third_party/google_appengine_cloudstorage/cloudstorage/rest_api.py +++ /dev/null
@@ -1,246 +0,0 @@ -# Copyright 2012 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -# either express or implied. See the License for the specific -# language governing permissions and limitations under the License. - -"""Base and helper classes for Google RESTful APIs.""" - - - - - -__all__ = ['add_sync_methods'] - -import httplib -import random -import time - -from . import api_utils - -try: - from google.appengine.api import app_identity - from google.appengine.ext import ndb -except ImportError: - from google.appengine.api import app_identity - from google.appengine.ext import ndb - - -def _make_sync_method(name): - """Helper to synthesize a synchronous method from an async method name. - - Used by the @add_sync_methods class decorator below. - - Args: - name: The name of the synchronous method. - - Returns: - A method (with first argument 'self') that retrieves and calls - self.<name>, passing its own arguments, expects it to return a - Future, and then waits for and returns that Future's result. - """ - - def sync_wrapper(self, *args, **kwds): - method = getattr(self, name) - future = method(*args, **kwds) - return future.get_result() - - return sync_wrapper - - -def add_sync_methods(cls): - """Class decorator to add synchronous methods corresponding to async methods. - - This modifies the class in place, adding additional methods to it. - If a synchronous method of a given name already exists it is not - replaced. - - Args: - cls: A class. - - Returns: - The same class, modified in place. - """ - for name in cls.__dict__.keys(): - if name.endswith('_async'): - sync_name = name[:-6] - if not hasattr(cls, sync_name): - setattr(cls, sync_name, _make_sync_method(name)) - return cls - - -class _AE_TokenStorage_(ndb.Model): - """Entity to store app_identity tokens in memcache.""" - - token = ndb.StringProperty() - expires = ndb.FloatProperty() - - -@ndb.tasklet -def _make_token_async(scopes, service_account_id): - """Get a fresh authentication token. - - Args: - scopes: A list of scopes. - service_account_id: Internal-use only. - - Returns: - An tuple (token, expiration_time) where expiration_time is - seconds since the epoch. - """ - rpc = app_identity.create_rpc() - app_identity.make_get_access_token_call(rpc, scopes, service_account_id) - token, expires_at = yield rpc - raise ndb.Return((token, expires_at)) - - -class _RestApi(object): - """Base class for REST-based API wrapper classes. - - This class manages authentication tokens and request retries. All - APIs are available as synchronous and async methods; synchronous - methods are synthesized from async ones by the add_sync_methods() - function in this module. - - WARNING: Do NOT directly use this api. It's an implementation detail - and is subject to change at any release. - """ - - _TOKEN_EXPIRATION_HEADROOM = random.randint(60, 600) - - def __init__(self, scopes, service_account_id=None, token_maker=None, - retry_params=None): - """Constructor. - - Args: - scopes: A scope or a list of scopes. - token_maker: An asynchronous function of the form - (scopes, service_account_id) -> (token, expires). - retry_params: An instance of api_utils.RetryParams. If None, the - default for current thread will be used. - service_account_id: Internal use only. - """ - - if isinstance(scopes, basestring): - scopes = [scopes] - self.scopes = scopes - self.service_account_id = service_account_id - self.make_token_async = token_maker or _make_token_async - self.token = None - if not retry_params: - retry_params = api_utils._get_default_retry_params() - self.retry_params = retry_params - - def __getstate__(self): - """Store state as part of serialization/pickling.""" - return {'token': self.token, - 'scopes': self.scopes, - 'id': self.service_account_id, - 'a_maker': None if self.make_token_async == _make_token_async - else self.make_token_async, - 'retry_params': self.retry_params} - - def __setstate__(self, state): - """Restore state as part of deserialization/unpickling.""" - self.__init__(state['scopes'], - service_account_id=state['id'], - token_maker=state['a_maker'], - retry_params=state['retry_params']) - self.token = state['token'] - - @ndb.tasklet - def do_request_async(self, url, method='GET', headers=None, payload=None, - deadline=None, callback=None): - """Issue one HTTP request. - - This is an async wrapper around urlfetch(). It adds an authentication - header and retries on a 401 status code. Upon other retriable errors, - it performs blocking retries. - """ - headers = {} if headers is None else dict(headers) - if self.token is None: - self.token = yield self.get_token_async() - headers['authorization'] = 'OAuth ' + self.token - - deadline = deadline or self.retry_params.urlfetch_timeout - - retry = False - resp = None - try: - resp = yield self.urlfetch_async(url, payload=payload, method=method, - headers=headers, follow_redirects=False, - deadline=deadline, callback=callback) - if resp.status_code == httplib.UNAUTHORIZED: - self.token = yield self.get_token_async(refresh=True) - headers['authorization'] = 'OAuth ' + self.token - resp = yield self.urlfetch_async( - url, payload=payload, method=method, headers=headers, - follow_redirects=False, deadline=deadline, callback=callback) - except api_utils._RETRIABLE_EXCEPTIONS: - retry = True - else: - retry = api_utils._should_retry(resp) - - if retry: - retry_resp = api_utils._retry_fetch( - url, retry_params=self.retry_params, payload=payload, method=method, - headers=headers, follow_redirects=False, deadline=deadline) - if retry_resp: - resp = retry_resp - elif not resp: - raise - - raise ndb.Return((resp.status_code, resp.headers, resp.content)) - - @ndb.tasklet - def get_token_async(self, refresh=False): - """Get an authentication token. - - The token is cached in memcache, keyed by the scopes argument. - - Args: - refresh: If True, ignore a cached token; default False. - - Returns: - An authentication token. - """ - if self.token is not None and not refresh: - raise ndb.Return(self.token) - key = '%s,%s' % (self.service_account_id, ','.join(self.scopes)) - ts = yield _AE_TokenStorage_.get_by_id_async( - key, use_cache=True, use_memcache=True, - use_datastore=self.retry_params.save_access_token) - if ts is None or ts.expires < (time.time() + - self._TOKEN_EXPIRATION_HEADROOM): - token, expires_at = yield self.make_token_async( - self.scopes, self.service_account_id) - timeout = int(expires_at - time.time()) - ts = _AE_TokenStorage_(id=key, token=token, expires=expires_at) - if timeout > 0: - yield ts.put_async(memcache_timeout=timeout, - use_datastore=self.retry_params.save_access_token, - use_cache=True, use_memcache=True) - self.token = ts.token - raise ndb.Return(self.token) - - def urlfetch_async(self, url, **kwds): - """Make an async urlfetch() call. - - This just passes the url and keyword arguments to NDB's async - urlfetch() wrapper in the current context. - - This returns a Future despite not being decorated with @ndb.tasklet! - """ - ctx = ndb.get_context() - return ctx.urlfetch(url, **kwds) - - -_RestApi = add_sync_methods(_RestApi)
diff --git a/third_party/google_appengine_cloudstorage/cloudstorage/storage_api.py b/third_party/google_appengine_cloudstorage/cloudstorage/storage_api.py deleted file mode 100644 index 3971741..0000000 --- a/third_party/google_appengine_cloudstorage/cloudstorage/storage_api.py +++ /dev/null
@@ -1,865 +0,0 @@ -# Copyright 2012 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -# either express or implied. See the License for the specific -# language governing permissions and limitations under the License. - -"""Python wrappers for the Google Storage RESTful API.""" - - - - - -__all__ = ['ReadBuffer', - 'StreamingBuffer', - ] - -import collections -import logging -import os -import urlparse - -from . import api_utils -from . import common -from . import errors -from . import rest_api - -try: - from google.appengine.api import urlfetch - from google.appengine.ext import ndb -except ImportError: - from google.appengine.api import urlfetch - from google.appengine.ext import ndb - - - -def _get_storage_api(retry_params, account_id=None): - """Returns storage_api instance for API methods. - - Args: - retry_params: An instance of api_utils.RetryParams. If none, - thread's default will be used. - account_id: Internal-use only. - - Returns: - A storage_api instance to handle urlfetch work to GCS. - On dev appserver, this instance by default will talk to a local stub - unless common.ACCESS_TOKEN is set. That token will be used to talk - to the real GCS. - """ - - - api = _StorageApi(_StorageApi.full_control_scope, - service_account_id=account_id, - retry_params=retry_params) - if common.local_run() and not common.get_access_token(): - api.api_url = common.local_api_url() - if common.get_access_token(): - api.token = common.get_access_token() - return api - - -class _StorageApi(rest_api._RestApi): - """A simple wrapper for the Google Storage RESTful API. - - WARNING: Do NOT directly use this api. It's an implementation detail - and is subject to change at any release. - - All async methods have similar args and returns. - - Args: - path: The path to the Google Storage object or bucket, e.g. - '/mybucket/myfile' or '/mybucket'. - **kwd: Options for urlfetch. e.g. - headers={'content-type': 'text/plain'}, payload='blah'. - - Returns: - A ndb Future. When fulfilled, future.get_result() should return - a tuple of (status, headers, content) that represents a HTTP response - of Google Cloud Storage XML API. - """ - - api_url = 'https://storage.googleapis.com' - read_only_scope = 'https://www.googleapis.com/auth/devstorage.read_only' - read_write_scope = 'https://www.googleapis.com/auth/devstorage.read_write' - full_control_scope = 'https://www.googleapis.com/auth/devstorage.full_control' - - def __getstate__(self): - """Store state as part of serialization/pickling. - - Returns: - A tuple (of dictionaries) with the state of this object - """ - return (super(_StorageApi, self).__getstate__(), {'api_url': self.api_url}) - - def __setstate__(self, state): - """Restore state as part of deserialization/unpickling. - - Args: - state: the tuple from a __getstate__ call - """ - superstate, localstate = state - super(_StorageApi, self).__setstate__(superstate) - self.api_url = localstate['api_url'] - - @api_utils._eager_tasklet - @ndb.tasklet - def do_request_async(self, url, method='GET', headers=None, payload=None, - deadline=None, callback=None): - """Inherit docs. - - This method translates urlfetch exceptions to more service specific ones. - """ - if headers is None: - headers = {} - if 'x-goog-api-version' not in headers: - headers['x-goog-api-version'] = '2' - headers['accept-encoding'] = 'gzip, *' - try: - resp_tuple = yield super(_StorageApi, self).do_request_async( - url, method=method, headers=headers, payload=payload, - deadline=deadline, callback=callback) - except urlfetch.DownloadError, e: - raise errors.TimeoutError( - 'Request to Google Cloud Storage timed out.', e) - - raise ndb.Return(resp_tuple) - - - def post_object_async(self, path, **kwds): - """POST to an object.""" - return self.do_request_async(self.api_url + path, 'POST', **kwds) - - def put_object_async(self, path, **kwds): - """PUT an object.""" - return self.do_request_async(self.api_url + path, 'PUT', **kwds) - - def get_object_async(self, path, **kwds): - """GET an object. - - Note: No payload argument is supported. - """ - return self.do_request_async(self.api_url + path, 'GET', **kwds) - - def delete_object_async(self, path, **kwds): - """DELETE an object. - - Note: No payload argument is supported. - """ - return self.do_request_async(self.api_url + path, 'DELETE', **kwds) - - def head_object_async(self, path, **kwds): - """HEAD an object. - - Depending on request headers, HEAD returns various object properties, - e.g. Content-Length, Last-Modified, and ETag. - - Note: No payload argument is supported. - """ - return self.do_request_async(self.api_url + path, 'HEAD', **kwds) - - def get_bucket_async(self, path, **kwds): - """GET a bucket.""" - return self.do_request_async(self.api_url + path, 'GET', **kwds) - - -_StorageApi = rest_api.add_sync_methods(_StorageApi) - - -class ReadBuffer(object): - """A class for reading Google storage files.""" - - DEFAULT_BUFFER_SIZE = 1024 * 1024 - MAX_REQUEST_SIZE = 30 * DEFAULT_BUFFER_SIZE - - def __init__(self, - api, - path, - buffer_size=DEFAULT_BUFFER_SIZE, - max_request_size=MAX_REQUEST_SIZE): - """Constructor. - - Args: - api: A StorageApi instance. - path: Quoted/escaped path to the object, e.g. /mybucket/myfile - buffer_size: buffer size. The ReadBuffer keeps - one buffer. But there may be a pending future that contains - a second buffer. This size must be less than max_request_size. - max_request_size: Max bytes to request in one urlfetch. - """ - self._api = api - self._path = path - self.name = api_utils._unquote_filename(path) - self.closed = False - - assert buffer_size <= max_request_size - self._buffer_size = buffer_size - self._max_request_size = max_request_size - self._offset = 0 - self._buffer = _Buffer() - self._etag = None - - self._request_next_buffer() - - status, headers, _ = self._api.head_object(path) - errors.check_status(status, [200], path, resp_headers=headers) - self._file_size = long(headers['content-length']) - self._check_etag(headers.get('etag')) - if self._file_size == 0: - self._buffer_future = None - - def __getstate__(self): - """Store state as part of serialization/pickling. - - The contents of the read buffer are not stored, only the current offset for - data read by the client. A new read buffer is established at unpickling. - The head information for the object (file size and etag) are stored to - reduce startup and ensure the file has not changed. - - Returns: - A dictionary with the state of this object - """ - return {'api': self._api, - 'path': self._path, - 'buffer_size': self._buffer_size, - 'request_size': self._max_request_size, - 'etag': self._etag, - 'size': self._file_size, - 'offset': self._offset, - 'closed': self.closed} - - def __setstate__(self, state): - """Restore state as part of deserialization/unpickling. - - Args: - state: the dictionary from a __getstate__ call - - Along with restoring the state, pre-fetch the next read buffer. - """ - self._api = state['api'] - self._path = state['path'] - self.name = api_utils._unquote_filename(self._path) - self._buffer_size = state['buffer_size'] - self._max_request_size = state['request_size'] - self._etag = state['etag'] - self._file_size = state['size'] - self._offset = state['offset'] - self._buffer = _Buffer() - self.closed = state['closed'] - self._buffer_future = None - if self._remaining() and not self.closed: - self._request_next_buffer() - - def __iter__(self): - """Iterator interface. - - Note the ReadBuffer container itself is the iterator. It's - (quote PEP0234) - 'destructive: they consumes all the values and a second iterator - cannot easily be created that iterates independently over the same values. - You could open the file for the second time, or seek() to the beginning.' - - Returns: - Self. - """ - return self - - def next(self): - line = self.readline() - if not line: - raise StopIteration() - return line - - def readline(self, size=-1): - """Read one line delimited by '\n' from the file. - - A trailing newline character is kept in the string. It may be absent when a - file ends with an incomplete line. If the size argument is non-negative, - it specifies the maximum string size (counting the newline) to return. - A negative size is the same as unspecified. Empty string is returned - only when EOF is encountered immediately. - - Args: - size: Maximum number of bytes to read. If not specified, readline stops - only on '\n' or EOF. - - Returns: - The data read as a string. - - Raises: - IOError: When this buffer is closed. - """ - self._check_open() - if size == 0 or not self._remaining(): - return '' - - data_list = [] - newline_offset = self._buffer.find_newline(size) - while newline_offset < 0: - data = self._buffer.read(size) - size -= len(data) - self._offset += len(data) - data_list.append(data) - if size == 0 or not self._remaining(): - return ''.join(data_list) - self._buffer.reset(self._buffer_future.get_result()) - self._request_next_buffer() - newline_offset = self._buffer.find_newline(size) - - data = self._buffer.read_to_offset(newline_offset + 1) - self._offset += len(data) - data_list.append(data) - - return ''.join(data_list) - - def read(self, size=-1): - """Read data from RAW file. - - Args: - size: Number of bytes to read as integer. Actual number of bytes - read is always equal to size unless EOF is reached. If size is - negative or unspecified, read the entire file. - - Returns: - data read as str. - - Raises: - IOError: When this buffer is closed. - """ - self._check_open() - if not self._remaining(): - return '' - - data_list = [] - while True: - remaining = self._buffer.remaining() - if size >= 0 and size < remaining: - data_list.append(self._buffer.read(size)) - self._offset += size - break - else: - size -= remaining - self._offset += remaining - data_list.append(self._buffer.read()) - - if self._buffer_future is None: - if size < 0 or size >= self._remaining(): - needs = self._remaining() - else: - needs = size - data_list.extend(self._get_segments(self._offset, needs)) - self._offset += needs - break - - if self._buffer_future: - self._buffer.reset(self._buffer_future.get_result()) - self._buffer_future = None - - if self._buffer_future is None: - self._request_next_buffer() - return ''.join(data_list) - - def _remaining(self): - return self._file_size - self._offset - - def _request_next_buffer(self): - """Request next buffer. - - Requires self._offset and self._buffer are in consistent state - """ - self._buffer_future = None - next_offset = self._offset + self._buffer.remaining() - if not hasattr(self, '_file_size') or next_offset != self._file_size: - self._buffer_future = self._get_segment(next_offset, - self._buffer_size) - - def _get_segments(self, start, request_size): - """Get segments of the file from Google Storage as a list. - - A large request is broken into segments to avoid hitting urlfetch - response size limit. Each segment is returned from a separate urlfetch. - - Args: - start: start offset to request. Inclusive. Have to be within the - range of the file. - request_size: number of bytes to request. - - Returns: - A list of file segments in order - """ - if not request_size: - return [] - - end = start + request_size - futures = [] - - while request_size > self._max_request_size: - futures.append(self._get_segment(start, self._max_request_size)) - request_size -= self._max_request_size - start += self._max_request_size - if start < end: - futures.append(self._get_segment(start, end-start)) - return [fut.get_result() for fut in futures] - - @ndb.tasklet - def _get_segment(self, start, request_size): - """Get a segment of the file from Google Storage. - - Args: - start: start offset of the segment. Inclusive. Have to be within the - range of the file. - request_size: number of bytes to request. Have to be small enough - for a single urlfetch request. May go over the logical range of the - file. - - Yields: - a segment [start, start + request_size) of the file. - - Raises: - ValueError: if the file has changed while reading. - """ - end = start + request_size - 1 - content_range = '%d-%d' % (start, end) - headers = {'Range': 'bytes=' + content_range} - status, resp_headers, content = yield self._api.get_object_async( - self._path, headers=headers) - errors.check_status(status, [200, 206], self._path, headers, resp_headers) - self._check_etag(resp_headers.get('etag')) - raise ndb.Return(content) - - def _check_etag(self, etag): - """Check if etag is the same across requests to GCS. - - If self._etag is None, set it. If etag is set, check that the new - etag equals the old one. - - In the __init__ method, we fire one HEAD and one GET request using - ndb tasklet. One of them would return first and set the first value. - - Args: - etag: etag from a GCS HTTP response. None if etag is not part of the - response header. It could be None for example in the case of GCS - composite file. - - Raises: - ValueError: if two etags are not equal. - """ - if etag is None: - return - elif self._etag is None: - self._etag = etag - elif self._etag != etag: - raise ValueError('File on GCS has changed while reading.') - - def close(self): - self.closed = True - self._buffer = None - self._buffer_future = None - - def __enter__(self): - return self - - def __exit__(self, atype, value, traceback): - self.close() - return False - - def seek(self, offset, whence=os.SEEK_SET): - """Set the file's current offset. - - Note if the new offset is out of bound, it is adjusted to either 0 or EOF. - - Args: - offset: seek offset as number. - whence: seek mode. Supported modes are os.SEEK_SET (absolute seek), - os.SEEK_CUR (seek relative to the current position), and os.SEEK_END - (seek relative to the end, offset should be negative). - - Raises: - IOError: When this buffer is closed. - ValueError: When whence is invalid. - """ - self._check_open() - - self._buffer.reset() - self._buffer_future = None - - if whence == os.SEEK_SET: - self._offset = offset - elif whence == os.SEEK_CUR: - self._offset += offset - elif whence == os.SEEK_END: - self._offset = self._file_size + offset - else: - raise ValueError('Whence mode %s is invalid.' % str(whence)) - - self._offset = min(self._offset, self._file_size) - self._offset = max(self._offset, 0) - if self._remaining(): - self._request_next_buffer() - - def tell(self): - """Tell the file's current offset. - - Returns: - current offset in reading this file. - - Raises: - IOError: When this buffer is closed. - """ - self._check_open() - return self._offset - - def _check_open(self): - if self.closed: - raise IOError('Buffer is closed.') - - def seekable(self): - return True - - def readable(self): - return True - - def writable(self): - return False - - -class _Buffer(object): - """In memory buffer.""" - - def __init__(self): - self.reset() - - def reset(self, content='', offset=0): - self._buffer = content - self._offset = offset - - def read(self, size=-1): - """Returns bytes from self._buffer and update related offsets. - - Args: - size: number of bytes to read starting from current offset. - Read the entire buffer if negative. - - Returns: - Requested bytes from buffer. - """ - if size < 0: - offset = len(self._buffer) - else: - offset = self._offset + size - return self.read_to_offset(offset) - - def read_to_offset(self, offset): - """Returns bytes from self._buffer and update related offsets. - - Args: - offset: read from current offset to this offset, exclusive. - - Returns: - Requested bytes from buffer. - """ - assert offset >= self._offset - result = self._buffer[self._offset: offset] - self._offset += len(result) - return result - - def remaining(self): - return len(self._buffer) - self._offset - - def find_newline(self, size=-1): - """Search for newline char in buffer starting from current offset. - - Args: - size: number of bytes to search. -1 means all. - - Returns: - offset of newline char in buffer. -1 if doesn't exist. - """ - if size < 0: - return self._buffer.find('\n', self._offset) - return self._buffer.find('\n', self._offset, self._offset + size) - - -class StreamingBuffer(object): - """A class for creating large objects using the 'resumable' API. - - The API is a subset of the Python writable stream API sufficient to - support writing zip files using the zipfile module. - - The exact sequence of calls and use of headers is documented at - https://developers.google.com/storage/docs/developer-guide#unknownresumables - """ - - _blocksize = 256 * 1024 - - _maxrequestsize = 16 * _blocksize - - def __init__(self, - api, - path, - content_type=None, - gcs_headers=None): - """Constructor. - - Args: - api: A StorageApi instance. - path: Quoted/escaped path to the object, e.g. /mybucket/myfile - content_type: Optional content-type; Default value is - delegate to Google Cloud Storage. - gcs_headers: additional gs headers as a str->str dict, e.g - {'x-goog-acl': 'private', 'x-goog-meta-foo': 'foo'}. - """ - assert self._maxrequestsize > self._blocksize - assert self._maxrequestsize % self._blocksize == 0 - - self._api = api - self._path = path - self.name = api_utils._unquote_filename(path) - self.closed = False - - self._buffer = collections.deque() - self._buffered = 0 - self._written = 0 - self._offset = 0 - - headers = {'x-goog-resumable': 'start'} - if content_type: - headers['content-type'] = content_type - if gcs_headers: - headers.update(gcs_headers) - status, resp_headers, _ = self._api.post_object(path, headers=headers) - errors.check_status(status, [201], path, headers, resp_headers) - loc = resp_headers.get('location') - if not loc: - raise IOError('No location header found in 201 response') - parsed = urlparse.urlparse(loc) - self._path_with_token = '%s?%s' % (self._path, parsed.query) - - def __getstate__(self): - """Store state as part of serialization/pickling. - - The contents of the write buffer are stored. Writes to the underlying - storage are required to be on block boundaries (_blocksize) except for the - last write. In the worst case the pickled version of this object may be - slightly larger than the blocksize. - - Returns: - A dictionary with the state of this object - - """ - return {'api': self._api, - 'path': self._path, - 'path_token': self._path_with_token, - 'buffer': self._buffer, - 'buffered': self._buffered, - 'written': self._written, - 'offset': self._offset, - 'closed': self.closed} - - def __setstate__(self, state): - """Restore state as part of deserialization/unpickling. - - Args: - state: the dictionary from a __getstate__ call - """ - self._api = state['api'] - self._path_with_token = state['path_token'] - self._buffer = state['buffer'] - self._buffered = state['buffered'] - self._written = state['written'] - self._offset = state['offset'] - self.closed = state['closed'] - self._path = state['path'] - self.name = api_utils._unquote_filename(self._path) - - def write(self, data): - """Write some bytes. - - Args: - data: data to write. str. - - Raises: - TypeError: if data is not of type str. - """ - self._check_open() - if not isinstance(data, str): - raise TypeError('Expected str but got %s.' % type(data)) - if not data: - return - self._buffer.append(data) - self._buffered += len(data) - self._offset += len(data) - if self._buffered >= self._blocksize: - self._flush() - - def flush(self): - """Dummy API. - - This API is provided because the zipfile module uses it. It is a - no-op because Google Storage *requires* that all writes except for - the final one are multiples on 256K bytes aligned on 256K-byte - boundaries. - """ - self._check_open() - - def tell(self): - """Return the total number of bytes passed to write() so far. - - (There is no seek() method.) - """ - return self._offset - - def close(self): - """Flush the buffer and finalize the file. - - When this returns the new file is available for reading. - """ - if not self.closed: - self.closed = True - self._flush(finish=True) - self._buffer = None - - def __enter__(self): - return self - - def __exit__(self, atype, value, traceback): - self.close() - return False - - def _flush(self, finish=False): - """Internal API to flush. - - This is called only when the total amount of buffered data is at - least self._blocksize, or to flush the final (incomplete) block of - the file with finish=True. - """ - flush_len = 0 if finish else self._blocksize - - while self._buffered >= flush_len: - buffer = [] - buffered = 0 - - while self._buffer: - buf = self._buffer.popleft() - size = len(buf) - self._buffered -= size - buffer.append(buf) - buffered += size - if buffered >= self._maxrequestsize: - break - - if buffered > self._maxrequestsize: - excess = buffered - self._maxrequestsize - elif finish: - excess = 0 - else: - excess = buffered % self._blocksize - - if excess: - over = buffer.pop() - size = len(over) - assert size >= excess - buffered -= size - head, tail = over[:-excess], over[-excess:] - self._buffer.appendleft(tail) - self._buffered += len(tail) - if head: - buffer.append(head) - buffered += len(head) - - data = ''.join(buffer) - file_len = '*' - if finish and not self._buffered: - file_len = self._written + len(data) - self._send_data(data, self._written, file_len) - self._written += len(data) - if file_len != '*': - break - - def _send_data(self, data, start_offset, file_len): - """Send the block to the storage service. - - This is a utility method that does not modify self. - - Args: - data: data to send in str. - start_offset: start offset of the data in relation to the file. - file_len: an int if this is the last data to append to the file. - Otherwise '*'. - """ - headers = {} - end_offset = start_offset + len(data) - 1 - - if data: - headers['content-range'] = ('bytes %d-%d/%s' % - (start_offset, end_offset, file_len)) - else: - headers['content-range'] = ('bytes */%s' % file_len) - - status, response_headers, _ = self._api.put_object( - self._path_with_token, payload=data, headers=headers) - if file_len == '*': - expected = 308 - else: - expected = 200 - errors.check_status(status, [expected], self._path, headers, - response_headers, - {'upload_path': self._path_with_token}) - - def _get_offset_from_gcs(self): - """Get the last offset that has been written to GCS. - - This is a utility method that does not modify self. - - Returns: - an int of the last offset written to GCS by this upload, inclusive. - -1 means nothing has been written. - """ - headers = {'content-range': 'bytes */*'} - status, response_headers, _ = self._api.put_object( - self._path_with_token, headers=headers) - errors.check_status(status, [308], self._path, headers, - response_headers, - {'upload_path': self._path_with_token}) - val = response_headers.get('range') - if val is None: - return -1 - _, offset = val.rsplit('-', 1) - return int(offset) - - def _force_close(self, file_length=None): - """Close this buffer on file_length. - - Finalize this upload immediately on file_length. - Contents that are still in memory will not be uploaded. - - This is a utility method that does not modify self. - - Args: - file_length: file length. Must match what has been uploaded. If None, - it will be queried from GCS. - """ - if file_length is None: - file_length = self._get_offset_from_gcs() + 1 - self._send_data('', 0, file_length) - - def _check_open(self): - if self.closed: - raise IOError('Buffer is closed.') - - def seekable(self): - return False - - def readable(self): - return False - - def writable(self): - return True
diff --git a/third_party/google_appengine_cloudstorage/cloudstorage/test_utils.py b/third_party/google_appengine_cloudstorage/cloudstorage/test_utils.py deleted file mode 100644 index e4d8247..0000000 --- a/third_party/google_appengine_cloudstorage/cloudstorage/test_utils.py +++ /dev/null
@@ -1,25 +0,0 @@ -# Copyright 2013 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -# either express or implied. See the License for the specific -# language governing permissions and limitations under the License. - -"""Utils for testing.""" - - -class MockUrlFetchResult(object): - - def __init__(self, status, headers, body): - self.status_code = status - self.headers = headers - self.content = body - self.content_was_truncated = False - self.final_url = None
diff --git a/third_party/netty-tcnative/OWNERS b/third_party/netty-tcnative/OWNERS index fb59c70..78c2d808 100644 --- a/third_party/netty-tcnative/OWNERS +++ b/third_party/netty-tcnative/OWNERS
@@ -1 +1 @@ -file://net/OWNERS +file://components/cronet/OWNERS
diff --git a/third_party/netty4/OWNERS b/third_party/netty4/OWNERS index fb59c70..78c2d808 100644 --- a/third_party/netty4/OWNERS +++ b/third_party/netty4/OWNERS
@@ -1 +1 @@ -file://net/OWNERS +file://components/cronet/OWNERS
diff --git a/third_party/snappy/linux/config.h b/third_party/snappy/linux/config.h index 0f997aa2..c416aa1 100644 --- a/third_party/snappy/linux/config.h +++ b/third_party/snappy/linux/config.h
@@ -16,15 +16,15 @@ /* Define to 1 if you have a definition for sysconf() in <unistd.h>. */ #define HAVE_FUNC_SYSCONF 1 -/* Define to 1 to use the gflags package for command-line parsing. */ -/* #undef HAVE_GFLAGS */ - /* Define to 1 if you have the `lzo2' library (-llzo2). */ /* #undef HAVE_LIBLZO2 */ /* Define to 1 if you have the `z' library (-lz). */ #define HAVE_LIBZ 1 +/* Define to 1 if you have the `lz4' library (-llz4). */ +/* #undef HAVE_LIBLZ4 */ + /* Define to 1 if you have the <sys/mman.h> header file. */ #define HAVE_SYS_MMAN_H 1 @@ -49,6 +49,9 @@ /* Define to 1 if you target processors with BMI2+ and have <bmi2intrin.h>. */ #define SNAPPY_HAVE_BMI2 0 +/* Define to 1 if you target processors with NEON and have <arm_neon.h>. */ +#define SNAPPY_HAVE_NEON 0 + /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ /* #undef SNAPPY_IS_BIG_ENDIAN */
diff --git a/third_party/snappy/mac/config.h b/third_party/snappy/mac/config.h index 0f997aa2..c416aa1 100644 --- a/third_party/snappy/mac/config.h +++ b/third_party/snappy/mac/config.h
@@ -16,15 +16,15 @@ /* Define to 1 if you have a definition for sysconf() in <unistd.h>. */ #define HAVE_FUNC_SYSCONF 1 -/* Define to 1 to use the gflags package for command-line parsing. */ -/* #undef HAVE_GFLAGS */ - /* Define to 1 if you have the `lzo2' library (-llzo2). */ /* #undef HAVE_LIBLZO2 */ /* Define to 1 if you have the `z' library (-lz). */ #define HAVE_LIBZ 1 +/* Define to 1 if you have the `lz4' library (-llz4). */ +/* #undef HAVE_LIBLZ4 */ + /* Define to 1 if you have the <sys/mman.h> header file. */ #define HAVE_SYS_MMAN_H 1 @@ -49,6 +49,9 @@ /* Define to 1 if you target processors with BMI2+ and have <bmi2intrin.h>. */ #define SNAPPY_HAVE_BMI2 0 +/* Define to 1 if you target processors with NEON and have <arm_neon.h>. */ +#define SNAPPY_HAVE_NEON 0 + /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ /* #undef SNAPPY_IS_BIG_ENDIAN */
diff --git a/third_party/snappy/win32/config.h b/third_party/snappy/win32/config.h index 63d14a0..511231c 100644 --- a/third_party/snappy/win32/config.h +++ b/third_party/snappy/win32/config.h
@@ -16,9 +16,6 @@ /* Define to 1 if you have a definition for sysconf() in <unistd.h>. */ /* #undef HAVE_FUNC_SYSCONF */ -/* Define to 1 to use the gflags package for command-line parsing. */ -/* #undef HAVE_GFLAGS */ - /* Define to 1 if you have the `lzo2' library (-llzo2). */ /* #undef HAVE_LIBLZO2 */ @@ -28,6 +25,9 @@ /* Define to 1 if you have the <sys/mman.h> header file. */ /* #undef HAVE_SYS_MMAN_H */ +/* Define to 1 if you have the `lz4' library (-llz4). */ +/* #undef HAVE_LIBLZ4 */ + /* Define to 1 if you have the <sys/resource.h> header file. */ /* #undef HAVE_SYS_RESOURCE_H */ @@ -49,6 +49,9 @@ /* Define to 1 if you target processors with BMI2+ and have <bmi2intrin.h>. */ #define SNAPPY_HAVE_BMI2 0 +/* Define to 1 if you target processors with NEON and have <arm_neon.h>. */ +#define SNAPPY_HAVE_NEON 0 + /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ /* #undef SNAPPY_IS_BIG_ENDIAN */
diff --git a/third_party/tflite/README.chromium b/third_party/tflite/README.chromium index 22e270e..ec9e72a 100644 --- a/third_party/tflite/README.chromium +++ b/third_party/tflite/README.chromium
@@ -1,7 +1,7 @@ Name: TensorFlow Lite Short Name: tflite URL: https://github.com/tensorflow/tensorflow -Version: 86611dc427e52921638e9715877678ae46d292e3 +Version: 84af5b08335d9099de320bd0409e250289865507 Date: 2021/11/22 License: Apache 2.0 License File: LICENSE
diff --git a/tools/mac/power/BUILD.gn b/tools/mac/power/BUILD.gn index 2d91f279..6c1a0b6c 100644 --- a/tools/mac/power/BUILD.gn +++ b/tools/mac/power/BUILD.gn
@@ -47,6 +47,8 @@ "power_sampler/sampling_controller.h", "power_sampler/sampling_event_source.cc", "power_sampler/sampling_event_source.h", + "power_sampler/smc_sampler.h", + "power_sampler/smc_sampler.mm", "power_sampler/timer_sampling_event_source.cc", "power_sampler/timer_sampling_event_source.h", "power_sampler/user_idle_level_sampler.cc", @@ -84,6 +86,7 @@ "power_sampler/main_display_sampler_unittest.cc", "power_sampler/resource_coalition_sampler_unittest.cc", "power_sampler/sampling_controller_unittest.cc", + "power_sampler/smc_sampler_unittest.mm", "power_sampler/timer_sampling_event_source_unittest.cc", "power_sampler/user_idle_level_sampler_unittest.cc", ]
diff --git a/tools/mac/power/benchmark.py b/tools/mac/power/benchmark.py index 78dbe85..da4ee60 100755 --- a/tools/mac/power/benchmark.py +++ b/tools/mac/power/benchmark.py
@@ -10,7 +10,7 @@ import os import datetime -from driver import Driver +from driver import DriverContext import scenarios import browsers @@ -85,24 +85,24 @@ datetime.datetime.now().strftime("%Y%m%d-%H%M%S")) logging.info(f'Outputing results in {os.path.abspath(output_dir)}') - driver = Driver(output_dir) - driver.CheckEnv(not args.no_checks) + with DriverContext(output_dir) as driver: + driver.CheckEnv(not args.no_checks) - # Measure or Profile all defined scenarios. - browser_factory = lambda broeswer_name: browsers.MakeBrowserDriver( - broeswer_name, - chrome_user_dir=args.chrome_user_dir, - chromium_path=args.chromium_path) - for scenario in IterScenarios(args.scenarios, - browser_factory, - meet_meeting_id=args.meet_meeting_id): + # Measure or Profile all defined scenarios. + browser_factory = lambda browser_name: browsers.MakeBrowserDriver( + browser_name, + chrome_user_dir=args.chrome_user_dir, + chromium_path=args.chromium_path) + for scenario in IterScenarios(args.scenarios, + browser_factory, + meet_meeting_id=args.meet_meeting_id): - if args.profile_mode: - logging.info(f'Profiling scenario {scenario.name} ...') - driver.Profile(scenario, profile_mode=args.profile_mode) - else: - logging.info(f'Recording scenario {scenario.name} ...') - driver.Record(scenario) + if args.profile_mode: + logging.info(f'Profiling scenario {scenario.name} ...') + driver.Profile(scenario, profile_mode=args.profile_mode) + else: + logging.info(f'Recording scenario {scenario.name} ...') + driver.Record(scenario) if __name__ == "__main__":
diff --git a/tools/mac/power/check_env.sh b/tools/mac/power/check_env.sh index ba9e845..74e4e82 100755 --- a/tools/mac/power/check_env.sh +++ b/tools/mac/power/check_env.sh
@@ -67,14 +67,6 @@ CheckDisplayValue "Automatically adjust brightness" "No"\ "Disable automatic brightness adjustments and unplug external monitors" - # Use Amphetamine.app to avoid sleeping during the tests. - if ! pgrep -x "Amphetamine" > /dev/null; then - echo "Use Amphetamine to prevent sleep." - exit 127 - fi - CompareValue $(defaults read com.if.Amphetamine "Default Duration") "0"\ - "Default session length in Amphetamine should be unlimited"; - # Verify that no terminals are running. # They introduce too much overhead. (As measured with powermetrics) CheckProgramNotRunning "Terminal" "Do not have a terminal opened. Use SSH.";
diff --git a/tools/mac/power/driver.py b/tools/mac/power/driver.py index 2355ca0..fd6ec39 100644 --- a/tools/mac/power/driver.py +++ b/tools/mac/power/driver.py
@@ -14,7 +14,8 @@ import scenarios import utils -class Driver: + +class DriverContext: """Class in charge of running the measurements and keeping track of the global state needed to do so. """ @@ -30,6 +31,19 @@ # Make sure there is somewhere to put results. os.makedirs(f"{self._output_dir}", exist_ok=True) + def __enter__(self): + self._caffeinate_process = subprocess.Popen([ + "caffeinate", + "-d", # Prevent the display from sleeping. + "-i", # Prevent the system from idle sleeping. This doesn't really take + # effect since the display is forced on. + "-u" # Force user_idle_level to active. + ]) + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + utils.TerminateProcess(self._caffeinate_process) + def CheckEnv(self, throw_on_bad_env: bool): """Verifies that the environment is conducive to proper profiling or measurements. @@ -198,6 +212,7 @@ """Outputs a json file describing `scenario_driver` arguments into the output directory """ + print(self._output_dir, f'{scenario_driver.name}_summary.json') with open( os.path.join(self._output_dir, f'{scenario_driver.name}_summary.json'), 'w') as summary_file:
diff --git a/tools/mac/power/power_sampler/power_sampler_main.cc b/tools/mac/power/power_sampler/power_sampler_main.cc index 520e4d64..782cd3a4 100644 --- a/tools/mac/power/power_sampler/power_sampler_main.cc +++ b/tools/mac/power/power_sampler/power_sampler_main.cc
@@ -23,6 +23,7 @@ #include "tools/mac/power/power_sampler/sample_counter.h" #include "tools/mac/power/power_sampler/sampler.h" #include "tools/mac/power/power_sampler/sampling_controller.h" +#include "tools/mac/power/power_sampler/smc_sampler.h" #include "tools/mac/power/power_sampler/timer_sampling_event_source.h" #include "tools/mac/power/power_sampler/user_idle_level_sampler.h" @@ -154,6 +155,10 @@ if (sampler) controller.AddSampler(std::move(sampler)); + sampler = power_sampler::SMCSampler::Create(); + if (sampler) + controller.AddSampler(std::move(sampler)); + sampler = power_sampler::UserIdleLevelSampler::Create(); if (sampler) controller.AddSampler(std::move(sampler));
diff --git a/tools/mac/power/power_sampler/smc_sampler.h b/tools/mac/power/power_sampler/smc_sampler.h new file mode 100644 index 0000000..e282069 --- /dev/null +++ b/tools/mac/power/power_sampler/smc_sampler.h
@@ -0,0 +1,43 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef TOOLS_MAC_POWER_POWER_SAMPLER_SMC_SAMPLER_H_ +#define TOOLS_MAC_POWER_POWER_SAMPLER_SMC_SAMPLER_H_ + +#include <memory> + +#include "tools/mac/power/power_sampler/sampler.h" + +namespace power_metrics { +class SMCReader; +} + +namespace power_sampler { + +// The SMC sampler samples power usage from various hardware components from the +// System Management Controller (SMC). +class SMCSampler : public Sampler { + public: + ~SMCSampler() override; + + // Creates and initializes a new sampler, if possible. + // Returns nullptr on failure. + static std::unique_ptr<SMCSampler> Create(); + + // Sampler implementation. + std::string GetName() override; + DatumNameUnits GetDatumNameUnits() override; + Sample GetSample(base::TimeTicks sample_time) override; + + private: + friend class SMCSamplerTest; + + SMCSampler(std::unique_ptr<power_metrics::SMCReader> smc_reader); + + std::unique_ptr<power_metrics::SMCReader> smc_reader_; +}; + +} // namespace power_sampler + +#endif // TOOLS_MAC_POWER_POWER_SAMPLER_BATTERY_SAMPLER_H_
diff --git a/tools/mac/power/power_sampler/smc_sampler.mm b/tools/mac/power/power_sampler/smc_sampler.mm new file mode 100644 index 0000000..2680388 --- /dev/null +++ b/tools/mac/power/power_sampler/smc_sampler.mm
@@ -0,0 +1,67 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "tools/mac/power/power_sampler/smc_sampler.h" + +#include "base/memory/ptr_util.h" +#include "base/strings/string_piece.h" +#include "components/power_metrics/smc_mac.h" + +namespace power_sampler { + +namespace { + +void MaybeAddToSample(Sampler::Sample* sample, + base::StringPiece name, + absl::optional<double> val) { + if (val.has_value()) + sample->emplace(name, val.value()); +} + +} // namespace + +SMCSampler::~SMCSampler() = default; + +// static +std::unique_ptr<SMCSampler> SMCSampler::Create() { + std::unique_ptr<power_metrics::SMCReader> smc_reader = + power_metrics::SMCReader::Create(); + if (!smc_reader) + return nullptr; + return base::WrapUnique(new SMCSampler(std::move(smc_reader))); +} + +std::string SMCSampler::GetName() { + return "smc"; +} + +Sampler::DatumNameUnits SMCSampler::GetDatumNameUnits() { + DatumNameUnits ret{{"total_power", "w"}, + {"cpu_package_cpu_power", "w"}, + {"cpu_package_gpu_power", "w"}, + {"gpu0_power", "w"}, + {"gpu1_power", "w"}}; + return ret; +} + +Sampler::Sample SMCSampler::GetSample(base::TimeTicks sample_time) { + Sample sample; + + MaybeAddToSample(&sample, "total_power", smc_reader_->ReadTotalPowerW()); + MaybeAddToSample(&sample, "cpu_package_cpu_power", + smc_reader_->ReadCPUPackageCPUPowerW()); + MaybeAddToSample(&sample, "cpu_package_gpu_power", + smc_reader_->ReadCPUPackageGPUPowerW()); + MaybeAddToSample(&sample, "gpu0_power", smc_reader_->ReadGPU0PowerW()); + MaybeAddToSample(&sample, "gpu1_power", smc_reader_->ReadGPU1PowerW()); + + return sample; +} + +SMCSampler::SMCSampler(std::unique_ptr<power_metrics::SMCReader> smc_reader) + : smc_reader_(std::move(smc_reader)) { + DCHECK(smc_reader_); +} + +} // namespace power_sampler
diff --git a/tools/mac/power/power_sampler/smc_sampler_unittest.mm b/tools/mac/power/power_sampler/smc_sampler_unittest.mm new file mode 100644 index 0000000..9df0481 --- /dev/null +++ b/tools/mac/power/power_sampler/smc_sampler_unittest.mm
@@ -0,0 +1,166 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "tools/mac/power/power_sampler/smc_sampler.h" +#include <memory> + +#include "base/memory/ptr_util.h" +#include "components/power_metrics/smc_mac.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/abseil-cpp/absl/types/optional.h" +#include "tools/mac/power/power_sampler/battery_sampler.h" + +namespace power_sampler { + +namespace { + +using testing::UnorderedElementsAre; + +class TestSMCReader : public power_metrics::SMCReader { + public: + TestSMCReader() + : power_metrics::SMCReader(base::mac::ScopedIOObject<io_object_t>()) {} + + void set_total_power(absl::optional<double> total_power) { + total_power_ = total_power; + } + void set_cpu_package_cpu_power(absl::optional<double> cpu_package_cpu_power) { + cpu_package_cpu_power_ = cpu_package_cpu_power; + } + void set_cpu_package_gpu_power(absl::optional<double> cpu_package_gpu_power) { + cpu_package_gpu_power_ = cpu_package_gpu_power; + } + void set_gpu0_power(absl::optional<double> gpu0_power) { + gpu0_power_ = gpu0_power; + } + void set_gpu1_power(absl::optional<double> gpu1_power) { + gpu1_power_ = gpu1_power; + } + + // power_metrics::SMCReader: + absl::optional<double> ReadTotalPowerW() override { return total_power_; } + absl::optional<double> ReadCPUPackageCPUPowerW() override { + return cpu_package_cpu_power_; + } + absl::optional<double> ReadCPUPackageGPUPowerW() override { + return cpu_package_gpu_power_; + } + absl::optional<double> ReadGPU0PowerW() override { return gpu0_power_; } + absl::optional<double> ReadGPU1PowerW() override { return gpu1_power_; } + + private: + absl::optional<double> total_power_; + absl::optional<double> cpu_package_cpu_power_; + absl::optional<double> cpu_package_gpu_power_; + absl::optional<double> gpu0_power_; + absl::optional<double> gpu1_power_; +}; + +} // namespace + +class SMCSamplerTest : public testing::Test { + public: + SMCSamplerTest() { + std::unique_ptr<TestSMCReader> reader = std::make_unique<TestSMCReader>(); + reader_ = reader.get(); + sampler_ = base::WrapUnique(new SMCSampler(std::move(reader))); + } + + TestSMCReader* reader_ = nullptr; + std::unique_ptr<SMCSampler> sampler_; +}; + +TEST_F(SMCSamplerTest, NameAndGetDatumNameUnits) { + EXPECT_EQ("smc", sampler_->GetName()); + + auto datum_name_units = sampler_->GetDatumNameUnits(); + EXPECT_THAT(datum_name_units, + UnorderedElementsAre(std::make_pair("total_power", "w"), + std::make_pair("cpu_package_cpu_power", "w"), + std::make_pair("cpu_package_gpu_power", "w"), + std::make_pair("gpu0_power", "w"), + std::make_pair("gpu1_power", "w"))); +} + +TEST_F(SMCSamplerTest, GetSample_AllFieldsAvailable) { + reader_->set_total_power(1); + reader_->set_cpu_package_cpu_power(2); + reader_->set_cpu_package_gpu_power(3); + reader_->set_gpu0_power(4); + reader_->set_gpu1_power(5); + + Sampler::Sample sample = sampler_->GetSample(base::TimeTicks()); + EXPECT_THAT(sample, + UnorderedElementsAre(std::make_pair("total_power", 1), + std::make_pair("cpu_package_cpu_power", 2), + std::make_pair("cpu_package_gpu_power", 3), + std::make_pair("gpu0_power", 4), + std::make_pair("gpu1_power", 5))); +} + +TEST_F(SMCSamplerTest, GetSample_IndividualFieldNotAvailable) { + reader_->set_total_power(1); + reader_->set_cpu_package_cpu_power(2); + reader_->set_cpu_package_gpu_power(3); + reader_->set_gpu0_power(4); + reader_->set_gpu1_power(5); + + { + reader_->set_total_power(absl::nullopt); + Sampler::Sample sample = sampler_->GetSample(base::TimeTicks()); + EXPECT_THAT(sample, + UnorderedElementsAre(std::make_pair("cpu_package_cpu_power", 2), + std::make_pair("cpu_package_gpu_power", 3), + std::make_pair("gpu0_power", 4), + std::make_pair("gpu1_power", 5))); + reader_->set_total_power(1); + } + + { + reader_->set_cpu_package_cpu_power(absl::nullopt); + Sampler::Sample sample = sampler_->GetSample(base::TimeTicks()); + EXPECT_THAT(sample, + UnorderedElementsAre(std::make_pair("total_power", 1), + std::make_pair("cpu_package_gpu_power", 3), + std::make_pair("gpu0_power", 4), + std::make_pair("gpu1_power", 5))); + reader_->set_cpu_package_cpu_power(2); + } + + { + reader_->set_cpu_package_gpu_power(absl::nullopt); + Sampler::Sample sample = sampler_->GetSample(base::TimeTicks()); + EXPECT_THAT(sample, + UnorderedElementsAre(std::make_pair("total_power", 1), + std::make_pair("cpu_package_cpu_power", 2), + std::make_pair("gpu0_power", 4), + std::make_pair("gpu1_power", 5))); + reader_->set_cpu_package_gpu_power(3); + } + + { + reader_->set_gpu0_power(absl::nullopt); + Sampler::Sample sample = sampler_->GetSample(base::TimeTicks()); + EXPECT_THAT(sample, + UnorderedElementsAre(std::make_pair("total_power", 1), + std::make_pair("cpu_package_cpu_power", 2), + std::make_pair("cpu_package_gpu_power", 3), + std::make_pair("gpu1_power", 5))); + reader_->set_gpu0_power(4); + } + + { + reader_->set_gpu1_power(absl::nullopt); + Sampler::Sample sample = sampler_->GetSample(base::TimeTicks()); + EXPECT_THAT(sample, + UnorderedElementsAre(std::make_pair("total_power", 1), + std::make_pair("cpu_package_cpu_power", 2), + std::make_pair("cpu_package_gpu_power", 3), + std::make_pair("gpu0_power", 4))); + reader_->set_gpu1_power(5); + } +} + +} // namespace power_sampler
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 46c4ba7..c8da1f85 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -217,8 +217,8 @@ }, 'chromium.dawn': { - 'Dawn Linux x64 Builder': 'dawn_tests_with_desktop_gl_release_trybot', - 'Dawn Linux x64 DEPS Builder': 'dawn_tests_with_desktop_gl_release_trybot', + 'Dawn Linux x64 Builder': 'dawn_tests_with_desktop_gl_release_trybot_reclient', + 'Dawn Linux x64 DEPS Builder': 'dawn_tests_with_desktop_gl_release_trybot_reclient', 'Dawn Mac x64 Builder': 'dawn_tests_release_bot_dcheck_always_on', 'Dawn Mac x64 DEPS Builder': 'dawn_tests_release_bot_dcheck_always_on', @@ -2137,6 +2137,10 @@ 'dawn_tests', 'dawn_enable_desktop_gl', 'release_trybot_minimal_symbols', ], + 'dawn_tests_with_desktop_gl_release_trybot_reclient': [ + 'dawn_tests', 'dawn_enable_desktop_gl', 'release_trybot_minimal_symbols_reclient', + ], + 'debug_bot': [ 'debug_bot', ],
diff --git a/tools/mb/mb_config_expectations/chromium.dawn.json b/tools/mb/mb_config_expectations/chromium.dawn.json index 62fc4399..6bee502 100644 --- a/tools/mb/mb_config_expectations/chromium.dawn.json +++ b/tools/mb/mb_config_expectations/chromium.dawn.json
@@ -9,7 +9,8 @@ "is_debug": false, "symbol_level": 1, "use_dawn": true, - "use_goma": true + "use_rbe": true, + "use_remoteexec": true } }, "Dawn Linux x64 DEPS Builder": { @@ -22,7 +23,8 @@ "is_debug": false, "symbol_level": 1, "use_dawn": true, - "use_goma": true + "use_rbe": true, + "use_remoteexec": true } }, "Dawn Mac x64 Builder": {
diff --git a/tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS b/tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS index a7e3b7b..3c81e49 100644 --- a/tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS +++ b/tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS
@@ -1,5 +1,6 @@ ajuma@chromium.org alcooper@chromium.org +alemate@chromium.org alexilin@chromium.org altimin@chromium.org andypaicu@chromium.org
diff --git a/tools/metrics/histograms/metadata/assistant/histograms.xml b/tools/metrics/histograms/metadata/assistant/histograms.xml index 62a2be19..85b01e06 100644 --- a/tools/metrics/histograms/metadata/assistant/histograms.xml +++ b/tools/metrics/histograms/metadata/assistant/histograms.xml
@@ -347,8 +347,10 @@ </token> </histogram> -<histogram name="QuickAnswers.Consent" units="impressions" - expires_after="2022-05-01"> +<histogram name="QuickAnswers.Consent" units="impressions" expires_after="M98"> + <obsolete> + Removed 10-2021 + </obsolete> <owner>updowndota@chromium.org</owner> <owner>llin@google.com</owner> <owner>croissant-eng@chromium.org</owner> @@ -360,7 +362,10 @@ <histogram name="QuickAnswers.Consent.Duration{QuickAnswersConsentInteractionType}" - units="ms" expires_after="2021-08-09"> + units="ms" expires_after="M98"> + <obsolete> + Removed 10-2021 + </obsolete> <owner>updowndota@chromium.org</owner> <owner>llin@google.com</owner> <owner>croissant-eng@chromium.org</owner> @@ -381,7 +386,10 @@ <histogram name="QuickAnswers.Consent.Impression{QuickAnswersConsentInteractionType}" - units="impressions" expires_after="2022-01-02"> + units="impressions" expires_after="M98"> + <obsolete> + Removed 10-2021 + </obsolete> <owner>updowndota@chromium.org</owner> <owner>llin@google.com</owner> <owner>croissant-eng@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/chromeos/histograms.xml b/tools/metrics/histograms/metadata/chromeos/histograms.xml index 53f60443..40dad28 100644 --- a/tools/metrics/histograms/metadata/chromeos/histograms.xml +++ b/tools/metrics/histograms/metadata/chromeos/histograms.xml
@@ -1152,9 +1152,11 @@ </histogram> <histogram name="ChromeOS.MessageCenter.ScrollActionReason" - enum="ChromeOSMessageCenterScrollActionReason" expires_after="2018-11-30"> + enum="ChromeOSMessageCenterScrollActionReason" expires_after="2022-11-22"> <owner>yoshiki@chromium.org</owner> <owner>omrilio@chromium.org</owner> + <owner>leandre@chromium.org</owner> + <owner>cros-status-area-eng@google.com</owner> <summary> The cause of the scroll event by the user on the message center. Only the first event after the message center opens is recorded. For example, the
diff --git a/tools/metrics/histograms/metadata/enterprise/histograms.xml b/tools/metrics/histograms/metadata/enterprise/histograms.xml index 06026b4..665f320 100644 --- a/tools/metrics/histograms/metadata/enterprise/histograms.xml +++ b/tools/metrics/histograms/metadata/enterprise/histograms.xml
@@ -388,7 +388,7 @@ </histogram> <histogram name="Enterprise.CBCMPolicyInvalidations" - enum="EnterprisePolicyInvalidations" expires_after="2022-01-01"> + enum="EnterprisePolicyInvalidations" expires_after="2023-01-15"> <owner>anthonyvd@chromium.org</owner> <owner>cbe-eng@google.com</owner> <summary> @@ -400,7 +400,7 @@ </histogram> <histogram name="Enterprise.CBCMPolicyRefresh" enum="EnterprisePolicyRefresh" - expires_after="2022-04-24"> + expires_after="2023-01-15"> <owner>anthonyvd@chromium.org</owner> <owner>cbe-eng@google.com</owner> <summary> @@ -441,7 +441,7 @@ </histogram> <histogram name="Enterprise.CBCMRemoteCommand.Executed" - enum="RemoteCommandExecutionStatus" expires_after="2022-01-01"> + enum="RemoteCommandExecutionStatus" expires_after="2023-01-15"> <owner>anthonyvd@chromium.org</owner> <owner>cbe-eng@google.com</owner> <summary> @@ -452,7 +452,7 @@ </histogram> <histogram name="Enterprise.CBCMRemoteCommand.Executed.Unsigned" - enum="RemoteCommandExecutionStatus" expires_after="2022-01-01"> + enum="RemoteCommandExecutionStatus" expires_after="2023-01-15"> <obsolete> Removed in M97 since unsigned commands are no longer supported. </obsolete> @@ -466,7 +466,7 @@ </histogram> <histogram name="Enterprise.CBCMRemoteCommand.Received" - enum="RemoteCommandReceivedStatus" expires_after="2022-01-01"> + enum="RemoteCommandReceivedStatus" expires_after="2023-01-15"> <owner>anthonyvd@chromium.org</owner> <owner>cbe-eng@google.com</owner> <summary> @@ -478,7 +478,7 @@ </histogram> <histogram name="Enterprise.CBCMRemoteCommand.Received.Unsigned" - enum="RemoteCommandReceivedStatus" expires_after="2022-01-01"> + enum="RemoteCommandReceivedStatus" expires_after="2023-01-15"> <owner>anthonyvd@chromium.org</owner> <owner>cbe-eng@google.com</owner> <summary> @@ -490,7 +490,7 @@ </histogram> <histogram name="Enterprise.CBCMRemoteCommandInvalidations" - enum="EnterprisePolicyInvalidations" expires_after="2022-01-01"> + enum="EnterprisePolicyInvalidations" expires_after="2023-01-15"> <owner>anthonyvd@chromium.org</owner> <owner>cbe-eng@google.com</owner> <summary> @@ -1408,7 +1408,7 @@ </histogram> <histogram name="Enterprise.FCMInvalidationService.CBCMPolicyInvalidations" - enum="EnterprisePolicyInvalidations" expires_after="2022-05-01"> + enum="EnterprisePolicyInvalidations" expires_after="2023-01-15"> <owner>anthonyvd@chromium.org</owner> <owner>chrome-enterprise-team-core@google.com</owner> <summary> @@ -1422,7 +1422,7 @@ </histogram> <histogram name="Enterprise.FCMInvalidationService.CBCMPolicyRefresh" - enum="EnterprisePolicyRefresh" expires_after="2022-01-01"> + enum="EnterprisePolicyRefresh" expires_after="2023-01-15"> <owner>anthonyvd@chromium.org</owner> <owner>chrome-enterprise-team-core@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/login/OWNERS b/tools/metrics/histograms/metadata/login/OWNERS index 7862db69..88594879 100644 --- a/tools/metrics/histograms/metadata/login/OWNERS +++ b/tools/metrics/histograms/metadata/login/OWNERS
@@ -4,3 +4,4 @@ # Use chromium-metrics-reviews@google.com as a backup. jorgelo@chromium.org rsorokin@chromium.org +alemate@chromium.org
diff --git a/tools/metrics/histograms/metadata/notifications/histograms.xml b/tools/metrics/histograms/metadata/notifications/histograms.xml index 212e7501..4688601 100644 --- a/tools/metrics/histograms/metadata/notifications/histograms.xml +++ b/tools/metrics/histograms/metadata/notifications/histograms.xml
@@ -38,8 +38,10 @@ </variants> <histogram name="Notifications.Actions" enum="NotificationActionType" - expires_after="M85"> + expires_after="2022-11-22"> <owner>dewittj@chromium.org</owner> + <owner>leandre@chromium.org</owner> + <owner>cros-status-area-eng@google.com</owner> <summary> The actions taken on notifications, recorded every time they happen. This histogram will record every single event that happens separately. @@ -610,8 +612,10 @@ </histogram> <histogram name="Notifications.PerNotificationActions" - enum="NotificationActionType" expires_after="M85"> + enum="NotificationActionType" expires_after="2022-11-22"> <owner>dewittj@chromium.org</owner> + <owner>leandre@chromium.org</owner> + <owner>cros-status-area-eng@google.com</owner> <summary> The actions taken on notifications, recorded once per notification, when it is closed. This differs from the Notifications.Actions histogram in that
diff --git a/tools/metrics/histograms/metadata/oobe/OWNERS b/tools/metrics/histograms/metadata/oobe/OWNERS index 9b37102..f0e7010 100644 --- a/tools/metrics/histograms/metadata/oobe/OWNERS +++ b/tools/metrics/histograms/metadata/oobe/OWNERS
@@ -3,3 +3,4 @@ # Prefer sending CLs to the owners listed below. # Use chromium-metrics-reviews@google.com as a backup. rsorokin@chromium.org +alemate@chromium.org
diff --git a/tools/metrics/histograms/metadata/others/OWNERS b/tools/metrics/histograms/metadata/others/OWNERS index 8dda3a3..e085954a 100644 --- a/tools/metrics/histograms/metadata/others/OWNERS +++ b/tools/metrics/histograms/metadata/others/OWNERS
@@ -18,3 +18,5 @@ dullweber@chromium.org # For PerformanceMonitor.* histograms: olivierli@chromium.org +# For BootTime.*, Uptime.*, UserManager.*, TimeZone.* histograms: +alemate@chromium.org
diff --git a/tools/perf/core/bot_platforms.py b/tools/perf/core/bot_platforms.py index 977219b..dfc5b96c 100644 --- a/tools/perf/core/bot_platforms.py +++ b/tools/perf/core/bot_platforms.py
@@ -489,6 +489,7 @@ ]) _FUCHSIA_PERF_FYI_BENCHMARK_CONFIGS = PerfSuite([ _GetBenchmarkConfig('system_health.memory_desktop'), + _GetBenchmarkConfig('rendering.mobile'), _GetBenchmarkConfig('media.mobile') ]) _FUCHSIA_SHERLOCK_PERF_FYI_BENCHMARK_CONFIGS = PerfSuite([
diff --git a/tools/perf/core/shard_maps/fuchsia-perf-fyi_map.json b/tools/perf/core/shard_maps/fuchsia-perf-fyi_map.json index 72754eb..1dce5fa 100644 --- a/tools/perf/core/shard_maps/fuchsia-perf-fyi_map.json +++ b/tools/perf/core/shard_maps/fuchsia-perf-fyi_map.json
@@ -4,44 +4,47 @@ "media.mobile": { "abridged": false }, - "system_health.memory_desktop": { - "end": 17, + "rendering.mobile": { + "end": 66, "abridged": false } } }, "1": { "benchmarks": { - "system_health.memory_desktop": { - "begin": 17, - "end": 27, + "rendering.mobile": { + "begin": 66, + "end": 178, "abridged": false } } }, "2": { "benchmarks": { - "system_health.memory_desktop": { - "begin": 27, - "end": 33, + "rendering.mobile": { + "begin": 178, + "end": 290, "abridged": false } } }, "3": { "benchmarks": { - "system_health.memory_desktop": { - "begin": 33, - "end": 41, + "rendering.mobile": { + "begin": 290, + "end": 402, "abridged": false } } }, "4": { "benchmarks": { + "rendering.mobile": { + "begin": 402, + "abridged": false + }, "system_health.memory_desktop": { - "begin": 41, - "end": 49, + "end": 27, "abridged": false } } @@ -49,8 +52,8 @@ "5": { "benchmarks": { "system_health.memory_desktop": { - "begin": 49, - "end": 53, + "begin": 27, + "end": 39, "abridged": false } } @@ -58,8 +61,8 @@ "6": { "benchmarks": { "system_health.memory_desktop": { - "begin": 53, - "end": 59, + "begin": 39, + "end": 50, "abridged": false } } @@ -67,8 +70,8 @@ "7": { "benchmarks": { "system_health.memory_desktop": { - "begin": 59, - "end": 65, + "begin": 50, + "end": 58, "abridged": false } } @@ -76,8 +79,8 @@ "8": { "benchmarks": { "system_health.memory_desktop": { - "begin": 65, - "end": 75, + "begin": 58, + "end": 73, "abridged": false } } @@ -85,26 +88,26 @@ "9": { "benchmarks": { "system_health.memory_desktop": { - "begin": 75, + "begin": 73, "abridged": false } } }, "extra_infos": { - "num_stories": 96, - "predicted_min_shard_time": 609.0, - "predicted_min_shard_index": 5, - "predicted_max_shard_time": 736.0, - "predicted_max_shard_index": 0, - "shard #0": 736.0, - "shard #1": 660.0, - "shard #2": 636.0, - "shard #3": 729.0, - "shard #4": 714.0, - "shard #5": 609.0, - "shard #6": 696.0, - "shard #7": 678.0, - "shard #8": 630.0, - "shard #9": 615.0 + "num_stories": 531, + "predicted_min_shard_time": 1074.0, + "predicted_min_shard_index": 9, + "predicted_max_shard_time": 1143.0, + "predicted_max_shard_index": 6, + "shard #0": 1124.0, + "shard #1": 1120, + "shard #2": 1120, + "shard #3": 1120, + "shard #4": 1130.0, + "shard #5": 1113.0, + "shard #6": 1143.0, + "shard #7": 1125.0, + "shard #8": 1122.0, + "shard #9": 1074.0 } } \ No newline at end of file
diff --git a/tools/perf/core/shard_maps/timing_data/fuchsia-perf-fyi_timing.json b/tools/perf/core/shard_maps/timing_data/fuchsia-perf-fyi_timing.json index 77b61572..a311a0f 100644 --- a/tools/perf/core/shard_maps/timing_data/fuchsia-perf-fyi_timing.json +++ b/tools/perf/core/shard_maps/timing_data/fuchsia-perf-fyi_timing.json
@@ -4,7 +4,7 @@ "name": "media.mobile/mse.html?media=aac_audio.mp4" }, { - "duration": "31.0", + "duration": "32.0", "name": "media.mobile/mse.html?media=aac_audio.mp4,h264_video.mp4" }, { @@ -12,7 +12,7 @@ "name": "media.mobile/mse.html?media=h264_video.mp4" }, { - "duration": "37.0", + "duration": "38.0", "name": "media.mobile/mse.html?media=tulip2.vp9.webm" }, { @@ -36,11 +36,11 @@ "name": "media.mobile/video.html?src=tulip2.mp3&type=audio&seek" }, { - "duration": "36.0", + "duration": "37.0", "name": "media.mobile/video.html?src=tulip2.mp4" }, { - "duration": "33.0", + "duration": "31.0", "name": "media.mobile/video.html?src=tulip2.mp4&busyjs" }, { @@ -52,7 +52,7 @@ "name": "media.mobile/video.html?src=tulip2.ogg&type=audio&seek" }, { - "duration": "32.0", + "duration": "35.0", "name": "media.mobile/video.html?src=tulip2.vp9.webm" }, { @@ -60,7 +60,7 @@ "name": "media.mobile/video.html?src=tulip2.vp9.webm&background" }, { - "duration": "35.0", + "duration": "34.0", "name": "media.mobile/video.html?src=tulip2.vp9.webm_WiFi" }, { @@ -72,78 +72,54 @@ "name": "system_health.memory_desktop/browse:media:imgur" }, { - "duration": "2.0", + "duration": "1.0", "name": "system_health.memory_desktop/browse:media:pinterest:2018" }, { - "duration": "2.0", + "duration": "1.0", "name": "system_health.memory_desktop/browse:media:tumblr:2018" }, { - "duration": "106.0", + "duration": "116.0", "name": "system_health.memory_desktop/browse:media:youtube:2019" }, { - "duration": "2.0", + "duration": "1.0", "name": "system_health.memory_desktop/browse:media:youtubetv:2019" }, { - "duration": "2.0", + "duration": "1.0", "name": "system_health.memory_desktop/browse:media:youtubetv_watch:2020" }, { - "duration": "99.0", + "duration": "91.0", "name": "system_health.memory_desktop/browse:news:hackernews:2020" }, { - "duration": "2.0", + "duration": "1.0", "name": "system_health.memory_desktop/browse:news:nytimes:2020" }, { - "duration": "2.0", - "name": "system_health.memory_desktop/browse:news:reddit:2020" - }, - { "duration": "1.0", - "name": "system_health.memory_desktop/browse:search:google:2020" + "name": "system_health.memory_desktop/browse:news:reddit:2020" }, { "duration": "1.0", "name": "system_health.memory_desktop/browse:search:google_india:2021" }, { - "duration": "131.0", + "duration": "149.0", "name": "system_health.memory_desktop/browse:social:tumblr_infinite_scroll:2018" }, { - "duration": "2.0", + "duration": "1.0", "name": "system_health.memory_desktop/browse:social:twitter:2018" }, { - "duration": "93.0", + "duration": "89.0", "name": "system_health.memory_desktop/browse:social:twitter_infinite_scroll:2018" }, { - "duration": "50.0", - "name": "system_health.memory_desktop/browse:tools:docs_scrolling" - }, - { - "duration": "1.0", - "name": "system_health.memory_desktop/browse:tools:gmail-compose:2020" - }, - { - "duration": "1.0", - "name": "system_health.memory_desktop/browse:tools:gmail-labelclick:2020" - }, - { - "duration": "1.0", - "name": "system_health.memory_desktop/browse:tools:gmail-openconversation:2020" - }, - { - "duration": "1.0", - "name": "system_health.memory_desktop/browse:tools:gmail-search:2020" - }, - { "duration": "1.0", "name": "system_health.memory_desktop/browse:tools:maps:2019" }, @@ -152,7 +128,7 @@ "name": "system_health.memory_desktop/browse:tools:sheets:2019" }, { - "duration": "30.0", + "duration": "31.0", "name": "system_health.memory_desktop/load:games:alphabetty:2018" }, { @@ -160,11 +136,11 @@ "name": "system_health.memory_desktop/load:games:bubbles:2020" }, { - "duration": "47.0", + "duration": "48.0", "name": "system_health.memory_desktop/load:games:lazors" }, { - "duration": "34.0", + "duration": "36.0", "name": "system_health.memory_desktop/load:games:miniclip:2018" }, { @@ -176,7 +152,7 @@ "name": "system_health.memory_desktop/load:media:9gag" }, { - "duration": "59.0", + "duration": "58.0", "name": "system_health.memory_desktop/load:media:dailymotion:2019" }, { @@ -184,7 +160,7 @@ "name": "system_health.memory_desktop/load:media:facebook_feed:desktop:2020" }, { - "duration": "26.0", + "duration": "27.0", "name": "system_health.memory_desktop/load:media:facebook_photos:2018" }, { @@ -196,11 +172,11 @@ "name": "system_health.memory_desktop/load:media:flickr:2018" }, { - "duration": "24.0", + "duration": "25.0", "name": "system_health.memory_desktop/load:media:google_images:2018" }, { - "duration": "52.0", + "duration": "53.0", "name": "system_health.memory_desktop/load:media:imgur:2018" }, { @@ -208,7 +184,7 @@ "name": "system_health.memory_desktop/load:media:soundcloud:2018" }, { - "duration": "42.0", + "duration": "39.0", "name": "system_health.memory_desktop/load:media:youtube:2018" }, { @@ -224,71 +200,71 @@ "name": "system_health.memory_desktop/load:news:cnn:2020" }, { - "duration": "43.0", + "duration": "68.0", "name": "system_health.memory_desktop/load:news:flipboard" }, { - "duration": "24.0", + "duration": "25.0", "name": "system_health.memory_desktop/load:news:hackernews:2018" }, { - "duration": "75.0", + "duration": "73.0", "name": "system_health.memory_desktop/load:news:nytimes:2018" }, { - "duration": "63.0", + "duration": "85.0", "name": "system_health.memory_desktop/load:news:qq:2018" }, { - "duration": "54.0", + "duration": "51.0", "name": "system_health.memory_desktop/load:news:reddit:2018" }, { - "duration": "32.0", + "duration": "55.0", "name": "system_health.memory_desktop/load:news:wikipedia:2018" }, { - "duration": "32.0", + "duration": "29.0", "name": "system_health.memory_desktop/load:search:amazon:2018" }, { - "duration": "54.0", + "duration": "53.0", "name": "system_health.memory_desktop/load:search:baidu:2018" }, { - "duration": "48.0", + "duration": "51.0", "name": "system_health.memory_desktop/load:search:ebay:2018" }, { - "duration": "36.0", + "duration": "35.0", "name": "system_health.memory_desktop/load:search:flipkart:2018" }, { - "duration": "25.0", + "duration": "26.0", "name": "system_health.memory_desktop/load:search:google:2018" }, { - "duration": "60.0", + "duration": "59.0", "name": "system_health.memory_desktop/load:search:taobao:2018" }, { - "duration": "53.0", + "duration": "54.0", "name": "system_health.memory_desktop/load:search:yahoo:2018" }, { - "duration": "26.0", + "duration": "28.0", "name": "system_health.memory_desktop/load:search:yandex:2018" }, { - "duration": "28.0", + "duration": "26.0", "name": "system_health.memory_desktop/load:social:instagram:2018" }, { - "duration": "31.0", + "duration": "30.0", "name": "system_health.memory_desktop/load:social:pinterest:2019" }, { - "duration": "38.0", + "duration": "60.0", "name": "system_health.memory_desktop/load:social:vk:2018" }, { @@ -296,7 +272,7 @@ "name": "system_health.memory_desktop/load:tools:chat:2020" }, { - "duration": "59.0", + "duration": "52.0", "name": "system_health.memory_desktop/load:tools:docs:2019" }, { @@ -304,31 +280,31 @@ "name": "system_health.memory_desktop/load:tools:drive:2019" }, { - "duration": "2.0", + "duration": "3.0", "name": "system_health.memory_desktop/load:tools:gmail:2019" }, { - "duration": "43.0", + "duration": "40.0", "name": "system_health.memory_desktop/load:tools:stackoverflow:2018" }, { - "duration": "46.0", + "duration": "43.0", "name": "system_health.memory_desktop/load:tools:weather:2019" }, { - "duration": "2.0", + "duration": "1.0", "name": "system_health.memory_desktop/long_running:tools:gmail-background" }, { - "duration": "2.0", + "duration": "1.0", "name": "system_health.memory_desktop/long_running:tools:gmail-foreground" }, { - "duration": "2.0", + "duration": "1.0", "name": "system_health.memory_desktop/multitab:misc:typical24" }, { - "duration": "2.0", + "duration": "1.0", "name": "system_health.memory_desktop/multitab:misc:typical24:2018" }, { @@ -336,7 +312,7 @@ "name": "system_health.memory_desktop/play:media:google_play_music" }, { - "duration": "63.0", + "duration": "61.0", "name": "system_health.memory_desktop/play:media:soundcloud:2018" } ] \ No newline at end of file
diff --git a/tools/tracing/README.md b/tools/tracing/README.md index 8a2dd73..70c5e7d 100644 --- a/tools/tracing/README.md +++ b/tools/tracing/README.md
@@ -30,19 +30,34 @@ Supported architectures for heap profiling: -* Local builds: arm32, arm64, x86-64 +* **Local builds**: arm32, arm64, x86-64 - * Even if arm32 is not used, ensure `symbol_level=1` is included in gn - args so that function names are included in symbol files. - * If an emulator is used, use x86-64 architecture. x86 architecture is not - supported for this. - * Prefer to use arm64/x86-64 builds since arm32 support is less stable. - * For arm32, set these gn args: `enable_profiling=true`, - `arm_use_thumb=false`, `is_component_build=false` and `symbol_level=1`. - * Alternatively for arm32 you can use `is_official_build=true`, - `symbol_level=1`. + * Set 'symbol_level' to 1 or 2 in gn args. Symbols are used to add + function names to CPU and heap profiles. Level 1 only includes public + functions. Level 2 includes all function names but takes longer to + build. -* Official builds: arm32, arm64, x86-64. + * **Emulator**: Use x86-64 architecture. x86 architecture is not + supported. + + * **Arm64**: If you are building for arm64 and using the primary apk + (chrome.apk or monochrome.apk), then profiling works with all the + builds. + + * **Arm64-secondary**: If you are using builds from secondary arch folder + (clang_arm32), then make sure the arm32 gn args defined below are + included. + + * Prefer to use arm64/x86-64 primary since arm32 support is less stable. + + * For **arm32**, set these gn args: + + * Unofficial: `enable_profiling=true`, `arm_use_thumb=false`, + `is_component_build=false` and `symbol_level=1`. + * Official: for arm32 you can use `is_official_build=true`, + `symbol_level=1`. + +* **Official builds**: arm32, arm64, x86-64. * Official builds need to be installed from the play store. * For arm32, only canary and dev channels are supported.
diff --git a/tools/tracing/breakpad_file_extractor.py b/tools/tracing/breakpad_file_extractor.py index b46ecb17..d2cf44e 100644 --- a/tools/tracing/breakpad_file_extractor.py +++ b/tools/tracing/breakpad_file_extractor.py
@@ -48,11 +48,7 @@ directories cannot be found. """ # Check to see if |dump_syms_path| is a file. - dump_syms_path = _GetDumpSyms(dump_syms_path, build_dir) - if dump_syms_path is None: - raise Exception( - 'dump_syms is missing. you can build dump_syms in the {build_dir} by' - 'running ninja -C {build_dir} dump_syms'.format(build_dir=build_dir)) + dump_syms_path = EnsureDumpSymsBinary(dump_syms_path, build_dir) # Check if |build_dir| and |breakpad_base_dir| are directories. if not os.path.isdir(build_dir): @@ -233,7 +229,7 @@ return True -def _GetDumpSyms(dump_syms_path, build_dir): +def EnsureDumpSymsBinary(dump_syms_path, build_dir): """Checks to see if dump_syms can be found. Args: @@ -241,15 +237,23 @@ build_dir: The path to a directory. Returns: - The path to the dump_syms binary or None if none is found. + The path to the dump_syms binary or raises exception. """ if dump_syms_path is not None and os.path.isfile( dump_syms_path) and 'dump_syms' in dump_syms_path: return dump_syms_path - path_to_dump_syms = os.path.join(build_dir, 'dump_syms') - if os.path.isfile(path_to_dump_syms): - return path_to_dump_syms - return None + + if build_dir is not None: + path_to_dump_syms = os.path.join(build_dir, 'dump_syms') + if os.path.isfile(path_to_dump_syms): + return path_to_dump_syms + + if not build_dir: + build_dir = 'out/android' # For error message. + raise Exception( + 'dump_syms binary not found. Build a binary with ' + 'autoninja -C {build_dir} dump_syms and try again with ' + '--dump_syms={build_dir}/dump_syms'.format(build_dir=build_dir)) def IsValidBinaryPath(path):
diff --git a/tools/tracing/breakpad_file_extractor_unittest.py b/tools/tracing/breakpad_file_extractor_unittest.py index b230569..40466cda3 100755 --- a/tools/tracing/breakpad_file_extractor_unittest.py +++ b/tools/tracing/breakpad_file_extractor_unittest.py
@@ -219,7 +219,7 @@ def testDumpSymsNotFound(self): breakpad_file_extractor._RunDumpSyms = mock.MagicMock() - exception_msg = 'dump_syms is missing.' + exception_msg = 'dump_syms binary not found.' with self.assertRaises(Exception) as e: breakpad_file_extractor.ExtractBreakpadFiles('fake/path/dump_syms', self.test_build_dir,
diff --git a/tools/tracing/flag_utils.py b/tools/tracing/flag_utils.py index 367f0e3..f25ecae 100644 --- a/tools/tracing/flag_utils.py +++ b/tools/tracing/flag_utils.py
@@ -16,8 +16,6 @@ 'catapult', 'systrace')) from systrace import util -_DEFAULT_CHROME_CATEGORIES = '_DEFAULT_CHROME_CATEGORIES' - TRACING_LOGGER_NAME = 'chromium:tools/tracing' @@ -115,8 +113,7 @@ profile_options.add_option('--chrome_categories', help='Chrome tracing ' 'categories to record.', - type='string', - default=_DEFAULT_CHROME_CATEGORIES) + type='string') profile_options.add_option( '--skip_symbolize', help='Skips symbolization after recording trace profile, if specified.', @@ -168,8 +165,11 @@ dest='local_build_dir') symbolization_options.add_option( '--dump_syms', - help=('Path to dump_syms binary. Searches the given build ' - 'directory for the binary, if not provided.'), + help=('Path to a dump_syms binary. Required when symbolizing an official ' + 'build. Optional on local builds as we can use --local_build_dir ' + 'to locate a binary. If built locally with ' + 'autoninja -C out/Release dump_syms then the binary path is ' + 'out/Release/dump_syms'), dest='dump_syms_path') symbolization_options.add_option( '--symbolizer', @@ -204,6 +204,17 @@ options: The command-line options given. """ if options.enable_profiler is None: + if not options.chrome_categories: + GetTracingLogger().warning( + 'No trace category or profiler is enabled using --enable_profiler ' + 'and/or --chrome_categories, enabling all default categories.') + if not options.skip_symbolize: + GetTracingLogger().warning( + 'No profiler is enabled, symbolization might fail without any ' + 'frames. Use --skip_symbolize to disable symbolization.') + else: + GetTracingLogger().info( + 'No profiler is enabled, the trace will only have trace events.') return if options.chrome_categories is None:
diff --git a/tools/tracing/profile_chrome_startup b/tools/tracing/profile_chrome_startup index 99562307..c0a90f0 100755 --- a/tools/tracing/profile_chrome_startup +++ b/tools/tracing/profile_chrome_startup
@@ -45,8 +45,8 @@ def _SetupFlags(options): - flag_utils.SetupProfilingCategories(options) flag_utils.SetupLogging(options.verbosity) + flag_utils.SetupProfilingCategories(options) def main(): @@ -76,8 +76,15 @@ symbolize_trace.SymbolizeTrace(trace_file=trace_file, options=options) if options.view: - trace = options.output_file if os.path.isfile(options.output_file) else trace_file - display_in_browser.DisplayInBrowser(trace, options.trace_format) + trace = options.output_file + if not trace or not os.path.isfile(trace): + trace = trace_file + + if trace and os.path.isfile(trace): + display_in_browser.DisplayInBrowser(trace, options.trace_format) + else: + flag_utils.GetTraceLogger().warning( + 'Trace is not found, so not opening in browser.') if __name__ == '__main__': sys.exit(main())
diff --git a/tools/tracing/symbolize_trace.py b/tools/tracing/symbolize_trace.py index 7585068..07d5767 100644 --- a/tools/tracing/symbolize_trace.py +++ b/tools/tracing/symbolize_trace.py
@@ -37,14 +37,22 @@ need_cleanup = False if options.local_breakpad_dir is None: + breakpad_file_extractor.EnsureDumpSymsBinary(options.dump_syms_path, + options.local_build_dir) + # Ensure valid |breakpad_output_dir| if options.breakpad_output_dir is None: # Create a temp dir if output dir is not provided. # Temp dir must be cleaned up later. options.breakpad_output_dir = tempfile.mkdtemp() need_cleanup = True - flag_utils.GetTracingLogger().debug( - 'Created temporary directory to hold symbol files.') + flag_utils.GetTracingLogger().warning( + 'Created temporary directory to hold symbol files. These symbols ' + 'will be cleaned up after symbolization. Please specify ' + '--breakpad_output_dir=<cached_dir> to save the symbols, if you need ' + 'to profile multiple times. The future runs need to use ' + '--local_breakpad_dir=<cached_dir> flag so the symbolizer uses the ' + 'cache.') else: if os.path.isdir(options.breakpad_output_dir): if os.listdir(options.breakpad_output_dir):
diff --git a/tools/tracing/symbolize_trace_unittest.py b/tools/tracing/symbolize_trace_unittest.py index 49f0eac2..d93df8f 100755 --- a/tools/tracing/symbolize_trace_unittest.py +++ b/tools/tracing/symbolize_trace_unittest.py
@@ -56,6 +56,11 @@ metadata_extractor.MetadataExtractor = mock.MagicMock() breakpad_file_extractor.ExtractBreakpadFiles = mock.MagicMock() + dump_syms_dir = tempfile.mkdtemp() + self.options.dump_syms_path = os.path.join(dump_syms_dir, 'dump_syms') + with open(self.options.dump_syms_path, 'w') as _: + pass + with tempfile.NamedTemporaryFile(mode='w+', delete=False) as test_trace_file: test_trace_file.write('Trace data.') @@ -158,6 +163,24 @@ symbolize_trace.SymbolizeTrace(self.trace_file, self.options) self.assertIn(exception_msg, str(e.exception)) + def testFailWhenNoDumpSyms(self): + self.options.dump_syms_path = None + + exception_msg = 'dump_syms binary not found.' + with self.assertRaises(Exception) as e: + symbolize_trace.SymbolizeTrace(self.trace_file, self.options) + self.assertIn(exception_msg, str(e.exception)) + + def testFindDumpSymsInBuild(self): + self.options.local_build_dir = tempfile.mkdtemp() + self.options.dump_syms_path = None + dump_syms_path = os.path.join(self.options.local_build_dir, 'dump_syms') + with open(dump_syms_path, 'w') as _: + pass + + # Throws no exception + symbolize_trace.SymbolizeTrace(self.trace_file, self.options) + def testValidLocalBreakpadDir(self): self.options.local_breakpad_dir = tempfile.mkdtemp()
diff --git a/tools/traffic_annotation/scripts/annotation_tools.py b/tools/traffic_annotation/scripts/annotation_tools.py index 273eef0..6d27e28 100644 --- a/tools/traffic_annotation/scripts/annotation_tools.py +++ b/tools/traffic_annotation/scripts/annotation_tools.py
@@ -83,35 +83,6 @@ return all(os.path.exists( os.path.join(path, item)) for item in ('gen', 'build.ninja')) - def GetCurrentPlatform(self): - """Return the target platform of |self.build_path| based on heuristics.""" - # Use host platform as the source of truth (in most cases). - current_platform = { - 'linux': 'linux', - 'linux2': 'linux', - 'win32': 'windows', - }[sys.platform] - - if current_platform == 'linux' and self.build_path is not None: - # It could be an Android build directory, being compiled from a Linux - # host. Look for a target_os='android' line in args.gn. - try: - with open(os.path.join(self.build_path, 'args.gn')) as f: - gn_args = f.read() - pattern = re.compile(r'^\s*target_os\s*=\s*"android"\s*$', re.MULTILINE) - if pattern.search(gn_args): - current_platform = 'android' - except (ValueError, OSError) as e: - print(e) - # Maybe the file's absent, or it can't be decoded as UTF-8, or - # something. It's probably not Android in that case. - pass - - if current_platform not in SUPPORTED_PLATFORMS: - raise ValueError('Unsupported platform {}'.format(current_platform)) - - return current_platform - def GetCompDBFiles(self, generate_compdb): """Gets the list of files.
diff --git a/tools/traffic_annotation/scripts/auditor/auditor.py b/tools/traffic_annotation/scripts/auditor/auditor.py index 5ff8e885..621ad77 100755 --- a/tools/traffic_annotation/scripts/auditor/auditor.py +++ b/tools/traffic_annotation/scripts/auditor/auditor.py
@@ -62,9 +62,8 @@ # These platforms populate the "os_list" field in annotations.xml for # newly-added annotations (i.e., assume they're present on these platforms). # -# Android isn't completely supported yet, so exclude it for now. -# TODO(crbug.com/1231780): Revisit this once Android support is complete. -DEFAULT_OS_LIST = ["linux", "windows"] +# ChromeOS isn't completely supported yet, so exclude it for now. +DEFAULT_OS_LIST = ["linux", "windows", "android"] # Earliest valid milestone for added_in_milestone in annotations.xml. MIN_MILESTONE = 62 @@ -1177,7 +1176,8 @@ SUMMARY_DIR = SCRIPT_DIR.parent.parent / "summary" - GROUPING_XML_PATH = SCRIPT_DIR.parent.parent / "summary" / "grouping.xml" + ANNOTATIONS_XML_PATH = SUMMARY_DIR / "annotations.xml" + GROUPING_XML_PATH = SUMMARY_DIR / "grouping.xml" def __init__(self, current_platform: str): self.archive: Dict[UniqueId, ArchivedAnnotation] = {} @@ -1192,26 +1192,15 @@ "Unable to extract MAJOR=... version from chrome/VERSION") self._current_milestone = int(m.group(1)) - if self._current_platform == "android": - # Use a separate file for Android until the CQ/waterfall checks are stable - # enough, to avoid confusing CL authors. - # - # TODO(crbug.com/1231780): Merge this with annotations.xml once the - # checks are working well on Android. - self.annotations_xml_path = (Exporter.SUMMARY_DIR / - "annotations_android.xml") - else: - self.annotations_xml_path = Exporter.SUMMARY_DIR / "annotations.xml" - def load_annotations_xml(self) -> None: """Loads annotations from annotations.xml into self.archive using ArchivedAnnotation objects.""" logger.info("Parsing {}.".format( - self.annotations_xml_path.relative_to(SRC_DIR))) + Exporter.ANNOTATIONS_XML_PATH.relative_to(SRC_DIR))) self.archive = {} - tree = xml.etree.ElementTree.parse(self.annotations_xml_path) + tree = xml.etree.ElementTree.parse(Exporter.ANNOTATIONS_XML_PATH) root = tree.getroot() for item in root.iter("item"): @@ -1417,14 +1406,14 @@ if os not in SUPPORTED_PLATFORMS: errors.append( AuditorError(AuditorError.Type.INVALID_OS, "", - self.annotations_xml_path, 0, os, unique_id)) + Exporter.ANNOTATIONS_XML_PATH, 0, os, unique_id)) # Check for consistency of "added_in_milestone" attribute. for unique_id, archived in self.archive.items(): if archived.added_in_milestone < MIN_MILESTONE: errors.append( AuditorError(AuditorError.Type.INVALID_ADDED_IN, "", - self.annotations_xml_path, 0, + Exporter.ANNOTATIONS_XML_PATH, 0, str(archived.added_in_milestone), unique_id)) return errors @@ -1432,9 +1421,9 @@ def save_annotations_xml(self) -> None: """Saves self._archive into annotations.xml""" logger.info("Saving annotations to {}.".format( - self.annotations_xml_path.relative_to(SRC_DIR))) + Exporter.ANNOTATIONS_XML_PATH.relative_to(SRC_DIR))) xml_str = self._generate_serialized_xml() - self.annotations_xml_path.write_text(xml_str, encoding="utf-8") + Exporter.ANNOTATIONS_XML_PATH.write_text(xml_str, encoding="utf-8") def get_other_platforms_annotation_ids(self) -> List[UniqueId]: """Returns a list of annotations that are not defined on this platform.""" @@ -1466,9 +1455,9 @@ """Returns the required updates to go from one state to another in annotations.xml""" logger.info("Computing required updates for {}.".format( - self.annotations_xml_path.relative_to(SRC_DIR))) + Exporter.ANNOTATIONS_XML_PATH.relative_to(SRC_DIR))) - old_xml = self.annotations_xml_path.read_text(encoding="utf-8") + old_xml = Exporter.ANNOTATIONS_XML_PATH.read_text(encoding="utf-8") new_xml = self._generate_serialized_xml() return Exporter._get_xml_differences(old_xml, new_xml)
diff --git a/tools/traffic_annotation/scripts/auditor/auditor_test.py b/tools/traffic_annotation/scripts/auditor/auditor_test.py index e8bba814..8b3242f 100755 --- a/tools/traffic_annotation/scripts/auditor/auditor_test.py +++ b/tools/traffic_annotation/scripts/auditor/auditor_test.py
@@ -605,7 +605,7 @@ self.assertEqual([], errors) # The content of annotations.xml shouldn't change when writing it. - old_xml = exporter.annotations_xml_path.read_text(encoding="utf-8") + old_xml = Exporter.ANNOTATIONS_XML_PATH.read_text(encoding="utf-8") new_xml = exporter._generate_serialized_xml() self.assertEqual(old_xml, new_xml)
diff --git a/tools/traffic_annotation/scripts/check_annotations.py b/tools/traffic_annotation/scripts/check_annotations.py index d286b4fd2..cf048454 100755 --- a/tools/traffic_annotation/scripts/check_annotations.py +++ b/tools/traffic_annotation/scripts/check_annotations.py
@@ -119,14 +119,6 @@ if stderr_text: print("\n[Runtime Messages]:\n%s" % stderr_text) - if self.tools.GetCurrentPlatform() == "android": - # For now, always mark the android bot as green. This acts as a sort of - # "FYI" mode. - # - # TODO(crbug.com/1254719): Once the Android presubmit bot is stable, turn - # this into a CQ-blocking failure. - return 0 - return return_code
diff --git a/tools/traffic_annotation/summary/BUILD.gn b/tools/traffic_annotation/summary/BUILD.gn index 0812c68b..25faae4 100644 --- a/tools/traffic_annotation/summary/BUILD.gn +++ b/tools/traffic_annotation/summary/BUILD.gn
@@ -3,9 +3,6 @@ # found in the LICENSE file. copy("annotations_xml") { - sources = [ - "annotations.xml", - "annotations_android.xml", - ] + sources = [ "annotations.xml" ] outputs = [ "$target_out_dir/{{source_file_part}}" ] }
diff --git a/tools/traffic_annotation/summary/annotations.xml b/tools/traffic_annotation/summary/annotations.xml index 41f136b..adab210 100644 --- a/tools/traffic_annotation/summary/annotations.xml +++ b/tools/traffic_annotation/summary/annotations.xml
@@ -8,44 +8,44 @@ --> <annotations> - <item id="accounts_image_fetcher" added_in_milestone="66" content_hash_code="02b53da6" os_list="linux,windows,chromeos" file_path="components/signin/internal/identity_manager/account_fetcher_service.cc" /> + <item id="accounts_image_fetcher" added_in_milestone="66" content_hash_code="02b53da6" os_list="linux,windows,chromeos,android" file_path="components/signin/internal/identity_manager/account_fetcher_service.cc" /> <item id="adb_client_socket" added_in_milestone="65" content_hash_code="03607bec" os_list="linux,windows,chromeos" file_path="chrome/browser/devtools/device/adb/adb_client_socket.cc" /> - <item id="affiliation_lookup_by_hash" added_in_milestone="87" content_hash_code="026afe84" os_list="linux,windows,chromeos" file_path="components/password_manager/core/browser/site_affiliation/hash_affiliation_fetcher.cc" /> - <item id="aggregation_service_helper_keys" added_in_milestone="96" content_hash_code="04127781" os_list="linux,windows,chromeos" file_path="content/browser/aggregation_service/aggregation_service_network_fetcher_impl.cc" /> - <item id="aggregation_service_report" added_in_milestone="95" content_hash_code="02a9ab82" os_list="linux,windows,chromeos" file_path="content/browser/aggregation_service/aggregatable_report_sender.cc" /> + <item id="affiliation_lookup_by_hash" added_in_milestone="87" content_hash_code="026afe84" os_list="linux,windows,chromeos,android" file_path="components/password_manager/core/browser/site_affiliation/hash_affiliation_fetcher.cc" /> + <item id="aggregation_service_helper_keys" added_in_milestone="96" content_hash_code="04127781" os_list="linux,windows,chromeos,android" file_path="content/browser/aggregation_service/aggregation_service_network_fetcher_impl.cc" /> + <item id="aggregation_service_report" added_in_milestone="95" content_hash_code="02a9ab82" os_list="linux,windows,chromeos,android" file_path="content/browser/aggregation_service/aggregatable_report_sender.cc" /> <item id="android_device_manager_socket" added_in_milestone="65" content_hash_code="00623801" os_list="linux,windows,chromeos" file_path="chrome/browser/devtools/device/android_device_manager.cc" /> <item id="android_web_socket" added_in_milestone="65" content_hash_code="00bbd661" os_list="linux,windows,chromeos" file_path="chrome/browser/devtools/device/android_web_socket.cc" /> - <item id="auction_downloader" added_in_milestone="92" content_hash_code="0713f212" os_list="linux,windows,chromeos" file_path="content/services/auction_worklet/auction_downloader.cc" /> - <item id="auction_report_sender" added_in_milestone="92" content_hash_code="03b7acb6" os_list="linux,windows,chromeos" file_path="content/browser/interest_group/ad_auction_service_impl.cc" /> - <item id="autofill_image_fetcher_card_art_image" added_in_milestone="93" content_hash_code="0177b54c" os_list="linux,windows,chromeos" file_path="components/autofill/core/browser/ui/autofill_image_fetcher.cc" /> - <item id="autofill_query" added_in_milestone="62" content_hash_code="00ed7a4b" os_list="linux,windows,chromeos" file_path="components/autofill/core/browser/autofill_download_manager.cc" /> - <item id="autofill_upload" added_in_milestone="62" content_hash_code="0698270b" os_list="linux,windows,chromeos" file_path="components/autofill/core/browser/autofill_download_manager.cc" /> + <item id="auction_downloader" added_in_milestone="92" content_hash_code="0713f212" os_list="linux,windows,chromeos,android" file_path="content/services/auction_worklet/auction_downloader.cc" /> + <item id="auction_report_sender" added_in_milestone="92" content_hash_code="03b7acb6" os_list="linux,windows,chromeos,android" file_path="content/browser/interest_group/ad_auction_service_impl.cc" /> + <item id="autofill_image_fetcher_card_art_image" added_in_milestone="93" content_hash_code="0177b54c" os_list="linux,windows,chromeos,android" file_path="components/autofill/core/browser/ui/autofill_image_fetcher.cc" /> + <item id="autofill_query" added_in_milestone="62" content_hash_code="00ed7a4b" os_list="linux,windows,chromeos,android" file_path="components/autofill/core/browser/autofill_download_manager.cc" /> + <item id="autofill_upload" added_in_milestone="62" content_hash_code="0698270b" os_list="linux,windows,chromeos,android" file_path="components/autofill/core/browser/autofill_download_manager.cc" /> <item id="backdrop_collection_images_download" added_in_milestone="68" content_hash_code="03c0de0e" os_list="linux,windows" file_path="chrome/browser/search/background/ntp_background_service.cc" /> <item id="backdrop_collection_names_download" added_in_milestone="68" content_hash_code="0592b787" os_list="linux,windows" file_path="chrome/browser/search/background/ntp_background_service.cc" /> <item id="backdrop_next_image_download" added_in_milestone="77" content_hash_code="05df91f2" os_list="linux,windows" file_path="chrome/browser/search/background/ntp_background_service.cc" /> - <item id="background_fetch_context" added_in_milestone="62" content_hash_code="031d0caa" os_list="linux,windows,chromeos" file_path="content/browser/background_fetch/background_fetch_delegate_proxy.cc" /> - <item id="bidirectional_stream" added_in_milestone="67" content_hash_code="07c03a44" os_list="linux,windows,chromeos" file_path="net/http/bidirectional_stream.cc" /> - <item id="blink_extension_resource_loader" added_in_milestone="63" content_hash_code="03c97c39" os_list="linux,windows,chromeos" file_path="third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader.cc" /> - <item id="blink_resource_loader" added_in_milestone="62" content_hash_code="047d7664" os_list="linux,windows,chromeos" file_path="third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader.cc" /> - <item id="bluetooth_socket" added_in_milestone="65" content_hash_code="01d7fd7d" os_list="linux,windows,chromeos" file_path="device/bluetooth/bluetooth_socket_net.cc" /> + <item id="background_fetch_context" added_in_milestone="62" content_hash_code="031d0caa" os_list="linux,windows,chromeos,android" file_path="content/browser/background_fetch/background_fetch_delegate_proxy.cc" /> + <item id="bidirectional_stream" added_in_milestone="67" content_hash_code="07c03a44" os_list="linux,windows,chromeos,android" file_path="net/http/bidirectional_stream.cc" /> + <item id="blink_extension_resource_loader" added_in_milestone="63" content_hash_code="03c97c39" os_list="linux,windows,chromeos,android" file_path="third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader.cc" /> + <item id="blink_resource_loader" added_in_milestone="62" content_hash_code="047d7664" os_list="linux,windows,chromeos,android" file_path="third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader.cc" /> + <item id="bluetooth_socket" added_in_milestone="65" content_hash_code="01d7fd7d" os_list="linux,windows,chromeos,android" file_path="device/bluetooth/bluetooth_socket_net.cc" /> <item id="box_access_token_fetcher" added_in_milestone="89" content_hash_code="0729581c" os_list="linux,windows,chromeos" file_path="chrome/browser/enterprise/connectors/file_system/access_token_fetcher.cc" /> <item id="brandcode_config" added_in_milestone="62" content_hash_code="07ae0010" os_list="linux,windows,chromeos" file_path="chrome/browser/profile_resetter/brandcode_config_fetcher.cc" /> <item id="browser_switcher_ieem_sitelist" added_in_milestone="72" content_hash_code="07b15836" os_list="linux,windows" file_path="chrome/browser/browser_switcher/browser_switcher_service.cc" /> - <item id="cablev2_websocket_from_authenticator" added_in_milestone="87" content_hash_code="0724f93c" os_list="linux,windows,chromeos" file_path="device/fido/cable/v2_authenticator.cc" /> + <item id="cablev2_websocket_from_authenticator" added_in_milestone="87" content_hash_code="0724f93c" os_list="linux,windows,chromeos,android" file_path="device/fido/cable/v2_authenticator.cc" /> <item id="cablev2_websocket_from_client" added_in_milestone="86" content_hash_code="06f37377" os_list="windows,linux,chromeos" file_path="device/fido/cable/fido_tunnel_device.cc" /> <item id="captive_portal_service" added_in_milestone="62" content_hash_code="04375eac" os_list="linux,windows,chromeos" file_path="components/captive_portal/content/captive_portal_service.cc" /> - <item id="cast_socket" added_in_milestone="66" content_hash_code="028e5273" os_list="linux,windows,chromeos" file_path="components/cast_channel/cast_socket.cc" /> - <item id="cast_udp_socket" added_in_milestone="66" content_hash_code="047d6b2d" os_list="linux,windows,chromeos" file_path="components/mirroring/service/udp_socket_client.cc" /> - <item id="cast_udp_transport" added_in_milestone="65" content_hash_code="066a8189" os_list="linux,windows,chromeos" file_path="media/cast/net/udp_transport_impl.cc" /> - <item id="certificate_verifier_url_loader" added_in_milestone="80" content_hash_code="05856cc0" os_list="linux,windows,chromeos" file_path="services/cert_verifier/cert_net_url_loader/cert_net_fetcher_url_loader.cc" /> - <item id="certificate_verifier_url_request" added_in_milestone="80" content_hash_code="03884604" os_list="linux,windows,chromeos" file_path="net/cert_net/cert_net_fetcher_url_request.cc" /> + <item id="cast_socket" added_in_milestone="66" content_hash_code="028e5273" os_list="linux,windows,chromeos,android" file_path="components/cast_channel/cast_socket.cc" /> + <item id="cast_udp_socket" added_in_milestone="66" content_hash_code="047d6b2d" os_list="linux,windows,chromeos,android" file_path="components/mirroring/service/udp_socket_client.cc" /> + <item id="cast_udp_transport" added_in_milestone="65" content_hash_code="066a8189" os_list="linux,windows,chromeos,android" file_path="media/cast/net/udp_transport_impl.cc" /> + <item id="certificate_verifier_url_loader" added_in_milestone="80" content_hash_code="05856cc0" os_list="linux,windows,chromeos,android" file_path="services/cert_verifier/cert_net_url_loader/cert_net_fetcher_url_loader.cc" /> + <item id="certificate_verifier_url_request" added_in_milestone="80" content_hash_code="03884604" os_list="linux,windows,chromeos,android" file_path="net/cert_net/cert_net_fetcher_url_request.cc" /> <item id="chrome_apps_socket_api" added_in_milestone="65" content_hash_code="07ca7795" os_list="linux,windows,chromeos" file_path="extensions/browser/api/socket/socket.cc" /> <item id="chrome_cart_discounts_lookup" added_in_milestone="92" content_hash_code="05b3e421" os_list="linux,windows,chromeos" file_path="chrome/browser/cart/cart_discount_fetcher.cc" /> <item id="chrome_cart_get_discounted_link" added_in_milestone="92" content_hash_code="052260e0" os_list="linux,windows,chromeos" file_path="chrome/browser/cart/cart_discount_link_fetcher.cc" /> <item id="chrome_cleaner" added_in_milestone="63" content_hash_code="06a16464" os_list="windows" file_path="chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc" /> <item id="chrome_cleanup_report" added_in_milestone="70" content_hash_code="07c84618" os_list="windows" file_path="chrome/chrome_cleaner/logging/cleaner_logging_service.cc" /> - <item id="chrome_feedback_report_app" added_in_milestone="62" content_hash_code="04bf864a" os_list="linux,windows,chromeos" file_path="components/feedback/feedback_uploader.cc" /> - <item id="chrome_variations_service" added_in_milestone="62" content_hash_code="00f59481" os_list="linux,windows,chromeos" file_path="components/variations/service/variations_service.cc" /> + <item id="chrome_feedback_report_app" added_in_milestone="62" content_hash_code="04bf864a" os_list="linux,windows,chromeos,android" file_path="components/feedback/feedback_uploader.cc" /> + <item id="chrome_variations_service" added_in_milestone="62" content_hash_code="00f59481" os_list="linux,windows,chromeos,android" file_path="components/variations/service/variations_service.cc" /> <item id="client_download_request" added_in_milestone="62" content_hash_code="04bc89c5" os_list="linux,windows,chromeos" file_path="chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc" /> <item id="cloud_print" added_in_milestone="65" type="completing" content_hash_code="03a1a8bc" os_list="linux,windows" semantics_fields="1,5" policy_fields="-1,3,4" file_path="chrome/service/cloud_print/cloud_print_url_fetcher.cc" /> <item id="cloud_print_backend" added_in_milestone="62" type="partial" second_id="cloud_print" content_hash_code="05177cb5" os_list="linux,windows" semantics_fields="2,3,4" file_path="chrome/service/cloud_print/cloud_print_proxy_backend.cc" /> @@ -53,252 +53,251 @@ <item id="cloud_print_proxy" added_in_milestone="62" type="partial" second_id="cloud_print" content_hash_code="056a8973" os_list="linux,windows" semantics_fields="2,3,4" file_path="chrome/service/cloud_print/cloud_print_proxy.cc" /> <item id="cloud_speech_recognition" added_in_milestone="85" content_hash_code="06d9916b" os_list="linux,windows,chromeos" file_path="chrome/services/speech/cloud_speech_recognition_client.cc" /> <item id="content_hash_verification_job" added_in_milestone="62" content_hash_code="079fc9db" os_list="linux,windows,chromeos" file_path="extensions/browser/content_hash_fetcher.cc" /> - <item id="content_suggestion_get_favicon" added_in_milestone="62" content_hash_code="0800f6e5" os_list="linux,windows,chromeos" file_path="components/ntp_snippets/content_suggestions_service.cc" /> - <item id="conversion_measurement_report" added_in_milestone="84" content_hash_code="06161a36" os_list="linux,windows,chromeos" file_path="content/browser/attribution_reporting/attribution_network_sender_impl.cc" /> - <item id="credenential_avatar" added_in_milestone="62" content_hash_code="06bcc86b" os_list="linux,windows,chromeos" file_path="chrome/browser/ui/passwords/account_avatar_fetcher.cc" /> + <item id="content_suggestion_get_favicon" added_in_milestone="62" content_hash_code="0800f6e5" os_list="linux,windows,chromeos,android" file_path="components/ntp_snippets/content_suggestions_service.cc" /> + <item id="conversion_measurement_report" added_in_milestone="84" content_hash_code="06161a36" os_list="linux,windows,chromeos,android" file_path="content/browser/attribution_reporting/attribution_network_sender_impl.cc" /> + <item id="credenential_avatar" added_in_milestone="62" content_hash_code="06bcc86b" os_list="linux,windows,chromeos,android" file_path="chrome/browser/ui/passwords/account_avatar_fetcher.cc" /> <item id="cros_recovery_image_download" added_in_milestone="62" content_hash_code="00a7d792" os_list="linux,windows,chromeos" file_path="chrome/browser/extensions/api/image_writer_private/write_from_url_operation.cc" /> <item id="desktop_screenshot_save" added_in_milestone="94" content_hash_code="019480c9" os_list="linux,windows,chromeos" file_path="chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.cc" /> - <item id="device_management_service" added_in_milestone="62" content_hash_code="06395282" os_list="linux,windows,chromeos" file_path="components/policy/core/common/cloud/device_management_service.cc" /> - <item id="devtools_cdp_network_resource" added_in_milestone="87" content_hash_code="051db8c6" os_list="linux,windows,chromeos" file_path="content/browser/devtools/protocol/devtools_network_resource_loader.cc" /> + <item id="device_management_service" added_in_milestone="62" content_hash_code="06395282" os_list="linux,windows,chromeos,android" file_path="components/policy/core/common/cloud/device_management_service.cc" /> + <item id="devtools_cdp_network_resource" added_in_milestone="87" content_hash_code="051db8c6" os_list="linux,windows,chromeos,android" file_path="content/browser/devtools/protocol/devtools_network_resource_loader.cc" /> <item id="devtools_free_data_source" added_in_milestone="62" content_hash_code="02213e08" os_list="linux,windows,chromeos" file_path="chrome/browser/ui/webui/devtools_ui_data_source.cc" /> - <item id="devtools_handle_front_end_messages" added_in_milestone="62" content_hash_code="04940191" os_list="linux,windows,chromeos" file_path="content/shell/browser/shell_devtools_bindings.cc" /> + <item id="devtools_handle_front_end_messages" added_in_milestone="62" content_hash_code="04940191" os_list="linux,windows,chromeos,android" file_path="content/shell/browser/shell_devtools_bindings.cc" /> <item id="devtools_hard_coded_data_source" added_in_milestone="62" content_hash_code="047b3668" os_list="linux,windows,chromeos" file_path="chrome/browser/ui/webui/devtools_ui_data_source.cc" /> - <item id="devtools_http_handler" added_in_milestone="66" content_hash_code="054518b9" os_list="linux,windows,chromeos" file_path="content/browser/devtools/devtools_http_handler.cc" /> + <item id="devtools_http_handler" added_in_milestone="66" content_hash_code="054518b9" os_list="linux,windows,chromeos,android" file_path="content/browser/devtools/devtools_http_handler.cc" /> <item id="devtools_network_resource" added_in_milestone="62" content_hash_code="01f4a4af" os_list="linux,windows,chromeos" file_path="chrome/browser/devtools/devtools_ui_bindings.cc" /> - <item id="devtools_proxy_config" added_in_milestone="85" content_hash_code="01e83c36" os_list="linux,windows,chromeos" file_path="content/browser/devtools/protocol/target_handler.cc" /> + <item id="devtools_proxy_config" added_in_milestone="85" content_hash_code="01e83c36" os_list="linux,windows,chromeos,android" file_path="content/browser/devtools/protocol/target_handler.cc" /> <item id="dial_url_fetcher" added_in_milestone="67" content_hash_code="07bd0650" os_list="linux,windows,chromeos" file_path="chrome/browser/media/router/discovery/dial/dial_url_fetcher.cc" /> - <item id="digital_asset_links" added_in_milestone="90" content_hash_code="00ced49e" os_list="linux,windows,chromeos" file_path="components/digital_asset_links/digital_asset_links_handler.cc" /> + <item id="digital_asset_links" added_in_milestone="90" content_hash_code="00ced49e" os_list="linux,windows,chromeos,android" file_path="components/digital_asset_links/digital_asset_links_handler.cc" /> <item id="direct_sockets" added_in_milestone="88" content_hash_code="03dc0aad" os_list="linux,windows,chromeos" file_path="content/browser/direct_sockets/direct_sockets_service_impl.cc" /> - <item id="dns_over_https" added_in_milestone="66" content_hash_code="02b087b6" os_list="linux,windows,chromeos" file_path="net/dns/dns_transaction.cc" /> - <item id="dns_transaction" added_in_milestone="65" content_hash_code="07e14f9f" os_list="linux,windows,chromeos" file_path="net/dns/dns_transaction.cc" /> - <item id="dom_distiller" added_in_milestone="62" content_hash_code="0653c7f2" os_list="linux,windows,chromeos" file_path="components/dom_distiller/core/distiller_url_fetcher.cc" /> - <item id="domain_reliability_report_upload" added_in_milestone="62" content_hash_code="0223d254" os_list="linux,windows,chromeos" file_path="components/domain_reliability/uploader.cc" /> - <item id="domain_security_policy" added_in_milestone="62" content_hash_code="01d7c177" os_list="linux,windows,chromeos" file_path="services/network/network_context.cc" /> - <item id="download_internals_webui_source" added_in_milestone="66" content_hash_code="07b659d0" os_list="linux,windows,chromeos" file_path="chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc" /> - <item id="download_manager_resume" added_in_milestone="62" content_hash_code="0275159a" os_list="linux,windows,chromeos" file_path="components/download/internal/common/download_item_impl.cc" /> + <item id="dns_over_https" added_in_milestone="66" content_hash_code="02b087b6" os_list="linux,windows,chromeos,android" file_path="net/dns/dns_transaction.cc" /> + <item id="dns_transaction" added_in_milestone="65" content_hash_code="07e14f9f" os_list="linux,windows,chromeos,android" file_path="net/dns/dns_transaction.cc" /> + <item id="dom_distiller" added_in_milestone="62" content_hash_code="0653c7f2" os_list="linux,windows,chromeos,android" file_path="components/dom_distiller/core/distiller_url_fetcher.cc" /> + <item id="domain_reliability_report_upload" added_in_milestone="62" content_hash_code="0223d254" os_list="linux,windows,chromeos,android" file_path="components/domain_reliability/uploader.cc" /> + <item id="domain_security_policy" added_in_milestone="62" content_hash_code="01d7c177" os_list="linux,windows,chromeos,android" file_path="services/network/network_context.cc" /> + <item id="download_internals_webui_source" added_in_milestone="66" content_hash_code="07b659d0" os_list="linux,windows,chromeos,android" file_path="chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc" /> + <item id="download_manager_resume" added_in_milestone="62" content_hash_code="0275159a" os_list="linux,windows,chromeos,android" file_path="components/download/internal/common/download_item_impl.cc" /> <item id="download_recovery_component" added_in_milestone="71" content_hash_code="00317d2f" os_list="windows" file_path="chrome/chrome_cleaner/components/recovery_component.cc" /> - <item id="download_web_contents_frame" added_in_milestone="62" content_hash_code="0037d0a1" os_list="linux,windows,chromeos" file_path="content/browser/web_contents/web_contents_impl.cc" /> + <item id="download_web_contents_frame" added_in_milestone="62" content_hash_code="0037d0a1" os_list="linux,windows,chromeos,android" file_path="content/browser/web_contents/web_contents_impl.cc" /> <item id="downloads_api_run_async" added_in_milestone="62" content_hash_code="008d9d92" os_list="linux,windows,chromeos" file_path="chrome/browser/extensions/api/downloads/downloads_api.cc" /> <item id="downloads_dom_handler" added_in_milestone="73" content_hash_code="082cc10b" os_list="linux,windows,chromeos" file_path="chrome/browser/ui/webui/downloads/downloads_dom_handler.cc" /> - <item id="drag_download_file" added_in_milestone="62" content_hash_code="078a20ba" os_list="linux,windows,chromeos" file_path="content/browser/download/drag_download_file.cc" /> + <item id="drag_download_file" added_in_milestone="62" content_hash_code="078a20ba" os_list="linux,windows,chromeos,android" file_path="content/browser/download/drag_download_file.cc" /> <item id="drive_service" added_in_milestone="90" content_hash_code="059e2023" os_list="linux,windows,chromeos" file_path="chrome/browser/new_tab_page/modules/drive/drive_service.cc" /> - <item id="early_hints_preload" added_in_milestone="91" content_hash_code="028fe27a" os_list="linux,windows,chromeos" file_path="content/browser/loader/navigation_early_hints_manager.cc" /> + <item id="early_hints_preload" added_in_milestone="91" content_hash_code="028fe27a" os_list="linux,windows,chromeos,android" file_path="content/browser/loader/navigation_early_hints_manager.cc" /> <item id="enterprise_safe_browsing_realtime_url_lookup" added_in_milestone="86" content_hash_code="00d66dca" os_list="linux,windows,chromeos" file_path="chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service.cc" /> - <item id="expect_ct_reporter" added_in_milestone="69" content_hash_code="07c7284e" os_list="linux,windows,chromeos" file_path="services/network/expect_ct_reporter.cc" /> + <item id="expect_ct_reporter" added_in_milestone="69" content_hash_code="07c7284e" os_list="linux,windows,chromeos,android" file_path="services/network/expect_ct_reporter.cc" /> <item id="extension_blacklist" added_in_milestone="62" content_hash_code="06f55974" os_list="linux,windows,chromeos" file_path="chrome/browser/extensions/blocklist_state_fetcher.cc" /> <item id="extension_crx_fetcher" added_in_milestone="62" content_hash_code="04b7bcef" os_list="linux,windows,chromeos" file_path="extensions/browser/updater/extension_downloader.cc" /> <item id="extension_install_signer" added_in_milestone="62" content_hash_code="065c4bce" os_list="linux,windows,chromeos" file_path="chrome/browser/extensions/install_signer.cc" /> <item id="extension_manifest_fetcher" added_in_milestone="62" content_hash_code="05983aa9" os_list="linux,windows,chromeos" file_path="extensions/browser/updater/extension_downloader.cc" /> <item id="external_policy_fetcher" added_in_milestone="62" content_hash_code="03d48984" os_list="linux,windows,chromeos" file_path="components/policy/core/common/cloud/external_policy_data_fetcher.cc" /> - <item id="favicon_loader" added_in_milestone="63" content_hash_code="0437e97c" os_list="linux,windows,chromeos" file_path="third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader.cc" /> + <item id="favicon_loader" added_in_milestone="63" content_hash_code="0437e97c" os_list="linux,windows,chromeos,android" file_path="third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader.cc" /> <item id="file_system_connector_to_box" added_in_milestone="89" type="partial" second_id="oauth2_api_call_flow" content_hash_code="02587cd7" os_list="linux,windows,chromeos" semantics_fields="1,2,3,4,5" policy_fields="-1,3,4" file_path="chrome/browser/enterprise/connectors/file_system/box_api_call_flow.cc" /> - <item id="floc_event_logger" added_in_milestone="89" type="partial" second_id="floc_remote_permission_service" content_hash_code="040df9ca" os_list="linux,windows,chromeos" semantics_fields="2,3,4" policy_fields="3" file_path="chrome/browser/federated_learning/floc_event_logger.cc" /> - <item id="floc_remote_permission_service" added_in_milestone="85" type="completing" content_hash_code="0524bc76" os_list="linux,windows,chromeos" semantics_fields="1,5" policy_fields="1,2,4" file_path="chrome/browser/federated_learning/floc_remote_permission_service.cc" /> - <item id="ftl_messaging_client_ack_messages" added_in_milestone="86" content_hash_code="013f1ddb" os_list="linux,windows,chromeos" file_path="remoting/signaling/ftl_messaging_client.cc" /> - <item id="ftl_messaging_client_receive_messages" added_in_milestone="86" content_hash_code="022e9c77" os_list="linux,windows,chromeos" file_path="remoting/signaling/ftl_messaging_client.cc" /> - <item id="ftl_messaging_client_send_messages" added_in_milestone="86" content_hash_code="006864f3" os_list="linux,windows,chromeos" file_path="remoting/signaling/ftl_messaging_client.cc" /> - <item id="ftl_registration_manager" added_in_milestone="86" content_hash_code="00bff9a1" os_list="linux,windows,chromeos" file_path="remoting/signaling/ftl_registration_manager.cc" /> - <item id="gaia_auth_check_connection_info" added_in_milestone="62" content_hash_code="036b0bb8" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_exchange_device_id" added_in_milestone="62" content_hash_code="03afe09b" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_fetch_for_uber" added_in_milestone="62" content_hash_code="01ab5779" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_get_user_info" added_in_milestone="62" content_hash_code="0047a3e9" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_list_accounts" added_in_milestone="62" content_hash_code="0595471e" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_log_out" added_in_milestone="62" content_hash_code="056ee739" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_login" added_in_milestone="62" content_hash_code="06aba27c" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_merge_sessions" added_in_milestone="62" content_hash_code="01d03b23" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_multilogin" added_in_milestone="70" content_hash_code="04a2142a" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_revoke_token" added_in_milestone="62" content_hash_code="05c2fef2" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_cookie_manager_external_cc_result" added_in_milestone="62" content_hash_code="01dbe597" os_list="linux,windows,chromeos" file_path="components/signin/internal/identity_manager/gaia_cookie_manager_service.cc" /> - <item id="gaia_create_reauth_proof_token_for_parent" added_in_milestone="80" content_hash_code="062b4b5c" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_oauth_client_get_account_capabilities" added_in_milestone="93" content_hash_code="030c6c8d" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_oauth_client.cc" /> - <item id="gaia_oauth_client_get_token_info" added_in_milestone="62" content_hash_code="07a34ff2" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_oauth_client.cc" /> - <item id="gaia_oauth_client_get_tokens" added_in_milestone="62" content_hash_code="00b89e68" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_oauth_client.cc" /> - <item id="gaia_oauth_client_get_user_info" added_in_milestone="62" content_hash_code="02187bdf" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_oauth_client.cc" /> - <item id="gaia_oauth_client_refresh_token" added_in_milestone="62" content_hash_code="015459e4" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_oauth_client.cc" /> - <item id="gcm_checkin" added_in_milestone="62" content_hash_code="05db527b" os_list="linux,windows,chromeos" file_path="google_apis/gcm/engine/checkin_request.cc" /> - <item id="gcm_connection_factory" added_in_milestone="66" content_hash_code="047caddb" os_list="linux,windows,chromeos" file_path="google_apis/gcm/engine/connection_factory_impl.cc" /> - <item id="gcm_registration" added_in_milestone="62" content_hash_code="06c679e8" os_list="linux,windows,chromeos" file_path="google_apis/gcm/engine/registration_request.cc" /> - <item id="gcm_unregistration" added_in_milestone="62" content_hash_code="01cbf67f" os_list="linux,windows,chromeos" file_path="google_apis/gcm/engine/unregistration_request.cc" /> - <item id="geo_language_provider" added_in_milestone="65" type="partial" second_id="network_location_request" content_hash_code="03e4d160" os_list="linux,windows,chromeos" semantics_fields="1" policy_fields="3,4" file_path="components/language/content/browser/geo_language_provider.cc" /> + <item id="floc_event_logger" added_in_milestone="89" type="partial" second_id="floc_remote_permission_service" content_hash_code="040df9ca" os_list="linux,windows,chromeos,android" semantics_fields="2,3,4" policy_fields="3" file_path="chrome/browser/federated_learning/floc_event_logger.cc" /> + <item id="floc_remote_permission_service" added_in_milestone="85" type="completing" content_hash_code="0524bc76" os_list="linux,windows,chromeos,android" semantics_fields="1,5" policy_fields="1,2,4" file_path="chrome/browser/federated_learning/floc_remote_permission_service.cc" /> + <item id="ftl_messaging_client_ack_messages" added_in_milestone="86" content_hash_code="013f1ddb" os_list="linux,windows,chromeos,android" file_path="remoting/signaling/ftl_messaging_client.cc" /> + <item id="ftl_messaging_client_receive_messages" added_in_milestone="86" content_hash_code="022e9c77" os_list="linux,windows,chromeos,android" file_path="remoting/signaling/ftl_messaging_client.cc" /> + <item id="ftl_messaging_client_send_messages" added_in_milestone="86" content_hash_code="006864f3" os_list="linux,windows,chromeos,android" file_path="remoting/signaling/ftl_messaging_client.cc" /> + <item id="ftl_registration_manager" added_in_milestone="86" content_hash_code="00bff9a1" os_list="linux,windows,chromeos,android" file_path="remoting/signaling/ftl_registration_manager.cc" /> + <item id="gaia_auth_check_connection_info" added_in_milestone="62" content_hash_code="036b0bb8" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> + <item id="gaia_auth_exchange_device_id" added_in_milestone="62" content_hash_code="03afe09b" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> + <item id="gaia_auth_fetch_for_uber" added_in_milestone="62" content_hash_code="01ab5779" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> + <item id="gaia_auth_get_user_info" added_in_milestone="62" content_hash_code="0047a3e9" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> + <item id="gaia_auth_list_accounts" added_in_milestone="62" content_hash_code="0595471e" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> + <item id="gaia_auth_log_out" added_in_milestone="62" content_hash_code="056ee739" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> + <item id="gaia_auth_login" added_in_milestone="62" content_hash_code="06aba27c" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> + <item id="gaia_auth_merge_sessions" added_in_milestone="62" content_hash_code="01d03b23" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> + <item id="gaia_auth_multilogin" added_in_milestone="70" content_hash_code="04a2142a" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> + <item id="gaia_auth_revoke_token" added_in_milestone="62" content_hash_code="05c2fef2" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> + <item id="gaia_cookie_manager_external_cc_result" added_in_milestone="62" content_hash_code="01dbe597" os_list="linux,windows,chromeos,android" file_path="components/signin/internal/identity_manager/gaia_cookie_manager_service.cc" /> + <item id="gaia_create_reauth_proof_token_for_parent" added_in_milestone="80" content_hash_code="062b4b5c" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> + <item id="gaia_oauth_client_get_account_capabilities" added_in_milestone="93" content_hash_code="030c6c8d" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_oauth_client.cc" /> + <item id="gaia_oauth_client_get_token_info" added_in_milestone="62" content_hash_code="07a34ff2" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_oauth_client.cc" /> + <item id="gaia_oauth_client_get_tokens" added_in_milestone="62" content_hash_code="00b89e68" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_oauth_client.cc" /> + <item id="gaia_oauth_client_get_user_info" added_in_milestone="62" content_hash_code="02187bdf" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_oauth_client.cc" /> + <item id="gaia_oauth_client_refresh_token" added_in_milestone="62" content_hash_code="015459e4" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_oauth_client.cc" /> + <item id="gcm_checkin" added_in_milestone="62" content_hash_code="05db527b" os_list="linux,windows,chromeos,android" file_path="google_apis/gcm/engine/checkin_request.cc" /> + <item id="gcm_connection_factory" added_in_milestone="66" content_hash_code="047caddb" os_list="linux,windows,chromeos,android" file_path="google_apis/gcm/engine/connection_factory_impl.cc" /> + <item id="gcm_registration" added_in_milestone="62" content_hash_code="06c679e8" os_list="linux,windows,chromeos,android" file_path="google_apis/gcm/engine/registration_request.cc" /> + <item id="gcm_unregistration" added_in_milestone="62" content_hash_code="01cbf67f" os_list="linux,windows,chromeos,android" file_path="google_apis/gcm/engine/unregistration_request.cc" /> + <item id="geo_language_provider" added_in_milestone="65" type="partial" second_id="network_location_request" content_hash_code="03e4d160" os_list="linux,windows,chromeos,android" semantics_fields="1" policy_fields="3,4" file_path="components/language/content/browser/geo_language_provider.cc" /> <item id="heartbeat_sender" added_in_milestone="86" content_hash_code="07dd0efd" os_list="linux,windows,chromeos" file_path="remoting/host/heartbeat_sender.cc" /> - <item id="hintsfetcher_gethintsrequest" added_in_milestone="75" content_hash_code="0365cd74" os_list="linux,windows,chromeos" file_path="components/optimization_guide/core/hints_fetcher.cc" /> - <item id="history_notice_utils_notice" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="07cc4c62" os_list="linux,windows,chromeos" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/history_notice_utils.cc" /> - <item id="history_notice_utils_popup" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="01d3338e" os_list="linux,windows,chromeos" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/history_notice_utils.cc" /> - <item id="history_ui_favicon_request_handler_get_favicon" added_in_milestone="77" content_hash_code="03d16565" os_list="linux,windows,chromeos" file_path="components/favicon/core/history_ui_favicon_request_handler_impl.cc" /> - <item id="http_server_error_response" added_in_milestone="66" content_hash_code="03a40a76" os_list="linux,windows,chromeos" file_path="net/server/http_server.cc" /> - <item id="icon_cacher" added_in_milestone="62" content_hash_code="06efa3dc" os_list="linux,windows,chromeos" file_path="components/ntp_tiles/icon_cacher_impl.cc" /> - <item id="icon_catcher_get_large_icon" added_in_milestone="62" content_hash_code="05db5c15" os_list="linux,windows,chromeos" file_path="components/ntp_tiles/icon_cacher_impl.cc" /> - <item id="image_annotation" added_in_milestone="73" content_hash_code="048b2d66" os_list="linux,windows,chromeos" file_path="services/image_annotation/annotator.cc" /> - <item id="indexed_db_internals_handler" added_in_milestone="62" content_hash_code="0384abe6" os_list="linux,windows,chromeos" file_path="content/browser/indexed_db/indexed_db_internals_ui.cc" /> - <item id="interest_feedv2_image_send" added_in_milestone="86" content_hash_code="06687258" os_list="linux,windows,chromeos" file_path="components/feed/core/v2/image_fetcher.cc" /> - <item id="interest_feedv2_send" added_in_milestone="83" content_hash_code="02f676af" os_list="linux,windows,chromeos" file_path="components/feed/core/v2/feed_network_impl.cc" /> - <item id="interest_group_update_fetcher" added_in_milestone="94" content_hash_code="0272b26d" os_list="linux,windows,chromeos" file_path="content/browser/interest_group/interest_group_manager.cc" /> + <item id="hintsfetcher_gethintsrequest" added_in_milestone="75" content_hash_code="0365cd74" os_list="linux,windows,chromeos,android" file_path="components/optimization_guide/core/hints_fetcher.cc" /> + <item id="history_notice_utils_notice" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="07cc4c62" os_list="linux,windows,chromeos,android" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/history_notice_utils.cc" /> + <item id="history_notice_utils_popup" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="01d3338e" os_list="linux,windows,chromeos,android" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/history_notice_utils.cc" /> + <item id="history_ui_favicon_request_handler_get_favicon" added_in_milestone="77" content_hash_code="03d16565" os_list="linux,windows,chromeos,android" file_path="components/favicon/core/history_ui_favicon_request_handler_impl.cc" /> + <item id="http_server_error_response" added_in_milestone="66" content_hash_code="03a40a76" os_list="linux,windows,chromeos,android" file_path="net/server/http_server.cc" /> + <item id="icon_cacher" added_in_milestone="62" content_hash_code="06efa3dc" os_list="linux,windows,chromeos,android" file_path="components/ntp_tiles/icon_cacher_impl.cc" /> + <item id="icon_catcher_get_large_icon" added_in_milestone="62" content_hash_code="05db5c15" os_list="linux,windows,chromeos,android" file_path="components/ntp_tiles/icon_cacher_impl.cc" /> + <item id="image_annotation" added_in_milestone="73" content_hash_code="048b2d66" os_list="linux,windows,chromeos,android" file_path="services/image_annotation/annotator.cc" /> + <item id="indexed_db_internals_handler" added_in_milestone="62" content_hash_code="0384abe6" os_list="linux,windows,chromeos,android" file_path="content/browser/indexed_db/indexed_db_internals_ui.cc" /> + <item id="interest_feedv2_image_send" added_in_milestone="86" content_hash_code="06687258" os_list="linux,windows,chromeos,android" file_path="components/feed/core/v2/image_fetcher.cc" /> + <item id="interest_feedv2_send" added_in_milestone="83" content_hash_code="02f676af" os_list="linux,windows,chromeos,android" file_path="components/feed/core/v2/feed_network_impl.cc" /> + <item id="interest_group_update_fetcher" added_in_milestone="94" content_hash_code="0272b26d" os_list="linux,windows,chromeos,android" file_path="content/browser/interest_group/interest_group_manager.cc" /> <item id="intranet_redirect_detector" added_in_milestone="62" content_hash_code="03b26f7b" os_list="linux,windows,chromeos" file_path="chrome/browser/intranet_redirect_detector.cc" /> <item id="javascript_report_error" added_in_milestone="87" content_hash_code="006e4e54" os_list="linux" file_path="chrome/browser/error_reporting/chrome_js_error_report_processor_nonchromeos.cc" /> - <item id="lib_address_input" added_in_milestone="62" content_hash_code="0374aae8" os_list="linux,windows,chromeos" file_path="third_party/libaddressinput/chromium/chrome_metadata_source.cc" /> - <item id="litepages_robots_rules" added_in_milestone="89" content_hash_code="04534928" os_list="linux,windows,chromeos" file_path="chrome/browser/subresource_redirect/origin_robots_rules.cc" /> - <item id="load_autofill_gstatic_data" added_in_milestone="78" content_hash_code="07a1e952" os_list="linux,windows,chromeos" file_path="chrome/browser/autofill/autofill_gstatic_reader.cc" /> - <item id="logo_service" added_in_milestone="73" content_hash_code="013550c3" os_list="linux,windows,chromeos" file_path="components/search_provider_logos/logo_service_impl.cc" /> - <item id="lookup_single_password_leak" added_in_milestone="78" content_hash_code="00b98558" os_list="linux,windows,chromeos" file_path="components/password_manager/core/browser/leak_detection/leak_detection_request.cc" /> + <item id="lib_address_input" added_in_milestone="62" content_hash_code="0374aae8" os_list="linux,windows,chromeos,android" file_path="third_party/libaddressinput/chromium/chrome_metadata_source.cc" /> + <item id="litepages_robots_rules" added_in_milestone="89" content_hash_code="04534928" os_list="linux,windows,chromeos,android" file_path="chrome/browser/subresource_redirect/origin_robots_rules.cc" /> + <item id="load_autofill_gstatic_data" added_in_milestone="78" content_hash_code="07a1e952" os_list="linux,windows,chromeos,android" file_path="chrome/browser/autofill/autofill_gstatic_reader.cc" /> + <item id="logo_service" added_in_milestone="73" content_hash_code="013550c3" os_list="linux,windows,chromeos,android" file_path="components/search_provider_logos/logo_service_impl.cc" /> + <item id="lookup_single_password_leak" added_in_milestone="78" content_hash_code="00b98558" os_list="linux,windows,chromeos,android" file_path="components/password_manager/core/browser/leak_detection/leak_detection_request.cc" /> <item id="managed_configuration_loader" added_in_milestone="89" content_hash_code="060dc999" os_list="linux,windows,chromeos" file_path="chrome/browser/device_api/managed_configuration_api.cc" /> <item id="media_router_global_media_controls_image" added_in_milestone="81" content_hash_code="02e96911" os_list="linux,windows,chromeos" file_path="chrome/browser/ui/global_media_controls/cast_media_notification_item.cc" /> - <item id="memories_remote_model_request" added_in_milestone="90" content_hash_code="032cf1fe" os_list="linux,windows,chromeos" file_path="components/history_clusters/core/remote_clustering_backend.cc" /> - <item id="metrics_report_ukm" added_in_milestone="62" content_hash_code="008577eb" os_list="linux,windows,chromeos" file_path="components/metrics/net/net_metrics_log_uploader.cc" /> - <item id="metrics_report_uma" added_in_milestone="62" content_hash_code="009b46c5" os_list="linux,windows,chromeos" file_path="components/metrics/net/net_metrics_log_uploader.cc" /> - <item id="mirroring_get_setup_info" added_in_milestone="68" content_hash_code="03dd5ef2" os_list="windows,linux,chromeos" file_path="components/mirroring/service/receiver_setup_querier.cc" /> + <item id="metrics_report_ukm" added_in_milestone="62" content_hash_code="008577eb" os_list="linux,windows,chromeos,android" file_path="components/metrics/net/net_metrics_log_uploader.cc" /> + <item id="metrics_report_uma" added_in_milestone="62" content_hash_code="009b46c5" os_list="linux,windows,chromeos,android" file_path="components/metrics/net/net_metrics_log_uploader.cc" /> + <item id="mirroring_get_setup_info" added_in_milestone="68" content_hash_code="03dd5ef2" os_list="windows,linux,chromeos,android" file_path="components/mirroring/service/receiver_setup_querier.cc" /> <item id="missing" added_in_milestone="62" reserved="1" os_list="linux,windows" file_path="" /> - <item id="navigation_predictor_srp_prefetch" added_in_milestone="81" content_hash_code="025036ba" os_list="linux,windows,chromeos" file_path="chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper.cc" /> - <item id="navigation_url_loader" added_in_milestone="62" content_hash_code="07b5c4cb" os_list="linux,windows,chromeos" file_path="content/browser/loader/navigation_url_loader_impl.cc" /> + <item id="navigation_predictor_srp_prefetch" added_in_milestone="81" content_hash_code="025036ba" os_list="linux,windows,chromeos,android" file_path="chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper.cc" /> + <item id="navigation_url_loader" added_in_milestone="62" content_hash_code="07b5c4cb" os_list="linux,windows,chromeos,android" file_path="content/browser/loader/navigation_url_loader_impl.cc" /> <item id="network_location_provider" added_in_milestone="64" type="partial" second_id="network_location_request" content_hash_code="0272f3e8" os_list="linux,windows,chromeos" semantics_fields="1" policy_fields="3,4" file_path="services/device/geolocation/network_location_provider.cc" /> - <item id="network_location_request" added_in_milestone="65" type="completing" content_hash_code="04d00293" os_list="linux,windows,chromeos" semantics_fields="2,3,4,5" policy_fields="-1" file_path="services/device/geolocation/network_location_request.cc" /> - <item id="network_time_component" added_in_milestone="62" content_hash_code="01ac0991" os_list="linux,windows,chromeos" file_path="components/network_time/network_time_tracker.cc" /> + <item id="network_location_request" added_in_milestone="65" type="completing" content_hash_code="04d00293" os_list="linux,windows,chromeos,android" semantics_fields="2,3,4,5" policy_fields="-1" file_path="services/device/geolocation/network_location_request.cc" /> + <item id="network_time_component" added_in_milestone="62" content_hash_code="01ac0991" os_list="linux,windows,chromeos,android" file_path="components/network_time/network_time_tracker.cc" /> <item id="new_tab_page_handler" added_in_milestone="84" content_hash_code="02ee5881" os_list="linux,windows,chromeos" file_path="chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc" /> - <item id="notification_client" added_in_milestone="79" content_hash_code="07bdb896" os_list="linux,windows,chromeos" file_path="remoting/client/notification/notification_client.cc" /> - <item id="ntp_snippets_fetch" added_in_milestone="62" content_hash_code="0099caef" os_list="linux,windows,chromeos" file_path="components/ntp_snippets/remote/json_request.cc" /> + <item id="notification_client" added_in_milestone="79" content_hash_code="07bdb896" os_list="linux,windows,chromeos,android" file_path="remoting/client/notification/notification_client.cc" /> + <item id="ntp_snippets_fetch" added_in_milestone="62" content_hash_code="0099caef" os_list="linux,windows,chromeos,android" file_path="components/ntp_snippets/remote/json_request.cc" /> <item id="nux_ntp_background_preview" added_in_milestone="74" content_hash_code="01df3270" os_list="linux,windows" file_path="chrome/browser/ui/webui/welcome/ntp_background_fetcher.cc" /> - <item id="oauth2_access_token_fetcher" added_in_milestone="62" content_hash_code="01ff32b0" os_list="linux,windows,chromeos" file_path="google_apis/gaia/gaia_access_token_fetcher.cc" /> - <item id="oauth2_api_call_flow" added_in_milestone="65" type="completing" content_hash_code="067ca204" os_list="linux,windows,chromeos" policy_fields="-1" file_path="google_apis/gaia/oauth2_api_call_flow.cc" /> - <item id="oauth2_mint_token_flow" added_in_milestone="62" type="partial" second_id="oauth2_api_call_flow" content_hash_code="05756bf8" os_list="linux,windows,chromeos" semantics_fields="1,2,3,4,5" policy_fields="3,4" file_path="google_apis/gaia/oauth2_mint_token_flow.cc" /> - <item id="offline_prefetch" added_in_milestone="62" content_hash_code="06ad9616" os_list="linux,windows,chromeos" file_path="components/offline_pages/core/prefetch/prefetch_request_fetcher.cc" /> - <item id="omnibox_documentsuggest" added_in_milestone="69" content_hash_code="07917541" os_list="linux,windows,chromeos" file_path="components/omnibox/browser/document_suggestions_service.cc" /> + <item id="oauth2_access_token_fetcher" added_in_milestone="62" content_hash_code="01ff32b0" os_list="linux,windows,chromeos,android" file_path="google_apis/gaia/gaia_access_token_fetcher.cc" /> + <item id="oauth2_api_call_flow" added_in_milestone="65" type="completing" content_hash_code="067ca204" os_list="linux,windows,chromeos,android" policy_fields="-1" file_path="google_apis/gaia/oauth2_api_call_flow.cc" /> + <item id="oauth2_mint_token_flow" added_in_milestone="62" type="partial" second_id="oauth2_api_call_flow" content_hash_code="05756bf8" os_list="linux,windows,chromeos,android" semantics_fields="1,2,3,4,5" policy_fields="3,4" file_path="google_apis/gaia/oauth2_mint_token_flow.cc" /> + <item id="offline_prefetch" added_in_milestone="62" content_hash_code="06ad9616" os_list="linux,windows,chromeos,android" file_path="components/offline_pages/core/prefetch/prefetch_request_fetcher.cc" /> + <item id="omnibox_documentsuggest" added_in_milestone="69" content_hash_code="07917541" os_list="linux,windows,chromeos,android" file_path="components/omnibox/browser/document_suggestions_service.cc" /> <item id="omnibox_navigation_observer" added_in_milestone="62" content_hash_code="043a7a2f" os_list="linux,windows,chromeos" file_path="chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc" /> - <item id="omnibox_result_change" added_in_milestone="62" content_hash_code="017a7557" os_list="linux,windows,chromeos" file_path="chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc" /> - <item id="omnibox_suggest" added_in_milestone="62" content_hash_code="0524cc7e" os_list="linux,windows,chromeos" file_path="components/omnibox/browser/search_provider.cc" /> - <item id="omnibox_suggest_deletion" added_in_milestone="62" content_hash_code="017d302e" os_list="linux,windows,chromeos" file_path="components/omnibox/browser/base_search_provider.cc" /> - <item id="omnibox_zerosuggest" added_in_milestone="62" content_hash_code="071e32e9" os_list="linux,windows,chromeos" file_path="components/omnibox/browser/remote_suggestions_service.cc" /> + <item id="omnibox_result_change" added_in_milestone="62" content_hash_code="017a7557" os_list="linux,windows,chromeos,android" file_path="chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc" /> + <item id="omnibox_suggest" added_in_milestone="62" content_hash_code="0524cc7e" os_list="linux,windows,chromeos,android" file_path="components/omnibox/browser/search_provider.cc" /> + <item id="omnibox_suggest_deletion" added_in_milestone="62" content_hash_code="017d302e" os_list="linux,windows,chromeos,android" file_path="components/omnibox/browser/base_search_provider.cc" /> + <item id="omnibox_zerosuggest" added_in_milestone="62" content_hash_code="071e32e9" os_list="linux,windows,chromeos,android" file_path="components/omnibox/browser/remote_suggestions_service.cc" /> <item id="one_google_bar_service" added_in_milestone="62" content_hash_code="02c5f314" os_list="linux,windows,chromeos" file_path="chrome/browser/new_tab_page/one_google_bar/one_google_bar_loader_impl.cc" /> - <item id="open_search" added_in_milestone="62" content_hash_code="04f2de86" os_list="linux,windows,chromeos" file_path="components/search_engines/template_url_fetcher.cc" /> - <item id="openscreen_message" added_in_milestone="83" content_hash_code="076a1faf" os_list="linux,windows,chromeos" file_path="components/openscreen_platform/udp_socket.cc" /> - <item id="openscreen_tls_message" added_in_milestone="83" content_hash_code="00f4022a" os_list="linux,windows,chromeos" file_path="components/openscreen_platform/tls_connection_factory.cc" /> - <item id="optimization_guide_model" added_in_milestone="79" content_hash_code="01ee6e67" os_list="linux,windows,chromeos" file_path="components/optimization_guide/core/prediction_model_fetcher_impl.cc" /> - <item id="optimization_guide_model_download" added_in_milestone="88" content_hash_code="05d71d9b" os_list="linux,windows,chromeos" file_path="chrome/browser/optimization_guide/prediction/prediction_model_download_manager.cc" /> - <item id="origin_policy_loader" added_in_milestone="69" content_hash_code="07fd1eaf" os_list="linux,windows,chromeos" file_path="services/network/origin_policy/origin_policy_fetcher.cc" /> - <item id="parallel_download_job" added_in_milestone="62" content_hash_code="064736f3" os_list="linux,windows,chromeos" file_path="components/download/internal/common/parallel_download_job.cc" /> - <item id="password_protection_request" added_in_milestone="62" content_hash_code="01869413" os_list="linux,windows,chromeos" file_path="components/safe_browsing/core/browser/password_protection/password_protection_request.cc" /> - <item id="password_requirements_spec_fetch" added_in_milestone="69" content_hash_code="005550dc" os_list="linux,windows,chromeos" file_path="components/password_manager/core/browser/generation/password_requirements_spec_fetcher_impl.cc" /> - <item id="payment_manifest_downloader" added_in_milestone="62" content_hash_code="01266484" os_list="linux,windows,chromeos" file_path="components/payments/core/payment_manifest_downloader.cc" /> - <item id="payments_sync_cards" added_in_milestone="62" content_hash_code="035e86b1" os_list="linux,windows,chromeos" file_path="components/autofill/core/browser/payments/payments_client.cc" /> + <item id="open_search" added_in_milestone="62" content_hash_code="04f2de86" os_list="linux,windows,chromeos,android" file_path="components/search_engines/template_url_fetcher.cc" /> + <item id="openscreen_message" added_in_milestone="83" content_hash_code="076a1faf" os_list="linux,windows,chromeos,android" file_path="components/openscreen_platform/udp_socket.cc" /> + <item id="openscreen_tls_message" added_in_milestone="83" content_hash_code="00f4022a" os_list="linux,windows,chromeos,android" file_path="components/openscreen_platform/tls_connection_factory.cc" /> + <item id="optimization_guide_model" added_in_milestone="79" content_hash_code="01ee6e67" os_list="linux,windows,chromeos,android" file_path="components/optimization_guide/core/prediction_model_fetcher_impl.cc" /> + <item id="optimization_guide_model_download" added_in_milestone="88" content_hash_code="05d71d9b" os_list="linux,windows,chromeos,android" file_path="chrome/browser/optimization_guide/prediction/prediction_model_download_manager.cc" /> + <item id="origin_policy_loader" added_in_milestone="69" content_hash_code="07fd1eaf" os_list="linux,windows,chromeos,android" file_path="services/network/origin_policy/origin_policy_fetcher.cc" /> + <item id="parallel_download_job" added_in_milestone="62" content_hash_code="064736f3" os_list="linux,windows,chromeos,android" file_path="components/download/internal/common/parallel_download_job.cc" /> + <item id="password_protection_request" added_in_milestone="62" content_hash_code="01869413" os_list="linux,windows,chromeos,android" file_path="components/safe_browsing/core/browser/password_protection/password_protection_request.cc" /> + <item id="password_requirements_spec_fetch" added_in_milestone="69" content_hash_code="005550dc" os_list="linux,windows,chromeos,android" file_path="components/password_manager/core/browser/generation/password_requirements_spec_fetcher_impl.cc" /> + <item id="payment_manifest_downloader" added_in_milestone="62" content_hash_code="01266484" os_list="linux,windows,chromeos,android" file_path="components/payments/core/payment_manifest_downloader.cc" /> + <item id="payments_sync_cards" added_in_milestone="62" content_hash_code="035e86b1" os_list="linux,windows,chromeos,android" file_path="components/autofill/core/browser/payments/payments_client.cc" /> <item id="pdf_plugin_placeholder" added_in_milestone="63" content_hash_code="0101fbd5" os_list="linux,windows,chromeos" file_path="chrome/browser/plugins/plugin_observer.cc" /> <item id="pepper_tcp_socket" added_in_milestone="65" content_hash_code="01a37664" os_list="linux,windows,chromeos" file_path="content/browser/renderer_host/pepper/pepper_socket_utils.cc" /> <item id="pepper_udp_socket" added_in_milestone="70" content_hash_code="006ee842" os_list="linux,windows,chromeos" file_path="content/browser/renderer_host/pepper/pepper_socket_utils.cc" /> - <item id="per_user_topic_registration_request" added_in_milestone="68" content_hash_code="0367425f" os_list="linux,windows,chromeos" file_path="components/invalidation/impl/per_user_topic_subscription_request.cc" /> - <item id="permission_predictions" added_in_milestone="88" content_hash_code="0556d9f7" os_list="linux,windows,chromeos" file_path="components/permissions/prediction_service/prediction_service.cc" /> + <item id="per_user_topic_registration_request" added_in_milestone="68" content_hash_code="0367425f" os_list="linux,windows,chromeos,android" file_path="components/invalidation/impl/per_user_topic_subscription_request.cc" /> + <item id="permission_predictions" added_in_milestone="88" content_hash_code="0556d9f7" os_list="linux,windows,chromeos,android" file_path="components/permissions/prediction_service/prediction_service.cc" /> <item id="photos_service" added_in_milestone="94" content_hash_code="0573af72" os_list="linux,windows,chromeos" file_path="chrome/browser/new_tab_page/modules/photos/photos_service.cc" /> <item id="plugins_resource_service" added_in_milestone="62" content_hash_code="0068f097" os_list="linux,windows,chromeos" file_path="chrome/browser/plugins/plugins_resource_service.cc" /> - <item id="popular_sites_fetch" added_in_milestone="62" content_hash_code="00697083" os_list="linux,windows,chromeos" file_path="components/ntp_tiles/popular_sites_impl.cc" /> + <item id="popular_sites_fetch" added_in_milestone="62" content_hash_code="00697083" os_list="linux,windows,chromeos,android" file_path="components/ntp_tiles/popular_sites_impl.cc" /> <item id="port_forwarding_controller_socket" added_in_milestone="65" content_hash_code="074810e4" os_list="linux,windows,chromeos" file_path="chrome/browser/devtools/device/port_forwarding_controller.cc" /> <item id="ppapi_download_request" added_in_milestone="62" content_hash_code="07d4e067" os_list="linux,windows,chromeos" file_path="chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc" /> - <item id="predictive_prefetch" added_in_milestone="85" content_hash_code="01acbb76" os_list="linux,windows,chromeos" file_path="chrome/browser/predictors/prefetch_manager.cc" /> - <item id="prefetch_download" added_in_milestone="62" content_hash_code="0146e99e" os_list="linux,windows,chromeos" file_path="components/offline_pages/core/prefetch/prefetch_downloader_impl.cc" /> - <item id="prefetch_proxy_canary_check" added_in_milestone="88" content_hash_code="0329567f" os_list="linux,windows,chromeos" file_path="chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_prober.cc" /> - <item id="prefetch_proxy_probe" added_in_milestone="88" content_hash_code="001d245d" os_list="linux,windows,chromeos" file_path="chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_prober.cc" /> - <item id="prefetch_visuals" added_in_milestone="75" content_hash_code="0564010a" os_list="linux,windows,chromeos" file_path="components/offline_pages/core/prefetch/visuals_fetch_by_url.cc" /> + <item id="predictive_prefetch" added_in_milestone="85" content_hash_code="01acbb76" os_list="linux,windows,chromeos,android" file_path="chrome/browser/predictors/prefetch_manager.cc" /> + <item id="prefetch_download" added_in_milestone="62" content_hash_code="0146e99e" os_list="linux,windows,chromeos,android" file_path="components/offline_pages/core/prefetch/prefetch_downloader_impl.cc" /> + <item id="prefetch_proxy_canary_check" added_in_milestone="88" content_hash_code="0329567f" os_list="linux,windows,chromeos,android" file_path="chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_prober.cc" /> + <item id="prefetch_proxy_probe" added_in_milestone="88" content_hash_code="001d245d" os_list="linux,windows,chromeos,android" file_path="chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_prober.cc" /> + <item id="prefetch_visuals" added_in_milestone="75" content_hash_code="0564010a" os_list="linux,windows,chromeos,android" file_path="components/offline_pages/core/prefetch/visuals_fetch_by_url.cc" /> <item id="printer_job_handler" added_in_milestone="62" type="partial" second_id="cloud_print" content_hash_code="048348b5" os_list="linux,windows" semantics_fields="2,3,4" file_path="chrome/service/cloud_print/printer_job_handler.cc" /> - <item id="profile_avatar" added_in_milestone="62" content_hash_code="06c4a5fd" os_list="linux,windows,chromeos" file_path="chrome/browser/profiles/profile_avatar_downloader.cc" /> + <item id="profile_avatar" added_in_milestone="62" content_hash_code="06c4a5fd" os_list="linux,windows,chromeos,android" file_path="chrome/browser/profiles/profile_avatar_downloader.cc" /> <item id="profile_resetter_upload" added_in_milestone="62" content_hash_code="07b56813" os_list="linux,windows,chromeos" file_path="chrome/browser/profile_resetter/reset_report_uploader.cc" /> <item id="promo_service" added_in_milestone="72" content_hash_code="01f69c19" os_list="linux,windows,chromeos" file_path="chrome/browser/new_tab_page/promos/promo_service.cc" /> - <item id="proxy_config_direct" added_in_milestone="67" content_hash_code="072602b0" os_list="linux,windows,chromeos" file_path="net/proxy_resolution/proxy_config_with_annotation.cc" /> + <item id="proxy_config_direct" added_in_milestone="67" content_hash_code="072602b0" os_list="linux,windows,chromeos,android" file_path="net/proxy_resolution/proxy_config_with_annotation.cc" /> <item id="proxy_config_headless" added_in_milestone="67" content_hash_code="049def4d" os_list="linux,windows,chromeos" file_path="headless/lib/browser/headless_request_context_manager.cc" /> - <item id="proxy_config_settings" added_in_milestone="67" content_hash_code="0129f6d1" os_list="linux,windows,chromeos" file_path="components/proxy_config/pref_proxy_config_tracker_impl.cc" /> - <item id="proxy_config_system" added_in_milestone="67" content_hash_code="0497cf89" os_list="linux,windows,chromeos" file_path="net/proxy_resolution/configured_proxy_resolution_service.cc" /> + <item id="proxy_config_settings" added_in_milestone="67" content_hash_code="0129f6d1" os_list="linux,windows,chromeos,android" file_path="components/proxy_config/pref_proxy_config_tracker_impl.cc" /> + <item id="proxy_config_system" added_in_milestone="67" content_hash_code="0497cf89" os_list="linux,windows,chromeos,android" file_path="net/proxy_resolution/configured_proxy_resolution_service.cc" /> <item id="proxy_config_windows_resolver" added_in_milestone="86" content_hash_code="075530ef" os_list="windows" file_path="net/proxy_resolution/win/windows_system_proxy_resolution_request.cc" /> <item id="qr_code_save" added_in_milestone="84" content_hash_code="045593bd" os_list="linux,windows,chromeos" file_path="chrome/browser/ui/views/qrcode_generator/qrcode_generator_bubble.cc" /> - <item id="query_tiles_fetcher" added_in_milestone="84" content_hash_code="0100b835" os_list="linux,windows,chromeos" file_path="components/query_tiles/internal/tile_fetcher.cc" /> - <item id="query_tiles_image_loader" added_in_milestone="83" content_hash_code="04797c4a" os_list="linux,windows,chromeos" file_path="components/query_tiles/internal/cached_image_loader.cc" /> - <item id="quic_chromium_incoming_pending_session" added_in_milestone="73" content_hash_code="032742d9" os_list="linux,windows,chromeos" file_path="net/quic/quic_chromium_client_session.cc" /> - <item id="quic_chromium_incoming_session" added_in_milestone="66" content_hash_code="04aeee25" os_list="linux,windows,chromeos" file_path="net/quic/quic_chromium_client_session.cc" /> - <item id="quic_chromium_packet_writer" added_in_milestone="66" content_hash_code="01c48aa5" os_list="linux,windows,chromeos" file_path="net/quic/quic_chromium_packet_writer.cc" /> - <item id="ranker_url_fetcher" added_in_milestone="62" content_hash_code="02bd45e2" os_list="linux,windows,chromeos" file_path="components/assist_ranker/ranker_url_fetcher.cc" /> + <item id="query_tiles_fetcher" added_in_milestone="84" content_hash_code="0100b835" os_list="linux,windows,chromeos,android" file_path="components/query_tiles/internal/tile_fetcher.cc" /> + <item id="query_tiles_image_loader" added_in_milestone="83" content_hash_code="04797c4a" os_list="linux,windows,chromeos,android" file_path="components/query_tiles/internal/cached_image_loader.cc" /> + <item id="quic_chromium_incoming_pending_session" added_in_milestone="73" content_hash_code="032742d9" os_list="linux,windows,chromeos,android" file_path="net/quic/quic_chromium_client_session.cc" /> + <item id="quic_chromium_incoming_session" added_in_milestone="66" content_hash_code="04aeee25" os_list="linux,windows,chromeos,android" file_path="net/quic/quic_chromium_client_session.cc" /> + <item id="quic_chromium_packet_writer" added_in_milestone="66" content_hash_code="01c48aa5" os_list="linux,windows,chromeos,android" file_path="net/quic/quic_chromium_packet_writer.cc" /> + <item id="ranker_url_fetcher" added_in_milestone="62" content_hash_code="02bd45e2" os_list="linux,windows,chromeos,android" file_path="components/assist_ranker/ranker_url_fetcher.cc" /> <item id="remote_copy_message_handler" added_in_milestone="80" content_hash_code="07038d73" os_list="linux,windows,chromeos" file_path="chrome/browser/sharing/shared_clipboard/remote_copy_message_handler.cc" /> - <item id="remote_suggestions_provider" added_in_milestone="62" content_hash_code="0787a38e" os_list="linux,windows,chromeos" file_path="components/ntp_snippets/remote/cached_image_fetcher.cc" /> - <item id="remoting_directory_delete_host" added_in_milestone="86" content_hash_code="03ed762b" os_list="linux,windows,chromeos" file_path="remoting/base/directory_service_client.cc" /> - <item id="remoting_directory_get_host_list" added_in_milestone="86" content_hash_code="03933aa0" os_list="linux,windows,chromeos" file_path="remoting/base/directory_service_client.cc" /> - <item id="remoting_directory_register_host" added_in_milestone="86" content_hash_code="046c936d" os_list="linux,windows,chromeos" file_path="remoting/base/directory_service_client.cc" /> - <item id="remoting_ice_config_request" added_in_milestone="86" content_hash_code="05a5a715" os_list="linux,windows,chromeos" file_path="remoting/protocol/remoting_ice_config_request.cc" /> - <item id="remoting_log_to_server" added_in_milestone="86" content_hash_code="06fb14d6" os_list="linux,windows,chromeos" file_path="remoting/signaling/remoting_log_to_server.cc" /> + <item id="remote_suggestions_provider" added_in_milestone="62" content_hash_code="0787a38e" os_list="linux,windows,chromeos,android" file_path="components/ntp_snippets/remote/cached_image_fetcher.cc" /> + <item id="remoting_directory_delete_host" added_in_milestone="86" content_hash_code="03ed762b" os_list="linux,windows,chromeos,android" file_path="remoting/base/directory_service_client.cc" /> + <item id="remoting_directory_get_host_list" added_in_milestone="86" content_hash_code="03933aa0" os_list="linux,windows,chromeos,android" file_path="remoting/base/directory_service_client.cc" /> + <item id="remoting_directory_register_host" added_in_milestone="86" content_hash_code="046c936d" os_list="linux,windows,chromeos,android" file_path="remoting/base/directory_service_client.cc" /> + <item id="remoting_ice_config_request" added_in_milestone="86" content_hash_code="05a5a715" os_list="linux,windows,chromeos,android" file_path="remoting/protocol/remoting_ice_config_request.cc" /> + <item id="remoting_log_to_server" added_in_milestone="86" content_hash_code="06fb14d6" os_list="linux,windows,chromeos,android" file_path="remoting/signaling/remoting_log_to_server.cc" /> <item id="remoting_register_support_host_request" added_in_milestone="86" content_hash_code="00f37554" os_list="linux,windows,chromeos" file_path="remoting/host/remoting_register_support_host_request.cc" /> - <item id="remoting_telemetry_log_writer" added_in_milestone="86" content_hash_code="04df471b" os_list="linux,windows,chromeos" file_path="remoting/base/telemetry_log_writer.cc" /> + <item id="remoting_telemetry_log_writer" added_in_milestone="86" content_hash_code="04df471b" os_list="linux,windows,chromeos,android" file_path="remoting/base/telemetry_log_writer.cc" /> <item id="render_view_context_menu" added_in_milestone="62" content_hash_code="04240bc2" os_list="linux,windows,chromeos" file_path="chrome/browser/renderer_context_menu/render_view_context_menu.cc" /> - <item id="renderer_initiated_download" added_in_milestone="62" content_hash_code="02417da4" os_list="linux,windows,chromeos" file_path="content/browser/renderer_host/render_frame_host_impl.cc" /> - <item id="reporting" added_in_milestone="62" content_hash_code="077eedd0" os_list="linux,windows,chromeos" file_path="net/reporting/reporting_uploader.cc" /> + <item id="renderer_initiated_download" added_in_milestone="62" content_hash_code="02417da4" os_list="linux,windows,chromeos,android" file_path="content/browser/renderer_host/render_frame_host_impl.cc" /> + <item id="reporting" added_in_milestone="62" content_hash_code="077eedd0" os_list="linux,windows,chromeos,android" file_path="net/reporting/reporting_uploader.cc" /> <item id="rlz_ping" added_in_milestone="63" content_hash_code="06160e82" os_list="windows,chromeos" file_path="rlz/lib/financial_ping.cc" /> <item id="safe_browsing_binary_upload_app" added_in_milestone="87" content_hash_code="03da20b9" os_list="linux,windows,chromeos" file_path="chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc" /> <item id="safe_browsing_binary_upload_connector" added_in_milestone="87" content_hash_code="031b9017" os_list="linux,windows,chromeos" file_path="chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc" /> - <item id="safe_browsing_cache_collector" added_in_milestone="62" content_hash_code="03b69135" os_list="linux,windows,chromeos" file_path="components/safe_browsing/content/browser/threat_details_cache.cc" /> - <item id="safe_browsing_certificate_error_reporting" added_in_milestone="62" content_hash_code="018e6226" os_list="linux,windows,chromeos" file_path="chrome/browser/ssl/certificate_error_reporter.cc" /> - <item id="safe_browsing_client_side_phishing_detector" added_in_milestone="62" content_hash_code="02fdfa67" os_list="linux,windows,chromeos" file_path="components/safe_browsing/content/browser/client_side_detection_service.cc" /> - <item id="safe_browsing_extended_reporting" added_in_milestone="62" content_hash_code="04d6ea29" os_list="linux,windows,chromeos" file_path="components/safe_browsing/core/browser/ping_manager.cc" /> + <item id="safe_browsing_cache_collector" added_in_milestone="62" content_hash_code="03b69135" os_list="linux,windows,chromeos,android" file_path="components/safe_browsing/content/browser/threat_details_cache.cc" /> + <item id="safe_browsing_certificate_error_reporting" added_in_milestone="62" content_hash_code="018e6226" os_list="linux,windows,chromeos,android" file_path="chrome/browser/ssl/certificate_error_reporter.cc" /> + <item id="safe_browsing_client_side_phishing_detector" added_in_milestone="62" content_hash_code="02fdfa67" os_list="linux,windows,chromeos,android" file_path="components/safe_browsing/content/browser/client_side_detection_service.cc" /> + <item id="safe_browsing_extended_reporting" added_in_milestone="62" content_hash_code="04d6ea29" os_list="linux,windows,chromeos,android" file_path="components/safe_browsing/core/browser/ping_manager.cc" /> <item id="safe_browsing_feedback" added_in_milestone="62" content_hash_code="019dc52e" os_list="linux,windows,chromeos" file_path="chrome/browser/safe_browsing/download_protection/download_feedback.cc" /> <item id="safe_browsing_incident" added_in_milestone="62" content_hash_code="006f7d23" os_list="linux,windows,chromeos" file_path="chrome/browser/safe_browsing/incident_reporting/incident_report_uploader_impl.cc" /> - <item id="safe_browsing_realtime_url_lookup" added_in_milestone="78" content_hash_code="043efa82" os_list="linux,windows,chromeos" file_path="components/safe_browsing/core/browser/realtime/url_lookup_service.cc" /> - <item id="safe_browsing_v4_get_hash" added_in_milestone="62" content_hash_code="07e4cea1" os_list="linux,windows,chromeos" file_path="components/safe_browsing/core/browser/db/v4_get_hash_protocol_manager.cc" /> - <item id="safe_browsing_v4_update" added_in_milestone="70" content_hash_code="00501369" os_list="linux,windows,chromeos" file_path="components/safe_browsing/core/browser/db/v4_update_protocol_manager.cc" /> - <item id="safe_search_service" added_in_milestone="70" content_hash_code="07995c17" os_list="linux,windows,chromeos" file_path="components/policy/content/safe_search_service.cc" /> - <item id="safety_check_update_connectivity" added_in_milestone="84" content_hash_code="01d8ad59" os_list="linux,windows,chromeos" file_path="components/safety_check/update_check_helper.cc" /> + <item id="safe_browsing_realtime_url_lookup" added_in_milestone="78" content_hash_code="043efa82" os_list="linux,windows,chromeos,android" file_path="components/safe_browsing/core/browser/realtime/url_lookup_service.cc" /> + <item id="safe_browsing_v4_get_hash" added_in_milestone="62" content_hash_code="07e4cea1" os_list="linux,windows,chromeos,android" file_path="components/safe_browsing/core/browser/db/v4_get_hash_protocol_manager.cc" /> + <item id="safe_browsing_v4_update" added_in_milestone="70" content_hash_code="00501369" os_list="linux,windows,chromeos,android" file_path="components/safe_browsing/core/browser/db/v4_update_protocol_manager.cc" /> + <item id="safe_search_service" added_in_milestone="70" content_hash_code="07995c17" os_list="linux,windows,chromeos,android" file_path="components/policy/content/safe_search_service.cc" /> + <item id="safety_check_update_connectivity" added_in_milestone="84" content_hash_code="01d8ad59" os_list="linux,windows,chromeos,android" file_path="components/safety_check/update_check_helper.cc" /> <item id="sanitized_image_source" added_in_milestone="86" content_hash_code="025ed93b" os_list="linux,windows,chromeos" file_path="chrome/browser/ui/webui/sanitized_image_source.cc" /> - <item id="save_file_manager" added_in_milestone="62" content_hash_code="03610e73" os_list="linux,windows,chromeos" file_path="content/browser/download/save_file_manager.cc" /> - <item id="sct_auditing" added_in_milestone="87" content_hash_code="0298c98f" os_list="linux,windows,chromeos" file_path="chrome/browser/ssl/sct_reporting_service.cc" /> - <item id="search_prefetch_service" added_in_milestone="88" content_hash_code="077746c6" os_list="windows,linux,chromeos" file_path="chrome/browser/prefetch/search_prefetch/base_search_prefetch_request.cc" /> + <item id="save_file_manager" added_in_milestone="62" content_hash_code="03610e73" os_list="linux,windows,chromeos,android" file_path="content/browser/download/save_file_manager.cc" /> + <item id="sct_auditing" added_in_milestone="87" content_hash_code="0298c98f" os_list="linux,windows,chromeos,android" file_path="chrome/browser/ssl/sct_reporting_service.cc" /> + <item id="search_prefetch_service" added_in_milestone="88" content_hash_code="077746c6" os_list="windows,linux,chromeos,android" file_path="chrome/browser/prefetch/search_prefetch/base_search_prefetch_request.cc" /> <item id="security_key_socket" added_in_milestone="66" content_hash_code="00d1acb0" os_list="linux,windows,chromeos" file_path="remoting/host/security_key/security_key_socket.cc" /> - <item id="service_worker_navigation_preload" added_in_milestone="63" content_hash_code="04bcaa60" os_list="linux,windows,chromeos" file_path="content/browser/service_worker/service_worker_fetch_dispatcher.cc" /> - <item id="service_worker_script_load" added_in_milestone="90" content_hash_code="035ab34f" os_list="linux,windows,chromeos" file_path="content/browser/service_worker/service_worker_new_script_fetcher.cc" /> - <item id="service_worker_update_checker" added_in_milestone="71" content_hash_code="01ef068e" os_list="linux,windows,chromeos" file_path="content/browser/service_worker/service_worker_single_script_update_checker.cc" /> - <item id="services_http_server_error_response" added_in_milestone="68" content_hash_code="079dad59" os_list="linux,windows,chromeos" file_path="services/network/public/cpp/server/http_server.cc" /> - <item id="shared_storage_worklet_module_script_downloader" added_in_milestone="95" content_hash_code="0367afa1" os_list="linux,windows,chromeos" file_path="content/services/shared_storage_worklet/module_script_downloader.cc" /> - <item id="sigined_exchange_cert_fetcher" added_in_milestone="66" content_hash_code="007c2dac" os_list="linux,windows,chromeos" file_path="content/browser/web_package/signed_exchange_cert_fetcher.cc" /> - <item id="sigined_exchange_validity_pinger" added_in_milestone="75" content_hash_code="071f2878" os_list="linux,windows,chromeos" file_path="content/browser/web_package/signed_exchange_validity_pinger.cc" /> - <item id="signed_in_profile_avatar" added_in_milestone="62" content_hash_code="04579cbb" os_list="linux,windows,chromeos" file_path="chrome/browser/profiles/profile_downloader.cc" /> - <item id="socket_bio_adapter" added_in_milestone="66" content_hash_code="014a4058" os_list="linux,windows,chromeos" file_path="net/socket/socket_bio_adapter.cc" /> - <item id="spdy_push_stream" added_in_milestone="67" content_hash_code="042048b5" os_list="linux,windows,chromeos" file_path="net/spdy/spdy_session.cc" /> - <item id="spdy_session_control" added_in_milestone="66" content_hash_code="01c6f3f0" os_list="linux,windows,chromeos" file_path="net/spdy/spdy_session.cc" /> + <item id="service_worker_navigation_preload" added_in_milestone="63" content_hash_code="04bcaa60" os_list="linux,windows,chromeos,android" file_path="content/browser/service_worker/service_worker_fetch_dispatcher.cc" /> + <item id="service_worker_script_load" added_in_milestone="90" content_hash_code="035ab34f" os_list="linux,windows,chromeos,android" file_path="content/browser/service_worker/service_worker_new_script_fetcher.cc" /> + <item id="service_worker_update_checker" added_in_milestone="71" content_hash_code="01ef068e" os_list="linux,windows,chromeos,android" file_path="content/browser/service_worker/service_worker_single_script_update_checker.cc" /> + <item id="services_http_server_error_response" added_in_milestone="68" content_hash_code="079dad59" os_list="linux,windows,chromeos,android" file_path="services/network/public/cpp/server/http_server.cc" /> + <item id="shared_storage_worklet_module_script_downloader" added_in_milestone="95" content_hash_code="0367afa1" os_list="linux,windows,chromeos,android" file_path="content/services/shared_storage_worklet/module_script_downloader.cc" /> + <item id="sigined_exchange_cert_fetcher" added_in_milestone="66" content_hash_code="007c2dac" os_list="linux,windows,chromeos,android" file_path="content/browser/web_package/signed_exchange_cert_fetcher.cc" /> + <item id="sigined_exchange_validity_pinger" added_in_milestone="75" content_hash_code="071f2878" os_list="linux,windows,chromeos,android" file_path="content/browser/web_package/signed_exchange_validity_pinger.cc" /> + <item id="signed_in_profile_avatar" added_in_milestone="62" content_hash_code="04579cbb" os_list="linux,windows,chromeos,android" file_path="chrome/browser/profiles/profile_downloader.cc" /> + <item id="socket_bio_adapter" added_in_milestone="66" content_hash_code="014a4058" os_list="linux,windows,chromeos,android" file_path="net/socket/socket_bio_adapter.cc" /> + <item id="spdy_push_stream" added_in_milestone="67" content_hash_code="042048b5" os_list="linux,windows,chromeos,android" file_path="net/spdy/spdy_session.cc" /> + <item id="spdy_session_control" added_in_milestone="66" content_hash_code="01c6f3f0" os_list="linux,windows,chromeos,android" file_path="net/spdy/spdy_session.cc" /> <item id="speech_recognition_downstream" added_in_milestone="62" content_hash_code="07323e31" os_list="linux,windows,chromeos" file_path="content/browser/speech/speech_recognition_engine.cc" /> <item id="speech_recognition_upstream" added_in_milestone="62" content_hash_code="0075966b" os_list="linux,windows,chromeos" file_path="content/browser/speech/speech_recognition_engine.cc" /> - <item id="spellcheck_hunspell_dictionary" added_in_milestone="62" content_hash_code="02b8bb18" os_list="linux,windows,chromeos" file_path="chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc" /> + <item id="spellcheck_hunspell_dictionary" added_in_milestone="62" content_hash_code="02b8bb18" os_list="linux,windows,chromeos,android" file_path="chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc" /> <item id="spellcheck_lookup" added_in_milestone="62" content_hash_code="072d1525" os_list="linux,windows,chromeos" file_path="components/spellcheck/browser/spelling_service_client.cc" /> - <item id="ssl_hmac_channel_authenticator" added_in_milestone="66" content_hash_code="0695685d" os_list="linux,windows,chromeos" file_path="remoting/protocol/ssl_hmac_channel_authenticator.cc" /> - <item id="ssl_name_mismatch_lookup" added_in_milestone="62" content_hash_code="05d18c86" os_list="linux,windows,chromeos" file_path="components/security_interstitials/content/common_name_mismatch_handler.cc" /> - <item id="stream_message_pipe_adapter" added_in_milestone="66" content_hash_code="03f252fd" os_list="linux,windows,chromeos" file_path="remoting/protocol/stream_message_pipe_adapter.cc" /> - <item id="stream_packet_socket" added_in_milestone="84" content_hash_code="034904c2" os_list="linux,windows,chromeos" file_path="remoting/protocol/stream_packet_socket.cc" /> + <item id="ssl_hmac_channel_authenticator" added_in_milestone="66" content_hash_code="0695685d" os_list="linux,windows,chromeos,android" file_path="remoting/protocol/ssl_hmac_channel_authenticator.cc" /> + <item id="ssl_name_mismatch_lookup" added_in_milestone="62" content_hash_code="05d18c86" os_list="linux,windows,chromeos,android" file_path="components/security_interstitials/content/common_name_mismatch_handler.cc" /> + <item id="stream_message_pipe_adapter" added_in_milestone="66" content_hash_code="03f252fd" os_list="linux,windows,chromeos,android" file_path="remoting/protocol/stream_message_pipe_adapter.cc" /> + <item id="stream_packet_socket" added_in_milestone="84" content_hash_code="034904c2" os_list="linux,windows,chromeos,android" file_path="remoting/protocol/stream_packet_socket.cc" /> <item id="sync_file_system" added_in_milestone="62" content_hash_code="031bce6a" os_list="linux,windows,chromeos" file_path="chrome/browser/sync_file_system/drive_backend/sync_engine.cc" /> - <item id="sync_http_bridge" added_in_milestone="62" content_hash_code="01f587fa" os_list="linux,windows,chromeos" file_path="components/sync/engine/net/http_bridge.cc" /> - <item id="sync_stop_reporter" added_in_milestone="62" content_hash_code="036444c2" os_list="linux,windows,chromeos" file_path="components/sync/driver/sync_stopped_reporter.cc" /> + <item id="sync_http_bridge" added_in_milestone="62" content_hash_code="01f587fa" os_list="linux,windows,chromeos,android" file_path="components/sync/engine/net/http_bridge.cc" /> + <item id="sync_stop_reporter" added_in_milestone="62" content_hash_code="036444c2" os_list="linux,windows,chromeos,android" file_path="components/sync/driver/sync_stopped_reporter.cc" /> <item id="task_module_service" added_in_milestone="88" content_hash_code="00b8e16a" os_list="linux,windows,chromeos" file_path="chrome/browser/new_tab_page/modules/task_module/task_module_service.cc" /> <item id="test" added_in_milestone="62" reserved="1" os_list="linux,windows" file_path="" /> <item id="test_partial" added_in_milestone="62" reserved="1" os_list="linux,windows" file_path="" /> - <item id="tethering_handler_socket" added_in_milestone="65" content_hash_code="000f0cb8" os_list="linux,windows,chromeos" file_path="content/browser/devtools/protocol/tethering_handler.cc" /> - <item id="translate_url_fetcher" added_in_milestone="62" content_hash_code="06363ba2" os_list="linux,windows,chromeos" file_path="components/translate/core/browser/translate_url_fetcher.cc" /> - <item id="trusted_vault_request" added_in_milestone="88" content_hash_code="0738dfaf" os_list="linux,windows,chromeos" file_path="components/sync/trusted_vault/trusted_vault_request.cc" /> - <item id="ui_devtools_server" added_in_milestone="66" content_hash_code="03bc45b7" os_list="linux,windows,chromeos" file_path="components/ui_devtools/devtools_server.cc" /> + <item id="tethering_handler_socket" added_in_milestone="65" content_hash_code="000f0cb8" os_list="linux,windows,chromeos,android" file_path="content/browser/devtools/protocol/tethering_handler.cc" /> + <item id="translate_url_fetcher" added_in_milestone="62" content_hash_code="06363ba2" os_list="linux,windows,chromeos,android" file_path="components/translate/core/browser/translate_url_fetcher.cc" /> + <item id="trusted_vault_request" added_in_milestone="88" content_hash_code="0738dfaf" os_list="linux,windows,chromeos,android" file_path="components/sync/trusted_vault/trusted_vault_request.cc" /> + <item id="ui_devtools_server" added_in_milestone="66" content_hash_code="03bc45b7" os_list="linux,windows,chromeos,android" file_path="components/ui_devtools/devtools_server.cc" /> <item id="undefined" added_in_milestone="62" reserved="1" os_list="linux,windows" file_path="" /> <item id="unwanted_software_report" added_in_milestone="70" content_hash_code="0386a164" os_list="windows" file_path="chrome/chrome_cleaner/logging/reporter_logging_service.cc" /> - <item id="update_client" added_in_milestone="74" content_hash_code="05223987" os_list="linux,windows,chromeos" file_path="components/update_client/net/network_impl.cc" /> - <item id="url_prevision_fetcher" added_in_milestone="62" content_hash_code="03f14ce9" os_list="linux,windows,chromeos" file_path="content/browser/media/url_provision_fetcher.cc" /> - <item id="user_info_fetcher" added_in_milestone="62" content_hash_code="044ae168" os_list="linux,windows,chromeos" file_path="components/policy/core/common/cloud/user_info_fetcher.cc" /> - <item id="video_tutorial_fetcher" added_in_milestone="87" content_hash_code="074438b7" os_list="linux,windows,chromeos" file_path="chrome/browser/video_tutorials/internal/tutorial_fetcher.cc" /> - <item id="web_app_origin_association_download" added_in_milestone="90" content_hash_code="0351203d" os_list="linux,windows,chromeos" file_path="components/webapps/services/web_app_origin_association/web_app_origin_association_fetcher.cc" /> - <item id="web_bundle_loader" added_in_milestone="84" content_hash_code="036bb68e" os_list="linux,windows,chromeos" file_path="content/browser/web_package/web_bundle_utils.cc" /> - <item id="web_history_counter" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="02f5cd95" os_list="linux,windows,chromeos" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/counters/history_counter.cc" /> - <item id="web_history_delete_url" added_in_milestone="74" type="partial" second_id="web_history_service" content_hash_code="018bdbf2" os_list="linux,windows,chromeos" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/history_service.cc" /> - <item id="web_history_expire" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="05855c6e" os_list="linux,windows,chromeos" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/browsing_history_service.cc" /> - <item id="web_history_expire_between_dates" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="020b7313" os_list="linux,windows,chromeos" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/history_service.cc" /> - <item id="web_history_query" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="0226768b" os_list="linux,windows,chromeos" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/browsing_history_service.cc" /> - <item id="web_history_service" added_in_milestone="65" type="completing" content_hash_code="00f6470d" os_list="linux,windows,chromeos" semantics_fields="1,5" policy_fields="-1,3" file_path="components/history/core/browser/web_history_service.cc" /> - <item id="web_push_message" added_in_milestone="77" content_hash_code="068f740a" os_list="linux,windows,chromeos" file_path="chrome/browser/sharing/web_push/web_push_sender.cc" /> - <item id="webid" added_in_milestone="88" content_hash_code="0741708b" os_list="linux,windows,chromeos" file_path="content/browser/webid/idp_network_request_manager.cc" /> - <item id="webrtc_event_log_uploader" added_in_milestone="67" content_hash_code="00a7ed3d" os_list="linux,windows,chromeos" file_path="chrome/browser/media/webrtc/webrtc_event_log_uploader.cc" /> - <item id="webrtc_log_upload" added_in_milestone="62" content_hash_code="0201a0f1" os_list="linux,windows,chromeos" file_path="chrome/browser/media/webrtc/webrtc_log_uploader.cc" /> - <item id="webrtc_peer_connection" added_in_milestone="66" content_hash_code="039bf82b" os_list="linux,windows,chromeos" file_path="third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc" /> - <item id="websocket_basic_stream" added_in_milestone="66" content_hash_code="040f7353" os_list="linux,windows,chromeos" file_path="net/websockets/websocket_basic_stream.cc" /> - <item id="websocket_stream" added_in_milestone="62" content_hash_code="006ea358" os_list="linux,windows,chromeos" file_path="content/browser/websockets/websocket_connector_impl.cc" /> + <item id="update_client" added_in_milestone="74" content_hash_code="05223987" os_list="linux,windows,chromeos,android" file_path="components/update_client/net/network_impl.cc" /> + <item id="url_prevision_fetcher" added_in_milestone="62" content_hash_code="03f14ce9" os_list="linux,windows,chromeos,android" file_path="content/browser/media/url_provision_fetcher.cc" /> + <item id="user_info_fetcher" added_in_milestone="62" content_hash_code="044ae168" os_list="linux,windows,chromeos,android" file_path="components/policy/core/common/cloud/user_info_fetcher.cc" /> + <item id="video_tutorial_fetcher" added_in_milestone="87" content_hash_code="074438b7" os_list="linux,windows,chromeos,android" file_path="chrome/browser/video_tutorials/internal/tutorial_fetcher.cc" /> + <item id="web_app_origin_association_download" added_in_milestone="90" content_hash_code="0351203d" os_list="linux,windows,chromeos,android" file_path="components/webapps/services/web_app_origin_association/web_app_origin_association_fetcher.cc" /> + <item id="web_bundle_loader" added_in_milestone="84" content_hash_code="036bb68e" os_list="linux,windows,chromeos,android" file_path="content/browser/web_package/web_bundle_utils.cc" /> + <item id="web_history_counter" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="02f5cd95" os_list="linux,windows,chromeos,android" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/counters/history_counter.cc" /> + <item id="web_history_delete_url" added_in_milestone="74" type="partial" second_id="web_history_service" content_hash_code="018bdbf2" os_list="linux,windows,chromeos,android" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/history_service.cc" /> + <item id="web_history_expire" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="05855c6e" os_list="linux,windows,chromeos,android" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/browsing_history_service.cc" /> + <item id="web_history_expire_between_dates" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="020b7313" os_list="linux,windows,chromeos,android" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/history_service.cc" /> + <item id="web_history_query" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="0226768b" os_list="linux,windows,chromeos,android" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/browsing_history_service.cc" /> + <item id="web_history_service" added_in_milestone="65" type="completing" content_hash_code="00f6470d" os_list="linux,windows,chromeos,android" semantics_fields="1,5" policy_fields="-1,3" file_path="components/history/core/browser/web_history_service.cc" /> + <item id="web_push_message" added_in_milestone="77" content_hash_code="068f740a" os_list="linux,windows,chromeos,android" file_path="chrome/browser/sharing/web_push/web_push_sender.cc" /> + <item id="webid" added_in_milestone="88" content_hash_code="0741708b" os_list="linux,windows,chromeos,android" file_path="content/browser/webid/idp_network_request_manager.cc" /> + <item id="webrtc_event_log_uploader" added_in_milestone="67" content_hash_code="00a7ed3d" os_list="linux,windows,chromeos,android" file_path="chrome/browser/media/webrtc/webrtc_event_log_uploader.cc" /> + <item id="webrtc_log_upload" added_in_milestone="62" content_hash_code="0201a0f1" os_list="linux,windows,chromeos,android" file_path="chrome/browser/media/webrtc/webrtc_log_uploader.cc" /> + <item id="webrtc_peer_connection" added_in_milestone="66" content_hash_code="039bf82b" os_list="linux,windows,chromeos,android" file_path="third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc" /> + <item id="websocket_basic_stream" added_in_milestone="66" content_hash_code="040f7353" os_list="linux,windows,chromeos,android" file_path="net/websockets/websocket_basic_stream.cc" /> + <item id="websocket_stream" added_in_milestone="62" content_hash_code="006ea358" os_list="linux,windows,chromeos,android" file_path="content/browser/websockets/websocket_connector_impl.cc" /> <item id="webstore_data_fetcher" added_in_milestone="62" content_hash_code="016e38ea" os_list="linux,windows,chromeos" file_path="chrome/browser/extensions/webstore_data_fetcher.cc" /> <item id="webstore_install_helper" added_in_milestone="62" content_hash_code="009bbc99" os_list="linux,windows,chromeos" file_path="chrome/browser/extensions/webstore_install_helper.cc" /> <item id="webstore_installer" added_in_milestone="62" content_hash_code="04396870" os_list="linux,windows,chromeos" file_path="chrome/browser/extensions/webstore_installer.cc" /> <item id="webui_content_scripts_download" added_in_milestone="62" content_hash_code="07257fcb" os_list="linux,windows,chromeos" file_path="extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.cc" /> - <item id="well_known_path_that_should_not_exist" added_in_milestone="86" content_hash_code="03552acf" os_list="linux,windows,chromeos" file_path="components/password_manager/core/browser/well_known_change_password_state.cc" /> + <item id="well_known_path_that_should_not_exist" added_in_milestone="86" content_hash_code="03552acf" os_list="linux,windows,chromeos,android" file_path="components/password_manager/core/browser/well_known_change_password_state.cc" /> <item id="whats_new_handler" added_in_milestone="94" content_hash_code="05a798ff" os_list="linux,windows,chromeos" file_path="chrome/browser/ui/webui/whats_new/whats_new_util.cc" /> - <item id="worker_script_load" added_in_milestone="72" content_hash_code="017bc751" os_list="linux,windows,chromeos" file_path="content/browser/worker_host/worker_script_fetcher.cc" /> - <item id="tailored_security_service" added_in_milestone="97" content_hash_code="021a7daf" os_list="linux,windows,chromeos" file_path="components/safe_browsing/core/browser/tailored_security_service/tailored_security_service.cc" /> - <item id="managed_acccount_signin_restrictions_secure_connect" added_in_milestone="97" content_hash_code="0119d88f" os_list="linux,windows,chromeos" file_path="components/policy/core/browser/signin/user_cloud_signin_restriction_policy_fetcher.cc" /> + <item id="worker_script_load" added_in_milestone="72" content_hash_code="017bc751" os_list="linux,windows,chromeos,android" file_path="content/browser/worker_host/worker_script_fetcher.cc" /> + <item id="tailored_security_service" added_in_milestone="97" content_hash_code="021a7daf" os_list="linux,windows,chromeos,android" file_path="components/safe_browsing/core/browser/tailored_security_service/tailored_security_service.cc" /> + <item id="managed_acccount_signin_restrictions_secure_connect" added_in_milestone="97" content_hash_code="0119d88f" os_list="linux,windows,chromeos,android" file_path="components/policy/core/browser/signin/user_cloud_signin_restriction_policy_fetcher.cc" /> <item id="ambient_photo_cache" added_in_milestone="98" content_hash_code="07dbf21e" os_list="chromeos" file_path="ash/ambient/ambient_photo_cache.cc" /> <item id="ambient_photo_controller" added_in_milestone="98" content_hash_code="03284b8a" os_list="chromeos" file_path="ash/ambient/ambient_photo_controller.cc" /> <item id="image_downloader" added_in_milestone="98" content_hash_code="05b52680" os_list="chromeos" file_path="ash/assistant/assistant_controller_impl.cc" /> @@ -317,7 +316,7 @@ <item id="wallpaper_fetcher" added_in_milestone="98" content_hash_code="0419c2d5" os_list="chromeos" file_path="chrome/browser/chromeos/extensions/wallpaper_api.cc" /> <item id="network_traversal_ice_config_fetcher" added_in_milestone="98" content_hash_code="0065f89d" os_list="chromeos" file_path="chrome/browser/nearby_sharing/network_traversal_ice_config_fetcher.cc" /> <item id="tachyon_ice_config_fetcher" added_in_milestone="98" content_hash_code="01e878b0" os_list="chromeos" file_path="chrome/browser/nearby_sharing/tachyon_ice_config_fetcher.cc" /> - <item id="supervised_users_denylist" added_in_milestone="98" content_hash_code="01cebaff" os_list="chromeos" file_path="chrome/browser/supervised_user/supervised_user_service.cc" /> + <item id="supervised_users_denylist" added_in_milestone="98" content_hash_code="01cebaff" os_list="chromeos,android" file_path="chrome/browser/supervised_user/supervised_user_service.cc" /> <item id="app_suggestion_get_favicon" added_in_milestone="98" content_hash_code="07fca800" os_list="chromeos" file_path="chrome/browser/ui/app_list/search/app_service_app_result.cc" /> <item id="url_icon_source_fetch" added_in_milestone="98" content_hash_code="0297f30b" os_list="chromeos" file_path="chrome/browser/ui/app_list/search/common/url_icon_source.cc" /> <item id="launcher_item_suggest" added_in_milestone="98" content_hash_code="04a4041e" os_list="chromeos" file_path="chrome/browser/ui/app_list/search/files/item_suggest_cache.cc" /> @@ -328,4 +327,23 @@ <item id="edu_account_login_profile_image_fetcher" added_in_milestone="98" content_hash_code="0689301c" os_list="chromeos" file_path="chrome/browser/ui/webui/chromeos/edu_account_login_handler_chromeos.cc" /> <item id="management_ui_customer_logo" added_in_milestone="98" content_hash_code="01a17a58" os_list="chromeos" file_path="chrome/browser/ui/webui/management/management_ui_handler_chromeos.cc" /> <item id="gaia_reauth_token_fetcher" added_in_milestone="98" content_hash_code="04ff463d" os_list="chromeos" file_path="chrome/browser/ash/login/gaia_reauth_token_fetcher.cc" /> + <item id="partner_bookmarks_reader_get_favicon" added_in_milestone="98" content_hash_code="0186a55e" os_list="android" file_path="chrome/browser/android/bookmarks/partner_bookmarks_reader.cc" /> + <item id="contextual_search_resolve" added_in_milestone="98" content_hash_code="07e8053b" os_list="android" file_path="chrome/browser/android/contextualsearch/contextual_search_delegate.cc" /> + <item id="customtabs_parallel_request" added_in_milestone="98" content_hash_code="02c6bf11" os_list="android" file_path="chrome/browser/android/customtabs/detached_resource_request.cc" /> + <item id="explore_sites_image_fetcher" added_in_milestone="98" content_hash_code="031c2b7a" os_list="android" file_path="chrome/browser/android/explore_sites/explore_sites_bridge_experimental.cc" /> + <item id="explore_sites" added_in_milestone="98" content_hash_code="05256b51" os_list="android" file_path="chrome/browser/android/explore_sites/explore_sites_fetcher.cc" /> + <item id="explore_sites_catalog_fetcher" added_in_milestone="98" content_hash_code="04fd4328" os_list="android" file_path="chrome/browser/android/explore_sites/ntp_json_fetcher.cc" /> + <item id="rlz" added_in_milestone="98" content_hash_code="0839c21d" os_list="android" file_path="chrome/browser/android/rlz/rlz_ping_handler.cc" /> + <item id="chrome_android_hats" added_in_milestone="98" content_hash_code="021cd5b5" os_list="android" file_path="chrome/browser/android/survey/http_client_type.cc" /> + <item id="chime_sdk" added_in_milestone="98" content_hash_code="0114ec9a" os_list="android" file_path="chrome/browser/android/survey/http_client_type.cc" /> + <item id="download_manager_service_retry" added_in_milestone="98" content_hash_code="01044c58" os_list="android" file_path="chrome/browser/download/android/download_manager_service.cc" /> + <item id="download_bitmap" added_in_milestone="98" content_hash_code="0632ef37" os_list="android" file_path="chrome/browser/share/bitmap_download_request.cc" /> + <item id="family_info" added_in_milestone="98" content_hash_code="01831b1a" os_list="android" file_path="chrome/browser/supervised_user/child_accounts/family_info_fetcher.cc" /> + <item id="permission_request_creator" added_in_milestone="98" content_hash_code="04629d73" os_list="android" file_path="chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.cc" /> + <item id="kids_chrome_management_client_classify_url" added_in_milestone="98" content_hash_code="06b848f5" os_list="android" file_path="chrome/browser/supervised_user/kids_chrome_management/kids_chrome_management_client.cc" /> + <item id="gstatic_onboarding_definition" added_in_milestone="98" content_hash_code="07b20d53" os_list="android" file_path="components/autofill_assistant/browser/autofill_assistant_onboarding_fetcher.cc" /> + <item id="autofill_service" added_in_milestone="98" content_hash_code="080a4c8d" os_list="android" file_path="components/autofill_assistant/browser/service/service_request_sender_impl.cc" /> + <item id="publish_note_request" added_in_milestone="98" content_hash_code="01e9f0b8" os_list="android" file_path="components/content_creation/notes/core/server/notes_server_saver.cc" /> + <item id="cached_image_fetcher" added_in_milestone="98" content_hash_code="06334a2d" os_list="android" file_path="components/image_fetcher/image_fetcher_bridge.cc" /> + <item id="gstatic_change_password_scripts" added_in_milestone="98" content_hash_code="04d28714" os_list="android" file_path="components/password_manager/core/browser/password_scripts_fetcher_impl.cc" /> </annotations>
diff --git a/tools/traffic_annotation/summary/annotations_android.xml b/tools/traffic_annotation/summary/annotations_android.xml deleted file mode 100644 index 8a9da92..0000000 --- a/tools/traffic_annotation/summary/annotations_android.xml +++ /dev/null
@@ -1,325 +0,0 @@ -<?xml version="1.0"?> -<!-- -Copyright 2017 The Chromium Authors. All rights reserved. -Use of this source code is governed by a BSD-style license that can be -found in the LICENSE file. - -Refer to README.md for content description and update process. ---> - -<annotations> - <item id="accounts_image_fetcher" added_in_milestone="66" content_hash_code="02b53da6" os_list="linux,windows,android" file_path="components/signin/internal/identity_manager/account_fetcher_service.cc" /> - <item id="adb_client_socket" added_in_milestone="65" content_hash_code="03607bec" os_list="linux,windows" file_path="chrome/browser/devtools/device/adb/adb_client_socket.cc" /> - <item id="affiliation_lookup_by_hash" added_in_milestone="87" content_hash_code="026afe84" os_list="linux,windows,android" file_path="components/password_manager/core/browser/site_affiliation/hash_affiliation_fetcher.cc" /> - <item id="aggregation_service_report" added_in_milestone="95" content_hash_code="02a9ab82" os_list="linux,windows,android" file_path="content/browser/aggregation_service/aggregatable_report_sender.cc" /> - <item id="android_device_manager_socket" added_in_milestone="65" content_hash_code="00623801" os_list="linux,windows" file_path="chrome/browser/devtools/device/android_device_manager.cc" /> - <item id="android_web_socket" added_in_milestone="65" content_hash_code="00bbd661" os_list="linux,windows" file_path="chrome/browser/devtools/device/android_web_socket.cc" /> - <item id="appcache_update_job" added_in_milestone="62" content_hash_code="01a27877" os_list="linux,windows" file_path="content/browser/appcache/appcache_update_url_loader_request.cc" /> - <item id="auction_downloader" added_in_milestone="92" content_hash_code="0713f212" os_list="linux,windows,android" file_path="content/services/auction_worklet/auction_downloader.cc" /> - <item id="auction_report_sender" added_in_milestone="92" content_hash_code="03b7acb6" os_list="linux,windows,android" file_path="content/browser/interest_group/ad_auction_service_impl.cc" /> - <item id="autofill_image_fetcher_card_art_image" added_in_milestone="93" content_hash_code="0177b54c" os_list="linux,windows,android" file_path="components/autofill/core/browser/ui/autofill_image_fetcher.cc" /> - <item id="autofill_query" added_in_milestone="62" content_hash_code="00ed7a4b" os_list="linux,windows,android" file_path="components/autofill/core/browser/autofill_download_manager.cc" /> - <item id="autofill_upload" added_in_milestone="62" content_hash_code="0698270b" os_list="linux,windows,android" file_path="components/autofill/core/browser/autofill_download_manager.cc" /> - <item id="backdrop_collection_images_download" added_in_milestone="68" content_hash_code="03c0de0e" os_list="linux,windows" file_path="chrome/browser/search/background/ntp_background_service.cc" /> - <item id="backdrop_collection_names_download" added_in_milestone="68" content_hash_code="0592b787" os_list="linux,windows" file_path="chrome/browser/search/background/ntp_background_service.cc" /> - <item id="backdrop_next_image_download" added_in_milestone="77" content_hash_code="05df91f2" os_list="linux,windows" file_path="chrome/browser/search/background/ntp_background_service.cc" /> - <item id="background_fetch_context" added_in_milestone="62" content_hash_code="031d0caa" os_list="linux,windows,android" file_path="content/browser/background_fetch/background_fetch_delegate_proxy.cc" /> - <item id="background_performance_tracer" added_in_milestone="62" content_hash_code="0729688a" os_list="linux,windows" file_path="chrome/browser/tracing/crash_service_uploader.cc" /> - <item id="bidirectional_stream" added_in_milestone="67" content_hash_code="07c03a44" os_list="linux,windows,android" file_path="net/http/bidirectional_stream.cc" /> - <item id="blink_extension_resource_loader" added_in_milestone="63" content_hash_code="03c97c39" os_list="linux,windows,android" file_path="third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader.cc" /> - <item id="blink_resource_loader" added_in_milestone="62" content_hash_code="047d7664" os_list="linux,windows,android" file_path="third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader.cc" /> - <item id="bluetooth_socket" added_in_milestone="65" content_hash_code="01d7fd7d" os_list="linux,windows,android" file_path="device/bluetooth/bluetooth_socket_net.cc" /> - <item id="box_access_token_fetcher" added_in_milestone="89" content_hash_code="0729581c" os_list="linux,windows" file_path="chrome/browser/enterprise/connectors/file_system/access_token_fetcher.cc" /> - <item id="brandcode_config" added_in_milestone="62" content_hash_code="07ae0010" os_list="linux,windows" file_path="chrome/browser/profile_resetter/brandcode_config_fetcher.cc" /> - <item id="browser_switcher_ieem_sitelist" added_in_milestone="72" content_hash_code="07b15836" os_list="linux,windows" file_path="chrome/browser/browser_switcher/browser_switcher_service.cc" /> - <item id="cablev2_websocket_from_authenticator" added_in_milestone="87" content_hash_code="0724f93c" os_list="linux,windows,android" file_path="device/fido/cable/v2_authenticator.cc" /> - <item id="cablev2_websocket_from_client" added_in_milestone="86" content_hash_code="06f37377" os_list="windows,linux" file_path="device/fido/cable/fido_tunnel_device.cc" /> - <item id="captive_portal_service" added_in_milestone="62" content_hash_code="04375eac" os_list="linux,windows" file_path="components/captive_portal/content/captive_portal_service.cc" /> - <item id="cast_socket" added_in_milestone="66" content_hash_code="028e5273" os_list="linux,windows,android" file_path="components/cast_channel/cast_socket.cc" /> - <item id="cast_udp_socket" added_in_milestone="66" content_hash_code="047d6b2d" os_list="linux,windows,android" file_path="components/mirroring/service/udp_socket_client.cc" /> - <item id="cast_udp_transport" added_in_milestone="65" content_hash_code="066a8189" os_list="linux,windows,android" file_path="media/cast/net/udp_transport_impl.cc" /> - <item id="certificate_verifier_url_loader" added_in_milestone="80" content_hash_code="05856cc0" os_list="linux,windows,android" file_path="services/cert_verifier/cert_net_url_loader/cert_net_fetcher_url_loader.cc" /> - <item id="certificate_verifier_url_request" added_in_milestone="80" content_hash_code="03884604" os_list="linux,windows,android" file_path="net/cert_net/cert_net_fetcher_url_request.cc" /> - <item id="chrome_apps_socket_api" added_in_milestone="65" content_hash_code="07ca7795" os_list="linux,windows" file_path="extensions/browser/api/socket/socket.cc" /> - <item id="chrome_cart_discounts_lookup" added_in_milestone="92" content_hash_code="05b3e421" os_list="linux,windows" file_path="chrome/browser/cart/cart_discount_fetcher.cc" /> - <item id="chrome_cart_get_discounted_link" added_in_milestone="92" content_hash_code="052260e0" os_list="linux,windows" file_path="chrome/browser/cart/cart_discount_link_fetcher.cc" /> - <item id="chrome_cleaner" added_in_milestone="63" content_hash_code="06a16464" os_list="windows" file_path="chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc" /> - <item id="chrome_cleanup_report" added_in_milestone="70" content_hash_code="07c84618" os_list="windows" file_path="chrome/chrome_cleaner/logging/cleaner_logging_service.cc" /> - <item id="chrome_feedback_report_app" added_in_milestone="62" content_hash_code="04bf864a" os_list="linux,windows,android" file_path="components/feedback/feedback_uploader.cc" /> - <item id="chrome_variations_service" added_in_milestone="62" content_hash_code="00f59481" os_list="linux,windows,android" file_path="components/variations/service/variations_service.cc" /> - <item id="client_download_request" added_in_milestone="62" content_hash_code="04bc89c5" os_list="linux,windows" file_path="chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc" /> - <item id="cloud_print" added_in_milestone="65" type="completing" content_hash_code="03a1a8bc" os_list="linux,windows" semantics_fields="1,5" policy_fields="-1,3,4" file_path="chrome/service/cloud_print/cloud_print_url_fetcher.cc" /> - <item id="cloud_print_backend" added_in_milestone="62" type="partial" second_id="cloud_print" content_hash_code="05177cb5" os_list="linux,windows" semantics_fields="2,3,4" file_path="chrome/service/cloud_print/cloud_print_proxy_backend.cc" /> - <item id="cloud_print_credential_update" added_in_milestone="66" content_hash_code="001200a0" os_list="linux,windows" file_path="chrome/service/cloud_print/cloud_print_proxy_backend.cc" /> - <item id="cloud_print_proxy" added_in_milestone="62" type="partial" second_id="cloud_print" content_hash_code="056a8973" os_list="linux,windows" semantics_fields="2,3,4" file_path="chrome/service/cloud_print/cloud_print_proxy.cc" /> - <item id="cloud_speech_recognition" added_in_milestone="85" content_hash_code="06d9916b" os_list="linux,windows" file_path="chrome/services/speech/cloud_speech_recognition_client.cc" /> - <item id="content_hash_verification_job" added_in_milestone="62" content_hash_code="079fc9db" os_list="linux,windows" file_path="extensions/browser/content_hash_fetcher.cc" /> - <item id="content_suggestion_get_favicon" added_in_milestone="62" content_hash_code="0800f6e5" os_list="linux,windows,android" file_path="components/ntp_snippets/content_suggestions_service.cc" /> - <item id="conversion_measurement_report" added_in_milestone="84" content_hash_code="06161a36" os_list="linux,windows,android" file_path="content/browser/attribution_reporting/attribution_network_sender_impl.cc" /> - <item id="credenential_avatar" added_in_milestone="62" content_hash_code="06bcc86b" os_list="linux,windows,android" file_path="chrome/browser/ui/passwords/account_avatar_fetcher.cc" /> - <item id="cros_recovery_image_download" added_in_milestone="62" content_hash_code="00a7d792" os_list="linux,windows" file_path="chrome/browser/extensions/api/image_writer_private/write_from_url_operation.cc" /> - <item id="desktop_screenshot_save" added_in_milestone="94" content_hash_code="019480c9" os_list="linux,windows" file_path="chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.cc" /> - <item id="device_management_service" added_in_milestone="62" content_hash_code="06395282" os_list="linux,windows,android" file_path="components/policy/core/common/cloud/device_management_service.cc" /> - <item id="devtools_cdp_network_resource" added_in_milestone="87" content_hash_code="051db8c6" os_list="linux,windows,android" file_path="content/browser/devtools/protocol/devtools_network_resource_loader.cc" /> - <item id="devtools_free_data_source" added_in_milestone="62" content_hash_code="02213e08" os_list="linux,windows" file_path="chrome/browser/ui/webui/devtools_ui_data_source.cc" /> - <item id="devtools_handle_front_end_messages" added_in_milestone="62" content_hash_code="04940191" os_list="linux,windows,android" file_path="content/shell/browser/shell_devtools_bindings.cc" /> - <item id="devtools_hard_coded_data_source" added_in_milestone="62" content_hash_code="047b3668" os_list="linux,windows" file_path="chrome/browser/ui/webui/devtools_ui_data_source.cc" /> - <item id="devtools_http_handler" added_in_milestone="66" content_hash_code="054518b9" os_list="linux,windows,android" file_path="content/browser/devtools/devtools_http_handler.cc" /> - <item id="devtools_network_resource" added_in_milestone="62" content_hash_code="01f4a4af" os_list="linux,windows" file_path="chrome/browser/devtools/devtools_ui_bindings.cc" /> - <item id="devtools_proxy_config" added_in_milestone="85" content_hash_code="01e83c36" os_list="linux,windows,android" file_path="content/browser/devtools/protocol/target_handler.cc" /> - <item id="dial_url_fetcher" added_in_milestone="67" content_hash_code="07bd0650" os_list="linux,windows" file_path="chrome/browser/media/router/discovery/dial/dial_url_fetcher.cc" /> - <item id="digital_asset_links" added_in_milestone="90" content_hash_code="00ced49e" os_list="linux,windows,android" file_path="components/digital_asset_links/digital_asset_links_handler.cc" /> - <item id="direct_sockets" added_in_milestone="88" content_hash_code="03dc0aad" os_list="linux,windows" file_path="content/browser/direct_sockets/direct_sockets_service_impl.cc" /> - <item id="dns_over_https" added_in_milestone="66" content_hash_code="02b087b6" os_list="linux,windows,android" file_path="net/dns/dns_transaction.cc" /> - <item id="dns_transaction" added_in_milestone="65" content_hash_code="07e14f9f" os_list="linux,windows,android" file_path="net/dns/dns_transaction.cc" /> - <item id="dom_distiller" added_in_milestone="62" content_hash_code="0653c7f2" os_list="linux,windows,android" file_path="components/dom_distiller/core/distiller_url_fetcher.cc" /> - <item id="domain_reliability_report_upload" added_in_milestone="62" content_hash_code="0223d254" os_list="linux,windows,android" file_path="components/domain_reliability/uploader.cc" /> - <item id="domain_security_policy" added_in_milestone="62" content_hash_code="01d7c177" os_list="linux,windows,android" file_path="services/network/network_context.cc" /> - <item id="download_internals_webui_source" added_in_milestone="66" content_hash_code="07b659d0" os_list="linux,windows,android" file_path="chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc" /> - <item id="download_manager_resume" added_in_milestone="62" content_hash_code="0275159a" os_list="linux,windows,android" file_path="components/download/internal/common/download_item_impl.cc" /> - <item id="download_recovery_component" added_in_milestone="71" content_hash_code="00317d2f" os_list="windows" file_path="chrome/chrome_cleaner/components/recovery_component.cc" /> - <item id="download_web_contents_frame" added_in_milestone="62" content_hash_code="0037d0a1" os_list="linux,windows,android" file_path="content/browser/web_contents/web_contents_impl.cc" /> - <item id="downloads_api_run_async" added_in_milestone="62" content_hash_code="008d9d92" os_list="linux,windows" file_path="chrome/browser/extensions/api/downloads/downloads_api.cc" /> - <item id="downloads_dom_handler" added_in_milestone="73" content_hash_code="082cc10b" os_list="linux,windows" file_path="chrome/browser/ui/webui/downloads/downloads_dom_handler.cc" /> - <item id="drag_download_file" added_in_milestone="62" content_hash_code="078a20ba" os_list="linux,windows,android" file_path="content/browser/download/drag_download_file.cc" /> - <item id="drive_service" added_in_milestone="90" content_hash_code="059e2023" os_list="linux,windows" file_path="chrome/browser/new_tab_page/modules/drive/drive_service.cc" /> - <item id="early_hints_preload" added_in_milestone="91" content_hash_code="028fe27a" os_list="linux,windows,android" file_path="content/browser/loader/navigation_early_hints_manager.cc" /> - <item id="enterprise_safe_browsing_realtime_url_lookup" added_in_milestone="86" content_hash_code="00d66dca" os_list="linux,windows" file_path="chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service.cc" /> - <item id="expect_ct_reporter" added_in_milestone="69" content_hash_code="07c7284e" os_list="linux,windows,android" file_path="services/network/expect_ct_reporter.cc" /> - <item id="extension_blacklist" added_in_milestone="62" content_hash_code="06f55974" os_list="linux,windows" file_path="chrome/browser/extensions/blocklist_state_fetcher.cc" /> - <item id="extension_crx_fetcher" added_in_milestone="62" content_hash_code="04b7bcef" os_list="linux,windows" file_path="extensions/browser/updater/extension_downloader.cc" /> - <item id="extension_install_signer" added_in_milestone="62" content_hash_code="065c4bce" os_list="linux,windows" file_path="chrome/browser/extensions/install_signer.cc" /> - <item id="extension_manifest_fetcher" added_in_milestone="62" content_hash_code="05983aa9" os_list="linux,windows" file_path="extensions/browser/updater/extension_downloader.cc" /> - <item id="external_policy_fetcher" added_in_milestone="62" content_hash_code="03d48984" os_list="linux,windows" file_path="components/policy/core/common/cloud/external_policy_data_fetcher.cc" /> - <item id="favicon_loader" added_in_milestone="63" content_hash_code="0437e97c" os_list="linux,windows,android" file_path="third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader.cc" /> - <item id="file_system_connector_to_box" added_in_milestone="89" type="partial" second_id="oauth2_api_call_flow" content_hash_code="02587cd7" os_list="linux,windows" semantics_fields="1,2,3,4,5" policy_fields="-1,3,4" file_path="chrome/browser/enterprise/connectors/file_system/box_api_call_flow.cc" /> - <item id="floc_event_logger" added_in_milestone="89" type="partial" second_id="floc_remote_permission_service" content_hash_code="040df9ca" os_list="linux,windows,android" semantics_fields="2,3,4" policy_fields="3" file_path="chrome/browser/federated_learning/floc_event_logger.cc" /> - <item id="floc_remote_permission_service" added_in_milestone="85" type="completing" content_hash_code="0524bc76" os_list="linux,windows,android" semantics_fields="1,5" policy_fields="1,2,4" file_path="chrome/browser/federated_learning/floc_remote_permission_service.cc" /> - <item id="ftl_messaging_client_ack_messages" added_in_milestone="86" content_hash_code="013f1ddb" os_list="linux,windows,android" file_path="remoting/signaling/ftl_messaging_client.cc" /> - <item id="ftl_messaging_client_receive_messages" added_in_milestone="86" content_hash_code="022e9c77" os_list="linux,windows,android" file_path="remoting/signaling/ftl_messaging_client.cc" /> - <item id="ftl_messaging_client_send_messages" added_in_milestone="86" content_hash_code="006864f3" os_list="linux,windows,android" file_path="remoting/signaling/ftl_messaging_client.cc" /> - <item id="ftl_registration_manager" added_in_milestone="86" content_hash_code="00bff9a1" os_list="linux,windows,android" file_path="remoting/signaling/ftl_registration_manager.cc" /> - <item id="gaia_auth_check_connection_info" added_in_milestone="62" content_hash_code="036b0bb8" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_exchange_device_id" added_in_milestone="62" content_hash_code="03afe09b" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_fetch_for_uber" added_in_milestone="62" content_hash_code="01ab5779" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_get_user_info" added_in_milestone="62" content_hash_code="0047a3e9" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_list_accounts" added_in_milestone="62" content_hash_code="0595471e" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_log_out" added_in_milestone="62" content_hash_code="056ee739" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_login" added_in_milestone="62" content_hash_code="06aba27c" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_merge_sessions" added_in_milestone="62" content_hash_code="01d03b23" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_multilogin" added_in_milestone="70" content_hash_code="04a2142a" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_auth_revoke_token" added_in_milestone="62" content_hash_code="05c2fef2" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_cookie_manager_external_cc_result" added_in_milestone="62" content_hash_code="01dbe597" os_list="linux,windows,android" file_path="components/signin/internal/identity_manager/gaia_cookie_manager_service.cc" /> - <item id="gaia_create_reauth_proof_token_for_parent" added_in_milestone="80" content_hash_code="062b4b5c" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_auth_fetcher.cc" /> - <item id="gaia_oauth_client_get_account_capabilities" added_in_milestone="93" content_hash_code="030c6c8d" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_oauth_client.cc" /> - <item id="gaia_oauth_client_get_token_info" added_in_milestone="62" content_hash_code="07a34ff2" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_oauth_client.cc" /> - <item id="gaia_oauth_client_get_tokens" added_in_milestone="62" content_hash_code="00b89e68" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_oauth_client.cc" /> - <item id="gaia_oauth_client_get_user_info" added_in_milestone="62" content_hash_code="02187bdf" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_oauth_client.cc" /> - <item id="gaia_oauth_client_refresh_token" added_in_milestone="62" content_hash_code="015459e4" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_oauth_client.cc" /> - <item id="gcm_checkin" added_in_milestone="62" content_hash_code="05db527b" os_list="linux,windows,android" file_path="google_apis/gcm/engine/checkin_request.cc" /> - <item id="gcm_connection_factory" added_in_milestone="66" content_hash_code="047caddb" os_list="linux,windows,android" file_path="google_apis/gcm/engine/connection_factory_impl.cc" /> - <item id="gcm_registration" added_in_milestone="62" content_hash_code="06c679e8" os_list="linux,windows,android" file_path="google_apis/gcm/engine/registration_request.cc" /> - <item id="gcm_unregistration" added_in_milestone="62" content_hash_code="01cbf67f" os_list="linux,windows,android" file_path="google_apis/gcm/engine/unregistration_request.cc" /> - <item id="geo_language_provider" added_in_milestone="65" type="partial" second_id="network_location_request" content_hash_code="03e4d160" os_list="linux,windows,android" semantics_fields="1" policy_fields="3,4" file_path="components/language/content/browser/geo_language_provider.cc" /> - <item id="heartbeat_sender" added_in_milestone="86" content_hash_code="07dd0efd" os_list="linux,windows" file_path="remoting/host/heartbeat_sender.cc" /> - <item id="hintsfetcher_gethintsrequest" added_in_milestone="75" content_hash_code="0365cd74" os_list="linux,windows,android" file_path="components/optimization_guide/core/hints_fetcher.cc" /> - <item id="history_notice_utils_notice" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="07cc4c62" os_list="linux,windows,android" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/history_notice_utils.cc" /> - <item id="history_notice_utils_popup" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="01d3338e" os_list="linux,windows,android" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/history_notice_utils.cc" /> - <item id="history_ui_favicon_request_handler_get_favicon" added_in_milestone="77" content_hash_code="03d16565" os_list="linux,windows,android" file_path="components/favicon/core/history_ui_favicon_request_handler_impl.cc" /> - <item id="http_server_error_response" added_in_milestone="66" content_hash_code="03a40a76" os_list="linux,windows,android" file_path="net/server/http_server.cc" /> - <item id="icon_cacher" added_in_milestone="62" content_hash_code="06efa3dc" os_list="linux,windows,android" file_path="components/ntp_tiles/icon_cacher_impl.cc" /> - <item id="icon_catcher_get_large_icon" added_in_milestone="62" content_hash_code="05db5c15" os_list="linux,windows,android" file_path="components/ntp_tiles/icon_cacher_impl.cc" /> - <item id="image_annotation" added_in_milestone="73" content_hash_code="048b2d66" os_list="linux,windows,android" file_path="services/image_annotation/annotator.cc" /> - <item id="indexed_db_internals_handler" added_in_milestone="62" content_hash_code="0384abe6" os_list="linux,windows,android" file_path="content/browser/indexed_db/indexed_db_internals_ui.cc" /> - <item id="interest_feedv2_image_send" added_in_milestone="86" content_hash_code="06687258" os_list="linux,windows,android" file_path="components/feed/core/v2/image_fetcher.cc" /> - <item id="interest_feedv2_send" added_in_milestone="83" content_hash_code="02f676af" os_list="linux,windows,android" file_path="components/feed/core/v2/feed_network_impl.cc" /> - <item id="interest_group_update_fetcher" added_in_milestone="94" content_hash_code="0272b26d" os_list="linux,windows,android" file_path="content/browser/interest_group/interest_group_manager.cc" /> - <item id="intranet_redirect_detector" added_in_milestone="62" content_hash_code="03b26f7b" os_list="linux,windows" file_path="chrome/browser/intranet_redirect_detector.cc" /> - <item id="javascript_report_error" added_in_milestone="87" content_hash_code="006e4e54" os_list="linux" file_path="chrome/browser/error_reporting/chrome_js_error_report_processor_nonchromeos.cc" /> - <item id="lib_address_input" added_in_milestone="62" content_hash_code="0374aae8" os_list="linux,windows,android" file_path="third_party/libaddressinput/chromium/chrome_metadata_source.cc" /> - <item id="litepages_robots_rules" added_in_milestone="89" content_hash_code="04534928" os_list="linux,windows,android" file_path="chrome/browser/subresource_redirect/origin_robots_rules.cc" /> - <item id="load_autofill_gstatic_data" added_in_milestone="78" content_hash_code="07a1e952" os_list="linux,windows,android" file_path="chrome/browser/autofill/autofill_gstatic_reader.cc" /> - <item id="logo_service" added_in_milestone="73" content_hash_code="013550c3" os_list="linux,windows,android" file_path="components/search_provider_logos/logo_service_impl.cc" /> - <item id="lookup_single_password_leak" added_in_milestone="78" content_hash_code="00b98558" os_list="linux,windows,android" file_path="components/password_manager/core/browser/leak_detection/leak_detection_request.cc" /> - <item id="managed_configuration_loader" added_in_milestone="89" content_hash_code="060dc999" os_list="linux,windows" file_path="chrome/browser/device_api/managed_configuration_api.cc" /> - <item id="media_router_global_media_controls_image" added_in_milestone="81" content_hash_code="02e96911" os_list="linux,windows" file_path="chrome/browser/ui/global_media_controls/cast_media_notification_item.cc" /> - <item id="memories_remote_model_request" added_in_milestone="90" content_hash_code="032cf1fe" os_list="linux,windows,android" file_path="components/history_clusters/core/remote_clustering_backend.cc" /> - <item id="metrics_report_ukm" added_in_milestone="62" content_hash_code="008577eb" os_list="linux,windows,android" file_path="components/metrics/net/net_metrics_log_uploader.cc" /> - <item id="metrics_report_uma" added_in_milestone="62" content_hash_code="009b46c5" os_list="linux,windows,android" file_path="components/metrics/net/net_metrics_log_uploader.cc" /> - <item id="mirroring_get_setup_info" added_in_milestone="68" content_hash_code="03dd5ef2" os_list="windows,linux,android" file_path="components/mirroring/service/receiver_setup_querier.cc" /> - <item id="missing" added_in_milestone="62" reserved="1" os_list="linux,windows" file_path="" /> - <item id="navigation_predictor_srp_prefetch" added_in_milestone="81" content_hash_code="025036ba" os_list="linux,windows,android" file_path="chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper.cc" /> - <item id="navigation_url_loader" added_in_milestone="62" content_hash_code="07b5c4cb" os_list="linux,windows,android" file_path="content/browser/loader/navigation_url_loader_impl.cc" /> - <item id="network_location_provider" added_in_milestone="64" type="partial" second_id="network_location_request" content_hash_code="0272f3e8" os_list="linux,windows" semantics_fields="1" policy_fields="3,4" file_path="services/device/geolocation/network_location_provider.cc" /> - <item id="network_location_request" added_in_milestone="65" type="completing" content_hash_code="04d00293" os_list="linux,windows,android" semantics_fields="2,3,4,5" policy_fields="-1" file_path="services/device/geolocation/network_location_request.cc" /> - <item id="network_time_component" added_in_milestone="62" content_hash_code="01ac0991" os_list="linux,windows,android" file_path="components/network_time/network_time_tracker.cc" /> - <item id="new_tab_page_handler" added_in_milestone="84" content_hash_code="02ee5881" os_list="linux,windows" file_path="chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc" /> - <item id="notification_client" added_in_milestone="79" content_hash_code="07bdb896" os_list="linux,windows,android" file_path="remoting/client/notification/notification_client.cc" /> - <item id="ntp_snippets_fetch" added_in_milestone="62" content_hash_code="0099caef" os_list="linux,windows,android" file_path="components/ntp_snippets/remote/json_request.cc" /> - <item id="nux_ntp_background_preview" added_in_milestone="74" content_hash_code="01df3270" os_list="linux,windows" file_path="chrome/browser/ui/webui/welcome/ntp_background_fetcher.cc" /> - <item id="oauth2_access_token_fetcher" added_in_milestone="62" content_hash_code="01ff32b0" os_list="linux,windows,android" file_path="google_apis/gaia/gaia_access_token_fetcher.cc" /> - <item id="oauth2_api_call_flow" added_in_milestone="65" type="completing" content_hash_code="067ca204" os_list="linux,windows,android" policy_fields="-1" file_path="google_apis/gaia/oauth2_api_call_flow.cc" /> - <item id="oauth2_mint_token_flow" added_in_milestone="62" type="partial" second_id="oauth2_api_call_flow" content_hash_code="05756bf8" os_list="linux,windows,android" semantics_fields="1,2,3,4,5" policy_fields="3,4" file_path="google_apis/gaia/oauth2_mint_token_flow.cc" /> - <item id="offline_prefetch" added_in_milestone="62" content_hash_code="06ad9616" os_list="linux,windows,android" file_path="components/offline_pages/core/prefetch/prefetch_request_fetcher.cc" /> - <item id="omnibox_documentsuggest" added_in_milestone="69" content_hash_code="07917541" os_list="linux,windows,android" file_path="components/omnibox/browser/document_suggestions_service.cc" /> - <item id="omnibox_navigation_observer" added_in_milestone="62" content_hash_code="00285074" os_list="linux,windows" file_path="chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc" /> - <item id="omnibox_result_change" added_in_milestone="62" content_hash_code="017a7557" os_list="linux,windows,android" file_path="chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc" /> - <item id="omnibox_suggest" added_in_milestone="62" content_hash_code="0524cc7e" os_list="linux,windows,android" file_path="components/omnibox/browser/search_provider.cc" /> - <item id="omnibox_suggest_deletion" added_in_milestone="62" content_hash_code="017d302e" os_list="linux,windows,android" file_path="components/omnibox/browser/base_search_provider.cc" /> - <item id="omnibox_zerosuggest" added_in_milestone="62" content_hash_code="071e32e9" os_list="linux,windows,android" file_path="components/omnibox/browser/remote_suggestions_service.cc" /> - <item id="one_google_bar_service" added_in_milestone="62" content_hash_code="02c5f314" os_list="linux,windows" file_path="chrome/browser/new_tab_page/one_google_bar/one_google_bar_loader_impl.cc" /> - <item id="open_search" added_in_milestone="62" content_hash_code="04f2de86" os_list="linux,windows,android" file_path="components/search_engines/template_url_fetcher.cc" /> - <item id="openscreen_message" added_in_milestone="83" content_hash_code="076a1faf" os_list="linux,windows,android" file_path="components/openscreen_platform/udp_socket.cc" /> - <item id="openscreen_tls_message" added_in_milestone="83" content_hash_code="00f4022a" os_list="linux,windows,android" file_path="components/openscreen_platform/tls_connection_factory.cc" /> - <item id="optimization_guide_model" added_in_milestone="79" content_hash_code="01ee6e67" os_list="linux,windows,android" file_path="components/optimization_guide/core/prediction_model_fetcher_impl.cc" /> - <item id="optimization_guide_model_download" added_in_milestone="88" content_hash_code="05d71d9b" os_list="linux,windows,android" file_path="chrome/browser/optimization_guide/prediction/prediction_model_download_manager.cc" /> - <item id="origin_policy_loader" added_in_milestone="69" content_hash_code="07fd1eaf" os_list="linux,windows,android" file_path="services/network/origin_policy/origin_policy_fetcher.cc" /> - <item id="parallel_download_job" added_in_milestone="62" content_hash_code="064736f3" os_list="linux,windows,android" file_path="components/download/internal/common/parallel_download_job.cc" /> - <item id="password_protection_request" added_in_milestone="62" content_hash_code="01869413" os_list="linux,windows,android" file_path="components/safe_browsing/core/browser/password_protection/password_protection_request.cc" /> - <item id="password_requirements_spec_fetch" added_in_milestone="69" content_hash_code="005550dc" os_list="linux,windows,android" file_path="components/password_manager/core/browser/generation/password_requirements_spec_fetcher_impl.cc" /> - <item id="payment_manifest_downloader" added_in_milestone="62" content_hash_code="01266484" os_list="linux,windows,android" file_path="components/payments/core/payment_manifest_downloader.cc" /> - <item id="payments_sync_cards" added_in_milestone="62" content_hash_code="035e86b1" os_list="linux,windows,android" file_path="components/autofill/core/browser/payments/payments_client.cc" /> - <item id="pdf_plugin_placeholder" added_in_milestone="63" content_hash_code="0101fbd5" os_list="linux,windows" file_path="chrome/browser/plugins/plugin_observer.cc" /> - <item id="pepper_tcp_socket" added_in_milestone="65" content_hash_code="01a37664" os_list="linux,windows" file_path="content/browser/renderer_host/pepper/pepper_socket_utils.cc" /> - <item id="pepper_udp_socket" added_in_milestone="70" content_hash_code="006ee842" os_list="linux,windows" file_path="content/browser/renderer_host/pepper/pepper_socket_utils.cc" /> - <item id="per_user_topic_registration_request" added_in_milestone="68" content_hash_code="0367425f" os_list="linux,windows,android" file_path="components/invalidation/impl/per_user_topic_subscription_request.cc" /> - <item id="permission_predictions" added_in_milestone="88" content_hash_code="0556d9f7" os_list="linux,windows,android" file_path="components/permissions/prediction_service/prediction_service.cc" /> - <item id="photos_service" added_in_milestone="94" content_hash_code="0573af72" os_list="linux,windows" file_path="chrome/browser/new_tab_page/modules/photos/photos_service.cc" /> - <item id="plugins_resource_service" added_in_milestone="62" content_hash_code="0068f097" os_list="linux,windows" file_path="chrome/browser/plugins/plugins_resource_service.cc" /> - <item id="popular_sites_fetch" added_in_milestone="62" content_hash_code="00697083" os_list="linux,windows,android" file_path="components/ntp_tiles/popular_sites_impl.cc" /> - <item id="port_forwarding_controller_socket" added_in_milestone="65" content_hash_code="074810e4" os_list="linux,windows" file_path="chrome/browser/devtools/device/port_forwarding_controller.cc" /> - <item id="ppapi_download_request" added_in_milestone="62" content_hash_code="07d4e067" os_list="linux,windows" file_path="chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc" /> - <item id="predictive_prefetch" added_in_milestone="85" content_hash_code="01acbb76" os_list="linux,windows,android" file_path="chrome/browser/predictors/prefetch_manager.cc" /> - <item id="prefetch_download" added_in_milestone="62" content_hash_code="0146e99e" os_list="linux,windows,android" file_path="components/offline_pages/core/prefetch/prefetch_downloader_impl.cc" /> - <item id="prefetch_proxy_canary_check" added_in_milestone="88" content_hash_code="0329567f" os_list="linux,windows,android" file_path="chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_prober.cc" /> - <item id="prefetch_proxy_probe" added_in_milestone="88" content_hash_code="001d245d" os_list="linux,windows,android" file_path="chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_prober.cc" /> - <item id="prefetch_visuals" added_in_milestone="75" content_hash_code="0564010a" os_list="linux,windows,android" file_path="components/offline_pages/core/prefetch/visuals_fetch_by_url.cc" /> - <item id="printer_job_handler" added_in_milestone="62" type="partial" second_id="cloud_print" content_hash_code="048348b5" os_list="linux,windows" semantics_fields="2,3,4" file_path="chrome/service/cloud_print/printer_job_handler.cc" /> - <item id="profile_avatar" added_in_milestone="62" content_hash_code="06c4a5fd" os_list="linux,windows,android" file_path="chrome/browser/profiles/profile_avatar_downloader.cc" /> - <item id="profile_resetter_upload" added_in_milestone="62" content_hash_code="07b56813" os_list="linux,windows" file_path="chrome/browser/profile_resetter/reset_report_uploader.cc" /> - <item id="promo_service" added_in_milestone="72" content_hash_code="01f69c19" os_list="linux,windows" file_path="chrome/browser/new_tab_page/promos/promo_service.cc" /> - <item id="proxy_config_direct" added_in_milestone="67" content_hash_code="072602b0" os_list="linux,windows,android" file_path="net/proxy_resolution/proxy_config_with_annotation.cc" /> - <item id="proxy_config_headless" added_in_milestone="67" content_hash_code="049def4d" os_list="linux,windows" file_path="headless/lib/browser/headless_request_context_manager.cc" /> - <item id="proxy_config_settings" added_in_milestone="67" content_hash_code="0129f6d1" os_list="linux,windows,android" file_path="components/proxy_config/pref_proxy_config_tracker_impl.cc" /> - <item id="proxy_config_system" added_in_milestone="67" content_hash_code="0497cf89" os_list="linux,windows,android" file_path="net/proxy_resolution/configured_proxy_resolution_service.cc" /> - <item id="proxy_config_windows_resolver" added_in_milestone="86" content_hash_code="075530ef" os_list="windows" file_path="net/proxy_resolution/win/windows_system_proxy_resolution_request.cc" /> - <item id="qr_code_save" added_in_milestone="84" content_hash_code="045593bd" os_list="linux,windows" file_path="chrome/browser/ui/views/qrcode_generator/qrcode_generator_bubble.cc" /> - <item id="query_tiles_fetcher" added_in_milestone="84" content_hash_code="0100b835" os_list="linux,windows,android" file_path="components/query_tiles/internal/tile_fetcher.cc" /> - <item id="query_tiles_image_loader" added_in_milestone="83" content_hash_code="04797c4a" os_list="linux,windows,android" file_path="components/query_tiles/internal/cached_image_loader.cc" /> - <item id="quic_chromium_incoming_pending_session" added_in_milestone="73" content_hash_code="032742d9" os_list="linux,windows,android" file_path="net/quic/quic_chromium_client_session.cc" /> - <item id="quic_chromium_incoming_session" added_in_milestone="66" content_hash_code="04aeee25" os_list="linux,windows,android" file_path="net/quic/quic_chromium_client_session.cc" /> - <item id="quic_chromium_packet_writer" added_in_milestone="66" content_hash_code="01c48aa5" os_list="linux,windows,android" file_path="net/quic/quic_chromium_packet_writer.cc" /> - <item id="ranker_url_fetcher" added_in_milestone="62" content_hash_code="02bd45e2" os_list="linux,windows,android" file_path="components/assist_ranker/ranker_url_fetcher.cc" /> - <item id="remote_copy_message_handler" added_in_milestone="80" content_hash_code="07038d73" os_list="linux,windows" file_path="chrome/browser/sharing/shared_clipboard/remote_copy_message_handler.cc" /> - <item id="remote_suggestions_provider" added_in_milestone="62" content_hash_code="0787a38e" os_list="linux,windows,android" file_path="components/ntp_snippets/remote/cached_image_fetcher.cc" /> - <item id="remoting_directory_delete_host" added_in_milestone="86" content_hash_code="03ed762b" os_list="linux,windows,android" file_path="remoting/base/directory_service_client.cc" /> - <item id="remoting_directory_get_host_list" added_in_milestone="86" content_hash_code="03933aa0" os_list="linux,windows,android" file_path="remoting/base/directory_service_client.cc" /> - <item id="remoting_directory_register_host" added_in_milestone="86" content_hash_code="046c936d" os_list="linux,windows,android" file_path="remoting/base/directory_service_client.cc" /> - <item id="remoting_ice_config_request" added_in_milestone="86" content_hash_code="05a5a715" os_list="linux,windows,android" file_path="remoting/protocol/remoting_ice_config_request.cc" /> - <item id="remoting_log_to_server" added_in_milestone="86" content_hash_code="06fb14d6" os_list="linux,windows,android" file_path="remoting/signaling/remoting_log_to_server.cc" /> - <item id="remoting_register_support_host_request" added_in_milestone="86" content_hash_code="00f37554" os_list="linux,windows" file_path="remoting/host/remoting_register_support_host_request.cc" /> - <item id="remoting_telemetry_log_writer" added_in_milestone="86" content_hash_code="04df471b" os_list="linux,windows,android" file_path="remoting/base/telemetry_log_writer.cc" /> - <item id="render_view_context_menu" added_in_milestone="62" content_hash_code="04240bc2" os_list="linux,windows" file_path="chrome/browser/renderer_context_menu/render_view_context_menu.cc" /> - <item id="renderer_initiated_download" added_in_milestone="62" content_hash_code="02417da4" os_list="linux,windows,android" file_path="content/browser/renderer_host/render_frame_host_impl.cc" /> - <item id="reporting" added_in_milestone="62" content_hash_code="077eedd0" os_list="linux,windows,android" file_path="net/reporting/reporting_uploader.cc" /> - <item id="rlz_ping" added_in_milestone="63" content_hash_code="06160e82" os_list="windows" file_path="rlz/lib/financial_ping.cc" /> - <item id="safe_browsing_binary_upload_app" added_in_milestone="87" content_hash_code="03da20b9" os_list="linux,windows" file_path="chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc" /> - <item id="safe_browsing_binary_upload_connector" added_in_milestone="87" content_hash_code="031b9017" os_list="linux,windows" file_path="chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc" /> - <item id="safe_browsing_cache_collector" added_in_milestone="62" content_hash_code="03b69135" os_list="linux,windows,android" file_path="components/safe_browsing/content/browser/threat_details_cache.cc" /> - <item id="safe_browsing_certificate_error_reporting" added_in_milestone="62" content_hash_code="018e6226" os_list="linux,windows,android" file_path="chrome/browser/ssl/certificate_error_reporter.cc" /> - <item id="safe_browsing_client_side_phishing_detector" added_in_milestone="62" content_hash_code="02fdfa67" os_list="linux,windows,android" file_path="components/safe_browsing/content/browser/client_side_detection_service.cc" /> - <item id="safe_browsing_extended_reporting" added_in_milestone="62" content_hash_code="04d6ea29" os_list="linux,windows,android" file_path="components/safe_browsing/core/browser/ping_manager.cc" /> - <item id="safe_browsing_feedback" added_in_milestone="62" content_hash_code="019dc52e" os_list="linux,windows" file_path="chrome/browser/safe_browsing/download_protection/download_feedback.cc" /> - <item id="safe_browsing_incident" added_in_milestone="62" content_hash_code="006f7d23" os_list="linux,windows" file_path="chrome/browser/safe_browsing/incident_reporting/incident_report_uploader_impl.cc" /> - <item id="safe_browsing_module_loader" added_in_milestone="62" content_hash_code="02f37ce2" os_list="linux,windows" file_path="components/safe_browsing/content/browser/client_side_model_loader.cc" /> - <item id="safe_browsing_realtime_url_lookup" added_in_milestone="78" content_hash_code="043efa82" os_list="linux,windows,android" file_path="components/safe_browsing/core/browser/realtime/url_lookup_service.cc" /> - <item id="safe_browsing_v4_get_hash" added_in_milestone="62" content_hash_code="07e4cea1" os_list="linux,windows,android" file_path="components/safe_browsing/core/browser/db/v4_get_hash_protocol_manager.cc" /> - <item id="safe_browsing_v4_update" added_in_milestone="70" content_hash_code="00501369" os_list="linux,windows,android" file_path="components/safe_browsing/core/browser/db/v4_update_protocol_manager.cc" /> - <item id="safe_search_service" added_in_milestone="70" content_hash_code="07995c17" os_list="linux,windows,android" file_path="components/policy/content/safe_search_service.cc" /> - <item id="safety_check_update_connectivity" added_in_milestone="84" content_hash_code="01d8ad59" os_list="linux,windows,android" file_path="components/safety_check/update_check_helper.cc" /> - <item id="sanitized_image_source" added_in_milestone="86" content_hash_code="025ed93b" os_list="linux,windows" file_path="chrome/browser/ui/webui/sanitized_image_source.cc" /> - <item id="save_file_manager" added_in_milestone="62" content_hash_code="03610e73" os_list="linux,windows,android" file_path="content/browser/download/save_file_manager.cc" /> - <item id="sct_auditing" added_in_milestone="87" content_hash_code="0298c98f" os_list="linux,windows,android" file_path="chrome/browser/ssl/sct_reporting_service.cc" /> - <item id="search_prefetch_service" added_in_milestone="88" content_hash_code="077746c6" os_list="windows,linux,android" file_path="chrome/browser/prefetch/search_prefetch/base_search_prefetch_request.cc" /> - <item id="security_key_socket" added_in_milestone="66" content_hash_code="00d1acb0" os_list="linux,windows" file_path="remoting/host/security_key/security_key_socket.cc" /> - <item id="service_worker_navigation_preload" added_in_milestone="63" content_hash_code="04bcaa60" os_list="linux,windows,android" file_path="content/browser/service_worker/service_worker_fetch_dispatcher.cc" /> - <item id="service_worker_script_load" added_in_milestone="90" content_hash_code="035ab34f" os_list="linux,windows,android" file_path="content/browser/service_worker/service_worker_new_script_fetcher.cc" /> - <item id="service_worker_update_checker" added_in_milestone="71" content_hash_code="01ef068e" os_list="linux,windows,android" file_path="content/browser/service_worker/service_worker_single_script_update_checker.cc" /> - <item id="services_http_server_error_response" added_in_milestone="68" content_hash_code="079dad59" os_list="linux,windows,android" file_path="services/network/public/cpp/server/http_server.cc" /> - <item id="shared_storage_worklet_module_script_downloader" added_in_milestone="95" content_hash_code="0367afa1" os_list="linux,windows,android" file_path="content/services/shared_storage_worklet/module_script_downloader.cc" /> - <item id="sigined_exchange_cert_fetcher" added_in_milestone="66" content_hash_code="007c2dac" os_list="linux,windows,android" file_path="content/browser/web_package/signed_exchange_cert_fetcher.cc" /> - <item id="sigined_exchange_validity_pinger" added_in_milestone="75" content_hash_code="071f2878" os_list="linux,windows,android" file_path="content/browser/web_package/signed_exchange_validity_pinger.cc" /> - <item id="signed_in_profile_avatar" added_in_milestone="62" content_hash_code="04579cbb" os_list="linux,windows,android" file_path="chrome/browser/profiles/profile_downloader.cc" /> - <item id="socket_bio_adapter" added_in_milestone="66" content_hash_code="014a4058" os_list="linux,windows,android" file_path="net/socket/socket_bio_adapter.cc" /> - <item id="spdy_push_stream" added_in_milestone="67" content_hash_code="042048b5" os_list="linux,windows,android" file_path="net/spdy/spdy_session.cc" /> - <item id="spdy_session_control" added_in_milestone="66" content_hash_code="01c6f3f0" os_list="linux,windows,android" file_path="net/spdy/spdy_session.cc" /> - <item id="speech_recognition_downstream" added_in_milestone="62" content_hash_code="07323e31" os_list="linux,windows" file_path="content/browser/speech/speech_recognition_engine.cc" /> - <item id="speech_recognition_upstream" added_in_milestone="62" content_hash_code="0075966b" os_list="linux,windows" file_path="content/browser/speech/speech_recognition_engine.cc" /> - <item id="spellcheck_hunspell_dictionary" added_in_milestone="62" content_hash_code="02b8bb18" os_list="linux,windows,android" file_path="chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc" /> - <item id="spellcheck_lookup" added_in_milestone="62" content_hash_code="072d1525" os_list="linux,windows" file_path="components/spellcheck/browser/spelling_service_client.cc" /> - <item id="ssl_hmac_channel_authenticator" added_in_milestone="66" content_hash_code="0695685d" os_list="linux,windows,android" file_path="remoting/protocol/ssl_hmac_channel_authenticator.cc" /> - <item id="ssl_name_mismatch_lookup" added_in_milestone="62" content_hash_code="05d18c86" os_list="linux,windows,android" file_path="components/security_interstitials/content/common_name_mismatch_handler.cc" /> - <item id="stream_message_pipe_adapter" added_in_milestone="66" content_hash_code="03f252fd" os_list="linux,windows,android" file_path="remoting/protocol/stream_message_pipe_adapter.cc" /> - <item id="stream_packet_socket" added_in_milestone="84" content_hash_code="034904c2" os_list="linux,windows,android" file_path="remoting/protocol/stream_packet_socket.cc" /> - <item id="sync_file_system" added_in_milestone="62" content_hash_code="031bce6a" os_list="linux,windows" file_path="chrome/browser/sync_file_system/drive_backend/sync_engine.cc" /> - <item id="sync_http_bridge" added_in_milestone="62" content_hash_code="01f587fa" os_list="linux,windows,android" file_path="components/sync/engine/net/http_bridge.cc" /> - <item id="sync_stop_reporter" added_in_milestone="62" content_hash_code="036444c2" os_list="linux,windows,android" file_path="components/sync/driver/sync_stopped_reporter.cc" /> - <item id="task_module_service" added_in_milestone="88" content_hash_code="00b8e16a" os_list="linux,windows" file_path="chrome/browser/new_tab_page/modules/task_module/task_module_service.cc" /> - <item id="test" added_in_milestone="62" reserved="1" os_list="linux,windows" file_path="" /> - <item id="test_partial" added_in_milestone="62" reserved="1" os_list="linux,windows" file_path="" /> - <item id="tethering_handler_socket" added_in_milestone="65" content_hash_code="000f0cb8" os_list="linux,windows,android" file_path="content/browser/devtools/protocol/tethering_handler.cc" /> - <item id="translate_url_fetcher" added_in_milestone="62" content_hash_code="06363ba2" os_list="linux,windows,android" file_path="components/translate/core/browser/translate_url_fetcher.cc" /> - <item id="trusted_vault_request" added_in_milestone="88" content_hash_code="0738dfaf" os_list="linux,windows,android" file_path="components/sync/trusted_vault/trusted_vault_request.cc" /> - <item id="ui_devtools_server" added_in_milestone="66" content_hash_code="03bc45b7" os_list="linux,windows,android" file_path="components/ui_devtools/devtools_server.cc" /> - <item id="undefined" added_in_milestone="62" reserved="1" os_list="linux,windows" file_path="" /> - <item id="unwanted_software_report" added_in_milestone="70" content_hash_code="0386a164" os_list="windows" file_path="chrome/chrome_cleaner/logging/reporter_logging_service.cc" /> - <item id="update_client" added_in_milestone="74" content_hash_code="05223987" os_list="linux,windows,android" file_path="components/update_client/net/network_impl.cc" /> - <item id="url_prevision_fetcher" added_in_milestone="62" content_hash_code="03f14ce9" os_list="linux,windows,android" file_path="content/browser/media/url_provision_fetcher.cc" /> - <item id="user_info_fetcher" added_in_milestone="62" content_hash_code="044ae168" os_list="linux,windows,android" file_path="components/policy/core/common/cloud/user_info_fetcher.cc" /> - <item id="video_tutorial_fetcher" added_in_milestone="87" content_hash_code="074438b7" os_list="linux,windows,android" file_path="chrome/browser/video_tutorials/internal/tutorial_fetcher.cc" /> - <item id="web_app_origin_association_download" added_in_milestone="90" content_hash_code="0351203d" os_list="linux,windows,android" file_path="components/webapps/services/web_app_origin_association/web_app_origin_association_fetcher.cc" /> - <item id="web_bundle_loader" added_in_milestone="84" content_hash_code="036bb68e" os_list="linux,windows,android" file_path="content/browser/web_package/web_bundle_utils.cc" /> - <item id="web_history_counter" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="02f5cd95" os_list="linux,windows,android" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/counters/history_counter.cc" /> - <item id="web_history_delete_url" added_in_milestone="74" type="partial" second_id="web_history_service" content_hash_code="018bdbf2" os_list="linux,windows,android" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/history_service.cc" /> - <item id="web_history_expire" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="05855c6e" os_list="linux,windows,android" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/browsing_history_service.cc" /> - <item id="web_history_expire_between_dates" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="020b7313" os_list="linux,windows,android" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/history_service.cc" /> - <item id="web_history_query" added_in_milestone="62" type="partial" second_id="web_history_service" content_hash_code="0226768b" os_list="linux,windows,android" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/browsing_history_service.cc" /> - <item id="web_history_service" added_in_milestone="65" type="completing" content_hash_code="00f6470d" os_list="linux,windows,android" semantics_fields="1,5" policy_fields="-1,3" file_path="components/history/core/browser/web_history_service.cc" /> - <item id="web_push_message" added_in_milestone="77" content_hash_code="068f740a" os_list="linux,windows,android" file_path="chrome/browser/sharing/web_push/web_push_sender.cc" /> - <item id="webid" added_in_milestone="88" content_hash_code="0741708b" os_list="linux,windows,android" file_path="content/browser/webid/idp_network_request_manager.cc" /> - <item id="webrtc_event_log_uploader" added_in_milestone="67" content_hash_code="00a7ed3d" os_list="linux,windows,android" file_path="chrome/browser/media/webrtc/webrtc_event_log_uploader.cc" /> - <item id="webrtc_log_upload" added_in_milestone="62" content_hash_code="0201a0f1" os_list="linux,windows,android" file_path="chrome/browser/media/webrtc/webrtc_log_uploader.cc" /> - <item id="webrtc_peer_connection" added_in_milestone="66" content_hash_code="039bf82b" os_list="linux,windows,android" file_path="third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc" /> - <item id="websocket_basic_stream" added_in_milestone="66" content_hash_code="040f7353" os_list="linux,windows,android" file_path="net/websockets/websocket_basic_stream.cc" /> - <item id="websocket_stream" added_in_milestone="62" content_hash_code="006ea358" os_list="linux,windows,android" file_path="content/browser/websockets/websocket_connector_impl.cc" /> - <item id="webstore_data_fetcher" added_in_milestone="62" content_hash_code="016e38ea" os_list="linux,windows" file_path="chrome/browser/extensions/webstore_data_fetcher.cc" /> - <item id="webstore_install_helper" added_in_milestone="62" content_hash_code="009bbc99" os_list="linux,windows" file_path="chrome/browser/extensions/webstore_install_helper.cc" /> - <item id="webstore_installer" added_in_milestone="62" content_hash_code="04396870" os_list="linux,windows" file_path="chrome/browser/extensions/webstore_installer.cc" /> - <item id="webui_content_scripts_download" added_in_milestone="62" content_hash_code="07257fcb" os_list="linux,windows" file_path="extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.cc" /> - <item id="well_known_path_that_should_not_exist" added_in_milestone="86" content_hash_code="03552acf" os_list="linux,windows,android" file_path="components/password_manager/core/browser/well_known_change_password_state.cc" /> - <item id="whats_new_handler" added_in_milestone="94" content_hash_code="05a798ff" os_list="linux,windows" file_path="chrome/browser/ui/webui/whats_new/whats_new_handler.cc" /> - <item id="worker_script_load" added_in_milestone="72" content_hash_code="017bc751" os_list="linux,windows,android" file_path="content/browser/worker_host/worker_script_fetcher.cc" /> - <item id="partner_bookmarks_reader_get_favicon" added_in_milestone="95" content_hash_code="0186a55e" os_list="android" file_path="chrome/browser/android/bookmarks/partner_bookmarks_reader.cc" /> - <item id="contextual_search_resolve" added_in_milestone="95" content_hash_code="07e8053b" os_list="android" file_path="chrome/browser/android/contextualsearch/contextual_search_delegate.cc" /> - <item id="customtabs_parallel_request" added_in_milestone="95" content_hash_code="02c6bf11" os_list="android" file_path="chrome/browser/android/customtabs/detached_resource_request.cc" /> - <item id="explore_sites_catalog_fetcher" added_in_milestone="95" content_hash_code="04fd4328" os_list="android" file_path="chrome/browser/android/explore_sites/ntp_json_fetcher.cc" /> - <item id="chrome_android_hats" added_in_milestone="95" content_hash_code="021cd5b5" os_list="android" file_path="chrome/browser/android/survey/http_client_type.cc" /> - <item id="chime_sdk" added_in_milestone="95" content_hash_code="0114ec9a" os_list="android" file_path="chrome/browser/android/survey/http_client_type.cc" /> - <item id="download_manager_service_retry" added_in_milestone="95" content_hash_code="01044c58" os_list="android" file_path="chrome/browser/download/android/download_manager_service.cc" /> - <item id="download_bitmap" added_in_milestone="95" content_hash_code="0632ef37" os_list="android" file_path="chrome/browser/share/bitmap_download_request.cc" /> - <item id="supervised_users_denylist" added_in_milestone="95" content_hash_code="01cebaff" os_list="android" file_path="chrome/browser/supervised_user/supervised_user_service.cc" /> - <item id="autofill_service" added_in_milestone="95" content_hash_code="080a4c8d" os_list="android" file_path="components/autofill_assistant/browser/service/service_request_sender_impl.cc" /> - <item id="publish_note_request" added_in_milestone="95" content_hash_code="01e9f0b8" os_list="android" file_path="components/content_creation/notes/core/server/notes_server_saver.cc" /> - <item id="cached_image_fetcher" added_in_milestone="95" content_hash_code="06334a2d" os_list="android" file_path="components/image_fetcher/image_fetcher_bridge.cc" /> - <item id="explore_sites_image_fetcher" added_in_milestone="95" content_hash_code="031c2b7a" os_list="android" file_path="chrome/browser/android/explore_sites/explore_sites_bridge_experimental.cc" /> - <item id="explore_sites" added_in_milestone="95" content_hash_code="05256b51" os_list="android" file_path="chrome/browser/android/explore_sites/explore_sites_fetcher.cc" /> - <item id="rlz" added_in_milestone="95" content_hash_code="0839c21d" os_list="android" file_path="chrome/browser/android/rlz/rlz_ping_handler.cc" /> - <item id="family_info" added_in_milestone="95" content_hash_code="01831b1a" os_list="android" file_path="chrome/browser/supervised_user/child_accounts/family_info_fetcher.cc" /> - <item id="permission_request_creator" added_in_milestone="95" content_hash_code="04629d73" os_list="android" file_path="chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.cc" /> - <item id="kids_chrome_management_client_classify_url" added_in_milestone="95" content_hash_code="06b848f5" os_list="android" file_path="chrome/browser/supervised_user/kids_chrome_management/kids_chrome_management_client.cc" /> - <item id="gstatic_onboarding_definition" added_in_milestone="95" content_hash_code="07b20d53" os_list="android" file_path="components/autofill_assistant/browser/autofill_assistant_onboarding_fetcher.cc" /> - <item id="gstatic_change_password_scripts" added_in_milestone="95" content_hash_code="04d28714" os_list="android" file_path="components/password_manager/core/browser/password_scripts_fetcher_impl.cc" /> - <item id="tailored_security_service" added_in_milestone="97" content_hash_code="021a7daf" os_list="android" file_path="components/safe_browsing/core/browser/tailored_security_service/tailored_security_service.cc" /> - <item id="aggregation_service_helper_keys" added_in_milestone="97" content_hash_code="04127781" os_list="android" file_path="content/browser/aggregation_service/aggregation_service_network_fetcher_impl.cc" /> - <item id="managed_acccount_signin_restrictions_secure_connect" added_in_milestone="98" content_hash_code="0119d88f" os_list="android" file_path="components/policy/core/browser/signin/user_cloud_signin_restriction_policy_fetcher.cc" /> -</annotations>
diff --git a/tools/traffic_annotation/summary/grouping.xml b/tools/traffic_annotation/summary/grouping.xml index 2ad77fc..e4cb4ef 100644 --- a/tools/traffic_annotation/summary/grouping.xml +++ b/tools/traffic_annotation/summary/grouping.xml
@@ -14,11 +14,30 @@ <groups> <group name="Mobile" hidden="true"> <!-- Android-specific features --> - <sender name="Android"> + <sender name="Android Unsorted"> <traffic_annotation unique_id="android_device_manager_socket"/> <traffic_annotation unique_id="android_web_socket"/> <traffic_annotation unique_id="query_tiles_fetcher"/> <traffic_annotation unique_id="query_tiles_image_loader"/> + <traffic_annotation unique_id="autofill_service"/> + <traffic_annotation unique_id="cached_image_fetcher"/> + <traffic_annotation unique_id="chime_sdk"/> + <traffic_annotation unique_id="chrome_android_hats"/> + <traffic_annotation unique_id="contextual_search_resolve"/> + <traffic_annotation unique_id="customtabs_parallel_request"/> + <traffic_annotation unique_id="download_bitmap"/> + <traffic_annotation unique_id="download_manager_service_retry"/> + <traffic_annotation unique_id="explore_sites"/> + <traffic_annotation unique_id="explore_sites_catalog_fetcher"/> + <traffic_annotation unique_id="explore_sites_image_fetcher"/> + <traffic_annotation unique_id="family_info"/> + <traffic_annotation unique_id="gstatic_change_password_scripts"/> + <traffic_annotation unique_id="gstatic_onboarding_definition"/> + <traffic_annotation unique_id="kids_chrome_management_client_classify_url"/> + <traffic_annotation unique_id="partner_bookmarks_reader_get_favicon"/> + <traffic_annotation unique_id="permission_request_creator"/> + <traffic_annotation unique_id="publish_note_request"/> + <traffic_annotation unique_id="rlz"/> </sender> <sender name="Feed Library"> <traffic_annotation unique_id="interest_feedv2_send"/> @@ -449,9 +468,6 @@ <sender name="Assist Rank"> <traffic_annotation unique_id="ranker_url_fetcher"/> </sender> - <sender name="Memories"> - <traffic_annotation unique_id="memories_remote_model_request"/> - </sender> <sender name="Whats New"> <traffic_annotation unique_id="whats_new_handler"/> </sender>
diff --git a/ui/accessibility/platform/BUILD.gn b/ui/accessibility/platform/BUILD.gn index 2512721..ad4ac3ca 100644 --- a/ui/accessibility/platform/BUILD.gn +++ b/ui/accessibility/platform/BUILD.gn
@@ -69,6 +69,7 @@ "inspect/ax_inspect_scenario.h", "inspect/ax_inspect_utils.cc", "inspect/ax_inspect_utils.h", + "inspect/ax_optional.h", "inspect/ax_property_node.cc", "inspect/ax_property_node.h", "inspect/ax_script_instruction.cc",
diff --git a/ui/accessibility/platform/inspect/ax_optional.h b/ui/accessibility/platform/inspect/ax_optional.h new file mode 100644 index 0000000..f9411e2 --- /dev/null +++ b/ui/accessibility/platform/inspect/ax_optional.h
@@ -0,0 +1,84 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_ACCESSIBILITY_PLATFORM_INSPECT_AX_OPTIONAL_H_ +#define UI_ACCESSIBILITY_PLATFORM_INSPECT_AX_OPTIONAL_H_ + +#include "build/build_config.h" +#include "ui/accessibility/ax_export.h" + +namespace ui { + +// Implements stateful value_s. Similar to absl::optional, but multi-state +// allowing nullable value_s. +template <typename ValueType> +class AX_EXPORT AXOptional final { + public: + static constexpr AXOptional Unsupported() { return AXOptional(kUnsupported); } + static constexpr AXOptional Error() { return AXOptional(kError); } + static constexpr AXOptional NotApplicable() { + return AXOptional(kNotApplicable); + } + static constexpr AXOptional NotNullOrError(ValueType other_value_) { + return AXOptional(other_value_, other_value_ != nullptr ? kValue : kError); + } + static constexpr AXOptional NotNullOrNotApplicable(ValueType other_value_) { + return AXOptional(other_value_, + other_value_ != nullptr ? kValue : kNotApplicable); + } + + explicit constexpr AXOptional(ValueType value_) + : value_(value_), flag_(kValue) {} + + bool constexpr IsUnsupported() const { return flag_ == kUnsupported; } + bool constexpr IsNotApplicable() const { return flag_ == kNotApplicable; } + bool constexpr IsError() const { return flag_ == kError; } + bool constexpr IsNotNull() const { return value_ != nullptr; } + bool constexpr HasValue() { return flag_ == kValue; } + constexpr const ValueType& operator*() const { return value_; } + + std::string ToString() const { + if (IsNotNull()) + return "<value>"; + return StateToString(); + } + + std::string StateToString() const { + if (IsNotApplicable()) + return "<n/a>"; + if (IsUnsupported()) + return "<unsupported>"; + if (IsError()) + return "<error>"; + if (!IsNotNull()) + return "<null>"; + return ""; + } + + private: + enum State { + // Indicates a valid value_; can be null. + kValue, + + // Indicates an error, such as call or parser errors. + kError, + + // Indicates a called property is not applicable to the object. + kNotApplicable, + + // Indicates the property can't have an associated object. + kUnsupported, + }; + + explicit constexpr AXOptional(State flag_) : value_(nullptr), flag_(flag_) {} + explicit constexpr AXOptional(ValueType value_, State flag_) + : value_(value_), flag_(flag_) {} + + ValueType value_; + State flag_; +}; + +} // namespace ui + +#endif // UI_ACCESSIBILITY_PLATFORM_INSPECT_AX_OPTIONAL_H_
diff --git a/ui/base/data_transfer_policy/data_transfer_endpoint.cc b/ui/base/data_transfer_policy/data_transfer_endpoint.cc index 3d8c18e..0c729bc 100644 --- a/ui/base/data_transfer_policy/data_transfer_endpoint.cc +++ b/ui/base/data_transfer_policy/data_transfer_endpoint.cc
@@ -5,6 +5,7 @@ #include "ui/base/data_transfer_policy/data_transfer_endpoint.h" #include "base/check_op.h" +#include "base/stl_util.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "url/origin.h" @@ -43,6 +44,10 @@ DataTransferEndpoint::~DataTransferEndpoint() = default; +const url::Origin* DataTransferEndpoint::GetOrigin() const { + return base::OptionalOrNullptr(origin_); +} + bool DataTransferEndpoint::IsSameOriginWith( const DataTransferEndpoint& other) const { return IsUrlType() && (type_ == other.type_) && (origin_ == other.origin_);
diff --git a/ui/base/data_transfer_policy/data_transfer_endpoint.h b/ui/base/data_transfer_policy/data_transfer_endpoint.h index a79c8c6..75815e0 100644 --- a/ui/base/data_transfer_policy/data_transfer_endpoint.h +++ b/ui/base/data_transfer_policy/data_transfer_endpoint.h
@@ -5,7 +5,6 @@ #ifndef UI_BASE_DATA_TRANSFER_POLICY_DATA_TRANSFER_ENDPOINT_H_ #define UI_BASE_DATA_TRANSFER_POLICY_DATA_TRANSFER_ENDPOINT_H_ -#include "base/stl_util.h" #include "build/chromeos_buildflags.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "url/origin.h" @@ -62,7 +61,7 @@ bool IsUrlType() const { return type_ == EndpointType::kUrl; } - const url::Origin* origin() const { return base::OptionalOrNullptr(origin_); } + const url::Origin* GetOrigin() const; EndpointType type() const { return type_; }
diff --git a/ui/base/data_transfer_policy/data_transfer_endpoint_unittest.cc b/ui/base/data_transfer_policy/data_transfer_endpoint_unittest.cc index 222c0d75..75587b7 100644 --- a/ui/base/data_transfer_policy/data_transfer_endpoint_unittest.cc +++ b/ui/base/data_transfer_policy/data_transfer_endpoint_unittest.cc
@@ -30,7 +30,7 @@ DataTransferEndpoint clone2(original2); EXPECT_EQ(original2.type(), clone2.type()); - EXPECT_TRUE(clone2.origin()->IsSameOriginWith(*original2.origin())); + EXPECT_TRUE(clone2.GetOrigin()->IsSameOriginWith(*original2.GetOrigin())); EXPECT_EQ(original2.notify_if_restricted(), clone2.notify_if_restricted()); }
diff --git a/ui/base/dragdrop/os_exchange_data_provider_non_backed_unittest.cc b/ui/base/dragdrop/os_exchange_data_provider_non_backed_unittest.cc index 9a9134c..1b66938 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_non_backed_unittest.cc +++ b/ui/base/dragdrop/os_exchange_data_provider_non_backed_unittest.cc
@@ -88,7 +88,7 @@ DataTransferEndpoint* data_endpoint = copy->GetSource(); EXPECT_TRUE(data_endpoint); EXPECT_TRUE(data_endpoint->IsUrlType()); - EXPECT_EQ(origin, *data_endpoint->origin()); + EXPECT_EQ(origin, *data_endpoint->GetOrigin()); } TEST(OSExchangeDataProviderNonBackedTest, FileNameCloneTest) {
diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn index 670c882..e89ad85 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn
@@ -782,6 +782,7 @@ "geometry/size_unittest.cc", "geometry/skia_conversions_unittest.cc", "geometry/transform_util_unittest.cc", + "geometry/triangle_unittest.cc", "geometry/vector2d_f_unittest.cc", "geometry/vector2d_unittest.cc", "geometry/vector3d_unittest.cc",
diff --git a/ui/gfx/geometry/BUILD.gn b/ui/gfx/geometry/BUILD.gn index abc446c..1436c095 100644 --- a/ui/gfx/geometry/BUILD.gn +++ b/ui/gfx/geometry/BUILD.gn
@@ -51,6 +51,8 @@ "size_conversions.h", "size_f.cc", "size_f.h", + "triangle_f.cc", + "triangle_f.h", "vector2d.cc", "vector2d.h", "vector2d_conversions.cc",
diff --git a/ui/gfx/geometry/quad_f.cc b/ui/gfx/geometry/quad_f.cc index 8ed8b91..80ef28f 100644 --- a/ui/gfx/geometry/quad_f.cc +++ b/ui/gfx/geometry/quad_f.cc
@@ -7,6 +7,7 @@ #include <limits> #include "base/strings/stringprintf.h" +#include "ui/gfx/geometry/triangle_f.h" namespace gfx { @@ -62,37 +63,6 @@ return element1 + element2 < element3 + element4; } -static inline bool PointIsInTriangle(const PointF& point, - const PointF& r1, - const PointF& r2, - const PointF& r3) { - // Compute the barycentric coordinates (u, v, w) of |point| relative to the - // triangle (r1, r2, r3) by the solving the system of equations: - // 1) point = u * r1 + v * r2 + w * r3 - // 2) u + v + w = 1 - // This algorithm comes from Christer Ericson's Real-Time Collision Detection. - - Vector2dF r31 = r1 - r3; - Vector2dF r32 = r2 - r3; - Vector2dF r3p = point - r3; - - // Promote to doubles so all the math below is done with doubles, because - // otherwise it gets incorrect results on arm64. - double r31x = r31.x(); - double r31y = r31.y(); - double r32x = r32.x(); - double r32y = r32.y(); - - double denom = r32y * r31x - r32x * r31y; - double u = (r32y * r3p.x() - r32x * r3p.y()) / denom; - double v = (r31x * r3p.y() - r31y * r3p.x()) / denom; - double w = 1.0 - u - v; - - // Use the barycentric coordinates to test if |point| is inside the - // triangle (r1, r2, r2). - return (u >= 0) && (v >= 0) && (w >= 0); -} - bool QuadF::Contains(const PointF& point) const { return PointIsInTriangle(point, p1_, p2_, p3_) || PointIsInTriangle(point, p1_, p3_, p4_);
diff --git a/ui/gfx/geometry/triangle_f.cc b/ui/gfx/geometry/triangle_f.cc new file mode 100644 index 0000000..923cbe3a --- /dev/null +++ b/ui/gfx/geometry/triangle_f.cc
@@ -0,0 +1,42 @@ +// Copyright (c) 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/gfx/geometry/triangle_f.h" + +#include "ui/gfx/geometry/vector2d_f.h" + +namespace gfx { + +bool PointIsInTriangle(const PointF& point, + const PointF& r1, + const PointF& r2, + const PointF& r3) { + // Compute the barycentric coordinates (u, v, w) of |point| relative to the + // triangle (r1, r2, r3) by the solving the system of equations: + // 1) point = u * r1 + v * r2 + w * r3 + // 2) u + v + w = 1 + // This algorithm comes from Christer Ericson's Real-Time Collision Detection. + + Vector2dF r31 = r1 - r3; + Vector2dF r32 = r2 - r3; + Vector2dF r3p = point - r3; + + // Promote to doubles so all the math below is done with doubles, because + // otherwise it gets incorrect results on arm64. + double r31x = r31.x(); + double r31y = r31.y(); + double r32x = r32.x(); + double r32y = r32.y(); + + double denom = r32y * r31x - r32x * r31y; + double u = (r32y * r3p.x() - r32x * r3p.y()) / denom; + double v = (r31x * r3p.y() - r31y * r3p.x()) / denom; + double w = 1.0 - u - v; + + // Use the barycentric coordinates to test if |point| is inside the + // triangle (r1, r2, r2). + return (u >= 0) && (v >= 0) && (w >= 0); +} + +} // namespace gfx \ No newline at end of file
diff --git a/ui/gfx/geometry/triangle_f.h b/ui/gfx/geometry/triangle_f.h new file mode 100644 index 0000000..1702c2f --- /dev/null +++ b/ui/gfx/geometry/triangle_f.h
@@ -0,0 +1,20 @@ +// Copyright (c) 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_GFX_GEOMETRY_TRIANGLE_F_H_ +#define UI_GFX_GEOMETRY_TRIANGLE_F_H_ + +#include "ui/gfx/geometry/geometry_export.h" +#include "ui/gfx/geometry/point_f.h" + +namespace gfx { + +GEOMETRY_EXPORT bool PointIsInTriangle(const PointF& point, + const PointF& r1, + const PointF& r2, + const PointF& r3); + +} + +#endif // UI_GFX_GEOMETRY_TRIANGLE_F_H_ \ No newline at end of file
diff --git a/ui/gfx/geometry/triangle_unittest.cc b/ui/gfx/geometry/triangle_unittest.cc new file mode 100644 index 0000000..41e5a80 --- /dev/null +++ b/ui/gfx/geometry/triangle_unittest.cc
@@ -0,0 +1,43 @@ +// Copyright (c) 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <stddef.h> + +#include "base/cxx17_backports.h" +#include "build/build_config.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/gfx/geometry/point_f.h" +#include "ui/gfx/geometry/triangle_f.h" + +namespace gfx { + +namespace { +constexpr PointF kPointA(1, 1); +constexpr PointF kPointB(10, 1); +constexpr PointF kPointC(1, 10); +} // namespace + +TEST(TriangleTest, PointIsInTriangleInside) { + PointF p(2, 2); + + EXPECT_TRUE(PointIsInTriangle(p, kPointA, kPointB, kPointC)); +} + +TEST(TriangleTest, PointIsInTriangleOutside) { + PointF o(0, 0); + + EXPECT_FALSE(PointIsInTriangle(o, kPointA, kPointB, kPointC)); +} + +TEST(TriangleTest, PointIsInTriangleEdge) { + PointF e(1, 3); + + EXPECT_TRUE(PointIsInTriangle(e, kPointA, kPointB, kPointC)); +} + +TEST(TriangleTest, PointIsInTriangleVertex) { + EXPECT_TRUE(PointIsInTriangle(kPointA, kPointA, kPointB, kPointC)); +} + +} // namespace gfx \ No newline at end of file
diff --git a/ui/gl/test/DEPS b/ui/gl/test/DEPS index 0349f94..f78af79 100644 --- a/ui/gl/test/DEPS +++ b/ui/gl/test/DEPS
@@ -1,7 +1,6 @@ include_rules = [ "+ui/base", "+ui/ozone/public", - "+ui/platform_window/x11", "+mojo/core/embedder", "+services/service_manager/public", "+services/viz/public",
diff --git a/ui/ozone/BUILD.gn b/ui/ozone/BUILD.gn index 9a2f42e..3fde8b33 100644 --- a/ui/ozone/BUILD.gn +++ b/ui/ozone/BUILD.gn
@@ -359,6 +359,10 @@ } test("ozone_unittests") { + if (is_chromeos_lacros && is_chromeos_device) { + configs += [ "//build/lacros:optional_shared_libgcc" ] + } + deps = [ ":test_support", "//ui/ozone/common:unittests",
diff --git a/ui/ozone/platform/wayland/gpu/wayland_gl_egl_utility.cc b/ui/ozone/platform/wayland/gpu/wayland_gl_egl_utility.cc index 0f43dda..a71b56c 100644 --- a/ui/ozone/platform/wayland/gpu/wayland_gl_egl_utility.cc +++ b/ui/ozone/platform/wayland/gpu/wayland_gl_egl_utility.cc
@@ -16,7 +16,6 @@ #ifndef EGL_ANGLE_platform_angle #define EGL_ANGLE_platform_angle 1 #define EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE 0x348F -#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE 0x3209 #endif /* EGL_ANGLE_platform_angle */ #ifndef EGL_ANGLE_platform_angle_vulkan @@ -24,21 +23,9 @@ #define EGL_PLATFORM_VULKAN_DISPLAY_MODE_HEADLESS_ANGLE 0x34A5 #endif /* EGL_ANGLE_platform_angle_vulkan */ -#ifndef EGL_ANGLE_platform_angle_device_type_egl_angle -#define EGL_ANGLE_platform_angle_device_type_egl_angle -#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE 0x348E -#endif /* EGL_ANGLE_platform_angle_device_type_egl_angle */ - -#ifndef EGL_ANGLE_platform_angle_opengl -#define EGL_ANGLE_platform_angle_opengl 1 -#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D -#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E -#endif /* EGL_ANGLE_platform_angle_opengl */ - namespace ui { WaylandGLEGLUtility::WaylandGLEGLUtility() = default; - WaylandGLEGLUtility::~WaylandGLEGLUtility() = default; void WaylandGLEGLUtility::GetAdditionalEGLAttributes( @@ -53,17 +40,6 @@ EGL_PLATFORM_VULKAN_DISPLAY_MODE_HEADLESS_ANGLE); return; } - - if (std::find(display_attributes->begin(), display_attributes->end(), - EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE) != - display_attributes->end() || - std::find(display_attributes->begin(), display_attributes->end(), - EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE) != - display_attributes->end()) { - display_attributes->push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE); - display_attributes->push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE); - return; - } } void WaylandGLEGLUtility::ChooseEGLAlphaAndBufferSize(EGLint* alpha_size,
diff --git a/ui/ozone/platform/wayland/gpu/wayland_surface_factory.cc b/ui/ozone/platform/wayland/gpu/wayland_surface_factory.cc index aa02b6fa7..486846f 100644 --- a/ui/ozone/platform/wayland/gpu/wayland_surface_factory.cc +++ b/ui/ozone/platform/wayland/gpu/wayland_surface_factory.cc
@@ -152,14 +152,8 @@ gl::GLImplementationParts(gl::kGLImplementationEGLGLES2)); impls.emplace_back( gl::GLImplementationParts(gl::kGLImplementationSwiftShaderGL)); - // Add only supported ANGLE implementations. Otherwise, angle-vulkan might - // be requested, which is not supported with this backend yet. impls.emplace_back( gl::GLImplementationParts(gl::ANGLEImplementation::kSwiftShader)); - impls.emplace_back( - gl::GLImplementationParts(gl::ANGLEImplementation::kOpenGL)); - impls.emplace_back( - gl::GLImplementationParts(gl::ANGLEImplementation::kOpenGLES)); } return impls; }