1 // Copyright 2012 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.
5 #include "chrome/browser/prefs/browser_prefs.h"
9 #include "base/metrics/histogram_macros.h"
10 #include "base/prefs/pref_registry_simple.h"
11 #include "base/prefs/pref_service.h"
12 #include "base/prefs/scoped_user_pref_update.h"
13 #include "base/trace_event/trace_event.h"
14 #include "chrome/browser/about_flags.h"
15 #include "chrome/browser/accessibility/invert_bubble_prefs.h"
16 #include "chrome/browser/autocomplete/zero_suggest_provider.h"
17 #include "chrome/browser/browser_process_impl.h"
18 #include "chrome/browser/browser_shutdown.h"
19 #include "chrome/browser/chrome_content_browser_client.h"
20 #include "chrome/browser/component_updater/recovery_component_installer.h"
21 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h"
22 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
23 #include "chrome/browser/devtools/devtools_window.h"
24 #include "chrome/browser/download/download_prefs.h"
25 #include "chrome/browser/external_protocol/external_protocol_handler.h"
26 #include "chrome/browser/first_run/first_run.h"
27 #include "chrome/browser/geolocation/geolocation_prefs.h"
28 #include "chrome/browser/gpu/gl_string_manager.h"
29 #include "chrome/browser/gpu/gpu_mode_manager.h"
30 #include "chrome/browser/intranet_redirect_detector.h"
31 #include "chrome/browser/io_thread.h"
32 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
33 #include "chrome/browser/media/media_device_id_salt.h"
34 #include "chrome/browser/media/media_stream_devices_controller.h"
35 #include "chrome/browser/metrics/chrome_metrics_service_client.h"
36 #include "chrome/browser/metrics/variations/variations_service.h"
37 #include "chrome/browser/net/http_server_properties_manager_factory.h"
38 #include "chrome/browser/net/net_pref_observer.h"
39 #include "chrome/browser/net/prediction_options.h"
40 #include "chrome/browser/net/predictor.h"
41 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h"
42 #include "chrome/browser/net/ssl_config_service_manager.h"
43 #include "chrome/browser/notifications/desktop_notification_service.h"
44 #include "chrome/browser/notifications/extension_welcome_notification.h"
45 #include "chrome/browser/notifications/message_center_notification_manager.h"
46 #include "chrome/browser/pepper_flash_settings_manager.h"
47 #include "chrome/browser/plugins/plugin_finder.h"
48 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
49 #include "chrome/browser/prefs/incognito_mode_prefs.h"
50 #include "chrome/browser/prefs/pref_service_syncable.h"
51 #include "chrome/browser/prefs/session_startup_pref.h"
52 #include "chrome/browser/printing/print_dialog_cloud.h"
53 #include "chrome/browser/profiles/chrome_version_service.h"
54 #include "chrome/browser/profiles/profile.h"
55 #include "chrome/browser/profiles/profile_impl.h"
56 #include "chrome/browser/profiles/profile_info_cache.h"
57 #include "chrome/browser/profiles/profiles_state.h"
58 #include "chrome/browser/push_messaging/push_messaging_service_impl.h"
59 #include "chrome/browser/renderer_host/pepper/device_id_fetcher.h"
60 #include "chrome/browser/search/search.h"
61 #include "chrome/browser/signin/signin_manager_factory.h"
62 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h"
63 #include "chrome/browser/task_manager/task_manager.h"
64 #include "chrome/browser/ui/app_list/app_list_prefs.h"
65 #include "chrome/browser/ui/app_list/app_list_service.h"
66 #include "chrome/browser/ui/browser_ui_prefs.h"
67 #include "chrome/browser/ui/navigation_correction_tab_observer.h"
68 #include "chrome/browser/ui/network_profile_bubble.h"
69 #include "chrome/browser/ui/passwords/password_bubble_experiment.h"
70 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
71 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h"
72 #include "chrome/browser/ui/startup/autolaunch_prompt.h"
73 #include "chrome/browser/ui/startup/default_browser_prompt.h"
74 #include "chrome/browser/ui/tabs/pinned_tab_codec.h"
75 #include "chrome/browser/ui/webui/flags_ui.h"
76 #include "chrome/browser/ui/webui/instant_ui.h"
77 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
78 #include "chrome/browser/ui/webui/plugins_ui.h"
79 #include "chrome/browser/ui/webui/print_preview/sticky_settings.h"
80 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
81 #include "chrome/browser/upgrade_detector.h"
82 #include "chrome/browser/web_resource/promo_resource_service.h"
83 #include "chrome/common/pref_names.h"
84 #include "components/autofill/core/browser/autofill_manager.h"
85 #include "components/bookmarks/browser/bookmark_utils.h"
86 #include "components/content_settings/core/browser/host_content_settings_map.h"
87 #include "components/dom_distiller/core/distilled_page_prefs.h"
88 #include "components/enhanced_bookmarks/bookmark_server_cluster_service.h"
89 #include "components/gcm_driver/gcm_channel_status_syncer.h"
90 #include "components/network_time/network_time_tracker.h"
91 #include "components/password_manager/core/browser/password_manager.h"
92 #include "components/pref_registry/pref_registry_syncable.h"
93 #include "components/rappor/rappor_service.h"
94 #include "components/search_engines/template_url_prepopulate_data.h"
95 #include "components/sync_driver/sync_prefs.h"
96 #include "components/translate/core/browser/translate_prefs.h"
97 #include "content/public/browser/render_process_host.h"
98 #include "net/http/http_server_properties_manager.h"
100 #if defined(ENABLE_AUTOFILL_DIALOG)
101 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
104 #if defined(ENABLE_BACKGROUND)
105 #include "chrome/browser/background/background_mode_manager.h"
108 #if defined(ENABLE_CONFIGURATION_POLICY)
109 #include "components/policy/core/browser/browser_policy_connector.h"
110 #include "components/policy/core/browser/url_blacklist_manager.h"
111 #include "components/policy/core/common/policy_statistics_collector.h"
114 #if defined(ENABLE_EXTENSIONS)
115 #include "chrome/browser/accessibility/animation_policy_prefs.h"
116 #include "chrome/browser/apps/drive/drive_app_mapping.h"
117 #include "chrome/browser/apps/shortcut_manager.h"
118 #include "chrome/browser/extensions/activity_log/activity_log.h"
119 #include "chrome/browser/extensions/api/commands/command_service.h"
120 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
121 #include "chrome/browser/extensions/extension_web_ui.h"
122 #include "chrome/browser/extensions/launch_util.h"
123 #include "chrome/browser/signin/easy_unlock_service.h"
124 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h"
125 #include "extensions/browser/extension_prefs.h"
126 #if !defined(OS_ANDROID) && !defined(OS_IOS)
127 #include "chrome/browser/extensions/api/copresence/copresence_api.h"
128 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
130 #endif // defined(ENABLE_EXTENSIONS)
132 #if defined(ENABLE_PLUGIN_INSTALLATION)
133 #include "chrome/browser/plugins/plugins_resource_service.h"
136 #if defined(ENABLE_SUPERVISED_USERS)
137 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_service.h"
138 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service.h"
139 #include "chrome/browser/supervised_user/supervised_user_service.h"
140 #include "chrome/browser/supervised_user/supervised_user_whitelist_service.h"
143 #if defined(ENABLE_SERVICE_DISCOVERY)
144 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui.h"
147 #if defined(OS_ANDROID)
148 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h"
149 #include "chrome/browser/android/new_tab_page_prefs.h"
151 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h"
152 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h"
155 #if !defined(OS_ANDROID) && !defined(OS_IOS)
156 #include "chrome/browser/signin/signin_promo.h"
159 #if defined(OS_CHROMEOS)
160 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
161 #include "chrome/browser/chromeos/customization/customization_document.h"
162 #include "chrome/browser/chromeos/display/display_preferences.h"
163 #include "chrome/browser/chromeos/extensions/echo_private_api.h"
164 #include "chrome/browser/chromeos/file_system_provider/registry.h"
165 #include "chrome/browser/chromeos/first_run/first_run.h"
166 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h"
167 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
168 #include "chrome/browser/chromeos/login/startup_utils.h"
169 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h"
170 #include "chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.h"
171 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h"
172 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
173 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
174 #include "chrome/browser/chromeos/net/proxy_config_handler.h"
175 #include "chrome/browser/chromeos/policy/auto_enrollment_client.h"
176 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
177 #include "chrome/browser/chromeos/policy/consumer_management_service.h"
178 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
179 #include "chrome/browser/chromeos/policy/device_status_collector.h"
180 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
181 #include "chrome/browser/chromeos/power/power_prefs.h"
182 #include "chrome/browser/chromeos/preferences.h"
183 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
184 #include "chrome/browser/chromeos/settings/device_settings_cache.h"
185 #include "chrome/browser/chromeos/status/data_promo_notification.h"
186 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h"
187 #include "chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h"
188 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h"
189 #include "chrome/browser/media/protected_media_identifier_permission_context.h"
190 #include "chrome/browser/metrics/chromeos_metrics_provider.h"
191 #include "chrome/browser/ui/webui/chromeos/login/demo_mode_detector.h"
192 #include "chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h"
193 #include "chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h"
194 #include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h"
195 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
196 #include "chromeos/audio/audio_devices_pref_handler_impl.h"
197 #include "chromeos/timezone/timezone_resolver.h"
198 #include "components/invalidation/invalidator_storage.h"
200 #include "chrome/browser/extensions/default_apps.h"
203 #if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST)
204 #include "chrome/browser/ui/app_list/google_now_extension.h"
207 #if defined(OS_MACOSX)
208 #include "chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h"
209 #include "chrome/browser/ui/cocoa/confirm_quit.h"
213 #include "chrome/browser/apps/app_launch_for_metro_restart_win.h"
214 #include "chrome/browser/component_updater/sw_reporter_installer_win.h"
217 #if defined(TOOLKIT_VIEWS)
218 #include "chrome/browser/ui/browser_view_prefs.h"
222 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
227 #if !defined(OS_ANDROID)
228 // The AutomaticProfileResetter service used this preference to save that the
229 // profile reset prompt had already been shown, however, the preference has been
230 // renamed in Local State. We keep the name here for now so that we can clear
231 // out legacy values.
232 // TODO(engedy): Remove this and usages in M42 or later. See crbug.com/398813.
233 const char kLegacyProfileResetPromptMemento
[] = "profile.reset_prompt_memento";
240 void RegisterLocalState(PrefRegistrySimple
* registry
) {
242 // Please keep this list alphabetized.
243 AppListService::RegisterPrefs(registry
);
244 browser_shutdown::RegisterPrefs(registry
);
245 BrowserProcessImpl::RegisterPrefs(registry
);
246 ChromeMetricsServiceClient::RegisterPrefs(registry
);
247 chrome_prefs::RegisterPrefs(registry
);
248 chrome_variations::VariationsService::RegisterPrefs(registry
);
249 component_updater::RegisterPrefsForRecoveryComponent(registry
);
250 component_updater::SupervisedUserWhitelistInstaller::RegisterPrefs(registry
);
251 ExternalProtocolHandler::RegisterPrefs(registry
);
252 FlagsUI::RegisterPrefs(registry
);
253 geolocation::RegisterPrefs(registry
);
254 GLStringManager::RegisterPrefs(registry
);
255 GpuModeManager::RegisterPrefs(registry
);
256 IntranetRedirectDetector::RegisterPrefs(registry
);
257 IOThread::RegisterPrefs(registry
);
258 network_time::NetworkTimeTracker::RegisterPrefs(registry
);
259 PrefProxyConfigTrackerImpl::RegisterPrefs(registry
);
260 ProfileInfoCache::RegisterPrefs(registry
);
261 profiles::RegisterPrefs(registry
);
262 PromoResourceService::RegisterPrefs(registry
);
263 rappor::RapporService::RegisterPrefs(registry
);
264 RegisterScreenshotPrefs(registry
);
265 SigninManagerFactory::RegisterPrefs(registry
);
266 SSLConfigServiceManager::RegisterPrefs(registry
);
267 UpgradeDetector::RegisterPrefs(registry
);
269 #if defined(ENABLE_AUTOFILL_DIALOG)
270 autofill::AutofillDialogController::RegisterPrefs(registry
);
273 #if defined(ENABLE_CONFIGURATION_POLICY)
274 policy::BrowserPolicyConnector::RegisterPrefs(registry
);
275 policy::PolicyStatisticsCollector::RegisterPrefs(registry
);
278 #if defined(ENABLE_EXTENSIONS)
279 EasyUnlockService::RegisterPrefs(registry
);
282 #if defined(ENABLE_NOTIFICATIONS) && !defined(OS_ANDROID)
283 // Android does not use the message center for notifications.
284 MessageCenterNotificationManager::RegisterPrefs(registry
);
287 #if defined(ENABLE_PLUGINS)
288 PluginFinder::RegisterPrefs(registry
);
291 #if defined(ENABLE_PLUGIN_INSTALLATION)
292 PluginsResourceService::RegisterPrefs(registry
);
295 #if defined(ENABLE_TASK_MANAGER)
296 TaskManager::RegisterPrefs(registry
);
297 #endif // defined(ENABLE_TASK_MANAGER)
299 #if !defined(OS_ANDROID)
300 AutomaticProfileResetterFactory::RegisterPrefs(registry
);
301 BackgroundModeManager::RegisterPrefs(registry
);
302 RegisterBrowserPrefs(registry
);
303 // The native GCM is used on Android instead.
304 gcm::GCMChannelStatusSyncer::RegisterPrefs(registry
);
305 #if !defined(OS_CHROMEOS)
306 RegisterDefaultBrowserPromptPrefs(registry
);
307 #endif // !defined(OS_CHROMEOS)
308 #endif // !defined(OS_ANDROID)
310 #if defined(OS_CHROMEOS)
311 ChromeOSMetricsProvider::RegisterPrefs(registry
);
312 chromeos::AudioDevicesPrefHandlerImpl::RegisterPrefs(registry
);
313 chromeos::ChromeUserManagerImpl::RegisterPrefs(registry
);
314 chromeos::DataPromoNotification::RegisterPrefs(registry
);
315 chromeos::DeviceOAuth2TokenService::RegisterPrefs(registry
);
316 chromeos::device_settings_cache::RegisterPrefs(registry
);
317 chromeos::EnableDebuggingScreenHandler::RegisterPrefs(registry
);
318 chromeos::language_prefs::RegisterPrefs(registry
);
319 chromeos::KioskAppManager::RegisterPrefs(registry
);
320 chromeos::MultiProfileUserController::RegisterPrefs(registry
);
321 chromeos::HIDDetectionScreenHandler::RegisterPrefs(registry
);
322 chromeos::DemoModeDetector::RegisterPrefs(registry
);
323 chromeos::Preferences::RegisterPrefs(registry
);
324 chromeos::proxy_config::RegisterPrefs(registry
);
325 chromeos::RegisterDisplayLocalStatePrefs(registry
);
326 chromeos::ResetScreenHandler::RegisterPrefs(registry
);
327 chromeos::ServicesCustomizationDocument::RegisterPrefs(registry
);
328 chromeos::SigninScreenHandler::RegisterPrefs(registry
);
329 chromeos::StartupUtils::RegisterPrefs(registry
);
330 chromeos::system::AutomaticRebootManager::RegisterPrefs(registry
);
331 chromeos::UserImageManager::RegisterPrefs(registry
);
332 chromeos::UserSessionManager::RegisterPrefs(registry
);
333 chromeos::WallpaperManager::RegisterPrefs(registry
);
334 chromeos::echo_offer::RegisterPrefs(registry
);
335 extensions::ExtensionAssetsManagerChromeOS::RegisterPrefs(registry
);
336 invalidation::InvalidatorStorage::RegisterPrefs(registry
);
337 policy::AutoEnrollmentClient::RegisterPrefs(registry
);
338 policy::BrowserPolicyConnectorChromeOS::RegisterPrefs(registry
);
339 policy::ConsumerManagementService::RegisterPrefs(registry
);
340 policy::DeviceCloudPolicyManagerChromeOS::RegisterPrefs(registry
);
341 policy::DeviceStatusCollector::RegisterPrefs(registry
);
342 policy::PolicyCertServiceFactory::RegisterPrefs(registry
);
343 chromeos::TimeZoneResolver::RegisterPrefs(registry
);
346 #if defined(OS_MACOSX)
347 confirm_quit::RegisterLocalState(registry
);
348 QuitWithAppsController::RegisterPrefs(registry
);
352 app_metro_launch::RegisterPrefs(registry
);
353 component_updater::RegisterPrefsForSwReporter(registry
);
354 password_manager::PasswordManager::RegisterLocalPrefs(registry
);
357 #if defined(TOOLKIT_VIEWS)
358 RegisterBrowserViewLocalPrefs(registry
);
361 // Preferences registered only for migration (clearing or moving to a new key)
363 #if !defined(OS_ANDROID)
364 registry
->RegisterDictionaryPref(kLegacyProfileResetPromptMemento
);
365 #endif // !defined(OS_ANDROID)
368 // Register prefs applicable to all profiles.
369 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable
* registry
) {
370 TRACE_EVENT0("browser", "chrome::RegisterProfilePrefs");
371 SCOPED_UMA_HISTOGRAM_TIMER("Settings.RegisterProfilePrefsTime");
372 // User prefs. Please keep this list alphabetized.
373 autofill::AutofillManager::RegisterProfilePrefs(registry
);
374 bookmarks::RegisterProfilePrefs(registry
);
375 sync_driver::SyncPrefs::RegisterProfilePrefs(registry
);
376 ChildAccountService::RegisterProfilePrefs(registry
);
377 ChromeContentBrowserClient::RegisterProfilePrefs(registry
);
378 ChromeVersionService::RegisterProfilePrefs(registry
);
379 chrome_browser_net::HttpServerPropertiesManagerFactory::RegisterProfilePrefs(
381 chrome_browser_net::Predictor::RegisterProfilePrefs(registry
);
382 chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry
);
383 chrome_prefs::RegisterProfilePrefs(registry
);
384 dom_distiller::DistilledPagePrefs::RegisterProfilePrefs(registry
);
385 DownloadPrefs::RegisterProfilePrefs(registry
);
386 enhanced_bookmarks::BookmarkServerClusterService::RegisterPrefs(registry
);
387 PushMessagingServiceImpl::RegisterProfilePrefs(registry
);
388 HostContentSettingsMap::RegisterProfilePrefs(registry
);
389 IncognitoModePrefs::RegisterProfilePrefs(registry
);
390 InstantUI::RegisterProfilePrefs(registry
);
391 NavigationCorrectionTabObserver::RegisterProfilePrefs(registry
);
392 MediaCaptureDevicesDispatcher::RegisterProfilePrefs(registry
);
393 MediaDeviceIDSalt::RegisterProfilePrefs(registry
);
394 MediaStreamDevicesController::RegisterProfilePrefs(registry
);
395 NetPrefObserver::RegisterProfilePrefs(registry
);
396 password_manager::PasswordManager::RegisterProfilePrefs(registry
);
397 password_bubble_experiment::RegisterPrefs(registry
);
398 PrefProxyConfigTrackerImpl::RegisterProfilePrefs(registry
);
399 PrefsTabHelper::RegisterProfilePrefs(registry
);
400 Profile::RegisterProfilePrefs(registry
);
401 ProfileImpl::RegisterProfilePrefs(registry
);
402 PromoResourceService::RegisterProfilePrefs(registry
);
403 ProtocolHandlerRegistry::RegisterProfilePrefs(registry
);
404 RegisterBrowserUserPrefs(registry
);
405 SessionStartupPref::RegisterProfilePrefs(registry
);
406 TemplateURLPrepopulateData::RegisterProfilePrefs(registry
);
407 translate::TranslatePrefs::RegisterProfilePrefs(registry
);
408 ZeroSuggestProvider::RegisterProfilePrefs(registry
);
410 #if defined(ENABLE_APP_LIST)
411 app_list::AppListPrefs::RegisterProfilePrefs(registry
);
414 #if defined(ENABLE_AUTOFILL_DIALOG)
415 autofill::AutofillDialogController::RegisterProfilePrefs(registry
);
418 #if defined(ENABLE_CONFIGURATION_POLICY)
419 policy::URLBlacklistManager::RegisterProfilePrefs(registry
);
422 #if defined(ENABLE_EXTENSIONS)
423 EasyUnlockService::RegisterProfilePrefs(registry
);
424 extensions::ActivityLog::RegisterProfilePrefs(registry
);
425 extensions::launch_util::RegisterProfilePrefs(registry
);
426 ExtensionWebUI::RegisterProfilePrefs(registry
);
427 extensions::ExtensionPrefs::RegisterProfilePrefs(registry
);
428 #if !defined(OS_ANDROID) && !defined(OS_IOS)
429 ToolbarActionsBar::RegisterProfilePrefs(registry
);
430 extensions::CopresenceService::RegisterProfilePrefs(registry
);
432 RegisterAnimationPolicyPrefs(registry
);
433 #endif // defined(ENABLE_EXTENSIONS)
435 #if defined(ENABLE_NOTIFICATIONS)
436 DesktopNotificationService::RegisterProfilePrefs(registry
);
439 #if defined(ENABLE_NOTIFICATIONS) && defined(ENABLE_EXTENSIONS) && \
441 // The extension welcome notification requires a build that enables extensions
442 // and notifications, and uses the UI message center.
443 ExtensionWelcomeNotification::RegisterProfilePrefs(registry
);
446 #if defined(ENABLE_PRINT_PREVIEW)
447 print_dialog_cloud::RegisterProfilePrefs(registry
);
448 printing::StickySettings::RegisterProfilePrefs(registry
);
451 #if defined(ENABLE_SERVICE_DISCOVERY)
452 LocalDiscoveryUI::RegisterProfilePrefs(registry
);
455 #if defined(ENABLE_SUPERVISED_USERS)
456 SupervisedUserService::RegisterProfilePrefs(registry
);
457 SupervisedUserSharedSettingsService::RegisterProfilePrefs(registry
);
458 SupervisedUserSyncService::RegisterProfilePrefs(registry
);
459 SupervisedUserWhitelistService::RegisterProfilePrefs(registry
);
462 #if defined(OS_ANDROID)
463 chrome_variations::VariationsService::RegisterProfilePrefs(registry
);
464 NewTabPagePrefs::RegisterProfilePrefs(registry
);
465 PartnerBookmarksShim::RegisterProfilePrefs(registry
);
467 AppShortcutManager::RegisterProfilePrefs(registry
);
468 autofill::GeneratedCreditCardBubbleController::RegisterUserPrefs(registry
);
469 DeviceIDFetcher::RegisterProfilePrefs(registry
);
470 DevToolsWindow::RegisterProfilePrefs(registry
);
471 DriveAppMapping::RegisterProfilePrefs(registry
);
472 extensions::CommandService::RegisterProfilePrefs(registry
);
473 extensions::ExtensionSettingsHandler::RegisterProfilePrefs(registry
);
474 extensions::TabsCaptureVisibleTabFunction::RegisterProfilePrefs(registry
);
475 first_run::RegisterProfilePrefs(registry
);
476 gcm::GCMChannelStatusSyncer::RegisterProfilePrefs(registry
);
477 NewTabUI::RegisterProfilePrefs(registry
);
478 PepperFlashSettingsManager::RegisterProfilePrefs(registry
);
479 PinnedTabCodec::RegisterProfilePrefs(registry
);
480 PluginsUI::RegisterProfilePrefs(registry
);
481 RegisterAutolaunchUserPrefs(registry
);
482 signin::RegisterProfilePrefs(registry
);
485 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
486 default_apps::RegisterProfilePrefs(registry
);
489 #if defined(OS_CHROMEOS)
490 chromeos::first_run::RegisterProfilePrefs(registry
);
491 chromeos::file_system_provider::RegisterProfilePrefs(registry
);
492 chromeos::MultiProfileUserController::RegisterProfilePrefs(registry
);
493 chromeos::Preferences::RegisterProfilePrefs(registry
);
494 chromeos::proxy_config::RegisterProfilePrefs(registry
);
495 chromeos::SAMLOfflineSigninLimiter::RegisterProfilePrefs(registry
);
496 chromeos::ServicesCustomizationDocument::RegisterProfilePrefs(registry
);
497 chromeos::UserImageSyncObserver::RegisterProfilePrefs(registry
);
498 extensions::EnterprisePlatformKeysPrivateChallengeUserKeyFunction::
499 RegisterProfilePrefs(registry
);
500 FlagsUI::RegisterProfilePrefs(registry
);
504 component_updater::RegisterProfilePrefsForSwReporter(registry
);
505 NetworkProfileBubble::RegisterProfilePrefs(registry
);
508 #if defined(TOOLKIT_VIEWS)
509 RegisterBrowserViewProfilePrefs(registry
);
510 RegisterInvertBubbleUserPrefs(registry
);
514 ash::RegisterChromeLauncherUserPrefs(registry
);
518 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable
* registry
) {
519 RegisterProfilePrefs(registry
);
521 #if defined(OS_CHROMEOS)
522 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry
);
526 void RegisterScreenshotPrefs(PrefRegistrySimple
* registry
) {
527 registry
->RegisterBooleanPref(prefs::kDisableScreenshots
, false);
530 #if defined(OS_CHROMEOS)
531 void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable
* registry
) {
532 RegisterProfilePrefs(registry
);
534 chromeos::PowerPrefs::RegisterLoginProfilePrefs(registry
);
538 // This method should be periodically pruned of year+ old migrations.
539 void MigrateObsoleteBrowserPrefs(Profile
* profile
, PrefService
* local_state
) {
540 #if defined(TOOLKIT_VIEWS)
542 MigrateBrowserTabStripPrefs(local_state
);
545 #if !defined(OS_ANDROID)
547 local_state
->ClearPref(kLegacyProfileResetPromptMemento
);
551 // This method should be periodically pruned of year+ old migrations.
552 void MigrateObsoleteProfilePrefs(Profile
* profile
) {
553 PrefService
* profile_prefs
= profile
->GetPrefs();
555 #if defined(OS_MACOSX) && !defined(OS_IOS)
557 autofill::AutofillManager::MigrateUserPrefs(profile_prefs
);
558 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
561 translate::TranslatePrefs::MigrateUserPrefs(profile_prefs
,
562 prefs::kAcceptLanguages
);
564 #if !defined(OS_ANDROID)
566 // Migrate kNetworkPredictionEnabled to kNetworkPredictionOptions when not on
567 // Android. On Android, platform-specific code performs preference migration.
568 // TODO(bnc): https://crbug.com/401970 Remove migration code one year after
570 chrome_browser_net::MigrateNetworkPredictionUserPrefs(profile_prefs
);
573 #if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST)
575 MigrateGoogleNowPrefs(profile
);
579 // As part of the migration from per-profile to per-partition HostZoomMaps,
580 // we need to detect if an existing per-profile set of preferences exist, and
581 // if so convert them to be per-partition. We migrate any per-profile zoom
582 // level prefs via zoom_level_prefs.
583 // Code that updates zoom prefs in the profile prefs store has been removed,
584 // so once we clear these values here, they should never get set again.
585 // TODO(wjmaclean): Remove this migration machinery after histograms show
586 // that an aceptable percentage of users have been migrated.
588 void MigrateProfileZoomLevelPrefs(Profile
* profile
) {
589 PrefService
* prefs
= profile
->GetPrefs();
590 chrome::ChromeZoomLevelPrefs
* zoom_level_prefs
= profile
->GetZoomLevelPrefs();
591 DCHECK(zoom_level_prefs
);
593 bool migrated
= false;
594 // Only migrate the default zoom level if it is not equal to the registered
595 // default for the preference.
596 const base::Value
* per_profile_default_zoom_level_value
=
597 prefs
->GetUserPrefValue(prefs::kDefaultZoomLevelDeprecated
);
598 if (per_profile_default_zoom_level_value
) {
599 if (per_profile_default_zoom_level_value
->GetType() ==
600 base::Value::TYPE_DOUBLE
) {
601 double per_profile_default_zoom_level
= 0.0;
602 bool success
= per_profile_default_zoom_level_value
->GetAsDouble(
603 &per_profile_default_zoom_level
);
605 zoom_level_prefs
->SetDefaultZoomLevelPref(per_profile_default_zoom_level
);
607 prefs
->ClearPref(prefs::kDefaultZoomLevelDeprecated
);
611 const base::DictionaryValue
* host_zoom_dictionary
=
612 prefs
->GetDictionary(prefs::kPerHostZoomLevelsDeprecated
);
613 // Collect stats on frequency with which migrations are occuring. This measure
614 // is not perfect, since it will consider an un-migrated user with only
615 // default value as being already migrated, but it will catch all non-trivial
617 migrated
|= !host_zoom_dictionary
->empty();
618 UMA_HISTOGRAM_BOOLEAN("Settings.ZoomLevelPreferencesMigrated", migrated
);
620 // Since |host_zoom_dictionary| is not partition-based, do not attempt to
622 zoom_level_prefs
->ExtractPerHostZoomLevels(
623 host_zoom_dictionary
, false /* sanitize_partition_host_zoom_levels */);
625 // We're done migrating the profile per-host zoom level values, so we clear
627 DictionaryPrefUpdate
host_zoom_dictionary_update(
628 prefs
, prefs::kPerHostZoomLevelsDeprecated
);
629 host_zoom_dictionary_update
->Clear();
632 } // namespace chrome