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