Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / browser / prefs / browser_prefs.cc
blob734836b7d7899400abc1bf807ff1d5a147353306
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/most_visited_sites.h"
147 #include "chrome/browser/android/new_tab_page_prefs.h"
148 #else
149 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h"
150 #include "chrome/browser/ui/startup/startup_browser_creator.h"
151 #endif
153 #if !defined(OS_ANDROID) && !defined(OS_IOS)
154 #include "chrome/browser/signin/signin_promo.h"
155 #include "chrome/browser/ui/webui/foreign_session_handler.h"
156 #endif
158 #if defined(OS_CHROMEOS)
159 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
160 #include "chrome/browser/chromeos/customization/customization_document.h"
161 #include "chrome/browser/chromeos/display/display_preferences.h"
162 #include "chrome/browser/chromeos/extensions/echo_private_api.h"
163 #include "chrome/browser/chromeos/file_system_provider/registry.h"
164 #include "chrome/browser/chromeos/first_run/first_run.h"
165 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h"
166 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
167 #include "chrome/browser/chromeos/login/startup_utils.h"
168 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h"
169 #include "chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.h"
170 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h"
171 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
172 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
173 #include "chrome/browser/chromeos/net/proxy_config_handler.h"
174 #include "chrome/browser/chromeos/platform_keys/key_permissions.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/impl/invalidator_storage.h"
199 #else
200 #include "chrome/browser/extensions/default_apps.h"
201 #endif
203 #if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST)
204 #include "chrome/browser/ui/app_list/google_now_extension.h"
205 #endif
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"
210 #endif
212 #if defined(OS_WIN)
213 #include "chrome/browser/apps/app_launch_for_metro_restart_win.h"
214 #include "chrome/browser/component_updater/sw_reporter_installer_win.h"
215 #endif
217 #if defined(TOOLKIT_VIEWS)
218 #include "chrome/browser/ui/browser_view_prefs.h"
219 #endif
221 #if defined(USE_ASH)
222 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
223 #endif
225 namespace {
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";
234 #endif
236 } // namespace
238 namespace chrome {
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 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 ChromeTracingDelegate::RegisterPrefs(registry);
303 RegisterBrowserPrefs(registry);
304 StartupBrowserCreator::RegisterLocalStatePrefs(registry);
305 // The native GCM is used on Android instead.
306 gcm::GCMChannelStatusSyncer::RegisterPrefs(registry);
307 #if !defined(OS_CHROMEOS)
308 RegisterDefaultBrowserPromptPrefs(registry);
309 #endif // !defined(OS_CHROMEOS)
310 #endif // !defined(OS_ANDROID)
312 #if defined(OS_CHROMEOS)
313 ChromeOSMetricsProvider::RegisterPrefs(registry);
314 chromeos::AudioDevicesPrefHandlerImpl::RegisterPrefs(registry);
315 chromeos::ChromeUserManagerImpl::RegisterPrefs(registry);
316 chromeos::DataPromoNotification::RegisterPrefs(registry);
317 chromeos::DeviceOAuth2TokenService::RegisterPrefs(registry);
318 chromeos::device_settings_cache::RegisterPrefs(registry);
319 chromeos::EnableDebuggingScreenHandler::RegisterPrefs(registry);
320 chromeos::language_prefs::RegisterPrefs(registry);
321 chromeos::KioskAppManager::RegisterPrefs(registry);
322 chromeos::MultiProfileUserController::RegisterPrefs(registry);
323 chromeos::HIDDetectionScreenHandler::RegisterPrefs(registry);
324 chromeos::DemoModeDetector::RegisterPrefs(registry);
325 chromeos::Preferences::RegisterPrefs(registry);
326 chromeos::proxy_config::RegisterPrefs(registry);
327 chromeos::RegisterDisplayLocalStatePrefs(registry);
328 chromeos::ResetScreenHandler::RegisterPrefs(registry);
329 chromeos::ServicesCustomizationDocument::RegisterPrefs(registry);
330 chromeos::SigninScreenHandler::RegisterPrefs(registry);
331 chromeos::StartupUtils::RegisterPrefs(registry);
332 chromeos::system::AutomaticRebootManager::RegisterPrefs(registry);
333 chromeos::UserImageManager::RegisterPrefs(registry);
334 chromeos::UserSessionManager::RegisterPrefs(registry);
335 chromeos::WallpaperManager::RegisterPrefs(registry);
336 chromeos::echo_offer::RegisterPrefs(registry);
337 extensions::ExtensionAssetsManagerChromeOS::RegisterPrefs(registry);
338 invalidation::InvalidatorStorage::RegisterPrefs(registry);
339 policy::AutoEnrollmentClient::RegisterPrefs(registry);
340 policy::BrowserPolicyConnectorChromeOS::RegisterPrefs(registry);
341 policy::ConsumerManagementService::RegisterPrefs(registry);
342 policy::DeviceCloudPolicyManagerChromeOS::RegisterPrefs(registry);
343 policy::DeviceStatusCollector::RegisterPrefs(registry);
344 policy::PolicyCertServiceFactory::RegisterPrefs(registry);
345 chromeos::TimeZoneResolver::RegisterPrefs(registry);
346 #endif
348 #if defined(OS_MACOSX)
349 confirm_quit::RegisterLocalState(registry);
350 QuitWithAppsController::RegisterPrefs(registry);
351 #endif
353 #if defined(OS_WIN)
354 app_metro_launch::RegisterPrefs(registry);
355 component_updater::RegisterPrefsForSwReporter(registry);
356 password_manager::PasswordManager::RegisterLocalPrefs(registry);
357 #endif
359 #if defined(TOOLKIT_VIEWS)
360 RegisterBrowserViewLocalPrefs(registry);
361 #endif
363 // Preferences registered only for migration (clearing or moving to a new key)
364 // go here.
365 #if !defined(OS_ANDROID)
366 registry->RegisterDictionaryPref(kLegacyProfileResetPromptMemento);
367 #endif // !defined(OS_ANDROID)
370 // Register prefs applicable to all profiles.
371 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
372 TRACE_EVENT0("browser", "chrome::RegisterProfilePrefs");
373 SCOPED_UMA_HISTOGRAM_TIMER("Settings.RegisterProfilePrefsTime");
374 // User prefs. Please keep this list alphabetized.
375 autofill::AutofillManager::RegisterProfilePrefs(registry);
376 sync_driver::SyncPrefs::RegisterProfilePrefs(registry);
377 ChromeContentBrowserClient::RegisterProfilePrefs(registry);
378 ChromeVersionService::RegisterProfilePrefs(registry);
379 chrome_browser_net::HttpServerPropertiesManagerFactory::RegisterProfilePrefs(
380 registry);
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_bubble_experiment::RegisterPrefs(registry);
397 password_manager::PasswordManager::RegisterProfilePrefs(registry);
398 PrefProxyConfigTrackerImpl::RegisterProfilePrefs(registry);
399 PrefsTabHelper::RegisterProfilePrefs(registry);
400 Profile::RegisterProfilePrefs(registry);
401 ProfileImpl::RegisterProfilePrefs(registry);
402 ProtocolHandlerRegistry::RegisterProfilePrefs(registry);
403 RegisterBrowserUserPrefs(registry);
404 SessionStartupPref::RegisterProfilePrefs(registry);
405 TemplateURLPrepopulateData::RegisterProfilePrefs(registry);
406 translate::TranslatePrefs::RegisterProfilePrefs(registry);
407 web_resource::PromoResourceService::RegisterProfilePrefs(registry);
408 ZeroSuggestProvider::RegisterProfilePrefs(registry);
410 #if defined(ENABLE_APP_LIST)
411 app_list::AppListPrefs::RegisterProfilePrefs(registry);
412 #endif
414 #if defined(ENABLE_AUTOFILL_DIALOG)
415 autofill::AutofillDialogController::RegisterProfilePrefs(registry);
416 #endif
418 #if defined(ENABLE_CONFIGURATION_POLICY)
419 policy::URLBlacklistManager::RegisterProfilePrefs(registry);
420 #endif
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);
431 #endif
432 RegisterAnimationPolicyPrefs(registry);
433 #endif // defined(ENABLE_EXTENSIONS)
435 #if defined(ENABLE_NOTIFICATIONS)
436 NotifierStateTracker::RegisterProfilePrefs(registry);
437 #endif
439 #if defined(ENABLE_NOTIFICATIONS) && defined(ENABLE_EXTENSIONS) && \
440 !defined(OS_ANDROID)
441 // The extension welcome notification requires a build that enables extensions
442 // and notifications, and uses the UI message center.
443 ExtensionWelcomeNotification::RegisterProfilePrefs(registry);
444 #endif
446 #if defined(ENABLE_PLUGINS)
447 PluginsUI::RegisterProfilePrefs(registry);
448 #endif
450 #if defined(ENABLE_PRINT_PREVIEW)
451 printing::StickySettings::RegisterProfilePrefs(registry);
452 #endif
454 #if defined(ENABLE_SERVICE_DISCOVERY)
455 LocalDiscoveryUI::RegisterProfilePrefs(registry);
456 #endif
458 #if defined(ENABLE_SUPERVISED_USERS)
459 #if !defined(OS_ANDROID) && !defined(OS_IOS)
460 SupervisedUserSharedSettingsService::RegisterProfilePrefs(registry);
461 SupervisedUserSyncService::RegisterProfilePrefs(registry);
462 #endif
463 ChildAccountService::RegisterProfilePrefs(registry);
464 SupervisedUserService::RegisterProfilePrefs(registry);
465 SupervisedUserWhitelistService::RegisterProfilePrefs(registry);
466 #endif
468 #if defined(OS_ANDROID)
469 variations::VariationsService::RegisterProfilePrefs(registry);
470 MostVisitedSites::RegisterProfilePrefs(registry);
471 NewTabPagePrefs::RegisterProfilePrefs(registry);
472 PartnerBookmarksShim::RegisterProfilePrefs(registry);
473 #else
474 AppShortcutManager::RegisterProfilePrefs(registry);
475 DeviceIDFetcher::RegisterProfilePrefs(registry);
476 DevToolsWindow::RegisterProfilePrefs(registry);
477 DriveAppMapping::RegisterProfilePrefs(registry);
478 extensions::CommandService::RegisterProfilePrefs(registry);
479 extensions::ExtensionSettingsHandler::RegisterProfilePrefs(registry);
480 extensions::TabsCaptureVisibleTabFunction::RegisterProfilePrefs(registry);
481 first_run::RegisterProfilePrefs(registry);
482 gcm::GCMChannelStatusSyncer::RegisterProfilePrefs(registry);
483 NewTabUI::RegisterProfilePrefs(registry);
484 PepperFlashSettingsManager::RegisterProfilePrefs(registry);
485 PinnedTabCodec::RegisterProfilePrefs(registry);
486 RegisterAutolaunchUserPrefs(registry);
487 signin::RegisterProfilePrefs(registry);
488 #endif
490 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
491 default_apps::RegisterProfilePrefs(registry);
492 #endif
494 #if defined(OS_CHROMEOS)
495 chromeos::first_run::RegisterProfilePrefs(registry);
496 chromeos::file_system_provider::RegisterProfilePrefs(registry);
497 chromeos::KeyPermissions::RegisterProfilePrefs(registry);
498 chromeos::MultiProfileUserController::RegisterProfilePrefs(registry);
499 chromeos::Preferences::RegisterProfilePrefs(registry);
500 chromeos::proxy_config::RegisterProfilePrefs(registry);
501 chromeos::SAMLOfflineSigninLimiter::RegisterProfilePrefs(registry);
502 chromeos::ServicesCustomizationDocument::RegisterProfilePrefs(registry);
503 chromeos::UserImageSyncObserver::RegisterProfilePrefs(registry);
504 extensions::EnterprisePlatformKeysPrivateChallengeUserKeyFunction::
505 RegisterProfilePrefs(registry);
506 FlagsUI::RegisterProfilePrefs(registry);
507 #endif
509 #if defined(OS_WIN)
510 component_updater::RegisterProfilePrefsForSwReporter(registry);
511 NetworkProfileBubble::RegisterProfilePrefs(registry);
512 #endif
514 #if defined(TOOLKIT_VIEWS)
515 RegisterBrowserViewProfilePrefs(registry);
516 RegisterInvertBubbleUserPrefs(registry);
517 #endif
519 #if defined(USE_ASH)
520 ash::RegisterChromeLauncherUserPrefs(registry);
521 #endif
523 #if !defined(OS_ANDROID) && !defined(OS_IOS)
524 browser_sync::ForeignSessionHandler::RegisterProfilePrefs(registry);
525 #endif
528 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
529 RegisterProfilePrefs(registry);
531 #if defined(OS_CHROMEOS)
532 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry);
533 #endif
536 void RegisterScreenshotPrefs(PrefRegistrySimple* registry) {
537 registry->RegisterBooleanPref(prefs::kDisableScreenshots, false);
540 #if defined(OS_CHROMEOS)
541 void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
542 RegisterProfilePrefs(registry);
544 chromeos::PowerPrefs::RegisterLoginProfilePrefs(registry);
546 #endif
548 // This method should be periodically pruned of year+ old migrations.
549 void MigrateObsoleteBrowserPrefs(Profile* profile, PrefService* local_state) {
550 #if defined(TOOLKIT_VIEWS)
551 // Added 05/2014.
552 MigrateBrowserTabStripPrefs(local_state);
553 #endif
555 #if !defined(OS_ANDROID)
556 // Added 08/2014.
557 local_state->ClearPref(kLegacyProfileResetPromptMemento);
558 #endif
561 // This method should be periodically pruned of year+ old migrations.
562 void MigrateObsoleteProfilePrefs(Profile* profile) {
563 PrefService* profile_prefs = profile->GetPrefs();
565 // Added 07/2014.
566 translate::TranslatePrefs::MigrateUserPrefs(profile_prefs,
567 prefs::kAcceptLanguages);
569 #if !defined(OS_ANDROID)
570 // Added 08/2014.
571 // Migrate kNetworkPredictionEnabled to kNetworkPredictionOptions when not on
572 // Android. On Android, platform-specific code performs preference migration.
573 // TODO(bnc): https://crbug.com/401970 Remove migration code one year after
574 // M38.
575 chrome_browser_net::MigrateNetworkPredictionUserPrefs(profile_prefs);
576 #endif
578 #if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST)
579 // Added 02/2015.
580 MigrateGoogleNowPrefs(profile);
581 #endif
584 } // namespace chrome