blob: 44c318a60be601a778f9b48a2d83a158465c7d9a [file] [log] [blame]
Xiyuan Xia5a8c4172019-05-13 16:23:481// Copyright 2019 The Chromium Authors. All rights reserved.
2// 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
Zentaro Kavanagh1f436492021-05-20 23:29:367#include "ash/accelerators/accelerator_controller_impl.h"
Mike Wassermand13e95a2019-06-28 23:29:488#include "ash/accessibility/accessibility_controller_impl.h"
Josiah K466b0dc32021-06-16 23:39:059#include "ash/accessibility/magnifier/docked_magnifier_controller.h"
wutao3a150d71b2020-02-19 22:11:2610#include "ash/ambient/ambient_controller.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"
Ahmed Fakhry766bac62021-09-24 02:36:1913#include "ash/capture_mode/capture_mode_controller.h"
Yulun Wu78c26ab2020-08-26 06:37:3614#include "ash/clipboard/clipboard_nudge_controller.h"
Gordon Setoc7b5631e2021-11-12 22:48:2815#include "ash/constants/ash_features.h"
Henrique Ferreiro37770262021-02-06 01:20:5316#include "ash/constants/ash_pref_names.h"
Xiyuan Xia14619a22019-05-14 20:20:4417#include "ash/detachable_base/detachable_base_handler.h"
18#include "ash/display/display_prefs.h"
Gil Dekel69777032020-02-07 18:41:5319#include "ash/display/privacy_screen_controller.h"
Chloe Pelling186ed3e2020-04-27 01:08:3420#include "ash/keyboard/keyboard_controller_impl.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4821#include "ash/login/login_screen_controller.h"
Aya ElAttard2b3c8a2020-06-22 23:02:1322#include "ash/login/ui/login_expanded_public_account_view.h"
Mia Bergeron12fd2f182019-06-11 23:04:4623#include "ash/media/media_controller_impl.h"
Ahmed Mehfooze6167f52020-10-22 20:01:3324#include "ash/public/cpp/holding_space/holding_space_prefs.h"
Daniel Classone31b84fd22021-10-05 02:41:5725#include "ash/quick_pair/keyed_service/quick_pair_mediator.h"
Xiaodan Zhud5b81872020-11-12 18:15:2926#include "ash/session/fullscreen_controller.h"
Yulun Wu1e355132020-02-11 20:12:2227#include "ash/shelf/contextual_tooltip.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4828#include "ash/shelf/shelf_controller.h"
minch308923f32020-08-28 18:58:3029#include "ash/style/ash_color_provider.h"
Cattalyya Nuengsigkapian9fd69262022-03-29 00:17:1730#include "ash/style/dark_mode_controller.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4831#include "ash/system/bluetooth/bluetooth_power_controller.h"
32#include "ash/system/caps_lock_notification_controller.h"
Ahmed Mehfoozd618d6b2020-02-29 01:46:3033#include "ash/system/gesture_education/gesture_education_notification_controller.h"
Jazz Xubfefcba2020-09-25 01:59:1334#include "ash/system/media/media_tray.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4835#include "ash/system/message_center/message_center_controller.h"
Gordon Seto5623514d2021-01-27 23:52:2836#include "ash/system/network/cellular_setup_notifier.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4837#include "ash/system/network/vpn_list_view.h"
Steven Bennetts32f5d552019-07-09 16:16:1338#include "ash/system/night_light/night_light_controller_impl.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4839#include "ash/system/palette/palette_tray.h"
40#include "ash/system/palette/palette_welcome_bubble.h"
Jimmy Gongc6f4fd02021-02-25 01:55:0041#include "ash/system/pcie_peripheral/pcie_peripheral_notification_controller.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4842#include "ash/system/power/power_prefs.h"
43#include "ash/system/session/logout_button_tray.h"
Maria Petrisor878ea9f12021-04-14 17:55:0944#include "ash/system/session/logout_confirmation_controller.h"
Michael Martis2ec2b4d2021-12-01 01:57:3745#include "ash/system/unified/hps_notify_controller.h"
Aya ElAttarfb1b9c62020-04-14 08:54:4446#include "ash/system/unified/top_shortcuts_view.h"
Kevin Radtkea8bd8254ca2021-11-16 00:37:4847#include "ash/system/unified/unified_system_tray_controller.h"
Jameson Thies647d2d32022-02-24 23:58:2148#include "ash/system/usb_peripheral/usb_peripheral_notification_controller.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4849#include "ash/touch/touch_devices_controller.h"
Mike Wassermana5352da2019-05-30 17:26:0850#include "ash/wallpaper/wallpaper_controller_impl.h"
Ahmed Fakhry1d18fafe52020-02-24 22:40:3651#include "ash/wm/desks/desks_restore_util.h"
minch86e06a32021-09-07 20:53:3452#include "ash/wm/desks/persistent_desks_bar_controller.h"
Brian Becke9b804272021-10-07 01:24:1753#include "ash/wm/desks/templates/desks_templates_util.h"
Sherri Linb6b765a12022-03-03 11:37:3454#include "ash/wm/lock_state_controller.h"
Cattalyya Nuengsigkapianf24c05b2021-01-15 02:51:1855#include "ash/wm/window_cycle/window_cycle_controller.h"
Yue Lif0da5bf2021-11-19 22:01:5756#include "chromeos/components/quick_answers/public/cpp/quick_answers_prefs.h"
Yue Li4fa72852019-07-17 01:01:3257#include "chromeos/services/assistant/public/cpp/assistant_prefs.h"
Yue Li0e81c0c2021-09-29 03:22:1858#include "components/language/core/browser/pref_names.h"
Amanda Deacon48669b4d2021-04-27 00:00:2359#include "components/live_caption/pref_names.h"
Abigail Kleine4c6b5c2022-03-30 21:06:4560#include "components/soda/constants.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4861
62namespace ash {
63
64namespace {
65
66// Registers prefs whose default values are same in user and signin prefs.
67void RegisterProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
Zentaro Kavanagh1f436492021-05-20 23:29:3668 AcceleratorControllerImpl::RegisterProfilePrefs(registry);
James Cook025aa042019-10-18 23:16:3269 AccessibilityControllerImpl::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4870 AppListControllerImpl::RegisterProfilePrefs(registry);
David Blackec4cbcd2020-04-15 20:35:2571 AssistantControllerImpl::RegisterProfilePrefs(registry);
minch308923f32020-08-28 18:58:3072 AshColorProvider::RegisterProfilePrefs(registry);
wutao3a150d71b2020-02-19 22:11:2673 AmbientController::RegisterProfilePrefs(registry);
Gordon Setoc7b5631e2021-11-12 22:48:2874 if (!ash::features::IsBluetoothRevampEnabled())
75 BluetoothPowerController::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4876 CapsLockNotificationController::RegisterProfilePrefs(registry, for_test);
Ahmed Fakhry766bac62021-09-24 02:36:1977 CaptureModeController::RegisterProfilePrefs(registry);
Gordon Seto5623514d2021-01-27 23:52:2878 CellularSetupNotifier::RegisterProfilePrefs(registry);
Yulun Wu1e355132020-02-11 20:12:2279 contextual_tooltip::RegisterProfilePrefs(registry);
Yulun Wu78c26ab2020-08-26 06:37:3680 ClipboardNudgeController::RegisterProfilePrefs(registry);
Cattalyya Nuengsigkapian9fd69262022-03-29 00:17:1781 DarkModeController::RegisterProfilePrefs(registry);
Ahmed Fakhry1d18fafe52020-02-24 22:40:3682 desks_restore_util::RegisterProfilePrefs(registry);
Brian Becke9b804272021-10-07 01:24:1783 desks_templates_util::RegisterProfilePrefs(registry);
Josiah K466b0dc32021-06-16 23:39:0584 DockedMagnifierController::RegisterProfilePrefs(registry);
Xiaodan Zhud5b81872020-11-12 18:15:2985 FullscreenController::RegisterProfilePrefs(registry);
Ahmed Mehfoozccd31e162020-05-12 01:59:1186 GestureEducationNotificationController::RegisterProfilePrefs(registry,
87 for_test);
Ahmed Mehfooze6167f52020-10-22 20:01:3388 holding_space_prefs::RegisterProfilePrefs(registry);
Michael Martis2ec2b4d2021-12-01 01:57:3789 HpsNotifyController::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4890 LoginScreenController::RegisterProfilePrefs(registry, for_test);
91 LogoutButtonTray::RegisterProfilePrefs(registry);
Maria Petrisor878ea9f12021-04-14 17:55:0992 LogoutConfirmationController::RegisterProfilePrefs(registry);
Chloe Pelling186ed3e2020-04-27 01:08:3493 KeyboardControllerImpl::RegisterProfilePrefs(registry);
Mia Bergeron12fd2f182019-06-11 23:04:4694 MediaControllerImpl::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4895 MessageCenterController::RegisterProfilePrefs(registry);
Steven Bennetts32f5d552019-07-09 16:16:1396 NightLightControllerImpl::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4897 PaletteTray::RegisterProfilePrefs(registry);
98 PaletteWelcomeBubble::RegisterProfilePrefs(registry);
Jimmy Gongc6f4fd02021-02-25 01:55:0099 PciePeripheralNotificationController::RegisterProfilePrefs(registry);
minch86e06a32021-09-07 20:53:34100 PersistentDesksBarController::RegisterProfilePrefs(registry);
Gil Dekel69777032020-02-07 18:41:53101 PrivacyScreenController::RegisterProfilePrefs(registry);
Daniel Classone31b84fd22021-10-05 02:41:57102 quick_pair::Mediator::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:48103 ShelfController::RegisterProfilePrefs(registry);
Ana Salazareb7c25712020-02-03 20:27:26104 TouchDevicesController::RegisterProfilePrefs(registry, for_test);
Kevin Radtkea8bd8254ca2021-11-16 00:37:48105 UnifiedSystemTrayController::RegisterProfilePrefs(registry);
Jazz Xubfefcba2020-09-25 01:59:13106 MediaTray::RegisterProfilePrefs(registry);
Jameson Thies647d2d32022-02-24 23:58:21107 UsbPeripheralNotificationController::RegisterProfilePrefs(registry);
James Cook987b4b32022-04-02 00:07:08108 VPNListView::RegisterProfilePrefs(registry);
Qasid Sadiqedba1f52021-04-05 18:56:03109 WallpaperControllerImpl::RegisterProfilePrefs(registry);
Cattalyya Nuengsigkapianf24c05b2021-01-15 02:51:18110 WindowCycleController::RegisterProfilePrefs(registry);
James Cook4f3640d2019-11-19 00:40:35111
Ana Salazareb7c25712020-02-03 20:27:26112 // Provide prefs registered in the browser for ash_unittests.
113 if (for_test) {
James Cook4f3640d2019-11-19 00:40:35114 chromeos::assistant::prefs::RegisterProfilePrefs(registry);
Yeunjoo Choiecf2ba42021-09-01 01:25:01115 quick_answers::prefs::RegisterProfilePrefs(registry);
Roman Sorokin8fab4972021-11-17 17:10:36116 registry->RegisterBooleanPref(prefs::kMouseReverseScroll, false);
Chloe Pelling4a5ed4462022-02-15 02:20:07117 registry->RegisterBooleanPref(prefs::kSendFunctionKeys, false);
Roman Sorokin8fab4972021-11-17 17:10:36118 registry->RegisterBooleanPref(chromeos::prefs::kSuggestedContentEnabled,
119 true);
120 registry->RegisterBooleanPref(::prefs::kLiveCaptionEnabled, false);
Abigail Kleine4c6b5c2022-03-30 21:06:45121 registry->RegisterStringPref(::prefs::kLiveCaptionLanguageCode,
122 speech::kUsEnglishLocale);
Yue Li0e81c0c2021-09-29 03:22:18123 registry->RegisterStringPref(language::prefs::kApplicationLocale,
124 std::string());
Yue Li5125160b2022-04-04 22:40:39125 registry->RegisterStringPref(language::prefs::kPreferredLanguages,
126 std::string());
Ana Salazareb7c25712020-02-03 20:27:26127 }
Xiyuan Xia5a8c4172019-05-13 16:23:48128}
129
130} // namespace
131
Xiyuan Xia14619a22019-05-14 20:20:44132void RegisterLocalStatePrefs(PrefRegistrySimple* registry, bool for_test) {
133 PaletteTray::RegisterLocalStatePrefs(registry);
Mike Wassermana5352da2019-05-30 17:26:08134 WallpaperControllerImpl::RegisterLocalStatePrefs(registry);
Gordon Setoc7b5631e2021-11-12 22:48:28135 if (!ash::features::IsBluetoothRevampEnabled())
136 BluetoothPowerController::RegisterLocalStatePrefs(registry);
Xiyuan Xia14619a22019-05-14 20:20:44137 DetachableBaseHandler::RegisterPrefs(registry);
138 PowerPrefs::RegisterLocalStatePrefs(registry);
139 DisplayPrefs::RegisterLocalStatePrefs(registry);
Aya ElAttard2b3c8a2020-06-22 23:02:13140 LoginExpandedPublicAccountView::RegisterLocalStatePrefs(registry);
Sherri Linb6b765a12022-03-03 11:37:34141 LockStateController::RegisterPrefs(registry);
Daniel Classon2ded753e2021-12-01 18:42:50142 quick_pair::Mediator::RegisterLocalStatePrefs(registry);
Aya ElAttarfb1b9c62020-04-14 08:54:44143 TopShortcutsView::RegisterLocalStatePrefs(registry);
Xiyuan Xia14619a22019-05-14 20:20:44144}
145
Xiyuan Xia5a8c4172019-05-13 16:23:48146void RegisterSigninProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
147 RegisterProfilePrefs(registry, for_test);
James Cookef1411e12019-10-18 23:49:22148 PowerPrefs::RegisterSigninProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:48149}
150
151void RegisterUserProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
152 RegisterProfilePrefs(registry, for_test);
James Cookef1411e12019-10-18 23:49:22153 PowerPrefs::RegisterUserProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:48154}
155
156} // namespace ash