File: ash_prefs.cc

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (308 lines) | stat: -rw-r--r-- 16,620 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/public/cpp/ash_prefs.h"

#include "ash/accelerators/accelerator_prefs.h"
#include "ash/accelerators/ash_accelerator_configuration.h"
#include "ash/accelerators/system_shortcut_behavior_policy.h"
#include "ash/accessibility/accessibility_controller.h"
#include "ash/accessibility/magnifier/docked_magnifier_controller.h"
#include "ash/ambient/ambient_controller.h"
#include "ash/ambient/managed/screensaver_images_policy_handler.h"
#include "ash/app_list/app_list_controller_impl.h"
#include "ash/app_list/views/app_list_nudge_controller.h"
#include "ash/assistant/assistant_controller_impl.h"
#include "ash/birch/birch_coral_provider.h"
#include "ash/birch/birch_item.h"
#include "ash/birch/birch_model.h"
#include "ash/birch/coral_util.h"
#include "ash/calendar/calendar_controller.h"
#include "ash/capture_mode/capture_mode_controller.h"
#include "ash/capture_mode/capture_mode_education_controller.h"
#include "ash/clipboard/clipboard_history_controller_impl.h"
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/controls/contextual_tooltip.h"
#include "ash/detachable_base/detachable_base_handler.h"
#include "ash/display/display_prefs.h"
#include "ash/display/privacy_screen_controller.h"
#include "ash/edusumer/graduation_prefs.h"
#include "ash/game_dashboard/game_dashboard_controller.h"
#include "ash/glanceables/glanceables_controller.h"
#include "ash/keyboard/keyboard_controller_impl.h"
#include "ash/login/login_screen_controller.h"
#include "ash/login/ui/login_expanded_public_account_view.h"
#include "ash/login/ui/management_disclosure_field_trial.h"
#include "ash/media/media_controller_impl.h"
#include "ash/metrics/feature_discovery_duration_reporter_impl.h"
#include "ash/projector/projector_controller_impl.h"
#include "ash/public/cpp/holding_space/holding_space_prefs.h"
#include "ash/public/cpp/lobster/lobster_enums.h"
#include "ash/quick_insert/quick_insert_controller.h"
#include "ash/quick_pair/feature_status_tracker/scanning_enabled_provider.h"
#include "ash/quick_pair/keyed_service/quick_pair_mediator.h"
#include "ash/scanner/scanner_controller.h"
#include "ash/session/fullscreen_controller.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shelf/shelf_controller.h"
#include "ash/style/color_palette_controller.h"
#include "ash/style/dark_light_mode_controller_impl.h"
#include "ash/system/bluetooth/bluetooth_device_status_ui_handler.h"
#include "ash/system/brightness/brightness_controller_chromeos.h"
#include "ash/system/camera/autozoom_controller_impl.h"
#include "ash/system/camera/autozoom_nudge_controller.h"
#include "ash/system/camera/camera_app_prefs.h"
#include "ash/system/camera/camera_effects_controller.h"
#include "ash/system/focus_mode/focus_mode_controller.h"
#include "ash/system/geolocation/geolocation_controller.h"
#include "ash/system/hotspot/hotspot_info_cache.h"
#include "ash/system/human_presence/snooping_protection_controller.h"
#include "ash/system/input_device_settings/input_device_settings_controller_impl.h"
#include "ash/system/input_device_settings/input_device_settings_metadata_manager.h"
#include "ash/system/input_device_settings/input_device_settings_notification_controller.h"
#include "ash/system/input_device_settings/input_device_tracker.h"
#include "ash/system/input_device_settings/keyboard_modifier_metrics_recorder.h"
#include "ash/system/keyboard_brightness/keyboard_backlight_color_controller.h"
#include "ash/system/keyboard_brightness/keyboard_brightness_controller.h"
#include "ash/system/mahi/mahi_nudge_controller.h"
#include "ash/system/mahi/mahi_utils.h"
#include "ash/system/media/media_tray.h"
#include "ash/system/network/cellular_setup_notifier.h"
#include "ash/system/network/vpn_detailed_view.h"
#include "ash/system/night_light/night_light_controller_impl.h"
#include "ash/system/notification_center/message_center_controller.h"
#include "ash/system/palette/palette_tray.h"
#include "ash/system/palette/palette_welcome_bubble.h"
#include "ash/system/pcie_peripheral/pcie_peripheral_notification_controller.h"
#include "ash/system/phonehub/onboarding_nudge_controller.h"
#include "ash/system/power/battery_saver_controller.h"
#include "ash/system/power/power_notification_controller.h"
#include "ash/system/power/power_prefs.h"
#include "ash/system/power/power_sounds_controller.h"
#include "ash/system/privacy_hub/privacy_hub_controller.h"
#include "ash/system/session/logout_button_tray.h"
#include "ash/system/session/logout_confirmation_controller.h"
#include "ash/system/unified/quick_settings_footer.h"
#include "ash/system/unified/unified_system_tray_controller.h"
#include "ash/system/usb_peripheral/usb_peripheral_notification_controller.h"
#include "ash/system/video_conference/video_conference_tray_controller.h"
#include "ash/touch/touch_devices_controller.h"
#include "ash/user_education/user_education_controller.h"
#include "ash/wallpaper/sea_pen_wallpaper_manager.h"
#include "ash/wallpaper/wallpaper_daily_refresh_scheduler.h"
#include "ash/wallpaper/wallpaper_pref_manager.h"
#include "ash/wallpaper/wallpaper_time_of_day_scheduler.h"
#include "ash/webui/help_app_ui/help_app_prefs.h"
#include "ash/wm/desks/desks_restore_util.h"
#include "ash/wm/desks/templates/saved_desk_util.h"
#include "ash/wm/float/tablet_mode_tuck_education.h"
#include "ash/wm/lock_state_controller.h"
#include "ash/wm/overview/birch/birch_bar_controller.h"
#include "ash/wm/overview/birch/birch_privacy_nudge_controller.h"
#include "ash/wm/window_cycle/window_cycle_controller.h"
#include "ash/wm/window_util.h"
#include "chromeos/ash/components/boca/boca_role_util.h"
#include "chromeos/ash/components/editor_menu/public/cpp/editor_enterprise_policy_enums.h"
#include "chromeos/ash/components/growth/campaigns_manager.h"
#include "chromeos/ash/services/assistant/public/cpp/assistant_prefs.h"
#include "chromeos/components/magic_boost/public/cpp/magic_boost_state.h"
#include "chromeos/components/quick_answers/public/cpp/quick_answers_prefs.h"
#include "chromeos/ui/frame/multitask_menu/multitask_menu_nudge_controller.h"
#include "chromeos/ui/wm/fullscreen/pref_names.h"
#include "components/language/core/browser/pref_names.h"
#include "components/live_caption/pref_names.h"
#include "components/soda/constants.h"
#include "components/user_manager/user_manager.h"

