// Copyright 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/prefs/browser_prefs.h" #include #include "base/metrics/histogram_macros.h" #include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service.h" #include "base/prefs/scoped_user_pref_update.h" #include "base/trace_event/trace_event.h" #include "chrome/browser/about_flags.h" #include "chrome/browser/accessibility/invert_bubble_prefs.h" #include "chrome/browser/browser_process_impl.h" #include "chrome/browser/browser_shutdown.h" #include "chrome/browser/chrome_content_browser_client.h" #include "chrome/browser/component_updater/recovery_component_installer.h" #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h" #include "chrome/browser/custom_handlers/protocol_handler_registry.h" #include "chrome/browser/devtools/devtools_window.h" #include "chrome/browser/download/download_prefs.h" #include "chrome/browser/external_protocol/external_protocol_handler.h" #include "chrome/browser/first_run/first_run.h" #include "chrome/browser/geolocation/geolocation_prefs.h" #include "chrome/browser/gpu/gl_string_manager.h" #include "chrome/browser/gpu/gpu_mode_manager.h" #include "chrome/browser/intranet_redirect_detector.h" #include "chrome/browser/io_thread.h" #include "chrome/browser/media/media_capture_devices_dispatcher.h" #include "chrome/browser/media/media_device_id_salt.h" #include "chrome/browser/media/media_stream_devices_controller.h" #include "chrome/browser/metrics/chrome_metrics_service_client.h" #include "chrome/browser/metrics/variations/variations_service.h" #include "chrome/browser/net/http_server_properties_manager_factory.h" #include "chrome/browser/net/net_pref_observer.h" #include "chrome/browser/net/prediction_options.h" #include "chrome/browser/net/predictor.h" #include "chrome/browser/net/pref_proxy_config_tracker_impl.h" #include "chrome/browser/net/ssl_config_service_manager.h" #include "chrome/browser/notifications/extension_welcome_notification.h" #include "chrome/browser/notifications/message_center_notification_manager.h" #include "chrome/browser/notifications/notifier_state_tracker.h" #include "chrome/browser/pepper_flash_settings_manager.h" #include "chrome/browser/plugins/plugin_finder.h" #include "chrome/browser/prefs/chrome_pref_service_factory.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/browser/profiles/chrome_version_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_impl.h" #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profiles_state.h" #include "chrome/browser/push_messaging/push_messaging_service_impl.h" #include "chrome/browser/renderer_host/pepper/device_id_fetcher.h" #include "chrome/browser/search/search.h" #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/task_manager/task_manager.h" #include "chrome/browser/tracing/chrome_tracing_delegate.h" #include "chrome/browser/ui/app_list/app_list_prefs.h" #include "chrome/browser/ui/app_list/app_list_service.h" #include "chrome/browser/ui/browser_ui_prefs.h" #include "chrome/browser/ui/navigation_correction_tab_observer.h" #include "chrome/browser/ui/network_profile_bubble.h" #include "chrome/browser/ui/prefs/prefs_tab_helper.h" #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" #include "chrome/browser/ui/startup/autolaunch_prompt.h" #include "chrome/browser/ui/startup/default_browser_prompt.h" #include "chrome/browser/ui/tabs/pinned_tab_codec.h" #include "chrome/browser/ui/webui/flags_ui.h" #include "chrome/browser/ui/webui/instant_ui.h" #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" #include "chrome/browser/ui/webui/plugins_ui.h" #include "chrome/browser/ui/webui/print_preview/sticky_settings.h" #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" #include "chrome/browser/upgrade_detector.h" #include "chrome/browser/web_resource/promo_resource_service.h" #include "chrome/common/pref_names.h" #include "components/autofill/core/browser/autofill_manager.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/dom_distiller/core/distilled_page_prefs.h" #include "components/enhanced_bookmarks/bookmark_server_cluster_service.h" #include "components/gcm_driver/gcm_channel_status_syncer.h" #include "components/network_time/network_time_tracker.h" #include "components/omnibox/browser/zero_suggest_provider.h" #include "components/password_manager/core/browser/password_manager.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/rappor/rappor_service.h" #include "components/search_engines/template_url_prepopulate_data.h" #include "components/sync_driver/sync_prefs.h" #include "components/translate/core/browser/translate_prefs.h" #include "content/public/browser/render_process_host.h" #include "net/http/http_server_properties_manager.h" #if defined(ENABLE_AUTOFILL_DIALOG) #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" #endif #if defined(ENABLE_BACKGROUND) #include "chrome/browser/background/background_mode_manager.h" #endif #if defined(ENABLE_CONFIGURATION_POLICY) #include "components/policy/core/browser/browser_policy_connector.h" #include "components/policy/core/browser/url_blacklist_manager.h" #include "components/policy/core/common/policy_statistics_collector.h" #endif #if defined(ENABLE_EXTENSIONS) #include "chrome/browser/accessibility/animation_policy_prefs.h" #include "chrome/browser/apps/drive/drive_app_mapping.h" #include "chrome/browser/apps/shortcut_manager.h" #include "chrome/browser/extensions/activity_log/activity_log.h" #include "chrome/browser/extensions/api/commands/command_service.h" #include "chrome/browser/extensions/api/tabs/tabs_api.h" #include "chrome/browser/extensions/extension_web_ui.h" #include "chrome/browser/extensions/launch_util.h" #include "chrome/browser/signin/easy_unlock_service.h" #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" #include "extensions/browser/extension_prefs.h" #if !defined(OS_ANDROID) && !defined(OS_IOS) #include "chrome/browser/extensions/api/copresence/copresence_api.h" #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" #endif #endif // defined(ENABLE_EXTENSIONS) #if defined(ENABLE_PLUGIN_INSTALLATION) #include "chrome/browser/plugins/plugins_resource_service.h" #endif #if defined(ENABLE_SUPERVISED_USERS) #include "chrome/browser/supervised_user/child_accounts/child_account_service.h" #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_service.h" #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service.h" #include "chrome/browser/supervised_user/supervised_user_service.h" #include "chrome/browser/supervised_user/supervised_user_whitelist_service.h" #endif #if defined(ENABLE_SERVICE_DISCOVERY) #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui.h" #endif #if defined(OS_ANDROID) #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" #include "chrome/browser/android/new_tab_page_prefs.h" #else #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" #include "chrome/browser/ui/startup/startup_browser_creator.h" #endif #if !defined(OS_ANDROID) && !defined(OS_IOS) #include "chrome/browser/signin/signin_promo.h" #include "chrome/browser/ui/webui/foreign_session_handler.h" #endif #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" #include "chrome/browser/chromeos/customization/customization_document.h" #include "chrome/browser/chromeos/display/display_preferences.h" #include "chrome/browser/chromeos/extensions/echo_private_api.h" #include "chrome/browser/chromeos/file_system_provider/registry.h" #include "chrome/browser/chromeos/first_run/first_run.h" #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h" #include "chrome/browser/chromeos/login/session/user_session_manager.h" #include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" #include "chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.h" #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" #include "chrome/browser/chromeos/net/proxy_config_handler.h" #include "chrome/browser/chromeos/platform_keys/key_permissions.h" #include "chrome/browser/chromeos/policy/auto_enrollment_client.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/consumer_management_service.h" #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" #include "chrome/browser/chromeos/policy/device_status_collector.h" #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" #include "chrome/browser/chromeos/power/power_prefs.h" #include "chrome/browser/chromeos/preferences.h" #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" #include "chrome/browser/chromeos/settings/device_settings_cache.h" #include "chrome/browser/chromeos/status/data_promo_notification.h" #include "chrome/browser/chromeos/system/automatic_reboot_manager.h" #include "chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h" #include "chrome/browser/extensions/extension_assets_manager_chromeos.h" #include "chrome/browser/media/protected_media_identifier_permission_context.h" #include "chrome/browser/metrics/chromeos_metrics_provider.h" #include "chrome/browser/ui/webui/chromeos/login/demo_mode_detector.h" #include "chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" #include "chromeos/audio/audio_devices_pref_handler_impl.h" #include "chromeos/timezone/timezone_resolver.h" #include "components/invalidation/impl/invalidator_storage.h" #else #include "chrome/browser/extensions/default_apps.h" #endif #if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST) #include "chrome/browser/ui/app_list/google_now_extension.h" #endif #if defined(OS_MACOSX) #include "chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h" #include "chrome/browser/ui/cocoa/confirm_quit.h" #endif #if defined(OS_WIN) #include "chrome/browser/apps/app_launch_for_metro_restart_win.h" #include "chrome/browser/component_updater/sw_reporter_installer_win.h" #endif #if defined(TOOLKIT_VIEWS) #include "chrome/browser/ui/browser_view_prefs.h" #endif #if defined(USE_ASH) #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" #endif namespace { #if !defined(OS_ANDROID) // The AutomaticProfileResetter service used this preference to save that the // profile reset prompt had already been shown, however, the preference has been // renamed in Local State. We keep the name here for now so that we can clear // out legacy values. // TODO(engedy): Remove this and usages in M42 or later. See crbug.com/398813. const char kLegacyProfileResetPromptMemento[] = "profile.reset_prompt_memento"; #endif } // namespace namespace chrome { void RegisterLocalState(PrefRegistrySimple* registry) { // Please keep this list alphabetized. AppListService::RegisterPrefs(registry); browser_shutdown::RegisterPrefs(registry); BrowserProcessImpl::RegisterPrefs(registry); ChromeMetricsServiceClient::RegisterPrefs(registry); ChromeTracingDelegate::RegisterPrefs(registry); chrome_prefs::RegisterPrefs(registry); chrome_variations::VariationsService::RegisterPrefs(registry); component_updater::RegisterPrefsForRecoveryComponent(registry); component_updater::SupervisedUserWhitelistInstaller::RegisterPrefs(registry); ExternalProtocolHandler::RegisterPrefs(registry); FlagsUI::RegisterPrefs(registry); geolocation::RegisterPrefs(registry); GLStringManager::RegisterPrefs(registry); GpuModeManager::RegisterPrefs(registry); IntranetRedirectDetector::RegisterPrefs(registry); IOThread::RegisterPrefs(registry); network_time::NetworkTimeTracker::RegisterPrefs(registry); PrefProxyConfigTrackerImpl::RegisterPrefs(registry); ProfileInfoCache::RegisterPrefs(registry); profiles::RegisterPrefs(registry); PromoResourceService::RegisterPrefs(registry); rappor::RapporService::RegisterPrefs(registry); RegisterScreenshotPrefs(registry); SigninManagerFactory::RegisterPrefs(registry); SSLConfigServiceManager::RegisterPrefs(registry); UpgradeDetector::RegisterPrefs(registry); #if defined(ENABLE_AUTOFILL_DIALOG) autofill::AutofillDialogController::RegisterPrefs(registry); #endif #if defined(ENABLE_CONFIGURATION_POLICY) policy::BrowserPolicyConnector::RegisterPrefs(registry); policy::PolicyStatisticsCollector::RegisterPrefs(registry); #endif #if defined(ENABLE_EXTENSIONS) EasyUnlockService::RegisterPrefs(registry); #endif #if defined(ENABLE_NOTIFICATIONS) && !defined(OS_ANDROID) // Android does not use the message center for notifications. MessageCenterNotificationManager::RegisterPrefs(registry); #endif #if defined(ENABLE_PLUGINS) PluginFinder::RegisterPrefs(registry); #endif #if defined(ENABLE_PLUGIN_INSTALLATION) PluginsResourceService::RegisterPrefs(registry); #endif #if defined(ENABLE_TASK_MANAGER) TaskManager::RegisterPrefs(registry); #endif // defined(ENABLE_TASK_MANAGER) #if !defined(OS_ANDROID) AutomaticProfileResetterFactory::RegisterPrefs(registry); BackgroundModeManager::RegisterPrefs(registry); RegisterBrowserPrefs(registry); StartupBrowserCreator::RegisterLocalStatePrefs(registry); // The native GCM is used on Android instead. gcm::GCMChannelStatusSyncer::RegisterPrefs(registry); #if !defined(OS_CHROMEOS) RegisterDefaultBrowserPromptPrefs(registry); #endif // !defined(OS_CHROMEOS) #endif // !defined(OS_ANDROID) #if defined(OS_CHROMEOS) ChromeOSMetricsProvider::RegisterPrefs(registry); chromeos::AudioDevicesPrefHandlerImpl::RegisterPrefs(registry); chromeos::ChromeUserManagerImpl::RegisterPrefs(registry); chromeos::DataPromoNotification::RegisterPrefs(registry); chromeos::DeviceOAuth2TokenService::RegisterPrefs(registry); chromeos::device_settings_cache::RegisterPrefs(registry); chromeos::EnableDebuggingScreenHandler::RegisterPrefs(registry); chromeos::language_prefs::RegisterPrefs(registry); chromeos::KioskAppManager::RegisterPrefs(registry); chromeos::MultiProfileUserController::RegisterPrefs(registry); chromeos::HIDDetectionScreenHandler::RegisterPrefs(registry); chromeos::DemoModeDetector::RegisterPrefs(registry); chromeos::Preferences::RegisterPrefs(registry); chromeos::proxy_config::RegisterPrefs(registry); chromeos::RegisterDisplayLocalStatePrefs(registry); chromeos::ResetScreenHandler::RegisterPrefs(registry); chromeos::ServicesCustomizationDocument::RegisterPrefs(registry); chromeos::SigninScreenHandler::RegisterPrefs(registry); chromeos::StartupUtils::RegisterPrefs(registry); chromeos::system::AutomaticRebootManager::RegisterPrefs(registry); chromeos::UserImageManager::RegisterPrefs(registry); chromeos::UserSessionManager::RegisterPrefs(registry); chromeos::WallpaperManager::RegisterPrefs(registry); chromeos::echo_offer::RegisterPrefs(registry); extensions::ExtensionAssetsManagerChromeOS::RegisterPrefs(registry); invalidation::InvalidatorStorage::RegisterPrefs(registry); policy::AutoEnrollmentClient::RegisterPrefs(registry); policy::BrowserPolicyConnectorChromeOS::RegisterPrefs(registry); policy::ConsumerManagementService::RegisterPrefs(registry); policy::DeviceCloudPolicyManagerChromeOS::RegisterPrefs(registry); policy::DeviceStatusCollector::RegisterPrefs(registry); policy::PolicyCertServiceFactory::RegisterPrefs(registry); chromeos::TimeZoneResolver::RegisterPrefs(registry); #endif #if defined(OS_MACOSX) confirm_quit::RegisterLocalState(registry); QuitWithAppsController::RegisterPrefs(registry); #endif #if defined(OS_WIN) app_metro_launch::RegisterPrefs(registry); component_updater::RegisterPrefsForSwReporter(registry); password_manager::PasswordManager::RegisterLocalPrefs(registry); #endif #if defined(TOOLKIT_VIEWS) RegisterBrowserViewLocalPrefs(registry); #endif // Preferences registered only for migration (clearing or moving to a new key) // go here. #if !defined(OS_ANDROID) registry->RegisterDictionaryPref(kLegacyProfileResetPromptMemento); #endif // !defined(OS_ANDROID) } // Register prefs applicable to all profiles. void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { TRACE_EVENT0("browser", "chrome::RegisterProfilePrefs"); SCOPED_UMA_HISTOGRAM_TIMER("Settings.RegisterProfilePrefsTime"); // User prefs. Please keep this list alphabetized. autofill::AutofillManager::RegisterProfilePrefs(registry); sync_driver::SyncPrefs::RegisterProfilePrefs(registry); ChromeContentBrowserClient::RegisterProfilePrefs(registry); ChromeVersionService::RegisterProfilePrefs(registry); chrome_browser_net::HttpServerPropertiesManagerFactory::RegisterProfilePrefs( registry); chrome_browser_net::Predictor::RegisterProfilePrefs(registry); chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry); chrome_prefs::RegisterProfilePrefs(registry); dom_distiller::DistilledPagePrefs::RegisterProfilePrefs(registry); DownloadPrefs::RegisterProfilePrefs(registry); enhanced_bookmarks::BookmarkServerClusterService::RegisterPrefs(registry); PushMessagingServiceImpl::RegisterProfilePrefs(registry); HostContentSettingsMap::RegisterProfilePrefs(registry); IncognitoModePrefs::RegisterProfilePrefs(registry); InstantUI::RegisterProfilePrefs(registry); NavigationCorrectionTabObserver::RegisterProfilePrefs(registry); MediaCaptureDevicesDispatcher::RegisterProfilePrefs(registry); MediaDeviceIDSalt::RegisterProfilePrefs(registry); MediaStreamDevicesController::RegisterProfilePrefs(registry); NetPrefObserver::RegisterProfilePrefs(registry); password_manager::PasswordManager::RegisterProfilePrefs(registry); PrefProxyConfigTrackerImpl::RegisterProfilePrefs(registry); PrefsTabHelper::RegisterProfilePrefs(registry); Profile::RegisterProfilePrefs(registry); ProfileImpl::RegisterProfilePrefs(registry); PromoResourceService::RegisterProfilePrefs(registry); ProtocolHandlerRegistry::RegisterProfilePrefs(registry); RegisterBrowserUserPrefs(registry); SessionStartupPref::RegisterProfilePrefs(registry); TemplateURLPrepopulateData::RegisterProfilePrefs(registry); translate::TranslatePrefs::RegisterProfilePrefs(registry); ZeroSuggestProvider::RegisterProfilePrefs(registry); #if defined(ENABLE_APP_LIST) app_list::AppListPrefs::RegisterProfilePrefs(registry); #endif #if defined(ENABLE_AUTOFILL_DIALOG) autofill::AutofillDialogController::RegisterProfilePrefs(registry); #endif #if defined(ENABLE_CONFIGURATION_POLICY) policy::URLBlacklistManager::RegisterProfilePrefs(registry); #endif #if defined(ENABLE_EXTENSIONS) EasyUnlockService::RegisterProfilePrefs(registry); extensions::ActivityLog::RegisterProfilePrefs(registry); extensions::launch_util::RegisterProfilePrefs(registry); ExtensionWebUI::RegisterProfilePrefs(registry); extensions::ExtensionPrefs::RegisterProfilePrefs(registry); #if !defined(OS_ANDROID) && !defined(OS_IOS) ToolbarActionsBar::RegisterProfilePrefs(registry); extensions::CopresenceService::RegisterProfilePrefs(registry); #endif RegisterAnimationPolicyPrefs(registry); #endif // defined(ENABLE_EXTENSIONS) #if defined(ENABLE_NOTIFICATIONS) NotifierStateTracker::RegisterProfilePrefs(registry); #endif #if defined(ENABLE_NOTIFICATIONS) && defined(ENABLE_EXTENSIONS) && \ !defined(OS_ANDROID) // The extension welcome notification requires a build that enables extensions // and notifications, and uses the UI message center. ExtensionWelcomeNotification::RegisterProfilePrefs(registry); #endif #if defined(ENABLE_PRINT_PREVIEW) printing::StickySettings::RegisterProfilePrefs(registry); #endif #if defined(ENABLE_SERVICE_DISCOVERY) LocalDiscoveryUI::RegisterProfilePrefs(registry); #endif #if defined(ENABLE_SUPERVISED_USERS) #if !defined(OS_ANDROID) && !defined(OS_IOS) SupervisedUserSharedSettingsService::RegisterProfilePrefs(registry); SupervisedUserSyncService::RegisterProfilePrefs(registry); #endif ChildAccountService::RegisterProfilePrefs(registry); SupervisedUserService::RegisterProfilePrefs(registry); SupervisedUserWhitelistService::RegisterProfilePrefs(registry); #endif #if defined(OS_ANDROID) chrome_variations::VariationsService::RegisterProfilePrefs(registry); NewTabPagePrefs::RegisterProfilePrefs(registry); PartnerBookmarksShim::RegisterProfilePrefs(registry); #else AppShortcutManager::RegisterProfilePrefs(registry); autofill::GeneratedCreditCardBubbleController::RegisterUserPrefs(registry); DeviceIDFetcher::RegisterProfilePrefs(registry); DevToolsWindow::RegisterProfilePrefs(registry); DriveAppMapping::RegisterProfilePrefs(registry); extensions::CommandService::RegisterProfilePrefs(registry); extensions::ExtensionSettingsHandler::RegisterProfilePrefs(registry); extensions::TabsCaptureVisibleTabFunction::RegisterProfilePrefs(registry); first_run::RegisterProfilePrefs(registry); gcm::GCMChannelStatusSyncer::RegisterProfilePrefs(registry); NewTabUI::RegisterProfilePrefs(registry); PepperFlashSettingsManager::RegisterProfilePrefs(registry); PinnedTabCodec::RegisterProfilePrefs(registry); PluginsUI::RegisterProfilePrefs(registry); RegisterAutolaunchUserPrefs(registry); signin::RegisterProfilePrefs(registry); #endif #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) default_apps::RegisterProfilePrefs(registry); #endif #if defined(OS_CHROMEOS) chromeos::first_run::RegisterProfilePrefs(registry); chromeos::file_system_provider::RegisterProfilePrefs(registry); chromeos::KeyPermissions::RegisterProfilePrefs(registry); chromeos::MultiProfileUserController::RegisterProfilePrefs(registry); chromeos::Preferences::RegisterProfilePrefs(registry); chromeos::proxy_config::RegisterProfilePrefs(registry); chromeos::SAMLOfflineSigninLimiter::RegisterProfilePrefs(registry); chromeos::ServicesCustomizationDocument::RegisterProfilePrefs(registry); chromeos::UserImageSyncObserver::RegisterProfilePrefs(registry); extensions::EnterprisePlatformKeysPrivateChallengeUserKeyFunction:: RegisterProfilePrefs(registry); FlagsUI::RegisterProfilePrefs(registry); #endif #if defined(OS_WIN) component_updater::RegisterProfilePrefsForSwReporter(registry); NetworkProfileBubble::RegisterProfilePrefs(registry); #endif #if defined(TOOLKIT_VIEWS) RegisterBrowserViewProfilePrefs(registry); RegisterInvertBubbleUserPrefs(registry); #endif #if defined(USE_ASH) ash::RegisterChromeLauncherUserPrefs(registry); #endif #if !defined(OS_ANDROID) && !defined(OS_IOS) browser_sync::ForeignSessionHandler::RegisterProfilePrefs(registry); #endif } void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { RegisterProfilePrefs(registry); #if defined(OS_CHROMEOS) chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); #endif } void RegisterScreenshotPrefs(PrefRegistrySimple* registry) { registry->RegisterBooleanPref(prefs::kDisableScreenshots, false); } #if defined(OS_CHROMEOS) void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { RegisterProfilePrefs(registry); chromeos::PowerPrefs::RegisterLoginProfilePrefs(registry); } #endif // This method should be periodically pruned of year+ old migrations. void MigrateObsoleteBrowserPrefs(Profile* profile, PrefService* local_state) { #if defined(TOOLKIT_VIEWS) // Added 05/2014. MigrateBrowserTabStripPrefs(local_state); #endif #if !defined(OS_ANDROID) // Added 08/2014. local_state->ClearPref(kLegacyProfileResetPromptMemento); #endif } // This method should be periodically pruned of year+ old migrations. void MigrateObsoleteProfilePrefs(Profile* profile) { PrefService* profile_prefs = profile->GetPrefs(); #if defined(OS_MACOSX) && !defined(OS_IOS) // Added 06/2014. autofill::AutofillManager::MigrateUserPrefs(profile_prefs); #endif // defined(OS_MACOSX) && !defined(OS_IOS) // Added 07/2014. translate::TranslatePrefs::MigrateUserPrefs(profile_prefs, prefs::kAcceptLanguages); #if !defined(OS_ANDROID) // Added 08/2014. // Migrate kNetworkPredictionEnabled to kNetworkPredictionOptions when not on // Android. On Android, platform-specific code performs preference migration. // TODO(bnc): https://crbug.com/401970 Remove migration code one year after // M38. chrome_browser_net::MigrateNetworkPredictionUserPrefs(profile_prefs); #endif #if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST) // Added 02/2015. MigrateGoogleNowPrefs(profile); #endif } // As part of the migration from per-profile to per-partition HostZoomMaps, // we need to detect if an existing per-profile set of preferences exist, and // if so convert them to be per-partition. We migrate any per-profile zoom // level prefs via zoom_level_prefs. // Code that updates zoom prefs in the profile prefs store has been removed, // so once we clear these values here, they should never get set again. // TODO(wjmaclean): Remove this migration machinery after histograms show // that an aceptable percentage of users have been migrated. // crbug.com/420643 void MigrateProfileZoomLevelPrefs(Profile* profile) { PrefService* prefs = profile->GetPrefs(); chrome::ChromeZoomLevelPrefs* zoom_level_prefs = profile->GetZoomLevelPrefs(); DCHECK(zoom_level_prefs); bool migrated = false; // Only migrate the default zoom level if it is not equal to the registered // default for the preference. const base::Value* per_profile_default_zoom_level_value = prefs->GetUserPrefValue(prefs::kDefaultZoomLevelDeprecated); if (per_profile_default_zoom_level_value) { if (per_profile_default_zoom_level_value->GetType() == base::Value::TYPE_DOUBLE) { double per_profile_default_zoom_level = 0.0; bool success = per_profile_default_zoom_level_value->GetAsDouble( &per_profile_default_zoom_level); DCHECK(success); zoom_level_prefs->SetDefaultZoomLevelPref(per_profile_default_zoom_level); } prefs->ClearPref(prefs::kDefaultZoomLevelDeprecated); migrated = true; } const base::DictionaryValue* host_zoom_dictionary = prefs->GetDictionary(prefs::kPerHostZoomLevelsDeprecated); // Collect stats on frequency with which migrations are occuring. This measure // is not perfect, since it will consider an un-migrated user with only // default value as being already migrated, but it will catch all non-trivial // migrations. migrated |= !host_zoom_dictionary->empty(); UMA_HISTOGRAM_BOOLEAN("Settings.ZoomLevelPreferencesMigrated", migrated); // Since |host_zoom_dictionary| is not partition-based, do not attempt to // sanitize it. zoom_level_prefs->ExtractPerHostZoomLevels( host_zoom_dictionary, false /* sanitize_partition_host_zoom_levels */); // We're done migrating the profile per-host zoom level values, so we clear // them all. DictionaryPrefUpdate host_zoom_dictionary_update( prefs, prefs::kPerHostZoomLevelsDeprecated); host_zoom_dictionary_update->Clear(); } } // namespace chrome