blob: 651291935459f8dbe7700c489068a0e3767d2ffb [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
Mike Wassermand13e95a2019-06-28 23:29:487#include "ash/accessibility/accessibility_controller_impl.h"
David Tseng00443a32021-03-24 22:24:138#include "ash/accessibility/magnifier/docked_magnifier_controller_impl.h"
wutao3a150d71b2020-02-19 22:11:269#include "ash/ambient/ambient_controller.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4810#include "ash/app_list/app_list_controller_impl.h"
David Blackec4cbcd2020-04-15 20:35:2511#include "ash/assistant/assistant_controller_impl.h"
Yulun Wu78c26ab2020-08-26 06:37:3612#include "ash/clipboard/clipboard_nudge_controller.h"
Henrique Ferreiro37770262021-02-06 01:20:5313#include "ash/constants/ash_pref_names.h"
Xiyuan Xia14619a22019-05-14 20:20:4414#include "ash/detachable_base/detachable_base_handler.h"
15#include "ash/display/display_prefs.h"
Gil Dekel69777032020-02-07 18:41:5316#include "ash/display/privacy_screen_controller.h"
Chloe Pelling186ed3e2020-04-27 01:08:3417#include "ash/keyboard/keyboard_controller_impl.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4818#include "ash/login/login_screen_controller.h"
Aya ElAttard2b3c8a2020-06-22 23:02:1319#include "ash/login/ui/login_expanded_public_account_view.h"
Mia Bergeron12fd2f182019-06-11 23:04:4620#include "ash/media/media_controller_impl.h"
Ana Salazareb7c25712020-02-03 20:27:2621#include "ash/public/cpp/ash_pref_names.h"
Ahmed Mehfooze6167f52020-10-22 20:01:3322#include "ash/public/cpp/holding_space/holding_space_prefs.h"
Xiaodan Zhud5b81872020-11-12 18:15:2923#include "ash/session/fullscreen_controller.h"
Yulun Wu1e355132020-02-11 20:12:2224#include "ash/shelf/contextual_tooltip.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4825#include "ash/shelf/shelf_controller.h"
minch308923f32020-08-28 18:58:3026#include "ash/style/ash_color_provider.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4827#include "ash/system/bluetooth/bluetooth_power_controller.h"
28#include "ash/system/caps_lock_notification_controller.h"
Ahmed Mehfoozd618d6b2020-02-29 01:46:3029#include "ash/system/gesture_education/gesture_education_notification_controller.h"
Jazz Xubfefcba2020-09-25 01:59:1330#include "ash/system/media/media_tray.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4831#include "ash/system/message_center/message_center_controller.h"
Gordon Seto5623514d2021-01-27 23:52:2832#include "ash/system/network/cellular_setup_notifier.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4833#include "ash/system/network/vpn_list_view.h"
Steven Bennetts32f5d552019-07-09 16:16:1334#include "ash/system/night_light/night_light_controller_impl.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4835#include "ash/system/palette/palette_tray.h"
36#include "ash/system/palette/palette_welcome_bubble.h"
Jimmy Gongc6f4fd02021-02-25 01:55:0037#include "ash/system/pcie_peripheral/pcie_peripheral_notification_controller.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4838#include "ash/system/power/power_prefs.h"
39#include "ash/system/session/logout_button_tray.h"
Maria Petrisor878ea9f12021-04-14 17:55:0940#include "ash/system/session/logout_confirmation_controller.h"
Aya ElAttarfb1b9c62020-04-14 08:54:4441#include "ash/system/unified/top_shortcuts_view.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4842#include "ash/touch/touch_devices_controller.h"
Mike Wassermana5352da2019-05-30 17:26:0843#include "ash/wallpaper/wallpaper_controller_impl.h"
Ahmed Fakhry1d18fafe52020-02-24 22:40:3644#include "ash/wm/desks/desks_restore_util.h"
Cattalyya Nuengsigkapianf24c05b2021-01-15 02:51:1845#include "ash/wm/window_cycle/window_cycle_controller.h"
Yue Lid6f4cd32020-08-19 00:11:3246#include "chromeos/components/quick_answers/public/cpp/quick_answers_prefs.h"
Yue Li4fa72852019-07-17 01:01:3247#include "chromeos/services/assistant/public/cpp/assistant_prefs.h"
Amanda Deacon48669b4d2021-04-27 00:00:2348#include "components/live_caption/pref_names.h"
Ana Salazareb7c25712020-02-03 20:27:2649#include "components/pref_registry/pref_registry_syncable.h"
Xiyuan Xia5a8c4172019-05-13 16:23:4850
51namespace ash {
52
53namespace {
54
55// Registers prefs whose default values are same in user and signin prefs.
56void RegisterProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
James Cook025aa042019-10-18 23:16:3257 AccessibilityControllerImpl::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4858 AppListControllerImpl::RegisterProfilePrefs(registry);
David Blackec4cbcd2020-04-15 20:35:2559 AssistantControllerImpl::RegisterProfilePrefs(registry);
minch308923f32020-08-28 18:58:3060 AshColorProvider::RegisterProfilePrefs(registry);
wutao3a150d71b2020-02-19 22:11:2661 AmbientController::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4862 BluetoothPowerController::RegisterProfilePrefs(registry);
63 CapsLockNotificationController::RegisterProfilePrefs(registry, for_test);
Gordon Seto5623514d2021-01-27 23:52:2864 CellularSetupNotifier::RegisterProfilePrefs(registry);
Yulun Wu1e355132020-02-11 20:12:2265 contextual_tooltip::RegisterProfilePrefs(registry);
Yulun Wu78c26ab2020-08-26 06:37:3666 ClipboardNudgeController::RegisterProfilePrefs(registry);
Ahmed Fakhry1d18fafe52020-02-24 22:40:3667 desks_restore_util::RegisterProfilePrefs(registry);
James Cook025aa042019-10-18 23:16:3268 DockedMagnifierControllerImpl::RegisterProfilePrefs(registry);
Xiaodan Zhud5b81872020-11-12 18:15:2969 FullscreenController::RegisterProfilePrefs(registry);
Ahmed Mehfoozccd31e162020-05-12 01:59:1170 GestureEducationNotificationController::RegisterProfilePrefs(registry,
71 for_test);
Ahmed Mehfooze6167f52020-10-22 20:01:3372 holding_space_prefs::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4873 LoginScreenController::RegisterProfilePrefs(registry, for_test);
74 LogoutButtonTray::RegisterProfilePrefs(registry);
Maria Petrisor878ea9f12021-04-14 17:55:0975 LogoutConfirmationController::RegisterProfilePrefs(registry);
Chloe Pelling186ed3e2020-04-27 01:08:3476 KeyboardControllerImpl::RegisterProfilePrefs(registry);
Mia Bergeron12fd2f182019-06-11 23:04:4677 MediaControllerImpl::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4878 MessageCenterController::RegisterProfilePrefs(registry);
Steven Bennetts32f5d552019-07-09 16:16:1379 NightLightControllerImpl::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4880 PaletteTray::RegisterProfilePrefs(registry);
81 PaletteWelcomeBubble::RegisterProfilePrefs(registry);
Jimmy Gongc6f4fd02021-02-25 01:55:0082 PciePeripheralNotificationController::RegisterProfilePrefs(registry);
Gil Dekel69777032020-02-07 18:41:5383 PrivacyScreenController::RegisterProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:4884 ShelfController::RegisterProfilePrefs(registry);
Ana Salazareb7c25712020-02-03 20:27:2685 TouchDevicesController::RegisterProfilePrefs(registry, for_test);
Xiyuan Xia5a8c4172019-05-13 16:23:4886 tray::VPNListView::RegisterProfilePrefs(registry);
Jazz Xubfefcba2020-09-25 01:59:1387 MediaTray::RegisterProfilePrefs(registry);
Qasid Sadiqedba1f52021-04-05 18:56:0388 WallpaperControllerImpl::RegisterProfilePrefs(registry);
Cattalyya Nuengsigkapianf24c05b2021-01-15 02:51:1889 WindowCycleController::RegisterProfilePrefs(registry);
James Cook4f3640d2019-11-19 00:40:3590
Ana Salazareb7c25712020-02-03 20:27:2691 // Provide prefs registered in the browser for ash_unittests.
92 if (for_test) {
James Cook4f3640d2019-11-19 00:40:3593 chromeos::assistant::prefs::RegisterProfilePrefs(registry);
Yue Lid6f4cd32020-08-19 00:11:3294 chromeos::quick_answers::prefs::RegisterProfilePrefs(registry);
Ana Salazareb7c25712020-02-03 20:27:2695 registry->RegisterBooleanPref(
96 prefs::kMouseReverseScroll, false,
97 user_prefs::PrefRegistrySyncable::SYNCABLE_OS_PRIORITY_PREF);
Rachel Wong0eaed122020-10-21 14:46:0198 registry->RegisterBooleanPref(
99 chromeos::prefs::kSuggestedContentEnabled, true,
100 user_prefs::PrefRegistrySyncable::SYNCABLE_OS_PREF);
Abigail Kleind1dd90b22020-12-04 18:02:28101 registry->RegisterBooleanPref(
Amanda Deacon48669b4d2021-04-27 00:00:23102 ::prefs::kLiveCaptionEnabled, false,
103 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
Ana Salazareb7c25712020-02-03 20:27:26104 }
Xiyuan Xia5a8c4172019-05-13 16:23:48105}
106
107} // namespace
108
Xiyuan Xia14619a22019-05-14 20:20:44109void RegisterLocalStatePrefs(PrefRegistrySimple* registry, bool for_test) {
110 PaletteTray::RegisterLocalStatePrefs(registry);
Mike Wassermana5352da2019-05-30 17:26:08111 WallpaperControllerImpl::RegisterLocalStatePrefs(registry);
Xiyuan Xia14619a22019-05-14 20:20:44112 BluetoothPowerController::RegisterLocalStatePrefs(registry);
113 DetachableBaseHandler::RegisterPrefs(registry);
114 PowerPrefs::RegisterLocalStatePrefs(registry);
115 DisplayPrefs::RegisterLocalStatePrefs(registry);
Aya ElAttard2b3c8a2020-06-22 23:02:13116 LoginExpandedPublicAccountView::RegisterLocalStatePrefs(registry);
Aya ElAttarfb1b9c62020-04-14 08:54:44117 TopShortcutsView::RegisterLocalStatePrefs(registry);
Xiyuan Xia14619a22019-05-14 20:20:44118}
119
Xiyuan Xia5a8c4172019-05-13 16:23:48120void RegisterSigninProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
121 RegisterProfilePrefs(registry, for_test);
James Cookef1411e12019-10-18 23:49:22122 PowerPrefs::RegisterSigninProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:48123}
124
125void RegisterUserProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
126 RegisterProfilePrefs(registry, for_test);
James Cookef1411e12019-10-18 23:49:22127 PowerPrefs::RegisterUserProfilePrefs(registry);
Xiyuan Xia5a8c4172019-05-13 16:23:48128}
129
130} // namespace ash