Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 1 | // 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 Kavanagh | 1f43649 | 2021-05-20 23:29:36 | [diff] [blame] | 7 | #include "ash/accelerators/accelerator_controller_impl.h" |
Mike Wasserman | d13e95a | 2019-06-28 23:29:48 | [diff] [blame] | 8 | #include "ash/accessibility/accessibility_controller_impl.h" |
Josiah K | 466b0dc3 | 2021-06-16 23:39:05 | [diff] [blame] | 9 | #include "ash/accessibility/magnifier/docked_magnifier_controller.h" |
wutao | 3a150d71b | 2020-02-19 22:11:26 | [diff] [blame] | 10 | #include "ash/ambient/ambient_controller.h" |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 11 | #include "ash/app_list/app_list_controller_impl.h" |
David Black | ec4cbcd | 2020-04-15 20:35:25 | [diff] [blame] | 12 | #include "ash/assistant/assistant_controller_impl.h" |
Ahmed Fakhry | 766bac6 | 2021-09-24 02:36:19 | [diff] [blame] | 13 | #include "ash/capture_mode/capture_mode_controller.h" |
Yulun Wu | 78c26ab | 2020-08-26 06:37:36 | [diff] [blame] | 14 | #include "ash/clipboard/clipboard_nudge_controller.h" |
Gordon Seto | c7b5631e | 2021-11-12 22:48:28 | [diff] [blame] | 15 | #include "ash/constants/ash_features.h" |
Henrique Ferreiro | 3777026 | 2021-02-06 01:20:53 | [diff] [blame] | 16 | #include "ash/constants/ash_pref_names.h" |
Xiyuan Xia | 14619a2 | 2019-05-14 20:20:44 | [diff] [blame] | 17 | #include "ash/detachable_base/detachable_base_handler.h" |
| 18 | #include "ash/display/display_prefs.h" |
Gil Dekel | 6977703 | 2020-02-07 18:41:53 | [diff] [blame] | 19 | #include "ash/display/privacy_screen_controller.h" |
Chloe Pelling | 186ed3e | 2020-04-27 01:08:34 | [diff] [blame] | 20 | #include "ash/keyboard/keyboard_controller_impl.h" |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 21 | #include "ash/login/login_screen_controller.h" |
Aya ElAttar | d2b3c8a | 2020-06-22 23:02:13 | [diff] [blame] | 22 | #include "ash/login/ui/login_expanded_public_account_view.h" |
Mia Bergeron | 12fd2f18 | 2019-06-11 23:04:46 | [diff] [blame] | 23 | #include "ash/media/media_controller_impl.h" |
Ahmed Mehfooz | e6167f5 | 2020-10-22 20:01:33 | [diff] [blame] | 24 | #include "ash/public/cpp/holding_space/holding_space_prefs.h" |
Daniel Classon | e31b84fd2 | 2021-10-05 02:41:57 | [diff] [blame] | 25 | #include "ash/quick_pair/keyed_service/quick_pair_mediator.h" |
Xiaodan Zhu | d5b8187 | 2020-11-12 18:15:29 | [diff] [blame] | 26 | #include "ash/session/fullscreen_controller.h" |
Yulun Wu | 1e35513 | 2020-02-11 20:12:22 | [diff] [blame] | 27 | #include "ash/shelf/contextual_tooltip.h" |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 28 | #include "ash/shelf/shelf_controller.h" |
minch | 308923f3 | 2020-08-28 18:58:30 | [diff] [blame] | 29 | #include "ash/style/ash_color_provider.h" |
Cattalyya Nuengsigkapian | 9fd6926 | 2022-03-29 00:17:17 | [diff] [blame] | 30 | #include "ash/style/dark_mode_controller.h" |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 31 | #include "ash/system/bluetooth/bluetooth_power_controller.h" |
| 32 | #include "ash/system/caps_lock_notification_controller.h" |
Ahmed Mehfooz | d618d6b | 2020-02-29 01:46:30 | [diff] [blame] | 33 | #include "ash/system/gesture_education/gesture_education_notification_controller.h" |
Jazz Xu | bfefcba | 2020-09-25 01:59:13 | [diff] [blame] | 34 | #include "ash/system/media/media_tray.h" |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 35 | #include "ash/system/message_center/message_center_controller.h" |
Gordon Seto | 5623514d | 2021-01-27 23:52:28 | [diff] [blame] | 36 | #include "ash/system/network/cellular_setup_notifier.h" |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 37 | #include "ash/system/network/vpn_list_view.h" |
Steven Bennetts | 32f5d55 | 2019-07-09 16:16:13 | [diff] [blame] | 38 | #include "ash/system/night_light/night_light_controller_impl.h" |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 39 | #include "ash/system/palette/palette_tray.h" |
| 40 | #include "ash/system/palette/palette_welcome_bubble.h" |
Jimmy Gong | c6f4fd0 | 2021-02-25 01:55:00 | [diff] [blame] | 41 | #include "ash/system/pcie_peripheral/pcie_peripheral_notification_controller.h" |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 42 | #include "ash/system/power/power_prefs.h" |
| 43 | #include "ash/system/session/logout_button_tray.h" |
Maria Petrisor | 878ea9f1 | 2021-04-14 17:55:09 | [diff] [blame] | 44 | #include "ash/system/session/logout_confirmation_controller.h" |
Michael Martis | 2ec2b4d | 2021-12-01 01:57:37 | [diff] [blame] | 45 | #include "ash/system/unified/hps_notify_controller.h" |
Aya ElAttar | fb1b9c6 | 2020-04-14 08:54:44 | [diff] [blame] | 46 | #include "ash/system/unified/top_shortcuts_view.h" |
Kevin Radtke | a8bd8254ca | 2021-11-16 00:37:48 | [diff] [blame] | 47 | #include "ash/system/unified/unified_system_tray_controller.h" |
Jameson Thies | 647d2d3 | 2022-02-24 23:58:21 | [diff] [blame] | 48 | #include "ash/system/usb_peripheral/usb_peripheral_notification_controller.h" |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 49 | #include "ash/touch/touch_devices_controller.h" |
Mike Wasserman | a5352da | 2019-05-30 17:26:08 | [diff] [blame] | 50 | #include "ash/wallpaper/wallpaper_controller_impl.h" |
Ahmed Fakhry | 1d18fafe5 | 2020-02-24 22:40:36 | [diff] [blame] | 51 | #include "ash/wm/desks/desks_restore_util.h" |
minch | 86e06a3 | 2021-09-07 20:53:34 | [diff] [blame] | 52 | #include "ash/wm/desks/persistent_desks_bar_controller.h" |
Brian Beck | e9b80427 | 2021-10-07 01:24:17 | [diff] [blame] | 53 | #include "ash/wm/desks/templates/desks_templates_util.h" |
Sherri Lin | b6b765a1 | 2022-03-03 11:37:34 | [diff] [blame] | 54 | #include "ash/wm/lock_state_controller.h" |
Cattalyya Nuengsigkapian | f24c05b | 2021-01-15 02:51:18 | [diff] [blame] | 55 | #include "ash/wm/window_cycle/window_cycle_controller.h" |
Yue Li | f0da5bf | 2021-11-19 22:01:57 | [diff] [blame] | 56 | #include "chromeos/components/quick_answers/public/cpp/quick_answers_prefs.h" |
Yue Li | 4fa7285 | 2019-07-17 01:01:32 | [diff] [blame] | 57 | #include "chromeos/services/assistant/public/cpp/assistant_prefs.h" |
Yue Li | 0e81c0c | 2021-09-29 03:22:18 | [diff] [blame] | 58 | #include "components/language/core/browser/pref_names.h" |
Amanda Deacon | 48669b4d | 2021-04-27 00:00:23 | [diff] [blame] | 59 | #include "components/live_caption/pref_names.h" |
Abigail Klein | e4c6b5c | 2022-03-30 21:06:45 | [diff] [blame] | 60 | #include "components/soda/constants.h" |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 61 | |
| 62 | namespace ash { |
| 63 | |
| 64 | namespace { |
| 65 | |
| 66 | // Registers prefs whose default values are same in user and signin prefs. |
| 67 | void RegisterProfilePrefs(PrefRegistrySimple* registry, bool for_test) { |
Zentaro Kavanagh | 1f43649 | 2021-05-20 23:29:36 | [diff] [blame] | 68 | AcceleratorControllerImpl::RegisterProfilePrefs(registry); |
James Cook | 025aa04 | 2019-10-18 23:16:32 | [diff] [blame] | 69 | AccessibilityControllerImpl::RegisterProfilePrefs(registry); |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 70 | AppListControllerImpl::RegisterProfilePrefs(registry); |
David Black | ec4cbcd | 2020-04-15 20:35:25 | [diff] [blame] | 71 | AssistantControllerImpl::RegisterProfilePrefs(registry); |
minch | 308923f3 | 2020-08-28 18:58:30 | [diff] [blame] | 72 | AshColorProvider::RegisterProfilePrefs(registry); |
wutao | 3a150d71b | 2020-02-19 22:11:26 | [diff] [blame] | 73 | AmbientController::RegisterProfilePrefs(registry); |
Gordon Seto | c7b5631e | 2021-11-12 22:48:28 | [diff] [blame] | 74 | if (!ash::features::IsBluetoothRevampEnabled()) |
| 75 | BluetoothPowerController::RegisterProfilePrefs(registry); |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 76 | CapsLockNotificationController::RegisterProfilePrefs(registry, for_test); |
Ahmed Fakhry | 766bac6 | 2021-09-24 02:36:19 | [diff] [blame] | 77 | CaptureModeController::RegisterProfilePrefs(registry); |
Gordon Seto | 5623514d | 2021-01-27 23:52:28 | [diff] [blame] | 78 | CellularSetupNotifier::RegisterProfilePrefs(registry); |
Yulun Wu | 1e35513 | 2020-02-11 20:12:22 | [diff] [blame] | 79 | contextual_tooltip::RegisterProfilePrefs(registry); |
Yulun Wu | 78c26ab | 2020-08-26 06:37:36 | [diff] [blame] | 80 | ClipboardNudgeController::RegisterProfilePrefs(registry); |
Cattalyya Nuengsigkapian | 9fd6926 | 2022-03-29 00:17:17 | [diff] [blame] | 81 | DarkModeController::RegisterProfilePrefs(registry); |
Ahmed Fakhry | 1d18fafe5 | 2020-02-24 22:40:36 | [diff] [blame] | 82 | desks_restore_util::RegisterProfilePrefs(registry); |
Brian Beck | e9b80427 | 2021-10-07 01:24:17 | [diff] [blame] | 83 | desks_templates_util::RegisterProfilePrefs(registry); |
Josiah K | 466b0dc3 | 2021-06-16 23:39:05 | [diff] [blame] | 84 | DockedMagnifierController::RegisterProfilePrefs(registry); |
Xiaodan Zhu | d5b8187 | 2020-11-12 18:15:29 | [diff] [blame] | 85 | FullscreenController::RegisterProfilePrefs(registry); |
Ahmed Mehfooz | ccd31e16 | 2020-05-12 01:59:11 | [diff] [blame] | 86 | GestureEducationNotificationController::RegisterProfilePrefs(registry, |
| 87 | for_test); |
Ahmed Mehfooz | e6167f5 | 2020-10-22 20:01:33 | [diff] [blame] | 88 | holding_space_prefs::RegisterProfilePrefs(registry); |
Michael Martis | 2ec2b4d | 2021-12-01 01:57:37 | [diff] [blame] | 89 | HpsNotifyController::RegisterProfilePrefs(registry); |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 90 | LoginScreenController::RegisterProfilePrefs(registry, for_test); |
| 91 | LogoutButtonTray::RegisterProfilePrefs(registry); |
Maria Petrisor | 878ea9f1 | 2021-04-14 17:55:09 | [diff] [blame] | 92 | LogoutConfirmationController::RegisterProfilePrefs(registry); |
Chloe Pelling | 186ed3e | 2020-04-27 01:08:34 | [diff] [blame] | 93 | KeyboardControllerImpl::RegisterProfilePrefs(registry); |
Mia Bergeron | 12fd2f18 | 2019-06-11 23:04:46 | [diff] [blame] | 94 | MediaControllerImpl::RegisterProfilePrefs(registry); |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 95 | MessageCenterController::RegisterProfilePrefs(registry); |
Steven Bennetts | 32f5d55 | 2019-07-09 16:16:13 | [diff] [blame] | 96 | NightLightControllerImpl::RegisterProfilePrefs(registry); |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 97 | PaletteTray::RegisterProfilePrefs(registry); |
| 98 | PaletteWelcomeBubble::RegisterProfilePrefs(registry); |
Jimmy Gong | c6f4fd0 | 2021-02-25 01:55:00 | [diff] [blame] | 99 | PciePeripheralNotificationController::RegisterProfilePrefs(registry); |
minch | 86e06a3 | 2021-09-07 20:53:34 | [diff] [blame] | 100 | PersistentDesksBarController::RegisterProfilePrefs(registry); |
Gil Dekel | 6977703 | 2020-02-07 18:41:53 | [diff] [blame] | 101 | PrivacyScreenController::RegisterProfilePrefs(registry); |
Daniel Classon | e31b84fd2 | 2021-10-05 02:41:57 | [diff] [blame] | 102 | quick_pair::Mediator::RegisterProfilePrefs(registry); |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 103 | ShelfController::RegisterProfilePrefs(registry); |
Ana Salazar | eb7c2571 | 2020-02-03 20:27:26 | [diff] [blame] | 104 | TouchDevicesController::RegisterProfilePrefs(registry, for_test); |
Kevin Radtke | a8bd8254ca | 2021-11-16 00:37:48 | [diff] [blame] | 105 | UnifiedSystemTrayController::RegisterProfilePrefs(registry); |
Jazz Xu | bfefcba | 2020-09-25 01:59:13 | [diff] [blame] | 106 | MediaTray::RegisterProfilePrefs(registry); |
Jameson Thies | 647d2d3 | 2022-02-24 23:58:21 | [diff] [blame] | 107 | UsbPeripheralNotificationController::RegisterProfilePrefs(registry); |
James Cook | 987b4b3 | 2022-04-02 00:07:08 | [diff] [blame] | 108 | VPNListView::RegisterProfilePrefs(registry); |
Qasid Sadiq | edba1f5 | 2021-04-05 18:56:03 | [diff] [blame] | 109 | WallpaperControllerImpl::RegisterProfilePrefs(registry); |
Cattalyya Nuengsigkapian | f24c05b | 2021-01-15 02:51:18 | [diff] [blame] | 110 | WindowCycleController::RegisterProfilePrefs(registry); |
James Cook | 4f3640d | 2019-11-19 00:40:35 | [diff] [blame] | 111 | |
Ana Salazar | eb7c2571 | 2020-02-03 20:27:26 | [diff] [blame] | 112 | // Provide prefs registered in the browser for ash_unittests. |
| 113 | if (for_test) { |
James Cook | 4f3640d | 2019-11-19 00:40:35 | [diff] [blame] | 114 | chromeos::assistant::prefs::RegisterProfilePrefs(registry); |
Yeunjoo Choi | ecf2ba4 | 2021-09-01 01:25:01 | [diff] [blame] | 115 | quick_answers::prefs::RegisterProfilePrefs(registry); |
Roman Sorokin | 8fab497 | 2021-11-17 17:10:36 | [diff] [blame] | 116 | registry->RegisterBooleanPref(prefs::kMouseReverseScroll, false); |
Chloe Pelling | 4a5ed446 | 2022-02-15 02:20:07 | [diff] [blame] | 117 | registry->RegisterBooleanPref(prefs::kSendFunctionKeys, false); |
Roman Sorokin | 8fab497 | 2021-11-17 17:10:36 | [diff] [blame] | 118 | registry->RegisterBooleanPref(chromeos::prefs::kSuggestedContentEnabled, |
| 119 | true); |
| 120 | registry->RegisterBooleanPref(::prefs::kLiveCaptionEnabled, false); |
Abigail Klein | e4c6b5c | 2022-03-30 21:06:45 | [diff] [blame] | 121 | registry->RegisterStringPref(::prefs::kLiveCaptionLanguageCode, |
| 122 | speech::kUsEnglishLocale); |
Yue Li | 0e81c0c | 2021-09-29 03:22:18 | [diff] [blame] | 123 | registry->RegisterStringPref(language::prefs::kApplicationLocale, |
| 124 | std::string()); |
Yue Li | 5125160b | 2022-04-04 22:40:39 | [diff] [blame^] | 125 | registry->RegisterStringPref(language::prefs::kPreferredLanguages, |
| 126 | std::string()); |
Ana Salazar | eb7c2571 | 2020-02-03 20:27:26 | [diff] [blame] | 127 | } |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | } // namespace |
| 131 | |
Xiyuan Xia | 14619a2 | 2019-05-14 20:20:44 | [diff] [blame] | 132 | void RegisterLocalStatePrefs(PrefRegistrySimple* registry, bool for_test) { |
| 133 | PaletteTray::RegisterLocalStatePrefs(registry); |
Mike Wasserman | a5352da | 2019-05-30 17:26:08 | [diff] [blame] | 134 | WallpaperControllerImpl::RegisterLocalStatePrefs(registry); |
Gordon Seto | c7b5631e | 2021-11-12 22:48:28 | [diff] [blame] | 135 | if (!ash::features::IsBluetoothRevampEnabled()) |
| 136 | BluetoothPowerController::RegisterLocalStatePrefs(registry); |
Xiyuan Xia | 14619a2 | 2019-05-14 20:20:44 | [diff] [blame] | 137 | DetachableBaseHandler::RegisterPrefs(registry); |
| 138 | PowerPrefs::RegisterLocalStatePrefs(registry); |
| 139 | DisplayPrefs::RegisterLocalStatePrefs(registry); |
Aya ElAttar | d2b3c8a | 2020-06-22 23:02:13 | [diff] [blame] | 140 | LoginExpandedPublicAccountView::RegisterLocalStatePrefs(registry); |
Sherri Lin | b6b765a1 | 2022-03-03 11:37:34 | [diff] [blame] | 141 | LockStateController::RegisterPrefs(registry); |
Daniel Classon | 2ded753e | 2021-12-01 18:42:50 | [diff] [blame] | 142 | quick_pair::Mediator::RegisterLocalStatePrefs(registry); |
Aya ElAttar | fb1b9c6 | 2020-04-14 08:54:44 | [diff] [blame] | 143 | TopShortcutsView::RegisterLocalStatePrefs(registry); |
Xiyuan Xia | 14619a2 | 2019-05-14 20:20:44 | [diff] [blame] | 144 | } |
| 145 | |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 146 | void RegisterSigninProfilePrefs(PrefRegistrySimple* registry, bool for_test) { |
| 147 | RegisterProfilePrefs(registry, for_test); |
James Cook | ef1411e1 | 2019-10-18 23:49:22 | [diff] [blame] | 148 | PowerPrefs::RegisterSigninProfilePrefs(registry); |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | void RegisterUserProfilePrefs(PrefRegistrySimple* registry, bool for_test) { |
| 152 | RegisterProfilePrefs(registry, for_test); |
James Cook | ef1411e1 | 2019-10-18 23:49:22 | [diff] [blame] | 153 | PowerPrefs::RegisterUserProfilePrefs(registry); |
Xiyuan Xia | 5a8c417 | 2019-05-13 16:23:48 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | } // namespace ash |