blob: 9f690b3fd28285d6841bc44d034187fdf60acbe2 [file] [log] [blame]
Avi Drissman3a215d1e2022-09-07 19:43:091// Copyright 2019 The Chromium Authors
Xiyuan Xia5a8c4172019-05-13 16:23:482// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ash/public/cpp/ash_prefs.h"
6
Mike Wassermand13e95a2019-06-28 23:29:487#include "ash/accessibility/accessibility_controller_impl.h"
Josiah K466b0dc32021-06-16 23:39:058#include "ash/accessibility/magnifier/docked_magnifier_controller.h"
wutao3a150d71b2020-02-19 22:11:269#include "ash/ambient/ambient_controller.h"
Emmanuel Arias Soto4de5f2b72023-04-26 15:58:2410#include "ash/ambient/managed/screensaver_images_policy_handler.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4811#include "ash/app_list/app_list_controller_impl.h"
David Blackec4cbcd2020-04-15 20:35:2512#include "ash/assistant/assistant_controller_impl.h"
Ramya Gopalan96b2aa22022-08-23 17:30:0013#include "ash/calendar/calendar_controller.h"
Ahmed Fakhry766bac62021-09-24 02:36:1914#include "ash/capture_mode/capture_mode_controller.h"
Yulun Wu78c26ab2020-08-26 06:37:3615#include "ash/clipboard/clipboard_nudge_controller.h"
Gordon Setoc7b5631e2021-11-12 22:48:2816#include "ash/constants/ash_features.h"
Henrique Ferreiro37770262021-02-06 01:20:5317#include "ash/constants/ash_pref_names.h"
Jason Thaiaa31bb12022-06-07 21:50:2618#include "ash/controls/contextual_tooltip.h"
Xiyuan Xia14619a22019-05-14 20:20:4419#include "ash/detachable_base/detachable_base_handler.h"
20#include "ash/display/display_prefs.h"
Gil Dekel69777032020-02-07 18:41:5321#include "ash/display/privacy_screen_controller.h"
James Cookf3789aac2022-09-06 18:10:5422#include "ash/glanceables/glanceables_util.h"
Chloe Pelling186ed3e2020-04-27 01:08:3423#include "ash/keyboard/keyboard_controller_impl.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4824#include "ash/login/login_screen_controller.h"
Aya ElAttard2b3c8a2020-06-22 23:02:1325#include "ash/login/ui/login_expanded_public_account_view.h"
Mia Bergeron12fd2f182019-06-11 23:04:4626#include "ash/media/media_controller_impl.h"
Andrew Xucfed58c2022-04-13 22:25:5127#include "ash/metrics/feature_discovery_duration_reporter_impl.h"
Courtney Wongfa3b71902022-05-12 22:21:3428#include "ash/projector/projector_controller_impl.h"
Ahmed Mehfooze6167f52020-10-22 20:01:3329#include "ash/public/cpp/holding_space/holding_space_prefs.h"
Daniel Classone31b84fd22021-10-05 02:41:5730#include "ash/quick_pair/keyed_service/quick_pair_mediator.h"
Xiaodan Zhud5b81872020-11-12 18:15:2931#include "ash/session/fullscreen_controller.h"
David Black57245f32023-03-07 19:36:0832#include "ash/session/session_controller_impl.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4833#include "ash/shelf/shelf_controller.h"
Erica Lee50bbcae2023-01-14 01:26:5634#include "ash/style/color_palette_controller.h"
minchc568dd72022-06-24 17:41:4335#include "ash/style/dark_light_mode_controller_impl.h"
Pi-Hsun Shih2ddabea2022-07-21 07:45:4436#include "ash/system/camera/autozoom_controller_impl.h"
Pi-Hsun Shihfaac34f2022-08-03 10:39:1237#include "ash/system/camera/autozoom_nudge_controller.h"
Guoxing Zhao191ec872022-11-28 02:06:3438#include "ash/system/camera/camera_effects_controller.h"
Eric Sumf97e7b892023-04-17 22:41:4439#include "ash/system/geolocation/geolocation_controller.h"
Ahmed Mehfoozd618d6b2020-02-29 01:46:3040#include "ash/system/gesture_education/gesture_education_notification_controller.h"
Michael Martis0a412c6c2022-05-10 03:40:0741#include "ash/system/human_presence/snooping_protection_controller.h"
Michael Checo76cfece2023-02-08 00:53:2442#include "ash/system/input_device_settings/input_device_settings_controller_impl.h"
David Padlipsky767122082023-01-20 00:15:5743#include "ash/system/input_device_settings/input_device_tracker.h"
David Padlipsky37b51932023-01-26 01:44:5944#include "ash/system/input_device_settings/keyboard_modifier_metrics_recorder.h"
Jason Thaie3670852022-05-10 21:19:1845#include "ash/system/keyboard_brightness/keyboard_backlight_color_controller.h"
Jazz Xubfefcba2020-09-25 01:59:1346#include "ash/system/media/media_tray.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4847#include "ash/system/message_center/message_center_controller.h"
Gordon Seto5623514d2021-01-27 23:52:2848#include "ash/system/network/cellular_setup_notifier.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4849#include "ash/system/network/vpn_list_view.h"
Steven Bennetts32f5d552019-07-09 16:16:1350#include "ash/system/night_light/night_light_controller_impl.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4851#include "ash/system/palette/palette_tray.h"
52#include "ash/system/palette/palette_welcome_bubble.h"
Jimmy Gongc6f4fd02021-02-25 01:55:0053#include "ash/system/pcie_peripheral/pcie_peripheral_notification_controller.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4854#include "ash/system/power/power_prefs.h"
Md Shahadat Hossain Shahin36bc3612022-08-09 11:01:2555#include "ash/system/privacy_hub/privacy_hub_controller.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4856#include "ash/system/session/logout_button_tray.h"
Maria Petrisor878ea9f12021-04-14 17:55:0957#include "ash/system/session/logout_confirmation_controller.h"
Jiaming Cheng5bb71282022-10-06 00:08:4558#include "ash/system/unified/quick_settings_footer.h"
Aya ElAttarfb1b9c62020-04-14 08:54:4459#include "ash/system/unified/top_shortcuts_view.h"
Kevin Radtkea8bd8254ca2021-11-16 00:37:4860#include "ash/system/unified/unified_system_tray_controller.h"
Jameson Thies647d2d32022-02-24 23:58:2161#include "ash/system/usb_peripheral/usb_peripheral_notification_controller.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4862#include "ash/touch/touch_devices_controller.h"
Sean Kaud881d182022-05-24 19:26:0963#include "ash/wallpaper/wallpaper_pref_manager.h"
Ahmed Fakhry1d18fafe52020-02-24 22:40:3664#include "ash/wm/desks/desks_restore_util.h"
Daniel Andersson3203dbc2022-05-05 23:47:2465#include "ash/wm/desks/templates/saved_desk_util.h"
Elijah Hewer4959cc82023-03-30 22:38:3466#include "ash/wm/float/tablet_mode_tuck_education.h"
Sherri Linb6b765a12022-03-03 11:37:3467#include "ash/wm/lock_state_controller.h"
Cattalyya Nuengsigkapianf24c05b2021-01-15 02:51:1868#include "ash/wm/window_cycle/window_cycle_controller.h"
Yeunjoo Choi2d3704c12022-06-21 02:44:3469#include "chromeos/ash/services/assistant/public/cpp/assistant_prefs.h"
Yue Lif0da5bf2021-11-19 22:01:5770#include "chromeos/components/quick_answers/public/cpp/quick_answers_prefs.h"
Sammie Quon2bb7e392023-02-13 22:23:4271#include "chromeos/ui/frame/multitask_menu/multitask_menu_nudge_controller.h"
anina koehlerf1e29df62022-08-10 07:22:3272#include "chromeos/ui/wm/fullscreen/pref_names.h"
Yue Li0e81c0c2021-09-29 03:22:1873#include "components/language/core/browser/pref_names.h"
Amanda Deacon48669b4d2021-04-27 00:00:2374#include "components/live_caption/pref_names.h"
Abigail Kleine4c6b5c2022-03-30 21:06:4575#include "components/soda/constants.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4876
77namespace ash {
78
79namespace {
80
81// Registers prefs whose default values are same in user and signin prefs.
82void RegisterProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
James Cook025aa042019-10-18 23:16:3283 AccessibilityControllerImpl::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4884 AppListControllerImpl::RegisterProfilePrefs(registry);
David Blackec4cbcd2020-04-15 20:35:2585 AssistantControllerImpl::RegisterProfilePrefs(registry);
Pi-Hsun Shih2ddabea2022-07-21 07:45:4486 AutozoomControllerImpl::RegisterProfilePrefs(registry);
Pi-Hsun Shihfaac34f2022-08-03 10:39:1287 AutozoomNudgeController::RegisterProfilePrefs(registry);
wutao3a150d71b2020-02-19 22:11:2688 AmbientController::RegisterProfilePrefs(registry);
Ramya Gopalan96b2aa22022-08-23 17:30:0089 CalendarController::RegisterProfilePrefs(registry);
Guoxing Zhao191ec872022-11-28 02:06:3490 CameraEffectsController::RegisterProfilePrefs(registry);
Ahmed Fakhry766bac62021-09-24 02:36:1991 CaptureModeController::RegisterProfilePrefs(registry);
Gordon Seto5623514d2021-01-27 23:52:2892 CellularSetupNotifier::RegisterProfilePrefs(registry);
Elijah Hewer4959cc82023-03-30 22:38:3493 chromeos::MultitaskMenuNudgeController::RegisterProfilePrefs(registry);
Yulun Wu1e355132020-02-11 20:12:2294 contextual_tooltip::RegisterProfilePrefs(registry);
Yulun Wu78c26ab2020-08-26 06:37:3695 ClipboardNudgeController::RegisterProfilePrefs(registry);
Erica Lee50bbcae2023-01-14 01:26:5696 ColorPaletteController::RegisterPrefs(registry);
minchc568dd72022-06-24 17:41:4397 DarkLightModeControllerImpl::RegisterProfilePrefs(registry);
Ahmed Fakhry1d18fafe52020-02-24 22:40:3698 desks_restore_util::RegisterProfilePrefs(registry);
Daniel Andersson3203dbc2022-05-05 23:47:2499 saved_desk_util::RegisterProfilePrefs(registry);
Josiah K466b0dc32021-06-16 23:39:05100 DockedMagnifierController::RegisterProfilePrefs(registry);
Andrew Xucfed58c2022-04-13 22:25:51101 FeatureDiscoveryDurationReporterImpl::RegisterProfilePrefs(registry);
Xiaodan Zhud5b81872020-11-12 18:15:29102 FullscreenController::RegisterProfilePrefs(registry);
Eric Sumf97e7b892023-04-17 22:41:44103 GeolocationController::RegisterProfilePrefs(registry);
Ahmed Mehfoozccd31e162020-05-12 01:59:11104 GestureEducationNotificationController::RegisterProfilePrefs(registry,
105 for_test);
Ahmed Mehfooze6167f52020-10-22 20:01:33106 holding_space_prefs::RegisterProfilePrefs(registry);
Michael Checo76cfece2023-02-08 00:53:24107 InputDeviceSettingsControllerImpl::RegisterProfilePrefs(registry);
David Padlipsky767122082023-01-20 00:15:57108 InputDeviceTracker::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:48109 LoginScreenController::RegisterProfilePrefs(registry, for_test);
110 LogoutButtonTray::RegisterProfilePrefs(registry);
Maria Petrisor878ea9f12021-04-14 17:55:09111 LogoutConfirmationController::RegisterProfilePrefs(registry);
lbowen1e6ed0b2022-10-26 21:49:44112 KeyboardBacklightColorController::RegisterPrefs(registry);
Chloe Pelling186ed3e2020-04-27 01:08:34113 KeyboardControllerImpl::RegisterProfilePrefs(registry);
David Padlipsky37b51932023-01-26 01:44:59114 KeyboardModifierMetricsRecorder::RegisterProfilePrefs(registry, for_test);
Mia Bergeron12fd2f182019-06-11 23:04:46115 MediaControllerImpl::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:48116 MessageCenterController::RegisterProfilePrefs(registry);
Steven Bennetts32f5d552019-07-09 16:16:13117 NightLightControllerImpl::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:48118 PaletteTray::RegisterProfilePrefs(registry);
119 PaletteWelcomeBubble::RegisterProfilePrefs(registry);
Jimmy Gongc6f4fd02021-02-25 01:55:00120 PciePeripheralNotificationController::RegisterProfilePrefs(registry);
Md Shahadat Hossain Shahin36bc3612022-08-09 11:01:25121 PrivacyHubController::RegisterProfilePrefs(registry);
Gil Dekel69777032020-02-07 18:41:53122 PrivacyScreenController::RegisterProfilePrefs(registry);
Courtney Wongfa3b71902022-05-12 22:21:34123 ProjectorControllerImpl::RegisterProfilePrefs(registry);
Daniel Classone31b84fd22021-10-05 02:41:57124 quick_pair::Mediator::RegisterProfilePrefs(registry);
Emmanuel Arias Soto4de5f2b72023-04-26 15:58:24125 ScreensaverImagesPolicyHandler::RegisterPrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:48126 ShelfController::RegisterProfilePrefs(registry);
Michael Martis398ffa82022-05-09 01:11:47127 SnoopingProtectionController::RegisterProfilePrefs(registry);
Elijah Hewer4959cc82023-03-30 22:38:34128 TabletModeTuckEducation::RegisterProfilePrefs(registry);
Ana Salazareb7c25712020-02-03 20:27:26129 TouchDevicesController::RegisterProfilePrefs(registry, for_test);
Kevin Radtkea8bd8254ca2021-11-16 00:37:48130 UnifiedSystemTrayController::RegisterProfilePrefs(registry);
Jazz Xubfefcba2020-09-25 01:59:13131 MediaTray::RegisterProfilePrefs(registry);
Jameson Thies647d2d32022-02-24 23:58:21132 UsbPeripheralNotificationController::RegisterProfilePrefs(registry);
James Cook987b4b32022-04-02 00:07:08133 VPNListView::RegisterProfilePrefs(registry);
Sean Kaud881d182022-05-24 19:26:09134 WallpaperPrefManager::RegisterProfilePrefs(registry);
Cattalyya Nuengsigkapianf24c05b2021-01-15 02:51:18135 WindowCycleController::RegisterProfilePrefs(registry);
James Cook4f3640d2019-11-19 00:40:35136
Ana Salazareb7c25712020-02-03 20:27:26137 // Provide prefs registered in the browser for ash_unittests.
138 if (for_test) {
Yeunjoo Choi65c73cc2022-08-02 05:30:16139 assistant::prefs::RegisterProfilePrefs(registry);
Yeunjoo Choiecf2ba42021-09-01 01:25:01140 quick_answers::prefs::RegisterProfilePrefs(registry);
Roman Sorokin8fab4972021-11-17 17:10:36141 registry->RegisterBooleanPref(prefs::kMouseReverseScroll, false);
Chloe Pelling4a5ed4462022-02-15 02:20:07142 registry->RegisterBooleanPref(prefs::kSendFunctionKeys, false);
Yeunjoo Choi0c8273a2022-11-29 04:22:50143 registry->RegisterBooleanPref(prefs::kSuggestedContentEnabled, true);
Roman Sorokin8fab4972021-11-17 17:10:36144 registry->RegisterBooleanPref(::prefs::kLiveCaptionEnabled, false);
anina koehlerf1e29df62022-08-10 07:22:32145 registry->RegisterListPref(
146 chromeos::prefs::kKeepFullscreenWithoutNotificationUrlAllowList);
Abigail Kleine4c6b5c2022-03-30 21:06:45147 registry->RegisterStringPref(::prefs::kLiveCaptionLanguageCode,
148 speech::kUsEnglishLocale);
Yue Li0e81c0c2021-09-29 03:22:18149 registry->RegisterStringPref(language::prefs::kApplicationLocale,
150 std::string());
Yue Li5125160b2022-04-04 22:40:39151 registry->RegisterStringPref(language::prefs::kPreferredLanguages,
152 std::string());
Ana Salazareb7c25712020-02-03 20:27:26153 }
Xiyuan Xia5a8c4172019-05-13 16:23:48154}
155
156} // namespace
157
Xiyuan Xia14619a22019-05-14 20:20:44158void RegisterLocalStatePrefs(PrefRegistrySimple* registry, bool for_test) {
159 PaletteTray::RegisterLocalStatePrefs(registry);
Sean Kaud881d182022-05-24 19:26:09160 WallpaperPrefManager::RegisterLocalStatePrefs(registry);
Xiyuan Xia14619a22019-05-14 20:20:44161 DetachableBaseHandler::RegisterPrefs(registry);
162 PowerPrefs::RegisterLocalStatePrefs(registry);
zauri7f404de2023-04-04 18:02:05163 PrivacyHubController::RegisterLocalStatePrefs(registry);
Xiyuan Xia14619a22019-05-14 20:20:44164 DisplayPrefs::RegisterLocalStatePrefs(registry);
Aya ElAttard2b3c8a2020-06-22 23:02:13165 LoginExpandedPublicAccountView::RegisterLocalStatePrefs(registry);
Sherri Linb6b765a12022-03-03 11:37:34166 LockStateController::RegisterPrefs(registry);
Daniel Classon2ded753e2021-12-01 18:42:50167 quick_pair::Mediator::RegisterLocalStatePrefs(registry);
Jiaming Cheng5bb71282022-10-06 00:08:45168 if (ash::features::IsQsRevampEnabled())
169 QuickSettingsFooter::RegisterLocalStatePrefs(registry);
170 else
171 TopShortcutsView::RegisterLocalStatePrefs(registry);
lbowen1e6ed0b2022-10-26 21:49:44172 KeyboardBacklightColorController::RegisterPrefs(registry);
Xiyuan Xia14619a22019-05-14 20:20:44173}
174
Xiyuan Xia5a8c4172019-05-13 16:23:48175void RegisterSigninProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
176 RegisterProfilePrefs(registry, for_test);
James Cookef1411e12019-10-18 23:49:22177 PowerPrefs::RegisterSigninProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:48178}
179
180void RegisterUserProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
181 RegisterProfilePrefs(registry, for_test);
James Cookef1411e12019-10-18 23:49:22182 PowerPrefs::RegisterUserProfilePrefs(registry);
David Black57245f32023-03-07 19:36:08183 SessionControllerImpl::RegisterUserProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:48184}
185
186} // namespace ash