ash_prefs.cc 7.8 KB

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