blob: 3ddc08cea4923562da2fab4af17a6b02b465d04c [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"
Xiyuan Xia5a8c4172019-05-13 16:23:4830#include "ash/system/bluetooth/bluetooth_power_controller.h"
31#include "ash/system/caps_lock_notification_controller.h"
Ahmed Mehfoozd618d6b2020-02-29 01:46:3032#include "ash/system/gesture_education/gesture_education_notification_controller.h"
Jazz Xubfefcba2020-09-25 01:59:1333#include "ash/system/media/media_tray.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4834#include "ash/system/message_center/message_center_controller.h"
Gordon Seto5623514d2021-01-27 23:52:2835#include "ash/system/network/cellular_setup_notifier.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4836#include "ash/system/network/vpn_list_view.h"
Steven Bennetts32f5d552019-07-09 16:16:1337#include "ash/system/night_light/night_light_controller_impl.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4838#include "ash/system/palette/palette_tray.h"
39#include "ash/system/palette/palette_welcome_bubble.h"
Jimmy Gongc6f4fd02021-02-25 01:55:0040#include "ash/system/pcie_peripheral/pcie_peripheral_notification_controller.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4841#include "ash/system/power/power_prefs.h"
42#include "ash/system/session/logout_button_tray.h"
Maria Petrisor878ea9f12021-04-14 17:55:0943#include "ash/system/session/logout_confirmation_controller.h"
Michael Martis2ec2b4d2021-12-01 01:57:3744#include "ash/system/unified/hps_notify_controller.h"
Aya ElAttarfb1b9c62020-04-14 08:54:4445#include "ash/system/unified/top_shortcuts_view.h"
Kevin Radtkea8bd8254ca2021-11-16 00:37:4846#include "ash/system/unified/unified_system_tray_controller.h"
Jameson Thies647d2d32022-02-24 23:58:2147#include "ash/system/usb_peripheral/usb_peripheral_notification_controller.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4848#include "ash/touch/touch_devices_controller.h"
Mike Wassermana5352da2019-05-30 17:26:0849#include "ash/wallpaper/wallpaper_controller_impl.h"
Ahmed Fakhry1d18fafe52020-02-24 22:40:3650#include "ash/wm/desks/desks_restore_util.h"
minch86e06a32021-09-07 20:53:3451#include "ash/wm/desks/persistent_desks_bar_controller.h"
Brian Becke9b804272021-10-07 01:24:1752#include "ash/wm/desks/templates/desks_templates_util.h"
Sherri Linb6b765a12022-03-03 11:37:3453#include "ash/wm/lock_state_controller.h"
Cattalyya Nuengsigkapianf24c05b2021-01-15 02:51:1854#include "ash/wm/window_cycle/window_cycle_controller.h"
Yue Lif0da5bf2021-11-19 22:01:5755#include "chromeos/components/quick_answers/public/cpp/quick_answers_prefs.h"
Yue Li4fa72852019-07-17 01:01:3256#include "chromeos/services/assistant/public/cpp/assistant_prefs.h"
Yue Li0e81c0c2021-09-29 03:22:1857#include "components/language/core/browser/pref_names.h"
Amanda Deacon48669b4d2021-04-27 00:00:2358#include "components/live_caption/pref_names.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4859
60namespace ash {
61
62namespace {
63
64// Registers prefs whose default values are same in user and signin prefs.
65void RegisterProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
Zentaro Kavanagh1f436492021-05-20 23:29:3666 AcceleratorControllerImpl::RegisterProfilePrefs(registry);
James Cook025aa042019-10-18 23:16:3267 AccessibilityControllerImpl::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4868 AppListControllerImpl::RegisterProfilePrefs(registry);
David Blackec4cbcd2020-04-15 20:35:2569 AssistantControllerImpl::RegisterProfilePrefs(registry);
minch308923f32020-08-28 18:58:3070 AshColorProvider::RegisterProfilePrefs(registry);
wutao3a150d71b2020-02-19 22:11:2671 AmbientController::RegisterProfilePrefs(registry);
Gordon Setoc7b5631e2021-11-12 22:48:2872 if (!ash::features::IsBluetoothRevampEnabled())
73 BluetoothPowerController::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4874 CapsLockNotificationController::RegisterProfilePrefs(registry, for_test);
Ahmed Fakhry766bac62021-09-24 02:36:1975 CaptureModeController::RegisterProfilePrefs(registry);
Gordon Seto5623514d2021-01-27 23:52:2876 CellularSetupNotifier::RegisterProfilePrefs(registry);
Yulun Wu1e355132020-02-11 20:12:2277 contextual_tooltip::RegisterProfilePrefs(registry);
Yulun Wu78c26ab2020-08-26 06:37:3678 ClipboardNudgeController::RegisterProfilePrefs(registry);
Ahmed Fakhry1d18fafe52020-02-24 22:40:3679 desks_restore_util::RegisterProfilePrefs(registry);
Brian Becke9b804272021-10-07 01:24:1780 desks_templates_util::RegisterProfilePrefs(registry);
Josiah K466b0dc32021-06-16 23:39:0581 DockedMagnifierController::RegisterProfilePrefs(registry);
Xiaodan Zhud5b81872020-11-12 18:15:2982 FullscreenController::RegisterProfilePrefs(registry);
Ahmed Mehfoozccd31e162020-05-12 01:59:1183 GestureEducationNotificationController::RegisterProfilePrefs(registry,
84 for_test);
Ahmed Mehfooze6167f52020-10-22 20:01:3385 holding_space_prefs::RegisterProfilePrefs(registry);
Michael Martis2ec2b4d2021-12-01 01:57:3786 HpsNotifyController::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4887 LoginScreenController::RegisterProfilePrefs(registry, for_test);
88 LogoutButtonTray::RegisterProfilePrefs(registry);
Maria Petrisor878ea9f12021-04-14 17:55:0989 LogoutConfirmationController::RegisterProfilePrefs(registry);
Chloe Pelling186ed3e2020-04-27 01:08:3490 KeyboardControllerImpl::RegisterProfilePrefs(registry);
Mia Bergeron12fd2f182019-06-11 23:04:4691 MediaControllerImpl::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4892 MessageCenterController::RegisterProfilePrefs(registry);
Steven Bennetts32f5d552019-07-09 16:16:1393 NightLightControllerImpl::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4894 PaletteTray::RegisterProfilePrefs(registry);
95 PaletteWelcomeBubble::RegisterProfilePrefs(registry);
Jimmy Gongc6f4fd02021-02-25 01:55:0096 PciePeripheralNotificationController::RegisterProfilePrefs(registry);
minch86e06a32021-09-07 20:53:3497 PersistentDesksBarController::RegisterProfilePrefs(registry);
Gil Dekel69777032020-02-07 18:41:5398 PrivacyScreenController::RegisterProfilePrefs(registry);
Daniel Classone31b84fd22021-10-05 02:41:5799 quick_pair::Mediator::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:48100 ShelfController::RegisterProfilePrefs(registry);
Ana Salazareb7c25712020-02-03 20:27:26101 TouchDevicesController::RegisterProfilePrefs(registry, for_test);
Xiyuan Xia5a8c4172019-05-13 16:23:48102 tray::VPNListView::RegisterProfilePrefs(registry);
Kevin Radtkea8bd8254ca2021-11-16 00:37:48103 UnifiedSystemTrayController::RegisterProfilePrefs(registry);
Jazz Xubfefcba2020-09-25 01:59:13104 MediaTray::RegisterProfilePrefs(registry);
Jameson Thies647d2d32022-02-24 23:58:21105 UsbPeripheralNotificationController::RegisterProfilePrefs(registry);
Qasid Sadiqedba1f52021-04-05 18:56:03106 WallpaperControllerImpl::RegisterProfilePrefs(registry);
Cattalyya Nuengsigkapianf24c05b2021-01-15 02:51:18107 WindowCycleController::RegisterProfilePrefs(registry);
James Cook4f3640d2019-11-19 00:40:35108
Ana Salazareb7c25712020-02-03 20:27:26109 // Provide prefs registered in the browser for ash_unittests.
110 if (for_test) {
James Cook4f3640d2019-11-19 00:40:35111 chromeos::assistant::prefs::RegisterProfilePrefs(registry);
Yeunjoo Choiecf2ba42021-09-01 01:25:01112 quick_answers::prefs::RegisterProfilePrefs(registry);
Roman Sorokin8fab4972021-11-17 17:10:36113 registry->RegisterBooleanPref(prefs::kMouseReverseScroll, false);
Chloe Pelling4a5ed4462022-02-15 02:20:07114 registry->RegisterBooleanPref(prefs::kSendFunctionKeys, false);
Roman Sorokin8fab4972021-11-17 17:10:36115 registry->RegisterBooleanPref(chromeos::prefs::kSuggestedContentEnabled,
116 true);
117 registry->RegisterBooleanPref(::prefs::kLiveCaptionEnabled, false);
Yue Li0e81c0c2021-09-29 03:22:18118 registry->RegisterStringPref(language::prefs::kApplicationLocale,
119 std::string());
Ana Salazareb7c25712020-02-03 20:27:26120 }
Xiyuan Xia5a8c4172019-05-13 16:23:48121}
122
123} // namespace
124
Xiyuan Xia14619a22019-05-14 20:20:44125void RegisterLocalStatePrefs(PrefRegistrySimple* registry, bool for_test) {
126 PaletteTray::RegisterLocalStatePrefs(registry);
Mike Wassermana5352da2019-05-30 17:26:08127 WallpaperControllerImpl::RegisterLocalStatePrefs(registry);
Gordon Setoc7b5631e2021-11-12 22:48:28128 if (!ash::features::IsBluetoothRevampEnabled())
129 BluetoothPowerController::RegisterLocalStatePrefs(registry);
Xiyuan Xia14619a22019-05-14 20:20:44130 DetachableBaseHandler::RegisterPrefs(registry);
131 PowerPrefs::RegisterLocalStatePrefs(registry);
132 DisplayPrefs::RegisterLocalStatePrefs(registry);
Aya ElAttard2b3c8a2020-06-22 23:02:13133 LoginExpandedPublicAccountView::RegisterLocalStatePrefs(registry);
Sherri Linb6b765a12022-03-03 11:37:34134 LockStateController::RegisterPrefs(registry);
Daniel Classon2ded753e2021-12-01 18:42:50135 quick_pair::Mediator::RegisterLocalStatePrefs(registry);
Aya ElAttarfb1b9c62020-04-14 08:54:44136 TopShortcutsView::RegisterLocalStatePrefs(registry);
Xiyuan Xia14619a22019-05-14 20:20:44137}
138
Xiyuan Xia5a8c4172019-05-13 16:23:48139void RegisterSigninProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
140 RegisterProfilePrefs(registry, for_test);
James Cookef1411e12019-10-18 23:49:22141 PowerPrefs::RegisterSigninProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:48142}
143
144void RegisterUserProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
145 RegisterProfilePrefs(registry, for_test);
James Cookef1411e12019-10-18 23:49:22146 PowerPrefs::RegisterUserProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:48147}
148
149} // namespace ash