ash_prefs.cc 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. #include "ash/public/cpp/ash_prefs.h"
  5. #include "ash/accessibility/accessibility_controller_impl.h"
  6. #include "ash/accessibility/magnifier/docked_magnifier_controller.h"
  7. #include "ash/ambient/ambient_controller.h"
  8. #include "ash/app_list/app_list_controller_impl.h"
  9. #include "ash/assistant/assistant_controller_impl.h"
  10. #include "ash/capture_mode/capture_mode_controller.h"
  11. #include "ash/clipboard/clipboard_nudge_controller.h"
  12. #include "ash/constants/ash_features.h"
  13. #include "ash/constants/ash_pref_names.h"
  14. #include "ash/controls/contextual_tooltip.h"
  15. #include "ash/detachable_base/detachable_base_handler.h"
  16. #include "ash/display/display_prefs.h"
  17. #include "ash/display/privacy_screen_controller.h"
  18. #include "ash/keyboard/keyboard_controller_impl.h"
  19. #include "ash/login/login_screen_controller.h"
  20. #include "ash/login/ui/login_expanded_public_account_view.h"
  21. #include "ash/media/media_controller_impl.h"
  22. #include "ash/metrics/feature_discovery_duration_reporter_impl.h"
  23. #include "ash/projector/projector_controller_impl.h"
  24. #include "ash/public/cpp/holding_space/holding_space_prefs.h"
  25. #include "ash/quick_pair/keyed_service/quick_pair_mediator.h"
  26. #include "ash/session/fullscreen_controller.h"
  27. #include "ash/shelf/shelf_controller.h"
  28. #include "ash/style/dark_light_mode_controller_impl.h"
  29. #include "ash/system/bluetooth/bluetooth_power_controller.h"
  30. #include "ash/system/camera/autozoom_controller_impl.h"
  31. #include "ash/system/camera/autozoom_nudge_controller.h"
  32. #include "ash/system/caps_lock_notification_controller.h"
  33. #include "ash/system/gesture_education/gesture_education_notification_controller.h"
  34. #include "ash/system/human_presence/snooping_protection_controller.h"
  35. #include "ash/system/keyboard_brightness/keyboard_backlight_color_controller.h"
  36. #include "ash/system/media/media_tray.h"
  37. #include "ash/system/message_center/message_center_controller.h"
  38. #include "ash/system/network/cellular_setup_notifier.h"
  39. #include "ash/system/network/vpn_list_view.h"
  40. #include "ash/system/night_light/night_light_controller_impl.h"
  41. #include "ash/system/palette/palette_tray.h"
  42. #include "ash/system/palette/palette_welcome_bubble.h"
  43. #include "ash/system/pcie_peripheral/pcie_peripheral_notification_controller.h"
  44. #include "ash/system/power/power_prefs.h"
  45. #include "ash/system/privacy_hub/privacy_hub_controller.h"
  46. #include "ash/system/session/logout_button_tray.h"
  47. #include "ash/system/session/logout_confirmation_controller.h"
  48. #include "ash/system/unified/top_shortcuts_view.h"
  49. #include "ash/system/unified/unified_system_tray_controller.h"
  50. #include "ash/system/usb_peripheral/usb_peripheral_notification_controller.h"
  51. #include "ash/touch/touch_devices_controller.h"
  52. #include "ash/wallpaper/wallpaper_pref_manager.h"
  53. #include "ash/wm/desks/desks_restore_util.h"
  54. #include "ash/wm/desks/persistent_desks_bar_controller.h"
  55. #include "ash/wm/desks/templates/saved_desk_util.h"
  56. #include "ash/wm/lock_state_controller.h"
  57. #include "ash/wm/multitask_menu_nudge_controller.h"
  58. #include "ash/wm/window_cycle/window_cycle_controller.h"
  59. #include "chromeos/ash/services/assistant/public/cpp/assistant_prefs.h"
  60. #include "chromeos/components/quick_answers/public/cpp/quick_answers_prefs.h"
  61. #include "chromeos/ui/wm/fullscreen/pref_names.h"
  62. #include "components/language/core/browser/pref_names.h"
  63. #include "components/live_caption/pref_names.h"
  64. #include "components/soda/constants.h"
  65. namespace ash {
  66. namespace {
  67. // Registers prefs whose default values are same in user and signin prefs.
  68. void RegisterProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
  69. AccessibilityControllerImpl::RegisterProfilePrefs(registry);
  70. AppListControllerImpl::RegisterProfilePrefs(registry);
  71. AssistantControllerImpl::RegisterProfilePrefs(registry);
  72. AutozoomControllerImpl::RegisterProfilePrefs(registry);
  73. AutozoomNudgeController::RegisterProfilePrefs(registry);
  74. AmbientController::RegisterProfilePrefs(registry);
  75. if (!ash::features::IsBluetoothRevampEnabled())
  76. BluetoothPowerController::RegisterProfilePrefs(registry);
  77. CapsLockNotificationController::RegisterProfilePrefs(registry, for_test);
  78. CaptureModeController::RegisterProfilePrefs(registry);
  79. CellularSetupNotifier::RegisterProfilePrefs(registry);
  80. contextual_tooltip::RegisterProfilePrefs(registry);
  81. ClipboardNudgeController::RegisterProfilePrefs(registry);
  82. DarkLightModeControllerImpl::RegisterProfilePrefs(registry);
  83. desks_restore_util::RegisterProfilePrefs(registry);
  84. saved_desk_util::RegisterProfilePrefs(registry);
  85. DockedMagnifierController::RegisterProfilePrefs(registry);
  86. FeatureDiscoveryDurationReporterImpl::RegisterProfilePrefs(registry);
  87. FullscreenController::RegisterProfilePrefs(registry);
  88. GestureEducationNotificationController::RegisterProfilePrefs(registry,
  89. for_test);
  90. holding_space_prefs::RegisterProfilePrefs(registry);
  91. LoginScreenController::RegisterProfilePrefs(registry, for_test);
  92. LogoutButtonTray::RegisterProfilePrefs(registry);
  93. LogoutConfirmationController::RegisterProfilePrefs(registry);
  94. KeyboardBacklightColorController::RegisterProfilePrefs(registry);
  95. KeyboardControllerImpl::RegisterProfilePrefs(registry);
  96. MediaControllerImpl::RegisterProfilePrefs(registry);
  97. MessageCenterController::RegisterProfilePrefs(registry);
  98. NightLightControllerImpl::RegisterProfilePrefs(registry);
  99. PaletteTray::RegisterProfilePrefs(registry);
  100. PaletteWelcomeBubble::RegisterProfilePrefs(registry);
  101. PciePeripheralNotificationController::RegisterProfilePrefs(registry);
  102. PersistentDesksBarController::RegisterProfilePrefs(registry);
  103. PrivacyHubController::RegisterProfilePrefs(registry);
  104. PrivacyScreenController::RegisterProfilePrefs(registry);
  105. ProjectorControllerImpl::RegisterProfilePrefs(registry);
  106. quick_pair::Mediator::RegisterProfilePrefs(registry);
  107. ShelfController::RegisterProfilePrefs(registry);
  108. SnoopingProtectionController::RegisterProfilePrefs(registry);
  109. TouchDevicesController::RegisterProfilePrefs(registry, for_test);
  110. UnifiedSystemTrayController::RegisterProfilePrefs(registry);
  111. MediaTray::RegisterProfilePrefs(registry);
  112. UsbPeripheralNotificationController::RegisterProfilePrefs(registry);
  113. VPNListView::RegisterProfilePrefs(registry);
  114. WallpaperPrefManager::RegisterProfilePrefs(registry);
  115. WindowCycleController::RegisterProfilePrefs(registry);
  116. MultitaskMenuNudgeController::RegisterProfilePrefs(registry);
  117. // Provide prefs registered in the browser for ash_unittests.
  118. if (for_test) {
  119. assistant::prefs::RegisterProfilePrefs(registry);
  120. quick_answers::prefs::RegisterProfilePrefs(registry);
  121. registry->RegisterBooleanPref(prefs::kMouseReverseScroll, false);
  122. registry->RegisterBooleanPref(prefs::kSendFunctionKeys, false);
  123. registry->RegisterBooleanPref(chromeos::prefs::kSuggestedContentEnabled,
  124. true);
  125. registry->RegisterBooleanPref(::prefs::kLiveCaptionEnabled, false);
  126. registry->RegisterListPref(
  127. chromeos::prefs::kKeepFullscreenWithoutNotificationUrlAllowList);
  128. registry->RegisterStringPref(::prefs::kLiveCaptionLanguageCode,
  129. speech::kUsEnglishLocale);
  130. registry->RegisterStringPref(language::prefs::kApplicationLocale,
  131. std::string());
  132. registry->RegisterStringPref(language::prefs::kPreferredLanguages,
  133. std::string());
  134. }
  135. }
  136. } // namespace
  137. void RegisterLocalStatePrefs(PrefRegistrySimple* registry, bool for_test) {
  138. PaletteTray::RegisterLocalStatePrefs(registry);
  139. WallpaperPrefManager::RegisterLocalStatePrefs(registry);
  140. if (!ash::features::IsBluetoothRevampEnabled())
  141. BluetoothPowerController::RegisterLocalStatePrefs(registry);
  142. DetachableBaseHandler::RegisterPrefs(registry);
  143. PowerPrefs::RegisterLocalStatePrefs(registry);
  144. DisplayPrefs::RegisterLocalStatePrefs(registry);
  145. LoginExpandedPublicAccountView::RegisterLocalStatePrefs(registry);
  146. LockStateController::RegisterPrefs(registry);
  147. quick_pair::Mediator::RegisterLocalStatePrefs(registry);
  148. TopShortcutsView::RegisterLocalStatePrefs(registry);
  149. }
  150. void RegisterSigninProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
  151. RegisterProfilePrefs(registry, for_test);
  152. PowerPrefs::RegisterSigninProfilePrefs(registry);
  153. }
  154. void RegisterUserProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
  155. RegisterProfilePrefs(registry, for_test);
  156. PowerPrefs::RegisterUserProfilePrefs(registry);
  157. }
  158. } // namespace ash