Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / prefs / browser_prefs.cc
blobbbf8ca3768d5267286e6bbc04ef0173f02e030f5
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"
7 #include <string>
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/trace_event/trace_event.h"
13 #include "chrome/browser/about_flags.h"
14 #include "chrome/browser/accessibility/invert_bubble_prefs.h"
15 #include "chrome/browser/browser_process_impl.h"
16 #include "chrome/browser/browser_shutdown.h"
17 #include "chrome/browser/chrome_content_browser_client.h"
18 #include "chrome/browser/component_updater/recovery_component_installer.h"
19 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h"
20 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
21 #include "chrome/browser/devtools/devtools_window.h"
22 #include "chrome/browser/download/download_prefs.h"
23 #include "chrome/browser/external_protocol/external_protocol_handler.h"
24 #include "chrome/browser/first_run/first_run.h"
25 #include "chrome/browser/geolocation/geolocation_prefs.h"
26 #include "chrome/browser/gpu/gl_string_manager.h"
27 #include "chrome/browser/gpu/gpu_mode_manager.h"
28 #include "chrome/browser/intranet_redirect_detector.h"
29 #include "chrome/browser/io_thread.h"
30 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
31 #include "chrome/browser/media/media_device_id_salt.h"
32 #include "chrome/browser/media/media_stream_devices_controller.h"
33 #include "chrome/browser/metrics/chrome_metrics_service_client.h"
34 #include "chrome/browser/net/http_server_properties_manager_factory.h"
35 #include "chrome/browser/net/net_pref_observer.h"
36 #include "chrome/browser/net/prediction_options.h"
37 #include "chrome/browser/net/predictor.h"
38 #include "chrome/browser/net/ssl_config_service_manager.h"
39 #include "chrome/browser/notifications/extension_welcome_notification.h"
40 #include "chrome/browser/notifications/message_center_notification_manager.h"
41 #include "chrome/browser/notifications/notifier_state_tracker.h"
42 #include "chrome/browser/pepper_flash_settings_manager.h"
43 #include "chrome/browser/plugins/plugin_finder.h"
44 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
45 #include "chrome/browser/prefs/incognito_mode_prefs.h"
46 #include "chrome/browser/prefs/pref_service_syncable.h"
47 #include "chrome/browser/prefs/session_startup_pref.h"
48 #include "chrome/browser/profiles/chrome_version_service.h"
49 #include "chrome/browser/profiles/profile.h"
50 #include "chrome/browser/profiles/profile_impl.h"
51 #include "chrome/browser/profiles/profile_info_cache.h"
52 #include "chrome/browser/profiles/profiles_state.h"
53 #include "chrome/browser/push_messaging/push_messaging_service_impl.h"
54 #include "chrome/browser/renderer_host/pepper/device_id_fetcher.h"
55 #include "chrome/browser/search/search.h"
56 #include "chrome/browser/signin/signin_manager_factory.h"
57 #include "chrome/browser/task_manager/task_manager.h"
58 #include "chrome/browser/tracing/chrome_tracing_delegate.h"
59 #include "chrome/browser/ui/app_list/app_list_prefs.h"
60 #include "chrome/browser/ui/app_list/app_list_service.h"
61 #include "chrome/browser/ui/browser_ui_prefs.h"
62 #include "chrome/browser/ui/navigation_correction_tab_observer.h"
63 #include "chrome/browser/ui/network_profile_bubble.h"
64 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
65 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h"
66 #include "chrome/browser/ui/startup/autolaunch_prompt.h"
67 #include "chrome/browser/ui/startup/default_browser_prompt.h"
68 #include "chrome/browser/ui/tabs/pinned_tab_codec.h"
69 #include "chrome/browser/ui/webui/flags_ui.h"
70 #include "chrome/browser/ui/webui/instant_ui.h"
71 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
72 #include "chrome/browser/ui/webui/plugins_ui.h"
73 #include "chrome/browser/ui/webui/print_preview/sticky_settings.h"
74 #include "chrome/browser/upgrade_detector.h"
75 #include "chrome/common/pref_names.h"
76 #include "components/autofill/core/browser/autofill_manager.h"
77 #include "components/content_settings/core/browser/host_content_settings_map.h"
78 #include "components/dom_distiller/core/distilled_page_prefs.h"
79 #include "components/enhanced_bookmarks/bookmark_server_cluster_service.h"
80 #include "components/gcm_driver/gcm_channel_status_syncer.h"
81 #include "components/network_time/network_time_tracker.h"
82 #include "components/omnibox/browser/zero_suggest_provider.h"
83 #include "components/password_manager/core/browser/password_bubble_experiment.h"
84 #include "components/password_manager/core/browser/password_manager.h"
85 #include "components/pref_registry/pref_registry_syncable.h"
86 #include "components/proxy_config/pref_proxy_config_tracker_impl.h"
87 #include "components/rappor/rappor_service.h"
88 #include "components/search_engines/template_url_prepopulate_data.h"
89 #include "components/sync_driver/sync_prefs.h"
90 #include "components/translate/core/browser/translate_prefs.h"
91 #include "components/variations/service/variations_service.h"
92 #include "components/web_resource/promo_resource_service.h"
93 #include "content/public/browser/render_process_host.h"
94 #include "net/http/http_server_properties_manager.h"
96 #if defined(ENABLE_AUTOFILL_DIALOG)
97 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
98 #endif
100 #if defined(ENABLE_BACKGROUND)
101 #include "chrome/browser/background/background_mode_manager.h"
102 #endif
104 #if defined(ENABLE_CONFIGURATION_POLICY)
105 #include "components/policy/core/browser/browser_policy_connector.h"
106 #include "components/policy/core/browser/url_blacklist_manager.h"
107 #include "components/policy/core/common/policy_statistics_collector.h"
108 #endif
110 #if defined(ENABLE_EXTENSIONS)
111 #include "chrome/browser/accessibility/animation_policy_prefs.h"
112 #include "chrome/browser/apps/drive/drive_app_mapping.h"
113 #include "chrome/browser/apps/shortcut_manager.h"
114 #include "chrome/browser/extensions/activity_log/activity_log.h"
115 #include "chrome/browser/extensions/api/commands/command_service.h"
116 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
117 #include "chrome/browser/extensions/extension_web_ui.h"
118 #include "chrome/browser/extensions/launch_util.h"
119 #include "chrome/browser/signin/easy_unlock_service.h"
120 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h"
121 #include "extensions/browser/extension_prefs.h"
122 #if !defined(OS_ANDROID) && !defined(OS_IOS)
123 #include "chrome/browser/extensions/api/copresence/copresence_api.h"
124 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
125 #endif
126 #endif // defined(ENABLE_EXTENSIONS)
128 #if defined(ENABLE_PLUGIN_INSTALLATION)
129 #include "chrome/browser/plugins/plugins_resource_service.h"
130 #endif
132 #if defined(ENABLE_SUPERVISED_USERS)
133 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h"
134 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_service.h"
135 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service.h"
136 #include "chrome/browser/supervised_user/supervised_user_service.h"
137 #include "chrome/browser/supervised_user/supervised_user_whitelist_service.h"
138 #endif
140 #if defined(ENABLE_SERVICE_DISCOVERY)
141 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui.h"
142 #endif
144 #if defined(OS_ANDROID)
145 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h"
146 #include "chrome/browser/android/new_tab_page_prefs.h"
147 #else
148 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h"
149 #include "chrome/browser/ui/startup/startup_browser_creator.h"
150 #endif
152 #if !defined(OS_ANDROID) && !defined(OS_IOS)
153 #include "chrome/browser/signin/signin_promo.h"
154 #include "chrome/browser/ui/webui/foreign_session_handler.h"
155 #endif
157 #if defined(OS_CHROMEOS)
158 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
159 #include "chrome/browser/chromeos/customization/customization_document.h"
160 #include "chrome/browser/chromeos/display/display_preferences.h"
161 #include "chrome/browser/chromeos/extensions/echo_private_api.h"
162 #include "chrome/browser/chromeos/file_system_provider/registry.h"
163 #include "chrome/browser/chromeos/first_run/first_run.h"
164 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h"
165 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
166 #include "chrome/browser/chromeos/login/startup_utils.h"
167 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h"
168 #include "chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.h"
169 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h"
170 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
171 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
172 #include "chrome/browser/chromeos/net/proxy_config_handler.h"
173 #include "chrome/browser/chromeos/platform_keys/key_permissions.h"
174 #include "chrome/browser/chromeos/policy/auto_enrollment_client.h"
175 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
176 #include "chrome/browser/chromeos/policy/consumer_management_service.h"
177 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
178 #include "chrome/browser/chromeos/policy/device_status_collector.h"
179 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
180 #include "chrome/browser/chromeos/power/power_prefs.h"
181 #include "chrome/browser/chromeos/preferences.h"
182 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
183 #include "chrome/browser/chromeos/settings/device_settings_cache.h"
184 #include "chrome/browser/chromeos/status/data_promo_notification.h"
185 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h"
186 #include "chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h"
187 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h"
188 #include "chrome/browser/media/protected_media_identifier_permission_context.h"
189 #include "chrome/browser/metrics/chromeos_metrics_provider.h"
190 #include "chrome/browser/ui/webui/chromeos/login/demo_mode_detector.h"
191 #include "chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h"
192 #include "chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h"
193 #include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h"
194 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
195 #include "chromeos/audio/audio_devices_pref_handler_impl.h"
196 #include "chromeos/timezone/timezone_resolver.h"
197 #include "components/invalidation/impl/invalidator_storage.h"
198 #else
199 #include "chrome/browser/extensions/default_apps.h"
200 #endif
202 #if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST)
203 #include "chrome/browser/ui/app_list/google_now_extension.h"
204 #endif
206 #if defined(OS_MACOSX)
207 #include "chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h"
208 #include "chrome/browser/ui/cocoa/confirm_quit.h"
209 #endif
211 #if defined(OS_WIN)
212 #include "chrome/browser/apps/app_launch_for_metro_restart_win.h"
213 #include "chrome/browser/component_updater/sw_reporter_installer_win.h"
214 #endif
216 #if defined(TOOLKIT_VIEWS)
217 #include "chrome/browser/ui/browser_view_prefs.h"
218 #endif
220 #if defined(USE_ASH)
221 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
222 #endif
224 namespace {
226 #if !defined(OS_ANDROID)
227 // The AutomaticProfileResetter service used this preference to save that the
228 // profile reset prompt had already been shown, however, the preference has been
229 // renamed in Local State. We keep the name here for now so that we can clear
230 // out legacy values.
231 // TODO(engedy): Remove this and usages in M42 or later. See crbug.com/398813.
232 const char kLegacyProfileResetPromptMemento[] = "profile.reset_prompt_memento";
233 #endif
235 } // namespace
237 namespace chrome {
239 void RegisterLocalState(PrefRegistrySimple* registry) {
241 // Please keep this list alphabetized.
242 AppListService::RegisterPrefs(registry);
243 browser_shutdown::RegisterPrefs(registry);
244 BrowserProcessImpl::RegisterPrefs(registry);
245 ChromeMetricsServiceClient::RegisterPrefs(registry);
246 ChromeTracingDelegate::RegisterPrefs(registry);
247 chrome_prefs::RegisterPrefs(registry);
248 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 rappor::RapporService::RegisterPrefs(registry);
263 RegisterScreenshotPrefs(registry);
264 SigninManagerFactory::RegisterPrefs(registry);
265 SSLConfigServiceManager::RegisterPrefs(registry);
266 UpgradeDetector::RegisterPrefs(registry);
267 web_resource::PromoResourceService::RegisterPrefs(registry);
269 #if defined(ENABLE_AUTOFILL_DIALOG)
270 autofill::AutofillDialogController::RegisterPrefs(registry);
271 #endif
273 #if defined(ENABLE_CONFIGURATION_POLICY)
274 policy::BrowserPolicyConnector::RegisterPrefs(registry);
275 policy::PolicyStatisticsCollector::RegisterPrefs(registry);
276 #endif
278 #if defined(ENABLE_EXTENSIONS)
279 EasyUnlockService::RegisterPrefs(registry);
280 #endif
282 #if defined(ENABLE_NOTIFICATIONS) && !defined(OS_ANDROID)
283 // Android does not use the message center for notifications.
284 MessageCenterNotificationManager::RegisterPrefs(registry);
285 #endif
287 #if defined(ENABLE_PLUGINS)
288 PluginFinder::RegisterPrefs(registry);
289 #endif
291 #if defined(ENABLE_PLUGIN_INSTALLATION)
292 PluginsResourceService::RegisterPrefs(registry);
293 #endif
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 StartupBrowserCreator::RegisterLocalStatePrefs(registry);
304 // The native GCM is used on Android instead.
305 gcm::GCMChannelStatusSyncer::RegisterPrefs(registry);
306 #if !defined(OS_CHROMEOS)
307 RegisterDefaultBrowserPromptPrefs(registry);
308 #endif // !defined(OS_CHROMEOS)
309 #endif // !defined(OS_ANDROID)
311 #if defined(OS_CHROMEOS)
312 ChromeOSMetricsProvider::RegisterPrefs(registry);
313 chromeos::AudioDevicesPrefHandlerImpl::RegisterPrefs(registry);
314 chromeos::ChromeUserManagerImpl::RegisterPrefs(registry);
315 chromeos::DataPromoNotification::RegisterPrefs(registry);
316 chromeos::DeviceOAuth2TokenService::RegisterPrefs(registry);
317 chromeos::device_settings_cache::RegisterPrefs(registry);
318 chromeos::EnableDebuggingScreenHandler::RegisterPrefs(registry);
319 chromeos::language_prefs::RegisterPrefs(registry);
320 chromeos::KioskAppManager::RegisterPrefs(registry);
321 chromeos::MultiProfileUserController::RegisterPrefs(registry);
322 chromeos::HIDDetectionScreenHandler::RegisterPrefs(registry);
323 chromeos::DemoModeDetector::RegisterPrefs(registry);
324 chromeos::Preferences::RegisterPrefs(registry);
325 chromeos::proxy_config::RegisterPrefs(registry);
326 chromeos::RegisterDisplayLocalStatePrefs(registry);
327 chromeos::ResetScreenHandler::RegisterPrefs(registry);
328 chromeos::ServicesCustomizationDocument::RegisterPrefs(registry);
329 chromeos::SigninScreenHandler::RegisterPrefs(registry);
330 chromeos::StartupUtils::RegisterPrefs(registry);
331 chromeos::system::AutomaticRebootManager::RegisterPrefs(registry);
332 chromeos::UserImageManager::RegisterPrefs(registry);
333 chromeos::UserSessionManager::RegisterPrefs(registry);
334 chromeos::WallpaperManager::RegisterPrefs(registry);
335 chromeos::echo_offer::RegisterPrefs(registry);
336 extensions::ExtensionAssetsManagerChromeOS::RegisterPrefs(registry);
337 invalidation::InvalidatorStorage::RegisterPrefs(registry);
338 policy::AutoEnrollmentClient::RegisterPrefs(registry);
339 policy::BrowserPolicyConnectorChromeOS::RegisterPrefs(registry);
340 policy::ConsumerManagementService::RegisterPrefs(registry);
341 policy::DeviceCloudPolicyManagerChromeOS::RegisterPrefs(registry);
342 policy::DeviceStatusCollector::RegisterPrefs(registry);
343 policy::PolicyCertServiceFactory::RegisterPrefs(registry);
344 chromeos::TimeZoneResolver::RegisterPrefs(registry);
345 #endif
347 #if defined(OS_MACOSX)
348 confirm_quit::RegisterLocalState(registry);
349 QuitWithAppsController::RegisterPrefs(registry);
350 #endif
352 #if defined(OS_WIN)
353 app_metro_launch::RegisterPrefs(registry);
354 component_updater::RegisterPrefsForSwReporter(registry);
355 password_manager::PasswordManager::RegisterLocalPrefs(registry);
356 #endif
358 #if defined(TOOLKIT_VIEWS)
359 RegisterBrowserViewLocalPrefs(registry);
360 #endif
362 // Preferences registered only for migration (clearing or moving to a new key)
363 // go here.
364 #if !defined(OS_ANDROID)
365 registry->RegisterDictionaryPref(kLegacyProfileResetPromptMemento);
366 #endif // !defined(OS_ANDROID)
369 // Register prefs applicable to all profiles.
370 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
371 TRACE_EVENT0("browser", "chrome::RegisterProfilePrefs");
372 SCOPED_UMA_HISTOGRAM_TIMER("Settings.RegisterProfilePrefsTime");
373 // User prefs. Please keep this list alphabetized.
374 autofill::AutofillManager::RegisterProfilePrefs(registry);
375 sync_driver::SyncPrefs::RegisterProfilePrefs(registry);
376 ChromeContentBrowserClient::RegisterProfilePrefs(registry);
377 ChromeVersionService::RegisterProfilePrefs(registry);
378 chrome_browser_net::HttpServerPropertiesManagerFactory::RegisterProfilePrefs(
379 registry);
380 chrome_browser_net::Predictor::RegisterProfilePrefs(registry);
381 chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry);
382 chrome_prefs::RegisterProfilePrefs(registry);
383 dom_distiller::DistilledPagePrefs::RegisterProfilePrefs(registry);
384 DownloadPrefs::RegisterProfilePrefs(registry);
385 enhanced_bookmarks::BookmarkServerClusterService::RegisterPrefs(registry);
386 PushMessagingServiceImpl::RegisterProfilePrefs(registry);
387 HostContentSettingsMap::RegisterProfilePrefs(registry);
388 IncognitoModePrefs::RegisterProfilePrefs(registry);
389 InstantUI::RegisterProfilePrefs(registry);
390 NavigationCorrectionTabObserver::RegisterProfilePrefs(registry);
391 MediaCaptureDevicesDispatcher::RegisterProfilePrefs(registry);
392 MediaDeviceIDSalt::RegisterProfilePrefs(registry);
393 MediaStreamDevicesController::RegisterProfilePrefs(registry);
394 NetPrefObserver::RegisterProfilePrefs(registry);
395 password_bubble_experiment::RegisterPrefs(registry);
396 password_manager::PasswordManager::RegisterProfilePrefs(registry);
397 PrefProxyConfigTrackerImpl::RegisterProfilePrefs(registry);
398 PrefsTabHelper::RegisterProfilePrefs(registry);
399 Profile::RegisterProfilePrefs(registry);
400 ProfileImpl::RegisterProfilePrefs(registry);
401 ProtocolHandlerRegistry::RegisterProfilePrefs(registry);
402 RegisterBrowserUserPrefs(registry);
403 SessionStartupPref::RegisterProfilePrefs(registry);
404 TemplateURLPrepopulateData::RegisterProfilePrefs(registry);
405 translate::TranslatePrefs::RegisterProfilePrefs(registry);
406 web_resource::PromoResourceService::RegisterProfilePrefs(registry);
407 ZeroSuggestProvider::RegisterProfilePrefs(registry);
409 #if defined(ENABLE_APP_LIST)
410 app_list::AppListPrefs::RegisterProfilePrefs(registry);
411 #endif
413 #if defined(ENABLE_AUTOFILL_DIALOG)
414 autofill::AutofillDialogController::RegisterProfilePrefs(registry);
415 #endif
417 #if defined(ENABLE_CONFIGURATION_POLICY)
418 policy::URLBlacklistManager::RegisterProfilePrefs(registry);
419 #endif
421 #if defined(ENABLE_EXTENSIONS)
422 EasyUnlockService::RegisterProfilePrefs(registry);
423 extensions::ActivityLog::RegisterProfilePrefs(registry);
424 extensions::launch_util::RegisterProfilePrefs(registry);
425 ExtensionWebUI::RegisterProfilePrefs(registry);
426 extensions::ExtensionPrefs::RegisterProfilePrefs(registry);
427 #if !defined(OS_ANDROID) && !defined(OS_IOS)
428 ToolbarActionsBar::RegisterProfilePrefs(registry);
429 extensions::CopresenceService::RegisterProfilePrefs(registry);
430 #endif
431 RegisterAnimationPolicyPrefs(registry);
432 #endif // defined(ENABLE_EXTENSIONS)
434 #if defined(ENABLE_NOTIFICATIONS)
435 NotifierStateTracker::RegisterProfilePrefs(registry);
436 #endif
438 #if defined(ENABLE_NOTIFICATIONS) && defined(ENABLE_EXTENSIONS) && \
439 !defined(OS_ANDROID)
440 // The extension welcome notification requires a build that enables extensions
441 // and notifications, and uses the UI message center.
442 ExtensionWelcomeNotification::RegisterProfilePrefs(registry);
443 #endif
445 #if defined(ENABLE_PLUGINS)
446 PluginsUI::RegisterProfilePrefs(registry);
447 #endif
449 #if defined(ENABLE_PRINT_PREVIEW)
450 printing::StickySettings::RegisterProfilePrefs(registry);
451 #endif
453 #if defined(ENABLE_SERVICE_DISCOVERY)
454 LocalDiscoveryUI::RegisterProfilePrefs(registry);
455 #endif
457 #if defined(ENABLE_SUPERVISED_USERS)
458 #if !defined(OS_ANDROID) && !defined(OS_IOS)
459 SupervisedUserSharedSettingsService::RegisterProfilePrefs(registry);
460 SupervisedUserSyncService::RegisterProfilePrefs(registry);
461 #endif
462 ChildAccountService::RegisterProfilePrefs(registry);
463 SupervisedUserService::RegisterProfilePrefs(registry);
464 SupervisedUserWhitelistService::RegisterProfilePrefs(registry);
465 #endif
467 #if defined(OS_ANDROID)
468 variations::VariationsService::RegisterProfilePrefs(registry);
469 NewTabPagePrefs::RegisterProfilePrefs(registry);
470 PartnerBookmarksShim::RegisterProfilePrefs(registry);
471 #else
472 AppShortcutManager::RegisterProfilePrefs(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 RegisterAutolaunchUserPrefs(registry);
485 signin::RegisterProfilePrefs(registry);
486 #endif
488 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
489 default_apps::RegisterProfilePrefs(registry);
490 #endif
492 #if defined(OS_CHROMEOS)
493 chromeos::first_run::RegisterProfilePrefs(registry);
494 chromeos::file_system_provider::RegisterProfilePrefs(registry);
495 chromeos::KeyPermissions::RegisterProfilePrefs(registry);
496 chromeos::MultiProfileUserController::RegisterProfilePrefs(registry);
497 chromeos::Preferences::RegisterProfilePrefs(registry);
498 chromeos::proxy_config::RegisterProfilePrefs(registry);
499 chromeos::SAMLOfflineSigninLimiter::RegisterProfilePrefs(registry);
500 chromeos::ServicesCustomizationDocument::RegisterProfilePrefs(registry);
501 chromeos::UserImageSyncObserver::RegisterProfilePrefs(registry);
502 extensions::EnterprisePlatformKeysPrivateChallengeUserKeyFunction::
503 RegisterProfilePrefs(registry);
504 FlagsUI::RegisterProfilePrefs(registry);
505 #endif
507 #if defined(OS_WIN)
508 component_updater::RegisterProfilePrefsForSwReporter(registry);
509 NetworkProfileBubble::RegisterProfilePrefs(registry);
510 #endif
512 #if defined(TOOLKIT_VIEWS)
513 RegisterBrowserViewProfilePrefs(registry);
514 RegisterInvertBubbleUserPrefs(registry);
515 #endif
517 #if defined(USE_ASH)
518 ash::RegisterChromeLauncherUserPrefs(registry);
519 #endif
521 #if !defined(OS_ANDROID) && !defined(OS_IOS)
522 browser_sync::ForeignSessionHandler::RegisterProfilePrefs(registry);
523 #endif
526 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
527 RegisterProfilePrefs(registry);
529 #if defined(OS_CHROMEOS)
530 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry);
531 #endif
534 void RegisterScreenshotPrefs(PrefRegistrySimple* registry) {
535 registry->RegisterBooleanPref(prefs::kDisableScreenshots, false);
538 #if defined(OS_CHROMEOS)
539 void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
540 RegisterProfilePrefs(registry);
542 chromeos::PowerPrefs::RegisterLoginProfilePrefs(registry);
544 #endif
546 // This method should be periodically pruned of year+ old migrations.
547 void MigrateObsoleteBrowserPrefs(Profile* profile, PrefService* local_state) {
548 #if defined(TOOLKIT_VIEWS)
549 // Added 05/2014.
550 MigrateBrowserTabStripPrefs(local_state);
551 #endif
553 #if !defined(OS_ANDROID)
554 // Added 08/2014.
555 local_state->ClearPref(kLegacyProfileResetPromptMemento);
556 #endif
559 // This method should be periodically pruned of year+ old migrations.
560 void MigrateObsoleteProfilePrefs(Profile* profile) {
561 PrefService* profile_prefs = profile->GetPrefs();
563 // Added 07/2014.
564 translate::TranslatePrefs::MigrateUserPrefs(profile_prefs,
565 prefs::kAcceptLanguages);
567 #if !defined(OS_ANDROID)
568 // Added 08/2014.
569 // Migrate kNetworkPredictionEnabled to kNetworkPredictionOptions when not on
570 // Android. On Android, platform-specific code performs preference migration.
571 // TODO(bnc): https://crbug.com/401970 Remove migration code one year after
572 // M38.
573 chrome_browser_net::MigrateNetworkPredictionUserPrefs(profile_prefs);
574 #endif
576 #if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST)
577 // Added 02/2015.
578 MigrateGoogleNowPrefs(profile);
579 #endif
582 } // namespace chrome