namespace ash {

namespace {

// Registers prefs whose default values are same in user and signin prefs.
void RegisterProfilePrefs(PrefRegistrySimple* registry,
                          std::string_view country,
                          bool for_test) {
  AcceleratorPrefs::RegisterProfilePrefs(registry);
  AccessibilityController::RegisterProfilePrefs(registry);
  AppListControllerImpl::RegisterProfilePrefs(registry);
  AppListNudgeController::RegisterProfilePrefs(registry);
  AshAcceleratorConfiguration::RegisterProfilePrefs(registry);
  AssistantControllerImpl::RegisterProfilePrefs(registry);
  AutozoomControllerImpl::RegisterProfilePrefs(registry);
  AutozoomNudgeController::RegisterProfilePrefs(registry);
  AmbientController::RegisterProfilePrefs(registry);
  BirchBarController::RegisterProfilePrefs(registry);
  BirchCoralProvider::RegisterProfilePrefs(registry);
  BirchItem::RegisterProfilePrefs(registry);
  BirchModel::RegisterProfilePrefs(registry);
  BirchPrivacyNudgeController::RegisterProfilePrefs(registry);
  boca_util::RegisterPrefs(registry);
  CalendarController::RegisterProfilePrefs(registry);
  camera_app_prefs::RegisterProfilePrefs(registry);
  CameraEffectsController::RegisterProfilePrefs(registry);
  CaptureModeController::RegisterProfilePrefs(registry);
  CaptureModeEducationController::RegisterProfilePrefs(registry);
  CellularSetupNotifier::RegisterProfilePrefs(registry);
  chromeos::MultitaskMenuNudgeController::RegisterProfilePrefs(registry);
  contextual_tooltip::RegisterProfilePrefs(registry);
  ClipboardHistoryControllerImpl::RegisterProfilePrefs(registry);
  ColorPaletteController::RegisterPrefs(registry);
  DarkLightModeControllerImpl::RegisterProfilePrefs(registry);
  desks_restore_util::RegisterProfilePrefs(registry);
  saved_desk_util::RegisterProfilePrefs(registry);
  window_util::RegisterProfilePrefs(registry);
  DockedMagnifierController::RegisterProfilePrefs(registry);
  FeatureDiscoveryDurationReporterImpl::RegisterProfilePrefs(registry);
  FocusModeController::RegisterProfilePrefs(registry);
  FullscreenController::RegisterProfilePrefs(registry);
  GameDashboardController::RegisterProfilePrefs(registry);
  GeolocationController::RegisterProfilePrefs(registry);
  GlanceablesController::RegisterUserProfilePrefs(registry);
  graduation_prefs::RegisterProfilePrefs(registry);
  help_app::prefs::RegisterProfilePrefs(registry);
  holding_space_prefs::RegisterProfilePrefs(registry);
  HotspotInfoCache::RegisterProfilePrefs(registry);
  InputDeviceSettingsControllerImpl::RegisterProfilePrefs(registry);
  InputDeviceSettingsNotificationController::RegisterProfilePrefs(registry);
  InputDeviceTracker::RegisterProfilePrefs(registry);
  LoginScreenController::RegisterProfilePrefs(registry, for_test);
  LogoutButtonTray::RegisterProfilePrefs(registry);
  LogoutConfirmationController::RegisterProfilePrefs(registry);
  KeyboardBacklightColorController::RegisterPrefs(registry);
  KeyboardControllerImpl::RegisterProfilePrefs(registry, country);
  KeyboardModifierMetricsRecorder::RegisterProfilePrefs(registry, for_test);
  MahiNudgeController::RegisterProfilePrefs(registry);
  MediaControllerImpl::RegisterProfilePrefs(registry);
  MessageCenterController::RegisterProfilePrefs(registry);
  NightLightControllerImpl::RegisterProfilePrefs(registry);
  OnboardingNudgeController::RegisterProfilePrefs(registry);
  PaletteTray::RegisterProfilePrefs(registry);
  PaletteWelcomeBubble::RegisterProfilePrefs(registry);
  PciePeripheralNotificationController::RegisterProfilePrefs(registry);
  PrivacyHubController::RegisterProfilePrefs(registry);
  PrivacyScreenController::RegisterProfilePrefs(registry);
  ProjectorControllerImpl::RegisterProfilePrefs(registry);
  QuickInsertController::RegisterProfilePrefs(registry);
  quick_pair::Mediator::RegisterProfilePrefs(registry);
  RegisterSystemShortcutBehaviorProfilePrefs(registry);
  ScannerController::RegisterProfilePrefs(registry);
  ScreensaverImagesPolicyHandler::RegisterPrefs(registry);
  ShelfController::RegisterProfilePrefs(registry);
  SnoopingProtectionController::RegisterProfilePrefs(registry);
  system::BrightnessControllerChromeos::RegisterProfilePrefs(registry);
  KeyboardBrightnessController::RegisterProfilePrefs(registry);
  TabletModeTuckEducation::RegisterProfilePrefs(registry);
  TouchDevicesController::RegisterProfilePrefs(registry, for_test);
  UserEducationController::RegisterProfilePrefs(registry);
  MediaTray::RegisterProfilePrefs(registry);
  UsbPeripheralNotificationController::RegisterProfilePrefs(registry);
  VideoConferenceTrayController::RegisterProfilePrefs(registry);
  VpnDetailedView::RegisterProfilePrefs(registry);
  WallpaperDailyRefreshScheduler::RegisterProfilePrefs(registry);
  WallpaperTimeOfDayScheduler::RegisterProfilePrefs(registry);
  WallpaperPrefManager::RegisterProfilePrefs(registry);
  WindowCycleController::RegisterProfilePrefs(registry);
  growth::CampaignsManager::RegisterProfilePrefs(registry);

  // Provide prefs registered in the browser for ash_unittests.
  if (for_test) {
    assistant::prefs::RegisterProfilePrefs(registry);
    quick_answers::prefs::RegisterProfilePrefs(registry);
    registry->RegisterBooleanPref(prefs::kMouseReverseScroll, false);
    registry->RegisterBooleanPref(prefs::kSendFunctionKeys, false);
    registry->RegisterBooleanPref(prefs::kSuggestedContentEnabled, true);
    registry->RegisterBooleanPref(prefs::kMagicBoostEnabled, true);
    registry->RegisterBooleanPref(prefs::kHmrEnabled, true);
    registry->RegisterIntegerPref(
        prefs::kHmrManagedSettings,
        static_cast<int>(
            mahi_utils::HmrEnterprisePolicy::kAllowedWithModelImprovement));
    registry->RegisterIntegerPref(
        prefs::kHmwManagedSettings,
        base::to_underlying(chromeos::editor_menu::EditorEnterprisePolicy::
                                kAllowedWithModelImprovement));
    registry->RegisterBooleanPref(prefs::kOrcaEnabled, true);
    registry->RegisterBooleanPref(prefs::kOrcaFeedbackEnabled, true);
    registry->RegisterBooleanPref(prefs::kLobsterEnabled, true);
    registry->RegisterIntegerPref(
        prefs::kLobsterEnterprisePolicySettings,
        base::to_underlying(
            ash::LobsterEnterprisePolicyValue::kAllowedWithModelImprovement));
    registry->RegisterBooleanPref(::prefs::kLiveCaptionEnabled, false);
    registry->RegisterListPref(
        chromeos::prefs::kKeepFullscreenWithoutNotificationUrlAllowList);
    registry->RegisterStringPref(::prefs::kLiveCaptionLanguageCode,
                                 speech::kUsEnglishLocale);
    registry->RegisterStringPref(language::prefs::kApplicationLocale,
                                 std::string());
    registry->RegisterStringPref(language::prefs::kPreferredLanguages,
                                 std::string());
    registry->RegisterIntegerPref(prefs::kAltEventRemappedToRightClick, 0);
    registry->RegisterIntegerPref(
        prefs::kHMRConsentStatus,
        base::to_underlying(chromeos::HMRConsentStatus::kUnset));
    registry->RegisterIntegerPref(prefs::kHMRConsentWindowDismissCount, 0);
    registry->RegisterIntegerPref(prefs::kSearchEventRemappedToRightClick, 0);
    registry->RegisterIntegerPref(prefs::kKeyEventRemappedToSixPackDelete, 0);
    registry->RegisterIntegerPref(prefs::kKeyEventRemappedToSixPackEnd, 0);
    registry->RegisterIntegerPref(prefs::kKeyEventRemappedToSixPackHome, 0);
    registry->RegisterIntegerPref(prefs::kKeyEventRemappedToSixPackPageUp, 0);
    registry->RegisterIntegerPref(prefs::kKeyEventRemappedToSixPackPageDown, 0);
    registry->RegisterBooleanPref(prefs::kShowInformedRestoreOnboarding, false);
    registry->RegisterIntegerPref(prefs::kInformedRestoreNudgeShownCount, 0);
    registry->RegisterTimePref(prefs::kInformedRestoreNudgeLastShown,
                               base::Time());
    registry->RegisterDictionaryPref(prefs::kEmojiPickerHistory);
    registry->RegisterIntegerPref(
        prefs::kGenAISmartGroupingSettings,
        base::to_underlying(coral_util::GenAISmartGroupingSettings::kAllowed));
  }
}

}  // namespace

void RegisterLocalStatePrefs(PrefRegistrySimple* registry, bool for_test) {
  PaletteTray::RegisterLocalStatePrefs(registry);
  WallpaperPrefManager::RegisterLocalStatePrefs(registry);
  ColorPaletteController::RegisterLocalStatePrefs(registry);
  DetachableBaseHandler::RegisterPrefs(registry);
  PowerPrefs::RegisterLocalStatePrefs(registry);
  PrivacyHubController::RegisterLocalStatePrefs(registry);
  DisplayPrefs::RegisterLocalStatePrefs(registry);
  LoginExpandedPublicAccountView::RegisterLocalStatePrefs(registry);
  LockStateController::RegisterPrefs(registry);
  quick_pair::Mediator::RegisterLocalStatePrefs(registry);
  QuickSettingsFooter::RegisterLocalStatePrefs(registry);
  KeyboardBacklightColorController::RegisterPrefs(registry);
  BatterySaverController::RegisterLocalStatePrefs(registry);
  PowerSoundsController::RegisterLocalStatePrefs(registry);
  PowerNotificationController::RegisterLocalStatePrefs(registry);
  quick_pair::ScanningEnabledProvider::RegisterLocalStatePrefs(registry);
  InputDeviceSettingsMetadataManager::RegisterLocalStatePrefs(registry);
  BluetoothDeviceStatusUiHandler::RegisterLocalStatePrefs(registry);
  management_disclosure_field_trial::RegisterLocalStatePrefs(registry);

  if (for_test) {
    registry->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false);
    user_manager::UserManager::RegisterPrefs(registry);
  }
}

void RegisterSigninProfilePrefs(PrefRegistrySimple* registry,
                                std::string_view country,
                                bool for_test) {
  RegisterProfilePrefs(registry, country, for_test);
  PowerPrefs::RegisterSigninProfilePrefs(registry);
}

void RegisterUserProfilePrefs(PrefRegistrySimple* registry,
                              std::string_view country,
                              bool for_test) {
  RegisterProfilePrefs(registry, country, for_test);
  PowerPrefs::RegisterUserProfilePrefs(registry);
  SessionControllerImpl::RegisterUserProfilePrefs(registry);
}

}  // namespace ash