diff --git a/DEPS b/DEPS index 7edfe31..f9540d8 100644 --- a/DEPS +++ b/DEPS
@@ -247,7 +247,7 @@ # 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': '36fcf80b1f2a99fdaa46d044994dfe96a08d7362', + 'angle_revision': '8419f4fcd1ec05ffac0ac51a1ac73f343dab00f4', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -314,7 +314,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': '895afdf921d39c15ec8b6c072e08d12961f797b1', + 'devtools_frontend_revision': 'b47975a82916c1852f5ef7e2235b8648bbb0df38', # 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. @@ -738,7 +738,7 @@ 'packages': [ { 'package': 'chromium/rts/model/windows-amd64', - 'version': 'K9BP5YhVbtP-iXTbJU0dbwRi9gaMI_w2x0OtulD3R_oC', + 'version': 'c47NwE87KkjD2MrTSkYBCdjdqtM-53Q3x4D55ICz5HgC', }, ], 'dep_type': 'cipd', @@ -799,7 +799,7 @@ 'packages': [ { 'package': 'chromium/third_party/androidx', - 'version': '51KZuMRReilT3sNyF1-vaB_9ciuTsRJxv8kUH1eLbDgC', + 'version': '22GLME4Ax-0a0SJo1MSxARBmZMMz-SMyTlRHX8fYhW8C', }, ], 'condition': 'checkout_android', @@ -1038,7 +1038,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '9e5809e98f33a5f9f9d3b69a5bd826ce8a7a5a81', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '48b35e123dff26b1ede11104316cbb7f462db4e8', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -1421,7 +1421,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'f9abf9948a180a56a3595ec54ff9f2f5c2c9947c', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '22467673a50f5599e7d8b1f49982faf7c1bc30d9', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1642,7 +1642,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'c843f8d63c8c17acfbb7d48e09059a581ba779b9', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '63b97de330fe3d4775b9b4df8ad15c7593d58fc0', + Var('webrtc_git') + '/src.git' + '@' + 'd525e2d9f71f02832a8c8d2d63d47b96c16a00fe', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1700,7 +1700,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@3772b4e1977a26513f2da475016bd6912a1c9c65', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@b52ee54b2a18637068d39e2aa0f4d94588076891', 'condition': 'checkout_src_internal', }, @@ -1741,7 +1741,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/projector_app/app', - 'version': 'FchxTKMvfxSkGTLMU23cSyqvexH52wHP-zPlLYF6QqUC', + 'version': 'jZ1wDChducDMF-MWFvXLkLZpk_AWan76x5hDRvEhqLoC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/android_webview/browser/aw_pac_processor.cc b/android_webview/browser/aw_pac_processor.cc index 6d97085..c9a07ff 100644 --- a/android_webview/browser/aw_pac_processor.cc +++ b/android_webview/browser/aw_pac_processor.cc
@@ -20,7 +20,6 @@ #include "base/bind.h" #include "base/logging.h" #include "base/memory/raw_ptr.h" -#include "base/no_destructor.h" #include "base/task/post_task.h" #include "base/task/thread_pool/thread_pool_instance.h" #include "base/threading/thread_restrictions.h"
diff --git a/android_webview/browser/gfx/task_queue_webview.cc b/android_webview/browser/gfx/task_queue_webview.cc index e5cb6dc..424cd9e 100644 --- a/android_webview/browser/gfx/task_queue_webview.cc +++ b/android_webview/browser/gfx/task_queue_webview.cc
@@ -12,7 +12,6 @@ #include "base/bind.h" #include "base/containers/queue.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/synchronization/condition_variable.h" #include "base/synchronization/lock.h" #include "base/thread_annotations.h"
diff --git a/android_webview/browser/metrics/aw_metrics_service_client.cc b/android_webview/browser/metrics/aw_metrics_service_client.cc index 4b174be8..00318a9 100644 --- a/android_webview/browser/metrics/aw_metrics_service_client.cc +++ b/android_webview/browser/metrics/aw_metrics_service_client.cc
@@ -17,7 +17,6 @@ #include "base/files/file_path.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/persistent_histogram_allocator.h" -#include "base/no_destructor.h" #include "base/time/time.h" #include "components/metrics/metrics_pref_names.h" #include "components/metrics/metrics_service.h"
diff --git a/android_webview/nonembedded/component_updater/aw_component_update_service.cc b/android_webview/nonembedded/component_updater/aw_component_update_service.cc index 38c1e8e..579f425 100644 --- a/android_webview/nonembedded/component_updater/aw_component_update_service.cc +++ b/android_webview/nonembedded/component_updater/aw_component_update_service.cc
@@ -16,6 +16,7 @@ #include "base/callback_helpers.h" #include "base/check.h" #include "base/command_line.h" +#include "base/no_destructor.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "components/component_updater/component_installer.h"
diff --git a/android_webview/test/shell/src/draw_fn/allocator.cc b/android_webview/test/shell/src/draw_fn/allocator.cc index 1081d7aa..4dab180 100644 --- a/android_webview/test/shell/src/draw_fn/allocator.cc +++ b/android_webview/test/shell/src/draw_fn/allocator.cc
@@ -6,6 +6,7 @@ #include "android_webview/public/browser/draw_fn.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/notreached.h" namespace draw_fn {
diff --git a/ash/app_list/views/continue_section_view_unittest.cc b/ash/app_list/views/continue_section_view_unittest.cc index ff50472..3d9ddba 100644 --- a/ash/app_list/views/continue_section_view_unittest.cc +++ b/ash/app_list/views/continue_section_view_unittest.cc
@@ -29,6 +29,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/events/event.h" #include "ui/events/keycodes/keyboard_codes.h" +#include "ui/views/animation/ink_drop.h" #include "ui/views/controls/textfield/textfield.h" namespace ash { @@ -726,5 +727,57 @@ EXPECT_TRUE(GetContinueSectionView()->GetVisible()); } +TEST_P(ContinueSectionViewTest, TaskViewHasRippleWithMenuOpen) { + AddSearchResult("id1", AppListSearchResultType::kFileChip); + AddSearchResult("id2", AppListSearchResultType::kDriveChip); + AddSearchResult("id3", AppListSearchResultType::kDriveChip); + + EnsureLauncherShown(); + VerifyResultViewsUpdated(); + + ContinueTaskView* continue_task_view = GetResultViewAt(0); + EXPECT_EQ(continue_task_view->result()->id(), "id1"); + + GetContinueSectionView()->GetWidget()->LayoutRootViewIfNecessary(); + SimulateRightClickOrLongPressAt( + continue_task_view->GetBoundsInScreen().CenterPoint()); + EXPECT_TRUE(continue_task_view->IsMenuShowing()); + + EXPECT_EQ(views::InkDropState::ACTIVATED, + views::InkDrop::Get(continue_task_view) + ->GetInkDrop() + ->GetTargetInkDropState()); +} + +TEST_P(ContinueSectionViewTest, TaskViewHidesRippleAfterMenuCloses) { + AddSearchResult("id1", AppListSearchResultType::kFileChip); + AddSearchResult("id2", AppListSearchResultType::kDriveChip); + AddSearchResult("id3", AppListSearchResultType::kDriveChip); + + EnsureLauncherShown(); + VerifyResultViewsUpdated(); + + ContinueTaskView* continue_task_view = GetResultViewAt(0); + EXPECT_EQ(continue_task_view->result()->id(), "id1"); + + GetContinueSectionView()->GetWidget()->LayoutRootViewIfNecessary(); + SimulateRightClickOrLongPressAt( + continue_task_view->GetBoundsInScreen().CenterPoint()); + EXPECT_TRUE(continue_task_view->IsMenuShowing()); + + // Click on other task view to hide context menu. + GetContinueSectionView()->GetWidget()->LayoutRootViewIfNecessary(); + SimulateRightClickOrLongPressAt( + GetResultViewAt(2)->GetBoundsInScreen().CenterPoint()); + EXPECT_FALSE(continue_task_view->IsMenuShowing()); + + // Wait for the view to update the ink drop. + base::RunLoop().RunUntilIdle(); + + EXPECT_EQ(views::InkDropState::HIDDEN, views::InkDrop::Get(continue_task_view) + ->GetInkDrop() + ->GetTargetInkDropState()); +} + } // namespace } // namespace ash
diff --git a/ash/app_list/views/continue_task_view.cc b/ash/app_list/views/continue_task_view.cc index a42e814..48a044bb 100644 --- a/ash/app_list/views/continue_task_view.cc +++ b/ash/app_list/views/continue_task_view.cc
@@ -152,6 +152,8 @@ } void ContinueTaskView::OnButtonPressed(const ui::Event& event) { + views::InkDrop::Get(this)->GetInkDrop()->AnimateToState( + views::InkDropState::ACTION_TRIGGERED); OpenResult(event.flags()); } @@ -173,12 +175,15 @@ void ContinueTaskView::UpdateResult() { SetVisible(!!result()); + views::InkDrop::Get(this)->GetInkDrop()->AnimateToState( + views::InkDropState::HIDDEN); + CloseContextMenu(); + if (!result()) { SetIcon(gfx::ImageSkia()); title_->SetText(std::u16string()); subtitle_->SetText(std::u16string()); GetViewAccessibility().OverrideName(std::u16string()); - CloseContextMenu(); return; } @@ -195,6 +200,9 @@ } void ContinueTaskView::SetResult(SearchResult* result) { + if (result_ == result) + return; + search_result_observation_.Reset(); result_ = result; @@ -222,6 +230,8 @@ source->GetWidget(), nullptr /*button_controller*/, source->GetBoundsInScreen(), views::MenuAnchorPosition::kBubbleTopRight, source_type); + views::InkDrop::Get(this)->GetInkDrop()->AnimateToState( + views::InkDropState::ACTIVATED); } void ContinueTaskView::ExecuteCommand(int command_id, int event_flags) { @@ -254,6 +264,11 @@ return context_menu_model_.get(); } +void ContinueTaskView::MenuClosed(ui::SimpleMenuModel* menu) { + views::InkDrop::Get(this)->GetInkDrop()->AnimateToState( + views::InkDropState::HIDDEN); +} + void ContinueTaskView::OpenResult(int event_flags) { DCHECK(result()); view_delegate_->OpenSearchResult(
diff --git a/ash/app_list/views/continue_task_view.h b/ash/app_list/views/continue_task_view.h index 749255f..737e987 100644 --- a/ash/app_list/views/continue_task_view.h +++ b/ash/app_list/views/continue_task_view.h
@@ -64,6 +64,7 @@ // SimpleMenuModel::Delegate: void ExecuteCommand(int command_id, int event_flags) override; + void MenuClosed(ui::SimpleMenuModel* source) override; private: void SetIcon(const gfx::ImageSkia& icon);
diff --git a/ash/clipboard/clipboard_nudge_controller.cc b/ash/clipboard/clipboard_nudge_controller.cc index 21a5b162c..63236967 100644 --- a/ash/clipboard/clipboard_nudge_controller.cc +++ b/ash/clipboard/clipboard_nudge_controller.cc
@@ -16,7 +16,6 @@ #include "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #include "components/prefs/scoped_user_pref_update.h"
diff --git a/ash/components/arc/session/arc_vm_client_adapter.cc b/ash/components/arc/session/arc_vm_client_adapter.cc index b1ae4b46..6f04f3b 100644 --- a/ash/components/arc/session/arc_vm_client_adapter.cc +++ b/ash/components/arc/session/arc_vm_client_adapter.cc
@@ -37,7 +37,6 @@ #include "base/logging.h" #include "base/memory/weak_ptr.h" #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "base/posix/eintr_wrapper.h" #include "base/process/launch.h" #include "base/process/process_metrics.h"
diff --git a/ash/components/drivefs/fake_drivefs_launcher_client.cc b/ash/components/drivefs/fake_drivefs_launcher_client.cc index 5ae590086..76546cff 100644 --- a/ash/components/drivefs/fake_drivefs_launcher_client.cc +++ b/ash/components/drivefs/fake_drivefs_launcher_client.cc
@@ -8,6 +8,7 @@ #include <vector> #include "base/bind.h" +#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/strings/string_util.h" #include "base/system/sys_info.h"
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index ac590398..2cf5855 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc
@@ -1154,14 +1154,6 @@ const base::Feature kSyncSettingsCategorization{ "SyncSettingsCategorization", base::FEATURE_DISABLED_BY_DEFAULT}; -// Updates the OOBE sync consent screen -// -// NOTE: The feature will be rolled out via a client-side Finch trial, so the -// actual state will vary. TODO(https://crbug.com/1227417): Migrate config in -// chrome/browser/ash/sync/sync_consent_optional_field_trial.cc -const base::Feature kSyncConsentOptional{"SyncConsentOptional", - base::FEATURE_DISABLED_BY_DEFAULT}; - // Enables battery indicator for styluses in the palette tray const base::Feature kStylusBatteryStatus{"StylusBatteryStatus", base::FEATURE_ENABLED_BY_DEFAULT}; @@ -1822,10 +1814,6 @@ return base::FeatureList::IsEnabled(kSyncSettingsCategorization); } -bool IsSyncConsentOptionalEnabled() { - return base::FeatureList::IsEnabled(kSyncConsentOptional); -} - bool IsStylusBatteryStatusEnabled() { return base::FeatureList::IsEnabled(kStylusBatteryStatus); }
diff --git a/ash/constants/ash_features.h b/ash/constants/ash_features.h index 7292e5c..b34e082 100644 --- a/ash/constants/ash_features.h +++ b/ash/constants/ash_features.h
@@ -438,7 +438,6 @@ COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kSnoopingProtection; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kStylusBatteryStatus; -COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kSyncConsentOptional; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kSyncSettingsCategorization; COMPONENT_EXPORT(ASH_CONSTANTS) @@ -629,7 +628,6 @@ COMPONENT_EXPORT(ASH_CONSTANTS) bool IsShimlessRMAFlowEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsSnoopingProtectionEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsSyncSettingsCategorizationEnabled(); -COMPONENT_EXPORT(ASH_CONSTANTS) bool IsSyncConsentOptionalEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsStylusBatteryStatusEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsSystemChinesePhysicalTypingEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsSystemJapanesePhysicalTypingEnabled();
diff --git a/ash/drag_drop/tab_drag_drop_delegate.cc b/ash/drag_drop/tab_drag_drop_delegate.cc index 011926f..72a4399a 100644 --- a/ash/drag_drop/tab_drag_drop_delegate.cc +++ b/ash/drag_drop/tab_drag_drop_delegate.cc
@@ -16,7 +16,6 @@ #include "ash/wm/splitview/split_view_drag_indicators.h" #include "ash/wm/splitview/split_view_utils.h" #include "ash/wm/tablet_mode/tablet_mode_browser_window_drag_session_windows_hider.h" -#include "base/no_destructor.h" #include "base/pickle.h" #include "base/strings/utf_string_conversions.h" #include "ui/base/clipboard/clipboard_format_type.h"
diff --git a/ash/drag_drop/tab_drag_drop_delegate_unittest.cc b/ash/drag_drop/tab_drag_drop_delegate_unittest.cc index ad2b7ff..232e0a5 100644 --- a/ash/drag_drop/tab_drag_drop_delegate_unittest.cc +++ b/ash/drag_drop/tab_drag_drop_delegate_unittest.cc
@@ -20,7 +20,6 @@ #include "ash/wm/splitview/split_view_controller.h" #include "ash/wm/tablet_mode/tablet_mode_controller_test_api.h" #include "base/containers/flat_map.h" -#include "base/no_destructor.h" #include "base/pickle.h" #include "base/strings/utf_string_conversions.h" #include "base/test/gmock_callback_support.h"
diff --git a/ash/hud_display/ash_tracing_handler.cc b/ash/hud_display/ash_tracing_handler.cc index 06fe6d8b..d865b2c1 100644 --- a/ash/hud_display/ash_tracing_handler.cc +++ b/ash/hud_display/ash_tracing_handler.cc
@@ -14,7 +14,6 @@ #include "base/files/file.h" #include "base/files/platform_file.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" #include "base/threading/sequenced_task_runner_handle.h"
diff --git a/ash/services/ime/ime_decoder.cc b/ash/services/ime/ime_decoder.cc index 777f078..2414b6bb 100644 --- a/ash/services/ime/ime_decoder.cc +++ b/ash/services/ime/ime_decoder.cc
@@ -9,6 +9,7 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/logging.h" +#include "base/no_destructor.h" namespace chromeos { namespace ime {
diff --git a/ash/webui/camera_app_ui/document_scanner_service_client.cc b/ash/webui/camera_app_ui/document_scanner_service_client.cc index 92c69a11..4df61ccd 100644 --- a/ash/webui/camera_app_ui/document_scanner_service_client.cc +++ b/ash/webui/camera_app_ui/document_scanner_service_client.cc
@@ -20,25 +20,30 @@ using chromeos::machine_learning::mojom::Rotation; constexpr char kOndeviceDocumentScanner[] = "ondevice_document_scanner"; +constexpr char kMLService[] = "ml_service"; // Returns whether the `value` is set for command line switch // kOndeviceDocumentScanner. -bool DocumentScannerSwitchHasValue(const std::string& value) { +bool HasCommandLineSwitch(const std::string& key, const std::string& value) { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - return command_line->HasSwitch(kOndeviceDocumentScanner) && - command_line->GetSwitchValueASCII(kOndeviceDocumentScanner) == value; + return command_line->HasSwitch(key) && + command_line->GetSwitchValueASCII(key) == value; } // Returns true if switch kOndeviceDocumentScanner is set to use_rootfs. bool IsEnabledOnRootfs() { - return DocumentScannerSwitchHasValue("use_rootfs"); + return HasCommandLineSwitch(kOndeviceDocumentScanner, "use_rootfs"); +} + +bool IsMachineLearningServiceAvailable() { + return HasCommandLineSwitch(kMLService, "enabled"); } } // namespace // static bool DocumentScannerServiceClient::IsSupported() { - return IsEnabledOnRootfs(); + return IsMachineLearningServiceAvailable() && IsEnabledOnRootfs(); } // static
diff --git a/ash/webui/camera_app_ui/resources/js/animation.js b/ash/webui/camera_app_ui/resources/js/animation.js deleted file mode 100644 index 509be57b..0000000 --- a/ash/webui/camera_app_ui/resources/js/animation.js +++ /dev/null
@@ -1,112 +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. - -import {assertInstanceof} from './assert.js'; -import {AsyncJobQueue} from './async_job_queue.js'; - -/** - * @type {!Map<!HTMLElement, !AsyncJobQueue>} - */ -const jobQueueMap = new Map(); - -/** - * Gets the animation job queue for the element. - * @param {!HTMLElement} el - * @return {!AsyncJobQueue} - */ -function getQueueFor(el) { - if (!jobQueueMap.has(el)) { - jobQueueMap.set(el, new AsyncJobQueue()); - } - return jobQueueMap.get(el); -} - -/** - * Gets all the animations running or pending on the element and its - * pseudo-elements. - * TODO(b/176879728): Remove @suppress once we fix the getAnimations() extern - * in upstream Closure compiler. - * @suppress {checkTypes} - * @param {{el: !HTMLElement, onChild: boolean}} param - * @return {!Array<!Animation>} - */ -function getAnimations({el, onChild}) { - return el.getAnimations({subtree: true}) - .filter( - (a) => onChild || - assertInstanceof(a.effect, KeyframeEffect).target === el); -} - -/** - * @param {{el: !HTMLElement, onChild: boolean}} param |el| is the - * target element to cancel animation. |onChild| specifies whether the - * cancelled animation is applied to all subtree children, false by default. - * @return {!Promise} Promise resolved when the animation is cancelled. - */ -async function doCancel({el, onChild}) { - getAnimations({el, onChild}).forEach((a) => a.cancel()); - await getQueueFor(el).flush(); -} - -/** - * Cancels the running animation on the element, if any. - * @param {!HTMLElement} el - * @return {!Promise} Promise resolved when the animation is cancelled. - */ -export async function cancel(el) { - return doCancel({el, onChild: false}); -} - -/** - * Cancels all running animation on children of the element, if any. - * @param {!HTMLElement} el - * @return {!Promise} Promise resolved when all animation is cancelled. - */ -export async function cancelOnChild(el) { - return doCancel({el, onChild: true}); -} - -/** - * Animates the target element once by applying the "animate" class. If the - * animation is already running, the previous one would be cancelled first. - * @param {{el: !HTMLElement, onChild: boolean}} param |el| is the - * target element to apply "animate" class. |onChild| specifies whether the - * animation is applied to all subtree children. - * @return {!Promise} Promise resolved when the animation is settled. - */ -function doPlay({el, onChild}) { - doCancel({el, onChild}); - const queue = getQueueFor(el); - const job = async () => { - /** - * Force repaint before applying the animation. - * @suppress {suspiciousCode} - */ - el.offsetWidth; - el.classList.add('animate'); - await Promise.allSettled( - getAnimations({el, onChild}).map((a) => a.finished)); - el.classList.remove('animate'); - }; - return queue.push(job); -} - -/** - * Sets "animate" class on the element and waits for its animation settled. - * @param {!HTMLElement} el - * @return {!Promise} Promise resolved when the animation is settled. - */ -export function play(el) { - return doPlay({el, onChild: false}); -} - -/** - * Sets "animate" class on the element and waits for its child's animation - * settled. - * @param {!HTMLElement} el - * @return {!Promise} Promise resolved when the child's animation is settled. - */ -export function playOnChild(el) { - return doPlay({el, onChild: true}); -}
diff --git a/ash/webui/camera_app_ui/resources/js/animation.ts b/ash/webui/camera_app_ui/resources/js/animation.ts new file mode 100644 index 0000000..a4f3a52f --- /dev/null +++ b/ash/webui/camera_app_ui/resources/js/animation.ts
@@ -0,0 +1,99 @@ +// 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 {assertInstanceof} from './assert.js'; +import {AsyncJobQueue} from './async_job_queue.js'; + +const jobQueueMap = new Map<HTMLElement, AsyncJobQueue>(); + +/** + * Gets the animation job queue for the element. + */ +function getQueueFor(el: HTMLElement): AsyncJobQueue { + if (!jobQueueMap.has(el)) { + jobQueueMap.set(el, new AsyncJobQueue()); + } + return jobQueueMap.get(el); +} + +/** + * Gets all the animations running or pending on the element and its + * pseudo-elements. + */ +function getAnimations({el, onChild}: {el: HTMLElement, onChild: boolean}): + Animation[] { + return el.getAnimations({subtree: true}) + .filter( + (a) => onChild || + assertInstanceof(a.effect, KeyframeEffect).target === el); +} + +/** + * @param param |el| is the target element to cancel animation. |onChild| + * specifies whether the cancelled animation is applied to all subtree + * children, false by default. + * @return Promise resolved when the animation is cancelled. + */ +async function doCancel({el, onChild}: {el: HTMLElement, onChild: boolean}): + Promise<void> { + getAnimations({el, onChild}).forEach((a) => a.cancel()); + await getQueueFor(el).flush(); +} + +/** + * Cancels the running animation on the element, if any. + * @return Promise resolved when the animation is cancelled. + */ +export async function cancel(el: HTMLElement): Promise<void> { + return doCancel({el, onChild: false}); +} + +/** + * Cancels all running animation on children of the element, if any. + * @return Promise resolved when all animation is cancelled. + */ +export async function cancelOnChild(el: HTMLElement): Promise<void> { + return doCancel({el, onChild: true}); +} + +/** + * Animates the target element once by applying the "animate" class. If the + * animation is already running, the previous one would be cancelled first. + * @param param |el| is the target element to apply "animate" class. |onChild| + * specifies whether the animation is applied to all subtree children. + * @return Promise resolved when the animation is settled. + */ +function doPlay({el, onChild}: {el: HTMLElement, onChild: boolean}): + Promise<void> { + doCancel({el, onChild}); + const queue = getQueueFor(el); + const job = async () => { + /** + * Force repaint before applying the animation. + */ + el.offsetWidth; + el.classList.add('animate'); + await Promise.allSettled( + getAnimations({el, onChild}).map((a) => a.finished)); + el.classList.remove('animate'); + }; + return queue.push(job); +} + +/** + * Sets "animate" class on the element and waits for its animation settled. + * @return Promise resolved when the animation is settled. + */ +export function play(el: HTMLElement): Promise<void> { + return doPlay({el, onChild: false}); +} + +/** + * Sets "animate" class on the element and waits for its child's animation + * settled. + * @return Promise resolved when the child's animation is settled. + */ +export function playOnChild(el: HTMLElement): Promise<void> { + return doPlay({el, onChild: true}); +}
diff --git a/ash/webui/camera_app_ui/resources/js/js.gni b/ash/webui/camera_app_ui/resources/js/js.gni index c897194..29372572 100644 --- a/ash/webui/camera_app_ui/resources/js/js.gni +++ b/ash/webui/camera_app_ui/resources/js/js.gni
@@ -3,7 +3,7 @@ # found in the LICENSE file. compile_js_files = [ - "animation.js", + "animation.ts", "app_window.ts", "assert.ts", "async_job_queue.ts", @@ -56,7 +56,7 @@ "nav.js", "new_feature_toast.js", "perf.js", - "snackbar.js", + "snackbar.ts", "sound.js", "state.js", "test_bridge.ts",
diff --git a/ash/webui/camera_app_ui/resources/js/snackbar.js b/ash/webui/camera_app_ui/resources/js/snackbar.ts similarity index 73% rename from ash/webui/camera_app_ui/resources/js/snackbar.js rename to ash/webui/camera_app_ui/resources/js/snackbar.ts index 77a387295..395baea6 100644 --- a/ash/webui/camera_app_ui/resources/js/snackbar.js +++ b/ash/webui/camera_app_ui/resources/js/snackbar.ts
@@ -4,16 +4,15 @@ import * as animate from './animation.js'; import * as dom from './dom.js'; -// eslint-disable-next-line no-unused-vars import {I18nString} from './i18n_string.js'; import * as loadTimeData from './models/load_time_data.js'; /** * Shows a snackbar message. - * @param {!I18nString} label The label of the message to show. - * @param {...string} substitutions The substitutions for the label. + * @param label The label of the message to show. + * @param substitutions The substitutions for the label. */ -export function show(label, ...substitutions) { +export function show(label: I18nString, ...substitutions: string[]): void { const message = loadTimeData.getI18nMessage(label, ...substitutions); const el = dom.get('.snackbar', HTMLElement); el.textContent = ''; // Force reiterate the same message for a11y.
diff --git a/ash/webui/diagnostics_ui/resources/input_list.html b/ash/webui/diagnostics_ui/resources/input_list.html index 826b0c5..d0c4740 100644 --- a/ash/webui/diagnostics_ui/resources/input_list.html +++ b/ash/webui/diagnostics_ui/resources/input_list.html
@@ -9,16 +9,22 @@ <div id="inputListContainer"> <div class="diagnostics-cards-container"> <div class="card-width"> - <input-card device-type="keyboard" devices="[[keyboards_]]" - on-test-button-click="handleKeyboardTestButtonClick_"> - <div slot="title">[[i18n('inputCategoryKeyboard')]]</div> - </input-card> - <input-card device-type="touchpad" devices="[[touchpads_]]"> - <div slot="title">[[i18n('inputCategoryTouchpad')]]</div> - </input-card> - <input-card device-type="touchscreen" devices="[[touchscreens_]]"> - <div slot="title">[[i18n('inputCategoryTouchscreen')]]</div> - </input-card> + <template is="dom-if" if="[[keyboards_.length]]"> + <input-card device-type="keyboard" devices="[[keyboards_]]" + on-test-button-click="handleKeyboardTestButtonClick_"> + <div slot="title">[[i18n('inputCategoryKeyboard')]]</div> + </input-card> + </template> + <template is="dom-if" if="[[touchpads_.length]]"> + <input-card device-type="touchpad" devices="[[touchpads_]]"> + <div slot="title">[[i18n('inputCategoryTouchpad')]]</div> + </input-card> + </template> + <template is="dom-if" if="[[touchscreens_.length]]"> + <input-card device-type="touchscreen" devices="[[touchscreens_]]"> + <div slot="title">[[i18n('inputCategoryTouchscreen')]]</div> + </input-card> + </template> </div> </div> </div>
diff --git a/ash/wm/haptics_util.cc b/ash/wm/haptics_util.cc index b70c41fea..df7ce04 100644 --- a/ash/wm/haptics_util.cc +++ b/ash/wm/haptics_util.cc
@@ -3,7 +3,6 @@ // found in the LICENSE file. #include "ash/wm/haptics_util.h" -#include "base/no_destructor.h" #include "ui/events/devices/haptic_touchpad_effects.h" #include "ui/ozone/public/input_controller.h" #include "ui/ozone/public/ozone_platform.h"
diff --git a/ash/wm/overview/overview_utils.cc b/ash/wm/overview/overview_utils.cc index ecfd725d..f56cab94 100644 --- a/ash/wm/overview/overview_utils.cc +++ b/ash/wm/overview/overview_utils.cc
@@ -29,7 +29,6 @@ #include "ash/wm/window_util.h" #include "ash/wm/wm_event.h" #include "ash/wm/work_area_insets.h" -#include "base/no_destructor.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" #include "ui/compositor/layer.h"
diff --git a/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc index a05582b..a0e313c 100644 --- a/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc +++ b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc
@@ -21,7 +21,6 @@ #include "base/compiler_specific.h" #include "base/ignore_result.h" #include "base/memory/nonscannable_memory.h" -#include "base/no_destructor.h" #include "base/numerics/checked_math.h" #include "build/build_config.h" #include "build/chromecast_buildflags.h"
diff --git a/base/allocator/partition_alloc_support.cc b/base/allocator/partition_alloc_support.cc index b111c833..7433741 100644 --- a/base/allocator/partition_alloc_support.cc +++ b/base/allocator/partition_alloc_support.cc
@@ -14,6 +14,7 @@ #include "base/check.h" #include "base/ignore_result.h" #include "base/metrics/histogram_functions.h" +#include "base/no_destructor.h" #include "base/threading/platform_thread.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h"
diff --git a/base/allocator/partition_allocator/memory_reclaimer.cc b/base/allocator/partition_allocator/memory_reclaimer.cc index cc4c5bad..5b609b5 100644 --- a/base/allocator/partition_allocator/memory_reclaimer.cc +++ b/base/allocator/partition_allocator/memory_reclaimer.cc
@@ -8,6 +8,7 @@ #include "base/allocator/partition_allocator/partition_alloc_check.h" #include "base/allocator/partition_allocator/partition_alloc_config.h" #include "base/allocator/partition_allocator/starscan/pcscan.h" +#include "base/no_destructor.h" // TODO(bikineev): Temporarily disable *Scan in MemoryReclaimer as it seems to // cause significant jank.
diff --git a/base/android/task_scheduler/post_task_android.cc b/base/android/task_scheduler/post_task_android.cc index 2adcbe59..0c5ecd2 100644 --- a/base/android/task_scheduler/post_task_android.cc +++ b/base/android/task_scheduler/post_task_android.cc
@@ -7,7 +7,6 @@ #include "base/android/jni_string.h" #include "base/android_runtime_jni_headers/Runnable_jni.h" #include "base/base_jni_headers/PostTask_jni.h" -#include "base/no_destructor.h" #include "base/run_loop.h" #include "base/strings/strcat.h" #include "base/task/post_task.h"
diff --git a/base/debug/stack_trace_fuchsia.cc b/base/debug/stack_trace_fuchsia.cc index 7bef573..a2ad540 100644 --- a/base/debug/stack_trace_fuchsia.cc +++ b/base/debug/stack_trace_fuchsia.cc
@@ -24,7 +24,6 @@ #include "base/cxx17_backports.h" #include "base/debug/elf_reader.h" #include "base/logging.h" -#include "base/no_destructor.h" namespace base { namespace debug {
diff --git a/base/files/important_file_writer_cleaner.cc b/base/files/important_file_writer_cleaner.cc index e465e02..ad47e15db 100644 --- a/base/files/important_file_writer_cleaner.cc +++ b/base/files/important_file_writer_cleaner.cc
@@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/files/file_enumerator.h" #include "base/files/file_util.h" +#include "base/no_destructor.h" #include "base/process/process.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h"
diff --git a/base/metrics/dummy_histogram.cc b/base/metrics/dummy_histogram.cc index e1b8925..fb0da279 100644 --- a/base/metrics/dummy_histogram.cc +++ b/base/metrics/dummy_histogram.cc
@@ -8,6 +8,7 @@ #include "base/metrics/histogram_samples.h" #include "base/metrics/metrics_hashes.h" +#include "base/no_destructor.h" #include "base/notreached.h" #include "base/values.h"
diff --git a/base/power_monitor/power_monitor.cc b/base/power_monitor/power_monitor.cc index 52b153a..658edce 100644 --- a/base/power_monitor/power_monitor.cc +++ b/base/power_monitor/power_monitor.cc
@@ -7,6 +7,7 @@ #include <utility> #include "base/logging.h" +#include "base/no_destructor.h" #include "base/power_monitor/power_monitor_source.h" #include "base/trace_event/base_tracing.h" #include "build/build_config.h"
diff --git a/base/task/current_thread.cc b/base/task/current_thread.cc index 718ba706..9e033bdc 100644 --- a/base/task/current_thread.cc +++ b/base/task/current_thread.cc
@@ -9,7 +9,6 @@ #include "base/message_loop/message_pump_for_io.h" #include "base/message_loop/message_pump_for_ui.h" #include "base/message_loop/message_pump_type.h" -#include "base/no_destructor.h" #include "base/task/sequence_manager/sequence_manager_impl.h" #include "base/threading/thread_local.h" #include "base/threading/thread_task_runner_handle.h"
diff --git a/base/task/thread_pool/thread_pool_impl.cc b/base/task/thread_pool/thread_pool_impl.cc index 08ed8a3..44e3c7f 100644 --- a/base/task/thread_pool/thread_pool_impl.cc +++ b/base/task/thread_pool/thread_pool_impl.cc
@@ -17,7 +17,6 @@ #include "base/feature_list.h" #include "base/message_loop/message_pump_type.h" #include "base/metrics/field_trial_params.h" -#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "base/task/scoped_set_task_priority_for_current_thread.h" #include "base/task/task_features.h"
diff --git a/base/threading/thread_local_storage.cc b/base/threading/thread_local_storage.cc index 11cee0c..1655f04 100644 --- a/base/threading/thread_local_storage.cc +++ b/base/threading/thread_local_storage.cc
@@ -8,7 +8,6 @@ #include "base/check_op.h" #include "base/compiler_specific.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/synchronization/lock.h" #include "build/build_config.h"
diff --git a/base/tracing/perfetto_task_runner.cc b/base/tracing/perfetto_task_runner.cc index 7efa4e3..e952731 100644 --- a/base/tracing/perfetto_task_runner.cc +++ b/base/tracing/perfetto_task_runner.cc
@@ -9,7 +9,6 @@ #include "base/bind.h" #include "base/containers/contains.h" -#include "base/no_destructor.h" #include "base/task/common/checked_lock_impl.h" #include "base/task/common/scoped_defer_task_posting.h" #include "base/task/post_task.h"
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 7a1825e..e45fa2c8 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -129,8 +129,8 @@ # TODO(gbiv): We disable optimizations by default on most platforms because # the space overhead is too great. We should use some mixture of profiles and # optimization settings to better tune the size increase. - thin_lto_enable_optimizations = - (is_chromeos_ash || is_android || is_win || is_linux) && is_official_build + thin_lto_enable_optimizations = (is_chromeos_ash || is_android || is_win || + is_linux || is_mac) && is_official_build # Initialize all local variables with a pattern. This flag will fill # uninitialized floating-point types (and 32-bit pointers) with 0xFF and the @@ -654,10 +654,11 @@ if (!is_debug && use_thin_lto && is_a_target_toolchain) { assert(use_lld, "LTO is only supported with lld") - cflags += [ - "-flto=thin", - "-fsplit-lto-unit", - ] + cflags += [ "-flto=thin" ] + if (!is_mac) { + # TODO(lgrey): Enable unit splitting for Mac when supported. + cflags += [ "-fsplit-lto-unit" ] + } # Limit the size of the ThinLTO cache to the lesser of 10% of # available disk space, 40GB and 100000 files.
diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni index a41df19..3520e428 100644 --- a/build/config/compiler/compiler.gni +++ b/build/config/compiler/compiler.gni
@@ -74,7 +74,8 @@ use_thin_lto = is_cfi || (is_clang && is_official_build && chrome_pgo_phase != 1 && - (is_linux || is_win || (is_android && target_os != "chromeos") || + (is_linux || is_win || is_mac || + (is_android && target_os != "chromeos") || ((is_chromeos_ash || is_chromeos_lacros) && is_chromeos_device))) # If true, use Goma for ThinLTO code generation where applicable.
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index f58729d..3aaf1d2 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -7.20211214.2.1 +7.20211215.0.1
diff --git a/build/fuchsia/linux_internal.sdk.sha1 b/build/fuchsia/linux_internal.sdk.sha1 index 1a80232..7ab9e48 100644 --- a/build/fuchsia/linux_internal.sdk.sha1 +++ b/build/fuchsia/linux_internal.sdk.sha1
@@ -1 +1 @@ -7.20211214.3.1 +7.20211215.1.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index f58729d..3aaf1d2 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -7.20211214.2.1 +7.20211215.0.1
diff --git a/cc/paint/paint_cache.cc b/cc/paint/paint_cache.cc index b75a938..8da1afa 100644 --- a/cc/paint/paint_cache.cc +++ b/cc/paint/paint_cache.cc
@@ -6,7 +6,6 @@ #include "base/check_op.h" #include "base/containers/flat_set.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/synchronization/lock.h"
diff --git a/chrome/android/features/autofill_assistant/BUILD.gn b/chrome/android/features/autofill_assistant/BUILD.gn index 47ad37d..714d5d65 100644 --- a/chrome/android/features/autofill_assistant/BUILD.gn +++ b/chrome/android/features/autofill_assistant/BUILD.gn
@@ -89,6 +89,7 @@ "java/src/org/chromium/chrome/browser/autofill_assistant/AssistantRootViewContainer.java", "java/src/org/chromium/chrome/browser/autofill_assistant/AssistantSnackbarFactoryChrome.java", "java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependenciesChrome.java", + "java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtilChrome.java", "java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTagsForTesting.java", "java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTextUtils.java", "java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandlerImpl.java",
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java index 2fb11e6..3ccc891d 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java
@@ -35,7 +35,6 @@ import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantCollectUserDataCoordinator; import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantCollectUserDataModel; import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider; -import org.chromium.chrome.browser.ui.TabObscuringHandler; import org.chromium.components.browser_ui.bottomsheet.BottomSheetContent; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.SheetState; @@ -48,7 +47,6 @@ import org.chromium.content_public.browser.WebContents; import org.chromium.ui.base.ApplicationViewportInsetSupplier; import org.chromium.ui.util.AccessibilityUtil; -import org.chromium.ui.util.TokenHolder; /** * Coordinator responsible for the Autofill Assistant bottom bar. @@ -62,7 +60,8 @@ private final AssistantModel mModel; private final AssistantOverlayCoordinator mOverlayCoordinator; private final BottomSheetController mBottomSheetController; - private final TabObscuringHandler mTabObscuringHandler; + @Nullable + private final AssistantTabObscuringUtil mTabObscuringUtil; private final AssistantBottomSheetContent mContent; private final ScrollView mScrollableContent; private final AssistantRootViewContainer mRootViewContainer; @@ -101,20 +100,17 @@ @AssistantViewportMode private int mTargetViewportMode = AssistantViewportMode.NO_RESIZE; - /** A token held while the assistant is obscuring all tabs. */ - private int mObscuringToken; - AssistantBottomBarCoordinator(Activity activity, AssistantModel model, AssistantOverlayCoordinator overlayCoordinator, BottomSheetController controller, ApplicationViewportInsetSupplier applicationViewportInsetSupplier, - TabObscuringHandler tabObscuringHandler, + @Nullable AssistantTabObscuringUtil tabObscuringUtil, @NonNull BrowserControlsStateProvider browserControlsStateProvider, AccessibilityUtil accessibilityUtil) { mAccessibilityUtil = accessibilityUtil; mModel = model; mOverlayCoordinator = overlayCoordinator; mBottomSheetController = controller; - mTabObscuringHandler = tabObscuringHandler; + mTabObscuringUtil = tabObscuringUtil; mWindowApplicationInsetSupplier = applicationViewportInsetSupplier; mWindowApplicationInsetSupplier.addSupplier(mInsetSupplier); @@ -263,10 +259,9 @@ } } else if (AssistantModel.ALLOW_TALKBACK_ON_WEBSITE == propertyKey) { if (!model.get(AssistantModel.ALLOW_TALKBACK_ON_WEBSITE)) { - mObscuringToken = tabObscuringHandler.obscureAllTabs(); + maybeObscureAllTabs(); } else { - tabObscuringHandler.unobscureAllTabs(mObscuringToken); - mObscuringToken = TokenHolder.INVALID_TOKEN; + maybeUnobscureAllTabs(); } } else if (AssistantModel.WEB_CONTENTS == propertyKey) { mWebContents = model.get(AssistantModel.WEB_CONTENTS); @@ -365,9 +360,7 @@ mAccessibilityUtil.removeObserver(mAccessibilityObserver); mBottomSheetController.removeObserver(mBottomSheetObserver); - if (mObscuringToken != TokenHolder.INVALID_TOKEN) { - mTabObscuringHandler.unobscureAllTabs(mObscuringToken); - } + maybeUnobscureAllTabs(); mInfoBoxCoordinator.destroy(); mInfoBoxCoordinator = null; @@ -507,4 +500,20 @@ } offsetController.onResult(mBottomSheetController.getCurrentOffset()); } + + private void maybeObscureAllTabs() { + if (mTabObscuringUtil == null) { + return; + } + + mTabObscuringUtil.obscureAllTabs(); + } + + private void maybeUnobscureAllTabs() { + if (mTabObscuringUtil == null) { + return; + } + + mTabObscuringUtil.unobscureAllTabs(); + } }
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantCoordinator.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantCoordinator.java index b5868d2..b3d102d2 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantCoordinator.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantCoordinator.java
@@ -17,7 +17,6 @@ import org.chromium.chrome.browser.fullscreen.BrowserControlsManager; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.browser.ui.TabObscuringHandler; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.SheetState; import org.chromium.ui.base.ActivityKeyboardVisibilityDelegate; @@ -41,7 +40,7 @@ private final Supplier<Tab> mCurrentTabSupplier; AssistantCoordinator(Activity activity, BottomSheetController controller, - TabObscuringHandler tabObscuringHandler, + @Nullable AssistantTabObscuringUtil tabObscuringUtil, @Nullable AssistantOverlayCoordinator overlayCoordinator, AssistantKeyboardCoordinator.Delegate keyboardCoordinatorDelegate, @NonNull ActivityKeyboardVisibilityDelegate keyboardDelegate, @NonNull View rootView, @@ -63,8 +62,8 @@ } mBottomBarCoordinator = new AssistantBottomBarCoordinator(activity, mModel, - mOverlayCoordinator, controller, applicationBottomInsetProvider, - tabObscuringHandler, browserControlsManager, accessibilityUtil); + mOverlayCoordinator, controller, applicationBottomInsetProvider, tabObscuringUtil, + browserControlsManager, accessibilityUtil); mKeyboardCoordinator = new AssistantKeyboardCoordinator(activity, keyboardDelegate, rootView, mModel, keyboardCoordinatorDelegate, controller); }
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependenciesChrome.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependenciesChrome.java index 4901c64..3dd4afc6 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependenciesChrome.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependenciesChrome.java
@@ -4,15 +4,33 @@ package org.chromium.chrome.browser.autofill_assistant; +import androidx.annotation.Nullable; + +import org.chromium.chrome.browser.ui.TabObscuringHandler; +import org.chromium.chrome.browser.ui.TabObscuringHandlerSupplier; import org.chromium.chrome.browser.util.ChromeAccessibilityUtil; +import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.util.AccessibilityUtil; /** - * Provides default implemtations of {@link AssistantStaticDependencies} for Chrome. + * Provides default implementations of {@link AssistantStaticDependencies} for Chrome. */ public interface AssistantStaticDependenciesChrome extends AssistantStaticDependencies { @Override default AccessibilityUtil getAccessibilityUtil() { return ChromeAccessibilityUtil.get(); } + + @Override + @Nullable + default AssistantTabObscuringUtil getTabObscuringUtilOrNull(WindowAndroid windowAndroid) { + TabObscuringHandler tabObscuringHandler = + TabObscuringHandlerSupplier.getValueOrNullFrom(windowAndroid); + assert tabObscuringHandler != null; + if (tabObscuringHandler == null) { + return null; + } + + return new AssistantTabObscuringUtilChrome(tabObscuringHandler); + } }
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtilChrome.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtilChrome.java new file mode 100644 index 0000000..f66f09c --- /dev/null +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtilChrome.java
@@ -0,0 +1,36 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.autofill_assistant; + +import org.chromium.chrome.browser.ui.TabObscuringHandler; +import org.chromium.ui.util.TokenHolder; +/** + * Implementation of {@link AssistantTabObscuringUtil} for Chrome. + */ +public class AssistantTabObscuringUtilChrome implements AssistantTabObscuringUtil { + private final TabObscuringHandler mTabObscuringHandler; + + /** A token held while the Autofill Assistant is obscuring all tabs. */ + private int mObscuringToken = TokenHolder.INVALID_TOKEN; + + public AssistantTabObscuringUtilChrome(TabObscuringHandler tabObscuringHandler) { + mTabObscuringHandler = tabObscuringHandler; + } + + @Override + public void obscureAllTabs() { + if (mObscuringToken == TokenHolder.INVALID_TOKEN) { + mTabObscuringHandler.obscureAllTabs(); + } + } + + @Override + public void unobscureAllTabs() { + if (mObscuringToken != TokenHolder.INVALID_TOKEN) { + mTabObscuringHandler.unobscureAllTabs(mObscuringToken); + mObscuringToken = TokenHolder.INVALID_TOKEN; + } + } +}
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java index 4af96f8..43931e7 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java
@@ -28,7 +28,6 @@ import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabUtils; -import org.chromium.chrome.browser.ui.TabObscuringHandler; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.SheetState; import org.chromium.components.browser_ui.bottomsheet.BottomSheetControllerProvider; @@ -128,22 +127,24 @@ // TODO(crbug.com/1048983): Have the params be passed in to the constructor directly rather // than obtaining them from ChromeActivity getters. - return new AutofillAssistantUiController(activity, sheetController, - activity.getTabObscuringHandler(), allowTabSwitching, nativeUiController, - dependencies, overlayCoordinator); + return new AutofillAssistantUiController(activity, sheetController, allowTabSwitching, + nativeUiController, dependencies, overlayCoordinator); } private AutofillAssistantUiController(ChromeActivity activity, BottomSheetController controller, - TabObscuringHandler tabObscuringHandler, boolean allowTabSwitching, - long nativeUiController, AssistantDependencies dependencies, + boolean allowTabSwitching, long nativeUiController, AssistantDependencies dependencies, @Nullable AssistantOverlayCoordinator overlayCoordinator) { mNativeUiController = nativeUiController; mActivity = activity; mDependencies = dependencies; Supplier<View> rootView = activity.getCompositorViewHolderSupplier(); mSnackbarFactory = dependencies.getSnackbarFactory(); + // NOTE: Only create one instance of this unless you know what you are doing. + @Nullable + AssistantTabObscuringUtil tabObscuringUtil = + dependencies.getTabObscuringUtilOrNull(activity.getWindowAndroid()); - mCoordinator = new AssistantCoordinator(activity, controller, tabObscuringHandler, + mCoordinator = new AssistantCoordinator(activity, controller, tabObscuringUtil, overlayCoordinator, this::safeNativeOnKeyboardVisibilityChanged, activity.getWindowAndroid().getKeyboardDelegate(), rootView.get(), activity.getActivityTabProvider(), activity.getBrowserControlsManager(),
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantAutostartTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantAutostartTest.java index e9890ee3..a9e9d1b0 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantAutostartTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantAutostartTest.java
@@ -28,6 +28,7 @@ import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.Collections; @@ -39,10 +40,14 @@ public class AutofillAssistantAutostartTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule).around(new AutofillAssistantCustomTabTestRule( - mTestRule, "autofill_assistant_target_website.html")); + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(new AutofillAssistantCustomTabTestRule( + mTestRule, "autofill_assistant_target_website.html")); /** * Launches autofill assistant with a single autostartable script.
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBackButtonIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBackButtonIntegrationTest.java index f298d368..47a74ff 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBackButtonIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBackButtonIntegrationTest.java
@@ -59,6 +59,7 @@ import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Arrays; @@ -76,8 +77,13 @@ private final AutofillAssistantChromeTabTestRule mTabTestRule = new AutofillAssistantChromeTabTestRule(mTestRule, TEST_PAGE_A); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule - public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around(mTabTestRule); + public final TestRule mRulesChain = + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(mTabTestRule); private String getURL(String page) { return mTabTestRule.getURL(page);
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBottomsheetTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBottomsheetTest.java index d5800fbd..4ab121e 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBottomsheetTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBottomsheetTest.java
@@ -81,6 +81,7 @@ import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -94,10 +95,14 @@ public class AutofillAssistantBottomsheetTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule).around(new AutofillAssistantCustomTabTestRule( - mTestRule, "bottomsheet_behaviour_target_website.html")); + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(new AutofillAssistantCustomTabTestRule( + mTestRule, "bottomsheet_behaviour_target_website.html")); private AutofillAssistantTestScript makeScriptWithActionArray( ArrayList<ActionProto> actionsList) {
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantChromeTabIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantChromeTabIntegrationTest.java index f1e4d67..3033855 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantChromeTabIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantChromeTabIntegrationTest.java
@@ -66,6 +66,7 @@ import org.chromium.components.browser_ui.widget.scrim.ScrimCoordinator; import org.chromium.content_public.browser.test.util.KeyUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import org.chromium.ui.test.util.UiRestriction; import java.util.ArrayList; @@ -84,8 +85,13 @@ private final AutofillAssistantChromeTabTestRule mTabTestRule = new AutofillAssistantChromeTabTestRule(mTestRule, TEST_PAGE_A); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule - public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around(mTabTestRule); + public final TestRule mRulesChain = + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(mTabTestRule); private ScrimCoordinator mScrimCoordinator;
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataIntegrationTest.java index cc593c9e..be1b831 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataIntegrationTest.java
@@ -112,6 +112,7 @@ import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.WebContents; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -130,9 +131,14 @@ public class AutofillAssistantCollectUserDataIntegrationTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule - public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around( - new AutofillAssistantCustomTabTestRule(mTestRule, "form_target_website.html")); + public final TestRule mRulesChain = + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(new AutofillAssistantCustomTabTestRule( + mTestRule, "form_target_website.html")); private AutofillAssistantCollectUserDataTestHelper mHelper;
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java index 855238d1..eb6861d 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java
@@ -39,8 +39,6 @@ import org.chromium.chrome.browser.directactions.DirectActionReporter.Type; import org.chromium.chrome.browser.directactions.FakeDirectActionReporter; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; @@ -57,8 +55,6 @@ private BottomSheetController mBottomSheetController; private DirectActionHandler mHandler; private TestingAutofillAssistantModuleEntryProvider mModuleEntryProvider; - private final SharedPreferencesManager mSharedPreferencesManager = - SharedPreferencesManager.getInstance(); @Before public void setUp() throws Exception { @@ -75,10 +71,8 @@ mActivity.getCompositorViewHolderForTesting(), mActivity.getActivityTabProvider(), mModuleEntryProvider); - mSharedPreferencesManager.removeKey( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED); - mSharedPreferencesManager.removeKey( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN); + AutofillAssistantPreferencesUtil.removeOnboardingAcceptedPreference(); + AutofillAssistantPreferencesUtil.removeSkipInitScreenPreference(); } @Test
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacadeTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacadeTest.java index 8e5fbd03..326f58d 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacadeTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacadeTest.java
@@ -18,8 +18,6 @@ import org.chromium.base.Function; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; @@ -67,20 +65,16 @@ public void proactiveHelpConditions() { Assert.assertTrue(AutofillAssistantPreferencesUtil.isProactiveHelpOn()); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(false); Assert.assertFalse(AutofillAssistantPreferencesUtil.isProactiveHelpOn()); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, false); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(false); Assert.assertFalse(AutofillAssistantPreferencesUtil.isProactiveHelpOn()); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(true); Assert.assertTrue(AutofillAssistantPreferencesUtil.isProactiveHelpOn()); }
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFormActionTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFormActionTest.java index 0b1b99da..cfae927 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFormActionTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFormActionTest.java
@@ -81,6 +81,7 @@ import org.chromium.chrome.browser.util.ChromeAccessibilityUtil; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.test.util.TestThreadUtils; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -94,10 +95,14 @@ public class AutofillAssistantFormActionTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule).around(new AutofillAssistantCustomTabTestRule( - mTestRule, "autofill_assistant_target_website.html")); + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(new AutofillAssistantCustomTabTestRule( + mTestRule, "autofill_assistant_target_website.html")); /** * Creates a close-to-real example of a form action with multiple counters and choices,
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java index 779859a..cafb4df 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java
@@ -164,6 +164,7 @@ import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Arrays; @@ -178,10 +179,14 @@ public class AutofillAssistantGenericUiTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule).around(new AutofillAssistantCustomTabTestRule( - mTestRule, "autofill_assistant_target_website.html")); + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(new AutofillAssistantCustomTabTestRule( + mTestRule, "autofill_assistant_target_website.html")); private AutofillAssistantCollectUserDataTestHelper mHelper;
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserverTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserverTest.java index c3c02d0..609a910 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserverTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserverTest.java
@@ -40,7 +40,7 @@ @Test @SmallTest public void clearFirstTimeUserFlagOnAllTimeHistoryDeletion() { - AutofillAssistantPreferencesUtil.setAutofillAssistantFirstTimeTriggerScriptUser(false); + AutofillAssistantPreferencesUtil.setFirstTimeTriggerScriptUserPreference(false); when(mHistoryDeletionInfo.isTimeRangeForAllTime()).thenReturn(true); mHistoryDeletionObserver.onURLsDeleted(mHistoryDeletionInfo); @@ -51,7 +51,7 @@ @Test @SmallTest public void doesNotClearFirstTimeUserFlagOnPartialHistoryDeletion() { - AutofillAssistantPreferencesUtil.setAutofillAssistantFirstTimeTriggerScriptUser(false); + AutofillAssistantPreferencesUtil.setFirstTimeTriggerScriptUserPreference(false); when(mHistoryDeletionInfo.isTimeRangeForAllTime()).thenReturn(false); mHistoryDeletionObserver.onURLsDeleted(mHistoryDeletionInfo);
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInputActionIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInputActionIntegrationTest.java index ea49cec..ed35e3e0 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInputActionIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInputActionIntegrationTest.java
@@ -63,6 +63,7 @@ import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.test.util.TestCallbackHelperContainer; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -83,9 +84,13 @@ private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule - public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around( - new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); + public final TestRule mRulesChain = + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); @Test @MediumTest
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInterruptIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInterruptIntegrationTest.java index cf95f51..77a4fc8c 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInterruptIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInterruptIntegrationTest.java
@@ -82,6 +82,7 @@ import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.List; @@ -94,10 +95,14 @@ public class AutofillAssistantInterruptIntegrationTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule).around(new AutofillAssistantCustomTabTestRule( - mTestRule, "autofill_assistant_target_website.html")); + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(new AutofillAssistantCustomTabTestRule( + mTestRule, "autofill_assistant_target_website.html")); private static final String MAIN_SCRIPT_PATH = "main_script"; private static final String INTERRUPT_SCRIPT_PATH = "interrupt_script";
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantKeyboardIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantKeyboardIntegrationTest.java index 2d1895a..32b1f4d 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantKeyboardIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantKeyboardIntegrationTest.java
@@ -54,6 +54,7 @@ import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -68,9 +69,13 @@ private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule - public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around( - new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); + public final TestRule mRulesChain = + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); private void runAutofillAssistant(AutofillAssistantTestScript script) { AutofillAssistantTestService testService =
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantNavigationIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantNavigationIntegrationTest.java index d6a7ae47..3f8a5ed 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantNavigationIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantNavigationIntegrationTest.java
@@ -47,6 +47,7 @@ import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Arrays; @@ -64,8 +65,13 @@ private final AutofillAssistantChromeTabTestRule mTabTestRule = new AutofillAssistantChromeTabTestRule(mTestRule, TEST_PAGE_A); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule - public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around(mTabTestRule); + public final TestRule mRulesChain = + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(mTabTestRule); private String getURL(String page) { return mTabTestRule.getURL(page);
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayIntegrationTest.java index 06df15e..f572966 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayIntegrationTest.java
@@ -64,6 +64,7 @@ import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -76,10 +77,14 @@ public class AutofillAssistantOverlayIntegrationTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule).around(new AutofillAssistantCustomTabTestRule( - mTestRule, "autofill_assistant_target_website.html")); + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(new AutofillAssistantCustomTabTestRule( + mTestRule, "autofill_assistant_target_website.html")); /** * Tests that clicking on a document element works with a showcast.
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPasswordManagerIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPasswordManagerIntegrationTest.java index 68cca04..2c7f7ed 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPasswordManagerIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPasswordManagerIntegrationTest.java
@@ -41,6 +41,7 @@ import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.TestThreadUtils; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -53,9 +54,14 @@ public class AutofillAssistantPasswordManagerIntegrationTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule - public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around( - new AutofillAssistantCustomTabTestRule(mTestRule, "form_target_website.html")); + public final TestRule mRulesChain = + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(new AutofillAssistantCustomTabTestRule( + mTestRule, "form_target_website.html")); private WebContents getWebContents() { return mTestRule.getWebContents();
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPersonalDataManagerTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPersonalDataManagerTest.java index b23d7287..ecc2f1f2 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPersonalDataManagerTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPersonalDataManagerTest.java
@@ -84,6 +84,7 @@ import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.TestThreadUtils; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Calendar; @@ -97,9 +98,14 @@ public class AutofillAssistantPersonalDataManagerTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule - public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around( - new AutofillAssistantCustomTabTestRule(mTestRule, "form_target_website.html")); + public final TestRule mRulesChain = + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(new AutofillAssistantCustomTabTestRule( + mTestRule, "form_target_website.html")); private AutofillAssistantCollectUserDataTestHelper mHelper; private AutofillTestHelper mAutofillHelper;
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPromptNavigationIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPromptNavigationIntegrationTest.java index a08a573fc..86e2229d 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPromptNavigationIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPromptNavigationIntegrationTest.java
@@ -33,6 +33,7 @@ import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.test.util.TestThreadUtils; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -47,9 +48,13 @@ private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule - public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around( - new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); + public final TestRule mRulesChain = + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); /** * Integration test for ending a prompt action when a render side navigation occurs.
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTriggerScriptIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTriggerScriptIntegrationTest.java index 78c0c009..503c2e1 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTriggerScriptIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTriggerScriptIntegrationTest.java
@@ -62,8 +62,6 @@ import org.chromium.chrome.browser.autofill_assistant.proto.TriggerScriptConditionsProto; import org.chromium.chrome.browser.autofill_assistant.proto.TriggerScriptProto; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.signin.services.UnifiedConsentServiceBridge; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; @@ -75,6 +73,7 @@ import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.content_public.browser.test.util.TouchCommon; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Arrays; @@ -92,8 +91,13 @@ private final AutofillAssistantChromeTabTestRule mTabTestRule = new AutofillAssistantChromeTabTestRule(mTestRule, TEST_PAGE_A); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule - public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around(mTabTestRule); + public final TestRule mRulesChain = + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(mTabTestRule); private String getURL(String page) { return mTabTestRule.getURL(page); @@ -273,8 +277,7 @@ .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(false); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed()); @@ -324,8 +327,7 @@ .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, true); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(true); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed()); @@ -398,15 +400,13 @@ .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(false); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed()); // Simulate the user accepting the onboarding in a different tab. - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, true); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(true); ArrayList<ActionProto> list = new ArrayList<>(); list.add(ActionProto.newBuilder() @@ -607,8 +607,7 @@ .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(false); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed()); @@ -669,8 +668,7 @@ .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(false); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed());
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTtsIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTtsIntegrationTest.java index d54436d8..f8f786e0 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTtsIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTtsIntegrationTest.java
@@ -58,6 +58,7 @@ import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content.browser.accessibility.BrowserAccessibilityState; import org.chromium.content_public.browser.test.util.TestThreadUtils; +import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -73,9 +74,13 @@ private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); + // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it + // again. @Rule - public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around( - new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); + public final TestRule mRulesChain = + RuleChain.outerRule(mTestRule) + .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) + .around(new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); @Rule public MockitoRule mMockitoRule = MockitoJUnit.rule();
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java index 971988c..f80d580 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java
@@ -106,7 +106,8 @@ private AssistantCoordinator createAndShowAssistantCoordinator() { return TestThreadUtils.runOnUiThreadBlockingNoException(() -> { AssistantCoordinator coordinator = new AssistantCoordinator(getActivity(), - initializeBottomSheet(), getActivity().getTabObscuringHandler(), + initializeBottomSheet(), + new AssistantTabObscuringUtilChrome(getActivity().getTabObscuringHandler()), /* overlayCoordinator= */ null, /* keyboardCoordinatorDelegate= */ null, getActivity().getWindowAndroid().getKeyboardDelegate(),
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromGsaTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromGsaTest.java index 9ff57c01..4ce25de 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromGsaTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromGsaTest.java
@@ -72,7 +72,7 @@ .putExtra(Browser.EXTRA_APPLICATION_ID, IntentHandler.PACKAGE_GSA)); // Enable MSBB. - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(true); TestThreadUtils.runOnUiThreadBlocking(() -> { UnifiedConsentServiceBridge.setUrlKeyedAnonymizedDataCollectionEnabled( AutofillAssistantUiController.getProfile(), true); @@ -135,7 +135,7 @@ withText("TriggerScript"), isDisplayed(), 2 * DEFAULT_MAX_TIME_TO_POLL); // Disabling the proactive help setting should stop the trigger script. - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(false); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(false); TestThreadUtils.runOnUiThreadBlocking( () -> AutofillAssistantTabHelper @@ -149,7 +149,7 @@ // still on a supported URL. testServiceRequestSender.setNextResponse( /* httpStatus = */ 200, createDefaultTriggerScriptResponse("TriggerScript")); - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(true); TestThreadUtils.runOnUiThreadBlocking( () -> AutofillAssistantTabHelper
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromNonGsaTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromNonGsaTest.java index d9bba1b..fa09b3c 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromNonGsaTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromNonGsaTest.java
@@ -51,7 +51,7 @@ } private void enableMsbb() { - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(true); TestThreadUtils.runOnUiThreadBlocking(() -> { UnifiedConsentServiceBridge.setUrlKeyedAnonymizedDataCollectionEnabled( AutofillAssistantUiController.getProfile(), true);
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java index c02bac2..787d4b9 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java
@@ -4,6 +4,9 @@ package org.chromium.chrome.browser.autofill_assistant; +import androidx.annotation.Nullable; + +import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.util.AccessibilityUtil; /** @@ -12,4 +15,11 @@ */ public interface AssistantStaticDependencies { AccessibilityUtil getAccessibilityUtil(); + + /** + * Returns a utility for obscuring all tabs. NOTE: Each call returns a new instance that can + * only unobscure what it obscured! + */ + @Nullable + AssistantTabObscuringUtil getTabObscuringUtilOrNull(WindowAndroid windowAndroid); }
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtil.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtil.java new file mode 100644 index 0000000..ab5865a --- /dev/null +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtil.java
@@ -0,0 +1,21 @@ +// 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.autofill_assistant; + +/** + * Interface for obscuring tabs hiding them from the accessibility tree. + */ +public interface AssistantTabObscuringUtil { + /** + * Notify the system that there is a feature obscuring all visible tabs for accessibility. Hides + * all tabs from the accessibility tree. + */ + void obscureAllTabs(); + /** + * Unobscures the content of all tabs. Note that other parts of the system might still hold the + * tabs obscured. + */ + void unobscureAllTabs(); +}
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserver.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserver.java index baf0255..60ff30a 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserver.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserver.java
@@ -6,8 +6,6 @@ import org.chromium.chrome.browser.history.HistoryDeletionBridge; import org.chromium.chrome.browser.history.HistoryDeletionInfo; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; /** History deletion observer that clears autofill-assistant flags when necessary. */ public class AutofillAssistantHistoryDeletionObserver implements HistoryDeletionBridge.Observer { @@ -16,7 +14,6 @@ if (!historyDeletionInfo.isTimeRangeForAllTime()) { return; } - SharedPreferencesManager.getInstance().removeKey( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER); + AutofillAssistantPreferencesUtil.onClearBrowserHistory(); } }
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferencesUtil.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferencesUtil.java index 7c9f2c30..4a59b0bf 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferencesUtil.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferencesUtil.java
@@ -4,25 +4,35 @@ package org.chromium.chrome.browser.autofill_assistant; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; +import android.content.SharedPreferences; + +import org.chromium.base.ContextUtils; /** Autofill Assistant related preferences util class. */ +// TODO(crbug.com/1069897): Use SharedPreferencesManager again. public class AutofillAssistantPreferencesUtil { + /** Whether Autofill Assistant is enabled */ + private static final String ENABLED_PREFERENCE_KEY = "autofill_assistant_switch"; + /** Whether the Autofill Assistant onboarding has been accepted. */ + private static final String ONBOARDING_ACCEPTED_PREFERENCE_KEY = + "AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED"; + /** Whether the user has seen a lite-script before or is a first-time user. */ + private static final String FIRST_TIME_LITE_SCRIPT_USER_PREFERENCE_KEY = + "Chrome.AutofillAssistant.LiteScriptFirstTimeUser"; + /** Whether proactive help is enabled. */ + private static final String PROACTIVE_HELP_PREFERENCE_KEY = + "Chrome.AutofillAssistant.ProactiveHelp"; /** - * If a user explicitly cancels a lite script >= this number, they will implicitly opt-out of - * this experience and never see a lite script again. Note: this is only temporarily in place - * until we have a better and more user-friendly solution, see crbug.com/1110887. + * @Deprecated preference indicating whether "do not show again" was checked in the autofill + * assistant onboarding */ - private static final int LITE_SCRIPT_MAX_NUM_CANCELED_TO_OPT_OUT = 2; - - // Avoid instantiation by accident. - private AutofillAssistantPreferencesUtil() {} + @Deprecated + private static final String SKIP_INIT_SCREEN_PREFERENCE_KEY = + "AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN"; /** Checks whether the Autofill Assistant switch preference in settings is on. */ static boolean isAutofillAssistantSwitchOn() { - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, true); + return getAssistantEnabledPreference(true); } /** Checks whether proactive help is enabled. */ @@ -40,70 +50,15 @@ return false; } - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, true); - } - - /** Enables or disables the proactive help setting. */ - public static void setProactiveHelpSwitch(boolean enabled) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, enabled); - } - - /** Returns whether the user has seen a trigger script before or not. */ - public static boolean isAutofillAssistantFirstTimeTriggerScriptUser() { - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER, true); - } - - /** Marks a user as having seen a trigger script at least once before. */ - public static void setAutofillAssistantFirstTimeTriggerScriptUser(boolean firstTimeUser) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER, firstTimeUser); - } - - /** Returns the number of times a user has explicitly canceled a lite script. */ - private static int getAutofillAssistantNumberOfLiteScriptsCanceled() { - return SharedPreferencesManager.getInstance().readInt( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_NUMBER_OF_LITE_SCRIPTS_CANCELED, 0); - } - - /** - * Returns whether the user has explicitly canceled the lite script at least {@code - * LITE_SCRIPT_MAX_NUM_CANCELED_TO_OPT_OUT} times. - */ - public static boolean isAutofillAssistantLiteScriptCancelThresholdReached() { - return getAutofillAssistantNumberOfLiteScriptsCanceled() - >= LITE_SCRIPT_MAX_NUM_CANCELED_TO_OPT_OUT; - } - - /** Increments the number of times a user has explicitly canceled a lite script. */ - public static void incrementAutofillAssistantNumberOfLiteScriptsCanceled() { - int numCanceled = getAutofillAssistantNumberOfLiteScriptsCanceled() + 1; - SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance(); - sharedPreferencesManager.writeInt( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_NUMBER_OF_LITE_SCRIPTS_CANCELED, - numCanceled); - if (isAutofillAssistantLiteScriptCancelThresholdReached() - && !sharedPreferencesManager.contains( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED)) { - // Disable the flag, such that users will not see the lite script again. This will also - // create the setting in the Chrome settings, if it was not present before, which will - // allow users to opt back in. - sharedPreferencesManager.writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false); - } + return getProactiveHelpPreference(true); } /** Checks whether the Autofill Assistant onboarding has been accepted. */ public static boolean isAutofillOnboardingAccepted() { - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false) - || + return getOnboardingAcceptedPreference(false) || /* Legacy treatment: users of earlier versions should not have to see the onboarding again if they checked the `do not show again' checkbox*/ - SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN, false); + getSkipInitScreenPreference(false); } /** Checks whether the Autofill Assistant onboarding screen should be shown. */ @@ -121,10 +76,86 @@ */ public static void setInitialPreferences(boolean accept) { if (accept) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, accept); + setAssistantEnabledPreference(accept); } - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, accept); + setOnboardingAcceptedPreference(accept); } + + public static boolean getAssistantEnabledPreference(boolean defaultValue) { + return readBoolean(ENABLED_PREFERENCE_KEY, defaultValue); + } + + public static void setAssistantEnabledPreference(boolean value) { + writeBoolean(ENABLED_PREFERENCE_KEY, value); + } + + public static boolean containsAssistantEnabledPreference() { + return contains(ENABLED_PREFERENCE_KEY); + } + + /* package */ static boolean getOnboardingAcceptedPreference(boolean defaultValue) { + return readBoolean(ONBOARDING_ACCEPTED_PREFERENCE_KEY, defaultValue); + } + + /* package */ static void setOnboardingAcceptedPreference(boolean value) { + writeBoolean(ONBOARDING_ACCEPTED_PREFERENCE_KEY, value); + } + + /* package */ static void removeOnboardingAcceptedPreference() { + remove(ONBOARDING_ACCEPTED_PREFERENCE_KEY); + } + + /** Returns whether the user has seen a trigger script before or not. */ + /* package */ static boolean isAutofillAssistantFirstTimeTriggerScriptUser() { + return readBoolean(FIRST_TIME_LITE_SCRIPT_USER_PREFERENCE_KEY, true); + } + + /** Marks a user as having seen a trigger script at least once before. */ + /* package */ static void setFirstTimeTriggerScriptUserPreference(boolean firstTimeUser) { + writeBoolean(FIRST_TIME_LITE_SCRIPT_USER_PREFERENCE_KEY, firstTimeUser); + } + + /* package */ static void onClearBrowserHistory() { + remove(FIRST_TIME_LITE_SCRIPT_USER_PREFERENCE_KEY); + } + + /* package */ static boolean getProactiveHelpPreference(boolean defaultValue) { + return readBoolean(PROACTIVE_HELP_PREFERENCE_KEY, defaultValue); + } + + /** Enables or disables the proactive help setting. */ + /* package */ static void setProactiveHelpPreference(boolean enabled) { + writeBoolean(PROACTIVE_HELP_PREFERENCE_KEY, enabled); + } + + /* package */ static boolean getSkipInitScreenPreference(boolean defaultValue) { + return readBoolean(SKIP_INIT_SCREEN_PREFERENCE_KEY, defaultValue); + } + + /* package */ static void removeSkipInitScreenPreference() { + remove(SKIP_INIT_SCREEN_PREFERENCE_KEY); + } + + private static boolean readBoolean(String key, boolean defaultValue) { + return ContextUtils.getAppSharedPreferences().getBoolean(key, defaultValue); + } + + private static void writeBoolean(String key, boolean value) { + SharedPreferences.Editor ed = ContextUtils.getAppSharedPreferences().edit(); + ed.putBoolean(key, value); + ed.apply(); + } + + private static boolean contains(String key) { + return ContextUtils.getAppSharedPreferences().contains(key); + } + + private static void remove(String key) { + SharedPreferences.Editor ed = ContextUtils.getAppSharedPreferences().edit(); + ed.remove(key); + ed.apply(); + } + + // Avoid instantiation by accident. + private AutofillAssistantPreferencesUtil() {} }
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java index df18962..096fbe6 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java
@@ -218,8 +218,7 @@ @CalledByNative private static void setIsFirstTimeUser(boolean firstTimeUser) { - AutofillAssistantPreferencesUtil.setAutofillAssistantFirstTimeTriggerScriptUser( - firstTimeUser); + AutofillAssistantPreferencesUtil.setFirstTimeTriggerScriptUserPreference(firstTimeUser); } @CalledByNative @@ -270,7 +269,7 @@ @CalledByNative private static void setProactiveHelpSettingEnabled(boolean enabled) { - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(enabled); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(enabled); } @CalledByNative
diff --git a/chrome/android/features/autofill_assistant/public/java_sources.gni b/chrome/android/features/autofill_assistant/public/java_sources.gni index 86b5c0bb..0b5f53cc 100644 --- a/chrome/android/features/autofill_assistant/public/java_sources.gni +++ b/chrome/android/features/autofill_assistant/public/java_sources.gni
@@ -12,6 +12,7 @@ "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantSnackbar.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantSnackbarFactory.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java", + "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtil.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandler.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectAction.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandler.java",
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java index 12874e1..5d7575d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java
@@ -67,8 +67,7 @@ (ChromeSwitchPreference) findPreference(PREF_AUTOFILL_ASSISTANT); if (shouldShowAutofillAssistantPreference()) { mAutofillAssistantPreference.setOnPreferenceChangeListener((preference, newValue) -> { - mSharedPreferencesManager.writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, (boolean) newValue); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference((boolean) newValue); updatePreferencesState(); return true; }); @@ -80,8 +79,7 @@ (ChromeSwitchPreference) findPreference(PREF_ASSISTANT_PROACTIVE_HELP_SWITCH); if (shouldShowAutofillAssistantProactiveHelpPreference()) { mProactiveHelpPreference.setOnPreferenceChangeListener((preference, newValue) -> { - mSharedPreferencesManager.writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, (boolean) newValue); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference((boolean) newValue); updatePreferencesState(); return true; }); @@ -126,8 +124,7 @@ private boolean shouldShowAutofillAssistantPreference() { return AssistantFeatures.AUTOFILL_ASSISTANT.isEnabled() - && mSharedPreferencesManager.contains( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED); + && AutofillAssistantPreferencesUtil.containsAssistantEnabledPreference(); } private boolean shouldShowAutofillAssistantProactiveHelpPreference() { @@ -140,8 +137,8 @@ } private void updatePreferencesState() { - boolean autofill_assistant_enabled = SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, true); + boolean autofill_assistant_enabled = + AutofillAssistantPreferencesUtil.getAssistantEnabledPreference(true); mAutofillAssistantPreference.setChecked(autofill_assistant_enabled); boolean assistant_switch_on_or_missing = @@ -150,8 +147,8 @@ UnifiedConsentServiceBridge.isUrlKeyedAnonymizedDataCollectionEnabled( Profile.getLastUsedRegularProfile()); - boolean proactive_help_on = SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, true); + boolean proactive_help_on = + AutofillAssistantPreferencesUtil.getProactiveHelpPreference(true); boolean proactive_toggle_enabled; boolean show_disclaimer; if (AssistantFeatures.AUTOFILL_ASSISTANT_DISABLE_PROACTIVE_HELP_TIED_TO_MSBB.isEnabled()) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java index 8e8f6b24..40f8e75 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java
@@ -18,14 +18,13 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.autofill_assistant.AssistantFeatures; +import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantPreferencesUtil; import org.chromium.chrome.browser.contextualsearch.ContextualSearchFieldTrial; import org.chromium.chrome.browser.contextualsearch.ContextualSearchManager; import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncherImpl; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.metrics.UmaSessionStats; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.Pref; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate; @@ -71,8 +70,6 @@ PrivacyPreferencesManagerImpl.getInstance(); private final ManagedPreferenceDelegate mManagedPreferenceDelegate = createManagedPreferenceDelegate(); - private final SharedPreferencesManager mSharedPreferencesManager = - SharedPreferencesManager.getInstance(); private ChromeSwitchPreference mAllowSignin; private ChromeSwitchPreference mSearchSuggestions; @@ -267,18 +264,16 @@ */ private boolean shouldShowAutofillAssistantPreference() { return AssistantFeatures.AUTOFILL_ASSISTANT.isEnabled() - && mSharedPreferencesManager.contains( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED); + && AutofillAssistantPreferencesUtil.containsAssistantEnabledPreference(); } public boolean isAutofillAssistantSwitchOn() { - return mSharedPreferencesManager.readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false); + return AutofillAssistantPreferencesUtil.getAssistantEnabledPreference( + /* defaultValue= */ false); } public void setAutofillAssistantSwitchValue(boolean newValue) { - mSharedPreferencesManager.writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, newValue); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(newValue); } // SignOutDialogListener implementation:
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragmentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragmentTest.java index e76aeab..1ea93d6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragmentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragmentTest.java
@@ -117,11 +117,9 @@ assertTrue(autofillAssistantSwitch.isChecked()); autofillAssistantSwitch.performClick(); - assertFalse(mSharedPreferencesManager.readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, true)); + assertFalse(AutofillAssistantPreferencesUtil.getAssistantEnabledPreference(true)); autofillAssistantSwitch.performClick(); - assertTrue(mSharedPreferencesManager.readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false)); + assertTrue(AutofillAssistantPreferencesUtil.getAssistantEnabledPreference(false)); }); } @@ -288,8 +286,7 @@ } private void setAutofillAssistantSwitchValue(boolean newValue) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, newValue); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(newValue); } private AutofillAssistantPreferenceFragment startAutofillAssistantPreferenceFragment() { @@ -298,7 +295,6 @@ } public boolean isAutofillAssistantSwitchOn() { - return mSharedPreferencesManager.readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false); + return AutofillAssistantPreferencesUtil.getAssistantEnabledPreference(false); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsTest.java index 3e6e593..e719a68 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsTest.java
@@ -385,6 +385,7 @@ final boolean usingPassphrase, final boolean syncingPasswords) { TestThreadUtils.runOnUiThreadBlocking(() -> { when(mMockSyncService.hasSyncConsent()).thenReturn(syncingPasswords); + when(mMockSyncService.isEngineInitialized()).thenReturn(true); when(mMockSyncService.isUsingExplicitPassphrase()).thenReturn(usingPassphrase); when(mMockSyncService.getActiveDataTypes()) .thenReturn(CollectionUtil.newHashSet(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java index 56a49ab4..4eef470 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java
@@ -24,11 +24,10 @@ import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; import org.chromium.chrome.browser.autofill_assistant.AssistantFeatures; +import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantPreferencesUtil; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.Pref; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.settings.SettingsActivityTestRule; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; @@ -331,8 +330,7 @@ } private void setAutofillAssistantSwitchValue(boolean newValue) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, newValue); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(newValue); } private GoogleServicesSettings startGoogleServicesSettings() {
diff --git a/chrome/android/profiles/newest.txt b/chrome/android/profiles/newest.txt index a4a494ff..bade16e 100644 --- a/chrome/android/profiles/newest.txt +++ b/chrome/android/profiles/newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-98.0.4758.7_rc-r1-merged.afdo.bz2 +chromeos-chrome-amd64-98.0.4758.8_rc-r1-merged.afdo.bz2
diff --git a/chrome/app/chrome_crash_reporter_client.cc b/chrome/app/chrome_crash_reporter_client.cc index b34ad0d..59d292c 100644 --- a/chrome/app/chrome_crash_reporter_client.cc +++ b/chrome/app/chrome_crash_reporter_client.cc
@@ -8,6 +8,7 @@ #include "base/environment.h" #include "base/files/file_path.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/path_service.h" #include "base/strings/string_split.h" #include "base/strings/utf_string_conversions.h"
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 7675eb1..9848090 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -8330,6 +8330,9 @@ <message name="IDS_COLLECTED_COOKIES_INFOBAR_BUTTON" desc="The string used in the infobar button allowing the user to reload the page directly from the infobar."> Reload </message> + <message name="IDS_COLLECTED_COOKIES_PARTITIONED_COOKIE" desc="The string used to identify cookies which have been partitioned based on the current site, and so are not available for use on different sites."> + Partitioned + </message> <!-- Accessiblility strings for Infobars in Views --> <if expr="toolkit_views">
diff --git a/chrome/app/generated_resources_grd/IDS_COLLECTED_COOKIES_PARTITIONED_COOKIE.png.sha1 b/chrome/app/generated_resources_grd/IDS_COLLECTED_COOKIES_PARTITIONED_COOKIE.png.sha1 new file mode 100644 index 0000000..649873e --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_COLLECTED_COOKIES_PARTITIONED_COOKIE.png.sha1
@@ -0,0 +1 @@ +07d6d20a03040837c86612cc5fc57f339e14349b \ No newline at end of file
diff --git a/chrome/app/os_settings_strings.grdp b/chrome/app/os_settings_strings.grdp index 305341c..8d92a31 100644 --- a/chrome/app/os_settings_strings.grdp +++ b/chrome/app/os_settings_strings.grdp
@@ -3327,7 +3327,7 @@ Set up PIN </message> <message name="IDS_SETTINGS_PEOPLE_LOCK_SCREEN_TITLE_LOCK" desc="Text on the people page which opens up the quick unlock subpage and the title of the quick unlock subpage."> - Screen lock + Lock screen </message> <message name="IDS_SETTINGS_PEOPLE_LOCK_SCREEN_TITLE_LOGIN_LOCK" desc="Text on the people page which opens up the security and sign-in section."> Security and sign-in
diff --git a/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_PEOPLE_LOCK_SCREEN_TITLE_LOCK.png.sha1 b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_PEOPLE_LOCK_SCREEN_TITLE_LOCK.png.sha1 new file mode 100644 index 0000000..8cfe1e2 --- /dev/null +++ b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_PEOPLE_LOCK_SCREEN_TITLE_LOCK.png.sha1
@@ -0,0 +1 @@ +c849ef6602b8548be8461dc9da0f8d86ea51e0f5 \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 3210670..27d216d 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -4422,8 +4422,6 @@ "usb/web_usb_chooser_desktop.h", "usb/web_usb_detector.cc", "usb/web_usb_detector.h", - "web_launch/web_launch_files_helper.cc", - "web_launch/web_launch_files_helper.h", "webauthn/authenticator_list_observer.h", "webauthn/authenticator_reference.cc", "webauthn/authenticator_reference.h",
diff --git a/chrome/browser/accessibility/live_caption_controller_factory.cc b/chrome/browser/accessibility/live_caption_controller_factory.cc index 2b9ee79..760ba164 100644 --- a/chrome/browser/accessibility/live_caption_controller_factory.cc +++ b/chrome/browser/accessibility/live_caption_controller_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/accessibility/live_caption_controller_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/accessibility/soda_installer_impl.cc b/chrome/browser/accessibility/soda_installer_impl.cc index aa83be3..f88b1ba8 100644 --- a/chrome/browser/accessibility/soda_installer_impl.cc +++ b/chrome/browser/accessibility/soda_installer_impl.cc
@@ -14,7 +14,6 @@ #include "base/cxx17_backports.h" #include "base/feature_list.h" #include "base/files/file_util.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/component_updater/soda_component_installer.h"
diff --git a/chrome/browser/android/autofill_assistant/annotate_dom_model_service_factory.cc b/chrome/browser/android/autofill_assistant/annotate_dom_model_service_factory.cc index 56b6725c..f2b5e388 100644 --- a/chrome/browser/android/autofill_assistant/annotate_dom_model_service_factory.cc +++ b/chrome/browser/android/autofill_assistant/annotate_dom_model_service_factory.cc
@@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/feature_list.h" #include "base/memory/scoped_refptr.h" +#include "base/no_destructor.h" #include "base/task/sequenced_task_runner.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h"
diff --git a/chrome/browser/android/customtabs/detached_resource_request.cc b/chrome/browser/android/customtabs/detached_resource_request.cc index e1071c3..72af983 100644 --- a/chrome/browser/android/customtabs/detached_resource_request.cc +++ b/chrome/browser/android/customtabs/detached_resource_request.cc
@@ -199,29 +199,13 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); int net_error = url_loader_->NetError(); net_error = std::abs(net_error); - auto duration = base::TimeTicks::Now() - start_time_; - switch (motivation_) { - case Motivation::kParallelRequest: { - RecordParallelRequestHistograms("", redirects_, duration, net_error); - if (is_from_aga_) { - RecordParallelRequestHistograms(".FromAga", redirects_, duration, - net_error); - } - break; - } - case Motivation::kResourcePrefetch: { - if (net_error == net::OK) { - UMA_HISTOGRAM_MEDIUM_TIMES( - "CustomTabs.ResourcePrefetch.Duration.Success", duration); - } else { - UMA_HISTOGRAM_MEDIUM_TIMES( - "CustomTabs.ResourcePrefetch.Duration.Failure", duration); - } - - base::UmaHistogramSparse("CustomTabs.ResourcePrefetch.FinalStatus", - net_error); - break; + if (motivation_ == Motivation::kParallelRequest) { + auto duration = base::TimeTicks::Now() - start_time_; + RecordParallelRequestHistograms("", redirects_, duration, net_error); + if (is_from_aga_) { + RecordParallelRequestHistograms(".FromAga", redirects_, duration, + net_error); } }
diff --git a/chrome/browser/android/metrics/android_session_durations_service_factory.cc b/chrome/browser/android/metrics/android_session_durations_service_factory.cc index 29f3c66c..2705d269 100644 --- a/chrome/browser/android/metrics/android_session_durations_service_factory.cc +++ b/chrome/browser/android/metrics/android_session_durations_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/android/metrics/android_session_durations_service_factory.h" +#include "base/no_destructor.h" #include "base/time/time.h" #include "build/build_config.h" #include "chrome/browser/android/metrics/android_session_durations_service.h"
diff --git a/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc b/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc index ac23285..eb510825 100644 --- a/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc +++ b/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc
@@ -8,6 +8,7 @@ #include "base/json/values_util.h" #include "base/metrics/histogram_functions.h" +#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
diff --git a/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc b/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc index e5a2a99..1f43bcf 100644 --- a/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc +++ b/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc
@@ -1614,10 +1614,7 @@ nullptr, ui::VKEY_ESCAPE, false, false, false, false)); }); - std::string button_title = features::IsSyncConsentOptionalEnabled() - ? "Got it" - : "Accept and continue"; - sm_.ExpectSpeech(button_title); + sm_.ExpectSpeech("Accept and continue"); // Check that profile switched to the active user. sm_.Call([]() {
diff --git a/chrome/browser/ash/account_manager/account_apps_availability.cc b/chrome/browser/ash/account_manager/account_apps_availability.cc index 7c2eb94..93795ea 100644 --- a/chrome/browser/ash/account_manager/account_apps_availability.cc +++ b/chrome/browser/ash/account_manager/account_apps_availability.cc
@@ -286,6 +286,11 @@ GetGaiaIdsAvailableInArc(prefs_), std::move(callback))); } +void AccountAppsAvailability::Shutdown() { + identity_manager_observation_.Reset(); + account_manager_facade_observation_.Reset(); +} + void AccountAppsAvailability::OnRefreshTokenUpdatedForAccount( const CoreAccountInfo& account_info) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/chrome/browser/ash/account_manager/account_apps_availability.h b/chrome/browser/ash/account_manager/account_apps_availability.h index 4907befa..13b5e52 100644 --- a/chrome/browser/ash/account_manager/account_apps_availability.h +++ b/chrome/browser/ash/account_manager/account_apps_availability.h
@@ -90,6 +90,9 @@ bool IsInitialized() const; private: + // `KeyedService`: + void Shutdown() override; + // `IdentityManager::Observer`: void OnRefreshTokenUpdatedForAccount( const CoreAccountInfo& account_info) override;
diff --git a/chrome/browser/ash/account_manager/account_apps_availability_factory.cc b/chrome/browser/ash/account_manager/account_apps_availability_factory.cc index a7618e9..1627431 100644 --- a/chrome/browser/ash/account_manager/account_apps_availability_factory.cc +++ b/chrome/browser/ash/account_manager/account_apps_availability_factory.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ash/account_manager/account_apps_availability_factory.h" #include "base/files/file_path.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/account_manager/account_apps_availability.h" #include "chrome/browser/ash/account_manager/account_manager_util.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/ash/android_sms/android_sms_service_factory.cc b/chrome/browser/ash/android_sms/android_sms_service_factory.cc index d486369a..e2ffa2d 100644 --- a/chrome/browser/ash/android_sms/android_sms_service_factory.cc +++ b/chrome/browser/ash/android_sms/android_sms_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/android_sms/android_sms_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/multidevice_setup/multidevice_setup_client_factory.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
diff --git a/chrome/browser/ash/app_restore/full_restore_service_factory.cc b/chrome/browser/ash/app_restore/full_restore_service_factory.cc index 2ef28b8..90598dd 100644 --- a/chrome/browser/ash/app_restore/full_restore_service_factory.cc +++ b/chrome/browser/ash/app_restore/full_restore_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/app_restore/full_restore_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/app_mode/app_mode_utils.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/ash/app_restore/full_restore_prefs.h"
diff --git a/chrome/browser/ash/arc/input_overlay/touch_id_manager.cc b/chrome/browser/ash/arc/input_overlay/touch_id_manager.cc index 19cc9ff..3024c40 100644 --- a/chrome/browser/ash/arc/input_overlay/touch_id_manager.cc +++ b/chrome/browser/ash/arc/input_overlay/touch_id_manager.cc
@@ -8,6 +8,7 @@ #include "base/check.h" #include "base/logging.h" +#include "base/no_destructor.h" namespace arc { namespace {
diff --git a/chrome/browser/ash/arc/process/arc_process.cc b/chrome/browser/ash/arc/process/arc_process.cc index 664d9fd..ba79fca 100644 --- a/chrome/browser/ash/arc/process/arc_process.cc +++ b/chrome/browser/ash/arc/process/arc_process.cc
@@ -7,7 +7,6 @@ #include <utility> #include "ash/components/arc/mojom/process.mojom.h" -#include "base/no_destructor.h" #include "base/strings/string_util.h" namespace arc {
diff --git a/chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc b/chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc index 14e8c8296..e31c6af 100644 --- a/chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc +++ b/chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc
@@ -18,6 +18,7 @@ #include "base/bind.h" #include "base/check_op.h" #include "base/location.h" +#include "base/no_destructor.h" #include "base/rand_util.h" #include "base/strings/string_number_conversions.h" #include "base/threading/thread_checker.h"
diff --git a/chrome/browser/ash/borealis/borealis_service_factory.cc b/chrome/browser/ash/borealis/borealis_service_factory.cc index 4cd204e..6979a4e 100644 --- a/chrome/browser/ash/borealis/borealis_service_factory.cc +++ b/chrome/browser/ash/borealis/borealis_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/borealis/borealis_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/borealis/borealis_service_impl.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/ash/certificate_provider/pin_dialog_manager.cc b/chrome/browser/ash/certificate_provider/pin_dialog_manager.cc index f96930f..fa4974b 100644 --- a/chrome/browser/ash/certificate_provider/pin_dialog_manager.cc +++ b/chrome/browser/ash/certificate_provider/pin_dialog_manager.cc
@@ -40,6 +40,10 @@ sign_requests_.erase(key); } +int PinDialogManager::StoredSignRequestsForTesting() const { + return sign_requests_.size(); +} + PinDialogManager::RequestPinResult PinDialogManager::RequestPin( const std::string& extension_id, const std::string& extension_name,
diff --git a/chrome/browser/ash/certificate_provider/pin_dialog_manager.h b/chrome/browser/ash/certificate_provider/pin_dialog_manager.h index 9b85730..22a0ae68d 100644 --- a/chrome/browser/ash/certificate_provider/pin_dialog_manager.h +++ b/chrome/browser/ash/certificate_provider/pin_dialog_manager.h
@@ -59,6 +59,9 @@ // future PIN dialogs related to it. void RemoveSignRequest(const std::string& extension_id, int sign_request_id); + // Returns the number of pending sign requests stored in sign_requests_ + int StoredSignRequestsForTesting() const; + // Creates and displays a new PIN dialog, or reuses the old dialog with just // updating the parameters if active one exists. // |extension_id| - the ID of the extension requesting the dialog.
diff --git a/chrome/browser/ash/child_accounts/child_status_reporting_service_factory.cc b/chrome/browser/ash/child_accounts/child_status_reporting_service_factory.cc index 410b1d4..a47a0e8 100644 --- a/chrome/browser/ash/child_accounts/child_status_reporting_service_factory.cc +++ b/chrome/browser/ash/child_accounts/child_status_reporting_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/child_accounts/child_status_reporting_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/child_accounts/child_status_reporting_service.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/ash/child_accounts/child_user_service_factory.cc b/chrome/browser/ash/child_accounts/child_user_service_factory.cc index c23098e..2bfbd98 100644 --- a/chrome/browser/ash/child_accounts/child_user_service_factory.cc +++ b/chrome/browser/ash/child_accounts/child_user_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/child_accounts/child_user_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/ash/child_accounts/child_user_service.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.cc b/chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.cc index c2c4c4a..0c78741 100644 --- a/chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.cc +++ b/chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/child_accounts/child_status_reporting_service_factory.h" #include "chrome/browser/ash/child_accounts/event_based_status_reporting_service.h" #include "chrome/browser/ash/child_accounts/screen_time_controller_factory.h"
diff --git a/chrome/browser/ash/child_accounts/family_user_metrics_service_factory.cc b/chrome/browser/ash/child_accounts/family_user_metrics_service_factory.cc index e3fe1dc..907f0b32 100644 --- a/chrome/browser/ash/child_accounts/family_user_metrics_service_factory.cc +++ b/chrome/browser/ash/child_accounts/family_user_metrics_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/child_accounts/family_user_metrics_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/ash/child_accounts/child_user_service_factory.h" #include "chrome/browser/ash/child_accounts/family_user_metrics_service.h"
diff --git a/chrome/browser/ash/child_accounts/screen_time_controller_factory.cc b/chrome/browser/ash/child_accounts/screen_time_controller_factory.cc index 6dbb2283..d4045d3 100644 --- a/chrome/browser/ash/child_accounts/screen_time_controller_factory.cc +++ b/chrome/browser/ash/child_accounts/screen_time_controller_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/child_accounts/screen_time_controller_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/child_accounts/child_status_reporting_service_factory.h" #include "chrome/browser/ash/child_accounts/screen_time_controller.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/ash/child_accounts/usage_time_state_notifier.cc b/chrome/browser/ash/child_accounts/usage_time_state_notifier.cc index 4782963..9b1c71f 100644 --- a/chrome/browser/ash/child_accounts/usage_time_state_notifier.cc +++ b/chrome/browser/ash/child_accounts/usage_time_state_notifier.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ash/child_accounts/usage_time_state_notifier.h" #include "base/check.h" +#include "base/no_destructor.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "components/session_manager/core/session_manager.h"
diff --git a/chrome/browser/ash/chrome_browser_main_parts_ash.cc b/chrome/browser/ash/chrome_browser_main_parts_ash.cc index f749ec9..50a5234 100644 --- a/chrome/browser/ash/chrome_browser_main_parts_ash.cc +++ b/chrome/browser/ash/chrome_browser_main_parts_ash.cc
@@ -926,7 +926,10 @@ std::string user_id_hash = parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile); - BrowserDataMigrator::MaybeRestartToMigrate(account_id, user_id_hash); + if (BrowserDataMigrator::MaybeRestartToMigrate(account_id, user_id_hash)) { + LOG(WARNING) << "Restarting chrome to run profile migration."; + return; + } session_manager::SessionManager::Get()->CreateSessionForRestart( account_id, user_id_hash);
diff --git a/chrome/browser/ash/concierge_helper_service.cc b/chrome/browser/ash/concierge_helper_service.cc index 9d479b0..479097e 100644 --- a/chrome/browser/ash/concierge_helper_service.cc +++ b/chrome/browser/ash/concierge_helper_service.cc
@@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "chromeos/dbus/concierge/concierge_client.h" #include "chromeos/dbus/concierge/concierge_service.pb.h" #include "chromeos/dbus/debug_daemon/debug_daemon_client.h"
diff --git a/chrome/browser/ash/crosapi/browser_data_migrator.cc b/chrome/browser/ash/crosapi/browser_data_migrator.cc index 76d4060..f2a01cf3 100644 --- a/chrome/browser/ash/crosapi/browser_data_migrator.cc +++ b/chrome/browser/ash/crosapi/browser_data_migrator.cc
@@ -160,20 +160,6 @@ "There must be no overlap between kNoCopyPaths, kAshDataPaths " "and kLacrosDataPaths"); -void OnRestartRequestResponse(bool result) { - if (!result) { - LOG(ERROR) << "SessionManagerClient::RequestBrowserDataMigration() failed."; - return; - } - - // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove this - // log message. - LOG(WARNING) - << "SessionManagerClient::RequestBrowserDataMigration() succeeded " - "and now attempting a restart."; - chrome::AttemptRestart(); -} - base::span<const char* const> GetNoCopyDataPaths() { if (base::FeatureList::IsEnabled( kLacrosProfileMigrationUseDeprecatedNoCopyPaths)) { @@ -230,7 +216,7 @@ } // static -void BrowserDataMigrator::MaybeRestartToMigrate( +bool BrowserDataMigrator::MaybeRestartToMigrate( const AccountId& account_id, const std::string& user_id_hash) { // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove this @@ -265,7 +251,7 @@ break; } - return; + return false; } // Check if the switch for testing is present. @@ -273,18 +259,17 @@ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kForceBrowserDataMigrationForTesting); if (force_migration_switch == kBrowserDataMigrationForceSkip) - return; + return false; if (force_migration_switch == kBrowserDataMigrationForceMigration) { LOG(WARNING) << "`kBrowserDataMigrationForceMigration` switch is present."; - RestartToMigrate(account_id, user_id_hash); - return; + return RestartToMigrate(account_id, user_id_hash); } const user_manager::User* user = user_manager::UserManager::Get()->FindUser(account_id); // Check if user exists i.e. not a guest session. if (!user) - return; + return false; // Check if lacros is enabled. If not immediately return. if (!crosapi::browser_util::IsLacrosEnabledForMigration(user)) { // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove @@ -302,7 +287,7 @@ user_id_hash); crosapi::browser_util::ClearProfileMigrationCompletedForUser( g_browser_process->local_state(), user_id_hash); - return; + return false; } // Currently we turn on profile migration only for Googlers. To test profile @@ -314,7 +299,7 @@ // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove // this log message. LOG(WARNING) << "Profile migration is disabled."; - return; + return false; } // If the user is a new user, then there shouldn't be anything to migrate. @@ -325,7 +310,7 @@ // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove // this log message. LOG(WARNING) << "Setting migration as completed since it is a new user."; - return; + return false; } int attempts = GetMigrationAttemptCountForUser( @@ -338,7 +323,7 @@ // this log message. LOG(WARNING) << "Skipping profile migration since migration attemp count = " << attempts << " has exceeded " << kMaxMigrationAttemptCount; - return; + return false; } if (crosapi::browser_util::IsDataWipeRequired(user_id_hash)) { @@ -348,8 +333,7 @@ << "Restarting to run profile migration since data wipe is required."; // If data wipe is required, no need for a further check to determine if // lacros data dir exists or not. - RestartToMigrate(account_id, user_id_hash); - return; + return RestartToMigrate(account_id, user_id_hash); } if (crosapi::browser_util::IsProfileMigrationCompletedForUser( @@ -357,16 +341,15 @@ // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, // remove this log message. LOG(WARNING) << "Profile migration has been completed already."; - return; + return false; } - RestartToMigrate(account_id, user_id_hash); + return RestartToMigrate(account_id, user_id_hash); } // static -void BrowserDataMigrator::RestartToMigrate(const AccountId& account_id, +bool BrowserDataMigrator::RestartToMigrate(const AccountId& account_id, const std::string& user_id_hash) { - LOG(WARNING) << "Restarting to start profile migration."; SetMigrationStep(g_browser_process->local_state(), MigrationStep::kRestartCalled); @@ -378,9 +361,17 @@ g_browser_process->local_state()->CommitPendingWrite(); - SessionManagerClient::Get()->RequestBrowserDataMigration( - cryptohome::CreateAccountIdentifierFromAccountId(account_id), - base::BindOnce(&OnRestartRequestResponse)); + // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove + // this log message. + LOG(WARNING) << "Making a dbus method call to session_manager"; + bool success = SessionManagerClient::Get()->RequestBrowserDataMigration( + cryptohome::CreateAccountIdentifierFromAccountId(account_id)); + + if (!success) + return false; + + chrome::AttemptRestart(); + return true; } // static
diff --git a/chrome/browser/ash/crosapi/browser_data_migrator.h b/chrome/browser/ash/crosapi/browser_data_migrator.h index 7b29b2f9..1b8cc16e 100644 --- a/chrome/browser/ash/crosapi/browser_data_migrator.h +++ b/chrome/browser/ash/crosapi/browser_data_migrator.h
@@ -205,9 +205,11 @@ }; // Checks if migration is required for the user identified by `user_id_hash` - // and if it is required, calls a DBus method to session_manager and - // terminates ash-chrome. - static void MaybeRestartToMigrate(const AccountId& account_id, + // and if it is required, calls a D-Bus method to session_manager and + // terminates ash-chrome. It returns true if the D-Bus call to the + // session_manager is made and successful. The return value of true means that + // `chrome::AttemptRestart()` has been called. + static bool MaybeRestartToMigrate(const AccountId& account_id, const std::string& user_id_hash); // The method needs to be called on UI thread. It posts `MigrateInternal()` on @@ -274,8 +276,8 @@ scoped_refptr<CancelFlag> cancel_flag); // Called from `MaybeRestartToMigrate()` to proceed with restarting to start - // the migration. - static void RestartToMigrate(const AccountId& account_id, + // the migration. It returns true if D-Bus call was successful. + static bool RestartToMigrate(const AccountId& account_id, const std::string& user_id_hash); // Called on UI thread once migration is finished.
diff --git a/chrome/browser/ash/crosapi/crosapi_util.cc b/chrome/browser/ash/crosapi/crosapi_util.cc index d8d8981..fd2906c 100644 --- a/chrome/browser/ash/crosapi/crosapi_util.cc +++ b/chrome/browser/ash/crosapi/crosapi_util.cc
@@ -300,12 +300,6 @@ params->idle_info = IdleServiceAsh::ReadIdleInfoFromSystem(); params->native_theme_info = NativeThemeServiceAsh::GetNativeThemeInfo(); - params->is_incognito_deprecated = - initial_browser_action.action == - crosapi::mojom::InitialBrowserAction::kOpenIncognitoWindow; - params->restore_last_session_deprecated = - initial_browser_action.action == - crosapi::mojom::InitialBrowserAction::kRestoreLastSession; params->initial_browser_action = initial_browser_action.action; if (initial_browser_action.action == crosapi::mojom::InitialBrowserAction::kOpenWindowWithUrls) {
diff --git a/chrome/browser/ash/crostini/ansible/ansible_management_service.cc b/chrome/browser/ash/crostini/ansible/ansible_management_service.cc index 14e44486..a2762a30 100644 --- a/chrome/browser/ash/crostini/ansible/ansible_management_service.cc +++ b/chrome/browser/ash/crostini/ansible/ansible_management_service.cc
@@ -6,7 +6,6 @@ #include "base/files/file_util.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/task/post_task.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h"
diff --git a/chrome/browser/ash/crostini/ansible/ansible_management_service_factory.cc b/chrome/browser/ash/crostini/ansible/ansible_management_service_factory.cc index 64e4c1b..858d366 100644 --- a/chrome/browser/ash/crostini/ansible/ansible_management_service_factory.cc +++ b/chrome/browser/ash/crostini/ansible/ansible_management_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/crostini/ansible/ansible_management_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/crostini/ansible/ansible_management_service.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/ash/crostini/crostini_engagement_metrics_service.cc b/chrome/browser/ash/crostini/crostini_engagement_metrics_service.cc index fd68da0..fa36062 100644 --- a/chrome/browser/ash/crostini/crostini_engagement_metrics_service.cc +++ b/chrome/browser/ash/crostini/crostini_engagement_metrics_service.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/crostini/crostini_engagement_metrics_service.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/crostini/crostini_features.h" #include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/crostini/crostini_util.h"
diff --git a/chrome/browser/ash/crostini/crostini_export_import.cc b/chrome/browser/ash/crostini/crostini_export_import.cc index d852f4f..df071d9 100644 --- a/chrome/browser/ash/crostini/crostini_export_import.cc +++ b/chrome/browser/ash/crostini/crostini_export_import.cc
@@ -11,6 +11,7 @@ #include "base/files/file_util.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/no_destructor.h" #include "base/strings/stringprintf.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h"
diff --git a/chrome/browser/ash/crostini/crostini_manager.cc b/chrome/browser/ash/crostini/crostini_manager.cc index cc3ed66..9676e2c 100644 --- a/chrome/browser/ash/crostini/crostini_manager.cc +++ b/chrome/browser/ash/crostini/crostini_manager.cc
@@ -18,7 +18,6 @@ #include "base/feature_list.h" #include "base/files/file_util.h" #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/strings/string_split.h" #include "base/strings/stringprintf.h"
diff --git a/chrome/browser/ash/crostini/crostini_manager_factory.cc b/chrome/browser/ash/crostini/crostini_manager_factory.cc index d670a174..7afa97f 100644 --- a/chrome/browser/ash/crostini/crostini_manager_factory.cc +++ b/chrome/browser/ash/crostini/crostini_manager_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/crostini/crostini_manager_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/ash/crostini/crostini_terminal.cc b/chrome/browser/ash/crostini/crostini_terminal.cc index 951c7d1a..15bd49d 100644 --- a/chrome/browser/ash/crostini/crostini_terminal.cc +++ b/chrome/browser/ash/crostini/crostini_terminal.cc
@@ -12,7 +12,6 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h"
diff --git a/chrome/browser/ash/crostini/crostini_upgrader.cc b/chrome/browser/ash/crostini/crostini_upgrader.cc index 1a68ad37c..3a8891b 100644 --- a/chrome/browser/ash/crostini/crostini_upgrader.cc +++ b/chrome/browser/ash/crostini/crostini_upgrader.cc
@@ -9,6 +9,7 @@ #include "base/feature_list.h" #include "base/files/file_util.h" #include "base/location.h" +#include "base/no_destructor.h" #include "base/system/sys_info.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h"
diff --git a/chrome/browser/ash/cryptauth/cryptauth_device_id_provider_impl.cc b/chrome/browser/ash/cryptauth/cryptauth_device_id_provider_impl.cc index 75e7fbf..0dd5e674 100644 --- a/chrome/browser/ash/cryptauth/cryptauth_device_id_provider_impl.cc +++ b/chrome/browser/ash/cryptauth/cryptauth_device_id_provider_impl.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ash/cryptauth/cryptauth_device_id_provider_impl.h" #include "base/guid.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/common/pref_names.h" #include "components/prefs/pref_registry_simple.h"
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc index 02b868d..526603421 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc
@@ -36,6 +36,7 @@ #include "base/json/json_reader.h" #include "base/json/json_value_converter.h" #include "base/json/json_writer.h" +#include "base/no_destructor.h" #include "base/path_service.h" #include "base/ranges/algorithm.h" #include "base/run_loop.h"
diff --git a/chrome/browser/ash/file_manager/open_with_browser.cc b/chrome/browser/ash/file_manager/open_with_browser.cc index 3c67e67..2be0c3ee 100644 --- a/chrome/browser/ash/file_manager/open_with_browser.cc +++ b/chrome/browser/ash/file_manager/open_with_browser.cc
@@ -12,7 +12,6 @@ #include "base/command_line.h" #include "base/cxx17_backports.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/path_service.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h"
diff --git a/chrome/browser/ash/guest_os/guest_os_mime_types_service_factory.cc b/chrome/browser/ash/guest_os/guest_os_mime_types_service_factory.cc index e56497f..17bb0e9 100644 --- a/chrome/browser/ash/guest_os/guest_os_mime_types_service_factory.cc +++ b/chrome/browser/ash/guest_os/guest_os_mime_types_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/guest_os/guest_os_mime_types_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/guest_os/guest_os_mime_types_service.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/ash/guest_os/guest_os_registry_service_factory.cc b/chrome/browser/ash/guest_os/guest_os_registry_service_factory.cc index 85f7497..10e178ef 100644 --- a/chrome/browser/ash/guest_os/guest_os_registry_service_factory.cc +++ b/chrome/browser/ash/guest_os/guest_os_registry_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/ash/guest_os/guest_os_share_path_factory.cc b/chrome/browser/ash/guest_os/guest_os_share_path_factory.cc index 5a33af9b..b31741d 100644 --- a/chrome/browser/ash/guest_os/guest_os_share_path_factory.cc +++ b/chrome/browser/ash/guest_os/guest_os_share_path_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/guest_os/guest_os_share_path_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/crostini/crostini_manager_factory.h" #include "chrome/browser/ash/guest_os/guest_os_share_path.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc index 60ed4ce3..f290597 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc
@@ -15,7 +15,6 @@ #include "ash/components/proximity_auth/screenlock_bridge.h" #include "base/bind.h" #include "base/memory/ptr_util.h" -#include "base/no_destructor.h" #include "base/run_loop.h" #include "base/test/metrics/histogram_tester.h" #include "base/values.h"
diff --git a/chrome/browser/ash/login/oobe_interactive_ui_test.cc b/chrome/browser/ash/login/oobe_interactive_ui_test.cc index 8df0e467..93b2651 100644 --- a/chrome/browser/ash/login/oobe_interactive_ui_test.cc +++ b/chrome/browser/ash/login/oobe_interactive_ui_test.cc
@@ -173,9 +173,8 @@ screen->SetProfileSyncEngineInitializedForTesting(true); screen->OnStateChanged(nullptr); - const std::string button_name = features::IsSyncConsentOptionalEnabled() - ? "acceptButton" - : "nonSplitSettingsAcceptButton"; + // TODO(TBD): Rename the button to remove SplitSettings from its name. + const std::string button_name = "nonSplitSettingsAcceptButton"; test::OobeJS().ExpectEnabledPath({"sync-consent", button_name}); test::OobeJS().CreateFocusWaiter({"sync-consent", button_name})->Wait();
diff --git a/chrome/browser/ash/login/saml/password_expiry_notification.cc b/chrome/browser/ash/login/saml/password_expiry_notification.cc index 59518fe..57eed67 100644 --- a/chrome/browser/ash/login/saml/password_expiry_notification.cc +++ b/chrome/browser/ash/login/saml/password_expiry_notification.cc
@@ -12,6 +12,7 @@ #include "ash/public/cpp/session/session_activation_observer.h" #include "ash/public/cpp/session/session_controller.h" #include "base/bind.h" +#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "base/task/post_task.h" #include "base/task/task_traits.h"
diff --git a/chrome/browser/ash/login/screens/guest_tos_screen.cc b/chrome/browser/ash/login/screens/guest_tos_screen.cc index 49ac7d5..aa4571af 100644 --- a/chrome/browser/ash/login/screens/guest_tos_screen.cc +++ b/chrome/browser/ash/login/screens/guest_tos_screen.cc
@@ -4,6 +4,8 @@ #include "chrome/browser/ash/login/screens/guest_tos_screen.h" +#include "ash/constants/ash_switches.h" +#include "base/command_line.h" #include "base/strings/stringprintf.h" #include "chrome/browser/ash/login/startup_utils.h" #include "chrome/browser/browser_process.h" @@ -17,11 +19,23 @@ constexpr const char kUserActionCancelClicked[] = "cancel"; std::string GetGoogleEulaOnlineUrl() { + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kOobeEulaUrlForTests)) { + return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kOobeEulaUrlForTests); + } + return base::StringPrintf(chrome::kGoogleEulaOnlineURLPath, g_browser_process->GetApplicationLocale().c_str()); } std::string GetCrosEulaOnlineUrl() { + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kOobeEulaUrlForTests)) { + return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kOobeEulaUrlForTests); + } + return base::StringPrintf(chrome::kCrosEulaOnlineURLPath, g_browser_process->GetApplicationLocale().c_str()); }
diff --git a/chrome/browser/ash/login/screens/guest_tos_screen_browsertest.cc b/chrome/browser/ash/login/screens/guest_tos_screen_browsertest.cc new file mode 100644 index 0000000..f07c450 --- /dev/null +++ b/chrome/browser/ash/login/screens/guest_tos_screen_browsertest.cc
@@ -0,0 +1,110 @@ +// 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 "ash/constants/ash_features.h" +#include "ash/constants/ash_switches.h" +#include "base/containers/contains.h" +#include "chrome/browser/ash/login/oobe_screen.h" +#include "chrome/browser/ash/login/screens/guest_tos_screen.h" +#include "chrome/browser/ash/login/test/fake_eula_mixin.h" +#include "chrome/browser/ash/login/test/js_checker.h" +#include "chrome/browser/ash/login/test/oobe_base_test.h" +#include "chrome/browser/ash/login/test/oobe_screen_waiter.h" +#include "chrome/browser/ash/login/test/webview_content_extractor.h" +#include "chrome/browser/ash/login/ui/login_display_host.h" +#include "chrome/browser/ash/login/ui/webui_login_view.h" +#include "chrome/browser/ash/login/wizard_controller.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/webui/chromeos/login/guest_tos_screen_handler.h" +#include "content/public/test/browser_test.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace ash { +namespace { + +constexpr char kGuestTostId[] = "guest-tos"; + +// Loaded Dialog +const test::UIPath kLoadedDialog = {kGuestTostId, "loaded"}; +const test::UIPath kGoogleEulaLink = {kGuestTostId, "googleEulaLink"}; +const test::UIPath kCrosEulaLink = {kGuestTostId, "crosEulaLink"}; + +const test::UIPath kUsageStats = {kGuestTostId, "usageStats"}; +const test::UIPath kUsageLearnMoreLink = {kGuestTostId, "usageLearnMore"}; +const test::UIPath kUsageLearnMorePopUp = {kGuestTostId, "usageLearnMorePopUp"}; +const test::UIPath kUsageLearnMorePopUpClose = { + kGuestTostId, "usageLearnMorePopUp", "closeButton"}; + +// Google EUlA Dialog +const test::UIPath kGoogleEulaDialog = {kGuestTostId, "googleEulaDialog"}; +const test::UIPath kGoogleEulaWebview = {kGuestTostId, "googleEulaWebview"}; +const test::UIPath kGoogleEulaOkButton = {kGuestTostId, "googleEulaOkButton"}; + +// CROS EULA Dialog +const test::UIPath kCrosEulaDialog = {kGuestTostId, "crosEulaDialog"}; +const test::UIPath kCrosEulaWebview = {kGuestTostId, "crosEulaWebview"}; +const test::UIPath kCrosEulaOkButton = {kGuestTostId, "crosEulaOkButton"}; + +} // namespace + +class GuestTosScreenTest : public OobeBaseTest { + public: + GuestTosScreenTest() { + feature_list_.InitAndEnableFeature(features::kOobeConsolidatedConsent); + } + + void SetUpOnMainThread() override { + LoginDisplayHost::default_host()->GetWizardContext()->is_branded_build = + true; + OobeBaseTest::SetUpOnMainThread(); + } + + void ShowGuestTosScreen() { + WizardController::default_controller()->AdvanceToScreen( + GuestTosScreenView::kScreenId); + OobeScreenWaiter(GuestTosScreenView::kScreenId).Wait(); + test::OobeJS().CreateVisibilityWaiter(true, kLoadedDialog)->Wait(); + } + + protected: + base::test::ScopedFeatureList feature_list_; + + FakeEulaMixin fake_eula_{&mixin_host_, embedded_test_server()}; +}; + +IN_PROC_BROWSER_TEST_F(GuestTosScreenTest, GoogleEula) { + ShowGuestTosScreen(); + test::OobeJS().CreateVisibilityWaiter(true, kLoadedDialog)->Wait(); + test::OobeJS().ClickOnPath(kGoogleEulaLink); + test::OobeJS().CreateVisibilityWaiter(true, kGoogleEulaDialog)->Wait(); + const std::string webview_contents = + test::GetWebViewContents(kGoogleEulaWebview); + EXPECT_TRUE(base::Contains(webview_contents, FakeEulaMixin::kFakeOnlineEula)); + test::OobeJS().ClickOnPath(kGoogleEulaOkButton); + test::OobeJS().CreateVisibilityWaiter(true, kLoadedDialog)->Wait(); +} + +IN_PROC_BROWSER_TEST_F(GuestTosScreenTest, CrosEula) { + ShowGuestTosScreen(); + test::OobeJS().CreateVisibilityWaiter(true, kLoadedDialog)->Wait(); + test::OobeJS().ClickOnPath(kCrosEulaLink); + test::OobeJS().CreateVisibilityWaiter(true, kCrosEulaDialog)->Wait(); + const std::string webview_contents = + test::GetWebViewContents(kCrosEulaWebview); + EXPECT_TRUE(base::Contains(webview_contents, FakeEulaMixin::kFakeOnlineEula)); + test::OobeJS().ClickOnPath(kCrosEulaOkButton); + test::OobeJS().CreateVisibilityWaiter(true, kLoadedDialog)->Wait(); +} + +IN_PROC_BROWSER_TEST_F(GuestTosScreenTest, UsageStatsOptin) { + ShowGuestTosScreen(); + test::OobeJS().ExpectVisiblePath(kUsageStats); + test::OobeJS().ClickOnPath(kUsageLearnMoreLink); + test::OobeJS().ExpectAttributeEQ("open", kUsageLearnMorePopUp, true); + test::OobeJS().ClickOnPath(kUsageLearnMorePopUpClose); + test::OobeJS().ExpectAttributeEQ("open", kUsageLearnMorePopUp, false); +} + +} // namespace ash
diff --git a/chrome/browser/ash/login/screens/hid_detection_screen.cc b/chrome/browser/ash/login/screens/hid_detection_screen.cc index bba2782..ad794ab 100644 --- a/chrome/browser/ash/login/screens/hid_detection_screen.cc +++ b/chrome/browser/ash/login/screens/hid_detection_screen.cc
@@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/command_line.h" +#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/time/default_tick_clock.h"
diff --git a/chrome/browser/ash/login/screens/sync_consent_browsertest.cc b/chrome/browser/ash/login/screens/sync_consent_browsertest.cc index 21c6f41..8dca28c 100644 --- a/chrome/browser/ash/login/screens/sync_consent_browsertest.cc +++ b/chrome/browser/ash/login/screens/sync_consent_browsertest.cc
@@ -63,16 +63,12 @@ const test::UIPath kOverviewDialog = {kSyncConsent, "syncConsentOverviewDialog"}; -const test::UIPath kSplitSettingsDialog = {kSyncConsent, - "splitSettingsSyncConsentDialog"}; const test::UIPath kReviewSettingsCheckBox = {kSyncConsent, "reviewSettingsBox"}; const test::UIPath kNonSplitSettingsAcceptButton = { kSyncConsent, "nonSplitSettingsAcceptButton"}; const test::UIPath kNonSplitSettingsDeclineButton = { kSyncConsent, "nonSplitSettingsDeclineButton"}; -const test::UIPath kAcceptButton = {kSyncConsent, "acceptButton"}; -const test::UIPath kDeclineButton = {kSyncConsent, "declineButton"}; syncer::SyncUserSettings* GetSyncUserSettings() { Profile* profile = ProfileManager::GetPrimaryUserProfile(); @@ -147,41 +143,27 @@ OobeBaseTest::SetUpOnMainThread(); LoginDisplayHost::default_host()->GetWizardContext()->is_branded_build = true; - if (features::IsSyncConsentOptionalEnabled()) { + + if (features::IsMinorModeRestrictionEnabled() && is_minor_user_) { expected_consent_ids_ = { - IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE, - IDS_LOGIN_SYNC_CONSENT_SCREEN_SUBTITLE, - IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_NAME, - IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_DESCRIPTION, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_NAME, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_SYNC_DESCRIPTION, - IDS_LOGIN_SYNC_CONSENT_SCREEN_PERSONALIZE_GOOGLE_SERVICES_NAME, - IDS_LOGIN_SYNC_CONSENT_SCREEN_PERSONALIZE_GOOGLE_SERVICES_DESCRIPTION, + IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE_WITH_DEVICE, + IDS_LOGIN_SYNC_CONSENT_SCREEN_SUBTITLE_2, + IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_NAME_2, + IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_NAME_2, + IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_DESCRIPTION, IDS_LOGIN_SYNC_CONSENT_SCREEN_DECLINE2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT2, + IDS_LOGIN_SYNC_CONSENT_SCREEN_TURN_ON_SYNC, }; } else { - if (features::IsMinorModeRestrictionEnabled() && is_minor_user_) { - expected_consent_ids_ = { - IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE_WITH_DEVICE, - IDS_LOGIN_SYNC_CONSENT_SCREEN_SUBTITLE_2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_NAME_2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_NAME_2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_DESCRIPTION, - IDS_LOGIN_SYNC_CONSENT_SCREEN_DECLINE2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_TURN_ON_SYNC, - }; - } else { - expected_consent_ids_ = { - IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE_WITH_DEVICE, - IDS_LOGIN_SYNC_CONSENT_SCREEN_SUBTITLE_2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_NAME_2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_NAME_2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_DESCRIPTION, - IDS_LOGIN_SYNC_CONSENT_SCREEN_REVIEW_SYNC_OPTIONS_LATER, - IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT_AND_CONTINUE, - }; - } + expected_consent_ids_ = { + IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE_WITH_DEVICE, + IDS_LOGIN_SYNC_CONSENT_SCREEN_SUBTITLE_2, + IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_NAME_2, + IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_NAME_2, + IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_DESCRIPTION, + IDS_LOGIN_SYNC_CONSENT_SCREEN_REVIEW_SYNC_OPTIONS_LATER, + IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT_AND_CONTINUE, + }; } SyncConsentScreen::SetSyncConsentScreenExitTestDelegate(this); @@ -362,14 +344,10 @@ EXPECT_TRUE(settings->IsSyncEverythingEnabled()); } -// Tests of the consent recorder with SyncConsentOptional disabled. The -// SyncConsentOptional suite below has its own consent recorder tests. class SyncConsentRecorderTest : public SyncConsentTest { public: SyncConsentRecorderTest() { - features_.InitWithFeatures( - /*enabled_features=*/{features::kSyncSettingsCategorization}, - /*disabled_features=*/{features::kSyncConsentOptional}); + features_.InitAndEnableFeature(features::kSyncSettingsCategorization); } ~SyncConsentRecorderTest() override = default; @@ -485,262 +463,13 @@ SyncConsentPolicyDisabledTest, testing::Bool()); -// Additional tests of the consent dialog that are only applicable when the -// SyncConsentOptional flag enabled. -class SyncConsentOptionalTest : public SyncConsentTest { - public: - SyncConsentOptionalTest() { - sync_feature_list_.InitWithFeatures( - { - features::kSyncSettingsCategorization, - features::kSyncConsentOptional, - }, - {}); - } - ~SyncConsentOptionalTest() override = default; - - private: - base::test::ScopedFeatureList sync_feature_list_; -}; - -// Flaky failures on sanitizer builds. https://crbug.com/1054377 -#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) -#define MAYBE_DefaultFlow DISABLED_DefaultFlow -#else -#define MAYBE_DefaultFlow DefaultFlow -#endif -IN_PROC_BROWSER_TEST_F(SyncConsentOptionalTest, MAYBE_DefaultFlow) { - LoginToSyncConsentScreen(); - WaitForScreenShown(); - - // OS sync is disabled by default. - Profile* profile = ProfileManager::GetPrimaryUserProfile(); - PrefService* prefs = profile->GetPrefs(); - EXPECT_FALSE(prefs->GetBoolean(syncer::prefs::kOsSyncFeatureEnabled)); - - // Dialog not completed yet. - EXPECT_FALSE(prefs->GetBoolean(prefs::kSyncOobeCompleted)); - - // Wait for content to load. - SyncConsentScreen* screen = GetSyncConsentScreen(); - ConsentRecordedWaiter consent_recorded_waiter; - screen->SetDelegateForTesting(&consent_recorded_waiter); - screen->SetProfileSyncDisabledByPolicyForTesting(false); - screen->SetProfileSyncEngineInitializedForTesting(true); - screen->OnStateChanged(nullptr); - test::OobeJS().CreateVisibilityWaiter(true, {kSyncConsent})->Wait(); - - // Dialog is visible. - test::OobeJS().ExpectVisiblePath(kSplitSettingsDialog); - - // Click the accept button and wait for the JS to C++ callback. - test::OobeJS().ClickOnPath(kAcceptButton); - consent_recorded_waiter.Wait(); - screen->SetDelegateForTesting(nullptr); - - // Consent was recorded for the confirmation button. - EXPECT_EQ(SyncConsentScreen::CONSENT_GIVEN, - consent_recorded_waiter.consent_given_); - EXPECT_EQ("Got it", consent_recorded_waiter.consent_confirmation_string_); - EXPECT_EQ(IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT2, - consent_recorded_waiter.consent_confirmation_id_); - - // Consent was recorded for all descriptions, including the confirmation - // button label. - std::vector<int> expected_ids = { - IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE, - IDS_LOGIN_SYNC_CONSENT_SCREEN_SUBTITLE, - IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_NAME, - IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_DESCRIPTION, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_NAME, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_SYNC_DESCRIPTION, - IDS_LOGIN_SYNC_CONSENT_SCREEN_PERSONALIZE_GOOGLE_SERVICES_NAME, - IDS_LOGIN_SYNC_CONSENT_SCREEN_PERSONALIZE_GOOGLE_SERVICES_DESCRIPTION, - IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_DECLINE2, - }; - EXPECT_THAT(consent_recorded_waiter.consent_description_ids_, - testing::UnorderedElementsAreArray(expected_ids)); - - // OS sync should be on. - syncer::SyncUserSettings* settings = GetSyncUserSettings(); - EXPECT_TRUE(settings->IsOsSyncFeatureEnabled()); - - // Browser sync is on. - auto* identity_manager = IdentityManagerFactory::GetForProfile(profile); - EXPECT_TRUE(identity_manager->HasPrimaryAccount(signin::ConsentLevel::kSync)); - EXPECT_TRUE(settings->IsSyncRequested()); - EXPECT_TRUE(settings->IsFirstSetupComplete()); - EXPECT_TRUE(settings->IsSyncEverythingEnabled()); - - WaitForScreenExit(); - EXPECT_EQ(screen_result_.value(), SyncConsentScreen::Result::NEXT); - histogram_tester_.ExpectTotalCount( - "OOBE.StepCompletionTimeByExitReason.Sync-consent.Next", 1); - histogram_tester_.ExpectTotalCount("OOBE.StepCompletionTime.Sync-consent", 1); - histogram_tester_.ExpectUniqueSample( - "OOBE.SyncConsentScreen.Behavior", - SyncConsentScreen::SyncScreenBehavior::kShow, 1); - histogram_tester_.ExpectUniqueSample( - "OOBE.SyncConsentScreen.UserChoice", - SyncConsentScreenHandler::UserChoice::kAccepted, 1); - histogram_tester_.ExpectUniqueSample("OOBE.SyncConsentScreen.SyncEnabled", - true, 1); - - // Dialog is completed. - EXPECT_TRUE(prefs->GetBoolean(prefs::kSyncOobeCompleted)); -} - -// Flaky failures on sanitizer builds. https://crbug.com/1054377 -#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) -#define MAYBE_DisableSync DISABLED_DisableSync -#else -#define MAYBE_DisableSync DisableSync -#endif -IN_PROC_BROWSER_TEST_F(SyncConsentOptionalTest, MAYBE_DisableSync) { - LoginToSyncConsentScreen(); - - // Wait for content to load. - SyncConsentScreen* screen = GetSyncConsentScreen(); - ConsentRecordedWaiter consent_recorded_waiter; - screen->SetDelegateForTesting(&consent_recorded_waiter); - screen->SetProfileSyncDisabledByPolicyForTesting(false); - screen->SetProfileSyncEngineInitializedForTesting(true); - screen->OnStateChanged(nullptr); - test::OobeJS().CreateVisibilityWaiter(true, {kSyncConsent})->Wait(); - - // Click the decline button and wait for the JS to C++ callback. - test::OobeJS().ClickOnPath(kDeclineButton); - consent_recorded_waiter.Wait(); - screen->SetDelegateForTesting(nullptr); - - // OS sync is off. - PrefService* prefs = ProfileManager::GetPrimaryUserProfile()->GetPrefs(); - EXPECT_FALSE(prefs->GetBoolean(syncer::prefs::kOsSyncFeatureEnabled)); - - // For historical reasons, browser sync is still on. However, all data types - // are disabled. - syncer::SyncUserSettings* settings = GetSyncUserSettings(); - EXPECT_TRUE(settings->IsSyncRequested()); - EXPECT_TRUE(settings->IsFirstSetupComplete()); - EXPECT_FALSE(settings->IsSyncEverythingEnabled()); - EXPECT_TRUE(settings->GetSelectedTypes().Empty()); - - histogram_tester_.ExpectUniqueSample( - "OOBE.SyncConsentScreen.Behavior", - SyncConsentScreen::SyncScreenBehavior::kShow, 1); - histogram_tester_.ExpectUniqueSample( - "OOBE.SyncConsentScreen.UserChoice", - SyncConsentScreenHandler::UserChoice::kDeclined, 1); - histogram_tester_.ExpectUniqueSample("OOBE.SyncConsentScreen.SyncEnabled", - false, 1); - - // Dialog is completed. - EXPECT_TRUE(prefs->GetBoolean(prefs::kSyncOobeCompleted)); -} - -IN_PROC_BROWSER_TEST_F(SyncConsentOptionalTest, LanguageSwitch) { - SwitchLanguage("es"); - LoginToSyncConsentScreen(); - - SyncConsentScreen* screen = GetSyncConsentScreen(); - ConsentRecordedWaiter consent_recorded_waiter; - screen->SetDelegateForTesting(&consent_recorded_waiter); - - test::OobeJS().CreateVisibilityWaiter(true, {kSyncConsent})->Wait(); - test::OobeJS().TapOnPath(kAcceptButton); - consent_recorded_waiter.Wait(); - screen->SetDelegateForTesting(nullptr); - - EXPECT_THAT(consent_recorded_waiter.consent_description_strings_, - UnorderedElementsAreArray(GetLocalizedExpectedConsentStrings())); - EXPECT_THAT( - consent_recorded_waiter.consent_confirmation_string_, - Eq(GetLocalizedConsentString(IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT2))); -} - -IN_PROC_BROWSER_TEST_F(SyncConsentOptionalTest, LanguageVariant) { - SwitchLanguage("en-GB"); - LoginToSyncConsentScreen(); - - SyncConsentScreen* screen = GetSyncConsentScreen(); - ConsentRecordedWaiter consent_recorded_waiter; - screen->SetDelegateForTesting(&consent_recorded_waiter); - - test::OobeJS().CreateVisibilityWaiter(true, {kSyncConsent})->Wait(); - test::OobeJS().TapOnPath(kAcceptButton); - consent_recorded_waiter.Wait(); - screen->SetDelegateForTesting(nullptr); - - EXPECT_THAT(consent_recorded_waiter.consent_description_strings_, - UnorderedElementsAreArray(GetLocalizedExpectedConsentStrings())); - EXPECT_THAT( - consent_recorded_waiter.consent_confirmation_string_, - Eq(GetLocalizedConsentString(IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT2))); -} - -IN_PROC_BROWSER_TEST_F(SyncConsentOptionalTest, SkippedNotBrandedBuild) { - LoginDisplayHost::default_host()->GetWizardContext()->is_branded_build = - false; - LoginToSyncConsentScreen(); - WaitForScreenExit(); - EXPECT_EQ(screen_result_.value(), SyncConsentScreen::Result::NOT_APPLICABLE); - - // OS sync should be on. - syncer::SyncUserSettings* settings = GetSyncUserSettings(); - EXPECT_TRUE(settings->IsOsSyncFeatureEnabled()); - - // Browser sync is on. - EXPECT_TRUE(settings->IsSyncRequested()); - EXPECT_TRUE(settings->IsFirstSetupComplete()); - - // Dialog is completed. - PrefService* prefs = ProfileManager::GetPrimaryUserProfile()->GetPrefs(); - EXPECT_TRUE(prefs->GetBoolean(prefs::kSyncOobeCompleted)); - - histogram_tester_.ExpectUniqueSample( - "OOBE.SyncConsentScreen.Behavior", - SyncConsentScreen::SyncScreenBehavior::kSkipAndEnableNonBrandedBuild, 1); - histogram_tester_.ExpectUniqueSample("OOBE.SyncConsentScreen.SyncEnabled", - true, 1); -} - -IN_PROC_BROWSER_TEST_F(SyncConsentOptionalTest, SkippedSyncDisabledByPolicy) { - SyncConsentScreen::SetProfileSyncDisabledByPolicyForTesting(true); - LoginToSyncConsentScreen(); - WaitForScreenExit(); - EXPECT_EQ(screen_result_.value(), SyncConsentScreen::Result::NOT_APPLICABLE); - - // OS sync should be off. - syncer::SyncUserSettings* settings = GetSyncUserSettings(); - EXPECT_FALSE(settings->IsOsSyncFeatureEnabled()); - - // Browser sync is off. - EXPECT_FALSE(settings->IsSyncRequested()); - EXPECT_FALSE(settings->IsFirstSetupComplete()); - - // Dialog is completed. - PrefService* prefs = ProfileManager::GetPrimaryUserProfile()->GetPrefs(); - EXPECT_TRUE(prefs->GetBoolean(prefs::kSyncOobeCompleted)); - - histogram_tester_.ExpectUniqueSample( - "OOBE.SyncConsentScreen.Behavior", - SyncConsentScreen::SyncScreenBehavior::kSkipPermissionsPolicy, 1); - // We don't test SyncEnabled because this test fakes the policy disable and - // the sync engine is still enabled. -} - // Tests for Active Directory accounts, which skip the dialog because they do // not use sync. class SyncConsentActiveDirectoryTest : public OobeBaseTest { public: SyncConsentActiveDirectoryTest() { - sync_feature_list_.InitWithFeatures( - { - features::kSyncSettingsCategorization, - features::kSyncConsentOptional, - }, - {}); + sync_feature_list_.InitWithFeatures({features::kSyncSettingsCategorization}, + {}); } ~SyncConsentActiveDirectoryTest() override = default; @@ -760,11 +489,8 @@ "test-user@locally-managed.localhost", "password"); test::WaitForPrimaryUserSessionStart(); - // OS sync is off. - syncer::SyncUserSettings* settings = GetSyncUserSettings(); - EXPECT_FALSE(settings->IsOsSyncFeatureEnabled()); - // Browser sync is off. + syncer::SyncUserSettings* settings = GetSyncUserSettings(); EXPECT_FALSE(settings->IsSyncRequested()); EXPECT_FALSE(settings->IsFirstSetupComplete());
diff --git a/chrome/browser/ash/login/screens/sync_consent_screen.cc b/chrome/browser/ash/login/screens/sync_consent_screen.cc index e222284..e32ceb3 100644 --- a/chrome/browser/ash/login/screens/sync_consent_screen.cc +++ b/chrome/browser/ash/login/screens/sync_consent_screen.cc
@@ -215,8 +215,7 @@ UpdateScreen(*context()); } -// TODO(https://crbug.com/1229582) Break SplitSettings names into -// SyncConsentOptional and SyncSettingsCategorization in the whole file. +// TODO(https://crbug.com/1229582) Remove SplitSettings from names in this file. void SyncConsentScreen::OnNonSplitSettingsContinue( const bool opted_in, const bool review_sync, @@ -237,64 +236,6 @@ Finish(Result::NEXT); } -void SyncConsentScreen::OnContinue( - const std::vector<int>& consent_description, - int consent_confirmation, - SyncConsentScreenHandler::UserChoice choice) { - DCHECK(features::IsSyncConsentOptionalEnabled()); - if (is_hidden()) - return; - base::UmaHistogramEnumeration("OOBE.SyncConsentScreen.UserChoice", choice); - // Record that the user saw the consent text, regardless of which features - // they chose to enable. - RecordConsent(CONSENT_GIVEN, consent_description, consent_confirmation); - bool enable_sync = choice == SyncConsentScreenHandler::UserChoice::kAccepted; - UpdateSyncSettings(enable_sync); - Finish(Result::NEXT); -} - -void SyncConsentScreen::UpdateSyncSettings(bool enable_sync) { - DCHECK(features::IsSyncConsentOptionalEnabled()); - DCHECK(features::IsSyncSettingsCategorizationEnabled()); - // For historical reasons, Chrome OS always has a "sync-consented" primary - // account in IdentityManager and always has browser sync "enabled". If the - // user disables the browser sync toggle we disable all browser data types, - // as if the user had opened browser sync settings and turned off all the - // toggles. - // TODO(crbug.com/1046746, crbug.com/1050677): Once all Chrome OS code is - // converted to the "consent aware" IdentityManager API, and the browser sync - // settings WebUI is converted to allow browser sync to be turned on/off, then - // this workaround can be removed. - syncer::SyncService* sync_service = GetSyncService(profile_); - if (sync_service) { - syncer::SyncUserSettings* sync_settings = sync_service->GetUserSettings(); - sync_settings->SetOsSyncFeatureEnabled(enable_sync); - if (!enable_sync) { - syncer::UserSelectableTypeSet empty_set; - sync_settings->SetSelectedTypes(/*sync_everything=*/false, empty_set); - } - // TODO(crbug.com/1229582) Revisit the logic in case !enable_sync. - sync_settings->SetSyncRequested(true); - sync_settings->SetFirstSetupComplete( - syncer::SyncFirstSetupCompleteSource::BASIC_FLOW); - } - // Set a "sync-consented" primary account. See comment above. - auto* identity_manager = IdentityManagerFactory::GetForProfile(profile_); - CoreAccountId account_id = - identity_manager->GetPrimaryAccountId(signin::ConsentLevel::kSignin); - DCHECK(!account_id.empty()); - identity_manager->GetPrimaryAccountMutator()->SetPrimaryAccount( - account_id, signin::ConsentLevel::kSync); - - // Only enable URL-keyed metrics if the user turned on browser sync. - if (enable_sync) { - unified_consent::UnifiedConsentService* consent_service = - UnifiedConsentServiceFactory::GetForProfile(profile_); - if (consent_service) - consent_service->SetUrlKeyedAnonymizedDataCollectionEnabled(true); - } -} - void SyncConsentScreen::MaybeEnableSyncForSkip() { // "sync everything" toggle is disabled during SyncService creation. We need // to turn it on if sync service needs to be enabled. @@ -311,15 +252,9 @@ case SyncScreenBehavior::kSkipAndEnableNonBrandedBuild: case SyncScreenBehavior::kSkipAndEnableEmphemeralUser: case SyncScreenBehavior::kSkipAndEnableScreenPolicy: - // Prior to SyncConsentOptional, sync is autostarted during SyncService + // Sync is autostarted during SyncService // creation with "sync everything" toggle off. We need to turn it on here. - // For SyncConsentOptional, we also need to update other sync-related - // flags. - if (features::IsSyncConsentOptionalEnabled()) { - UpdateSyncSettings(/*enable_sync=*/true); - } else { - SetSyncEverythingEnabled(/*enabled=*/true); - } + SetSyncEverythingEnabled(/*enabled=*/true); return; } }
diff --git a/chrome/browser/ash/login/screens/sync_consent_screen.h b/chrome/browser/ash/login/screens/sync_consent_screen.h index 2fb49521..ce0ee1db 100644 --- a/chrome/browser/ash/login/screens/sync_consent_screen.h +++ b/chrome/browser/ash/login/screens/sync_consent_screen.h
@@ -107,14 +107,6 @@ const std::vector<int>& consent_description, const int consent_confirmation); - // Reacts to "Yes, I'm in" and "No, thanks". - void OnContinue(const std::vector<int>& consent_description, - int consent_confirmation, - SyncConsentScreenHandler::UserChoice choice); - - // Configures OS sync and browser sync. - void UpdateSyncSettings(bool enable_sync); - // Enables sync if required when skipping the dialog. void MaybeEnableSyncForSkip();
diff --git a/chrome/browser/ash/login/screens/terms_of_service_screen.cc b/chrome/browser/ash/login/screens/terms_of_service_screen.cc index f694cfe1..627cd9b 100644 --- a/chrome/browser/ash/login/screens/terms_of_service_screen.cc +++ b/chrome/browser/ash/login/screens/terms_of_service_screen.cc
@@ -13,6 +13,7 @@ #include "base/files/file_util.h" #include "base/files/important_file_writer.h" #include "base/location.h" +#include "base/no_destructor.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" #include "base/time/time.h"
diff --git a/chrome/browser/ash/login/session/user_session_manager.cc b/chrome/browser/ash/login/session/user_session_manager.cc index 07b58b2..de97b05 100644 --- a/chrome/browser/ash/login/session/user_session_manager.cc +++ b/chrome/browser/ash/login/session/user_session_manager.cc
@@ -1420,33 +1420,12 @@ accounts_mutator->SeedAccountInfo(gaia_id, user->GetDisplayEmail()); // 3. Set it as the Primary Account. - if (features::IsSyncConsentOptionalEnabled()) { - // In theory this should only be done for new profiles. However, if user - // profile prefs failed to save or the prefs are corrupted by a crash then - // the IdentityManager will start up without a primary account. See test - // CrashRestoreComplexTest.RestoreSessionForThreeUsers. - if (!identity_manager->HasPrimaryAccount(ConsentLevel::kSignin)) { - // Set the account without recording browser sync consent. - identity_manager->GetPrimaryAccountMutator()->SetPrimaryAccount( - account_id, ConsentLevel::kSignin); - } + identity_manager->GetPrimaryAccountMutator()->SetPrimaryAccount( + account_id, ConsentLevel::kSync); - CHECK(identity_manager->HasPrimaryAccount(ConsentLevel::kSignin)); - CHECK_EQ( - identity_manager->GetPrimaryAccountInfo(ConsentLevel::kSignin).gaia, - gaia_id); - } else { - // Set a primary account here because the profile might have been - // created with the feature SyncConsentOptional enabled. Then the - // profile might only have an unconsented primary account. - identity_manager->GetPrimaryAccountMutator()->SetPrimaryAccount( - account_id, ConsentLevel::kSync); - - CHECK(identity_manager->HasPrimaryAccount(ConsentLevel::kSync)); - CHECK_EQ( - identity_manager->GetPrimaryAccountInfo(ConsentLevel::kSync).gaia, - gaia_id); - } + CHECK(identity_manager->HasPrimaryAccount(ConsentLevel::kSync)); + CHECK_EQ(identity_manager->GetPrimaryAccountInfo(ConsentLevel::kSync).gaia, + gaia_id); DCHECK_EQ(account_id, identity_manager->GetPrimaryAccountId(ConsentLevel::kSignin)); @@ -1505,10 +1484,7 @@ return; user_profile_initialized_called_.insert(profile); - // OOBE doesn't set kOsSyncFeatureEnabled yet, call MigrateOsSyncPreferences - // to make sure it is correctly set. - // TODO(https://crbug.com/1229582): Revise when SyncConsentOptional changes - // for OOBE are implemented. + // MigrateOsSyncPreferences migrates prefs for SyncSettingsCategorization. os_sync_util::MigrateOsSyncPreferences(profile->GetPrefs()); BootTimesRecorder* btl = BootTimesRecorder::Get(); @@ -2213,8 +2189,11 @@ const user_manager::User* user = chromeos::ProfileHelper::Get()->GetUserByProfile(profile); - ash::BrowserDataMigrator::MaybeRestartToMigrate(user->GetAccountId(), - user->username_hash()); + if (ash::BrowserDataMigrator::MaybeRestartToMigrate(user->GetAccountId(), + user->username_hash())) { + LOG(WARNING) << "Restarting chrome to run profile migration."; + return; + } if (login_host) { login_host->SetStatusAreaVisible(true);
diff --git a/chrome/browser/ash/login/test/embedded_policy_test_server_mixin.cc b/chrome/browser/ash/login/test/embedded_policy_test_server_mixin.cc new file mode 100644 index 0000000..9adc63d --- /dev/null +++ b/chrome/browser/ash/login/test/embedded_policy_test_server_mixin.cc
@@ -0,0 +1,83 @@ +// 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/embedded_policy_test_server_mixin.h" + +#include <string> +#include <utility> + +#include "base/guid.h" +#include "base/json/values_util.h" +#include "base/values.h" +#include "chrome/browser/ash/login/test/fake_gaia_mixin.h" +#include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h" +#include "chrome/browser/ash/policy/enrollment/device_cloud_policy_initializer.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_process_platform_part.h" +#include "chromeos/system/fake_statistics_provider.h" +#include "components/policy/core/common/cloud/cloud_policy_constants.h" +#include "components/policy/core/common/cloud/test/policy_builder.h" +#include "components/policy/core/common/policy_switches.h" +#include "components/policy/test_support/client_storage.h" +#include "components/policy/test_support/embedded_policy_test_server.h" +#include "components/policy/test_support/policy_storage.h" +#include "components/policy/test_support/signature_provider.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace ash { + +EmbeddedPolicyTestServerMixin::EmbeddedPolicyTestServerMixin( + InProcessBrowserTestMixinHost* host) + : InProcessBrowserTestMixin(host) {} + +EmbeddedPolicyTestServerMixin::~EmbeddedPolicyTestServerMixin() = default; + +void EmbeddedPolicyTestServerMixin::SetUp() { + InProcessBrowserTestMixin::SetUp(); + policy_test_server_ = std::make_unique<policy::EmbeddedPolicyTestServer>(); + policy_test_server_->policy_storage()->set_robot_api_auth_code( + FakeGaiaMixin::kFakeAuthCode); + policy_test_server_->policy_storage()->add_managed_user("*"); + + // Create universal signing keys that can sign any domain. + std::vector<policy::SignatureProvider::SigningKey> universal_signing_keys; + universal_signing_keys.push_back(policy::SignatureProvider::SigningKey( + policy::PolicyBuilder::CreateTestSigningKey(), + {{"*", policy::PolicyBuilder::GetTestSigningKeySignature()}})); + policy_test_server_->policy_storage()->signature_provider()->set_signing_keys( + std::move(universal_signing_keys)); + + // Register default user used in many tests. + policy::ClientStorage::ClientInfo client_info; + client_info.device_id = policy::PolicyBuilder::kFakeDeviceId; + client_info.device_token = policy::PolicyBuilder::kFakeToken; + client_info.allowed_policy_types = { + policy::dm_protocol::kChromeDevicePolicyType, + policy::dm_protocol::kChromeUserPolicyType, + policy::dm_protocol::kChromePublicAccountPolicyType, + policy::dm_protocol::kChromeExtensionPolicyType, + policy::dm_protocol::kChromeSigninExtensionPolicyType, + policy::dm_protocol::kChromeMachineLevelUserCloudPolicyType, + policy::dm_protocol::kChromeMachineLevelExtensionCloudPolicyType}; + policy_test_server_->client_storage()->RegisterClient(client_info); + + CHECK(policy_test_server_->Start()); +} + +void EmbeddedPolicyTestServerMixin::SetUpCommandLine( + base::CommandLine* command_line) { + // Specify device management server URL. + command_line->AppendSwitchASCII(policy::switches::kDeviceManagementUrl, + policy_test_server_->GetServiceURL().spec()); +} + +void EmbeddedPolicyTestServerMixin::UpdateUserPolicy( + const enterprise_management::CloudPolicySettings& policy, + const std::string& policy_user) { + policy_test_server_->policy_storage()->set_policy_user(policy_user); + policy_test_server_->policy_storage()->SetPolicyPayload( + policy::dm_protocol::kChromeUserPolicyType, policy.SerializeAsString()); +} + +} // namespace ash
diff --git a/chrome/browser/ash/login/test/embedded_policy_test_server_mixin.h b/chrome/browser/ash/login/test/embedded_policy_test_server_mixin.h new file mode 100644 index 0000000..3a217f5 --- /dev/null +++ b/chrome/browser/ash/login/test/embedded_policy_test_server_mixin.h
@@ -0,0 +1,52 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_LOGIN_TEST_EMBEDDED_POLICY_TEST_SERVER_MIXIN_H_ +#define CHROME_BROWSER_ASH_LOGIN_TEST_EMBEDDED_POLICY_TEST_SERVER_MIXIN_H_ + +#include <memory> +#include <string> + +#include "base/command_line.h" +#include "chrome/test/base/mixin_based_in_process_browser_test.h" +#include "components/policy/proto/cloud_policy.pb.h" +#include "components/policy/test_support/embedded_policy_test_server.h" + +namespace ash { + +// This test mixin covers setting up EmbeddedPolicyTestServer and adding a +// command-line flag to use it. Please see SetUp function for default settings. +// Server is started after SetUp execution. +class EmbeddedPolicyTestServerMixin : public InProcessBrowserTestMixin { + public: + explicit EmbeddedPolicyTestServerMixin(InProcessBrowserTestMixinHost* host); + + EmbeddedPolicyTestServerMixin(const EmbeddedPolicyTestServerMixin&) = delete; + EmbeddedPolicyTestServerMixin& operator=( + const EmbeddedPolicyTestServerMixin&) = delete; + + ~EmbeddedPolicyTestServerMixin() override; + + policy::EmbeddedPolicyTestServer* server() { + return policy_test_server_.get(); + } + + // InProcessBrowserTestMixin: + void SetUp() override; + void SetUpCommandLine(base::CommandLine* command_line) override; + + // Updates user policy blob served by the embedded policy test server. + // `policy_user` - the policy user's email. + void UpdateUserPolicy( + const enterprise_management::CloudPolicySettings& policy, + const std::string& policy_user); + + private: + std::unique_ptr<policy::EmbeddedPolicyTestServer> policy_test_server_; + base::Value server_config_; +}; + +} // namespace ash + +#endif // CHROME_BROWSER_ASH_LOGIN_TEST_EMBEDDED_POLICY_TEST_SERVER_MIXIN_H_
diff --git a/chrome/browser/ash/login/test/logged_in_user_mixin.cc b/chrome/browser/ash/login/test/logged_in_user_mixin.cc index 4fd2f86e..73aa8c7f 100644 --- a/chrome/browser/ash/login/test/logged_in_user_mixin.cc +++ b/chrome/browser/ash/login/test/logged_in_user_mixin.cc
@@ -42,7 +42,7 @@ bool should_launch_browser, absl::optional<AccountId> account_id, bool include_initial_user, - bool use_local_policy_server) + bool use_embedded_policy_server) : InProcessBrowserTestMixin(mixin_host), user_(account_id.value_or( AccountId::FromUserEmailGaiaId(FakeGaiaMixin::kFakeUserEmail, @@ -51,12 +51,13 @@ login_manager_(mixin_host, GetInitialUsers(user_, include_initial_user), &fake_gaia_), - local_policy_server_(mixin_host), - user_policy_(mixin_host, - user_.account_id, - use_local_policy_server ? &local_policy_server_ : nullptr), + embedded_policy_server_(mixin_host), + user_policy_( + mixin_host, + user_.account_id, + use_embedded_policy_server ? &embedded_policy_server_ : nullptr), user_policy_helper_(user_.account_id.GetUserEmail(), - &local_policy_server_), + &embedded_policy_server_), embedded_test_server_setup_(mixin_host, embedded_test_server), fake_gaia_(mixin_host), test_base_(test_base) {
diff --git a/chrome/browser/ash/login/test/logged_in_user_mixin.h b/chrome/browser/ash/login/test/logged_in_user_mixin.h index d6bbcc71..28bb9446 100644 --- a/chrome/browser/ash/login/test/logged_in_user_mixin.h +++ b/chrome/browser/ash/login/test/logged_in_user_mixin.h
@@ -5,9 +5,9 @@ #ifndef CHROME_BROWSER_ASH_LOGIN_TEST_LOGGED_IN_USER_MIXIN_H_ #define CHROME_BROWSER_ASH_LOGIN_TEST_LOGGED_IN_USER_MIXIN_H_ +#include "chrome/browser/ash/login/test/embedded_policy_test_server_mixin.h" #include "chrome/browser/ash/login/test/embedded_test_server_setup_mixin.h" #include "chrome/browser/ash/login/test/fake_gaia_mixin.h" -#include "chrome/browser/ash/login/test/local_policy_test_server_mixin.h" #include "chrome/browser/ash/login/test/login_manager_mixin.h" #include "chrome/browser/ash/login/test/user_policy_mixin.h" #include "chrome/browser/ash/policy/core/user_policy_test_helper.h" @@ -66,8 +66,8 @@ // |include_initial_user| if true, then the user already exists on the login // screen. Otherwise, the user is newly added to the device and the OOBE Gaia // screen will show on start-up. - // |use_local_policy_server| determines if the LocalPolicyTestServerMixin - // should be passed into the UserPolicyMixin. + // |use_embedded_policy_server| determines if the + // EmbeddedPolicyTestServerMixin should be passed into the UserPolicyMixin. LoggedInUserMixin(InProcessBrowserTestMixinHost* mixin_host, LogInType type, net::EmbeddedTestServer* embedded_test_server, @@ -76,7 +76,7 @@ absl::optional<AccountId> account_id = absl::nullopt, bool include_initial_user = true, // TODO(crbug/1112885): Remove this parameter. - bool use_local_policy_server = true); + bool use_embedded_policy_server = true); LoggedInUserMixin(const LoggedInUserMixin&) = delete; LoggedInUserMixin& operator=(const LoggedInUserMixin&) = delete; ~LoggedInUserMixin() override; @@ -99,8 +99,8 @@ UserPolicyMixin* GetUserPolicyMixin() { return &user_policy_; } - LocalPolicyTestServerMixin* GetLocalPolicyTestServerMixin() { - return &local_policy_server_; + EmbeddedPolicyTestServerMixin* GetEmbeddedPolicyTestServerMixin() { + return &embedded_policy_server_; } policy::UserPolicyTestHelper* GetUserPolicyTestHelper() { @@ -115,7 +115,7 @@ LoginManagerMixin::TestUserInfo user_; LoginManagerMixin login_manager_; - LocalPolicyTestServerMixin local_policy_server_; + EmbeddedPolicyTestServerMixin embedded_policy_server_; UserPolicyMixin user_policy_; policy::UserPolicyTestHelper user_policy_helper_;
diff --git a/chrome/browser/ash/login/test/user_policy_mixin.cc b/chrome/browser/ash/login/test/user_policy_mixin.cc index a7bde115..05ca279 100644 --- a/chrome/browser/ash/login/test/user_policy_mixin.cc +++ b/chrome/browser/ash/login/test/user_policy_mixin.cc
@@ -11,6 +11,7 @@ #include "base/files/file_path.h" #include "base/path_service.h" #include "base/threading/thread_restrictions.h" +#include "chrome/browser/ash/login/test/embedded_policy_test_server_mixin.h" #include "chrome/browser/ash/login/test/local_policy_test_server_mixin.h" #include "chrome/common/chrome_paths.h" #include "chromeos/cryptohome/cryptohome_parameters.h" @@ -32,7 +33,14 @@ LocalPolicyTestServerMixin* policy_server) : InProcessBrowserTestMixin(mixin_host), account_id_(account_id), - policy_server_(policy_server) {} + local_policy_server_(policy_server) {} + +UserPolicyMixin::UserPolicyMixin(InProcessBrowserTestMixinHost* mixin_host, + const AccountId& account_id, + EmbeddedPolicyTestServerMixin* policy_server) + : InProcessBrowserTestMixin(mixin_host), + account_id_(account_id), + embedded_policy_server_(policy_server) {} UserPolicyMixin::~UserPolicyMixin() = default; @@ -103,9 +111,12 @@ cryptohome::CreateAccountIdentifierFromAccountId(account_id_); FakeSessionManagerClient::Get()->set_user_policy(cryptohome_id, policy_blob); - if (policy_server_) { - policy_server_->UpdateUserPolicy(user_policy_builder_.payload(), - account_id_.GetUserEmail()); + if (local_policy_server_) { + local_policy_server_->UpdateUserPolicy(user_policy_builder_.payload(), + account_id_.GetUserEmail()); + } else if (embedded_policy_server_) { + embedded_policy_server_->UpdateUserPolicy(user_policy_builder_.payload(), + account_id_.GetUserEmail()); } }
diff --git a/chrome/browser/ash/login/test/user_policy_mixin.h b/chrome/browser/ash/login/test/user_policy_mixin.h index ed91556..d74cba6 100644 --- a/chrome/browser/ash/login/test/user_policy_mixin.h +++ b/chrome/browser/ash/login/test/user_policy_mixin.h
@@ -16,10 +16,11 @@ namespace ash { class LocalPolicyTestServerMixin; +class EmbeddedPolicyTestServerMixin; // Mixin for setting up user policy for a test user. // Currently supports setting cached user policy and optionally user policy -// served by local policy test server.. +// served by local or embedded policy test server.. // NOTE: This mixin will set up in-memory FakeSessionManagerClient during setup. class UserPolicyMixin : public InProcessBrowserTestMixin { public: @@ -28,6 +29,9 @@ UserPolicyMixin(InProcessBrowserTestMixinHost* mixin_host, const AccountId& account_id, LocalPolicyTestServerMixin* policy_server); + UserPolicyMixin(InProcessBrowserTestMixinHost* mixin_host, + const AccountId& account_id, + EmbeddedPolicyTestServerMixin* policy_server); UserPolicyMixin(const UserPolicyMixin&) = delete; UserPolicyMixin& operator=(const UserPolicyMixin&) = delete; @@ -69,7 +73,8 @@ // Policy server that can optionally be passed into UserPolicyMixin. If set // user policy changes done by RequestPolicyUpdate() will also be forwarded // to the policy server. - LocalPolicyTestServerMixin* policy_server_ = nullptr; + LocalPolicyTestServerMixin* local_policy_server_ = nullptr; + EmbeddedPolicyTestServerMixin* embedded_policy_server_ = nullptr; policy::UserPolicyBuilder user_policy_builder_;
diff --git a/chrome/browser/ash/net/rollback_network_config/rollback_network_config_service.cc b/chrome/browser/ash/net/rollback_network_config/rollback_network_config_service.cc index ab28374..dfc5f75 100644 --- a/chrome/browser/ash/net/rollback_network_config/rollback_network_config_service.cc +++ b/chrome/browser/ash/net/rollback_network_config/rollback_network_config_service.cc
@@ -6,7 +6,6 @@ #include "base/check.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "chrome/browser/ash/net/rollback_network_config/rollback_network_config.h" #include "chromeos/network/network_handler.h" #include "chromeos/services/rollback_network_config/public/mojom/rollback_network_config.mojom.h"
diff --git a/chrome/browser/ash/platform_keys/chaps_slot_session.cc b/chrome/browser/ash/platform_keys/chaps_slot_session.cc index f322178..9684da5 100644 --- a/chrome/browser/ash/platform_keys/chaps_slot_session.cc +++ b/chrome/browser/ash/platform_keys/chaps_slot_session.cc
@@ -12,7 +12,6 @@ #include "base/location.h" #include "base/logging.h" #include "base/memory/ptr_util.h" -#include "base/no_destructor.h" #include "base/threading/scoped_blocking_call.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/chrome/browser/ash/platform_keys/chaps_util_impl.cc b/chrome/browser/ash/platform_keys/chaps_util_impl.cc index 9f9e2894..8a01410 100644 --- a/chrome/browser/ash/platform_keys/chaps_util_impl.cc +++ b/chrome/browser/ash/platform_keys/chaps_util_impl.cc
@@ -19,7 +19,6 @@ #include "base/check.h" #include "base/cxx17_backports.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/strings/string_piece.h" #include "chrome/browser/ash/platform_keys/chaps_slot_session.h" #include "crypto/chaps_support.h"
diff --git a/chrome/browser/ash/platform_keys/key_permissions/key_permissions_service_factory.cc b/chrome/browser/ash/platform_keys/key_permissions/key_permissions_service_factory.cc index b1d9bbe..83ae7000 100644 --- a/chrome/browser/ash/platform_keys/key_permissions/key_permissions_service_factory.cc +++ b/chrome/browser/ash/platform_keys/key_permissions/key_permissions_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/platform_keys/key_permissions/key_permissions_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/platform_keys/key_permissions/key_permissions_manager_impl.h" #include "chrome/browser/ash/platform_keys/key_permissions/key_permissions_service.h" #include "chrome/browser/ash/platform_keys/key_permissions/key_permissions_service_impl.h"
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.cc b/chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.cc index bc0a578..46383e0 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.cc +++ b/chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_features.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_pref_names.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h"
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_manager_factory.cc b/chrome/browser/ash/plugin_vm/plugin_vm_manager_factory.cc index 44971f8a..1485686 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_manager_factory.cc +++ b/chrome/browser/ash/plugin_vm/plugin_vm_manager_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/plugin_vm/plugin_vm_manager_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_util.cc b/chrome/browser/ash/plugin_vm/plugin_vm_util.cc index 50e0fde0..5ca38c49 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_util.cc +++ b/chrome/browser/ash/plugin_vm/plugin_vm_util.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/files/file_util.h" +#include "base/no_destructor.h" #include "base/observer_list.h" #include "base/strings/pattern.h" #include "base/strings/string_util.h"
diff --git a/chrome/browser/ash/policy/core/user_policy_test_helper.cc b/chrome/browser/ash/policy/core/user_policy_test_helper.cc index 4ed1fe5..768e1ebc 100644 --- a/chrome/browser/ash/policy/core/user_policy_test_helper.cc +++ b/chrome/browser/ash/policy/core/user_policy_test_helper.cc
@@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/run_loop.h" #include "base/values.h" +#include "chrome/browser/ash/login/test/embedded_policy_test_server_mixin.h" #include "chrome/browser/ash/login/test/local_policy_test_server_mixin.h" #include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/browser_process.h" @@ -21,6 +22,7 @@ #include "components/policy/core/common/cloud/cloud_policy_core.h" #include "components/policy/core/common/policy_service.h" #include "components/policy/core/common/policy_switches.h" +#include "components/policy/proto/cloud_policy.pb.h" #include "components/policy/proto/device_management_backend.pb.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" @@ -32,14 +34,27 @@ ash::LocalPolicyTestServerMixin* local_policy_server) : account_id_(account_id), local_policy_server_(local_policy_server) {} +UserPolicyTestHelper::UserPolicyTestHelper( + const std::string& account_id, + ash::EmbeddedPolicyTestServerMixin* embedded_policy_server) + : account_id_(account_id), + embedded_policy_server_(embedded_policy_server) {} + UserPolicyTestHelper::~UserPolicyTestHelper() {} void UserPolicyTestHelper::SetPolicy(const base::Value& mandatory, const base::Value& recommended) { + DCHECK(local_policy_server_); ASSERT_TRUE(local_policy_server_->UpdateUserPolicy(mandatory, recommended, account_id_)); } +void UserPolicyTestHelper::SetPolicy( + const enterprise_management::CloudPolicySettings& policy) { + DCHECK(embedded_policy_server_); + embedded_policy_server_->UpdateUserPolicy(policy, account_id_); +} + void UserPolicyTestHelper::WaitForInitialPolicy(Profile* profile) { BrowserPolicyConnector* const connector = g_browser_process->browser_policy_connector(); @@ -77,6 +92,13 @@ RefreshPolicyAndWait(profile); } +void UserPolicyTestHelper::SetPolicyAndWait( + const enterprise_management::CloudPolicySettings& policy, + Profile* profile) { + SetPolicy(policy); + RefreshPolicyAndWait(profile); +} + void UserPolicyTestHelper::RefreshPolicyAndWait(Profile* profile) { policy::ProfilePolicyConnector* const profile_connector = profile->GetProfilePolicyConnector();
diff --git a/chrome/browser/ash/policy/core/user_policy_test_helper.h b/chrome/browser/ash/policy/core/user_policy_test_helper.h index 8f7c9acf..c706f0e 100644 --- a/chrome/browser/ash/policy/core/user_policy_test_helper.h +++ b/chrome/browser/ash/policy/core/user_policy_test_helper.h
@@ -13,13 +13,18 @@ class Profile; namespace ash { +class EmbeddedPolicyTestServerMixin; class LocalPolicyTestServerMixin; -} +} // namespace ash namespace base { class Value; } +namespace enterprise_management { +class CloudPolicySettings; +} + namespace policy { // This class can be used to apply a user policy to the profile in a @@ -28,13 +33,19 @@ public: UserPolicyTestHelper(const std::string& account_id, ash::LocalPolicyTestServerMixin* local_policy_server); + UserPolicyTestHelper( + const std::string& account_id, + ash::EmbeddedPolicyTestServerMixin* embedded_policy_server); UserPolicyTestHelper(const UserPolicyTestHelper&) = delete; UserPolicyTestHelper& operator=(const UserPolicyTestHelper&) = delete; virtual ~UserPolicyTestHelper(); + // Can only be used when constructed with LocalPolicyTestServerMixin. void SetPolicy(const base::Value& mandatory, const base::Value& recommended); + // Can only be used when constructed with EmbeddedPolicyTestServerMixin. + void SetPolicy(const enterprise_management::CloudPolicySettings& policy); // Can be optionally used to wait for the initial policy to be applied to the // profile. Alternatively, a login can be simulated, which makes it @@ -42,17 +53,26 @@ void WaitForInitialPolicy(Profile* profile); // Updates the policy test server with the given policy. Then calls - // RefreshPolicyAndWait(). + // RefreshPolicyAndWait(). Can only be used when constructed with + // LocalPolicyTestServerMixin. void SetPolicyAndWait(const base::Value& mandatory_policy, const base::Value& recommended_policy, Profile* profile); + // Updates the policy test server with the given policy. Then calls + // RefreshPolicyAndWait(). Can only be used when constructed with + // EmbeddedPolicyTestServerMixin. + void SetPolicyAndWait( + const enterprise_management::CloudPolicySettings& policy, + Profile* profile); + // Refreshes and waits for the new policy being applied to |profile|. void RefreshPolicyAndWait(Profile* profile); private: const std::string account_id_; - ash::LocalPolicyTestServerMixin* local_policy_server_; + ash::LocalPolicyTestServerMixin* local_policy_server_ = nullptr; + ash::EmbeddedPolicyTestServerMixin* embedded_policy_server_ = nullptr; }; } // namespace policy
diff --git a/chrome/browser/ash/power/ml/smart_dim/ml_agent.cc b/chrome/browser/ash/power/ml/smart_dim/ml_agent.cc index 7d1bcad..553bc9c 100644 --- a/chrome/browser/ash/power/ml/smart_dim/ml_agent.cc +++ b/chrome/browser/ash/power/ml/smart_dim/ml_agent.cc
@@ -10,6 +10,7 @@ #include "ash/constants/ash_features.h" #include "base/containers/flat_map.h" #include "base/metrics/field_trial_params.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/power/ml/smart_dim/metrics.h" #include "chrome/browser/ash/power/ml/smart_dim/ml_agent_util.h" #include "chrome/browser/ash/power/ml/user_activity_ukm_logger_helpers.h"
diff --git a/chrome/browser/ash/preferences.cc b/chrome/browser/ash/preferences.cc index f1d4709..fb8f10f5 100644 --- a/chrome/browser/ash/preferences.cc +++ b/chrome/browser/ash/preferences.cc
@@ -37,7 +37,6 @@ #include "chrome/browser/ash/login/session/user_session_manager.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/ash/settings/cros_settings.h" -#include "chrome/browser/ash/sync/sync_consent_optional_field_trial.h" #include "chrome/browser/ash/system/input_device_settings.h" #include "chrome/browser/ash/system/timezone_resolver_manager.h" #include "chrome/browser/ash/system/timezone_util.h" @@ -145,7 +144,6 @@ registry->RegisterBooleanPref(prefs::kLoginScreenWebUILazyLoading, false); RegisterLocalStatePrefs(registry); - sync_consent_optional_field_trial::RegisterLocalStatePrefs(registry); } // static
diff --git a/chrome/browser/ash/printing/bulk_printers_calculator_factory.cc b/chrome/browser/ash/printing/bulk_printers_calculator_factory.cc index cfb82ebc..483d898 100644 --- a/chrome/browser/ash/printing/bulk_printers_calculator_factory.cc +++ b/chrome/browser/ash/printing/bulk_printers_calculator_factory.cc
@@ -4,7 +4,6 @@ #include "chrome/browser/ash/printing/bulk_printers_calculator_factory.h" -#include "base/no_destructor.h" #include "chrome/browser/ash/printing/bulk_printers_calculator.h" #include "components/account_id/account_id.h" #include "components/user_manager/user.h"
diff --git a/chrome/browser/ash/secure_channel/secure_channel_client_provider.cc b/chrome/browser/ash/secure_channel/secure_channel_client_provider.cc index a537ce3..ae4a282 100644 --- a/chrome/browser/ash/secure_channel/secure_channel_client_provider.cc +++ b/chrome/browser/ash/secure_channel/secure_channel_client_provider.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/secure_channel/secure_channel_client_provider.h" +#include "base/no_destructor.h" #include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl.h" #include "chromeos/services/secure_channel/secure_channel_base.h" #include "chromeos/services/secure_channel/secure_channel_initializer.h"
diff --git a/chrome/browser/ash/sync/app_settings_model_type_controller.cc b/chrome/browser/ash/sync/app_settings_model_type_controller.cc index 90c59cf5..b6e692f 100644 --- a/chrome/browser/ash/sync/app_settings_model_type_controller.cc +++ b/chrome/browser/ash/sync/app_settings_model_type_controller.cc
@@ -33,11 +33,6 @@ DCHECK(chromeos::features::IsSyncSettingsCategorizationEnabled()); DCHECK(profile_); DCHECK(sync_service_); - pref_registrar_.Init(profile_->GetPrefs()); - pref_registrar_.Add( - syncer::prefs::kOsSyncFeatureEnabled, - base::BindRepeating(&AppSettingsModelTypeController::OnUserPrefChanged, - base::Unretained(this))); } AppSettingsModelTypeController::~AppSettingsModelTypeController() = default; @@ -51,16 +46,3 @@ NonUiSyncableServiceBasedModelTypeController::LoadModels(configure_context, model_load_callback); } - -syncer::DataTypeController::PreconditionState -AppSettingsModelTypeController::GetPreconditionState() const { - DCHECK(CalledOnValidThread()); - return profile_->GetPrefs()->GetBoolean(syncer::prefs::kOsSyncFeatureEnabled) - ? PreconditionState::kPreconditionsMet - : PreconditionState::kMustStopAndClearData; -} - -void AppSettingsModelTypeController::OnUserPrefChanged() { - DCHECK(CalledOnValidThread()); - sync_service_->DataTypePreconditionChanged(type()); -}
diff --git a/chrome/browser/ash/sync/app_settings_model_type_controller.h b/chrome/browser/ash/sync/app_settings_model_type_controller.h index 9df24a0..652be105 100644 --- a/chrome/browser/ash/sync/app_settings_model_type_controller.h +++ b/chrome/browser/ash/sync/app_settings_model_type_controller.h
@@ -39,15 +39,10 @@ // DataTypeController: void LoadModels(const syncer::ConfigureContext& configure_context, const ModelLoadCallback& model_load_callback) override; - PreconditionState GetPreconditionState() const override; private: - // Callback for changes to the OS sync feature enabled pref. - void OnUserPrefChanged(); - Profile* const profile_; syncer::SyncService* const sync_service_; - PrefChangeRegistrar pref_registrar_; }; #endif // CHROME_BROWSER_ASH_SYNC_APP_SETTINGS_MODEL_TYPE_CONTROLLER_H_
diff --git a/chrome/browser/ash/sync/os_sync_model_type_controller.cc b/chrome/browser/ash/sync/os_sync_model_type_controller.cc index 9564c29e..fc1b79ff 100644 --- a/chrome/browser/ash/sync/os_sync_model_type_controller.cc +++ b/chrome/browser/ash/sync/os_sync_model_type_controller.cc
@@ -32,24 +32,6 @@ DCHECK(chromeos::features::IsSyncSettingsCategorizationEnabled()); DCHECK(pref_service_); DCHECK(sync_service_); - pref_registrar_.Init(pref_service_); - pref_registrar_.Add( - syncer::prefs::kOsSyncFeatureEnabled, - base::BindRepeating(&OsSyncModelTypeController::OnUserPrefChanged, - base::Unretained(this))); } OsSyncModelTypeController::~OsSyncModelTypeController() = default; - -syncer::DataTypeController::PreconditionState -OsSyncModelTypeController::GetPreconditionState() const { - DCHECK(CalledOnValidThread()); - return pref_service_->GetBoolean(syncer::prefs::kOsSyncFeatureEnabled) - ? PreconditionState::kPreconditionsMet - : PreconditionState::kMustStopAndClearData; -} - -void OsSyncModelTypeController::OnUserPrefChanged() { - DCHECK(CalledOnValidThread()); - sync_service_->DataTypePreconditionChanged(type()); -}
diff --git a/chrome/browser/ash/sync/os_sync_model_type_controller.h b/chrome/browser/ash/sync/os_sync_model_type_controller.h index 3307acc..7dfdf605 100644 --- a/chrome/browser/ash/sync/os_sync_model_type_controller.h +++ b/chrome/browser/ash/sync/os_sync_model_type_controller.h
@@ -17,8 +17,8 @@ class SyncService; } // namespace syncer -// Controls sync of Chrome OS ModelTypes that can run in transport-mode and -// depend on the system-wide kOsSyncFeatureEnabled preference. +// Controls sync of Chrome OS ModelTypes that can run in transport-mode. +// TODO(https://crbug.com/1274802): Remove this. class OsSyncModelTypeController : public syncer::ModelTypeController { public: OsSyncModelTypeController(syncer::ModelType type, @@ -34,17 +34,12 @@ OsSyncModelTypeController& operator=(const OsSyncModelTypeController&) = delete; - // DataTypeController: - PreconditionState GetPreconditionState() const override; - private: // Callback for changes to the OS sync feature enabled pref. void OnUserPrefChanged(); PrefService* const pref_service_; syncer::SyncService* const sync_service_; - - PrefChangeRegistrar pref_registrar_; }; #endif // CHROME_BROWSER_ASH_SYNC_OS_SYNC_MODEL_TYPE_CONTROLLER_H_
diff --git a/chrome/browser/ash/sync/os_sync_util.cc b/chrome/browser/ash/sync/os_sync_util.cc index 97cc2b09..ccc5942 100644 --- a/chrome/browser/ash/sync/os_sync_util.cc +++ b/chrome/browser/ash/sync/os_sync_util.cc
@@ -13,36 +13,14 @@ namespace os_sync_util { namespace { -void MaybeMigratePreferencesForSyncConsentOptional(PrefService* prefs) { - DCHECK(chromeos::features::IsSyncSettingsCategorizationEnabled()); - - if (!ash::features::IsSyncConsentOptionalEnabled()) { - // Always enable the OS sync if SyncConsentOptional is disabled. Before the - // SyncConsentOptional launch it's impossible to disable/enable the OS sync - // from the UI. - prefs->SetBoolean(syncer::prefs::kOsSyncFeatureEnabled, true); - return; - } - - // TODO(https://crbug.com/1246357) Add a migration code here. To handle switch - // between SyncConsentOptional being disabled and enabled - prefs->SetBoolean(syncer::prefs::kOsSyncFeatureEnabled, false); -} - // Returns true if the prefs were migrated. bool MaybeMigratePreferencesForSyncSettingsCategorization(PrefService* prefs) { // Migration code can be removed when SyncSettingsCategorization has been // fully deployed to stable channel for a couple milestones. if (!chromeos::features::IsSyncSettingsCategorizationEnabled()) { - // SyncSettingsCategorization should be launched before SyncConsentOptional. - DCHECK(!chromeos::features::IsSyncConsentOptionalEnabled()); - // Reset the migration flag because this might be a rollback of the feature. // We want migration to happen again when the feature is enabled. prefs->SetBoolean(syncer::prefs::kOsSyncPrefsMigrated, false); - // Reset the OS sync pref to its default state, such that we get the same - // migration behavior next time SyncSettingsCategorization is enabled. - prefs->SetBoolean(syncer::prefs::kOsSyncFeatureEnabled, false); prefs->ClearPref(syncer::prefs::kSyncAllOsTypes); prefs->ClearPref(syncer::prefs::kSyncOsApps); @@ -78,8 +56,6 @@ migrated_this_time = true; } - MaybeMigratePreferencesForSyncConsentOptional(prefs); - return migrated_this_time; }
diff --git a/chrome/browser/ash/sync/os_sync_util_unittest.cc b/chrome/browser/ash/sync/os_sync_util_unittest.cc index 329fddd..cf14765 100644 --- a/chrome/browser/ash/sync/os_sync_util_unittest.cc +++ b/chrome/browser/ash/sync/os_sync_util_unittest.cc
@@ -33,7 +33,6 @@ TEST_F(OsSyncUtilTest, SimpleMigration) { os_sync_util::MigrateOsSyncPreferences(&prefs_); EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncPrefsMigrated)); - EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); EXPECT_TRUE(prefs_.GetBoolean(sp::kSyncAllOsTypes)); } @@ -61,36 +60,6 @@ EXPECT_FALSE(prefs_.GetBoolean(csp::kSyncOsWallpaper)); } -TEST_F(OsSyncUtilTest, SyncAppsEnablesOsSyncFeature) { - prefs_.SetBoolean(sp::kSyncKeepEverythingSynced, false); - prefs_.SetBoolean(sp::kSyncApps, true); - os_sync_util::MigrateOsSyncPreferences(&prefs_); - EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); -} - -TEST_F(OsSyncUtilTest, SyncPreferencesEnablesOsSyncFeature) { - prefs_.SetBoolean(sp::kSyncKeepEverythingSynced, false); - prefs_.SetBoolean(sp::kSyncPreferences, true); - os_sync_util::MigrateOsSyncPreferences(&prefs_); - EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); -} - -TEST_F(OsSyncUtilTest, SyncWallpaperEnablesOsSyncFeature) { - prefs_.SetBoolean(sp::kSyncKeepEverythingSynced, false); - prefs_.SetBoolean(sp::kSyncApps, true); - prefs_.SetBoolean(sp::kSyncThemes, true); - os_sync_util::MigrateOsSyncPreferences(&prefs_); - ASSERT_TRUE(prefs_.GetBoolean(csp::kSyncOsWallpaper)); - EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); -} - -TEST_F(OsSyncUtilTest, SyncWifiEnablesOsSyncFeature) { - prefs_.SetBoolean(sp::kSyncKeepEverythingSynced, false); - prefs_.SetBoolean(sp::kSyncWifiConfigurations, true); - os_sync_util::MigrateOsSyncPreferences(&prefs_); - EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); -} - TEST_F(OsSyncUtilTest, MigrationOnlyHappensOnce) { // Do initial migration. os_sync_util::MigrateOsSyncPreferences(&prefs_); @@ -118,7 +87,6 @@ // Do initial migration. os_sync_util::MigrateOsSyncPreferences(&prefs_); EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncPrefsMigrated)); - EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); { // Simulate disabling the feature (e.g. disabling via Finch). @@ -129,7 +97,6 @@ // OS sync is marked as not migrated. EXPECT_FALSE(prefs_.GetBoolean(sp::kOsSyncPrefsMigrated)); - EXPECT_FALSE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); } // Simulate re-enabling the feature. @@ -141,7 +108,6 @@ // OS sync is marked as migrated. EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncPrefsMigrated)); - EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); } }
diff --git a/chrome/browser/ash/sync/os_syncable_service_model_type_controller.cc b/chrome/browser/ash/sync/os_syncable_service_model_type_controller.cc index 2a2d1dc..30e3a2a 100644 --- a/chrome/browser/ash/sync/os_syncable_service_model_type_controller.cc +++ b/chrome/browser/ash/sync/os_syncable_service_model_type_controller.cc
@@ -39,27 +39,7 @@ type == syncer::OS_PRIORITY_PREFERENCES); DCHECK(pref_service_); DCHECK(sync_service_); - - pref_registrar_.Init(pref_service_); - pref_registrar_.Add( - syncer::prefs::kOsSyncFeatureEnabled, - base::BindRepeating( - &OsSyncableServiceModelTypeController::OnUserPrefChanged, - base::Unretained(this))); } OsSyncableServiceModelTypeController::~OsSyncableServiceModelTypeController() = default; - -syncer::DataTypeController::PreconditionState -OsSyncableServiceModelTypeController::GetPreconditionState() const { - DCHECK(CalledOnValidThread()); - return pref_service_->GetBoolean(syncer::prefs::kOsSyncFeatureEnabled) - ? PreconditionState::kPreconditionsMet - : PreconditionState::kMustStopAndClearData; -} - -void OsSyncableServiceModelTypeController::OnUserPrefChanged() { - DCHECK(CalledOnValidThread()); - sync_service_->DataTypePreconditionChanged(type()); -}
diff --git a/chrome/browser/ash/sync/os_syncable_service_model_type_controller.h b/chrome/browser/ash/sync/os_syncable_service_model_type_controller.h index 9eb77bd4..efac896 100644 --- a/chrome/browser/ash/sync/os_syncable_service_model_type_controller.h +++ b/chrome/browser/ash/sync/os_syncable_service_model_type_controller.h
@@ -21,6 +21,7 @@ // Controls syncing of Chrome OS ModelTypes that run in sync transport-only // mode and are tied to the OS sync feature consent (APP_LIST, OS_PREFERENCES, // and OS_PRIORITY_PREFERENCES). +// TODO(https://crbug.com/1274802): Remove this. class OsSyncableServiceModelTypeController : public syncer::SyncableServiceBasedModelTypeController { public: @@ -39,17 +40,9 @@ OsSyncableServiceModelTypeController& operator=( const OsSyncableServiceModelTypeController&) = delete; - // DataTypeController: - PreconditionState GetPreconditionState() const override; - private: - // Callback for changes to the OS sync feature enabled pref. - void OnUserPrefChanged(); - PrefService* const pref_service_; syncer::SyncService* const sync_service_; - - PrefChangeRegistrar pref_registrar_; }; #endif // CHROME_BROWSER_ASH_SYNC_OS_SYNCABLE_SERVICE_MODEL_TYPE_CONTROLLER_H_
diff --git a/chrome/browser/ash/sync/sync_consent_optional_field_trial.cc b/chrome/browser/ash/sync/sync_consent_optional_field_trial.cc deleted file mode 100644 index 7aff1815..0000000 --- a/chrome/browser/ash/sync/sync_consent_optional_field_trial.cc +++ /dev/null
@@ -1,144 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ash/sync/sync_consent_optional_field_trial.h" - -#include "ash/constants/ash_features.h" -#include "base/feature_list.h" -#include "base/metrics/field_trial.h" -#include "base/strings/string_number_conversions.h" -#include "chrome/common/channel_info.h" -#include "components/prefs/pref_registry_simple.h" -#include "components/prefs/pref_service.h" -#include "components/variations/variations_associated_data.h" -#include "components/version_info/version_info.h" - -namespace sync_consent_optional_field_trial { -namespace { - -// String local state preference with the name of the assigned trial group. -// Empty if no group has been assigned yet. -const char kTrialGroupPrefName[] = "sync_consent_optional.trial_group"; - -// The field trial name. -const char kTrialName[] = "SyncConsentOptional"; - -// Group names for the trial. -const char kEnabledGroup[] = "Enabled"; -const char kDisabledGroup[] = "Disabled"; -const char kDefaultGroup[] = "Default"; - -// Probabilities for all field trial groups add up to kTotalProbability. -const base::FieldTrial::Probability kTotalProbability = 100; - -// Creates the field trial. -scoped_refptr<base::FieldTrial> CreateFieldTrial() { - return base::FieldTrialList::FactoryGetFieldTrial( - kTrialName, kTotalProbability, kDefaultGroup, - base::FieldTrial::ONE_TIME_RANDOMIZED, - /*default_group_number=*/nullptr); -} - -// Sets the feature state based on the trial group. Defaults to disabled. -void SetFeatureState(base::FeatureList* feature_list, - base::FieldTrial* trial, - const std::string& group_name) { - base::FeatureList::OverrideState feature_state = - group_name == kEnabledGroup ? base::FeatureList::OVERRIDE_ENABLE_FEATURE - : base::FeatureList::OVERRIDE_DISABLE_FEATURE; - feature_list->RegisterFieldTrialOverride( - chromeos::features::kSyncConsentOptional.name, feature_state, trial); -} - -// Creates a trial for the first run (when there is no variations seed) and -// enables the feature based on the randomly selected trial group. Returns the -// group name. -std::string CreateFirstRunTrial(base::FeatureList* feature_list) { - int enabled_percent; - int disabled_percent; - int default_percent; - switch (chrome::GetChannel()) { - case version_info::Channel::UNKNOWN: - case version_info::Channel::CANARY: - case version_info::Channel::DEV: - case version_info::Channel::BETA: - // Field trial is disabled due to b/171471530. - // TODO(khorimoto): Re-enable the trial once the underlying issue is - // fixed. - enabled_percent = 0; - disabled_percent = 0; - default_percent = 100; - break; - case version_info::Channel::STABLE: - // Disabled on Stable pending approval (see https://crbug.com/1020731). - // Note that this code is not currently accessed on Stable channel due to - // the early return in Create() below. - enabled_percent = 0; - disabled_percent = 0; - default_percent = 100; - break; - } - DCHECK_EQ(kTotalProbability, - enabled_percent + disabled_percent + default_percent); - - // Set up the trial and groups. - scoped_refptr<base::FieldTrial> trial = CreateFieldTrial(); - trial->AppendGroup(kEnabledGroup, enabled_percent); - trial->AppendGroup(kDisabledGroup, disabled_percent); - trial->AppendGroup(kDefaultGroup, default_percent); - - // Finalize the group choice and set the feature state. - const std::string& group_name = trial->GetGroupNameWithoutActivation(); - SetFeatureState(feature_list, trial.get(), group_name); - return group_name; -} - -// Creates a trial with a single group and sets the feature flag to the state -// for that group. -void CreateSubsequentRunTrial(base::FeatureList* feature_list, - const std::string& group_name) { - scoped_refptr<base::FieldTrial> trial = CreateFieldTrial(); - trial->AppendGroup(group_name, kTotalProbability); - SetFeatureState(feature_list, trial.get(), group_name); -} - -} // namespace - -void RegisterLocalStatePrefs(PrefRegistrySimple* registry) { - registry->RegisterStringPref(kTrialGroupPrefName, std::string()); -} - -void Create(base::FeatureList* feature_list, PrefService* local_state) { - // TODO(https://crbug.com/1246357): Uncomment the function body for the - // SyncConsentOptional launch. - /* - // This field trial is only intended to be run on Canary/Dev/Beta channels. - // If the user is on Stable channel, return early so that they are not opted - // into this experiment. Without this return, users who were opted into the - // experiment on Canary/Dev/Beta, then changed to Stable, could still be in - // the experiment. See https://crbug.com/1147325. - if (chrome::GetChannel() == version_info::Channel::STABLE) - return; - - std::string trial_group = local_state->GetString(kTrialGroupPrefName); - if (trial_group.empty()) { - // No group assigned, this is the first run. - trial_group = CreateFirstRunTrial(feature_list); - // Persist the assigned group for subsequent runs. - local_state->SetString(kTrialGroupPrefName, trial_group); - } else { - // Group already assigned. - - // Field trial is disabled due to b/171471530. Override the existing trial - // and use kDefaultGroup instead. - // TODO(khorimoto): Remove the line below once the underlying issue from - // b/171471530 is fixed. - trial_group = kDefaultGroup; - - CreateSubsequentRunTrial(feature_list, trial_group); - } - */ -} - -} // namespace sync_consent_optional_field_trial
diff --git a/chrome/browser/ash/sync/sync_consent_optional_field_trial.h b/chrome/browser/ash/sync/sync_consent_optional_field_trial.h deleted file mode 100644 index af242e47..0000000 --- a/chrome/browser/ash/sync/sync_consent_optional_field_trial.h +++ /dev/null
@@ -1,44 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_ASH_SYNC_SYNC_CONSENT_OPTIONAL_FIELD_TRIAL_H_ -#define CHROME_BROWSER_ASH_SYNC_SYNC_CONSENT_OPTIONAL_FIELD_TRIAL_H_ - -class PrefRegistrySimple; -class PrefService; - -namespace base { -class FeatureList; -} // namespace base - -namespace sync_consent_optional_field_trial { - -// Registers preferences. -void RegisterLocalStatePrefs(PrefRegistrySimple* registry); - -// Creates a field trial to control the SyncConsentOptional feature. The trial -// is client controlled because SyncConsentOptional controls the out-of-box -// experience (OOBE) sync consent dialog, which shows up before a variations -// seed is available. -// -// The trial group chosen on first run is persisted to local state prefs and -// reused on subsequent runs. This keeps the in-session sync settings UI stable -// between runs. Local state prefs can be reset via powerwash, which will result -// in re-randomization, but this also sends the user through the first-run flow -// again and they will see the appropriate consent flow. -// -// Persisting the group also avoids a subtle corner case: A user could be -// randomized to SyncConsentOptional, opt-in to sync during OOBE, then turn off -// OS sync in OS settings but leave "Sync everything" enabled in browser -// settings. If they were re-randomized to non-SyncConsentOptional on a future -// login, then the OS sync data types would go back to being controlled by -// browser sync settings, and those OS types would be re-enabled even though the -// user had them disabled. -// -// Launch bug for the SyncConsentOptional feature: https://crbug.com/1020731 -void Create(base::FeatureList* feature_list, PrefService* local_state); - -} // namespace sync_consent_optional_field_trial - -#endif // CHROME_BROWSER_ASH_SYNC_SYNC_CONSENT_OPTIONAL_FIELD_TRIAL_H_
diff --git a/chrome/browser/ash/system_logs/debug_daemon_log_source.cc b/chrome/browser/ash/system_logs/debug_daemon_log_source.cc index e94c88a..ad5f632a 100644 --- a/chrome/browser/ash/system_logs/debug_daemon_log_source.cc +++ b/chrome/browser/ash/system_logs/debug_daemon_log_source.cc
@@ -14,7 +14,6 @@ #include "base/files/file_util.h" #include "base/logging.h" #include "base/memory/weak_ptr.h" -#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/task/post_task.h"
diff --git a/chrome/browser/ash/system_logs/shill_log_source.cc b/chrome/browser/ash/system_logs/shill_log_source.cc index 40432ea6..f42f2e6 100644 --- a/chrome/browser/ash/system_logs/shill_log_source.cc +++ b/chrome/browser/ash/system_logs/shill_log_source.cc
@@ -8,7 +8,6 @@ #include "base/containers/contains.h" #include "base/json/json_writer.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "chromeos/components/onc/onc_utils.h" #include "chromeos/dbus/shill/shill_device_client.h"
diff --git a/chrome/browser/ash/web_applications/crosh_loader_factory.cc b/chrome/browser/ash/web_applications/crosh_loader_factory.cc index 928d14ab..ac76f4a5 100644 --- a/chrome/browser/ash/web_applications/crosh_loader_factory.cc +++ b/chrome/browser/ash/web_applications/crosh_loader_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/web_applications/crosh_loader_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/web_applications/crosh_loader.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/autofill/autofill_image_fetcher_factory.cc b/chrome/browser/autofill/autofill_image_fetcher_factory.cc index 3c83828..50f7ebcb 100644 --- a/chrome/browser/autofill/autofill_image_fetcher_factory.cc +++ b/chrome/browser/autofill/autofill_image_fetcher_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/autofill/autofill_image_fetcher_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/image_fetcher/image_decoder_impl.h" #include "chrome/browser/profiles/incognito_helpers.h"
diff --git a/chrome/browser/autofill/autofill_interactive_uitest.cc b/chrome/browser/autofill/autofill_interactive_uitest.cc index 3a84a576..3d02cc3 100644 --- a/chrome/browser/autofill/autofill_interactive_uitest.cc +++ b/chrome/browser/autofill/autofill_interactive_uitest.cc
@@ -2151,8 +2151,16 @@ } // Test that Autofill does not fill in Company Name if disabled +// TODO(crbug.com/1279102): Flaky on Win and Mac. +#if defined(OS_WIN) || defined(OS_MAC) +#define MAYBE_NoAutofillSugggestionForCompanyName \ + DISABLED_NoAutofillSugggestionForCompanyName +#else +#define MAYBE_NoAutofillSugggestionForCompanyName \ + NoAutofillSugggestionForCompanyName +#endif IN_PROC_BROWSER_TEST_F(AutofillCompanyInteractiveTest, - NoAutofillSugggestionForCompanyName) { + MAYBE_NoAutofillSugggestionForCompanyName) { CreateTestProfile(); std::string company_name("Initech");
diff --git a/chrome/browser/bluetooth/bluetooth_chooser_context_factory.cc b/chrome/browser/bluetooth/bluetooth_chooser_context_factory.cc index dfebefef..87089c7 100644 --- a/chrome/browser/bluetooth/bluetooth_chooser_context_factory.cc +++ b/chrome/browser/bluetooth/bluetooth_chooser_context_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/bluetooth/bluetooth_chooser_context_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/breadcrumbs/breadcrumb_manager_keyed_service_factory.cc b/chrome/browser/breadcrumbs/breadcrumb_manager_keyed_service_factory.cc index c6e2caa..02d7148 100644 --- a/chrome/browser/breadcrumbs/breadcrumb_manager_keyed_service_factory.cc +++ b/chrome/browser/breadcrumbs/breadcrumb_manager_keyed_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/breadcrumbs/breadcrumb_manager_keyed_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "components/breadcrumbs/core/breadcrumb_manager_keyed_service.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index 1318d3ae..ab3d5ff 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd
@@ -326,9 +326,17 @@ <include name="IDR_SYS_INTERNALS_HTML" file="resources\chromeos\sys_internals\index.html" type="BINDATA" /> <include name="IDR_SYS_INTERNALS_CSS" file="resources\chromeos\sys_internals\index.css" type="BINDATA" /> <include name="IDR_SYS_INTERNALS_JS" file="resources\chromeos\sys_internals\index.js" type="BINDATA" /> + <include name="IDR_SYS_INTERNALS_MAIN_JS" file="resources\chromeos\sys_internals\main.js" type="BINDATA" /> <include name="IDR_SYS_INTERNALS_CONSTANT_JS" file="resources\chromeos\sys_internals\constants.js" type="BINDATA" /> + <include name="IDR_SYS_INTERNALS_TYPES_JS" file="resources\chromeos\sys_internals\types.js" type="BINDATA" /> + <include name="IDR_SYS_INTERNALS_LINE_CHART_CONSTANTS_JS" file="resources\chromeos\sys_internals\line_chart\constants.js" type="BINDATA" /> <include name="IDR_SYS_INTERNALS_LINE_CHART_CSS" file="resources\chromeos\sys_internals\line_chart\line_chart.css" type="BINDATA" /> - <include name="IDR_SYS_INTERNALS_LINE_CHART_JS" file="resources\chromeos\sys_internals\line_chart\index.js" flattenhtml="true" type="BINDATA" /> + <include name="IDR_SYS_INTERNALS_LINE_CHART_DATA_SERIES_JS" file="resources\chromeos\sys_internals\line_chart\data_series.js" type="BINDATA" /> + <include name="IDR_SYS_INTERNALS_LINE_CHART_LINE_CHART_JS" file="resources\chromeos\sys_internals\line_chart\line_chart.js" type="BINDATA" /> + <include name="IDR_SYS_INTERNALS_LINE_CHART_MENU_JS" file="resources\chromeos\sys_internals\line_chart\menu.js" type="BINDATA" /> + <include name="IDR_SYS_INTERNALS_LINE_CHART_SCROLLBAR_JS" file="resources\chromeos\sys_internals\line_chart\scrollbar.js" type="BINDATA" /> + <include name="IDR_SYS_INTERNALS_LINE_CHART_SUB_CHART_JS" file="resources\chromeos\sys_internals\line_chart\sub_chart.js" type="BINDATA" /> + <include name="IDR_SYS_INTERNALS_LINE_CHART_UNIT_LABEL_JS" file="resources\chromeos\sys_internals\line_chart\unit_label.js" type="BINDATA" /> <include name="IDR_SYS_INTERNALS_IMAGE_MENU_SVG" file="resources\chromeos\sys_internals\img\menu.svg" type="BINDATA" /> <include name="IDR_SYS_INTERNALS_IMAGE_INFO_SVG" file="resources\chromeos\sys_internals\img\info.svg" type="BINDATA" /> <include name="IDR_SYS_INTERNALS_IMAGE_CPU_SVG" file="resources\chromeos\sys_internals\img\cpu.svg" type="BINDATA" />
diff --git a/chrome/browser/cart/fetch_discount_worker.cc b/chrome/browser/cart/fetch_discount_worker.cc index 40ecf10..30bde5f 100644 --- a/chrome/browser/cart/fetch_discount_worker.cc +++ b/chrome/browser/cart/fetch_discount_worker.cc
@@ -6,7 +6,6 @@ #include "base/memory/scoped_refptr.h" #include "base/metrics/field_trial_params.h" -#include "base/no_destructor.h" #include "base/task/thread_pool.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/cart/cart_discount_fetcher.h"
diff --git a/chrome/browser/chrome_browser_field_trials.cc b/chrome/browser/chrome_browser_field_trials.cc index a06e7467..7ba99d5 100644 --- a/chrome/browser/chrome_browser_field_trials.cc +++ b/chrome/browser/chrome_browser_field_trials.cc
@@ -38,7 +38,6 @@ #endif #if BUILDFLAG(IS_CHROMEOS_ASH) -#include "chrome/browser/ash/sync/sync_consent_optional_field_trial.h" #include "chromeos/services/multidevice_setup/public/cpp/first_run_field_trial.h" #endif @@ -95,11 +94,6 @@ chromeos::multidevice_setup::CreateFirstRunFieldTrial(feature_list); #endif } -#if BUILDFLAG(IS_CHROMEOS_ASH) - // This trial is fully client controlled and must be configured whether or - // not a seed is available. - sync_consent_optional_field_trial::Create(feature_list, local_state_); -#endif } void ChromeBrowserFieldTrials::RegisterSyntheticTrials() {
diff --git a/chrome/browser/chrome_content_browser_client_browsertest.cc b/chrome/browser/chrome_content_browser_client_browsertest.cc index 464c5e5..68ec431 100644 --- a/chrome/browser/chrome_content_browser_client_browsertest.cc +++ b/chrome/browser/chrome_content_browser_client_browsertest.cc
@@ -10,7 +10,6 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/memory/raw_ptr.h" -#include "base/no_destructor.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/test/scoped_feature_list.h"
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 8473814e..95265de8 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -3048,8 +3048,6 @@ "../ash/sync/os_sync_util.h", "../ash/sync/os_syncable_service_model_type_controller.cc", "../ash/sync/os_syncable_service_model_type_controller.h", - "../ash/sync/sync_consent_optional_field_trial.cc", - "../ash/sync/sync_consent_optional_field_trial.h", "../ash/system/automatic_reboot_manager.cc", "../ash/system/automatic_reboot_manager.h", "../ash/system/automatic_reboot_manager_observer.h", @@ -3735,6 +3733,8 @@ "../ash/login/screens/recommend_apps/fake_recommend_apps_fetcher_delegate.h", "../ash/login/test/dialog_window_waiter.cc", "../ash/login/test/dialog_window_waiter.h", + "../ash/login/test/embedded_policy_test_server_mixin.cc", + "../ash/login/test/embedded_policy_test_server_mixin.h", "../ash/login/test/embedded_test_server_setup_mixin.cc", "../ash/login/test/embedded_test_server_setup_mixin.h", "../ash/login/test/fake_gaia_mixin.cc",
diff --git a/chrome/browser/chromeos/extensions/login_screen/login/cleanup/cleanup_manager.cc b/chrome/browser/chromeos/extensions/login_screen/login/cleanup/cleanup_manager.cc index 6114640..7299ef8a 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login/cleanup/cleanup_manager.cc +++ b/chrome/browser/chromeos/extensions/login_screen/login/cleanup/cleanup_manager.cc
@@ -9,6 +9,7 @@ #include "base/barrier_closure.h" #include "base/bind.h" #include "base/metrics/histogram_functions.h" +#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "chrome/browser/chromeos/extensions/login_screen/login/cleanup/browsing_data_cleanup_handler.h" #include "chrome/browser/chromeos/extensions/login_screen/login/cleanup/clipboard_cleanup_handler.h"
diff --git a/chrome/browser/chromeos/extensions/login_screen/login/cleanup/extension_cleanup_handler.h b/chrome/browser/chromeos/extensions/login_screen/login/cleanup/extension_cleanup_handler.h index 4c854d2..58c3de7c 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login/cleanup/extension_cleanup_handler.h +++ b/chrome/browser/chromeos/extensions/login_screen/login/cleanup/extension_cleanup_handler.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_LOGIN_SCREEN_LOGIN_CLEANUP_EXTENSION_CLEANUP_HANDLER_H_ #include "base/callback.h" -#include "base/no_destructor.h" #include "chrome/browser/chromeos/extensions/login_screen/login/cleanup/cleanup_handler.h" #include "chrome/browser/extensions/extension_service.h"
diff --git a/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc b/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc index 9af2d17..948a42b 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc +++ b/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc
@@ -417,9 +417,8 @@ auto registry_observer = GetTestExtensionRegistryObserver(kInSessionExtensionId); - ASSERT_TRUE( - logged_in_user_mixin_.GetLocalPolicyTestServerMixin()->UpdateUserPolicy( - user_policy_builder->payload(), account_id.GetUserEmail())); + logged_in_user_mixin_.GetEmbeddedPolicyTestServerMixin()->UpdateUserPolicy( + user_policy_builder->payload(), account_id.GetUserEmail()); session_manager_client()->set_user_policy( cryptohome::CreateAccountIdentifierFromAccountId(account_id), user_policy_builder->GetBlob());
diff --git a/chrome/browser/chromeos/extensions/login_screen/login/shared_session_handler.cc b/chrome/browser/chromeos/extensions/login_screen/login/shared_session_handler.cc index f9490b4..48c3856e 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login/shared_session_handler.cc +++ b/chrome/browser/chromeos/extensions/login_screen/login/shared_session_handler.cc
@@ -8,6 +8,7 @@ #include "ash/components/settings/cros_settings_names.h" #include "base/bind.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/login/existing_user_controller.h" #include "chrome/browser/ash/settings/cros_settings.h" #include "chrome/browser/chromeos/extensions/login_screen/login/cleanup/cleanup_manager.h"
diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc index 22f99e3..98401f0f 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
@@ -265,12 +265,8 @@ // When the sync settings categorization is on, the wallpaper sync status is // stored in the kSyncOsWallpaper pref. The pref value essentially means // "themes sync is on" && "apps sync is on". - // TODO(https://crbug.com/1243218): Figure out if we need to check - // IsOsSyncFeatureEnabled here. - bool os_wallpaper_sync_enabled = - sync_service->GetUserSettings()->IsOsSyncFeatureEnabled() && - profile->GetPrefs()->GetBoolean( - chromeos::settings::prefs::kSyncOsWallpaper); + bool os_wallpaper_sync_enabled = profile->GetPrefs()->GetBoolean( + chromeos::settings::prefs::kSyncOsWallpaper); dict->SetBoolean(kSyncThemes, os_wallpaper_sync_enabled); Respond(OneArgument(base::Value::FromUniquePtrValue(std::move(dict)))); return;
diff --git a/chrome/browser/chromeos/fileapi/file_change_service_factory.cc b/chrome/browser/chromeos/fileapi/file_change_service_factory.cc index 9e282079..d1f034b3 100644 --- a/chrome/browser/chromeos/fileapi/file_change_service_factory.cc +++ b/chrome/browser/chromeos/fileapi/file_change_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/fileapi/file_change_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/chromeos/fileapi/file_change_service.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/chromeos/printing/cups_proxy_service_manager_factory.cc b/chrome/browser/chromeos/printing/cups_proxy_service_manager_factory.cc index ddcc3630..2df4c16 100644 --- a/chrome/browser/chromeos/printing/cups_proxy_service_manager_factory.cc +++ b/chrome/browser/chromeos/printing/cups_proxy_service_manager_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/printing/cups_proxy_service_manager_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/chromeos/printing/cups_proxy_service_manager.h" #include "chrome/browser/profiles/incognito_helpers.h"
diff --git a/chrome/browser/chromeos/printing/printer_configurer.cc b/chrome/browser/chromeos/printing/printer_configurer.cc index 9017214..1b59a05 100644 --- a/chrome/browser/chromeos/printing/printer_configurer.cc +++ b/chrome/browser/chromeos/printing/printer_configurer.cc
@@ -18,7 +18,6 @@ #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "chrome/browser/ash/printing/ppd_provider_factory.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h"
diff --git a/chrome/browser/commerce/coupons/coupon_service_factory.cc b/chrome/browser/commerce/coupons/coupon_service_factory.cc index ead7da1..a25cdce34 100644 --- a/chrome/browser/commerce/coupons/coupon_service_factory.cc +++ b/chrome/browser/commerce/coupons/coupon_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/commerce/coupons/coupon_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/commerce/coupons/coupon_db.h" #include "chrome/browser/commerce/coupons/coupon_service.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/commerce/merchant_viewer/merchant_signal_db.cc b/chrome/browser/commerce/merchant_viewer/merchant_signal_db.cc index 217772a..f97ae1b 100644 --- a/chrome/browser/commerce/merchant_viewer/merchant_signal_db.cc +++ b/chrome/browser/commerce/merchant_viewer/merchant_signal_db.cc
@@ -11,7 +11,6 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/containers/fixed_flat_map.h" -#include "base/no_destructor.h" #include "chrome/browser/commerce/merchant_viewer/android/jni_headers/MerchantTrustSignalsEventStorage_jni.h" #include "chrome/browser/commerce/merchant_viewer/android/jni_headers/MerchantTrustSignalsEvent_jni.h" #include "chrome/browser/commerce/merchant_viewer/merchant_signal_db_content.pb.h"
diff --git a/chrome/browser/commerce/subscriptions/commerce_subscription_db.cc b/chrome/browser/commerce/subscriptions/commerce_subscription_db.cc index 8b59c6e..adc6345 100644 --- a/chrome/browser/commerce/subscriptions/commerce_subscription_db.cc +++ b/chrome/browser/commerce/subscriptions/commerce_subscription_db.cc
@@ -11,7 +11,6 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/containers/fixed_flat_map.h" -#include "base/no_destructor.h" #include "chrome/browser/commerce/subscriptions/android/jni_headers/CommerceSubscription_jni.h" #include "chrome/browser/commerce/subscriptions/android/jni_headers/CommerceSubscriptionsStorage_jni.h" #include "chrome/browser/commerce/subscriptions/commerce_subscription_db_content.pb.h"
diff --git a/chrome/browser/devtools/devtools_browser_context_manager.cc b/chrome/browser/devtools/devtools_browser_context_manager.cc index 466f3c7..1981efe 100644 --- a/chrome/browser/devtools/devtools_browser_context_manager.cc +++ b/chrome/browser/devtools/devtools_browser_context_manager.cc
@@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" +#include "base/no_destructor.h" #include "chrome/browser/profiles/profile_destroyer.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/browser.h"
diff --git a/chrome/browser/enterprise/browser_management/management_service_factory.cc b/chrome/browser/enterprise/browser_management/management_service_factory.cc index 4e2a44bf..75484198 100644 --- a/chrome/browser/enterprise/browser_management/management_service_factory.cc +++ b/chrome/browser/enterprise/browser_management/management_service_factory.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/enterprise/browser_management/management_service_factory.h" #include "base/memory/singleton.h" +#include "base/no_destructor.h" #include "chrome/browser/enterprise/browser_management/browser_management_service.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/enterprise/connectors/connectors_manager.cc b/chrome/browser/enterprise/connectors/connectors_manager.cc index 039b032..6d14508 100644 --- a/chrome/browser/enterprise/connectors/connectors_manager.cc +++ b/chrome/browser/enterprise/connectors/connectors_manager.cc
@@ -7,7 +7,6 @@ #include <memory> #include "base/feature_list.h" -#include "base/no_destructor.h" #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/enterprise/connectors/connectors_prefs.h"
diff --git a/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator.cc b/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator.cc index 6d3abaa..586a3218 100644 --- a/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator.cc +++ b/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator.cc
@@ -7,7 +7,6 @@ #include <string> #include "base/json/values_util.h" -#include "base/no_destructor.h" #include "base/time/time.h" #include "base/values.h" #include "build/chromeos_buildflags.h"
diff --git a/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc b/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc index 9243460..a543970 100644 --- a/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc +++ b/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc
@@ -402,6 +402,9 @@ // Wait for the extension to receive the sign request. ASSERT_TRUE(sign_digest_listener.WaitUntilSatisfied()); + EXPECT_GT(cert_provider_service_->pin_dialog_manager() + ->StoredSignRequestsForTesting(), + 0); // Check that the certificate is available. scoped_refptr<net::X509Certificate> certificate = GetCertificate(); @@ -445,6 +448,11 @@ // Wait for the https navigation to finish. navigation_observer.Wait(); + // Make sure that sign request is removed from pin dialog manager. + EXPECT_EQ(cert_provider_service_->pin_dialog_manager() + ->StoredSignRequestsForTesting(), + 0); + // Check whether the server acknowledged that a client certificate was // presented. const std::string client_cert_fingerprint =
diff --git a/chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc b/chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc index a016848..4305987 100644 --- a/chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc +++ b/chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc
@@ -8,6 +8,7 @@ #include "base/base_paths.h" #include "base/files/file_util.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/path_service.h" #include "base/rand_util.h" #include "build/build_config.h"
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.cc index 2fead96c..23603d6 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.cc +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h" #include "chrome/browser/password_manager/bulk_leak_check_service_factory.h"
diff --git a/chrome/browser/extensions/api/system_indicator/system_indicator_api.cc b/chrome/browser/extensions/api/system_indicator/system_indicator_api.cc index e75425b..fa061edf 100644 --- a/chrome/browser/extensions/api/system_indicator/system_indicator_api.cc +++ b/chrome/browser/extensions/api/system_indicator/system_indicator_api.cc
@@ -4,7 +4,6 @@ #include "chrome/browser/extensions/api/system_indicator/system_indicator_api.h" -#include "base/no_destructor.h" #include "chrome/browser/extensions/api/system_indicator/system_indicator_manager.h" #include "chrome/browser/extensions/api/system_indicator/system_indicator_manager_factory.h" #include "chrome/common/extensions/api/system_indicator/system_indicator_handler.h"
diff --git a/chrome/browser/extensions/api/web_authentication_proxy/web_authentication_proxy_service.cc b/chrome/browser/extensions/api/web_authentication_proxy/web_authentication_proxy_service.cc index 049052b..ca0f0af0 100644 --- a/chrome/browser/extensions/api/web_authentication_proxy/web_authentication_proxy_service.cc +++ b/chrome/browser/extensions/api/web_authentication_proxy/web_authentication_proxy_service.cc
@@ -6,6 +6,7 @@ #include <limits> +#include "base/no_destructor.h" #include "base/rand_util.h" #include "chrome/common/extensions/api/web_authentication_proxy.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc index eff48ee..20a117bd 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -8,7 +8,6 @@ #include <memory> -#include "base/no_destructor.h" #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_constants.h" #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.h" #include "chrome/browser/extensions/extension_tab_util.h"
diff --git a/chrome/browser/extensions/chrome_content_verifier_delegate.cc b/chrome/browser/extensions/chrome_content_verifier_delegate.cc index a445df3f..f8cae7b 100644 --- a/chrome/browser/extensions/chrome_content_verifier_delegate.cc +++ b/chrome/browser/extensions/chrome_content_verifier_delegate.cc
@@ -14,7 +14,6 @@ #include "base/containers/contains.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" #include "base/syslog_logging.h"
diff --git a/chrome/browser/extensions/external_pref_loader.cc b/chrome/browser/extensions/external_pref_loader.cc index 1f90565e6..7623d81 100644 --- a/chrome/browser/extensions/external_pref_loader.cc +++ b/chrome/browser/extensions/external_pref_loader.cc
@@ -136,40 +136,10 @@ } DCHECK(!done_closure_); done_closure_ = std::move(done_closure); - if (chromeos::features::IsSyncConsentOptionalEnabled()) { - // SyncConsentOptional lets users opt-out of sync during OOBE. - PrefService* prefs = profile_->GetPrefs(); - if (!prefs->GetBoolean(chromeos::prefs::kSyncOobeCompleted)) { - // Need to wait for OOBE completion before checking if sync is enabled. - pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); - pref_change_registrar_->Init(prefs); - // base::Unretained is safe because we own |pref_changed_registrar_|. - pref_change_registrar_->Add( - chromeos::prefs::kSyncOobeCompleted, - base::BindRepeating(&PrioritySyncReadyWaiter::OnSyncOobeCompleted, - base::Unretained(this))); - return; - } - } MaybeObserveSyncStart(); } private: - void OnSyncOobeCompleted() { - DCHECK(chromeos::features::IsSyncConsentOptionalEnabled()); - DCHECK( - profile_->GetPrefs()->GetBoolean(chromeos::prefs::kSyncOobeCompleted)); - pref_change_registrar_.reset(); - syncer::SyncService* service = SyncServiceFactory::GetForProfile(profile_); - if (!service->GetUserSettings()->IsOsSyncFeatureEnabled()) { - // User opted-out of OS sync, OS sync will never start, we're done here. - Finish(); - // Note: |this| is deleted. - return; - } - MaybeObserveSyncStart(); - } - void MaybeObserveSyncStart() { syncer::SyncService* service = SyncServiceFactory::GetForProfile(profile_); DCHECK(service); @@ -229,9 +199,6 @@ base::OnceClosure done_closure_; - // Used with SyncConsentOptional to wait for OOBE sync dialog completion. - std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; - // Used for registering observer for sync_preferences::PrefServiceSyncable. base::ScopedObservation<sync_preferences::PrefServiceSyncable, sync_preferences::PrefServiceSyncableObserver>
diff --git a/chrome/browser/extensions/external_pref_loader_unittest.cc b/chrome/browser/extensions/external_pref_loader_unittest.cc index 6eede1aa..c9e57dcc 100644 --- a/chrome/browser/extensions/external_pref_loader_unittest.cc +++ b/chrome/browser/extensions/external_pref_loader_unittest.cc
@@ -131,16 +131,11 @@ public: ExternalPrefLoaderTest() { if (ShouldEnableSyncSettingsCategorization()) { - feature_list_.InitWithFeatures( - /*enabled_features=*/{chromeos::features:: - kSyncSettingsCategorization}, - /*disabled_features=*/{chromeos::features::kSyncConsentOptional}); + feature_list_.InitAndEnableFeature( + chromeos::features::kSyncSettingsCategorization); } else { - feature_list_.InitWithFeatures( - /*enabled_features=*/{}, - /*disabled_features=*/{ - chromeos::features::kSyncSettingsCategorization, - chromeos::features::kSyncConsentOptional}); + feature_list_.InitAndDisableFeature( + chromeos::features::kSyncSettingsCategorization); } } ~ExternalPrefLoaderTest() override = default; @@ -156,7 +151,7 @@ // Tests that we fire pref reading correctly after priority sync state // is resolved by ExternalPrefLoader. This test checks that the flow works -// without SyncSettingsCategorization and SyncConsentOptional. +// regardless of the state of SyncSettingsCategorization. TEST_P(ExternalPrefLoaderTest, PrefReadInitiatesCorrectly) { base::RunLoop run_loop; scoped_refptr<ExternalPrefLoader> loader( @@ -179,97 +174,4 @@ ExternalPrefLoaderTest, ::testing::Bool()); -class ExternalPrefLoaderSyncConsentOptionalTest - : public ExternalPrefLoaderTestBase { - public: - ExternalPrefLoaderSyncConsentOptionalTest() { - feature_list_.InitWithFeatures( - /*enabled_features=*/{chromeos::features::kSyncSettingsCategorization, - chromeos::features::kSyncConsentOptional}, - /*disabled_features=*/{}); - } - ~ExternalPrefLoaderSyncConsentOptionalTest() override = default; - ExternalPrefLoaderSyncConsentOptionalTest( - ExternalPrefLoaderSyncConsentOptionalTest&) = delete; - ExternalPrefLoaderSyncConsentOptionalTest& operator=( - ExternalPrefLoaderSyncConsentOptionalTest&) = delete; -}; - -TEST_F(ExternalPrefLoaderSyncConsentOptionalTest, OsSyncEnabled) { - base::RunLoop run_loop; - scoped_refptr<ExternalPrefLoader> loader = - base::MakeRefCounted<TestExternalPrefLoader>( - profile(), run_loop.QuitWhenIdleClosure()); - ExternalProviderImpl provider( - /*service=*/nullptr, loader, profile(), - ManifestLocation::kInvalidLocation, ManifestLocation::kInvalidLocation, - Extension::NO_FLAGS); - provider.VisitRegisteredExtension(); - - PrefService* prefs = profile()->GetPrefs(); - ASSERT_FALSE(prefs->GetBoolean(chromeos::prefs::kSyncOobeCompleted)); - - // Simulate OOBE screen completion with OS sync enabled. - sync_service()->GetUserSettings()->SetOsSyncFeatureEnabled(true); - prefs->SetBoolean(chromeos::prefs::kSyncOobeCompleted, true); - - // Simulate OS prefs starting to sync. - sync_preferences::PrefServiceSyncable* pref_sync = - profile()->GetTestingPrefService(); - // This is an ugly cast, but it's how other tests do it. - sync_preferences::PrefModelAssociator* pref_sync_service = - static_cast<sync_preferences::PrefModelAssociator*>( - pref_sync->GetSyncableService(syncer::OS_PRIORITY_PREFERENCES)); - pref_sync_service->MergeDataAndStartSyncing( - syncer::OS_PRIORITY_PREFERENCES, syncer::SyncDataList(), - std::make_unique<syncer::FakeSyncChangeProcessor>(), - std::make_unique<syncer::SyncErrorFactoryMock>()); - - run_loop.Run(); - // |loader| completed loading. -} - -TEST_F(ExternalPrefLoaderSyncConsentOptionalTest, OsSyncDisable) { - base::RunLoop run_loop; - scoped_refptr<ExternalPrefLoader> loader = - base::MakeRefCounted<TestExternalPrefLoader>( - profile(), run_loop.QuitWhenIdleClosure()); - ExternalProviderImpl provider( - /*service=*/nullptr, loader, profile(), - ManifestLocation::kInvalidLocation, ManifestLocation::kInvalidLocation, - Extension::NO_FLAGS); - provider.VisitRegisteredExtension(); - - PrefService* prefs = profile()->GetPrefs(); - ASSERT_FALSE(prefs->GetBoolean(chromeos::prefs::kSyncOobeCompleted)); - - // Simulate OOBE screen completion with OS sync disabled. - sync_service()->GetUserSettings()->SetOsSyncFeatureEnabled(false); - prefs->SetBoolean(chromeos::prefs::kSyncOobeCompleted, true); - - // Loader doesn't need to wait, since OS pref sync is disabled. - run_loop.Run(); - // |loader| completed loading. -} - -TEST_F(ExternalPrefLoaderSyncConsentOptionalTest, SyncDisabledByPolicy) { - sync_service()->SetDisableReasons( - syncer::SyncService::DISABLE_REASON_ENTERPRISE_POLICY); - ASSERT_FALSE(sync_service()->CanSyncFeatureStart()); - - base::RunLoop run_loop; - scoped_refptr<ExternalPrefLoader> loader = - base::MakeRefCounted<TestExternalPrefLoader>( - profile(), run_loop.QuitWhenIdleClosure()); - ExternalProviderImpl provider( - /*service=*/nullptr, loader, profile(), - ManifestLocation::kInvalidLocation, ManifestLocation::kInvalidLocation, - Extension::NO_FLAGS); - provider.VisitRegisteredExtension(); - - // Loader doesn't need to wait, because sync will never enable. - run_loop.Run(); - // |loader| completed loading. -} - } // namespace extensions
diff --git a/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc b/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc index 54615df..c863af8 100644 --- a/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc +++ b/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc
@@ -287,7 +287,6 @@ // OOBE screen completed with OS sync enabled. PrefService* prefs = profile()->GetPrefs(); - prefs->SetBoolean(syncer::prefs::kOsSyncFeatureEnabled, true); prefs->SetBoolean(chromeos::prefs::kSyncOobeCompleted, true); // App sync will wait for priority sync to complete.
diff --git a/chrome/browser/first_party_sets/first_party_sets_util.cc b/chrome/browser/first_party_sets/first_party_sets_util.cc index b6759b7..7bdfadc5 100644 --- a/chrome/browser/first_party_sets/first_party_sets_util.cc +++ b/chrome/browser/first_party_sets/first_party_sets_util.cc
@@ -8,6 +8,7 @@ #include "base/callback_helpers.h" #include "base/files/file_util.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h" #include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 0babcd6..8255dad 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -3603,6 +3603,11 @@ "expiry_milestone": 95 }, { + "name": "ios-shared-highlighting-v2", + "owners": ["tmartino", "cheickcisse@google.com"], + "expiry_milestone": 100 + }, + { "name": "ios-synthetic-crash-reports", "owners": [ "olivierrobin", "justincohen", "bling-flags@google.com" ], "expiry_milestone": 100
diff --git a/chrome/browser/hid/hid_chooser_context_factory.cc b/chrome/browser/hid/hid_chooser_context_factory.cc index 3a43b5227..35019f85 100644 --- a/chrome/browser/hid/hid_chooser_context_factory.cc +++ b/chrome/browser/hid/hid_chooser_context_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/hid/hid_chooser_context_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/hid/hid_chooser_context.h" #include "chrome/browser/profiles/incognito_helpers.h"
diff --git a/chrome/browser/history/domain_diversity_reporter_factory.cc b/chrome/browser/history/domain_diversity_reporter_factory.cc index 1f47d0cbb..9a52edc 100644 --- a/chrome/browser/history/domain_diversity_reporter_factory.cc +++ b/chrome/browser/history/domain_diversity_reporter_factory.cc
@@ -7,6 +7,7 @@ #include <string> #include "base/bind.h" +#include "base/no_destructor.h" #include "base/time/default_clock.h" #include "build/build_config.h" #include "chrome/browser/history/history_service_factory.h"
diff --git a/chrome/browser/history_clusters/history_clusters_service_factory.cc b/chrome/browser/history_clusters/history_clusters_service_factory.cc index c27203f..7699066 100644 --- a/chrome/browser/history_clusters/history_clusters_service_factory.cc +++ b/chrome/browser/history_clusters/history_clusters_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/history_clusters/history_clusters_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/engagement/site_engagement_service_factory.h" #include "chrome/browser/history/history_service_factory.h"
diff --git a/chrome/browser/lacros/account_manager/profile_account_manager_factory.cc b/chrome/browser/lacros/account_manager/profile_account_manager_factory.cc index ef50717..f90b3eb 100644 --- a/chrome/browser/lacros/account_manager/profile_account_manager_factory.cc +++ b/chrome/browser/lacros/account_manager/profile_account_manager_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/lacros/account_manager/profile_account_manager_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/lacros/account_manager/profile_account_manager.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/lacros/cert_db_initializer_factory.cc b/chrome/browser/lacros/cert_db_initializer_factory.cc index 57bb1a8..d408862 100644 --- a/chrome/browser/lacros/cert_db_initializer_factory.cc +++ b/chrome/browser/lacros/cert_db_initializer_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/lacros/cert_db_initializer_factory.h" +#include "base/no_destructor.h" #include "base/system/sys_info.h" #include "chrome/browser/lacros/cert_db_initializer_impl.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/login_detection/login_detection_keyed_service_factory.cc b/chrome/browser/login_detection/login_detection_keyed_service_factory.cc index 4b6351c..7e796fd 100644 --- a/chrome/browser/login_detection/login_detection_keyed_service_factory.cc +++ b/chrome/browser/login_detection/login_detection_keyed_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/login_detection/login_detection_keyed_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/login_detection/login_detection_keyed_service.h" #include "chrome/browser/login_detection/login_detection_util.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h"
diff --git a/chrome/browser/media/webrtc/webrtc_interactive_uitest.cc b/chrome/browser/media/webrtc/webrtc_interactive_uitest.cc index 16cf5cb3..ab37a849 100644 --- a/chrome/browser/media/webrtc/webrtc_interactive_uitest.cc +++ b/chrome/browser/media/webrtc/webrtc_interactive_uitest.cc
@@ -318,17 +318,9 @@ DetectVideoAndHangUp(); } -// Test is flaky on windows. https://crbug.com/1239275 -#if defined(OS_WIN) -#define MAYBE_RunsAudioVideoWebRTCCallInTwoTabsEmitsGatheringStateChange_ConnectionCount \ - DISABLED_RunsAudioVideoWebRTCCallInTwoTabsEmitsGatheringStateChange_ConnectionCount -#else -#define MAYBE_RunsAudioVideoWebRTCCallInTwoTabsEmitsGatheringStateChange_ConnectionCount \ - RunsAudioVideoWebRTCCallInTwoTabsEmitsGatheringStateChange_ConnectionCount -#endif IN_PROC_BROWSER_TEST_F( WebRtcBrowserTest, - MAYBE_RunsAudioVideoWebRTCCallInTwoTabsEmitsGatheringStateChange_ConnectionCount) { + RunsAudioVideoWebRTCCallInTwoTabsEmitsGatheringStateChange_ConnectionCount) { EXPECT_EQ(0u, GetPeerToPeerConnectionsCountChangeFromNetworkService()); StartServerAndOpenTabs(); SetupPeerconnectionWithLocalStream(left_tab_);
diff --git a/chrome/browser/metrics/family_user_metrics_provider_browsertest.cc b/chrome/browser/metrics/family_user_metrics_provider_browsertest.cc index 8b263462..3eb5f9b 100644 --- a/chrome/browser/metrics/family_user_metrics_provider_browsertest.cc +++ b/chrome/browser/metrics/family_user_metrics_provider_browsertest.cc
@@ -110,10 +110,10 @@ /*should_launch_browser=*/true, GetPrimaryAccountId(GetFamilyUserLogSegment()), /*include_initial_user=*/true, - // Don't use LocalPolicyTestServer because it does not support customizing - // PolicyData. - // TODO(crbug/1112885): Use LocalPolicyTestServer when this is fixed. - /*use_local_policy_server=*/false}; + // Don't use EmbeddedPolicyTestServer because it does not support + // customizing PolicyData. + // TODO(crbug/1112885): Use EmbeddedPolicyTestServer when this is fixed. + /*use_embedded_policy_server=*/false}; }; IN_PROC_BROWSER_TEST_P(FamilyUserMetricsProviderTest, UserCategory) {
diff --git a/chrome/browser/metrics/perf/metric_provider.cc b/chrome/browser/metrics/perf/metric_provider.cc index 0b6f52e..bc6b264 100644 --- a/chrome/browser/metrics/perf/metric_provider.cc +++ b/chrome/browser/metrics/perf/metric_provider.cc
@@ -200,8 +200,6 @@ // the OS settings. Otherwise, we read from Chrome settings. We then check if // the sync feature is enabled and the App Sync toggle is on. if (chromeos::features::IsSyncSettingsCategorizationEnabled()) { - if (!sync_settings->IsOsSyncFeatureEnabled()) - return RecordAttemptStatus::kOSSyncFeatureDisabled; if (!sync_settings->GetSelectedOsTypes().Has( syncer::UserSelectableOsType::kOsApps)) return RecordAttemptStatus::kOSAppSyncDisabled;
diff --git a/chrome/browser/metrics/perf/metric_provider.h b/chrome/browser/metrics/perf/metric_provider.h index 0143d99..0b239d91 100644 --- a/chrome/browser/metrics/perf/metric_provider.h +++ b/chrome/browser/metrics/perf/metric_provider.h
@@ -81,7 +81,7 @@ kSyncServiceUnavailable = 5, kChromeSyncFeatureDisabled = 6, kChromeAppSyncDisabled = 7, - kOSSyncFeatureDisabled = 8, + // Deprecated: kOSSyncFeatureDisabled = 8, kOSAppSyncDisabled = 9, kMaxValue = kOSAppSyncDisabled, };
diff --git a/chrome/browser/metrics/perf/metric_provider_unittest.cc b/chrome/browser/metrics/perf/metric_provider_unittest.cc index 7743376947..1e12b51 100644 --- a/chrome/browser/metrics/perf/metric_provider_unittest.cc +++ b/chrome/browser/metrics/perf/metric_provider_unittest.cc
@@ -351,13 +351,11 @@ } void EnableOSAppSync(TestSyncService* sync_service) { - sync_service->GetUserSettings()->SetOsSyncFeatureEnabled(true); sync_service->GetUserSettings()->SetSelectedOsTypes( /*sync_all_os_types=*/false, {syncer::UserSelectableOsType::kOsApps}); } void DisableOSAppSync(TestSyncService* sync_service) { - sync_service->GetUserSettings()->SetOsSyncFeatureEnabled(true); sync_service->GetUserSettings()->SetSelectedOsTypes( /*sync_all_os_types=*/false, {}); }
diff --git a/chrome/browser/metrics/structured/chrome_structured_metrics_recorder.cc b/chrome/browser/metrics/structured/chrome_structured_metrics_recorder.cc index f4ccf1ec..389bb44 100644 --- a/chrome/browser/metrics/structured/chrome_structured_metrics_recorder.cc +++ b/chrome/browser/metrics/structured/chrome_structured_metrics_recorder.cc
@@ -7,6 +7,7 @@ #include <stdint.h> #include "base/feature_list.h" +#include "base/no_destructor.h" #include "build/chromeos_buildflags.h" #include "components/metrics/structured/histogram_util.h" #include "components/metrics/structured/structured_metrics_features.h"
diff --git a/chrome/browser/metrics/usertype_by_devicetype_metrics_provider_browsertest.cc b/chrome/browser/metrics/usertype_by_devicetype_metrics_provider_browsertest.cc index 3d736c5..70c67c4 100644 --- a/chrome/browser/metrics/usertype_by_devicetype_metrics_provider_browsertest.cc +++ b/chrome/browser/metrics/usertype_by_devicetype_metrics_provider_browsertest.cc
@@ -378,10 +378,10 @@ embedded_test_server(), this, /*should_launch_browser=*/true, GetPrimaryAccountId(), /*include_initial_user=*/true, - // Don't use LocalPolicyTestServer because it does not support customizing - // PolicyData. - // TODO(crbug/1112885): Use LocalPolicyTestServer when this is fixed. - /*use_local_policy_server=*/false}; + // Don't use EmbeddedPolicyTestServer because it does not support + // customizing PolicyData. + // TODO(crbug/1112885): Use EmbeddedPolicyTestServer when this is fixed. + /*use_embedded_policy_server=*/false}; policy::UserPolicyBuilder device_local_account_policy_; ash::LocalPolicyTestServerMixin local_policy_mixin_{&mixin_host_};
diff --git a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl_unittest.cc b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl_unittest.cc index b6e2c40..bf356c9 100644 --- a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl_unittest.cc +++ b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl_unittest.cc
@@ -10,7 +10,6 @@ #include "base/containers/contains.h" #include "base/containers/flat_set.h" -#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "chrome/browser/nearby_sharing/client/fake_nearby_share_client.h" #include "chrome/browser/nearby_sharing/common/fake_nearby_share_profile_info_provider.h"
diff --git a/chrome/browser/optimization_guide/model_validator_keyed_service_factory.cc b/chrome/browser/optimization_guide/model_validator_keyed_service_factory.cc index 60491af8..d6636df0 100644 --- a/chrome/browser/optimization_guide/model_validator_keyed_service_factory.cc +++ b/chrome/browser/optimization_guide/model_validator_keyed_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/optimization_guide/model_validator_keyed_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/optimization_guide/model_validator_keyed_service.h" #include "chrome/browser/optimization_guide/model_validator_keyed_service_factory.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h"
diff --git a/chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.cc b/chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.cc index 7b942577..046225b 100644 --- a/chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.cc +++ b/chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h" +#include "base/no_destructor.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h"
diff --git a/chrome/browser/optimization_guide/page_content_annotations_service_factory.cc b/chrome/browser/optimization_guide/page_content_annotations_service_factory.cc index 7af73261..2d0ba01 100644 --- a/chrome/browser/optimization_guide/page_content_annotations_service_factory.cc +++ b/chrome/browser/optimization_guide/page_content_annotations_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/optimization_guide/page_content_annotations_service_factory.h" +#include "base/no_destructor.h" #include "base/task/sequenced_task_runner.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h"
diff --git a/chrome/browser/page_info/about_this_site_service_factory.cc b/chrome/browser/page_info/about_this_site_service_factory.cc index 6e0897fc..aaf7acf 100644 --- a/chrome/browser/page_info/about_this_site_service_factory.cc +++ b/chrome/browser/page_info/about_this_site_service_factory.cc
@@ -7,6 +7,7 @@ #include <memory> #include "base/feature_list.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h"
diff --git a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelper.java b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelper.java index a831712..0fad594 100644 --- a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelper.java +++ b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelper.java
@@ -97,7 +97,7 @@ */ public static boolean hasChosenToSyncPasswordsWithNoCustomPassphrase(SyncService syncService) { return PasswordManagerHelper.hasChosenToSyncPasswords(syncService) - && !syncService.isUsingExplicitPassphrase(); + && syncService.isEngineInitialized() && !syncService.isUsingExplicitPassphrase(); } /** @@ -109,6 +109,7 @@ public static boolean isSyncingPasswordsWithNoCustomPassphrase(SyncService syncService) { if (syncService == null || !syncService.hasSyncConsent()) return false; if (!syncService.getActiveDataTypes().contains(ModelType.PASSWORDS)) return false; + if (!syncService.isEngineInitialized()) return false; if (syncService.isUsingExplicitPassphrase()) return false; return true; }
diff --git a/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelperTest.java b/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelperTest.java index 35b05a1f..67940dc 100644 --- a/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelperTest.java +++ b/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelperTest.java
@@ -131,6 +131,7 @@ when(mSyncServiceMock.isSyncFeatureEnabled()).thenReturn(true); when(mSyncServiceMock.getChosenDataTypes()) .thenReturn(CollectionUtil.newHashSet(ModelType.PASSWORDS)); + when(mSyncServiceMock.isEngineInitialized()).thenReturn(true); when(mSyncServiceMock.isUsingExplicitPassphrase()).thenReturn(true); Assert.assertTrue(PasswordManagerHelper.hasChosenToSyncPasswords(mSyncServiceMock)); Assert.assertFalse(PasswordManagerHelper.hasChosenToSyncPasswordsWithNoCustomPassphrase( @@ -138,10 +139,23 @@ } @Test + public void testSyncEnabledButInitializing() { + when(mSyncServiceMock.isSyncFeatureEnabled()).thenReturn(true); + when(mSyncServiceMock.getChosenDataTypes()) + .thenReturn(CollectionUtil.newHashSet(ModelType.PASSWORDS)); + when(mSyncServiceMock.isEngineInitialized()).thenReturn(false); + Assert.assertTrue(PasswordManagerHelper.hasChosenToSyncPasswords(mSyncServiceMock)); + Assert.assertFalse(PasswordManagerHelper.hasChosenToSyncPasswordsWithNoCustomPassphrase( + mSyncServiceMock)); + verify(mSyncServiceMock, never()).isUsingExplicitPassphrase(); + } + + @Test public void testActivelySyncingPasswordsWithNoCustomPassphrase() { when(mSyncServiceMock.hasSyncConsent()).thenReturn(true); when(mSyncServiceMock.getActiveDataTypes()) .thenReturn(CollectionUtil.newHashSet(ModelType.PASSWORDS)); + when(mSyncServiceMock.isEngineInitialized()).thenReturn(true); when(mSyncServiceMock.isUsingExplicitPassphrase()).thenReturn(false); Assert.assertTrue( PasswordManagerHelper.isSyncingPasswordsWithNoCustomPassphrase(mSyncServiceMock)); @@ -152,6 +166,7 @@ when(mSyncServiceMock.hasSyncConsent()).thenReturn(true); when(mSyncServiceMock.getActiveDataTypes()) .thenReturn(CollectionUtil.newHashSet(ModelType.PASSWORDS)); + when(mSyncServiceMock.isEngineInitialized()).thenReturn(true); when(mSyncServiceMock.isUsingExplicitPassphrase()).thenReturn(true); Assert.assertFalse( PasswordManagerHelper.isSyncingPasswordsWithNoCustomPassphrase(mSyncServiceMock));
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc index abf8fb9..377f8cfd 100644 --- a/chrome/browser/password_manager/chrome_password_manager_client.cc +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
@@ -19,7 +19,6 @@ #include "base/metrics/field_trial.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/stl_util.h" #include "build/branding_buildflags.h" #include "build/build_config.h"
diff --git a/chrome/browser/password_manager/credentials_cleaner_runner_factory.cc b/chrome/browser/password_manager/credentials_cleaner_runner_factory.cc index 40641a9f..1cc860b 100644 --- a/chrome/browser/password_manager/credentials_cleaner_runner_factory.cc +++ b/chrome/browser/password_manager/credentials_cleaner_runner_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/password_manager/credentials_cleaner_runner_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/password_manager/core/browser/credentials_cleaner_runner.h"
diff --git a/chrome/browser/performance_manager/mechanisms/working_set_trimmer_win.h b/chrome/browser/performance_manager/mechanisms/working_set_trimmer_win.h index d3284b7f..bef11049 100644 --- a/chrome/browser/performance_manager/mechanisms/working_set_trimmer_win.h +++ b/chrome/browser/performance_manager/mechanisms/working_set_trimmer_win.h
@@ -7,6 +7,8 @@ #include "chrome/browser/performance_manager/mechanisms/working_set_trimmer.h" +#include "base/no_destructor.h" + namespace performance_manager { namespace mechanism {
diff --git a/chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade_factory.cc b/chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade_factory.cc index c8c7316..7a5bed6e 100644 --- a/chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade_factory.cc +++ b/chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade_factory.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade_factory.h" #include "base/memory/ptr_util.h" +#include "base/no_destructor.h" #include "base/run_loop.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade.h"
diff --git a/chrome/browser/performance_manager/policies/working_set_trimmer_policy_arcvm.cc b/chrome/browser/performance_manager/policies/working_set_trimmer_policy_arcvm.cc index c9600db..092cb82d 100644 --- a/chrome/browser/performance_manager/policies/working_set_trimmer_policy_arcvm.cc +++ b/chrome/browser/performance_manager/policies/working_set_trimmer_policy_arcvm.cc
@@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/memory/singleton.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/arc/session/arc_session_manager.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile_manager.h"
diff --git a/chrome/browser/permissions/chrome_permissions_client.cc b/chrome/browser/permissions/chrome_permissions_client.cc index 61b77b8..f8e17b2f 100644 --- a/chrome/browser/permissions/chrome_permissions_client.cc +++ b/chrome/browser/permissions/chrome_permissions_client.cc
@@ -7,6 +7,7 @@ #include <vector> #include "base/feature_list.h" +#include "base/no_destructor.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/bluetooth/bluetooth_chooser_context_factory.h"
diff --git a/chrome/browser/persisted_state_db/profile_proto_db_factory.h b/chrome/browser/persisted_state_db/profile_proto_db_factory.h index c19f900..2d3726ea 100644 --- a/chrome/browser/persisted_state_db/profile_proto_db_factory.h +++ b/chrome/browser/persisted_state_db/profile_proto_db_factory.h
@@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_PERSISTED_STATE_DB_PROFILE_PROTO_DB_FACTORY_H_ #define CHROME_BROWSER_PERSISTED_STATE_DB_PROFILE_PROTO_DB_FACTORY_H_ +#include "base/no_destructor.h" #include "build/build_config.h" #include "chrome/browser/persisted_state_db/profile_proto_db.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/policy/browser_dm_token_storage_linux.cc b/chrome/browser/policy/browser_dm_token_storage_linux.cc index 47d9dabb..a67b2b3 100644 --- a/chrome/browser/policy/browser_dm_token_storage_linux.cc +++ b/chrome/browser/policy/browser_dm_token_storage_linux.cc
@@ -14,7 +14,6 @@ #include "base/files/important_file_writer.h" #include "base/hash/sha1.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/path_service.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h"
diff --git a/chrome/browser/policy/browser_dm_token_storage_mac.mm b/chrome/browser/policy/browser_dm_token_storage_mac.mm index abf871d7..927cf30 100644 --- a/chrome/browser/policy/browser_dm_token_storage_mac.mm +++ b/chrome/browser/policy/browser_dm_token_storage_mac.mm
@@ -17,7 +17,6 @@ #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_ioobject.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/path_service.h" #include "base/strings/string_util.h"
diff --git a/chrome/browser/policy/browser_dm_token_storage_win.cc b/chrome/browser/policy/browser_dm_token_storage_win.cc index bc379d4f..0aee627 100644 --- a/chrome/browser/policy/browser_dm_token_storage_win.cc +++ b/chrome/browser/policy/browser_dm_token_storage_win.cc
@@ -25,7 +25,6 @@ #include "base/callback.h" #include "base/callback_helpers.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h"
diff --git a/chrome/browser/policy/profile_policy_connector_unittest.cc b/chrome/browser/policy/profile_policy_connector_unittest.cc index 79e5823..a9b27d1 100644 --- a/chrome/browser/policy/profile_policy_connector_unittest.cc +++ b/chrome/browser/policy/profile_policy_connector_unittest.cc
@@ -127,6 +127,7 @@ } void TearDown() override { + task_environment_.RunUntilIdle(); TestingBrowserProcess::GetGlobal()->ShutdownBrowserPolicyConnector(); cloud_policy_manager_->Shutdown(); }
diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java index 0a354a8..5d73372b 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java
@@ -95,27 +95,6 @@ public static final String ATTRIBUTION_PROVIDER_LAST_BROWSER_START = "Chrome.Attribution.LastBrowserStart"; - /** Whether Autofill Assistant is enabled */ - public static final String AUTOFILL_ASSISTANT_ENABLED = "autofill_assistant_switch"; - /** Whether the Autofill Assistant onboarding has been accepted. */ - public static final String AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED = - "AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED"; - /** Whether the user has seen a lite-script before or is a first-time user. */ - public static final String AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER = - "Chrome.AutofillAssistant.LiteScriptFirstTimeUser"; - /** The number of times a user has explicitly canceled a lite script. */ - public static final String AUTOFILL_ASSISTANT_NUMBER_OF_LITE_SCRIPTS_CANCELED = - "Chrome.AutofillAssistant.NumberOfLiteScriptsCanceled"; - /** Whether proactive help is enabled. */ - public static final String AUTOFILL_ASSISTANT_PROACTIVE_HELP = - "Chrome.AutofillAssistant.ProactiveHelp"; - /** - * LEGACY preference indicating whether "do not show again" was checked in the autofill - * assistant onboarding - */ - public static final String AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN = - "AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN"; - public static final String BACKUP_FIRST_BACKUP_DONE = "first_backup_done"; public static final String BOOKMARKS_LAST_MODIFIED_FOLDER_ID = "last_bookmark_folder_id"; @@ -1044,9 +1023,6 @@ ASSISTANT_VOICE_CONSENT_OUTSIDE_TAPS, ASSISTANT_VOICE_SEARCH_ENABLED, ATTRIBUTION_PROVIDER_LAST_BROWSER_START, - AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER, - AUTOFILL_ASSISTANT_NUMBER_OF_LITE_SCRIPTS_CANCELED, - AUTOFILL_ASSISTANT_PROACTIVE_HELP, APP_LAUNCH_LAST_KNOWN_ACTIVE_TAB_STATE, APP_LAUNCH_SEARCH_ENGINE_HAD_LOGO, APPLICATION_OVERRIDE_LANGUAGE,
diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java index 94b02200..ca0d254 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java
@@ -19,7 +19,12 @@ static List<String> getKeysForTesting() { // clang-format off return Arrays.asList( + "AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED", + "AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN", "Chrome.AccountPickerBottomSheet.ShownCount", + "Chrome.AutofillAssistant.LiteScriptFirstTimeUser", + "Chrome.AutofillAssistant.NumberOfLiteScriptsCanceled", + "Chrome.AutofillAssistant.ProactiveHelp", "Chrome.Flags.PaintPreviewTestEnabled", "Chrome.Flags.SafeBool.*", "Chrome.Flags.SafeDouble.*", @@ -53,6 +58,7 @@ "allow_low_end_device_ui", "allow_prefetch", "allow_starting_service_manager_only", + "autofill_assistant_switch", "bookmark_search_history", "bottom_toolbar_enabled", "bottom_toolbar_variation",
diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java index be841e85..ba3a984 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java
@@ -25,9 +25,6 @@ return Arrays.asList( ChromePreferenceKeys.ACCESSIBILITY_TAB_SWITCHER, ChromePreferenceKeys.APP_LOCALE, - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, - ChromePreferenceKeys.AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN, ChromePreferenceKeys.BACKUP_FIRST_BACKUP_DONE, ChromePreferenceKeys.BOOKMARKS_LAST_MODIFIED_FOLDER_ID, ChromePreferenceKeys.BOOKMARKS_LAST_USED_URL,
diff --git a/chrome/browser/prefetch/search_prefetch/search_prefetch_service_factory.cc b/chrome/browser/prefetch/search_prefetch/search_prefetch_service_factory.cc index 5c7c53e1..51cd21037 100644 --- a/chrome/browser/prefetch/search_prefetch/search_prefetch_service_factory.cc +++ b/chrome/browser/prefetch/search_prefetch/search_prefetch_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/prefetch/search_prefetch/search_prefetch_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/prefetch/search_prefetch/field_trial_settings.h" #include "chrome/browser/prefetch/search_prefetch/search_prefetch_service.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 32f9a9b..7cde01a 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -694,6 +694,9 @@ // Deprecated 12/2021. const char kArcAppReinstallState[] = "arc_app_reinstall_state"; + +// Deprecated 12/2021. +const char kOsSyncFeatureEnabled[] = "sync.os_sync_feature_enabled"; #endif // BUILDFLAG(IS_CHROMEOS_ASH) // Register local state used only for migration (clearing or moving to a new @@ -902,6 +905,8 @@ registry->RegisterBooleanPref(kSyncFirstRunCompleted, false); registry->RegisterDictionaryPref(kArcAppReinstallState); + + registry->RegisterBooleanPref(kOsSyncFeatureEnabled, false); #endif // BUILDFLAG(IS_CHROMEOS_ASH) } @@ -1773,6 +1778,8 @@ // Added 12/2021. profile_prefs->ClearPref(kArcAppReinstallState); + + profile_prefs->ClearPref(kOsSyncFeatureEnabled); #endif // BUILDFLAG(IS_CHROMEOS_ASH) // Please don't delete the following line. It is used by PRESUBMIT.py.
diff --git a/chrome/browser/prefs/incognito_mode_prefs.cc b/chrome/browser/prefs/incognito_mode_prefs.cc index 9e58406d..604ac3b 100644 --- a/chrome/browser/prefs/incognito_mode_prefs.cc +++ b/chrome/browser/prefs/incognito_mode_prefs.cc
@@ -82,8 +82,6 @@ IncognitoModePrefs::Availability::kForced; #if BUILDFLAG(IS_CHROMEOS_LACROS) auto* init_params = chromeos::LacrosService::Get()->init_params(); - // TODO(https://crbug.com/1194304): Remove in M93. - should_use_incognito |= init_params->is_incognito_deprecated; should_use_incognito |= init_params->initial_browser_action == crosapi::mojom::InitialBrowserAction::kOpenIncognitoWindow;
diff --git a/chrome/browser/profiles/profile_browsertest.cc b/chrome/browser/profiles/profile_browsertest.cc index dda6f286..e8eb6a08 100644 --- a/chrome/browser/profiles/profile_browsertest.cc +++ b/chrome/browser/profiles/profile_browsertest.cc
@@ -413,7 +413,13 @@ // Test OnProfileCreate is called with is_new_profile set to true when // creating a new profile asynchronously. -IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateNewProfileAsynchronous) { +// TODO(crbug.com/1280223): Flaky on ChromeOS-Ash. +#if BUILDFLAG(IS_CHROMEOS_ASH) +#define MAYBE_CreateNewProfileAsynchronous DISABLED_CreateNewProfileAsynchronous +#else +#define MAYBE_CreateNewProfileAsynchronous CreateNewProfileAsynchronous +#endif +IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, MAYBE_CreateNewProfileAsynchronous) { base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -438,13 +444,7 @@ // Test OnProfileCreate is called with is_new_profile set to false when // creating a profile asynchronously with an existing prefs file. -// TODO(1232030): Flakily crashes on ChromeOS. -#if defined(OS_CHROMEOS) -#define MAYBE_CreateOldProfileAsynchronous DISABLED_CreateOldProfileAsynchronous -#else -#define MAYBE_CreateOldProfileAsynchronous CreateOldProfileAsynchronous -#endif -IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, MAYBE_CreateOldProfileAsynchronous) { +IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateOldProfileAsynchronous) { base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
diff --git a/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc b/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc index 10717e0c..30f6797 100644 --- a/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc +++ b/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "base/no_destructor.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" #include "chrome/app/chrome_command_ids.h"
diff --git a/chrome/browser/resources/chromeos/login/debug/debug.js b/chrome/browser/resources/chromeos/login/debug/debug.js index 62a1e8d..00e91fa5 100644 --- a/chrome/browser/resources/chromeos/login/debug/debug.js +++ b/chrome/browser/resources/chromeos/login/debug/debug.js
@@ -907,7 +907,6 @@ states: [{ id: 'minor-mode', data: { - syncConsentOptionalEnabled: false, isMinorMode: true, }, }]
diff --git a/chrome/browser/resources/chromeos/login/screens/common/guest_tos.html b/chrome/browser/resources/chromeos/login/screens/common/guest_tos.html index ffca09f..4280988 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/guest_tos.html +++ b/chrome/browser/resources/chromeos/login/screens/common/guest_tos.html
@@ -108,7 +108,7 @@ </div> <!-- Usage stats toggle row --> - <div class="layout horizontal center oobe-optin-row"> + <div id="usageStats" class="layout horizontal center oobe-optin-row"> <div class="oobe-optin-content"> <span id="usageTitle" class="oobe-optin-title"> [[i18nDynamic(locale, 'guestTosUsageOptinTitle')]]
diff --git a/chrome/browser/resources/chromeos/login/screens/common/sync_consent.js b/chrome/browser/resources/chromeos/login/screens/common/sync_consent.js index 3149c3b..d99b6a4 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/sync_consent.js +++ b/chrome/browser/resources/chromeos/login/screens/common/sync_consent.js
@@ -51,9 +51,6 @@ */ isChildAccount_: Boolean, - /** @private */ - syncConsentOptionalEnabled_: Boolean, - /** * Indicates whether user is minor mode user (e.g. under age of 18). * @private @@ -77,7 +74,6 @@ this.UI_STEPS = SyncUIState; this.isChildAccount_ = false; - this.syncConsentOptionalEnabled_ = false; this.isMinorMode_ = false; } @@ -96,7 +92,6 @@ */ onBeforeShow(data) { this.setIsChildAccount(data['isChildAccount']); - this.syncConsentOptionalEnabled_ = data['syncConsentOptionalEnabled']; } /** @@ -160,8 +155,7 @@ * @private */ getDefaultUIStep_() { - return this.syncConsentOptionalEnabled_ ? SyncUIState.SPLIT : - SyncUIState.NO_SPLIT; + return SyncUIState.NO_SPLIT; } /** @@ -170,7 +164,6 @@ */ onSettingsSaveAndContinue_(e, opted_in) { assert(e.path); - assert(!this.syncConsentOptionalEnabled_); chrome.send('login.SyncConsentScreen.nonSplitSettingsContinue', [ opted_in, this.$.reviewSettingsBox.checked, this.getConsentDescription_(), this.getConsentConfirmation_(e.path) @@ -191,11 +184,7 @@ * @private */ onAcceptTap_(event) { - assert(this.syncConsentOptionalEnabled_); - assert(event.path); - chrome.send('login.SyncConsentScreen.acceptAndContinue', [ - this.getConsentDescription_(), this.getConsentConfirmation_(event.path) - ]); + // TODO(https://crbug.com/1278325): Remove this. } /** @@ -204,11 +193,7 @@ * @private */ onDeclineTap_(event) { - assert(this.syncConsentOptionalEnabled_); - assert(event.path); - chrome.send('login.SyncConsentScreen.declineAndContinue', [ - this.getConsentDescription_(), this.getConsentConfirmation_(event.path) - ]); + // TODO(https://crbug.com/1278325): Remove this. } /**
diff --git a/chrome/browser/resources/chromeos/sys_internals/BUILD.gn b/chrome/browser/resources/chromeos/sys_internals/BUILD.gn index d708c6e..8c960925 100644 --- a/chrome/browser/resources/chromeos/sys_internals/BUILD.gn +++ b/chrome/browser/resources/chromeos/sys_internals/BUILD.gn
@@ -5,7 +5,6 @@ import("//third_party/closure_compiler/compile_js.gni") js_type_check("closure_compile") { - uses_legacy_modules = true deps = [ ":constants", ":index", @@ -18,14 +17,16 @@ ":constants", ":types", "line_chart:line_chart", - "//ui/webui/resources/js:cr", + "line_chart:unit_label", + "//ui/webui/resources/js:cr.m", + "//ui/webui/resources/js:promise_resolver.m", + "//ui/webui/resources/js:util.m", ] externs_list = [ "externs.js" ] } js_library("constants") { - deps = [ "//ui/webui/resources/js:cr" ] } js_library("types") {
diff --git a/chrome/browser/resources/chromeos/sys_internals/constants.js b/chrome/browser/resources/chromeos/sys_internals/constants.js index 445f659..01af237 100644 --- a/chrome/browser/resources/chromeos/sys_internals/constants.js +++ b/chrome/browser/resources/chromeos/sys_internals/constants.js
@@ -6,56 +6,42 @@ * @fileoverview Constants use by chrome://sys-internals. */ -cr.define('SysInternals', function() { /** * The page update period, in milliseconds. * @type {number} */ - const UPDATE_PERIOD = 1000; +export const UPDATE_PERIOD = 1000; - const /** !Array<string> */ UNITS_NUMBER_PER_SECOND = ['/s', 'K/s', 'M/s']; +export const /** !Array<string> */ UNITS_NUMBER_PER_SECOND = + ['/s', 'K/s', 'M/s']; - /** @const {number} */ - const /** number */ UNITBASE_NUMBER_PER_SECOND = 1000; +/** @export const {number} */ +export const /** number */ UNITBASE_NUMBER_PER_SECOND = 1000; - const /** !Array<string> */ UNITS_MEMORY = - ['B', 'KB', 'MB', 'GB', 'TB', 'PB']; +export const /** !Array<string> */ UNITS_MEMORY = + ['B', 'KB', 'MB', 'GB', 'TB', 'PB']; - const /** number */ UNITBASE_MEMORY = 1024; +export const /** number */ UNITBASE_MEMORY = 1024; - /** @type {number} - The precision of the number on the info page. */ - const INFO_PAGE_PRECISION = 2; +/** @type {number} - The precision of the number on the info page. */ +export const INFO_PAGE_PRECISION = 2; - const /** !Array<string> */ CPU_COLOR_SET = [ - '#2fa2ff', '#ff93e2', '#a170d0', '#fe6c6c', '#2561a4', '#15b979', '#fda941', - '#79dbcd' - ]; +export const /** !Array<string> */ CPU_COLOR_SET = [ + '#2fa2ff', '#ff93e2', '#a170d0', '#fe6c6c', '#2561a4', '#15b979', '#fda941', + '#79dbcd' +]; - const /** !Array<string> */ MEMORY_COLOR_SET = - ['#fa4e30', '#8d6668', '#73418c', '#41205e']; +export const /** !Array<string> */ MEMORY_COLOR_SET = + ['#fa4e30', '#8d6668', '#73418c', '#41205e']; - /** @type {!Array<string>} - Note: 4th and 5th colors use black menu text. */ - const ZRAM_COLOR_SET = - ['#9cabd4', '#4a4392', '#dcfaff', '#fff9c9', '#ffa3ab']; +/** @type {!Array<string>} - Note: 4th and 5th colors use black menu text. */ +export const ZRAM_COLOR_SET = + ['#9cabd4', '#4a4392', '#dcfaff', '#fff9c9', '#ffa3ab']; - /** @enum {string} */ - const PAGE_HASH = { - INFO: '', - CPU: '#CPU', - MEMORY: '#Memory', - ZRAM: '#Zram', - }; - - return { - CPU_COLOR_SET: CPU_COLOR_SET, - INFO_PAGE_PRECISION: INFO_PAGE_PRECISION, - MEMORY_COLOR_SET: MEMORY_COLOR_SET, - PAGE_HASH: PAGE_HASH, - UNITBASE_MEMORY: UNITBASE_MEMORY, - UNITBASE_NUMBER_PER_SECOND: UNITBASE_NUMBER_PER_SECOND, - UNITS_MEMORY: UNITS_MEMORY, - UNITS_NUMBER_PER_SECOND: UNITS_NUMBER_PER_SECOND, - UPDATE_PERIOD: UPDATE_PERIOD, - ZRAM_COLOR_SET: ZRAM_COLOR_SET, - }; -}); +/** @enum {string} */ +export const PAGE_HASH = { + INFO: '', + CPU: '#CPU', + MEMORY: '#Memory', + ZRAM: '#Zram', +};
diff --git a/chrome/browser/resources/chromeos/sys_internals/index.html b/chrome/browser/resources/chromeos/sys_internals/index.html index b9ce771..7968daa 100644 --- a/chrome/browser/resources/chromeos/sys_internals/index.html +++ b/chrome/browser/resources/chromeos/sys_internals/index.html
@@ -12,13 +12,7 @@ maximum-scale=1.0, user-scalable=no"> <title>System Internals</title> <link rel="stylesheet" type="text/css" href="index.css"> - <script src="chrome://resources/js/cr.js"></script> - <script src="chrome://resources/js/assert.js"></script> - <script src="chrome://resources/js/promise_resolver.js"></script> - <script src="chrome://resources/js/util.js"></script> - <script type="text/javascript" src="line_chart.js"></script> - <script type="text/javascript" src="constants.js"></script> - <script type="text/javascript" src="index.js"></script> + <script type="module" src="main.js"></script> </head> <body> <div id="sys-internals-drawer" class="hidden" hidden>
diff --git a/chrome/browser/resources/chromeos/sys_internals/index.js b/chrome/browser/resources/chromeos/sys_internals/index.js index b900e993..58b1dc51 100644 --- a/chrome/browser/resources/chromeos/sys_internals/index.js +++ b/chrome/browser/resources/chromeos/sys_internals/index.js
@@ -2,575 +2,561 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -cr.define('SysInternals', function() { - /** @type {!DataSeriesSet} */ - const dataSeries = initDataSeries(); +import {sendWithPromise} from 'chrome://resources/js/cr.m.js'; +import {PromiseResolver} from 'chrome://resources/js/promise_resolver.m.js'; +import {$} from 'chrome://resources/js/util.m.js'; - /** @type {!GeneralInfoType} */ - const generalInfo = initGeneralInfo(); +import {CPU_COLOR_SET, INFO_PAGE_PRECISION, MEMORY_COLOR_SET, PAGE_HASH, UNITBASE_MEMORY, UNITBASE_NUMBER_PER_SECOND, UNITS_MEMORY, UNITS_NUMBER_PER_SECOND, UPDATE_PERIOD, ZRAM_COLOR_SET} from './constants.js'; +import {UnitLabelAlign} from './line_chart/constants.js'; +import {DataSeries} from './line_chart/data_series.js'; +import {LineChart} from './line_chart/line_chart.js'; +import {UnitLabel} from './line_chart/unit_label.js'; +import {CounterType, DataSeriesSet, GeneralCpuType, GeneralInfoType, GeneralMemoryType, GeneralZramType, MemoryDataSeriesSet, ZramDataSeriesSet} from './types.js'; - /** @type{!Object<string, PromiseResolver>} */ - const promiseResolvers = { - waitCpuInitialized: new PromiseResolver(), +/** @type {!DataSeriesSet} */ +const dataSeries = initDataSeries(); - /* For testing */ - waitDrawerActionCompleted: null, - waitOnHashChangeCompleted: null, - waitSysInternalsInitialized: new PromiseResolver(), +/** @type {!GeneralInfoType} */ +const generalInfo = initGeneralInfo(); + +/** @type{!Object<string, PromiseResolver>} */ +export const promiseResolvers = { + waitCpuInitialized: new PromiseResolver(), + + /* For testing */ + waitDrawerActionCompleted: null, + waitOnHashChangeCompleted: null, + waitSysInternalsInitialized: new PromiseResolver(), +}; + +/** @type {!LineChart} */ +export const lineChart = new LineChart(); + +/** + * The maximum value of the counter of the system info data. + * @type {number} + */ +let counterMax = 0; + +/** @const{Map<string, !CounterType>} */ +const counterDict = new Map(); + +/** + * Initialize the whole page. + */ +export function initialize() { + initPage(); + initChart(); + startUpdateRequests(); + + /* Initialize with the current url hash value. */ + onHashChange(); + promiseResolvers.waitSysInternalsInitialized.resolve(); +} + +/** + * Initialize the DOM of the page. + */ +function initPage() { + $('nav-menu-btn').addEventListener('click', function(event) { + event.preventDefault(); + openDrawer(); + }); + + $('sys-internals-drawer').addEventListener('click', function(event) { + closeDrawer(); + }); + + window.addEventListener('hashchange', onHashChange); +} + +/** + * Open the navbar drawer menu. + */ +export function openDrawer() { + $('sys-internals-drawer').removeAttribute('hidden'); + /* Preventing CSS transition blocking by JS. */ + setTimeout(function() { + $('sys-internals-drawer').classList.remove('hidden'); + $('drawer-menu').classList.remove('hidden'); + if (promiseResolvers.waitDrawerActionCompleted) { + promiseResolvers.waitDrawerActionCompleted.resolve(); + } + }); +} + +/** + * Close the navbar drawer menu. + */ +export function closeDrawer() { + const /** Element */ drawer = $('sys-internals-drawer'); + drawer.classList.add('hidden'); + $('drawer-menu').classList.add('hidden'); + /* Wait for the drawer close. */ + setTimeout(function() { + drawer.setAttribute('hidden', ''); + if (promiseResolvers.waitDrawerActionCompleted) { + promiseResolvers.waitDrawerActionCompleted.resolve(); + } + }, 200); +} + +/** + * Initialize the data series of the page. + * @return {!DataSeriesSet} + */ +function initDataSeries() { + const /** DataSeriesSet */ dataSeriesRes = { + cpus: null, + memory: { + memUsed: new DataSeries('Used Memory', MEMORY_COLOR_SET[0]), + swapUsed: new DataSeries('Used Swap', MEMORY_COLOR_SET[1]), + pswpin: new DataSeries('Pswpin', MEMORY_COLOR_SET[2]), + pswpout: new DataSeries('Pswpout', MEMORY_COLOR_SET[3]), + }, + zram: { + origDataSize: new DataSeries('Original Data Size', ZRAM_COLOR_SET[0]), + comprDataSize: new DataSeries('Compress Data Size', ZRAM_COLOR_SET[1]), + memUsedTotal: new DataSeries('Total Memory', ZRAM_COLOR_SET[2]), + numReads: new DataSeries('Num Reads', ZRAM_COLOR_SET[3]), + numWrites: new DataSeries('Num Writes', ZRAM_COLOR_SET[4]), + }, }; + dataSeriesRes.zram.memUsedTotal.setMenuTextBlack(true); + dataSeriesRes.zram.numReads.setMenuTextBlack(true); + return dataSeriesRes; +} - /** @type {!LineChart.LineChart} */ - const lineChart = new LineChart.LineChart(); +/** + * Initialize generalInfo. + * @return {!GeneralInfoType} + */ +function initGeneralInfo() { + return { + cpu: { + core: 0, + idle: 0, + kernel: 0, + usage: 0, + user: 0, + }, + memory: { + swapTotal: 0, + swapUsed: 0, + total: 0, + used: 0, + }, + zram: { + compr: 0, + comprRatio: NaN, + orig: 0, + total: 0, + }, + }; +} + +/** + * Initialize the LineChart object. + */ +function initChart() { + lineChart.attachRootDiv($('chart-root')); +} + +/** + * Wait until next period, and then send the update request to backend to + * update the system information. + */ +function startUpdateRequests() { + if (window.DONT_SEND_UPDATE_REQUEST) + return; + + const doUpdate = function() { + sendWithPromise('getSysInfo').then(function(data) { + handleUpdateData(data, Date.now()); + }); + }; + doUpdate(); + setInterval(doUpdate, UPDATE_PERIOD); +} + +/** + * Handle the new data which received from backend. + * @param {!SysInfoApiResult} data + * @param {number} timestamp - The time tick for these data. + */ +export function handleUpdateData(data, timestamp) { + counterMax = data.const.counterMax; + + updateCpuData(data.cpus, timestamp); + updateMemoryData(data.memory, timestamp); + updateZramData(data.zram, timestamp); + + if (isInfoPage()) { + updateInfoPage(); + } else { + lineChart.updateEndTime(timestamp); + } +} + +/** + * Handle the new cpu data. + * @param {!Array<!SysInfoApiCpuResult>} cpus + * @param {number} timestamp + */ +function updateCpuData(cpus, timestamp) { + if (dataSeries.cpus == null) { + initCpuDataSeries(cpus); + } + const /** Array<!DataSeries> */ cpuDataSeries = dataSeries.cpus; + if (cpus.length != cpuDataSeries.length) { + console.warn('Cpu Data: Number of processors changed.'); + return; + } + let allKernel = 0; + let allUser = 0; + let allIdle = 0; + for (let i = 0; i < cpus.length; ++i) { + /* Check if this cpu is offline */ + if (cpus[i].total == 0) { + cpuDataSeries[i].addDataPoint(0, timestamp); + continue; + } + const /** number */ user = + getDiffAndUpdateCounter(`cpu_${i}_user`, cpus[i].user, timestamp); + const /** number */ kernel = + getDiffAndUpdateCounter(`cpu_${i}_kernel`, cpus[i].kernel, timestamp); + const /** number */ idle = + getDiffAndUpdateCounter(`cpu_${i}_idle`, cpus[i].idle, timestamp); + const /** number */ total = + getDiffAndUpdateCounter(`cpu_${i}_total`, cpus[i].total, timestamp); + /* Total may be zero at first update. */ + const /** number */ percentage = + total == 0 ? 0 : (user + kernel) / total * 100; + cpuDataSeries[i].addDataPoint(percentage, timestamp); + allKernel += kernel; + allUser += user; + allIdle += idle; + } + + const /** !GeneralCpuType */ generalCpu = generalInfo.cpu; + generalCpu.core = cpus.length; + const allTotal = allKernel + allUser + allIdle; + generalCpu.usage = allTotal == 0 ? 0 : (allKernel + allUser) / allTotal; + generalCpu.kernel = allTotal == 0 ? 0 : allKernel / allTotal; + generalCpu.user = allTotal == 0 ? 0 : allUser / allTotal; + generalCpu.idle = allTotal == 0 ? 0 : allIdle / allTotal; +} + +/** + * Initialize the data series of the page. This function will be called for + * the first time we get the cpus data. + * @param {!Array<!SysInfoApiCpuResult>} cpus + */ +function initCpuDataSeries(cpus) { + if (cpus.length == 0) + return; + dataSeries.cpus = []; + for (let i = 0; i < cpus.length; ++i) { + const colorIdx = i % CPU_COLOR_SET.length; + dataSeries.cpus[i] = new DataSeries(`CPU ${i}`, CPU_COLOR_SET[colorIdx]); + } + promiseResolvers.waitCpuInitialized.resolve(); +} + +/** + * Handle the new memory data. + * @param {!SysInfoApiMemoryResult} memory + * @param {number} timestamp + */ +function updateMemoryData(memory, timestamp) { + const /** !MemoryDataSeriesSet */ memDataSeries = dataSeries.memory; + const /** number */ memUsed = memory.total - memory.available; + memDataSeries.memUsed.addDataPoint(memUsed, timestamp); + const /** number */ swapUsed = memory.swapTotal - memory.swapFree; + memDataSeries.swapUsed.addDataPoint(swapUsed, timestamp); + const /** number */ pswpin = + getDiffPerSecAndUpdateCounter('pswpin', memory.pswpin, timestamp); + memDataSeries.pswpin.addDataPoint(pswpin, timestamp); + const /** number */ pswpout = + getDiffPerSecAndUpdateCounter('pswpout', memory.pswpout, timestamp); + memDataSeries.pswpout.addDataPoint(pswpout, timestamp); + + const /** !GeneralMemoryType */ generalMem = generalInfo.memory; + generalMem.total = memory.total; + generalMem.used = memUsed; + generalMem.swapTotal = memory.swapTotal; + generalMem.swapUsed = swapUsed; +} + +/** + * Handle the new zram data. + * @param {!SysInfoApiZramResult} zram + * @param {number} timestamp + */ +function updateZramData(zram, timestamp) { + const /** !ZramDataSeriesSet */ zramDataSeries = dataSeries.zram; + zramDataSeries.origDataSize.addDataPoint(zram.origDataSize, timestamp); + zramDataSeries.comprDataSize.addDataPoint(zram.comprDataSize, timestamp); + zramDataSeries.memUsedTotal.addDataPoint(zram.memUsedTotal, timestamp); + const /** number */ numReads = + getDiffPerSecAndUpdateCounter('numReads', zram.numReads, timestamp); + zramDataSeries.numReads.addDataPoint(numReads, timestamp); + const /** number */ numWrites = + getDiffPerSecAndUpdateCounter('numWrites', zram.numWrites, timestamp); + zramDataSeries.numWrites.addDataPoint(numWrites, timestamp); + + const /** !GeneralZramType */ generalZram = generalInfo.zram; + generalZram.total = zram.memUsedTotal; + generalZram.orig = zram.origDataSize; + generalZram.compr = zram.comprDataSize; + /* Note: |comprRatio| may be NaN, this is ok because it can remind user + * there is no comprRatio now. */ + generalZram.comprRatio = + (zram.origDataSize - zram.comprDataSize) / zram.origDataSize; +} + +/** + * Get the increments from the last value to the current value. Return the + * increments, and store the current value. + * @param {string} name - The key to identify the counter. + * @param {number} newValue + * @param {number} timestamp + * @return {number} + */ +export function getDiffAndUpdateCounter(name, newValue, timestamp) { + if (counterDict.get(name) == undefined) { + counterDict.set(name, {value: newValue, timestamp: timestamp}); + return 0; + } + const /** !CounterType */ counter = counterDict.get(name); + let /** number */ valueDelta = newValue - counter.value; + + /* If the increments of the counter is negative, it means that the counter + * is circulating. Get the real increments with the |counterMax|. The result + * is guaranteed to be greater than zero because the maximum difference of + * two counter never greater than |counterMax|. */ + if (valueDelta < 0) { + valueDelta += counterMax; + } + counter.value = newValue; + counter.timestamp = timestamp; + return valueDelta; +} + +/** + * Return the average increments per second, and store the current value. + * @param {string} name - The key to identify the counter. + * @param {number} newValue + * @param {number} timestamp + * @return {number} + */ +export function getDiffPerSecAndUpdateCounter(name, newValue, timestamp) { + const /** number */ oldTimeStamp = + counterDict.get(name) ? counterDict.get(name).timestamp : -1; + const /** number */ valueDelta = + getDiffAndUpdateCounter(name, newValue, timestamp); + + /* If oldTimeStamp is -1, it means that this is the first value of the + * counter. */ + if (oldTimeStamp == -1) + return 0; /** - * The maximum value of the counter of the system info data. + * The time increments, in seconds. * @type {number} */ - let counterMax = 0; + const timeDelta = (timestamp - oldTimeStamp) / 1000; + const /** number */ deltaPerSec = + (timeDelta == 0) ? 0 : valueDelta / timeDelta; + return deltaPerSec; +} - /** @const{Map<string, !CounterType>} */ - const counterDict = new Map(); - - /** - * Initialize the whole page. - */ - function initialize() { - initPage(); - initChart(); - startUpdateRequests(); - - /* Initialize with the current url hash value. */ - onHashChange(); - promiseResolvers.waitSysInternalsInitialized.resolve(); - } - - /** - * Initialize the DOM of the page. - */ - function initPage() { - $('nav-menu-btn').addEventListener('click', function(event) { - event.preventDefault(); - openDrawer(); - }); - - $('sys-internals-drawer').addEventListener('click', function(event) { - closeDrawer(); - }); - - window.addEventListener('hashchange', onHashChange); - } - - /** - * Open the navbar drawer menu. - */ - function openDrawer() { - $('sys-internals-drawer').removeAttribute('hidden'); - /* Preventing CSS transition blocking by JS. */ - setTimeout(function() { - $('sys-internals-drawer').classList.remove('hidden'); - $('drawer-menu').classList.remove('hidden'); - if (promiseResolvers.waitDrawerActionCompleted) { - promiseResolvers.waitDrawerActionCompleted.resolve(); - } - }); - } - - /** - * Close the navbar drawer menu. - */ - function closeDrawer() { - const /** Element */ drawer = $('sys-internals-drawer'); - drawer.classList.add('hidden'); - $('drawer-menu').classList.add('hidden'); - /* Wait for the drawer close. */ - setTimeout(function() { - drawer.setAttribute('hidden', ''); - if (promiseResolvers.waitDrawerActionCompleted) { - promiseResolvers.waitDrawerActionCompleted.resolve(); - } - }, 200); - } - - /** - * Initialize the data series of the page. - * @return {!DataSeriesSet} - */ - function initDataSeries() { - const /** DataSeriesSet */ dataSeriesRes = { - cpus: null, - memory: { - memUsed: new LineChart.DataSeries( - 'Used Memory', SysInternals.MEMORY_COLOR_SET[0]), - swapUsed: new LineChart.DataSeries( - 'Used Swap', SysInternals.MEMORY_COLOR_SET[1]), - pswpin: new LineChart.DataSeries( - 'Pswpin', SysInternals.MEMORY_COLOR_SET[2]), - pswpout: new LineChart.DataSeries( - 'Pswpout', SysInternals.MEMORY_COLOR_SET[3]), - }, - zram: { - origDataSize: new LineChart.DataSeries( - 'Original Data Size', SysInternals.ZRAM_COLOR_SET[0]), - comprDataSize: new LineChart.DataSeries( - 'Compress Data Size', SysInternals.ZRAM_COLOR_SET[1]), - memUsedTotal: new LineChart.DataSeries( - 'Total Memory', SysInternals.ZRAM_COLOR_SET[2]), - numReads: new LineChart.DataSeries( - 'Num Reads', SysInternals.ZRAM_COLOR_SET[3]), - numWrites: new LineChart.DataSeries( - 'Num Writes', SysInternals.ZRAM_COLOR_SET[4]), - }, - }; - dataSeriesRes.zram.memUsedTotal.setMenuTextBlack(true); - dataSeriesRes.zram.numReads.setMenuTextBlack(true); - return dataSeriesRes; - } - - /** - * Initialize generalInfo. - * @return {!GeneralInfoType} - */ - function initGeneralInfo() { - return { - cpu: { - core: 0, - idle: 0, - kernel: 0, - usage: 0, - user: 0, - }, - memory: { - swapTotal: 0, - swapUsed: 0, - total: 0, - used: 0, - }, - zram: { - compr: 0, - comprRatio: NaN, - orig: 0, - total: 0, - }, - }; - } - - /** - * Initialize the LineChart object. - */ - function initChart() { - lineChart.attachRootDiv($('chart-root')); - } - - /** - * Wait until next period, and then send the update request to backend to - * update the system information. - */ - function startUpdateRequests() { - if (DONT_SEND_UPDATE_REQUEST) - return; - - const doUpdate = function() { - cr.sendWithPromise('getSysInfo').then(function(data) { - handleUpdateData(data, Date.now()); - }); - }; - doUpdate(); - setInterval(doUpdate, SysInternals.UPDATE_PERIOD); - } - - /** - * Handle the new data which received from backend. - * @param {!SysInfoApiResult} data - * @param {number} timestamp - The time tick for these data. - */ - function handleUpdateData(data, timestamp) { - counterMax = data.const.counterMax; - - updateCpuData(data.cpus, timestamp); - updateMemoryData(data.memory, timestamp); - updateZramData(data.zram, timestamp); - - if (isInfoPage()) { - updateInfoPage(); - } else { - lineChart.updateEndTime(timestamp); - } - } - - /** - * Handle the new cpu data. - * @param {!Array<!SysInfoApiCpuResult>} cpus - * @param {number} timestamp - */ - function updateCpuData(cpus, timestamp) { - if (dataSeries.cpus == null) { - initCpuDataSeries(cpus); - } - const /** Array<!LineChart.DataSeries> */ cpuDataSeries = dataSeries.cpus; - if (cpus.length != cpuDataSeries.length) { - console.warn('Cpu Data: Number of processors changed.'); - return; - } - let allKernel = 0; - let allUser = 0; - let allIdle = 0; - for (let i = 0; i < cpus.length; ++i) { - /* Check if this cpu is offline */ - if (cpus[i].total == 0) { - cpuDataSeries[i].addDataPoint(0, timestamp); - continue; - } - const /** number */ user = - getDiffAndUpdateCounter(`cpu_${i}_user`, cpus[i].user, timestamp); - const /** number */ kernel = - getDiffAndUpdateCounter(`cpu_${i}_kernel`, cpus[i].kernel, timestamp); - const /** number */ idle = - getDiffAndUpdateCounter(`cpu_${i}_idle`, cpus[i].idle, timestamp); - const /** number */ total = - getDiffAndUpdateCounter(`cpu_${i}_total`, cpus[i].total, timestamp); - /* Total may be zero at first update. */ - const /** number */ percentage = - total == 0 ? 0 : (user + kernel) / total * 100; - cpuDataSeries[i].addDataPoint(percentage, timestamp); - allKernel += kernel; - allUser += user; - allIdle += idle; - } - - const /** !GeneralCpuType */ generalCpu = generalInfo.cpu; - generalCpu.core = cpus.length; - const allTotal = allKernel + allUser + allIdle; - generalCpu.usage = allTotal == 0 ? 0 : (allKernel + allUser) / allTotal; - generalCpu.kernel = allTotal == 0 ? 0 : allKernel / allTotal; - generalCpu.user = allTotal == 0 ? 0 : allUser / allTotal; - generalCpu.idle = allTotal == 0 ? 0 : allIdle / allTotal; - } - - /** - * Initialize the data series of the page. This function will be called for - * the first time we get the cpus data. - * @param {!Array<!SysInfoApiCpuResult>} cpus - */ - function initCpuDataSeries(cpus) { - if (cpus.length == 0) - return; - dataSeries.cpus = []; - for (let i = 0; i < cpus.length; ++i) { - const colorIdx = i % SysInternals.CPU_COLOR_SET.length; - dataSeries.cpus[i] = new LineChart.DataSeries( - `CPU ${i}`, SysInternals.CPU_COLOR_SET[colorIdx]); - } - promiseResolvers.waitCpuInitialized.resolve(); - } - - /** - * Handle the new memory data. - * @param {!SysInfoApiMemoryResult} memory - * @param {number} timestamp - */ - function updateMemoryData(memory, timestamp) { - const /** !MemoryDataSeriesSet */ memDataSeries = dataSeries.memory; - const /** number */ memUsed = memory.total - memory.available; - memDataSeries.memUsed.addDataPoint(memUsed, timestamp); - const /** number */ swapUsed = memory.swapTotal - memory.swapFree; - memDataSeries.swapUsed.addDataPoint(swapUsed, timestamp); - const /** number */ pswpin = - getDiffPerSecAndUpdateCounter('pswpin', memory.pswpin, timestamp); - memDataSeries.pswpin.addDataPoint(pswpin, timestamp); - const /** number */ pswpout = - getDiffPerSecAndUpdateCounter('pswpout', memory.pswpout, timestamp); - memDataSeries.pswpout.addDataPoint(pswpout, timestamp); - - const /** !GeneralMemoryType */ generalMem = generalInfo.memory; - generalMem.total = memory.total; - generalMem.used = memUsed; - generalMem.swapTotal = memory.swapTotal; - generalMem.swapUsed = swapUsed; - } - - /** - * Handle the new zram data. - * @param {!SysInfoApiZramResult} zram - * @param {number} timestamp - */ - function updateZramData(zram, timestamp) { - const /** !ZramDataSeriesSet */ zramDataSeries = dataSeries.zram; - zramDataSeries.origDataSize.addDataPoint(zram.origDataSize, timestamp); - zramDataSeries.comprDataSize.addDataPoint(zram.comprDataSize, timestamp); - zramDataSeries.memUsedTotal.addDataPoint(zram.memUsedTotal, timestamp); - const /** number */ numReads = - getDiffPerSecAndUpdateCounter('numReads', zram.numReads, timestamp); - zramDataSeries.numReads.addDataPoint(numReads, timestamp); - const /** number */ numWrites = - getDiffPerSecAndUpdateCounter('numWrites', zram.numWrites, timestamp); - zramDataSeries.numWrites.addDataPoint(numWrites, timestamp); - - const /** !GeneralZramType */ generalZram = generalInfo.zram; - generalZram.total = zram.memUsedTotal; - generalZram.orig = zram.origDataSize; - generalZram.compr = zram.comprDataSize; - /* Note: |comprRatio| may be NaN, this is ok because it can remind user - * there is no comprRatio now. */ - generalZram.comprRatio = - (zram.origDataSize - zram.comprDataSize) / zram.origDataSize; - } - - /** - * Get the increments from the last value to the current value. Return the - * increments, and store the current value. - * @param {string} name - The key to identify the counter. - * @param {number} newValue - * @param {number} timestamp - * @return {number} - */ - function getDiffAndUpdateCounter(name, newValue, timestamp) { - if (counterDict.get(name) == undefined) { - counterDict.set(name, {value: newValue, timestamp: timestamp}); - return 0; - } - const /** !CounterType */ counter = counterDict.get(name); - let /** number */ valueDelta = newValue - counter.value; - - /* If the increments of the counter is negative, it means that the counter - * is circulating. Get the real increments with the |counterMax|. The result - * is guaranteed to be greater than zero because the maximum difference of - * two counter never greater than |counterMax|. */ - if (valueDelta < 0) { - valueDelta += counterMax; - } - counter.value = newValue; - counter.timestamp = timestamp; - return valueDelta; - } - - /** - * Return the average increments per second, and store the current value. - * @param {string} name - The key to identify the counter. - * @param {number} newValue - * @param {number} timestamp - * @return {number} - */ - function getDiffPerSecAndUpdateCounter(name, newValue, timestamp) { - const /** number */ oldTimeStamp = - counterDict.get(name) ? counterDict.get(name).timestamp : -1; - const /** number */ valueDelta = - getDiffAndUpdateCounter(name, newValue, timestamp); - - /* If oldTimeStamp is -1, it means that this is the first value of the - * counter. */ - if (oldTimeStamp == -1) - return 0; - - /** - * The time increments, in seconds. - * @type {number} - */ - const timeDelta = (timestamp - oldTimeStamp) / 1000; - const /** number */ deltaPerSec = - (timeDelta == 0) ? 0 : valueDelta / timeDelta; - return deltaPerSec; - } - - /** - * Updata the info page with the current data. - */ - function updateInfoPage() { - const setPercentageById = function(/** string */ id, /** number */ value) { - setTextById( - id, toPercentageString(value, SysInternals.INFO_PAGE_PRECISION)); - }; - const setMemoryById = function(/** string */ id, /** number */ value) { - setTextById( - id, - getValueWithUnit( - value, SysInternals.UNITS_MEMORY, SysInternals.UNITBASE_MEMORY)); - }; - - const /** !GeneralCpuType */ cpu = generalInfo.cpu; - setTextById('infopage-num-of-cpu', cpu.core.toString()); - setPercentageById('infopage-cpu-usage', cpu.usage); - setPercentageById('infopage-cpu-kernel', cpu.kernel); - setPercentageById('infopage-cpu-user', cpu.user); - setPercentageById('infopage-cpu-idle', cpu.idle); - - const /** !GeneralMemoryType */ memory = generalInfo.memory; - setMemoryById('infopage-memory-total', memory.total); - setMemoryById('infopage-memory-used', memory.used); - setMemoryById('infopage-memory-swap-total', memory.swapTotal); - setMemoryById('infopage-memory-swap-used', memory.swapUsed); - - const /** !GeneralZramType */ zram = generalInfo.zram; - setMemoryById('infopage-zram-total', zram.total); - setMemoryById('infopage-zram-orig', zram.orig); - setMemoryById('infopage-zram-compr', zram.compr); - setPercentageById('infopage-zram-compr-ratio', zram.comprRatio); - } - - /** - * Set the element inner text by the element id. - * @param {string} id - * @param {string} text - */ - function setTextById(id, text) { - $(id).innerText = text; - } - - /** - * Transform the number to percentage string. - * @param {number} number - * @param {number} fixed - The percision of the number. - * @return {string} - */ - function toPercentageString(number, fixed) { - const fixedNumber = (number * 100).toFixed(fixed); - return fixedNumber + '%'; - } - - /** - * Return the value with a suitable unit. See - * |LineChart.getSuitableUint()|. - * @param {number} value - * @param {!Array<string>} units - * @param {number} unitBase - * @return {string} - */ - function getValueWithUnit(value, units, unitBase) { - const result = LineChart.getSuitableUnit(value, units, unitBase); - const suitableValue = - result.value.toFixed(SysInternals.INFO_PAGE_PRECISION); - const unitStr = units[result.unitIdx]; - return `${suitableValue} ${unitStr}`; - } - - /** - * Handle the url onhashchange event. - */ - function onHashChange() { - const /** string */ hash = location.hash; - switch (hash) { - case SysInternals.PAGE_HASH.INFO: - setupInfoPage(); - break; - case SysInternals.PAGE_HASH.CPU: - /* Wait for cpu dataseries initialized. */ - promiseResolvers.waitCpuInitialized.promise.then(setupCPUPage); - break; - case SysInternals.PAGE_HASH.MEMORY: - setupMemoryPage(); - break; - case SysInternals.PAGE_HASH.ZRAM: - setupZramPage(); - break; - } - const /** Element */ title = $('drawer-title'); - const /** Element */ infoPage = $('infopage-root'); - if (isInfoPage()) { - title.innerText = 'Info'; - infoPage.removeAttribute('hidden'); - } else { - title.innerText = hash.slice(1); - infoPage.setAttribute('hidden', ''); - } - - if (promiseResolvers.waitOnHashChangeCompleted) { - promiseResolvers.waitOnHashChangeCompleted.resolve(); - } - } - - /** - * Return true if the current page is info page. - * @return {boolean} - */ - function isInfoPage() { - return location.hash == ''; - } - - /** - * Set the current page to info page. - */ - function setupInfoPage() { - lineChart.clearAllSubChart(); - updateInfoPage(); - } - - const /** number */ LEFT = LineChart.UnitLabelAlign.LEFT; - const /** number */ RIGHT = LineChart.UnitLabelAlign.RIGHT; - - /** - * Set the current page to cpu page. - */ - function setupCPUPage() { - /* This function is async so we need to check the page is still CPU page. */ - if (location.hash != SysInternals.PAGE_HASH.CPU) - return; - - const /** Array<!LineChart.DataSeries> */ cpuDataSeries = dataSeries.cpus; - const /** number */ UNITBASE_NO_CARRY = 1; - const /** !Array<string> */ UNIT_PURE_NUMBER = ['']; - lineChart.setSubChart(LEFT, UNIT_PURE_NUMBER, UNITBASE_NO_CARRY); - const /** !Array<string> */ UNIT_PERCENTAGE = ['%']; - lineChart.setSubChart(RIGHT, UNIT_PERCENTAGE, UNITBASE_NO_CARRY); - lineChart.setSubChartMaxValue(RIGHT, 100); - for (let i = 0; i < cpuDataSeries.length; ++i) { - lineChart.addDataSeries(RIGHT, cpuDataSeries[i]); - } - } - - /** - * Set the current page to memory page. - */ - function setupMemoryPage() { - const /** !MemoryDataSeriesSet */ memDataSeries = dataSeries.memory; - lineChart.setSubChart( - LEFT, SysInternals.UNITS_NUMBER_PER_SECOND, - SysInternals.UNITBASE_NUMBER_PER_SECOND); - lineChart.setSubChart( - RIGHT, SysInternals.UNITS_MEMORY, SysInternals.UNITBASE_MEMORY); - lineChart.addDataSeries(RIGHT, memDataSeries.memUsed); - lineChart.addDataSeries(RIGHT, memDataSeries.swapUsed); - lineChart.addDataSeries(LEFT, memDataSeries.pswpin); - lineChart.addDataSeries(LEFT, memDataSeries.pswpout); - } - - /** - * Set the current page to zram page. - */ - function setupZramPage() { - const /** !ZramDataSeriesSet */ zramDataSeries = dataSeries.zram; - lineChart.setSubChart( - LEFT, SysInternals.UNITS_NUMBER_PER_SECOND, - SysInternals.UNITBASE_NUMBER_PER_SECOND); - lineChart.setSubChart( - RIGHT, SysInternals.UNITS_MEMORY, SysInternals.UNITBASE_MEMORY); - lineChart.addDataSeries(RIGHT, zramDataSeries.origDataSize); - lineChart.addDataSeries(RIGHT, zramDataSeries.comprDataSize); - lineChart.addDataSeries(RIGHT, zramDataSeries.memUsedTotal); - lineChart.addDataSeries(LEFT, zramDataSeries.numReads); - lineChart.addDataSeries(LEFT, zramDataSeries.numWrites); - } - - /* Exposed for testing. */ - return { - closeDrawer: closeDrawer, - dataSeries: dataSeries, - getDiffAndUpdateCounter: getDiffAndUpdateCounter, - getDiffPerSecAndUpdateCounter: getDiffPerSecAndUpdateCounter, - getValueWithUnit: getValueWithUnit, - handleUpdateData: handleUpdateData, - initialize: initialize, - isInfoPage: isInfoPage, - lineChart: lineChart, - openDrawer: openDrawer, - promiseResolvers: promiseResolvers, - toPercentageString: toPercentageString, - updateInfoPage: updateInfoPage, +/** + * Updata the info page with the current data. + */ +export function updateInfoPage() { + const setPercentageById = function(/** string */ id, /** number */ value) { + setTextById(id, toPercentageString(value, INFO_PAGE_PRECISION)); + }; + const setMemoryById = function(/** string */ id, /** number */ value) { + setTextById(id, getValueWithUnit(value, UNITS_MEMORY, UNITBASE_MEMORY)); }; -}); // cr.define + const /** !GeneralCpuType */ cpu = generalInfo.cpu; + setTextById('infopage-num-of-cpu', cpu.core.toString()); + setPercentageById('infopage-cpu-usage', cpu.usage); + setPercentageById('infopage-cpu-kernel', cpu.kernel); + setPercentageById('infopage-cpu-user', cpu.user); + setPercentageById('infopage-cpu-idle', cpu.idle); + + const /** !GeneralMemoryType */ memory = generalInfo.memory; + setMemoryById('infopage-memory-total', memory.total); + setMemoryById('infopage-memory-used', memory.used); + setMemoryById('infopage-memory-swap-total', memory.swapTotal); + setMemoryById('infopage-memory-swap-used', memory.swapUsed); + + const /** !GeneralZramType */ zram = generalInfo.zram; + setMemoryById('infopage-zram-total', zram.total); + setMemoryById('infopage-zram-orig', zram.orig); + setMemoryById('infopage-zram-compr', zram.compr); + setPercentageById('infopage-zram-compr-ratio', zram.comprRatio); +} + +/** + * Set the element inner text by the element id. + * @param {string} id + * @param {string} text + */ +function setTextById(id, text) { + $(id).innerText = text; +} + +/** + * Transform the number to percentage string. + * @param {number} number + * @param {number} fixed - The precision of the number. + * @return {string} + */ +export function toPercentageString(number, fixed) { + const fixedNumber = (number * 100).toFixed(fixed); + return fixedNumber + '%'; +} + +/** + * Return the value with a suitable unit. See + * |getSuitableUint()|. + * @param {number} value + * @param {!Array<string>} units + * @param {number} unitBase + * @return {string} + */ +export function getValueWithUnit(value, units, unitBase) { + const result = UnitLabel.getSuitableUnit(value, units, unitBase); + const suitableValue = result.value.toFixed(INFO_PAGE_PRECISION); + const unitStr = units[result.unitIdx]; + return `${suitableValue} ${unitStr}`; +} + +/** + * Handle the url onhashchange event. + */ +function onHashChange() { + const /** string */ hash = location.hash; + switch (hash) { + case PAGE_HASH.INFO: + setupInfoPage(); + break; + case PAGE_HASH.CPU: + /* Wait for cpu dataseries initialized. */ + promiseResolvers.waitCpuInitialized.promise.then(setupCPUPage); + break; + case PAGE_HASH.MEMORY: + setupMemoryPage(); + break; + case PAGE_HASH.ZRAM: + setupZramPage(); + break; + } + const /** Element */ title = $('drawer-title'); + const /** Element */ infoPage = $('infopage-root'); + if (isInfoPage()) { + title.innerText = 'Info'; + infoPage.removeAttribute('hidden'); + } else { + title.innerText = hash.slice(1); + infoPage.setAttribute('hidden', ''); + } + + if (promiseResolvers.waitOnHashChangeCompleted) { + promiseResolvers.waitOnHashChangeCompleted.resolve(); + } +} + +/** + * Return true if the current page is info page. + * @return {boolean} + */ +export function isInfoPage() { + return location.hash == ''; +} + +/** + * Set the current page to info page. + */ +function setupInfoPage() { + lineChart.clearAllSubChart(); + updateInfoPage(); +} + +const /** number */ LEFT = UnitLabelAlign.LEFT; +const /** number */ RIGHT = UnitLabelAlign.RIGHT; + +/** + * Set the current page to cpu page. + */ +function setupCPUPage() { + /* This function is async so we need to check the page is still CPU page. */ + if (location.hash != PAGE_HASH.CPU) + return; + + const /** Array<!DataSeries> */ cpuDataSeries = dataSeries.cpus; + const /** number */ UNITBASE_NO_CARRY = 1; + const /** !Array<string> */ UNIT_PURE_NUMBER = ['']; + lineChart.setSubChart(LEFT, UNIT_PURE_NUMBER, UNITBASE_NO_CARRY); + const /** !Array<string> */ UNIT_PERCENTAGE = ['%']; + lineChart.setSubChart(RIGHT, UNIT_PERCENTAGE, UNITBASE_NO_CARRY); + lineChart.setSubChartMaxValue(RIGHT, 100); + for (let i = 0; i < cpuDataSeries.length; ++i) { + lineChart.addDataSeries(RIGHT, cpuDataSeries[i]); + } +} + +/** + * Set the current page to memory page. + */ +function setupMemoryPage() { + const /** !MemoryDataSeriesSet */ memDataSeries = dataSeries.memory; + lineChart.setSubChart( + LEFT, UNITS_NUMBER_PER_SECOND, UNITBASE_NUMBER_PER_SECOND); + lineChart.setSubChart(RIGHT, UNITS_MEMORY, UNITBASE_MEMORY); + lineChart.addDataSeries(RIGHT, memDataSeries.memUsed); + lineChart.addDataSeries(RIGHT, memDataSeries.swapUsed); + lineChart.addDataSeries(LEFT, memDataSeries.pswpin); + lineChart.addDataSeries(LEFT, memDataSeries.pswpout); +} + +/** + * Set the current page to zram page. + */ +function setupZramPage() { + const /** !ZramDataSeriesSet */ zramDataSeries = dataSeries.zram; + lineChart.setSubChart( + LEFT, UNITS_NUMBER_PER_SECOND, UNITBASE_NUMBER_PER_SECOND); + lineChart.setSubChart(RIGHT, UNITS_MEMORY, UNITBASE_MEMORY); + lineChart.addDataSeries(RIGHT, zramDataSeries.origDataSize); + lineChart.addDataSeries(RIGHT, zramDataSeries.comprDataSize); + lineChart.addDataSeries(RIGHT, zramDataSeries.memUsedTotal); + lineChart.addDataSeries(LEFT, zramDataSeries.numReads); + lineChart.addDataSeries(LEFT, zramDataSeries.numWrites); +} + +/* Exposed for testing. */ +/*return { + closeDrawer: closeDrawer, + dataSeries: dataSeries, + getDiffAndUpdateCounter: getDiffAndUpdateCounter, + getDiffPerSecAndUpdateCounter: getDiffPerSecAndUpdateCounter, + getValueWithUnit: getValueWithUnit, + handleUpdateData: handleUpdateData, + initialize: initialize, + isInfoPage: isInfoPage, + lineChart: lineChart, + openDrawer: openDrawer, + promiseResolvers: promiseResolvers, + toPercentageString: toPercentageString, + updateInfoPage: updateInfoPage, +};*/ + /** @type {boolean} - Tag used by browser test. */ -var DONT_SEND_UPDATE_REQUEST; - -document.addEventListener('DOMContentLoaded', function() { - SysInternals.initialize(); -}); +window.DONT_SEND_UPDATE_REQUEST;
diff --git a/chrome/browser/resources/chromeos/sys_internals/line_chart/BUILD.gn b/chrome/browser/resources/chromeos/sys_internals/line_chart/BUILD.gn index a43a8342..eee5edd7 100644 --- a/chrome/browser/resources/chromeos/sys_internals/line_chart/BUILD.gn +++ b/chrome/browser/resources/chromeos/sys_internals/line_chart/BUILD.gn
@@ -23,7 +23,8 @@ ":menu", ":scrollbar", ":sub_chart", - "//ui/webui/resources/js:util", + ":unit_label", + "//ui/webui/resources/js:util.m", ] } @@ -36,10 +37,7 @@ } js_library("scrollbar") { - deps = [ - ":constants", - "//ui/webui/resources/js:util", - ] + deps = [ "//ui/webui/resources/js:util.m" ] } js_library("unit_label") { @@ -50,7 +48,7 @@ deps = [ ":constants", ":data_series", - "//ui/webui/resources/js:util", + "//ui/webui/resources/js:util.m", ] }
diff --git a/chrome/browser/resources/chromeos/sys_internals/line_chart/constants.js b/chrome/browser/resources/chromeos/sys_internals/line_chart/constants.js index 1fe1b53..968f4fd 100644 --- a/chrome/browser/resources/chromeos/sys_internals/line_chart/constants.js +++ b/chrome/browser/resources/chromeos/sys_internals/line_chart/constants.js
@@ -3,96 +3,94 @@ // found in the LICENSE file. -/** @const */ var LineChart = {}; - /** * The left, right and top margin of the line chart, in pixels. * @const {number} */ -LineChart.CHART_MARGIN = 10; +export const CHART_MARGIN = 10; /** * The default scale of the line chart. The scale means how many milliseconds * per pixel. * @const {number} */ -LineChart.DEFAULT_SCALE = 100; +export const DEFAULT_SCALE = 100; /** * The minimun scale of the line chart. * @const {number} */ -LineChart.MIN_SCALE = 10; +export const MIN_SCALE = 10; /** * The maximum scale of the line chart. * @const {number} */ -LineChart.MAX_SCALE = 1000 * 60 * 3; +export const MAX_SCALE = 1000 * 60 * 3; /** * The maximum number of the left and right unit label, in pixels. * @const {number} */ -LineChart.MAX_VERTICAL_LABEL_NUM = 6; +export const MAX_VERTICAL_LABEL_NUM = 6; /** * The minimum vertical spacing between two text label of the left and right * unit labels, in pixels. * @const {number} */ -LineChart.MIN_LABEL_VERTICAL_SPACING = 4; +export const MIN_LABEL_VERTICAL_SPACING = 4; /** * The minimum horizontal spacing from the line chart to the left and right unit * labels, in pixels. * @const {number} */ -LineChart.MIN_LABEL_HORIZONTAL_SPACING = 3; +export const MIN_LABEL_HORIZONTAL_SPACING = 3; /** * The minimum horizontal spacing between two time tick labels, in pixels. * @const {number} */ -LineChart.MIN_TIME_LABEL_HORIZONTAL_SPACING = 25; +export const MIN_TIME_LABEL_HORIZONTAL_SPACING = 25; /** * The tick length of the unit tick, in pixels. * @const {number} */ -LineChart.Y_AXIS_TICK_LENGTH = 20; +export const Y_AXIS_TICK_LENGTH = 20; /** * How far does the mouse wheeling to be counted as 1 unit. * @const {number} */ -LineChart.MOUSE_WHEEL_UNITS = 120; +export const MOUSE_WHEEL_UNITS = 120; /** * How far does the finger zooming to be counted as 1 unit, in pixels. * @const {number} */ -LineChart.TOUCH_ZOOM_UNITS = 60; +export const TOUCH_ZOOM_UNITS = 60; /** * The zooming rate of the line chart. * @const {number} */ -LineChart.ZOOM_RATE = 1.25; +export const ZOOM_RATE = 1.25; /** * The mouse whell scrolling rate (For horizontal scroll), in pixels. * @const {number} */ -LineChart.MOUSE_WHEEL_SCROLL_RATE = 120; +export const MOUSE_WHEEL_SCROLL_RATE = 120; /** * The drag rate, how many pixels will we move when user drag 1 pixel. Drag rate * is for both mouse dragging or touch dragging. * @const {number} */ -LineChart.DRAG_RATE = 3; +export const DRAG_RATE = 3; /** * The set of time step, in milliseconds. Line chart will choose a suitable one @@ -100,7 +98,7 @@ * up a unit from the list. * @const {Array<number>} */ -LineChart.TIME_STEP_UNITS = [ +export const TIME_STEP_UNITS = [ 1000, // 1 second 1000 * 5, 1000 * 30, @@ -117,40 +115,40 @@ * only draw data points at the position which are exact multiple of this value. * @const {number} */ -LineChart.SAMPLE_RATE = 15; +export const SAMPLE_RATE = 15; /** * The text color of the line chart. * @const {string} */ -LineChart.TEXT_COLOR = '#000'; +export const TEXT_COLOR = '#000'; /** * The grid color of the line chart. * @const {string} */ -LineChart.GRID_COLOR = '#888'; +export const GRID_COLOR = '#888'; /** * The background color of the line chart. * @const {string} */ -LineChart.BACKGROUND_COLOR = '#e3e3e3'; +export const BACKGROUND_COLOR = '#e3e3e3'; /** * The color of the menu button. * @const {string} */ -LineChart.MENU_TEXT_COLOR_LIGHT = '#e9e9e9'; +export const MENU_TEXT_COLOR_LIGHT = '#e9e9e9'; /** @const{string} */ -LineChart.MENU_TEXT_COLOR_DARK = '#333'; +export const MENU_TEXT_COLOR_DARK = '#333'; /** * The enum of the align of label. * @enum {number} */ -LineChart.UnitLabelAlign = { +export const UnitLabelAlign = { LEFT: 0, RIGHT: 1 };
diff --git a/chrome/browser/resources/chromeos/sys_internals/line_chart/data_series.js b/chrome/browser/resources/chromeos/sys_internals/line_chart/data_series.js index 169d6cf..71e038a0 100644 --- a/chrome/browser/resources/chromeos/sys_internals/line_chart/data_series.js +++ b/chrome/browser/resources/chromeos/sys_internals/line_chart/data_series.js
@@ -2,14 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -(function() { -'use strict'; +import {SAMPLE_RATE} from './constants.js'; /** * Collect the data points to show on the line chart. * @const */ -LineChart.DataSeries = class { +export class DataSeries { constructor(/** string */ title, /** string */ color) { /** @const {string} - The name of this data series. */ this.title_ = title; @@ -154,7 +153,7 @@ const /** Array<null|number> */ values = []; values.length = count; - const /** number */ sampleRate = LineChart.SAMPLE_RATE; + const /** number */ sampleRate = SAMPLE_RATE; let /** number */ endTime = startTime; const /** number */ firstIndex = this.findLowerBoundPointIndex_(startTime); let /** number */ nextIndex = firstIndex; @@ -294,6 +293,4 @@ const /** number */ ratio = (x - x1) / (x2 - x1); return (y2 - y1) * ratio + y1; } -}; - -})(); +}
diff --git a/chrome/browser/resources/chromeos/sys_internals/line_chart/index.js b/chrome/browser/resources/chromeos/sys_internals/line_chart/index.js deleted file mode 100644 index 02a8d80..0000000 --- a/chrome/browser/resources/chromeos/sys_internals/line_chart/index.js +++ /dev/null
@@ -1,11 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// <include src="constants.js"> -// <include src="data_series.js"> -// <include src="unit_label.js"> -// <include src="line_chart.js"> -// <include src="menu.js"> -// <include src="scrollbar.js"> -// <include src="sub_chart.js">
diff --git a/chrome/browser/resources/chromeos/sys_internals/line_chart/line_chart.js b/chrome/browser/resources/chromeos/sys_internals/line_chart/line_chart.js index ed0e15b..1c89dde6 100644 --- a/chrome/browser/resources/chromeos/sys_internals/line_chart/line_chart.js +++ b/chrome/browser/resources/chromeos/sys_internals/line_chart/line_chart.js
@@ -2,8 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -(function() { -'use strict'; +import {createElementWithClassName} from 'chrome://resources/js/util.m.js'; + +import {BACKGROUND_COLOR, CHART_MARGIN, DEFAULT_SCALE, DRAG_RATE, GRID_COLOR, MAX_SCALE, MIN_LABEL_VERTICAL_SPACING, MIN_SCALE, MIN_TIME_LABEL_HORIZONTAL_SPACING, MOUSE_WHEEL_SCROLL_RATE, MOUSE_WHEEL_UNITS, SAMPLE_RATE, TEXT_COLOR, TIME_STEP_UNITS, TOUCH_ZOOM_UNITS, ZOOM_RATE} from './constants.js'; +import {DataSeries} from './data_series.js'; +import {Menu} from './menu.js'; +import {Scrollbar} from './scrollbar.js'; +import {SubChart} from './sub_chart.js'; +import {UnitLabel} from './unit_label.js'; /** * Create a canvas line chart. The object will enroll the events of the line @@ -11,7 +17,7 @@ * and control other object. See README for usage. * @const */ -LineChart.LineChart = class { +export class LineChart { constructor() { /** @type {Element} */ this.rootDiv_ = null; @@ -31,13 +37,13 @@ * The scale of the line chart. Milliseconds per pixel. * @type {number} */ - this.scale_ = LineChart.DEFAULT_SCALE; + this.scale_ = DEFAULT_SCALE; /** * |subChart| is the chart that all data series in it shares the same unit * label. There are two |SubChart| in |LineChart|, one's label align left, - * another's align right. See |LineChart.SubChart|. - * @type {Array<LineChart.SubChart>} + * another's align right. See |SubChart|. + * @type {Array<SubChart>} */ this.subCharts_ = [null, null]; @@ -65,10 +71,10 @@ this.touchZoomBase_ = 0; /** - * The menu to control the visibility of data series. See |LineChart.Menu|. - * @const {LineChart.Menu} + * The menu to control the visibility of data series. See |Menu|. + * @const {Menu} */ - this.menu_ = new LineChart.Menu(this.onMenuUpdate_.bind(this)); + this.menu_ = new Menu(this.onMenuUpdate_.bind(this)); /** @const {Element} */ this.canvas_ = createElementWithClassName('canvas', 'line-chart-canvas'); @@ -79,13 +85,13 @@ /** * A dummy scrollbar to scroll the line chart and to show the current * visible position of the line chair. - * @const {LineChart.Scrollbar} + * @const {Scrollbar} */ - this.scrollbar_ = new LineChart.Scrollbar(this.update.bind(this)); + this.scrollbar_ = new Scrollbar(this.update.bind(this)); } /** - * Attach the root div of LineChart. + * Attach the root div of * @param {Element} rootDiv */ attachRootDiv(rootDiv) { @@ -140,7 +146,7 @@ enrollNonPassiveEvent( this.canvas_, 'touchcancel', this.onTouchCancel_.bind(this)); - const /** string */ pxString = `${LineChart.CHART_MARGIN}px`; + const /** string */ pxString = `${CHART_MARGIN}px`; const /** string */ marginString = `${pxString} ${pxString} 0 ${pxString}`; this.canvas_.style.margin = marginString; } @@ -158,10 +164,10 @@ console.warn( 'WheelEvent.deltaMode is not set to WheelEvent.DOM_DELTA_PIXEL.'); } - const wheelX = event.deltaX / LineChart.MOUSE_WHEEL_UNITS; - const wheelY = -event.deltaY / LineChart.MOUSE_WHEEL_UNITS; - this.scroll(LineChart.MOUSE_WHEEL_SCROLL_RATE * wheelX); - this.zoom(Math.pow(LineChart.ZOOM_RATE, -wheelY)); + const wheelX = event.deltaX / MOUSE_WHEEL_UNITS; + const wheelY = -event.deltaY / MOUSE_WHEEL_UNITS; + this.scroll(MOUSE_WHEEL_SCROLL_RATE * wheelX); + this.zoom(Math.pow(ZOOM_RATE, -wheelY)); } /** @@ -182,7 +188,7 @@ if (!this.isDragging_) return; const /** number */ dragDeltaX = event.clientX - this.dragX_; - this.scroll(LineChart.DRAG_RATE * dragDeltaX); + this.scroll(DRAG_RATE * dragDeltaX); this.dragX_ = event.clientX; } @@ -232,14 +238,14 @@ const /** TouchList */ touches = event.targetTouches; if (touches.length == 1) { const /** number */ dragDeltaX = this.touchX_ - touches[0].clientX; - this.scroll(LineChart.DRAG_RATE * dragDeltaX); + this.scroll(DRAG_RATE * dragDeltaX); this.touchX_ = touches[0].clientX; } else if (touches.length == 2) { const /** number */ newDistance = this.constructor.touchDistance_(touches[0], touches[1]); const /** number */ zoomDelta = - (this.touchZoomBase_ - newDistance) / LineChart.TOUCH_ZOOM_UNITS; - this.zoom(Math.pow(LineChart.ZOOM_RATE, zoomDelta)); + (this.touchZoomBase_ - newDistance) / TOUCH_ZOOM_UNITS; + this.zoom(Math.pow(ZOOM_RATE, zoomDelta)); this.touchZoomBase_ = newDistance; } } @@ -267,8 +273,7 @@ zoom(rate) { const /** number */ oldScale = this.scale_; const /** number */ newScale = this.scale_ * rate; - this.scale_ = - Math.max(LineChart.MIN_SCALE, Math.min(newScale, LineChart.MAX_SCALE)); + this.scale_ = Math.max(MIN_SCALE, Math.min(newScale, MAX_SCALE)); if (this.scale_ == oldScale) return; @@ -318,7 +323,7 @@ } /** - * Handle |LineChart.Menu| update event. + * Handle |Menu| update event. */ onMenuUpdate_() { this.resize_(); @@ -333,7 +338,7 @@ this.canvas_.width = width; this.canvas_.height = height; - const /** number */ scrollBarWidth = width + 2 * LineChart.CHART_MARGIN; + const /** number */ scrollBarWidth = width + 2 * CHART_MARGIN; this.scrollbar_.resize(scrollBarWidth); this.updateScrollBar_(); } @@ -373,7 +378,7 @@ const /** number */ timeRange = this.endTime_ - this.startTime_; const /** number */ numOfPixels = Math.floor(timeRange / this.scale_); - const /** number */ sampleRate = LineChart.SAMPLE_RATE; + const /** number */ sampleRate = SAMPLE_RATE; /* To reduce CPU usage, the chart do not draw points at every pixels. * Remove the last few pixels to avoid the graph showing some blank at * the end of the graph. */ @@ -387,8 +392,7 @@ * @return {number} */ getChartVisibleWidth() { - return this.rootDiv_.offsetWidth - LineChart.CHART_MARGIN * 2 - - this.menu_.getWidth(); + return this.rootDiv_.offsetWidth - CHART_MARGIN * 2 - this.menu_.getWidth(); } /** @@ -396,21 +400,20 @@ * @return {number} */ getChartVisibleHeight() { - return this.rootDiv_.offsetHeight - LineChart.CHART_MARGIN - + return this.rootDiv_.offsetHeight - CHART_MARGIN - this.scrollbar_.getHeight(); } /** * Set or reset the |units| and the |unitBase| of the |SubChart|. * @param {number} align - The align side of the subchart. - * @param {Array<string>} units - See |LineChart.UnitLabel|. - * @param {number} unitBase - See |LineChart.UnitLabel|. + * @param {Array<string>} units - See |UnitLabel|. + * @param {number} unitBase - See |UnitLabel|. */ setSubChart(align, units, unitBase) { this.clearSubChart(align); - const /** LineChart.UnitLabel */ label = - new LineChart.UnitLabel(units, unitBase); - this.subCharts_[align] = new LineChart.SubChart(label, align); + const /** UnitLabel */ label = new UnitLabel(units, unitBase); + this.subCharts_[align] = new SubChart(label, align); this.update(); } @@ -440,9 +443,9 @@ * @param {number} align - The align side of the subchart. */ clearSubChart(align) { - const /** LineChart.SubChart */ oldSubChart = this.subCharts_[align]; + const /** SubChart */ oldSubChart = this.subCharts_[align]; if (oldSubChart) { - const /** Array<LineChart.DataSeries> */ dataSeriesList = + const /** Array<DataSeries> */ dataSeriesList = oldSubChart.getDataSeriesList(); for (let /** number */ i = 0; i < dataSeriesList.length; ++i) { this.menu_.removeDataSeries(dataSeriesList[i]); @@ -456,10 +459,10 @@ * Add a data series to a subchart of the line chart. Call |setSubChart| * before calling this function. * @param {number} align - The align side of the subchart. - * @param {LineChart.DataSeries} dataSeries + * @param {DataSeries} dataSeries */ addDataSeries(align, dataSeries) { - const /** Array<LineChart.SubChart> */ subCharts = this.subCharts_; + const /** Array<SubChart> */ subCharts = this.subCharts_; if (subCharts[align] == null) { console.warn( 'This sub chart has not been setup yet. ' + @@ -524,7 +527,7 @@ const /** number */ visibleStartTime = this.startTime_ + position * this.scale_; const /** number */ graphHeight = - height - fontHeight - LineChart.MIN_LABEL_VERTICAL_SPACING; + height - fontHeight - MIN_LABEL_VERTICAL_SPACING; this.renderTimeLabels_( context, width, graphHeight, fontHeight, visibleStartTime); this.renderSubCharts_( @@ -542,7 +545,7 @@ context.lineWidth = 2; context.lineCap = 'round'; context.lineJoin = 'round'; - context.fillStyle = LineChart.BACKGROUND_COLOR; + context.fillStyle = BACKGROUND_COLOR; context.fillRect(0, 0, width, height); } @@ -557,7 +560,7 @@ renderTimeLabels_(context, width, height, fontHeight, startTime) { const /** string */ sampleText = (new Date(startTime)).toLocaleTimeString(); const /** number */ minSpacing = context.measureText(sampleText).width + - LineChart.MIN_TIME_LABEL_HORIZONTAL_SPACING; + MIN_TIME_LABEL_HORIZONTAL_SPACING; const /** number */ timeStep = this.constructor.getSuitableTimeStep_(minSpacing, this.scale_); if (timeStep == 0) { @@ -567,11 +570,11 @@ context.textBaseline = 'bottom'; context.textAlign = 'center'; - context.fillStyle = LineChart.TEXT_COLOR; - context.strokeStyle = LineChart.GRID_COLOR; + context.fillStyle = TEXT_COLOR; + context.strokeStyle = GRID_COLOR; context.beginPath(); const /** number */ yCoord = - height + fontHeight + LineChart.MIN_LABEL_VERTICAL_SPACING; + height + fontHeight + MIN_LABEL_VERTICAL_SPACING; const /** number */ firstTimeTick = Math.ceil(startTime / timeStep) * timeStep; let /** number */ time = firstTimeTick; @@ -595,7 +598,7 @@ * @return {number} */ static getSuitableTimeStep_(minSpacing, scale) { - const /** Array<number> */ timeStepUnits = LineChart.TIME_STEP_UNITS; + const /** Array<number> */ timeStepUnits = TIME_STEP_UNITS; let /** number */ timeStep = 0; for (let /** number */ i = 0; i < timeStepUnits.length; ++i) { if (timeStepUnits[i] / scale >= minSpacing) { @@ -612,7 +615,7 @@ * @param {number} graphHeight */ renderChartGrid_(context, graphWidth, graphHeight) { - context.strokeStyle = LineChart.GRID_COLOR; + context.strokeStyle = GRID_COLOR; context.strokeRect(0, 0, graphWidth - 1, graphHeight); } @@ -628,11 +631,11 @@ renderSubCharts_( context, graphWidth, graphHeight, fontHeight, visibleStartTime, position) { - const /** Array<LineChart.SubChart> */ subCharts = this.subCharts_; + const /** Array<SubChart> */ subCharts = this.subCharts_; /* To reduce CPU usage, the chart do not draw points at every pixels. Use * |offset| to make sure the graph won't shaking during scrolling, the line * chart will render the data points at the same absolute position. */ - const /** number */ offset = position % LineChart.SAMPLE_RATE; + const /** number */ offset = position % SAMPLE_RATE; for (let /** number */ i = 0; i < subCharts.length; ++i) { if (subCharts[i] == undefined) continue; @@ -643,6 +646,4 @@ subCharts[i].renderUnitLabels(context); } } -}; - -})(); +}
diff --git a/chrome/browser/resources/chromeos/sys_internals/line_chart/menu.js b/chrome/browser/resources/chromeos/sys_internals/line_chart/menu.js index 5eb0dd15c2..2af3869 100644 --- a/chrome/browser/resources/chromeos/sys_internals/line_chart/menu.js +++ b/chrome/browser/resources/chromeos/sys_internals/line_chart/menu.js
@@ -2,16 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -(function() { -'use strict'; +import {createElementWithClassName} from 'chrome://resources/js/util.m.js'; + +import {MENU_TEXT_COLOR_DARK, MENU_TEXT_COLOR_LIGHT} from './constants.js'; +import {DataSeries} from './data_series.js'; /** - * Create by |LineChart.LineChart|. + * Create by |LineChart|. * A menu to show and to control the visibility of the data series in current * line chart. * @const */ -LineChart.Menu = class { +export class Menu { constructor(/** function(): undefined */ callback) { /** * Handle the menu status changed event, include clicking button, hiding or @@ -34,7 +36,7 @@ this.rootDiv_.appendChild(this.handleDiv_); this.handleDiv_.addEventListener('click', this.handleOnClick_.bind(this)); - /** @type {Array<LineChart.DataSeries>} */ + /** @type {Array<DataSeries>} */ this.dataSeries_ = []; /** @type {Array<Element>} - Buttons of data series. */ @@ -43,7 +45,7 @@ /** * Handle menu showing and hiding. - * @this {LineChart.Menu} + * @this {Menu} */ handleOnClick_() { const /** string|null */ hiddenAttr = @@ -68,7 +70,7 @@ /** * Add a data series to the menu. - * @param {LineChart.DataSeries} dataSeries + * @param {DataSeries} dataSeries */ addDataSeries(dataSeries) { const /** number */ idx = this.dataSeries_.indexOf(dataSeries); @@ -85,7 +87,7 @@ /** * Create a button to control the data series. - * @param {LineChart.DataSeries} dataSeries + * @param {DataSeries} dataSeries * @return {Element} */ createButton_(dataSeries) { @@ -105,7 +107,7 @@ /** * Add a onclick handler to the button. * @param {Element} button - * @param {LineChart.DataSeries} dataSeries + * @param {DataSeries} dataSeries */ setupButtonOnClickHandler_(button, dataSeries) { const /** function(Event): undefined */ handler = function(event) { @@ -120,25 +122,25 @@ /** * Update the button style with the visibility of data series. * @param {Element} button - * @param {LineChart.DataSeries} dataSeries + * @param {DataSeries} dataSeries * @param {boolean} visible */ updateButtonStyle_(button, dataSeries, visible) { if (visible) { button.style.backgroundColor = dataSeries.getColor(); const /** string */ color = dataSeries.isMenuTextBlack() ? - LineChart.MENU_TEXT_COLOR_DARK : - LineChart.MENU_TEXT_COLOR_LIGHT; + MENU_TEXT_COLOR_DARK : + MENU_TEXT_COLOR_LIGHT; button.style.color = color; } else { - button.style.backgroundColor = LineChart.MENU_TEXT_COLOR_LIGHT; - button.style.color = LineChart.MENU_TEXT_COLOR_DARK; + button.style.backgroundColor = MENU_TEXT_COLOR_LIGHT; + button.style.color = MENU_TEXT_COLOR_DARK; } } /** * Remove a data series from the menu. - * @param {LineChart.DataSeries} dataSeries + * @param {DataSeries} dataSeries */ removeDataSeries(dataSeries) { const /** number */ idx = this.dataSeries_.indexOf(dataSeries); @@ -150,6 +152,4 @@ /* Width may change. */ this.callback_(); } -}; - -})(); +}
diff --git a/chrome/browser/resources/chromeos/sys_internals/line_chart/scrollbar.js b/chrome/browser/resources/chromeos/sys_internals/line_chart/scrollbar.js index 531d92dd..bccb30a 100644 --- a/chrome/browser/resources/chromeos/sys_internals/line_chart/scrollbar.js +++ b/chrome/browser/resources/chromeos/sys_internals/line_chart/scrollbar.js
@@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - -(function() { -'use strict'; +import {createElementWithClassName} from 'chrome://resources/js/util.m.js'; /** * Create by |LineChart.LineChart|. @@ -13,7 +11,7 @@ * instead of drawing the whole chart. * @const */ -LineChart.Scrollbar = class { +export class Scrollbar { constructor(/** function(): undefined */ callback) { /** @const {function(): undefined} - Handle the scrolling event. */ this.callback_ = callback; @@ -161,6 +159,4 @@ scrollToRightEdge() { this.setPosition(this.range_); } -}; - -})(); +}
diff --git a/chrome/browser/resources/chromeos/sys_internals/line_chart/sub_chart.js b/chrome/browser/resources/chromeos/sys_internals/line_chart/sub_chart.js index 90517bc5c..c530017 100644 --- a/chrome/browser/resources/chromeos/sys_internals/line_chart/sub_chart.js +++ b/chrome/browser/resources/chromeos/sys_internals/line_chart/sub_chart.js
@@ -2,25 +2,26 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -(function() { -'use strict'; +import {GRID_COLOR, MIN_LABEL_HORIZONTAL_SPACING, SAMPLE_RATE, TEXT_COLOR, UnitLabelAlign, Y_AXIS_TICK_LENGTH} from './constants.js'; +import {DataSeries} from './data_series.js'; +import {UnitLabel} from './unit_label.js'; /** - * Create by |LineChart.LineChart|. - * Maintains data series which share the same |LineChart.UnitLable|, that is, + * Create by |LineChart|. + * Maintains data series which share the same |UnitLabel|, that is, * share the same unit set. Also, this object is responsible for drawing the * line and the unit label on the line chart. * @const */ -LineChart.SubChart = class { - constructor(/** LineChart.UnitLabel */ label, /** number */ labelAlign) { - /** @const {LineChart.UnitLabel} */ +export class SubChart { + constructor(/** UnitLabel */ label, /** number */ labelAlign) { + /** @const {UnitLabel} */ this.label_ = label; /** @const {number} */ this.labelAlign_ = labelAlign; - /** @type {Array<LineChart.DataSeries>} */ + /** @type {Array<DataSeries>} */ this.dataSeriesList_ = []; /** @@ -39,8 +40,8 @@ /** * The offset of the current visible range. To make sure we draw the data - * points at the same absolute postition. See also - * |LineChart.renderSubCharts_()|. + * points at the same absolute position. See also + * |renderSubCharts_()|. * @type {number} */ this.offset_ = 0; @@ -73,13 +74,13 @@ * @param {number} fontHeight * @param {number} visibleStartTime * @param {number} scale - * @param {number} offset - See |LineChart.LineChart.renderSubChart_()|. + * @param {number} offset - See |renderSubChart_()|. */ setLayout(width, height, fontHeight, visibleStartTime, scale, offset) { this.width_ = width; this.height_ = height; this.offset_ = offset; - const /** number */ sampleRate = LineChart.SAMPLE_RATE; + const /** number */ sampleRate = SAMPLE_RATE; /* Draw a data point on every |sampleRate| pixels. */ this.stepSize_ = scale * sampleRate; @@ -112,8 +113,7 @@ * Calculate the max value for the current layout. */ updateMaxValue_() { - const /** Array<LineChart.DataSeries> */ dataSeriesList = - this.dataSeriesList_; + const /** Array<DataSeries> */ dataSeriesList = this.dataSeriesList_; if (this.maxValue_ != null) { this.label_.setMaxValue(this.maxValue_); return; @@ -128,7 +128,7 @@ /** * Query the max value of the query range from the data series. - * @param {LineChart.DataSeries} dataSeries + * @param {DataSeries} dataSeries * @return {number} */ getMaxValueFromDataSeries_(dataSeries) { @@ -140,7 +140,7 @@ /** * Add a data series to this sub chart. - * @param {LineChart.DataSeries} dataSeries + * @param {DataSeries} dataSeries */ addDataSeries(dataSeries) { this.dataSeriesList_.push(dataSeries); @@ -148,7 +148,7 @@ /** * Get all data series of this sub chart. - * @return {Array<LineChart.DataSeries>} + * @return {Array<DataSeries>} */ getDataSeriesList() { return this.dataSeriesList_; @@ -159,8 +159,7 @@ * @param {CanvasRenderingContext2D} context */ renderLines(context) { - const /** Array<LineChart.DataSeries> */ dataSeriesList = - this.dataSeriesList_; + const /** Array<DataSeries> */ dataSeriesList = this.dataSeriesList_; for (let /** number */ i = 0; i < dataSeriesList.length; ++i) { const /** Array<number> */ values = this.getValuesFromDataSeries_(dataSeriesList[i]); @@ -172,7 +171,7 @@ /** * Query the the data points' values from the data series. - * @param {LineChart.DataSeries} dataSeries + * @param {DataSeries} dataSeries * @return {Array<number>} */ getValuesFromDataSeries_(dataSeries) { @@ -184,7 +183,7 @@ /** * @param {CanvasRenderingContext2D} context - * @param {LineChart.DataSeries} dataSeries + * @param {DataSeries} dataSeries * @param {Array<number>} values */ renderLineOfDataSeries_(context, dataSeries, values) { @@ -192,7 +191,7 @@ context.fillStyle = dataSeries.getColor(); context.beginPath(); - const /** number */ sampleRate = LineChart.SAMPLE_RATE; + const /** number */ sampleRate = SAMPLE_RATE; const /** number */ valueScale = this.label_.getScale(); let /** number */ firstXCoord = this.width_; let /** number */ xCoord = -this.offset_; @@ -234,16 +233,16 @@ let /** number */ tickStartX; let /** number */ tickEndX; let /** number */ textXCoord; - if (this.labelAlign_ == LineChart.UnitLabelAlign.LEFT) { + if (this.labelAlign_ == UnitLabelAlign.LEFT) { context.textAlign = 'left'; tickStartX = 0; - tickEndX = LineChart.Y_AXIS_TICK_LENGTH; - textXCoord = LineChart.MIN_LABEL_HORIZONTAL_SPACING; - } else if (this.labelAlign_ == LineChart.UnitLabelAlign.RIGHT) { + tickEndX = Y_AXIS_TICK_LENGTH; + textXCoord = MIN_LABEL_HORIZONTAL_SPACING; + } else if (this.labelAlign_ == UnitLabelAlign.RIGHT) { context.textAlign = 'right'; tickStartX = this.width_ - 1; - tickEndX = this.width_ - 1 - LineChart.Y_AXIS_TICK_LENGTH; - textXCoord = this.width_ - LineChart.MIN_LABEL_HORIZONTAL_SPACING; + tickEndX = this.width_ - 1 - Y_AXIS_TICK_LENGTH; + textXCoord = this.width_ - MIN_LABEL_HORIZONTAL_SPACING; } else { console.warn('Unknown label align.'); return; @@ -263,7 +262,7 @@ * @param {number} tickEndX */ renderLabelTicks_(context, labelTexts, labelYStep, tickStartX, tickEndX) { - context.strokeStyle = LineChart.GRID_COLOR; + context.strokeStyle = GRID_COLOR; context.beginPath(); /* First and last tick are the top and the bottom of the line chart, so * don't draw them again. */ @@ -285,7 +284,7 @@ renderLabelTexts_(context, labelTexts, labelYStep, textXCoord) { /* The first label cannot align the bottom of the tick or it will go outside * the canvas. */ - context.fillStyle = LineChart.TEXT_COLOR; + context.fillStyle = TEXT_COLOR; context.textBaseline = 'top'; context.fillText(labelTexts[0], textXCoord, 0); @@ -304,6 +303,4 @@ shouldRender() { return this.dataSeriesList_.length > 0; } -}; - -})(); +}
diff --git a/chrome/browser/resources/chromeos/sys_internals/line_chart/unit_label.js b/chrome/browser/resources/chromeos/sys_internals/line_chart/unit_label.js index 027cdd2..5d4e50f 100644 --- a/chrome/browser/resources/chromeos/sys_internals/line_chart/unit_label.js +++ b/chrome/browser/resources/chromeos/sys_internals/line_chart/unit_label.js
@@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -(function() { -'use strict'; +import {MAX_VERTICAL_LABEL_NUM, MIN_LABEL_VERTICAL_SPACING} from './constants.js'; /** * Create by |LineChart.LineChart|. @@ -11,7 +10,7 @@ * labels. * @const */ -LineChart.UnitLabel = class { +export class UnitLabel { constructor(/** Array<string> */ units, /** number */ unitBase) { /** @const {Array<string>} - See |getSuitableUnit()|. */ this.units_ = units; @@ -227,13 +226,13 @@ */ getMaxNumberOfLabel_() { const /** number */ minLabelSpacing = - 2 * this.fontHeight_ + LineChart.MIN_LABEL_VERTICAL_SPACING; + 2 * this.fontHeight_ + MIN_LABEL_VERTICAL_SPACING; let /** number */ maxLabelNum = 1 + Math.floor(this.height_ / minLabelSpacing); if (maxLabelNum < 2) { maxLabelNum = 2; - } else if (maxLabelNum > LineChart.MAX_VERTICAL_LABEL_NUM) { - maxLabelNum = LineChart.MAX_VERTICAL_LABEL_NUM; + } else if (maxLabelNum > MAX_VERTICAL_LABEL_NUM) { + maxLabelNum = MAX_VERTICAL_LABEL_NUM; } return maxLabelNum; @@ -269,12 +268,4 @@ getRealValueWithCurrentUnit_(value) { return value * Math.pow(this.unitBase_, this.currentUnitIdx_); } -}; - -/** - * Export the function getSuitableUnit. - * @const - */ -LineChart.getSuitableUnit = LineChart.UnitLabel.getSuitableUnit; - -})(); +}
diff --git a/chrome/browser/resources/chromeos/sys_internals/main.js b/chrome/browser/resources/chromeos/sys_internals/main.js new file mode 100644 index 0000000..42cb110e --- /dev/null +++ b/chrome/browser/resources/chromeos/sys_internals/main.js
@@ -0,0 +1,14 @@ +// Copyright 2016 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 {initialize} from './index.js'; +import {loadTestModule} from './test_loader_util.js'; + +document.addEventListener('DOMContentLoaded', () => { + // Using a query of "module" provides a hook for the test suite to perform + // setup actions. + if (!loadTestModule()) { + initialize(); + } +});
diff --git a/chrome/browser/resources/chromeos/sys_internals/types.js b/chrome/browser/resources/chromeos/sys_internals/types.js index 977c99a..951b650 100644 --- a/chrome/browser/resources/chromeos/sys_internals/types.js +++ b/chrome/browser/resources/chromeos/sys_internals/types.js
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {DataSeries} from './line_chart/data_series.js'; + /** * @fileoverview Typedef use by chrome://sys-internals. */ @@ -16,7 +18,7 @@ * user: number, * }} */ -var GeneralCpuType; +export var GeneralCpuType; /** * For info page. @@ -27,7 +29,7 @@ * used: number, * }} */ -var GeneralMemoryType; +export var GeneralMemoryType; /** * For info page. @@ -38,7 +40,7 @@ * total: number, * }} */ -var GeneralZramType; +export var GeneralZramType; /** * @typedef {{ @@ -47,33 +49,33 @@ * zram: GeneralZramType, * }} */ -var GeneralInfoType; +export var GeneralInfoType; /** - * @typedef {Array<!LineChart.DataSeries>|null} + * @typedef {Array<!DataSeries>|null} */ -var CpuDataSeriesSet; +export var CpuDataSeriesSet; /** * @typedef {{ - * memUsed: !LineChart.DataSeries, - * swapUsed: !LineChart.DataSeries, - * pswpin: !LineChart.DataSeries, - * pswpout: !LineChart.DataSeries + * memUsed: !DataSeries, + * swapUsed: !DataSeries, + * pswpin: !DataSeries, + * pswpout: !DataSeries * }} */ -var MemoryDataSeriesSet; +export var MemoryDataSeriesSet; /** * @typedef {{ - * origDataSize: !LineChart.DataSeries, - * comprDataSize: !LineChart.DataSeries, - * memUsedTotal: !LineChart.DataSeries, - * numReads: !LineChart.DataSeries, - * numWrites: !LineChart.DataSeries + * origDataSize: !DataSeries, + * comprDataSize: !DataSeries, + * memUsedTotal: !DataSeries, + * numReads: !DataSeries, + * numWrites: !DataSeries * }} */ -var ZramDataSeriesSet; +export var ZramDataSeriesSet; /** * @typedef {{ @@ -82,9 +84,9 @@ * zram: ZramDataSeriesSet, * }} */ -var DataSeriesSet; +export var DataSeriesSet; /** * @typedef {{value: number, timestamp: number}} */ -var CounterType; +export var CounterType;
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/internet_detail_page.js b/chrome/browser/resources/settings/chromeos/internet_page/internet_detail_page.js index c48880c5..2744c554 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/internet_detail_page.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/internet_detail_page.js
@@ -555,9 +555,9 @@ * Handler for when os sync preferences are updated. * @private */ - handleOsSyncPrefsChanged_(osSyncFeatureEnabled, osSyncPrefs) { - this.isWifiSyncEnabled_ = osSyncFeatureEnabled && !!osSyncPrefs && - osSyncPrefs.osWifiConfigurationsSynced; + handleOsSyncPrefsChanged_(osSyncPrefs) { + this.isWifiSyncEnabled_ = + !!osSyncPrefs && osSyncPrefs.osWifiConfigurationsSynced; }, /**
diff --git a/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_wifi_sync_item.js b/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_wifi_sync_item.js index 7bec70bb..9cec310 100644 --- a/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_wifi_sync_item.js +++ b/chrome/browser/resources/settings/chromeos/multidevice_page/multidevice_wifi_sync_item.js
@@ -68,12 +68,11 @@ /** * Handler for when os sync preferences are updated. * @param {!settings.OsSyncPrefs} osSyncPrefs - * @param {!boolean} osSyncFeatureEnabled * @private */ - handleOsSyncPrefsChanged_(osSyncFeatureEnabled, osSyncPrefs) { - this.isWifiSyncV1Enabled_ = osSyncFeatureEnabled && !!osSyncPrefs && - osSyncPrefs.osWifiConfigurationsSynced; + handleOsSyncPrefsChanged_(osSyncPrefs) { + this.isWifiSyncV1Enabled_ = + !!osSyncPrefs && osSyncPrefs.osWifiConfigurationsSynced; }, /** @override */
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_browser_proxy.js b/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_browser_proxy.js index 4b93a33d..a28578da 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_browser_proxy.js +++ b/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_browser_proxy.js
@@ -48,13 +48,6 @@ sendOsSyncPrefsChanged() {} /** - * Sets whether the OS sync feature should be enabled. Sync will not start - * until the user either navigates away from the page or closes settings. - * @param {boolean} enabled - */ - setOsSyncFeatureEnabled(enabled) {} - - /** * Sets which types of data to sync. * @param {!settings.OsSyncPrefs} osSyncPrefs */ @@ -81,11 +74,6 @@ } /** @override */ - setOsSyncFeatureEnabled(enabled) { - return chrome.send('SetOsSyncFeatureEnabled', [enabled]); - } - - /** @override */ setOsSyncDatatypes(osSyncPrefs) { return chrome.send('SetOsSyncDatatypes', [osSyncPrefs]); }
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_controls.html b/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_controls.html index 92534d9..e531748b 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_controls.html +++ b/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_controls.html
@@ -103,7 +103,7 @@ <div class="settings-box first two-line"> <div id="avatarContainer"> <img id="avatarIcon" alt="" src="[[profileIconUrl]]"> - <div id="syncIconContainer" hidden="[[!osSyncFeatureEnabled]]" + <div id="syncIconContainer" class$="[[getSyncIconStyle_( syncStatus.hasError, syncStatus.statusAction, syncStatus.disabled)]]"> @@ -118,22 +118,10 @@ [[getAccountTitle_(profileName, syncStatus.hasError)]] </span> <div id="accountSubtitle" class="secondary" aria-hidden="true"> - [[getAccountSubtitle_(profileEmail, syncStatus.hasError, - osSyncFeatureEnabled)]] + [[getAccountSubtitle_(profileEmail, syncStatus.hasError)]] </div> </div> </div> - - <template is="dom-if" if="[[syncConsentOptionalEnabled_]]" restamp> - <cr-button id="syncOnOffButton" - class="action-button" - on-click="onSyncOnOffButtonClick_" - aria-labelledby="syncOnOffButton accountTitle accountSubtitle" - aria-describedby="featureLabel" - deep-link-focus-id$="[[Setting.kSplitSyncOnOff]]"> - [[getSyncOnOffButtonLabel_(osSyncFeatureEnabled)]] - </cr-button> - </template> </div> <div id="featureLabel" class="settings-box"> @@ -145,14 +133,12 @@ <div class="settings-box"> <div id="syncEverythingCheckboxLabel" - class="start" - label-disabled$="[[!osSyncFeatureEnabled]]"> + class="start"> $i18n{syncEverythingCheckboxLabel} </div> <cr-toggle id="syncAllOsTypesControl" checked="{{osSyncPrefs.syncAllOsTypes}}" on-change="onSyncAllOsTypesChanged_" - disabled="[[!osSyncFeatureEnabled]]" aria-labelledby="syncEverythingCheckboxLabel"> </cr-toggle> </div>
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_controls.js b/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_controls.js index 6d53b7b..401499f0 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_controls.js +++ b/chrome/browser/resources/settings/chromeos/os_people_page/os_sync_controls.js
@@ -67,13 +67,6 @@ profileEmail: String, /** - * Whether the OS sync feature is enabled. This object does not directly - * manipulate prefs so we can defer turning on OS sync until the user - * navigates away from the page. - */ - osSyncFeatureEnabled: Boolean, - - /** * The current OS sync preferences. Cached so we can restore individual * toggle state when turning "sync everything" on and off, without affecting * the underlying chrome prefs. @@ -85,8 +78,7 @@ areDataTypeTogglesDisabled_: { type: Boolean, value: true, - computed: `computeDataTypeTogglesDisabled_(osSyncFeatureEnabled, - osSyncPrefs.syncAllOsTypes)`, + computed: `computeDataTypeTogglesDisabled_(osSyncPrefs.syncAllOsTypes)`, }, /** @@ -97,14 +89,6 @@ type: Object, value: () => new Set([chromeos.settings.mojom.Setting.kSplitSyncOnOff]), }, - - /** @private */ - syncConsentOptionalEnabled_: { - type: Boolean, - value() { - return loadTimeData.getBoolean('syncConsentOptionalEnabled'); - }, - }, }, /** @private {?settings.OsSyncBrowserProxy} */ @@ -164,23 +148,12 @@ if (!this.syncStatus) { return ''; } - return this.osSyncFeatureEnabled && !this.syncStatus.hasError ? + return !this.syncStatus.hasError ? this.i18n('syncingTo', this.profileEmail) : this.profileEmail; }, /** - * @return {string} - * @private - */ - getSyncOnOffButtonLabel_() { - if (!this.osSyncFeatureEnabled) { - return this.i18n('osSyncTurnOn'); - } - return this.i18n('osSyncTurnOff'); - }, - - /** * Returns the CSS class for the sync status icon. * @return {string} * @private @@ -226,33 +199,15 @@ * Handler for when the sync preferences are updated. * @private */ - handleOsSyncPrefsChanged_(osSyncFeatureEnabled, osSyncPrefs) { - assert(osSyncFeatureEnabled || this.syncConsentOptionalEnabled_); - this.osSyncFeatureEnabled = osSyncFeatureEnabled; + handleOsSyncPrefsChanged_(osSyncPrefs) { this.osSyncPrefs = osSyncPrefs; - // If the feature is disabled the checkboxes appear toggled off, regardless - // of the underlying chrome pref. - if (!this.osSyncFeatureEnabled) { - this.set('osSyncPrefs.syncAllOsTypes', false); - for (const dataType of SyncPrefsIndividualDataTypes) { - this.set(['osSyncPrefs', dataType], false); - } - } - // If apps are not registered or synced, force wallpaper off. if (!this.osSyncPrefs.osAppsRegistered || !this.osSyncPrefs.osAppsSynced) { this.set('osSyncPrefs.wallpaperEnabled', false); } }, - /** @private */ - onSyncOnOffButtonClick_() { - assert(this.syncConsentOptionalEnabled_); - this.browserProxy_.setOsSyncFeatureEnabled(!this.osSyncFeatureEnabled); - settings.recordSettingChange(); - }, - /** * Handler for when the sync all data types checkbox is changed. * @param {!Event} event @@ -314,8 +269,7 @@ * @private */ computeDataTypeTogglesDisabled_() { - return !this.osSyncFeatureEnabled || - (this.osSyncPrefs !== undefined && this.osSyncPrefs.syncAllOsTypes); + return this.osSyncPrefs !== undefined && this.osSyncPrefs.syncAllOsTypes; }, /**
diff --git a/chrome/browser/resources/support_tool/OWNERS b/chrome/browser/resources/support_tool/OWNERS new file mode 100644 index 0000000..63381752 --- /dev/null +++ b/chrome/browser/resources/support_tool/OWNERS
@@ -0,0 +1,3 @@ +iremuguz@google.com +pmarko@chromium.org +srad@google.com \ No newline at end of file
diff --git a/chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.cc b/chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.cc index 6bec847..b1d64f01 100644 --- a/chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.cc +++ b/chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.h" #include "base/bind.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service.h"
diff --git a/chrome/browser/serial/serial_blocklist.cc b/chrome/browser/serial/serial_blocklist.cc index 6ec5ffc..fd502138 100644 --- a/chrome/browser/serial/serial_blocklist.cc +++ b/chrome/browser/serial/serial_blocklist.cc
@@ -9,6 +9,7 @@ #include <tuple> #include "base/metrics/field_trial_params.h" +#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "services/device/public/mojom/serial.mojom.h"
diff --git a/chrome/browser/sessions/exit_type_service_factory.cc b/chrome/browser/sessions/exit_type_service_factory.cc index 8613b78..4ab651d0 100644 --- a/chrome/browser/sessions/exit_type_service_factory.cc +++ b/chrome/browser/sessions/exit_type_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/sessions/exit_type_service_factory.h" +#include "base/no_destructor.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sessions/exit_type_service.h"
diff --git a/chrome/browser/sharing/web_push/web_push_sender.cc b/chrome/browser/sharing/web_push/web_push_sender.cc index cc9e70b..e7d5a83 100644 --- a/chrome/browser/sharing/web_push/web_push_sender.cc +++ b/chrome/browser/sharing/web_push/web_push_sender.cc
@@ -8,7 +8,6 @@ #include "base/base64url.h" #include "base/bind.h" -#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "chrome/browser/sharing/web_push/json_web_token_util.h"
diff --git a/chrome/browser/signin/signin_manager_android_factory.cc b/chrome/browser/signin/signin_manager_android_factory.cc index 08d545c3..83c53f0a 100644 --- a/chrome/browser/signin/signin_manager_android_factory.cc +++ b/chrome/browser/signin/signin_manager_android_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/signin/signin_manager_android_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/android/signin/signin_manager_android.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/identity_manager_factory.h"
diff --git a/chrome/browser/speech/tts_chromeos.cc b/chrome/browser/speech/tts_chromeos.cc index 0930690..47c0872 100644 --- a/chrome/browser/speech/tts_chromeos.cc +++ b/chrome/browser/speech/tts_chromeos.cc
@@ -10,6 +10,7 @@ #include "ash/components/arc/mojom/tts.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" +#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/tts_platform.h"
diff --git a/chrome/browser/speech/tts_lacros.cc b/chrome/browser/speech/tts_lacros.cc index 9e33515..7ea4701 100644 --- a/chrome/browser/speech/tts_lacros.cc +++ b/chrome/browser/speech/tts_lacros.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/speech/tts_lacros.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/speech/tts_client_lacros.h"
diff --git a/chrome/browser/startup_data.cc b/chrome/browser/startup_data.cc index f55db44..38e1301 100644 --- a/chrome/browser/startup_data.cc +++ b/chrome/browser/startup_data.cc
@@ -19,7 +19,6 @@ #if defined(OS_ANDROID) #include "base/files/file_util.h" -#include "base/no_destructor.h" #include "base/path_service.h" #include "base/task/post_task.h" #include "chrome/browser/android/profile_key_startup_accessor.h"
diff --git a/chrome/browser/supervised_user/kids_chrome_management/kids_chrome_management_client_factory.cc b/chrome/browser/supervised_user/kids_chrome_management/kids_chrome_management_client_factory.cc index f502b0ea..95b31f1 100644 --- a/chrome/browser/supervised_user/kids_chrome_management/kids_chrome_management_client_factory.cc +++ b/chrome/browser/supervised_user/kids_chrome_management/kids_chrome_management_client_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/supervised_user/kids_chrome_management/kids_chrome_management_client_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/supervised_user/kids_chrome_management/kids_chrome_management_client.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/sync/sync_error_notifier_ash_unittest.cc b/chrome/browser/sync/sync_error_notifier_ash_unittest.cc index 3e7e2f4..824ad68e 100644 --- a/chrome/browser/sync/sync_error_notifier_ash_unittest.cc +++ b/chrome/browser/sync/sync_error_notifier_ash_unittest.cc
@@ -101,14 +101,6 @@ ExpectNotificationShown(false); } -TEST_F(SyncErrorNotifierTest, NoNotificationWhenSyncDisabled) { - service_.SetPassphraseRequiredForPreferredDataTypes(true); - service_.SetFirstSetupComplete(false); - service_.GetUserSettings()->SetOsSyncFeatureEnabled(false); - error_notifier_->OnStateChanged(&service_); - ExpectNotificationShown(false); -} - TEST_F(SyncErrorNotifierTest, NotificationShownWhenBrowserSyncEnabled) { service_.SetPassphraseRequiredForPreferredDataTypes(true); service_.SetFirstSetupComplete(true); @@ -116,23 +108,8 @@ ExpectNotificationShown(true); } -TEST_F(SyncErrorNotifierTest, NotificationShownWhenOsSyncEnabled) { - base::test::ScopedFeatureList feature_list; - // SyncConsentOptional requires SyncSettingsCategorization. - feature_list.InitWithFeatures( - {chromeos::features::kSyncSettingsCategorization, - chromeos::features::kSyncConsentOptional}, - {}); - service_.SetPassphraseRequiredForPreferredDataTypes(true); - service_.GetUserSettings()->SetOsSyncFeatureEnabled(true); - service_.SetFirstSetupComplete(false); - error_notifier_->OnStateChanged(&service_); - ExpectNotificationShown(true); -} - TEST_F(SyncErrorNotifierTest, NotificationShownOnce) { service_.SetPassphraseRequiredForPreferredDataTypes(true); - service_.GetUserSettings()->SetOsSyncFeatureEnabled(true); service_.SetFirstSetupComplete(true); error_notifier_->OnStateChanged(&service_); ExpectNotificationShown(true);
diff --git a/chrome/browser/sync/sync_invalidations_service_factory.cc b/chrome/browser/sync/sync_invalidations_service_factory.cc index 722d757..1bdfc73 100644 --- a/chrome/browser/sync/sync_invalidations_service_factory.cc +++ b/chrome/browser/sync/sync_invalidations_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/sync/sync_invalidations_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/gcm/gcm_profile_service_factory.h" #include "chrome/browser/gcm/instance_id/instance_id_profile_service_factory.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/sync/sync_service_factory.cc b/chrome/browser/sync/sync_service_factory.cc index 8d918de..2bf97bd 100644 --- a/chrome/browser/sync/sync_service_factory.cc +++ b/chrome/browser/sync/sync_service_factory.cc
@@ -147,10 +147,7 @@ // need to take care that SyncServiceImpl doesn't get tripped up between // those two cases. Bug 88109. bool is_auto_start = browser_defaults::kSyncAutoStarts; -#if BUILDFLAG(IS_CHROMEOS_ASH) - if (chromeos::features::IsSyncConsentOptionalEnabled()) - is_auto_start = false; -#elif BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_CHROMEOS_LACROS) // TODO(https://crbug.com/1194983): Figure out how split sync settings will // work here. For now, we will mimic Ash's behaviour of having sync turned // on by default.
diff --git a/chrome/browser/sync/sync_ui_util.cc b/chrome/browser/sync/sync_ui_util.cc index 61f2375..5e8619c 100644 --- a/chrome/browser/sync/sync_ui_util.cc +++ b/chrome/browser/sync/sync_ui_util.cc
@@ -197,20 +197,6 @@ Navigate(¶ms); } -// Returns true if the user has consented to browser sync-the-feature or -// Chrome OS sync. -bool HasUserOptedInToSync(const syncer::SyncUserSettings* settings) { - if (settings->IsFirstSetupComplete()) - return true; -#if BUILDFLAG(IS_CHROMEOS_ASH) - if (chromeos::features::IsSyncConsentOptionalEnabled() && - settings->IsOsSyncFeatureEnabled()) { - return true; - } -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - return false; -} - absl::optional<AvatarSyncErrorType> GetTrustedVaultError( const syncer::SyncService* sync_service, const PrefService* pref_service) { @@ -278,7 +264,7 @@ if (!service->HasSyncConsent()) { // Only trusted vault errors can be shown if the account isn't a consented // primary account. - // Note the condition checked is not HasUserOptedInToSync(), because the + // Note the condition checked is not IsFirstSetupComplete(), because the // setup incomplete case is treated separately below. See the comment in // ShouldRequestSyncConfirmation() about dashboard resets. return GetTrustedVaultError(service, profile->GetPrefs()); @@ -367,7 +353,7 @@ bool ShouldShowSyncPassphraseError(const syncer::SyncService* service) { const syncer::SyncUserSettings* settings = service->GetUserSettings(); - return HasUserOptedInToSync(settings) && + return settings->IsFirstSetupComplete() && settings->IsPassphraseRequiredForPreferredDataTypes(); } @@ -378,7 +364,7 @@ return false; } - if (HasUserOptedInToSync(settings)) { + if (settings->IsFirstSetupComplete()) { return true; } @@ -413,7 +399,7 @@ return false; } - if (HasUserOptedInToSync(settings)) { + if (settings->IsFirstSetupComplete()) { return true; }
diff --git a/chrome/browser/sync/sync_ui_util_unittest.cc b/chrome/browser/sync/sync_ui_util_unittest.cc index 7c769960..f6017db0 100644 --- a/chrome/browser/sync/sync_ui_util_unittest.cc +++ b/chrome/browser/sync/sync_ui_util_unittest.cc
@@ -369,9 +369,6 @@ TEST(SyncUIUtilTest, ShouldShowSyncPassphraseError_SyncDisabled) { syncer::TestSyncService service; service.SetFirstSetupComplete(false); -#if BUILDFLAG(IS_CHROMEOS_ASH) - service.GetUserSettings()->SetOsSyncFeatureEnabled(false); -#endif // BUILDFLAG(IS_CHROMEOS_ASH) service.SetPassphraseRequiredForPreferredDataTypes(true); EXPECT_FALSE(ShouldShowSyncPassphraseError(&service)); } @@ -383,20 +380,4 @@ EXPECT_FALSE(ShouldShowSyncPassphraseError(&service)); } -#if BUILDFLAG(IS_CHROMEOS_ASH) -TEST(SyncUIUtilTest, ShouldShowSyncPassphraseError_OsSyncEnabled) { - base::test::ScopedFeatureList feature_list; - // SyncConsentOptional requires SyncSettingsCategorization. - feature_list.InitWithFeatures( - {chromeos::features::kSyncSettingsCategorization, - chromeos::features::kSyncConsentOptional}, - {}); - syncer::TestSyncService service; - service.SetPassphraseRequiredForPreferredDataTypes(true); - service.SetFirstSetupComplete(false); - service.GetUserSettings()->SetOsSyncFeatureEnabled(true); - EXPECT_TRUE(ShouldShowSyncPassphraseError(&service)); -} -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - } // namespace
diff --git a/chrome/browser/sync/test/integration/single_client_app_settings_sync_test.cc b/chrome/browser/sync/test/integration/single_client_app_settings_sync_test.cc index 8c9566b..897f4036 100644 --- a/chrome/browser/sync/test/integration/single_client_app_settings_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_app_settings_sync_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 "build/chromeos_buildflags.h" #include "chrome/browser/sync/test/integration/sync_test.h" #include "components/sync/base/model_type.h" #include "components/sync/base/user_selectable_type.h" @@ -11,41 +10,13 @@ #include "content/public/test/browser_test.h" #include "testing/gtest/include/gtest/gtest.h" -#if BUILDFLAG(IS_CHROMEOS_ASH) -#include "ash/constants/ash_features.h" -#include "chrome/browser/sync/test/integration/sync_consent_optional_sync_test.h" -#endif - using syncer::UserSelectableType; using syncer::UserSelectableTypeSet; namespace { -#if BUILDFLAG(IS_CHROMEOS_ASH) -// Chrome OS syncs apps as an OS type. -class SingleClientAppSettingsOsSyncTest : public SyncConsentOptionalSyncTest { - public: - SingleClientAppSettingsOsSyncTest() - : SyncConsentOptionalSyncTest(SINGLE_CLIENT) {} - ~SingleClientAppSettingsOsSyncTest() override = default; -}; - -IN_PROC_BROWSER_TEST_F(SingleClientAppSettingsOsSyncTest, - DisablingOsSyncFeatureDisablesDataType) { - ASSERT_TRUE(chromeos::features::IsSyncConsentOptionalEnabled()); - ASSERT_TRUE(SetupSync()); - syncer::SyncServiceImpl* service = GetSyncService(0); - syncer::SyncUserSettings* settings = service->GetUserSettings(); - - EXPECT_TRUE(settings->IsOsSyncFeatureEnabled()); - EXPECT_TRUE(service->GetActiveDataTypes().Has(syncer::APP_SETTINGS)); - - settings->SetOsSyncFeatureEnabled(false); - EXPECT_FALSE(settings->IsOsSyncFeatureEnabled()); - EXPECT_FALSE(service->GetActiveDataTypes().Has(syncer::APP_SETTINGS)); -} - -#else // !BUILDFLAG(IS_CHROMEOS_ASH) +// TODO(https://crbug.com/1280212): See if this test can be enabled on ChromeOS. +#if !BUILDFLAG(IS_CHROMEOS_ASH) // See also TwoClientExtensionSettingsAndAppSettingsSyncTest. class SingleClientAppSettingsSyncTest : public SyncTest { @@ -65,6 +36,7 @@ EXPECT_FALSE(settings->GetSelectedTypes().Has(UserSelectableType::kApps)); EXPECT_FALSE(service->GetActiveDataTypes().Has(syncer::APP_SETTINGS)); } -#endif // BUILDFLAG(IS_CHROMEOS_ASH) + +#endif // !BUILDFLAG(IS_CHROMEOS_ASH) } // namespace
diff --git a/chrome/browser/sync/test/integration/single_client_arc_package_sync_test.cc b/chrome/browser/sync/test/integration/single_client_arc_package_sync_test.cc index 8287d94..4f5dab7f 100644 --- a/chrome/browser/sync/test/integration/single_client_arc_package_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_arc_package_sync_test.cc
@@ -5,7 +5,6 @@ #include "ash/constants/ash_features.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/test/integration/sync_arc_package_helper.h" -#include "chrome/browser/sync/test/integration/sync_consent_optional_sync_test.h" #include "chrome/browser/sync/test/integration/sync_service_impl_harness.h" #include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" @@ -91,27 +90,5 @@ ASSERT_TRUE(AllProfilesHaveSameArcPackageDetails()); } -class SingleClientArcPackageOsSyncTest : public SyncConsentOptionalSyncTest { - public: - SingleClientArcPackageOsSyncTest() - : SyncConsentOptionalSyncTest(SINGLE_CLIENT) {} - ~SingleClientArcPackageOsSyncTest() override = default; -}; - -IN_PROC_BROWSER_TEST_F(SingleClientArcPackageOsSyncTest, - DisablingOsSyncFeatureDisablesDataType) { - ASSERT_TRUE(chromeos::features::IsSyncConsentOptionalEnabled()); - ASSERT_TRUE(SetupSync()); - syncer::SyncService* service = GetSyncService(0); - syncer::SyncUserSettings* settings = service->GetUserSettings(); - - EXPECT_TRUE(settings->IsOsSyncFeatureEnabled()); - EXPECT_TRUE(service->GetActiveDataTypes().Has(syncer::ARC_PACKAGE)); - - settings->SetOsSyncFeatureEnabled(false); - EXPECT_FALSE(settings->IsOsSyncFeatureEnabled()); - EXPECT_FALSE(service->GetActiveDataTypes().Has(syncer::ARC_PACKAGE)); -} - } // namespace } // namespace arc
diff --git a/chrome/browser/sync/test/integration/single_client_extension_apps_sync_test.cc b/chrome/browser/sync/test/integration/single_client_extension_apps_sync_test.cc index dc7eed3..31ec8ed 100644 --- a/chrome/browser/sync/test/integration/single_client_extension_apps_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_extension_apps_sync_test.cc
@@ -2,19 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "build/build_config.h" -#include "build/chromeos_buildflags.h" #include "chrome/browser/sync/test/integration/apps_helper.h" #include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "components/sync/driver/sync_service_impl.h" #include "content/public/test/browser_test.h" -#if BUILDFLAG(IS_CHROMEOS_ASH) -#include "ash/constants/ash_features.h" -#include "chrome/browser/sync/test/integration/sync_consent_optional_sync_test.h" -#endif - using apps_helper::AllProfilesHaveSameApps; using apps_helper::InstallHostedApp; using apps_helper::InstallPlatformApp; @@ -114,36 +107,3 @@ ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); ASSERT_TRUE(AllProfilesHaveSameApps()); } - -#if BUILDFLAG(IS_CHROMEOS_ASH) - -// Tests for SyncConsentOptional. -class SingleClientExtensionAppsOsSyncTest : public SyncConsentOptionalSyncTest { - public: - SingleClientExtensionAppsOsSyncTest() - : SyncConsentOptionalSyncTest(SINGLE_CLIENT) {} - - SingleClientExtensionAppsOsSyncTest( - const SingleClientExtensionAppsOsSyncTest&) = delete; - SingleClientExtensionAppsOsSyncTest& operator=( - const SingleClientExtensionAppsOsSyncTest&) = delete; - - ~SingleClientExtensionAppsOsSyncTest() override = default; -}; - -IN_PROC_BROWSER_TEST_F(SingleClientExtensionAppsOsSyncTest, - DisablingOsSyncFeatureDisablesDataType) { - ASSERT_TRUE(chromeos::features::IsSyncConsentOptionalEnabled()); - ASSERT_TRUE(SetupSync()); - syncer::SyncService* service = GetSyncService(0); - syncer::SyncUserSettings* settings = service->GetUserSettings(); - - EXPECT_TRUE(settings->IsOsSyncFeatureEnabled()); - EXPECT_TRUE(service->GetActiveDataTypes().Has(syncer::APPS)); - - settings->SetOsSyncFeatureEnabled(false); - EXPECT_FALSE(settings->IsOsSyncFeatureEnabled()); - EXPECT_FALSE(service->GetActiveDataTypes().Has(syncer::APPS)); -} - -#endif // BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/sync/test/integration/single_client_os_preferences_sync_test.cc b/chrome/browser/sync/test/integration/single_client_os_preferences_sync_test.cc index a71b570..4047b71 100644 --- a/chrome/browser/sync/test/integration/single_client_os_preferences_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_os_preferences_sync_test.cc
@@ -9,7 +9,6 @@ #include "base/strings/string_util.h" #include "base/values.h" #include "chrome/browser/sync/test/integration/preferences_helper.h" -#include "chrome/browser/sync/test/integration/sync_consent_optional_sync_test.h" #include "chrome/browser/sync/test/integration/sync_settings_categorization_sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" @@ -49,29 +48,6 @@ Eq(ash::kShelfAlignmentRight)); } -class SingleClientOsPreferencesOptionalConsentSyncTest - : public SyncConsentOptionalSyncTest { - public: - SingleClientOsPreferencesOptionalConsentSyncTest() - : SyncConsentOptionalSyncTest(SINGLE_CLIENT) {} - ~SingleClientOsPreferencesOptionalConsentSyncTest() override = default; -}; - -IN_PROC_BROWSER_TEST_F(SingleClientOsPreferencesOptionalConsentSyncTest, - DisablingOsSyncFeatureDisablesDataType) { - ASSERT_TRUE(chromeos::features::IsSyncConsentOptionalEnabled()); - ASSERT_TRUE(SetupSync()); - syncer::SyncService* service = GetSyncService(0); - syncer::SyncUserSettings* settings = service->GetUserSettings(); - - EXPECT_TRUE(settings->IsOsSyncFeatureEnabled()); - EXPECT_TRUE(service->GetActiveDataTypes().Has(syncer::OS_PREFERENCES)); - - settings->SetOsSyncFeatureEnabled(false); - EXPECT_FALSE(settings->IsOsSyncFeatureEnabled()); - EXPECT_FALSE(service->GetActiveDataTypes().Has(syncer::OS_PREFERENCES)); -} - class SyncCategorizationBaseTest : public SyncTest { public: SyncCategorizationBaseTest() : SyncTest(SyncTest::SINGLE_CLIENT) {}
diff --git a/chrome/browser/sync/test/integration/single_client_printers_sync_test.cc b/chrome/browser/sync/test/integration/single_client_printers_sync_test.cc index d8eb5f3..9e945316 100644 --- a/chrome/browser/sync/test/integration/single_client_printers_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_printers_sync_test.cc
@@ -6,7 +6,6 @@ #include "chrome/browser/ash/printing/printers_sync_bridge.h" #include "chrome/browser/sync/test/integration/printers_helper.h" -#include "chrome/browser/sync/test/integration/sync_consent_optional_sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "chromeos/printing/printer_configuration.h" @@ -116,26 +115,4 @@ EXPECT_EQ(kServerAddress, spec_printer->print_server_uri()); } -// Tests for SyncConsentOptional. -class SingleClientPrintersOsSyncTest : public SyncConsentOptionalSyncTest { - public: - SingleClientPrintersOsSyncTest() - : SyncConsentOptionalSyncTest(SINGLE_CLIENT) {} - ~SingleClientPrintersOsSyncTest() override = default; -}; - -IN_PROC_BROWSER_TEST_F(SingleClientPrintersOsSyncTest, - DisablingOsSyncFeatureDisablesDataType) { - ASSERT_TRUE(SetupSync()); - syncer::SyncService* service = GetSyncService(0); - syncer::SyncUserSettings* settings = service->GetUserSettings(); - - EXPECT_TRUE(settings->IsOsSyncFeatureEnabled()); - EXPECT_TRUE(service->GetActiveDataTypes().Has(syncer::PRINTERS)); - - settings->SetOsSyncFeatureEnabled(false); - EXPECT_FALSE(settings->IsOsSyncFeatureEnabled()); - EXPECT_FALSE(service->GetActiveDataTypes().Has(syncer::PRINTERS)); -} - } // namespace
diff --git a/chrome/browser/sync/test/integration/single_client_standalone_transport_sync_test.cc b/chrome/browser/sync/test/integration/single_client_standalone_transport_sync_test.cc index 2b8d2a01..6f542b7 100644 --- a/chrome/browser/sync/test/integration/single_client_standalone_transport_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_standalone_transport_sync_test.cc
@@ -24,7 +24,6 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/constants/ash_features.h" -#include "chrome/browser/sync/test/integration/sync_consent_optional_sync_test.h" #include "components/browser_sync/browser_sync_switches.h" #endif @@ -82,13 +81,10 @@ ~SingleClientStandaloneTransportSyncTest() override = default; }; +// On Chrome OS sync auto-starts on sign-in. +#if !BUILDFLAG(IS_CHROMEOS_ASH) IN_PROC_BROWSER_TEST_F(SingleClientStandaloneTransportSyncTest, StartsSyncTransportOnSignin) { -#if BUILDFLAG(IS_CHROMEOS_ASH) - // On Chrome OS before SyncConsentOptional, sync auto-starts on sign-in. - if (!chromeos::features::IsSyncConsentOptionalEnabled()) - return; -#endif ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; // Signing in (without explicitly setting up Sync) should trigger starting the @@ -122,6 +118,7 @@ AllowedTypesInStandaloneTransportMode()); EXPECT_TRUE(bad_types.Empty()) << syncer::ModelTypeSetToString(bad_types); } +#endif // BUILDFLAG(IS_CHROMEOS_ASH) IN_PROC_BROWSER_TEST_F(SingleClientStandaloneTransportSyncTest, SwitchesBetweenTransportAndFeature) { @@ -285,92 +282,4 @@ EXPECT_EQ(old_cache_guid, transport_data_prefs.GetCacheGuid()); } -#if BUILDFLAG(IS_CHROMEOS_ASH) -class SingleClientStandaloneTransportOsSyncTest - : public SyncConsentOptionalSyncTest { - public: - SingleClientStandaloneTransportOsSyncTest() - : SyncConsentOptionalSyncTest(SINGLE_CLIENT) { - // Enable in-development types. - scoped_features_.InitAndEnableFeature(switches::kSyncWifiConfigurations); - } - ~SingleClientStandaloneTransportOsSyncTest() override = default; - - private: - base::test::ScopedFeatureList scoped_features_; -}; - -IN_PROC_BROWSER_TEST_F(SingleClientStandaloneTransportOsSyncTest, - OsTypesAreActiveWhenBrowserSyncIsOff) { - ASSERT_TRUE(chromeos::features::IsSyncConsentOptionalEnabled()); - - // Setup clients but don't start syncing yet. - ASSERT_TRUE(SetupClients()); - syncer::SyncService* service = GetSyncService(0); - syncer::SyncUserSettings* settings = service->GetUserSettings(); - - // Simulate a signed-in user with browser sync off and OS sync on. - settings->SetSyncRequested(false); - settings->SetOsSyncFeatureEnabled(true); - ASSERT_TRUE(GetClient(0)->SignInPrimaryAccount()); - ASSERT_TRUE(GetClient(0)->AwaitSyncTransportActive()); - ASSERT_EQ(syncer::SyncService::TransportState::ACTIVE, - GetSyncService(0)->GetTransportState()); - ASSERT_FALSE(service->IsSyncFeatureActive()); - - // OS data types synced by the transport layer are active. - syncer::ModelTypeSet active_types = service->GetActiveDataTypes(); - EXPECT_TRUE(active_types.Has(syncer::APP_LIST)); - EXPECT_TRUE(active_types.Has(syncer::APP_SETTINGS)); - EXPECT_TRUE(active_types.Has(syncer::APPS)); - EXPECT_TRUE(active_types.Has(syncer::ARC_PACKAGE)); - EXPECT_TRUE(active_types.Has(syncer::OS_PREFERENCES)); - EXPECT_TRUE(active_types.Has(syncer::OS_PRIORITY_PREFERENCES)); - EXPECT_TRUE(active_types.Has(syncer::PRINTERS)); - EXPECT_TRUE(active_types.Has(syncer::WIFI_CONFIGURATIONS)); - - // Verify that a few browser non-transport-mode types are not active. - EXPECT_FALSE(active_types.Has(syncer::BOOKMARKS)); - EXPECT_FALSE(active_types.Has(syncer::SESSIONS)); - EXPECT_FALSE(active_types.Has(syncer::TYPED_URLS)); - EXPECT_FALSE(active_types.Has(syncer::WEB_APPS)); -} - -IN_PROC_BROWSER_TEST_F(SingleClientStandaloneTransportOsSyncTest, - OsTypesAreNotActiveWhenOsSyncIsOff) { - ASSERT_TRUE(chromeos::features::IsSyncConsentOptionalEnabled()); - - // Setup clients but don't start syncing yet. - ASSERT_TRUE(SetupClients()); - syncer::SyncService* service = GetSyncService(0); - syncer::SyncUserSettings* settings = service->GetUserSettings(); - - // Simulate a user who leaves OS sync disabled but starts browser sync. - settings->SetOsSyncFeatureEnabled(false); - ASSERT_TRUE(GetClient(0)->SetupSync()); - ASSERT_TRUE(GetClient(0)->AwaitSyncTransportActive()); - ASSERT_EQ(syncer::SyncService::TransportState::ACTIVE, - GetSyncService(0)->GetTransportState()); - ASSERT_TRUE(service->IsSyncFeatureActive()); - ASSERT_FALSE(settings->IsOsSyncFeatureEnabled()); - - // OS data types synced by the transport layer are not active. - syncer::ModelTypeSet active_types = service->GetActiveDataTypes(); - EXPECT_FALSE(active_types.Has(syncer::APP_LIST)); - EXPECT_FALSE(active_types.Has(syncer::APP_SETTINGS)); - EXPECT_FALSE(active_types.Has(syncer::APPS)); - EXPECT_FALSE(active_types.Has(syncer::ARC_PACKAGE)); - EXPECT_FALSE(active_types.Has(syncer::OS_PREFERENCES)); - EXPECT_FALSE(active_types.Has(syncer::OS_PRIORITY_PREFERENCES)); - EXPECT_FALSE(active_types.Has(syncer::PRINTERS)); - EXPECT_FALSE(active_types.Has(syncer::WIFI_CONFIGURATIONS)); - - // Browser non-transport-mode types are active. - EXPECT_TRUE(active_types.Has(syncer::BOOKMARKS)); - EXPECT_TRUE(active_types.Has(syncer::SESSIONS)); - EXPECT_TRUE(active_types.Has(syncer::TYPED_URLS)); - EXPECT_TRUE(active_types.Has(syncer::WEB_APPS)); -} -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - } // namespace
diff --git a/chrome/browser/sync/test/integration/single_client_web_apps_sync_test.cc b/chrome/browser/sync/test/integration/single_client_web_apps_sync_test.cc index 432ca0d9..4627907 100644 --- a/chrome/browser/sync/test/integration/single_client_web_apps_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_web_apps_sync_test.cc
@@ -21,11 +21,6 @@ #include "content/public/test/browser_test.h" #include "testing/gtest/include/gtest/gtest.h" -#if BUILDFLAG(IS_CHROMEOS_ASH) -#include "ash/constants/ash_features.h" -#include "chrome/browser/sync/test/integration/sync_consent_optional_sync_test.h" -#endif - using syncer::UserSelectableType; using syncer::UserSelectableTypeSet; @@ -38,36 +33,6 @@ // Default version used when creating extension entities. const char kVersion[] = "1.0.0.1"; -#if BUILDFLAG(IS_CHROMEOS_ASH) - -// These tests test the new Web Apps system with next generation sync. -// -// Chrome OS syncs Web apps as a browser type, so it shouldn't be affected by -// the OS sync feature. -class SingleClientWebAppsOsSyncTest : public SyncConsentOptionalSyncTest { - public: - SingleClientWebAppsOsSyncTest() - : SyncConsentOptionalSyncTest(SINGLE_CLIENT) {} - ~SingleClientWebAppsOsSyncTest() override = default; -}; - -IN_PROC_BROWSER_TEST_F(SingleClientWebAppsOsSyncTest, - DisablingOsSyncFeatureKeepsWebAppsEnabled) { - ASSERT_TRUE(chromeos::features::IsSyncConsentOptionalEnabled()); - ASSERT_TRUE(SetupSync()); - syncer::SyncServiceImpl* service = GetSyncService(0); - syncer::SyncUserSettings* settings = service->GetUserSettings(); - - EXPECT_TRUE(settings->IsOsSyncFeatureEnabled()); - EXPECT_TRUE(service->GetActiveDataTypes().Has(syncer::WEB_APPS)); - - settings->SetOsSyncFeatureEnabled(false); - EXPECT_FALSE(settings->IsOsSyncFeatureEnabled()); - // WEB_APPS is a browser type, so they shouldn't be affected by the OS sync. - EXPECT_TRUE(service->GetActiveDataTypes().Has(syncer::WEB_APPS)); -} -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - class SingleClientWebAppsSyncTest : public WebAppsSyncTestBase { public: SingleClientWebAppsSyncTest() : WebAppsSyncTestBase(SINGLE_CLIENT) {}
diff --git a/chrome/browser/sync/test/integration/single_client_workspace_desk_sync_test.cc b/chrome/browser/sync/test/integration/single_client_workspace_desk_sync_test.cc index dfb94c4f..91a103a 100644 --- a/chrome/browser/sync/test/integration/single_client_workspace_desk_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_workspace_desk_sync_test.cc
@@ -8,9 +8,9 @@ #include "base/test/bind.h" #include "base/test/simple_test_clock.h" #include "chrome/browser/sync/desk_sync_service_factory.h" -#include "chrome/browser/sync/test/integration/sync_consent_optional_sync_test.h" #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" #include "chrome/browser/sync/test/integration/sync_service_impl_harness.h" +#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/workspace_desk_helper.h" #include "chrome/browser/ui/browser.h" #include "components/desks_storage/core/desk_model.h" @@ -42,12 +42,9 @@ return specifics; } -// Desk Sync is a Chrome OS sync type. -// Therefore this class should subclass from SyncConsentOptionalSyncTest. -class SingleClientWorkspaceDeskSyncTest : public SyncConsentOptionalSyncTest { +class SingleClientWorkspaceDeskSyncTest : public SyncTest { public: - SingleClientWorkspaceDeskSyncTest() - : SyncConsentOptionalSyncTest(SINGLE_CLIENT) { + SingleClientWorkspaceDeskSyncTest() : SyncTest(SINGLE_CLIENT) { kTestUuid1_ = base::GUID::ParseCaseInsensitive(base::StringPrintf(kUuidFormat, 1)); } @@ -86,22 +83,6 @@ }; IN_PROC_BROWSER_TEST_F(SingleClientWorkspaceDeskSyncTest, - DisablingOsSyncFeatureDisablesDataType) { - ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; - - syncer::SyncService* service = GetSyncService(0); - syncer::SyncUserSettings* settings = service->GetUserSettings(); - - EXPECT_TRUE(settings->IsOsSyncFeatureEnabled()); - EXPECT_TRUE(service->GetActiveDataTypes().Has(syncer::WORKSPACE_DESK)); - - settings->SetOsSyncFeatureEnabled(false); - - EXPECT_FALSE(settings->IsOsSyncFeatureEnabled()); - EXPECT_FALSE(service->GetActiveDataTypes().Has(syncer::WORKSPACE_DESK)); -} - -IN_PROC_BROWSER_TEST_F(SingleClientWorkspaceDeskSyncTest, DownloadDeskTemplateWhenSyncEnabled) { // Inject a test desk template to Sync. sync_pb::EntitySpecifics specifics; @@ -117,9 +98,6 @@ ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; syncer::SyncService* sync_service = GetSyncService(0); - syncer::SyncUserSettings* settings = sync_service->GetUserSettings(); - - ASSERT_TRUE(settings->IsOsSyncFeatureEnabled()); ASSERT_TRUE(sync_service->GetActiveDataTypes().Has(syncer::WORKSPACE_DESK)); // Check the test desk template is downloaded.
diff --git a/chrome/browser/sync/test/integration/sync_consent_optional_sync_test.cc b/chrome/browser/sync/test/integration/sync_consent_optional_sync_test.cc deleted file mode 100644 index 9562e6af..0000000 --- a/chrome/browser/sync/test/integration/sync_consent_optional_sync_test.cc +++ /dev/null
@@ -1,20 +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 "chrome/browser/sync/test/integration/sync_consent_optional_sync_test.h" - -#include "ash/constants/ash_features.h" - -SyncConsentOptionalSyncTest::SyncConsentOptionalSyncTest(TestType type) - : SyncTest(type) { - // SyncSettingsCategorization is required for SyncConsentOptional. - settings_feature_list_.InitWithFeatures( - { - ash::features::kSyncSettingsCategorization, - ash::features::kSyncConsentOptional, - }, - {}); -} - -SyncConsentOptionalSyncTest::~SyncConsentOptionalSyncTest() = default;
diff --git a/chrome/browser/sync/test/integration/sync_consent_optional_sync_test.h b/chrome/browser/sync/test/integration/sync_consent_optional_sync_test.h deleted file mode 100644 index 4834c27..0000000 --- a/chrome/browser/sync/test/integration/sync_consent_optional_sync_test.h +++ /dev/null
@@ -1,29 +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 CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_CONSENT_OPTIONAL_SYNC_TEST_H_ -#define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_CONSENT_OPTIONAL_SYNC_TEST_H_ - -#include "base/test/scoped_feature_list.h" -#include "chrome/browser/sync/test/integration/sync_test.h" - -// Test suite for Chrome OS sync. Enables the SyncConsentOptional feature. -// TODO(https://crbug.com/1227417): When SyncConsentOptional is on-by-default -// this class can be deleted. -class SyncConsentOptionalSyncTest : public SyncTest { - public: - explicit SyncConsentOptionalSyncTest(TestType type); - ~SyncConsentOptionalSyncTest() override; - - SyncConsentOptionalSyncTest(const SyncConsentOptionalSyncTest&) = delete; - SyncConsentOptionalSyncTest& operator=(const SyncConsentOptionalSyncTest&) = - delete; - - private: - // The names |scoped_feature_list_| and |feature_list_| are both used in - // superclasses. - base::test::ScopedFeatureList settings_feature_list_; -}; - -#endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_CONSENT_OPTIONAL_SYNC_TEST_H_
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index 44d9601f..1abe8e2 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -668,14 +668,6 @@ } #if BUILDFLAG(IS_CHROMEOS_ASH) - // SyncSettingsCategorization makes several types (e.g. APPS, APP_LIST, - // PRINTERS) into OS sync types. OS sync is on-by-default, so enable it here. - if (chromeos::features::IsSyncSettingsCategorizationEnabled()) { - for (int i = 0; i < num_clients(); ++i) { - GetSyncService(i)->GetUserSettings()->SetOsSyncFeatureEnabled(true); - } - } - if (ArcAppListPrefsFactory::IsFactorySetForSyncTest()) { // Init SyncArcPackageHelper to ensure that the arc services are initialized // for each Profile, only can be called after test profiles are created.
diff --git a/chrome/browser/sync/test/integration/two_client_app_list_sync_test.cc b/chrome/browser/sync/test/integration/two_client_app_list_sync_test.cc index 2b39311..8dc6c15 100644 --- a/chrome/browser/sync/test/integration/two_client_app_list_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_app_list_sync_test.cc
@@ -587,53 +587,3 @@ ASSERT_TRUE(AwaitQuiescence()); ASSERT_TRUE(AllProfilesHaveSameAppList()); } - -// Tests for SyncSettingsCategorization and SyncConsentOptional. -class TwoClientAppListOsSyncTest : public TwoClientAppListSyncTest { - public: - TwoClientAppListOsSyncTest() { - settings_feature_list_.InitWithFeatures( - {chromeos::features::kSyncSettingsCategorization, - chromeos::features::kSyncConsentOptional}, - {}); - } - ~TwoClientAppListOsSyncTest() override = default; - - // SyncTest - bool SetupClients() override { - if (!TwoClientAppListSyncTest::SetupClients()) - return false; - // Enable the OS sync feature for all profiles. - for (Profile* profile : GetAllProfiles()) { - profile->GetPrefs()->SetBoolean(syncer::prefs::kOsSyncFeatureEnabled, - true); - } - return true; - } - - private: - base::test::ScopedFeatureList settings_feature_list_; -}; - -IN_PROC_BROWSER_TEST_F(TwoClientAppListOsSyncTest, DisableOsSync) { - ASSERT_TRUE(SetupSync()); - ASSERT_TRUE(AllProfilesHaveSameAppList()); - - // Disable OS sync on the second client. - PrefService* prefs = GetProfile(1)->GetPrefs(); - prefs->SetBoolean(syncer::prefs::kOsSyncFeatureEnabled, false); - - // Install a Chrome app and sync. - InstallHostedApp(GetProfile(0), 0); - ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); - - // App list didn't sync because OS sync is off. - ASSERT_FALSE(AllProfilesHaveSameAppList()); - - // Enable OS sync on the second client. - prefs->SetBoolean(syncer::prefs::kOsSyncFeatureEnabled, true); - AwaitQuiescenceAndInstallAppsPendingForSync(); - - // App list has synced. - ASSERT_TRUE(AllProfilesHaveSameAppList()); -}
diff --git a/chrome/browser/translate/translate_model_service_factory.cc b/chrome/browser/translate/translate_model_service_factory.cc index ffb3db45..6aa2ff1 100644 --- a/chrome/browser/translate/translate_model_service_factory.cc +++ b/chrome/browser/translate/translate_model_service_factory.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/translate/translate_model_service_factory.h" #include "base/memory/scoped_refptr.h" +#include "base/no_destructor.h" #include "base/task/sequenced_task_runner.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h"
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 9947982..24f42338 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -312,8 +312,8 @@ "webui/segmentation_internals/segmentation_internals_ui.h", "webui/signin_internals_ui.cc", "webui/signin_internals_ui.h", - "webui/support_tool_ui.cc", - "webui/support_tool_ui.h", + "webui/support_tool/support_tool_ui.cc", + "webui/support_tool/support_tool_ui.h", "webui/sync_internals/sync_internals_message_handler.cc", "webui/sync_internals/sync_internals_message_handler.h", "webui/sync_internals/sync_internals_ui.cc",
diff --git a/chrome/browser/ui/android/tab_model/tab_model_list.cc b/chrome/browser/ui/android/tab_model/tab_model_list.cc index cccc2c45b..4ecbdd3 100644 --- a/chrome/browser/ui/android/tab_model/tab_model_list.cc +++ b/chrome/browser/ui/android/tab_model/tab_model_list.cc
@@ -4,7 +4,6 @@ #include "chrome/browser/ui/android/tab_model/tab_model_list.h" -#include "base/no_destructor.h" #include "chrome/browser/android/tab_android.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/android/tab_model/tab_model.h"
diff --git a/chrome/browser/ui/app_list/arc/arc_package_sync_model_type_controller.cc b/chrome/browser/ui/app_list/arc/arc_package_sync_model_type_controller.cc index bc1a6fe7..a6decf2 100644 --- a/chrome/browser/ui/app_list/arc/arc_package_sync_model_type_controller.cc +++ b/chrome/browser/ui/app_list/arc/arc_package_sync_model_type_controller.cc
@@ -67,16 +67,6 @@ } arc_prefs_->AddObserver(this); - - // See GetPreconditionState(). - if (chromeos::features::IsSyncSettingsCategorizationEnabled()) { - pref_registrar_.Init(profile_->GetPrefs()); - pref_registrar_.Add( - syncer::prefs::kOsSyncFeatureEnabled, - base::BindRepeating( - &ArcPackageSyncModelTypeController::OnOsSyncFeaturePrefChanged, - base::Unretained(this))); - } } ArcPackageSyncModelTypeController::~ArcPackageSyncModelTypeController() { @@ -93,12 +83,6 @@ if (!arc::IsArcPlayStoreEnabledForProfile(profile_)) { return PreconditionState::kMustStopAndClearData; } - // Use OS sync feature consent for this ModelType because it can sync in - // transport-only mode (and hence isn't tied to browser sync consent). - if (chromeos::features::IsSyncSettingsCategorizationEnabled() && - !profile_->GetPrefs()->GetBoolean(syncer::prefs::kOsSyncFeatureEnabled)) { - return PreconditionState::kMustStopAndClearData; - } // Implementing a wait here in the controller, instead of the regular wait in // the SyncableService, allows waiting again after this particular datatype // has been disabled and reenabled (since core sync code does not support the
diff --git a/chrome/browser/ui/app_list/arc/arc_package_sync_model_type_controller.h b/chrome/browser/ui/app_list/arc/arc_package_sync_model_type_controller.h index ea201ee4b..aa63a77 100644 --- a/chrome/browser/ui/app_list/arc/arc_package_sync_model_type_controller.h +++ b/chrome/browser/ui/app_list/arc/arc_package_sync_model_type_controller.h
@@ -63,7 +63,6 @@ syncer::SyncService* const sync_service_; Profile* const profile_; ArcAppListPrefs* const arc_prefs_; - PrefChangeRegistrar pref_registrar_; }; #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_PACKAGE_SYNC_MODEL_TYPE_CONTROLLER_H_
diff --git a/chrome/browser/ui/ash/accessibility/ax_tree_source_aura_unittest.cc b/chrome/browser/ui/ash/accessibility/ax_tree_source_aura_unittest.cc index f08ae74..0ee486e 100644 --- a/chrome/browser/ui/ash/accessibility/ax_tree_source_aura_unittest.cc +++ b/chrome/browser/ui/ash/accessibility/ax_tree_source_aura_unittest.cc
@@ -168,8 +168,8 @@ // This is the initial serialization. ax_serializer.SerializeChanges(ax_tree.GetRoot(), &out_update); - // The update should be the desktop node and the Lacros host node. - ASSERT_EQ(2U, out_update.nodes.size()); + // The update should be the desktop node. + ASSERT_EQ(1U, out_update.nodes.size()); // Try removing some child views and re-adding which should fire some events. content_->RemoveAllChildViewsWithoutDeleting();
diff --git a/chrome/browser/ui/ash/app_icon_color_cache.cc b/chrome/browser/ui/ash/app_icon_color_cache.cc index bee57b2..91419f2 100644 --- a/chrome/browser/ui/ash/app_icon_color_cache.cc +++ b/chrome/browser/ui/ash/app_icon_color_cache.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ui/ash/app_icon_color_cache.h" +#include "base/no_destructor.h" #include "ui/gfx/color_analysis.h" #include "ui/gfx/image/image_skia.h"
diff --git a/chrome/browser/ui/ash/calendar/calendar_keyed_service_factory.cc b/chrome/browser/ui/ash/calendar/calendar_keyed_service_factory.cc index 428bef3..5859b63 100644 --- a/chrome/browser/ui/ash/calendar/calendar_keyed_service_factory.cc +++ b/chrome/browser/ui/ash/calendar/calendar_keyed_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ui/ash/calendar/calendar_keyed_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/identity_manager_factory.h"
diff --git a/chrome/browser/ui/ash/keyboard/chrome_keyboard_ui.cc b/chrome/browser/ui/ash/keyboard/chrome_keyboard_ui.cc index 038ba09..101e567 100644 --- a/chrome/browser/ui/ash/keyboard/chrome_keyboard_ui.cc +++ b/chrome/browser/ui/ash/keyboard/chrome_keyboard_ui.cc
@@ -11,7 +11,6 @@ #include "ash/shell.h" #include "base/bind.h" #include "base/callback_helpers.h" -#include "base/no_destructor.h" #include "chrome/browser/ui/ash/keyboard/chrome_keyboard_bounds_observer.h" #include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h" #include "chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.h"
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc index 057ce9b1..3f49277 100644 --- a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc +++ b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc
@@ -452,13 +452,6 @@ extension_system->ready().Post(FROM_HERE, run_loop.QuitClosure()); run_loop.Run(); - // Many pinned app tests assume OS sync is enabled. - if (chromeos::features::IsSyncSettingsCategorizationEnabled()) { - syncer::SyncService* sync_service = - SyncServiceFactory::GetForProfile(profile()); - sync_service->GetUserSettings()->SetOsSyncFeatureEnabled(true); - } - app_list_syncable_service_ = app_list::AppListSyncableServiceFactory::GetForProfile(profile()); StartAppSyncService(app_list_syncable_service_->GetAllSyncDataForTesting()); @@ -1174,16 +1167,11 @@ public: ChromeShelfControllerTest() { if (ShouldEnableSyncSettingsCategorization()) { - feature_list_.InitWithFeatures( - /*enabled_features=*/{chromeos::features:: - kSyncSettingsCategorization}, - /*disabled_features=*/{chromeos::features::kSyncConsentOptional}); + feature_list_.InitAndEnableFeature( + chromeos::features::kSyncSettingsCategorization); } else { - feature_list_.InitWithFeatures( - /*enabled_features=*/{}, - /*disabled_features=*/{ - chromeos::features::kSyncSettingsCategorization, - chromeos::features::kSyncConsentOptional}); + feature_list_.InitAndDisableFeature( + chromeos::features::kSyncSettingsCategorization); } } ~ChromeShelfControllerTest() override = default; @@ -1194,24 +1182,6 @@ base::test::ScopedFeatureList feature_list_; }; -// Tests for feature SyncConsentOptional. Exists as a separate class -// because the feature must be initialized before -// ChromeShelfControllerTestBase::SetUp(). -class ChromeShelfControllerSyncConsentOptionalTest - : public ChromeShelfControllerTestBase { - public: - ChromeShelfControllerSyncConsentOptionalTest() { - feature_list_.InitWithFeatures( - /*enabled_features=*/{chromeos::features::kSyncSettingsCategorization, - chromeos::features::kSyncConsentOptional}, - /*disabled_features=*/{}); - } - ~ChromeShelfControllerSyncConsentOptionalTest() override = default; - - private: - base::test::ScopedFeatureList feature_list_; -}; - // Tests for Lacros integration. Exists as a separate class because the feature // must be initialized before ChromeShelfControllerTestBase::SetUp(). class ChromeShelfControllerLacrosTest : public ChromeShelfControllerTestBase { @@ -1554,26 +1524,6 @@ GetPinnedAppStatus()); } -TEST_F(ChromeShelfControllerSyncConsentOptionalTest, PreinstalledApps) { - // Simulate a user who opted out of sync. - syncer::SyncService* sync_service = - SyncServiceFactory::GetForProfile(profile()); - sync_service->GetUserSettings()->SetOsSyncFeatureEnabled(false); - - InitShelfController(); - EXPECT_EQ("Chrome", GetPinnedAppStatus()); - - // Simulate the preinstalled app loader installing some apps. Don't start the - // pref sync service, because this user opted out of sync. - AddWebApp(web_app::kYoutubeAppId); - AddWebApp(web_app::kMessagesAppId); - AddWebApp(web_app::kGmailAppId); - AddWebApp(web_app::kGoogleDocsAppId); - - // Default apps are pinned. - EXPECT_EQ("Chrome, Gmail, Messages, Youtube", GetPinnedAppStatus()); -} - TEST_F(ChromeShelfControllerLacrosTest, LacrosPinnedByDefault) { InitShelfController(); EXPECT_EQ("Chrome, Lacros", GetPinnedAppStatus());
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_prefs.cc b/chrome/browser/ui/ash/shelf/chrome_shelf_prefs.cc index 164f457a..081c8d51 100644 --- a/chrome/browser/ui/ash/shelf/chrome_shelf_prefs.cc +++ b/chrome/browser/ui/ash/shelf/chrome_shelf_prefs.cc
@@ -138,8 +138,7 @@ // apps is likely override it. There is a case when App sync is disabled and // in last case local cache is available immediately. if (chromeos::features::IsSyncSettingsCategorizationEnabled()) { - if (settings->IsOsSyncFeatureEnabled() && - settings->GetSelectedOsTypes().Has(UserSelectableOsType::kOsApps) && + if (settings->GetSelectedOsTypes().Has(UserSelectableOsType::kOsApps) && !app_list::AppListSyncableServiceFactory::GetForProfile(profile) ->IsSyncing()) { return false; @@ -156,8 +155,7 @@ // If shelf pin layout rolls preference is not started yet then we cannot say // if we rolled layout or not. if (chromeos::features::IsSyncSettingsCategorizationEnabled()) { - if (settings->IsOsSyncFeatureEnabled() && - settings->GetSelectedOsTypes().Has( + if (settings->GetSelectedOsTypes().Has( UserSelectableOsType::kOsPreferences) && !PrefServiceSyncableFromProfile(profile)->AreOsPrefsSyncing()) { return false;
diff --git a/chrome/browser/ui/ash/wallpaper_controller_client_impl.cc b/chrome/browser/ui/ash/wallpaper_controller_client_impl.cc index 76f6b22..9e6aa2f 100644 --- a/chrome/browser/ui/ash/wallpaper_controller_client_impl.cc +++ b/chrome/browser/ui/ash/wallpaper_controller_client_impl.cc
@@ -538,9 +538,8 @@ return false; if (chromeos::features::IsSyncSettingsCategorizationEnabled()) { // If in client use profile otherwise use GetUserPrefServiceSyncable. - return sync_service->GetUserSettings()->IsOsSyncFeatureEnabled() && - profile->GetPrefs()->GetBoolean( - chromeos::settings::prefs::kSyncOsWallpaper); + return profile->GetPrefs()->GetBoolean( + chromeos::settings::prefs::kSyncOsWallpaper); } return sync_service->CanSyncFeatureStart() && sync_service->GetUserSettings()->GetSelectedTypes().Has(
diff --git a/chrome/browser/ui/commander/commander.cc b/chrome/browser/ui/commander/commander.cc index d884676..5b22a1f 100644 --- a/chrome/browser/ui/commander/commander.cc +++ b/chrome/browser/ui/commander/commander.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ui/commander/commander.h" +#include "base/no_destructor.h" #include "chrome/browser/ui/commander/commander_controller.h" #include "chrome/browser/ui/commander/commander_frontend.h" #include "chrome/browser/ui/ui_features.h"
diff --git a/chrome/browser/ui/extensions/extension_settings_overridden_dialog.cc b/chrome/browser/ui/extensions/extension_settings_overridden_dialog.cc index 2a9fa8ed..26c102fe 100644 --- a/chrome/browser/ui/extensions/extension_settings_overridden_dialog.cc +++ b/chrome/browser/ui/extensions/extension_settings_overridden_dialog.cc
@@ -8,7 +8,6 @@ #include <utility> #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "base/supports_user_data.h" #include "chrome/browser/extensions/extension_service.h" #include "extensions/browser/disable_reason.h"
diff --git a/chrome/browser/ui/find_bar/find_bar_controller.cc b/chrome/browser/ui/find_bar/find_bar_controller.cc index e7d98fd..abab1b9 100644 --- a/chrome/browser/ui/find_bar/find_bar_controller.cc +++ b/chrome/browser/ui/find_bar/find_bar_controller.cc
@@ -7,7 +7,6 @@ #include <algorithm> #include "base/check_op.h" -#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "build/build_config.h" #include "chrome/browser/ui/find_bar/find_bar.h"
diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc index 16ad496..7b3d912 100644 --- a/chrome/browser/ui/startup/startup_browser_creator.cc +++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -516,8 +516,6 @@ bool expect_incognito = command_line.HasSwitch(switches::kIncognito); #if BUILDFLAG(IS_CHROMEOS_LACROS) auto* init_params = chromeos::LacrosService::Get()->init_params(); - // TODO(https://crbug.com/1194304): Remove in M93. - expect_incognito |= init_params->is_incognito_deprecated; expect_incognito |= init_params->initial_browser_action == crosapi::mojom::InitialBrowserAction::kOpenIncognitoWindow; @@ -707,8 +705,6 @@ pref.type = SessionStartupPref::DEFAULT; return pref; } - // TODO(https://crbug.com/1194304): Remove in M93. - restore_last_session |= init_params->restore_last_session_deprecated; restore_last_session |= init_params->initial_browser_action == crosapi::mojom::InitialBrowserAction::kRestoreLastSession;
diff --git a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc index ee3f89b..fb471325 100644 --- a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc +++ b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc
@@ -120,7 +120,7 @@ } } -bool TabContentsSyncedTabDelegate::ProfileIsSupervised() const { +bool TabContentsSyncedTabDelegate::ProfileHasChildAccount() const { return Profile::FromBrowserContext(web_contents_->GetBrowserContext()) ->IsChild(); } @@ -145,7 +145,7 @@ GetWindowId()) == nullptr) return false; - if (ProfileIsSupervised() && !GetBlockedNavigations()->empty()) + if (ProfileHasChildAccount() && !GetBlockedNavigations()->empty()) return true; if (IsInitialBlankNavigation())
diff --git a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h index d2b5d00..6a8a71e 100644 --- a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h +++ b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h
@@ -46,7 +46,7 @@ void GetSerializedNavigationAtIndex( int i, sessions::SerializedNavigationEntry* serialized_entry) const override; - bool ProfileIsSupervised() const override; + bool ProfileHasChildAccount() const override; const std::vector<std::unique_ptr<const sessions::SerializedNavigationEntry>>* GetBlockedNavigations() const override; bool ShouldSync(sync_sessions::SyncSessionsClient* sessions_client) override;
diff --git a/chrome/browser/ui/thumbnails/thumbnail_stats_tracker.cc b/chrome/browser/ui/thumbnails/thumbnail_stats_tracker.cc index 2edad33..a3b9176 100644 --- a/chrome/browser/ui/thumbnails/thumbnail_stats_tracker.cc +++ b/chrome/browser/ui/thumbnails/thumbnail_stats_tracker.cc
@@ -7,7 +7,6 @@ #include "base/bind.h" #include "base/location.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/time/time.h" #include "chrome/browser/ui/thumbnails/thumbnail_image.h"
diff --git a/chrome/browser/ui/user_education/tutorial/tutorial_bubble_factory_registry.cc b/chrome/browser/ui/user_education/tutorial/tutorial_bubble_factory_registry.cc index 4f123c4..e850561 100644 --- a/chrome/browser/ui/user_education/tutorial/tutorial_bubble_factory_registry.cc +++ b/chrome/browser/ui/user_education/tutorial/tutorial_bubble_factory_registry.cc
@@ -6,7 +6,6 @@ #include <memory> -#include "base/no_destructor.h" #include "chrome/browser/ui/user_education/tutorial/tutorial_bubble_factory.h" #include "ui/base/interaction/element_tracker.h"
diff --git a/chrome/browser/ui/user_education/tutorial/tutorial_registry.cc b/chrome/browser/ui/user_education/tutorial/tutorial_registry.cc index 8797918..a963c546 100644 --- a/chrome/browser/ui/user_education/tutorial/tutorial_registry.cc +++ b/chrome/browser/ui/user_education/tutorial/tutorial_registry.cc
@@ -7,7 +7,6 @@ #include <memory> #include <vector> -#include "base/no_destructor.h" #include "chrome/browser/ui/user_education/tutorial/tutorial.h" #include "chrome/browser/ui/user_education/tutorial/tutorial_description.h"
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc index 251a473..d5c14405 100644 --- a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc +++ b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc
@@ -7,7 +7,6 @@ #include <memory> #include "base/containers/contains.h" -#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "build/build_config.h" #include "chrome/browser/autofill/mock_autofill_popup_controller.h"
diff --git a/chrome/browser/ui/views/bubble/bubble_contents_wrapper_service_factory.cc b/chrome/browser/ui/views/bubble/bubble_contents_wrapper_service_factory.cc index 8839e25..ea816ea 100644 --- a/chrome/browser/ui/views/bubble/bubble_contents_wrapper_service_factory.cc +++ b/chrome/browser/ui/views/bubble/bubble_contents_wrapper_service_factory.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ui/views/bubble/bubble_contents_wrapper_service_factory.h" #include "base/memory/singleton.h" +#include "base/no_destructor.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/views/bubble/bubble_contents_wrapper_service.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chrome/browser/ui/views/collected_cookies_views.cc b/chrome/browser/ui/views/collected_cookies_views.cc index 40b31c5..a5d4a51 100644 --- a/chrome/browser/ui/views/collected_cookies_views.cc +++ b/chrome/browser/ui/views/collected_cookies_views.cc
@@ -179,6 +179,8 @@ SkColor GetTextColorForNode(views::TreeView* tree_view, ui::TreeModelNode* node) override; + SkColor GetAuxiliaryTextColorForNode(views::TreeView* tree_view, + ui::TreeModelNode* node) override; std::u16string GetAuxiliaryTextForNode(views::TreeView* tree_view, ui::TreeModelNode* node) override; bool ShouldDrawIconForNode(views::TreeView* tree_view, @@ -202,11 +204,26 @@ return color; } +SkColor CookiesTreeViewDrawingProvider::GetAuxiliaryTextColorForNode( + views::TreeView* tree_view, + ui::TreeModelNode* node) { + SkColor color = TreeViewDrawingProvider::GetTextColorForNode(tree_view, node); + return SkColorSetA(color, 0x80); +} + std::u16string CookiesTreeViewDrawingProvider::GetAuxiliaryTextForNode( views::TreeView* tree_view, ui::TreeModelNode* node) { if (annotations_.find(node) != annotations_.end()) return annotations_[node]; + + CookieTreeNode* cookie_node = static_cast<CookieTreeNode*>(node); + if (cookie_node->GetDetailedInfo().node_type == + CookieTreeNode::DetailedInfo::TYPE_COOKIE && + cookie_node->GetDetailedInfo().cookie->IsPartitioned()) { + return l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_PARTITIONED_COOKIE); + } + return TreeViewDrawingProvider::GetAuxiliaryTextForNode(tree_view, node); }
diff --git a/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc b/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc index a34dbb26..86ef3dc 100644 --- a/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc +++ b/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc
@@ -9,6 +9,7 @@ #include "base/callback_helpers.h" #include "base/cxx17_backports.h" #include "base/feature_list.h" +#include "base/no_destructor.h" #include "build/build_config.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h"
diff --git a/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc b/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc index 96ab01d..07f531cb 100644 --- a/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc +++ b/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc
@@ -9,6 +9,7 @@ #include "base/containers/contains.h" #include "base/containers/flat_set.h" #include "base/memory/raw_ptr.h" +#include "base/no_destructor.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" #include "chrome/browser/ui/views/frame/contents_layout_manager.h"
diff --git a/chrome/browser/ui/views/tabs/tab_close_button.cc b/chrome/browser/ui/views/tabs/tab_close_button.cc index 491d1e5..8269f6e 100644 --- a/chrome/browser/ui/views/tabs/tab_close_button.cc +++ b/chrome/browser/ui/views/tabs/tab_close_button.cc
@@ -9,7 +9,6 @@ #include <vector> #include "base/hash/hash.h" -#include "base/no_destructor.h" #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/ui/layout_constants.h" #include "chrome/browser/ui/views/tabs/tab.h"
diff --git a/chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.cc b/chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.cc index dbfc270..89edc1e 100644 --- a/chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.cc +++ b/chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.cc
@@ -16,7 +16,6 @@ #include "base/memory/raw_ptr.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" -#include "base/no_destructor.h" #include "base/strings/utf_string_conversions.h" #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/ui/browser.h"
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index dda2eb8..22a44fb 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -28,7 +28,6 @@ #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" -#include "base/no_destructor.h" #include "base/numerics/safe_conversions.h" #include "base/scoped_observation.h" #include "base/stl_util.h"
diff --git a/chrome/browser/ui/web_applications/system_web_app_delegate_ui_impl.cc b/chrome/browser/ui/web_applications/system_web_app_delegate_ui_impl.cc index e278eef..52c9b44 100644 --- a/chrome/browser/ui/web_applications/system_web_app_delegate_ui_impl.cc +++ b/chrome/browser/ui/web_applications/system_web_app_delegate_ui_impl.cc
@@ -14,7 +14,7 @@ #include "chrome/browser/ui/web_applications/web_app_launch_utils.h" #include "chrome/browser/web_applications/os_integration_manager.h" #include "chrome/browser/web_applications/web_app_provider.h" -#include "chrome/browser/web_launch/web_launch_files_helper.h" +#include "chrome/browser/web_applications/web_launch_params_helper.h" #include "content/public/browser/web_contents.h" #include "url/gurl.h" @@ -77,12 +77,11 @@ // Send launch files. if (provider->os_integration_manager().IsFileHandlingAPIAvailable( params.app_id)) { - GURL app_scope = provider->registrar().GetAppScope(params.app_id); base::FilePath launch_dir = GetLaunchDirectory(params); if (!launch_dir.empty() || !params.launch_files.empty()) { - web_launch::WebLaunchFilesHelper::EnqueueLaunchParams( - web_contents, app_scope, + WebLaunchParamsHelper::EnqueueLaunchParams( + web_contents, provider->registrar(), params.app_id, /*await_navigation=*/navigating, /*launch_url=*/web_contents->GetURL(), launch_dir, params.launch_files);
diff --git a/chrome/browser/ui/web_applications/system_web_app_ui_utils.cc b/chrome/browser/ui/web_applications/system_web_app_ui_utils.cc index 9b61c8a..cb9f953 100644 --- a/chrome/browser/ui/web_applications/system_web_app_ui_utils.cc +++ b/chrome/browser/ui/web_applications/system_web_app_ui_utils.cc
@@ -28,7 +28,6 @@ #include "chrome/browser/web_applications/web_app_helpers.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_registrar.h" -#include "chrome/browser/web_launch/web_launch_files_helper.h" #include "chrome/common/webui_url_constants.h" #include "content/public/browser/web_contents.h" #include "ui/base/window_open_disposition.h"
diff --git a/chrome/browser/ui/web_applications/web_app_launch_process.cc b/chrome/browser/ui/web_applications/web_app_launch_process.cc index 0e42cc1f..4bc79964 100644 --- a/chrome/browser/ui/web_applications/web_app_launch_process.cc +++ b/chrome/browser/ui/web_applications/web_app_launch_process.cc
@@ -27,7 +27,7 @@ #include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/browser/web_applications/web_app_sync_bridge.h" #include "chrome/browser/web_applications/web_app_tab_helper.h" -#include "chrome/browser/web_launch/web_launch_files_helper.h" +#include "chrome/browser/web_applications/web_launch_params_helper.h" #include "components/services/app_service/public/cpp/intent_util.h" #include "components/site_engagement/content/site_engagement_service.h" #include "extensions/common/constants.h" @@ -346,8 +346,8 @@ content::WebContents* web_contents, bool is_navigating) { if (is_file_handling || web_app_->launch_handler().has_value()) { - web_launch::WebLaunchFilesHelper::EnqueueLaunchParams( - web_contents, provider_.registrar().GetAppScope(web_app_->app_id()), + WebLaunchParamsHelper::EnqueueLaunchParams( + web_contents, provider_.registrar(), web_app_->app_id(), /*await_navigation=*/is_navigating, launch_url, /*launch_dir=*/{}, is_file_handling ? params_.launch_files
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index 916ae159..be000ef 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -57,7 +57,7 @@ #include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h" #include "chrome/browser/ui/webui/segmentation_internals/segmentation_internals_ui.h" #include "chrome/browser/ui/webui/signin_internals_ui.h" -#include "chrome/browser/ui/webui/support_tool_ui.h" +#include "chrome/browser/ui/webui/support_tool/support_tool_ui.h" #include "chrome/browser/ui/webui/sync_internals/sync_internals_ui.h" #include "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h" #include "chrome/browser/ui/webui/usb_internals/usb_internals_ui.h"
diff --git a/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_state_tracker.cc b/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_state_tracker.cc index 188d1da..73fd627 100644 --- a/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_state_tracker.cc +++ b/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_state_tracker.cc
@@ -9,6 +9,7 @@ #include "base/containers/contains.h" #include "base/logging.h" #include "base/metrics/histogram_functions.h" +#include "base/no_destructor.h" #include "content/public/browser/web_ui.h" namespace chromeos {
diff --git a/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.cc index b4d4f988..2ba5af4 100644 --- a/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.cc
@@ -70,8 +70,7 @@ constexpr StaticOobeScreenId SyncConsentScreenView::kScreenId; -// TODO(https://crbug.com/1229582) Break SplitSettings names into -// SyncConsentOptional and SyncSettingsCategorization in the whole file. +// TODO(https://crbug.com/1229582): Remove SplitSettings from names in this file SyncConsentScreenHandler::SyncConsentScreenHandler( JSCallsContainer* js_calls_container) : BaseScreenHandler(kScreenId, js_calls_container) { @@ -126,7 +125,8 @@ RememberLocalizedValue("syncConsentTurnOnSync", IDS_LOGIN_SYNC_CONSENT_SCREEN_TURN_ON_SYNC, builder); - // SplitSettingsSync strings. + // TODO(https://crbug.com/1278325): Remove this strings after removing + // the corresponding UI. RememberLocalizedValue("syncConsentScreenSplitSettingsTitle", IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE, builder); RememberLocalizedValue("syncConsentScreenSplitSettingsSubtitle", @@ -168,8 +168,6 @@ auto* user_manager = user_manager::UserManager::Get(); base::DictionaryValue data; data.SetBoolean("isChildAccount", user_manager->IsLoggedInAsChildUser()); - data.SetBoolean("syncConsentOptionalEnabled", - chromeos::features::IsSyncConsentOptionalEnabled()); ShowScreenWithData(kScreenId, &data); } @@ -199,7 +197,6 @@ const bool review_sync, const login::StringList& consent_description, const std::string& consent_confirmation) { - DCHECK(!chromeos::features::IsSyncConsentOptionalEnabled()); std::vector<int> consent_description_ids; int consent_confirmation_id; GetConsentIDs(known_string_ids_, consent_description, consent_confirmation, @@ -217,32 +214,15 @@ void SyncConsentScreenHandler::HandleAcceptAndContinue( const login::StringList& consent_description, const std::string& consent_confirmation) { - Continue(consent_description, consent_confirmation, UserChoice::kAccepted); + NOTREACHED(); + // TODO(https://crbug.com/1278325): Remove this. } void SyncConsentScreenHandler::HandleDeclineAndContinue( const login::StringList& consent_description, const std::string& consent_confirmation) { - Continue(consent_description, consent_confirmation, UserChoice::kDeclined); -} - -void SyncConsentScreenHandler::Continue( - const login::StringList& consent_description, - const std::string& consent_confirmation, - UserChoice choice) { - DCHECK(chromeos::features::IsSyncConsentOptionalEnabled()); - std::vector<int> consent_description_ids; - int consent_confirmation_id; - GetConsentIDs(known_string_ids_, consent_description, consent_confirmation, - &consent_description_ids, &consent_confirmation_id); - screen_->OnContinue(consent_description_ids, consent_confirmation_id, choice); - - SyncConsentScreen::SyncConsentScreenTestDelegate* test_delegate = - screen_->GetDelegateForTesting(); - if (test_delegate) { - test_delegate->OnConsentRecordedStrings(consent_description, - consent_confirmation); - } + NOTREACHED(); + // TODO(https://crbug.com/1278325): Remove this. } } // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.h index 9534646..50a3b5a3 100644 --- a/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.h
@@ -82,16 +82,12 @@ const std::string& consent_confirmation); // WebUI message handlers for SplitSettingsSync. + // TODO(https://crbug.com/1278325): Remove these. void HandleAcceptAndContinue(const ::login::StringList& consent_description, const std::string& consent_confirmation); void HandleDeclineAndContinue(const ::login::StringList& consent_description, const std::string& consent_confirmation); - // Helper for the accept and decline cases. - void Continue(const ::login::StringList& consent_description, - const std::string& consent_confirmation, - UserChoice choice); - // Adds resource `resource_id` both to `builder` and to `known_string_ids_`. void RememberLocalizedValue(const std::string& name, const int resource_id,
diff --git a/chrome/browser/ui/webui/chromeos/sync/os_sync_handler.cc b/chrome/browser/ui/webui/chromeos/sync/os_sync_handler.cc index dae3f19..d8fb81c6 100644 --- a/chrome/browser/ui/webui/chromeos/sync/os_sync_handler.cc +++ b/chrome/browser/ui/webui/chromeos/sync/os_sync_handler.cc
@@ -33,7 +33,6 @@ OSSyncHandler::~OSSyncHandler() { RemoveSyncServiceObserver(); - CommitFeatureEnabledPref(); } void OSSyncHandler::RegisterMessages() { @@ -50,10 +49,6 @@ base::BindRepeating(&OSSyncHandler::HandleOsSyncPrefsDispatch, base::Unretained(this))); web_ui()->RegisterDeprecatedMessageCallback( - "SetOsSyncFeatureEnabled", - base::BindRepeating(&OSSyncHandler::HandleSetOsSyncFeatureEnabled, - base::Unretained(this))); - web_ui()->RegisterDeprecatedMessageCallback( "SetOsSyncDatatypes", base::BindRepeating(&OSSyncHandler::HandleSetOsSyncDatatypes, base::Unretained(this))); @@ -79,25 +74,12 @@ void OSSyncHandler::HandleOsSyncPrefsDispatch(const base::ListValue* args) { AllowJavascript(); - // Cache the feature enabled pref. - SyncService* service = GetSyncService(); - if (service) - feature_enabled_ = service->GetUserSettings()->IsOsSyncFeatureEnabled(); PushSyncPrefs(); } void OSSyncHandler::HandleDidNavigateAwayFromOsSyncPage( const base::ListValue* args) { - CommitFeatureEnabledPref(); -} - -void OSSyncHandler::HandleSetOsSyncFeatureEnabled(const base::ListValue* args) { - const auto& list = args->GetList(); - CHECK(!list.empty()); - feature_enabled_ = list[0].GetBool(); - should_commit_feature_enabled_ = true; - // Changing the feature enabled state may change toggle state. - PushSyncPrefs(); + // TODO(https://crbug.com/1278325): Remove this. } void OSSyncHandler::HandleSetOsSyncDatatypes(const base::ListValue* args) { @@ -148,16 +130,6 @@ set_web_ui(web_ui); } -void OSSyncHandler::CommitFeatureEnabledPref() { - if (!should_commit_feature_enabled_) - return; - SyncService* service = GetSyncService(); - if (!service) - return; - service->GetUserSettings()->SetOsSyncFeatureEnabled(feature_enabled_); - should_commit_feature_enabled_ = false; -} - void OSSyncHandler::PushSyncPrefs() { syncer::SyncService* service = GetSyncService(); // The sync service may be nullptr if it has been just disabled by policy. @@ -185,8 +157,7 @@ profile_->GetPrefs()->GetBoolean( chromeos::settings::prefs::kSyncOsWallpaper)); - FireWebUIListener("os-sync-prefs-changed", base::Value(feature_enabled_), - args); + FireWebUIListener("os-sync-prefs-changed", args); } syncer::SyncService* OSSyncHandler::GetSyncService() const {
diff --git a/chrome/browser/ui/webui/chromeos/sync/os_sync_handler.h b/chrome/browser/ui/webui/chromeos/sync/os_sync_handler.h index 23c772e..4c2609b 100644 --- a/chrome/browser/ui/webui/chromeos/sync/os_sync_handler.h +++ b/chrome/browser/ui/webui/chromeos/sync/os_sync_handler.h
@@ -42,15 +42,11 @@ void HandleDidNavigateToOsSyncPage(const base::ListValue* args); void HandleDidNavigateAwayFromOsSyncPage(const base::ListValue* args); void HandleOsSyncPrefsDispatch(const base::ListValue* args); - void HandleSetOsSyncFeatureEnabled(const base::ListValue* args); void HandleSetOsSyncDatatypes(const base::ListValue* args); void SetWebUIForTest(content::WebUI* web_ui); private: - // Sets the OS sync feature enabled pref if the user changed the setting. - void CommitFeatureEnabledPref(); - // Pushes the updated sync prefs to JavaScript. void PushSyncPrefs(); @@ -62,13 +58,6 @@ Profile* const profile_; - // Cached copy of the OS sync feature enabled pref. Used to avoid turning on - // OS sync before the user is done configuring the toggles. - bool feature_enabled_ = false; - - // Whether to commit the feature enabled state when the user closes the UI. - bool should_commit_feature_enabled_ = false; - // Prevents messages to JS layer while data type prefs are being set. bool is_setting_prefs_ = false; };
diff --git a/chrome/browser/ui/webui/chromeos/sync/os_sync_handler_unittest.cc b/chrome/browser/ui/webui/chromeos/sync/os_sync_handler_unittest.cc index 5fec615..f28a65a2 100644 --- a/chrome/browser/ui/webui/chromeos/sync/os_sync_handler_unittest.cc +++ b/chrome/browser/ui/webui/chromeos/sync/os_sync_handler_unittest.cc
@@ -145,9 +145,7 @@ EXPECT_TRUE(event); EXPECT_EQ(*event, "os-sync-prefs-changed"); - EXPECT_TRUE(call_data.arg2()->is_bool()); - *feature_enabled = call_data.arg2()->GetBool(); - EXPECT_TRUE(call_data.arg3()->GetAsDictionary(os_sync_prefs)); + EXPECT_TRUE(call_data.arg2()->GetAsDictionary(os_sync_prefs)); } void NotifySyncStateChanged() { handler_->OnStateChanged(sync_service_); } @@ -173,7 +171,6 @@ }; TEST_F(OsSyncHandlerTest, OsSyncPrefsSentOnNavigateToPage) { - user_settings_->SetOsSyncFeatureEnabled(true); handler_->HandleDidNavigateToOsSyncPage(nullptr); ASSERT_EQ(1U, web_ui_.call_data().size()); @@ -181,19 +178,6 @@ std::string event_name = call_data.arg1()->GetString(); EXPECT_EQ(event_name, "os-sync-prefs-changed"); - - bool feature_enabled = call_data.arg2()->GetBool(); - EXPECT_TRUE(feature_enabled); -} - -TEST_F(OsSyncHandlerTest, OsSyncPrefsWhenFeatureIsDisabled) { - user_settings_->SetOsSyncFeatureEnabled(false); - handler_->HandleDidNavigateToOsSyncPage(nullptr); - - ASSERT_EQ(1U, web_ui_.call_data().size()); - const TestWebUI::CallData& call_data = *web_ui_.call_data().back(); - bool feature_enabled = call_data.arg2()->GetBool(); - EXPECT_FALSE(feature_enabled); } TEST_F(OsSyncHandlerTest, OpenConfigPageBeforeSyncEngineInitialized) { @@ -227,38 +211,6 @@ EXPECT_FALSE(user_settings_->IsSyncRequested()); } -TEST_F(OsSyncHandlerTest, UserEnablesFeatureThenNavigatesAway) { - // Open the page with the feature disabled. - user_settings_->SetOsSyncFeatureEnabled(false); - handler_->HandleDidNavigateToOsSyncPage(nullptr); - - // Clicking "Turn on" doesn't set the pref yet. - base::ListValue args; - args.Append(base::Value(true)); // feature_enabled - handler_->HandleSetOsSyncFeatureEnabled(&args); - EXPECT_FALSE(user_settings_->IsOsSyncFeatureEnabled()); - - // The pref is set when the user navigates away. - handler_->HandleDidNavigateAwayFromOsSyncPage(nullptr); - EXPECT_TRUE(user_settings_->IsOsSyncFeatureEnabled()); -} - -TEST_F(OsSyncHandlerTest, UserEnablesFeatureThenClosesSettings) { - // Open the page with the feature disabled. - user_settings_->SetOsSyncFeatureEnabled(false); - handler_->HandleDidNavigateToOsSyncPage(nullptr); - - // Clicking "Turn on" doesn't set the pref yet. - base::ListValue args; - args.Append(base::Value(true)); // feature_enabled - handler_->HandleSetOsSyncFeatureEnabled(&args); - EXPECT_FALSE(user_settings_->IsOsSyncFeatureEnabled()); - - // The pref is set when the settings window closes and destroys the handler. - handler_.reset(); - EXPECT_TRUE(user_settings_->IsOsSyncFeatureEnabled()); -} - TEST_F(OsSyncHandlerTest, TestSyncEverything) { base::ListValue list_args; list_args.Append(CreateOsSyncPrefs(SYNC_ALL_OS_TYPES,
diff --git a/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_ui.cc b/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_ui.cc index 35347cd..890fb5e0 100644 --- a/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_ui.cc +++ b/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_ui.cc
@@ -13,6 +13,8 @@ #include "chrome/grit/browser_resources.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_data_source.h" +#include "services/network/public/mojom/content_security_policy.mojom.h" +#include "ui/resources/grit/webui_generated_resources.h" SysInternalsUI::SysInternalsUI(content::WebUI* web_ui) : content::WebUIController(web_ui) { @@ -20,14 +22,35 @@ content::WebUIDataSource* html_source = content::WebUIDataSource::Create(chrome::kChromeUISysInternalsHost); - html_source->SetDefaultResource(IDR_SYS_INTERNALS_HTML); + html_source->DisableTrustedTypesCSP(); + html_source->OverrideContentSecurityPolicy( + network::mojom::CSPDirectiveName::ScriptSrc, + "script-src chrome://resources chrome://test 'self';"); + + html_source->AddResourcePath("", IDR_SYS_INTERNALS_HTML); + html_source->AddResourcePath("index.html", IDR_SYS_INTERNALS_HTML); html_source->AddResourcePath("index.css", IDR_SYS_INTERNALS_CSS); html_source->AddResourcePath("index.js", IDR_SYS_INTERNALS_JS); + html_source->AddResourcePath("main.js", IDR_SYS_INTERNALS_MAIN_JS); html_source->AddResourcePath("constants.js", IDR_SYS_INTERNALS_CONSTANT_JS); + html_source->AddResourcePath("types.js", IDR_SYS_INTERNALS_TYPES_JS); html_source->AddResourcePath("line_chart.css", IDR_SYS_INTERNALS_LINE_CHART_CSS); - html_source->AddResourcePath("line_chart.js", - IDR_SYS_INTERNALS_LINE_CHART_JS); + + html_source->AddResourcePath("line_chart/constants.js", + IDR_SYS_INTERNALS_LINE_CHART_CONSTANTS_JS); + html_source->AddResourcePath("line_chart/data_series.js", + IDR_SYS_INTERNALS_LINE_CHART_DATA_SERIES_JS); + html_source->AddResourcePath("line_chart/unit_label.js", + IDR_SYS_INTERNALS_LINE_CHART_UNIT_LABEL_JS); + html_source->AddResourcePath("line_chart/line_chart.js", + IDR_SYS_INTERNALS_LINE_CHART_LINE_CHART_JS); + html_source->AddResourcePath("line_chart/menu.js", + IDR_SYS_INTERNALS_LINE_CHART_MENU_JS); + html_source->AddResourcePath("line_chart/scrollbar.js", + IDR_SYS_INTERNALS_LINE_CHART_SCROLLBAR_JS); + html_source->AddResourcePath("line_chart/sub_chart.js", + IDR_SYS_INTERNALS_LINE_CHART_SUB_CHART_JS); html_source->AddResourcePath("images/menu.svg", IDR_SYS_INTERNALS_IMAGE_MENU_SVG); @@ -40,6 +63,9 @@ html_source->AddResourcePath("images/zram.svg", IDR_SYS_INTERNALS_IMAGE_ZRAM_SVG); + html_source->AddResourcePath("test_loader_util.js", + IDR_WEBUI_JS_TEST_LOADER_UTIL_JS); + Profile* profile = Profile::FromWebUI(web_ui); content::WebUIDataSource::Add(profile, html_source); }
diff --git a/chrome/browser/ui/webui/settings/chromeos/main_section.cc b/chrome/browser/ui/webui/settings/chromeos/main_section.cc index f0626ca..522ea6e 100644 --- a/chrome/browser/ui/webui/settings/chromeos/main_section.cc +++ b/chrome/browser/ui/webui/settings/chromeos/main_section.cc
@@ -9,7 +9,6 @@ #include "base/feature_list.h" #include "base/i18n/message_formatter.h" #include "base/i18n/number_formatting.h" -#include "base/no_destructor.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h" #include "chrome/browser/ash/policy/handlers/minimum_version_policy_handler.h"
diff --git a/chrome/browser/ui/webui/settings/chromeos/os_settings_manager_unittest.cc b/chrome/browser/ui/webui/settings/chromeos/os_settings_manager_unittest.cc index a8089fdb..edeaecf2 100644 --- a/chrome/browser/ui/webui/settings/chromeos/os_settings_manager_unittest.cc +++ b/chrome/browser/ui/webui/settings/chromeos/os_settings_manager_unittest.cc
@@ -6,7 +6,6 @@ #include "base/containers/contains.h" #include "base/metrics/histogram_base.h" -#include "base/no_destructor.h" #include "base/test/metrics/histogram_enum_reader.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/ash/android_sms/android_sms_service_factory.h"
diff --git a/chrome/browser/ui/webui/settings/chromeos/people_section.cc b/chrome/browser/ui/webui/settings/chromeos/people_section.cc index 8312027a..7fc0014 100644 --- a/chrome/browser/ui/webui/settings/chromeos/people_section.cc +++ b/chrome/browser/ui/webui/settings/chromeos/people_section.cc
@@ -158,34 +158,6 @@ return *tags; } -const std::vector<SearchConcept>& GetSyncOnSearchConcepts() { - DCHECK(chromeos::features::IsSyncConsentOptionalEnabled()); - static const base::NoDestructor<std::vector<SearchConcept>> tags({ - {IDS_OS_SETTINGS_TAG_SYNC_TURN_OFF, - mojom::kSyncSubpagePath, - mojom::SearchResultIcon::kSync, - mojom::SearchResultDefaultRank::kMedium, - mojom::SearchResultType::kSetting, - {.setting = mojom::Setting::kSplitSyncOnOff}, - {IDS_OS_SETTINGS_TAG_SYNC_TURN_OFF_ALT1, SearchConcept::kAltTagEnd}}, - }); - return *tags; -} - -const std::vector<SearchConcept>& GetSyncOffSearchConcepts() { - DCHECK(chromeos::features::IsSyncConsentOptionalEnabled()); - static const base::NoDestructor<std::vector<SearchConcept>> tags({ - {IDS_OS_SETTINGS_TAG_SYNC_TURN_ON, - mojom::kSyncSubpagePath, - mojom::SearchResultIcon::kSync, - mojom::SearchResultDefaultRank::kMedium, - mojom::SearchResultType::kSetting, - {.setting = mojom::Setting::kSplitSyncOnOff}, - {IDS_OS_SETTINGS_TAG_SYNC_TURN_ON_ALT1, SearchConcept::kAltTagEnd}}, - }); - return *tags; -} - const std::vector<SearchConcept>& GetParentalSearchConcepts() { static const base::NoDestructor<std::vector<SearchConcept>> tags({ {IDS_OS_SETTINGS_TAG_PARENTAL_CONTROLS, @@ -492,8 +464,6 @@ html_source->AddBoolean( "syncSettingsCategorizationEnabled", chromeos::features::IsSyncSettingsCategorizationEnabled()); - html_source->AddBoolean("syncConsentOptionalEnabled", - chromeos::features::IsSyncConsentOptionalEnabled()); html_source->AddString( "browserSettingsSyncSetupUrl", base::StrCat({chrome::kChromeUISettingsURL, chrome::kSyncSetupSubPage})); @@ -580,15 +550,14 @@ } // namespace -PeopleSection::PeopleSection( - Profile* profile, - SearchTagRegistry* search_tag_registry, - syncer::SyncService* sync_service, - SupervisedUserService* supervised_user_service, - signin::IdentityManager* identity_manager, - PrefService* pref_service) +// TODO(https://crbug.com/1274802): Remove sync_service param. +PeopleSection::PeopleSection(Profile* profile, + SearchTagRegistry* search_tag_registry, + syncer::SyncService* sync_service, + SupervisedUserService* supervised_user_service, + signin::IdentityManager* identity_manager, + PrefService* pref_service) : OsSettingsSection(profile, search_tag_registry), - sync_service_(sync_service), supervised_user_service_(supervised_user_service), identity_manager_(identity_manager), pref_service_(pref_service) { @@ -614,19 +583,10 @@ FetchAccounts(); } - if (sync_service_) { - if (chromeos::features::IsSyncConsentOptionalEnabled()) { - DCHECK(chromeos::features::IsSyncSettingsCategorizationEnabled()); - updater.AddSearchTags(GetCategorizedSyncSearchConcepts()); - - // Sync search tags are added/removed dynamically. - sync_service_->AddObserver(this); - OnStateChanged(sync_service_); - } else if (chromeos::features::IsSyncSettingsCategorizationEnabled()) { - updater.AddSearchTags(GetCategorizedSyncSearchConcepts()); - } else { - updater.AddSearchTags(GetNonCategorizedSyncSearchConcepts()); - } + if (chromeos::features::IsSyncSettingsCategorizationEnabled()) { + updater.AddSearchTags(GetCategorizedSyncSearchConcepts()); + } else { + updater.AddSearchTags(GetNonCategorizedSyncSearchConcepts()); } // Parental control search tags are added if necessary and do not update @@ -635,10 +595,7 @@ updater.AddSearchTags(GetParentalSearchConcepts()); } -PeopleSection::~PeopleSection() { - if (chromeos::features::IsSyncConsentOptionalEnabled() && sync_service_) - sync_service_->RemoveObserver(this); -} +PeopleSection::~PeopleSection() = default; void PeopleSection::AddLoadTimeData(content::WebUIDataSource* html_source) { static constexpr webui::LocalizedString kLocalizedStrings[] = { @@ -868,22 +825,6 @@ } } -void PeopleSection::OnStateChanged(syncer::SyncService* sync_service) { - DCHECK(chromeos::features::IsSyncConsentOptionalEnabled()); - DCHECK_EQ(sync_service, sync_service_); - - SearchTagRegistry::ScopedTagUpdater updater = registry()->StartUpdate(); - - if (sync_service_->IsEngineInitialized() && - sync_service_->GetUserSettings()->IsOsSyncFeatureEnabled()) { - updater.AddSearchTags(GetSyncOnSearchConcepts()); - updater.RemoveSearchTags(GetSyncOffSearchConcepts()); - } else { - updater.RemoveSearchTags(GetSyncOnSearchConcepts()); - updater.AddSearchTags(GetSyncOffSearchConcepts()); - } -} - bool PeopleSection::AreFingerprintSettingsAllowed() { return quick_unlock::IsFingerprintEnabled(profile()); }
diff --git a/chrome/browser/ui/webui/settings/chromeos/people_section.h b/chrome/browser/ui/webui/settings/chromeos/people_section.h index 3a73dd14..7533608f 100644 --- a/chrome/browser/ui/webui/settings/chromeos/people_section.h +++ b/chrome/browser/ui/webui/settings/chromeos/people_section.h
@@ -44,8 +44,7 @@ // allowed by policy/flags. Different sets of Sync tags are shown depending on // whether the feature is enabed or disabled. class PeopleSection : public OsSettingsSection, - public account_manager::AccountManagerFacade::Observer, - public syncer::SyncServiceObserver { + public account_manager::AccountManagerFacade::Observer { public: PeopleSection(Profile* profile, SearchTagRegistry* search_tag_registry, @@ -70,9 +69,6 @@ void OnAccountUpserted(const ::account_manager::Account& account) override; void OnAccountRemoved(const ::account_manager::Account& account) override; - // syncer::SyncServiceObserver: - void OnStateChanged(syncer::SyncService* sync_service) override; - bool AreFingerprintSettingsAllowed(); void FetchAccounts(); void UpdateAccountManagerSearchTags( @@ -80,7 +76,6 @@ account_manager::AccountManager* account_manager_ = nullptr; account_manager::AccountManagerFacade* account_manager_facade_ = nullptr; - syncer::SyncService* sync_service_; SupervisedUserService* supervised_user_service_; signin::IdentityManager* identity_manager_; PrefService* pref_service_;
diff --git a/chrome/browser/ui/webui/settings/settings_ui.cc b/chrome/browser/ui/webui/settings/settings_ui.cc index 57bd1eb..6153eca 100644 --- a/chrome/browser/ui/webui/settings/settings_ui.cc +++ b/chrome/browser/ui/webui/settings/settings_ui.cc
@@ -290,8 +290,6 @@ html_source->AddBoolean( "syncSettingsCategorizationEnabled", chromeos::features::IsSyncSettingsCategorizationEnabled()); - html_source->AddBoolean("syncConsentOptionalEnabled", - chromeos::features::IsSyncConsentOptionalEnabled()); html_source->AddBoolean( "userCannotManuallyEnterPassword",
diff --git a/chrome/browser/ui/webui/support_tool/OWNERS b/chrome/browser/ui/webui/support_tool/OWNERS new file mode 100644 index 0000000..63381752 --- /dev/null +++ b/chrome/browser/ui/webui/support_tool/OWNERS
@@ -0,0 +1,3 @@ +iremuguz@google.com +pmarko@chromium.org +srad@google.com \ No newline at end of file
diff --git a/chrome/browser/ui/webui/support_tool_ui.cc b/chrome/browser/ui/webui/support_tool/support_tool_ui.cc similarity index 94% rename from chrome/browser/ui/webui/support_tool_ui.cc rename to chrome/browser/ui/webui/support_tool/support_tool_ui.cc index c6ca6a92..a4d294e 100644 --- a/chrome/browser/ui/webui/support_tool_ui.cc +++ b/chrome/browser/ui/webui/support_tool/support_tool_ui.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/webui/support_tool_ui.h" +#include "chrome/browser/ui/webui/support_tool/support_tool_ui.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/webui_util.h"
diff --git a/chrome/browser/ui/webui/support_tool_ui.h b/chrome/browser/ui/webui/support_tool/support_tool_ui.h similarity index 73% rename from chrome/browser/ui/webui/support_tool_ui.h rename to chrome/browser/ui/webui/support_tool/support_tool_ui.h index 6170ff1..df7ce474 100644 --- a/chrome/browser/ui/webui/support_tool_ui.h +++ b/chrome/browser/ui/webui/support_tool/support_tool_ui.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_WEBUI_SUPPORT_TOOL_UI_H_ -#define CHROME_BROWSER_UI_WEBUI_SUPPORT_TOOL_UI_H_ +#ifndef CHROME_BROWSER_UI_WEBUI_SUPPORT_TOOL_SUPPORT_TOOL_UI_H_ +#define CHROME_BROWSER_UI_WEBUI_SUPPORT_TOOL_SUPPORT_TOOL_UI_H_ #include "content/public/browser/web_ui_controller.h" @@ -18,4 +18,4 @@ ~SupportToolUI() override; }; -#endif // CHROME_BROWSER_UI_WEBUI_SUPPORT_TOOL_UI_H_ +#endif // CHROME_BROWSER_UI_WEBUI_SUPPORT_TOOL_SUPPORT_TOOL_UI_H_
diff --git a/chrome/browser/ui/webui/support_tool_ui_browsertest.cc b/chrome/browser/ui/webui/support_tool/support_tool_ui_browsertest.cc similarity index 100% rename from chrome/browser/ui/webui/support_tool_ui_browsertest.cc rename to chrome/browser/ui/webui/support_tool/support_tool_ui_browsertest.cc
diff --git a/chrome/browser/updates/announcement_notification/announcement_notification_service_factory.cc b/chrome/browser/updates/announcement_notification/announcement_notification_service_factory.cc index 2ce01467..fd9a7f1 100644 --- a/chrome/browser/updates/announcement_notification/announcement_notification_service_factory.cc +++ b/chrome/browser/updates/announcement_notification/announcement_notification_service_factory.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "base/no_destructor.h" #include "base/time/default_clock.h" #include "build/build_config.h" #include "chrome/browser/notifications/notification_display_service_factory.h" // nogncheck
diff --git a/chrome/browser/web_applications/BUILD.gn b/chrome/browser/web_applications/BUILD.gn index d08c03e..ac687f1 100644 --- a/chrome/browser/web_applications/BUILD.gn +++ b/chrome/browser/web_applications/BUILD.gn
@@ -160,6 +160,8 @@ "web_app_utils.h", "web_application_info.cc", "web_application_info.h", + "web_launch_params_helper.cc", + "web_launch_params_helper.h", ] if (is_chromeos_ash || is_chromeos_lacros) {
diff --git a/chrome/browser/web_applications/app_shim_registry_mac.cc b/chrome/browser/web_applications/app_shim_registry_mac.cc index 2b92b27..75d455f 100644 --- a/chrome/browser/web_applications/app_shim_registry_mac.cc +++ b/chrome/browser/web_applications/app_shim_registry_mac.cc
@@ -7,6 +7,7 @@ #include <memory> #include <utility> +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile_manager.h" #include "components/prefs/pref_registry_simple.h"
diff --git a/chrome/browser/web_applications/preinstalled_web_app_manager.cc b/chrome/browser/web_applications/preinstalled_web_app_manager.cc index 088f7f1a..3cc9c4aed 100644 --- a/chrome/browser/web_applications/preinstalled_web_app_manager.cc +++ b/chrome/browser/web_applications/preinstalled_web_app_manager.cc
@@ -23,7 +23,6 @@ #include "base/json/json_reader.h" #include "base/memory/scoped_refptr.h" #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "base/path_service.h" #include "base/strings/strcat.h" #include "base/task/post_task.h"
diff --git a/chrome/browser/web_applications/web_app_registrar.cc b/chrome/browser/web_applications/web_app_registrar.cc index a2909e4..840f7eb 100644 --- a/chrome/browser/web_applications/web_app_registrar.cc +++ b/chrome/browser/web_applications/web_app_registrar.cc
@@ -352,6 +352,11 @@ return !GetAppScopeInternal(app_id).has_value(); } +bool WebAppRegistrar::IsSystemApp(const AppId& app_id) const { + const WebApp* web_app = GetAppById(app_id); + return web_app && web_app->IsSystemApp(); +} + DisplayMode WebAppRegistrar::GetAppEffectiveDisplayMode( const AppId& app_id) const { if (!IsLocallyInstalled(app_id))
diff --git a/chrome/browser/web_applications/web_app_registrar.h b/chrome/browser/web_applications/web_app_registrar.h index 4d845bfb..0785bd8fd 100644 --- a/chrome/browser/web_applications/web_app_registrar.h +++ b/chrome/browser/web_applications/web_app_registrar.h
@@ -234,6 +234,8 @@ // complete installation via the ExternallyManagedAppManager. bool IsPlaceholderApp(const AppId& app_id) const; + bool IsSystemApp(const AppId& app_id) const; + // Computes and returns the DisplayMode, accounting for user preference // to launch in a browser window and entries in the web app manifest. DisplayMode GetAppEffectiveDisplayMode(const AppId& app_id) const;
diff --git a/chrome/browser/web_applications/web_app_shortcut.cc b/chrome/browser/web_applications/web_app_shortcut.cc index e93356c..d006bea 100644 --- a/chrome/browser/web_applications/web_app_shortcut.cc +++ b/chrome/browser/web_applications/web_app_shortcut.cc
@@ -16,7 +16,6 @@ #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/task/task_traits.h"
diff --git a/chrome/browser/web_launch/web_launch_files_helper.cc b/chrome/browser/web_applications/web_launch_params_helper.cc similarity index 79% rename from chrome/browser/web_launch/web_launch_files_helper.cc rename to chrome/browser/web_applications/web_launch_params_helper.cc index 542f3f79..a9ab276c 100644 --- a/chrome/browser/web_launch/web_launch_files_helper.cc +++ b/chrome/browser/web_applications/web_launch_params_helper.cc
@@ -2,24 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/web_launch/web_launch_files_helper.h" +#include "chrome/browser/web_applications/web_launch_params_helper.h" #include <memory> #include <utility> #include <vector> -#include "base/bind.h" -#include "base/feature_list.h" #include "base/files/file_path.h" -#include "base/strings/utf_string_conversions.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/common/chrome_features.h" +#include "chrome/browser/web_applications/web_app_registrar.h" +#include "content/public/browser/file_system_access_entry_factory.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/storage_partition.h" #include "content/public/browser/web_contents.h" -#include "content/public/browser/web_contents_user_data.h" #include "mojo/public/cpp/bindings/associated_remote.h" #include "storage/browser/file_system/external_mount_points.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" @@ -28,9 +25,9 @@ #include "third_party/blink/public/mojom/web_launch/web_launch.mojom.h" #include "url/origin.h" -namespace web_launch { +namespace web_app { -WEB_CONTENTS_USER_DATA_KEY_IMPL(WebLaunchFilesHelper); +WEB_CONTENTS_USER_DATA_KEY_IMPL(WebLaunchParamsHelper); namespace { @@ -100,48 +97,52 @@ } // namespace -WebLaunchFilesHelper::~WebLaunchFilesHelper() = default; +WebLaunchParamsHelper::~WebLaunchParamsHelper() = default; // static -WebLaunchFilesHelper* WebLaunchFilesHelper::GetForWebContents( +WebLaunchParamsHelper* WebLaunchParamsHelper::GetForWebContents( content::WebContents* web_contents) { - return static_cast<WebLaunchFilesHelper*>( + return static_cast<WebLaunchParamsHelper*>( web_contents->GetUserData(UserDataKey())); } // static -void WebLaunchFilesHelper::EnqueueLaunchParams( +void WebLaunchParamsHelper::EnqueueLaunchParams( content::WebContents* web_contents, - const GURL& app_scope, + const WebAppRegistrar& web_app_registrar, + AppId app_id, bool await_navigation, GURL launch_url, base::FilePath launch_dir, std::vector<base::FilePath> launch_paths) { - auto helper = base::WrapUnique( - new WebLaunchFilesHelper(web_contents, app_scope, std::move(launch_url), - std::move(launch_dir), std::move(launch_paths))); + auto helper = base::WrapUnique(new WebLaunchParamsHelper( + web_contents, web_app_registrar, std::move(app_id), std::move(launch_url), + std::move(launch_dir), std::move(launch_paths))); auto* helper_ptr = helper.get(); web_contents->SetUserData(UserDataKey(), std::move(helper)); helper_ptr->Start(await_navigation); } -WebLaunchFilesHelper::WebLaunchFilesHelper( +WebLaunchParamsHelper::WebLaunchParamsHelper( content::WebContents* web_contents, - const GURL& app_scope, + const WebAppRegistrar& web_app_registrar, + AppId app_id, GURL launch_url, base::FilePath launch_dir, std::vector<base::FilePath> launch_paths) : content::WebContentsObserver(web_contents), - content::WebContentsUserData<WebLaunchFilesHelper>(*web_contents), - app_scope_(app_scope.spec()), + content::WebContentsUserData<WebLaunchParamsHelper>(*web_contents), + web_app_registrar_(web_app_registrar), + app_id_(std::move(app_id)), launch_url_(std::move(launch_url)), launch_dir_(std::move(launch_dir)), launch_paths_(std::move(launch_paths)) { - DCHECK(InAppScope(launch_url_)); + DCHECK(web_app_registrar_.IsUrlInAppScope(launch_url_, app_id_)); + DCHECK(launch_dir_.empty() || web_app_registrar.IsSystemApp(app_id_)); } -void WebLaunchFilesHelper::Start(bool await_navigation) { +void WebLaunchParamsHelper::Start(bool await_navigation) { // Wait for DidFinishNavigation before enqueuing. if (await_navigation) return; @@ -150,13 +151,7 @@ SendLaunchEntries(); } -// TODO(crbug.com/1250225): Move this class into chrome/browser/web_applications -// and use WebAppRegistrar::IsUrlInAppScope(). -bool WebLaunchFilesHelper::InAppScope(const GURL& url) const { - return base::StartsWith(url.spec(), app_scope_, base::CompareCase::SENSITIVE); -} - -void WebLaunchFilesHelper::DidFinishNavigation( +void WebLaunchParamsHelper::DidFinishNavigation( content::NavigationHandle* handle) { // Currently, launch data is only sent for the main frame. // TODO(https://crbug.com/1218946): With MPArch there may be multiple main @@ -167,7 +162,7 @@ // Launch params still haven't been enqueued. if (!url_params_enqueued_in_.is_valid()) { - if (!InAppScope(handle->GetURL())) { + if (!web_app_registrar_.IsUrlInAppScope(handle->GetURL(), app_id_)) { DestroySelf(); return; } @@ -190,9 +185,9 @@ return; } -void WebLaunchFilesHelper::SendLaunchEntries() { +void WebLaunchParamsHelper::SendLaunchEntries() { DCHECK(url_params_enqueued_in_.is_valid()); - DCHECK(InAppScope(url_params_enqueued_in_)); + DCHECK(web_app_registrar_.IsUrlInAppScope(url_params_enqueued_in_, app_id_)); mojo::AssociatedRemote<blink::mojom::WebLaunchService> launch_service; web_contents()->GetMainFrame()->GetRemoteAssociatedInterfaces()->GetInterface( &launch_service); @@ -213,14 +208,14 @@ } } -void WebLaunchFilesHelper::CloseApp() { +void WebLaunchParamsHelper::CloseApp() { web_contents()->Close(); // `this` is deleted. } -void WebLaunchFilesHelper::DestroySelf() { +void WebLaunchParamsHelper::DestroySelf() { web_contents()->RemoveUserData(UserDataKey()); // `this` is deleted. } -} // namespace web_launch +} // namespace web_app
diff --git a/chrome/browser/web_applications/web_launch_params_helper.h b/chrome/browser/web_applications/web_launch_params_helper.h new file mode 100644 index 0000000..e306d7d --- /dev/null +++ b/chrome/browser/web_applications/web_launch_params_helper.h
@@ -0,0 +1,117 @@ +// 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 CHROME_BROWSER_WEB_APPLICATIONS_WEB_LAUNCH_PARAMS_HELPER_H_ +#define CHROME_BROWSER_WEB_APPLICATIONS_WEB_LAUNCH_PARAMS_HELPER_H_ + +#include <vector> + +#include "base/files/file_path.h" +#include "base/memory/weak_ptr.h" +#include "chrome/browser/web_applications/web_app_id.h" +#include "content/public/browser/web_contents_observer.h" +#include "content/public/browser/web_contents_user_data.h" +#include "url/gurl.h" + +namespace content { + +class WebContents; +class NavigationHandle; + +} // namespace content + +namespace web_app { + +class WebAppRegistrar; + +// A helper for sending launch paths to the renderer process. +// +// If `await_navigation` is set, it waits for the first DidFinishNavigation +// before enqueuing launch params, and otherwise enqueues them immediately. +// DidFinishNavigation takes into account server redirects. Will re-enqueue if +// the page reloads without navigating away. +// +// Note: The lifetime of this class is tied to the WebContents it is attached +// to. However, it will often destroy itself before the WebContents, such as +// when the WebContents navigates away from the initial URL. +class WebLaunchParamsHelper + : public content::WebContentsObserver, + public content::WebContentsUserData<WebLaunchParamsHelper> { + public: + WEB_CONTENTS_USER_DATA_KEY_DECL(); + + WebLaunchParamsHelper(const WebLaunchParamsHelper&) = delete; + WebLaunchParamsHelper& operator=(const WebLaunchParamsHelper&) = delete; + + ~WebLaunchParamsHelper() override; + + static WebLaunchParamsHelper* GetForWebContents( + content::WebContents* web_contents); + + // Enqueues a LaunchParams into the `web_contents` with the provided launch_* + // params. Only enqueues into pages inside `app_scope`. Will enqueue + // immediately unless `await_navigation` is set in which case it waits for the + // next DidFinishNavigation event. Only system web apps may provide a + // |launch_dir|. + static void EnqueueLaunchParams(content::WebContents* web_contents, + const WebAppRegistrar& web_app_registrar, + AppId app_id, + bool await_navigation, + GURL launch_url, + base::FilePath launch_dir, + std::vector<base::FilePath> launch_paths); + + const std::vector<base::FilePath>& launch_paths() { return launch_paths_; } + + private: + WebLaunchParamsHelper(content::WebContents* web_contents, + const WebAppRegistrar& web_app_registrar, + AppId app_id, + GURL launch_url, + base::FilePath launch_dir, + std::vector<base::FilePath> launch_paths); + + void Start(bool await_navigation); + + // content::WebContentsObserver: + void DidFinishNavigation(content::NavigationHandle* handle) override; + + // Sends the launch entries to the renderer if they have been created and the + // renderer is ready to receive them. + void MaybeSendLaunchEntries(); + + // Send the launch entries to the renderer. + void SendLaunchEntries(); + + // Closes the app window/tab. `this` will be deleted, return immediately after + // calling. + void CloseApp(); + + // Removes self from the parent WebContents. `this` will be deleted, return + // immediately after calling. + void DestroySelf(); + + const WebAppRegistrar& web_app_registrar_; + const AppId app_id_; + + // The URL the launch entries are for. Note that redirects may cause us to + // enqueue in a different URL, we still report the original launch target URL + // in the launch params. + GURL launch_url_; + + // The directory to launch with (may be empty). + base::FilePath launch_dir_; + + // The files to launch with (may be empty). + std::vector<base::FilePath> launch_paths_; + + // Which URL we first enqueued launch params in. + GURL url_params_enqueued_in_; + + base::WeakPtrFactory<WebLaunchParamsHelper> weak_ptr_factory_{this}; +}; + +} // namespace web_app + +#endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_LAUNCH_PARAMS_HELPER_H_
diff --git a/chrome/browser/web_launch/web_launch_files_helper.h b/chrome/browser/web_launch/web_launch_files_helper.h deleted file mode 100644 index f958c57..0000000 --- a/chrome/browser/web_launch/web_launch_files_helper.h +++ /dev/null
@@ -1,123 +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 CHROME_BROWSER_WEB_LAUNCH_WEB_LAUNCH_FILES_HELPER_H_ -#define CHROME_BROWSER_WEB_LAUNCH_WEB_LAUNCH_FILES_HELPER_H_ - -#include <vector> - -#include "base/files/file_path.h" -#include "base/memory/scoped_refptr.h" -#include "base/memory/weak_ptr.h" -#include "content/public/browser/file_system_access_entry_factory.h" -#include "content/public/browser/web_contents_observer.h" -#include "content/public/browser/web_contents_user_data.h" -#include "url/gurl.h" - -namespace content { - -class WebContents; -class NavigationHandle; - -} // namespace content - -namespace web_launch { - -// A helper for sending launch paths to the renderer process. -// Launch files cannot be sent immediately because the data is stored on a -// document for `launch_url_`, which is not created until `launch_url_` is -// committed. -// -// If `await_navigation` is set it waits for the first DidFinishNavigation -// before enqueuing launch params otherwise enqueues them immediately. -// DidFinishNavigation takes into account server redirects. Will re-enqueue if -// the page reloads without navigating away. -// -// Note: The lifetime of this class is tied to the WebContents it is attached -// to. However, in general it will be destroyed before the WebContents, when the -// helper sends the FileSystemAccessEntries to the renderer. -// -// TODO(crbug.com/1250225): Rename this to WebLaunchParamsHelper. -class WebLaunchFilesHelper - : public content::WebContentsObserver, - public content::WebContentsUserData<WebLaunchFilesHelper> { - public: - WEB_CONTENTS_USER_DATA_KEY_DECL(); - - WebLaunchFilesHelper(const WebLaunchFilesHelper&) = delete; - WebLaunchFilesHelper& operator=(const WebLaunchFilesHelper&) = delete; - - ~WebLaunchFilesHelper() override; - - static WebLaunchFilesHelper* GetForWebContents( - content::WebContents* web_contents); - - // Enqueues a LaunchParams into the `web_contents` with the provided launch_* - // params. Only enqueues into pages inside `app_scope`. Will enqueue - // immediately unless `await_navigation` is set in which case it waits for the - // next DidFinishNavigation event. - // Only system web apps may provide a |launch_dir|. - // TODO(crbug.com/1250225): DCHECK that only system web apps use launch_dir. - static void EnqueueLaunchParams(content::WebContents* web_contents, - const GURL& app_scope, - bool await_navigation, - GURL launch_url, - base::FilePath launch_dir, - std::vector<base::FilePath> launch_paths); - - const std::vector<base::FilePath>& launch_paths() { return launch_paths_; } - - private: - WebLaunchFilesHelper(content::WebContents* web_contents, - const GURL& app_scope, - GURL launch_url, - base::FilePath launch_dir, - std::vector<base::FilePath> launch_paths); - - void Start(bool await_navigation); - - // Whether `url` is within `app_scope_`. - bool InAppScope(const GURL& url) const; - - // content::WebContentsObserver: - void DidFinishNavigation(content::NavigationHandle* handle) override; - - // Sends the launch entries to the renderer if they have been created and the - // renderer is ready to receive them. - void MaybeSendLaunchEntries(); - - // Send the launch entries to the renderer. - void SendLaunchEntries(); - - // Closes the app window/tab. `this` will be deleted, return immediately after - // calling. - void CloseApp(); - - // Removes self from the parent WebContents. `this` will be deleted, return - // immediately after calling. - void DestroySelf(); - - // The scope in which launch params may be enqueued. - std::string app_scope_; - - // The URL the launch entries are for. Note that redirects may cause us to - // enqueue in a different URL, we still report the original launch target URL - // in the launch params. - GURL launch_url_; - - // The directory to launch with (may be empty). - base::FilePath launch_dir_; - - // The files to launch with (may be empty). - std::vector<base::FilePath> launch_paths_; - - // Which URL we first enqueued launch params in. - GURL url_params_enqueued_in_; - - base::WeakPtrFactory<WebLaunchFilesHelper> weak_ptr_factory_{this}; -}; - -} // namespace web_launch - -#endif // CHROME_BROWSER_WEB_LAUNCH_WEB_LAUNCH_FILES_HELPER_H_
diff --git a/chrome/browser/webapps/chrome_webapps_client.cc b/chrome/browser/webapps/chrome_webapps_client.cc index 9a046aa..84dc7f9 100644 --- a/chrome/browser/webapps/chrome_webapps_client.cc +++ b/chrome/browser/webapps/chrome_webapps_client.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/webapps/chrome_webapps_client.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "chrome/browser/ssl/security_state_tab_helper.h" #include "components/infobars/content/content_infobar_manager.h" #include "components/webapps/browser/installable/installable_metrics.h"
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 343a04d5..6374f6d 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1639526239-a0d881f0048d045d354f668c449f9cc1d5fb2651.profdata +chrome-linux-main-1639569614-51af581decdc00b7af5310dccd59d8dd19f402a7.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index d832a87f..6412b29 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1639526239-f999c2751396f2d955909c0c12681befd8319247.profdata +chrome-mac-main-1639569614-d251f83da686019cc9a1332b1064979740a5536b.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index f51359e5..9dec62a 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1639526239-fba5218e9f7efbe8971262d0927a477c0a0708f7.profdata +chrome-win32-main-1639558498-bfc8cbd53a95441e4b362960336fa324f065b029.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 9abdd9e..fd9a56a 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1639537168-0b06bcc6c7eeeb1a4010c2caccb9a5d589914c95.profdata +chrome-win64-main-1639569614-a364248aacb276f65024141a5cfb87f1882ed3eb.profdata
diff --git a/chrome/elevation_service/service_main.cc b/chrome/elevation_service/service_main.cc index 6c8cca9..4296b7a8 100644 --- a/chrome/elevation_service/service_main.cc +++ b/chrome/elevation_service/service_main.cc
@@ -20,6 +20,7 @@ #include "base/command_line.h" #include "base/cxx17_backports.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/win/scoped_com_initializer.h" #include "chrome/elevation_service/elevated_recovery_impl.h" #include "chrome/elevation_service/elevator.h"
diff --git a/chrome/gpu/browser_exposed_gpu_interfaces.cc b/chrome/gpu/browser_exposed_gpu_interfaces.cc index bb74573..4f39206 100644 --- a/chrome/gpu/browser_exposed_gpu_interfaces.cc +++ b/chrome/gpu/browser_exposed_gpu_interfaces.cc
@@ -5,7 +5,6 @@ #include "chrome/gpu/browser_exposed_gpu_interfaces.h" #include "base/memory/scoped_refptr.h" -#include "base/no_destructor.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "chrome/gpu/chrome_content_gpu_client.h"
diff --git a/chrome/installer/mac/BUILD.gn b/chrome/installer/mac/BUILD.gn index a2d2713..0053726 100644 --- a/chrome/installer/mac/BUILD.gn +++ b/chrome/installer/mac/BUILD.gn
@@ -166,7 +166,8 @@ # Help the compiler find lipo for creating fat binaries. "-B", mac_bin_path, - + "-fno-lto", + "-fno-whole-program-vtables", "-arch", "x86_64", "-arch",
diff --git a/chrome/services/ipp_parser/public/cpp/browser/ipp_parser_launcher.cc b/chrome/services/ipp_parser/public/cpp/browser/ipp_parser_launcher.cc index 0a51d4b..785b9a0 100644 --- a/chrome/services/ipp_parser/public/cpp/browser/ipp_parser_launcher.cc +++ b/chrome/services/ipp_parser/public/cpp/browser/ipp_parser_launcher.cc
@@ -4,7 +4,6 @@ #include "chrome/services/ipp_parser/public/cpp/browser/ipp_parser_launcher.h" -#include "base/no_destructor.h" #include "chrome/grit/generated_resources.h" #include "chrome/services/ipp_parser/public/mojom/ipp_parser.mojom.h" #include "content/public/browser/service_process_host.h"
diff --git a/chrome/services/qrcode_generator/public/cpp/qrcode_generator_service.cc b/chrome/services/qrcode_generator/public/cpp/qrcode_generator_service.cc index 7ad4fd8c..36e1370 100644 --- a/chrome/services/qrcode_generator/public/cpp/qrcode_generator_service.cc +++ b/chrome/services/qrcode_generator/public/cpp/qrcode_generator_service.cc
@@ -4,7 +4,6 @@ #include "chrome/services/qrcode_generator/public/cpp/qrcode_generator_service.h" -#include "base/no_destructor.h" #include "chrome/grit/generated_resources.h" #include "chrome/services/qrcode_generator/public/mojom/qrcode_generator.mojom.h" #include "content/public/browser/service_process_host.h"
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 9c0c0a1..8ef8e21 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -2052,7 +2052,7 @@ "../browser/ui/webui/settings/settings_clear_browsing_data_handler_browsertest.cc", "../browser/ui/webui/settings/settings_secure_dns_handler_browsertest.cc", "../browser/ui/webui/settings/settings_ui_browsertest.cc", - "../browser/ui/webui/support_tool_ui_browsertest.cc", + "../browser/ui/webui/support_tool/support_tool_ui_browsertest.cc", "../browser/ui/webui/tab_search/tab_search_ui_browsertest.cc", "../browser/ui/webui/webui_load_timer_browsertest.cc", "../browser/ui/zoom/zoom_controller_browsertest.cc", @@ -2122,9 +2122,7 @@ # crbug.com/1279884 Flaky on CrOS if (!is_chromeos) { - sources += [ - "../browser/optimization_guide/page_content_annotations_service_browsertest.cc" - ] + sources += [ "../browser/optimization_guide/page_content_annotations_service_browsertest.cc" ] } if (enable_reporting) { @@ -3227,6 +3225,7 @@ "../browser/ash/login/screens/family_link_notice_browsertest.cc", "../browser/ash/login/screens/fingerprint_setup_browsertest.cc", "../browser/ash/login/screens/gesture_navigation_screen_browsertest.cc", + "../browser/ash/login/screens/guest_tos_screen_browsertest.cc", "../browser/ash/login/screens/hid_detection_screen_browsertest.cc", "../browser/ash/login/screens/lacros_data_migration_screen_browsertest.cc", "../browser/ash/login/screens/management_transition_screen_browsertest.cc", @@ -9024,8 +9023,6 @@ "../browser/sync/test/integration/sync_app_list_helper.h", "../browser/sync/test/integration/sync_arc_package_helper.cc", "../browser/sync/test/integration/sync_arc_package_helper.h", - "../browser/sync/test/integration/sync_consent_optional_sync_test.cc", - "../browser/sync/test/integration/sync_consent_optional_sync_test.h", "../browser/sync/test/integration/sync_settings_categorization_sync_test.cc", "../browser/sync/test/integration/sync_settings_categorization_sync_test.h", "../browser/sync/test/integration/workspace_desk_helper.cc",
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index 30cca13..6abe13e 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc
@@ -13,7 +13,6 @@ #include "base/containers/contains.h" #include "base/files/file_util.h" #include "base/location.h" -#include "base/no_destructor.h" #include "base/path_service.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h"
diff --git a/chrome/test/data/webui/BUILD.gn b/chrome/test/data/webui/BUILD.gn index 69c9b424..718e8ea 100644 --- a/chrome/test/data/webui/BUILD.gn +++ b/chrome/test/data/webui/BUILD.gn
@@ -357,7 +357,6 @@ "$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_people_page_test.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_privacy_page_test.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_settings_menu_test.m.js", - "$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_sync_controls_optional_disabled_test.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_sync_controls_test.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/lock_screen_tests.m.js", "$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_printing_page_tests.m.js",
diff --git a/chrome/test/data/webui/chromeos/diagnostics/input_list_test.js b/chrome/test/data/webui/chromeos/diagnostics/input_list_test.js index b86efabc..b0919b7e 100644 --- a/chrome/test/data/webui/chromeos/diagnostics/input_list_test.js +++ b/chrome/test/data/webui/chromeos/diagnostics/input_list_test.js
@@ -51,10 +51,18 @@ /** @return {!InputCardElement} */ function getCardByDeviceType(deviceType) { const card = inputListElement.$$(`input-card[device-type="${deviceType}"]`); - assertTrue(!!card); return /** @type {!InputCardElement} */ (card); } + /** + * Returns whether the element both exists and is visible. + * @param {?Element} element + * @return {boolean} + */ + function isVisible(element) { + return !!element && element.style.display !== 'none'; + } + test('InputListPopulated', () => { return initializeInputList().then(() => { assertEquals( @@ -171,4 +179,38 @@ fakeTouchDevices[1].name, touchscreenCard.devices[0].name); }); }); + + test('EmptySectionsHidden', async () => { + await initializeInputList([], []); + assertFalse(isVisible(getCardByDeviceType('keyboard'))); + assertFalse(isVisible(getCardByDeviceType('touchpad'))); + assertFalse(isVisible(getCardByDeviceType('touchscreen'))); + + provider.addFakeConnectedTouchDevice(fakeTouchDevices[1]); + await flushTasks(); + assertTrue(!!getCardByDeviceType('touchscreen')); + assertFalse(isVisible(getCardByDeviceType('keyboard'))); + assertFalse(isVisible(getCardByDeviceType('touchpad'))); + assertTrue(isVisible(getCardByDeviceType('touchscreen'))); + + provider.removeFakeConnectedTouchDeviceById(fakeTouchDevices[1].id); + provider.addFakeConnectedTouchDevice(fakeTouchDevices[0]); + await flushTasks(); + assertFalse(isVisible(getCardByDeviceType('keyboard'))); + assertTrue(isVisible(getCardByDeviceType('touchpad'))); + assertFalse(isVisible(getCardByDeviceType('touchscreen'))); + + provider.removeFakeConnectedTouchDeviceById(fakeTouchDevices[0].id); + provider.addFakeConnectedKeyboard(fakeKeyboards[0]); + await flushTasks(); + assertTrue(isVisible(getCardByDeviceType('keyboard'))); + assertFalse(isVisible(getCardByDeviceType('touchpad'))); + assertFalse(isVisible(getCardByDeviceType('touchscreen'))); + + provider.removeFakeConnectedKeyboardById(fakeKeyboards[0].id); + await flushTasks(); + assertFalse(isVisible(getCardByDeviceType('keyboard'))); + assertFalse(isVisible(getCardByDeviceType('touchpad'))); + assertFalse(isVisible(getCardByDeviceType('touchscreen'))); + }); }
diff --git a/chrome/test/data/webui/settings/chromeos/BUILD.gn b/chrome/test/data/webui/settings/chromeos/BUILD.gn index 26cb9ea..fef09dd477 100644 --- a/chrome/test/data/webui/settings/chromeos/BUILD.gn +++ b/chrome/test/data/webui/settings/chromeos/BUILD.gn
@@ -144,7 +144,6 @@ "os_settings_menu_test.js", "os_settings_ui_test.js", "os_settings_ui_test_2.js", - "os_sync_controls_optional_disabled_test.js", "os_sync_controls_test.js", "parental_controls_page_test.js", "people_page_account_manager_test.js",
diff --git a/chrome/test/data/webui/settings/chromeos/multidevice_wifi_sync_item_tests.js b/chrome/test/data/webui/settings/chromeos/multidevice_wifi_sync_item_tests.js index 4023b16..6390a20 100644 --- a/chrome/test/data/webui/settings/chromeos/multidevice_wifi_sync_item_tests.js +++ b/chrome/test/data/webui/settings/chromeos/multidevice_wifi_sync_item_tests.js
@@ -13,6 +13,8 @@ // #import {TestBrowserProxy} from 'chrome://test/test_browser_proxy.js'; // clang-format on +// Prefs used by settings-multidevice-wifi-sync-item if +// SyncSettingsCategorization is disabled. function getPrefs() { return { wifiConfigurationsRegistered: true, @@ -20,6 +22,15 @@ }; } +// Prefs used by settings-multidevice-wifi-sync-item if +// SyncSettingsCategorization is enabled. +function getOsPrefs() { + return { + osWifiConfigurationsRegistered: true, + osWifiConfigurationsSynced: true, + }; +} + suite('Multidevice_WifiSyncItem_CategorizationDisabled', function() { let wifiSyncItem; @@ -103,10 +114,10 @@ wifiSyncItem.remove(); }); - test('Chrome Sync off', async () => { - const prefs = getPrefs(); - prefs.wifiConfigurationsSynced = false; - cr.webUIListenerCallback('os-sync-prefs-changed', false, prefs); + test('Wifi Sync off', async () => { + const prefs = getOsPrefs(); + prefs.osWifiConfigurationsSynced = false; + cr.webUIListenerCallback('os-sync-prefs-changed', prefs); Polymer.dom.flush(); assertTrue( @@ -118,10 +129,10 @@ assertFalse(toggle.checked); }); - test('Chrome Sync on', async () => { - const prefs = getPrefs(); - prefs.wifiConfigurationsSynced = true; - cr.webUIListenerCallback('os-sync-prefs-changed', true, prefs); + test('Wifi Sync on', async () => { + const prefs = getOsPrefs(); + prefs.osWifiConfigurationsSynced = true; + cr.webUIListenerCallback('os-sync-prefs-changed', prefs); Polymer.dom.flush(); assertFalse(
diff --git a/chrome/test/data/webui/settings/chromeos/os_settings_v3_browsertest.js b/chrome/test/data/webui/settings/chromeos/os_settings_v3_browsertest.js index 45a0a9e..8c0c72e 100644 --- a/chrome/test/data/webui/settings/chromeos/os_settings_v3_browsertest.js +++ b/chrome/test/data/webui/settings/chromeos/os_settings_v3_browsertest.js
@@ -102,10 +102,8 @@ /** @override */ get featureList() { return { - enabled: super.featureList.enabled.concat([ - 'chromeos::features::kSyncConsentOptional', - 'chromeos::features::kSyncSettingsCategorization' - ]) + enabled: super.featureList.enabled.concat( + ['chromeos::features::kSyncSettingsCategorization']) }; } }; @@ -114,29 +112,6 @@ mocha.run(); }); -var OSSettingsPeoplePageOsSyncOptionalDisabledV3Test = - class extends OSSettingsV3BrowserTest { - /** @override */ - get browsePreload() { - return 'chrome://os-settings/test_loader.html?module=settings/chromeos/' + - 'os_sync_controls_optional_disabled_test.m.js'; - } - - /** @override */ - get featureList() { - return { - enabled: super.featureList.enabled.concat( - ['chromeos::features::kSyncSettingsCategorization']), - disabled: ['chromeos::features::kSyncConsentOptional'] - }; - } -}; - -TEST_F('OSSettingsPeoplePageOsSyncOptionalDisabledV3Test', 'AllJsTests', () => { - mocha.run(); -}); - - // TODO(crbug.com/1234871) Move this test back into the list of tests below once // Bluetooth revamp is launched. var OSSettingsOsSettingsPageV3Test = class extends OSSettingsV3BrowserTest {
diff --git a/chrome/test/data/webui/settings/chromeos/os_sync_controls_optional_disabled_test.js b/chrome/test/data/webui/settings/chromeos/os_sync_controls_optional_disabled_test.js deleted file mode 100644 index e9b48cd..0000000 --- a/chrome/test/data/webui/settings/chromeos/os_sync_controls_optional_disabled_test.js +++ /dev/null
@@ -1,268 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// clang-format off -// #import 'chrome://os-settings/chromeos/os_settings.js'; - -// #import {OsSyncBrowserProxyImpl, Router, StatusAction, routes} from 'chrome://os-settings/chromeos/os_settings.js'; -// #import {flush} from'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -// #import {assertEquals, assertFalse, assertTrue} from '../../chai_assert.js'; -// #import {waitAfterNextRender} from 'chrome://test/test_util.js'; -// #import {getDeepActiveElement} from 'chrome://resources/js/util.m.js'; -// #import {TestBrowserProxy} from '../../test_browser_proxy.js'; -// clang-format on - -/** @implements {settings.OsSyncBrowserProxy} */ -class TestOsSyncBrowserProxy extends TestBrowserProxy { - constructor() { - super([ - 'didNavigateToOsSyncPage', - 'didNavigateAwayFromOsSyncPage', - 'setOsSyncFeatureEnabled', - 'setOsSyncDatatypes', - ]); - } - - /** @override */ - didNavigateToOsSyncPage() { - this.methodCalled('didNavigateToOsSyncPage'); - } - - /** @override */ - didNavigateAwayFromOsSyncPage() { - this.methodCalled('didNavigateAwayFromSyncPage'); - } - - /** @override */ - setOsSyncFeatureEnabled(enabled) { - this.methodCalled('setOsSyncFeatureEnabled', enabled); - } - - /** @override */ - setOsSyncDatatypes(osSyncPrefs) { - this.methodCalled('setOsSyncDatatypes', osSyncPrefs); - } -} - -/** - * Returns a sync prefs dictionary with either all or nothing syncing. - * @param {boolean} syncAll - * @return {!settings.OsSyncPrefs} - */ -function getOsSyncPrefs(syncAll) { - return { - osAppsRegistered: true, - osAppsSynced: syncAll, - osPreferencesRegistered: true, - osPreferencesSynced: syncAll, - syncAllOsTypes: syncAll, - wallpaperEnabled: syncAll, - wifiConfigurationsRegistered: true, - wifiConfigurationsSynced: syncAll, - }; -} - -function getSyncAllPrefs() { - return getOsSyncPrefs(true); -} - -function getSyncNothingPrefs() { - return getOsSyncPrefs(false); -} - -// Returns a SyncStatus representing the default syncing state. -function getDefaultSyncStatus() { - return { - disabled: false, - hasError: false, - hasUnrecoverableError: false, - signedIn: true, - statusAction: settings.StatusAction.NO_ACTION, - }; -} - -function setupWithFeatureEnabled() { - cr.webUIListenerCallback( - 'os-sync-prefs-changed', /*featureEnabled=*/ true, getSyncAllPrefs()); - Polymer.dom.flush(); -} - -suite('OsSyncControlsTest', function() { - let browserProxy = null; - let syncControls = null; - let syncIconContainer = null; - - setup(function() { - browserProxy = new TestOsSyncBrowserProxy(); - settings.OsSyncBrowserProxyImpl.instance_ = browserProxy; - - PolymerTest.clearBody(); - syncControls = document.createElement('os-sync-controls'); - syncControls.syncStatus = getDefaultSyncStatus(); - syncControls.profileName = 'John Cena'; - syncControls.profileEmail = 'john.cena@gmail.com'; - syncControls.profileIconUrl = 'data:image/png;base64,abc123'; - document.body.appendChild(syncControls); - - // Alias to help with line wrapping in test cases. - syncIconContainer = syncControls.$.syncIconContainer; - }); - - teardown(function() { - syncControls.remove(); - settings.Router.getInstance().resetRouteForTesting(); - }); - - test('ControlsHiddenUntilInitialUpdateSent', function() { - assertTrue(syncControls.hidden); - setupWithFeatureEnabled(); - assertFalse(syncControls.hidden); - }); - - test('Avatar icon', function() { - assertEquals('data:image/png;base64,abc123', syncControls.$.avatarIcon.src); - }); - - test('Status icon is visible with feature enabled', function() { - setupWithFeatureEnabled(); - assertFalse(syncControls.$.syncIconContainer.hidden); - }); - - test('Status icon with error', function() { - setupWithFeatureEnabled(); - const status = getDefaultSyncStatus(); - status.hasError = true; - syncControls.syncStatus = status; - - assertTrue(syncIconContainer.classList.contains('sync-problem')); - assertTrue(!!syncControls.$$('[icon="settings:sync-problem"]')); - }); - - test('Status icon with sync paused for reauthentication', function() { - setupWithFeatureEnabled(); - const status = getDefaultSyncStatus(); - status.hasError = true; - status.statusAction = settings.StatusAction.REAUTHENTICATE; - syncControls.syncStatus = status; - - assertTrue(syncIconContainer.classList.contains('sync-paused')); - assertTrue(!!syncControls.$$('[icon="settings:sync-disabled"]')); - }); - - test('Status icon with sync disabled', function() { - setupWithFeatureEnabled(); - const status = getDefaultSyncStatus(); - status.disabled = true; - syncControls.syncStatus = status; - - assertTrue(syncIconContainer.classList.contains('sync-disabled')); - assertTrue(!!syncControls.$$('[icon="cr:sync"]')); - }); - - test('Account name and email with feature enabled', function() { - setupWithFeatureEnabled(); - assertEquals('John Cena', syncControls.$.accountTitle.textContent.trim()); - assertEquals( - 'Syncing to john.cena@gmail.com', - syncControls.$.accountSubtitle.textContent.trim()); - }); - - test('Account name and email with sync error', function() { - setupWithFeatureEnabled(); - syncControls.syncStatus = {hasError: true}; - Polymer.dom.flush(); - assertEquals( - `Sync isn't working`, syncControls.$.accountTitle.textContent.trim()); - assertEquals( - 'john.cena@gmail.com', - syncControls.$.accountSubtitle.textContent.trim()); - }); - - // Regression test for https://crbug.com/1076239 - test('Handles undefined syncStatus', function() { - syncControls.syncStatus = undefined; - setupWithFeatureEnabled(); - assertEquals('', syncControls.$.accountTitle.textContent.trim()); - assertEquals('', syncControls.$.accountSubtitle.textContent.trim()); - }); - - test('FeatureEnabled', function() { - setupWithFeatureEnabled(); - - // the button is always hidden when kSyncConsentOptional is disabled. - assertTrue(!syncControls.$$('#syncOnOffButton')); - - assertFalse(syncControls.$.syncEverythingCheckboxLabel.hasAttribute( - 'label-disabled')); - - const syncAllControl = syncControls.$.syncAllOsTypesControl; - assertFalse(syncAllControl.disabled); - assertTrue(syncAllControl.checked); - - const labels = syncControls.shadowRoot.querySelectorAll( - '.list-item:not([hidden]) > div.checkbox-label'); - for (const label of labels) { - assertFalse(label.hasAttribute('label-disabled')); - } - - const datatypeControls = syncControls.shadowRoot.querySelectorAll( - '.list-item:not([hidden]) > cr-toggle'); - for (const control of datatypeControls) { - assertTrue(control.disabled); - assertTrue(control.checked); - } - }); - - test('UncheckingSyncAllEnablesAllIndividualControls', async function() { - setupWithFeatureEnabled(); - syncControls.$.syncAllOsTypesControl.click(); - const prefs = await browserProxy.whenCalled('setOsSyncDatatypes'); - - const expectedPrefs = getSyncAllPrefs(); - expectedPrefs.syncAllOsTypes = false; - assertEquals(JSON.stringify(expectedPrefs), JSON.stringify(prefs)); - }); - - test('PrefChangeUpdatesControls', function() { - const prefs = getSyncAllPrefs(); - prefs.syncAllOsTypes = false; - cr.webUIListenerCallback( - 'os-sync-prefs-changed', /*featureEnabled=*/ true, prefs); - - const datatypeControls = syncControls.shadowRoot.querySelectorAll( - '.list-item:not([hidden]) > cr-toggle'); - for (const control of datatypeControls) { - assertFalse(control.disabled); - assertTrue(control.checked); - } - }); - - test('DisablingOneControlUpdatesPrefs', async function() { - setupWithFeatureEnabled(); - - // Disable "Sync All". - syncControls.$.syncAllOsTypesControl.click(); - // Disable "Settings". - syncControls.$.osPreferencesControl.click(); - const prefs = await browserProxy.whenCalled('setOsSyncDatatypes'); - - const expectedPrefs = getSyncAllPrefs(); - expectedPrefs.syncAllOsTypes = false; - expectedPrefs.osPreferencesSynced = false; - assertEquals(JSON.stringify(expectedPrefs), JSON.stringify(prefs)); - }); -}); - -suite('OsSyncControlsNavigationTest', function() { - test('DidNavigateEvents', async function() { - const browserProxy = new TestOsSyncBrowserProxy(); - settings.OsSyncBrowserProxyImpl.instance_ = browserProxy; - - settings.Router.getInstance().navigateTo(settings.routes.OS_SYNC); - await browserProxy.methodCalled('didNavigateToOsSyncPage'); - - settings.Router.getInstance().navigateTo(settings.routes.OS_PEOPLE); - await browserProxy.methodCalled('didNavigateAwayFromOsSyncPage'); - }); -});
diff --git a/chrome/test/data/webui/settings/chromeos/os_sync_controls_test.js b/chrome/test/data/webui/settings/chromeos/os_sync_controls_test.js index 2afb0292..37f511b 100644 --- a/chrome/test/data/webui/settings/chromeos/os_sync_controls_test.js +++ b/chrome/test/data/webui/settings/chromeos/os_sync_controls_test.js
@@ -19,7 +19,6 @@ super([ 'didNavigateToOsSyncPage', 'didNavigateAwayFromOsSyncPage', - 'setOsSyncFeatureEnabled', 'setOsSyncDatatypes', ]); } @@ -35,11 +34,6 @@ } /** @override */ - setOsSyncFeatureEnabled(enabled) { - this.methodCalled('setOsSyncFeatureEnabled', enabled); - } - - /** @override */ setOsSyncDatatypes(osSyncPrefs) { this.methodCalled('setOsSyncDatatypes', osSyncPrefs); } @@ -82,16 +76,8 @@ }; } -function setupWithFeatureEnabled() { - cr.webUIListenerCallback( - 'os-sync-prefs-changed', /*featureEnabled=*/ true, getSyncAllPrefs()); - Polymer.dom.flush(); -} - -function setupWithFeatureDisabled() { - cr.webUIListenerCallback( - 'os-sync-prefs-changed', /*featureEnabled=*/ false, - getSyncNothingPrefs()); +function setupSync() { + cr.webUIListenerCallback('os-sync-prefs-changed', getSyncAllPrefs()); Polymer.dom.flush(); } @@ -123,7 +109,7 @@ test('ControlsHiddenUntilInitialUpdateSent', function() { assertTrue(syncControls.hidden); - setupWithFeatureEnabled(); + setupSync(); assertFalse(syncControls.hidden); }); @@ -132,17 +118,12 @@ }); test('Status icon is visible with feature enabled', function() { - setupWithFeatureEnabled(); + setupSync(); assertFalse(syncControls.$.syncIconContainer.hidden); }); - test('Status icon is hidden with feature disabled', function() { - setupWithFeatureDisabled(); - assertTrue(syncControls.$.syncIconContainer.hidden); - }); - test('Status icon with error', function() { - setupWithFeatureEnabled(); + setupSync(); const status = getDefaultSyncStatus(); status.hasError = true; syncControls.syncStatus = status; @@ -152,7 +133,7 @@ }); test('Status icon with sync paused for reauthentication', function() { - setupWithFeatureEnabled(); + setupSync(); const status = getDefaultSyncStatus(); status.hasError = true; status.statusAction = settings.StatusAction.REAUTHENTICATE; @@ -163,7 +144,7 @@ }); test('Status icon with sync disabled', function() { - setupWithFeatureEnabled(); + setupSync(); const status = getDefaultSyncStatus(); status.disabled = true; syncControls.syncStatus = status; @@ -173,23 +154,15 @@ }); test('Account name and email with feature enabled', function() { - setupWithFeatureEnabled(); + setupSync(); assertEquals('John Cena', syncControls.$.accountTitle.textContent.trim()); assertEquals( 'Syncing to john.cena@gmail.com', syncControls.$.accountSubtitle.textContent.trim()); }); - test('Account name and email with feature disabled', function() { - setupWithFeatureDisabled(); - assertEquals('John Cena', syncControls.$.accountTitle.textContent.trim()); - assertEquals( - 'john.cena@gmail.com', - syncControls.$.accountSubtitle.textContent.trim()); - }); - test('Account name and email with sync error', function() { - setupWithFeatureEnabled(); + setupSync(); syncControls.syncStatus = {hasError: true}; Polymer.dom.flush(); assertEquals( @@ -202,41 +175,13 @@ // Regression test for https://crbug.com/1076239 test('Handles undefined syncStatus', function() { syncControls.syncStatus = undefined; - setupWithFeatureEnabled(); + setupSync(); assertEquals('', syncControls.$.accountTitle.textContent.trim()); assertEquals('', syncControls.$.accountSubtitle.textContent.trim()); }); - test('FeatureDisabled', function() { - setupWithFeatureDisabled(); - - assertTrue(!!syncControls.$$('#syncOnOffButton')); - - assertTrue(syncControls.$.syncEverythingCheckboxLabel.hasAttribute( - 'label-disabled')); - - const syncAllControl = syncControls.$.syncAllOsTypesControl; - assertTrue(syncAllControl.disabled); - assertFalse(syncAllControl.checked); - - const labels = syncControls.shadowRoot.querySelectorAll( - '.list-item:not([hidden]) > div'); - for (const label of labels) { - assertTrue(label.hasAttribute('label-disabled')); - } - - const datatypeControls = syncControls.shadowRoot.querySelectorAll( - '.list-item:not([hidden]) > cr-toggle'); - for (const control of datatypeControls) { - assertTrue(control.disabled); - assertFalse(control.checked); - } - }); - - test('FeatureEnabled', function() { - setupWithFeatureEnabled(); - - assertTrue(!!syncControls.$$('#syncOnOffButton')); + test('SyncEnabled', function() { + setupSync(); assertFalse(syncControls.$.syncEverythingCheckboxLabel.hasAttribute( 'label-disabled')); @@ -259,36 +204,8 @@ } }); - test('ClickingTurnOffDisablesFeature', async function() { - setupWithFeatureEnabled(); - syncControls.$$('#syncOnOffButton').click(); - const enabled = await browserProxy.whenCalled('setOsSyncFeatureEnabled'); - assertFalse(enabled); - }); - - test('Deep link to sync on/off', async function() { - setupWithFeatureEnabled(); - - const params = new URLSearchParams; - params.append('settingId', '302'); - settings.Router.getInstance().navigateTo(settings.routes.OS_SYNC, params); - - const deepLinkElement = syncControls.$$('#syncOnOffButton'); - await test_util.waitAfterNextRender(deepLinkElement); - assertEquals( - deepLinkElement, getDeepActiveElement(), - 'Sync on/off should be focused for settingId=302.'); - }); - - test('ClickingTurnOnEnablesFeature', async function() { - setupWithFeatureDisabled(); - syncControls.$$('#syncOnOffButton').click(); - const enabled = await browserProxy.whenCalled('setOsSyncFeatureEnabled'); - assertTrue(enabled); - }); - test('UncheckingSyncAllEnablesAllIndividualControls', async function() { - setupWithFeatureEnabled(); + setupSync(); syncControls.$.syncAllOsTypesControl.click(); const prefs = await browserProxy.whenCalled('setOsSyncDatatypes'); @@ -300,8 +217,7 @@ test('PrefChangeUpdatesControls', function() { const prefs = getSyncAllPrefs(); prefs.syncAllOsTypes = false; - cr.webUIListenerCallback( - 'os-sync-prefs-changed', /*featureEnabled=*/ true, prefs); + cr.webUIListenerCallback('os-sync-prefs-changed', prefs); const datatypeControls = syncControls.shadowRoot.querySelectorAll( '.list-item:not([hidden]) > cr-toggle'); @@ -312,7 +228,7 @@ }); test('DisablingOneControlUpdatesPrefs', async function() { - setupWithFeatureEnabled(); + setupSync(); // Disable "Sync All". syncControls.$.syncAllOsTypesControl.click();
diff --git a/chrome/test/data/webui/support_tool/OWNERS b/chrome/test/data/webui/support_tool/OWNERS new file mode 100644 index 0000000..63381752 --- /dev/null +++ b/chrome/test/data/webui/support_tool/OWNERS
@@ -0,0 +1,3 @@ +iremuguz@google.com +pmarko@chromium.org +srad@google.com \ No newline at end of file
diff --git a/chrome/test/data/webui/sys_internals/all_tests.js b/chrome/test/data/webui/sys_internals/all_tests.js new file mode 100644 index 0000000..8268b1b --- /dev/null +++ b/chrome/test/data/webui/sys_internals/all_tests.js
@@ -0,0 +1,15 @@ +// 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 './api_test.js'; +import './line_chart/data_series_test.js'; +import './line_chart/line_chart_test.js'; +import './line_chart/menu_test.js'; +import './line_chart/scrollbar_test.js'; +import './line_chart/sub_chart_test.js'; +import './line_chart/unit_label_test.js'; +import './page_drawer_test.js'; +import './page_infopage_test.js'; +import './page_switch_test.js'; +import './page_unit_test.js';
diff --git a/chrome/test/data/webui/sys_internals/api_test.js b/chrome/test/data/webui/sys_internals/api_test.js index e7d50525..e35330a2c 100644 --- a/chrome/test/data/webui/sys_internals/api_test.js +++ b/chrome/test/data/webui/sys_internals/api_test.js
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -var ApiTest = ApiTest || {}; +import {sendWithPromise} from 'chrome://resources/js/cr.m.js'; -ApiTest.getSysInfo = function() { +suite('getSysInfo', function() { test('Message handler integration test', function(done) { function checkConst(constVal) { if (!Number.isInteger(constVal.counterMax)) { @@ -56,7 +56,7 @@ } } - cr.sendWithPromise('getSysInfo').then(function(result) { + sendWithPromise('getSysInfo').then(function(result) { try { checkConst(result.const); checkCpus(result.cpus); @@ -68,6 +68,4 @@ } }); }); - - mocha.run(); -}; +});
diff --git a/chrome/test/data/webui/sys_internals/line_chart/data_series_test.js b/chrome/test/data/webui/sys_internals/line_chart/data_series_test.js index c3f56127..a277164 100644 --- a/chrome/test/data/webui/sys_internals/line_chart/data_series_test.js +++ b/chrome/test/data/webui/sys_internals/line_chart/data_series_test.js
@@ -2,98 +2,91 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -var LineChartTest = LineChartTest || {}; +import {DataSeries} from 'chrome://sys-internals/line_chart/data_series.js'; -LineChartTest.DataSeries = function() { - suite('LineChart DataSeries unit test', function() { - test('linerInterpolation', function() { - TestUtil.assertCloseTo( - LineChart.DataSeries.linearInterpolation(100, 15, 142, 32, 118), - 22.285, 1e-2); - TestUtil.assertCloseTo( - LineChart.DataSeries.linearInterpolation(42, 15, 142, 32, 65), 18.91, - 1e-2); - TestUtil.assertCloseTo( - LineChart.DataSeries.linearInterpolation( - 100000, 640000, 123456, 654545, 112345), - 647655.099, 1e-2); - }); +import {assertCloseTo} from '../test_util.js'; - test('dataPointLinerInterpolation', function() { - const dataSeries = new LineChart.DataSeries('Test', '#aabbcc'); - dataSeries.getValues(0, 100, 10); - const pointA = {time: 100, value: 15}; - const pointB = {time: 142, value: 32}; - TestUtil.assertCloseTo( - dataSeries.dataPointLinearInterpolation(pointA, pointB, 118), 23.5, - 1e-2); - - dataSeries.getValues(30, 100, 10); - const pointC = {time: 42, value: 15}; - const pointD = {time: 142, value: 32}; - TestUtil.assertCloseTo( - dataSeries.dataPointLinearInterpolation(pointC, pointD, 65), 15, - 1e-2); - TestUtil.assertCloseTo( - dataSeries.dataPointLinearInterpolation(pointC, pointD, 135), 32, - 1e-2); - - dataSeries.getValues(42, 100, 10); - const pointE = {time: 42, value: 615}; - const pointF = {time: 542, value: 132}; - TestUtil.assertCloseTo( - dataSeries.dataPointLinearInterpolation(pointE, pointF, 315), - 421.7999, 1e-2); - }); - - test('DataSeries integration test', function() { - const dataSeries = new LineChart.DataSeries('Test', '#aabbcc'); - dataSeries.getValues(1200, 150, 10); // Call when 0 point. - dataSeries.addDataPoint(10, 1000); - dataSeries.getValues(1200, 150, 10); // Call when 1 point. - dataSeries.addDataPoint(20, 2000); - dataSeries.addDataPoint(42, 3000); - dataSeries.addDataPoint(31, 4000); - dataSeries.addDataPoint(59, 5000); - dataSeries.addDataPoint(787, 6000); - dataSeries.addDataPoint(612, 7000); - dataSeries.addDataPoint(4873, 8000); - dataSeries.addDataPoint(22, 9000); - dataSeries.addDataPoint(10, 10000); - - assertEquals(dataSeries.findLowerBoundPointIndex_(1500), 1); - assertEquals(dataSeries.findLowerBoundPointIndex_(9000), 8); - assertEquals(dataSeries.findLowerBoundPointIndex_(10001), 10); - - assertDeepEquals( - dataSeries.getSampleValue_(1, 2500), {value: 20, nextIndex: 2}); - assertDeepEquals( - dataSeries.getSampleValue_(3, 3000), {value: null, nextIndex: 3}); - assertDeepEquals( - dataSeries.getSampleValue_(4, 7000), {value: 423, nextIndex: 6}); - assertDeepEquals( - dataSeries.getSampleValue_(10, 11000), {value: null, nextIndex: 10}); - - assertDeepEquals(dataSeries.getValues(2000, 2000, 1), [31]); - assertEquals(dataSeries.getMaxValue(2000, 2000, 1), 31); - - assertDeepEquals(dataSeries.getValues(0, 1000, 3), [null, 10, 20]); - assertEquals(dataSeries.getMaxValue(0, 1000, 3), 20); - - /* (10 + 20) / 2 === 15 */ - assertDeepEquals(dataSeries.getValues(0, 3000, 1), [15]); - assertEquals(dataSeries.getMaxValue(0, 3000, 1), 15); - - assertDeepEquals( - dataSeries.getValues(4545, 1500, 5), [423, 612, 2447.5, 10, null]); - assertEquals(dataSeries.getMaxValue(4545, 1500, 5), 2447.5); - - assertDeepEquals( - dataSeries.getValues(1200, 100, 10), - [12, null, null, null, null, null, null, null, 20, 22.2]); - assertEquals(dataSeries.getMaxValue(1200, 100, 10), 22.2); - }); +suite('LineChart_DataSeries', function() { + test('linerInterpolation', function() { + assertCloseTo( + DataSeries.linearInterpolation(100, 15, 142, 32, 118), 22.285, 1e-2); + assertCloseTo( + DataSeries.linearInterpolation(42, 15, 142, 32, 65), 18.91, 1e-2); + assertCloseTo( + DataSeries.linearInterpolation(100000, 640000, 123456, 654545, 112345), + 647655.099, 1e-2); }); - mocha.run(); -}; + test('dataPointLinerInterpolation', function() { + const dataSeries = new DataSeries('Test', '#aabbcc'); + dataSeries.getValues(0, 100, 10); + const pointA = {time: 100, value: 15}; + const pointB = {time: 142, value: 32}; + assertCloseTo( + dataSeries.dataPointLinearInterpolation(pointA, pointB, 118), 23.5, + 1e-2); + + dataSeries.getValues(30, 100, 10); + const pointC = {time: 42, value: 15}; + const pointD = {time: 142, value: 32}; + assertCloseTo( + dataSeries.dataPointLinearInterpolation(pointC, pointD, 65), 15, 1e-2); + assertCloseTo( + dataSeries.dataPointLinearInterpolation(pointC, pointD, 135), 32, 1e-2); + + dataSeries.getValues(42, 100, 10); + const pointE = {time: 42, value: 615}; + const pointF = {time: 542, value: 132}; + assertCloseTo( + dataSeries.dataPointLinearInterpolation(pointE, pointF, 315), 421.7999, + 1e-2); + }); + + test('DataSeries integration test', function() { + const dataSeries = new DataSeries('Test', '#aabbcc'); + dataSeries.getValues(1200, 150, 10); // Call when 0 point. + dataSeries.addDataPoint(10, 1000); + dataSeries.getValues(1200, 150, 10); // Call when 1 point. + dataSeries.addDataPoint(20, 2000); + dataSeries.addDataPoint(42, 3000); + dataSeries.addDataPoint(31, 4000); + dataSeries.addDataPoint(59, 5000); + dataSeries.addDataPoint(787, 6000); + dataSeries.addDataPoint(612, 7000); + dataSeries.addDataPoint(4873, 8000); + dataSeries.addDataPoint(22, 9000); + dataSeries.addDataPoint(10, 10000); + + assertEquals(dataSeries.findLowerBoundPointIndex_(1500), 1); + assertEquals(dataSeries.findLowerBoundPointIndex_(9000), 8); + assertEquals(dataSeries.findLowerBoundPointIndex_(10001), 10); + + assertDeepEquals( + dataSeries.getSampleValue_(1, 2500), {value: 20, nextIndex: 2}); + assertDeepEquals( + dataSeries.getSampleValue_(3, 3000), {value: null, nextIndex: 3}); + assertDeepEquals( + dataSeries.getSampleValue_(4, 7000), {value: 423, nextIndex: 6}); + assertDeepEquals( + dataSeries.getSampleValue_(10, 11000), {value: null, nextIndex: 10}); + + assertDeepEquals(dataSeries.getValues(2000, 2000, 1), [31]); + assertEquals(dataSeries.getMaxValue(2000, 2000, 1), 31); + + assertDeepEquals(dataSeries.getValues(0, 1000, 3), [null, 10, 20]); + assertEquals(dataSeries.getMaxValue(0, 1000, 3), 20); + + /* (10 + 20) / 2 === 15 */ + assertDeepEquals(dataSeries.getValues(0, 3000, 1), [15]); + assertEquals(dataSeries.getMaxValue(0, 3000, 1), 15); + + assertDeepEquals( + dataSeries.getValues(4545, 1500, 5), [423, 612, 2447.5, 10, null]); + assertEquals(dataSeries.getMaxValue(4545, 1500, 5), 2447.5); + + assertDeepEquals( + dataSeries.getValues(1200, 100, 10), + [12, null, null, null, null, null, null, null, 20, 22.2]); + assertEquals(dataSeries.getMaxValue(1200, 100, 10), 22.2); + }); +});
diff --git a/chrome/test/data/webui/sys_internals/line_chart/line_chart_test.js b/chrome/test/data/webui/sys_internals/line_chart/line_chart_test.js index 11d1f61..9d3460e 100644 --- a/chrome/test/data/webui/sys_internals/line_chart/line_chart_test.js +++ b/chrome/test/data/webui/sys_internals/line_chart/line_chart_test.js
@@ -2,26 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -var LineChartTest = LineChartTest || {}; +import {SAMPLE_RATE, UnitLabelAlign} from 'chrome://sys-internals/line_chart/constants.js'; +import {DataSeries} from 'chrome://sys-internals/line_chart/data_series.js'; +import {LineChart} from 'chrome://sys-internals/line_chart/line_chart.js'; -LineChartTest.LineChart = function() { +import {assertCloseTo} from '../test_util.js'; + +suite('LineChart_LineChart', function() { test('touchDistance', function() { const touchA = {clientX: 100, clientY: 100}; const touchB = {clientX: 140, clientY: 130}; - TestUtil.assertCloseTo( - LineChart.LineChart.touchDistance_(touchA, touchB), 50, 1e-2); + assertCloseTo(LineChart.touchDistance_(touchA, touchB), 50, 1e-2); const touchC = {clientX: 1230, clientY: 475}; const touchD = {clientX: 523, clientY: 675}; - TestUtil.assertCloseTo( - LineChart.LineChart.touchDistance_(touchC, touchD), 734.744, 1e-2); + assertCloseTo(LineChart.touchDistance_(touchC, touchD), 734.744, 1e-2); }); test('getSuitableTimeStep_', function() { - assertEquals(LineChart.LineChart.getSuitableTimeStep_(100, 1000), 300000); - assertEquals(LineChart.LineChart.getSuitableTimeStep_(70, 1500), 300000); - assertEquals(LineChart.LineChart.getSuitableTimeStep_(120, 30000), 3600000); - assertEquals(LineChart.LineChart.getSuitableTimeStep_(90, 100), 30000); + assertEquals(LineChart.getSuitableTimeStep_(100, 1000), 300000); + assertEquals(LineChart.getSuitableTimeStep_(70, 1500), 300000); + assertEquals(LineChart.getSuitableTimeStep_(120, 30000), 3600000); + assertEquals(LineChart.getSuitableTimeStep_(90, 100), 30000); }); test('LineChart integration test', function() { @@ -31,77 +33,73 @@ document.body.appendChild(rootDiv); assertEquals(rootDiv.offsetWidth, 1000); - const data1 = new LineChart.DataSeries('test1', '#aabbcc'); + const data1 = new DataSeries('test1', '#aabbcc'); data1.addDataPoint(100, 1504764694799); data1.addDataPoint(100, 1504764695799); data1.addDataPoint(100, 1504764696799); - const data2 = new LineChart.DataSeries('test2', '#aabbcc'); + const data2 = new DataSeries('test2', '#aabbcc'); data2.addDataPoint(40, 1504764694799); data2.addDataPoint(42, 1504764695799); data2.addDataPoint(40, 1504764696799); - const data3 = new LineChart.DataSeries('test3', '#aabbcc'); + const data3 = new DataSeries('test3', '#aabbcc'); data3.addDataPoint(1024, 1504764694799); data3.addDataPoint(2048, 1504764695799); data3.addDataPoint(4096, 1504764696799); - const lineChart = new LineChart.LineChart(); + const lineChart = new LineChart(); lineChart.attachRootDiv(rootDiv); assertFalse(lineChart.shouldRender()); - lineChart.setSubChart( - LineChart.UnitLabelAlign.LEFT, ['', 'K', 'M', 'G'], 1000); - lineChart.setSubChart( - LineChart.UnitLabelAlign.RIGHT, ['B', 'KB', 'MB', 'GB'], 1024); - lineChart.addDataSeries(LineChart.UnitLabelAlign.LEFT, data1); - lineChart.addDataSeries(LineChart.UnitLabelAlign.RIGHT, data2); - lineChart.addDataSeries(LineChart.UnitLabelAlign.RIGHT, data3); + lineChart.setSubChart(UnitLabelAlign.LEFT, ['', 'K', 'M', 'G'], 1000); + lineChart.setSubChart(UnitLabelAlign.RIGHT, ['B', 'KB', 'MB', 'GB'], 1024); + lineChart.addDataSeries(UnitLabelAlign.LEFT, data1); + lineChart.addDataSeries(UnitLabelAlign.RIGHT, data2); + lineChart.addDataSeries(UnitLabelAlign.RIGHT, data3); assertTrue(lineChart.shouldRender()); const visibleChartWidth = lineChart.getChartVisibleWidth(); lineChart.updateEndTime( lineChart.startTime_ + 100000 + visibleChartWidth * 100); - const offset = (1000 + visibleChartWidth) % LineChart.SAMPLE_RATE; - TestUtil.assertCloseTo( + const offset = (1000 + visibleChartWidth) % SAMPLE_RATE; + assertCloseTo( lineChart.getChartWidth_(), 1000 + visibleChartWidth - offset, 1e-2); assertTrue(lineChart.scrollbar_.isScrolledToRightEdge()); - /* See |LineChart.Scrollbar.isScrolledToRightEdge()|. */ + /* See |Scrollbar.isScrolledToRightEdge()|. */ const scrollError = 2; - TestUtil.assertCloseTo(lineChart.scale_, 100, 1e-2); - TestUtil.assertCloseTo( + assertCloseTo(lineChart.scale_, 100, 1e-2); + assertCloseTo( lineChart.scrollbar_.getPosition(), 1000 - offset, scrollError); lineChart.scroll(100); - TestUtil.assertCloseTo( + assertCloseTo( lineChart.scrollbar_.getPosition(), 1000 - offset, scrollError); lineChart.scroll(-50); - TestUtil.assertCloseTo( + assertCloseTo( lineChart.scrollbar_.getPosition(), 950 - offset, scrollError); lineChart.scroll(10.85); - TestUtil.assertCloseTo( + assertCloseTo( lineChart.scrollbar_.getPosition(), 961 - offset, scrollError); lineChart.scroll(-10000); - TestUtil.assertCloseTo(lineChart.scrollbar_.getPosition(), 0, scrollError); + assertCloseTo(lineChart.scrollbar_.getPosition(), 0, scrollError); lineChart.scrollbar_.scrollToRightEdge(); - TestUtil.assertCloseTo( + assertCloseTo( lineChart.scrollbar_.getPosition(), 1000 - offset, scrollError); lineChart.zoom(7.6); - TestUtil.assertCloseTo(lineChart.scale_, 760, 1e-2); + assertCloseTo(lineChart.scale_, 760, 1e-2); assertTrue(lineChart.scrollbar_.isScrolledToRightEdge()); lineChart.zoom(1.42); - TestUtil.assertCloseTo(lineChart.scale_, 1079.2, 1e-2); + assertCloseTo(lineChart.scale_, 1079.2, 1e-2); assertTrue(lineChart.scrollbar_.isScrolledToRightEdge()); lineChart.zoom(0.21); - TestUtil.assertCloseTo(lineChart.scale_, 226.632, 1e-2); + assertCloseTo(lineChart.scale_, 226.632, 1e-2); assertTrue(lineChart.scrollbar_.isScrolledToRightEdge()); lineChart.zoom(1.25); - TestUtil.assertCloseTo(lineChart.scale_, 283.29, 1e-2); + assertCloseTo(lineChart.scale_, 283.29, 1e-2); assertTrue(lineChart.scrollbar_.isScrolledToRightEdge()); lineChart.clearAllSubChart(); assertFalse(lineChart.shouldRender()); }); - - mocha.run(); -}; +});
diff --git a/chrome/test/data/webui/sys_internals/line_chart/menu_test.js b/chrome/test/data/webui/sys_internals/line_chart/menu_test.js index be22af6..05ca5ba74 100644 --- a/chrome/test/data/webui/sys_internals/line_chart/menu_test.js +++ b/chrome/test/data/webui/sys_internals/line_chart/menu_test.js
@@ -2,14 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -var LineChartTest = LineChartTest || {}; +import {DataSeries} from 'chrome://sys-internals/line_chart/data_series.js'; +import {Menu} from 'chrome://sys-internals/line_chart/menu.js'; -LineChartTest.Menu = function() { +suite('LineChart_Menu', function() { test('Menu integration test', function() { - const menu = new LineChart.Menu(function() {}); - const data1 = new LineChart.DataSeries('test1', '#aabbcc'); - const data2 = new LineChart.DataSeries('test2', '#aabbcc'); - const data3 = new LineChart.DataSeries('test3', '#aabbcc'); + const menu = new Menu(function() {}); + const data1 = new DataSeries('test1', '#aabbcc'); + const data2 = new DataSeries('test2', '#aabbcc'); + const data3 = new DataSeries('test3', '#aabbcc'); menu.addDataSeries(data1); menu.addDataSeries(data2); @@ -41,6 +42,4 @@ assertEquals(menu.dataSeries_.length, 0); assertEquals(menu.buttons_.length, 0); }); - - mocha.run(); -}; +});
diff --git a/chrome/test/data/webui/sys_internals/line_chart/scrollbar_test.js b/chrome/test/data/webui/sys_internals/line_chart/scrollbar_test.js index cd1061f3..b165a6f12 100644 --- a/chrome/test/data/webui/sys_internals/line_chart/scrollbar_test.js +++ b/chrome/test/data/webui/sys_internals/line_chart/scrollbar_test.js
@@ -2,28 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -var LineChartTest = LineChartTest || {}; +import {Scrollbar} from 'chrome://sys-internals/line_chart/scrollbar.js'; -LineChartTest.Scrollbar = function() { +import {assertCloseTo} from '../test_util.js'; + +suite('LineChart_Scrollbar', function() { test('Scrollbar integration test', function() { - const scrollbar = new LineChart.Scrollbar(function() {}); + const scrollbar = new Scrollbar(function() {}); scrollbar.resize(100); scrollbar.setRange(1000); - /* See |LineChart.Scrollbar.isScrolledToRightEdge()|. */ + /* See |Scrollbar.isScrolledToRightEdge()|. */ const scrollError = 2; assertFalse(scrollbar.isScrolledToRightEdge()); - TestUtil.assertCloseTo(scrollbar.getPosition(), 0, scrollError); + assertCloseTo(scrollbar.getPosition(), 0, scrollError); scrollbar.scrollToRightEdge(); assertTrue(scrollbar.isScrolledToRightEdge()); - TestUtil.assertCloseTo(scrollbar.getPosition(), 1000, scrollError); + assertCloseTo(scrollbar.getPosition(), 1000, scrollError); scrollbar.setPosition(500); assertFalse(scrollbar.isScrolledToRightEdge()); - TestUtil.assertCloseTo(scrollbar.getPosition(), 500, scrollError); + assertCloseTo(scrollbar.getPosition(), 500, scrollError); scrollbar.setRange(100); assertTrue(scrollbar.isScrolledToRightEdge()); - TestUtil.assertCloseTo(scrollbar.getPosition(), 100, scrollError); + assertCloseTo(scrollbar.getPosition(), 100, scrollError); }); - - mocha.run(); -}; +});
diff --git a/chrome/test/data/webui/sys_internals/line_chart/sub_chart_test.js b/chrome/test/data/webui/sys_internals/line_chart/sub_chart_test.js index bebc13a..102caa8 100644 --- a/chrome/test/data/webui/sys_internals/line_chart/sub_chart_test.js +++ b/chrome/test/data/webui/sys_internals/line_chart/sub_chart_test.js
@@ -2,26 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -var LineChartTest = LineChartTest || {}; +import {UnitLabelAlign} from 'chrome://sys-internals/line_chart/constants.js'; +import {DataSeries} from 'chrome://sys-internals/line_chart/data_series.js'; +import {SubChart} from 'chrome://sys-internals/line_chart/sub_chart.js'; +import {UnitLabel} from 'chrome://sys-internals/line_chart/unit_label.js'; -LineChartTest.SubChart = function() { +import {assertCloseTo} from '../test_util.js'; + +suite('LineChart_SubChart', function() { test('SubChart integration test', function() { - const data1 = new LineChart.DataSeries('test1', '#aabbcc'); + const data1 = new DataSeries('test1', '#aabbcc'); data1.addDataPoint(100, 1504764694799); data1.addDataPoint(100, 1504764695799); data1.addDataPoint(100, 1504764696799); - const data2 = new LineChart.DataSeries('test2', '#aabbcc'); + const data2 = new DataSeries('test2', '#aabbcc'); data2.addDataPoint(40, 1504764694799); data2.addDataPoint(42, 1504764695799); data2.addDataPoint(40, 1504764696799); - const data3 = new LineChart.DataSeries('test3', '#aabbcc'); + const data3 = new DataSeries('test3', '#aabbcc'); data3.addDataPoint(1024, 1504764694799); data3.addDataPoint(2048, 1504764695799); data3.addDataPoint(4096, 1504764696799); - const label = new LineChart.UnitLabel(['/s', 'K/s', 'M/s'], 1000); - const subChart = - new LineChart.SubChart(label, LineChart.UnitLabelAlign.RIGHT); + const label = new UnitLabel(['/s', 'K/s', 'M/s'], 1000); + const subChart = new SubChart(label, UnitLabelAlign.RIGHT); assertFalse(subChart.shouldRender()); subChart.addDataSeries(data1); subChart.addDataSeries(data2); @@ -30,18 +34,16 @@ assertTrue(subChart.shouldRender()); subChart.setLayout(1920, 1080, 14, 1504764695799, 150, 8); - TestUtil.assertCloseTo(subChart.label_.maxValueCache_, 2389.333, 1e-2); + assertCloseTo(subChart.label_.maxValueCache_, 2389.333, 1e-2); subChart.setMaxValue(424242); - TestUtil.assertCloseTo(subChart.label_.maxValueCache_, 424242, 1e-2); + assertCloseTo(subChart.label_.maxValueCache_, 424242, 1e-2); subChart.setLayout(1920, 1080, 14, 1504764695799, 10, 8); - TestUtil.assertCloseTo(subChart.label_.maxValueCache_, 424242, 1e-2); + assertCloseTo(subChart.label_.maxValueCache_, 424242, 1e-2); subChart.setMaxValue(null); - TestUtil.assertCloseTo(subChart.label_.maxValueCache_, 4096, 1e-2); + assertCloseTo(subChart.label_.maxValueCache_, 4096, 1e-2); subChart.setLayout(150, 100, 14, 1504764685799, 100, 8); - TestUtil.assertCloseTo(subChart.label_.maxValueCache_, 3072, 1e-2); + assertCloseTo(subChart.label_.maxValueCache_, 3072, 1e-2); }); - - mocha.run(); -}; +});
diff --git a/chrome/test/data/webui/sys_internals/line_chart/unit_label_test.js b/chrome/test/data/webui/sys_internals/line_chart/unit_label_test.js index b0000ec1..10a0888 100644 --- a/chrome/test/data/webui/sys_internals/line_chart/unit_label_test.js +++ b/chrome/test/data/webui/sys_internals/line_chart/unit_label_test.js
@@ -2,63 +2,64 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -var LineChartTest = LineChartTest || {}; +import {UnitLabel} from 'chrome://sys-internals/line_chart/unit_label.js'; -LineChartTest.UnitLabel = function() { - suite('LineChart Label unit test', function() { - suiteSetup(function() { - TEST_MEM_UNIT = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']; - TEST_MEM_UNITBASE = 1024; - testLabel = new LineChart.UnitLabel(TEST_MEM_UNIT, TEST_MEM_UNITBASE); - }); +import {assertCloseTo} from '../test_util.js'; - test('getSuitableUnit', function() { - assertDeepEquals( - LineChart.UnitLabel.getSuitableUnit( - Math.pow(1024, 4) * 5, TEST_MEM_UNIT, TEST_MEM_UNITBASE), - {value: 5, unitIdx: 4}); +suite('LineChart_UnitLabel', function() { + var TEST_MEM_UNIT; + var TEST_MEM_UNITBASE; + var testLabel; - assertDeepEquals( - LineChart.UnitLabel.getSuitableUnit( - Math.pow(1024, 2) * 1023, TEST_MEM_UNIT, TEST_MEM_UNITBASE), - {value: 1023, unitIdx: 2}); - - assertDeepEquals( - LineChart.UnitLabel.getSuitableUnit( - Math.pow(1024, 6), TEST_MEM_UNIT, TEST_MEM_UNITBASE), - {value: 1024, unitIdx: 5}); - }); - - test('getTopLabelValue_', function() { - assertEquals(testLabel.getTopLabelValue_(55, 10), 60); - assertEquals(testLabel.getTopLabelValue_(73.5, 15), 75); - }); - - test('UnitLabel integration test', function() { - testLabel.setLayout(600, 12, 2); - assertEquals(testLabel.getMaxNumberOfLabel_(), 6); - assertEquals(testLabel.getCurrentUnitString(), 'B'); - assertEquals(testLabel.getRealValueWithCurrentUnit_(1234), 1234); - - testLabel.setMaxValue(Math.pow(1024, 4) * 123); - assertEquals(testLabel.getCurrentUnitString(), 'TB'); - assertEquals( - testLabel.getRealValueWithCurrentUnit_(42), Math.pow(1024, 4) * 42); - - assertEquals(testLabel.getNumberOfLabelWithStepSize_(20), 8); - assertEquals(testLabel.getNumberOfLabelWithStepSize_(50), 4); - assertEquals(testLabel.getNumberOfLabelWithStepSize_(0.1), 1231); - - assertDeepEquals( - testLabel.getSuitableStepSize_(), - {stepSize: 50, stepSizePrecision: 0}); - assertDeepEquals( - testLabel.getLabels(), ['150 TB', '100 TB', '50 TB', '0 TB']); - - const realTopValue = Math.pow(1024, 4) * 150; - TestUtil.assertCloseTo(testLabel.getScale() * realTopValue, 600, 1e-2); - }); + suiteSetup(function() { + TEST_MEM_UNIT = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']; + TEST_MEM_UNITBASE = 1024; + testLabel = new UnitLabel(TEST_MEM_UNIT, TEST_MEM_UNITBASE); }); - mocha.run(); -}; + test('getSuitableUnit', function() { + assertDeepEquals( + UnitLabel.getSuitableUnit( + Math.pow(1024, 4) * 5, TEST_MEM_UNIT, TEST_MEM_UNITBASE), + {value: 5, unitIdx: 4}); + + assertDeepEquals( + UnitLabel.getSuitableUnit( + Math.pow(1024, 2) * 1023, TEST_MEM_UNIT, TEST_MEM_UNITBASE), + {value: 1023, unitIdx: 2}); + + assertDeepEquals( + UnitLabel.getSuitableUnit( + Math.pow(1024, 6), TEST_MEM_UNIT, TEST_MEM_UNITBASE), + {value: 1024, unitIdx: 5}); + }); + + test('getTopLabelValue_', function() { + assertEquals(testLabel.getTopLabelValue_(55, 10), 60); + assertEquals(testLabel.getTopLabelValue_(73.5, 15), 75); + }); + + test('UnitLabel integration test', function() { + testLabel.setLayout(600, 12, 2); + assertEquals(testLabel.getMaxNumberOfLabel_(), 6); + assertEquals(testLabel.getCurrentUnitString(), 'B'); + assertEquals(testLabel.getRealValueWithCurrentUnit_(1234), 1234); + + testLabel.setMaxValue(Math.pow(1024, 4) * 123); + assertEquals(testLabel.getCurrentUnitString(), 'TB'); + assertEquals( + testLabel.getRealValueWithCurrentUnit_(42), Math.pow(1024, 4) * 42); + + assertEquals(testLabel.getNumberOfLabelWithStepSize_(20), 8); + assertEquals(testLabel.getNumberOfLabelWithStepSize_(50), 4); + assertEquals(testLabel.getNumberOfLabelWithStepSize_(0.1), 1231); + + assertDeepEquals( + testLabel.getSuitableStepSize_(), {stepSize: 50, stepSizePrecision: 0}); + assertDeepEquals( + testLabel.getLabels(), ['150 TB', '100 TB', '50 TB', '0 TB']); + + const realTopValue = Math.pow(1024, 4) * 150; + assertCloseTo(testLabel.getScale() * realTopValue, 600, 1e-2); + }); +});
diff --git a/chrome/test/data/webui/sys_internals/page_drawer_test.js b/chrome/test/data/webui/sys_internals/page_drawer_test.js index d034cd8b..c21c084 100644 --- a/chrome/test/data/webui/sys_internals/page_drawer_test.js +++ b/chrome/test/data/webui/sys_internals/page_drawer_test.js
@@ -2,76 +2,75 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -var PageTest = PageTest || {}; +import {PromiseResolver} from 'chrome://resources/js/promise_resolver.m.js'; +import {$} from 'chrome://resources/js/util.m.js'; +import {closeDrawer, initialize, openDrawer, promiseResolvers} from 'chrome://sys-internals/index.js'; -PageTest.Drawer = function() { - suite('Page drawer integration test', function() { - suiteSetup('Wait for the page initialize.', function() { - return SysInternals.promiseResolvers.waitSysInternalsInitialized.promise; - }); - - function checkOpen() { - assertFalse($('sys-internals-drawer').hasAttribute('hidden')); - assertFalse($('sys-internals-drawer').classList.contains('hidden')); - assertFalse($('drawer-menu').classList.contains('hidden')); - } - - function checkClose() { - assertTrue($('sys-internals-drawer').hasAttribute('hidden')); - assertTrue($('sys-internals-drawer').classList.contains('hidden')); - assertTrue($('drawer-menu').classList.contains('hidden')); - } - - function operate(action, checker) { - const promiseResolvers = SysInternals.promiseResolvers; - promiseResolvers.waitDrawerActionCompleted = new PromiseResolver(); - action(); - return promiseResolvers.waitDrawerActionCompleted.promise.then( - function() { - checker(); - return Promise.resolve(); - }); - } - - test('open and close by SysInternals function', function() { - return operate(SysInternals.openDrawer, checkOpen) - .then(function() { - return operate(SysInternals.closeDrawer, checkClose); - }) - .then(function() { - return operate(SysInternals.openDrawer, checkOpen); - }) - .then(function() { - return operate(SysInternals.closeDrawer, checkClose); - }); - }); - - function openByButton() { - $('nav-menu-btn').click(); - } - - function closeByClickBackground() { - $('sys-internals-drawer').click(); - } - - function closeByClickInfoPageButton() { - const infoPageBtn = document.getElementsByClassName('drawer-item')[0]; - infoPageBtn.click(); - } - - test('Tap to open and close', function() { - return operate(openByButton, checkOpen) - .then(function() { - return operate(closeByClickBackground, checkClose); - }) - .then(function() { - return operate(openByButton, checkOpen); - }) - .then(function() { - return operate(closeByClickInfoPageButton, checkClose); - }); - }); +suite('Page_Drawer', function() { + suiteSetup('Wait for the page initialize.', function() { + initialize(); + return promiseResolvers.waitSysInternalsInitialized.promise; }); - mocha.run(); -}; + function checkOpen() { + assertFalse($('sys-internals-drawer').hasAttribute('hidden')); + assertFalse($('sys-internals-drawer').classList.contains('hidden')); + assertFalse($('drawer-menu').classList.contains('hidden')); + } + + function checkClose() { + assertTrue($('sys-internals-drawer').hasAttribute('hidden')); + assertTrue($('sys-internals-drawer').classList.contains('hidden')); + assertTrue($('drawer-menu').classList.contains('hidden')); + } + + function operate(action, checker) { + promiseResolvers.waitDrawerActionCompleted = new PromiseResolver(); + action(); + return promiseResolvers.waitDrawerActionCompleted.promise.then(function() { + checker(); + return Promise.resolve(); + }); + } + + test('open and close by SysInternals function', function() { + return operate(openDrawer, checkOpen) + .then(function() { + return operate(closeDrawer, checkClose); + }) + .then(function() { + return operate(openDrawer, checkOpen); + }) + .then(function() { + return operate(closeDrawer, checkClose); + }); + }); + + function openByButton() { + $('nav-menu-btn').click(); + } + + function closeByClickBackground() { + $('sys-internals-drawer').click(); + } + + function closeByClickInfoPageButton() { + const infoPageBtn = document.getElementsByClassName('drawer-item')[0]; + infoPageBtn.click(); + } + + test('Tap to open and close', function() { + return operate(openByButton, checkOpen) + .then(function() { + return operate(closeByClickBackground, checkClose); + }) + .then(function() { + return operate(openByButton, checkOpen); + }) + .then(function() { + return operate(closeByClickInfoPageButton, checkClose); + }); + }); +}); + +// mocha.run();
diff --git a/chrome/test/data/webui/sys_internals/page_infopage_test.js b/chrome/test/data/webui/sys_internals/page_infopage_test.js index abd1b34..8a91204 100644 --- a/chrome/test/data/webui/sys_internals/page_infopage_test.js +++ b/chrome/test/data/webui/sys_internals/page_infopage_test.js
@@ -2,80 +2,78 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -var PageTest = PageTest || {}; +import {$} from 'chrome://resources/js/util.m.js'; +import {handleUpdateData, lineChart, updateInfoPage} from 'chrome://sys-internals/index.js'; -PageTest.InfoPage = function() { - suite('Info page integration test', function() { - test('check cpu info', function() { - function getTextById(id) { - return $(id).innerText; - } +import {getTestData} from './test_util.js'; - assertTrue(DONT_SEND_UPDATE_REQUEST); - SysInternals.updateInfoPage(); - assertEquals(getTextById('infopage-num-of-cpu'), '0'); - assertEquals(getTextById('infopage-cpu-kernel'), '0.00%'); - assertEquals(getTextById('infopage-cpu-usage'), '0.00%'); - assertEquals(getTextById('infopage-memory-total'), '0.00 B'); - assertEquals(getTextById('infopage-memory-used'), '0.00 B'); - assertEquals(getTextById('infopage-memory-swap-used'), '0.00 B'); - assertEquals(getTextById('infopage-zram-orig'), '0.00 B'); - assertEquals(getTextById('infopage-zram-compr'), '0.00 B'); - assertEquals(getTextById('infopage-zram-compr-ratio'), 'NaN%'); +suite('Page_InfoPage', function() { + test('check cpu info', function() { + function getTextById(id) { + return $(id).innerText; + } - const handleUpdateData = SysInternals.handleUpdateData; - handleUpdateData( - TestUtil.getTestData([ - {idle: 100, kernel: 100, total: 100, user: 100}, - {idle: 100, kernel: 100, total: 100, user: 100}, - {idle: 100, kernel: 100, total: 100, user: 100}, - {idle: 100, kernel: 100, total: 100, user: 100}, - ]), - 1000); - assertEquals(getTextById('infopage-num-of-cpu'), '4'); - assertEquals(getTextById('infopage-cpu-kernel'), '0.00%'); - assertEquals(getTextById('infopage-cpu-usage'), '0.00%'); - assertEquals(getTextById('infopage-memory-total'), '8.00 TB'); - assertEquals(getTextById('infopage-memory-used'), '4.00 TB'); - assertEquals(getTextById('infopage-memory-swap-used'), '2.00 TB'); - assertEquals(getTextById('infopage-zram-orig'), '200.00 GB'); - assertEquals(getTextById('infopage-zram-compr'), '100.00 GB'); - assertEquals(getTextById('infopage-zram-compr-ratio'), '50.00%'); + assertTrue(window.DONT_SEND_UPDATE_REQUEST); + updateInfoPage(); + assertEquals(getTextById('infopage-num-of-cpu'), '0'); + assertEquals(getTextById('infopage-cpu-kernel'), '0.00%'); + assertEquals(getTextById('infopage-cpu-usage'), '0.00%'); + assertEquals(getTextById('infopage-memory-total'), '0.00 B'); + assertEquals(getTextById('infopage-memory-used'), '0.00 B'); + assertEquals(getTextById('infopage-memory-swap-used'), '0.00 B'); + assertEquals(getTextById('infopage-zram-orig'), '0.00 B'); + assertEquals(getTextById('infopage-zram-compr'), '0.00 B'); + assertEquals(getTextById('infopage-zram-compr-ratio'), 'NaN%'); - handleUpdateData( - TestUtil.getTestData([ - {idle: 160, kernel: 120, total: 200, user: 120}, - {idle: 180, kernel: 110, total: 200, user: 110}, - {idle: 140, kernel: 130, total: 200, user: 130}, - {idle: 160, kernel: 120, total: 200, user: 120}, - ]), - 2000); - assertEquals(getTextById('infopage-cpu-usage'), '40.00%'); - assertEquals(getTextById('infopage-cpu-kernel'), '20.00%'); + handleUpdateData( + getTestData([ + {idle: 100, kernel: 100, total: 100, user: 100}, + {idle: 100, kernel: 100, total: 100, user: 100}, + {idle: 100, kernel: 100, total: 100, user: 100}, + {idle: 100, kernel: 100, total: 100, user: 100}, + ]), + 1000); + assertEquals(getTextById('infopage-num-of-cpu'), '4'); + assertEquals(getTextById('infopage-cpu-kernel'), '0.00%'); + assertEquals(getTextById('infopage-cpu-usage'), '0.00%'); + assertEquals(getTextById('infopage-memory-total'), '8.00 TB'); + assertEquals(getTextById('infopage-memory-used'), '4.00 TB'); + assertEquals(getTextById('infopage-memory-swap-used'), '2.00 TB'); + assertEquals(getTextById('infopage-zram-orig'), '200.00 GB'); + assertEquals(getTextById('infopage-zram-compr'), '100.00 GB'); + assertEquals(getTextById('infopage-zram-compr-ratio'), '50.00%'); - handleUpdateData( - TestUtil.getTestData([ - {idle: 190, kernel: 150, total: 290, user: 150}, - {idle: 210, kernel: 140, total: 290, user: 140}, - {idle: 170, kernel: 160, total: 290, user: 160}, - {idle: 190, kernel: 150, total: 290, user: 150}, - ]), - 2876); - assertEquals(getTextById('infopage-cpu-usage'), '66.67%'); - assertEquals(getTextById('infopage-cpu-kernel'), '33.33%'); + handleUpdateData( + getTestData([ + {idle: 160, kernel: 120, total: 200, user: 120}, + {idle: 180, kernel: 110, total: 200, user: 110}, + {idle: 140, kernel: 130, total: 200, user: 130}, + {idle: 160, kernel: 120, total: 200, user: 120}, + ]), + 2000); + assertEquals(getTextById('infopage-cpu-usage'), '40.00%'); + assertEquals(getTextById('infopage-cpu-kernel'), '20.00%'); - handleUpdateData( - TestUtil.getTestData([ - {idle: 200, kernel: 160, total: 320, user: 160}, - {idle: 220, kernel: 150, total: 320, user: 150}, - {idle: 180, kernel: 170, total: 320, user: 170}, - {idle: 200, kernel: 160, total: 320, user: 160}, - ]), - 3999); - assertEquals(getTextById('infopage-cpu-usage'), '66.67%'); - assertEquals(getTextById('infopage-cpu-kernel'), '33.33%'); - }); + handleUpdateData( + getTestData([ + {idle: 190, kernel: 150, total: 290, user: 150}, + {idle: 210, kernel: 140, total: 290, user: 140}, + {idle: 170, kernel: 160, total: 290, user: 160}, + {idle: 190, kernel: 150, total: 290, user: 150}, + ]), + 2876); + assertEquals(getTextById('infopage-cpu-usage'), '66.67%'); + assertEquals(getTextById('infopage-cpu-kernel'), '33.33%'); + + handleUpdateData( + getTestData([ + {idle: 200, kernel: 160, total: 320, user: 160}, + {idle: 220, kernel: 150, total: 320, user: 150}, + {idle: 180, kernel: 170, total: 320, user: 170}, + {idle: 200, kernel: 160, total: 320, user: 160}, + ]), + 3999); + assertEquals(getTextById('infopage-cpu-usage'), '66.67%'); + assertEquals(getTextById('infopage-cpu-kernel'), '33.33%'); }); - - mocha.run(); -}; +});
diff --git a/chrome/test/data/webui/sys_internals/page_switch_test.js b/chrome/test/data/webui/sys_internals/page_switch_test.js index 2040019..58320a0 100644 --- a/chrome/test/data/webui/sys_internals/page_switch_test.js +++ b/chrome/test/data/webui/sys_internals/page_switch_test.js
@@ -2,103 +2,100 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -var PageTest = PageTest || {}; +import {PromiseResolver} from 'chrome://resources/js/promise_resolver.m.js'; +import {$} from 'chrome://resources/js/util.m.js'; +import {PAGE_HASH} from 'chrome://sys-internals/constants.js'; +import {handleUpdateData, initialize, isInfoPage, lineChart, promiseResolvers} from 'chrome://sys-internals/index.js'; -PageTest.Switch = function() { - suite('Page switch integration test', function() { - suiteSetup('Wait for the page initialize.', function() { - const testData = TestUtil.getTestData([ - {idle: 100, kernel: 100, total: 100, user: 100}, - {idle: 100, kernel: 100, total: 100, user: 100}, - {idle: 100, kernel: 100, total: 100, user: 100}, - {idle: 100, kernel: 100, total: 100, user: 100}, - {idle: 100, kernel: 100, total: 100, user: 100}, - {idle: 100, kernel: 100, total: 100, user: 100}, - {idle: 100, kernel: 100, total: 100, user: 100}, - {idle: 100, kernel: 100, total: 100, user: 100}, - {idle: 100, kernel: 100, total: 100, user: 100}, - ]); - return SysInternals.promiseResolvers.waitSysInternalsInitialized.promise - .then(function() { - SysInternals.handleUpdateData(testData, 1000); - return Promise.resolve(); - }); - }); +import {getTestData} from './test_util.js'; - function checkInfoPage() { - assertEquals(location.hash, SysInternals.PAGE_HASH.INFO); - assertEquals($('drawer-title').innerText, 'Info'); - assertFalse($('infopage-root').hasAttribute('hidden')); - assertFalse(SysInternals.lineChart.shouldRender()); - } - - function checkChartPage(hash) { - assertEquals(location.hash, hash); - assertEquals($('drawer-title').innerText, hash.slice(1)); - assertTrue($('infopage-root').hasAttribute('hidden')); - - const lineChart = SysInternals.lineChart; - assertTrue(lineChart.shouldRender()); - const PAGE_HASH = SysInternals.PAGE_HASH; - if (hash === PAGE_HASH.CPU) { - assertEquals(lineChart.subCharts_[0].dataSeriesList_.length, 0); - assertEquals(lineChart.subCharts_[1].dataSeriesList_.length, 9); - assertEquals(lineChart.menu_.buttons_.length, 9); - } else if (hash === PAGE_HASH.MEMORY) { - assertEquals(lineChart.subCharts_[0].dataSeriesList_.length, 2); - assertEquals(lineChart.subCharts_[1].dataSeriesList_.length, 2); - assertEquals(lineChart.menu_.buttons_.length, 4); - } else if (hash === PAGE_HASH.ZRAM) { - assertEquals(lineChart.subCharts_[0].dataSeriesList_.length, 2); - assertEquals(lineChart.subCharts_[1].dataSeriesList_.length, 3); - assertEquals(lineChart.menu_.buttons_.length, 5); - } else { - assertNotReached(); - } - } - - function clickDrawerBtn(btnIndex) { - $('nav-menu-btn').click(); - const infoBtn = document.getElementsByClassName('drawer-item')[btnIndex]; - infoBtn.click(); - } - - function goPage(hash, btnIndex) { - const promiseResolvers = SysInternals.promiseResolvers; - promiseResolvers.waitOnHashChangeCompleted = new PromiseResolver(); - clickDrawerBtn(btnIndex); - return promiseResolvers.waitOnHashChangeCompleted.promise.then( - function() { - if (hash === SysInternals.PAGE_HASH.INFO) { - checkInfoPage(); - } else { - checkChartPage(hash); - } - return Promise.resolve(); - }); - } - - test('Switch test', function() { - assertTrue(SysInternals.isInfoPage()); - const PAGE_HASH = SysInternals.PAGE_HASH; - return goPage(PAGE_HASH.CPU, 1) - .then(function() { - return goPage(PAGE_HASH.ZRAM, 3); - }) - .then(function() { - return goPage(PAGE_HASH.MEMORY, 2); - }) - .then(function() { - return goPage(PAGE_HASH.CPU, 1); - }) - .then(function() { - return goPage(PAGE_HASH.INFO, 0); - }) - .then(function() { - return goPage(PAGE_HASH.MEMORY, 2); - }); - }); +suite('Page_Switch', function() { + suiteSetup('Wait for the page initialize.', function() { + const testData = getTestData([ + {idle: 100, kernel: 100, total: 100, user: 100}, + {idle: 100, kernel: 100, total: 100, user: 100}, + {idle: 100, kernel: 100, total: 100, user: 100}, + {idle: 100, kernel: 100, total: 100, user: 100}, + {idle: 100, kernel: 100, total: 100, user: 100}, + {idle: 100, kernel: 100, total: 100, user: 100}, + {idle: 100, kernel: 100, total: 100, user: 100}, + {idle: 100, kernel: 100, total: 100, user: 100}, + {idle: 100, kernel: 100, total: 100, user: 100}, + ]); + initialize(); + return promiseResolvers.waitSysInternalsInitialized.promise.then( + function() { + handleUpdateData(testData, 1000); + return Promise.resolve(); + }); }); - mocha.run(); -}; + function checkInfoPage() { + assertEquals(location.hash, PAGE_HASH.INFO); + assertEquals($('drawer-title').innerText, 'Info'); + assertFalse($('infopage-root').hasAttribute('hidden')); + assertFalse(lineChart.shouldRender()); + } + + function checkChartPage(hash) { + assertEquals(location.hash, hash); + assertEquals($('drawer-title').innerText, hash.slice(1)); + assertTrue($('infopage-root').hasAttribute('hidden')); + + assertTrue(lineChart.shouldRender()); + if (hash === PAGE_HASH.CPU) { + assertEquals(lineChart.subCharts_[0].dataSeriesList_.length, 0); + assertEquals(lineChart.subCharts_[1].dataSeriesList_.length, 9); + assertEquals(lineChart.menu_.buttons_.length, 9); + } else if (hash === PAGE_HASH.MEMORY) { + assertEquals(lineChart.subCharts_[0].dataSeriesList_.length, 2); + assertEquals(lineChart.subCharts_[1].dataSeriesList_.length, 2); + assertEquals(lineChart.menu_.buttons_.length, 4); + } else if (hash === PAGE_HASH.ZRAM) { + assertEquals(lineChart.subCharts_[0].dataSeriesList_.length, 2); + assertEquals(lineChart.subCharts_[1].dataSeriesList_.length, 3); + assertEquals(lineChart.menu_.buttons_.length, 5); + } else { + assertNotReached(); + } + } + + function clickDrawerBtn(btnIndex) { + $('nav-menu-btn').click(); + const infoBtn = document.getElementsByClassName('drawer-item')[btnIndex]; + infoBtn.click(); + } + + function goPage(hash, btnIndex) { + promiseResolvers.waitOnHashChangeCompleted = new PromiseResolver(); + clickDrawerBtn(btnIndex); + return promiseResolvers.waitOnHashChangeCompleted.promise.then(function() { + if (hash === PAGE_HASH.INFO) { + checkInfoPage(); + } else { + checkChartPage(hash); + } + return Promise.resolve(); + }); + } + + test('Switch test', function() { + assertTrue(isInfoPage()); + return goPage(PAGE_HASH.CPU, 1) + .then(function() { + return goPage(PAGE_HASH.ZRAM, 3); + }) + .then(function() { + return goPage(PAGE_HASH.MEMORY, 2); + }) + .then(function() { + return goPage(PAGE_HASH.CPU, 1); + }) + .then(function() { + return goPage(PAGE_HASH.INFO, 0); + }) + .then(function() { + return goPage(PAGE_HASH.MEMORY, 2); + }); + }); +});
diff --git a/chrome/test/data/webui/sys_internals/page_unit_test.js b/chrome/test/data/webui/sys_internals/page_unit_test.js index 6ba2f75..c442c62 100644 --- a/chrome/test/data/webui/sys_internals/page_unit_test.js +++ b/chrome/test/data/webui/sys_internals/page_unit_test.js
@@ -2,47 +2,38 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -var PageTest = PageTest || {}; +import {getDiffAndUpdateCounter, getDiffPerSecAndUpdateCounter, getValueWithUnit, toPercentageString} from 'chrome://sys-internals/index.js'; -PageTest.Unit = function() { - suite('Page unit test', function() { - test('getDiffPerSecAndUpdateCounter', function() { - const getDiffAndUpdateCounter = SysInternals.getDiffAndUpdateCounter; - assertEquals(getDiffAndUpdateCounter('test', 10, 1000), 0); - assertEquals(getDiffAndUpdateCounter('test', 20, 2000), 10); - assertEquals(getDiffAndUpdateCounter('test', 42, 3000), 22); +import {assertCloseTo, MEMORY_UNITS} from './test_util.js'; - const getDiffPerSecAndUpdateCounter = - SysInternals.getDiffPerSecAndUpdateCounter; - TestUtil.assertCloseTo( - getDiffPerSecAndUpdateCounter('test2', 10, 1000), 0, 1e-2); - TestUtil.assertCloseTo( - getDiffPerSecAndUpdateCounter('test2', 20, 3000), 5, 1e-2); - TestUtil.assertCloseTo( - getDiffPerSecAndUpdateCounter('test2', 42, 3720), 30.555, 1e-2); - TestUtil.assertCloseTo( - getDiffPerSecAndUpdateCounter('test2', 59, 4999), 13.291, 1e-2); - }); +suite('Page_Unit', function() { + test('getDiffPerSecAndUpdateCounter', function() { + assertEquals(getDiffAndUpdateCounter('test', 10, 1000), 0); + assertEquals(getDiffAndUpdateCounter('test', 20, 2000), 10); + assertEquals(getDiffAndUpdateCounter('test', 42, 3000), 22); - test('toPercentageString', function() { - const toPercentageString = SysInternals.toPercentageString; - assertEquals(toPercentageString(0.12345, 2), '12.35%'); - assertEquals(toPercentageString(1.23456, 2), '123.46%'); - assertEquals(toPercentageString(0.424242, 2), '42.42%'); - assertEquals(toPercentageString(NaN, 2), 'NaN%'); - }); - - test('getValueWithUnit', function() { - const UNITS = ['B', 'KB', 'MB', 'GB']; - const UNITBASE = 1024; - const GB = TestUtil.MEMORY_UNITS.GB; - const KB = TestUtil.MEMORY_UNITS.KB; - const getValueWithUnit = SysInternals.getValueWithUnit; - assertEquals(getValueWithUnit(60 * KB, UNITS, UNITBASE), '60.00 KB'); - assertEquals(getValueWithUnit(42 * GB, UNITS, UNITBASE), '42.00 GB'); - assertEquals(getValueWithUnit(73.2546 * KB, UNITS, UNITBASE), '73.25 KB'); - }); + assertCloseTo(getDiffPerSecAndUpdateCounter('test2', 10, 1000), 0, 1e-2); + assertCloseTo(getDiffPerSecAndUpdateCounter('test2', 20, 3000), 5, 1e-2); + assertCloseTo( + getDiffPerSecAndUpdateCounter('test2', 42, 3720), 30.555, 1e-2); + assertCloseTo( + getDiffPerSecAndUpdateCounter('test2', 59, 4999), 13.291, 1e-2); }); - mocha.run(); -}; + test('toPercentageString', function() { + assertEquals(toPercentageString(0.12345, 2), '12.35%'); + assertEquals(toPercentageString(1.23456, 2), '123.46%'); + assertEquals(toPercentageString(0.424242, 2), '42.42%'); + assertEquals(toPercentageString(NaN, 2), 'NaN%'); + }); + + test('getValueWithUnit', function() { + const UNITS = ['B', 'KB', 'MB', 'GB']; + const UNITBASE = 1024; + const GB = MEMORY_UNITS.GB; + const KB = MEMORY_UNITS.KB; + assertEquals(getValueWithUnit(60 * KB, UNITS, UNITBASE), '60.00 KB'); + assertEquals(getValueWithUnit(42 * GB, UNITS, UNITBASE), '42.00 GB'); + assertEquals(getValueWithUnit(73.2546 * KB, UNITS, UNITBASE), '73.25 KB'); + }); +});
diff --git a/chrome/test/data/webui/sys_internals/sys_internals_browsertest.js b/chrome/test/data/webui/sys_internals/sys_internals_browsertest.js index 6ca12d8..a5d6923 100644 --- a/chrome/test/data/webui/sys_internals/sys_internals_browsertest.js +++ b/chrome/test/data/webui/sys_internals/sys_internals_browsertest.js
@@ -17,70 +17,57 @@ SysInternalsBrowserTest.prototype = { __proto__: testing.Test.prototype, - browsePreload: 'chrome://sys-internals', + browsePreload: + 'chrome://sys-internals/index.html?module=sys_internals/all_tests.js', isAsync: true, extraLibraries: [ - 'api_test.js', - 'line_chart/data_series_test.js', - 'line_chart/line_chart_test.js', - 'line_chart/menu_test.js', - 'line_chart/scrollbar_test.js', - 'line_chart/sub_chart_test.js', - 'line_chart/unit_label_test.js', - 'page_drawer_test.js', - 'page_infopage_test.js', - 'page_switch_test.js', - 'page_unit_test.js', - 'test_util.js', '//third_party/mocha/mocha.js', - '//third_party/polymer/v1_0/components-chromium/' + - 'iron-test-helpers/mock-interactions.js', '//chrome/test/data/webui/mocha_adapter.js', ], }; TEST_F('SysInternalsBrowserTest', 'getSysInfo', function() { - ApiTest.getSysInfo(); + runMochaSuite('getSysInfo'); }); TEST_F('SysInternalsBrowserTest', 'LineChart_DataSeries', function() { - LineChartTest.DataSeries(); + runMochaSuite('LineChart_DataSeries'); }); TEST_F('SysInternalsBrowserTest', 'LineChart_LineChart', function() { - LineChartTest.LineChart(); + runMochaSuite('LineChart_LineChart'); }); TEST_F('SysInternalsBrowserTest', 'LineChart_Menu', function() { - LineChartTest.Menu(); + runMochaSuite('LineChart_Menu'); }); TEST_F('SysInternalsBrowserTest', 'LineChart_Scrollbar', function() { - LineChartTest.Scrollbar(); + runMochaSuite('LineChart_Scrollbar'); }); TEST_F('SysInternalsBrowserTest', 'LineChart_SubChart', function() { - LineChartTest.SubChart(); + runMochaSuite('LineChart_SubChart'); }); TEST_F('SysInternalsBrowserTest', 'LineChart_UnitLabel', function() { - LineChartTest.UnitLabel(); + runMochaSuite('LineChart_UnitLabel'); }); TEST_F('SysInternalsBrowserTest', 'Page_Drawer', function() { - PageTest.Drawer(); + runMochaSuite('Page_Drawer'); }); TEST_F('SysInternalsBrowserTest', 'Page_InfoPage', function() { - PageTest.InfoPage(); + runMochaSuite('Page_InfoPage'); }); TEST_F('SysInternalsBrowserTest', 'Page_Switch', function() { - PageTest.Switch(); + runMochaSuite('Page_Switch'); }); TEST_F('SysInternalsBrowserTest', 'Page_Unit', function() { - PageTest.Unit(); + runMochaSuite('Page_Unit'); });
diff --git a/chrome/test/data/webui/sys_internals/test_util.js b/chrome/test/data/webui/sys_internals/test_util.js index 73049cb..d000aae 100644 --- a/chrome/test/data/webui/sys_internals/test_util.js +++ b/chrome/test/data/webui/sys_internals/test_util.js
@@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -var TestUtil = TestUtil || {}; -TestUtil.assertCloseTo = function(value, equ, delta, optMessage) { +export function assertCloseTo(value, equ, delta, optMessage) { chai.assert.closeTo(value, equ, delta, optMessage); -}; +} -TestUtil.MEMORY_UNITS = { +export const MEMORY_UNITS = { B: 1, KB: Math.pow(1024, 1), MB: Math.pow(1024, 2), @@ -17,9 +16,9 @@ PB: Math.pow(1024, 5), }; -TestUtil.getTestData = function(cpuData) { - const GB = TestUtil.MEMORY_UNITS.GB; - const TB = TestUtil.MEMORY_UNITS.TB; +export function getTestData(cpuData) { + const GB = MEMORY_UNITS.GB; + const TB = MEMORY_UNITS.TB; return { const : {counterMax: 2147483647}, cpus: cpuData, @@ -39,4 +38,4 @@ origDataSize: 200 * GB, }, }; -}; +}
diff --git a/chrome/updater/app/server/mac/service_delegate.mm b/chrome/updater/app/server/mac/service_delegate.mm index c4031e551..4d44536 100644 --- a/chrome/updater/app/server/mac/service_delegate.mm +++ b/chrome/updater/app/server/mac/service_delegate.mm
@@ -16,7 +16,6 @@ #include "base/mac/foundation_util.h" #include "base/mac/scoped_block.h" #include "base/mac/scoped_nsobject.h" -#include "base/no_destructor.h" #include "base/strings/sys_string_conversions.h" #include "base/synchronization/waitable_event.h" #include "base/threading/sequenced_task_runner_handle.h"
diff --git a/chrome/updater/app/server/win/service_main.cc b/chrome/updater/app/server/win/service_main.cc index 1087d8b..649183ef 100644 --- a/chrome/updater/app/server/win/service_main.cc +++ b/chrome/updater/app/server/win/service_main.cc
@@ -13,6 +13,7 @@ #include "base/command_line.h" #include "base/cxx17_backports.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/task/single_thread_task_executor.h" #include "base/win/scoped_com_initializer.h" #include "chrome/updater/app/server/win/com_classes.h"
diff --git a/chrome/utility/services.cc b/chrome/utility/services.cc index 5451c94..57d70e4 100644 --- a/chrome/utility/services.cc +++ b/chrome/utility/services.cc
@@ -7,7 +7,6 @@ #include <memory> #include <utility> -#include "base/no_destructor.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "chrome/services/qrcode_generator/public/mojom/qrcode_generator.mojom.h" // nogncheck
diff --git a/chromecast/base/metrics/cast_metrics_helper.cc b/chromecast/base/metrics/cast_metrics_helper.cc index 2d94c01..294d6306 100644 --- a/chromecast/base/metrics/cast_metrics_helper.cc +++ b/chromecast/base/metrics/cast_metrics_helper.cc
@@ -14,6 +14,7 @@ #include "base/logging.h" #include "base/metrics/histogram.h" #include "base/metrics/user_metrics.h" +#include "base/no_destructor.h" #include "base/strings/string_split.h" #include "base/task/sequenced_task_runner.h" #include "base/time/tick_clock.h"
diff --git a/chromecast/browser/cast_extension_url_loader_factory.cc b/chromecast/browser/cast_extension_url_loader_factory.cc index d5e6ba8..b1c4933 100644 --- a/chromecast/browser/cast_extension_url_loader_factory.cc +++ b/chromecast/browser/cast_extension_url_loader_factory.cc
@@ -10,6 +10,7 @@ #include <vector> #include "base/logging.h" +#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "chromecast/browser/extensions/cast_extension_system_factory.h" #include "chromecast/common/cast_redirect_manifest_handler.h"
diff --git a/chromecast/browser/cast_session_id_map.cc b/chromecast/browser/cast_session_id_map.cc index b8b91e9..36a127ad 100644 --- a/chromecast/browser/cast_session_id_map.cc +++ b/chromecast/browser/cast_session_id_map.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/location.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/task/single_thread_task_runner.h" #include "base/task/task_runner_util.h" #include "base/time/time.h"
diff --git a/chromecast/common/queryable_data.cc b/chromecast/common/queryable_data.cc index 00fdaaa1..d435387c 100644 --- a/chromecast/common/queryable_data.cc +++ b/chromecast/common/queryable_data.cc
@@ -6,6 +6,8 @@ #include <utility> +#include "base/no_destructor.h" + namespace chromecast { namespace {
diff --git a/chromecast/metrics/metrics_recorder.cc b/chromecast/metrics/metrics_recorder.cc index 883db26..b63ec3e 100644 --- a/chromecast/metrics/metrics_recorder.cc +++ b/chromecast/metrics/metrics_recorder.cc
@@ -18,7 +18,6 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/observer_list.h" #include "base/synchronization/lock.h"
diff --git a/chromeos/components/local_search_service/public/cpp/local_search_service_proxy_factory.cc b/chromeos/components/local_search_service/public/cpp/local_search_service_proxy_factory.cc index fb44821..7958648 100644 --- a/chromeos/components/local_search_service/public/cpp/local_search_service_proxy_factory.cc +++ b/chromeos/components/local_search_service/public/cpp/local_search_service_proxy_factory.cc
@@ -4,6 +4,7 @@ #include "chromeos/components/local_search_service/public/cpp/local_search_service_proxy_factory.h" +#include "base/no_destructor.h" #include "chromeos/components/local_search_service/public/cpp/local_search_service_proxy.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/chromeos/components/local_search_service/search_utils.cc b/chromeos/components/local_search_service/search_utils.cc index 377dff8..623895b 100644 --- a/chromeos/components/local_search_service/search_utils.cc +++ b/chromeos/components/local_search_service/search_utils.cc
@@ -15,7 +15,6 @@ #include "base/i18n/case_conversion.h" #include "base/i18n/unicodestring.h" #include "base/memory/ptr_util.h" -#include "base/no_destructor.h" #include "base/strings/utf_string_conversions.h" #include "chromeos/components/local_search_service/shared_structs.h" #include "chromeos/components/string_matching/sequence_matcher.h"
diff --git a/chromeos/components/mojo_bootstrap/pending_connection_manager.cc b/chromeos/components/mojo_bootstrap/pending_connection_manager.cc index 85ffbf5..e4b9b819 100644 --- a/chromeos/components/mojo_bootstrap/pending_connection_manager.cc +++ b/chromeos/components/mojo_bootstrap/pending_connection_manager.cc
@@ -7,6 +7,7 @@ #include <utility> #include "base/check_op.h" +#include "base/no_destructor.h" namespace mojo_bootstrap {
diff --git a/chromeos/components/sensors/ash/sensor_hal_dispatcher.cc b/chromeos/components/sensors/ash/sensor_hal_dispatcher.cc index 30919feb4..98389dc 100644 --- a/chromeos/components/sensors/ash/sensor_hal_dispatcher.cc +++ b/chromeos/components/sensors/ash/sensor_hal_dispatcher.cc
@@ -7,7 +7,6 @@ #include <utility> #include "base/bind.h" -#include "base/no_destructor.h" namespace chromeos { namespace sensors {
diff --git a/chromeos/crosapi/mojom/crosapi.mojom b/chromeos/crosapi/mojom/crosapi.mojom index 966421b..ed64d770 100644 --- a/chromeos/crosapi/mojom/crosapi.mojom +++ b/chromeos/crosapi/mojom/crosapi.mojom
@@ -695,17 +695,10 @@ [MinVersion=12] IdleInfo? idle_info@12; - // Launches an incognito window. - // Added in M91. - // TODO(https://crbug.com/1194304): Remove in M93. [MinVersion=13] - bool is_incognito_deprecated@13; - - // Restores tabs from the last session. - // Added in M91. - // TODO(https://crbug.com/1194304): Remove in M93. + bool REMOVED_13@13; [MinVersion=14] - bool restore_last_session_deprecated@14; + bool REMOVED_14@14; // Defines which windows or tabs to restore on launch. [MinVersion=15]
diff --git a/chromeos/dbus/dlp/dlp_client.cc b/chromeos/dbus/dlp/dlp_client.cc index b9ae1215..0cd60b61 100644 --- a/chromeos/dbus/dlp/dlp_client.cc +++ b/chromeos/dbus/dlp/dlp_client.cc
@@ -95,6 +95,27 @@ weak_factory_.GetWeakPtr(), std::move(callback))); } + void GetFilesSources(const dlp::GetFilesSourcesRequest request, + GetFilesSourcesCallback callback) const override { + dbus::MethodCall method_call(dlp::kDlpInterface, + dlp::kGetFilesSourcesMethod); + dbus::MessageWriter writer(&method_call); + + if (!writer.AppendProtoAsArrayOfBytes(request)) { + dlp::GetFilesSourcesResponse response; + response.set_error_message(base::StrCat( + {"Failure to call d-bus method: ", dlp::kGetFilesSourcesMethod})); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), response)); + return; + } + + proxy_->CallMethod( + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, + base::BindOnce(&DlpClientImpl::HandleGetFilesSourcesResponse, + weak_factory_.GetWeakPtr(), std::move(callback))); + } + bool IsAlive() const override { return is_alive_; } private: @@ -123,6 +144,16 @@ std::move(callback).Run(response_proto); } + void HandleGetFilesSourcesResponse(GetFilesSourcesCallback callback, + dbus::Response* response) { + dlp::GetFilesSourcesResponse response_proto; + const char* error_message = DeserializeProto(response, &response_proto); + if (error_message) { + response_proto.set_error_message(error_message); + } + std::move(callback).Run(response_proto); + } + // D-Bus proxy for the Dlp daemon, not owned. dbus::ObjectProxy* proxy_ = nullptr;
diff --git a/chromeos/dbus/dlp/dlp_client.h b/chromeos/dbus/dlp/dlp_client.h index 1276c69..1721c9c2 100644 --- a/chromeos/dbus/dlp/dlp_client.h +++ b/chromeos/dbus/dlp/dlp_client.h
@@ -25,6 +25,8 @@ base::OnceCallback<void(const dlp::SetDlpFilesPolicyResponse response)>; using AddFileCallback = base::OnceCallback<void(const dlp::AddFileResponse response)>; + using GetFilesSourcesCallback = + base::OnceCallback<void(const dlp::GetFilesSourcesResponse response)>; // Interface with testing functionality. Accessed through GetTestInterface(), // only implemented in the fake implementation. @@ -52,10 +54,16 @@ // Returns the global instance which may be null if not initialized. static DlpClient* Get(); + // Dlp daemon D-Bus method calls. See org.chromium.Dlp.xml and + // dlp_service.proto in Chromium OS code for the documentation of the methods + // and request/response messages. virtual void SetDlpFilesPolicy(const dlp::SetDlpFilesPolicyRequest request, SetDlpFilesPolicyCallback callback) = 0; virtual void AddFile(const dlp::AddFileRequest request, AddFileCallback callback) = 0; + virtual void GetFilesSources(const dlp::GetFilesSourcesRequest request, + GetFilesSourcesCallback callback) const = 0; + virtual bool IsAlive() const = 0; // Returns an interface for testing (fake only), or returns nullptr.
diff --git a/chromeos/dbus/dlp/fake_dlp_client.cc b/chromeos/dbus/dlp/fake_dlp_client.cc index 47d3a1d6..26d970ae 100644 --- a/chromeos/dbus/dlp/fake_dlp_client.cc +++ b/chromeos/dbus/dlp/fake_dlp_client.cc
@@ -26,6 +26,9 @@ void FakeDlpClient::AddFile(const dlp::AddFileRequest request, AddFileCallback callback) {} +void FakeDlpClient::GetFilesSources(const dlp::GetFilesSourcesRequest request, + GetFilesSourcesCallback callback) const {} + bool FakeDlpClient::IsAlive() const { return false; }
diff --git a/chromeos/dbus/dlp/fake_dlp_client.h b/chromeos/dbus/dlp/fake_dlp_client.h index 50967b4..599d167 100644 --- a/chromeos/dbus/dlp/fake_dlp_client.h +++ b/chromeos/dbus/dlp/fake_dlp_client.h
@@ -25,6 +25,8 @@ SetDlpFilesPolicyCallback callback) override; void AddFile(const dlp::AddFileRequest request, AddFileCallback callback) override; + void GetFilesSources(const dlp::GetFilesSourcesRequest request, + GetFilesSourcesCallback callback) const override; bool IsAlive() const override; DlpClient::TestInterface* GetTestInterface() override;
diff --git a/chromeos/dbus/session_manager/fake_session_manager_client.cc b/chromeos/dbus/session_manager/fake_session_manager_client.cc index dad17e5..18e60bc 100644 --- a/chromeos/dbus/session_manager/fake_session_manager_client.cc +++ b/chromeos/dbus/session_manager/fake_session_manager_client.cc
@@ -406,6 +406,11 @@ screen_is_locked_ = false; } +bool FakeSessionManagerClient::RequestBrowserDataMigration( + const cryptohome::AccountIdentifier& cryptohome_id) { + return true; +} + void FakeSessionManagerClient::RetrieveActiveSessions( ActiveSessionsCallback callback) { PostReply(FROM_HERE, std::move(callback), user_sessions_);
diff --git a/chromeos/dbus/session_manager/fake_session_manager_client.h b/chromeos/dbus/session_manager/fake_session_manager_client.h index 98fcd3c..539e57a 100644 --- a/chromeos/dbus/session_manager/fake_session_manager_client.h +++ b/chromeos/dbus/session_manager/fake_session_manager_client.h
@@ -103,9 +103,8 @@ void RequestLockScreen() override; void NotifyLockScreenShown() override; void NotifyLockScreenDismissed() override; - void RequestBrowserDataMigration( - const cryptohome::AccountIdentifier& cryptohome_id, - VoidDBusMethodCallback callback) override {} + bool RequestBrowserDataMigration( + const cryptohome::AccountIdentifier& cryptohome_id) override; void RetrieveActiveSessions(ActiveSessionsCallback callback) override; void RetrieveDevicePolicy(RetrievePolicyCallback callback) override; RetrievePolicyResponseType BlockingRetrieveDevicePolicy(
diff --git a/chromeos/dbus/session_manager/session_manager_client.cc b/chromeos/dbus/session_manager/session_manager_client.cc index c89ecf4..aad147c 100644 --- a/chromeos/dbus/session_manager/session_manager_client.cc +++ b/chromeos/dbus/session_manager/session_manager_client.cc
@@ -402,18 +402,23 @@ login_manager::kSessionManagerHandleLockScreenDismissed); } - void RequestBrowserDataMigration( - const cryptohome::AccountIdentifier& cryptohome_id, - VoidDBusMethodCallback callback) override { + bool RequestBrowserDataMigration( + const cryptohome::AccountIdentifier& cryptohome_id) override { dbus::MethodCall method_call( login_manager::kSessionManagerInterface, login_manager::kSessionManagerStartBrowserDataMigration); dbus::MessageWriter writer(&method_call); writer.AppendString(cryptohome_id.account_id()); - session_manager_proxy_->CallMethod( - &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, - base::BindOnce(&SessionManagerClientImpl::OnVoidMethod, - weak_ptr_factory_.GetWeakPtr(), std::move(callback))); + dbus::ScopedDBusError error; + std::unique_ptr<dbus::Response> response = + blocking_method_caller_->CallMethodAndBlockWithError(&method_call, + &error); + if (!response) { + LOG(ERROR) << "RequestBrowserDataMigration failed."; + return false; + } + + return true; } void RetrieveActiveSessions(ActiveSessionsCallback callback) override {
diff --git a/chromeos/dbus/session_manager/session_manager_client.h b/chromeos/dbus/session_manager/session_manager_client.h index 94dde6d3..74c97ef3 100644 --- a/chromeos/dbus/session_manager/session_manager_client.h +++ b/chromeos/dbus/session_manager/session_manager_client.h
@@ -253,11 +253,12 @@ // Notifies session_manager that Chrome has hidden the lock screen. virtual void NotifyLockScreenDismissed() = 0; - // Tells session_manager to restart ash-chrome to carry out browser data - // migration. - virtual void RequestBrowserDataMigration( - const cryptohome::AccountIdentifier& cryptohome_id, - VoidDBusMethodCallback callback) = 0; + // Makes session_manager add some flags to carry out browser data migration + // upon next ash-chrome restart. The method returns true if the DBus call was + // successful. The callback is passed true if the DBus call is successful and + // false otherwise. + virtual bool RequestBrowserDataMigration( + const cryptohome::AccountIdentifier& cryptohome_id) = 0; // Map that is used to describe the set of active user sessions where |key| // is cryptohome id and |value| is user_id_hash.
diff --git a/chromeos/language/language_packs/language_pack_manager.cc b/chromeos/language/language_packs/language_pack_manager.cc index e7af4aa..c928d8a0 100644 --- a/chromeos/language/language_packs/language_pack_manager.cc +++ b/chromeos/language/language_packs/language_pack_manager.cc
@@ -11,6 +11,7 @@ #include "base/containers/flat_map.h" #include "base/logging.h" #include "base/metrics/histogram_functions.h" +#include "base/no_destructor.h" #include "chromeos/dbus/dlcservice/dlcservice.pb.h" #include "chromeos/dbus/dlcservice/dlcservice_client.h"
diff --git a/chromeos/language/language_packs/language_packs_impl.cc b/chromeos/language/language_packs/language_packs_impl.cc index cbf46bd..e50bb120 100644 --- a/chromeos/language/language_packs/language_packs_impl.cc +++ b/chromeos/language/language_packs/language_packs_impl.cc
@@ -5,6 +5,8 @@ #include <string> #include "chromeos/language/language_packs/language_packs_impl.h" + +#include "base/no_destructor.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace chromeos {
diff --git a/chromeos/memory/userspace_swap/swap_storage.cc b/chromeos/memory/userspace_swap/swap_storage.cc index a2db387b..0a70dc1 100644 --- a/chromeos/memory/userspace_swap/swap_storage.cc +++ b/chromeos/memory/userspace_swap/swap_storage.cc
@@ -20,7 +20,6 @@ #include "base/files/file_util.h" #include "base/files/scoped_file.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/numerics/checked_math.h" #include "base/path_service.h" #include "base/posix/eintr_wrapper.h"
diff --git a/chromeos/profiles/atom.afdo.newest.txt b/chromeos/profiles/atom.afdo.newest.txt index efa35adb..0819b76 100644 --- a/chromeos/profiles/atom.afdo.newest.txt +++ b/chromeos/profiles/atom.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-atom-98-4744.1-1639393599-benchmark-98.0.4758.7-r1-redacted.afdo.xz +chromeos-chrome-amd64-atom-98-4744.1-1639393599-benchmark-98.0.4758.8-r1-redacted.afdo.xz
diff --git a/chromeos/profiles/bigcore.afdo.newest.txt b/chromeos/profiles/bigcore.afdo.newest.txt index ee4397a5..fecc011 100644 --- a/chromeos/profiles/bigcore.afdo.newest.txt +++ b/chromeos/profiles/bigcore.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-bigcore-98-4744.1-1639397847-benchmark-98.0.4758.7-r1-redacted.afdo.xz +chromeos-chrome-amd64-bigcore-98-4744.1-1639397847-benchmark-98.0.4758.8-r1-redacted.afdo.xz
diff --git a/chromeos/services/bluetooth_config/in_process_instance.cc b/chromeos/services/bluetooth_config/in_process_instance.cc index efe155b47..369bb1f9 100644 --- a/chromeos/services/bluetooth_config/in_process_instance.cc +++ b/chromeos/services/bluetooth_config/in_process_instance.cc
@@ -7,7 +7,6 @@ #include "ash/constants/ash_features.h" #include "base/bind.h" #include "base/check.h" -#include "base/no_destructor.h" #include "chromeos/services/bluetooth_config/cros_bluetooth_config.h" #include "chromeos/services/bluetooth_config/fast_pair_delegate.h" #include "chromeos/services/bluetooth_config/initializer_impl.h"
diff --git a/chromeos/services/cellular_setup/cellular_setup_impl.cc b/chromeos/services/cellular_setup/cellular_setup_impl.cc index cfe1956..b43db37 100644 --- a/chromeos/services/cellular_setup/cellular_setup_impl.cc +++ b/chromeos/services/cellular_setup/cellular_setup_impl.cc
@@ -8,7 +8,6 @@ #include "base/bind.h" #include "base/memory/ptr_util.h" -#include "base/no_destructor.h" #include "chromeos/network/network_handler.h" #include "chromeos/services/cellular_setup/ota_activator_impl.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h"
diff --git a/chromeos/services/chromebox_for_meetings/public/cpp/fake_service_connection.cc b/chromeos/services/chromebox_for_meetings/public/cpp/fake_service_connection.cc index 156e0fa..b03806f 100644 --- a/chromeos/services/chromebox_for_meetings/public/cpp/fake_service_connection.cc +++ b/chromeos/services/chromebox_for_meetings/public/cpp/fake_service_connection.cc
@@ -6,7 +6,6 @@ #include "base/bind.h" #include "base/files/file.h" -#include "base/no_destructor.h" #include "base/sequence_checker.h" #include "chromeos/dbus/chromebox_for_meetings/cfm_hotline_client.h" #include "mojo/public/cpp/bindings/remote.h"
diff --git a/chromeos/services/device_sync/cryptauth_device_activity_getter_impl.cc b/chromeos/services/device_sync/cryptauth_device_activity_getter_impl.cc index 8addad1..2cc229f 100644 --- a/chromeos/services/device_sync/cryptauth_device_activity_getter_impl.cc +++ b/chromeos/services/device_sync/cryptauth_device_activity_getter_impl.cc
@@ -10,7 +10,6 @@ #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "base/time/time.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/components/multidevice/software_feature.h"
diff --git a/chromeos/services/multidevice_setup/public/cpp/first_run_field_trial.cc b/chromeos/services/multidevice_setup/public/cpp/first_run_field_trial.cc index 1e8e542..413eb22 100644 --- a/chromeos/services/multidevice_setup/public/cpp/first_run_field_trial.cc +++ b/chromeos/services/multidevice_setup/public/cpp/first_run_field_trial.cc
@@ -8,7 +8,6 @@ #include "base/containers/contains.h" #include "base/memory/scoped_refptr.h" #include "base/metrics/field_trial.h" -#include "base/no_destructor.h" #include "base/system/sys_info.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc b/chromeos/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc index fc0d99d7..0336b67d 100644 --- a/chromeos/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc +++ b/chromeos/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc
@@ -14,7 +14,6 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/memory/scoped_refptr.h" -#include "base/no_destructor.h" #include "base/run_loop.h" #include "base/task/single_thread_task_runner.h" #include "base/test/bind.h"
diff --git a/chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc b/chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc index cc13583..fc0d6c9 100644 --- a/chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc +++ b/chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc
@@ -6,7 +6,6 @@ #include "base/memory/ptr_util.h" #include "base/memory/scoped_refptr.h" -#include "base/no_destructor.h" #include "base/run_loop.h" #include "base/task/single_thread_task_runner.h" #include "base/test/null_task_runner.h"
diff --git a/chromeos/tast_control.gni b/chromeos/tast_control.gni index 798b840..9125e21 100644 --- a/chromeos/tast_control.gni +++ b/chromeos/tast_control.gni
@@ -99,6 +99,9 @@ # https://crbug.com/1273485: Flaky. "printer.ProxyAdd.epson_software_collate", + + # https://crbug.com/1279285: Flaky. + "policy.AllowWakeLocks", ] # To disable a specific test in lacros_all_tast_tests, add it the following
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc index 8e1e3fc5..e4f28f3b 100644 --- a/components/autofill/content/renderer/autofill_agent.cc +++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -492,6 +492,11 @@ void AutofillAgent::DataListOptionsChanged(const WebInputElement& element) { DCHECK(IsOwnedByFrame(element, render_frame())); + if (element.GetDocument().IsNull() || !is_popup_possibly_visible_ || + !element.Focused()) { + return; + } + if (datalist_option_change_batch_timer_.IsRunning()) datalist_option_change_batch_timer_.AbandonAndStop(); @@ -503,10 +508,8 @@ void AutofillAgent::BatchDataListOptionChange( const blink::WebFormControlElement& element) { - if (element.GetDocument().IsNull() || !is_popup_possibly_visible_ || - !element.Focused()) { + if (element.GetDocument().IsNull()) return; - } OnProvisionallySaveForm(WebFormElement(), element, ElementChangeSource::TEXTFIELD_CHANGED);
diff --git a/components/autofill/core/browser/data_model/autofill_structured_address_regex_provider.cc b/components/autofill/core/browser/data_model/autofill_structured_address_regex_provider.cc index 82aab62..58036086f 100644 --- a/components/autofill/core/browser/data_model/autofill_structured_address_regex_provider.cc +++ b/components/autofill/core/browser/data_model/autofill_structured_address_regex_provider.cc
@@ -6,6 +6,7 @@ #include <utility> +#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "components/autofill/core/browser/data_model/autofill_structured_address_constants.h" #include "components/autofill/core/browser/data_model/autofill_structured_address_utils.h"
diff --git a/components/autofill/core/browser/data_model/autofill_structured_address_utils.cc b/components/autofill/core/browser/data_model/autofill_structured_address_utils.cc index 3fe9d8e..4ca9616 100644 --- a/components/autofill/core/browser/data_model/autofill_structured_address_utils.cc +++ b/components/autofill/core/browser/data_model/autofill_structured_address_utils.cc
@@ -15,6 +15,7 @@ #include "base/feature_list.h" #include "base/i18n/case_conversion.h" #include "base/i18n/char_iterator.h" +#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/strings/string_piece.h" #include "base/strings/string_split.h"
diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc index 73ac6b3..cfa1a04 100644 --- a/components/autofill/core/browser/form_structure.cc +++ b/components/autofill/core/browser/form_structure.cc
@@ -22,7 +22,6 @@ #include "base/logging.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h"
diff --git a/components/autofill/core/browser/geo/alternative_state_name_map.cc b/components/autofill/core/browser/geo/alternative_state_name_map.cc index 5b5add9..469e3fc 100644 --- a/components/autofill/core/browser/geo/alternative_state_name_map.cc +++ b/components/autofill/core/browser/geo/alternative_state_name_map.cc
@@ -4,6 +4,7 @@ #include "components/autofill/core/browser/geo/alternative_state_name_map.h" +#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h"
diff --git a/components/autofill/ios/browser/autofill_java_script_feature.mm b/components/autofill/ios/browser/autofill_java_script_feature.mm index 2615725..f0acaf4 100644 --- a/components/autofill/ios/browser/autofill_java_script_feature.mm +++ b/components/autofill/ios/browser/autofill_java_script_feature.mm
@@ -8,6 +8,7 @@ #include "base/command_line.h" #include "base/feature_list.h" +#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "base/strings/sys_string_conversions.h" #include "base/values.h"
diff --git a/components/autofill/ios/browser/suggestion_controller_java_script_feature.mm b/components/autofill/ios/browser/suggestion_controller_java_script_feature.mm index 82cddaac..4e485b5 100644 --- a/components/autofill/ios/browser/suggestion_controller_java_script_feature.mm +++ b/components/autofill/ios/browser/suggestion_controller_java_script_feature.mm
@@ -7,6 +7,7 @@ #import <Foundation/Foundation.h> #include "base/bind.h" +#include "base/no_destructor.h" #include "base/strings/sys_string_conversions.h" #include "base/time/time.h" #include "base/values.h"
diff --git a/components/autofill/ios/form_util/form_handlers_java_script_feature.mm b/components/autofill/ios/form_util/form_handlers_java_script_feature.mm index 777227f..7494919 100644 --- a/components/autofill/ios/form_util/form_handlers_java_script_feature.mm +++ b/components/autofill/ios/form_util/form_handlers_java_script_feature.mm
@@ -4,6 +4,7 @@ #import "components/autofill/ios/form_util/form_handlers_java_script_feature.h" +#include "base/no_destructor.h" #include "base/values.h" #include "components/autofill/ios/form_util/form_activity_tab_helper.h" #import "components/autofill/ios/form_util/form_util_java_script_feature.h"
diff --git a/components/autofill/ios/form_util/form_util_java_script_feature.mm b/components/autofill/ios/form_util/form_util_java_script_feature.mm index 0a11c03..c26a6b3a 100644 --- a/components/autofill/ios/form_util/form_util_java_script_feature.mm +++ b/components/autofill/ios/form_util/form_util_java_script_feature.mm
@@ -4,6 +4,7 @@ #import "components/autofill/ios/form_util/form_util_java_script_feature.h" +#include "base/no_destructor.h" #include "base/values.h" #import "ios/web/public/js_messaging/java_script_feature_util.h"
diff --git a/components/autofill_assistant/browser/user_data_util.cc b/components/autofill_assistant/browser/user_data_util.cc index 210ceed..e2146ae4 100644 --- a/components/autofill_assistant/browser/user_data_util.cc +++ b/components/autofill_assistant/browser/user_data_util.cc
@@ -9,6 +9,7 @@ #include "base/callback.h" #include "base/containers/flat_map.h" #include "base/i18n/case_conversion.h" +#include "base/no_destructor.h" #include "base/strings/utf_string_conversions.h" #include "components/autofill/core/browser/autofill_data_util.h" #include "components/autofill/core/browser/geo/address_i18n.h"
diff --git a/components/breadcrumbs/core/crash_reporter_breadcrumb_observer.cc b/components/breadcrumbs/core/crash_reporter_breadcrumb_observer.cc index bbee6f9..ec40d44 100644 --- a/components/breadcrumbs/core/crash_reporter_breadcrumb_observer.cc +++ b/components/breadcrumbs/core/crash_reporter_breadcrumb_observer.cc
@@ -7,6 +7,7 @@ #include <numeric> #include <string> +#include "base/no_destructor.h" #include "components/breadcrumbs/core/crash_reporter_breadcrumb_constants.h" #include "components/crash/core/common/crash_key.h"
diff --git a/components/browsing_data/content/cookie_helper.cc b/components/browsing_data/content/cookie_helper.cc index 3d3b9d8..7b0a528 100644 --- a/components/browsing_data/content/cookie_helper.cc +++ b/components/browsing_data/content/cookie_helper.cc
@@ -11,7 +11,6 @@ #include "base/callback_helpers.h" #include "base/check_op.h" #include "base/location.h" -#include "base/no_destructor.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/cookie_access_details.h" #include "content/public/browser/storage_partition.h"
diff --git a/components/cast_certificate/cast_cert_reader.cc b/components/cast_certificate/cast_cert_reader.cc index 5c94f52c..7e879b84 100644 --- a/components/cast_certificate/cast_cert_reader.cc +++ b/components/cast_certificate/cast_cert_reader.cc
@@ -5,7 +5,6 @@ #include "components/cast_certificate/cast_cert_reader.h" #include "base/files/file_util.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/path_service.h" #include "net/cert/internal/common_cert_errors.h" #include "net/cert/pem.h"
diff --git a/components/download/internal/common/url_download_handler_factory.cc b/components/download/internal/common/url_download_handler_factory.cc index 424253e..9ee0f09 100644 --- a/components/download/internal/common/url_download_handler_factory.cc +++ b/components/download/internal/common/url_download_handler_factory.cc
@@ -4,7 +4,6 @@ #include "components/download/public/common/url_download_handler_factory.h" -#include "base/no_destructor.h" #include "base/synchronization/lock.h" #include "components/download/internal/common/resource_downloader.h" #include "components/download/public/common/download_item.h"
diff --git a/components/gwp_asan/client/guarded_page_allocator.cc b/components/gwp_asan/client/guarded_page_allocator.cc index aa54ddd..4bbea722 100644 --- a/components/gwp_asan/client/guarded_page_allocator.cc +++ b/components/gwp_asan/client/guarded_page_allocator.cc
@@ -12,7 +12,6 @@ #include "base/debug/stack_trace.h" #include "base/logging.h" #include "base/memory/page_size.h" -#include "base/no_destructor.h" #include "base/rand_util.h" #include "base/strings/stringprintf.h" #include "base/synchronization/lock.h"
diff --git a/components/gwp_asan/client/sampling_malloc_shims.cc b/components/gwp_asan/client/sampling_malloc_shims.cc index 83d1d93..d69af52 100644 --- a/components/gwp_asan/client/sampling_malloc_shims.cc +++ b/components/gwp_asan/client/sampling_malloc_shims.cc
@@ -10,7 +10,6 @@ #include "base/allocator/allocator_shim.h" #include "base/check_op.h" #include "base/compiler_specific.h" -#include "base/no_destructor.h" #include "base/numerics/safe_math.h" #include "base/process/process_metrics.h" #include "base/rand_util.h"
diff --git a/components/heap_profiling/multi_process/supervisor.h b/components/heap_profiling/multi_process/supervisor.h index 7bceaca6..a94a69c1 100644 --- a/components/heap_profiling/multi_process/supervisor.h +++ b/components/heap_profiling/multi_process/supervisor.h
@@ -6,6 +6,7 @@ #define COMPONENTS_HEAP_PROFILING_MULTI_PROCESS_SUPERVISOR_H_ #include "base/memory/weak_ptr.h" +#include "base/no_destructor.h" #include "base/process/process.h" #include "components/services/heap_profiling/public/mojom/heap_profiling_client.mojom.h" #include "services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom.h"
diff --git a/components/history/core/browser/history_types.cc b/components/history/core/browser/history_types.cc index 99d8b52..8e9bebdf 100644 --- a/components/history/core/browser/history_types.cc +++ b/components/history/core/browser/history_types.cc
@@ -405,7 +405,9 @@ opener_visit_of_redirect_chain_start), source(source) {} AnnotatedVisit::AnnotatedVisit(const AnnotatedVisit&) = default; +AnnotatedVisit::AnnotatedVisit(AnnotatedVisit&&) = default; AnnotatedVisit& AnnotatedVisit::operator=(const AnnotatedVisit&) = default; +AnnotatedVisit& AnnotatedVisit::operator=(AnnotatedVisit&&) = default; AnnotatedVisit::~AnnotatedVisit() = default; ClusterVisit::ClusterVisit() = default; @@ -423,7 +425,9 @@ should_show_on_prominent_ui_surfaces( should_show_on_prominent_ui_surfaces) {} Cluster::Cluster(const Cluster&) = default; +Cluster::Cluster(Cluster&&) = default; Cluster& Cluster::operator=(const Cluster&) = default; +Cluster& Cluster::operator=(Cluster&&) = default; Cluster::~Cluster() = default; ClusterRow::ClusterRow() = default;
diff --git a/components/history/core/browser/history_types.h b/components/history/core/browser/history_types.h index 45d5afa..feeb9af 100644 --- a/components/history/core/browser/history_types.h +++ b/components/history/core/browser/history_types.h
@@ -758,7 +758,9 @@ VisitID opener_visit_of_redirect_chain_start, VisitSource visit); AnnotatedVisit(const AnnotatedVisit&); + AnnotatedVisit(AnnotatedVisit&&); AnnotatedVisit& operator=(const AnnotatedVisit&); + AnnotatedVisit& operator=(AnnotatedVisit&&); ~AnnotatedVisit(); URLRow url_row; @@ -838,7 +840,9 @@ const std::vector<std::u16string>& keywords, bool should_show_on_prominent_ui_surfaces = true); Cluster(const Cluster&); + Cluster(Cluster&&); Cluster& operator=(const Cluster&); + Cluster& operator=(Cluster&&); ~Cluster(); int64_t cluster_id = 0;
diff --git a/components/history_clusters/core/history_clusters_service.cc b/components/history_clusters/core/history_clusters_service.cc index c2ebda67..b860857a 100644 --- a/components/history_clusters/core/history_clusters_service.cc +++ b/components/history_clusters/core/history_clusters_service.cc
@@ -121,6 +121,17 @@ clusters->end()); } +// Transforms a `ClusterVisit` to a `Visit`. This will `std::move` members and +// `cluster_visit` should not be used afterwards. Some fields won't be copied +// over as they're not represented or represented differently by `Visit`. +Visit ClusterVisitToVisit(history::ClusterVisit&& cluster_visit) { + Visit visit; + visit.annotated_visit = std::move(cluster_visit.annotated_visit); + visit.normalized_url = std::move(cluster_visit.normalized_url); + visit.score = cluster_visit.score; + return visit; +} + // Gets a loggable JSON representation of `visits`. std::string GetDebugJSONForVisits( const std::vector<history::AnnotatedVisit>& visits) { @@ -467,61 +478,52 @@ // static std::vector<Cluster> HistoryClustersService::CollapseDuplicateVisits( - const std::vector<history::Cluster>& raw_clusters) { + std::vector<history::Cluster>&& raw_clusters) { std::vector<Cluster> result_clusters; for (const auto& raw_cluster : raw_clusters) { Cluster cluster; cluster.cluster_id = raw_cluster.cluster_id; cluster.keywords = raw_cluster.keywords; - // First stash all visits within the cluster in a id-keyed map. - base::flat_map<int64_t, Visit> visits_map; - visits_map.reserve(raw_cluster.visits.size()); - for (const auto& raw_visit : raw_cluster.visits) { - Visit visit; - visit.annotated_visit = raw_visit.annotated_visit; - visit.normalized_url = raw_visit.normalized_url; - visit.score = raw_visit.score; + // Identify child visits, i.e. visits that are marked duplicate and are not + // canonical. We use the temporary vector `child_visits_vector` in order to + // construct the set in 1 go as each set insertion is O(n). + std::vector<history::VisitID> child_visits_vector; + for (const auto& cluster_visit : raw_cluster.visits) { + for (const auto& duplicate_id : cluster_visit.duplicate_visit_ids) + child_visits_vector.push_back(duplicate_id); + } + base::flat_set<history::VisitID> child_visits_set{ + std::move(child_visits_vector)}; - visits_map[visit.annotated_visit.visit_row.visit_id] = std::move(visit); + // Split the visits into child visits, stored in a map for constant lookup + // later, and parent visits. Because we're `std::move`ing visits, + // `raw_cluster.visits` should not be used after this iteration. + base::flat_map<int64_t, history::ClusterVisit> child_visits_map; + std::vector<history::ClusterVisit> parent_visits; + for (const auto& cluster_visit : raw_cluster.visits) { + const auto& id = cluster_visit.annotated_visit.visit_row.visit_id; + if (child_visits_set.contains(id)) + child_visits_map[id] = std::move(cluster_visit); + else + parent_visits.push_back(std::move(cluster_visit)); } - // Now do the actual un-flattening in a second loop. - for (const auto& raw_visit : raw_cluster.visits) { - int64_t visit_id = raw_visit.annotated_visit.visit_row.visit_id; - - // For every duplicate marked in the original raw visit, find the visit - // in the id-keyed map, move it to the canonical visit's vector, and - // erase it from the map. - for (auto& duplicate_id : raw_visit.duplicate_visit_ids) { - auto duplicate_visit = visits_map.find(duplicate_id); - if (duplicate_visit == visits_map.end()) { - NOTREACHED() << "Visit has missing duplicate ID."; - continue; - } - - // Move the duplicate visit into the vector of the canonical visit. - DCHECK(duplicate_visit->second.duplicate_visits.empty()) - << "Duplicates shouldn't themselves have duplicates. " - "If they do, the output is undefined."; - auto& canonical_visit = visits_map[visit_id]; - canonical_visit.duplicate_visits.push_back( - std::move(duplicate_visit->second)); - - // Remove the duplicate from the map. - visits_map.erase(duplicate_visit); + // Move the child visits from the map of `ClusterVisit`s to the vector of + // `Visit`s. Because we're `std::move`ing visits, `child_visits_map` and + // `parent_visits` should not be used after this iteration. Order matters, + // `parent_visits` preserved `raw_cluster.visits` order above, and we keep + // the same order for `cluster.visits`. + for (auto& cluster_visit : parent_visits) { + std::vector<Visit> duplicate_visits; + for (const auto& duplicate_id : cluster_visit.duplicate_visit_ids) { + DCHECK(child_visits_map.count(duplicate_id)); + duplicate_visits.push_back( + ClusterVisitToVisit(std::move(child_visits_map[duplicate_id]))); } - } - - // Now move all our surviving visits, which should all be canonical visits, - // to the final cluster. To preserve the original pre-sorted ordering, we - // iterate through the original cluster's visits. - for (const auto& raw_visit : raw_cluster.visits) { - auto unflattened_visit = - visits_map.find(raw_visit.annotated_visit.visit_row.visit_id); - if (unflattened_visit != visits_map.end()) { - cluster.visits.push_back(std::move(unflattened_visit->second)); - } + auto visit = ClusterVisitToVisit(std::move(cluster_visit)); + visit.duplicate_visits = std::move(duplicate_visits); + cluster.visits.push_back(std::move(visit)); } result_clusters.push_back(std::move(cluster)); @@ -697,7 +699,7 @@ } FilterClustersMatchingQuery(query, &raw_clusters); - result.clusters = CollapseDuplicateVisits(raw_clusters); + result.clusters = CollapseDuplicateVisits(std::move(raw_clusters)); return result; }
diff --git a/components/history_clusters/core/history_clusters_service.h b/components/history_clusters/core/history_clusters_service.h index ad6ea6d..6bdb792 100644 --- a/components/history_clusters/core/history_clusters_service.h +++ b/components/history_clusters/core/history_clusters_service.h
@@ -161,8 +161,9 @@ // Converts the vector of history::Cluster types to history_clusters::Cluster // by collapsing all the duplicate visits into the canonical visits, thereby // "unflattening" the output of the backend. Public for testing purposes. + // `raw_clusters` will be cannibalized and should not be used again. static std::vector<Cluster> CollapseDuplicateVisits( - const std::vector<history::Cluster>& raw_clusters); + std::vector<history::Cluster>&& raw_clusters); // Clears `all_keywords_cache_` and cancels any pending tasks to populate it. void ClearKeywordCache();
diff --git a/components/history_clusters/core/history_clusters_types.cc b/components/history_clusters/core/history_clusters_types.cc index fadf118..625ef1c05 100644 --- a/components/history_clusters/core/history_clusters_types.cc +++ b/components/history_clusters/core/history_clusters_types.cc
@@ -9,10 +9,16 @@ Visit::Visit() = default; Visit::~Visit() = default; Visit::Visit(const Visit&) = default; +Visit::Visit(Visit&&) = default; +Visit& Visit::operator=(const Visit&) = default; +Visit& Visit::operator=(Visit&&) = default; Cluster::Cluster() = default; Cluster::~Cluster() = default; Cluster::Cluster(const Cluster&) = default; +Cluster::Cluster(Cluster&&) = default; +Cluster& Cluster::operator=(const Cluster&) = default; +Cluster& Cluster::operator=(Cluster&&) = default; QueryClustersResult::QueryClustersResult() = default; QueryClustersResult::~QueryClustersResult() = default;
diff --git a/components/history_clusters/core/history_clusters_types.h b/components/history_clusters/core/history_clusters_types.h index bcc0bcb..50383da 100644 --- a/components/history_clusters/core/history_clusters_types.h +++ b/components/history_clusters/core/history_clusters_types.h
@@ -20,6 +20,9 @@ Visit(); ~Visit(); Visit(const Visit&); + Visit(Visit&&); + Visit& operator=(const Visit&); + Visit& operator=(Visit&&); history::AnnotatedVisit annotated_visit; @@ -41,6 +44,9 @@ Cluster(); ~Cluster(); Cluster(const Cluster&); + Cluster(Cluster&&); + Cluster& operator=(const Cluster&); + Cluster& operator=(Cluster&&); // An unique but opaque cluster ID. int64_t cluster_id;
diff --git a/components/keyed_service/core/simple_key_map.cc b/components/keyed_service/core/simple_key_map.cc index c1e42c8..fcb27e2 100644 --- a/components/keyed_service/core/simple_key_map.cc +++ b/components/keyed_service/core/simple_key_map.cc
@@ -5,6 +5,7 @@ #include "components/keyed_service/core/simple_key_map.h" #include "base/check.h" +#include "base/no_destructor.h" SimpleKeyMap::SimpleKeyMap() = default;
diff --git a/components/lookalikes/core/lookalike_url_util.cc b/components/lookalikes/core/lookalike_url_util.cc index 497e4a2..109a3603 100644 --- a/components/lookalikes/core/lookalike_url_util.cc +++ b/components/lookalikes/core/lookalike_url_util.cc
@@ -15,7 +15,6 @@ #include "base/memory/singleton.h" #include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/strings/string_piece.h" #include "base/strings/string_split.h"
diff --git a/components/metrics/structured/recorder.cc b/components/metrics/structured/recorder.cc index da7f99d9..34fdb163 100644 --- a/components/metrics/structured/recorder.cc +++ b/components/metrics/structured/recorder.cc
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/feature_list.h" +#include "base/no_destructor.h" #include "base/task/current_thread.h" #include "base/task/post_task.h" #include "components/metrics/structured/event_base.h"
diff --git a/components/omnibox/browser/autocomplete_provider.cc b/components/omnibox/browser/autocomplete_provider.cc index b95049c..a7721ae 100644 --- a/components/omnibox/browser/autocomplete_provider.cc +++ b/components/omnibox/browser/autocomplete_provider.cc
@@ -11,7 +11,6 @@ #include "base/feature_list.h" #include "base/i18n/case_conversion.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h"
diff --git a/components/omnibox/browser/history_quick_provider_performance_unittest.cc b/components/omnibox/browser/history_quick_provider_performance_unittest.cc index 7bd80fa..de24eaf 100644 --- a/components/omnibox/browser/history_quick_provider_performance_unittest.cc +++ b/components/omnibox/browser/history_quick_provider_performance_unittest.cc
@@ -9,7 +9,6 @@ #include <string> #include "base/cxx17_backports.h" -#include "base/no_destructor.h" #include "base/run_loop.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h"
diff --git a/components/omnibox/browser/on_device_model_update_listener.cc b/components/omnibox/browser/on_device_model_update_listener.cc index 5a67609..72551f6 100644 --- a/components/omnibox/browser/on_device_model_update_listener.cc +++ b/components/omnibox/browser/on_device_model_update_listener.cc
@@ -5,6 +5,7 @@ #include "components/omnibox/browser/on_device_model_update_listener.h" #include "base/files/file_enumerator.h" +#include "base/no_destructor.h" #include "base/strings/utf_string_conversions.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h"
diff --git a/components/omnibox/browser/search_suggestion_parser.cc b/components/omnibox/browser/search_suggestion_parser.cc index f4c2684..d1c8171 100644 --- a/components/omnibox/browser/search_suggestion_parser.cc +++ b/components/omnibox/browser/search_suggestion_parser.cc
@@ -16,7 +16,6 @@ #include "base/json/json_writer.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h"
diff --git a/components/optimization_guide/core/optimization_hints_component_update_listener.cc b/components/optimization_guide/core/optimization_hints_component_update_listener.cc index 4ea36ec..019c0d4 100644 --- a/components/optimization_guide/core/optimization_hints_component_update_listener.cc +++ b/components/optimization_guide/core/optimization_hints_component_update_listener.cc
@@ -5,6 +5,7 @@ #include "components/optimization_guide/core/optimization_hints_component_update_listener.h" #include "base/metrics/histogram_functions.h" +#include "base/no_destructor.h" namespace optimization_guide {
diff --git a/components/paint_preview/browser/paint_preview_base_service_unittest.cc b/components/paint_preview/browser/paint_preview_base_service_unittest.cc index 29d2b460..bc2d428 100644 --- a/components/paint_preview/browser/paint_preview_base_service_unittest.cc +++ b/components/paint_preview/browser/paint_preview_base_service_unittest.cc
@@ -8,7 +8,6 @@ #include <utility> #include "base/files/scoped_temp_dir.h" -#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h"
diff --git a/components/password_manager/core/browser/password_store_proxy_backend.cc b/components/password_manager/core/browser/password_store_proxy_backend.cc index 43625367..7e964a5 100644 --- a/components/password_manager/core/browser/password_store_proxy_backend.cc +++ b/components/password_manager/core/browser/password_store_proxy_backend.cc
@@ -26,16 +26,32 @@ using MethodName = base::StrongAlias<struct MethodNameTag, std::string>; -bool IsPasswordUniquePtrLess(const std::unique_ptr<PasswordForm>& lhs, - const std::unique_ptr<PasswordForm>& rhs) { - return PasswordFormUniqueKey(*lhs) < PasswordFormUniqueKey(*rhs); -} +struct LoginsResultOrErrorImpl { + using ResultType = LoginsResultOrError; + using ElementsType = LoginsResult; -bool IsPasswordUniquePtrWithSameKeyInconsistent( - const std::unique_ptr<PasswordForm>& lhs, - const std::unique_ptr<PasswordForm>& rhs) { - return lhs->password_value != rhs->password_value; -} + static LoginsResult* GetElements(LoginsResultOrError& logins_or_error) { + return absl::holds_alternative<PasswordStoreBackendError>(logins_or_error) + ? nullptr + : &absl::get<LoginsResult>(logins_or_error); + } + + static std::unique_ptr<PasswordForm> Clone( + const std::unique_ptr<PasswordForm>& login) { + return std::make_unique<PasswordForm>(*login); + } + + static bool IsLess(const std::unique_ptr<PasswordForm>& lhs, + const std::unique_ptr<PasswordForm>& rhs) { + return PasswordFormUniqueKey(*lhs) < PasswordFormUniqueKey(*rhs); + } + + static bool HaveInconsistentPasswords( + const std::unique_ptr<PasswordForm>& lhs, + const std::unique_ptr<PasswordForm>& rhs) { + return lhs->password_value != rhs->password_value; + } +}; void InvokeCallbackWithCombinedStatus(base::OnceCallback<void(bool)> completion, std::vector<bool> statuses) { @@ -110,59 +126,63 @@ } // Records the metrics of a pair of MethodName calls to the main and -// the shadow backends once both calls are finished. +// the shadow backends once both calls are finished. MethodName() is expected to +// return an std::vector<ApiMethodImpl::ResultType>. ApiMethodImpl classes need +// to provide 4 methods: +// - GetElements(): returns the elements to be compared +// - Clone(): Returns a copy of an element, used to cache the main results. +// - IsLess(): to compare elements. +// - HaveInconsistentPasswords(): Whether elements have inconsistent passwords // // The class is ref-counted because it is equally owned by the two parallel // method calls : it must outlive the first returning one and shall be // destroyed after the second one returns. +template <typename ApiMethodImpl> class ShadowTrafficMetricsRecorder - : public base::RefCounted<ShadowTrafficMetricsRecorder> { + : public base::RefCounted<ShadowTrafficMetricsRecorder<ApiMethodImpl>> { public: explicit ShadowTrafficMetricsRecorder(MethodName method_name) : method_name_(std::move(method_name)) {} // Returns the unchanged |result| so it can be passed to the main handler. - LoginsResultOrError RecordMainLoginsResultOrError( - LoginsResultOrError logins_or_error) { - if (absl::holds_alternative<PasswordStoreBackendError>(logins_or_error)) { - return logins_or_error; + typename ApiMethodImpl::ResultType RecordMainResult( + typename ApiMethodImpl::ResultType result) { + if (auto* elements = ApiMethodImpl::GetElements(result)) { + if (!first_result_) { + first_result_ = + absl::make_optional<typename ApiMethodImpl::ElementsType>(); + first_result_->reserve(elements->size()); + for (const auto& e : *elements) + first_result_->push_back(ApiMethodImpl::Clone(e)); + } else { + RecordMetrics(method_name_, /*main_result=*/*elements, + /*shadow_result=*/*first_result_, &ApiMethodImpl::IsLess, + &ApiMethodImpl::HaveInconsistentPasswords); + } } - LoginsResult logins = std::move(absl::get<LoginsResult>(logins_or_error)); - if (!first_result_) { - first_result_ = absl::make_optional<LoginsResult>(); - first_result_->reserve(logins.size()); - for (const auto& login : logins) - first_result_->push_back(std::make_unique<PasswordForm>(*login)); - } else { - RecordMetrics(method_name_, /*main_result=*/logins, - /*shadow_result=*/*first_result_, &IsPasswordUniquePtrLess, - &IsPasswordUniquePtrWithSameKeyInconsistent); - } - - return logins; + return result; } - void RecordShadowLoginsResultOrError(LoginsResultOrError logins_or_error) { - if (absl::holds_alternative<PasswordStoreBackendError>(logins_or_error)) { - return; + void RecordShadowResult(typename ApiMethodImpl::ResultType result) { + if (auto* elements = ApiMethodImpl::GetElements(result)) { + if (!first_result_) { + first_result_ = std::move(*elements); + } else { + RecordMetrics(method_name_, + /*main_result=*/*first_result_, + /*shadow_result=*/*elements, &ApiMethodImpl::IsLess, + &ApiMethodImpl::HaveInconsistentPasswords); + } } - - LoginsResult logins = std::move(absl::get<LoginsResult>(logins_or_error)); - if (!first_result_) - first_result_ = std::move(logins); - else - RecordMetrics(method_name_, /*main_result=*/*first_result_, - /*shadow_result=*/logins, &IsPasswordUniquePtrLess, - &IsPasswordUniquePtrWithSameKeyInconsistent); } private: - friend class RefCounted<ShadowTrafficMetricsRecorder>; + friend class base::RefCounted<ShadowTrafficMetricsRecorder<ApiMethodImpl>>; ~ShadowTrafficMetricsRecorder() = default; // Stores the result of the backend that returns first. - absl::optional<LoginsResult> first_result_; + absl::optional<typename ApiMethodImpl::ElementsType> first_result_; const MethodName method_name_; }; @@ -207,20 +227,23 @@ } void PasswordStoreProxyBackend::GetAllLoginsAsync(LoginsOrErrorReply callback) { - scoped_refptr<ShadowTrafficMetricsRecorder> handler = - base::MakeRefCounted<ShadowTrafficMetricsRecorder>( + scoped_refptr<ShadowTrafficMetricsRecorder<LoginsResultOrErrorImpl>> handler = + base::MakeRefCounted< + ShadowTrafficMetricsRecorder<LoginsResultOrErrorImpl>>( MethodName("GetAllLoginsAsync")); main_backend_->GetAllLoginsAsync( - base::BindOnce( - &ShadowTrafficMetricsRecorder::RecordMainLoginsResultOrError, handler) + base::BindOnce(&ShadowTrafficMetricsRecorder< + LoginsResultOrErrorImpl>::RecordMainResult, + handler) .Then(std::move(callback))); if (is_syncing_passwords_callback_.Run() && base::FeatureList::IsEnabled( features::kUnifiedPasswordManagerShadowAndroid)) { - shadow_backend_->GetAllLoginsAsync(base::BindOnce( - &ShadowTrafficMetricsRecorder::RecordShadowLoginsResultOrError, - handler)); + shadow_backend_->GetAllLoginsAsync( + base::BindOnce(&ShadowTrafficMetricsRecorder< + LoginsResultOrErrorImpl>::RecordShadowResult, + handler)); } }
diff --git a/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.cc b/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.cc index 6a9ef85..f0d3221 100644 --- a/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.cc +++ b/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.cc
@@ -12,7 +12,6 @@ #include "base/files/file_path.h" #include "base/location.h" #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "base/ranges/algorithm.h" #include "base/task/sequenced_task_runner.h" #include "base/task/thread_pool.h"
diff --git a/components/password_manager/ios/password_manager_java_script_feature.mm b/components/password_manager/ios/password_manager_java_script_feature.mm index 521b2cf7..41b6fa1 100644 --- a/components/password_manager/ios/password_manager_java_script_feature.mm +++ b/components/password_manager/ios/password_manager_java_script_feature.mm
@@ -4,6 +4,7 @@ #import "components/password_manager/ios/password_manager_java_script_feature.h" +#include "base/no_destructor.h" #include "base/strings/sys_string_conversions.h" #include "base/values.h" #include "components/autofill/core/common/password_form_fill_data.h"
diff --git a/components/permissions/permission_actions_history.cc b/components/permissions/permission_actions_history.cc index 27cb7a8..d468cdf 100644 --- a/components/permissions/permission_actions_history.cc +++ b/components/permissions/permission_actions_history.cc
@@ -5,7 +5,6 @@ #include "base/containers/adapters.h" #include "base/json/values_util.h" -#include "base/no_destructor.h" #include "base/ranges/algorithm.h" #include "base/strings/string_piece.h" #include "base/values.h"
diff --git a/components/policy/core/common/management/platform_management_service.cc b/components/policy/core/common/management/platform_management_service.cc index 980849c36..43ff991 100644 --- a/components/policy/core/common/management/platform_management_service.cc +++ b/components/policy/core/common/management/platform_management_service.cc
@@ -4,7 +4,6 @@ #include "components/policy/core/common/management/platform_management_service.h" -#include "base/no_destructor.h" #include "build/build_config.h" #if defined(OS_WIN)
diff --git a/components/policy/core/common/policy_proto_decoders.cc b/components/policy/core/common/policy_proto_decoders.cc index 1e631c5..11521b3 100644 --- a/components/policy/core/common/policy_proto_decoders.cc +++ b/components/policy/core/common/policy_proto_decoders.cc
@@ -129,7 +129,7 @@ PolicyPerProfileFilter per_profile) { PolicyLevel level; - for (const BooleanPolicyAccess& access : GetBooleanPolicyAccess()) { + for (const BooleanPolicyAccess& access : kBooleanPolicyAccess) { if (!PerProfileMatches(access.per_profile, per_profile) || !access.has_proto(policy)) continue; @@ -142,7 +142,7 @@ nullptr); } - for (const IntegerPolicyAccess& access : GetIntegerPolicyAccess()) { + for (const IntegerPolicyAccess& access : kIntegerPolicyAccess) { if (!PerProfileMatches(access.per_profile, per_profile) || !access.has_proto(policy)) continue; @@ -160,7 +160,7 @@ {base::UTF8ToUTF16(error)}); } - for (const StringPolicyAccess& access : GetStringPolicyAccess()) { + for (const StringPolicyAccess& access : kStringPolicyAccess) { if (!PerProfileMatches(access.per_profile, per_profile) || !access.has_proto(policy)) continue; @@ -196,7 +196,7 @@ {base::UTF8ToUTF16(error)}); } - for (const StringListPolicyAccess& access : GetStringListPolicyAccess()) { + for (const StringListPolicyAccess& access : kStringListPolicyAccess) { if (!PerProfileMatches(access.per_profile, per_profile) || !access.has_proto(policy)) continue;
diff --git a/components/policy/test_support/request_handler_for_register_device_and_user.cc b/components/policy/test_support/request_handler_for_register_device_and_user.cc index 65e3142..f62b4802 100644 --- a/components/policy/test_support/request_handler_for_register_device_and_user.cc +++ b/components/policy/test_support/request_handler_for_register_device_and_user.cc
@@ -107,7 +107,8 @@ client_info.device_id = device_id; client_info.device_token = device_token; client_info.machine_name = machine_name; - client_info.username = policy_user; + if (!policy_user.empty()) + client_info.username = policy_user; AddAllowedPolicyTypes(register_request.type(), &client_info.allowed_policy_types); client_storage()->RegisterClient(std::move(client_info));
diff --git a/components/policy/test_support/signature_provider.cc b/components/policy/test_support/signature_provider.cc index cbc4437..31cf722 100644 --- a/components/policy/test_support/signature_provider.cc +++ b/components/policy/test_support/signature_provider.cc
@@ -153,12 +153,19 @@ bool SignatureProvider::SigningKey::GetSignatureForDomain( const std::string& domain, std::string* signature) const { - auto it = signatures_.find(domain); - if (it == signatures_.end()) - return false; + auto domain_signature = signatures_.find(domain); + if (domain_signature != signatures_.end()) { + signature->assign(domain_signature->second); + return true; + } - signature->assign(it->second); - return true; + auto wildcard_signature = signatures_.find("*"); + if (wildcard_signature != signatures_.end()) { + signature->assign(wildcard_signature->second); + return true; + } + + return false; } bool SignatureProvider::SigningKey::Sign(const std::string& str,
diff --git a/components/policy/tools/generate_policy_source.py b/components/policy/tools/generate_policy_source.py index c36b70d..c1275d9 100755 --- a/components/policy/tools/generate_policy_source.py +++ b/components/policy/tools/generate_policy_source.py
@@ -502,7 +502,6 @@ #include <cstdint> #include <string> -#include "base/no_destructor.h" #include "components/policy/core/common/policy_details.h" #include "components/policy/core/common/policy_map.h" #include "components/policy/proto/cloud_policy.pb.h" @@ -597,15 +596,13 @@ f.write('struct %sPolicyAccess {\n' % protobuf_type) f.write(' const char* policy_key;\n' ' bool per_profile;\n' - ' std::function<bool(const em::CloudPolicySettings& policy)>\n' - ' has_proto;\n' - ' std::function<const em::%sPolicyProto&(\n' - ' const em::CloudPolicySettings& policy)>\n' - ' get_proto;\n' % protobuf_type) + ' bool (*has_proto)(const em::CloudPolicySettings& policy);\n' + ' const em::%sPolicyProto& (*get_proto)(\n' + ' const em::CloudPolicySettings& policy);\n' % protobuf_type) if protobuf_type == 'String': f.write(' const StringPolicyType type;\n') f.write('};\n') - f.write('const std::array<%sPolicyAccess, %d>& Get%sPolicyAccess();\n\n' % + f.write('extern const std::array<%sPolicyAccess, %d> k%sPolicyAccess;\n\n' % (protobuf_type, len(supported_user_policies), protobuf_type)) @@ -1341,31 +1338,25 @@ def _WriteChromePolicyAccessSource(policies, f, protobuf_type): supported_user_policies = _GetSupportedChromeUserPolicies( policies, protobuf_type) - f.write('const std::array<%sPolicyAccess, %d>& Get%sPolicyAccess() {\n' % - (protobuf_type, len(supported_user_policies), protobuf_type)) - f.write(' static const base::NoDestructor<std::array<%sPolicyAccess, %d>>\n' - ' k%sPolicyAccess({{\n' % + f.write('const std::array<%sPolicyAccess, %d> k%sPolicyAccess {{\n' % (protobuf_type, len(supported_user_policies), protobuf_type)) extra_args = '' for policy in supported_user_policies: name = policy.name if protobuf_type == 'String': - extra_args = ',\n ' + _GetStringPolicyType(policy.policy_type) - f.write(' {key::k%s,\n' - ' %s,\n' - ' [](const em::CloudPolicySettings& policy) {\n' - ' return policy.has_%s();\n' - ' },\n' - ' [](const em::CloudPolicySettings& policy)\n' - ' -> const em::%sPolicyProto& {\n' - ' return policy.%s();\n' - ' }%s\n' - ' },\n' % (name, str(policy.per_profile).lower(), name.lower(), - protobuf_type, name.lower(), extra_args)) - f.write(' }});\n\n') - f.write(' return *k%sPolicyAccess;\n' % protobuf_type) - f.write('}\n\n') - + extra_args = ',\n ' + _GetStringPolicyType(policy.policy_type) + f.write(' {key::k%s,\n' + ' %s,\n' + ' [](const em::CloudPolicySettings& policy) {\n' + ' return policy.has_%s();\n' + ' },\n' + ' [](const em::CloudPolicySettings& policy)\n' + ' -> const em::%sPolicyProto& {\n' + ' return policy.%s();\n' + ' }%s\n' + ' },\n' % (name, str(policy.per_profile).lower(), name.lower(), + protobuf_type, name.lower(), extra_args)) + f.write('}};\n\n') #------------------ policy risk tag header -------------------------#
diff --git a/components/policy/tools/generate_policy_source_test_data.py b/components/policy/tools/generate_policy_source_test_data.py index 3e883158..add2c798 100644 --- a/components/policy/tools/generate_policy_source_test_data.py +++ b/components/policy/tools/generate_policy_source_test_data.py
@@ -121,7 +121,6 @@ #include <cstdint> #include <string> -#include "base/no_destructor.h" #include "components/policy/core/common/policy_details.h" #include "components/policy/core/common/policy_map.h" #include "components/policy/proto/cloud_policy.pb.h" @@ -196,50 +195,42 @@ struct BooleanPolicyAccess { const char* policy_key; bool per_profile; - std::function<bool(const em::CloudPolicySettings& policy)> - has_proto; - std::function<const em::BooleanPolicyProto&( - const em::CloudPolicySettings& policy)> - get_proto; + bool (*has_proto)(const em::CloudPolicySettings& policy); + const em::BooleanPolicyProto& (*get_proto)( + const em::CloudPolicySettings& policy); }; -const std::array<BooleanPolicyAccess, 4>& GetBooleanPolicyAccess(); +extern const std::array<BooleanPolicyAccess, 4> kBooleanPolicyAccess; // Read access to the protobufs of all supported integer user policies. struct IntegerPolicyAccess { const char* policy_key; bool per_profile; - std::function<bool(const em::CloudPolicySettings& policy)> - has_proto; - std::function<const em::IntegerPolicyProto&( - const em::CloudPolicySettings& policy)> - get_proto; + bool (*has_proto)(const em::CloudPolicySettings& policy); + const em::IntegerPolicyProto& (*get_proto)( + const em::CloudPolicySettings& policy); }; -const std::array<IntegerPolicyAccess, 0>& GetIntegerPolicyAccess(); +extern const std::array<IntegerPolicyAccess, 0> kIntegerPolicyAccess; // Read access to the protobufs of all supported string user policies. struct StringPolicyAccess { const char* policy_key; bool per_profile; - std::function<bool(const em::CloudPolicySettings& policy)> - has_proto; - std::function<const em::StringPolicyProto&( - const em::CloudPolicySettings& policy)> - get_proto; + bool (*has_proto)(const em::CloudPolicySettings& policy); + const em::StringPolicyProto& (*get_proto)( + const em::CloudPolicySettings& policy); const StringPolicyType type; }; -const std::array<StringPolicyAccess, 1>& GetStringPolicyAccess(); +extern const std::array<StringPolicyAccess, 1> kStringPolicyAccess; // Read access to the protobufs of all supported stringlist user policies. struct StringListPolicyAccess { const char* policy_key; bool per_profile; - std::function<bool(const em::CloudPolicySettings& policy)> - has_proto; - std::function<const em::StringListPolicyProto&( - const em::CloudPolicySettings& policy)> - get_proto; + bool (*has_proto)(const em::CloudPolicySettings& policy); + const em::StringListPolicyProto& (*get_proto)( + const em::CloudPolicySettings& policy); }; -const std::array<StringListPolicyAccess, 0>& GetStringListPolicyAccess(); +extern const std::array<StringListPolicyAccess, 0> kStringListPolicyAccess; constexpr int64_t kDevicePolicyExternalDataResourceCacheSize = 0; @@ -408,88 +399,68 @@ } // namespace metapolicy -const std::array<BooleanPolicyAccess, 4>& GetBooleanPolicyAccess() { - static const base::NoDestructor<std::array<BooleanPolicyAccess, 4>> - kBooleanPolicyAccess({{ - {key::kExampleBoolPolicy, - false, - [](const em::CloudPolicySettings& policy) { - return policy.has_exampleboolpolicy(); - }, - [](const em::CloudPolicySettings& policy) - -> const em::BooleanPolicyProto& { - return policy.exampleboolpolicy(); - } - }, - {key::kExampleBoolMergeMetapolicy, - false, - [](const em::CloudPolicySettings& policy) { - return policy.has_exampleboolmergemetapolicy(); - }, - [](const em::CloudPolicySettings& policy) - -> const em::BooleanPolicyProto& { - return policy.exampleboolmergemetapolicy(); - } - }, - {key::kExampleBoolPrecedenceMetapolicy, - false, - [](const em::CloudPolicySettings& policy) { - return policy.has_exampleboolprecedencemetapolicy(); - }, - [](const em::CloudPolicySettings& policy) - -> const em::BooleanPolicyProto& { - return policy.exampleboolprecedencemetapolicy(); - } - }, - {key::kCloudOnlyPolicy, - false, - [](const em::CloudPolicySettings& policy) { - return policy.has_cloudonlypolicy(); - }, - [](const em::CloudPolicySettings& policy) - -> const em::BooleanPolicyProto& { - return policy.cloudonlypolicy(); - } - }, - }}); +const std::array<BooleanPolicyAccess, 4> kBooleanPolicyAccess {{ + {key::kExampleBoolPolicy, + false, + [](const em::CloudPolicySettings& policy) { + return policy.has_exampleboolpolicy(); + }, + [](const em::CloudPolicySettings& policy) + -> const em::BooleanPolicyProto& { + return policy.exampleboolpolicy(); + } + }, + {key::kExampleBoolMergeMetapolicy, + false, + [](const em::CloudPolicySettings& policy) { + return policy.has_exampleboolmergemetapolicy(); + }, + [](const em::CloudPolicySettings& policy) + -> const em::BooleanPolicyProto& { + return policy.exampleboolmergemetapolicy(); + } + }, + {key::kExampleBoolPrecedenceMetapolicy, + false, + [](const em::CloudPolicySettings& policy) { + return policy.has_exampleboolprecedencemetapolicy(); + }, + [](const em::CloudPolicySettings& policy) + -> const em::BooleanPolicyProto& { + return policy.exampleboolprecedencemetapolicy(); + } + }, + {key::kCloudOnlyPolicy, + false, + [](const em::CloudPolicySettings& policy) { + return policy.has_cloudonlypolicy(); + }, + [](const em::CloudPolicySettings& policy) + -> const em::BooleanPolicyProto& { + return policy.cloudonlypolicy(); + } + }, +}}; - return *kBooleanPolicyAccess; -} +const std::array<IntegerPolicyAccess, 0> kIntegerPolicyAccess {{ +}}; -const std::array<IntegerPolicyAccess, 0>& GetIntegerPolicyAccess() { - static const base::NoDestructor<std::array<IntegerPolicyAccess, 0>> - kIntegerPolicyAccess({{ - }}); +const std::array<StringPolicyAccess, 1> kStringPolicyAccess {{ + {key::kExampleStringPolicy, + false, + [](const em::CloudPolicySettings& policy) { + return policy.has_examplestringpolicy(); + }, + [](const em::CloudPolicySettings& policy) + -> const em::StringPolicyProto& { + return policy.examplestringpolicy(); + }, + StringPolicyType::STRING + }, +}}; - return *kIntegerPolicyAccess; -} - -const std::array<StringPolicyAccess, 1>& GetStringPolicyAccess() { - static const base::NoDestructor<std::array<StringPolicyAccess, 1>> - kStringPolicyAccess({{ - {key::kExampleStringPolicy, - false, - [](const em::CloudPolicySettings& policy) { - return policy.has_examplestringpolicy(); - }, - [](const em::CloudPolicySettings& policy) - -> const em::StringPolicyProto& { - return policy.examplestringpolicy(); - }, - StringPolicyType::STRING - }, - }}); - - return *kStringPolicyAccess; -} - -const std::array<StringListPolicyAccess, 0>& GetStringListPolicyAccess() { - static const base::NoDestructor<std::array<StringListPolicyAccess, 0>> - kStringListPolicyAccess({{ - }}); - - return *kStringListPolicyAccess; -} +const std::array<StringListPolicyAccess, 0> kStringListPolicyAccess {{ +}}; } // namespace policy
diff --git a/components/power_scheduler/power_scheduler.h b/components/power_scheduler/power_scheduler.h index fea177e..a1dfdb50 100644 --- a/components/power_scheduler/power_scheduler.h +++ b/components/power_scheduler/power_scheduler.h
@@ -8,6 +8,7 @@ #include "base/component_export.h" #include "base/cpu_affinity_posix.h" #include "base/memory/raw_ptr.h" +#include "base/no_destructor.h" #include "base/process/process_metrics.h" #include "base/task/task_observer.h" #include "components/power_scheduler/power_mode_arbiter.h"
diff --git a/components/reporting/client/mock_report_queue_provider.cc b/components/reporting/client/mock_report_queue_provider.cc index f0b0f419..ef2d5aac 100644 --- a/components/reporting/client/mock_report_queue_provider.cc +++ b/components/reporting/client/mock_report_queue_provider.cc
@@ -9,7 +9,6 @@ #include "base/bind.h" #include "base/callback_helpers.h" -#include "base/no_destructor.h" #include "base/task/sequenced_task_runner.h" #include "base/test/gmock_callback_support.h" #include "base/threading/sequenced_task_runner_handle.h"
diff --git a/components/safe_browsing/content/browser/safe_browsing_navigation_observer_unittest.cc b/components/safe_browsing/content/browser/safe_browsing_navigation_observer_unittest.cc index 7af7b7f..a1c5ef4 100644 --- a/components/safe_browsing/content/browser/safe_browsing_navigation_observer_unittest.cc +++ b/components/safe_browsing/content/browser/safe_browsing_navigation_observer_unittest.cc
@@ -30,7 +30,10 @@ class SBNavigationObserverTest : public content::RenderViewHostTestHarness { public: - SBNavigationObserverTest() {} + SBNavigationObserverTest() { + scoped_feature_list_.InitAndEnableFeature( + kOmitNonUserGesturesFromReferrerChain); + } SBNavigationObserverTest(const SBNavigationObserverTest&) = delete; SBNavigationObserverTest& operator=(const SBNavigationObserverTest&) = delete; @@ -50,9 +53,6 @@ navigation_observer_ = new SafeBrowsingNavigationObserver(web_contents(), settings_map_.get(), navigation_observer_manager_.get()); - - scoped_feature_list_.InitAndEnableFeature( - kOmitNonUserGesturesFromReferrerChain); } void TearDown() override { delete navigation_observer_; @@ -185,6 +185,8 @@ std::unique_ptr<SafeBrowsingNavigationObserverManager> navigation_observer_manager_; raw_ptr<SafeBrowsingNavigationObserver> navigation_observer_; + + private: base::test::ScopedFeatureList scoped_feature_list_; };
diff --git a/components/services/heap_profiling/heap_profiling_service.cc b/components/services/heap_profiling/heap_profiling_service.cc index ede6ca0..b21009e11 100644 --- a/components/services/heap_profiling/heap_profiling_service.cc +++ b/components/services/heap_profiling/heap_profiling_service.cc
@@ -9,7 +9,6 @@ #include "base/bind.h" #include "base/memory/weak_ptr.h" -#include "base/no_destructor.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h" #include "components/services/heap_profiling/connection_manager.h"
diff --git a/components/services/heap_profiling/public/cpp/heap_profiling_trace_source.cc b/components/services/heap_profiling/public/cpp/heap_profiling_trace_source.cc index 31391d6b..1860fe83 100644 --- a/components/services/heap_profiling/public/cpp/heap_profiling_trace_source.cc +++ b/components/services/heap_profiling/public/cpp/heap_profiling_trace_source.cc
@@ -4,6 +4,7 @@ #include "components/services/heap_profiling/public/cpp/heap_profiling_trace_source.h" +#include "base/no_destructor.h" #include "base/profiler/frame.h" #include "base/profiler/module_cache.h" #include "base/trace_event/trace_event.h"
diff --git a/components/services/patch/content/patch_service.cc b/components/services/patch/content/patch_service.cc index 1c8ff4f..d384c3cb 100644 --- a/components/services/patch/content/patch_service.cc +++ b/components/services/patch/content/patch_service.cc
@@ -4,7 +4,6 @@ #include "components/services/patch/content/patch_service.h" -#include "base/no_destructor.h" #include "components/services/patch/public/mojom/file_patcher.mojom.h" #include "components/strings/grit/components_strings.h" #include "content/public/browser/service_process_host.h"
diff --git a/components/services/storage/indexed_db/transactional_leveldb/transactional_leveldb_transaction_unittest.cc b/components/services/storage/indexed_db/transactional_leveldb/transactional_leveldb_transaction_unittest.cc index 644beee..f2602da 100644 --- a/components/services/storage/indexed_db/transactional_leveldb/transactional_leveldb_transaction_unittest.cc +++ b/components/services/storage/indexed_db/transactional_leveldb/transactional_leveldb_transaction_unittest.cc
@@ -15,7 +15,6 @@ #include "base/files/file.h" #include "base/files/file_path.h" -#include "base/no_destructor.h" #include "base/strings/string_piece.h" #include "base/test/bind.h" #include "base/threading/sequenced_task_runner_handle.h"
diff --git a/components/shared_highlighting/core/common/shared_highlighting_features.cc b/components/shared_highlighting/core/common/shared_highlighting_features.cc index f2ae62b..13ee4e1 100644 --- a/components/shared_highlighting/core/common/shared_highlighting_features.cc +++ b/components/shared_highlighting/core/common/shared_highlighting_features.cc
@@ -19,6 +19,9 @@ const base::Feature kSharedHighlightingAmp{"SharedHighlightingAmp", base::FEATURE_ENABLED_BY_DEFAULT}; +const base::Feature kIOSSharedHighlightingV2{"IOSSharedHighlightingV2", + base::FEATURE_DISABLED_BY_DEFAULT}; + int GetPreemptiveLinkGenTimeoutLengthMs() { return kPreemptiveLinkGenTimeoutLengthMs.Get(); }
diff --git a/components/shared_highlighting/core/common/shared_highlighting_features.h b/components/shared_highlighting/core/common/shared_highlighting_features.h index 56b737b..144dfcf 100644 --- a/components/shared_highlighting/core/common/shared_highlighting_features.h +++ b/components/shared_highlighting/core/common/shared_highlighting_features.h
@@ -24,6 +24,9 @@ // Enables shared highlighting for AMP viewers pages. extern const base::Feature kSharedHighlightingAmp; +// Feature flag that enable Shared Highlighting V2 in iOS. +extern const base::Feature kIOSSharedHighlightingV2; + // Returns the pre-emptive link generation timeout length. int GetPreemptiveLinkGenTimeoutLengthMs();
diff --git a/components/soda/soda_installer_impl_chromeos.cc b/components/soda/soda_installer_impl_chromeos.cc index 7b1b8e58..2b1a53b 100644 --- a/components/soda/soda_installer_impl_chromeos.cc +++ b/components/soda/soda_installer_impl_chromeos.cc
@@ -6,7 +6,6 @@ #include "base/bind.h" #include "base/feature_list.h" -#include "base/no_destructor.h" #include "base/numerics/safe_conversions.h" #include "chromeos/dbus/dlcservice/dlcservice_client.h" #include "components/live_caption/pref_names.h"
diff --git a/components/spellcheck/browser/spellcheck_platform_win.cc b/components/spellcheck/browser/spellcheck_platform_win.cc index fe839caa..eab6dc40 100644 --- a/components/spellcheck/browser/spellcheck_platform_win.cc +++ b/components/spellcheck/browser/spellcheck_platform_win.cc
@@ -7,7 +7,6 @@ #include <string> #include "base/callback.h" -#include "base/no_destructor.h" #include "base/task/post_task.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h"
diff --git a/components/sync/base/pref_names.cc b/components/sync/base/pref_names.cc index 63a33f1c..7d79917 100644 --- a/components/sync/base/pref_names.cc +++ b/components/sync/base/pref_names.cc
@@ -23,10 +23,6 @@ // SyncSettingsCategorization rollout. const char kOsSyncPrefsMigrated[] = "sync.os_sync_prefs_migrated"; -// Boolean indicating that the user has enabled the Chrome OS system-setting -// sync feature. -const char kOsSyncFeatureEnabled[] = "sync.os_sync_feature_enabled"; - // Boolean specifying whether to automatically sync all Chrome OS specific data // types (including future ones). This includes types like printers, OS-only // settings, etc. If set, the individual type preferences can be ignored.
diff --git a/components/sync/base/pref_names.h b/components/sync/base/pref_names.h index 9538b77..be3763f 100644 --- a/components/sync/base/pref_names.h +++ b/components/sync/base/pref_names.h
@@ -17,7 +17,6 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) extern const char kOsSyncPrefsMigrated[]; -extern const char kOsSyncFeatureEnabled[]; extern const char kSyncAllOsTypes[]; extern const char kSyncOsApps[]; extern const char kSyncOsPreferences[];
diff --git a/components/sync/base/sync_prefs.cc b/components/sync/base/sync_prefs.cc index fb2c460..96f4102 100644 --- a/components/sync/base/sync_prefs.cc +++ b/components/sync/base/sync_prefs.cc
@@ -77,7 +77,6 @@ } #if BUILDFLAG(IS_CHROMEOS_ASH) registry->RegisterBooleanPref(prefs::kOsSyncPrefsMigrated, false); - registry->RegisterBooleanPref(prefs::kOsSyncFeatureEnabled, false); registry->RegisterBooleanPref(prefs::kSyncAllOsTypes, true); registry->RegisterBooleanPref(prefs::kSyncOsApps, false); registry->RegisterBooleanPref(prefs::kSyncOsPreferences, false); @@ -231,16 +230,6 @@ } } -bool SyncPrefs::IsOsSyncFeatureEnabled() const { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return pref_service_->GetBoolean(prefs::kOsSyncFeatureEnabled); -} - -void SyncPrefs::SetOsSyncFeatureEnabled(bool enabled) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - pref_service_->SetBoolean(prefs::kOsSyncFeatureEnabled, enabled); -} - // static const char* SyncPrefs::GetPrefNameForOsType(UserSelectableOsType type) { switch (type) {
diff --git a/components/sync/base/sync_prefs.h b/components/sync/base/sync_prefs.h index 720410b..f2ef64a 100644 --- a/components/sync/base/sync_prefs.h +++ b/components/sync/base/sync_prefs.h
@@ -90,8 +90,6 @@ void SetSelectedOsTypes(bool sync_all_os_types, UserSelectableOsTypeSet registered_types, UserSelectableOsTypeSet selected_types); - bool IsOsSyncFeatureEnabled() const; - void SetOsSyncFeatureEnabled(bool enabled); // Maps |type| to its corresponding preference name. Returns nullptr if |type| // isn't an OS type.
diff --git a/components/sync/driver/sync_internals_util.cc b/components/sync/driver/sync_internals_util.cc index 88bb41b..0fce6c61 100644 --- a/components/sync/driver/sync_internals_util.cc +++ b/components/sync/driver/sync_internals_util.cc
@@ -483,13 +483,8 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) if (!chromeos::features::IsSyncSettingsCategorizationEnabled()) { os_feature_state->Set("Flag disabled"); - } else if (!chromeos::features::IsSyncConsentOptionalEnabled()) { - DCHECK(service->GetUserSettings()->IsOsSyncFeatureEnabled()); - os_feature_state->Set("Enforced Enabled"); - } else if (service->GetUserSettings()->IsOsSyncFeatureEnabled()) { - os_feature_state->Set("Enabled"); } else { - os_feature_state->Set("Disabled"); + os_feature_state->Set("Enforced Enabled"); } #endif // BUILDFLAG(IS_CHROMEOS_ASH) feature_enabled->Set(service->IsSyncFeatureEnabled());
diff --git a/components/sync/driver/sync_user_settings.h b/components/sync/driver/sync_user_settings.h index c685c14d..5d5a3f4 100644 --- a/components/sync/driver/sync_user_settings.h +++ b/components/sync/driver/sync_user_settings.h
@@ -71,11 +71,6 @@ virtual void SetSelectedOsTypes(bool sync_all_os_types, UserSelectableOsTypeSet types) = 0; virtual UserSelectableOsTypeSet GetRegisteredSelectableOsTypes() const = 0; - - // Whether the OS sync feature is enabled. Implies the user has consented. - // Exists in this interface for easier mocking in tests. - virtual bool IsOsSyncFeatureEnabled() const = 0; - virtual void SetOsSyncFeatureEnabled(bool enabled) = 0; #endif // BUILDFLAG(IS_CHROMEOS_ASH) // Encryption state.
diff --git a/components/sync/driver/sync_user_settings_impl.cc b/components/sync/driver/sync_user_settings_impl.cc index abdf2097..12f8f39e 100644 --- a/components/sync/driver/sync_user_settings_impl.cc +++ b/components/sync/driver/sync_user_settings_impl.cc
@@ -145,18 +145,6 @@ } return registered_types; } - -bool SyncUserSettingsImpl::IsOsSyncFeatureEnabled() const { - DCHECK(chromeos::features::IsSyncSettingsCategorizationEnabled()); - return prefs_->IsOsSyncFeatureEnabled(); -} - -void SyncUserSettingsImpl::SetOsSyncFeatureEnabled(bool enabled) { - DCHECK(chromeos::features::IsSyncSettingsCategorizationEnabled()); - // OsSyncFeature can't be disabled unless SyncConsentOptional is on. - DCHECK(enabled || chromeos::features::IsSyncConsentOptionalEnabled()); - prefs_->SetOsSyncFeatureEnabled(enabled); -} #endif // BUILDFLAG(IS_CHROMEOS_ASH) bool SyncUserSettingsImpl::IsCustomPassphraseAllowed() const {
diff --git a/components/sync/driver/sync_user_settings_impl.h b/components/sync/driver/sync_user_settings_impl.h index fe3c5a1..16ce051 100644 --- a/components/sync/driver/sync_user_settings_impl.h +++ b/components/sync/driver/sync_user_settings_impl.h
@@ -49,9 +49,6 @@ void SetSelectedOsTypes(bool sync_all_os_types, UserSelectableOsTypeSet types) override; UserSelectableOsTypeSet GetRegisteredSelectableOsTypes() const override; - - bool IsOsSyncFeatureEnabled() const override; - void SetOsSyncFeatureEnabled(bool enabled) override; #endif bool IsCustomPassphraseAllowed() const override;
diff --git a/components/sync/driver/sync_user_settings_mock.h b/components/sync/driver/sync_user_settings_mock.h index 3e9880c..b92bd40 100644 --- a/components/sync/driver/sync_user_settings_mock.h +++ b/components/sync/driver/sync_user_settings_mock.h
@@ -49,8 +49,6 @@ GetRegisteredSelectableOsTypes, (), (const override)); - MOCK_METHOD(bool, IsOsSyncFeatureEnabled, (), (const override)); - MOCK_METHOD(void, SetOsSyncFeatureEnabled, (bool), (override)); #endif MOCK_METHOD(bool, IsCustomPassphraseAllowed, (), (const override)); MOCK_METHOD(bool, IsEncryptEverythingEnabled, (), (const override));
diff --git a/components/sync/driver/test_sync_user_settings.cc b/components/sync/driver/test_sync_user_settings.cc index 7794b94..2bf25df 100644 --- a/components/sync/driver/test_sync_user_settings.cc +++ b/components/sync/driver/test_sync_user_settings.cc
@@ -115,14 +115,6 @@ const { return UserSelectableOsTypeSet::All(); } - -bool TestSyncUserSettings::IsOsSyncFeatureEnabled() const { - return os_sync_feature_enabled_; -} - -void TestSyncUserSettings::SetOsSyncFeatureEnabled(bool enabled) { - os_sync_feature_enabled_ = enabled; -} #endif bool TestSyncUserSettings::IsCustomPassphraseAllowed() const {
diff --git a/components/sync/driver/test_sync_user_settings.h b/components/sync/driver/test_sync_user_settings.h index c8be418..acb8e3b4 100644 --- a/components/sync/driver/test_sync_user_settings.h +++ b/components/sync/driver/test_sync_user_settings.h
@@ -40,9 +40,6 @@ void SetSelectedOsTypes(bool sync_all_os_types, UserSelectableOsTypeSet types) override; UserSelectableOsTypeSet GetRegisteredSelectableOsTypes() const override; - - bool IsOsSyncFeatureEnabled() const override; - void SetOsSyncFeatureEnabled(bool enabled) override; #endif bool IsCustomPassphraseAllowed() const override; @@ -79,7 +76,6 @@ bool first_setup_complete_ = true; bool sync_everything_enabled_ = true; #if BUILDFLAG(IS_CHROMEOS_ASH) - bool os_sync_feature_enabled_ = true; bool sync_all_os_types_enabled_ = true; #endif
diff --git a/components/sync_bookmarks/bookmark_remote_updates_handler.cc b/components/sync_bookmarks/bookmark_remote_updates_handler.cc index 7d43da7..d200f35 100644 --- a/components/sync_bookmarks/bookmark_remote_updates_handler.cc +++ b/components/sync_bookmarks/bookmark_remote_updates_handler.cc
@@ -16,7 +16,6 @@ #include "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" -#include "base/strings/string_piece.h" #include "base/trace_event/trace_event.h" #include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/browser/bookmark_node.h" @@ -72,23 +71,26 @@ // emit updates in top-down order. |ordered_updates| must not be null because // traversed updates are appended to |*ordered_updates|. void TraverseAndAppendChildren( - const base::StringPiece& node_id, - const std::unordered_map<base::StringPiece, - const syncer::UpdateResponseData*, - base::StringPieceHash>& id_to_updates, - const std::unordered_map<base::StringPiece, - std::vector<base::StringPiece>, - base::StringPieceHash>& node_to_children, + const base::GUID& node_guid, + const std::unordered_multimap<base::GUID, + const syncer::UpdateResponseData*, + base::GUIDHash>& guid_to_updates, + const std::unordered_map<base::GUID, + std::vector<base::GUID>, + base::GUIDHash>& node_to_children, std::vector<const syncer::UpdateResponseData*>* ordered_updates) { // If no children to traverse, we are done. - if (node_to_children.count(node_id) == 0) { + if (node_to_children.count(node_guid) == 0) { return; } // Recurse over all children. - for (const base::StringPiece& child : node_to_children.at(node_id)) { - DCHECK_NE(id_to_updates.count(child), 0U); - ordered_updates->push_back(id_to_updates.at(child)); - TraverseAndAppendChildren(child, id_to_updates, node_to_children, + for (const base::GUID& child : node_to_children.at(node_guid)) { + auto range = guid_to_updates.equal_range(child); + DCHECK(range.first != range.second); + for (auto it = range.first; it != range.second; ++it) { + ordered_updates->push_back(it->second); + } + TraverseAndAppendChildren(child, guid_to_updates, node_to_children, ordered_updates); } } @@ -163,6 +165,16 @@ return true; } +// Determines the parent's GUID included in |update_entity|. |update_entity| +// must be a valid update as defined in IsValidUpdate(). +base::GUID GetParentGUIDInUpdate(const syncer::EntityData& update_entity) { + DCHECK(IsValidUpdate(update_entity)); + base::GUID parent_guid = base::GUID::ParseLowercase( + update_entity.specifics.bookmark().parent_guid()); + DCHECK(parent_guid.is_valid()); + return parent_guid; +} + void ApplyRemoteUpdate( const syncer::UpdateResponseData& update, const SyncedBookmarkTracker::Entity* tracked_entity, @@ -407,15 +419,15 @@ // 3. Start at each root in |roots|, emit the update and recurse over its // children. - std::unordered_map<base::StringPiece, const syncer::UpdateResponseData*, - base::StringPieceHash> - id_to_updates; - std::set<base::StringPiece> roots; - std::unordered_map<base::StringPiece, std::vector<base::StringPiece>, - base::StringPieceHash> - parent_to_children; + // Normally there shouldn't be multiple updates for the same GUID, but let's + // avoiding dedupping here just in case (e.g. the could in theory be a + // combination of client-tagged and non-client-tagged updated that + // ModelTypeWorker failed to deduplicate. + std::unordered_multimap<base::GUID, const syncer::UpdateResponseData*, + base::GUIDHash> + guid_to_updates; - // Add only valid, non-deletions to |id_to_updates|. + // Add only valid, non-deletions to |guid_to_updates|. int invalid_updates_count = 0; int root_node_updates_count = 0; for (const syncer::UpdateResponseData& update : *updates) { @@ -432,35 +444,41 @@ ++invalid_updates_count; continue; } - id_to_updates[update_entity.id] = &update; + base::GUID guid = + base::GUID::ParseLowercase(update_entity.specifics.bookmark().guid()); + DCHECK(guid.is_valid()); + guid_to_updates.emplace(std::move(guid), &update); } - // Iterate over |id_to_updates| and construct |roots| and + + // Iterate over |guid_to_updates| and construct |roots| and // |parent_to_children|. - for (const std::pair<const base::StringPiece, - const syncer::UpdateResponseData*>& pair : - id_to_updates) { + std::set<base::GUID> roots; + std::unordered_map<base::GUID, std::vector<base::GUID>, base::GUIDHash> + parent_to_children; + for (const auto& pair : guid_to_updates) { const syncer::EntityData& update_entity = pair.second->entity; - parent_to_children[update_entity.parent_id].push_back(update_entity.id); + base::GUID parent_guid = GetParentGUIDInUpdate(update_entity); + base::GUID child_guid = + base::GUID::ParseLowercase(update_entity.specifics.bookmark().guid()); + DCHECK(child_guid.is_valid()); + + parent_to_children[parent_guid].emplace_back(std::move(child_guid)); // If this entity's parent has no pending update, add it to |roots|. - if (id_to_updates.count(update_entity.parent_id) == 0) { - roots.insert(update_entity.parent_id); + if (guid_to_updates.count(parent_guid) == 0) { + roots.insert(std::move(parent_guid)); } } // |roots| contains only root of all trees in the forest all of which are // ready to be processed because none has a pending update. std::vector<const syncer::UpdateResponseData*> ordered_updates; - for (const base::StringPiece& root : roots) { - TraverseAndAppendChildren(root, id_to_updates, parent_to_children, + for (const base::GUID& root : roots) { + TraverseAndAppendChildren(root, guid_to_updates, parent_to_children, &ordered_updates); } // Add deletions. for (const syncer::UpdateResponseData& update : *updates) { const syncer::EntityData& update_entity = update.entity; - // Ignore updates to root nodes. - if (IsPermanentNodeUpdate(update_entity)) { - continue; - } - if (update_entity.is_deleted()) { + if (!IsPermanentNodeUpdate(update_entity) && update_entity.is_deleted()) { ordered_updates.push_back(&update); } } @@ -543,21 +561,12 @@ const bookmarks::BookmarkNode* parent_node = GetParentNode(update_entity); if (!parent_node) { // If we cannot find the parent, we can do nothing. - DLOG(ERROR) - << "Could not find parent of node being added." - << " Node title: " - << update_entity.specifics.bookmark().legacy_canonicalized_title() - << ", parent id = " << update_entity.parent_id; LogProblematicBookmark(RemoteBookmarkUpdateError::kMissingParentNode); bookmark_tracker_->RecordIgnoredServerUpdateDueToMissingParent( update.response_version); return nullptr; } if (!parent_node->is_folder()) { - DLOG(ERROR) - << "Parent node is not a folder. Node title: " - << update_entity.specifics.bookmark().legacy_canonicalized_title() - << ", parent id: " << update_entity.parent_id; LogProblematicBookmark(RemoteBookmarkUpdateError::kParentNotFolder); return nullptr; } @@ -598,23 +607,18 @@ DCHECK(old_parent->is_folder()); const SyncedBookmarkTracker::Entity* new_parent_entity = - bookmark_tracker_->GetEntityForSyncId(update_entity.parent_id); + bookmark_tracker_->GetEntityForGUID(GetParentGUIDInUpdate(update_entity)); if (!new_parent_entity) { - DLOG(ERROR) << "Could not update node. Parent node doesn't exist: " - << update_entity.parent_id; LogProblematicBookmark(RemoteBookmarkUpdateError::kMissingParentEntity); return; } const bookmarks::BookmarkNode* new_parent = new_parent_entity->bookmark_node(); if (!new_parent) { - DLOG(ERROR) - << "Could not update node. Parent node has been deleted already."; LogProblematicBookmark(RemoteBookmarkUpdateError::kMissingParentNode); return; } if (!new_parent->is_folder()) { - DLOG(ERROR) << "Could not update node. Parent not is not a folder."; LogProblematicBookmark(RemoteBookmarkUpdateError::kParentNotFolder); return; } @@ -711,15 +715,14 @@ DCHECK(old_parent->is_folder()); const SyncedBookmarkTracker::Entity* new_parent_entity = - bookmark_tracker_->GetEntityForSyncId(update_entity.parent_id); + bookmark_tracker_->GetEntityForGUID(GetParentGUIDInUpdate(update_entity)); + // The |new_parent_entity| could be null in some racy conditions. For // example, when a client A moves a node and deletes the old parent and // commits, and then updates the node again, and at the same time client B // updates before receiving the move updates. The client B update will arrive // at client A after the parent entity has been deleted already. if (!new_parent_entity) { - DLOG(ERROR) << "Could not update node. Parent node doesn't exist: " - << update_entity.parent_id; LogProblematicBookmark( RemoteBookmarkUpdateError::kMissingParentEntityInConflict); return tracked_entity; @@ -731,8 +734,6 @@ // entails child deletion, and if this child has been updated on another // client, this would cause conflict. if (!new_parent) { - DLOG(ERROR) - << "Could not update node. Parent node has been deleted already."; LogProblematicBookmark( RemoteBookmarkUpdateError::kMissingParentNodeInConflict); return tracked_entity; @@ -780,8 +781,10 @@ const bookmarks::BookmarkNode* BookmarkRemoteUpdatesHandler::GetParentNode( const syncer::EntityData& update_entity) const { + DCHECK(IsValidBookmarkSpecifics(update_entity.specifics.bookmark())); + const SyncedBookmarkTracker::Entity* parent_entity = - bookmark_tracker_->GetEntityForSyncId(update_entity.parent_id); + bookmark_tracker_->GetEntityForGUID(GetParentGUIDInUpdate(update_entity)); if (!parent_entity) { return nullptr; }
diff --git a/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc b/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc index 0fe4b005..1bdc0f30 100644 --- a/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc +++ b/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc
@@ -174,10 +174,7 @@ CreateTombstoneResponseData(guid, version); response_data.entity.originator_client_item_id = guid.AsLowercaseString(); - response_data.entity.parent_id = GetFakeServerIdFromGUID(parent_guid); - // Note that proto field |parent_guid| is currently only used to consider - // specifics valid. sync_pb::BookmarkSpecifics* bookmark_specifics = response_data.entity.specifics.mutable_bookmark(); bookmark_specifics->set_guid(guid.AsLowercaseString()); @@ -931,7 +928,6 @@ syncer::UpdateResponseDataList updates; syncer::EntityData data; data.id = GetFakeServerIdFromGUID(kParentGuid); - data.parent_id = kBookmarkBarId; sync_pb::BookmarkSpecifics* bookmark_specifics = data.specifics.mutable_bookmark(); bookmark_specifics->set_guid(kParentGuid.AsLowercaseString()); @@ -983,7 +979,6 @@ syncer::UpdateResponseDataList updates; syncer::EntityData data; data.id = "server_id"; - data.parent_id = kBookmarkBarId; sync_pb::BookmarkSpecifics* bookmark_specifics = data.specifics.mutable_bookmark(); bookmark_specifics->set_guid( @@ -1028,7 +1023,6 @@ syncer::UpdateResponseDataList updates; syncer::EntityData data; data.id = "server_id"; - data.parent_id = kBookmarkBarId; sync_pb::BookmarkSpecifics* bookmark_specifics = data.specifics.mutable_bookmark(); bookmark_specifics->set_guid(
diff --git a/components/sync_sessions/local_session_event_handler_impl.cc b/components/sync_sessions/local_session_event_handler_impl.cc index bd6668d..44f17cab 100644 --- a/components/sync_sessions/local_session_event_handler_impl.cc +++ b/components/sync_sessions/local_session_event_handler_impl.cc
@@ -371,7 +371,7 @@ const int min_index = std::max(0, current_index - kMaxSyncNavigationCount); const int max_index = std::min(current_index + kMaxSyncNavigationCount, tab_delegate.GetEntryCount()); - bool is_supervised = tab_delegate.ProfileIsSupervised(); + bool has_child_account = tab_delegate.ProfileHasChildAccount(); for (int i = min_index; i < max_index; ++i) { if (!tab_delegate.GetVirtualURLAtIndex(i).is_valid()) { @@ -391,7 +391,7 @@ if (!page_language.empty()) navigation->set_page_language(page_language); - if (is_supervised) { + if (has_child_account) { navigation->set_blocked_state( sync_pb::TabNavigation_BlockedState_STATE_ALLOWED); } @@ -403,7 +403,7 @@ specifics.set_current_navigation_index(specifics.navigation_size() - 1); } - if (is_supervised) { + if (has_child_account) { const std::vector<std::unique_ptr<const SerializedNavigationEntry>>* blocked_navigations = tab_delegate.GetBlockedNavigations(); DCHECK(blocked_navigations);
diff --git a/components/sync_sessions/local_session_event_handler_impl_unittest.cc b/components/sync_sessions/local_session_event_handler_impl_unittest.cc index 2957199..3b54002 100644 --- a/components/sync_sessions/local_session_event_handler_impl_unittest.cc +++ b/components/sync_sessions/local_session_event_handler_impl_unittest.cc
@@ -275,8 +275,8 @@ ASSERT_EQ(3, session_tab.navigation_size()); } -// Tests that for supervised users blocked navigations are recorded and marked -// as such, while regular navigations are marked as allowed. +// Tests that for child account users blocked navigations are recorded and +// marked as such, while regular navigations are marked as allowed. TEST_F(LocalSessionEventHandlerImplTest, BlockedNavigations) { AddWindow(kWindowId1); TestSyncedTabDelegate* tab = AddTabWithTime(kWindowId1, kFoo1, kTime1); @@ -296,7 +296,7 @@ blocked_navigations.push_back(std::move(entry2)); blocked_navigations.push_back(std::move(entry3)); - tab->set_is_supervised(true); + tab->set_has_child_account(true); tab->set_blocked_navigations(blocked_navigations); InitHandler();
diff --git a/components/sync_sessions/synced_tab_delegate.h b/components/sync_sessions/synced_tab_delegate.h index bf48b062..142d4e8 100644 --- a/components/sync_sessions/synced_tab_delegate.h +++ b/components/sync_sessions/synced_tab_delegate.h
@@ -50,8 +50,8 @@ int i, sessions::SerializedNavigationEntry* serialized_entry) const = 0; - // Supervised user related methods. - virtual bool ProfileIsSupervised() const = 0; + // Methods to restrict navigation for child account users. + virtual bool ProfileHasChildAccount() const = 0; virtual const std::vector< std::unique_ptr<const sessions::SerializedNavigationEntry>>* GetBlockedNavigations() const = 0;
diff --git a/components/sync_sessions/test_synced_window_delegates_getter.cc b/components/sync_sessions/test_synced_window_delegates_getter.cc index 67146f0c..7999045 100644 --- a/components/sync_sessions/test_synced_window_delegates_getter.cc +++ b/components/sync_sessions/test_synced_window_delegates_getter.cc
@@ -128,12 +128,12 @@ return std::string(); } -bool TestSyncedTabDelegate::ProfileIsSupervised() const { - return is_supervised_; +bool TestSyncedTabDelegate::ProfileHasChildAccount() const { + return has_child_account_; } -void TestSyncedTabDelegate::set_is_supervised(bool is_supervised) { - is_supervised_ = is_supervised; +void TestSyncedTabDelegate::set_has_child_account(bool has_child_account) { + has_child_account_ = has_child_account; } const std::vector<std::unique_ptr<const sessions::SerializedNavigationEntry>>* @@ -248,7 +248,7 @@ NOTREACHED(); } -bool PlaceholderTabDelegate::ProfileIsSupervised() const { +bool PlaceholderTabDelegate::ProfileHasChildAccount() const { NOTREACHED(); return false; }
diff --git a/components/sync_sessions/test_synced_window_delegates_getter.h b/components/sync_sessions/test_synced_window_delegates_getter.h index 86c6b83..62dddb3 100644 --- a/components/sync_sessions/test_synced_window_delegates_getter.h +++ b/components/sync_sessions/test_synced_window_delegates_getter.h
@@ -61,8 +61,8 @@ SessionID GetSessionId() const override; bool IsBeingDestroyed() const override; std::string GetExtensionAppId() const override; - bool ProfileIsSupervised() const override; - void set_is_supervised(bool is_supervised); + bool ProfileHasChildAccount() const override; + void set_has_child_account(bool has_child_account); const std::vector<std::unique_ptr<const sessions::SerializedNavigationEntry>>* GetBlockedNavigations() const override; bool IsPlaceholderTab() const override; @@ -77,7 +77,7 @@ const base::RepeatingCallback<void(SyncedTabDelegate*)> notify_cb_; int current_entry_index_ = -1; - bool is_supervised_ = false; + bool has_child_account_ = false; std::vector<std::unique_ptr<const sessions::SerializedNavigationEntry>> blocked_navigations_; std::vector<std::unique_ptr<const sessions::SerializedNavigationEntry>> @@ -115,7 +115,7 @@ void GetSerializedNavigationAtIndex( int i, sessions::SerializedNavigationEntry* serialized_entry) const override; - bool ProfileIsSupervised() const override; + bool ProfileHasChildAccount() const override; const std::vector<std::unique_ptr<const sessions::SerializedNavigationEntry>>* GetBlockedNavigations() const override; bool ShouldSync(SyncSessionsClient* sessions_client) override;
diff --git a/components/viz/service/performance_hint/hint_session.cc b/components/viz/service/performance_hint/hint_session.cc index 3e3571f7..9b06ebb 100644 --- a/components/viz/service/performance_hint/hint_session.cc +++ b/components/viz/service/performance_hint/hint_session.cc
@@ -17,7 +17,6 @@ #include "base/android/build_info.h" #include "base/logging.h" #include "base/native_library.h" -#include "base/no_destructor.h" #include "base/trace_event/trace_event.h" static_assert(sizeof(base::PlatformThreadId) == sizeof(int32_t),
diff --git a/components/web_cache/browser/web_cache_manager.cc b/components/web_cache/browser/web_cache_manager.cc index 3d3b86e7..3b7fcf34 100644 --- a/components/web_cache/browser/web_cache_manager.cc +++ b/components/web_cache/browser/web_cache_manager.cc
@@ -12,6 +12,7 @@ #include "base/compiler_specific.h" #include "base/location.h" #include "base/metrics/histogram_macros.h" +#include "base/no_destructor.h" #include "base/system/sys_info.h" #include "base/task/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h"
diff --git a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm index bea5957a..6675ae22 100644 --- a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm +++ b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
@@ -9,7 +9,6 @@ #include "base/bind.h" #include "base/ignore_result.h" -#include "base/no_destructor.h" #include "content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.h" #include "content/app_shim_remote_cocoa/render_widget_host_ns_view_host_helper.h" #include "content/app_shim_remote_cocoa/web_contents_ns_view_bridge.h"
diff --git a/content/browser/accessibility/accessibility_event_recorder_auralinux.cc b/content/browser/accessibility/accessibility_event_recorder_auralinux.cc index be5517c..8df13c6 100644 --- a/content/browser/accessibility/accessibility_event_recorder_auralinux.cc +++ b/content/browser/accessibility/accessibility_event_recorder_auralinux.cc
@@ -9,6 +9,7 @@ #include <atspi/atspi.h> #include "base/cxx17_backports.h" +#include "base/no_destructor.h" #include "base/process/process_handle.h" #include "base/strings/stringprintf.h" #include "content/browser/accessibility/browser_accessibility_auralinux.h"
diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc index 6dd39da8..b3a41232 100644 --- a/content/browser/accessibility/browser_accessibility.cc +++ b/content/browser/accessibility/browser_accessibility.cc
@@ -10,7 +10,6 @@ #include <iterator> #include "base/logging.h" -#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h"
diff --git a/content/browser/accessibility/browser_accessibility_state_impl_android.cc b/content/browser/accessibility/browser_accessibility_state_impl_android.cc index 08ac12b..9a6aa43 100644 --- a/content/browser/accessibility/browser_accessibility_state_impl_android.cc +++ b/content/browser/accessibility/browser_accessibility_state_impl_android.cc
@@ -8,6 +8,7 @@ #include "base/android/jni_string.h" #include "base/containers/contains.h" #include "base/metrics/histogram_macros.h" +#include "base/no_destructor.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/android/content_jni_headers/BrowserAccessibilityState_jni.h" #include "content/public/browser/browser_thread.h"
diff --git a/content/browser/accessibility/browser_accessibility_state_impl_mac.mm b/content/browser/accessibility/browser_accessibility_state_impl_mac.mm index 0cd255f..e10921e 100644 --- a/content/browser/accessibility/browser_accessibility_state_impl_mac.mm +++ b/content/browser/accessibility/browser_accessibility_state_impl_mac.mm
@@ -7,6 +7,7 @@ #import <Cocoa/Cocoa.h> #include "base/metrics/histogram_macros.h" +#include "base/no_destructor.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/browser_thread.h" #include "ui/gfx/animation/animation.h"
diff --git a/content/browser/accessibility/browser_accessibility_state_impl_win.cc b/content/browser/accessibility/browser_accessibility_state_impl_win.cc index 242c728..a21ca14 100644 --- a/content/browser/accessibility/browser_accessibility_state_impl_win.cc +++ b/content/browser/accessibility/browser_accessibility_state_impl_win.cc
@@ -14,6 +14,7 @@ #include "base/cxx17_backports.h" #include "base/files/file_path.h" #include "base/metrics/histogram_macros.h" +#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "content/browser/web_contents/web_contents_impl.h" #include "ui/accessibility/accessibility_features.h"
diff --git a/content/browser/android/battery_metrics.cc b/content/browser/android/battery_metrics.cc index 6bef4fa..604c3e5 100644 --- a/content/browser/android/battery_metrics.cc +++ b/content/browser/android/battery_metrics.cc
@@ -10,6 +10,7 @@ #include "base/logging.h" #include "base/metrics/histogram.h" #include "base/metrics/histogram_macros.h" +#include "base/no_destructor.h" #include "base/power_monitor/power_monitor.h" #include "base/trace_event/trace_event.h" #include "content/browser/web_contents/web_contents_impl.h"
diff --git a/content/browser/browser_child_process_host_impl.cc b/content/browser/browser_child_process_host_impl.cc index dbe0858..fc23b94 100644 --- a/content/browser/browser_child_process_host_impl.cc +++ b/content/browser/browser_child_process_host_impl.cc
@@ -20,7 +20,6 @@ #include "base/metrics/histogram_macros.h" #include "base/metrics/persistent_histogram_allocator.h" #include "base/metrics/persistent_memory_allocator.h" -#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread_task_runner_handle.h"
diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc index 6decb2a..f044043 100644 --- a/content/browser/browser_context.cc +++ b/content/browser/browser_context.cc
@@ -23,7 +23,6 @@ #include "base/memory/ptr_util.h" #include "base/memory/weak_ptr.h" #include "base/metrics/field_trial_params.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
diff --git a/content/browser/browser_interface_binders.cc b/content/browser/browser_interface_binders.cc index 7b4c1b2..9f5eef8a 100644 --- a/content/browser/browser_interface_binders.cc +++ b/content/browser/browser_interface_binders.cc
@@ -8,6 +8,7 @@ #include "base/callback_helpers.h" #include "base/command_line.h" #include "base/feature_list.h" +#include "base/no_destructor.h" #include "base/task/thread_pool.h" #include "build/branding_buildflags.h" #include "build/build_config.h"
diff --git a/content/browser/child_process_task_port_provider_mac.cc b/content/browser/child_process_task_port_provider_mac.cc index f2b4dc959..9d5fcfd 100644 --- a/content/browser/child_process_task_port_provider_mac.cc +++ b/content/browser/child_process_task_port_provider_mac.cc
@@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/mac/foundation_util.h" #include "base/mac/mach_logging.h" +#include "base/no_destructor.h" #include "base/strings/stringprintf.h" #include "content/common/child_process.mojom.h" #include "mojo/public/cpp/system/platform_handle.h"
diff --git a/content/browser/compute_pressure/cpu_probe_linux.cc b/content/browser/compute_pressure/cpu_probe_linux.cc index 3e628041..5672b05 100644 --- a/content/browser/compute_pressure/cpu_probe_linux.cc +++ b/content/browser/compute_pressure/cpu_probe_linux.cc
@@ -15,7 +15,6 @@ #include "base/files/file_util.h" #include "base/files/scoped_file.h" #include "base/format_macros.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/numerics/safe_math.h" #include "base/sequence_checker.h"
diff --git a/content/browser/devtools/auction_worklet_devtools_agent_host.cc b/content/browser/devtools/auction_worklet_devtools_agent_host.cc index 8c460aed..4513d63 100644 --- a/content/browser/devtools/auction_worklet_devtools_agent_host.cc +++ b/content/browser/devtools/auction_worklet_devtools_agent_host.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/guid.h" #include "base/memory/scoped_refptr.h" +#include "base/no_destructor.h" #include "base/notreached.h" #include "content/browser/devtools/render_frame_devtools_agent_host.h" #include "content/browser/renderer_host/render_frame_host_impl.h"
diff --git a/content/browser/devtools/service_worker_devtools_manager.cc b/content/browser/devtools/service_worker_devtools_manager.cc index 82b34b4a..c88de64 100644 --- a/content/browser/devtools/service_worker_devtools_manager.cc +++ b/content/browser/devtools/service_worker_devtools_manager.cc
@@ -4,6 +4,7 @@ #include "content/browser/devtools/service_worker_devtools_manager.h" +#include "base/no_destructor.h" #include "content/browser/devtools/devtools_instrumentation.h" #include "content/browser/devtools/protocol/network_handler.h" #include "content/browser/devtools/protocol/page_handler.h"
diff --git a/content/browser/direct_sockets/direct_sockets_service_impl.cc b/content/browser/direct_sockets/direct_sockets_service_impl.cc index c241bae..ad1f5034 100644 --- a/content/browser/direct_sockets/direct_sockets_service_impl.cc +++ b/content/browser/direct_sockets/direct_sockets_service_impl.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/feature_list.h" #include "base/metrics/histogram_functions.h" +#include "base/no_destructor.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "content/browser/direct_sockets/direct_udp_socket_impl.h"
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index ec1ba57..8054367 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc
@@ -23,7 +23,6 @@ #include "base/message_loop/message_pump_type.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/thread.h"
diff --git a/content/browser/idle/idle_polling_service.cc b/content/browser/idle/idle_polling_service.cc index d508092..ab8b52d 100644 --- a/content/browser/idle/idle_polling_service.cc +++ b/content/browser/idle/idle_polling_service.cc
@@ -4,6 +4,7 @@ #include "content/browser/idle/idle_polling_service.h" +#include "base/no_destructor.h" #include "content/public/browser/idle_time_provider.h" #include "ui/base/idle/idle.h"
diff --git a/content/browser/indexed_db/indexed_db_leveldb_env.cc b/content/browser/indexed_db/indexed_db_leveldb_env.cc index 53e1b40..48e45a0 100644 --- a/content/browser/indexed_db/indexed_db_leveldb_env.cc +++ b/content/browser/indexed_db/indexed_db_leveldb_env.cc
@@ -4,6 +4,7 @@ #include "content/browser/indexed_db/indexed_db_leveldb_env.h" +#include "base/no_destructor.h" #include "components/services/storage/filesystem_proxy_factory.h" namespace content {
diff --git a/content/browser/renderer_host/commit_deferring_condition_runner.cc b/content/browser/renderer_host/commit_deferring_condition_runner.cc index df962dc2..6a01779c 100644 --- a/content/browser/renderer_host/commit_deferring_condition_runner.cc +++ b/content/browser/renderer_host/commit_deferring_condition_runner.cc
@@ -4,6 +4,7 @@ #include "content/browser/renderer_host/commit_deferring_condition_runner.h" +#include "base/no_destructor.h" #include "content/browser/renderer_host/back_forward_cache_commit_deferring_condition.h" #include "content/browser/renderer_host/commit_deferring_condition.h" #include "content/browser/renderer_host/navigation_request.h"
diff --git a/content/browser/renderer_host/compositor_dependencies_android.cc b/content/browser/renderer_host/compositor_dependencies_android.cc index c356bb3..a8db8bcd 100644 --- a/content/browser/renderer_host/compositor_dependencies_android.cc +++ b/content/browser/renderer_host/compositor_dependencies_android.cc
@@ -7,6 +7,7 @@ #include <utility> #include "base/bind.h" +#include "base/no_destructor.h" #include "base/system/sys_info.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h"
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index 5db6c33..ea2ee416 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc
@@ -21,6 +21,7 @@ #include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/no_destructor.h" #include "base/rand_util.h" #include "base/stl_util.h" #include "base/strings/strcat.h"
diff --git a/content/browser/renderer_host/origin_policy_throttle.cc b/content/browser/renderer_host/origin_policy_throttle.cc index f20b26d..50d0429 100644 --- a/content/browser/renderer_host/origin_policy_throttle.cc +++ b/content/browser/renderer_host/origin_policy_throttle.cc
@@ -12,6 +12,7 @@ #include "base/command_line.h" #include "base/feature_list.h" #include "base/memory/ptr_util.h" +#include "base/no_destructor.h" #include "content/browser/renderer_host/navigation_request.h" #include "content/browser/storage_partition_impl.h" #include "content/public/browser/browser_thread.h"
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index 38b4d4da..cf91da5 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -10499,7 +10499,7 @@ // that. if (navigation_request->pending_ad_components_map()) { navigation_request->pending_ad_components_map()->ExportToMapping( - GetMainFrame()->GetPage().fenced_frame_urls_map()); + GetPage().fenced_frame_urls_map()); } // Continue observing the events for the committed navigation.
diff --git a/content/browser/scheduler/browser_task_executor.cc b/content/browser/scheduler/browser_task_executor.cc index fdb236e..28ee473c 100644 --- a/content/browser/scheduler/browser_task_executor.cc +++ b/content/browser/scheduler/browser_task_executor.cc
@@ -8,7 +8,6 @@ #include "base/bind.h" #include "base/message_loop/message_pump_type.h" -#include "base/no_destructor.h" #include "base/run_loop.h" #include "base/task/deferred_sequenced_task_runner.h" #include "base/task/post_task.h"
diff --git a/content/browser/service_worker/embedded_worker_instance.cc b/content/browser/service_worker/embedded_worker_instance.cc index 1500905..4e649f2 100644 --- a/content/browser/service_worker/embedded_worker_instance.cc +++ b/content/browser/service_worker/embedded_worker_instance.cc
@@ -12,7 +12,6 @@ #include "base/containers/contains.h" #include "base/feature_list.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/trace_event/trace_event.h" #include "content/browser/bad_message.h" #include "content/browser/data_url_loader_factory.h"
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index 2a729ea2..f5030c97 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc
@@ -23,6 +23,7 @@ #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "base/metrics/histogram_functions.h" +#include "base/no_destructor.h" #include "base/run_loop.h" #include "base/task/sequenced_task_runner.h" #include "base/task/single_thread_task_runner.h"
diff --git a/content/browser/theme_helper.cc b/content/browser/theme_helper.cc index f7da17c..e2ccd312 100644 --- a/content/browser/theme_helper.cc +++ b/content/browser/theme_helper.cc
@@ -4,6 +4,7 @@ #include "content/browser/theme_helper.h" +#include "base/no_destructor.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/common/renderer.mojom.h"
diff --git a/content/browser/tracing/background_reached_code_tracing_observer_android.h b/content/browser/tracing/background_reached_code_tracing_observer_android.h index 15bb6d4..e678100 100644 --- a/content/browser/tracing/background_reached_code_tracing_observer_android.h +++ b/content/browser/tracing/background_reached_code_tracing_observer_android.h
@@ -7,6 +7,7 @@ #include <memory> +#include "base/no_destructor.h" #include "content/browser/tracing/background_tracing_manager_impl.h" #include "content/common/content_export.h"
diff --git a/content/browser/tracing/tracing_service_controller.cc b/content/browser/tracing/tracing_service_controller.cc index 588341ca..1dfe048c 100644 --- a/content/browser/tracing/tracing_service_controller.cc +++ b/content/browser/tracing/tracing_service_controller.cc
@@ -6,6 +6,7 @@ #include <utility> +#include "base/no_destructor.h" #include "base/task/thread_pool.h" #include "base/time/time.h" #include "content/public/browser/browser_task_traits.h"
diff --git a/content/browser/webauth/authenticator_environment_impl.cc b/content/browser/webauth/authenticator_environment_impl.cc index 415839e..ef2a41cc 100644 --- a/content/browser/webauth/authenticator_environment_impl.cc +++ b/content/browser/webauth/authenticator_environment_impl.cc
@@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/containers/contains.h" +#include "base/no_destructor.h" #include "content/browser/webauth/virtual_authenticator.h" #include "content/browser/webauth/virtual_discovery.h" #include "content/browser/webauth/virtual_fido_discovery_factory.h"
diff --git a/content/browser/worker_host/shared_worker_host.cc b/content/browser/worker_host/shared_worker_host.cc index 7c99063..b5f1801 100644 --- a/content/browser/worker_host/shared_worker_host.cc +++ b/content/browser/worker_host/shared_worker_host.cc
@@ -10,7 +10,6 @@ #include "base/feature_list.h" #include "base/memory/raw_ptr.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/task/post_task.h" #include "base/unguessable_token.h" #include "content/browser/broadcast_channel/broadcast_channel_provider.h"
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc index 1fb2766b..35850e1 100644 --- a/content/child/child_thread_impl.cc +++ b/content/child/child_thread_impl.cc
@@ -28,7 +28,6 @@ #include "base/message_loop/timer_slack.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/power_monitor/power_monitor.h" #include "base/process/process.h" #include "base/process/process_handle.h"
diff --git a/content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc b/content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc index 5158899..4b9d988c 100644 --- a/content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc +++ b/content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc
@@ -14,7 +14,6 @@ #include "base/debug/crash_logging.h" #include "base/feature_list.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/strings/utf_string_conversions.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h"
diff --git a/content/common/process_visibility_tracker.cc b/content/common/process_visibility_tracker.cc index 5d9d95dd..c4726b7 100644 --- a/content/common/process_visibility_tracker.cc +++ b/content/common/process_visibility_tracker.cc
@@ -4,6 +4,7 @@ #include "content/common/process_visibility_tracker.h" +#include "base/no_destructor.h" #include "components/power_scheduler/power_mode_arbiter.h" namespace content {
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index f205fd77..fbc0d20 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc
@@ -19,6 +19,7 @@ #include "base/files/file_util.h" #include "base/guid.h" #include "base/json/json_reader.h" +#include "base/no_destructor.h" #include "base/process/kill.h" #include "base/run_loop.h" #include "base/strings/pattern.h"
diff --git a/content/public/test/mock_render_process_host.cc b/content/public/test/mock_render_process_host.cc index 347158d9..29d3de6 100644 --- a/content/public/test/mock_render_process_host.cc +++ b/content/public/test/mock_render_process_host.cc
@@ -13,6 +13,7 @@ #include "base/ignore_result.h" #include "base/lazy_instance.h" #include "base/location.h" +#include "base/no_destructor.h" #include "base/process/process_handle.h" #include "base/task/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h"
diff --git a/content/public/test/no_renderer_crashes_assertion.h b/content/public/test/no_renderer_crashes_assertion.h index a9f49de..e4126bc 100644 --- a/content/public/test/no_renderer_crashes_assertion.h +++ b/content/public/test/no_renderer_crashes_assertion.h
@@ -8,6 +8,7 @@ #include <map> #include "base/gtest_prod_util.h" +#include "base/no_destructor.h" #include "base/sequence_checker.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h"
diff --git a/content/renderer/mock_agent_scheduling_group.cc b/content/renderer/mock_agent_scheduling_group.cc index 563607dd..23a9327 100644 --- a/content/renderer/mock_agent_scheduling_group.cc +++ b/content/renderer/mock_agent_scheduling_group.cc
@@ -5,7 +5,6 @@ #include "content/renderer/mock_agent_scheduling_group.h" #include "base/ignore_result.h" -#include "base/no_destructor.h" #include "content/renderer/render_thread_impl.h" #include "third_party/blink/public/mojom/browser_interface_broker.mojom.h"
diff --git a/content/shell/utility/shell_content_utility_client.cc b/content/shell/utility/shell_content_utility_client.cc index 033cf0b..de371c2 100644 --- a/content/shell/utility/shell_content_utility_client.cc +++ b/content/shell/utility/shell_content_utility_client.cc
@@ -16,7 +16,6 @@ #include "base/memory/shared_memory_mapping.h" #include "base/memory/unsafe_shared_memory_region.h" #include "base/memory/writable_shared_memory_region.h" -#include "base/no_destructor.h" #include "base/process/process.h" #include "build/build_config.h" #include "components/services/storage/test_api/test_api.h"
diff --git a/content/test/fuzzer/presentation_service_mojolpm_fuzzer.cc b/content/test/fuzzer/presentation_service_mojolpm_fuzzer.cc index a9aabaf4..263983d2 100644 --- a/content/test/fuzzer/presentation_service_mojolpm_fuzzer.cc +++ b/content/test/fuzzer/presentation_service_mojolpm_fuzzer.cc
@@ -13,6 +13,7 @@ #include "base/callback_helpers.h" #include "base/command_line.h" #include "base/i18n/icu_util.h" +#include "base/no_destructor.h" #include "base/run_loop.h" #include "base/test/test_switches.h" #include "base/test/test_timeouts.h"
diff --git a/content/utility/services.cc b/content/utility/services.cc index f0e76b6..7c78adf 100644 --- a/content/utility/services.cc +++ b/content/utility/services.cc
@@ -8,7 +8,6 @@ #include "base/command_line.h" #include "base/metrics/field_trial_params.h" -#include "base/no_destructor.h" #include "base/threading/thread_task_runner_handle.h" #include "build/branding_buildflags.h" #include "build/build_config.h"
diff --git a/device/fido/mac/keychain.mm b/device/fido/mac/keychain.mm index 5ed91cf6..a9781ad 100644 --- a/device/fido/mac/keychain.mm +++ b/device/fido/mac/keychain.mm
@@ -4,6 +4,8 @@ #include "device/fido/mac/keychain.h" +#include "base/no_destructor.h" + namespace device { namespace fido { namespace mac {
diff --git a/docs/testing/web_tests_in_content_shell.md b/docs/testing/web_tests_in_content_shell.md index d806f41..7b3174e 100644 --- a/docs/testing/web_tests_in_content_shell.md +++ b/docs/testing/web_tests_in_content_shell.md
@@ -84,7 +84,7 @@ out/Release: ```bash -python third_party/blink/tools/run_blink_httpd.py -t <build directory> +vpython3 third_party/blink/tools/run_blink_httpd.py -t <build directory> ``` Then run the test with a localhost URL: @@ -101,7 +101,7 @@ tests require some setup before running in Content Shell: ```bash -python third_party/blink/tools/run_blink_wptserve.py -t <build directory> +vpython3 third_party/blink/tools/run_blink_wptserve.py -t <build directory> ``` Then run the test: @@ -144,7 +144,7 @@ start the server: ```bash -python third_party/blink/tools/run_blink_wptserve.py +vpython3 third_party/blink/tools/run_blink_wptserve.py ``` Then start Content Shell with some additional flags:
diff --git a/extensions/browser/api/storage/session_storage_manager.cc b/extensions/browser/api/storage/session_storage_manager.cc index a4f88f0..def7f10 100644 --- a/extensions/browser/api/storage/session_storage_manager.cc +++ b/extensions/browser/api/storage/session_storage_manager.cc
@@ -4,6 +4,7 @@ #include "extensions/browser/api/storage/session_storage_manager.h" +#include "base/no_destructor.h" #include "base/trace_event/memory_usage_estimator.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
diff --git a/extensions/browser/api/test/test_api_observer_registry.cc b/extensions/browser/api/test/test_api_observer_registry.cc index 63f4c4f..fdb6209 100644 --- a/extensions/browser/api/test/test_api_observer_registry.cc +++ b/extensions/browser/api/test/test_api_observer_registry.cc
@@ -7,6 +7,7 @@ #include <ostream> #include "base/check.h" +#include "base/no_destructor.h" namespace extensions {
diff --git a/extensions/browser/api/web_request/web_request_api.cc b/extensions/browser/api/web_request/web_request_api.cc index 911303d5..e682ee4 100644 --- a/extensions/browser/api/web_request/web_request_api.cc +++ b/extensions/browser/api/web_request/web_request_api.cc
@@ -21,6 +21,7 @@ #include "base/memory/raw_ptr.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" +#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h"
diff --git a/extensions/browser/api/web_request/web_request_api_helpers.cc b/extensions/browser/api/web_request/web_request_api_helpers.cc index 0e71a622..0e8f2f0b 100644 --- a/extensions/browser/api/web_request/web_request_api_helpers.cc +++ b/extensions/browser/api/web_request/web_request_api_helpers.cc
@@ -19,7 +19,6 @@ #include "base/containers/fixed_flat_set.h" #include "base/memory/scoped_refptr.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/ranges/algorithm.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h"
diff --git a/extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc b/extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc index 0dac24cc..891c981 100644 --- a/extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc +++ b/extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
@@ -11,6 +11,7 @@ #include "base/callback_helpers.h" #include "base/feature_list.h" #include "base/metrics/histogram_macros.h" +#include "base/no_destructor.h" #include "base/strings/stringprintf.h" #include "base/task/post_task.h" #include "base/trace_event/trace_event.h"
diff --git a/extensions/browser/api/web_request/web_request_proxying_websocket.cc b/extensions/browser/api/web_request/web_request_proxying_websocket.cc index 7e185f8..a97f8f6 100644 --- a/extensions/browser/api/web_request/web_request_proxying_websocket.cc +++ b/extensions/browser/api/web_request/web_request_proxying_websocket.cc
@@ -5,6 +5,7 @@ #include "extensions/browser/api/web_request/web_request_proxying_websocket.h" #include "base/bind.h" +#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h"
diff --git a/extensions/browser/permissions_manager.cc b/extensions/browser/permissions_manager.cc index 38c66f8..88b8dace 100644 --- a/extensions/browser/permissions_manager.cc +++ b/extensions/browser/permissions_manager.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "base/no_destructor.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "content/public/browser/browser_context.h"
diff --git a/extensions/renderer/api/automation/automation_internal_custom_bindings.cc b/extensions/renderer/api/automation/automation_internal_custom_bindings.cc index be326fad..05aac66 100644 --- a/extensions/renderer/api/automation/automation_internal_custom_bindings.cc +++ b/extensions/renderer/api/automation/automation_internal_custom_bindings.cc
@@ -17,6 +17,7 @@ #include "base/containers/cxx20_erase.h" #include "base/i18n/string_search.h" #include "base/memory/ptr_util.h" +#include "base/no_destructor.h" #include "base/strings/utf_offset_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/thread_task_runner_handle.h"
diff --git a/extensions/renderer/user_script_injector.cc b/extensions/renderer/user_script_injector.cc index 6a8b6d8..dbfff3c 100644 --- a/extensions/renderer/user_script_injector.cc +++ b/extensions/renderer/user_script_injector.cc
@@ -9,6 +9,7 @@ #include "base/check.h" #include "base/lazy_instance.h" +#include "base/no_destructor.h" #include "content/public/common/url_constants.h" #include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_thread.h"
diff --git a/fuchsia/engine/browser/content_directory_loader_factory.cc b/fuchsia/engine/browser/content_directory_loader_factory.cc index 4590a3a..269d356 100644 --- a/fuchsia/engine/browser/content_directory_loader_factory.cc +++ b/fuchsia/engine/browser/content_directory_loader_factory.cc
@@ -17,7 +17,6 @@ #include "base/json/json_reader.h" #include "base/lazy_instance.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/strings/string_piece.h" #include "base/strings/string_split.h"
diff --git a/fuchsia/engine/browser/web_engine_browser_main_parts.cc b/fuchsia/engine/browser/web_engine_browser_main_parts.cc index 4217816..587127c 100644 --- a/fuchsia/engine/browser/web_engine_browser_main_parts.cc +++ b/fuchsia/engine/browser/web_engine_browser_main_parts.cc
@@ -21,6 +21,7 @@ #include "base/fuchsia/process_context.h" #include "base/i18n/rtl.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/strings/stringprintf.h" #include "base/system/sys_info.h" #include "base/threading/thread_restrictions.h"
diff --git a/fuchsia/engine/browser/web_engine_memory_inspector.cc b/fuchsia/engine/browser/web_engine_memory_inspector.cc index 08d7b678..3762ebf 100644 --- a/fuchsia/engine/browser/web_engine_memory_inspector.cc +++ b/fuchsia/engine/browser/web_engine_memory_inspector.cc
@@ -8,6 +8,7 @@ #include <lib/inspect/cpp/inspector.h> #include <sstream> +#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "base/trace_event/memory_dump_request_args.h" #include "fuchsia/base/config_reader.h"
diff --git a/gpu/command_buffer/client/raster_implementation.cc b/gpu/command_buffer/client/raster_implementation.cc index b8a8c2a..a2dd433 100644 --- a/gpu/command_buffer/client/raster_implementation.cc +++ b/gpu/command_buffer/client/raster_implementation.cc
@@ -23,7 +23,6 @@ #include "base/compiler_specific.h" #include "base/memory/raw_ptr.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/numerics/safe_math.h" #include "base/trace_event/memory_allocator_dump.h" #include "base/trace_event/memory_dump_manager.h"
diff --git a/gpu/command_buffer/service/external_vk_image_backing.cc b/gpu/command_buffer/service/external_vk_image_backing.cc index b574f15..bc1bcc50 100644 --- a/gpu/command_buffer/service/external_vk_image_backing.cc +++ b/gpu/command_buffer/service/external_vk_image_backing.cc
@@ -424,19 +424,14 @@ backend_texture_, GrBackendSurfaceMutableState(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_QUEUE_FAMILY_EXTERNAL)); + auto semaphore = external_semaphore_pool()->GetOrCreateSemaphore(); - VkSemaphore vk_semaphore = semaphore.GetVkSemaphore(); - GrBackendSemaphore backend_semaphore; - backend_semaphore.initVulkan(vk_semaphore); - GrFlushInfo flush_info = { - .fNumSemaphores = 1, - .fSignalSemaphores = &backend_semaphore, - }; - gpu::AddVulkanCleanupTaskForSkiaFlush( - context_state()->vk_context_provider(), &flush_info); - auto flush_result = gr_context->flush(flush_info); - DCHECK_EQ(flush_result, GrSemaphoresSubmitted::kYes); - gr_context->submit(); + if (!SubmitSignalVkSemaphore( + context_provider()->GetDeviceQueue()->GetVulkanQueue(), + semaphore.GetVkSemaphore())) { + LOG(ERROR) << "Failed to create a signaled semaphore"; + return false; + } external_semaphores->push_back(std::move(semaphore)); } @@ -781,7 +776,8 @@ if (latest_content_ & kInSharedMemory) { if (!shared_memory_wrapper_.IsValid()) return; - if (!WritePixels()) + if (!WritePixelsWithData(shared_memory_wrapper_.GetMemoryAsSpan(), + shared_memory_wrapper_.GetStride())) return; latest_content_ |= use_separate_gl_texture() ? kInVkImage : kInVkImage | kInGLTexture; @@ -808,10 +804,7 @@ bool ExternalVkImageBacking::WritePixelsWithCallback( size_t data_size, - size_t stride, WriteBufferCallback callback) { - DCHECK(stride == 0 || size().height() * stride <= data_size); - VkBufferCreateInfo buffer_create_info = { .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, .size = data_size, @@ -863,10 +856,8 @@ VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); backend_texture_.setVkImageLayout(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); } - uint32_t buffer_width = - stride ? stride * 8 / BitsPerPixel(format()) : size().width(); - command_buffer->CopyBufferToImage(stage_buffer, image_info.fImage, - buffer_width, size().height(), + command_buffer->CopyBufferToImage(stage_buffer, image_info.fImage, // + 0, 0, /* the buffer is packed */ size().width(), size().height()); } @@ -988,59 +979,33 @@ bool ExternalVkImageBacking::WritePixelsWithData( base::span<const uint8_t> pixel_data, size_t stride) { - std::vector<ExternalSemaphore> external_semaphores; - if (!BeginAccessInternal(false /* readonly */, &external_semaphores)) { - DLOG(ERROR) << "BeginAccess() failed."; - return false; - } - auto* gr_context = context_state_->gr_context(); - WaitSemaphoresOnGrContext(gr_context, &external_semaphores); - - auto info = SkImageInfo::Make(size().width(), size().height(), - ResourceFormatToClosestSkColorType( - /*gpu_compositing=*/true, format()), - kOpaque_SkAlphaType); - SkPixmap pixmap(info, pixel_data.data(), stride); - if (!gr_context->updateBackendTexture(backend_texture_, &pixmap, - /*levels=*/1, nullptr, nullptr)) { - DLOG(ERROR) << "updateBackendTexture() failed."; + size_t row_copy_size = (BitsPerPixel(format()) * size().width()) / 8; + if (stride == 0) { + stride = row_copy_size; } - if (!need_synchronization()) { - DCHECK(external_semaphores.empty()); - EndAccessInternal(false /* readonly */, ExternalSemaphore()); - return true; - } + DCHECK(stride >= row_copy_size); + DCHECK(stride <= pixel_data.size() / size().height()); - gr_context->flush({}); - gr_context->setBackendTextureState( - backend_texture_, - GrBackendSurfaceMutableState(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, - VK_QUEUE_FAMILY_EXTERNAL)); + return WritePixelsWithCallback( + pixel_data.size(), + base::BindOnce( + [](const ExternalVkImageBacking* backing, + base::span<const uint8_t> data, size_t stride, + size_t row_copy_size, void* buffer) { + uint8_t* dest = static_cast<uint8_t*>(buffer); + gfx::Size size = backing->size(); + if (row_copy_size == stride) { + memcpy(dest, data.data(), row_copy_size * size.height()); + return; + } - auto end_access_semaphore = external_semaphore_pool()->GetOrCreateSemaphore(); - VkSemaphore vk_end_access_semaphore = end_access_semaphore.GetVkSemaphore(); - GrBackendSemaphore end_access_backend_semaphore; - end_access_backend_semaphore.initVulkan(vk_end_access_semaphore); - GrFlushInfo flush_info = { - .fNumSemaphores = 1, - .fSignalSemaphores = &end_access_backend_semaphore, - }; - gr_context->flush(flush_info); - - // Submit so the |end_access_semaphore| is ready for waiting. - gr_context->submit(); - - EndAccessInternal(false /* readonly */, std::move(end_access_semaphore)); - // |external_semaphores| have been waited on and can be reused when submitted - // GPU work is done. - ReturnPendingSemaphoresWithFenceHelper(std::move(external_semaphores)); - return true; -} - -bool ExternalVkImageBacking::WritePixels() { - return WritePixelsWithData(shared_memory_wrapper_.GetMemoryAsSpan(), - shared_memory_wrapper_.GetStride()); + for (int y = 0; y < size.height(); y++) { + memcpy(dest + y * row_copy_size, data.data() + y * stride, + row_copy_size); + } + }, + this, pixel_data, stride, row_copy_size)); } void ExternalVkImageBacking::CopyPixelsFromGLTextureToVkImage() { @@ -1091,7 +1056,7 @@ gl::ScopedPixelStore pack_alignment(GL_PACK_ALIGNMENT, 1); WritePixelsWithCallback( - checked_size.ValueOrDie(), 0, + checked_size.ValueOrDie(), base::BindOnce( [](gl::GLApi* api, const gfx::Size& size, GLenum format, GLenum type, void* buffer) {
diff --git a/gpu/command_buffer/service/external_vk_image_backing.h b/gpu/command_buffer/service/external_vk_image_backing.h index 04b32ed..a22b956 100644 --- a/gpu/command_buffer/service/external_vk_image_backing.h +++ b/gpu/command_buffer/service/external_vk_image_backing.h
@@ -180,15 +180,12 @@ using WriteBufferCallback = base::OnceCallback<void(void* buffer)>; // TODO(penghuang): Remove it when GrContext::updateBackendTexture() supports // compressed texture and callback. - bool WritePixelsWithCallback(size_t data_size, - size_t stride, - WriteBufferCallback callback); + bool WritePixelsWithCallback(size_t data_size, WriteBufferCallback callback); using ReadBufferCallback = base::OnceCallback<void(const void* buffer)>; bool ReadPixelsWithCallback(size_t data_size, size_t stride, ReadBufferCallback callback); bool WritePixelsWithData(base::span<const uint8_t> pixel_data, size_t stride); - bool WritePixels(); void CopyPixelsFromGLTextureToVkImage(); void CopyPixelsFromShmToGLTexture(); void CopyPixelsFromVkImageToGLTexture();
diff --git a/gpu/command_buffer/service/shared_image_backing_factory_angle_vulkan.cc b/gpu/command_buffer/service/shared_image_backing_factory_angle_vulkan.cc index b71ea13..f853d08 100644 --- a/gpu/command_buffer/service/shared_image_backing_factory_angle_vulkan.cc +++ b/gpu/command_buffer/service/shared_image_backing_factory_angle_vulkan.cc
@@ -18,6 +18,7 @@ #include "gpu/vulkan/vulkan_fence_helper.h" #include "gpu/vulkan/vulkan_image.h" #include "gpu/vulkan/vulkan_util.h" +#include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkPromiseImageTexture.h" #include "ui/gl/gl_context.h" #include "ui/gl/gl_image_egl_angle_vulkan.h" @@ -62,6 +63,7 @@ context_state_(context_state) {} ~AngleVulkanBacking() override { + DCHECK_EQ(access_mode_, kNone); if (passthrough_texture_) { if (!gl::GLContext::GetCurrent()) context_state_->MakeCurrent(/*surface=*/nullptr, /*needs_gl=*/true); @@ -154,6 +156,12 @@ // SharedImageRepresentationGLTextureClient implementation. bool SharedImageRepresentationGLTextureBeginAccess() override { + if (access_mode_ != kNone) { + LOG(DFATAL) << "The backing is being accessed with mode:" << access_mode_; + return false; + } + access_mode_ = kGLReadWrite; + gl::GLApi* api = gl::g_current_gl_context; GLuint texture = passthrough_texture_->service_id(); // Acquire the texture, so ANGLE can access it. @@ -162,6 +170,13 @@ } void SharedImageRepresentationGLTextureEndAccess(bool readonly) override { + if (access_mode_ != kGLReadWrite) { + LOG(DFATAL) << "The backing is not being accessed by GL. mode:" + << access_mode_; + return; + } + access_mode_ = kNone; + gl::GLApi* api = gl::g_current_gl_context; GLuint texture = passthrough_texture_->service_id(); // Release the texture from ANGLE, so it can be used elsewhere. @@ -173,7 +188,14 @@ private: class SkiaRepresentation; - bool BeginAccessSkia() { + bool BeginAccessSkia(bool readonly) { + if (access_mode_ != kNone) { + LOG(DFATAL) << "The backing is being accessed with mode:" << access_mode_; + return false; + } + + access_mode_ = readonly ? kSkiaReadOnly : kSkiaReadWrite; + if (!backend_texture_.isValid()) { GrVkImageInfo info = CreateGrVkImageInfo(vulkan_image_.get()); backend_texture_ = @@ -185,6 +207,13 @@ } void EndAccessSkia() { + if (access_mode_ != kSkiaReadOnly && access_mode_ != kSkiaReadWrite) { + LOG(DFATAL) << "The backing is not being accessed by Skia. mode:" + << access_mode_; + return; + } + access_mode_ = kNone; + GrVkImageInfo info; bool result = backend_texture_.getVkImageInfo(&info); DCHECK(result); @@ -223,6 +252,13 @@ scoped_refptr<gles2::TexturePassthrough> passthrough_texture_; GrBackendTexture backend_texture_{}; GLenum layout_ = GL_NONE; + enum AccessMode { + kNone, + kSkiaReadOnly, + kSkiaReadWrite, + kGLReadWrite, + }; + AccessMode access_mode_ = kNone; }; // namespace class AngleVulkanBacking::SkiaRepresentation @@ -240,7 +276,7 @@ std::vector<GrBackendSemaphore>* begin_semaphores, std::vector<GrBackendSemaphore>* end_semaphores, std::unique_ptr<GrBackendSurfaceMutableState>* end_state) override { - if (!backing_impl()->BeginAccessSkia()) + if (!backing_impl()->BeginAccessSkia(/*readonly=*/true)) return nullptr; return SkPromiseImageTexture::Make(backing_impl()->backend_texture_); } @@ -251,23 +287,64 @@ std::vector<GrBackendSemaphore>* begin_semaphores, std::vector<GrBackendSemaphore>* end_semaphores, std::unique_ptr<GrBackendSurfaceMutableState>* end_state) override { - // TODO(penghuang): support it for OOP-C. - NOTIMPLEMENTED(); - return nullptr; + if (!backing_impl()->BeginAccessSkia(/*readonly=*/false)) + return nullptr; + return SkPromiseImageTexture::Make(backing_impl()->backend_texture_); } - void EndWriteAccess(sk_sp<SkSurface> surface) override {} + + sk_sp<SkSurface> BeginWriteAccess( + int final_msaa_count, + const SkSurfaceProps& surface_props, + std::vector<GrBackendSemaphore>* begin_semaphores, + std::vector<GrBackendSemaphore>* end_semaphores, + std::unique_ptr<GrBackendSurfaceMutableState>* end_state) override { + auto promise_image_texture = + BeginWriteAccess(begin_semaphores, end_semaphores, end_state); + if (!promise_image_texture) + return nullptr; + + auto surface = backing_impl()->context_state_->GetCachedSkSurface(this); + + // If surface properties are different from the last access, then we cannot + // reuse the cached SkSurface. + if (!surface || surface_props != surface->props() || + final_msaa_count != surface_msaa_count_) { + SkColorType sk_color_type = viz::ResourceFormatToClosestSkColorType( + true /* gpu_compositing */, format()); + surface = SkSurface::MakeFromBackendTexture( + backing_impl()->context_state_->gr_context(), + promise_image_texture->backendTexture(), surface_origin(), + final_msaa_count, sk_color_type, + backing_impl()->color_space().ToSkColorSpace(), &surface_props); + if (!surface) { + backing_impl()->context_state_->EraseCachedSkSurface(this); + return nullptr; + } + surface_msaa_count_ = final_msaa_count; + backing_impl()->context_state_->CacheSkSurface(this, surface); + } + + int count = surface->getCanvas()->save(); + DCHECK_EQ(count, 1); + ALLOW_UNUSED_LOCAL(count); + + return surface; + } + + void EndWriteAccess(sk_sp<SkSurface> surface) override { + if (surface) { + surface->getCanvas()->restoreToCount(1); + surface = nullptr; + DCHECK(backing_impl()->context_state_->CachedSkSurfaceIsUnique(this)); + } + backing_impl()->EndAccessSkia(); + } private: AngleVulkanBacking* backing_impl() const { return static_cast<AngleVulkanBacking*>(backing()); } - sk_sp<SkPromiseImageTexture> BeginAccess( - bool readonly, - std::vector<GrBackendSemaphore>* begin_semaphores, - std::vector<GrBackendSemaphore>* end_semaphores); - - void EndAccess(bool readonly); int surface_msaa_count_ = 0; };
diff --git a/gpu/vulkan/vulkan_util.cc b/gpu/vulkan/vulkan_util.cc index 64a7cea..eaf2533a 100644 --- a/gpu/vulkan/vulkan_util.cc +++ b/gpu/vulkan/vulkan_util.cc
@@ -237,7 +237,7 @@ VkImageLayout GLImageLayoutToVkImageLayout(uint32_t layout) { switch (layout) { case GL_NONE: - break; + return VK_IMAGE_LAYOUT_UNDEFINED; case GL_LAYOUT_GENERAL_EXT: return VK_IMAGE_LAYOUT_GENERAL; case GL_LAYOUT_COLOR_ATTACHMENT_EXT:
diff --git a/headless/lib/utility/headless_content_utility_client.cc b/headless/lib/utility/headless_content_utility_client.cc index 4d08d91a..54541af 100644 --- a/headless/lib/utility/headless_content_utility_client.cc +++ b/headless/lib/utility/headless_content_utility_client.cc
@@ -6,7 +6,6 @@ #include "base/bind.h" #include "base/lazy_instance.h" -#include "base/no_destructor.h" #include "content/public/utility/utility_thread.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/service_factory.h"
diff --git a/ios/chrome/browser/autofill/address_normalizer_factory.cc b/ios/chrome/browser/autofill/address_normalizer_factory.cc index ae0881a..08662f3 100644 --- a/ios/chrome/browser/autofill/address_normalizer_factory.cc +++ b/ios/chrome/browser/autofill/address_normalizer_factory.cc
@@ -4,6 +4,7 @@ #include "ios/chrome/browser/autofill/address_normalizer_factory.h" +#include "base/no_destructor.h" #include "ios/chrome/browser/application_context.h" #include "ios/chrome/browser/autofill/validation_rules_storage_factory.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
diff --git a/ios/chrome/browser/autofill/autofill_profile_validator_factory.cc b/ios/chrome/browser/autofill/autofill_profile_validator_factory.cc index f07f4ff..e18ba7e8 100644 --- a/ios/chrome/browser/autofill/autofill_profile_validator_factory.cc +++ b/ios/chrome/browser/autofill/autofill_profile_validator_factory.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "base/no_destructor.h" #include "ios/chrome/browser/application_context.h" #include "ios/chrome/browser/autofill/validation_rules_storage_factory.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
diff --git a/ios/chrome/browser/autofill/validation_rules_storage_factory.cc b/ios/chrome/browser/autofill/validation_rules_storage_factory.cc index 64b687a..6659382e 100644 --- a/ios/chrome/browser/autofill/validation_rules_storage_factory.cc +++ b/ios/chrome/browser/autofill/validation_rules_storage_factory.cc
@@ -5,6 +5,7 @@ #include "ios/chrome/browser/autofill/validation_rules_storage_factory.h" #include "base/files/file_path.h" +#include "base/no_destructor.h" #include "base/path_service.h" #include "components/prefs/json_pref_store.h" #include "ios/chrome/browser/chrome_paths.h"
diff --git a/ios/chrome/browser/bookmarks/bookmark_sync_service_factory.cc b/ios/chrome/browser/bookmarks/bookmark_sync_service_factory.cc index 9a1aed4..313280e 100644 --- a/ios/chrome/browser/bookmarks/bookmark_sync_service_factory.cc +++ b/ios/chrome/browser/bookmarks/bookmark_sync_service_factory.cc
@@ -4,6 +4,7 @@ #include "ios/chrome/browser/bookmarks/bookmark_sync_service_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/sync_bookmarks/bookmark_sync_service.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h"
diff --git a/ios/chrome/browser/bookmarks/managed_bookmark_service_factory.mm b/ios/chrome/browser/bookmarks/managed_bookmark_service_factory.mm index 1e0adff8..bee8402 100644 --- a/ios/chrome/browser/bookmarks/managed_bookmark_service_factory.mm +++ b/ios/chrome/browser/bookmarks/managed_bookmark_service_factory.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/bookmarks/managed_bookmark_service_factory.h" +#include "base/no_destructor.h" #include "base/strings/sys_string_conversions.h" #include "components/bookmarks/managed/managed_bookmark_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h"
diff --git a/ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_keyed_service_factory.cc b/ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_keyed_service_factory.cc index 269ae9a..8437fd4 100644 --- a/ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_keyed_service_factory.cc +++ b/ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_keyed_service_factory.cc
@@ -4,6 +4,7 @@ #include "ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_keyed_service_factory.h" +#include "base/no_destructor.h" #include "components/breadcrumbs/core/breadcrumb_manager_keyed_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "ios/web/public/browser_state.h"
diff --git a/ios/chrome/browser/credential_provider/credential_provider_service_factory.mm b/ios/chrome/browser/credential_provider/credential_provider_service_factory.mm index a0933d69..a34a3adc 100644 --- a/ios/chrome/browser/credential_provider/credential_provider_service_factory.mm +++ b/ios/chrome/browser/credential_provider/credential_provider_service_factory.mm
@@ -4,6 +4,7 @@ #include "ios/chrome/browser/credential_provider/credential_provider_service_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/core/service_access_type.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/password_manager/core/common/password_manager_features.h"
diff --git a/ios/chrome/browser/device_sharing/device_sharing_manager_factory.mm b/ios/chrome/browser/device_sharing/device_sharing_manager_factory.mm index e894c85..43df9db 100644 --- a/ios/chrome/browser/device_sharing/device_sharing_manager_factory.mm +++ b/ios/chrome/browser/device_sharing/device_sharing_manager_factory.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/device_sharing/device_sharing_manager_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
diff --git a/ios/chrome/browser/discover_feed/discover_feed_service_factory.mm b/ios/chrome/browser/discover_feed/discover_feed_service_factory.mm index e51f03e..f35ff47 100644 --- a/ios/chrome/browser/discover_feed/discover_feed_service_factory.mm +++ b/ios/chrome/browser/discover_feed/discover_feed_service_factory.mm
@@ -4,6 +4,7 @@ #include "ios/chrome/browser/discover_feed/discover_feed_service_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/discover_feed/discover_feed_service.h"
diff --git a/ios/chrome/browser/download/background_service/background_download_service_factory.cc b/ios/chrome/browser/download/background_service/background_download_service_factory.cc index e6eb078..bdd2eecbf 100644 --- a/ios/chrome/browser/download/background_service/background_download_service_factory.cc +++ b/ios/chrome/browser/download/background_service/background_download_service_factory.cc
@@ -6,6 +6,7 @@ #include <utility> +#include "base/no_destructor.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" #include "base/time/default_clock.h"
diff --git a/ios/chrome/browser/flags/about_flags.mm b/ios/chrome/browser/flags/about_flags.mm index 2579b1d..a38e3d4ac 100644 --- a/ios/chrome/browser/flags/about_flags.mm +++ b/ios/chrome/browser/flags/about_flags.mm
@@ -532,6 +532,10 @@ flag_descriptions::kIOSSharedHighlightingColorChangeDescription, flags_ui::kOsIos, FEATURE_VALUE_TYPE(web::features::kIOSSharedHighlightingColorChange)}, + {"ios-shared-highlighting-v2", + flag_descriptions::kIOSSharedHighlightingV2Name, + flag_descriptions::kIOSSharedHighlightingV2Description, flags_ui::kOsIos, + FEATURE_VALUE_TYPE(shared_highlighting::kIOSSharedHighlightingV2)}, {"ios-persist-crash-restore-infobar", flag_descriptions::kIOSPersistCrashRestoreName, flag_descriptions::kIOSPersistCrashRestoreDescription, flags_ui::kOsIos, @@ -712,9 +716,6 @@ flag_descriptions::kEnableDiscoverFeedShorterCacheName, flag_descriptions::kEnableDiscoverFeedShorterCacheDescription, flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableDiscoverFeedShorterCache)}, - {"shared-highlighting-v2", flag_descriptions::kIOSSharedHighlightingV2Name, - flag_descriptions::kIOSSharedHighlightingV2Description, flags_ui::kOsIos, - FEATURE_VALUE_TYPE(shared_highlighting::kSharedHighlightingV2)}, {"shared-highlighting-amp", flag_descriptions::kIOSSharedHighlightingAmpName, flag_descriptions::kIOSSharedHighlightingAmpDescription, flags_ui::kOsIos,
diff --git a/ios/chrome/browser/history/domain_diversity_reporter_factory.mm b/ios/chrome/browser/history/domain_diversity_reporter_factory.mm index 1f983d2..22371e6b 100644 --- a/ios/chrome/browser/history/domain_diversity_reporter_factory.mm +++ b/ios/chrome/browser/history/domain_diversity_reporter_factory.mm
@@ -5,6 +5,7 @@ #import "ios/chrome/browser/history/domain_diversity_reporter_factory.h" #import "base/bind.h" +#import "base/no_destructor.h" #import "base/time/default_clock.h" #import "build/build_config.h" #import "components/history/metrics/domain_diversity_reporter.h"
diff --git a/ios/chrome/browser/language/language_model_manager_factory.cc b/ios/chrome/browser/language/language_model_manager_factory.cc index 984ebf6..c88d2fb 100644 --- a/ios/chrome/browser/language/language_model_manager_factory.cc +++ b/ios/chrome/browser/language/language_model_manager_factory.cc
@@ -5,6 +5,7 @@ #include "ios/chrome/browser/language/language_model_manager_factory.h" #include "base/feature_list.h" +#include "base/no_destructor.h" #include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/language/core/browser/language_model.h"
diff --git a/ios/chrome/browser/language/url_language_histogram_factory.cc b/ios/chrome/browser/language/url_language_histogram_factory.cc index 6b37538..c23ae77 100644 --- a/ios/chrome/browser/language/url_language_histogram_factory.cc +++ b/ios/chrome/browser/language/url_language_histogram_factory.cc
@@ -4,6 +4,7 @@ #include "ios/chrome/browser/language/url_language_histogram_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/language/core/browser/url_language_histogram.h"
diff --git a/ios/chrome/browser/link_to_text/link_to_text_java_script_feature.mm b/ios/chrome/browser/link_to_text/link_to_text_java_script_feature.mm index c94d5f4e..04a490e 100644 --- a/ios/chrome/browser/link_to_text/link_to_text_java_script_feature.mm +++ b/ios/chrome/browser/link_to_text/link_to_text_java_script_feature.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/link_to_text/link_to_text_java_script_feature.h" +#include "base/no_destructor.h" #import "base/timer/elapsed_timer.h" #import "ios/chrome/browser/link_to_text/link_to_text_constants.h" #import "ios/web/public/js_messaging/web_frame.h"
diff --git a/ios/chrome/browser/main/browser_list_factory.mm b/ios/chrome/browser/main/browser_list_factory.mm index b448535..64fa816 100644 --- a/ios/chrome/browser/main/browser_list_factory.mm +++ b/ios/chrome/browser/main/browser_list_factory.mm
@@ -6,6 +6,7 @@ #include <memory> +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
diff --git a/ios/chrome/browser/metrics/ios_profile_session_durations_service_factory.mm b/ios/chrome/browser/metrics/ios_profile_session_durations_service_factory.mm index 1715c80..68ff16bc 100644 --- a/ios/chrome/browser/metrics/ios_profile_session_durations_service_factory.mm +++ b/ios/chrome/browser/metrics/ios_profile_session_durations_service_factory.mm
@@ -10,6 +10,7 @@ #include <memory> +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/sync/driver/sync_service.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h"
diff --git a/ios/chrome/browser/omaha/omaha_service.mm b/ios/chrome/browser/omaha/omaha_service.mm index f68048a..33b1f58 100644 --- a/ios/chrome/browser/omaha/omaha_service.mm +++ b/ios/chrome/browser/omaha/omaha_service.mm
@@ -14,6 +14,7 @@ #include "base/ios/device_util.h" #include "base/logging.h" #include "base/metrics/field_trial.h" +#include "base/no_destructor.h" #include "base/rand_util.h" #include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h"
diff --git a/ios/chrome/browser/optimization_guide/optimization_guide_service_factory.mm b/ios/chrome/browser/optimization_guide/optimization_guide_service_factory.mm index f2d0ab2..d617481b 100644 --- a/ios/chrome/browser/optimization_guide/optimization_guide_service_factory.mm +++ b/ios/chrome/browser/optimization_guide/optimization_guide_service_factory.mm
@@ -5,6 +5,7 @@ #include "ios/chrome/browser/optimization_guide/optimization_guide_service_factory.h" #import "base/feature_list.h" +#import "base/no_destructor.h" #import "components/keyed_service/ios/browser_state_dependency_manager.h" #import "components/optimization_guide/core/optimization_guide_features.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h"
diff --git a/ios/chrome/browser/passwords/credentials_cleaner_runner_factory.cc b/ios/chrome/browser/passwords/credentials_cleaner_runner_factory.cc index aeb7b1c1..bf3b447 100644 --- a/ios/chrome/browser/passwords/credentials_cleaner_runner_factory.cc +++ b/ios/chrome/browser/passwords/credentials_cleaner_runner_factory.cc
@@ -4,6 +4,7 @@ #include "ios/chrome/browser/passwords/credentials_cleaner_runner_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/password_manager/core/browser/credentials_cleaner_runner.h" #include "ios/web/public/browser_state.h"
diff --git a/ios/chrome/browser/passwords/ios_chrome_affiliation_service_factory.cc b/ios/chrome/browser/passwords/ios_chrome_affiliation_service_factory.cc index c426b272..ca7d5082 100644 --- a/ios/chrome/browser/passwords/ios_chrome_affiliation_service_factory.cc +++ b/ios/chrome/browser/passwords/ios_chrome_affiliation_service_factory.cc
@@ -7,6 +7,7 @@ #include <memory> #include <utility> +#include "base/no_destructor.h" #include "base/task/sequenced_task_runner.h" #include "base/task/thread_pool.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h"
diff --git a/ios/chrome/browser/passwords/ios_chrome_bulk_leak_check_service_factory.cc b/ios/chrome/browser/passwords/ios_chrome_bulk_leak_check_service_factory.cc index ca79560..da370f46 100644 --- a/ios/chrome/browser/passwords/ios_chrome_bulk_leak_check_service_factory.cc +++ b/ios/chrome/browser/passwords/ios_chrome_bulk_leak_check_service_factory.cc
@@ -7,6 +7,7 @@ #include <memory> #include <utility> +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "components/password_manager/core/browser/bulk_leak_check_service.h"
diff --git a/ios/chrome/browser/passwords/ios_chrome_password_check_manager_factory.mm b/ios/chrome/browser/passwords/ios_chrome_password_check_manager_factory.mm index 069c7b59..0e87b08 100644 --- a/ios/chrome/browser/passwords/ios_chrome_password_check_manager_factory.mm +++ b/ios/chrome/browser/passwords/ios_chrome_password_check_manager_factory.mm
@@ -6,6 +6,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/passwords/ios_chrome_password_check_manager.h"
diff --git a/ios/chrome/browser/passwords/ios_password_requirements_service_factory.cc b/ios/chrome/browser/passwords/ios_password_requirements_service_factory.cc index 2705ee6..5186089 100644 --- a/ios/chrome/browser/passwords/ios_password_requirements_service_factory.cc +++ b/ios/chrome/browser/passwords/ios_password_requirements_service_factory.cc
@@ -4,6 +4,7 @@ #include "ios/chrome/browser/passwords/ios_password_requirements_service_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/core/service_access_type.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/password_manager/core/browser/password_requirements_service.h"
diff --git a/ios/chrome/browser/policy_url_blocking/policy_url_blocking_service.cc b/ios/chrome/browser/policy_url_blocking/policy_url_blocking_service.cc index bb5d1c57..eed2b2e 100644 --- a/ios/chrome/browser/policy_url_blocking/policy_url_blocking_service.cc +++ b/ios/chrome/browser/policy_url_blocking/policy_url_blocking_service.cc
@@ -4,6 +4,7 @@ #include "ios/chrome/browser/policy_url_blocking/policy_url_blocking_service.h" +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "ios/chrome/browser/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
diff --git a/ios/chrome/browser/safe_browsing/chrome_password_protection_service_factory.mm b/ios/chrome/browser/safe_browsing/chrome_password_protection_service_factory.mm index 13e9ee1..980047bd 100644 --- a/ios/chrome/browser/safe_browsing/chrome_password_protection_service_factory.mm +++ b/ios/chrome/browser/safe_browsing/chrome_password_protection_service_factory.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/safe_browsing/chrome_password_protection_service_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #import "ios/chrome/browser/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h"
diff --git a/ios/chrome/browser/safe_browsing/real_time_url_lookup_service_factory.mm b/ios/chrome/browser/safe_browsing/real_time_url_lookup_service_factory.mm index be3d310..c710af8 100644 --- a/ios/chrome/browser/safe_browsing/real_time_url_lookup_service_factory.mm +++ b/ios/chrome/browser/safe_browsing/real_time_url_lookup_service_factory.mm
@@ -5,6 +5,7 @@ #include "ios/chrome/browser/safe_browsing/real_time_url_lookup_service_factory.h" #include "base/bind.h" +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/safe_browsing/core/browser/realtime/url_lookup_service.h" #include "components/safe_browsing/core/browser/sync/safe_browsing_primary_account_token_fetcher.h"
diff --git a/ios/chrome/browser/safe_browsing/verdict_cache_manager_factory.mm b/ios/chrome/browser/safe_browsing/verdict_cache_manager_factory.mm index 9d7c7424..64a4946 100644 --- a/ios/chrome/browser/safe_browsing/verdict_cache_manager_factory.mm +++ b/ios/chrome/browser/safe_browsing/verdict_cache_manager_factory.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/safe_browsing/verdict_cache_manager_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/core/service_access_type.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/safe_browsing/core/browser/verdict_cache_manager.h"
diff --git a/ios/chrome/browser/screen_time/screen_time_history_deleter_factory.mm b/ios/chrome/browser/screen_time/screen_time_history_deleter_factory.mm index 38917f7a..251702d 100644 --- a/ios/chrome/browser/screen_time/screen_time_history_deleter_factory.mm +++ b/ios/chrome/browser/screen_time/screen_time_history_deleter_factory.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/screen_time/screen_time_history_deleter_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/core/service_access_type.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h"
diff --git a/ios/chrome/browser/search/search_service_factory.mm b/ios/chrome/browser/search/search_service_factory.mm index 057bb28..0ad1c51 100644 --- a/ios/chrome/browser/search/search_service_factory.mm +++ b/ios/chrome/browser/search/search_service_factory.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/search/search_service_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
diff --git a/ios/chrome/browser/search_engines/search_engine_java_script_feature.mm b/ios/chrome/browser/search_engines/search_engine_java_script_feature.mm index f94f8c5..1904ef7f 100644 --- a/ios/chrome/browser/search_engines/search_engine_java_script_feature.mm +++ b/ios/chrome/browser/search_engines/search_engine_java_script_feature.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/search_engines/search_engine_java_script_feature.h" +#include "base/no_destructor.h" //#import "ios/chrome/browser/search_engines/search_engine_tab_helper.h" #include "ios/web/public/js_messaging/java_script_feature_util.h" #import "ios/web/public/js_messaging/script_message.h"
diff --git a/ios/chrome/browser/search_engines/search_engine_tab_helper_factory.mm b/ios/chrome/browser/search_engines/search_engine_tab_helper_factory.mm index a7e05844..2cefc0b 100644 --- a/ios/chrome/browser/search_engines/search_engine_tab_helper_factory.mm +++ b/ios/chrome/browser/search_engines/search_engine_tab_helper_factory.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/search_engines/search_engine_tab_helper_factory.h" +#include "base/no_destructor.h" #import "ios/chrome/browser/search_engines/search_engine_tab_helper.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/signin/chrome_account_manager_service_factory.mm b/ios/chrome/browser/signin/chrome_account_manager_service_factory.mm index b2cff72..a3d28037 100644 --- a/ios/chrome/browser/signin/chrome_account_manager_service_factory.mm +++ b/ios/chrome/browser/signin/chrome_account_manager_service_factory.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/signin/chrome_account_manager_service_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "ios/chrome/browser/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
diff --git a/ios/chrome/browser/signin/identity_manager_factory.cc b/ios/chrome/browser/signin/identity_manager_factory.cc index 57e2f87..8ae6cd73 100644 --- a/ios/chrome/browser/signin/identity_manager_factory.cc +++ b/ios/chrome/browser/signin/identity_manager_factory.cc
@@ -7,6 +7,7 @@ #include <memory> #include <utility> +#include "base/no_destructor.h" #include "components/image_fetcher/ios/ios_image_decoder_impl.h" #include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h"
diff --git a/ios/chrome/browser/signin/signin_browser_state_info_updater_factory.mm b/ios/chrome/browser/signin/signin_browser_state_info_updater_factory.mm index 88669f8..0b1e4b51 100644 --- a/ios/chrome/browser/signin/signin_browser_state_info_updater_factory.mm +++ b/ios/chrome/browser/signin/signin_browser_state_info_updater_factory.mm
@@ -8,6 +8,7 @@ #error "This file requires ARC support." #endif +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/signin/identity_manager_factory.h"
diff --git a/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h b/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h index bbf32845..f68cda0 100644 --- a/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h +++ b/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h
@@ -42,7 +42,7 @@ void GetSerializedNavigationAtIndex( int i, sessions::SerializedNavigationEntry* serialized_entry) const override; - bool ProfileIsSupervised() const override; + bool ProfileHasChildAccount() const override; const std::vector<std::unique_ptr<const sessions::SerializedNavigationEntry>>* GetBlockedNavigations() const override; bool IsPlaceholderTab() const override;
diff --git a/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.mm b/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.mm index 31eb916..6748ae7 100644 --- a/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.mm +++ b/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.mm
@@ -159,7 +159,7 @@ } } -bool IOSChromeSyncedTabDelegate::ProfileIsSupervised() const { +bool IOSChromeSyncedTabDelegate::ProfileHasChildAccount() const { return false; }
diff --git a/ios/chrome/browser/sync/send_tab_to_self_sync_service_factory.mm b/ios/chrome/browser/sync/send_tab_to_self_sync_service_factory.mm index 83a191b..4d76002 100644 --- a/ios/chrome/browser/sync/send_tab_to_self_sync_service_factory.mm +++ b/ios/chrome/browser/sync/send_tab_to_self_sync_service_factory.mm
@@ -4,6 +4,7 @@ #include "ios/chrome/browser/sync/send_tab_to_self_sync_service_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/core/service_access_type.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/send_tab_to_self/send_tab_to_self_sync_service.h"
diff --git a/ios/chrome/browser/sync/sync_invalidations_service_factory.mm b/ios/chrome/browser/sync/sync_invalidations_service_factory.mm index 9e52a00..07cb565 100644 --- a/ios/chrome/browser/sync/sync_invalidations_service_factory.mm +++ b/ios/chrome/browser/sync/sync_invalidations_service_factory.mm
@@ -4,6 +4,7 @@ #include "ios/chrome/browser/sync/sync_invalidations_service_factory.h" +#include "base/no_destructor.h" #include "components/gcm_driver/gcm_profile_service.h" #include "components/gcm_driver/instance_id/instance_id_profile_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h"
diff --git a/ios/chrome/browser/translate/translate_accept_languages_factory.cc b/ios/chrome/browser/translate/translate_accept_languages_factory.cc index 3ef11ae2..0d676b9 100644 --- a/ios/chrome/browser/translate/translate_accept_languages_factory.cc +++ b/ios/chrome/browser/translate/translate_accept_languages_factory.cc
@@ -4,6 +4,7 @@ #include "ios/chrome/browser/translate/translate_accept_languages_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/language/core/browser/pref_names.h"
diff --git a/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_account_chooser/identity_item_configurator.mm b/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_account_chooser/identity_item_configurator.mm index 816b54c..586b543 100644 --- a/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_account_chooser/identity_item_configurator.mm +++ b/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_account_chooser/identity_item_configurator.mm
@@ -18,6 +18,7 @@ item.email = self.email; item.avatar = self.avatar; item.selected = self.selected; + item.useCustomSeparator = NO; } - (NSString*)description {
diff --git a/ios/chrome/browser/ui/context_menu/link_no_preview_view.mm b/ios/chrome/browser/ui/context_menu/link_no_preview_view.mm index bd223089..05ab8e9 100644 --- a/ios/chrome/browser/ui/context_menu/link_no_preview_view.mm +++ b/ios/chrome/browser/ui/context_menu/link_no_preview_view.mm
@@ -24,6 +24,8 @@ const CGFloat kLeadingMargin = 15; // Margin between the favicon and the text. const CGFloat kFaviconToTextMargin = 14; +// Number of lines for the subtitle. +const CGFloat kNumberOfSubtitleLines = 3; } // namespace @@ -45,6 +47,7 @@ _title = [[UILabel alloc] init]; _title.translatesAutoresizingMaskIntoConstraints = NO; _title.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; + _title.adjustsFontForContentSizeCategory = YES; _title.textColor = [UIColor colorNamed:kTextPrimaryColor]; _title.text = title; [self addSubview:_title]; @@ -52,6 +55,8 @@ _subtitle = [[UILabel alloc] init]; _subtitle.translatesAutoresizingMaskIntoConstraints = NO; _subtitle.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; + _subtitle.adjustsFontForContentSizeCategory = YES; + _subtitle.numberOfLines = kNumberOfSubtitleLines; _subtitle.textColor = [UIColor colorNamed:kTextSecondaryColor]; _subtitle.text = subtitle; [self addSubview:_subtitle];
diff --git a/ios/chrome/browser/ui/overlays/infobar_banner/infobar_banner_overlay_coordinator.mm b/ios/chrome/browser/ui/overlays/infobar_banner/infobar_banner_overlay_coordinator.mm index 4d2714b7..2575259 100644 --- a/ios/chrome/browser/ui/overlays/infobar_banner/infobar_banner_overlay_coordinator.mm +++ b/ios/chrome/browser/ui/overlays/infobar_banner/infobar_banner_overlay_coordinator.mm
@@ -6,7 +6,6 @@ #include "base/check.h" #include "base/mac/foundation_util.h" -#include "base/no_destructor.h" #import "ios/chrome/browser/overlays/public/common/infobars/infobar_overlay_request_config.h" #import "ios/chrome/browser/overlays/public/overlay_request.h" #import "ios/chrome/browser/overlays/public/overlay_request_support.h"
diff --git a/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_list.swift b/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_list.swift index 9f2bdc8..816d5e8 100644 --- a/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_list.swift +++ b/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_list.swift
@@ -32,6 +32,9 @@ /// When the dynamic text size is large, the width of each item is the /// screen width minus a fixed space. static let largeTextSizeSpace: CGFloat = 120 + + /// Space above the list pushing them down from the grabber. + static let topMargin: CGFloat = 20 } /// The current dynamic type size. @@ -50,11 +53,15 @@ : .vertical( iconSpacing: spacing.iconSpacing, iconPadding: spacing.iconPadding) + let alignment: VerticalAlignment = sizeCategory >= .accessibilityMedium ? .center : .top - LazyHStack(spacing: 0) { - ForEach(destinations) { destination in - OverflowMenuDestinationView( - destination: destination, layoutParameters: layoutParameters) + VStack { + Spacer(minLength: Constants.topMargin) + LazyHStack(alignment: alignment, spacing: 0) { + ForEach(destinations) { destination in + OverflowMenuDestinationView( + destination: destination, layoutParameters: layoutParameters) + } } } // Make sure the space to the first icon is constant, so add extra
diff --git a/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_view.swift b/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_view.swift index d0b6638..8e8a044 100644 --- a/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_view.swift +++ b/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_view.swift
@@ -24,6 +24,9 @@ /// The spacing between the icon and the text in horizontal layout. static let horizontalLayoutIconSpacing: CGFloat = 14 + + /// The image width, which controls the width of the overall view. + static let imageWidth: CGFloat = 54 } /// The destination for this view. @@ -35,11 +38,12 @@ func makeBody(configuration: Configuration) -> some View { Group { switch layoutParameters { - case .vertical: + case .vertical(let iconSpacing, let iconPadding): VStack { icon(configuration: configuration) text } + .frame(width: Dimensions.imageWidth + 2 * iconSpacing + 2 * iconPadding) case .horizontal(let itemWidth): HStack { icon(configuration: configuration) @@ -87,15 +91,20 @@ var text: some View { // Only the vertical layout has extra spacing around the text let textSpacing: CGFloat + let maximumLines: Int? switch layoutParameters { case .vertical: textSpacing = Dimensions.verticalLayoutTextPadding + maximumLines = nil case .horizontal: textSpacing = 0 + maximumLines = 1 } return Text(destination.name) .font(.caption2) .padding([.leading, .trailing], textSpacing) + .multilineTextAlignment(.center) + .lineLimit(maximumLines) } }
diff --git a/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.mm b/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.mm index 3792632..a51c940 100644 --- a/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.mm +++ b/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.mm
@@ -5,6 +5,7 @@ #import "ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.h" #include "base/mac/foundation_util.h" +#import "ios/chrome/browser/net/crurl.h" #import "ios/chrome/browser/signin/constants.h" #import "ios/chrome/browser/signin/signin_util.h" #import "ios/chrome/browser/ui/authentication/cells/signin_promo_view_configurator.h" @@ -482,6 +483,8 @@ [[TableViewLinkHeaderFooterItem alloc] initWithType:ItemTypeLinkFooter]; linkFooter.text = @"This is a footer text view with a BEGIN_LINKlinkEND_LINK in the middle"; + linkFooter.urls = + @[ [[CrURL alloc] initWithGURL:GURL("http://www.example.com")] ]; [model setFooter:linkFooter forSectionWithIdentifier:SectionIdentifierSettings];
diff --git a/ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.mm b/ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.mm index f9621e53..7386bc9 100644 --- a/ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.mm +++ b/ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.mm
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/location.h" +#include "base/no_destructor.h" #include "ios/chrome/browser/chrome_url_constants.h" #include "ios/chrome/browser/policy/policy_features.h" #include "ios/chrome/browser/system_flags.h"
diff --git a/ios/chrome/browser/unified_consent/unified_consent_service_factory.cc b/ios/chrome/browser/unified_consent/unified_consent_service_factory.cc index 5e1d19c..c4898d8 100644 --- a/ios/chrome/browser/unified_consent/unified_consent_service_factory.cc +++ b/ios/chrome/browser/unified_consent/unified_consent_service_factory.cc
@@ -7,6 +7,7 @@ #include <string> #include <vector> +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/sync/driver/sync_service.h" #include "components/sync_preferences/pref_service_syncable.h"
diff --git a/ios/chrome/browser/web/image_fetch/image_fetch_java_script_feature.mm b/ios/chrome/browser/web/image_fetch/image_fetch_java_script_feature.mm index 92a3dec..6eed2c4 100644 --- a/ios/chrome/browser/web/image_fetch/image_fetch_java_script_feature.mm +++ b/ios/chrome/browser/web/image_fetch/image_fetch_java_script_feature.mm
@@ -5,6 +5,7 @@ #import "ios/chrome/browser/web/image_fetch/image_fetch_java_script_feature.h" #include "base/base64.h" +#include "base/no_destructor.h" #include "base/values.h" #include "ios/chrome/browser/web/image_fetch/image_fetch_tab_helper.h" #import "ios/web/public/js_messaging/java_script_feature_util.h"
diff --git a/ios/chrome/browser/web/java_script_console/java_script_console_feature_factory.mm b/ios/chrome/browser/web/java_script_console/java_script_console_feature_factory.mm index e7feaf2..cc1ccf02 100644 --- a/ios/chrome/browser/web/java_script_console/java_script_console_feature_factory.mm +++ b/ios/chrome/browser/web/java_script_console/java_script_console_feature_factory.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/web/java_script_console/java_script_console_feature_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #import "ios/chrome/browser/web/java_script_console/java_script_console_feature.h"
diff --git a/ios/chrome/browser/web/session_state/web_session_state_cache_factory.mm b/ios/chrome/browser/web/session_state/web_session_state_cache_factory.mm index 7c7f5cd..2e3782b 100644 --- a/ios/chrome/browser/web/session_state/web_session_state_cache_factory.mm +++ b/ios/chrome/browser/web/session_state/web_session_state_cache_factory.mm
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "base/no_destructor.h" #include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h"
diff --git a/ios/chrome/common/crash_report/chrome_crash_reporter_client.cc b/ios/chrome/common/crash_report/chrome_crash_reporter_client.cc index 7aa5f3b..3acd084 100644 --- a/ios/chrome/common/crash_report/chrome_crash_reporter_client.cc +++ b/ios/chrome/common/crash_report/chrome_crash_reporter_client.cc
@@ -5,6 +5,7 @@ #include "ios/chrome/common/crash_report/chrome_crash_reporter_client.h" #include "base/files/file_path.h" +#include "base/no_destructor.h" #include "ios/chrome/common/crash_report/crash_helper.h" void ChromeCrashReporterClient::Create() {
diff --git a/ios/chrome/credential_provider_extension/credential_provider_extension_localize_strings_config.plist b/ios/chrome/credential_provider_extension/credential_provider_extension_localize_strings_config.plist index 5ae3803..e3ac15b 100644 --- a/ios/chrome/credential_provider_extension/credential_provider_extension_localize_strings_config.plist +++ b/ios/chrome/credential_provider_extension/credential_provider_extension_localize_strings_config.plist
@@ -44,6 +44,8 @@ <string>IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_ERROR_MESSAGE</string> <string>IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_ERROR_TITLE</string> <string>IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER</string> + <string>IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_BRANDED_NO_SYNC</string> + <string>IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_BRANDED_SYNC</string> <string>IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_NO_EMAIL</string> <string>IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_HIDE_KEYBOARD_HINT</string> <string>IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_HIDE_PASSWORD_HINT</string>
diff --git a/ios/chrome/credential_provider_extension/strings/ios_credential_provider_extension_strings.grd b/ios/chrome/credential_provider_extension/strings/ios_credential_provider_extension_strings.grd index 2c3cbaf..581525a1 100644 --- a/ios/chrome/credential_provider_extension/strings/ios_credential_provider_extension_strings.grd +++ b/ios/chrome/credential_provider_extension/strings/ios_credential_provider_extension_strings.grd
@@ -254,6 +254,12 @@ <message name="IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER" desc="Disclaimer telling users what will happen to their passwords"> Your password will be saved in your Google Account (<ph name="EMAIL">$1<ex>example@google.com</ex></ph>) when you come back to Chrome </message> + <message name="IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_BRANDED_NO_SYNC" desc="Disclaimer telling non-logged in users what will happen to their passwords"> + Passwords are saved to Google Password Manager on this device only. + </message> + <message name="IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_BRANDED_SYNC" desc="Disclaimer telling users what will happen to their passwords"> + Your password will be saved to Google Password Manager for <ph name="EMAIL">$1<ex>example@google.com</ex></ph> when you come back to Chrome. + </message> <message name="IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_NO_EMAIL" desc="Disclaimer telling non-logged in users what will happen to their passwords"> Your password will be saved to your device. To use passwords on any device, turn on sync in Chrome. </message>
diff --git a/ios/chrome/credential_provider_extension/strings/ios_credential_provider_extension_strings_grd/IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_BRANDED_NO_SYNC.png.sha1 b/ios/chrome/credential_provider_extension/strings/ios_credential_provider_extension_strings_grd/IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_BRANDED_NO_SYNC.png.sha1 new file mode 100644 index 0000000..3a883e7 --- /dev/null +++ b/ios/chrome/credential_provider_extension/strings/ios_credential_provider_extension_strings_grd/IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_BRANDED_NO_SYNC.png.sha1
@@ -0,0 +1 @@ +2b705b9e9e4853e71e132ad9290d5a9c1fbd846d \ No newline at end of file
diff --git a/ios/chrome/credential_provider_extension/strings/ios_credential_provider_extension_strings_grd/IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_BRANDED_SYNC.png.sha1 b/ios/chrome/credential_provider_extension/strings/ios_credential_provider_extension_strings_grd/IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_BRANDED_SYNC.png.sha1 new file mode 100644 index 0000000..8502fcb --- /dev/null +++ b/ios/chrome/credential_provider_extension/strings/ios_credential_provider_extension_strings_grd/IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_BRANDED_SYNC.png.sha1
@@ -0,0 +1 @@ +85f75048aa14099eb2572d3ce807c5a6e91b848b \ No newline at end of file
diff --git a/ios/chrome/credential_provider_extension/ui/new_password_footer_view.mm b/ios/chrome/credential_provider_extension/ui/new_password_footer_view.mm index 9eccb57..99632ff 100644 --- a/ios/chrome/credential_provider_extension/ui/new_password_footer_view.mm +++ b/ios/chrome/credential_provider_extension/ui/new_password_footer_view.mm
@@ -7,6 +7,7 @@ #include "ios/chrome/common/app_group/app_group_constants.h" #import "ios/chrome/common/credential_provider/constants.h" #import "ios/chrome/common/ui/colors/semantic_color_names.h" +#import "ios/chrome/credential_provider_extension/ui/feature_flags.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -66,20 +67,32 @@ self.footerTextLabel.text = [self footerText]; } +#pragma mark - Private + - (NSString*)footerText { NSString* userEmail = [app_group::GetGroupUserDefaults() stringForKey:AppGroupUserDefaultsCredentialProviderUserEmail()]; + + NSString* syncKey = + IsPasswordManagerBrandingUpdateEnable() + ? @"IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_BRANDED_SYNC" + : @"IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER"; + + NSString* noSyncKey = + IsPasswordManagerBrandingUpdateEnable() + ? @"IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_BRANDED_NO_SYNC" + : @"IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_NO_EMAIL"; + if (userEmail) { NSString* baseLocalizedString = NSLocalizedString( - @"IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER", + syncKey, @"Disclaimer telling users what will happen to their passwords"); return [baseLocalizedString stringByReplacingOccurrencesOfString:@"$1" withString:userEmail]; } else { - return NSLocalizedString( - @"IDS_IOS_CREDENTIAL_PROVIDER_NEW_PASSWORD_FOOTER_NO_EMAIL", - @"Disclaimer telling non-logged in users what will happen to their " - @"passwords"); + return NSLocalizedString(noSyncKey, + @"Disclaimer telling non-logged in users what " + @"will happen to their passwords"); } }
diff --git a/ios/public/provider/chrome/browser/font_size_java_script_feature.mm b/ios/public/provider/chrome/browser/font_size_java_script_feature.mm index 44e90ec5..2fb16a88 100644 --- a/ios/public/provider/chrome/browser/font_size_java_script_feature.mm +++ b/ios/public/provider/chrome/browser/font_size_java_script_feature.mm
@@ -4,6 +4,7 @@ #import "ios/public/provider/chrome/browser/font_size_java_script_feature.h" +#include "base/no_destructor.h" #include "base/values.h" #import "ios/web/public/js_messaging/web_frame.h" #include "ios/web/public/js_messaging/web_frames_manager.h"
diff --git a/ios/web/browser_state.mm b/ios/web/browser_state.mm index 62a487d..3afdc51 100644 --- a/ios/web/browser_state.mm +++ b/ios/web/browser_state.mm
@@ -12,7 +12,6 @@ #include "base/location.h" #include "base/memory/ref_counted.h" #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "base/process/process_handle.h" #include "base/task/post_task.h" #include "base/token.h"
diff --git a/ios/web/browser_url_rewriter_impl.mm b/ios/web/browser_url_rewriter_impl.mm index 0d702f7..8137fe8 100644 --- a/ios/web/browser_url_rewriter_impl.mm +++ b/ios/web/browser_url_rewriter_impl.mm
@@ -5,6 +5,7 @@ #include "ios/web/browser_url_rewriter_impl.h" #include "base/check.h" +#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "ios/web/public/browser_state.h" #import "ios/web/public/web_client.h"
diff --git a/ios/web/find_in_page/find_in_page_java_script_feature.mm b/ios/web/find_in_page/find_in_page_java_script_feature.mm index f481e34..4cb70b91 100644 --- a/ios/web/find_in_page/find_in_page_java_script_feature.mm +++ b/ios/web/find_in_page/find_in_page_java_script_feature.mm
@@ -4,6 +4,7 @@ #import "ios/web/find_in_page/find_in_page_java_script_feature.h" +#include "base/no_destructor.h" #import "ios/web/find_in_page/find_in_page_constants.h" #include "ios/web/public/js_messaging/java_script_feature_util.h" #include "ios/web/public/js_messaging/web_frame.h"
diff --git a/ios/web/js_messaging/script_command_java_script_feature.mm b/ios/web/js_messaging/script_command_java_script_feature.mm index 4ef93291..1aeff18 100644 --- a/ios/web/js_messaging/script_command_java_script_feature.mm +++ b/ios/web/js_messaging/script_command_java_script_feature.mm
@@ -7,6 +7,7 @@ #include <string> #include "base/logging.h" +#include "base/no_destructor.h" #include "base/values.h" #include "ios/web/public/js_messaging/script_message.h" #include "ios/web/public/js_messaging/web_frame_util.h"
diff --git a/ios/web/navigation/navigation_java_script_feature.mm b/ios/web/navigation/navigation_java_script_feature.mm index e536da4e..1a94f61 100644 --- a/ios/web/navigation/navigation_java_script_feature.mm +++ b/ios/web/navigation/navigation_java_script_feature.mm
@@ -3,6 +3,8 @@ // found in the LICENSE file. #import "ios/web/navigation/navigation_java_script_feature.h" + +#import "base/no_destructor.h" #import "ios/web/public/js_messaging/java_script_feature_util.h" #import "ios/web/public/js_messaging/script_message.h" #import "ios/web/web_state/ui/crw_web_controller.h"
diff --git a/ios/web/text_fragments/text_fragments_java_script_feature.mm b/ios/web/text_fragments/text_fragments_java_script_feature.mm index 5a2ffbd..1ec65717 100644 --- a/ios/web/text_fragments/text_fragments_java_script_feature.mm +++ b/ios/web/text_fragments/text_fragments_java_script_feature.mm
@@ -6,6 +6,7 @@ #include <vector> +#include "base/no_destructor.h" #import "ios/web/public/js_messaging/script_message.h" #import "ios/web/public/js_messaging/web_frame.h" #import "ios/web/public/js_messaging/web_frame_util.h"
diff --git a/ios/web_view/internal/passwords/web_view_account_password_store_factory.mm b/ios/web_view/internal/passwords/web_view_account_password_store_factory.mm index 65f8eb7..71eb929 100644 --- a/ios/web_view/internal/passwords/web_view_account_password_store_factory.mm +++ b/ios/web_view/internal/passwords/web_view_account_password_store_factory.mm
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" +#include "base/no_destructor.h" #include "base/task/post_task.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/password_manager/core/browser/login_database.h"
diff --git a/ios/web_view/internal/passwords/web_view_password_requirements_service_factory.mm b/ios/web_view/internal/passwords/web_view_password_requirements_service_factory.mm index 8461bb59..9e4323e9 100644 --- a/ios/web_view/internal/passwords/web_view_password_requirements_service_factory.mm +++ b/ios/web_view/internal/passwords/web_view_password_requirements_service_factory.mm
@@ -4,6 +4,7 @@ #import "ios/web_view/internal/passwords/web_view_password_requirements_service_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/core/service_access_type.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/password_manager/core/browser/password_requirements_service.h"
diff --git a/ios/web_view/internal/signin/web_view_identity_manager_factory.mm b/ios/web_view/internal/signin/web_view_identity_manager_factory.mm index ed8972ba..7116e29 100644 --- a/ios/web_view/internal/signin/web_view_identity_manager_factory.mm +++ b/ios/web_view/internal/signin/web_view_identity_manager_factory.mm
@@ -6,6 +6,7 @@ #include <memory> +#include "base/no_destructor.h" #include "components/image_fetcher/ios/ios_image_decoder_impl.h" #include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h"
diff --git a/ios/web_view/internal/sync/web_view_sync_invalidations_service_factory.mm b/ios/web_view/internal/sync/web_view_sync_invalidations_service_factory.mm index 3ee089e3c..435a1db 100644 --- a/ios/web_view/internal/sync/web_view_sync_invalidations_service_factory.mm +++ b/ios/web_view/internal/sync/web_view_sync_invalidations_service_factory.mm
@@ -4,6 +4,7 @@ #include "ios/web_view/internal/sync/web_view_sync_invalidations_service_factory.h" +#include "base/no_destructor.h" #include "components/gcm_driver/gcm_profile_service.h" #include "components/gcm_driver/instance_id/instance_id_profile_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h"
diff --git a/ios/web_view/internal/webui/web_view_web_ui_ios_controller_factory.mm b/ios/web_view/internal/webui/web_view_web_ui_ios_controller_factory.mm index c0d45a2..f487e916 100644 --- a/ios/web_view/internal/webui/web_view_web_ui_ios_controller_factory.mm +++ b/ios/web_view/internal/webui/web_view_web_ui_ios_controller_factory.mm
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/location.h" +#include "base/no_destructor.h" #include "ios/components/webui/web_ui_url_constants.h" #include "ios/web_view/internal/webui/web_view_sync_internals_ui.h" #include "url/gurl.h"
diff --git a/media/base/audio_encoder.cc b/media/base/audio_encoder.cc index 070d73b2a..bb19db6 100644 --- a/media/base/audio_encoder.cc +++ b/media/base/audio_encoder.cc
@@ -5,7 +5,6 @@ #include "media/base/audio_encoder.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/time/time.h" #include "media/base/audio_timestamp_helper.h"
diff --git a/media/base/supported_types.cc b/media/base/supported_types.cc index a32455c3..65f3ce9 100644 --- a/media/base/supported_types.cc +++ b/media/base/supported_types.cc
@@ -7,7 +7,6 @@ #include "base/command_line.h" #include "base/feature_list.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h"
diff --git a/media/base/tuneable.cc b/media/base/tuneable.cc index 0b71e94d..c3b6d42 100644 --- a/media/base/tuneable.cc +++ b/media/base/tuneable.cc
@@ -9,7 +9,6 @@ #include "base/cxx17_backports.h" #include "base/hash/hash.h" #include "base/metrics/field_trial_params.h" -#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "media/base/media_switches.h"
diff --git a/media/gpu/android/codec_allocator.cc b/media/gpu/android/codec_allocator.cc index 33db46a..06ff0a6d 100644 --- a/media/gpu/android/codec_allocator.cc +++ b/media/gpu/android/codec_allocator.cc
@@ -11,6 +11,7 @@ #include "base/callback_helpers.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/task/post_task.h" #include "base/task/task_runner_util.h" #include "base/task/task_traits.h"
diff --git a/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc b/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc index 709f63e..87f284c8 100644 --- a/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc +++ b/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc
@@ -5,7 +5,9 @@ #include "media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.h" #include <dlfcn.h> +#include <sys/stat.h> +#include "base/strings/stringprintf.h" #include "media/gpu/buildflags.h" #if BUILDFLAG(USE_VAAPI) @@ -51,6 +53,38 @@ // platforms that need it. static const char kDevImageProc0Path[] = "/dev/image-proc0"; permissions.push_back(BrokerFilePermission::ReadWrite(kDevImageProc0Path)); +#elif BUILDFLAG(USE_VAAPI) + command_set.set(sandbox::syscall_broker::COMMAND_OPEN); + + if (options.use_amd_specific_policies) { + command_set.set(sandbox::syscall_broker::COMMAND_ACCESS); + command_set.set(sandbox::syscall_broker::COMMAND_STAT); + command_set.set(sandbox::syscall_broker::COMMAND_READLINK); + + permissions.push_back(BrokerFilePermission::ReadOnly("/dev/dri")); + + static const char* kDevices[] = {"/sys/dev/char", "/sys/devices"}; + for (const char* item : kDevices) { + std::string path(item); + permissions.push_back( + BrokerFilePermission::StatOnlyWithIntermediateDirs(path)); + permissions.push_back( + BrokerFilePermission::ReadOnlyRecursive(path + "/")); + } + } + + // TODO(b/195769334): for now, this is only needed for two use cases: the + // legacy VaapiVideoDecodeAccelerator and AMD. However, we'll likely need this + // unconditionally so that we can allocate dma-bufs. + for (int i = 128; i <= 137; ++i) { + const std::string path = base::StringPrintf("/dev/dri/renderD%d", i); + struct stat st; + if (stat(path.c_str(), &st) == 0) { + permissions.push_back(options.use_amd_specific_policies + ? BrokerFilePermission::ReadWrite(path) + : BrokerFilePermission::ReadOnly(path)); + } + } #endif // BUILDFLAG(USE_V4L2_CODEC) sandbox::policy::SandboxLinux::GetInstance()->StartBrokerProcess( @@ -68,7 +102,19 @@ // that bots like linux-chromeos-rel end up reaching this presandbox hook. #if BUILDFLAG(USE_VAAPI) VaapiWrapper::PreSandboxInitialization(); -#elif BUILDFLAG(USE_V4L2_CODEC) + + if (options.use_amd_specific_policies) { + const char* radeonsi_lib = "/usr/lib64/dri/radeonsi_dri.so"; +#if defined(DRI_DRIVER_DIR) + radeonsi_lib = DRI_DRIVER_DIR "/radeonsi_dri.so"; +#endif + if (nullptr == + dlopen(radeonsi_lib, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE)) { + LOG(ERROR) << "dlopen(radeonsi_dri.so) failed with error: " << dlerror(); + return false; + } + } +#elif BUILDFLAG(USE_LIBV4L2) dlopen("/usr/lib/libv4l2.so", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); #endif // BUILDFLAG(USE_VAAPI)
diff --git a/media/gpu/vaapi/fuzzers/jpeg_decoder/jpeg_decoder_fuzzertest.cc b/media/gpu/vaapi/fuzzers/jpeg_decoder/jpeg_decoder_fuzzertest.cc index 66c43dd..464fd67 100644 --- a/media/gpu/vaapi/fuzzers/jpeg_decoder/jpeg_decoder_fuzzertest.cc +++ b/media/gpu/vaapi/fuzzers/jpeg_decoder/jpeg_decoder_fuzzertest.cc
@@ -12,7 +12,6 @@ #include "base/callback_helpers.h" #include "base/cxx17_backports.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/numerics/safe_conversions.h" #include "media/gpu/vaapi/fuzzers/jpeg_decoder/jpeg_decoder_fuzzer_input.pb.h" #include "media/gpu/vaapi/vaapi_jpeg_decoder.h"
diff --git a/media/remoting/mock_receiver_controller.cc b/media/remoting/mock_receiver_controller.cc index 7ee23f8..ac34302 100644 --- a/media/remoting/mock_receiver_controller.cc +++ b/media/remoting/mock_receiver_controller.cc
@@ -5,6 +5,7 @@ #include "media/remoting/mock_receiver_controller.h" #include "base/check.h" +#include "base/no_destructor.h" #include "media/mojo/common/mojo_decoder_buffer_converter.h" #include "media/remoting/test_utils.h" #include "mojo/public/cpp/system/data_pipe.h"
diff --git a/media/remoting/receiver_controller.cc b/media/remoting/receiver_controller.cc index 0a7822db6..da8a909 100644 --- a/media/remoting/receiver_controller.cc +++ b/media/remoting/receiver_controller.cc
@@ -4,6 +4,7 @@ #include "media/remoting/receiver_controller.h" +#include "base/no_destructor.h" #include "base/task/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h"
diff --git a/media/video/fake_gpu_memory_buffer.cc b/media/video/fake_gpu_memory_buffer.cc index fbaae57..18e2a8cc 100644 --- a/media/video/fake_gpu_memory_buffer.cc +++ b/media/video/fake_gpu_memory_buffer.cc
@@ -5,7 +5,6 @@ #include "media/video/fake_gpu_memory_buffer.h" #include "base/atomic_sequence_num.h" -#include "base/no_destructor.h" #include "build/build_config.h" #include "media/base/format_utils.h" #include "media/base/video_frame.h"
diff --git a/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc b/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc index 6671974..9c98492 100644 --- a/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc +++ b/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc
@@ -29,7 +29,7 @@ // The VideoFrame-backing resources that are reused by the pool, namely, a // GpuMemoryBuffer and a per-plane SharedImage. This retains a reference to -// the InternalRefCountedPool that created it. +// the InternalRefCountedPool that created it. Not safe for concurrent use. class FrameResources { public: FrameResources(scoped_refptr<InternalRefCountedPool> pool, @@ -72,7 +72,13 @@ // The owner of the RenderableGpuMemoryBufferVideoFramePool::Client needs to be // reference counted to ensure that not be destroyed while there still exist any // FrameResources. -class InternalRefCountedPool : public base::RefCounted<InternalRefCountedPool> { +// Although this class is not generally safe for concurrent use, it extends +// RefCountedThreadSafe in order to allow destruction on a different thread. +// Specifically, blink::WebRtcVideoFrameAdapter::SharedResources lazily creates +// a RenderableGpuMemoryBufferVideoFramePool when it needs to convert a frame on +// the IO thread, but ends up destroying the object on the main thread. +class InternalRefCountedPool + : public base::RefCountedThreadSafe<InternalRefCountedPool> { public: explicit InternalRefCountedPool( std::unique_ptr<RenderableGpuMemoryBufferVideoFramePool::Context> @@ -95,7 +101,7 @@ RenderableGpuMemoryBufferVideoFramePool::Context* GetContext() const; private: - friend class base::RefCounted<InternalRefCountedPool>; + friend class base::RefCountedThreadSafe<InternalRefCountedPool>; ~InternalRefCountedPool(); // Callback made whe a created VideoFrame is destroyed. Returns
diff --git a/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc b/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc index 6491f16..95979460 100644 --- a/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc +++ b/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc
@@ -5,6 +5,8 @@ #include "media/video/renderable_gpu_memory_buffer_video_frame_pool.h" #include "base/memory/weak_ptr.h" +#include "base/task/thread_pool.h" +#include "base/test/bind.h" #include "base/test/task_environment.h" #include "media/base/video_frame.h" #include "media/video/fake_gpu_memory_buffer.h" @@ -167,6 +169,105 @@ EXPECT_FALSE(!!context); } +TEST(RenderableGpuMemoryBufferVideoFramePool, CrossThread) { + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + const gfx::Size size0(128, 256); + const gfx::ColorSpace color_space0 = gfx::ColorSpace::CreateREC709(); + + // Create a pool on the main thread. + auto pool = RenderableGpuMemoryBufferVideoFramePool::Create( + std::make_unique<FakeContext>()); + + base::ThreadPool::CreateSequencedTaskRunner({})->PostTaskAndReplyWithResult( + FROM_HERE, + // Create a frame on another thread. + base::BindLambdaForTesting( + [&]() { return pool->MaybeCreateVideoFrame(size0, color_space0); }), + // Destroy the video frame on the main thread. + base::BindLambdaForTesting( + [&](scoped_refptr<VideoFrame> video_frame0) {})); + task_environment.RunUntilIdle(); + + // Destroy the pool. + pool = nullptr; + task_environment.RunUntilIdle(); +} + +TEST(RenderableGpuMemoryBufferVideoFramePool, + VideoFramesDestroyedConcurrently) { + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + const gfx::BufferFormat format = gfx::BufferFormat::YUV_420_BIPLANAR; + const gfx::Size size0(128, 256); + const gfx::ColorSpace color_space0 = gfx::ColorSpace::CreateREC709(); + + // Create a pool and several frames on the main thread. + base::WeakPtr<FakeContext> context; + std::unique_ptr<RenderableGpuMemoryBufferVideoFramePool> pool; + { + auto context_strong = std::make_unique<FakeContext>(); + context = context_strong->GetWeakPtr(); + pool = RenderableGpuMemoryBufferVideoFramePool::Create( + std::move(context_strong)); + } + + std::vector<scoped_refptr<VideoFrame>> frames; + static constexpr int kNumFrames = 3; + for (int i = 0; i < kNumFrames; i++) { + EXPECT_CALL(*context, DoCreateGpuMemoryBuffer(size0, format)); + EXPECT_CALL(*context, + DoCreateSharedImage(_, gfx::BufferPlane::Y, _, _, _, _)); + EXPECT_CALL(*context, + DoCreateSharedImage(_, gfx::BufferPlane::UV, _, _, _, _)); + frames.emplace_back(pool->MaybeCreateVideoFrame(size0, color_space0)); + } + task_environment.RunUntilIdle(); + + // Expect all frames to be destroyed eventually. + EXPECT_CALL(*context, DestroySharedImage(_, _)).Times(kNumFrames * 2); + + // Destroy frames on separate threads. TSAN will tell us if there's a problem. + for (int i = 0; i < kNumFrames; i++) { + base::ThreadPool::CreateSequencedTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce([](scoped_refptr<VideoFrame> video_frame0) {}, + std::move(frames[i]))); + } + + pool.reset(); + task_environment.RunUntilIdle(); + EXPECT_FALSE(!!context); +} + +TEST(RenderableGpuMemoryBufferVideoFramePool, ConcurrentCreateDestroy) { + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + const gfx::Size size0(128, 256); + const gfx::ColorSpace color_space0 = gfx::ColorSpace::CreateREC709(); + + // Create a pool on the main thread. + auto pool = RenderableGpuMemoryBufferVideoFramePool::Create( + std::make_unique<FakeContext>()); + + // Create a frame on the main thread. + auto video_frame0 = pool->MaybeCreateVideoFrame(size0, color_space0); + task_environment.RunUntilIdle(); + + // Destroy the frame on another thread. TSAN will tell us if there's a + // problem. + base::ThreadPool::CreateSequencedTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce([](scoped_refptr<VideoFrame> video_frame0) {}, + std::move(video_frame0))); + + // Create another frame on the main thread. + auto video_frame1 = pool->MaybeCreateVideoFrame(size0, color_space0); + task_environment.RunUntilIdle(); + + video_frame1 = nullptr; + pool.reset(); + task_environment.RunUntilIdle(); +} + TEST(RenderableGpuMemoryBufferVideoFramePool, RespectSizeAndColorSpace) { base::test::SingleThreadTaskEnvironment task_environment; const gfx::BufferFormat format = gfx::BufferFormat::YUV_420_BIPLANAR;
diff --git a/mojo/core/mojo_core.cc b/mojo/core/mojo_core.cc index 9385582..e35f2fc 100644 --- a/mojo/core/mojo_core.cc +++ b/mojo/core/mojo_core.cc
@@ -12,6 +12,7 @@ #include "base/feature_list.h" #include "base/logging.h" #include "base/message_loop/message_pump_type.h" +#include "base/no_destructor.h" #include "base/rand_util.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread.h"
diff --git a/mojo/public/cpp/bindings/lib/message_quota_checker.cc b/mojo/public/cpp/bindings/lib/message_quota_checker.cc index dedb408..0d16ac9 100644 --- a/mojo/public/cpp/bindings/lib/message_quota_checker.cc +++ b/mojo/public/cpp/bindings/lib/message_quota_checker.cc
@@ -12,7 +12,6 @@ #include "base/debug/dump_without_crashing.h" #include "base/memory/scoped_refptr.h" #include "base/metrics/field_trial_params.h" -#include "base/no_destructor.h" #include "base/rand_util.h" #include "base/synchronization/lock.h" #include "base/types/pass_key.h"
diff --git a/mojo/public/cpp/bindings/lib/sync_handle_registry.cc b/mojo/public/cpp/bindings/lib/sync_handle_registry.cc index 215bac3..261554f 100644 --- a/mojo/public/cpp/bindings/lib/sync_handle_registry.cc +++ b/mojo/public/cpp/bindings/lib/sync_handle_registry.cc
@@ -12,7 +12,6 @@ #include "base/containers/contains.h" #include "base/containers/cxx20_erase.h" #include "base/memory/scoped_refptr.h" -#include "base/no_destructor.h" #include "base/threading/sequence_local_storage_slot.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/types/pass_key.h"
diff --git a/mojo/public/cpp/bindings/tests/new_endpoint_types_unittest.cc b/mojo/public/cpp/bindings/tests/new_endpoint_types_unittest.cc index 67634b4..9bbd7f19 100644 --- a/mojo/public/cpp/bindings/tests/new_endpoint_types_unittest.cc +++ b/mojo/public/cpp/bindings/tests/new_endpoint_types_unittest.cc
@@ -9,7 +9,6 @@ #include "base/bind.h" #include "base/callback_helpers.h" -#include "base/no_destructor.h" #include "base/run_loop.h" #include "base/test/task_environment.h" #include "mojo/public/cpp/bindings/associated_receiver.h"
diff --git a/mojo/public/cpp/bindings/tests/service_factory_unittest.cc b/mojo/public/cpp/bindings/tests/service_factory_unittest.cc index 0901498..e8056ad 100644 --- a/mojo/public/cpp/bindings/tests/service_factory_unittest.cc +++ b/mojo/public/cpp/bindings/tests/service_factory_unittest.cc
@@ -6,7 +6,6 @@ #include "base/callback.h" #include "base/callback_helpers.h" -#include "base/no_destructor.h" #include "base/run_loop.h" #include "base/test/bind.h" #include "base/test/task_environment.h"
diff --git a/net/android/radio_activity_tracker.cc b/net/android/radio_activity_tracker.cc index 4e886b1..0fe85a85 100644 --- a/net/android/radio_activity_tracker.cc +++ b/net/android/radio_activity_tracker.cc
@@ -6,6 +6,7 @@ #include "base/feature_list.h" #include "base/metrics/histogram_functions.h" +#include "base/no_destructor.h" #include "net/base/features.h" #include "net/traffic_annotation/network_traffic_annotation.h"
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index 8a3ef9a..6cb49c1 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc
@@ -4641,7 +4641,7 @@ disk_cache::Entry* alt_entry; ASSERT_THAT(CreateEntry(keys[0], &alt_entry), IsOk()); - // One more file closure here to accomodate for alt_entry. + // One more file closure here to accommodate for alt_entry. histogram_tester.ExpectBucketCount("SimpleCache.FileDescriptorLimiterAction", disk_cache::FD_LIMIT_CLOSE_FILE, kLargeNumEntries - 64 + 1);
diff --git a/net/dns/context_host_resolver.cc b/net/dns/context_host_resolver.cc index 14d716b..5fc8257 100644 --- a/net/dns/context_host_resolver.cc +++ b/net/dns/context_host_resolver.cc
@@ -9,7 +9,6 @@ #include <vector> #include "base/check_op.h" -#include "base/no_destructor.h" #include "base/strings/string_piece.h" #include "base/time/tick_clock.h" #include "net/base/net_errors.h"
diff --git a/net/dns/host_cache.cc b/net/dns/host_cache.cc index 15958b7..123208b 100644 --- a/net/dns/host_cache.cc +++ b/net/dns/host_cache.cc
@@ -13,7 +13,6 @@ #include "base/check_op.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/numerics/safe_conversions.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h"
diff --git a/net/http/http_stream_factory_job.h b/net/http/http_stream_factory_job.h index dc94a8d..63bfb428 100644 --- a/net/http/http_stream_factory_job.h +++ b/net/http/http_stream_factory_job.h
@@ -248,12 +248,8 @@ STATE_WAITING_USER_ACTION, STATE_CREATE_STREAM, STATE_CREATE_STREAM_COMPLETE, - STATE_DRAIN_BODY_FOR_AUTH_RESTART, - STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE, STATE_DONE, STATE_NONE, - // Used for UMA. - STATE_MAX, }; void OnStreamReadyCallback();
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc index b3b3820..d3d8e9da0 100644 --- a/net/spdy/spdy_http_stream.cc +++ b/net/spdy/spdy_http_stream.cc
@@ -13,7 +13,6 @@ #include "base/check_op.h" #include "base/location.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/task/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "base/values.h"
diff --git a/net/ssl/ssl_key_logger.cc b/net/ssl/ssl_key_logger.cc index ef16e81..2173a82 100644 --- a/net/ssl/ssl_key_logger.cc +++ b/net/ssl/ssl_key_logger.cc
@@ -5,6 +5,7 @@ #include "net/ssl/ssl_key_logger.h" #include "base/check.h" +#include "base/no_destructor.h" namespace net {
diff --git a/net/websockets/websocket_http2_handshake_stream.cc b/net/websockets/websocket_http2_handshake_stream.cc index 407e2fbd..f2be257 100644 --- a/net/websockets/websocket_http2_handshake_stream.cc +++ b/net/websockets/websocket_http2_handshake_stream.cc
@@ -9,7 +9,6 @@ #include "base/bind.h" #include "base/check_op.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/strings/stringprintf.h" #include "base/time/time.h"
diff --git a/remoting/base/file_host_settings.cc b/remoting/base/file_host_settings.cc index e063116a..3fb86d4 100644 --- a/remoting/base/file_host_settings.cc +++ b/remoting/base/file_host_settings.cc
@@ -9,7 +9,6 @@ #include "base/json/json_file_value_serializer.h" #include "base/json/json_string_value_serializer.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/values.h" #include "remoting/base/logging.h"
diff --git a/remoting/client/input/keycode_map.cc b/remoting/client/input/keycode_map.cc index 9dc665a..9ea3173 100644 --- a/remoting/client/input/keycode_map.cc +++ b/remoting/client/input/keycode_map.cc
@@ -9,7 +9,6 @@ #include <ostream> #include "base/check.h" -#include "base/no_destructor.h" namespace remoting {
diff --git a/remoting/host/file_transfer/file_chooser_main_win.cc b/remoting/host/file_transfer/file_chooser_main_win.cc index 6040e61e..fe8c453 100644 --- a/remoting/host/file_transfer/file_chooser_main_win.cc +++ b/remoting/host/file_transfer/file_chooser_main_win.cc
@@ -13,7 +13,6 @@ #include "base/files/file_path.h" #include "base/logging.h" #include "base/memory/scoped_refptr.h" -#include "base/no_destructor.h" #include "base/pickle.h" #include "base/run_loop.h" #include "base/task/thread_pool/thread_pool_instance.h"
diff --git a/remoting/host/keyboard_layout_monitor_win.cc b/remoting/host/keyboard_layout_monitor_win.cc index 47d7f73..a48fb5b 100644 --- a/remoting/host/keyboard_layout_monitor_win.cc +++ b/remoting/host/keyboard_layout_monitor_win.cc
@@ -17,7 +17,6 @@ #include "base/cxx17_backports.h" #include "base/memory/ptr_util.h" #include "base/memory/weak_ptr.h" -#include "base/no_destructor.h" #include "base/strings/utf_string_conversions.h" #include "base/task/post_task.h" #include "base/task/single_thread_task_runner.h"
diff --git a/remoting/host/mac/host_service_main.cc b/remoting/host/mac/host_service_main.cc index 8a59c78..c585580d 100644 --- a/remoting/host/mac/host_service_main.cc +++ b/remoting/host/mac/host_service_main.cc
@@ -15,7 +15,6 @@ #include "base/files/file_util.h" #include "base/logging.h" #include "base/mac/mac_util.h" -#include "base/no_destructor.h" #include "base/path_service.h" #include "base/process/launch.h" #include "base/process/process.h"
diff --git a/remoting/host/mojo_ipc/mojo_ipc_server_unittest.cc b/remoting/host/mojo_ipc/mojo_ipc_server_unittest.cc index fcd793b3..78e4e274 100644 --- a/remoting/host/mojo_ipc/mojo_ipc_server_unittest.cc +++ b/remoting/host/mojo_ipc/mojo_ipc_server_unittest.cc
@@ -10,7 +10,6 @@ #include "base/bind.h" #include "base/callback.h" #include "base/callback_helpers.h" -#include "base/no_destructor.h" #include "base/process/process_handle.h" #include "base/run_loop.h" #include "base/test/bind.h"
diff --git a/remoting/host/remote_open_url/remote_open_url_constants.cc b/remoting/host/remote_open_url/remote_open_url_constants.cc index 6ee675b..b32b7d1 100644 --- a/remoting/host/remote_open_url/remote_open_url_constants.cc +++ b/remoting/host/remote_open_url/remote_open_url_constants.cc
@@ -4,7 +4,6 @@ #include "remoting/host/remote_open_url/remote_open_url_constants.h" -#include "base/no_destructor.h" #include "build/build_config.h" namespace remoting {
diff --git a/remoting/host/remote_open_url/url_forwarder_configurator_win.cc b/remoting/host/remote_open_url/url_forwarder_configurator_win.cc index 927070719..12686a1 100644 --- a/remoting/host/remote_open_url/url_forwarder_configurator_win.cc +++ b/remoting/host/remote_open_url/url_forwarder_configurator_win.cc
@@ -15,7 +15,6 @@ #include "base/files/file_path.h" #include "base/location.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/path_service.h" #include "base/process/launch.h"
diff --git a/remoting/ios/app/notification_presenter.mm b/remoting/ios/app/notification_presenter.mm index 6b6f0348..ff3abb8c 100644 --- a/remoting/ios/app/notification_presenter.mm +++ b/remoting/ios/app/notification_presenter.mm
@@ -12,6 +12,7 @@ #import "remoting/ios/persistence/remoting_preferences.h" #include "base/bind.h" #include "base/check_op.h" +#include "base/no_destructor.h" #include "base/strings/sys_string_conversions.h" #include "base/threading/sequenced_task_runner_handle.h" #include "remoting/base/string_resources.h"
diff --git a/remoting/ios/facade/host_list_service.mm b/remoting/ios/facade/host_list_service.mm index 13c87f6..70c275f5 100644 --- a/remoting/ios/facade/host_list_service.mm +++ b/remoting/ios/facade/host_list_service.mm
@@ -18,6 +18,7 @@ #include "base/bind.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "remoting/base/directory_service_client.h" #include "remoting/base/protobuf_http_status.h" #include "remoting/base/string_resources.h"
diff --git a/services/cert_verifier/cert_verifier_service_unittest.cc b/services/cert_verifier/cert_verifier_service_unittest.cc index 419ddf0..1a6f0c17 100644 --- a/services/cert_verifier/cert_verifier_service_unittest.cc +++ b/services/cert_verifier/cert_verifier_service_unittest.cc
@@ -15,7 +15,6 @@ #include "base/memory/ptr_util.h" #include "base/memory/raw_ptr.h" #include "base/memory/scoped_refptr.h" -#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "base/test/bind.h" #include "base/test/task_environment.h"
diff --git a/services/network/cors/preflight_controller.cc b/services/network/cors/preflight_controller.cc index a3e76ea..8943c08 100644 --- a/services/network/cors/preflight_controller.cc +++ b/services/network/cors/preflight_controller.cc
@@ -11,7 +11,6 @@ #include "base/memory/raw_ptr.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "base/unguessable_token.h" #include "net/base/load_flags.h"
diff --git a/services/network/public/cpp/corb/corb_impl.cc b/services/network/public/cpp/corb/corb_impl.cc index 321e407..38a9366 100644 --- a/services/network/public/cpp/corb/corb_impl.cc +++ b/services/network/public/cpp/corb/corb_impl.cc
@@ -19,7 +19,6 @@ #include "base/feature_list.h" #include "base/lazy_instance.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h"
diff --git a/services/network/public/cpp/cors/cors.cc b/services/network/public/cpp/cors/cors.cc index af768dd..1279e1bab 100644 --- a/services/network/public/cpp/cors/cors.cc +++ b/services/network/public/cpp/cors/cors.cc
@@ -12,7 +12,6 @@ #include "base/containers/contains.h" #include "base/containers/fixed_flat_set.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" #include "net/base/mime_util.h"
diff --git a/services/network/public/cpp/initiator_lock_compatibility.cc b/services/network/public/cpp/initiator_lock_compatibility.cc index 9a720b7..920efec 100644 --- a/services/network/public/cpp/initiator_lock_compatibility.cc +++ b/services/network/public/cpp/initiator_lock_compatibility.cc
@@ -7,7 +7,6 @@ #include <string> #include "base/containers/flat_set.h" -#include "base/no_destructor.h" #include "base/stl_util.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "services/network/public/cpp/resource_request.h"
diff --git a/services/network/throttling/throttling_controller.cc b/services/network/throttling/throttling_controller.cc index 176e45b..b232e12 100644 --- a/services/network/throttling/throttling_controller.cc +++ b/services/network/throttling/throttling_controller.cc
@@ -4,6 +4,7 @@ #include "services/network/throttling/throttling_controller.h" +#include "base/no_destructor.h" #include "net/http/http_request_info.h" #include "services/network/throttling/network_conditions.h" #include "services/network/throttling/scoped_throttling_token.h"
diff --git a/services/network/trust_tokens/trust_token_key_commitment_controller_unittest.cc b/services/network/trust_tokens/trust_token_key_commitment_controller_unittest.cc index 19aedd9..4d69758 100644 --- a/services/network/trust_tokens/trust_token_key_commitment_controller_unittest.cc +++ b/services/network/trust_tokens/trust_token_key_commitment_controller_unittest.cc
@@ -8,7 +8,6 @@ #include <utility> #include "base/bind.h" -#include "base/no_destructor.h" #include "base/test/bind.h" #include "base/test/task_environment.h" #include "net/base/load_flags.h"
diff --git a/services/network/trust_tokens/trust_token_key_commitment_parser_unittest.cc b/services/network/trust_tokens/trust_token_key_commitment_parser_unittest.cc index 0f14bfc8..6a684c3 100644 --- a/services/network/trust_tokens/trust_token_key_commitment_parser_unittest.cc +++ b/services/network/trust_tokens/trust_token_key_commitment_parser_unittest.cc
@@ -6,7 +6,6 @@ #include "base/base64.h" #include "base/json/json_reader.h" -#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/test/bind.h"
diff --git a/services/network/trust_tokens/trust_token_request_helper_factory_unittest.cc b/services/network/trust_tokens/trust_token_request_helper_factory_unittest.cc index ea4868e..198a1fcc 100644 --- a/services/network/trust_tokens/trust_token_request_helper_factory_unittest.cc +++ b/services/network/trust_tokens/trust_token_request_helper_factory_unittest.cc
@@ -4,6 +4,7 @@ #include "services/network/trust_tokens/trust_token_request_helper_factory.h" +#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/test/bind.h" #include "base/test/metrics/histogram_tester.h"
diff --git a/services/network/trust_tokens/trust_token_request_signing_helper.cc b/services/network/trust_tokens/trust_token_request_signing_helper.cc index 6be69370..69a2db32 100644 --- a/services/network/trust_tokens/trust_token_request_signing_helper.cc +++ b/services/network/trust_tokens/trust_token_request_signing_helper.cc
@@ -11,6 +11,7 @@ #include "base/base64.h" #include "base/containers/flat_set.h" #include "base/ignore_result.h" +#include "base/no_destructor.h" #include "base/ranges/algorithm.h" #include "base/strings/strcat.h" #include "base/strings/string_split.h"
diff --git a/services/network/url_loader_unittest.cc b/services/network/url_loader_unittest.cc index 9876350..6c4d8d4 100644 --- a/services/network/url_loader_unittest.cc +++ b/services/network/url_loader_unittest.cc
@@ -22,6 +22,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/metrics/statistics_recorder.h" +#include "base/no_destructor.h" #include "base/path_service.h" #include "base/run_loop.h" #include "base/strings/strcat.h"
diff --git a/services/proxy_resolver_win/winhttp_proxy_resolver_functions.cc b/services/proxy_resolver_win/winhttp_proxy_resolver_functions.cc index 3cfbf56..1f9a324c 100644 --- a/services/proxy_resolver_win/winhttp_proxy_resolver_functions.cc +++ b/services/proxy_resolver_win/winhttp_proxy_resolver_functions.cc
@@ -4,6 +4,8 @@ #include "services/proxy_resolver_win/winhttp_proxy_resolver_functions.h" +#include "base/no_destructor.h" + namespace proxy_resolver_win { WinHttpProxyResolverFunctions::WinHttpProxyResolverFunctions() {
diff --git a/services/service_manager/public/cpp/service_receiver.cc b/services/service_manager/public/cpp/service_receiver.cc index 2f31ac55..4f4ca6ed 100644 --- a/services/service_manager/public/cpp/service_receiver.cc +++ b/services/service_manager/public/cpp/service_receiver.cc
@@ -7,7 +7,6 @@ #include <utility> #include "base/bind.h" -#include "base/no_destructor.h" #include "base/synchronization/lock.h" #include "mojo/public/cpp/bindings/remote.h" #include "services/service_manager/public/cpp/service.h"
diff --git a/services/tracing/perfetto/consumer_host_unittest.cc b/services/tracing/perfetto/consumer_host_unittest.cc index ca1b966..ad469a2 100644 --- a/services/tracing/perfetto/consumer_host_unittest.cc +++ b/services/tracing/perfetto/consumer_host_unittest.cc
@@ -298,11 +298,15 @@ bool tracing_enabled_ = false; }; +// TODO(crbug.com/1006541): Switch this to use TracingUnitTest. class TracingConsumerTest : public testing::Test, public mojo::DataPipeDrainer::Client { public: void SetUp() override { task_environment_ = std::make_unique<base::test::TaskEnvironment>(); + tracing_environment_ = std::make_unique<base::test::TracingEnvironment>( + *task_environment_, base::ThreadTaskRunnerHandle::Get(), + PerfettoTracedProcess::Get()->perfetto_platform_for_testing()); test_handle_ = tracing::PerfettoTracedProcess::SetupForTesting(); PerfettoTracedProcess::Get()->ClearDataSourcesForTesting(); threaded_service_ = std::make_unique<ThreadedPerfettoService>(); @@ -312,6 +316,7 @@ } void TearDown() override { + tracing_environment_.reset(); threaded_service_.reset(); task_environment_->RunUntilIdle(); test_handle_.reset(); @@ -440,6 +445,7 @@ private: std::unique_ptr<ThreadedPerfettoService> threaded_service_; std::unique_ptr<base::test::TaskEnvironment> task_environment_; + std::unique_ptr<base::test::TracingEnvironment> tracing_environment_; std::unique_ptr<PerfettoTracedProcess::TestHandle> test_handle_; base::OnceClosure on_data_complete_; std::unique_ptr<mojo::DataPipeDrainer> drainer_;
diff --git a/services/tracing/public/cpp/perfetto/java_heap_profiler/java_heap_profiler_android.cc b/services/tracing/public/cpp/perfetto/java_heap_profiler/java_heap_profiler_android.cc index 211dd97..59ace213 100644 --- a/services/tracing/public/cpp/perfetto/java_heap_profiler/java_heap_profiler_android.cc +++ b/services/tracing/public/cpp/perfetto/java_heap_profiler/java_heap_profiler_android.cc
@@ -6,6 +6,7 @@ #include "base/android/java_heap_dump_generator.h" #include "base/files/scoped_temp_dir.h" +#include "base/no_destructor.h" #include "services/tracing/public/cpp/perfetto/java_heap_profiler/hprof_parser_android.h" #include "services/tracing/public/cpp/perfetto/perfetto_traced_process.h"
diff --git a/services/tracing/public/cpp/perfetto/producer_client.cc b/services/tracing/public/cpp/perfetto/producer_client.cc index 838ec11..635d688 100644 --- a/services/tracing/public/cpp/perfetto/producer_client.cc +++ b/services/tracing/public/cpp/perfetto/producer_client.cc
@@ -8,7 +8,6 @@ #include "base/bind.h" #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "base/process/process.h" #include "base/task/post_task.h" #include "base/tracing/tracing_tls.h"
diff --git a/services/tracing/public/cpp/perfetto/producer_client.h b/services/tracing/public/cpp/perfetto/producer_client.h index d8be9ed..f9998d1a 100644 --- a/services/tracing/public/cpp/perfetto/producer_client.h +++ b/services/tracing/public/cpp/perfetto/producer_client.h
@@ -16,6 +16,7 @@ #include "base/component_export.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" +#include "base/no_destructor.h" #include "base/sequence_checker.h" #include "base/synchronization/lock.h" #include "base/tracing/perfetto_task_runner.h"
diff --git a/services/tracing/public/cpp/perfetto/trace_event_data_source.h b/services/tracing/public/cpp/perfetto/trace_event_data_source.h index 4c4a680..07bf619b 100644 --- a/services/tracing/public/cpp/perfetto/trace_event_data_source.h +++ b/services/tracing/public/cpp/perfetto/trace_event_data_source.h
@@ -16,6 +16,7 @@ #include "base/metrics/histogram_base.h" #include "base/metrics/statistics_recorder.h" #include "base/metrics/user_metrics.h" +#include "base/no_destructor.h" #include "base/sequence_checker.h" #include "base/thread_annotations.h" #include "base/threading/thread_local.h"
diff --git a/services/tracing/public/cpp/stack_sampling/reached_code_data_source_android.cc b/services/tracing/public/cpp/stack_sampling/reached_code_data_source_android.cc index f947f5f..01e0b1d 100644 --- a/services/tracing/public/cpp/stack_sampling/reached_code_data_source_android.cc +++ b/services/tracing/public/cpp/stack_sampling/reached_code_data_source_android.cc
@@ -10,6 +10,7 @@ #include "base/android/reached_addresses_bitset.h" #include "base/android/reached_code_profiler.h" #include "base/debug/elf_reader.h" +#include "base/no_destructor.h" #include "base/strings/string_piece.h" #include "services/tracing/public/cpp/perfetto/perfetto_producer.h" #include "services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.h"
diff --git a/services/tracing/public/cpp/system_tracing_service.cc b/services/tracing/public/cpp/system_tracing_service.cc index f04c290..a69b2f768 100644 --- a/services/tracing/public/cpp/system_tracing_service.cc +++ b/services/tracing/public/cpp/system_tracing_service.cc
@@ -12,7 +12,6 @@ #include "base/bind.h" #include "base/check.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/tracing/public/cpp/perfetto/perfetto_traced_process.h"
diff --git a/testing/buildbot/filters/android.emulator_p.chrome_public_test_apk.filter b/testing/buildbot/filters/android.emulator_p.chrome_public_test_apk.filter index 0f75c2c..20a723b4 100644 --- a/testing/buildbot/filters/android.emulator_p.chrome_public_test_apk.filter +++ b/testing/buildbot/filters/android.emulator_p.chrome_public_test_apk.filter
@@ -124,27 +124,3 @@ # crbug.com/1187536 -org.chromium.chrome.browser.customtabs.CustomTabExternalNavigationTest.testIntentPickerNotShownForNormalUrl - -# crbug.com/1272997 --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantFormActionTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantChromeTabIntegrationTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantTriggerScriptIntegrationTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantBackButtonIntegrationTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantCollectUserDataIntegrationTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantGenericUiTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantChromeTabIntegrationTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantNavigationIntegrationTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantInterruptIntegrationTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantPersonalDataManagerTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantInputActionIntegrationTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantOverlayIntegrationTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantBottomsheetTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantKeyboardIntegrationTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUpdateClientSettingsIntegrationTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantTtsIntegrationTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantAutostartTest* --org.chromium.chrome.browser.autofill_assistant.AutofillAssistantPasswordManagerIntegrationTest* - - - -
diff --git a/testing/buildbot/filters/chromeos.msan.browser_tests.oobe_negative.filter b/testing/buildbot/filters/chromeos.msan.browser_tests.oobe_negative.filter index 3f112df..7eecb612 100644 --- a/testing/buildbot/filters/chromeos.msan.browser_tests.oobe_negative.filter +++ b/testing/buildbot/filters/chromeos.msan.browser_tests.oobe_negative.filter
@@ -139,7 +139,6 @@ -SigninToUserProfileSwitchTest.* -SiteIsolationFlagHandlingTest.* -StartupBrowserWindowLaunchSuppressedTest.* --SyncConsentOptionalTest.* -SyncConsentRecorderTest.* -SyncConsentTest.* -SyncConsentTimezoneOverride.*
diff --git a/testing/buildbot/filters/chromeos.msan.browser_tests.oobe_positive.filter b/testing/buildbot/filters/chromeos.msan.browser_tests.oobe_positive.filter index 6ccab6e..8c5b7450 100644 --- a/testing/buildbot/filters/chromeos.msan.browser_tests.oobe_positive.filter +++ b/testing/buildbot/filters/chromeos.msan.browser_tests.oobe_positive.filter
@@ -139,7 +139,6 @@ SigninToUserProfileSwitchTest.* SiteIsolationFlagHandlingTest.* StartupBrowserWindowLaunchSuppressedTest.* -SyncConsentOptionalTest.* SyncConsentRecorderTest.* SyncConsentTest.* SyncConsentTimezoneOverride.*
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 10a4413..a31f4800 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -4820,21 +4820,6 @@ ] } ], - "LightweightReactions": [ - { - "platforms": [ - "android" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "LightweightReactions" - ] - } - ] - } - ], "LiteVideo": [ { "platforms": [
diff --git a/third_party/abseil-cpp/CMake/AbseilHelpers.cmake b/third_party/abseil-cpp/CMake/AbseilHelpers.cmake index 17c4f449..9ad2627d 100644 --- a/third_party/abseil-cpp/CMake/AbseilHelpers.cmake +++ b/third_party/abseil-cpp/CMake/AbseilHelpers.cmake
@@ -40,7 +40,8 @@ # LINKOPTS: List of link options # PUBLIC: Add this so that this library will be exported under absl:: # Also in IDE, target will appear in Abseil folder while non PUBLIC will be in Abseil/internal. -# TESTONLY: When added, this target will only be built if BUILD_TESTING=ON. +# TESTONLY: When added, this target will only be built if both +# BUILD_TESTING=ON and ABSL_BUILD_TESTING=ON. # # Note: # By default, absl_cc_library will always create a library named absl_${NAME}, @@ -82,7 +83,7 @@ ${ARGN} ) - if(ABSL_CC_LIB_TESTONLY AND NOT BUILD_TESTING) + if(ABSL_CC_LIB_TESTONLY AND NOT (BUILD_TESTING AND ABSL_BUILD_TESTING)) return() endif() @@ -364,7 +365,7 @@ # GTest::gtest_main # ) function(absl_cc_test) - if(NOT BUILD_TESTING) + if(NOT (BUILD_TESTING AND ABSL_BUILD_TESTING)) return() endif()
diff --git a/third_party/abseil-cpp/CMake/README.md b/third_party/abseil-cpp/CMake/README.md index f8b27e63f..8134615 100644 --- a/third_party/abseil-cpp/CMake/README.md +++ b/third_party/abseil-cpp/CMake/README.md
@@ -20,8 +20,10 @@ ### Step-by-Step Instructions 1. If you want to build the Abseil tests, integrate the Abseil dependency -[Google Test](https://github.com/google/googletest) into your CMake project. To disable Abseil tests, you have to pass -`-DBUILD_TESTING=OFF` when configuring your project with CMake. +[Google Test](https://github.com/google/googletest) into your CMake +project. To disable Abseil tests, you have to pass either +`-DBUILD_TESTING=OFF` or `-DABSL_BUILD_TESTING=OFF` when configuring your +project with CMake. 2. Download Abseil and copy it into a subdirectory in your CMake project or add Abseil as a [git submodule](https://git-scm.com/docs/git-submodule) in your @@ -91,7 +93,8 @@ ### Running Abseil Tests with CMake -Use the `-DBUILD_TESTING=ON` flag to run Abseil tests. +Use the `-DABSL_BUILD_TESTING=ON` flag to run Abseil tests. Note that +BUILD_TESTING must also be on (the default). You will need to provide Abseil with a Googletest dependency. There are two options for how to do this: @@ -109,7 +112,7 @@ cd path/to/abseil-cpp mkdir build cd build -cmake -DBUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON .. +cmake -DABSL_BUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON .. make -j ctest ``` @@ -175,7 +178,7 @@ ## Google Test Options -`-DBUILD_TESTING=ON` must be set to enable testing +`-DABSL_BUILD_TESTING=ON` must be set to enable testing - Have Abseil download and build Google Test for you: `-DABSL_USE_EXTERNAL_GOOGLETEST=OFF` (default) - Download and build latest Google Test: `-DABSL_USE_GOOGLETEST_HEAD=ON`
diff --git a/third_party/abseil-cpp/CMake/install_test_project/test.sh b/third_party/abseil-cpp/CMake/install_test_project/test.sh index aecbb8f..cc028ba 100755 --- a/third_party/abseil-cpp/CMake/install_test_project/test.sh +++ b/third_party/abseil-cpp/CMake/install_test_project/test.sh
@@ -55,7 +55,7 @@ -DABSL_USE_EXTERNAL_GOOGLETEST=ON \ -DABSL_FIND_GOOGLETEST=ON \ -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_TESTING=ON \ + -DABSL_BUILD_TESTING=ON \ -DBUILD_SHARED_LIBS="${build_shared_libs}" make -j $(nproc) ctest -j $(nproc) --output-on-failure
diff --git a/third_party/abseil-cpp/CMakeLists.txt b/third_party/abseil-cpp/CMakeLists.txt index a1400b7..ff49ac1 100644 --- a/third_party/abseil-cpp/CMakeLists.txt +++ b/third_party/abseil-cpp/CMakeLists.txt
@@ -46,10 +46,6 @@ cmake_policy(SET CMP0091 NEW) endif (POLICY CMP0091) -# Set BUILD_TESTING to OFF by default. -# This must come before the project() and include(CTest) lines. -OPTION(BUILD_TESTING "Build tests" OFF) - project(absl LANGUAGES CXX) include(CTest) @@ -111,6 +107,9 @@ include(CMakeDependentOption) +option(ABSL_BUILD_TESTING + "If ON, Abseil will build all of Abseil's own tests." OFF) + option(ABSL_USE_EXTERNAL_GOOGLETEST "If ON, Abseil will assume that the targets for GoogleTest are already provided by the including project. This makes sense when Abseil is used with add_subproject." OFF) @@ -130,7 +129,7 @@ "If ABSL_USE_GOOGLETEST_HEAD is OFF and ABSL_GOOGLETEST_URL is not set, specifies the directory of a local GoogleTest checkout." ) -if(BUILD_TESTING) +if(BUILD_TESTING AND ABSL_BUILD_TESTING) ## check targets if (ABSL_USE_EXTERNAL_GOOGLETEST) if (ABSL_FIND_GOOGLETEST)
diff --git a/third_party/abseil-cpp/README.chromium b/third_party/abseil-cpp/README.chromium index 60774f6..f8a5720 100644 --- a/third_party/abseil-cpp/README.chromium +++ b/third_party/abseil-cpp/README.chromium
@@ -4,7 +4,7 @@ License: Apache 2.0 License File: LICENSE Version: 0 -Revision: 9336be04a242237cd41a525bedfcf3be1bb55377 +Revision: 1065514ef332d036f3437e950e78d35ce6b7c740 Security Critical: yes Description:
diff --git a/third_party/abseil-cpp/absl/base/config.h b/third_party/abseil-cpp/absl/base/config.h index c29b206..373aa0c 100644 --- a/third_party/abseil-cpp/absl/base/config.h +++ b/third_party/abseil-cpp/absl/base/config.h
@@ -751,8 +751,6 @@ // a compiler instrumentation module and a run-time library. #ifdef ABSL_HAVE_MEMORY_SANITIZER #error "ABSL_HAVE_MEMORY_SANITIZER cannot be directly set." -#elif defined(__SANITIZE_MEMORY__) -#define ABSL_HAVE_MEMORY_SANITIZER 1 #elif !defined(__native_client__) && ABSL_HAVE_FEATURE(memory_sanitizer) #define ABSL_HAVE_MEMORY_SANITIZER 1 #endif @@ -779,6 +777,28 @@ #define ABSL_HAVE_ADDRESS_SANITIZER 1 #endif +// ABSL_HAVE_HWADDRESS_SANITIZER +// +// Hardware-Assisted AddressSanitizer (or HWASAN) is even faster than asan +// memory error detector which can use CPU features like ARM TBI, Intel LAM or +// AMD UAI. +#ifdef ABSL_HAVE_HWADDRESS_SANITIZER +#error "ABSL_HAVE_HWADDRESS_SANITIZER cannot be directly set." +#elif defined(__SANITIZE_HWADDRESS__) +#define ABSL_HAVE_HWADDRESS_SANITIZER 1 +#elif ABSL_HAVE_FEATURE(hwaddress_sanitizer) +#define ABSL_HAVE_HWADDRESS_SANITIZER 1 +#endif + +// ABSL_HAVE_LEAK_SANITIZER +// +// LeakSanitizer (or lsan) is a detector of memory leaks. +#ifdef ABSL_HAVE_LEAK_SANITIZER +#error "ABSL_HAVE_LEAK_SANITIZER cannot be directly set." +#elif ABSL_HAVE_FEATURE(leak_sanitizer) +#define ABSL_HAVE_LEAK_SANITIZER 1 +#endif + // ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION // // Class template argument deduction is a language feature added in C++17.
diff --git a/third_party/abseil-cpp/absl/base/internal/direct_mmap.h b/third_party/abseil-cpp/absl/base/internal/direct_mmap.h index 274054c..7037094 100644 --- a/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +++ b/third_party/abseil-cpp/absl/base/internal/direct_mmap.h
@@ -80,7 +80,7 @@ (defined(__PPC__) && !defined(__PPC64__)) || \ (defined(__riscv) && __riscv_xlen == 32) || \ (defined(__s390__) && !defined(__s390x__)) || \ - (defined(__sparc__) && !defined(__arch64__)) + (defined(__sparc__) && !defined(__aarch64__)) // On these architectures, implement mmap with mmap2. static int pagesize = 0; if (pagesize == 0) {
diff --git a/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h b/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h index d4b72ab1..ad12f41 100644 --- a/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +++ b/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
@@ -201,7 +201,7 @@ template <typename T> uint32_t TrailingZeros(T x) { ABSL_INTERNAL_ASSUME(x != 0); - return countr_zero(x); + return static_cast<uint32_t>(countr_zero(x)); } // An abstraction over a bitmask. It provides an easy way to iterate through the @@ -230,7 +230,7 @@ return *this; } explicit operator bool() const { return mask_ != 0; } - int operator*() const { return LowestBitSet(); } + uint32_t operator*() const { return LowestBitSet(); } uint32_t LowestBitSet() const { return container_internal::TrailingZeros(mask_) >> Shift; } @@ -248,7 +248,7 @@ uint32_t LeadingZeros() const { constexpr int total_significant_bits = SignificantBits << Shift; constexpr int extra_bits = sizeof(T) * 8 - total_significant_bits; - return countl_zero(mask_ << extra_bits) >> Shift; + return static_cast<uint32_t>(countl_zero(mask_ << extra_bits)) >> Shift; } private: @@ -360,7 +360,7 @@ BitMask<uint32_t, kWidth> Match(h2_t hash) const { auto match = _mm_set1_epi8(hash); return BitMask<uint32_t, kWidth>( - _mm_movemask_epi8(_mm_cmpeq_epi8(match, ctrl))); + static_cast<uint32_t>(_mm_movemask_epi8(_mm_cmpeq_epi8(match, ctrl)))); } // Returns a bitmask representing the positions of empty slots. @@ -368,7 +368,7 @@ #if ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 // This only works because ctrl_t::kEmpty is -128. return BitMask<uint32_t, kWidth>( - _mm_movemask_epi8(_mm_sign_epi8(ctrl, ctrl))); + static_cast<uint32_t>(_mm_movemask_epi8(_mm_sign_epi8(ctrl, ctrl)))); #else return Match(static_cast<h2_t>(ctrl_t::kEmpty)); #endif @@ -376,14 +376,15 @@ // Returns a bitmask representing the positions of empty or deleted slots. BitMask<uint32_t, kWidth> MatchEmptyOrDeleted() const { - auto special = _mm_set1_epi8(static_cast<int8_t>(ctrl_t::kSentinel)); + auto special = _mm_set1_epi8(static_cast<uint8_t>(ctrl_t::kSentinel)); return BitMask<uint32_t, kWidth>( - _mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl))); + static_cast<uint32_t>( + _mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl)))); } // Returns the number of trailing empty or deleted elements in the group. uint32_t CountLeadingEmptyOrDeleted() const { - auto special = _mm_set1_epi8(static_cast<int8_t>(ctrl_t::kSentinel)); + auto special = _mm_set1_epi8(static_cast<uint8_t>(ctrl_t::kSentinel)); return TrailingZeros(static_cast<uint32_t>( _mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl)) + 1)); } @@ -1465,7 +1466,7 @@ auto seq = probe(ctrl_, hash, capacity_); while (true) { Group g{ctrl_ + seq.offset()}; - for (int i : g.Match(H2(hash))) { + for (uint32_t i : g.Match(H2(hash))) { if (ABSL_PREDICT_TRUE(PolicyTraits::apply( EqualElement<K>{key, eq_ref()}, PolicyTraits::element(slots_ + seq.offset(i))))) @@ -1610,7 +1611,7 @@ void erase_meta_only(const_iterator it) { assert(IsFull(*it.inner_.ctrl_) && "erasing a dangling iterator"); --size_; - const size_t index = it.inner_.ctrl_ - ctrl_; + const size_t index = static_cast<size_t>(it.inner_.ctrl_ - ctrl_); const size_t index_before = (index - Group::kWidth) & capacity_; const auto empty_after = Group(it.inner_.ctrl_).MatchEmpty(); const auto empty_before = Group(ctrl_ + index_before).MatchEmpty(); @@ -1832,7 +1833,7 @@ auto seq = probe(ctrl_, hash, capacity_); while (true) { Group g{ctrl_ + seq.offset()}; - for (int i : g.Match(H2(hash))) { + for (uint32_t i : g.Match(H2(hash))) { if (ABSL_PREDICT_TRUE(PolicyTraits::element(slots_ + seq.offset(i)) == elem)) return true; @@ -1864,7 +1865,7 @@ auto seq = probe(ctrl_, hash, capacity_); while (true) { Group g{ctrl_ + seq.offset()}; - for (int i : g.Match(H2(hash))) { + for (uint32_t i : g.Match(H2(hash))) { if (ABSL_PREDICT_TRUE(PolicyTraits::apply( EqualElement<K>{key, eq_ref()}, PolicyTraits::element(slots_ + seq.offset(i))))) @@ -1984,7 +1985,7 @@ auto seq = probe(set.ctrl_, hash, set.capacity_); while (true) { container_internal::Group g{set.ctrl_ + seq.offset()}; - for (int i : g.Match(container_internal::H2(hash))) { + for (uint32_t i : g.Match(container_internal::H2(hash))) { if (Traits::apply( typename Set::template EqualElement<typename Set::key_type>{ key, set.eq_ref()},
diff --git a/third_party/abseil-cpp/absl/container/internal/raw_hash_set_benchmark.cc b/third_party/abseil-cpp/absl/container/internal/raw_hash_set_benchmark.cc index c886d3a..146ef433 100644 --- a/third_party/abseil-cpp/absl/container/internal/raw_hash_set_benchmark.cc +++ b/third_party/abseil-cpp/absl/container/internal/raw_hash_set_benchmark.cc
@@ -330,6 +330,7 @@ h2_t h = 1; for (auto _ : state) { ::benchmark::DoNotOptimize(h); + ::benchmark::DoNotOptimize(g); ::benchmark::DoNotOptimize(g.Match(h)); } } @@ -339,7 +340,10 @@ std::array<ctrl_t, Group::kWidth> group; Iota(group.begin(), group.end(), -4); Group g{group.data()}; - for (auto _ : state) ::benchmark::DoNotOptimize(g.MatchEmpty()); + for (auto _ : state) { + ::benchmark::DoNotOptimize(g); + ::benchmark::DoNotOptimize(g.MatchEmpty()); + } } BENCHMARK(BM_Group_MatchEmpty); @@ -347,7 +351,10 @@ std::array<ctrl_t, Group::kWidth> group; Iota(group.begin(), group.end(), -4); Group g{group.data()}; - for (auto _ : state) ::benchmark::DoNotOptimize(g.MatchEmptyOrDeleted()); + for (auto _ : state) { + ::benchmark::DoNotOptimize(g); + ::benchmark::DoNotOptimize(g.MatchEmptyOrDeleted()); + } } BENCHMARK(BM_Group_MatchEmptyOrDeleted); @@ -355,8 +362,10 @@ std::array<ctrl_t, Group::kWidth> group; Iota(group.begin(), group.end(), -2); Group g{group.data()}; - for (auto _ : state) + for (auto _ : state) { + ::benchmark::DoNotOptimize(g); ::benchmark::DoNotOptimize(g.CountLeadingEmptyOrDeleted()); + } } BENCHMARK(BM_Group_CountLeadingEmptyOrDeleted); @@ -364,7 +373,10 @@ std::array<ctrl_t, Group::kWidth> group; Iota(group.begin(), group.end(), -2); Group g{group.data()}; - for (auto _ : state) ::benchmark::DoNotOptimize(*g.MatchEmptyOrDeleted()); + for (auto _ : state) { + ::benchmark::DoNotOptimize(g); + ::benchmark::DoNotOptimize(*g.MatchEmptyOrDeleted()); + } } BENCHMARK(BM_Group_MatchFirstEmptyOrDeleted);
diff --git a/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc b/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc index 26df3289..4be6256 100644 --- a/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +++ b/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc
@@ -30,16 +30,12 @@ ABSL_NAMESPACE_END } // namespace absl -#else +#else // __linux__ && !__ANDROID__ -#include <fcntl.h> -#include <sys/stat.h> -#include <sys/syscall.h> -#include <sys/types.h> +#include <stdint.h> +#include <syscall.h> #include <unistd.h> -#include <cerrno> - #include "absl/base/internal/errno_saver.h" #include "absl/base/internal/raw_logging.h" @@ -47,60 +43,54 @@ ABSL_NAMESPACE_BEGIN namespace debugging_internal { +// NOTE: be extra careful about adding any interposable function calls here +// (such as open(), read(), etc.). These symbols may be interposed and will get +// invoked in contexts they don't expect. +// +// NOTE: any new system calls here may also require sandbox reconfiguration. +// bool AddressIsReadable(const void *addr) { - int fd = 0; + // Align address on 8-byte boundary. On aarch64, checking last + // byte before inaccessible page returned unexpected EFAULT. + const uintptr_t u_addr = reinterpret_cast<uintptr_t>(addr) & ~7; + addr = reinterpret_cast<const void *>(u_addr); + + // rt_sigprocmask below will succeed for this input. + if (addr == nullptr) return false; + absl::base_internal::ErrnoSaver errno_saver; - for (int j = 0; j < 2; j++) { - // Here we probe with some syscall which - // - accepts a one-byte region of user memory as input - // - tests for EFAULT before other validation - // - has no problematic side-effects - // - // connect(2) works for this. It copies the address into kernel - // memory before any validation beyond requiring an open fd. - // But a one byte address is never valid (sa_family is two bytes), - // so the call cannot succeed and change any state. - // - // This strategy depends on Linux implementation details, - // so we rely on the test to alert us if it stops working. - // - // Some discarded past approaches: - // - msync() doesn't reject PROT_NONE regions - // - write() on /dev/null doesn't return EFAULT - // - write() on a pipe requires creating it and draining the writes - // - // Use syscall(SYS_connect, ...) instead of connect() to prevent ASAN - // and other checkers from complaining about accesses to arbitrary memory. - do { - ABSL_RAW_CHECK(syscall(SYS_connect, fd, addr, 1) == -1, - "should never succeed"); - } while (errno == EINTR); - if (errno == EFAULT) return false; - if (errno == EBADF) { - if (j != 0) { - // Unclear what happened. - ABSL_RAW_LOG(ERROR, "unexpected EBADF on fd %d", fd); - return false; - } - // fd 0 must have been closed. Try opening it again. - // Note: we shouldn't leak too many file descriptors here, since we expect - // to get fd==0 reopened. - fd = open("/dev/null", O_RDONLY); - if (fd == -1) { - ABSL_RAW_LOG(ERROR, "can't open /dev/null"); - return false; - } - } else { - // probably EINVAL or ENOTSOCK; we got past EFAULT validation. - return true; - } - } - ABSL_RAW_CHECK(false, "unreachable"); - return false; + + // Here we probe with some syscall which + // - accepts an 8-byte region of user memory as input + // - tests for EFAULT before other validation + // - has no problematic side-effects + // + // rt_sigprocmask(2) works for this. It copies sizeof(kernel_sigset_t)==8 + // bytes from the address into the kernel memory before any validation. + // + // The call can never succeed, since the `how` parameter is not one of + // SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK. + // + // This strategy depends on Linux implementation details, + // so we rely on the test to alert us if it stops working. + // + // Some discarded past approaches: + // - msync() doesn't reject PROT_NONE regions + // - write() on /dev/null doesn't return EFAULT + // - write() on a pipe requires creating it and draining the writes + // - connect() works but is problematic for sandboxes and needs a valid + // file descriptor + // + // This can never succeed (invalid first argument to sigprocmask). + ABSL_RAW_CHECK(syscall(SYS_rt_sigprocmask, ~0, addr, nullptr, + /*sizeof(kernel_sigset_t)*/ 8) == -1, + "unexpected success"); + ABSL_RAW_CHECK(errno == EFAULT || errno == EINVAL, "unexpected errno"); + return errno != EFAULT; } } // namespace debugging_internal ABSL_NAMESPACE_END } // namespace absl -#endif +#endif // __linux__ && !__ANDROID__
diff --git a/third_party/abseil-cpp/absl/flags/declare.h b/third_party/abseil-cpp/absl/flags/declare.h index b9794d8..a791b66 100644 --- a/third_party/abseil-cpp/absl/flags/declare.h +++ b/third_party/abseil-cpp/absl/flags/declare.h
@@ -60,6 +60,10 @@ // The ABSL_DECLARE_FLAG(type, name) macro expands to: // // extern absl::Flag<type> FLAGS_name; -#define ABSL_DECLARE_FLAG(type, name) extern ::absl::Flag<type> FLAGS_##name +#define ABSL_DECLARE_FLAG(type, name) \ + extern absl::Flag<type> FLAGS_##name; \ + namespace absl /* block flags in namespaces */ {} \ + /* second redeclaration is to allow applying attributes */ \ + extern absl::Flag<type> FLAGS_##name #endif // ABSL_FLAGS_DECLARE_H_
diff --git a/third_party/abseil-cpp/absl/random/internal/randen_detect.cc b/third_party/abseil-cpp/absl/random/internal/randen_detect.cc index bbe7b96..9bb58fc 100644 --- a/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +++ b/third_party/abseil-cpp/absl/random/internal/randen_detect.cc
@@ -40,7 +40,6 @@ #if defined(ABSL_INTERNAL_USE_X86_CPUID) #if defined(_WIN32) || defined(_WIN64) #include <intrin.h> // NOLINT(build/include_order) -#pragma intrinsic(__cpuid) #else // MSVC-equivalent __cpuid intrinsic function. static void __cpuid(int cpu_info[4], int info_type) {
diff --git a/third_party/abseil-cpp/absl/strings/ascii.h b/third_party/abseil-cpp/absl/strings/ascii.h index b46bc71..9b8e5d1 100644 --- a/third_party/abseil-cpp/absl/strings/ascii.h +++ b/third_party/abseil-cpp/absl/strings/ascii.h
@@ -133,7 +133,7 @@ // ascii_isprint() // -// Determines whether the given character is printable, including whitespace. +// Determines whether the given character is printable, including spaces. inline bool ascii_isprint(unsigned char c) { return c >= 32 && c < 127; } // ascii_isgraph()
diff --git a/third_party/abseil-cpp/absl/strings/cord.cc b/third_party/abseil-cpp/absl/strings/cord.cc index 5905bac..425b4be 100644 --- a/third_party/abseil-cpp/absl/strings/cord.cc +++ b/third_party/abseil-cpp/absl/strings/cord.cc
@@ -311,11 +311,10 @@ constexpr unsigned char Cord::InlineRep::kMaxInline; -inline void Cord::InlineRep::set_data(const char* data, size_t n, - bool nullify_tail) { +inline void Cord::InlineRep::set_data(const char* data, size_t n) { static_assert(kMaxInline == 15, "set_data is hard-coded for a length of 15"); - cord_internal::SmallMemmove(data_.as_chars(), data, n, nullify_tail); + cord_internal::SmallMemmove<true>(data_.as_chars(), data, n); set_inline_size(n); } @@ -375,7 +374,8 @@ } void Cord::InlineRep::AppendTree(CordRep* tree, MethodIdentifier method) { - if (tree == nullptr) return; + assert(tree != nullptr); + assert(tree->length != 0); assert(!tree->IsCrc()); if (data_.is_tree()) { AppendTreeToTree(tree, method); @@ -412,6 +412,7 @@ void Cord::InlineRep::PrependTree(CordRep* tree, MethodIdentifier method) { assert(tree != nullptr); + assert(tree->length != 0); assert(!tree->IsCrc()); if (data_.is_tree()) { PrependTreeToTree(tree, method); @@ -549,7 +550,7 @@ : contents_(InlineData::kDefaultInit) { const size_t n = src.size(); if (n <= InlineRep::kMaxInline) { - contents_.set_data(src.data(), n, true); + contents_.set_data(src.data(), n); } else { CordRep* rep = NewTree(src.data(), n, 0); contents_.EmplaceTree(rep, method); @@ -559,7 +560,7 @@ template <typename T, Cord::EnableIfString<T>> Cord::Cord(T&& src) : contents_(InlineData::kDefaultInit) { if (src.size() <= InlineRep::kMaxInline) { - contents_.set_data(src.data(), src.size(), true); + contents_.set_data(src.data(), src.size()); } else { CordRep* rep = CordRepFromString(std::forward<T>(src)); contents_.EmplaceTree(rep, CordzUpdateTracker::kConstructorString); @@ -610,7 +611,7 @@ // - MaybeUntrackCord must be called before set_data() clobbers cordz_info. // - set_data() must be called before Unref(tree) as it may reference tree. if (tree != nullptr) CordzInfo::MaybeUntrackCord(contents_.cordz_info()); - contents_.set_data(data, length, true); + contents_.set_data(data, length); if (tree != nullptr) CordRep::Unref(tree); return *this; } @@ -1014,9 +1015,7 @@ CordRep* tree = contents_.tree(); if (tree == nullptr) { - // sub_cord is newly constructed, no need to re-zero-out the tail of - // contents_ memory. - sub_cord.contents_.set_data(contents_.data() + pos, new_size, false); + sub_cord.contents_.set_data(contents_.data() + pos, new_size); return sub_cord; }
diff --git a/third_party/abseil-cpp/absl/strings/cord.h b/third_party/abseil-cpp/absl/strings/cord.h index 27d3475f..3bbd763 100644 --- a/third_party/abseil-cpp/absl/strings/cord.h +++ b/third_party/abseil-cpp/absl/strings/cord.h
@@ -763,9 +763,8 @@ bool empty() const; size_t size() const; const char* data() const; // Returns nullptr if holding pointer - void set_data(const char* data, size_t n, - bool nullify_tail); // Discards pointer, if any - char* set_data(size_t n); // Write data to the result + void set_data(const char* data, size_t n); // Discards pointer, if any + char* set_data(size_t n); // Write data to the result // Returns nullptr if holding bytes absl::cord_internal::CordRep* tree() const; absl::cord_internal::CordRep* as_tree() const; @@ -857,7 +856,7 @@ bool is_profiled() const { return data_.is_tree() && data_.is_profiled(); } // Returns the available inlined capacity, or 0 if is_tree() == true. - size_t inline_capacity() const { + size_t remaining_inline_capacity() const { return data_.is_tree() ? 0 : kMaxInline - data_.inline_size(); } @@ -968,8 +967,8 @@ // Fast implementation of memmove for up to 15 bytes. This implementation is // safe for overlapping regions. If nullify_tail is true, the destination is // padded with '\0' up to 16 bytes. -inline void SmallMemmove(char* dst, const char* src, size_t n, - bool nullify_tail = false) { +template <bool nullify_tail = false> +inline void SmallMemmove(char* dst, const char* src, size_t n) { if (n >= 8) { assert(n <= 16); uint64_t buf1; @@ -1006,22 +1005,16 @@ } // Does non-template-specific `CordRepExternal` initialization. -// Expects `data` to be non-empty. +// Requires `data` to be non-empty. void InitializeCordRepExternal(absl::string_view data, CordRepExternal* rep); // Creates a new `CordRep` that owns `data` and `releaser` and returns a pointer -// to it, or `nullptr` if `data` was empty. +// to it. Requires `data` to be non-empty. template <typename Releaser> // NOLINTNEXTLINE - suppress clang-tidy raw pointer return. CordRep* NewExternalRep(absl::string_view data, Releaser&& releaser) { + assert(!data.empty()); using ReleaserType = absl::decay_t<Releaser>; - if (data.empty()) { - // Never create empty external nodes. - InvokeReleaser(Rank0{}, ReleaserType(std::forward<Releaser>(releaser)), - data); - return nullptr; - } - CordRepExternal* rep = new CordRepExternalImpl<ReleaserType>( std::forward<Releaser>(releaser), 0); InitializeCordRepExternal(data, rep); @@ -1041,10 +1034,15 @@ template <typename Releaser> Cord MakeCordFromExternal(absl::string_view data, Releaser&& releaser) { Cord cord; - if (auto* rep = ::absl::cord_internal::NewExternalRep( - data, std::forward<Releaser>(releaser))) { - cord.contents_.EmplaceTree(rep, + if (ABSL_PREDICT_TRUE(!data.empty())) { + cord.contents_.EmplaceTree(::absl::cord_internal::NewExternalRep( + data, std::forward<Releaser>(releaser)), Cord::MethodIdentifier::kMakeCordFromExternal); + } else { + using ReleaserType = absl::decay_t<Releaser>; + cord_internal::InvokeReleaser( + cord_internal::Rank0{}, ReleaserType(std::forward<Releaser>(releaser)), + data); } return cord; }
diff --git a/third_party/abseil-cpp/absl/strings/cord_test.cc b/third_party/abseil-cpp/absl/strings/cord_test.cc index ea865cc..a22db0b 100644 --- a/third_party/abseil-cpp/absl/strings/cord_test.cc +++ b/third_party/abseil-cpp/absl/strings/cord_test.cc
@@ -1370,31 +1370,64 @@ } TEST_P(CordTest, ConstructFromExternalReferenceQualifierOverloads) { - struct Releaser { - void operator()(absl::string_view) & { *lvalue_invoked = true; } - void operator()(absl::string_view) && { *rvalue_invoked = true; } + enum InvokedAs { kMissing, kLValue, kRValue }; + enum CopiedAs { kNone, kMove, kCopy }; + struct Tracker { + CopiedAs copied_as = kNone; + InvokedAs invoked_as = kMissing; - bool* lvalue_invoked; - bool* rvalue_invoked; + void Record(InvokedAs rhs) { + ASSERT_EQ(invoked_as, kMissing); + invoked_as = rhs; + } + + void Record(CopiedAs rhs) { + if (copied_as == kNone || rhs == kCopy) copied_as = rhs; + } + } tracker; + + class Releaser { + public: + explicit Releaser(Tracker* tracker) : tr_(tracker) { *tracker = Tracker(); } + Releaser(Releaser&& rhs) : tr_(rhs.tr_) { tr_->Record(kMove); } + Releaser(const Releaser& rhs) : tr_(rhs.tr_) { tr_->Record(kCopy); } + + void operator()(absl::string_view) & { tr_->Record(kLValue); } + void operator()(absl::string_view) && { tr_->Record(kRValue); } + + private: + Tracker* tr_; }; - bool lvalue_invoked = false; - bool rvalue_invoked = false; - Releaser releaser = {&lvalue_invoked, &rvalue_invoked}; - (void)MaybeHardened(absl::MakeCordFromExternal("", releaser)); - EXPECT_FALSE(lvalue_invoked); - EXPECT_TRUE(rvalue_invoked); - rvalue_invoked = false; + const Releaser releaser1(&tracker); + (void)MaybeHardened(absl::MakeCordFromExternal("", releaser1)); + EXPECT_EQ(tracker.copied_as, kCopy); + EXPECT_EQ(tracker.invoked_as, kRValue); - (void)MaybeHardened(absl::MakeCordFromExternal("dummy", releaser)); - EXPECT_FALSE(lvalue_invoked); - EXPECT_TRUE(rvalue_invoked); - rvalue_invoked = false; + const Releaser releaser2(&tracker); + (void)MaybeHardened(absl::MakeCordFromExternal("", releaser2)); + EXPECT_EQ(tracker.copied_as, kCopy); + EXPECT_EQ(tracker.invoked_as, kRValue); - // NOLINTNEXTLINE: suppress clang-tidy std::move on trivially copyable type. - (void)MaybeHardened(absl::MakeCordFromExternal("dummy", std::move(releaser))); - EXPECT_FALSE(lvalue_invoked); - EXPECT_TRUE(rvalue_invoked); + Releaser releaser3(&tracker); + (void)MaybeHardened(absl::MakeCordFromExternal("", std::move(releaser3))); + EXPECT_EQ(tracker.copied_as, kMove); + EXPECT_EQ(tracker.invoked_as, kRValue); + + Releaser releaser4(&tracker); + (void)MaybeHardened(absl::MakeCordFromExternal("dummy", releaser4)); + EXPECT_EQ(tracker.copied_as, kCopy); + EXPECT_EQ(tracker.invoked_as, kRValue); + + const Releaser releaser5(&tracker); + (void)MaybeHardened(absl::MakeCordFromExternal("dummy", releaser5)); + EXPECT_EQ(tracker.copied_as, kCopy); + EXPECT_EQ(tracker.invoked_as, kRValue); + + Releaser releaser6(&tracker); + (void)MaybeHardened(absl::MakeCordFromExternal("foo", std::move(releaser6))); + EXPECT_EQ(tracker.copied_as, kMove); + EXPECT_EQ(tracker.invoked_as, kRValue); } TEST_P(CordTest, ExternalMemoryBasicUsage) {
diff --git a/third_party/abseil-cpp/absl/strings/substitute.h b/third_party/abseil-cpp/absl/strings/substitute.h index 151c56f..dae4e63f 100644 --- a/third_party/abseil-cpp/absl/strings/substitute.h +++ b/third_party/abseil-cpp/absl/strings/substitute.h
@@ -159,8 +159,8 @@ Arg(Hex hex); // NOLINT(runtime/explicit) Arg(Dec dec); // NOLINT(runtime/explicit) - // vector<bool>::reference and const_reference require special help to - // convert to `AlphaNum` because it requires two user defined conversions. + // vector<bool>::reference and const_reference require special help to convert + // to `Arg` because it requires two user defined conversions. template <typename T, absl::enable_if_t< std::is_class<T>::value &&
diff --git a/third_party/abseil-cpp/absl/synchronization/mutex.cc b/third_party/abseil-cpp/absl/synchronization/mutex.cc index 76ad41f..3af4cda 100644 --- a/third_party/abseil-cpp/absl/synchronization/mutex.cc +++ b/third_party/abseil-cpp/absl/synchronization/mutex.cc
@@ -2327,7 +2327,7 @@ base_internal::CycleClock::Now() - enqueue_timestamp; mutex_tracer("slow release", this, wait_cycles); ABSL_TSAN_MUTEX_PRE_DIVERT(this, 0); - submit_profile_data(enqueue_timestamp); + submit_profile_data(wait_cycles); ABSL_TSAN_MUTEX_POST_DIVERT(this, 0); } }
diff --git a/third_party/abseil-cpp/absl/synchronization/notification.h b/third_party/abseil-cpp/absl/synchronization/notification.h index 9a354ca..429968da 100644 --- a/third_party/abseil-cpp/absl/synchronization/notification.h +++ b/third_party/abseil-cpp/absl/synchronization/notification.h
@@ -22,7 +22,7 @@ // The `Notification` object maintains a private boolean "notified" state that // transitions to `true` at most once. The `Notification` class provides the // following primary member functions: -// * `HasBeenNotified() `to query its state +// * `HasBeenNotified()` to query its state // * `WaitForNotification*()` to have threads wait until the "notified" state // is `true`. // * `Notify()` to set the notification's "notified" state to `true` and
diff --git a/third_party/abseil-cpp/ci/linux_gcc-latest_libstdcxx_cmake.sh b/third_party/abseil-cpp/ci/linux_gcc-latest_libstdcxx_cmake.sh index ab06aa0..eccb381 100755 --- a/third_party/abseil-cpp/ci/linux_gcc-latest_libstdcxx_cmake.sh +++ b/third_party/abseil-cpp/ci/linux_gcc-latest_libstdcxx_cmake.sh
@@ -54,7 +54,7 @@ cmake /abseil-cpp \ -DABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL} \ -DBUILD_SHARED_LIBS=${build_shared} \ - -DBUILD_TESTING=ON \ + -DABSL_BUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=${compilation_mode} \ -DCMAKE_CXX_STANDARD=${std} \ -DCMAKE_MODULE_LINKER_FLAGS=\"-Wl,--no-undefined\" && \
diff --git a/third_party/abseil-cpp/ci/linux_gcc_alpine_cmake.sh b/third_party/abseil-cpp/ci/linux_gcc_alpine_cmake.sh index bce27d2..bf2e123 100755 --- a/third_party/abseil-cpp/ci/linux_gcc_alpine_cmake.sh +++ b/third_party/abseil-cpp/ci/linux_gcc_alpine_cmake.sh
@@ -53,7 +53,7 @@ /bin/sh -c " cmake /abseil-cpp \ -DABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL} \ - -DBUILD_TESTING=ON \ + -DABSL_BUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=${compilation_mode} \ -DCMAKE_CXX_STANDARD=${std} \ -DCMAKE_MODULE_LINKER_FLAGS=\"-Wl,--no-undefined\" && \
diff --git a/third_party/abseil-cpp/ci/macos_xcode_cmake.sh b/third_party/abseil-cpp/ci/macos_xcode_cmake.sh index 2a870cf4..71ea253 100755 --- a/third_party/abseil-cpp/ci/macos_xcode_cmake.sh +++ b/third_party/abseil-cpp/ci/macos_xcode_cmake.sh
@@ -45,7 +45,7 @@ time cmake ${ABSEIL_ROOT} \ -GXcode \ -DBUILD_SHARED_LIBS=${build_shared} \ - -DBUILD_TESTING=ON \ + -DABSL_BUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=${compilation_mode} \ -DCMAKE_CXX_STANDARD=11 \ -DCMAKE_MODULE_LINKER_FLAGS="-Wl,--no-undefined" \
diff --git a/third_party/abseil-cpp/symbols_arm64_dbg.def b/third_party/abseil-cpp/symbols_arm64_dbg.def index b7dade3..87fdac71 100644 --- a/third_party/abseil-cpp/symbols_arm64_dbg.def +++ b/third_party/abseil-cpp/symbols_arm64_dbg.def
@@ -437,6 +437,8 @@ ??$SetEdge@$0A@@CordRepBtree@cord_internal@absl@@QEAA?AUOpResult@012@_NPEAUCordRep@12@_K@Z ??$SharedCompareImpl@VCord@absl@@@absl@@YAHAEBVCord@0@0@Z ??$SharedCompareImpl@Vstring_view@absl@@@absl@@YAHAEBVCord@0@AEBVstring_view@0@@Z + ??$SmallMemmove@$00@cord_internal@absl@@YAXPEADPEBD_K@Z + ??$SmallMemmove@$0A@@cord_internal@absl@@YAXPEADPEBD_K@Z ??$StrAppend@$$V@absl@@YAXPEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@AEBVAlphaNum@0@1111@Z ??$StrReplaceAll@V?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@@absl@@YA?AV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@Vstring_view@0@AEBV?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@3@@Z ??$StrReplaceAll@V?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@@absl@@YAHAEBV?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@PEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@2@@Z @@ -2485,7 +2487,6 @@ ?SleepFor@absl@@YAXVDuration@1@@Z ?SlowLock@SpinLock@base_internal@absl@@AEAAXXZ ?SlowUnlock@SpinLock@base_internal@absl@@AEAAXI@Z - ?SmallMemmove@cord_internal@absl@@YAXPEADPEBD_K_N@Z ?SnprintF@str_format_internal@absl@@YAHPEAD_KVUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z ?SpinLockDelay@base_internal@absl@@YAXPEAU?$atomic@I@__1@std@@IHW4SchedulingMode@12@@Z ?SpinLockSuggestedDelayNS@base_internal@absl@@YAHH@Z @@ -3613,7 +3614,7 @@ ?set_cordz_info@InlineData@cord_internal@absl@@QEAAXPEAVCordzInfo@23@@Z ?set_cordz_mean_interval@cord_internal@absl@@YAXH@Z ?set_data@InlineRep@Cord@absl@@QEAAPEAD_K@Z - ?set_data@InlineRep@Cord@absl@@QEAAXPEBD_K_N@Z + ?set_data@InlineRep@Cord@absl@@QEAAXPEBD_K@Z ?set_depth@CordRepConcat@cord_internal@absl@@QEAAXE@Z ?set_end@CordRepBtree@cord_internal@absl@@AEAAX_K@Z ?set_from_arg@InputValue@UnboundConversion@str_format_internal@absl@@QEAAXH@Z
diff --git a/third_party/abseil-cpp/symbols_x64_dbg.def b/third_party/abseil-cpp/symbols_x64_dbg.def index 5c65dda..6820239 100644 --- a/third_party/abseil-cpp/symbols_x64_dbg.def +++ b/third_party/abseil-cpp/symbols_x64_dbg.def
@@ -437,6 +437,8 @@ ??$SetEdge@$0A@@CordRepBtree@cord_internal@absl@@QEAA?AUOpResult@012@_NPEAUCordRep@12@_K@Z ??$SharedCompareImpl@VCord@absl@@@absl@@YAHAEBVCord@0@0@Z ??$SharedCompareImpl@Vstring_view@absl@@@absl@@YAHAEBVCord@0@AEBVstring_view@0@@Z + ??$SmallMemmove@$00@cord_internal@absl@@YAXPEADPEBD_K@Z + ??$SmallMemmove@$0A@@cord_internal@absl@@YAXPEADPEBD_K@Z ??$StrAppend@$$V@absl@@YAXPEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@AEBVAlphaNum@0@1111@Z ??$StrReplaceAll@V?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@@absl@@YA?AV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@Vstring_view@0@AEBV?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@3@@Z ??$StrReplaceAll@V?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@@absl@@YAHAEBV?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@PEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@2@@Z @@ -2487,7 +2489,6 @@ ?SleepFor@absl@@YAXVDuration@1@@Z ?SlowLock@SpinLock@base_internal@absl@@AEAAXXZ ?SlowUnlock@SpinLock@base_internal@absl@@AEAAXI@Z - ?SmallMemmove@cord_internal@absl@@YAXPEADPEBD_K_N@Z ?SnprintF@str_format_internal@absl@@YAHPEAD_KVUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z ?SpinLockDelay@base_internal@absl@@YAXPEAU?$atomic@I@__1@std@@IHW4SchedulingMode@12@@Z ?SpinLockSuggestedDelayNS@base_internal@absl@@YAHH@Z @@ -3613,7 +3614,7 @@ ?set_cordz_info@InlineData@cord_internal@absl@@QEAAXPEAVCordzInfo@23@@Z ?set_cordz_mean_interval@cord_internal@absl@@YAXH@Z ?set_data@InlineRep@Cord@absl@@QEAAPEAD_K@Z - ?set_data@InlineRep@Cord@absl@@QEAAXPEBD_K_N@Z + ?set_data@InlineRep@Cord@absl@@QEAAXPEBD_K@Z ?set_depth@CordRepConcat@cord_internal@absl@@QEAAXE@Z ?set_end@CordRepBtree@cord_internal@absl@@AEAAX_K@Z ?set_from_arg@InputValue@UnboundConversion@str_format_internal@absl@@QEAAXH@Z
diff --git a/third_party/abseil-cpp/symbols_x86_dbg.def b/third_party/abseil-cpp/symbols_x86_dbg.def index 4b47ddfd..85868e26 100644 --- a/third_party/abseil-cpp/symbols_x86_dbg.def +++ b/third_party/abseil-cpp/symbols_x86_dbg.def
@@ -435,6 +435,8 @@ ??$SetEdge@$0A@@CordRepBtree@cord_internal@absl@@QAE?AUOpResult@012@_NPAUCordRep@12@I@Z ??$SharedCompareImpl@VCord@absl@@@absl@@YAHABVCord@0@0@Z ??$SharedCompareImpl@Vstring_view@absl@@@absl@@YAHABVCord@0@ABVstring_view@0@@Z + ??$SmallMemmove@$00@cord_internal@absl@@YAXPADPBDI@Z + ??$SmallMemmove@$0A@@cord_internal@absl@@YAXPADPBDI@Z ??$StrAppend@$$V@absl@@YAXPAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@ABVAlphaNum@0@1111@Z ??$StrReplaceAll@V?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@@absl@@YA?AV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@Vstring_view@0@ABV?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@3@@Z ??$StrReplaceAll@V?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@@absl@@YAHABV?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@PAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@2@@Z @@ -2481,7 +2483,6 @@ ?SleepFor@absl@@YAXVDuration@1@@Z ?SlowLock@SpinLock@base_internal@absl@@AAEXXZ ?SlowUnlock@SpinLock@base_internal@absl@@AAEXI@Z - ?SmallMemmove@cord_internal@absl@@YAXPADPBDI_N@Z ?SnprintF@str_format_internal@absl@@YAHPADIVUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z ?SpinLockDelay@base_internal@absl@@YAXPAU?$atomic@I@__1@std@@IHW4SchedulingMode@12@@Z ?SpinLockSuggestedDelayNS@base_internal@absl@@YAHH@Z @@ -3607,7 +3608,7 @@ ?set_cordz_info@InlineData@cord_internal@absl@@QAEXPAVCordzInfo@23@@Z ?set_cordz_mean_interval@cord_internal@absl@@YAXH@Z ?set_data@InlineRep@Cord@absl@@QAEPADI@Z - ?set_data@InlineRep@Cord@absl@@QAEXPBDI_N@Z + ?set_data@InlineRep@Cord@absl@@QAEXPBDI@Z ?set_depth@CordRepConcat@cord_internal@absl@@QAEXE@Z ?set_end@CordRepBtree@cord_internal@absl@@AAEXI@Z ?set_from_arg@InputValue@UnboundConversion@str_format_internal@absl@@QAEXH@Z
diff --git a/third_party/blink/common/permissions_policy/permissions_policy.cc b/third_party/blink/common/permissions_policy/permissions_policy.cc index c6dc948..f2c9da52 100644 --- a/third_party/blink/common/permissions_policy/permissions_policy.cc +++ b/third_party/blink/common/permissions_policy/permissions_policy.cc
@@ -185,10 +185,9 @@ return PermissionsPolicy::Allowlist(); // Return defined policy if exists; otherwise return default policy. - allowlists_checked_ = true; - auto allowlist = allowlists_.find(feature); - if (allowlist != allowlists_.end()) - return allowlist->second; + const auto& maybe_allow_list = GetAllowlistForFeatureIfExists(feature); + if (maybe_allow_list.has_value()) + return maybe_allow_list.value(); // Note: |allowlists_| purely comes from HTTP header. If a feature is not // declared in HTTP header, all origins are implicitly allowed. @@ -204,16 +203,14 @@ const PermissionsPolicy::Allowlist PermissionsPolicy::GetAllowlistForFeature( mojom::PermissionsPolicyFeature feature) const { DCHECK(base::Contains(feature_list_, feature)); - DCHECK(base::Contains(inherited_policies_, feature)); // Return an empty allowlist when disabled through inheritance. - if (!inherited_policies_.at(feature)) + if (!IsFeatureEnabledByInheritedPolicy(feature)) return PermissionsPolicy::Allowlist(); // Return defined policy if exists; otherwise return default policy. - allowlists_checked_ = true; - auto allowlist = allowlists_.find(feature); - if (allowlist != allowlists_.end()) - return allowlist->second; + const auto& maybe_allow_list = GetAllowlistForFeatureIfExists(feature); + if (maybe_allow_list.has_value()) + return maybe_allow_list.value(); const PermissionsPolicyFeatureDefault default_policy = feature_list_.at(feature); @@ -228,6 +225,21 @@ return default_allowlist; } +absl::optional<const PermissionsPolicy::Allowlist> +PermissionsPolicy::GetAllowlistForFeatureIfExists( + mojom::PermissionsPolicyFeature feature) const { + // Return an empty allowlist when disabled through inheritance. + if (!IsFeatureEnabledByInheritedPolicy(feature)) + return absl::nullopt; + + // Only return allowlist if actually in `allowlists_`. + allowlists_checked_ = true; + auto allowlist = allowlists_.find(feature); + if (allowlist != allowlists_.end()) + return allowlist->second; + return absl::nullopt; +} + void PermissionsPolicy::SetHeaderPolicy( const ParsedPermissionsPolicy& parsed_header) { DCHECK(allowlists_.empty() && !allowlists_checked_);
diff --git a/third_party/blink/common/permissions_policy/permissions_policy_unittest.cc b/third_party/blink/common/permissions_policy/permissions_policy_unittest.cc index a409dfd..154b019a 100644 --- a/third_party/blink/common/permissions_policy/permissions_policy_unittest.cc +++ b/third_party/blink/common/permissions_policy/permissions_policy_unittest.cc
@@ -5,10 +5,12 @@ #include "third_party/blink/public/common/permissions_policy/permissions_policy.h" #include "base/test/gtest_util.h" +#include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom.h" #include "third_party/blink/public/mojom/permissions_policy/policy_value.mojom.h" #include "url/gurl.h" +#include "url/origin.h" namespace blink { @@ -1741,4 +1743,55 @@ false}}})); } +TEST_F(PermissionsPolicyTest, GetAllowlistForFeatureIfExists) { + // If we set a policy, then we can extract it. + auto policy1 = CreateFromParentPolicy(nullptr, origin_a_); + const std::vector<url::Origin> origins1({origin_b_}); + policy1->SetHeaderPolicy({{{mojom::PermissionsPolicyFeature::kClientHintDPR, + origins1, false, false}}}); + const auto& maybe_allow_list1 = policy1->GetAllowlistForFeatureIfExists( + mojom::PermissionsPolicyFeature::kClientHintDPR); + EXPECT_TRUE(maybe_allow_list1.has_value()); + EXPECT_FALSE(maybe_allow_list1.value().MatchesAll()); + EXPECT_FALSE(maybe_allow_list1.value().MatchesOpaqueSrc()); + EXPECT_THAT(maybe_allow_list1.value().AllowedOrigins(), + testing::ContainerEq(origins1)); + + // If we don't set a policy, then we can't extract it. + auto policy2 = CreateFromParentPolicy(nullptr, origin_a_); + const auto& maybe_allow_list2 = policy2->GetAllowlistForFeatureIfExists( + mojom::PermissionsPolicyFeature::kClientHintDPR); + EXPECT_FALSE(maybe_allow_list2.has_value()); + + // If we set a policy, then overwrite it, we can extract it. + auto policy3 = CreateFromParentPolicy(nullptr, origin_a_); + const std::vector<url::Origin> origins3({origin_a_}); + policy3->SetHeaderPolicy( + {{{mojom::PermissionsPolicyFeature::kClientHintDPR, {}, false, false}}}); + policy3->OverwriteHeaderPolicyForClientHints( + {{{mojom::PermissionsPolicyFeature::kClientHintDPR, origins3, false, + false}}}); + const auto& maybe_allow_list3 = policy3->GetAllowlistForFeatureIfExists( + mojom::PermissionsPolicyFeature::kClientHintDPR); + EXPECT_TRUE(maybe_allow_list3.has_value()); + EXPECT_FALSE(maybe_allow_list3.value().MatchesAll()); + EXPECT_FALSE(maybe_allow_list3.value().MatchesOpaqueSrc()); + EXPECT_THAT(maybe_allow_list3.value().AllowedOrigins(), + testing::ContainerEq(origins3)); + + // If we don't set a policy, then overwrite it, we can extract it. + auto policy4 = CreateFromParentPolicy(nullptr, origin_a_); + const std::vector<url::Origin> origins4({origin_a_, origin_b_}); + policy4->OverwriteHeaderPolicyForClientHints( + {{{mojom::PermissionsPolicyFeature::kClientHintDPR, origins4, false, + false}}}); + const auto& maybe_allow_list4 = policy4->GetAllowlistForFeatureIfExists( + mojom::PermissionsPolicyFeature::kClientHintDPR); + EXPECT_TRUE(maybe_allow_list4.has_value()); + EXPECT_FALSE(maybe_allow_list4.value().MatchesAll()); + EXPECT_FALSE(maybe_allow_list4.value().MatchesOpaqueSrc()); + EXPECT_THAT(maybe_allow_list4.value().AllowedOrigins(), + testing::ContainerEq(origins4)); +} + } // namespace blink
diff --git a/third_party/blink/public/common/permissions_policy/permissions_policy.h b/third_party/blink/public/common/permissions_policy/permissions_policy.h index 03094e5..78fb8be 100644 --- a/third_party/blink/public/common/permissions_policy/permissions_policy.h +++ b/third_party/blink/public/common/permissions_policy/permissions_policy.h
@@ -9,6 +9,7 @@ #include <vector> #include "services/network/public/mojom/web_sandbox_flags.mojom-shared.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/common/common_export.h" #include "third_party/blink/public/common/permissions_policy/permissions_policy_features.h" #include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom-forward.h" @@ -202,6 +203,11 @@ const Allowlist GetAllowlistForFeature( mojom::PermissionsPolicyFeature feature) const; + // Returns the allowlist of a given feature if it already exists. Doesn't + // build a default allow list based on the policy if not. + absl::optional<const Allowlist> GetAllowlistForFeatureIfExists( + mojom::PermissionsPolicyFeature feature) const; + // Sets the declared policy from the parsed Permissions-Policy HTTP header. // Unrecognized features will be ignored. void SetHeaderPolicy(const ParsedPermissionsPolicy& parsed_header);
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc b/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc index f7d6b2ab..93f3d02 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc
@@ -224,13 +224,18 @@ if (std::isinf(number_value)) return 0; + // Confine number to (-kNumberOfValues, kNumberOfValues). number_value = number_value < 0 ? -floor(fabs(number_value)) : floor(fabs(number_value)); number_value = fmod(number_value, LimitsTrait::kNumberOfValues); - return static_cast<T>(number_value > LimitsTrait::kMaxValue - ? number_value - LimitsTrait::kNumberOfValues - : number_value); + // Adjust range to [-kMinValue, kMaxValue]. + if (number_value < LimitsTrait::kMinValue) + number_value += LimitsTrait::kNumberOfValues; + else if (LimitsTrait::kMaxValue < number_value) + number_value -= LimitsTrait::kNumberOfValues; + + return static_cast<T>(number_value); } template <typename T>
diff --git a/third_party/blink/renderer/core/aom/computed_accessible_node.cc b/third_party/blink/renderer/core/aom/computed_accessible_node.cc index 28126e4..bde8141 100644 --- a/third_party/blink/renderer/core/aom/computed_accessible_node.cc +++ b/third_party/blink/renderer/core/aom/computed_accessible_node.cc
@@ -81,7 +81,7 @@ void ComputedAccessibleNodePromiseResolver::EnsureUpToDate() { DCHECK(RuntimeEnabledFeatures::AccessibilityObjectModelEnabled()); - if (continue_callback_request_id_) + if (continue_callback_request_id_ || !ax_context_->GetDocument()) return; // TODO(aboxhall): Trigger a call when lifecycle is next at kPrePaintClean. RequestAnimationFrameCallback* callback = @@ -91,6 +91,10 @@ } void ComputedAccessibleNodePromiseResolver::UpdateTreeAndResolve() { + if (!ax_context_->GetDocument()) { + resolver_->Resolve(); + return; + } LocalFrame* local_frame = ax_context_->GetDocument()->GetFrame(); if (!local_frame) { resolver_->Resolve(); @@ -220,6 +224,8 @@ ScriptPromise ComputedAccessibleNode::ensureUpToDate( ScriptState* script_state) { + if (!GetDocument()) + return ScriptPromise(); // Empty promise. auto* resolver = MakeGarbageCollected<ComputedAccessibleNodePromiseResolver>( script_state, *GetDocument(), ax_id_); ScriptPromise promise = resolver->Promise(); @@ -331,6 +337,8 @@ } WebComputedAXTree* ComputedAccessibleNode::GetTree() const { + if (!GetDocument()) + return nullptr; LocalFrame* local_frame = GetDocument()->GetFrame(); if (!local_frame) return nullptr;
diff --git a/third_party/blink/renderer/core/css/css_variable_data.cc b/third_party/blink/renderer/core/css/css_variable_data.cc index 620bc3f..a2294cc7 100644 --- a/third_party/blink/renderer/core/css/css_variable_data.cc +++ b/third_party/blink/renderer/core/css/css_variable_data.cc
@@ -119,7 +119,6 @@ needs_variable_resolution_(needs_variable_resolution), base_url_(base_url.IsValid() ? base_url.GetString() : String()), charset_(charset) { - DCHECK(!tokenized_value.range.AtEnd()); ConsumeAndUpdateTokens(tokenized_value.range); }
diff --git a/third_party/blink/renderer/core/css/parser/css_variable_parser.cc b/third_party/blink/renderer/core/css/parser/css_variable_parser.cc index 4273110e..3b84510 100644 --- a/third_party/blink/renderer/core/css/parser/css_variable_parser.cc +++ b/third_party/blink/renderer/core/css/parser/css_variable_parser.cc
@@ -83,8 +83,6 @@ if (range.Consume().GetType() != kCommaToken) return false; - if (range.AtEnd()) - return false; bool has_references = false; return ClassifyBlock(range, has_references); @@ -167,9 +165,6 @@ const CSSTokenizedValue& tokenized_value, bool is_animation_tainted, const CSSParserContext& context) { - if (tokenized_value.range.AtEnd()) - return nullptr; - bool has_references; CSSValueID type = ClassifyVariableRange(tokenized_value.range, has_references); @@ -178,7 +173,6 @@ return nullptr; if (type == CSSValueID::kInternalVariableValue) { return MakeGarbageCollected<CSSCustomPropertyDeclaration>( - CSSVariableData::Create(tokenized_value, is_animation_tainted, has_references, context.BaseURL(), context.Charset()));
diff --git a/third_party/blink/renderer/core/dom/events/node_event_context.cc b/third_party/blink/renderer/core/dom/events/node_event_context.cc index 4e01c92f..06d3465 100644 --- a/third_party/blink/renderer/core/dom/events/node_event_context.cc +++ b/third_party/blink/renderer/core/dom/events/node_event_context.cc
@@ -36,7 +36,12 @@ namespace blink { NodeEventContext::NodeEventContext(Node& node, EventTarget& current_target) - : node_(node), current_target_(current_target) {} + : node_(node, Member<Node>::AtomicInitializerTag{}), + current_target_(current_target, + Member<EventTarget>::AtomicInitializerTag{}), + tree_scope_event_context_( + nullptr, + Member<TreeScopeEventContext>::AtomicInitializerTag{}) {} void NodeEventContext::Trace(Visitor* visitor) const { visitor->Trace(node_);
diff --git a/third_party/blink/renderer/core/dom/events/node_event_context.h b/third_party/blink/renderer/core/dom/events/node_event_context.h index 29190970..a80595bc 100644 --- a/third_party/blink/renderer/core/dom/events/node_event_context.h +++ b/third_party/blink/renderer/core/dom/events/node_event_context.h
@@ -77,6 +77,14 @@ } // namespace blink -WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::NodeEventContext) +namespace WTF { + +template <> +struct VectorTraits<blink::NodeEventContext> + : SimpleClassVectorTraits<blink::NodeEventContext> { + static constexpr bool kCanTraceConcurrently = true; +}; + +} // namespace WTF #endif // THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_NODE_EVENT_CONTEXT_H_
diff --git a/third_party/blink/renderer/core/layout/layout_block.cc b/third_party/blink/renderer/core/layout/layout_block.cc index 1b969ba..5581029 100644 --- a/third_party/blink/renderer/core/layout/layout_block.cc +++ b/third_party/blink/renderer/core/layout/layout_block.cc
@@ -1147,7 +1147,7 @@ } void LayoutBlock::RemovePositionedObjects( - LayoutObject* o, + LayoutObject* stay_within, ContainingBlockState containing_block_state) { NOT_DESTROYED(); TrackedLayoutBoxLinkedHashSet* positioned_descendants = PositionedObjects(); @@ -1156,8 +1156,8 @@ HeapVector<Member<LayoutBox>, 16> dead_objects; for (LayoutBox* positioned_object : *positioned_descendants) { - if (!o || - (positioned_object->IsDescendantOf(o) && o != positioned_object)) { + if (!stay_within || (positioned_object->IsDescendantOf(stay_within) && + stay_within != positioned_object)) { ProcessPositionedObjectRemoval(containing_block_state, positioned_object); dead_objects.push_back(positioned_object); }
diff --git a/third_party/blink/renderer/core/layout/layout_box.cc b/third_party/blink/renderer/core/layout/layout_box.cc index e566b424..9ac4f3f5 100644 --- a/third_party/blink/renderer/core/layout/layout_box.cc +++ b/third_party/blink/renderer/core/layout/layout_box.cc
@@ -3360,8 +3360,15 @@ NOT_DESTROYED(); DCHECK_EQ(result->Status(), NGLayoutResult::kSuccess); if (index != WTF::kNotFound && layout_results_.size() > index) { - if (layout_results_.size() > index + 1) + if (layout_results_.size() > index + 1) { + // Before forgetting any old fragments and their items, we need to clear + // associations. + if (To<NGPhysicalBoxFragment>(result->PhysicalFragment()) + .IsInlineFormattingContext()) + NGFragmentItems::ClearAssociatedFragments(this); + ShrinkLayoutResults(index + 1); + } ReplaceLayoutResult(std::move(result), index); return; } @@ -3453,6 +3460,11 @@ InvalidateItems(*measure_result_); measure_result_ = nullptr; + if (!layout_results_.IsEmpty() && + To<NGPhysicalBoxFragment>(layout_results_[0]->PhysicalFragment()) + .IsInlineFormattingContext()) + NGFragmentItems::ClearAssociatedFragments(this); + ShrinkLayoutResults(0); } @@ -3462,12 +3474,6 @@ // Invalidate if inline |DisplayItemClient|s will be destroyed. for (wtf_size_t i = results_to_keep; i < layout_results_.size(); i++) InvalidateItems(*layout_results_[i]); - if (results_to_keep == 0 && !layout_results_.IsEmpty()) { - if (To<NGPhysicalBoxFragment>(layout_results_[0]->PhysicalFragment()) - .HasItems()) { - NGFragmentItems::ClearAssociatedFragments(this); - } - } // |layout_results_| is particularly critical when side effects are disabled. DCHECK(!NGDisableSideEffectsScope::IsDisabled()); layout_results_.Shrink(results_to_keep);
diff --git a/third_party/blink/renderer/core/layout/layout_multi_column_flow_thread_test.cc b/third_party/blink/renderer/core/layout/layout_multi_column_flow_thread_test.cc index a4abd530..3d73af20 100644 --- a/third_party/blink/renderer/core/layout/layout_multi_column_flow_thread_test.cc +++ b/third_party/blink/renderer/core/layout/layout_multi_column_flow_thread_test.cc
@@ -1206,6 +1206,19 @@ +--LayoutMultiColumnSet (anonymous) )DUMP", ToSimpleLayoutTree(container)); + } else if (RuntimeEnabledFeatures::LayoutNGBlockInInlineEnabled()) { + EXPECT_EQ(R"DUMP( +LayoutNGBlockFlow DIV id="mc" + +--LayoutMultiColumnFlowThread (anonymous) + | +--LayoutNGBlockFlow (anonymous) + | | +--LayoutInline SPAN + | | | +--LayoutText #text "x" + | | | +--LayoutNGBlockFlow (anonymous) + | | | | +--LayoutNGBlockFlow DIV id="inner" + | | | +--LayoutText #text "y" + +--LayoutMultiColumnSet (anonymous) +)DUMP", + ToSimpleLayoutTree(container)); } else { EXPECT_EQ(R"DUMP( LayoutNGBlockFlow DIV id="mc" @@ -1238,6 +1251,17 @@ +--LayoutMultiColumnSet (anonymous) )DUMP", ToSimpleLayoutTree(container)); + } else if (RuntimeEnabledFeatures::LayoutNGBlockInInlineEnabled()) { + EXPECT_EQ(R"DUMP( +LayoutNGBlockFlow DIV id="mc" + +--LayoutMultiColumnFlowThread (anonymous) + | +--LayoutNGBlockFlow (anonymous) + | | +--LayoutInline SPAN + | | | +--LayoutText #text "x" + | | | +--LayoutText #text "y" + +--LayoutMultiColumnSet (anonymous) +)DUMP", + ToSimpleLayoutTree(container)); } else { EXPECT_FALSE(flow_thread.ChildrenInline()); EXPECT_EQ(R"DUMP( @@ -1267,6 +1291,17 @@ +--LayoutMultiColumnSet (anonymous) )DUMP", ToSimpleLayoutTree(container)); + } else if (RuntimeEnabledFeatures::LayoutNGBlockInInlineEnabled()) { + EXPECT_FALSE(flow_thread.ChildrenInline()); + EXPECT_EQ(R"DUMP( +LayoutNGBlockFlow DIV id="mc" + +--LayoutMultiColumnFlowThread (anonymous) + | +--LayoutNGBlockFlow (anonymous) + | | +--LayoutInline SPAN + | | | +--LayoutText #text "xy" + +--LayoutMultiColumnSet (anonymous) +)DUMP", + ToSimpleLayoutTree(container)); } else { EXPECT_FALSE(flow_thread.ChildrenInline()); EXPECT_EQ(R"DUMP(
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_item.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_item.cc index c363bb0..f1ee97a 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_item.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_item.cc
@@ -74,7 +74,9 @@ LayoutObject* layout_object) : start_offset_(start), end_offset_(end), - layout_object_(layout_object), + // Use atomic construction to allow for concurrently marking NGInlineItem. + layout_object_(layout_object, + Member<LayoutObject>::AtomicInitializerTag{}), type_(type), text_type_(static_cast<unsigned>(NGTextType::kNormal)), style_variant_(static_cast<unsigned>(NGStyleVariant::kStandard)),
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_item.h b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_item.h index 6f8bb91b..74c8b65 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_item.h +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_item.h
@@ -288,6 +288,15 @@ } // namespace blink -WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::NGInlineItem) +namespace WTF { + +template <> +struct VectorTraits<blink::NGInlineItem> + : VectorTraitsBase<blink::NGInlineItem> { + static constexpr bool kCanClearUnusedSlotsWithMemset = true; + static constexpr bool kCanTraceConcurrently = true; +}; + +} // namespace WTF #endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_INLINE_NG_INLINE_ITEM_H_
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_offset_mapping.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_offset_mapping.cc index 92cc1c6..15073bda 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_offset_mapping.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_offset_mapping.cc
@@ -94,7 +94,10 @@ unsigned text_content_start, unsigned text_content_end) : type_(type), - layout_object_(&layout_object), + // Use atomic construction to allow for concurrently marking + // NGOffsetMappingUnit. + layout_object_(&layout_object, + Member<const LayoutObject>::AtomicInitializerTag{}), dom_start_(dom_start), dom_end_(dom_end), text_content_start_(text_content_start),
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_offset_mapping.h b/third_party/blink/renderer/core/layout/ng/inline/ng_offset_mapping.h index 71fe977..273edbbd 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_offset_mapping.h +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_offset_mapping.h
@@ -258,6 +258,15 @@ } // namespace blink -WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::NGOffsetMappingUnit) +namespace WTF { + +template <> +struct VectorTraits<blink::NGOffsetMappingUnit> + : VectorTraitsBase<blink::NGOffsetMappingUnit> { + static constexpr bool kCanClearUnusedSlotsWithMemset = true; + static constexpr bool kCanTraceConcurrently = true; +}; + +} // namespace WTF #endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_INLINE_NG_OFFSET_MAPPING_H_
diff --git a/third_party/blink/renderer/modules/scheduler/dom_task.cc b/third_party/blink/renderer/modules/scheduler/dom_task.cc index 2902880..a465f72 100644 --- a/third_party/blink/renderer/modules/scheduler/dom_task.cc +++ b/third_party/blink/renderer/modules/scheduler/dom_task.cc
@@ -67,8 +67,8 @@ ScriptState* script_state = callback_->CallbackRelevantScriptStateOrReportError("DOMTask", "Create"); DCHECK(script_state && script_state->ContextIsValid()); - probe::AsyncTaskScheduled(ExecutionContext::From(script_state), "postTask", - &async_task_id_); + async_task_context_.Schedule(ExecutionContext::From(script_state), + "postTask"); } void DOMTask::Trace(Visitor* visitor) const { @@ -121,7 +121,7 @@ ExecutionContext* context = ExecutionContext::From(script_state); DCHECK(context); - probe::AsyncTask async_task(context, &async_task_id_); + probe::AsyncTask async_task(context, &async_task_context_); probe::UserCallback probe(context, "postTask", AtomicString(), true); v8::Local<v8::Context> v8_context = script_state->GetContext(); @@ -148,8 +148,7 @@ ScriptState* script_state = callback_->CallbackRelevantScriptStateOrReportError("DOMTask", "Abort"); DCHECK(script_state && script_state->ContextIsValid()); - probe::AsyncTaskCanceled(ExecutionContext::From(script_state), - &async_task_id_); + async_task_context_.Cancel(); } void DOMTask::RecordTaskStartMetrics() {
diff --git a/third_party/blink/renderer/modules/scheduler/dom_task.h b/third_party/blink/renderer/modules/scheduler/dom_task.h index f9c9b6e..d4a238f 100644 --- a/third_party/blink/renderer/modules/scheduler/dom_task.h +++ b/third_party/blink/renderer/modules/scheduler/dom_task.h
@@ -7,7 +7,7 @@ #include "base/time/time.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" -#include "third_party/blink/renderer/core/probe/async_task_id.h" +#include "third_party/blink/renderer/core/probe/async_task_context.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cancellable_task.h" @@ -42,7 +42,7 @@ TaskHandle task_handle_; Member<V8SchedulerPostTaskCallback> callback_; Member<ScriptPromiseResolver> resolver_; - probe::AsyncTaskId async_task_id_; + probe::AsyncTaskContext async_task_context_; // Do not remove. For dynamic priority task queues, |signal_| ensures that the // associated WebSchedulingTaskQueue stays alive until after this task runs, // which is necessary to ensure throttling works correctly.
diff --git a/third_party/blink/renderer/modules/webdatabase/database.cc b/third_party/blink/renderer/modules/webdatabase/database.cc index 53bd54c..455f8ad 100644 --- a/third_party/blink/renderer/modules/webdatabase/database.cc +++ b/third_party/blink/renderer/modules/webdatabase/database.cc
@@ -35,7 +35,6 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/core/inspector/console_message.h" -#include "third_party/blink/renderer/core/probe/async_task_id.h" #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/modules/webdatabase/change_version_data.h" #include "third_party/blink/renderer/modules/webdatabase/change_version_wrapper.h" @@ -316,15 +315,14 @@ if (success && IsNew()) { STORAGE_DVLOG(1) << "Scheduling DatabaseCreationCallbackTask for database " << this; - auto task_id = std::make_unique<probe::AsyncTaskId>(); - probe::AsyncTaskScheduled(GetExecutionContext(), "openDatabase", - task_id.get()); + auto async_task_context = std::make_unique<probe::AsyncTaskContext>(); + async_task_context->Schedule(GetExecutionContext(), "openDatabase"); GetExecutionContext() ->GetTaskRunner(TaskType::kDatabaseAccess) - ->PostTask( - FROM_HERE, - WTF::Bind(&Database::RunCreationCallback, WrapPersistent(this), - WrapPersistent(creation_callback), std::move(task_id))); + ->PostTask(FROM_HERE, WTF::Bind(&Database::RunCreationCallback, + WrapPersistent(this), + WrapPersistent(creation_callback), + std::move(async_task_context))); } } @@ -333,8 +331,8 @@ void Database::RunCreationCallback( V8DatabaseCallback* creation_callback, - std::unique_ptr<probe::AsyncTaskId> task_id) { - probe::AsyncTask async_task(GetExecutionContext(), task_id.get()); + std::unique_ptr<probe::AsyncTaskContext> async_task_context) { + probe::AsyncTask async_task(GetExecutionContext(), async_task_context.get()); creation_callback->InvokeAndReportException(nullptr, this); }
diff --git a/third_party/blink/renderer/modules/webdatabase/database.h b/third_party/blink/renderer/modules/webdatabase/database.h index 8d4bbe4..bfbf4fca 100644 --- a/third_party/blink/renderer/modules/webdatabase/database.h +++ b/third_party/blink/renderer/modules/webdatabase/database.h
@@ -29,6 +29,7 @@ #include <atomic> #include "base/task/single_thread_task_runner.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_database_callback.h" +#include "third_party/blink/renderer/core/probe/async_task_context.h" #include "third_party/blink/renderer/modules/webdatabase/database_authorizer.h" #include "third_party/blink/renderer/modules/webdatabase/database_basic_types.h" #include "third_party/blink/renderer/modules/webdatabase/database_error.h" @@ -135,8 +136,9 @@ bool PerformOpenAndVerify(bool set_version_in_new_database, DatabaseError&, String& error_message); - void RunCreationCallback(V8DatabaseCallback* creation_callback, - std::unique_ptr<probe::AsyncTaskId> task_id); + void RunCreationCallback( + V8DatabaseCallback* creation_callback, + std::unique_ptr<probe::AsyncTaskContext> async_task_context); void ScheduleTransaction();
diff --git a/third_party/blink/renderer/platform/webrtc/webrtc_video_frame_adapter.cc b/third_party/blink/renderer/platform/webrtc/webrtc_video_frame_adapter.cc index b65fd114..80771ee 100644 --- a/third_party/blink/renderer/platform/webrtc/webrtc_video_frame_adapter.cc +++ b/third_party/blink/renderer/platform/webrtc/webrtc_video_frame_adapter.cc
@@ -208,10 +208,14 @@ bool CanUseGpuMemoryBufferReadback( media::VideoPixelFormat format, media::GpuVideoAcceleratorFactories* gpu_factories) { - // GMB readback only works with NV12, so only opaque buffers can be used. + // Since ConvertToWebRtcVideoFrameBuffer will always produce an opaque frame + // (unless the input is already I420A), we allow using GMB readback from + // ABGR/ARGB to NV12. return gpu_factories && (format == media::PIXEL_FORMAT_XBGR || - format == media::PIXEL_FORMAT_XRGB) && + format == media::PIXEL_FORMAT_XRGB || + format == media::PIXEL_FORMAT_ABGR || + format == media::PIXEL_FORMAT_ARGB) && base::FeatureList::IsEnabled(kWebRTCGpuMemoryBufferReadback); } @@ -244,7 +248,8 @@ // Expose the color space and pixel format that is backing // `image->GetMailboxHolder()`, or, alternatively, expose an accelerated // SkImage. - auto format = source_frame->format() == media::PIXEL_FORMAT_XBGR + auto format = (source_frame->format() == media::PIXEL_FORMAT_XBGR || + source_frame->format() == media::PIXEL_FORMAT_ABGR) ? viz::ResourceFormat::RGBA_8888 : viz::ResourceFormat::BGRA_8888; @@ -270,6 +275,17 @@ // CopyRGBATextureToVideoFrame() operates on mailboxes and not frames, so we // must manually copy over properties relevant to the encoder. + // TODO(https://crbug.com/1272852): Consider bailing out of this path if + // visible_rect or natural_size is much smaller than coded_size, or copying + // only the necessary part. + if (dst_frame->visible_rect() != source_frame->visible_rect() || + dst_frame->natural_size() != source_frame->natural_size()) { + const auto format = dst_frame->format(); + dst_frame = media::VideoFrame::WrapVideoFrame( + std::move(dst_frame), format, source_frame->visible_rect(), + source_frame->natural_size()); + DCHECK(dst_frame); + } dst_frame->set_timestamp(source_frame->timestamp()); dst_frame->set_metadata(source_frame->metadata());
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 8ee428c7..46e2206 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -1560,18 +1560,6 @@ # Incorrect native scrollbar repaint crbug.com/891944 [ Mac ] external/wpt/css/css-scrollbars/scrollbar-width-paint-001.html [ Failure ] -# css-variables - -crbug.com/1220148 external/wpt/css/css-variables/variable-declaration-07.html [ Failure ] -crbug.com/1220148 external/wpt/css/css-variables/variable-declaration-09.html [ Failure ] -crbug.com/1220148 external/wpt/css/css-variables/variable-reference-06.html [ Failure ] -crbug.com/1220148 external/wpt/css/css-variables/variable-reference-11.html [ Failure ] -crbug.com/1220148 external/wpt/css/css-variables/variable-supports-05.html [ Failure ] -crbug.com/1220148 external/wpt/css/css-variables/variable-supports-07.html [ Failure ] -crbug.com/1220148 external/wpt/css/css-variables/variable-supports-37.html [ Failure ] -crbug.com/1220148 external/wpt/css/css-variables/variable-supports-39.html [ Failure ] -crbug.com/1220149 external/wpt/css/css-variables/variable-supports-57.html [ Failure ] - # css-nesting crbug.com/1095675 external/wpt/css/selectors/nesting.html [ Failure ] @@ -2820,6 +2808,51 @@ crbug.com/626703 [ Fuchsia ] external/wpt/dom/historical.html [ Skip ] # ====== New tests from wpt-importer added here ====== +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-color/color-contrast-001.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-color/xyz-d50-004.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-color/xyz-d65-004.html [ Failure ] +crbug.com/626703 [ Linux ] external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html [ Failure ] +crbug.com/626703 [ Mac10.12 ] external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html [ Failure ] +crbug.com/626703 [ Mac10.13 ] external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html [ Failure ] +crbug.com/626703 [ Mac10.14 ] external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html [ Failure ] +crbug.com/626703 [ Mac10.15 ] external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html [ Failure ] +crbug.com/626703 [ Mac11 ] external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html [ Failure ] +crbug.com/626703 [ Win ] external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-color-property-001a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-color-property-002.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-line-height-001b.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-line-height-003c.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-line-height-004d.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-001.html [ Timeout Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-001b.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-002.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-003.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-003c.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-005.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-005b.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-005d.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-005e.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-005f.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-006a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-006b.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-006c.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-006f.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-006g.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-property-003.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-property-004a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-005.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-012a.html [ Failure Crash ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-013.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-013a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-014a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-015a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-016a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-017a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-019.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-shadow/quirks-decor-noblur.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/html/semantics/grouping-content/the-li-element/grouping-li-reftest-007.html [ Failure Crash ] +crbug.com/626703 [ Mac11-arm64 ] virtual/system-color-compute/external/wpt/css/css-color/color-contrast-001.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] virtual/system-color-compute/external/wpt/css/css-color/xyz-d50-004.html [ Failure ] crbug.com/626703 [ Linux ] external/wpt/css/css-color/color-contrast-001.html [ Failure ] crbug.com/626703 [ Mac10.12 ] external/wpt/css/css-color/color-contrast-001.html [ Failure ] crbug.com/626703 [ Mac10.13 ] external/wpt/css/css-color/color-contrast-001.html [ Failure ] @@ -2870,7 +2903,7 @@ crbug.com/626703 [ Mac10.14 ] external/wpt/css/css-text-decor/text-emphasis-line-height-003a.html [ Failure ] crbug.com/626703 [ Mac10.15 ] external/wpt/css/css-text-decor/text-emphasis-line-height-003a.html [ Failure ] crbug.com/626703 [ Win ] external/wpt/css/css-text-decor/text-emphasis-line-height-003a.html [ Failure ] -crbug.com/626703 [ Mac11 ] external/wpt/css/css-text-decor/text-emphasis-line-height-003a.html [ Timeout Failure ] +crbug.com/626703 [ Mac11 ] external/wpt/css/css-text-decor/text-emphasis-line-height-003a.html [ Failure Timeout ] crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-line-height-003a.html [ Crash Failure ] crbug.com/626703 external/wpt/css/css-text-decor/text-emphasis-line-height-003b.html [ Failure ] crbug.com/626703 [ Linux ] external/wpt/css/css-text-decor/text-emphasis-line-height-003c.html [ Failure ] @@ -7290,7 +7323,6 @@ # Sheriff 2021-07-23 crbug.com/1232388 [ Mac10.12 ] external/wpt/html/rendering/non-replaced-elements/hidden-elements.html [ Failure Pass ] -crbug.com/1232417 external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-video.https.html [ Failure Pass Timeout ] # Sheriff 2021-07-26 crbug.com/1232867 [ Mac10.12 ] fast/inline-block/contenteditable-baseline.html [ Failure Pass ] @@ -7876,7 +7908,5 @@ crbug.com/1277973 http/tests/xmlhttprequest/uri-resolution-opera-open-007.html [ Crash Failure Pass ] -crbug.com/1278738 http/tests/devtools/console/console-format-style.js [ Failure Pass ] - # Sheriff 2021-12-13 crbug.com/1279586 [ Mac ] external/wpt/IndexedDB/idbobjectstore-rename-abort.html [ Failure ]
diff --git a/third_party/blink/web_tests/android/ChromeWPTOverrideExpectations b/third_party/blink/web_tests/android/ChromeWPTOverrideExpectations index 661b3d25..843adcb0 100644 --- a/third_party/blink/web_tests/android/ChromeWPTOverrideExpectations +++ b/third_party/blink/web_tests/android/ChromeWPTOverrideExpectations
@@ -396,7 +396,7 @@ crbug.com/1050754 external/wpt/bluetooth/requestDevice/acceptAllDevices/device-with-name.https.window.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/acceptAllDevices/optional-services-missing.https.window.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/acceptAllDevices/optional-services-present.https.window.html [ Failure ] -crbug.com/1050754 external/wpt/bluetooth/requestDevice/blocklisted-service-in-filter.https.window.html [ Failure ] +crbug.com/1050754 external/wpt/bluetooth/requestDevice/blocklisted-service-in-filter.https.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/blocklisted-service-in-optionalServices.https.window.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/canonicalizeFilter/device-name-longer-than-29-bytes.https.window.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/canonicalizeFilter/empty-filter.https.window.html [ Failure ]
diff --git a/third_party/blink/web_tests/android/WebLayerWPTOverrideExpectations b/third_party/blink/web_tests/android/WebLayerWPTOverrideExpectations index c95e7b1c..f624940 100644 --- a/third_party/blink/web_tests/android/WebLayerWPTOverrideExpectations +++ b/third_party/blink/web_tests/android/WebLayerWPTOverrideExpectations
@@ -457,7 +457,7 @@ crbug.com/1050754 external/wpt/bluetooth/requestDevice/acceptAllDevices/device-with-name.https.window.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/acceptAllDevices/optional-services-missing.https.window.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/acceptAllDevices/optional-services-present.https.window.html [ Failure ] -crbug.com/1050754 external/wpt/bluetooth/requestDevice/blocklisted-service-in-filter.https.window.html [ Failure ] +crbug.com/1050754 external/wpt/bluetooth/requestDevice/blocklisted-service-in-filter.https.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/blocklisted-service-in-optionalServices.https.window.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/canonicalizeFilter/data-prefix-and-mask-size.https.window.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/canonicalizeFilter/dataPrefix-buffer-is-detached.https.window.html [ Failure ]
diff --git a/third_party/blink/web_tests/android/WebviewWPTExpectations b/third_party/blink/web_tests/android/WebviewWPTExpectations index 3ebd097..ee651a8 100644 --- a/third_party/blink/web_tests/android/WebviewWPTExpectations +++ b/third_party/blink/web_tests/android/WebviewWPTExpectations
@@ -355,7 +355,7 @@ crbug.com/1050754 external/wpt/bluetooth/requestDevice/acceptAllDevices/device-with-name.https.window.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/acceptAllDevices/optional-services-missing.https.window.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/acceptAllDevices/optional-services-present.https.window.html [ Failure ] -crbug.com/1050754 external/wpt/bluetooth/requestDevice/blocklisted-service-in-filter.https.window.html [ Failure ] +crbug.com/1050754 external/wpt/bluetooth/requestDevice/blocklisted-service-in-filter.https.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/blocklisted-service-in-optionalServices.https.window.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/canonicalizeFilter/device-name-longer-than-29-bytes.https.window.html [ Failure ] crbug.com/1050754 external/wpt/bluetooth/requestDevice/canonicalizeFilter/empty-filter.https.window.html [ Failure ]
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json index 2a1bac83..d016803 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json
@@ -152163,6 +152163,19 @@ {} ] ], + "table-child-percentage-height-with-border-box.html": [ + "7700b00dc3239245e38f90c72df944ef04a36998", + [ + null, + [ + [ + "/css/css-sizing/table-child-percentage-height-with-border-box-expected.html", + "==" + ] + ], + {} + ] + ], "thin-element-render.html": [ "fa587360a6d2625c8f02cd7f0eba54b3bb09a1f1", [ @@ -334359,7 +334372,7 @@ ] ], "AmbientLightSensor.https.html": [ - "7d23896a6488f3fdfef6809f552a06f03fe427a3", + "0ccb899ec237a0de885622a66c26677193f749c5", [ null, { @@ -356502,7 +356515,7 @@ ], "parsing": { "color-computed.html": [ - "d78e92b81e106f52026aeeedbc2b104e987e5639", + "6d0a7074f76c086117c5b3a964003aa94f49e814", [ null, {} @@ -356729,15 +356742,15 @@ null, {} ] + ], + "conditional-CSSGroupingRule.html": [ + "bde92d7091bd0ace1320acb5d0d8f56c33def22e", + [ + null, + {} + ] ] - }, - "test_group_insertRule.html": [ - "e9e8cce8ffaeb983eed7a84e33da04cc4c3a5242", - [ - null, - {} - ] - ] + } }, "css-contain": { "contain-chrome-thcrash-001.html": [ @@ -462836,6 +462849,13 @@ {} ] ], + "intersection-ratio-with-fractional-bounds-2.html": [ + "1e250accd8e43e84050f735cdd42f30d1ef7f931", + [ + null, + {} + ] + ], "intersection-ratio-with-fractional-bounds.html": [ "9f54bef976782ad7ebb28b17b6e151a059840f49", [ @@ -558584,6 +558604,13 @@ null, {} ] + ], + "table-child-percentage-height-with-border-box-expected.html": [ + "2b0a2f451c59b21471d5b2984c2c01aae2cfa5ce", + [ + null, + {} + ] ] }, "css-text": {
diff --git a/third_party/blink/web_tests/external/wpt/accessibility/crashtests/computed-node-checked.html b/third_party/blink/web_tests/external/wpt/accessibility/crashtests/computed-node-checked.html new file mode 100644 index 0000000..a413d26 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/accessibility/crashtests/computed-node-checked.html
@@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html class="test-wait"> +<body> +</body> +<script src="/resources/testharness.js"></script> +<script> +if (window.chrome && chrome.gpuBenchmarking) { + chrome.gpuBenchmarking.pointerActionSequence( + [ + { + source: 'pen', + actions: [ + { name: 'pointerMove', x: 50, y: 50 } + ] + } + ] + ); +} +</script> +<script>step_timeout(gc, 50);</script> +<script> + const frameElem = document.createElement('iframe'); + + frameElem.srcdoc = '<div></div>'; + frameElem.onload = function() { + const frameDoc = frameElem.contentWindow.document; + const divElem = frameDoc.querySelector('div'); + getComputedAccessibleNode(divElem).then(function(divAccessible) { + frameElem.remove(); + requestAnimationFrame(() => { + const isChecked = divAccessible.checked; + document.documentElement.className = ''; + }); + }); + }; + document.body.appendChild(frameElem); +</script> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/accessibility/crashtests/multicol-with-text-change-role-relayout-crash.html b/third_party/blink/web_tests/external/wpt/accessibility/crashtests/multicol-with-text-change-role-relayout-crash.html new file mode 100644 index 0000000..d1ecd16d --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/accessibility/crashtests/multicol-with-text-change-role-relayout-crash.html
@@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html class="test-wait"> +<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org"> +<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1278439"> +<div id="container"> + <div id="mc" style="columns:2; column-fill:auto; width:200px; height:30px; line-height:20px; orphans:1; widows:1;"> + x<br> + x<br> + </div> +</div> +<script> + requestAnimationFrame(()=> { + requestAnimationFrame(()=> { + requestAnimationFrame(()=> { + mc.style.width = "201px"; + container.setAttribute("role", "treegrid"); + document.body.offsetTop; + document.documentElement.className = ""; + }); + }); + }); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/bluetooth/requestDevice/blocklisted-service-in-filter.https.html b/third_party/blink/web_tests/external/wpt/bluetooth/requestDevice/blocklisted-service-in-filter.https.html new file mode 100644 index 0000000..cb2f989 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/bluetooth/requestDevice/blocklisted-service-in-filter.https.html
@@ -0,0 +1,26 @@ +<!DOCTYPE html> +<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="/bluetooth/resources/bluetooth-test.js"></script> +<script src="/bluetooth/resources/bluetooth-fake-devices.js"></script> +<script> +'use strict'; +const test_desc = 'Reject with SecurityError if requesting a blocklisted ' + + 'service.'; +const expected = new DOMException( + 'requestDevice() called with a filter containing a blocklisted UUID. ' + + 'https://goo.gl/4NeimX', + 'SecurityError'); + +bluetooth_test( + () => + setUpPreconnectedDevice({knownServiceUUIDs: ['human_interface_device']}) + .then( + () => assert_promise_rejects_with_message( + requestDeviceWithTrustedClick( + {filters: [{services: ['human_interface_device']}]}), + expected, 'Requesting blocklisted service rejects.')), + test_desc); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/bluetooth/requestDevice/blocklisted-service-in-filter.https.window.js b/third_party/blink/web_tests/external/wpt/bluetooth/requestDevice/blocklisted-service-in-filter.https.window.js deleted file mode 100644 index e17f7aa..0000000 --- a/third_party/blink/web_tests/external/wpt/bluetooth/requestDevice/blocklisted-service-in-filter.https.window.js +++ /dev/null
@@ -1,23 +0,0 @@ -// META: script=/resources/testharness.js -// META: script=/resources/testharnessreport.js -// META: script=/resources/testdriver.js -// META: script=/resources/testdriver-vendor.js -// META: script=/bluetooth/resources/bluetooth-test.js -// META: script=/bluetooth/resources/bluetooth-fake-devices.js -'use strict'; -const test_desc = 'Reject with SecurityError if requesting a blocklisted ' + - 'service.'; -const expected = new DOMException( - 'requestDevice() called with a filter containing a blocklisted UUID. ' + - 'https://goo.gl/4NeimX', - 'SecurityError'); - -bluetooth_test(async () => { - assert_promise_rejects_with_message( - setUpPreconnectedFakeDevice({ - fakeDeviceOptions: {knownServiceUUIDs: ['human_interface_device']}, - requestDeviceOptions: - {filters: [{services: ['human_interface_device']}]} - }), - expected, 'Requesting blocklisted service rejects.'); -}, test_desc);
diff --git a/third_party/blink/web_tests/external/wpt/css/css-color/parsing/color-computed.html b/third_party/blink/web_tests/external/wpt/css/css-color/parsing/color-computed.html index d78e92b..6d0a707 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-color/parsing/color-computed.html +++ b/third_party/blink/web_tests/external/wpt/css/css-color/parsing/color-computed.html
@@ -4,6 +4,9 @@ <meta charset="utf-8"> <title>CSS Color Module Level 3: getComputedStyle().color</title> <link rel="help" href="https://drafts.csswg.org/css-color/#propdef-color"> +<link rel="help" href="https://drafts.csswg.org/css-color-4/#serializing-color-function-values"> +<link rel="help" href="https://drafts.csswg.org/css-color-4/#serializing-lab-lch"> +<link rel="help" href="https://drafts.csswg.org/css-color-4/#serializing-oklab-oklch"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/css/support/computed-testcommon.js"></script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-conditional/js/conditional-CSSGroupingRule.html b/third_party/blink/web_tests/external/wpt/css/css-conditional/js/conditional-CSSGroupingRule.html new file mode 100644 index 0000000..bde92d7 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-conditional/js/conditional-CSSGroupingRule.html
@@ -0,0 +1,244 @@ +<!DOCTYPE HTML> +<html lang=en> + <title>CSSGroupingRule Conditional Rules Test</title> + <link rel="author" title="L. David Baron" href="https://dbaron.org/"> + <link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact"> + <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> + <link rel="help" href="http://www.w3.org/TR/css3-conditional/#the-cssgroupingrule-interface"> + <meta name="assert" content="requirements in definition of insertRule"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + +<style id="style"> + @media unsupported { /* tests need to work even if condition is false */ } + @supports (unsupported: value) { } +</style> +<div id=log></div> +<div id="test"></div> +<script> + + var rules = document.getElementById("style").sheet.cssRules; + var rule_names = ["@media", "@supports"]; + var rule_types = [CSSRule.MEDIA_RULE, CSSRule.SUPPORTS_RULE] + var rule_nums = [4, 12] + + for (let i = 0; i < 2; i++) { + var grouping_rule = rules[i]; + var rule_name = rule_names[i]; + + test(function() { + assert_true(grouping_rule instanceof CSSGroupingRule, + rule_name + " instanceof CSSGroupingRule"); + }, + rule_name + " is CSSGroupingRule"); + + test(function() { + assert_equals(grouping_rule.type, rule_types[i], + "Rule type of " + rule_name + " rule"); + assert_equals(grouping_rule.type, rule_nums[i], + "Rule number of " + rule_name + " rule"); + }, + rule_name + " rule type"); + + test(function() { + assert_equals(grouping_rule.cssRules.length, 0, + "Starting cssRules.length of " + rule_name + " rule"); + }, + "Empty " + rule_name + " rule length"); + + test(function() { + assert_throws_dom("HIERARCHY_REQUEST_ERR", + function() { + grouping_rule.insertRule("@import url(foo.css);", 0); + }, + "inserting a disallowed rule should throw HIERARCHY_REQUEST_ERR"); + }, + "insertRule of @import into " + rule_name); + + test(function() { + assert_throws_dom("INDEX_SIZE_ERR", + function() { + grouping_rule.insertRule("p { color: green }", 1); + }, + "inserting at a bad index throws INDEX_SIZE_ERR"); + }, + "insertRule into empty " + rule_name + " at bad index"); + + test(function() { + grouping_rule.insertRule("p { color: green }", 0); + assert_equals(grouping_rule.cssRules.length, 1, + "Modified cssRules.length of " + rule_name + " rule"); + grouping_rule.insertRule("p { color: blue }", 1); + assert_equals(grouping_rule.cssRules.length, 2, + "Modified cssRules.length of " + rule_name + " rule"); + grouping_rule.insertRule("p { color: aqua }", 1); + assert_equals(grouping_rule.cssRules.length, 3, + "Modified cssRules.length of " + rule_name + " rule"); + assert_throws_dom("INDEX_SIZE_ERR", + function() { + grouping_rule.insertRule("p { color: green }", 4); + }, + "inserting at a bad index throws INDEX_SIZE_ERR"); + assert_equals(grouping_rule.cssRules.length, 3, + "Modified cssRules.length of " + rule_name + " rule"); + }, + "insertRule into " + rule_name + " updates length"); + + test(function() { + while (grouping_rule.cssRules.length > 0) { + grouping_rule.deleteRule(0); + } + grouping_rule.insertRule("@media print {}", 0); + assert_equals(grouping_rule.cssRules.length, 1, + "Modified cssRules.length of " + rule_name + " rule"); + assert_equals(grouping_rule.cssRules[0].type, CSSRule.MEDIA_RULE, + "inserting syntactically correct media rule succeeds"); + }, + "insertRule of valid @media into " + rule_name); + + test(function() { + while (grouping_rule.cssRules.length > 0) { + grouping_rule.deleteRule(0); + } + grouping_rule.insertRule("p { color: yellow }", 0); + assert_equals(grouping_rule.cssRules.length, 1, + "Modified cssRules.length of " + rule_name + " rule"); + assert_equals(grouping_rule.cssRules[0].type, CSSRule.STYLE_RULE, + "inserting syntactically correct style rule succeeds"); + }, + "insertRule of valid style rule into " + rule_name); + + test(function() { + while (grouping_rule.cssRules.length > 0) { + grouping_rule.deleteRule(0); + } + assert_throws_dom("SYNTAX_ERR", + function() { + grouping_rule.insertRule("@media bad syntax;", 0); + }, + "inserting syntactically invalid rule throws syntax error"); + assert_equals(grouping_rule.cssRules.length, 0, + "Modified cssRules.length of " + rule_name + " rule"); + }, + "insertRule of invalid @media into " + rule_name); + + test(function() { + while (grouping_rule.cssRules.length > 0) { + grouping_rule.deleteRule(0); + } + assert_throws_dom("SYNTAX_ERR", + function() { + grouping_rule.insertRule("", 0); + }, + "inserting empty rule throws syntax error"); + assert_equals(grouping_rule.cssRules.length, 0, + "Modified cssRules.length of " + rule_name + " rule"); + }, + "insertRule of empty string into " + rule_name); + + test(function() { + while (grouping_rule.cssRules.length > 0) { + grouping_rule.deleteRule(0); + } + assert_throws_dom("SYNTAX_ERR", + function() { + grouping_rule.insertRule("@media print {} foo", 0); + }, + "inserting rule with garbage afterwards throws syntax error"); + assert_equals(grouping_rule.cssRules.length, 0, + "Modified cssRules.length of " + rule_name + " rule"); + }, + "insertRule of valid @media rule followed by garbage into " + rule_name); + + test(function() { + while (grouping_rule.cssRules.length > 0) { + grouping_rule.deleteRule(0); + } + assert_throws_dom("SYNTAX_ERR", + function() { + grouping_rule.insertRule("p { color: yellow } foo", 0); + }, + "inserting rule with garbage afterwards throws syntax error"); + assert_equals(grouping_rule.cssRules.length, 0, + "Modified cssRules.length of " + rule_name + " rule"); + }, + "insertRule of valid style rule followed by garbage into " + rule_name); + + test(function() { + while (grouping_rule.cssRules.length > 0) { + grouping_rule.deleteRule(0); + } + assert_throws_dom("SYNTAX_ERR", + function() { + grouping_rule.insertRule("@media print {} @media print {}", 0); + }, + "inserting multiple rules throws syntax error"); + assert_equals(grouping_rule.cssRules.length, 0, + "Modified cssRules.length of " + rule_name + " rule"); + }, + "insertRule of mutiple valid @media into " + rule_name); + + test(function() { + while (grouping_rule.cssRules.length > 0) { + grouping_rule.deleteRule(0); + } + assert_throws_dom("SYNTAX_ERR", + function() { + grouping_rule.insertRule("p { color: yellow } @media print {}", 0); + }, + "inserting multiple rules throws syntax error"); + assert_equals(grouping_rule.cssRules.length, 0, + "Modified cssRules.length of " + rule_name + " rule"); + }, + "insertRule of valid style rulle followed by valid @media into " + rule_name); + + test(function() { + while (grouping_rule.cssRules.length > 0) { + grouping_rule.deleteRule(0); + } + assert_throws_dom("SYNTAX_ERR", + function() { + grouping_rule.insertRule("@media print {} p { color: yellow }", 0); + }, + "inserting multiple rules throws syntax error"); + assert_equals(grouping_rule.cssRules.length, 0, + "Modified cssRules.length of " + rule_name + " rule"); + }, + "insertRule of valid style rule followed by valid @media into " + rule_name); + + test(function() { + while (grouping_rule.cssRules.length > 0) { + grouping_rule.deleteRule(0); + } + assert_throws_dom("SYNTAX_ERR", + function() { + grouping_rule.insertRule("p { color: yellow } p { color: yellow }", 0); + }, + "inserting multiple rules throws syntax error"); + assert_equals(grouping_rule.cssRules.length, 0, + "Modified cssRules.length of " + rule_name + " rule"); + }, + "insertRule of two valid style rules into " + rule_name); + + test(function() { + while (grouping_rule.cssRules.length > 0) { + grouping_rule.deleteRule(0); + } + var res = grouping_rule.insertRule("p { color: green }", 0); + assert_equals(res, 0, "return value should be index"); + assert_equals(grouping_rule.cssRules.length, 1, + "Modified cssRules.length of " + rule_name + " rule"); + res = grouping_rule.insertRule("p { color: green }", 0); + assert_equals(res, 0, "return value should be index"); + assert_equals(grouping_rule.cssRules.length, 2, + "Modified cssRules.length of " + rule_name + " rule"); + res = grouping_rule.insertRule("p { color: green }", 2); + assert_equals(res, 2, "return value should be index"); + assert_equals(grouping_rule.cssRules.length, 3, + "Modified cssRules.length of " + rule_name + " rule"); + }, + "Return value of insertRule into " + rule_name); + } +</script> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-conditional/test_group_insertRule.html b/third_party/blink/web_tests/external/wpt/css/css-conditional/test_group_insertRule.html deleted file mode 100644 index e9e8cce8..0000000 --- a/third_party/blink/web_tests/external/wpt/css/css-conditional/test_group_insertRule.html +++ /dev/null
@@ -1,222 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <title>CSS Variables Allowed Syntax</title> - <link rel="author" title="L. David Baron" href="https://dbaron.org/"> - <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> - <link rel="help" href="http://www.w3.org/TR/css3-conditional/#the-cssgroupingrule-interface"> - <meta name="assert" content="requirements in definition of insertRule"> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> -<style id="style"> -@media print {} -</style> -</head> -<body> -<div id=log></div> -<div id="test"></div> -<script> - - var sheet = document.getElementById("style").sheet; - - var grouping_rule = sheet.cssRules[0]; - - test(function() { - assert_equals(grouping_rule.type, CSSRule.MEDIA_RULE, - "Rule type of @media rule"); - }, - "rule_type"); - - test(function() { - assert_equals(grouping_rule.cssRules.length, 0, - "Starting cssRules.length of @media rule"); - }, - "rule_length"); - - test(function() { - assert_throws_dom("HIERARCHY_REQUEST_ERR", - function() { - grouping_rule.insertRule("@import url(foo.css);", 0); - }, - "inserting a disallowed rule should throw HIERARCHY_REQUEST_ERR"); - }, - "insert_import_throws"); - - test(function() { - assert_throws_dom("INDEX_SIZE_ERR", - function() { - grouping_rule.insertRule("p { color: green }", 1); - }, - "inserting at a bad index throws INDEX_SIZE_ERR"); - }, - "insert_index_throws1"); - test(function() { - grouping_rule.insertRule("p { color: green }", 0); - assert_equals(grouping_rule.cssRules.length, 1, - "Modified cssRules.length of @media rule"); - grouping_rule.insertRule("p { color: blue }", 1); - assert_equals(grouping_rule.cssRules.length, 2, - "Modified cssRules.length of @media rule"); - grouping_rule.insertRule("p { color: aqua }", 1); - assert_equals(grouping_rule.cssRules.length, 3, - "Modified cssRules.length of @media rule"); - assert_throws_dom("INDEX_SIZE_ERR", - function() { - grouping_rule.insertRule("p { color: green }", 4); - }, - "inserting at a bad index throws INDEX_SIZE_ERR"); - assert_equals(grouping_rule.cssRules.length, 3, - "Modified cssRules.length of @media rule"); - }, - "insert_index_throws2"); - - test(function() { - while (grouping_rule.cssRules.length > 0) { - grouping_rule.deleteRule(0); - } - grouping_rule.insertRule("@media print {}", 0); - assert_equals(grouping_rule.cssRules.length, 1, - "Modified cssRules.length of @media rule"); - assert_equals(grouping_rule.cssRules[0].type, CSSRule.MEDIA_RULE, - "inserting syntactically correct media rule succeeds"); - }, - "insert_media_succeed"); - test(function() { - while (grouping_rule.cssRules.length > 0) { - grouping_rule.deleteRule(0); - } - grouping_rule.insertRule("p { color: yellow }", 0); - assert_equals(grouping_rule.cssRules.length, 1, - "Modified cssRules.length of @media rule"); - assert_equals(grouping_rule.cssRules[0].type, CSSRule.STYLE_RULE, - "inserting syntactically correct style rule succeeds"); - }, - "insert_style_succeed"); - test(function() { - while (grouping_rule.cssRules.length > 0) { - grouping_rule.deleteRule(0); - } - assert_throws_dom("SYNTAX_ERR", - function() { - grouping_rule.insertRule("@media bad syntax;", 0); - }, - "inserting syntactically invalid rule throws syntax error"); - assert_equals(grouping_rule.cssRules.length, 0, - "Modified cssRules.length of @media rule"); - }, - "insert_bad_media_throw"); - test(function() { - while (grouping_rule.cssRules.length > 0) { - grouping_rule.deleteRule(0); - } - assert_throws_dom("SYNTAX_ERR", - function() { - grouping_rule.insertRule("", 0); - }, - "inserting empty rule throws syntax error"); - assert_equals(grouping_rule.cssRules.length, 0, - "Modified cssRules.length of @media rule"); - }, - "insert_empty_throw"); - test(function() { - while (grouping_rule.cssRules.length > 0) { - grouping_rule.deleteRule(0); - } - assert_throws_dom("SYNTAX_ERR", - function() { - grouping_rule.insertRule("@media print {} foo", 0); - }, - "inserting rule with garbage afterwards throws syntax error"); - assert_equals(grouping_rule.cssRules.length, 0, - "Modified cssRules.length of @media rule"); - }, - "insert_garbage_after_media_throw"); - test(function() { - while (grouping_rule.cssRules.length > 0) { - grouping_rule.deleteRule(0); - } - assert_throws_dom("SYNTAX_ERR", - function() { - grouping_rule.insertRule("p { color: yellow } foo", 0); - }, - "inserting rule with garbage afterwards throws syntax error"); - assert_equals(grouping_rule.cssRules.length, 0, - "Modified cssRules.length of @media rule"); - }, - "insert_garbage_after_style_throw"); - test(function() { - while (grouping_rule.cssRules.length > 0) { - grouping_rule.deleteRule(0); - } - assert_throws_dom("SYNTAX_ERR", - function() { - grouping_rule.insertRule("@media print {} @media print {}", 0); - }, - "inserting multiple rules throws syntax error"); - assert_equals(grouping_rule.cssRules.length, 0, - "Modified cssRules.length of @media rule"); - }, - "insert_two_media_throw"); - test(function() { - while (grouping_rule.cssRules.length > 0) { - grouping_rule.deleteRule(0); - } - assert_throws_dom("SYNTAX_ERR", - function() { - grouping_rule.insertRule("p { color: yellow } @media print {}", 0); - }, - "inserting multiple rules throws syntax error"); - assert_equals(grouping_rule.cssRules.length, 0, - "Modified cssRules.length of @media rule"); - }, - "insert_style_media_throw"); - test(function() { - while (grouping_rule.cssRules.length > 0) { - grouping_rule.deleteRule(0); - } - assert_throws_dom("SYNTAX_ERR", - function() { - grouping_rule.insertRule("@media print {} p { color: yellow }", 0); - }, - "inserting multiple rules throws syntax error"); - assert_equals(grouping_rule.cssRules.length, 0, - "Modified cssRules.length of @media rule"); - }, - "insert_media_style_throw"); - test(function() { - while (grouping_rule.cssRules.length > 0) { - grouping_rule.deleteRule(0); - } - assert_throws_dom("SYNTAX_ERR", - function() { - grouping_rule.insertRule("p { color: yellow } p { color: yellow }", 0); - }, - "inserting multiple rules throws syntax error"); - assert_equals(grouping_rule.cssRules.length, 0, - "Modified cssRules.length of @media rule"); - }, - "insert_two_style_throw"); - - test(function() { - while (grouping_rule.cssRules.length > 0) { - grouping_rule.deleteRule(0); - } - var res = grouping_rule.insertRule("p { color: green }", 0); - assert_equals(res, 0, "return value should be index"); - assert_equals(grouping_rule.cssRules.length, 1, - "Modified cssRules.length of @media rule"); - res = grouping_rule.insertRule("p { color: green }", 0); - assert_equals(res, 0, "return value should be index"); - assert_equals(grouping_rule.cssRules.length, 2, - "Modified cssRules.length of @media rule"); - res = grouping_rule.insertRule("p { color: green }", 2); - assert_equals(res, 2, "return value should be index"); - assert_equals(grouping_rule.cssRules.length, 3, - "Modified cssRules.length of @media rule"); - }, - "insert_retval"); - - -</script> -</body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box-expected.html b/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box-expected.html new file mode 100644 index 0000000..2b0a2f45 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box-expected.html
@@ -0,0 +1,38 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Test if percentage height of table's child element with box-sizing: border-box is calculated correctly</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing/#box-sizing"> +<style> + html { + height: 100%; + width: 100%; + } + body { + box-sizing: border-box; + display: table; + margin: 0 auto; + width: 100%; + height: 100%; + } + .content { + box-sizing: border-box; + display: table-row; + width: 100%; + height: 100%; + background-color: red; + } + .wrapper { + box-sizing: content-box; + width: 100%; + height: 100%; + background-color: green; + padding-top: 100px; + } +</style> +<body> + <div class="content"> + <div class="wrapper"> + wrapped content (height: 100%) + </div> + </div> +</body>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html b/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html new file mode 100644 index 0000000..7700b00d --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html
@@ -0,0 +1,39 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Test if percentage height of table's child element with box-sizing: border-box is calculated correctly</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing/#box-sizing"> +<link rel="match" href="table-child-percentage-height-with-border-box-expected.html"> +<style> + html { + height: 100%; + width: 100%; + } + body { + box-sizing: border-box; + display: table; + margin: 0 auto; + width: 100%; + height: 100%; + } + .content { + box-sizing: border-box; + display: table-row; + width: 100%; + height: 100%; + background-color: red; + } + .wrapper { + box-sizing: border-box; + width: 100%; + height: 100%; + background-color: green; + padding-top: 100px; + } +</style> +<body> + <div class="content"> + <div class="wrapper"> + wrapped content (height: 100%) + </div> + </div> +</body>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition-expected.txt index 3cccbb4..032ffac 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition-expected.txt +++ b/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 73 tests; 47 PASS, 26 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 73 tests; 50 PASS, 23 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS no variable PASS variable PASS single char variable @@ -8,7 +8,7 @@ FAIL white space value (single space) assert_equals: Expected Value should match actual value expected "" but got " " FAIL white space value (double space) assert_equals: Expected Value should match actual value expected "" but got " " PASS overwrite -FAIL can't overwrite with no value assert_equals: Expected Value should match actual value expected "" but got "value" +PASS can overwrite with no value FAIL can overwrite with space value assert_equals: Expected Value should match actual value expected "" but got " " PASS case sensetivity PASS case sensetivity2 @@ -31,7 +31,7 @@ FAIL white space value (single space) (Computed Style) assert_equals: Expected Value should match actual value expected "" but got " " FAIL white space value (double space) (Computed Style) assert_equals: Expected Value should match actual value expected "" but got " " PASS overwrite (Computed Style) -FAIL can't overwrite with no value (Computed Style) assert_equals: Expected Value should match actual value expected "" but got "value" +PASS can overwrite with no value (Computed Style) FAIL can overwrite with space value (Computed Style) assert_equals: Expected Value should match actual value expected "" but got " " PASS case sensetivity (Computed Style) PASS case sensetivity2 (Computed Style) @@ -54,7 +54,7 @@ FAIL white space value (single space) (Cascading) assert_equals: Expected Value should match actual value expected "" but got " " FAIL white space value (double space) (Cascading) assert_equals: Expected Value should match actual value expected "" but got " " PASS overwrite (Cascading) -FAIL can't overwrite with no value (Cascading) assert_equals: Expected Value should match actual value expected "" but got "value" +PASS can overwrite with no value (Cascading) FAIL can overwrite with space value (Cascading) assert_equals: Expected Value should match actual value expected "" but got " " PASS case sensetivity (Cascading) PASS case sensetivity2 (Cascading)
diff --git a/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition.html b/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition.html index 5ad71f7f..0f9cefc5 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition.html +++ b/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition.html
@@ -26,7 +26,7 @@ { varName:"--var", expectedValue:"", style:"--var: ", testName:"white space value (single space)"}, { varName:"--var", expectedValue:"", style:"--var: ", testName:"white space value (double space)"}, { varName:"--var", expectedValue:"value2", style:"--var:value1; --var:value2", testName:"overwrite"}, - { varName:"--var", expectedValue:"", style:"--var:value;--var:;", testName:"can't overwrite with no value"}, + { varName:"--var", expectedValue:"", style:"--var:value;--var:;", testName:"can overwrite with no value"}, { varName:"--var", expectedValue:"", style:"--var:value;--var: ;", testName:"can overwrite with space value"}, { varName:"--var", expectedValue:"value1", style:"--var:value1; --Var:value2", testName:"case sensetivity"}, { varName:"--Var", expectedValue:"value2", style:"--var:value1; --Var:value2", testName:"case sensetivity2"},
diff --git a/third_party/blink/web_tests/external/wpt/css/css-variables/variable-reference-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-variables/variable-reference-expected.txt deleted file mode 100644 index 904ca589..0000000 --- a/third_party/blink/web_tests/external/wpt/css/css-variables/variable-reference-expected.txt +++ /dev/null
@@ -1,21 +0,0 @@ -This is a testharness.js-based test. -PASS width: var(--prop); -PASS width: var(--prop) !important; -PASS width: var(--prop, ); -PASS width: var(--prop, 20px); -PASS width: var(--prop, blue); -PASS width: var(--prop1, var(--prop2)); -PASS width: var(--prop1, var(--prop2, var(--prop3, auto))); -PASS width: var(--prop1) var(--prop2) -FAIL width: var(--prop,); assert_equals: expected "var(--prop,)" but got "" -PASS width: var(); -PASS width: var(prop); -PASS width: var(-prop); -PASS width: var(--prop 20px); -PASS width: var(--prop, var(prop)); -PASS width: var(--prop, var(-prop)); -PASS width: var(20px); -PASS width: var(var(--prop)); -PASS Variable reference left open at end of stylesheet -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/lint.ignore b/third_party/blink/web_tests/external/wpt/lint.ignore index decc2023..cffb1f1 100644 --- a/third_party/blink/web_tests/external/wpt/lint.ignore +++ b/third_party/blink/web_tests/external/wpt/lint.ignore
@@ -759,6 +759,7 @@ AHEM SYSTEM FONT: infrastructure/assumptions/ahem.html # Existing crashtests using testharness +TESTHARNESS-IN-OTHER-TYPE: accessibility/crashtests/computed-node-checked.html TESTHARNESS-IN-OTHER-TYPE: html/canvas/element/manual/wide-gamut-canvas/imagedata-no-color-settings-crash.html TESTHARNESS-IN-OTHER-TYPE: css/CSS2/floats-clear/adjoining-float-new-fc-crash.html TESTHARNESS-IN-OTHER-TYPE: css/CSS2/floats/floats-saturated-position-crash.html @@ -798,6 +799,9 @@ TESTHARNESS-IN-OTHER-TYPE: svg/extensibility/foreignObject/foreign-object-under-defs-crash.html TESTHARNESS-IN-OTHER-TYPE: svg/svg-in-svg/svg-in-svg-circular-filter-reference-crash.html +# Adding the testharnessreport.js script causes the test to never complete. +MISSING-TESTHARNESSREPORT: accessibility/crashtests/computed-node-checked.html + PRINT STATEMENT: webdriver/tests/print/printcmd.py PRINT STATEMENT: webdriver/tests/print/user_prompts.py
diff --git a/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-video.https.html b/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-video.https.html index 517a693..a6f73f00 100644 --- a/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-video.https.html +++ b/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-video.https.html
@@ -18,11 +18,11 @@ function makeVideoFrame(timestamp) { const canvas = new OffscreenCanvas(width, height); - const ctx = canvas.getContext('2d', { alpha: false }); - ctx.fillStyle = `rgba(${pixelColour[0]}, ${pixelColour[1]}, ${pixelColour[2]}, ${pixelColour[3]})`; + const ctx = canvas.getContext('2d', {alpha: false}); + ctx.fillStyle = `rgba(${pixelColour.join()})`; ctx.fillRect(0, 0, width, height); - return new VideoFrame(canvas.transferToImageBitmap(), { timestamp, alpha: 'discard' }); + return new VideoFrame(canvas, {timestamp, alpha: 'discard'}); } async function getVideoFrame() { @@ -35,8 +35,7 @@ return result.value; } - function assertPixel(t, bytes, expected) { - const epsilon = 5; + function assertPixel(t, bytes, expected, epsilon = 5) { for (let i = 0; i < bytes.length; i++) { t.step(() => { assert_less_than(Math.abs(bytes[i] - expected[i]), epsilon, "Mismatched pixel"); @@ -55,7 +54,7 @@ exchangeIceCandidates(caller, callee); // Wait for the first track. const e = await exchangeOfferAndListenToOntrack(t, caller, callee); - output.srcObject = new MediaStream([e.track]) + output.srcObject = new MediaStream([e.track]); // Exchange answer. await exchangeAnswer(caller, callee); await waitForConnectionStateChange(callee, ['connected']); @@ -121,51 +120,134 @@ }, 'Tests that frames are actually rendered correctly in a stream used for a video element.'); promise_test(async t => { - const generator = new MediaStreamTrackGenerator({ kind: 'video' }); + const generator = new MediaStreamTrackGenerator({kind: 'video'}); t.add_cleanup(() => generator.stop()); - const video = document.createElement("video"); + // Write frames for the duration of the test. + const writer = generator.writable.getWriter(); + let timestamp = 0; + const intervalId = setInterval( + t.step_func(async () => { + if (generator.readyState === 'live') { + timestamp++; + await writer.write(makeVideoFrame(timestamp)); + } + }), + 40); + t.add_cleanup(() => clearInterval(intervalId)); + + const video = document.createElement('video'); video.autoplay = true; video.width = width; video.height = height; video.muted = true; - let connectedResolver; - const connectedPromise = new Promise((resolve) => connectedResolver = resolve); - // Wait for the video element to be connected to the generator and - // generate some frames. - video.onloadstart = async () => { - // Ensure the peer connection has connected before injecting frames. - await connectedPromise; - let writer = generator.writable.getWriter(); - for (let i = 0; i < 5; i++) { - await writer.write(makeVideoFrame(i)); - // FIXME: this makes the test non-flaky - // See also https://bugs.chromium.org/p/chromium/issues/detail?id=1232417&q=mediastreamtrackgenerator%20flaky&can=2 - await new Promise(res => t.step_timeout(res, 1)); - } - }; + await initiateSingleTrackCall(t, generator, video); - let videoPlayPromise = new Promise((resolve)=> { + return new Promise(resolve => { video.ontimeupdate = t.step_func(() => { - const canvas = document.createElement("canvas"); + const canvas = document.createElement('canvas'); canvas.width = width; canvas.height = height; const context = canvas.getContext('2d'); context.drawImage(video, 0, 0); - // Pick a pixel in the centre of the video and check that it has the colour of the frame provided. + // Pick a pixel in the centre of the video and check that it has the + // colour of the frame provided. const pixel = context.getImageData(width / 2, height / 2, 1, 1); - assertPixel(t, pixel.data, pixelColour); + // Encoding/decoding can add noise, so increase the threshhold to 8. + assertPixel(t, pixel.data, pixelColour, 8); resolve(); }); }); - - await initiateSingleTrackCall(t, generator, video); - connectedResolver(); - - return videoPlayPromise; }, 'Tests that frames are actually rendered correctly in a stream sent over a peer connection.'); + promise_test(async t => { + const generator = new MediaStreamTrackGenerator({kind: 'video'}); + t.add_cleanup(() => generator.stop()); + + const inputCanvas = new OffscreenCanvas(width, height); + + const inputContext = inputCanvas.getContext('2d', {alpha: false}); + // draw four quadrants + const colorUL = [255, 0, 0, 255]; + inputContext.fillStyle = `rgba(${colorUL.join()})`; + inputContext.fillRect(0, 0, width / 2, height / 2); + const colorUR = [255, 255, 0, 255]; + inputContext.fillStyle = `rgba(${colorUR.join()})`; + inputContext.fillRect(width / 2, 0, width / 2, height / 2); + const colorLL = [0, 255, 0, 255]; + inputContext.fillStyle = `rgba(${colorLL.join()})`; + inputContext.fillRect(0, height / 2, width / 2, height / 2); + const colorLR = [0, 255, 255, 255]; + inputContext.fillStyle = `rgba(${colorLR.join()})`; + inputContext.fillRect(width / 2, height / 2, width / 2, height / 2); + + // Write frames for the duration of the test. + const writer = generator.writable.getWriter(); + let timestamp = 0; + const intervalId = setInterval( + t.step_func(async () => { + if (generator.readyState === 'live') { + timestamp++; + await writer.write(new VideoFrame( + inputCanvas, {timestamp: timestamp, alpha: 'discard'})); + } + }), + 40); + t.add_cleanup(() => clearInterval(intervalId)); + + const caller = new RTCPeerConnection(); + t.add_cleanup(() => caller.close()); + const callee = new RTCPeerConnection(); + t.add_cleanup(() => callee.close()); + const sender = caller.addTrack(generator); + + exchangeIceCandidates(caller, callee); + // Wait for the first track. + const e = await exchangeOfferAndListenToOntrack(t, caller, callee); + + // Exchange answer. + await exchangeAnswer(caller, callee); + await waitForConnectionStateChange(callee, ['connected']); + const params = sender.getParameters(); + params.encodings.forEach(e => e.scaleResolutionDownBy = 2); + sender.setParameters(params); + + const processor = new MediaStreamTrackProcessor(e.track); + const reader = processor.readable.getReader(); + + // The first frame may not have had scaleResolutionDownBy applied + const numTries = 5; + for (let i = 1; i <= numTries; i++) { + const {value: outputFrame} = await reader.read(); + if (outputFrame.displayWidth !== width / 2) { + assert_less_than(i, numTries, `First ${numTries} frames were the wrong size.`); + outputFrame.close(); + continue; + } + + assert_equals(outputFrame.displayWidth, width / 2); + assert_equals(outputFrame.displayHeight, height / 2); + + const outputCanvas = new OffscreenCanvas(width / 2, height / 2); + const outputContext = outputCanvas.getContext('2d', {alpha: false}); + outputContext.drawImage(outputFrame, 0, 0); + outputFrame.close(); + // Check the four quadrants + const pixelUL = outputContext.getImageData(width / 8, height / 8, 1, 1); + assertPixel(t, pixelUL.data, colorUL); + const pixelUR = + outputContext.getImageData(width * 3 / 8, height / 8, 1, 1); + assertPixel(t, pixelUR.data, colorUR); + const pixelLL = + outputContext.getImageData(width / 8, height * 3 / 8, 1, 1); + assertPixel(t, pixelLL.data, colorLL); + const pixelLR = + outputContext.getImageData(width * 3 / 8, height * 3 / 8, 1, 1); + assertPixel(t, pixelLR.data, colorLR); + break; + } + }, 'Tests that frames are sent correctly with RTCRtpEncodingParameters.scaleResolutionDownBy.'); promise_test(async t => { const generator = new MediaStreamTrackGenerator("video");
diff --git a/third_party/blink/web_tests/http/tests/devtools/elements/styles/styles-parse-invalid-properties-expected.txt b/third_party/blink/web_tests/http/tests/devtools/elements/styles/styles-parse-invalid-properties-expected.txt index 15086bb..a4af765 100644 --- a/third_party/blink/web_tests/http/tests/devtools/elements/styles/styles-parse-invalid-properties-expected.txt +++ b/third_party/blink/web_tests/http/tests/devtools/elements/styles/styles-parse-invalid-properties-expected.txt
@@ -22,7 +22,7 @@ #inspected { (<style>) /-- overloaded --/ color: blue; /-- overloaded --/ a property with spaces: red; -/-- overloaded --/ --a-property-with-no-value: ; + --a-property-with-no-value: ; /-- overloaded --/ content: "forgot the semicolon" --next-property: "next property";
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/external/wpt/dom/historical-expected.txt b/third_party/blink/web_tests/platform/mac-mac11-arm64/external/wpt/dom/historical-expected.txt deleted file mode 100644 index 66cad48..0000000 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/external/wpt/dom/historical-expected.txt +++ /dev/null
@@ -1,81 +0,0 @@ -This is a testharness.js-based test. -Found 77 tests; 72 PASS, 5 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS Historical DOM features must be removed: DOMConfiguration -PASS Historical DOM features must be removed: DOMCursor -FAIL Historical DOM features must be removed: DOMError assert_false: expected false got true -PASS Historical DOM features must be removed: DOMErrorHandler -PASS Historical DOM features must be removed: DOMImplementationList -PASS Historical DOM features must be removed: DOMImplementationSource -PASS Historical DOM features must be removed: DOMLocator -PASS Historical DOM features must be removed: DOMObject -PASS Historical DOM features must be removed: DOMRequest -PASS Historical DOM features must be removed: DOMSettableTokenList -PASS Historical DOM features must be removed: DOMUserData -PASS Historical DOM features must be removed: Entity -PASS Historical DOM features must be removed: EntityReference -PASS Historical DOM features must be removed: EventException -PASS Historical DOM features must be removed: NameList -PASS Historical DOM features must be removed: Notation -PASS Historical DOM features must be removed: TypeInfo -PASS Historical DOM features must be removed: UserDataHandler -PASS Historical DOM features must be removed: RangeException -PASS Historical DOM features must be removed: createEntityReference -FAIL Historical DOM features must be removed: xmlEncoding assert_false: expected false got true -FAIL Historical DOM features must be removed: xmlStandalone assert_false: expected false got true -FAIL Historical DOM features must be removed: xmlVersion assert_false: expected false got true -PASS Historical DOM features must be removed: strictErrorChecking -PASS Historical DOM features must be removed: domConfig -PASS Historical DOM features must be removed: normalizeDocument -PASS Historical DOM features must be removed: renameNode -PASS Historical DOM features must be removed: defaultCharset -PASS Historical DOM features must be removed: height -PASS Historical DOM features must be removed: width -PASS Historical DOM features must be removed: commands -PASS Historical DOM features must be removed: cssElementMap -PASS Historical DOM features must be removed: async -PASS Historical DOM features must be removed: origin -PASS document.load -PASS XMLDocument.load -PASS DOMImplementation.getFeature() must be removed. -PASS Historical DOM features must be removed: schemaTypeInfo -PASS Historical DOM features must be removed: setIdAttribute -PASS Historical DOM features must be removed: setIdAttributeNS -PASS Historical DOM features must be removed: setIdAttributeNode -PASS Attr member must be removed: schemaTypeInfo -PASS Attr member must be removed: isId -PASS DocumentType member must be removed: entities -PASS DocumentType member must be removed: notations -PASS DocumentType member must be removed: internalSubset -PASS Text member must be removed: isElementContentWhitespace -PASS Text member must be removed: replaceWholeText -PASS Node member must be removed: hasAttributes -PASS Node member must be removed: attributes -PASS Node member must be removed: namespaceURI -PASS Node member must be removed: prefix -PASS Node member must be removed: localName -PASS Node member must be removed: isSupported -PASS Node member must be removed: getFeature -PASS Node member must be removed: getUserData -PASS Node member must be removed: setUserData -PASS Node member must be removed: rootNode -PASS Window member must be removed: attachEvent -PASS Event should not have this constant: MOUSEDOWN -PASS Event should not have this constant: MOUSEUP -PASS Event should not have this constant: MOUSEOVER -PASS Event should not have this constant: MOUSEOUT -PASS Event should not have this constant: MOUSEMOVE -PASS Event should not have this constant: MOUSEDRAG -PASS Event should not have this constant: CLICK -PASS Event should not have this constant: DBLCLICK -PASS Event should not have this constant: KEYDOWN -PASS Event should not have this constant: KEYUP -PASS Event should not have this constant: KEYPRESS -PASS Event should not have this constant: DRAGDROP -PASS Event should not have this constant: FOCUS -PASS Event should not have this constant: BLUR -PASS Event should not have this constant: SELECT -PASS Event should not have this constant: CHANGE -PASS Event.prototype should not have this property: getPreventDefault -FAIL Event.prototype should not have this property: path assert_false: expected false got true -Harness: the test ran to completion. -
diff --git a/tools/metrics/histograms/metadata/custom_tabs/histograms.xml b/tools/metrics/histograms/metadata/custom_tabs/histograms.xml index 47593a96..1c7f816 100644 --- a/tools/metrics/histograms/metadata/custom_tabs/histograms.xml +++ b/tools/metrics/histograms/metadata/custom_tabs/histograms.xml
@@ -230,6 +230,9 @@ <histogram base="true" name="CustomTabs.ResourcePrefetch.Duration" units="ms" expires_after="M73"> + <obsolete> + No longer recorded since M73. + </obsolete> <owner>alexilin@chromium.org</owner> <summary> Time between the start of a detached resource request for resource prefetch @@ -239,6 +242,9 @@ <histogram name="CustomTabs.ResourcePrefetch.FinalStatus" enum="NetErrorCodes" expires_after="M73"> + <obsolete> + No longer recorded since M73. + </obsolete> <owner>alexilin@chromium.org</owner> <summary> Reports the final status of the detached request for resource prefetch,
diff --git a/tools/metrics/histograms/metadata/histogram_suffixes_list.xml b/tools/metrics/histograms/metadata/histogram_suffixes_list.xml index 18c05e58..381f406 100644 --- a/tools/metrics/histograms/metadata/histogram_suffixes_list.xml +++ b/tools/metrics/histograms/metadata/histogram_suffixes_list.xml
@@ -3524,7 +3524,11 @@ <suffix name="Success" label="Successful detached request"/> <affected-histogram name="CustomTabs.DetachedResourceRequest.Duration"/> <affected-histogram name="CustomTabs.DetachedResourceRequest.RedirectsCount"/> - <affected-histogram name="CustomTabs.ResourcePrefetch.Duration"/> + <affected-histogram name="CustomTabs.ResourcePrefetch.Duration"> + <obsolete> + No longer recorded since M73. + </obsolete> + </affected-histogram> </histogram_suffixes> <histogram_suffixes name="DataReductionProxy" separator="_">
diff --git a/tools/metrics/histograms/metadata/signin/histograms.xml b/tools/metrics/histograms/metadata/signin/histograms.xml index ee60088..0cdcca9 100644 --- a/tools/metrics/histograms/metadata/signin/histograms.xml +++ b/tools/metrics/histograms/metadata/signin/histograms.xml
@@ -509,7 +509,7 @@ </histogram> <histogram name="Signin.Extensions.GaiaRemoteConsentFlowResult" - enum="GaiaRemoteConsentFlowResult" expires_after="2021-12-12"> + enum="GaiaRemoteConsentFlowResult" expires_after="2022-03-12"> <owner>alexilin@chromium.org</owner> <owner>droger@chromium.org</owner> <summary> @@ -964,7 +964,7 @@ </histogram> <histogram name="Signin.OAuth2MintToken.ApiCallResult" - enum="OAuth2MintTokenApiCallResult" expires_after="2022-01-16"> + enum="OAuth2MintTokenApiCallResult" expires_after="2022-06-12"> <owner>alexilin@chromium.org</owner> <owner>droger@chromium.org</owner> <summary>
diff --git a/ui/accessibility/platform/ax_platform_node_cocoa.mm b/ui/accessibility/platform/ax_platform_node_cocoa.mm index 25cabe0..e1da773 100644 --- a/ui/accessibility/platform/ax_platform_node_cocoa.mm +++ b/ui/accessibility/platform/ax_platform_node_cocoa.mm
@@ -7,6 +7,7 @@ #import <Cocoa/Cocoa.h> #include "base/mac/foundation_util.h" +#include "base/no_destructor.h" #include "base/strings/sys_string_conversions.h" #include "base/trace_event/trace_event.h" #include "ui/accessibility/ax_action_data.h"
diff --git a/ui/base/clipboard/clipboard.cc b/ui/base/clipboard/clipboard.cc index bf36e5a0..d22b14f 100644 --- a/ui/base/clipboard/clipboard.cc +++ b/ui/base/clipboard/clipboard.cc
@@ -12,6 +12,7 @@ #include "base/containers/contains.h" #include "base/json/json_reader.h" #include "base/memory/ptr_util.h" +#include "base/no_destructor.h" #include "base/notreached.h" #include "base/strings/utf_string_conversions.h" #include "third_party/skia/include/core/SkBitmap.h"
diff --git a/ui/base/clipboard/clipboard_android.cc b/ui/base/clipboard/clipboard_android.cc index 3f8832ed..e0fedb73 100644 --- a/ui/base/clipboard/clipboard_android.cc +++ b/ui/base/clipboard/clipboard_android.cc
@@ -18,7 +18,6 @@ #include "base/callback.h" #include "base/containers/contains.h" #include "base/lazy_instance.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/strings/utf_string_conversions.h" #include "base/synchronization/lock.h"
diff --git a/ui/base/clipboard/clipboard_format_type_android.cc b/ui/base/clipboard/clipboard_format_type_android.cc index 7af255b..b9b833d 100644 --- a/ui/base/clipboard/clipboard_format_type_android.cc +++ b/ui/base/clipboard/clipboard_format_type_android.cc
@@ -4,6 +4,7 @@ #include "ui/base/clipboard/clipboard_format_type.h" +#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h"
diff --git a/ui/base/clipboard/clipboard_format_type_aura.cc b/ui/base/clipboard/clipboard_format_type_aura.cc index 078fa98..83af0534 100644 --- a/ui/base/clipboard/clipboard_format_type_aura.cc +++ b/ui/base/clipboard/clipboard_format_type_aura.cc
@@ -4,6 +4,7 @@ #include "ui/base/clipboard/clipboard_format_type.h" +#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h"
diff --git a/ui/base/clipboard/clipboard_format_type_mac.mm b/ui/base/clipboard/clipboard_format_type_mac.mm index 317f367..413e2fa 100644 --- a/ui/base/clipboard/clipboard_format_type_mac.mm +++ b/ui/base/clipboard/clipboard_format_type_mac.mm
@@ -6,6 +6,7 @@ #import <Cocoa/Cocoa.h> +#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h"
diff --git a/ui/base/clipboard/clipboard_mac.mm b/ui/base/clipboard/clipboard_mac.mm index a95f39d..a1762a4 100644 --- a/ui/base/clipboard/clipboard_mac.mm +++ b/ui/base/clipboard/clipboard_mac.mm
@@ -17,7 +17,6 @@ #include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_nsobject.h" #include "base/memory/ref_counted_memory.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h"
diff --git a/ui/base/clipboard/clipboard_monitor.cc b/ui/base/clipboard/clipboard_monitor.cc index 4930406..2af8730 100644 --- a/ui/base/clipboard/clipboard_monitor.cc +++ b/ui/base/clipboard/clipboard_monitor.cc
@@ -4,6 +4,7 @@ #include "ui/base/clipboard/clipboard_monitor.h" +#include "base/no_destructor.h" #include "build/chromeos_buildflags.h" #include "ui/base/clipboard/clipboard_observer.h"
diff --git a/ui/base/clipboard/clipboard_ozone.cc b/ui/base/clipboard/clipboard_ozone.cc index 6afa74a5..1ad279a6 100644 --- a/ui/base/clipboard/clipboard_ozone.cc +++ b/ui/base/clipboard/clipboard_ozone.cc
@@ -14,6 +14,7 @@ #include "base/containers/flat_map.h" #include "base/containers/span.h" #include "base/memory/weak_ptr.h" +#include "base/no_destructor.h" #include "base/notreached.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h"
diff --git a/ui/base/interaction/element_tracker.cc b/ui/base/interaction/element_tracker.cc index b5aef95..fddc837 100644 --- a/ui/base/interaction/element_tracker.cc +++ b/ui/base/interaction/element_tracker.cc
@@ -13,6 +13,7 @@ #include "base/bind.h" #include "base/containers/contains.h" #include "base/memory/raw_ptr.h" +#include "base/no_destructor.h" #include "ui/base/interaction/element_identifier.h" namespace ui {
diff --git a/ui/base/interaction/element_tracker_mac.mm b/ui/base/interaction/element_tracker_mac.mm index 75455d6b..2d9ce31 100644 --- a/ui/base/interaction/element_tracker_mac.mm +++ b/ui/base/interaction/element_tracker_mac.mm
@@ -8,6 +8,7 @@ #include <memory> #include "base/logging.h" +#include "base/no_destructor.h" namespace ui {
diff --git a/ui/compositor/recyclable_compositor_mac.cc b/ui/compositor/recyclable_compositor_mac.cc index 131c7d8..5a387010 100644 --- a/ui/compositor/recyclable_compositor_mac.cc +++ b/ui/compositor/recyclable_compositor_mac.cc
@@ -5,6 +5,7 @@ #include "ui/compositor/recyclable_compositor_mac.h" #include "base/bind.h" +#include "base/no_destructor.h" #include "base/threading/thread_task_runner_handle.h" #include "components/viz/common/features.h" #include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
diff --git a/ui/events/ozone/evdev/event_device_info.cc b/ui/events/ozone/evdev/event_device_info.cc index ddbc6c44..5c2c0b0 100644 --- a/ui/events/ozone/evdev/event_device_info.cc +++ b/ui/events/ozone/evdev/event_device_info.cc
@@ -96,7 +96,6 @@ {0x413c, 0x81d5}, // Dell Active Pen PN579X }; -#if defined(USE_LIBINPUT) // Certain devices need to be forced to use libinput in place of // evdev/libgestures constexpr struct { @@ -117,7 +116,6 @@ return false; } -#endif // Note: this is not SteelSeries's actual VID; the Stratus Duo just reports it // incorrectly over Bluetooth. @@ -568,7 +566,6 @@ bool EventDeviceInfo::UseLibinput() const { bool useLibinput = false; -#if defined(USE_LIBINPUT) if (HasTouchpad()) { auto overridden_state = base::FeatureList::GetStateIfOverridden(ui::kLibinputHandleTouchpad); @@ -579,7 +576,6 @@ IsSemiMultitouch() || IsForceLibinput(*this); } } -#endif return useLibinput; }
diff --git a/ui/events/win/keyboard_hook_monitor_impl.cc b/ui/events/win/keyboard_hook_monitor_impl.cc index 293b0d8..8e4dd0e 100644 --- a/ui/events/win/keyboard_hook_monitor_impl.cc +++ b/ui/events/win/keyboard_hook_monitor_impl.cc
@@ -4,6 +4,8 @@ #include "ui/events/win/keyboard_hook_monitor_impl.h" +#include "base/no_destructor.h" + namespace ui { KeyboardHookMonitorImpl::KeyboardHookMonitorImpl() = default;
diff --git a/ui/gfx/linux/gpu_memory_buffer_support_x11.cc b/ui/gfx/linux/gpu_memory_buffer_support_x11.cc index ced8650..1da38a9 100644 --- a/ui/gfx/linux/gpu_memory_buffer_support_x11.cc +++ b/ui/gfx/linux/gpu_memory_buffer_support_x11.cc
@@ -12,6 +12,7 @@ #include "base/containers/contains.h" #include "base/debug/crash_logging.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/posix/eintr_wrapper.h" #include "ui/gfx/buffer_format_util.h" #include "ui/gfx/buffer_types.h"
diff --git a/ui/gfx/mac/display_icc_profiles.cc b/ui/gfx/mac/display_icc_profiles.cc index 119b652..e00e980c 100644 --- a/ui/gfx/mac/display_icc_profiles.cc +++ b/ui/gfx/mac/display_icc_profiles.cc
@@ -4,6 +4,7 @@ #include "ui/gfx/mac/display_icc_profiles.h" +#include "base/no_destructor.h" #include "base/notreached.h" #include "ui/gfx/icc_profile.h"
diff --git a/ui/gfx/win/crash_id_helper.cc b/ui/gfx/win/crash_id_helper.cc index 5cbf9201..adbb8cb 100644 --- a/ui/gfx/win/crash_id_helper.cc +++ b/ui/gfx/win/crash_id_helper.cc
@@ -5,6 +5,7 @@ #include "ui/gfx/win/crash_id_helper.h" #include "base/memory/ptr_util.h" +#include "base/no_destructor.h" #include "base/strings/string_util.h" namespace gfx {
diff --git a/ui/gl/dcomp_surface_registry.cc b/ui/gl/dcomp_surface_registry.cc index b876126..4d98bed0 100644 --- a/ui/gl/dcomp_surface_registry.cc +++ b/ui/gl/dcomp_surface_registry.cc
@@ -4,6 +4,7 @@ #include "ui/gl/dcomp_surface_registry.h" #include "base/logging.h" +#include "base/no_destructor.h" namespace gl {
diff --git a/ui/gl/init/gl_display_egl_util_ozone.cc b/ui/gl/init/gl_display_egl_util_ozone.cc index 6449933..6fad59ee 100644 --- a/ui/gl/init/gl_display_egl_util_ozone.cc +++ b/ui/gl/init/gl_display_egl_util_ozone.cc
@@ -4,6 +4,7 @@ #include "ui/gl/init/gl_display_egl_util_ozone.h" +#include "base/no_destructor.h" #include "ui/ozone/public/ozone_platform.h" #include "ui/ozone/public/platform_gl_egl_utility.h"
diff --git a/ui/gl/shader_tracking.cc b/ui/gl/shader_tracking.cc index d7b9a40..a185ebe 100644 --- a/ui/gl/shader_tracking.cc +++ b/ui/gl/shader_tracking.cc
@@ -5,6 +5,7 @@ #include "ui/gl/shader_tracking.h" #include "base/check.h" +#include "base/no_destructor.h" #include "ui/gl/gl_switches.h" namespace gl {
diff --git a/ui/gtk/native_theme_gtk.cc b/ui/gtk/native_theme_gtk.cc index 4afa399..3832f2d9 100644 --- a/ui/gtk/native_theme_gtk.cc +++ b/ui/gtk/native_theme_gtk.cc
@@ -4,6 +4,7 @@ #include "ui/gtk/native_theme_gtk.h" +#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "ui/color/color_id.h" #include "ui/color/color_provider_manager.h"
diff --git a/ui/latency/latency_tracker.cc b/ui/latency/latency_tracker.cc index c22b5a9c..bd7ea1c 100644 --- a/ui/latency/latency_tracker.cc +++ b/ui/latency/latency_tracker.cc
@@ -7,7 +7,6 @@ #include <algorithm> #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/rand_util.h" #include "base/strings/strcat.h" #include "base/trace_event/trace_event.h"
diff --git a/ui/native_theme/common_theme.cc b/ui/native_theme/common_theme.cc index a8d95abb..6446219 100644 --- a/ui/native_theme/common_theme.cc +++ b/ui/native_theme/common_theme.cc
@@ -6,7 +6,6 @@ #include "base/containers/fixed_flat_map.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/strings/string_piece.h" #include "build/build_config.h"
diff --git a/ui/native_theme/native_theme.cc b/ui/native_theme/native_theme.cc index ca0630b..55b7e24 100644 --- a/ui/native_theme/native_theme.cc +++ b/ui/native_theme/native_theme.cc
@@ -11,7 +11,6 @@ #include "base/containers/fixed_flat_map.h" #include "base/logging.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "build/build_config.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/ui_base_switches.h"
diff --git a/ui/native_theme/native_theme_android.cc b/ui/native_theme/native_theme_android.cc index 48beb949..c9d0bda7 100644 --- a/ui/native_theme/native_theme_android.cc +++ b/ui/native_theme/native_theme_android.cc
@@ -4,6 +4,7 @@ #include "ui/native_theme/native_theme_android.h" +#include "base/no_destructor.h" #include "base/notreached.h" #include "ui/gfx/geometry/size.h"
diff --git a/ui/native_theme/native_theme_aura.cc b/ui/native_theme/native_theme_aura.cc index 6c7599d6..77813d8 100644 --- a/ui/native_theme/native_theme_aura.cc +++ b/ui/native_theme/native_theme_aura.cc
@@ -8,6 +8,7 @@ #include <utility> #include "base/check_op.h" +#include "base/no_destructor.h" #include "base/notreached.h" #include "base/trace_event/trace_event.h" #include "build/build_config.h"
diff --git a/ui/native_theme/native_theme_mac.mm b/ui/native_theme/native_theme_mac.mm index 29f0ea2..711c3ef4 100644 --- a/ui/native_theme/native_theme_mac.mm +++ b/ui/native_theme/native_theme_mac.mm
@@ -12,6 +12,7 @@ #include "base/command_line.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_block.h" +#include "base/no_destructor.h" #include "cc/paint/paint_shader.h" #import "skia/ext/skia_utils_mac.h" #include "ui/base/ui_base_features.h"
diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc index 99256ff..2165990 100644 --- a/ui/native_theme/native_theme_win.cc +++ b/ui/native_theme/native_theme_win.cc
@@ -15,6 +15,7 @@ #include "base/check.h" #include "base/command_line.h" #include "base/feature_list.h" +#include "base/no_destructor.h" #include "base/notreached.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/win/scoped_gdi_object.h"
diff --git a/ui/views/accessibility/ax_aura_obj_cache.cc b/ui/views/accessibility/ax_aura_obj_cache.cc index 18cfcdda..af4c6b5 100644 --- a/ui/views/accessibility/ax_aura_obj_cache.cc +++ b/ui/views/accessibility/ax_aura_obj_cache.cc
@@ -3,11 +3,10 @@ // found in the LICENSE file. #include "ui/views/accessibility/ax_aura_obj_cache.h" -#include "base/memory/raw_ptr.h" #include <utility> -#include "base/no_destructor.h" +#include "base/memory/raw_ptr.h" #include "base/strings/string_util.h" #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node.h"
diff --git a/ui/views/accessibility/ax_root_obj_wrapper.cc b/ui/views/accessibility/ax_root_obj_wrapper.cc index 8d41c5ab..d11016e 100644 --- a/ui/views/accessibility/ax_root_obj_wrapper.cc +++ b/ui/views/accessibility/ax_root_obj_wrapper.cc
@@ -18,56 +18,9 @@ #include "ui/views/accessibility/ax_aura_obj_cache.h" #include "ui/views/accessibility/ax_window_obj_wrapper.h" -#if defined(OS_CHROMEOS) -namespace { - -constexpr char kAXLacrosAppId[] = "AXLacrosApp"; - -// A simple wrapper object that can reference another tree via app id. -class AXHostAuraObj : public views::AXAuraObjWrapper { - public: - AXHostAuraObj(views::AXAuraObjCache* cache, - const std::string& child_app_id, - views::AXAuraObjWrapper* parent) - : views::AXAuraObjWrapper(cache), - child_app_id_(child_app_id), - parent_(parent) {} - - ~AXHostAuraObj() override = default; - - // views::AXAuraObjWrapper: - views::AXAuraObjWrapper* GetParent() override { return parent_; } - - void GetChildren(std::vector<AXAuraObjWrapper*>* out_children) override {} - - void Serialize(ui::AXNodeData* out_node_data) override { - out_node_data->id = GetUniqueId(); - out_node_data->AddStringAttribute( - ax::mojom::StringAttribute::kChildTreeNodeAppId, child_app_id_); - out_node_data->role = ax::mojom::Role::kClient; - } - - ui::AXNodeID GetUniqueId() const override { return unique_id_.Get(); } - std::string ToString() const override { return std::string(); } - - private: - const std::string child_app_id_; - views::AXAuraObjWrapper* parent_; - const ui::AXUniqueId unique_id_; -}; - -} // namespace -#endif // defined(OS_CHROMEOS) - AXRootObjWrapper::AXRootObjWrapper(views::AXAuraObjCache::Delegate* delegate, views::AXAuraObjCache* cache) - : views::AXAuraObjWrapper(cache), delegate_(delegate) { -#if BUILDFLAG(IS_CHROMEOS_ASH) - auto lacros = std::make_unique<AXHostAuraObj>(cache, kAXLacrosAppId, this); - lacros_host_ = lacros.get(); - cache->CreateOrReplace(std::move(lacros)); -#endif // BUILDFLAG(IS_CHROMEOS_ASH) -} + : views::AXAuraObjWrapper(cache), delegate_(delegate) {} AXRootObjWrapper::~AXRootObjWrapper() = default; @@ -84,22 +37,15 @@ void AXRootObjWrapper::GetChildren( std::vector<views::AXAuraObjWrapper*>* out_children) { aura_obj_cache_->GetTopLevelWindows(out_children); - -#if BUILDFLAG(IS_CHROMEOS_ASH) - // Add a host for LaCrOS. - out_children->push_back(lacros_host_); -#endif // BUILDFLAG(IS_CHROMEOS_LACROS) } void AXRootObjWrapper::Serialize(ui::AXNodeData* out_node_data) { out_node_data->id = unique_id_.Get(); #if BUILDFLAG(IS_CHROMEOS_LACROS) out_node_data->role = ax::mojom::Role::kClient; - out_node_data->AddStringAttribute(ax::mojom::StringAttribute::kAppId, - kAXLacrosAppId); #else out_node_data->role = ax::mojom::Role::kDesktop; -#endif // BUILDFLAG(IS_CHROMEOS_LACROS) +#endif display::Screen* screen = display::Screen::GetScreen(); if (!screen)
diff --git a/ui/views/accessibility/ax_root_obj_wrapper.h b/ui/views/accessibility/ax_root_obj_wrapper.h index 8735426..ce9c08fd 100644 --- a/ui/views/accessibility/ax_root_obj_wrapper.h +++ b/ui/views/accessibility/ax_root_obj_wrapper.h
@@ -12,7 +12,6 @@ #include <vector> #include "base/memory/raw_ptr.h" -#include "build/chromeos_buildflags.h" #include "ui/accessibility/platform/ax_unique_id.h" #include "ui/display/display_observer.h" #include "ui/views/accessibility/ax_aura_obj_cache.h" @@ -47,10 +46,6 @@ ui::AXUniqueId unique_id_; raw_ptr<views::AXAuraObjCache::Delegate> delegate_; - -#if BUILDFLAG(IS_CHROMEOS_ASH) - views::AXAuraObjWrapper* lacros_host_; -#endif // BUILDFLAG(IS_CHROMEOS_ASH) }; #endif // UI_VIEWS_ACCESSIBILITY_AX_ROOT_OBJ_WRAPPER_H_
diff --git a/ui/views/accessibility/ax_window_obj_wrapper.cc b/ui/views/accessibility/ax_window_obj_wrapper.cc index 59ed1c3..4fa0261 100644 --- a/ui/views/accessibility/ax_window_obj_wrapper.cc +++ b/ui/views/accessibility/ax_window_obj_wrapper.cc
@@ -25,6 +25,10 @@ #include "ui/views/accessibility/ax_aura_obj_cache.h" #include "ui/views/widget/widget.h" +#if BUILDFLAG(IS_CHROMEOS_LACROS) +#include "ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h" +#endif + namespace views { namespace { @@ -82,21 +86,34 @@ #if BUILDFLAG(IS_CHROMEOS_LACROS) std::string GetPlatformWindowId(aura::Window* window) { - // This is a top level root window. - if (window->IsRootWindow() && !window->parent()) { - // On desktop aura there is one WindowTreeHost per top-level window. - aura::WindowTreeHost* window_tree_host = window->GetHost(); - if (window_tree_host) { - // Lacros is based on Ozone/Wayland, which uses PlatformWindow and - // aura::WindowTreeHostPlatform. - aura::WindowTreeHostPlatform* window_tree_host_platform = - static_cast<aura::WindowTreeHostPlatform*>(window_tree_host); + // Ignore non-top level windows. + if (!window->IsRootWindow() || window->parent()) + return std::string(); - return window_tree_host_platform->platform_window()->GetWindowUniqueId(); - } + // On desktop aura there is one WindowTreeHost per top-level window. + aura::WindowTreeHost* window_tree_host = window->GetHost(); + if (!window_tree_host) + return std::string(); + + // Lacros is based on Ozone/Wayland, which uses PlatformWindow and + // aura::WindowTreeHostPlatform. + aura::WindowTreeHostPlatform* window_tree_host_platform = + static_cast<aura::WindowTreeHostPlatform*>(window_tree_host); + + // Prefer the DesktopWindowTreeHostPlatform if it exists. + DesktopWindowTreeHostPlatform* desktop_window_tree_host_platform = + DesktopWindowTreeHostPlatform::GetHostForWidget( + window_tree_host->GetAcceleratedWidget()); + if (!desktop_window_tree_host_platform) + return window_tree_host_platform->platform_window()->GetWindowUniqueId(); + + while (desktop_window_tree_host_platform->window_parent()) { + desktop_window_tree_host_platform = + desktop_window_tree_host_platform->window_parent(); } - return std::string(); + return desktop_window_tree_host_platform->platform_window() + ->GetWindowUniqueId(); } #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/ui/views/animation/animation_builder.cc b/ui/views/animation/animation_builder.cc index 0f496abc..ef87e8c 100644 --- a/ui/views/animation/animation_builder.cc +++ b/ui/views/animation/animation_builder.cc
@@ -12,6 +12,7 @@ #include "base/callback.h" #include "base/check_op.h" #include "base/memory/ptr_util.h" +#include "base/no_destructor.h" #include "base/ranges/algorithm.h" #include "base/time/time.h" #include "ui/compositor/layer.h"
diff --git a/ui/views/animation/animation_builder.h b/ui/views/animation/animation_builder.h index 2d5c5d5..94f0ceb3 100644 --- a/ui/views/animation/animation_builder.h +++ b/ui/views/animation/animation_builder.h
@@ -11,7 +11,6 @@ #include "base/callback.h" #include "base/memory/raw_ptr.h" -#include "base/no_destructor.h" #include "base/types/pass_key.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/compositor/layer_animation_observer.h"
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm index 48dd1adb..fc1ddbd 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
@@ -9,6 +9,7 @@ #include "base/base64.h" #include "base/ignore_result.h" #include "base/mac/foundation_util.h" +#include "base/no_destructor.h" #include "base/strings/sys_string_conversions.h" #include "components/remote_cocoa/app_shim/mouse_capture.h" #include "components/remote_cocoa/app_shim/native_widget_mac_nswindow.h"
diff --git a/ui/views/controls/tree/tree_view.cc b/ui/views/controls/tree/tree_view.cc index 500ccb2..9f6a3eeb 100644 --- a/ui/views/controls/tree/tree_view.cc +++ b/ui/views/controls/tree/tree_view.cc
@@ -61,6 +61,8 @@ // Padding around the text (on each side). static constexpr int kTextVerticalPadding = 3; static constexpr int kTextHorizontalPadding = 2; +// Padding between the auxiliary text and the end of the line, handles RTL. +static constexpr int kAuxiliaryTextLineEndPadding = 5; // How much children are indented from their parent. static constexpr int kIndent = 20; @@ -1127,7 +1129,8 @@ : gfx::Canvas::TEXT_ALIGN_RIGHT; canvas->DrawStringRectWithFlags( aux_text, font_list_, - drawing_provider()->GetTextColorForNode(this, node->model_node()), + drawing_provider()->GetAuxiliaryTextColorForNode(this, + node->model_node()), aux_text_bounds, align); } } @@ -1257,14 +1260,16 @@ // leading aligned. gfx::Rect TreeView::GetAuxiliaryTextBoundsForNode(InternalNode* node) { gfx::Rect text_bounds = GetTextBoundsForNode(node); - int width = base::i18n::IsRTL() ? text_bounds.x() - kTextHorizontalPadding * 2 - : bounds().width() - text_bounds.right() - - 2 * kTextHorizontalPadding; + int width = base::i18n::IsRTL() + ? text_bounds.x() - kTextHorizontalPadding - + kAuxiliaryTextLineEndPadding + : bounds().width() - text_bounds.right() - + kTextHorizontalPadding - kAuxiliaryTextLineEndPadding; if (width < 0) return gfx::Rect(); int x = base::i18n::IsRTL() - ? kTextHorizontalPadding - : bounds().right() - width - kTextHorizontalPadding; + ? kAuxiliaryTextLineEndPadding + : bounds().right() - width - kAuxiliaryTextLineEndPadding; return gfx::Rect(x, text_bounds.y(), width, text_bounds.height()); }
diff --git a/ui/views/controls/tree/tree_view_drawing_provider.cc b/ui/views/controls/tree/tree_view_drawing_provider.cc index 846f903..e79f66e 100644 --- a/ui/views/controls/tree/tree_view_drawing_provider.cc +++ b/ui/views/controls/tree/tree_view_drawing_provider.cc
@@ -33,6 +33,13 @@ return tree_view->GetColorProvider()->GetColor(color_id); } +SkColor TreeViewDrawingProvider::GetAuxiliaryTextColorForNode( + TreeView* tree_view, + ui::TreeModelNode* node) { + // Default to using the same color as the primary text. + return GetTextColorForNode(tree_view, node); +} + std::u16string TreeViewDrawingProvider::GetAuxiliaryTextForNode( TreeView* tree_view, ui::TreeModelNode* node) {
diff --git a/ui/views/controls/tree/tree_view_drawing_provider.h b/ui/views/controls/tree/tree_view_drawing_provider.h index 7169e58..626c6d8 100644 --- a/ui/views/controls/tree/tree_view_drawing_provider.h +++ b/ui/views/controls/tree/tree_view_drawing_provider.h
@@ -32,6 +32,8 @@ ui::TreeModelNode* node); virtual SkColor GetTextColorForNode(TreeView* tree_view, ui::TreeModelNode* node); + virtual SkColor GetAuxiliaryTextColorForNode(TreeView* tree_view, + ui::TreeModelNode* node); // The auxiliary text for a node is descriptive text drawn on the trailing end // of the node's row in the treeview.
diff --git a/ui/views/focus/widget_focus_manager.cc b/ui/views/focus/widget_focus_manager.cc index e7e1366..bdd8aad 100644 --- a/ui/views/focus/widget_focus_manager.cc +++ b/ui/views/focus/widget_focus_manager.cc
@@ -4,6 +4,8 @@ #include "ui/views/focus/widget_focus_manager.h" +#include "base/no_destructor.h" + namespace views { // WidgetFocusManager ----------------------------------------------------------
diff --git a/ui/views/interaction/element_tracker_views.h b/ui/views/interaction/element_tracker_views.h index 5f54558a..15883a10e 100644 --- a/ui/views/interaction/element_tracker_views.h +++ b/ui/views/interaction/element_tracker_views.h
@@ -10,6 +10,7 @@ #include <vector> #include "base/memory/raw_ptr.h" +#include "base/no_destructor.h" #include "base/scoped_multi_source_observation.h" #include "base/strings/string_piece_forward.h" #include "ui/base/interaction/element_identifier.h"
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h index 331867f..e8d23dc 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h
@@ -142,6 +142,10 @@ // ui::WorkspaceExtensionDelegate: void OnWorkspaceChanged() override; + DesktopWindowTreeHostPlatform* window_parent() const { + return window_parent_; + } + protected: // These are not general purpose methods and must be used with care. Please // make sure you understand the rounding direction before using.
diff --git a/ui/webui/untrusted_web_ui_controller_factory.cc b/ui/webui/untrusted_web_ui_controller_factory.cc index d42607a2..febba884 100644 --- a/ui/webui/untrusted_web_ui_controller_factory.cc +++ b/ui/webui/untrusted_web_ui_controller_factory.cc
@@ -4,7 +4,6 @@ #include "ui/webui/untrusted_web_ui_controller_factory.h" -#include "base/no_destructor.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_controller.h"
diff --git a/weblayer/browser/android/metrics/metrics_browsertest.cc b/weblayer/browser/android/metrics/metrics_browsertest.cc index 11e1737..cdbde5aa5 100644 --- a/weblayer/browser/android/metrics/metrics_browsertest.cc +++ b/weblayer/browser/android/metrics/metrics_browsertest.cc
@@ -6,7 +6,6 @@ #include "base/metrics/metrics_hashes.h" #include "base/metrics/statistics_recorder.h" -#include "base/no_destructor.h" #include "base/test/bind.h" #include "components/metrics/log_decoder.h" #include "components/metrics/metrics_log_uploader.h"
diff --git a/weblayer/browser/background_download_service_factory.cc b/weblayer/browser/background_download_service_factory.cc index 2bbba37..cbc3709 100644 --- a/weblayer/browser/background_download_service_factory.cc +++ b/weblayer/browser/background_download_service_factory.cc
@@ -6,6 +6,7 @@ #include "base/files/file_path.h" #include "base/memory/raw_ptr.h" +#include "base/no_destructor.h" #include "base/task/sequenced_task_runner.h" #include "base/task/single_thread_task_runner.h" #include "base/task/task_traits.h"
diff --git a/weblayer/browser/background_sync/background_sync_controller_factory.cc b/weblayer/browser/background_sync/background_sync_controller_factory.cc index 8745490a..0268239 100644 --- a/weblayer/browser/background_sync/background_sync_controller_factory.cc +++ b/weblayer/browser/background_sync/background_sync_controller_factory.cc
@@ -4,6 +4,7 @@ #include "weblayer/browser/background_sync/background_sync_controller_factory.h" +#include "base/no_destructor.h" #include "components/background_sync/background_sync_controller_impl.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "weblayer/browser/background_sync/background_sync_delegate_impl.h"
diff --git a/weblayer/browser/bluetooth/weblayer_bluetooth_chooser_context_factory.cc b/weblayer/browser/bluetooth/weblayer_bluetooth_chooser_context_factory.cc index 68adf36..8eea007 100644 --- a/weblayer/browser/bluetooth/weblayer_bluetooth_chooser_context_factory.cc +++ b/weblayer/browser/bluetooth/weblayer_bluetooth_chooser_context_factory.cc
@@ -4,6 +4,7 @@ #include "weblayer/browser/bluetooth/weblayer_bluetooth_chooser_context_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/permissions/contexts/bluetooth_chooser_context.h" #include "weblayer/browser/host_content_settings_map_factory.h"
diff --git a/weblayer/browser/browser_list.cc b/weblayer/browser/browser_list.cc index 06af561..5d9ecca 100644 --- a/weblayer/browser/browser_list.cc +++ b/weblayer/browser/browser_list.cc
@@ -7,6 +7,7 @@ #include <algorithm> #include <functional> +#include "base/no_destructor.h" #include "weblayer/browser/browser_impl.h" #include "weblayer/browser/browser_list_observer.h"
diff --git a/weblayer/browser/browsing_data_remover_delegate_factory.cc b/weblayer/browser/browsing_data_remover_delegate_factory.cc index acc4bcc9..ede4423 100644 --- a/weblayer/browser/browsing_data_remover_delegate_factory.cc +++ b/weblayer/browser/browsing_data_remover_delegate_factory.cc
@@ -4,6 +4,7 @@ #include "weblayer/browser/browsing_data_remover_delegate_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "weblayer/browser/browsing_data_remover_delegate.h"
diff --git a/weblayer/browser/client_hints_factory.cc b/weblayer/browser/client_hints_factory.cc index 39385c5..9664c22f 100644 --- a/weblayer/browser/client_hints_factory.cc +++ b/weblayer/browser/client_hints_factory.cc
@@ -4,6 +4,7 @@ #include "weblayer/browser/client_hints_factory.h" +#include "base/no_destructor.h" #include "components/client_hints/browser/client_hints.h" #include "components/embedder_support/user_agent_utils.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/weblayer/browser/content_browser_client_impl.cc b/weblayer/browser/content_browser_client_impl.cc index f7797c1..5ed1c10 100644 --- a/weblayer/browser/content_browser_client_impl.cc +++ b/weblayer/browser/content_browser_client_impl.cc
@@ -10,7 +10,6 @@ #include "base/containers/flat_set.h" #include "base/files/file.h" #include "base/files/file_util.h" -#include "base/no_destructor.h" #include "base/path_service.h" #include "base/strings/string_piece.h" #include "base/threading/thread_restrictions.h"
diff --git a/weblayer/browser/cookie_settings_factory.cc b/weblayer/browser/cookie_settings_factory.cc index b8942fb..b6ea1dc 100644 --- a/weblayer/browser/cookie_settings_factory.cc +++ b/weblayer/browser/cookie_settings_factory.cc
@@ -4,6 +4,7 @@ #include "weblayer/browser/cookie_settings_factory.h" +#include "base/no_destructor.h" #include "components/content_settings/core/browser/cookie_settings.h" #include "components/content_settings/core/common/pref_names.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/weblayer/browser/favicon/favicon_service_impl_factory.cc b/weblayer/browser/favicon/favicon_service_impl_factory.cc index ac39ab8a..d77182c5 100644 --- a/weblayer/browser/favicon/favicon_service_impl_factory.cc +++ b/weblayer/browser/favicon/favicon_service_impl_factory.cc
@@ -5,6 +5,7 @@ #include "weblayer/browser/favicon/favicon_service_impl_factory.h" #include "base/files/file_path.h" +#include "base/no_destructor.h" #include "components/favicon/content/large_favicon_provider_getter.h" #include "components/favicon/core/core_favicon_service.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
diff --git a/weblayer/browser/heavy_ad_service_factory.cc b/weblayer/browser/heavy_ad_service_factory.cc index ea9b501..27db37fd 100644 --- a/weblayer/browser/heavy_ad_service_factory.cc +++ b/weblayer/browser/heavy_ad_service_factory.cc
@@ -4,6 +4,7 @@ #include "weblayer/browser/heavy_ad_service_factory.h" +#include "base/no_destructor.h" #include "components/heavy_ad_intervention/heavy_ad_service.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "content/public/browser/browser_context.h"
diff --git a/weblayer/browser/permissions/permission_decision_auto_blocker_factory.cc b/weblayer/browser/permissions/permission_decision_auto_blocker_factory.cc index 066993c..4722186 100644 --- a/weblayer/browser/permissions/permission_decision_auto_blocker_factory.cc +++ b/weblayer/browser/permissions/permission_decision_auto_blocker_factory.cc
@@ -4,6 +4,7 @@ #include "weblayer/browser/permissions/permission_decision_auto_blocker_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/permissions/permission_decision_auto_blocker.h" #include "weblayer/browser/host_content_settings_map_factory.h"
diff --git a/weblayer/browser/permissions/weblayer_permissions_client.cc b/weblayer/browser/permissions/weblayer_permissions_client.cc index 84a343b0..e1b8a78 100644 --- a/weblayer/browser/permissions/weblayer_permissions_client.cc +++ b/weblayer/browser/permissions/weblayer_permissions_client.cc
@@ -4,6 +4,7 @@ #include "weblayer/browser/permissions/weblayer_permissions_client.h" +#include "base/no_destructor.h" #include "components/content_settings/core/browser/cookie_settings.h" #include "components/subresource_filter/content/browser/subresource_filter_content_settings_manager.h" #include "components/subresource_filter/content/browser/subresource_filter_profile_context.h"
diff --git a/weblayer/browser/safe_browsing/client_side_detection_service_factory.cc b/weblayer/browser/safe_browsing/client_side_detection_service_factory.cc index 00e2282..7adf7b8 100644 --- a/weblayer/browser/safe_browsing/client_side_detection_service_factory.cc +++ b/weblayer/browser/safe_browsing/client_side_detection_service_factory.cc
@@ -4,6 +4,7 @@ #include "weblayer/browser/safe_browsing/client_side_detection_service_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/safe_browsing/content/browser/client_side_detection_service.h" #include "content/public/browser/browser_context.h"
diff --git a/weblayer/browser/safe_browsing/safe_browsing_metrics_collector_factory.cc b/weblayer/browser/safe_browsing/safe_browsing_metrics_collector_factory.cc index 945535be..ff5db21f 100644 --- a/weblayer/browser/safe_browsing/safe_browsing_metrics_collector_factory.cc +++ b/weblayer/browser/safe_browsing/safe_browsing_metrics_collector_factory.cc
@@ -4,6 +4,7 @@ #include "weblayer/browser/safe_browsing/safe_browsing_metrics_collector_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/safe_browsing/core/browser/safe_browsing_metrics_collector.h" #include "weblayer/browser/browser_context_impl.h"
diff --git a/weblayer/browser/safe_browsing/safe_browsing_navigation_observer_manager_factory.cc b/weblayer/browser/safe_browsing/safe_browsing_navigation_observer_manager_factory.cc index a9c39fd0..888574a 100644 --- a/weblayer/browser/safe_browsing/safe_browsing_navigation_observer_manager_factory.cc +++ b/weblayer/browser/safe_browsing/safe_browsing_navigation_observer_manager_factory.cc
@@ -4,6 +4,7 @@ #include "weblayer/browser/safe_browsing/safe_browsing_navigation_observer_manager_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/safe_browsing/content/browser/safe_browsing_navigation_observer_manager.h" #include "weblayer/browser/browser_context_impl.h"
diff --git a/weblayer/browser/site_engagement/site_engagement_service_factory.cc b/weblayer/browser/site_engagement/site_engagement_service_factory.cc index e1722d9..7ae0826 100644 --- a/weblayer/browser/site_engagement/site_engagement_service_factory.cc +++ b/weblayer/browser/site_engagement/site_engagement_service_factory.cc
@@ -4,6 +4,7 @@ #include "weblayer/browser/site_engagement/site_engagement_service_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" using site_engagement::SiteEngagementService;
diff --git a/weblayer/browser/subresource_filter_profile_context_factory.cc b/weblayer/browser/subresource_filter_profile_context_factory.cc index a31f985..41e3d65 100644 --- a/weblayer/browser/subresource_filter_profile_context_factory.cc +++ b/weblayer/browser/subresource_filter_profile_context_factory.cc
@@ -4,6 +4,7 @@ #include "weblayer/browser/subresource_filter_profile_context_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/core/keyed_service.h" #include "components/subresource_filter/content/browser/subresource_filter_profile_context.h"
diff --git a/weblayer/browser/translate_accept_languages_factory.cc b/weblayer/browser/translate_accept_languages_factory.cc index a2013e50..904887f 100644 --- a/weblayer/browser/translate_accept_languages_factory.cc +++ b/weblayer/browser/translate_accept_languages_factory.cc
@@ -4,6 +4,7 @@ #include "weblayer/browser/translate_accept_languages_factory.h" +#include "base/no_destructor.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/language/core/browser/pref_names.h" #include "components/prefs/pref_service.h"
diff --git a/weblayer/browser/translate_ranker_factory.cc b/weblayer/browser/translate_ranker_factory.cc index b2fc318..75dd8a8 100644 --- a/weblayer/browser/translate_ranker_factory.cc +++ b/weblayer/browser/translate_ranker_factory.cc
@@ -5,6 +5,7 @@ #include "weblayer/browser/translate_ranker_factory.h" #include "base/files/file_path.h" +#include "base/no_destructor.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/translate/core/browser/translate_ranker_impl.h" #include "content/public/browser/browser_context.h"
diff --git a/weblayer/browser/web_data_service_factory.cc b/weblayer/browser/web_data_service_factory.cc index e3214cf..89de4c5c5 100644 --- a/weblayer/browser/web_data_service_factory.cc +++ b/weblayer/browser/web_data_service_factory.cc
@@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/files/file_path.h" +#include "base/no_destructor.h" #include "base/notreached.h" #include "components/webdata_services/web_data_service_wrapper.h" #include "content/public/browser/browser_context.h"
diff --git a/weblayer/browser/webapps/weblayer_webapps_client.cc b/weblayer/browser/webapps/weblayer_webapps_client.cc index c0ce917..5046f683 100644 --- a/weblayer/browser/webapps/weblayer_webapps_client.cc +++ b/weblayer/browser/webapps/weblayer_webapps_client.cc
@@ -7,6 +7,7 @@ #include <string> #include "base/logging.h" +#include "base/no_destructor.h" #include "components/infobars/content/content_infobar_manager.h" #include "components/security_state/content/content_utils.h" #include "components/webapps/browser/installable/installable_metrics.h"
diff --git a/weblayer/browser/webui/web_ui_controller_factory.cc b/weblayer/browser/webui/web_ui_controller_factory.cc index 45098472..6227f70 100644 --- a/weblayer/browser/webui/web_ui_controller_factory.cc +++ b/weblayer/browser/webui/web_ui_controller_factory.cc
@@ -5,6 +5,7 @@ #include "weblayer/browser/webui/web_ui_controller_factory.h" #include "base/memory/ptr_util.h" +#include "base/no_destructor.h" #include "content/public/browser/web_ui.h" #include "url/gurl.h" #include "weblayer/browser/webui/net_export_ui.h"
diff --git a/weblayer/shell/app/shell_main_params.cc b/weblayer/shell/app/shell_main_params.cc index 0d6de8d..16a2d61 100644 --- a/weblayer/shell/app/shell_main_params.cc +++ b/weblayer/shell/app/shell_main_params.cc
@@ -9,7 +9,6 @@ #include "base/environment.h" #include "base/files/file_path.h" #include "base/files/file_util.h" -#include "base/no_destructor.h" #include "base/path_service.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h"
diff --git a/weblayer/utility/content_utility_client_impl.cc b/weblayer/utility/content_utility_client_impl.cc index 439d987..80cab15 100644 --- a/weblayer/utility/content_utility_client_impl.cc +++ b/weblayer/utility/content_utility_client_impl.cc
@@ -6,7 +6,6 @@ #include "base/bind.h" #include "base/lazy_instance.h" -#include "base/no_destructor.h" namespace weblayer {