[M120 Migration][MM] Fix EME AD insert issue
[platform/framework/web/chromium-efl.git] / ash / ash_prefs.cc
1 // Copyright 2019 The Chromium Authors
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
7 #include "ash/accelerators/accelerator_prefs.h"
8 #include "ash/accelerators/ash_accelerator_configuration.h"
9 #include "ash/accessibility/accessibility_controller_impl.h"
10 #include "ash/accessibility/magnifier/docked_magnifier_controller.h"
11 #include "ash/ambient/ambient_controller.h"
12 #include "ash/ambient/managed/screensaver_images_policy_handler.h"
13 #include "ash/app_list/app_list_controller_impl.h"
14 #include "ash/app_list/views/app_list_nudge_controller.h"
15 #include "ash/app_list/views/search_notifier_controller.h"
16 #include "ash/assistant/assistant_controller_impl.h"
17 #include "ash/calendar/calendar_controller.h"
18 #include "ash/capture_mode/capture_mode_controller.h"
19 #include "ash/clipboard/clipboard_history_controller_impl.h"
20 #include "ash/constants/ash_features.h"
21 #include "ash/constants/ash_pref_names.h"
22 #include "ash/controls/contextual_tooltip.h"
23 #include "ash/detachable_base/detachable_base_handler.h"
24 #include "ash/display/display_prefs.h"
25 #include "ash/display/privacy_screen_controller.h"
26 #include "ash/glanceables/glanceables_controller.h"
27 #include "ash/keyboard/keyboard_controller_impl.h"
28 #include "ash/login/login_screen_controller.h"
29 #include "ash/login/ui/login_expanded_public_account_view.h"
30 #include "ash/media/media_controller_impl.h"
31 #include "ash/metrics/feature_discovery_duration_reporter_impl.h"
32 #include "ash/projector/projector_controller_impl.h"
33 #include "ash/public/cpp/holding_space/holding_space_prefs.h"
34 #include "ash/quick_pair/keyed_service/quick_pair_mediator.h"
35 #include "ash/session/fullscreen_controller.h"
36 #include "ash/session/session_controller_impl.h"
37 #include "ash/shelf/shelf_controller.h"
38 #include "ash/style/color_palette_controller.h"
39 #include "ash/style/dark_light_mode_controller_impl.h"
40 #include "ash/system/camera/autozoom_controller_impl.h"
41 #include "ash/system/camera/autozoom_nudge_controller.h"
42 #include "ash/system/camera/camera_app_prefs.h"
43 #include "ash/system/camera/camera_effects_controller.h"
44 #include "ash/system/focus_mode/focus_mode_controller.h"
45 #include "ash/system/geolocation/geolocation_controller.h"
46 #include "ash/system/hotspot/hotspot_info_cache.h"
47 #include "ash/system/human_presence/snooping_protection_controller.h"
48 #include "ash/system/input_device_settings/input_device_settings_controller_impl.h"
49 #include "ash/system/input_device_settings/input_device_settings_notification_controller.h"
50 #include "ash/system/input_device_settings/input_device_tracker.h"
51 #include "ash/system/input_device_settings/keyboard_modifier_metrics_recorder.h"
52 #include "ash/system/keyboard_brightness/keyboard_backlight_color_controller.h"
53 #include "ash/system/media/media_tray.h"
54 #include "ash/system/message_center/message_center_controller.h"
55 #include "ash/system/network/cellular_setup_notifier.h"
56 #include "ash/system/network/vpn_detailed_view.h"
57 #include "ash/system/night_light/night_light_controller_impl.h"
58 #include "ash/system/palette/palette_tray.h"
59 #include "ash/system/palette/palette_welcome_bubble.h"
60 #include "ash/system/pcie_peripheral/pcie_peripheral_notification_controller.h"
61 #include "ash/system/phonehub/onboarding_nudge_controller.h"
62 #include "ash/system/power/battery_saver_controller.h"
63 #include "ash/system/power/power_prefs.h"
64 #include "ash/system/power/power_sounds_controller.h"
65 #include "ash/system/privacy_hub/privacy_hub_controller.h"
66 #include "ash/system/session/logout_button_tray.h"
67 #include "ash/system/session/logout_confirmation_controller.h"
68 #include "ash/system/unified/quick_settings_footer.h"
69 #include "ash/system/unified/top_shortcuts_view.h"
70 #include "ash/system/unified/unified_system_tray_controller.h"
71 #include "ash/system/usb_peripheral/usb_peripheral_notification_controller.h"
72 #include "ash/touch/touch_devices_controller.h"
73 #include "ash/user_education/user_education_controller.h"
74 #include "ash/wallpaper/wallpaper_daily_refresh_scheduler.h"
75 #include "ash/wallpaper/wallpaper_pref_manager.h"
76 #include "ash/wm/desks/desks_restore_util.h"
77 #include "ash/wm/desks/templates/saved_desk_util.h"
78 #include "ash/wm/float/tablet_mode_tuck_education.h"
79 #include "ash/wm/lock_state_controller.h"
80 #include "ash/wm/window_cycle/window_cycle_controller.h"
81 #include "chromeos/ash/services/assistant/public/cpp/assistant_prefs.h"
82 #include "chromeos/components/quick_answers/public/cpp/quick_answers_prefs.h"
83 #include "chromeos/ui/frame/multitask_menu/multitask_menu_nudge_controller.h"
84 #include "chromeos/ui/wm/fullscreen/pref_names.h"
85 #include "components/language/core/browser/pref_names.h"
86 #include "components/live_caption/pref_names.h"
87 #include "components/soda/constants.h"
88 #include "components/user_manager/known_user.h"
89
90 namespace ash {
91
92 namespace {
93
94 // Registers prefs whose default values are same in user and signin prefs.
95 void RegisterProfilePrefs(PrefRegistrySimple* registry,
96                           std::string_view country,
97                           bool for_test) {
98   AcceleratorPrefs::RegisterProfilePrefs(registry);
99   AccessibilityControllerImpl::RegisterProfilePrefs(registry);
100   AppListControllerImpl::RegisterProfilePrefs(registry);
101   AppListNudgeController::RegisterProfilePrefs(registry);
102   AshAcceleratorConfiguration::RegisterProfilePrefs(registry);
103   AssistantControllerImpl::RegisterProfilePrefs(registry);
104   AutozoomControllerImpl::RegisterProfilePrefs(registry);
105   AutozoomNudgeController::RegisterProfilePrefs(registry);
106   AmbientController::RegisterProfilePrefs(registry);
107   CalendarController::RegisterProfilePrefs(registry);
108   camera_app_prefs::RegisterProfilePrefs(registry);
109   CameraEffectsController::RegisterProfilePrefs(registry);
110   CaptureModeController::RegisterProfilePrefs(registry);
111   CellularSetupNotifier::RegisterProfilePrefs(registry);
112   chromeos::MultitaskMenuNudgeController::RegisterProfilePrefs(registry);
113   contextual_tooltip::RegisterProfilePrefs(registry);
114   ClipboardHistoryControllerImpl::RegisterProfilePrefs(registry);
115   ColorPaletteController::RegisterPrefs(registry);
116   DarkLightModeControllerImpl::RegisterProfilePrefs(registry);
117   desks_restore_util::RegisterProfilePrefs(registry);
118   saved_desk_util::RegisterProfilePrefs(registry);
119   DockedMagnifierController::RegisterProfilePrefs(registry);
120   FeatureDiscoveryDurationReporterImpl::RegisterProfilePrefs(registry);
121   FocusModeController::RegisterProfilePrefs(registry);
122   FullscreenController::RegisterProfilePrefs(registry);
123   GeolocationController::RegisterProfilePrefs(registry);
124   GlanceablesController::RegisterUserProfilePrefs(registry);
125   holding_space_prefs::RegisterProfilePrefs(registry);
126   HotspotInfoCache::RegisterProfilePrefs(registry);
127   InputDeviceSettingsControllerImpl::RegisterProfilePrefs(registry);
128   InputDeviceSettingsNotificationController::RegisterProfilePrefs(registry);
129   InputDeviceTracker::RegisterProfilePrefs(registry);
130   LoginScreenController::RegisterProfilePrefs(registry, for_test);
131   LogoutButtonTray::RegisterProfilePrefs(registry);
132   LogoutConfirmationController::RegisterProfilePrefs(registry);
133   KeyboardBacklightColorController::RegisterPrefs(registry);
134   KeyboardControllerImpl::RegisterProfilePrefs(registry, country);
135   KeyboardModifierMetricsRecorder::RegisterProfilePrefs(registry, for_test);
136   MediaControllerImpl::RegisterProfilePrefs(registry);
137   MessageCenterController::RegisterProfilePrefs(registry);
138   NightLightControllerImpl::RegisterProfilePrefs(registry);
139   OnboardingNudgeController::RegisterProfilePrefs(registry);
140   PaletteTray::RegisterProfilePrefs(registry);
141   PaletteWelcomeBubble::RegisterProfilePrefs(registry);
142   PciePeripheralNotificationController::RegisterProfilePrefs(registry);
143   PrivacyHubController::RegisterProfilePrefs(registry);
144   PrivacyScreenController::RegisterProfilePrefs(registry);
145   ProjectorControllerImpl::RegisterProfilePrefs(registry);
146   quick_pair::Mediator::RegisterProfilePrefs(registry);
147   ScreensaverImagesPolicyHandler::RegisterPrefs(registry);
148   SearchNotifierController::RegisterProfilePrefs(registry);
149   ShelfController::RegisterProfilePrefs(registry);
150   SnoopingProtectionController::RegisterProfilePrefs(registry);
151   TabletModeTuckEducation::RegisterProfilePrefs(registry);
152   TouchDevicesController::RegisterProfilePrefs(registry, for_test);
153   UnifiedSystemTrayController::RegisterProfilePrefs(registry);
154   UserEducationController::RegisterProfilePrefs(registry);
155   MediaTray::RegisterProfilePrefs(registry);
156   UsbPeripheralNotificationController::RegisterProfilePrefs(registry);
157   VpnDetailedView::RegisterProfilePrefs(registry);
158   WallpaperDailyRefreshScheduler::RegisterProfilePrefs(registry);
159   WallpaperPrefManager::RegisterProfilePrefs(registry);
160   WindowCycleController::RegisterProfilePrefs(registry);
161
162   // Provide prefs registered in the browser for ash_unittests.
163   if (for_test) {
164     assistant::prefs::RegisterProfilePrefs(registry);
165     quick_answers::prefs::RegisterProfilePrefs(registry);
166     registry->RegisterBooleanPref(prefs::kMouseReverseScroll, false);
167     registry->RegisterBooleanPref(prefs::kSendFunctionKeys, false);
168     registry->RegisterBooleanPref(prefs::kSuggestedContentEnabled, true);
169     registry->RegisterBooleanPref(::prefs::kLiveCaptionEnabled, false);
170     registry->RegisterListPref(
171         chromeos::prefs::kKeepFullscreenWithoutNotificationUrlAllowList);
172     registry->RegisterStringPref(::prefs::kLiveCaptionLanguageCode,
173                                  speech::kUsEnglishLocale);
174     registry->RegisterStringPref(language::prefs::kApplicationLocale,
175                                  std::string());
176     registry->RegisterStringPref(language::prefs::kPreferredLanguages,
177                                  std::string());
178     registry->RegisterIntegerPref(prefs::kAltEventRemappedToRightClick, 0);
179     registry->RegisterIntegerPref(prefs::kSearchEventRemappedToRightClick, 0);
180     registry->RegisterIntegerPref(prefs::kKeyEventRemappedToSixPackDelete, 0);
181     registry->RegisterIntegerPref(prefs::kKeyEventRemappedToSixPackEnd, 0);
182     registry->RegisterIntegerPref(prefs::kKeyEventRemappedToSixPackHome, 0);
183     registry->RegisterIntegerPref(prefs::kKeyEventRemappedToSixPackPageUp, 0);
184     registry->RegisterIntegerPref(prefs::kKeyEventRemappedToSixPackPageDown, 0);
185   }
186 }
187
188 }  // namespace
189
190 void RegisterLocalStatePrefs(PrefRegistrySimple* registry, bool for_test) {
191   PaletteTray::RegisterLocalStatePrefs(registry);
192   WallpaperPrefManager::RegisterLocalStatePrefs(registry);
193   ColorPaletteController::RegisterLocalStatePrefs(registry);
194   DetachableBaseHandler::RegisterPrefs(registry);
195   PowerPrefs::RegisterLocalStatePrefs(registry);
196   PrivacyHubController::RegisterLocalStatePrefs(registry);
197   DisplayPrefs::RegisterLocalStatePrefs(registry);
198   LoginExpandedPublicAccountView::RegisterLocalStatePrefs(registry);
199   LockStateController::RegisterPrefs(registry);
200   quick_pair::Mediator::RegisterLocalStatePrefs(registry);
201   if (ash::features::IsQsRevampEnabled()) {
202     QuickSettingsFooter::RegisterLocalStatePrefs(registry);
203   } else {
204     TopShortcutsView::RegisterLocalStatePrefs(registry);
205   }
206   KeyboardBacklightColorController::RegisterPrefs(registry);
207   BatterySaverController::RegisterLocalStatePrefs(registry);
208   PowerSoundsController::RegisterLocalStatePrefs(registry);
209
210   if (for_test) {
211     registry->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false);
212     user_manager::KnownUser::RegisterPrefs(registry);
213   }
214 }
215
216 void RegisterSigninProfilePrefs(PrefRegistrySimple* registry,
217                                 std::string_view country,
218                                 bool for_test) {
219   RegisterProfilePrefs(registry, country, for_test);
220   PowerPrefs::RegisterSigninProfilePrefs(registry);
221 }
222
223 void RegisterUserProfilePrefs(PrefRegistrySimple* registry,
224                               std::string_view country,
225                               bool for_test) {
226   RegisterProfilePrefs(registry, country, for_test);
227   PowerPrefs::RegisterUserProfilePrefs(registry);
228   SessionControllerImpl::RegisterUserProfilePrefs(registry);
229 }
230
231 }  // namespace ash