summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-06 02:45:47 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-06 02:45:47 +0000
commitb1de2c717ac103f2c66110510072ce4731e51015 (patch)
tree6ece76e06f3118052d1913774d49fa71b8802fb6 /chrome
parente659eb915610370c828a64ae2d82519cc10c60e7 (diff)
downloadchromium_src-b1de2c717ac103f2c66110510072ce4731e51015.zip
chromium_src-b1de2c717ac103f2c66110510072ce4731e51015.tar.gz
chromium_src-b1de2c717ac103f2c66110510072ce4731e51015.tar.bz2
Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple.
This is a step towards removing registration methods from PrefService and simplifying its class hierarchy. TBR=ben@chromium.org BUG=155525 Review URL: https://chromiumcodereview.appspot.com/11741003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180873 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/about_flags_unittest.cc3
-rw-r--r--chrome/browser/autofill/risk/fingerprint.cc2
-rw-r--r--chrome/browser/autofill/risk/fingerprint_browsertest.cc6
-rw-r--r--chrome/browser/background/background_mode_manager.cc11
-rw-r--r--chrome/browser/background/background_mode_manager.h4
-rw-r--r--chrome/browser/browser_process.h5
-rw-r--r--chrome/browser/browser_process_impl.cc72
-rw-r--r--chrome/browser/browser_process_impl.h8
-rw-r--r--chrome/browser/browser_shutdown.cc9
-rw-r--r--chrome/browser/browser_shutdown.h4
-rw-r--r--chrome/browser/chrome_browser_main.cc36
-rw-r--r--chrome/browser/chromeos/audio/audio_handler.cc27
-rw-r--r--chrome/browser/chromeos/audio/audio_handler.h4
-rw-r--r--chrome/browser/chromeos/customization_document.cc5
-rw-r--r--chrome/browser/chromeos/customization_document.h4
-rw-r--r--chrome/browser/chromeos/display/display_preferences.cc17
-rw-r--r--chrome/browser/chromeos/display/display_preferences.h4
-rw-r--r--chrome/browser/chromeos/display/display_preferences_unittest.cc2
-rw-r--r--chrome/browser/chromeos/language_preferences.cc8
-rw-r--r--chrome/browser/chromeos/language_preferences.h4
-rw-r--r--chrome/browser/chromeos/login/login_utils_browsertest.cc3
-rw-r--r--chrome/browser/chromeos/login/user_image_manager.h4
-rw-r--r--chrome/browser/chromeos/login/user_image_manager_impl.cc9
-rw-r--r--chrome/browser/chromeos/login/user_manager.h4
-rw-r--r--chrome/browser/chromeos/login/user_manager_impl.cc21
-rw-r--r--chrome/browser/chromeos/login/user_manager_unittest.cc6
-rw-r--r--chrome/browser/chromeos/login/wallpaper_manager.cc11
-rw-r--r--chrome/browser/chromeos/login/wallpaper_manager.h4
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.cc35
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.h4
-rw-r--r--chrome/browser/chromeos/power/session_length_limiter.cc7
-rw-r--r--chrome/browser/chromeos/power/session_length_limiter.h4
-rw-r--r--chrome/browser/chromeos/power/session_length_limiter_unittest.cc2
-rw-r--r--chrome/browser/chromeos/proxy_config_service_impl.cc5
-rw-r--r--chrome/browser/chromeos/proxy_config_service_impl.h2
-rw-r--r--chrome/browser/chromeos/proxy_config_service_impl_unittest.cc6
-rw-r--r--chrome/browser/chromeos/settings/device_settings_cache.cc5
-rw-r--r--chrome/browser/chromeos/settings/device_settings_cache.h4
-rw-r--r--chrome/browser/chromeos/status/data_promo_notification.cc5
-rw-r--r--chrome/browser/chromeos/status/data_promo_notification.h4
-rw-r--r--chrome/browser/component_updater/recovery_component_installer.cc9
-rw-r--r--chrome/browser/component_updater/recovery_component_installer.h4
-rw-r--r--chrome/browser/extensions/app_launcher.cc5
-rw-r--r--chrome/browser/extensions/app_launcher.h4
-rw-r--r--chrome/browser/extensions/component_loader_unittest.cc4
-rw-r--r--chrome/browser/external_protocol/external_protocol_handler.cc5
-rw-r--r--chrome/browser/external_protocol/external_protocol_handler.h4
-rw-r--r--chrome/browser/first_run/first_run.cc14
-rw-r--r--chrome/browser/geolocation/chrome_access_token_store.cc5
-rw-r--r--chrome/browser/geolocation/chrome_access_token_store.h4
-rw-r--r--chrome/browser/geolocation/geolocation_prefs.cc4
-rw-r--r--chrome/browser/geolocation/geolocation_prefs.h4
-rw-r--r--chrome/browser/gpu/gl_string_manager.cc11
-rw-r--r--chrome/browser/intranet_redirect_detector.cc7
-rw-r--r--chrome/browser/intranet_redirect_detector.h4
-rw-r--r--chrome/browser/io_thread.cc37
-rw-r--r--chrome/browser/io_thread.h6
-rw-r--r--chrome/browser/managed_mode/managed_mode.cc5
-rw-r--r--chrome/browser/managed_mode/managed_mode.h4
-rw-r--r--chrome/browser/metrics/metrics_log.cc5
-rw-r--r--chrome/browser/metrics/metrics_log.h4
-rw-r--r--chrome/browser/metrics/metrics_log_unittest.cc4
-rw-r--r--chrome/browser/metrics/metrics_service.cc88
-rw-r--r--chrome/browser/metrics/metrics_service.h4
-rw-r--r--chrome/browser/metrics/variations/variations_service.cc9
-rw-r--r--chrome/browser/metrics/variations/variations_service.h4
-rw-r--r--chrome/browser/metrics/variations/variations_service_unittest.cc4
-rw-r--r--chrome/browser/net/http_server_properties_manager_unittest.cc4
-rw-r--r--chrome/browser/net/pref_proxy_config_tracker_impl.cc6
-rw-r--r--chrome/browser/net/pref_proxy_config_tracker_impl.h4
-rw-r--r--chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc14
-rw-r--r--chrome/browser/net/ssl_config_service_manager.h4
-rw-r--r--chrome/browser/net/ssl_config_service_manager_pref.cc28
-rw-r--r--chrome/browser/net/ssl_config_service_manager_pref_unittest.cc19
-rw-r--r--chrome/browser/notifications/desktop_notifications_unittest.cc2
-rw-r--r--chrome/browser/notifications/notification_prefs_manager.cc12
-rw-r--r--chrome/browser/notifications/notification_prefs_manager.h5
-rw-r--r--chrome/browser/plugins/plugin_finder.cc5
-rw-r--r--chrome/browser/plugins/plugin_finder.h6
-rw-r--r--chrome/browser/policy/auto_enrollment_client.cc7
-rw-r--r--chrome/browser/policy/auto_enrollment_client.h4
-rw-r--r--chrome/browser/policy/browser_policy_connector.cc12
-rw-r--r--chrome/browser/policy/browser_policy_connector.h4
-rw-r--r--chrome/browser/policy/cloud_policy_core_unittest.cc2
-rw-r--r--chrome/browser/policy/device_cloud_policy_manager_chromeos_unittest.cc3
-rw-r--r--chrome/browser/policy/device_status_collector.cc11
-rw-r--r--chrome/browser/policy/device_status_collector.h4
-rw-r--r--chrome/browser/policy/device_status_collector_browsertest.cc2
-rw-r--r--chrome/browser/policy/policy_statistics_collector.cc5
-rw-r--r--chrome/browser/policy/policy_statistics_collector.h4
-rw-r--r--chrome/browser/policy/policy_statistics_collector_unittest.cc2
-rw-r--r--chrome/browser/policy/url_blacklist_manager_unittest.cc5
-rw-r--r--chrome/browser/policy/user_cloud_policy_manager_chromeos_unittest.cc3
-rw-r--r--chrome/browser/policy/user_policy_signin_service_unittest.cc2
-rw-r--r--chrome/browser/prefs/browser_prefs.cc121
-rw-r--r--chrome/browser/prefs/browser_prefs.h6
-rw-r--r--chrome/browser/prefs/chrome_pref_service_factory.cc12
-rw-r--r--chrome/browser/prefs/chrome_pref_service_factory.h13
-rw-r--r--chrome/browser/prefs/pref_notifier_impl_unittest.cc7
-rw-r--r--chrome/browser/prefs/pref_registry.cc64
-rw-r--r--chrome/browser/prefs/pref_registry.h75
-rw-r--r--chrome/browser/prefs/pref_registry_simple.cc67
-rw-r--r--chrome/browser/prefs/pref_registry_simple.h43
-rw-r--r--chrome/browser/prefs/pref_service.cc97
-rw-r--r--chrome/browser/prefs/pref_service.h42
-rw-r--r--chrome/browser/prefs/pref_service_builder.cc11
-rw-r--r--chrome/browser/prefs/pref_service_builder.h9
-rw-r--r--chrome/browser/prefs/pref_service_mock_builder.cc4
-rw-r--r--chrome/browser/prefs/pref_service_mock_builder.h4
-rw-r--r--chrome/browser/prefs/pref_service_simple.cc76
-rw-r--r--chrome/browser/prefs/pref_service_simple.h43
-rw-r--r--chrome/browser/prefs/pref_service_syncable.cc31
-rw-r--r--chrome/browser/prefs/pref_service_syncable.h6
-rw-r--r--chrome/browser/prefs/pref_service_syncable_builder.cc8
-rw-r--r--chrome/browser/prefs/pref_service_unittest.cc21
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl_unittest.cc5
-rw-r--r--chrome/browser/profiles/profile_info_cache.cc5
-rw-r--r--chrome/browser/profiles/profile_info_cache.h4
-rw-r--r--chrome/browser/profiles/profile_manager.cc11
-rw-r--r--chrome/browser/profiles/profile_manager.h2
-rw-r--r--chrome/browser/renderer_host/web_cache_manager.cc5
-rw-r--r--chrome/browser/renderer_host/web_cache_manager.h6
-rw-r--r--chrome/browser/signin/signin_manager_factory.cc7
-rw-r--r--chrome/browser/signin/signin_manager_factory.h4
-rw-r--r--chrome/browser/signin/signin_manager_unittest.cc2
-rw-r--r--chrome/browser/task_manager/task_manager.cc6
-rw-r--r--chrome/browser/task_manager/task_manager.h4
-rw-r--r--chrome/browser/ui/app_list/app_list_controller_browsertest.cc2
-rw-r--r--chrome/browser/ui/app_list/app_list_util.cc5
-rw-r--r--chrome/browser/ui/app_list/app_list_util.h4
-rw-r--r--chrome/browser/ui/browser_ui_prefs.cc9
-rw-r--r--chrome/browser/ui/browser_ui_prefs.h4
-rw-r--r--chrome/browser/ui/browser_view_prefs.cc12
-rw-r--r--chrome/browser/ui/browser_view_prefs.h4
-rw-r--r--chrome/browser/ui/cocoa/confirm_quit.h4
-rw-r--r--chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm6
-rw-r--r--chrome/browser/ui/search_engines/keyword_editor_controller.cc6
-rw-r--r--chrome/browser/ui/search_engines/keyword_editor_controller.h4
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc9
-rw-r--r--chrome/browser/ui/tabs/tab_strip_layout_type_prefs.cc9
-rw-r--r--chrome/browser/ui/tabs/tab_strip_layout_type_prefs.h4
-rw-r--r--chrome/browser/ui/webui/flags_ui.cc6
-rw-r--r--chrome/browser/ui/webui/flags_ui.h4
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_page_handler.h2
-rw-r--r--chrome/browser/ui/window_snapshot/window_snapshot.cc5
-rw-r--r--chrome/browser/ui/window_snapshot/window_snapshot.h4
-rw-r--r--chrome/browser/upgrade_detector.cc8
-rw-r--r--chrome/browser/upgrade_detector.h4
-rw-r--r--chrome/browser/web_resource/notification_promo.cc6
-rw-r--r--chrome/browser/web_resource/notification_promo.h4
-rw-r--r--chrome/browser/web_resource/plugins_resource_service.cc9
-rw-r--r--chrome/browser/web_resource/plugins_resource_service.h4
-rw-r--r--chrome/browser/web_resource/promo_resource_service.cc8
-rw-r--r--chrome/browser/web_resource/promo_resource_service.h4
-rw-r--r--chrome/chrome_browser.gypi6
-rw-r--r--chrome/test/base/testing_browser_process.cc4
-rw-r--r--chrome/test/base/testing_browser_process.h8
-rw-r--r--chrome/test/base/testing_pref_service.cc68
-rw-r--r--chrome/test/base/testing_pref_service.h23
-rw-r--r--chrome/test/reliability/page_load_test.cc19
160 files changed, 1105 insertions, 815 deletions
diff --git a/chrome/browser/about_flags_unittest.cc b/chrome/browser/about_flags_unittest.cc
index cff2597..79322c9 100644
--- a/chrome/browser/about_flags_unittest.cc
+++ b/chrome/browser/about_flags_unittest.cc
@@ -6,6 +6,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/about_flags.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_pref_service.h"
@@ -86,7 +87,7 @@ static Experiment kExperiments[] = {
class AboutFlagsTest : public ::testing::Test {
protected:
AboutFlagsTest() {
- prefs_.RegisterListPref(prefs::kEnabledLabsExperiments);
+ prefs_.registry()->RegisterListPref(prefs::kEnabledLabsExperiments);
testing::ClearState();
}
diff --git a/chrome/browser/autofill/risk/fingerprint.cc b/chrome/browser/autofill/risk/fingerprint.cc
index 74d8a45..0e3b4d6 100644
--- a/chrome/browser/autofill/risk/fingerprint.cc
+++ b/chrome/browser/autofill/risk/fingerprint.cc
@@ -15,7 +15,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/risk/proto/fingerprint.pb.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/prefs/pref_service_simple.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/content_browser_client.h"
diff --git a/chrome/browser/autofill/risk/fingerprint_browsertest.cc b/chrome/browser/autofill/risk/fingerprint_browsertest.cc
index 92f1817..519744a 100644
--- a/chrome/browser/autofill/risk/fingerprint_browsertest.cc
+++ b/chrome/browser/autofill/risk/fingerprint_browsertest.cc
@@ -9,6 +9,7 @@
#include "base/port.h"
#include "base/prefs/public/pref_service_base.h"
#include "chrome/browser/autofill/risk/proto/fingerprint.pb.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_pref_service.h"
@@ -97,8 +98,9 @@ class AutofillRiskFingerprintTest : public InProcessBrowserTest {
// Test that getting a fingerprint works on some basic level.
IN_PROC_BROWSER_TEST_F(AutofillRiskFingerprintTest, GetFingerprint) {
TestingPrefServiceSimple prefs;
- prefs.RegisterStringPref(prefs::kDefaultCharset, kCharset);
- prefs.RegisterStringPref(prefs::kAcceptLanguages, kAcceptLanguages);
+ prefs.registry()->RegisterStringPref(prefs::kDefaultCharset, kCharset);
+ prefs.registry()->RegisterStringPref(prefs::kAcceptLanguages,
+ kAcceptLanguages);
GetFingerprint(
kGaiaId, kWindowBounds, kContentBounds, prefs,
diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc
index 6f53a0c..ce832eb 100644
--- a/chrome/browser/background/background_mode_manager.cc
+++ b/chrome/browser/background/background_mode_manager.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/lifetime/application_lifetime.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
@@ -40,9 +41,9 @@
#include "chrome/common/pref_names.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/user_metrics.h"
+#include "grit/chrome_unscaled_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
-#include "grit/chrome_unscaled_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -219,10 +220,10 @@ BackgroundModeManager::~BackgroundModeManager() {
}
// static
-void BackgroundModeManager::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterBooleanPref(prefs::kUserCreatedLoginItem, false);
- prefs->RegisterBooleanPref(prefs::kUserRemovedLoginItem, false);
- prefs->RegisterBooleanPref(prefs::kBackgroundModeEnabled, true);
+void BackgroundModeManager::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterBooleanPref(prefs::kUserCreatedLoginItem, false);
+ registry->RegisterBooleanPref(prefs::kUserRemovedLoginItem, false);
+ registry->RegisterBooleanPref(prefs::kBackgroundModeEnabled, true);
}
diff --git a/chrome/browser/background/background_mode_manager.h b/chrome/browser/background/background_mode_manager.h
index a5dd053..312748b 100644
--- a/chrome/browser/background/background_mode_manager.h
+++ b/chrome/browser/background/background_mode_manager.h
@@ -19,7 +19,7 @@
class Browser;
class CommandLine;
-class PrefServiceSimple;
+class PrefRegistrySimple;
class Profile;
class ProfileInfoCache;
class StatusIcon;
@@ -53,7 +53,7 @@ class BackgroundModeManager
ProfileInfoCache* profile_cache);
virtual ~BackgroundModeManager();
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
virtual void RegisterProfile(Profile* profile);
diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h
index 942c0b0..40f70b5 100644
--- a/chrome/browser/browser_process.h
+++ b/chrome/browser/browser_process.h
@@ -29,7 +29,8 @@ class IntranetRedirectDetector;
class IOThread;
class MetricsService;
class NotificationUIManager;
-class PrefServiceSimple;
+class PrefRegistrySimple;
+class PrefService;
class Profile;
class ProfileManager;
class RenderWidgetSnapshotTaker;
@@ -103,7 +104,7 @@ class BrowserProcess {
// Services: any of these getters may return NULL
virtual MetricsService* metrics_service() = 0;
virtual ProfileManager* profile_manager() = 0;
- virtual PrefServiceSimple* local_state() = 0;
+ virtual PrefService* local_state() = 0;
virtual net::URLRequestContextGetter* system_request_context() = 0;
virtual chrome_variations::VariationsService* variations_service() = 0;
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index a33776b..ab1f680 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -51,6 +51,7 @@
#include "chrome/browser/policy/policy_service.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/prefs/chrome_pref_service_factory.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prerender/prerender_tracker.h"
#include "chrome/browser/printing/background_printing_manager.h"
@@ -415,10 +416,7 @@ ProfileManager* BrowserProcessImpl::profile_manager() {
return profile_manager_.get();
}
-// TODO(joi): Switch to returning just PrefService, since those
-// calling this function shouldn't be doing ad-hoc registration, that
-// happens earlier in browser_prefs::RegisterLocalState.
-PrefServiceSimple* BrowserProcessImpl::local_state() {
+PrefService* BrowserProcessImpl::local_state() {
DCHECK(CalledOnValidThread());
if (!created_local_state_)
CreateLocalState();
@@ -626,6 +624,45 @@ void BrowserProcessImpl::PlatformSpecificCommandLineProcessing(
}
#endif
+// static
+void BrowserProcessImpl::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled,
+ false);
+ // This policy needs to be defined before the net subsystem is initialized,
+ // so we do it here.
+ registry->RegisterIntegerPref(prefs::kMaxConnectionsPerProxy,
+ net::kDefaultMaxSocketsPerProxyServer);
+
+ // This is observed by ChildProcessSecurityPolicy, which lives in content/
+ // though, so it can't register itself.
+ registry->RegisterListPref(prefs::kDisabledSchemes);
+
+ registry->RegisterBooleanPref(prefs::kAllowCrossOriginAuthPrompt, false);
+
+#if defined(OS_WIN)
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8)
+ registry->RegisterBooleanPref(prefs::kRestartSwitchMode, false);
+#endif
+
+ // TODO(brettw,*): this comment about ResourceBundle was here since
+ // initial commit. This comment seems unrelated, bit-rotten and
+ // a candidate for removal.
+ // Initialize ResourceBundle which handles files loaded from external
+ // sources. This has to be done before uninstall code path and before prefs
+ // are registered.
+ registry->RegisterStringPref(prefs::kApplicationLocale, std::string());
+#if defined(OS_CHROMEOS)
+ registry->RegisterStringPref(prefs::kOwnerLocale, std::string());
+ registry->RegisterStringPref(prefs::kHardwareKeyboardLayout,
+ std::string());
+#endif // defined(OS_CHROMEOS)
+#if !defined(OS_CHROMEOS)
+ registry->RegisterBooleanPref(
+ prefs::kMetricsReportingEnabled,
+ GoogleUpdateSettings::GetCollectStatsConsent());
+#endif // !defined(OS_CHROMEOS)
+}
+
DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() {
DCHECK(CalledOnValidThread());
if (!download_request_limiter_)
@@ -762,29 +799,30 @@ void BrowserProcessImpl::CreateLocalState() {
FilePath local_state_path;
CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path));
+ scoped_refptr<PrefRegistrySimple> pref_registry = new PrefRegistrySimple;
local_state_.reset(
chrome_prefs::CreateLocalState(local_state_path,
local_state_task_runner_,
policy_service(),
- NULL, false));
+ NULL,
+ pref_registry,
+ false));
// Initialize the prefs of the local state.
- chrome::RegisterLocalState(local_state_.get());
+ //
+ // TODO(joi): Once we clean up so none of the registration methods
+ // need the PrefService pointer, this should happen before the call
+ // to CreateLocalState.
+ chrome::RegisterLocalState(pref_registry, local_state_.get());
pref_change_registrar_.Init(local_state_.get());
// Initialize the notification for the default browser setting policy.
- local_state_->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled,
- false);
pref_change_registrar_.Add(
prefs::kDefaultBrowserSettingEnabled,
base::Bind(&BrowserProcessImpl::ApplyDefaultBrowserPolicy,
base::Unretained(this)));
- // This policy needs to be defined before the net subsystem is initialized,
- // so we do it here.
- local_state_->RegisterIntegerPref(prefs::kMaxConnectionsPerProxy,
- net::kDefaultMaxSocketsPerProxyServer);
int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy);
net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(
net::HttpNetworkSession::NORMAL_SOCKET_POOL,
@@ -792,21 +830,11 @@ void BrowserProcessImpl::CreateLocalState() {
net::ClientSocketPoolManager::max_sockets_per_group(
net::HttpNetworkSession::NORMAL_SOCKET_POOL)));
- // This is observed by ChildProcessSecurityPolicy, which lives in content/
- // though, so it can't register itself.
- local_state_->RegisterListPref(prefs::kDisabledSchemes);
pref_change_registrar_.Add(
prefs::kDisabledSchemes,
base::Bind(&BrowserProcessImpl::ApplyDisabledSchemesPolicy,
base::Unretained(this)));
ApplyDisabledSchemesPolicy();
-
- local_state_->RegisterBooleanPref(prefs::kAllowCrossOriginAuthPrompt, false);
-
-#if defined(OS_WIN)
- if (base::win::GetVersion() >= base::win::VERSION_WIN8)
- local_state_->RegisterBooleanPref(prefs::kRestartSwitchMode, false);
-#endif
}
void BrowserProcessImpl::PreCreateThreads() {
diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h
index fb3901f..b01591f 100644
--- a/chrome/browser/browser_process_impl.h
+++ b/chrome/browser/browser_process_impl.h
@@ -25,7 +25,7 @@ class ChromeNetLog;
class ChromeResourceDispatcherHostDelegate;
class CommandLine;
class RemoteDebuggingServer;
-class PrefServiceSimple;
+class PrefRegistrySimple;
class PromoResourceService;
#if defined(ENABLE_PLUGIN_INSTALLATION)
@@ -76,7 +76,7 @@ class BrowserProcessImpl : public BrowserProcess,
virtual IOThread* io_thread() OVERRIDE;
virtual WatchDogThread* watchdog_thread() OVERRIDE;
virtual ProfileManager* profile_manager() OVERRIDE;
- virtual PrefServiceSimple* local_state() OVERRIDE;
+ virtual PrefService* local_state() OVERRIDE;
virtual net::URLRequestContextGetter* system_request_context() OVERRIDE;
virtual chrome_variations::VariationsService* variations_service() OVERRIDE;
#if defined(OS_CHROMEOS)
@@ -132,6 +132,8 @@ class BrowserProcessImpl : public BrowserProcess,
virtual void PlatformSpecificCommandLineProcessing(
const CommandLine& command_line) OVERRIDE;
+ static void RegisterPrefs(PrefRegistrySimple* registry);
+
private:
void CreateMetricsService();
void CreateWatchdogThread();
@@ -182,7 +184,7 @@ class BrowserProcessImpl : public BrowserProcess,
scoped_ptr<ProfileManager> profile_manager_;
bool created_local_state_;
- scoped_ptr<PrefServiceSimple> local_state_;
+ scoped_ptr<PrefService> local_state_;
bool created_icon_manager_;
scoped_ptr<IconManager> icon_manager_;
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc
index f8398b1..e473b43 100644
--- a/chrome/browser/browser_shutdown.cc
+++ b/chrome/browser/browser_shutdown.cc
@@ -26,6 +26,7 @@
#include "chrome/browser/jankometer.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/metrics/metrics_service.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/service/service_process_control.h"
@@ -77,10 +78,10 @@ int shutdown_num_processes_slow_;
const char kShutdownMsFile[] = "chrome_shutdown_ms.txt";
-void RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterIntegerPref(prefs::kShutdownType, NOT_VALID);
- local_state->RegisterIntegerPref(prefs::kShutdownNumProcesses, 0);
- local_state->RegisterIntegerPref(prefs::kShutdownNumProcessesSlow, 0);
+void RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterIntegerPref(prefs::kShutdownType, NOT_VALID);
+ registry->RegisterIntegerPref(prefs::kShutdownNumProcesses, 0);
+ registry->RegisterIntegerPref(prefs::kShutdownNumProcessesSlow, 0);
}
ShutdownType GetShutdownType() {
diff --git a/chrome/browser/browser_shutdown.h b/chrome/browser/browser_shutdown.h
index cc4f728..208bb1d 100644
--- a/chrome/browser/browser_shutdown.h
+++ b/chrome/browser/browser_shutdown.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_BROWSER_SHUTDOWN_H__
#define CHROME_BROWSER_BROWSER_SHUTDOWN_H__
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace browser_shutdown {
@@ -20,7 +20,7 @@ enum ShutdownType {
END_SESSION
};
-void RegisterPrefs(PrefServiceSimple* local_state);
+void RegisterPrefs(PrefRegistrySimple* registry);
// Called when the browser starts shutting down so that we can measure shutdown
// time.
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index b0e406b..e4939a0 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -76,6 +76,7 @@
#include "chrome/browser/policy/policy_service.h"
#include "chrome/browser/prefs/chrome_pref_service_factory.h"
#include "chrome/browser/prefs/command_line_pref_store.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/pref_value_store.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
@@ -251,27 +252,10 @@ PrefService* InitializeLocalState(
bool local_state_file_exists = file_util::PathExists(local_state_path);
// Load local state. This includes the application locale so we know which
- // locale dll to load.
- PrefServiceSimple* local_state = g_browser_process->local_state();
+ // locale dll to load. This also causes local state prefs to be registered.
+ PrefService* local_state = g_browser_process->local_state();
DCHECK(local_state);
- // TODO(brettw,*): this comment about ResourceBundle was here since
- // initial commit. This comment seems unrelated, bit-rotten and
- // a candidate for removal.
- // Initialize ResourceBundle which handles files loaded from external
- // sources. This has to be done before uninstall code path and before prefs
- // are registered.
- local_state->RegisterStringPref(prefs::kApplicationLocale, std::string());
-#if defined(OS_CHROMEOS)
- local_state->RegisterStringPref(prefs::kOwnerLocale, std::string());
- local_state->RegisterStringPref(prefs::kHardwareKeyboardLayout,
- std::string());
-#endif // defined(OS_CHROMEOS)
-#if !defined(OS_CHROMEOS)
- local_state->RegisterBooleanPref(prefs::kMetricsReportingEnabled,
- GoogleUpdateSettings::GetCollectStatsConsent());
-#endif // !defined(OS_CHROMEOS)
-
if (is_first_run) {
#if defined(OS_WIN)
// During first run we read the google_update registry key to find what
@@ -296,19 +280,23 @@ PrefService* InitializeLocalState(
// inherit and reset the user's setting.
//
// TODO(mnissler): We should probably just instantiate a
- // JSONPrefStore here instead of an entire PrefService.
+ // JSONPrefStore here instead of an entire PrefService. Once this is
+ // addressed, the call to browser_prefs::RegisterLocalState can move
+ // to chrome_prefs::CreateLocalState.
if (!local_state_file_exists &&
parsed_command_line.HasSwitch(switches::kParentProfile)) {
FilePath parent_profile =
parsed_command_line.GetSwitchValuePath(switches::kParentProfile);
- scoped_ptr<PrefServiceSimple> parent_local_state(
+ scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple();
+ scoped_ptr<PrefService> parent_local_state(
chrome_prefs::CreateLocalState(
parent_profile,
local_state_task_runner,
g_browser_process->policy_service(),
- NULL, false));
- parent_local_state->RegisterStringPref(prefs::kApplicationLocale,
- std::string());
+ NULL,
+ registry,
+ false));
+ registry->RegisterStringPref(prefs::kApplicationLocale, std::string());
// Right now, we only inherit the locale setting from the parent profile.
local_state->SetString(
prefs::kApplicationLocale,
diff --git a/chrome/browser/chromeos/audio/audio_handler.cc b/chrome/browser/chromeos/audio/audio_handler.cc
index d509319..ebf4fcd 100644
--- a/chrome/browser/chromeos/audio/audio_handler.cc
+++ b/chrome/browser/chromeos/audio/audio_handler.cc
@@ -17,6 +17,7 @@
#else
#include "chrome/browser/chromeos/audio/audio_mixer_alsa.h"
#endif
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
@@ -79,27 +80,15 @@ AudioHandler* AudioHandler::GetInstance() {
}
// static
-void AudioHandler::RegisterPrefs(PrefServiceSimple* local_state) {
- if (!local_state->FindPreference(prefs::kAudioVolumePercent)) {
- local_state->RegisterDoublePref(prefs::kAudioVolumePercent,
- kDefaultVolumePercent);
- }
- if (!local_state->FindPreference(prefs::kAudioMute)) {
- local_state->RegisterIntegerPref(prefs::kAudioMute,
- kPrefMuteOff);
- }
-
- if (!local_state->FindPreference(prefs::kAudioOutputAllowed)) {
- // Register the prefs backing the audio muting policies.
- local_state->RegisterBooleanPref(prefs::kAudioOutputAllowed,
- true);
- }
+void AudioHandler::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterDoublePref(prefs::kAudioVolumePercent,
+ kDefaultVolumePercent);
+ registry->RegisterIntegerPref(prefs::kAudioMute, kPrefMuteOff);
+ // Register the prefs backing the audio muting policies.
+ registry->RegisterBooleanPref(prefs::kAudioOutputAllowed, true);
// This pref has moved to the media subsystem but we should verify it is there
// before we use it.
- if (!local_state->FindPreference(prefs::kAudioCaptureAllowed)) {
- local_state->RegisterBooleanPref(prefs::kAudioCaptureAllowed,
- true);
- }
+ registry->RegisterBooleanPref(prefs::kAudioCaptureAllowed, true);
}
double AudioHandler::GetVolumePercent() {
diff --git a/chrome/browser/chromeos/audio/audio_handler.h b/chrome/browser/chromeos/audio/audio_handler.h
index 78b333b..662fdec 100644
--- a/chrome/browser/chromeos/audio/audio_handler.h
+++ b/chrome/browser/chromeos/audio/audio_handler.h
@@ -14,8 +14,8 @@
template <typename T> struct DefaultSingletonTraits;
class PrefChangeRegistrar;
+class PrefRegistrySimple;
class PrefService;
-class PrefServiceSimple;
namespace chromeos {
@@ -44,7 +44,7 @@ class AudioHandler {
static AudioHandler* GetInstance();
// Registers volume and mute preferences.
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Gets volume level in our internal 0-100% range, 0 being pure silence.
double GetVolumePercent();
diff --git a/chrome/browser/chromeos/customization_document.cc b/chrome/browser/chromeos/customization_document.cc
index 0d5c6cc..052ef2a 100644
--- a/chrome/browser/chromeos/customization_document.cc
+++ b/chrome/browser/chromeos/customization_document.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/chromeos/cros/network_library.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/chromeos/system/statistics_provider.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "content/public/browser/browser_thread.h"
@@ -248,8 +249,8 @@ ServicesCustomizationDocument* ServicesCustomizationDocument::GetInstance() {
// static
void ServicesCustomizationDocument::RegisterPrefs(
- PrefServiceSimple* local_state) {
- local_state->RegisterBooleanPref(kServicesCustomizationAppliedPref, false);
+ PrefRegistrySimple* registry) {
+ registry->RegisterBooleanPref(kServicesCustomizationAppliedPref, false);
}
// static
diff --git a/chrome/browser/chromeos/customization_document.h b/chrome/browser/chromeos/customization_document.h
index e7a06e4..81872e9 100644
--- a/chrome/browser/chromeos/customization_document.h
+++ b/chrome/browser/chromeos/customization_document.h
@@ -16,7 +16,7 @@
#include "googleurl/src/gurl.h"
#include "net/url_request/url_fetcher_delegate.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace base {
class DictionaryValue;
@@ -119,7 +119,7 @@ class ServicesCustomizationDocument : public CustomizationDocument,
static ServicesCustomizationDocument* GetInstance();
// Registers preferences.
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Return true if the customization was applied. Customization is applied only
// once per machine.
diff --git a/chrome/browser/chromeos/display/display_preferences.cc b/chrome/browser/chromeos/display/display_preferences.cc
index 90d7204..6515d32 100644
--- a/chrome/browser/chromeos/display/display_preferences.cc
+++ b/chrome/browser/chromeos/display/display_preferences.cc
@@ -13,6 +13,7 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/login/user_manager.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/common/pref_names.h"
@@ -132,22 +133,22 @@ void NotifyDisplayOverscans() {
} // namespace
-void RegisterDisplayLocalStatePrefs(PrefServiceSimple* local_state) {
+void RegisterDisplayLocalStatePrefs(PrefRegistrySimple* registry) {
// The default secondary display layout.
- local_state->RegisterIntegerPref(prefs::kSecondaryDisplayLayout,
- static_cast<int>(ash::DisplayLayout::RIGHT));
+ registry->RegisterIntegerPref(prefs::kSecondaryDisplayLayout,
+ static_cast<int>(ash::DisplayLayout::RIGHT));
// The default offset of the secondary display position from the primary
// display.
- local_state->RegisterIntegerPref(prefs::kSecondaryDisplayOffset, 0);
+ registry->RegisterIntegerPref(prefs::kSecondaryDisplayOffset, 0);
// Per-display preference.
- local_state->RegisterDictionaryPref(prefs::kSecondaryDisplays);
+ registry->RegisterDictionaryPref(prefs::kSecondaryDisplays);
// Primary output name.
- local_state->RegisterInt64Pref(prefs::kPrimaryDisplayID,
- gfx::Display::kInvalidDisplayID);
+ registry->RegisterInt64Pref(prefs::kPrimaryDisplayID,
+ gfx::Display::kInvalidDisplayID);
// Display overscan preference.
- local_state->RegisterDictionaryPref(prefs::kDisplayOverscans);
+ registry->RegisterDictionaryPref(prefs::kDisplayOverscans);
}
void SetDisplayLayoutPref(const gfx::Display& display,
diff --git a/chrome/browser/chromeos/display/display_preferences.h b/chrome/browser/chromeos/display/display_preferences.h
index 615ce57..1d40edc 100644
--- a/chrome/browser/chromeos/display/display_preferences.h
+++ b/chrome/browser/chromeos/display/display_preferences.h
@@ -7,7 +7,7 @@
#include "base/basictypes.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace gfx {
class Display;
@@ -18,7 +18,7 @@ namespace chromeos {
// Registers the prefs associated with display settings and stored
// into Local State.
-void RegisterDisplayLocalStatePrefs(PrefServiceSimple* local_state);
+void RegisterDisplayLocalStatePrefs(PrefRegistrySimple* registry);
// Sets or updates the display layout data to the specified |display| and
// |pref_service|.
diff --git a/chrome/browser/chromeos/display/display_preferences_unittest.cc b/chrome/browser/chromeos/display/display_preferences_unittest.cc
index 4143285..bfdf871 100644
--- a/chrome/browser/chromeos/display/display_preferences_unittest.cc
+++ b/chrome/browser/chromeos/display/display_preferences_unittest.cc
@@ -27,7 +27,7 @@ class DisplayPreferencesTest : public ash::test::AshTestBase {
virtual void SetUp() OVERRIDE {
ash::test::AshTestBase::SetUp();
- RegisterDisplayLocalStatePrefs(&local_state_);
+ RegisterDisplayLocalStatePrefs(local_state_.registry());
TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_);
}
diff --git a/chrome/browser/chromeos/language_preferences.cc b/chrome/browser/chromeos/language_preferences.cc
index 77658dd..77e9518 100644
--- a/chrome/browser/chromeos/language_preferences.cc
+++ b/chrome/browser/chromeos/language_preferences.cc
@@ -4,6 +4,7 @@
#include "base/basictypes.h"
#include "chrome/browser/chromeos/language_preferences.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/common/pref_names.h"
#include "grit/generated_resources.h"
@@ -392,13 +393,12 @@ const int kXkbAutoRepeatDelayInMs = 500;
const int kXkbAutoRepeatIntervalInMs = 50;
const char kPreferredKeyboardLayout[] = "PreferredKeyboardLayout";
-void RegisterPrefs(PrefServiceSimple* local_state) {
+void RegisterPrefs(PrefRegistrySimple* registry) {
// We use an empty string here rather than a hardware keyboard layout name
// since input_method::GetHardwareInputMethodId() might return a fallback
- // layout name if local_state->RegisterStringPref(kHardwareKeyboardLayout)
+ // layout name if registry->RegisterStringPref(kHardwareKeyboardLayout)
// is not called yet.
- local_state->RegisterStringPref(kPreferredKeyboardLayout,
- "");
+ registry->RegisterStringPref(kPreferredKeyboardLayout, "");
}
} // namespace language_prefs
diff --git a/chrome/browser/chromeos/language_preferences.h b/chrome/browser/chromeos/language_preferences.h
index 19c0031..07b15c8 100644
--- a/chrome/browser/chromeos/language_preferences.h
+++ b/chrome/browser/chromeos/language_preferences.h
@@ -9,6 +9,8 @@
#include "chrome/browser/prefs/pref_service.h"
+class PrefRegistrySimple;
+
// TODO(yusukes): Rename this file to input_method_preference.cc. Since
// "language" usually means UI language, the current file name is confusing.
// The namespace should also be changed to "namespace input_method {".
@@ -161,7 +163,7 @@ extern const int kXkbAutoRepeatIntervalInMs;
extern const char kPreferredKeyboardLayout[];
// Registers non-user prefs for the default keyboard layout on the login screen.
-void RegisterPrefs(PrefServiceSimple* local_state);
+void RegisterPrefs(PrefRegistrySimple* registry);
} // language_prefs
} // chromeos
diff --git a/chrome/browser/chromeos/login/login_utils_browsertest.cc b/chrome/browser/chromeos/login/login_utils_browsertest.cc
index 46dece0..f1139ea 100644
--- a/chrome/browser/chromeos/login/login_utils_browsertest.cc
+++ b/chrome/browser/chromeos/login/login_utils_browsertest.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/policy/enterprise_install_attributes.h"
#include "chrome/browser/policy/policy_service.h"
#include "chrome/browser/policy/proto/device_management_backend.pb.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/rlz/rlz.h"
#include "chrome/common/chrome_notification_types.h"
@@ -187,8 +188,6 @@ class LoginUtilsTest : public testing::Test,
// OAuth2 path.
command_line->AppendSwitch(switches::kForceOAuth1);
- local_state_.Get()->RegisterStringPref(prefs::kApplicationLocale, "");
-
// DBusThreadManager should be initialized before io_thread_state_, as
// DBusThreadManager is used from chromeos::ProxyConfigServiceImpl,
// which is part of io_thread_state_.
diff --git a/chrome/browser/chromeos/login/user_image_manager.h b/chrome/browser/chromeos/login/user_image_manager.h
index 00bb9a7..eeec8a0 100644
--- a/chrome/browser/chromeos/login/user_image_manager.h
+++ b/chrome/browser/chromeos/login/user_image_manager.h
@@ -9,7 +9,7 @@
#include "chrome/browser/chromeos/login/user.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace base {
class FilePath;
@@ -27,7 +27,7 @@ class UserImage;
class UserImageManager {
public:
// Registers user image manager preferences.
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
virtual ~UserImageManager();
diff --git a/chrome/browser/chromeos/login/user_image_manager_impl.cc b/chrome/browser/chromeos/login/user_image_manager_impl.cc
index 58ec5c0..37a1ac3 100644
--- a/chrome/browser/chromeos/login/user_image_manager_impl.cc
+++ b/chrome/browser/chromeos/login/user_image_manager_impl.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/chromeos/login/user_image_manager_impl.h"
-#include "base/debug/trace_event.h"
#include "base/bind.h"
+#include "base/debug/trace_event.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
@@ -20,6 +20,7 @@
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/user_image.h"
#include "chrome/browser/chromeos/login/user_manager.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile_downloader.h"
@@ -168,9 +169,9 @@ int UserImageManagerImpl::user_image_migration_delay_sec =
kUserImageMigrationDelaySec;
// static
-void UserImageManager::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterDictionaryPref(kUserImages);
- local_state->RegisterDictionaryPref(kUserImageProperties);
+void UserImageManager::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterDictionaryPref(kUserImages);
+ registry->RegisterDictionaryPref(kUserImageProperties);
}
UserImageManagerImpl::UserImageManagerImpl()
diff --git a/chrome/browser/chromeos/login/user_manager.h b/chrome/browser/chromeos/login/user_manager.h
index d812fce..13a95dd 100644
--- a/chrome/browser/chromeos/login/user_manager.h
+++ b/chrome/browser/chromeos/login/user_manager.h
@@ -10,7 +10,7 @@
#include "base/memory/singleton.h"
#include "chrome/browser/chromeos/login/user.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace chromeos {
@@ -63,7 +63,7 @@ class UserManager {
static UserManager* Set(UserManager* mock);
// Registers user manager preferences.
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Indicates imminent shutdown, allowing the UserManager to remove any
// observers it has registered.
diff --git a/chrome/browser/chromeos/login/user_manager_impl.cc b/chrome/browser/chromeos/login/user_manager_impl.cc
index c045f5c..28d734a 100644
--- a/chrome/browser/chromeos/login/user_manager_impl.cc
+++ b/chrome/browser/chromeos/login/user_manager_impl.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/chromeos/power/session_length_limiter.h"
#include "chrome/browser/policy/browser_policy_connector.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -158,16 +159,16 @@ bool ParseUserList(const ListValue& users_list,
} // namespace
// static
-void UserManager::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterListPref(kRegularUsers);
- local_state->RegisterListPref(kPublicAccounts);
- local_state->RegisterListPref(kLocallyManagedUsersFirstRun);
- local_state->RegisterIntegerPref(kLocallyManagedUsersNextId, 0);
- local_state->RegisterStringPref(kPublicAccountPendingDataRemoval, "");
- local_state->RegisterDictionaryPref(kUserOAuthTokenStatus);
- local_state->RegisterDictionaryPref(kUserDisplayName);
- local_state->RegisterDictionaryPref(kUserDisplayEmail);
- SessionLengthLimiter::RegisterPrefs(local_state);
+void UserManager::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterListPref(kRegularUsers);
+ registry->RegisterListPref(kPublicAccounts);
+ registry->RegisterListPref(kLocallyManagedUsersFirstRun);
+ registry->RegisterIntegerPref(kLocallyManagedUsersNextId, 0);
+ registry->RegisterStringPref(kPublicAccountPendingDataRemoval, "");
+ registry->RegisterDictionaryPref(kUserOAuthTokenStatus);
+ registry->RegisterDictionaryPref(kUserDisplayName);
+ registry->RegisterDictionaryPref(kUserDisplayEmail);
+ SessionLengthLimiter::RegisterPrefs(registry);
}
UserManagerImpl::UserManagerImpl()
diff --git a/chrome/browser/chromeos/login/user_manager_unittest.cc b/chrome/browser/chromeos/login/user_manager_unittest.cc
index 475ad11..325f225 100644
--- a/chrome/browser/chromeos/login/user_manager_unittest.cc
+++ b/chrome/browser/chromeos/login/user_manager_unittest.cc
@@ -60,11 +60,11 @@ class UserManagerTest : public testing::Test {
local_state_.reset(new TestingPrefServiceSimple);
reinterpret_cast<TestingBrowserProcess*>(g_browser_process)
->SetLocalState(local_state_.get());
- UserManager::RegisterPrefs(local_state_.get());
+ UserManager::RegisterPrefs(local_state_->registry());
// Wallpaper manager and user image managers prefs will be accessed by the
// unit-test as well.
- UserImageManager::RegisterPrefs(local_state_.get());
- WallpaperManager::RegisterPrefs(local_state_.get());
+ UserImageManager::RegisterPrefs(local_state_->registry());
+ WallpaperManager::RegisterPrefs(local_state_->registry());
old_user_manager_ = UserManager::Get();
ResetUserManager();
diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc
index d24bb36..09b5562 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager.cc
+++ b/chrome/browser/chromeos/login/wallpaper_manager.cc
@@ -8,9 +8,9 @@
#include "ash/shell.h"
#include "base/command_line.h"
-#include "base/logging.h"
#include "base/file_path.h"
#include "base/file_util.h"
+#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/path_service.h"
#include "base/string_number_conversions.h"
@@ -24,6 +24,7 @@
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/common/chrome_notification_types.h"
@@ -139,10 +140,10 @@ void WallpaperManager::Shutdown() {
}
// static
-void WallpaperManager::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterDictionaryPref(prefs::kUsersWallpaperInfo);
- local_state->RegisterDictionaryPref(kUserWallpapers);
- local_state->RegisterDictionaryPref(kUserWallpapersProperties);
+void WallpaperManager::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterDictionaryPref(prefs::kUsersWallpaperInfo);
+ registry->RegisterDictionaryPref(kUserWallpapers);
+ registry->RegisterDictionaryPref(kUserWallpapersProperties);
}
void WallpaperManager::AddObservers() {
diff --git a/chrome/browser/chromeos/login/wallpaper_manager.h b/chrome/browser/chromeos/login/wallpaper_manager.h
index b675750..f9866b8 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager.h
+++ b/chrome/browser/chromeos/login/wallpaper_manager.h
@@ -24,7 +24,7 @@
#include "third_party/icu/public/i18n/unicode/timezone.h"
#include "ui/gfx/image/image_skia.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace base {
class SequencedTaskRunner;
@@ -70,7 +70,7 @@ class WallpaperManager: public system::TimezoneSettings::Observer,
void Shutdown();
// Registers wallpaper manager preferences.
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Adds PowerManagerClient, TimeZoneSettings and CrosSettings observers.
void AddObservers();
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index cfc4c16..4066f70 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -39,6 +39,7 @@
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/chromeos/settings/cros_settings_names.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/options/options_util.h"
@@ -385,27 +386,19 @@ void WizardController::SkipUpdateEnrollAfterEula() {
}
// static
-void WizardController::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterBooleanPref(kOobeComplete, false);
- local_state->RegisterIntegerPref(kDeviceRegistered, -1);
- local_state->RegisterBooleanPref(kEulaAccepted, false);
- local_state->RegisterStringPref(kInitialLocale, "en-US");
- // Check if the pref is already registered in case
- // Preferences::RegisterUserPrefs runs before this code in the future.
- if (local_state->FindPreference(prefs::kSpokenFeedbackEnabled) == NULL) {
- local_state->RegisterBooleanPref(prefs::kSpokenFeedbackEnabled, false);
- }
- if (local_state->FindPreference(prefs::kHighContrastEnabled) == NULL) {
- local_state->RegisterBooleanPref(prefs::kHighContrastEnabled, false);
- }
- if (local_state->FindPreference(prefs::kVirtualKeyboardEnabled) == NULL) {
- local_state->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, false);
- }
- local_state->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false);
- local_state->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true);
- local_state->RegisterBooleanPref(prefs::kFactoryResetRequested, false);
- local_state->RegisterStringPref(prefs::kRLZBrand, std::string());
- local_state->RegisterBooleanPref(prefs::kRLZDisabled, false);
+void WizardController::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterBooleanPref(kOobeComplete, false);
+ registry->RegisterIntegerPref(kDeviceRegistered, -1);
+ registry->RegisterBooleanPref(kEulaAccepted, false);
+ registry->RegisterStringPref(kInitialLocale, "en-US");
+ registry->RegisterBooleanPref(prefs::kSpokenFeedbackEnabled, false);
+ registry->RegisterBooleanPref(prefs::kHighContrastEnabled, false);
+ registry->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, false);
+ registry->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false);
+ registry->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true);
+ registry->RegisterBooleanPref(prefs::kFactoryResetRequested, false);
+ registry->RegisterStringPref(prefs::kRLZBrand, std::string());
+ registry->RegisterBooleanPref(prefs::kRLZDisabled, false);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/chromeos/login/wizard_controller.h b/chrome/browser/chromeos/login/wizard_controller.h
index 3154776..33a9359 100644
--- a/chrome/browser/chromeos/login/wizard_controller.h
+++ b/chrome/browser/chromeos/login/wizard_controller.h
@@ -18,7 +18,7 @@
#include "googleurl/src/gurl.h"
#include "ui/gfx/rect.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace base {
class DictionaryValue;
@@ -99,7 +99,7 @@ class WizardController : public ScreenObserver {
static void SetInitialLocale(const std::string& locale);
// Registers OOBE preferences.
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Marks user image screen to be always skipped after login.
static void SkipImageSelectionForTesting();
diff --git a/chrome/browser/chromeos/power/session_length_limiter.cc b/chrome/browser/chromeos/power/session_length_limiter.cc
index 8a716bc..7a879c5 100644
--- a/chrome/browser/chromeos/power/session_length_limiter.cc
+++ b/chrome/browser/chromeos/power/session_length_limiter.cc
@@ -13,6 +13,7 @@
#include "base/prefs/public/pref_service_base.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/lifetime/application_lifetime.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
@@ -65,9 +66,9 @@ SessionLengthLimiter::Delegate::~Delegate() {
}
// static
-void SessionLengthLimiter::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterInt64Pref(prefs::kSessionStartTime, 0);
- local_state->RegisterIntegerPref(prefs::kSessionLengthLimit, 0);
+void SessionLengthLimiter::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterInt64Pref(prefs::kSessionStartTime, 0);
+ registry->RegisterIntegerPref(prefs::kSessionLengthLimit, 0);
}
SessionLengthLimiter::SessionLengthLimiter(Delegate* delegate,
diff --git a/chrome/browser/chromeos/power/session_length_limiter.h b/chrome/browser/chromeos/power/session_length_limiter.h
index ebeb355..996ea0b 100644
--- a/chrome/browser/chromeos/power/session_length_limiter.h
+++ b/chrome/browser/chromeos/power/session_length_limiter.h
@@ -13,7 +13,7 @@
#include "base/timer.h"
class PrefService;
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace chromeos {
@@ -30,7 +30,7 @@ class SessionLengthLimiter {
};
// Registers preferences.
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
SessionLengthLimiter(Delegate* delegate, bool browser_restarted);
~SessionLengthLimiter();
diff --git a/chrome/browser/chromeos/power/session_length_limiter_unittest.cc b/chrome/browser/chromeos/power/session_length_limiter_unittest.cc
index f527f08..7eec370 100644
--- a/chrome/browser/chromeos/power/session_length_limiter_unittest.cc
+++ b/chrome/browser/chromeos/power/session_length_limiter_unittest.cc
@@ -99,7 +99,7 @@ class SessionLengthLimiterTest : public testing::Test {
virtual void SetUp() {
TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_);
- SessionLengthLimiter::RegisterPrefs(&local_state_);
+ SessionLengthLimiter::RegisterPrefs(local_state_.registry());
delegate_ = new NiceMock<MockSessionLengthLimiterDelegate>;
ON_CALL(*delegate_, GetCurrentTime())
diff --git a/chrome/browser/chromeos/proxy_config_service_impl.cc b/chrome/browser/chromeos/proxy_config_service_impl.cc
index 053e401..cb375dd 100644
--- a/chrome/browser/chromeos/proxy_config_service_impl.cc
+++ b/chrome/browser/chromeos/proxy_config_service_impl.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/chromeos/settings/cros_settings_names.h"
#include "chrome/browser/policy/proto/chrome_device_policy.pb.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/proxy_config_dictionary.h"
#include "chrome/browser/prefs/proxy_prefs.h"
@@ -580,10 +581,10 @@ bool ProxyConfigServiceImpl::ParseProxyConfig(const Network* network,
}
// static
-void ProxyConfigServiceImpl::RegisterPrefs(PrefServiceSimple* pref_service) {
+void ProxyConfigServiceImpl::RegisterPrefs(PrefRegistrySimple* registry) {
// Use shared proxies default to off. GetUseSharedProxies will return the
// correct value based on pre-login and login.
- pref_service->RegisterBooleanPref(prefs::kUseSharedProxies, true);
+ registry->RegisterBooleanPref(prefs::kUseSharedProxies, true);
}
// static
diff --git a/chrome/browser/chromeos/proxy_config_service_impl.h b/chrome/browser/chromeos/proxy_config_service_impl.h
index 6f4271c..07f7848 100644
--- a/chrome/browser/chromeos/proxy_config_service_impl.h
+++ b/chrome/browser/chromeos/proxy_config_service_impl.h
@@ -199,7 +199,7 @@ class ProxyConfigServiceImpl
net::ProxyConfig* proxy_config);
// Register UseShardProxies preference.
- static void RegisterPrefs(PrefServiceSimple* pref_service);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
static void RegisterUserPrefs(PrefServiceSyncable* pref_service);
#if defined(UNIT_TEST)
diff --git a/chrome/browser/chromeos/proxy_config_service_impl_unittest.cc b/chrome/browser/chromeos/proxy_config_service_impl_unittest.cc
index 85f440f..23a1aa1 100644
--- a/chrome/browser/chromeos/proxy_config_service_impl_unittest.cc
+++ b/chrome/browser/chromeos/proxy_config_service_impl_unittest.cc
@@ -235,11 +235,11 @@ class ProxyConfigServiceImplTestBase : public TESTBASE {
: ui_thread_(BrowserThread::UI, &loop_),
io_thread_(BrowserThread::IO, &loop_) {}
- virtual void Init(PrefServiceSimple* pref_service) {
+ virtual void Init(TestingPrefServiceSimple* pref_service) {
ASSERT_TRUE(pref_service);
DBusThreadManager::Initialize();
- PrefProxyConfigTrackerImpl::RegisterPrefs(pref_service);
- ProxyConfigServiceImpl::RegisterPrefs(pref_service);
+ PrefProxyConfigTrackerImpl::RegisterPrefs(pref_service->registry());
+ ProxyConfigServiceImpl::RegisterPrefs(pref_service->registry());
proxy_config_service_.reset(new ChromeProxyConfigService(NULL));
config_service_impl_.reset(new ProxyConfigServiceImpl(pref_service));
config_service_impl_->SetChromeProxyConfigService(
diff --git a/chrome/browser/chromeos/settings/device_settings_cache.cc b/chrome/browser/chromeos/settings/device_settings_cache.cc
index d8c5739..a9bf424 100644
--- a/chrome/browser/chromeos/settings/device_settings_cache.cc
+++ b/chrome/browser/chromeos/settings/device_settings_cache.cc
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/policy/proto/device_management_backend.pb.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
@@ -19,8 +20,8 @@ namespace chromeos {
namespace device_settings_cache {
-void RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterStringPref(prefs::kDeviceSettingsCache, "invalid");
+void RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterStringPref(prefs::kDeviceSettingsCache, "invalid");
}
bool Store(const em::PolicyData& policy, PrefService* local_state) {
diff --git a/chrome/browser/chromeos/settings/device_settings_cache.h b/chrome/browser/chromeos/settings/device_settings_cache.h
index 1a632d4..ac2028c 100644
--- a/chrome/browser/chromeos/settings/device_settings_cache.h
+++ b/chrome/browser/chromeos/settings/device_settings_cache.h
@@ -10,7 +10,7 @@ class PolicyData;
}
class PrefService;
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace chromeos {
@@ -20,7 +20,7 @@ namespace chromeos {
// case.
namespace device_settings_cache {
// Registers required pref section.
-void RegisterPrefs(PrefServiceSimple* local_state);
+void RegisterPrefs(PrefRegistrySimple* registry);
// Stores a new policy blob inside the cache stored in |local_state|.
bool Store(const enterprise_management::PolicyData &policy,
diff --git a/chrome/browser/chromeos/status/data_promo_notification.cc b/chrome/browser/chromeos/status/data_promo_notification.cc
index bfbad93..989aea8 100644
--- a/chrome/browser/chromeos/status/data_promo_notification.cc
+++ b/chrome/browser/chromeos/status/data_promo_notification.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/mobile_config.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -127,9 +128,9 @@ DataPromoNotification::~DataPromoNotification() {
CloseNotification();
}
-void DataPromoNotification::RegisterPrefs(PrefServiceSimple* local_state) {
+void DataPromoNotification::RegisterPrefs(PrefRegistrySimple* registry) {
// Carrier deal notification shown count defaults to 0.
- local_state->RegisterIntegerPref(prefs::kCarrierDealPromoShown, 0);
+ registry->RegisterIntegerPref(prefs::kCarrierDealPromoShown, 0);
}
void DataPromoNotification::ShowOptionalMobileDataPromoNotification(
diff --git a/chrome/browser/chromeos/status/data_promo_notification.h b/chrome/browser/chromeos/status/data_promo_notification.h
index e1a03a3..072bd48 100644
--- a/chrome/browser/chromeos/status/data_promo_notification.h
+++ b/chrome/browser/chromeos/status/data_promo_notification.h
@@ -8,7 +8,7 @@
#include "base/basictypes.h"
#include "base/memory/weak_ptr.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace ash {
class NetworkTrayDelegate;
@@ -26,7 +26,7 @@ class DataPromoNotification {
DataPromoNotification();
virtual ~DataPromoNotification();
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
const std::string& deal_info_url() const { return deal_info_url_; }
const std::string& deal_topup_url() const { return deal_topup_url_; }
diff --git a/chrome/browser/component_updater/recovery_component_installer.cc b/chrome/browser/component_updater/recovery_component_installer.cc
index 673a6ce..3573549 100644
--- a/chrome/browser/component_updater/recovery_component_installer.cc
+++ b/chrome/browser/component_updater/recovery_component_installer.cc
@@ -16,6 +16,7 @@
#include "base/string_util.h"
#include "base/values.h"
#include "chrome/browser/component_updater/component_updater_service.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/pref_names.h"
@@ -61,12 +62,14 @@ class RecoveryComponentInstaller : public ComponentInstaller {
};
void RecoveryRegisterHelper(ComponentUpdateService* cus,
- PrefServiceSimple* prefs) {
+ PrefService* prefs) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// TODO(joi): Registrations for local state prefs shouldn't happen
// like this, they should be done via
// browser_prefs::RegisterLocalState.
- prefs->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0");
+ static_cast<PrefRegistrySimple*>(
+ prefs->DeprecatedGetPrefRegistry())->RegisterStringPref(
+ prefs::kRecoveryComponentVersion, "0.0.0.0");
Version version(prefs->GetString(prefs::kRecoveryComponentVersion));
if (!version.IsValid()) {
NOTREACHED();
@@ -134,7 +137,7 @@ bool RecoveryComponentInstaller::Install(base::DictionaryValue* manifest,
}
void RegisterRecoveryComponent(ComponentUpdateService* cus,
- PrefServiceSimple* prefs) {
+ PrefService* prefs) {
#if !defined(OS_CHROMEOS)
// We delay execute the registration because we are not required in
// the critical path during browser startup.
diff --git a/chrome/browser/component_updater/recovery_component_installer.h b/chrome/browser/component_updater/recovery_component_installer.h
index 5dd3bfa..9512852 100644
--- a/chrome/browser/component_updater/recovery_component_installer.h
+++ b/chrome/browser/component_updater/recovery_component_installer.h
@@ -6,13 +6,13 @@
#define CHROME_BROWSER_COMPONENT_UPDATER_RECOVERY_COMPONENT_INSTALLER_H_
class ComponentUpdateService;
-class PrefServiceSimple;
+class PrefService;
// Component update registration for the recovery component. The job of the
// recovery component is to repair the chrome installation or repair the Google
// update installation. This is a last resort safety mechanism.
void RegisterRecoveryComponent(ComponentUpdateService* cus,
- PrefServiceSimple* prefs);
+ PrefService* prefs);
#endif // CHROME_BROWSER_COMPONENT_UPDATER_RECOVERY_COMPONENT_INSTALLER_H_
diff --git a/chrome/browser/extensions/app_launcher.cc b/chrome/browser/extensions/app_launcher.cc
index 7590bbd..3855177 100644
--- a/chrome/browser/extensions/app_launcher.cc
+++ b/chrome/browser/extensions/app_launcher.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
@@ -102,7 +103,7 @@ bool IsAppLauncherEnabled() {
namespace app_launcher {
-void RegisterPrefs(PrefServiceSimple* pref_service) {
+void RegisterPrefs(PrefRegistrySimple* registry) {
// If it is impossible to synchronously determine whether the app launcher is
// enabled, assume it is disabled. Anything that needs to know the absolute
// truth should call UpdateIsAppLauncherEnabled().
@@ -112,7 +113,7 @@ void RegisterPrefs(PrefServiceSimple* pref_service) {
// that the value hasn't changed since last time it was checked, using this
// preference.
bool is_enabled = SynchronousAppLauncherChecks() == APP_LAUNCHER_ENABLED;
- pref_service->RegisterBooleanPref(prefs::kAppLauncherIsEnabled, is_enabled);
+ registry->RegisterBooleanPref(prefs::kAppLauncherIsEnabled, is_enabled);
}
} // namespace app_launcher
diff --git a/chrome/browser/extensions/app_launcher.h b/chrome/browser/extensions/app_launcher.h
index 8a4b062..5d07673 100644
--- a/chrome/browser/extensions/app_launcher.h
+++ b/chrome/browser/extensions/app_launcher.h
@@ -8,7 +8,7 @@
#include "base/basictypes.h"
#include "base/callback_forward.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace extensions {
@@ -26,7 +26,7 @@ void UpdateIsAppLauncherEnabled(
bool IsAppLauncherEnabled();
namespace app_launcher {
-void RegisterPrefs(PrefServiceSimple* pref_service);
+void RegisterPrefs(PrefRegistrySimple* registry);
}
} // namespace extensions
diff --git a/chrome/browser/extensions/component_loader_unittest.cc b/chrome/browser/extensions/component_loader_unittest.cc
index 87a00ba..9c1b3e5 100644
--- a/chrome/browser/extensions/component_loader_unittest.cc
+++ b/chrome/browser/extensions/component_loader_unittest.cc
@@ -9,6 +9,7 @@
#include "base/file_util.h"
#include "base/path_service.h"
#include "chrome/browser/extensions/test_extension_service.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_set.h"
@@ -100,7 +101,8 @@ class ComponentLoaderTest : public testing::Test {
// Register the local state prefs.
#if defined(OS_CHROMEOS)
- local_state_.RegisterBooleanPref(prefs::kSpokenFeedbackEnabled, false);
+ local_state_.registry()->RegisterBooleanPref(
+ prefs::kSpokenFeedbackEnabled, false);
#endif
}
diff --git a/chrome/browser/external_protocol/external_protocol_handler.cc b/chrome/browser/external_protocol/external_protocol_handler.cc
index 18f3218..9eeed5b 100644
--- a/chrome/browser/external_protocol/external_protocol_handler.cc
+++ b/chrome/browser/external_protocol/external_protocol_handler.cc
@@ -14,6 +14,7 @@
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/platform_util.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/common/pref_names.h"
@@ -296,8 +297,8 @@ void ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(const GURL& url) {
}
// static
-void ExternalProtocolHandler::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterDictionaryPref(prefs::kExcludedSchemes);
+void ExternalProtocolHandler::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterDictionaryPref(prefs::kExcludedSchemes);
}
// static
diff --git a/chrome/browser/external_protocol/external_protocol_handler.h b/chrome/browser/external_protocol/external_protocol_handler.h
index ae61f92..7b5fa3f 100644
--- a/chrome/browser/external_protocol/external_protocol_handler.h
+++ b/chrome/browser/external_protocol/external_protocol_handler.h
@@ -10,7 +10,7 @@
#include "chrome/browser/shell_integration.h"
class GURL;
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace base {
class DictionaryValue;
@@ -78,7 +78,7 @@ class ExternalProtocolHandler {
int routing_id);
// Register the ExcludedSchemes preference.
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Starts a url using the external protocol handler with the help
// of shellexecute. Should only be called if the protocol is whitelisted
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
index aa2dd46..f4a8386 100644
--- a/chrome/browser/first_run/first_run.cc
+++ b/chrome/browser/first_run/first_run.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/importer/importer_list.h"
#include "chrome/browser/importer/importer_progress_dialog.h"
#include "chrome/browser/importer/importer_progress_observer.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/process_singleton.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -435,26 +436,29 @@ bool SetShowFirstRunBubblePref(FirstRunBubbleOptions show_bubble_option) {
}
bool SetShowWelcomePagePref() {
- PrefServiceSimple* local_state = g_browser_process->local_state();
+ PrefService* local_state = g_browser_process->local_state();
if (!local_state)
return false;
// TODO(joi): This should happen via browser_prefs::RegisterLocalState().
if (!local_state->FindPreference(prefs::kShouldShowWelcomePage)) {
- local_state->RegisterBooleanPref(prefs::kShouldShowWelcomePage, false);
+ static_cast<PrefRegistrySimple*>(
+ local_state->DeprecatedGetPrefRegistry())->RegisterBooleanPref(
+ prefs::kShouldShowWelcomePage, false);
local_state->SetBoolean(prefs::kShouldShowWelcomePage, true);
}
return true;
}
bool SetPersonalDataManagerFirstRunPref() {
- PrefServiceSimple* local_state = g_browser_process->local_state();
+ PrefService* local_state = g_browser_process->local_state();
if (!local_state)
return false;
if (!local_state->FindPreference(
prefs::kAutofillPersonalDataManagerFirstRun)) {
// TODO(joi): This should happen via browser_prefs::RegisterLocalState().
- local_state->RegisterBooleanPref(
- prefs::kAutofillPersonalDataManagerFirstRun, false);
+ static_cast<PrefRegistrySimple*>(
+ local_state->DeprecatedGetPrefRegistry())->RegisterBooleanPref(
+ prefs::kAutofillPersonalDataManagerFirstRun, false);
local_state->SetBoolean(prefs::kAutofillPersonalDataManagerFirstRun, true);
}
return true;
diff --git a/chrome/browser/geolocation/chrome_access_token_store.cc b/chrome/browser/geolocation/chrome_access_token_store.cc
index b895ee7..e01886e 100644
--- a/chrome/browser/geolocation/chrome_access_token_store.cc
+++ b/chrome/browser/geolocation/chrome_access_token_store.cc
@@ -9,6 +9,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/common/pref_names.h"
@@ -98,8 +99,8 @@ class TokenLoadingJob : public base::RefCountedThreadSafe<TokenLoadingJob> {
} // namespace
-void ChromeAccessTokenStore::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterDictionaryPref(prefs::kGeolocationAccessToken);
+void ChromeAccessTokenStore::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterDictionaryPref(prefs::kGeolocationAccessToken);
}
ChromeAccessTokenStore::ChromeAccessTokenStore() {}
diff --git a/chrome/browser/geolocation/chrome_access_token_store.h b/chrome/browser/geolocation/chrome_access_token_store.h
index b1ecd56..ab7bada 100644
--- a/chrome/browser/geolocation/chrome_access_token_store.h
+++ b/chrome/browser/geolocation/chrome_access_token_store.h
@@ -8,12 +8,12 @@
#include "base/memory/ref_counted.h"
#include "content/public/browser/access_token_store.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
// Creates a new access token store backed by the global chome prefs.
class ChromeAccessTokenStore : public content::AccessTokenStore {
public:
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
ChromeAccessTokenStore();
diff --git a/chrome/browser/geolocation/geolocation_prefs.cc b/chrome/browser/geolocation/geolocation_prefs.cc
index 352e1f9..dcfc2ec 100644
--- a/chrome/browser/geolocation/geolocation_prefs.cc
+++ b/chrome/browser/geolocation/geolocation_prefs.cc
@@ -8,9 +8,9 @@
#include "chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h"
namespace geolocation {
-void RegisterPrefs(PrefServiceSimple* prefs) {
+void RegisterPrefs(PrefRegistrySimple* registry) {
// Fan out to all geolocation sub-components that use prefs.
- ChromeAccessTokenStore::RegisterPrefs(prefs);
+ ChromeAccessTokenStore::RegisterPrefs(registry);
}
} // namespace geolocation
diff --git a/chrome/browser/geolocation/geolocation_prefs.h b/chrome/browser/geolocation/geolocation_prefs.h
index c4fc954..d5be8e5 100644
--- a/chrome/browser/geolocation/geolocation_prefs.h
+++ b/chrome/browser/geolocation/geolocation_prefs.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PREFS_H_
#define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PREFS_H_
-class PrefServiceSimple;
+class PrefRegistrySimple;
class PrefServiceSyncable;
namespace geolocation {
-void RegisterPrefs(PrefServiceSimple* prefs);
+void RegisterPrefs(PrefRegistrySimple* registry);
}
#endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PREFS_H_
diff --git a/chrome/browser/gpu/gl_string_manager.cc b/chrome/browser/gpu/gl_string_manager.cc
index a9216f5..1f2382d 100644
--- a/chrome/browser/gpu/gl_string_manager.cc
+++ b/chrome/browser/gpu/gl_string_manager.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/gpu/gl_string_manager.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/gpu_data_manager.h"
@@ -21,14 +22,16 @@ void GLStringManager::Initialize() {
// We never remove this observer from GpuDataManager.
content::GpuDataManager::GetInstance()->AddObserver(this);
- PrefServiceSimple* local_state = g_browser_process->local_state();
+ PrefService* local_state = g_browser_process->local_state();
if (!local_state)
return;
// TODO(joi): This should happen via browser_prefs::RegisterLocalState().
- local_state->RegisterStringPref(prefs::kGLVendorString, gl_vendor_);
- local_state->RegisterStringPref(prefs::kGLRendererString, gl_renderer_);
- local_state->RegisterStringPref(prefs::kGLVersionString, gl_version_);
+ PrefRegistrySimple* registry = static_cast<PrefRegistrySimple*>(
+ local_state->DeprecatedGetPrefRegistry());
+ registry->RegisterStringPref(prefs::kGLVendorString, gl_vendor_);
+ registry->RegisterStringPref(prefs::kGLRendererString, gl_renderer_);
+ registry->RegisterStringPref(prefs::kGLVersionString, gl_version_);
gl_vendor_ = local_state->GetString(prefs::kGLVendorString);
gl_renderer_ = local_state->GetString(prefs::kGLRendererString);
diff --git a/chrome/browser/intranet_redirect_detector.cc b/chrome/browser/intranet_redirect_detector.cc
index a2ae736..c92000e 100644
--- a/chrome/browser/intranet_redirect_detector.cc
+++ b/chrome/browser/intranet_redirect_detector.cc
@@ -10,6 +10,7 @@
#include "base/stl_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
@@ -55,9 +56,9 @@ GURL IntranetRedirectDetector::RedirectOrigin() {
}
// static
-void IntranetRedirectDetector::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterStringPref(prefs::kLastKnownIntranetRedirectOrigin,
- std::string());
+void IntranetRedirectDetector::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterStringPref(prefs::kLastKnownIntranetRedirectOrigin,
+ std::string());
}
void IntranetRedirectDetector::FinishSleep() {
diff --git a/chrome/browser/intranet_redirect_detector.h b/chrome/browser/intranet_redirect_detector.h
index a0a575d..5518234 100644
--- a/chrome/browser/intranet_redirect_detector.h
+++ b/chrome/browser/intranet_redirect_detector.h
@@ -17,7 +17,7 @@
#include "net/base/network_change_notifier.h"
#include "net/url_request/url_fetcher_delegate.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
// This object is responsible for determining whether the user is on a network
// that redirects requests for intranet hostnames to another site, and if so,
@@ -52,7 +52,7 @@ class IntranetRedirectDetector
// is in place.
static GURL RedirectOrigin();
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// The number of characters the fetcher will use for its randomly-generated
// hostnames.
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 556862d..38f4da4 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -35,6 +35,7 @@
#include "chrome/browser/net/sdch_dictionary_fetcher.h"
#include "chrome/browser/net/spdyproxy/http_auth_handler_spdyproxy.h"
#include "chrome/browser/policy/policy_service.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
@@ -363,7 +364,7 @@ IOThread::Globals::~Globals() {}
// |local_state| is passed in explicitly in order to (1) reduce implicit
// dependencies and (2) make IOThread more flexible for testing.
IOThread::IOThread(
- PrefServiceSimple* local_state,
+ PrefService* local_state,
policy::PolicyService* policy_service,
ChromeNetLog* net_log,
extensions::EventRouterForwarder* extension_event_router_forwarder)
@@ -381,7 +382,9 @@ IOThread::IOThread(
//
// TODO(joi): See if we can fix so it does get registered from
// browser_prefs::RegisterLocalState.
- RegisterPrefs(local_state);
+ PrefRegistrySimple* registry = static_cast<PrefRegistrySimple*>(
+ local_state->DeprecatedGetPrefRegistry());
+ RegisterPrefs(registry);
auth_schemes_ = local_state->GetString(prefs::kAuthSchemes);
negotiate_disable_cname_lookup_ = local_state->GetBoolean(
prefs::kDisableAuthNegotiateCnameLookup);
@@ -740,21 +743,21 @@ void IOThread::EnableSpdy(const std::string& mode) {
}
// static
-void IOThread::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterStringPref(prefs::kAuthSchemes,
- "basic,digest,ntlm,negotiate,"
- "spdyproxy");
- local_state->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup,
- false);
- local_state->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false);
- local_state->RegisterStringPref(prefs::kAuthServerWhitelist, "");
- local_state->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, "");
- local_state->RegisterStringPref(prefs::kGSSAPILibraryName, "");
- local_state->RegisterStringPref(prefs::kSpdyProxyOrigin, "");
- local_state->RegisterBooleanPref(prefs::kEnableReferrers, true);
- local_state->RegisterInt64Pref(prefs::kHttpReceivedContentLength, 0);
- local_state->RegisterInt64Pref(prefs::kHttpOriginalContentLength, 0);
- local_state->RegisterBooleanPref(
+void IOThread::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterStringPref(prefs::kAuthSchemes,
+ "basic,digest,ntlm,negotiate,"
+ "spdyproxy");
+ registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup,
+ false);
+ registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false);
+ registry->RegisterStringPref(prefs::kAuthServerWhitelist, "");
+ registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, "");
+ registry->RegisterStringPref(prefs::kGSSAPILibraryName, "");
+ registry->RegisterStringPref(prefs::kSpdyProxyOrigin, "");
+ registry->RegisterBooleanPref(prefs::kEnableReferrers, true);
+ registry->RegisterInt64Pref(prefs::kHttpReceivedContentLength, 0);
+ registry->RegisterInt64Pref(prefs::kHttpOriginalContentLength, 0);
+ registry->RegisterBooleanPref(
prefs::kBuiltInDnsClientEnabled,
chrome_browser_net::ConfigureAsyncDnsFieldTrial());
}
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h
index 431eb92..a70c99e 100644
--- a/chrome/browser/io_thread.h
+++ b/chrome/browser/io_thread.h
@@ -24,7 +24,7 @@ class ChromeNetLog;
class CommandLine;
class PrefProxyConfigTrackerImpl;
class PrefService;
-class PrefServiceSimple;
+class PrefRegistrySimple;
class SystemURLRequestContextGetter;
namespace chrome_browser_net {
@@ -171,7 +171,7 @@ class IOThread : public content::BrowserThreadDelegate {
};
// |net_log| must either outlive the IOThread or be NULL.
- IOThread(PrefServiceSimple* local_state,
+ IOThread(PrefService* local_state,
policy::PolicyService* policy_service,
ChromeNetLog* net_log,
extensions::EventRouterForwarder* extension_event_router_forwarder);
@@ -236,7 +236,7 @@ class IOThread : public content::BrowserThreadDelegate {
// SystemRequestContext state has been initialized on the UI thread.
void InitSystemRequestContextOnIOThread();
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory(
net::HostResolver* resolver);
diff --git a/chrome/browser/managed_mode/managed_mode.cc b/chrome/browser/managed_mode/managed_mode.cc
index 5749d81..5f426c7 100644
--- a/chrome/browser/managed_mode/managed_mode.cc
+++ b/chrome/browser/managed_mode/managed_mode.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/managed_mode/managed_mode_site_list.h"
#include "chrome/browser/policy/url_blacklist_manager.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
@@ -33,8 +34,8 @@ ManagedMode* ManagedMode::GetInstance() {
}
// static
-void ManagedMode::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterBooleanPref(prefs::kInManagedMode, false);
+void ManagedMode::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterBooleanPref(prefs::kInManagedMode, false);
}
// static
diff --git a/chrome/browser/managed_mode/managed_mode.h b/chrome/browser/managed_mode/managed_mode.h
index a079128..8318336 100644
--- a/chrome/browser/managed_mode/managed_mode.h
+++ b/chrome/browser/managed_mode/managed_mode.h
@@ -24,7 +24,7 @@ struct DefaultSingletonTraits;
class ManagedModeSiteList;
class ManagedModeURLFilter;
class PrefChangeRegistrar;
-class PrefServiceSimple;
+class PrefRegistrySimple;
class PrefServiceSyncable;
class Profile;
@@ -42,7 +42,7 @@ class ManagedMode : public chrome::BrowserListObserver,
public:
typedef base::Callback<void(bool)> EnterCallback;
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Initializes the singleton, setting the managed_profile_. Must be called
// after g_browser_process and the LocalState have been created.
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index 375d6fc..03fa5cf 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/plugins/plugin_prefs.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_version_info.h"
@@ -380,8 +381,8 @@ MetricsLog::MetricsLog(const std::string& client_id, int session_id)
MetricsLog::~MetricsLog() {}
// static
-void MetricsLog::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterListPref(prefs::kStabilityPluginStats);
+void MetricsLog::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterListPref(prefs::kStabilityPluginStats);
}
// static
diff --git a/chrome/browser/metrics/metrics_log.h b/chrome/browser/metrics/metrics_log.h
index afb1cb4..3c6ae45 100644
--- a/chrome/browser/metrics/metrics_log.h
+++ b/chrome/browser/metrics/metrics_log.h
@@ -23,7 +23,7 @@
struct AutocompleteLog;
class PrefService;
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace base {
class DictionaryValue;
@@ -68,7 +68,7 @@ class MetricsLog : public MetricsLogBase {
MetricsLog(const std::string& client_id, int session_id);
virtual ~MetricsLog();
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Get the amount of uptime in seconds since this function was last called.
// This updates the cumulative uptime metric for uninstall as a side effect.
diff --git a/chrome/browser/metrics/metrics_log_unittest.cc b/chrome/browser/metrics/metrics_log_unittest.cc
index ca5fc9a..0a138dc 100644
--- a/chrome/browser/metrics/metrics_log_unittest.cc
+++ b/chrome/browser/metrics/metrics_log_unittest.cc
@@ -15,9 +15,9 @@
#include "chrome/browser/metrics/metrics_log.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/common/metrics/variations/variations_util.h"
#include "chrome/common/metrics/proto/profiler_event.pb.h"
#include "chrome/common/metrics/proto/system_profile.pb.h"
+#include "chrome/common/metrics/variations/variations_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/installer/util/google_update_settings.h"
#include "chrome/test/base/testing_pref_service.h"
@@ -51,7 +51,7 @@ class TestMetricsLog : public MetricsLog {
TestMetricsLog(const std::string& client_id, int session_id)
: MetricsLog(client_id, session_id),
brand_for_testing_(kBrandForTesting) {
- chrome::RegisterLocalState(&prefs_);
+ chrome::RegisterLocalState(prefs_.registry(), &prefs_);
#if defined(OS_CHROMEOS)
prefs_.SetInteger(prefs::kStabilityChildProcessCrashCount, 10);
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index 5154ff0..be0574e 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -178,6 +178,7 @@
#include "chrome/browser/metrics/tracking_synchronizer.h"
#include "chrome/browser/net/http_pipelining_compatibility_client.h"
#include "chrome/browser/net/network_stats.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile.h"
@@ -434,55 +435,52 @@ class MetricsMemoryDetails : public MemoryDetails {
};
// static
-void MetricsService::RegisterPrefs(PrefServiceSimple* local_state) {
+void MetricsService::RegisterPrefs(PrefRegistrySimple* registry) {
DCHECK(IsSingleThreaded());
- local_state->RegisterStringPref(prefs::kMetricsClientID, "");
- local_state->RegisterIntegerPref(prefs::kMetricsLowEntropySource,
- kLowEntropySourceNotSet);
- local_state->RegisterInt64Pref(prefs::kMetricsClientIDTimestamp, 0);
- local_state->RegisterInt64Pref(prefs::kStabilityLaunchTimeSec, 0);
- local_state->RegisterInt64Pref(prefs::kStabilityLastTimestampSec, 0);
- local_state->RegisterStringPref(prefs::kStabilityStatsVersion, "");
- local_state->RegisterInt64Pref(prefs::kStabilityStatsBuildTime, 0);
- local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true);
- local_state->RegisterBooleanPref(prefs::kStabilitySessionEndCompleted, true);
- local_state->RegisterIntegerPref(prefs::kMetricsSessionID, -1);
- local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0);
- local_state->RegisterIntegerPref(prefs::kStabilityCrashCount, 0);
- local_state->RegisterIntegerPref(prefs::kStabilityIncompleteSessionEndCount,
- 0);
- local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0);
- local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0);
- local_state->RegisterIntegerPref(prefs::kStabilityExtensionRendererCrashCount,
- 0);
- local_state->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0);
- local_state->RegisterIntegerPref(prefs::kStabilityChildProcessCrashCount, 0);
- local_state->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationFail,
- 0);
- local_state->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationSuccess,
- 0);
- local_state->RegisterIntegerPref(prefs::kStabilityDebuggerPresent, 0);
- local_state->RegisterIntegerPref(prefs::kStabilityDebuggerNotPresent, 0);
+ registry->RegisterStringPref(prefs::kMetricsClientID, "");
+ registry->RegisterIntegerPref(prefs::kMetricsLowEntropySource,
+ kLowEntropySourceNotSet);
+ registry->RegisterInt64Pref(prefs::kMetricsClientIDTimestamp, 0);
+ registry->RegisterInt64Pref(prefs::kStabilityLaunchTimeSec, 0);
+ registry->RegisterInt64Pref(prefs::kStabilityLastTimestampSec, 0);
+ registry->RegisterStringPref(prefs::kStabilityStatsVersion, "");
+ registry->RegisterInt64Pref(prefs::kStabilityStatsBuildTime, 0);
+ registry->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true);
+ registry->RegisterBooleanPref(prefs::kStabilitySessionEndCompleted, true);
+ registry->RegisterIntegerPref(prefs::kMetricsSessionID, -1);
+ registry->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityCrashCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityIncompleteSessionEndCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityExtensionRendererCrashCount,
+ 0);
+ registry->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityChildProcessCrashCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationFail, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationSuccess,
+ 0);
+ registry->RegisterIntegerPref(prefs::kStabilityDebuggerPresent, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityDebuggerNotPresent, 0);
#if defined(OS_CHROMEOS)
- local_state->RegisterIntegerPref(prefs::kStabilityOtherUserCrashCount, 0);
- local_state->RegisterIntegerPref(prefs::kStabilityKernelCrashCount, 0);
- local_state->RegisterIntegerPref(prefs::kStabilitySystemUncleanShutdownCount,
- 0);
+ registry->RegisterIntegerPref(prefs::kStabilityOtherUserCrashCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityKernelCrashCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilitySystemUncleanShutdownCount, 0);
#endif // OS_CHROMEOS
- local_state->RegisterDictionaryPref(prefs::kProfileMetrics);
- local_state->RegisterIntegerPref(prefs::kNumKeywords, 0);
- local_state->RegisterListPref(prefs::kMetricsInitialLogsXml);
- local_state->RegisterListPref(prefs::kMetricsOngoingLogsXml);
- local_state->RegisterListPref(prefs::kMetricsInitialLogsProto);
- local_state->RegisterListPref(prefs::kMetricsOngoingLogsProto);
-
- local_state->RegisterInt64Pref(prefs::kUninstallMetricsPageLoadCount, 0);
- local_state->RegisterInt64Pref(prefs::kUninstallLaunchCount, 0);
- local_state->RegisterInt64Pref(prefs::kUninstallMetricsInstallDate, 0);
- local_state->RegisterInt64Pref(prefs::kUninstallMetricsUptimeSec, 0);
- local_state->RegisterInt64Pref(prefs::kUninstallLastLaunchTimeSec, 0);
- local_state->RegisterInt64Pref(prefs::kUninstallLastObservedRunTimeSec, 0);
+ registry->RegisterDictionaryPref(prefs::kProfileMetrics);
+ registry->RegisterIntegerPref(prefs::kNumKeywords, 0);
+ registry->RegisterListPref(prefs::kMetricsInitialLogsXml);
+ registry->RegisterListPref(prefs::kMetricsOngoingLogsXml);
+ registry->RegisterListPref(prefs::kMetricsInitialLogsProto);
+ registry->RegisterListPref(prefs::kMetricsOngoingLogsProto);
+
+ registry->RegisterInt64Pref(prefs::kUninstallMetricsPageLoadCount, 0);
+ registry->RegisterInt64Pref(prefs::kUninstallLaunchCount, 0);
+ registry->RegisterInt64Pref(prefs::kUninstallMetricsInstallDate, 0);
+ registry->RegisterInt64Pref(prefs::kUninstallMetricsUptimeSec, 0);
+ registry->RegisterInt64Pref(prefs::kUninstallLastLaunchTimeSec, 0);
+ registry->RegisterInt64Pref(prefs::kUninstallLastObservedRunTimeSec, 0);
}
// static
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index 4c92a43..d14be3d 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -33,7 +33,7 @@
class MetricsReportingScheduler;
class PrefService;
-class PrefServiceSimple;
+class PrefRegistrySimple;
class Profile;
class TemplateURLService;
@@ -123,7 +123,7 @@ class MetricsService
// At startup, prefs needs to be called with a list of all the pref names and
// types we'll be using.
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Set up notifications which indicate that a user is performing work. This is
// useful to allow some features to sleep, until the machine becomes active,
diff --git a/chrome/browser/metrics/variations/variations_service.cc b/chrome/browser/metrics/variations/variations_service.cc
index 6ebfc021..a6fd9ae 100644
--- a/chrome/browser/metrics/variations/variations_service.cc
+++ b/chrome/browser/metrics/variations/variations_service.cc
@@ -15,6 +15,7 @@
#include "base/version.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/metrics/proto/trials_seed.pb.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/metrics/variations/variations_util.h"
@@ -208,10 +209,10 @@ void VariationsService::SetCreateTrialsFromSeedCalledForTesting(bool called) {
}
// static
-void VariationsService::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterStringPref(prefs::kVariationsSeed, std::string());
- prefs->RegisterInt64Pref(prefs::kVariationsSeedDate,
- base::Time().ToInternalValue());
+void VariationsService::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterStringPref(prefs::kVariationsSeed, std::string());
+ registry->RegisterInt64Pref(prefs::kVariationsSeedDate,
+ base::Time().ToInternalValue());
}
// static
diff --git a/chrome/browser/metrics/variations/variations_service.h b/chrome/browser/metrics/variations/variations_service.h
index 95323c2..e0685fe 100644
--- a/chrome/browser/metrics/variations/variations_service.h
+++ b/chrome/browser/metrics/variations/variations_service.h
@@ -26,7 +26,7 @@
#endif
class PrefService;
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace chrome_variations {
@@ -62,7 +62,7 @@ class VariationsService
void SetCreateTrialsFromSeedCalledForTesting(bool called);
// Register Variations related prefs in Local State.
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Factory method for creating a VariationsService.
static VariationsService* Create();
diff --git a/chrome/browser/metrics/variations/variations_service_unittest.cc b/chrome/browser/metrics/variations/variations_service_unittest.cc
index 2137be0..de47944 100644
--- a/chrome/browser/metrics/variations/variations_service_unittest.cc
+++ b/chrome/browser/metrics/variations/variations_service_unittest.cc
@@ -340,7 +340,7 @@ TEST(VariationsServiceTest, IsStudyExpired) {
TEST(VariationsServiceTest, LoadSeed) {
TestingPrefServiceSimple pref_service;
- VariationsService::RegisterPrefs(&pref_service);
+ VariationsService::RegisterPrefs(pref_service.registry());
// Store good seed data to test if loading from prefs works.
TrialsSeed seed = CreateTestSeed();
@@ -380,7 +380,7 @@ TEST(VariationsServiceTest, LoadSeed) {
TEST(VariationsServiceTest, StoreSeed) {
TestingPrefServiceSimple pref_service;
- VariationsService::RegisterPrefs(&pref_service);
+ VariationsService::RegisterPrefs(pref_service.registry());
const base::Time now = base::Time::Now();
TrialsSeed seed = CreateTestSeed();
diff --git a/chrome/browser/net/http_server_properties_manager_unittest.cc b/chrome/browser/net/http_server_properties_manager_unittest.cc
index 6495c23..a883900d 100644
--- a/chrome/browser/net/http_server_properties_manager_unittest.cc
+++ b/chrome/browser/net/http_server_properties_manager_unittest.cc
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "base/message_loop.h"
#include "base/values.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_pref_service.h"
#include "content/public/test/test_browser_thread.h"
@@ -84,7 +85,8 @@ class HttpServerPropertiesManagerTest : public testing::Test {
}
virtual void SetUp() OVERRIDE {
- pref_service_.RegisterDictionaryPref(prefs::kHttpServerProperties);
+ pref_service_.registry()->RegisterDictionaryPref(
+ prefs::kHttpServerProperties);
http_server_props_manager_.reset(
new StrictMock<TestingHttpServerPropertiesManager>(&pref_service_));
ExpectCacheUpdate();
diff --git a/chrome/browser/net/pref_proxy_config_tracker_impl.cc b/chrome/browser/net/pref_proxy_config_tracker_impl.cc
index 8134c8f..ccc12ba 100644
--- a/chrome/browser/net/pref_proxy_config_tracker_impl.cc
+++ b/chrome/browser/net/pref_proxy_config_tracker_impl.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/values.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/proxy_config_dictionary.h"
#include "chrome/common/chrome_notification_types.h"
@@ -195,10 +196,9 @@ net::ProxyConfigService::ConfigAvailability
}
// static
-void PrefProxyConfigTrackerImpl::RegisterPrefs(
- PrefServiceSimple* local_state) {
+void PrefProxyConfigTrackerImpl::RegisterPrefs(PrefRegistrySimple* registry) {
DictionaryValue* default_settings = ProxyConfigDictionary::CreateSystem();
- local_state->RegisterDictionaryPref(prefs::kProxy, default_settings);
+ registry->RegisterDictionaryPref(prefs::kProxy, default_settings);
}
// static
diff --git a/chrome/browser/net/pref_proxy_config_tracker_impl.h b/chrome/browser/net/pref_proxy_config_tracker_impl.h
index c280b50..ea546c1 100644
--- a/chrome/browser/net/pref_proxy_config_tracker_impl.h
+++ b/chrome/browser/net/pref_proxy_config_tracker_impl.h
@@ -15,7 +15,7 @@
#include "net/proxy/proxy_config_service.h"
class PrefService;
-class PrefServiceSimple;
+class PrefRegistrySimple;
class PrefServiceSyncable;
// A net::ProxyConfigService implementation that applies preference proxy
@@ -119,7 +119,7 @@ class PrefProxyConfigTrackerImpl {
// Registers the proxy preferences. These are actually registered
// the same way in local state and in user prefs.
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
static void RegisterUserPrefs(PrefServiceSyncable* user_prefs);
protected:
diff --git a/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc b/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc
index cf2b6c8..34a2491 100644
--- a/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc
+++ b/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc
@@ -8,6 +8,7 @@
#include "base/file_path.h"
#include "base/message_loop.h"
#include "chrome/browser/net/chrome_url_request_context.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service_mock_builder.h"
#include "chrome/browser/prefs/proxy_config_dictionary.h"
#include "chrome/common/chrome_switches.h"
@@ -77,9 +78,9 @@ class PrefProxyConfigTrackerImplTestBase : public TESTBASE {
: ui_thread_(BrowserThread::UI, &loop_),
io_thread_(BrowserThread::IO, &loop_) {}
- virtual void Init(PrefServiceSimple* pref_service) {
+ virtual void Init(PrefService* pref_service, PrefRegistrySimple* registry) {
ASSERT_TRUE(pref_service);
- PrefProxyConfigTrackerImpl::RegisterPrefs(pref_service);
+ PrefProxyConfigTrackerImpl::RegisterPrefs(registry);
fixed_config_.set_pac_url(GURL(kFixedPacUrl));
delegate_service_ =
new TestProxyConfigService(fixed_config_,
@@ -118,7 +119,7 @@ class PrefProxyConfigTrackerImplTest
protected:
virtual void SetUp() {
pref_service_.reset(new TestingPrefServiceSimple());
- Init(pref_service_.get());
+ Init(pref_service_.get(), pref_service_->registry());
}
scoped_ptr<TestingPrefServiceSimple> pref_service_;
@@ -338,15 +339,16 @@ class PrefProxyConfigTrackerImplCommandLineTest
else if (name)
command_line_.AppendSwitch(name);
}
+ scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple;
pref_service_.reset(
PrefServiceMockBuilder().WithCommandLine(
- &command_line_).CreateSimple());
- Init(pref_service_.get());
+ &command_line_).Create(registry));
+ Init(pref_service_.get(), registry);
}
private:
CommandLine command_line_;
- scoped_ptr<PrefServiceSimple> pref_service_;
+ scoped_ptr<PrefService> pref_service_;
};
TEST_P(PrefProxyConfigTrackerImplCommandLineTest, CommandLine) {
diff --git a/chrome/browser/net/ssl_config_service_manager.h b/chrome/browser/net/ssl_config_service_manager.h
index 570d496..dd98293a 100644
--- a/chrome/browser/net/ssl_config_service_manager.h
+++ b/chrome/browser/net/ssl_config_service_manager.h
@@ -10,7 +10,7 @@ class SSLConfigService;
} // namespace net
class PrefService;
-class PrefServiceSimple;
+class PrefRegistrySimple;
// An interface for creating SSLConfigService objects.
class SSLConfigServiceManager {
@@ -23,7 +23,7 @@ class SSLConfigServiceManager {
PrefService* local_state,
PrefService* user_prefs);
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
virtual ~SSLConfigServiceManager() {}
diff --git a/chrome/browser/net/ssl_config_service_manager_pref.cc b/chrome/browser/net/ssl_config_service_manager_pref.cc
index 07be26b..db0d009 100644
--- a/chrome/browser/net/ssl_config_service_manager_pref.cc
+++ b/chrome/browser/net/ssl_config_service_manager_pref.cc
@@ -12,6 +12,7 @@
#include "base/prefs/public/pref_change_registrar.h"
#include "base/prefs/public/pref_member.h"
#include "chrome/browser/content_settings/content_settings_utils.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/content_settings.h"
@@ -149,7 +150,7 @@ class SSLConfigServiceManagerPref
virtual ~SSLConfigServiceManagerPref() {}
// Register local_state SSL preferences.
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
virtual net::SSLConfigService* Get();
@@ -245,22 +246,21 @@ SSLConfigServiceManagerPref::SSLConfigServiceManagerPref(
}
// static
-void SSLConfigServiceManagerPref::RegisterPrefs(
- PrefServiceSimple* local_state) {
+void SSLConfigServiceManagerPref::RegisterPrefs(PrefRegistrySimple* registry) {
net::SSLConfig default_config;
- local_state->RegisterBooleanPref(prefs::kCertRevocationCheckingEnabled,
- default_config.rev_checking_enabled);
+ registry->RegisterBooleanPref(prefs::kCertRevocationCheckingEnabled,
+ default_config.rev_checking_enabled);
std::string version_min_str =
SSLProtocolVersionToString(default_config.version_min);
std::string version_max_str =
SSLProtocolVersionToString(default_config.version_max);
- local_state->RegisterStringPref(prefs::kSSLVersionMin, version_min_str);
- local_state->RegisterStringPref(prefs::kSSLVersionMax, version_max_str);
- local_state->RegisterBooleanPref(prefs::kEnableOriginBoundCerts,
- default_config.channel_id_enabled);
- local_state->RegisterBooleanPref(prefs::kDisableSSLRecordSplitting,
- !default_config.false_start_enabled);
- local_state->RegisterListPref(prefs::kCipherSuiteBlacklist);
+ registry->RegisterStringPref(prefs::kSSLVersionMin, version_min_str);
+ registry->RegisterStringPref(prefs::kSSLVersionMax, version_max_str);
+ registry->RegisterBooleanPref(prefs::kEnableOriginBoundCerts,
+ default_config.channel_id_enabled);
+ registry->RegisterBooleanPref(prefs::kDisableSSLRecordSplitting,
+ !default_config.false_start_enabled);
+ registry->RegisterListPref(prefs::kCipherSuiteBlacklist);
}
net::SSLConfigService* SSLConfigServiceManagerPref::Get() {
@@ -353,6 +353,6 @@ SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager(
}
// static
-void SSLConfigServiceManager::RegisterPrefs(PrefServiceSimple* prefs) {
- SSLConfigServiceManagerPref::RegisterPrefs(prefs);
+void SSLConfigServiceManager::RegisterPrefs(PrefRegistrySimple* registry) {
+ SSLConfigServiceManagerPref::RegisterPrefs(registry);
}
diff --git a/chrome/browser/net/ssl_config_service_manager_pref_unittest.cc b/chrome/browser/net/ssl_config_service_manager_pref_unittest.cc
index 4149637..8b7306a 100644
--- a/chrome/browser/net/ssl_config_service_manager_pref_unittest.cc
+++ b/chrome/browser/net/ssl_config_service_manager_pref_unittest.cc
@@ -10,6 +10,7 @@
#include "base/prefs/testing_pref_store.h"
#include "base/values.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service_mock_builder.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/content_settings.h"
@@ -61,7 +62,7 @@ class SSLConfigServiceManagerPrefTest : public testing::Test {
// Test channel id with no user prefs.
TEST_F(SSLConfigServiceManagerPrefTest, ChannelIDWithoutUserPrefs) {
TestingPrefServiceSimple local_state;
- SSLConfigServiceManager::RegisterPrefs(&local_state);
+ SSLConfigServiceManager::RegisterPrefs(local_state.registry());
local_state.SetUserPref(prefs::kEnableOriginBoundCerts,
Value::CreateBooleanValue(false));
@@ -87,7 +88,7 @@ TEST_F(SSLConfigServiceManagerPrefTest, ChannelIDWithoutUserPrefs) {
// Test channel id with user prefs.
TEST_F(SSLConfigServiceManagerPrefTest, ChannelIDWithUserPrefs) {
TestingPrefServiceSimple local_state;
- SSLConfigServiceManager::RegisterPrefs(&local_state);
+ SSLConfigServiceManager::RegisterPrefs(local_state.registry());
local_state.SetUserPref(prefs::kEnableOriginBoundCerts,
Value::CreateBooleanValue(false));
@@ -152,7 +153,7 @@ TEST_F(SSLConfigServiceManagerPrefTest, ChannelIDWithUserPrefs) {
// every value is expected to be successfully parsed into a cipher suite.
TEST_F(SSLConfigServiceManagerPrefTest, GoodDisabledCipherSuites) {
TestingPrefServiceSimple local_state;
- SSLConfigServiceManager::RegisterPrefs(&local_state);
+ SSLConfigServiceManager::RegisterPrefs(local_state.registry());
scoped_ptr<SSLConfigServiceManager> config_manager(
SSLConfigServiceManager::CreateDefaultManager(&local_state, NULL));
@@ -187,7 +188,7 @@ TEST_F(SSLConfigServiceManagerPrefTest, GoodDisabledCipherSuites) {
// should be ignored.
TEST_F(SSLConfigServiceManagerPrefTest, BadDisabledCipherSuites) {
TestingPrefServiceSimple local_state;
- SSLConfigServiceManager::RegisterPrefs(&local_state);
+ SSLConfigServiceManager::RegisterPrefs(local_state.registry());
scoped_ptr<SSLConfigServiceManager> config_manager(
SSLConfigServiceManager::CreateDefaultManager(&local_state, NULL));
@@ -226,9 +227,10 @@ TEST_F(SSLConfigServiceManagerPrefTest, NoCommandLinePrefs) {
PrefServiceMockBuilder builder;
builder.WithUserPrefs(local_state_store.get());
- scoped_ptr<PrefServiceSimple> local_state(builder.CreateSimple());
+ scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple;
+ scoped_ptr<PrefService> local_state(builder.Create(registry));
- SSLConfigServiceManager::RegisterPrefs(local_state.get());
+ SSLConfigServiceManager::RegisterPrefs(registry);
scoped_ptr<SSLConfigServiceManager> config_manager(
SSLConfigServiceManager::CreateDefaultManager(local_state.get(), NULL));
@@ -269,9 +271,10 @@ TEST_F(SSLConfigServiceManagerPrefTest, CommandLinePrefs) {
PrefServiceMockBuilder builder;
builder.WithUserPrefs(local_state_store.get());
builder.WithCommandLine(&command_line);
- scoped_ptr<PrefServiceSimple> local_state(builder.CreateSimple());
+ scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple;
+ scoped_ptr<PrefService> local_state(builder.Create(registry));
- SSLConfigServiceManager::RegisterPrefs(local_state.get());
+ SSLConfigServiceManager::RegisterPrefs(registry);
scoped_ptr<SSLConfigServiceManager> config_manager(
SSLConfigServiceManager::CreateDefaultManager(local_state.get(), NULL));
diff --git a/chrome/browser/notifications/desktop_notifications_unittest.cc b/chrome/browser/notifications/desktop_notifications_unittest.cc
index a78b946..8925bb3 100644
--- a/chrome/browser/notifications/desktop_notifications_unittest.cc
+++ b/chrome/browser/notifications/desktop_notifications_unittest.cc
@@ -103,7 +103,7 @@ void DesktopNotificationsTest::SetUp() {
active_desktop_monitor_.reset(new ActiveDesktopMonitor);
#endif
- chrome::RegisterLocalState(&local_state_);
+ chrome::RegisterLocalState(local_state_.registry(), &local_state_);
profile_.reset(new TestingProfile());
ui_manager_.reset(new BalloonNotificationUIManager(&local_state_));
balloon_collection_ = new MockBalloonCollection();
diff --git a/chrome/browser/notifications/notification_prefs_manager.cc b/chrome/browser/notifications/notification_prefs_manager.cc
index 01928aa..1283d14 100644
--- a/chrome/browser/notifications/notification_prefs_manager.cc
+++ b/chrome/browser/notifications/notification_prefs_manager.cc
@@ -4,16 +4,22 @@
#include "chrome/browser/notifications/notification_prefs_manager.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
// static
-void NotificationPrefsManager::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterIntegerPref(prefs::kDesktopNotificationPosition,
- BalloonCollection::DEFAULT_POSITION);
+void NotificationPrefsManager::RegisterPrefs(PrefService* prefs,
+ PrefRegistrySimple* registry) {
+ registry->RegisterIntegerPref(prefs::kDesktopNotificationPosition,
+ BalloonCollection::DEFAULT_POSITION);
#if defined(OS_CHROMEOS)
// Option menu for changing desktop notification position on ChromeOS is
// disabled. Force preference to default.
+ //
+ // TODO(joi): This shouldn't be done during registration;
+ // registration should all be done up front, before there even
+ // exists a PrefService.
prefs->SetInteger(prefs::kDesktopNotificationPosition,
BalloonCollection::DEFAULT_POSITION);
#endif
diff --git a/chrome/browser/notifications/notification_prefs_manager.h b/chrome/browser/notifications/notification_prefs_manager.h
index 03856aa..0704887 100644
--- a/chrome/browser/notifications/notification_prefs_manager.h
+++ b/chrome/browser/notifications/notification_prefs_manager.h
@@ -7,7 +7,8 @@
#include "chrome/browser/notifications/balloon_collection.h"
-class PrefServiceSimple;
+class PrefService;
+class PrefRegistrySimple;
// This interface is used to access and mutate the preferences related to
// desktop notifications.
@@ -16,7 +17,7 @@ class NotificationPrefsManager {
virtual ~NotificationPrefsManager() {}
// Registers preferences.
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefService* prefs, PrefRegistrySimple* registry);
// Gets the preference indicating where notifications should be placed.
virtual BalloonCollection::PositionPreference
diff --git a/chrome/browser/plugins/plugin_finder.cc b/chrome/browser/plugins/plugin_finder.cc
index b362c80..d128f8d 100644
--- a/chrome/browser/plugins/plugin_finder.cc
+++ b/chrome/browser/plugins/plugin_finder.cc
@@ -13,6 +13,7 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/plugins/plugin_metadata.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
@@ -135,8 +136,8 @@ PluginMetadata* CreatePluginMetadata(
} // namespace
// static
-void PluginFinder::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterBooleanPref(prefs::kDisablePluginFinder, false);
+void PluginFinder::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterBooleanPref(prefs::kDisablePluginFinder, false);
}
// static
diff --git a/chrome/browser/plugins/plugin_finder.h b/chrome/browser/plugins/plugin_finder.h
index 0b6d1de..b4bbb98 100644
--- a/chrome/browser/plugins/plugin_finder.h
+++ b/chrome/browser/plugins/plugin_finder.h
@@ -10,10 +10,10 @@
#include "base/callback.h"
#include "base/gtest_prod_util.h"
-#include "base/synchronization/lock.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "base/string16.h"
+#include "base/synchronization/lock.h"
#include "webkit/plugins/webplugininfo.h"
namespace base {
@@ -22,7 +22,7 @@ class DictionaryValue;
class GURL;
class PluginMetadata;
-class PrefServiceSimple;
+class PrefRegistrySimple;
#if defined(ENABLE_PLUGIN_INSTALLATION)
class PluginInstaller;
@@ -33,7 +33,7 @@ class PluginInstaller;
// After that it can be safely used on any other thread.
class PluginFinder {
public:
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
static PluginFinder* GetInstance();
diff --git a/chrome/browser/policy/auto_enrollment_client.cc b/chrome/browser/policy/auto_enrollment_client.cc
index fae7665..2c8294f 100644
--- a/chrome/browser/policy/auto_enrollment_client.cc
+++ b/chrome/browser/policy/auto_enrollment_client.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/policy/browser_policy_connector.h"
#include "chrome/browser/policy/device_cloud_policy_manager_chromeos.h"
#include "chrome/browser/policy/device_management_service.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
@@ -92,9 +93,9 @@ AutoEnrollmentClient::AutoEnrollmentClient(const base::Closure& callback,
AutoEnrollmentClient::~AutoEnrollmentClient() {}
// static
-void AutoEnrollmentClient::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterBooleanPref(prefs::kShouldAutoEnroll, false);
- local_state->RegisterIntegerPref(prefs::kAutoEnrollmentPowerLimit, -1);
+void AutoEnrollmentClient::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterBooleanPref(prefs::kShouldAutoEnroll, false);
+ registry->RegisterIntegerPref(prefs::kAutoEnrollmentPowerLimit, -1);
}
// static
diff --git a/chrome/browser/policy/auto_enrollment_client.h b/chrome/browser/policy/auto_enrollment_client.h
index c733139..b21ad1b 100644
--- a/chrome/browser/policy/auto_enrollment_client.h
+++ b/chrome/browser/policy/auto_enrollment_client.h
@@ -16,7 +16,7 @@
#include "third_party/protobuf/src/google/protobuf/repeated_field.h"
class PrefService;
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace enterprise_management {
class DeviceManagementResponse;
@@ -47,7 +47,7 @@ class AutoEnrollmentClient {
virtual ~AutoEnrollmentClient();
// Registers preferences in local state.
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Returns true if auto-enrollment is disabled in this device. In that case,
// instances returned by Create() fail immediately once Start() is invoked.
diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc
index 8b30543..d45ed87 100644
--- a/chrome/browser/policy/browser_policy_connector.cc
+++ b/chrome/browser/policy/browser_policy_connector.cc
@@ -21,8 +21,8 @@
#include "chrome/browser/policy/managed_mode_policy_provider.h"
#include "chrome/browser/policy/policy_service_impl.h"
#include "chrome/browser/policy/policy_statistics_collector.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/prefs/pref_service_simple.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -405,12 +405,12 @@ bool BrowserPolicyConnector::IsNonEnterpriseUser(const std::string& username) {
}
// static
-void BrowserPolicyConnector::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterIntegerPref(prefs::kUserPolicyRefreshRate,
- kDefaultPolicyRefreshRateMs);
+void BrowserPolicyConnector::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterIntegerPref(prefs::kUserPolicyRefreshRate,
+ kDefaultPolicyRefreshRateMs);
#if defined(OS_CHROMEOS)
- local_state->RegisterIntegerPref(prefs::kDevicePolicyRefreshRate,
- kDefaultPolicyRefreshRateMs);
+ registry->RegisterIntegerPref(prefs::kDevicePolicyRefreshRate,
+ kDefaultPolicyRefreshRateMs);
#endif
}
diff --git a/chrome/browser/policy/browser_policy_connector.h b/chrome/browser/policy/browser_policy_connector.h
index 8a95e42..992492c 100644
--- a/chrome/browser/policy/browser_policy_connector.h
+++ b/chrome/browser/policy/browser_policy_connector.h
@@ -14,7 +14,7 @@
#include "chrome/browser/policy/configuration_policy_handler_list.h"
#include "chrome/browser/policy/proxy_policy_provider.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
class Profile;
namespace policy {
@@ -148,7 +148,7 @@ class BrowserPolicyConnector {
static bool IsNonEnterpriseUser(const std::string& username);
// Registers refresh rate prefs.
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
private:
// Complete initialization once the message loops are running and the
diff --git a/chrome/browser/policy/cloud_policy_core_unittest.cc b/chrome/browser/policy/cloud_policy_core_unittest.cc
index 16f6386..18db1b3 100644
--- a/chrome/browser/policy/cloud_policy_core_unittest.cc
+++ b/chrome/browser/policy/cloud_policy_core_unittest.cc
@@ -23,7 +23,7 @@ class CloudPolicyCoreTest : public testing::Test {
: core_(PolicyNamespaceKey(dm_protocol::kChromeUserPolicyType,
std::string()),
&store_) {
- chrome::RegisterLocalState(&prefs_);
+ chrome::RegisterLocalState(prefs_.registry(), &prefs_);
}
MessageLoop loop_;
diff --git a/chrome/browser/policy/device_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/policy/device_cloud_policy_manager_chromeos_unittest.cc
index a990a9d..32cf49f 100644
--- a/chrome/browser/policy/device_cloud_policy_manager_chromeos_unittest.cc
+++ b/chrome/browser/policy/device_cloud_policy_manager_chromeos_unittest.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/policy/proto/chrome_device_policy.pb.h"
#include "chrome/browser/policy/proto/device_management_backend.pb.h"
#include "chrome/browser/prefs/browser_prefs.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/test/base/testing_pref_service.h"
#include "policy/policy_constants.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -46,7 +47,7 @@ class DeviceCloudPolicyManagerChromeOSTest
virtual void SetUp() OVERRIDE {
DeviceSettingsTestBase::SetUp();
- chrome::RegisterLocalState(&local_state_);
+ chrome::RegisterLocalState(local_state_.registry(), &local_state_);
manager_.Init();
}
diff --git a/chrome/browser/policy/device_status_collector.cc b/chrome/browser/policy/device_status_collector.cc
index 1917d07..4776b04 100644
--- a/chrome/browser/policy/device_status_collector.cc
+++ b/chrome/browser/policy/device_status_collector.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/chromeos/settings/cros_settings_names.h"
#include "chrome/browser/chromeos/system/statistics_provider.h"
#include "chrome/browser/policy/proto/device_management_backend.pb.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/common/chrome_notification_types.h"
@@ -152,11 +153,11 @@ DeviceStatusCollector::~DeviceStatusCollector() {
}
// static
-void DeviceStatusCollector::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterDictionaryPref(prefs::kDeviceActivityTimes,
- new base::DictionaryValue);
- local_state->RegisterDictionaryPref(prefs::kDeviceLocation,
- new base::DictionaryValue);
+void DeviceStatusCollector::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterDictionaryPref(prefs::kDeviceActivityTimes,
+ new base::DictionaryValue);
+ registry->RegisterDictionaryPref(prefs::kDeviceLocation,
+ new base::DictionaryValue);
}
void DeviceStatusCollector::CheckIdleState() {
diff --git a/chrome/browser/policy/device_status_collector.h b/chrome/browser/policy/device_status_collector.h
index 2b9a094..b7ef3e8 100644
--- a/chrome/browser/policy/device_status_collector.h
+++ b/chrome/browser/policy/device_status_collector.h
@@ -37,7 +37,7 @@ class DeviceStatusReportRequest;
}
class PrefService;
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace policy {
@@ -64,7 +64,7 @@ class DeviceStatusCollector : public CloudPolicyClient::StatusProvider,
enterprise_management::SessionStatusReportRequest* status) OVERRIDE;
virtual void OnSubmittedSuccessfully() OVERRIDE;
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// How often, in seconds, to poll to see if the user is idle.
static const unsigned int kIdlePollIntervalSeconds = 30;
diff --git a/chrome/browser/policy/device_status_collector_browsertest.cc b/chrome/browser/policy/device_status_collector_browsertest.cc
index 672489a..fc2ae01 100644
--- a/chrome/browser/policy/device_status_collector_browsertest.cc
+++ b/chrome/browser/policy/device_status_collector_browsertest.cc
@@ -143,7 +143,7 @@ class DeviceStatusCollectorTest : public testing::Test {
scoped_ptr<base::Environment> env(base::Environment::Create());
env->SetVar("TZ", "UTC");
- TestingDeviceStatusCollector::RegisterPrefs(&prefs_);
+ TestingDeviceStatusCollector::RegisterPrefs(prefs_.registry());
EXPECT_CALL(statistics_provider_, GetMachineStatistic(_, NotNull()))
.WillRepeatedly(Return(false));
diff --git a/chrome/browser/policy/policy_statistics_collector.cc b/chrome/browser/policy/policy_statistics_collector.cc
index a0d1d93..de762c1 100644
--- a/chrome/browser/policy/policy_statistics_collector.cc
+++ b/chrome/browser/policy/policy_statistics_collector.cc
@@ -12,6 +12,7 @@
#include "base/metrics/histogram.h"
#include "base/task_runner.h"
#include "chrome/browser/policy/policy_service.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
#include "policy/policy_constants.h"
@@ -49,8 +50,8 @@ void PolicyStatisticsCollector::Initialize() {
}
// static
-void PolicyStatisticsCollector::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterInt64Pref(prefs::kLastPolicyStatisticsUpdate, 0);
+void PolicyStatisticsCollector::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterInt64Pref(prefs::kLastPolicyStatisticsUpdate, 0);
}
void PolicyStatisticsCollector::RecordPolicyUse(int id) {
diff --git a/chrome/browser/policy/policy_statistics_collector.h b/chrome/browser/policy/policy_statistics_collector.h
index 961f3d1..08a7c923 100644
--- a/chrome/browser/policy/policy_statistics_collector.h
+++ b/chrome/browser/policy/policy_statistics_collector.h
@@ -11,7 +11,7 @@
#include "base/time.h"
class PrefService;
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace base {
class TaskRunner;
@@ -37,7 +37,7 @@ class PolicyStatisticsCollector {
// Completes initialization and starts periodical statistic updates.
void Initialize();
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
protected:
// protected virtual for mocking.
diff --git a/chrome/browser/policy/policy_statistics_collector_unittest.cc b/chrome/browser/policy/policy_statistics_collector_unittest.cc
index 9c26767..294af94 100644
--- a/chrome/browser/policy/policy_statistics_collector_unittest.cc
+++ b/chrome/browser/policy/policy_statistics_collector_unittest.cc
@@ -60,7 +60,7 @@ class PolicyStatisticsCollectorTest : public testing::Test {
}
virtual void SetUp() OVERRIDE {
- chrome::RegisterLocalState(&prefs_);
+ chrome::RegisterLocalState(prefs_.registry(), &prefs_);
// Find ids for kTestPolicy1 and kTestPolicy2.
const policy::PolicyDefinitionList* policy_list =
diff --git a/chrome/browser/policy/url_blacklist_manager_unittest.cc b/chrome/browser/policy/url_blacklist_manager_unittest.cc
index d800824..81000ec 100644
--- a/chrome/browser/policy/url_blacklist_manager_unittest.cc
+++ b/chrome/browser/policy/url_blacklist_manager_unittest.cc
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/message_loop.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_pref_service.h"
#include "content/public/test/test_browser_thread.h"
@@ -72,8 +73,8 @@ class URLBlacklistManagerTest : public testing::Test {
}
virtual void SetUp() OVERRIDE {
- pref_service_.RegisterListPref(prefs::kUrlBlacklist);
- pref_service_.RegisterListPref(prefs::kUrlWhitelist);
+ pref_service_.registry()->RegisterListPref(prefs::kUrlBlacklist);
+ pref_service_.registry()->RegisterListPref(prefs::kUrlWhitelist);
blacklist_manager_.reset(
new TestingURLBlacklistManager(&pref_service_));
loop_.RunUntilIdle();
diff --git a/chrome/browser/policy/user_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/policy/user_cloud_policy_manager_chromeos_unittest.cc
index 1a1af44..9794fae4 100644
--- a/chrome/browser/policy/user_cloud_policy_manager_chromeos_unittest.cc
+++ b/chrome/browser/policy/user_cloud_policy_manager_chromeos_unittest.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/policy/mock_device_management_service.h"
#include "chrome/browser/policy/proto/device_management_backend.pb.h"
#include "chrome/browser/prefs/browser_prefs.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/test/base/testing_pref_service.h"
#include "policy/policy_constants.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -34,7 +35,7 @@ class UserCloudPolicyManagerChromeOSTest : public testing::Test {
: store_(NULL) {}
virtual void SetUp() OVERRIDE {
- chrome::RegisterLocalState(&prefs_);
+ chrome::RegisterLocalState(prefs_.registry(), &prefs_);
// Set up a policy map for testing.
policy_map_.Set("key", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
diff --git a/chrome/browser/policy/user_policy_signin_service_unittest.cc b/chrome/browser/policy/user_policy_signin_service_unittest.cc
index f70904b..3920bba 100644
--- a/chrome/browser/policy/user_policy_signin_service_unittest.cc
+++ b/chrome/browser/policy/user_policy_signin_service_unittest.cc
@@ -77,7 +77,7 @@ class UserPolicySigninServiceTest : public testing::Test {
g_browser_process->browser_policy_connector()->Init();
local_state_.reset(new TestingPrefServiceSimple);
- chrome::RegisterLocalState(local_state_.get());
+ chrome::RegisterLocalState(local_state_->registry(), local_state_.get());
TestingBrowserProcess::GetGlobal()->SetLocalState(
local_state_.get());
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index c1ff183..d56c950 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/background/background_mode_manager.h"
#include "chrome/browser/bookmarks/bookmark_prompt_prefs.h"
#include "chrome/browser/bookmarks/bookmark_utils.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/content_settings/host_content_settings_map.h"
@@ -46,6 +47,7 @@
#include "chrome/browser/pepper_flash_settings_manager.h"
#include "chrome/browser/plugins/plugin_finder.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/profiles/chrome_version_service.h"
@@ -147,85 +149,90 @@ enum MigratedPreferences {
namespace chrome {
-void RegisterLocalState(PrefServiceSimple* local_state) {
+// TODO(joi): Do the work needed to remove the PrefService parameter,
+// i.e. to do all registration up front before a PrefService is even
+// created.
+void RegisterLocalState(PrefRegistrySimple* registry,
+ PrefService* local_state) {
// Prefs in Local State.
- local_state->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0);
+ registry->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0);
// Please keep this list alphabetized.
- browser_shutdown::RegisterPrefs(local_state);
- chrome::RegisterScreenshotPrefs(local_state);
- extensions::app_launcher::RegisterPrefs(local_state);
- ExternalProtocolHandler::RegisterPrefs(local_state);
- FlagsUI::RegisterPrefs(local_state);
- geolocation::RegisterPrefs(local_state);
- IntranetRedirectDetector::RegisterPrefs(local_state);
- KeywordEditorController::RegisterPrefs(local_state);
- MetricsLog::RegisterPrefs(local_state);
- MetricsService::RegisterPrefs(local_state);
- PrefProxyConfigTrackerImpl::RegisterPrefs(local_state);
- ProfileInfoCache::RegisterPrefs(local_state);
- ProfileManager::RegisterPrefs(local_state);
- PromoResourceService::RegisterPrefs(local_state);
- SigninManagerFactory::RegisterPrefs(local_state);
- SSLConfigServiceManager::RegisterPrefs(local_state);
- UpgradeDetector::RegisterPrefs(local_state);
- WebCacheManager::RegisterPrefs(local_state);
+ browser_shutdown::RegisterPrefs(registry);
+ BrowserProcessImpl::RegisterPrefs(registry);
+ chrome::RegisterScreenshotPrefs(registry);
+ extensions::app_launcher::RegisterPrefs(registry);
+ ExternalProtocolHandler::RegisterPrefs(registry);
+ FlagsUI::RegisterPrefs(registry);
+ geolocation::RegisterPrefs(registry);
+ IntranetRedirectDetector::RegisterPrefs(registry);
+ KeywordEditorController::RegisterPrefs(registry);
+ MetricsLog::RegisterPrefs(registry);
+ MetricsService::RegisterPrefs(registry);
+ PrefProxyConfigTrackerImpl::RegisterPrefs(registry);
+ ProfileInfoCache::RegisterPrefs(registry);
+ ProfileManager::RegisterPrefs(registry);
+ PromoResourceService::RegisterPrefs(registry);
+ SigninManagerFactory::RegisterPrefs(registry);
+ SSLConfigServiceManager::RegisterPrefs(registry);
+ UpgradeDetector::RegisterPrefs(registry);
+ WebCacheManager::RegisterPrefs(registry);
#if defined(ENABLE_PLUGINS)
- PluginFinder::RegisterPrefs(local_state);
+ PluginFinder::RegisterPrefs(registry);
#endif
#if defined(ENABLE_PLUGIN_INSTALLATION)
- PluginsResourceService::RegisterPrefs(local_state);
+ PluginsResourceService::RegisterPrefs(registry);
#endif
#if defined(ENABLE_CONFIGURATION_POLICY)
- policy::BrowserPolicyConnector::RegisterPrefs(local_state);
- policy::PolicyStatisticsCollector::RegisterPrefs(local_state);
+ policy::BrowserPolicyConnector::RegisterPrefs(registry);
+ policy::PolicyStatisticsCollector::RegisterPrefs(registry);
#endif
#if defined(ENABLE_NOTIFICATIONS)
- NotificationPrefsManager::RegisterPrefs(local_state);
+ NotificationPrefsManager::RegisterPrefs(local_state, registry);
#endif
#if defined(ENABLE_TASK_MANAGER)
- TaskManager::RegisterPrefs(local_state);
+ TaskManager::RegisterPrefs(registry);
#endif // defined(ENABLE_TASK_MANAGER)
#if defined(TOOLKIT_VIEWS)
- RegisterBrowserViewPrefs(local_state);
- RegisterTabStripLayoutTypePrefs(local_state);
+ RegisterBrowserViewPrefs(registry);
+ RegisterTabStripLayoutTypePrefs(registry);
#endif
#if !defined(OS_ANDROID)
- BackgroundModeManager::RegisterPrefs(local_state);
- chrome_variations::VariationsService::RegisterPrefs(local_state);
- RegisterBrowserPrefs(local_state);
- ManagedMode::RegisterPrefs(local_state);
+ BackgroundModeManager::RegisterPrefs(registry);
+ chrome_variations::VariationsService::RegisterPrefs(registry);
+ RegisterBrowserPrefs(registry);
+ ManagedMode::RegisterPrefs(registry);
#endif
#if defined(OS_CHROMEOS)
- chromeos::AudioHandler::RegisterPrefs(local_state);
- chromeos::DataPromoNotification::RegisterPrefs(local_state);
- chromeos::device_settings_cache::RegisterPrefs(local_state);
- chromeos::language_prefs::RegisterPrefs(local_state);
- chromeos::ProxyConfigServiceImpl::RegisterPrefs(local_state);
- chromeos::RegisterDisplayLocalStatePrefs(local_state);
- chromeos::ServicesCustomizationDocument::RegisterPrefs(local_state);
- chromeos::UserImageManager::RegisterPrefs(local_state);
- chromeos::UserManager::RegisterPrefs(local_state);
- chromeos::WallpaperManager::RegisterPrefs(local_state);
- chromeos::WizardController::RegisterPrefs(local_state);
- policy::AutoEnrollmentClient::RegisterPrefs(local_state);
- policy::DeviceStatusCollector::RegisterPrefs(local_state);
+ chromeos::AudioHandler::RegisterPrefs(registry);
+ chromeos::DataPromoNotification::RegisterPrefs(registry);
+ chromeos::device_settings_cache::RegisterPrefs(registry);
+ chromeos::language_prefs::RegisterPrefs(registry);
+ chromeos::ProxyConfigServiceImpl::RegisterPrefs(registry);
+ chromeos::RegisterDisplayLocalStatePrefs(registry);
+ chromeos::ServicesCustomizationDocument::RegisterPrefs(registry);
+ chromeos::UserImageManager::RegisterPrefs(registry);
+ chromeos::UserManager::RegisterPrefs(registry);
+ chromeos::WallpaperManager::RegisterPrefs(registry);
+ chromeos::WizardController::RegisterPrefs(registry);
+ policy::AutoEnrollmentClient::RegisterPrefs(registry);
+ policy::DeviceStatusCollector::RegisterPrefs(registry);
#endif
#if defined(OS_MACOSX)
- confirm_quit::RegisterLocalState(local_state);
+ confirm_quit::RegisterLocalState(registry);
#endif
#if defined(ENABLE_SETTINGS_APP)
- chrome::RegisterAppListPrefs(local_state);
+ chrome::RegisterAppListPrefs(registry);
#endif
}
@@ -333,17 +340,19 @@ void MigrateUserPrefs(Profile* profile) {
prefs->UnregisterPreference(kBackupPref);
}
-void MigrateBrowserPrefs(Profile* profile, PrefServiceSimple* local_state) {
+void MigrateBrowserPrefs(Profile* profile, PrefService* local_state) {
// Copy pref values which have been migrated to user_prefs from local_state,
// or remove them from local_state outright, if copying is not required.
int current_version =
local_state->GetInteger(prefs::kMultipleProfilePrefMigration);
+ PrefRegistrySimple* registry = static_cast<PrefRegistrySimple*>(
+ local_state->DeprecatedGetPrefRegistry());
if (!(current_version & DNS_PREFS)) {
- local_state->RegisterListPref(prefs::kDnsStartupPrefetchList);
+ registry->RegisterListPref(prefs::kDnsStartupPrefetchList);
local_state->ClearPref(prefs::kDnsStartupPrefetchList);
- local_state->RegisterListPref(prefs::kDnsHostReferralList);
+ registry->RegisterListPref(prefs::kDnsHostReferralList);
local_state->ClearPref(prefs::kDnsHostReferralList);
current_version |= DNS_PREFS;
@@ -353,7 +362,7 @@ void MigrateBrowserPrefs(Profile* profile, PrefServiceSimple* local_state) {
PrefServiceSyncable* user_prefs = profile->GetPrefs();
if (!(current_version & WINDOWS_PREFS)) {
- local_state->RegisterIntegerPref(prefs::kDevToolsHSplitLocation, -1);
+ registry->RegisterIntegerPref(prefs::kDevToolsHSplitLocation, -1);
if (local_state->HasPrefPath(prefs::kDevToolsHSplitLocation)) {
user_prefs->SetInteger(
prefs::kDevToolsHSplitLocation,
@@ -361,7 +370,7 @@ void MigrateBrowserPrefs(Profile* profile, PrefServiceSimple* local_state) {
}
local_state->ClearPref(prefs::kDevToolsHSplitLocation);
- local_state->RegisterDictionaryPref(prefs::kBrowserWindowPlacement);
+ registry->RegisterDictionaryPref(prefs::kBrowserWindowPlacement);
if (local_state->HasPrefPath(prefs::kBrowserWindowPlacement)) {
const PrefService::Preference* pref =
local_state->FindPreference(prefs::kBrowserWindowPlacement);
@@ -378,16 +387,16 @@ void MigrateBrowserPrefs(Profile* profile, PrefServiceSimple* local_state) {
if (!(current_version & GOOGLE_URL_TRACKER_PREFS)) {
GoogleURLTrackerFactory::GetInstance()->RegisterUserPrefsOnProfile(profile);
- local_state->RegisterStringPref(prefs::kLastKnownGoogleURL,
- GoogleURLTracker::kDefaultGoogleHomepage);
+ registry->RegisterStringPref(prefs::kLastKnownGoogleURL,
+ GoogleURLTracker::kDefaultGoogleHomepage);
if (local_state->HasPrefPath(prefs::kLastKnownGoogleURL)) {
user_prefs->SetString(prefs::kLastKnownGoogleURL,
local_state->GetString(prefs::kLastKnownGoogleURL));
}
local_state->ClearPref(prefs::kLastKnownGoogleURL);
- local_state->RegisterStringPref(prefs::kLastPromptedGoogleURL,
- std::string());
+ registry->RegisterStringPref(prefs::kLastPromptedGoogleURL,
+ std::string());
if (local_state->HasPrefPath(prefs::kLastPromptedGoogleURL)) {
user_prefs->SetString(
prefs::kLastPromptedGoogleURL,
diff --git a/chrome/browser/prefs/browser_prefs.h b/chrome/browser/prefs/browser_prefs.h
index 296ab3b..5fb5262 100644
--- a/chrome/browser/prefs/browser_prefs.h
+++ b/chrome/browser/prefs/browser_prefs.h
@@ -5,19 +5,19 @@
#ifndef CHROME_BROWSER_PREFS_BROWSER_PREFS_H_
#define CHROME_BROWSER_PREFS_BROWSER_PREFS_H_
+class PrefRegistrySimple;
class PrefService;
-class PrefServiceSimple;
class PrefServiceSyncable;
class Profile;
namespace chrome {
// Makes the PrefService objects aware of all the prefs.
-void RegisterLocalState(PrefServiceSimple* local_state);
+void RegisterLocalState(PrefRegistrySimple* registry, PrefService* local_state);
void RegisterUserPrefs(PrefServiceSyncable* user_prefs);
// Migrates prefs from |local_state| to |profile|'s pref store.
-void MigrateBrowserPrefs(Profile* profile, PrefServiceSimple* local_state);
+void MigrateBrowserPrefs(Profile* profile, PrefService* local_state);
// Migrates prefs in |profile|'s pref store.
void MigrateUserPrefs(Profile* profile);
diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc
index a074a34..39de2d1 100644
--- a/chrome/browser/prefs/chrome_pref_service_factory.cc
+++ b/chrome/browser/prefs/chrome_pref_service_factory.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/prefs/command_line_pref_store.h"
#include "chrome/browser/prefs/pref_model_associator.h"
#include "chrome/browser/prefs/pref_notifier_impl.h"
+#include "chrome/browser/prefs/pref_registry.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/pref_service_syncable_builder.h"
#include "chrome/browser/prefs/pref_value_store.h"
@@ -56,7 +57,7 @@ void PrepareBuilder(
const FilePath& pref_filename,
base::SequencedTaskRunner* pref_io_task_runner,
policy::PolicyService* policy_service,
- PrefStore* extension_prefs,
+ const scoped_refptr<PrefStore>& extension_prefs,
bool async) {
#if defined(OS_LINUX)
// We'd like to see what fraction of our users have the preferences
@@ -98,11 +99,12 @@ PrefServiceBase* PrefServiceBase::FromBrowserContext(BrowserContext* context) {
namespace chrome_prefs {
-PrefServiceSimple* CreateLocalState(
+PrefService* CreateLocalState(
const FilePath& pref_filename,
base::SequencedTaskRunner* pref_io_task_runner,
policy::PolicyService* policy_service,
- PrefStore* extension_prefs,
+ const scoped_refptr<PrefStore>& extension_prefs,
+ const scoped_refptr<PrefRegistry>& pref_registry,
bool async) {
PrefServiceSyncableBuilder builder;
PrepareBuilder(&builder,
@@ -111,14 +113,14 @@ PrefServiceSimple* CreateLocalState(
policy_service,
extension_prefs,
async);
- return builder.CreateSimple();
+ return builder.Create(pref_registry);
}
PrefServiceSyncable* CreateProfilePrefs(
const FilePath& pref_filename,
base::SequencedTaskRunner* pref_io_task_runner,
policy::PolicyService* policy_service,
- PrefStore* extension_prefs,
+ const scoped_refptr<PrefStore>& extension_prefs,
bool async) {
PrefServiceSyncableBuilder builder;
PrepareBuilder(&builder,
diff --git a/chrome/browser/prefs/chrome_pref_service_factory.h b/chrome/browser/prefs/chrome_pref_service_factory.h
index 7ba5053..87bec89 100644
--- a/chrome/browser/prefs/chrome_pref_service_factory.h
+++ b/chrome/browser/prefs/chrome_pref_service_factory.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_PREFS_CHROME_PREF_SERVICE_FACTORY_H_
#define CHROME_BROWSER_PREFS_CHROME_PREF_SERVICE_FACTORY_H_
+#include "base/memory/ref_counted.h"
+
namespace base {
class FilePath;
class SequencedTaskRunner;
@@ -14,7 +16,8 @@ namespace policy {
class PolicyService;
}
-class PrefServiceSimple;
+class PrefRegistry;
+class PrefService;
class PrefServiceSyncable;
class PrefStore;
@@ -28,24 +31,26 @@ namespace chrome_prefs {
// preferences and may be NULL.
// |policy_service| is used as the source for mandatory or recommended
// policies.
+// |pref_registry| keeps the list of registered prefs and their default values.
// If |async| is true, asynchronous version is used.
// Notifies using PREF_INITIALIZATION_COMPLETED in the end. Details is set to
// the created PrefService or NULL if creation has failed. Note, it is
// guaranteed that in asynchronous version initialization happens after this
// function returned.
-PrefServiceSimple* CreateLocalState(
+PrefService* CreateLocalState(
const base::FilePath& pref_filename,
base::SequencedTaskRunner* pref_io_task_runner,
policy::PolicyService* policy_service,
- PrefStore* extension_prefs,
+ const scoped_refptr<PrefStore>& extension_prefs,
+ const scoped_refptr<PrefRegistry>& pref_registry,
bool async);
PrefServiceSyncable* CreateProfilePrefs(
const base::FilePath& pref_filename,
base::SequencedTaskRunner* pref_io_task_runner,
policy::PolicyService* policy_service,
- PrefStore* extension_prefs,
+ const scoped_refptr<PrefStore>& extension_prefs,
bool async);
} // namespace chrome_prefs
diff --git a/chrome/browser/prefs/pref_notifier_impl_unittest.cc b/chrome/browser/prefs/pref_notifier_impl_unittest.cc
index 3d3057c..241d436 100644
--- a/chrome/browser/prefs/pref_notifier_impl_unittest.cc
+++ b/chrome/browser/prefs/pref_notifier_impl_unittest.cc
@@ -7,6 +7,7 @@
#include "base/prefs/pref_observer.h"
#include "chrome/browser/prefs/mock_pref_change_callback.h"
#include "chrome/browser/prefs/pref_notifier_impl.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/pref_value_store.h"
#include "chrome/common/chrome_notification_types.h"
@@ -93,10 +94,8 @@ class PrefObserverMock : public PrefObserver {
class PrefNotifierTest : public testing::Test {
protected:
virtual void SetUp() {
- pref_service_.RegisterBooleanPref(kChangedPref,
- true);
- pref_service_.RegisterBooleanPref(kUnchangedPref,
- true);
+ pref_service_.registry()->RegisterBooleanPref(kChangedPref, true);
+ pref_service_.registry()->RegisterBooleanPref(kUnchangedPref, true);
}
TestingPrefServiceSimple pref_service_;
diff --git a/chrome/browser/prefs/pref_registry.cc b/chrome/browser/prefs/pref_registry.cc
new file mode 100644
index 0000000..c91aa83
--- /dev/null
+++ b/chrome/browser/prefs/pref_registry.cc
@@ -0,0 +1,64 @@
+// Copyright (c) 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/pref_registry.h"
+
+#include "base/logging.h"
+#include "base/prefs/default_pref_store.h"
+#include "base/prefs/pref_store.h"
+#include "base/values.h"
+
+PrefRegistry::PrefRegistry()
+ : defaults_(new DefaultPrefStore()) {
+}
+
+PrefRegistry::~PrefRegistry() {
+}
+
+scoped_refptr<PrefStore> PrefRegistry::defaults() {
+ return defaults_.get();
+}
+
+PrefRegistry::const_iterator PrefRegistry::begin() const {
+ return defaults_->begin();
+}
+
+PrefRegistry::const_iterator PrefRegistry::end() const {
+ return defaults_->end();
+}
+
+void PrefRegistry::SetRegistrationCallback(
+ const RegistrationCallback& callback) {
+ registration_callback_ = callback;
+}
+
+void PrefRegistry::SetUnregistrationCallback(
+ const UnregistrationCallback& callback) {
+ unregistration_callback_ = callback;
+}
+
+void PrefRegistry::DeprecatedUnregisterPreference(const char* path) {
+ DCHECK(defaults_->GetValue(path, NULL)) <<
+ "Trying to unregister an unregistered pref: " << path;
+
+ defaults_->RemoveDefaultValue(path);
+
+ if (!unregistration_callback_.is_null())
+ unregistration_callback_.Run(path);
+}
+
+void PrefRegistry::RegisterPreference(const char* path,
+ base::Value* default_value) {
+ base::Value::Type orig_type = default_value->GetType();
+ DCHECK(orig_type != base::Value::TYPE_NULL &&
+ orig_type != base::Value::TYPE_BINARY) <<
+ "invalid preference type: " << orig_type;
+ DCHECK(!defaults_->GetValue(path, NULL)) <<
+ "Trying to register a previously registered pref: " << path;
+
+ defaults_->SetDefaultValue(path, default_value);
+
+ if (!registration_callback_.is_null())
+ registration_callback_.Run(path, default_value);
+}
diff --git a/chrome/browser/prefs/pref_registry.h b/chrome/browser/prefs/pref_registry.h
new file mode 100644
index 0000000..327f987
--- /dev/null
+++ b/chrome/browser/prefs/pref_registry.h
@@ -0,0 +1,75 @@
+// Copyright (c) 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.
+
+#ifndef CHROME_BROWSER_PREFS_PREF_REGISTRY_H_
+#define CHROME_BROWSER_PREFS_PREF_REGISTRY_H_
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+#include "base/prefs/pref_value_map.h"
+
+namespace base {
+class Value;
+}
+
+class DefaultPrefStore;
+class PrefStore;
+
+// Preferences need to be registered with a type and default value
+// before they are used.
+//
+// The way you use a PrefRegistry is that you register all required
+// preferences on it (via one of its subclasses), then pass it as a
+// construction parameter to PrefService.
+//
+// Currently, registrations after constructing the PrefService will
+// also work, but this is being deprecated.
+class PrefRegistry : public base::RefCounted<PrefRegistry> {
+ public:
+ typedef PrefValueMap::const_iterator const_iterator;
+ typedef base::Callback<void(const char*, base::Value*)> RegistrationCallback;
+ typedef base::Callback<void(const char*)> UnregistrationCallback;
+
+ PrefRegistry();
+
+ // Gets the registered defaults.
+ scoped_refptr<PrefStore> defaults();
+
+ // Allows iteration over defaults.
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ // Exactly one callback can be set for each of two events:
+ // Registration and unregistration. If either is set, the callback
+ // will be invoked each time registration and/or unregistration has
+ // been performed on this object.
+ //
+ // Calling either of these methods after a callback has already been
+ // set will make the object forget the previous callback and use the
+ // new one instead.
+ void SetRegistrationCallback(const RegistrationCallback& callback);
+ void SetUnregistrationCallback(const UnregistrationCallback& callback);
+
+ // Unregisters a preference. This is going away soon.
+ virtual void DeprecatedUnregisterPreference(const char* path);
+
+ protected:
+ friend class base::RefCounted<PrefRegistry>;
+ virtual ~PrefRegistry();
+
+ // TODO(joi): Temporary until we have PrefRegistrySyncable.
+ friend class PrefServiceSyncable;
+
+ // Used by subclasses to register a default value for a preference.
+ void RegisterPreference(const char* path, base::Value* default_value);
+
+ private:
+ RegistrationCallback registration_callback_;
+ UnregistrationCallback unregistration_callback_;
+ scoped_refptr<DefaultPrefStore> defaults_;
+
+ DISALLOW_COPY_AND_ASSIGN(PrefRegistry);
+};
+
+#endif // CHROME_BROWSER_PREFS_PREF_REGISTRY_H_
diff --git a/chrome/browser/prefs/pref_registry_simple.cc b/chrome/browser/prefs/pref_registry_simple.cc
new file mode 100644
index 0000000..f8addf1
--- /dev/null
+++ b/chrome/browser/prefs/pref_registry_simple.cc
@@ -0,0 +1,67 @@
+// Copyright (c) 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/pref_registry_simple.h"
+
+#include "base/file_path.h"
+#include "base/string_number_conversions.h"
+#include "base/values.h"
+
+PrefRegistrySimple::PrefRegistrySimple() {
+}
+
+PrefRegistrySimple::~PrefRegistrySimple() {
+}
+
+void PrefRegistrySimple::RegisterBooleanPref(const char* path,
+ bool default_value) {
+ RegisterPreference(path, base::Value::CreateBooleanValue(default_value));
+}
+
+void PrefRegistrySimple::RegisterIntegerPref(const char* path,
+ int default_value) {
+ RegisterPreference(path, base::Value::CreateIntegerValue(default_value));
+}
+
+void PrefRegistrySimple::RegisterDoublePref(const char* path,
+ double default_value) {
+ RegisterPreference(path, base::Value::CreateDoubleValue(default_value));
+}
+
+void PrefRegistrySimple::RegisterStringPref(const char* path,
+ const std::string& default_value) {
+ RegisterPreference(path, base::Value::CreateStringValue(default_value));
+}
+
+void PrefRegistrySimple::RegisterFilePathPref(
+ const char* path,
+ const base::FilePath& default_value) {
+ RegisterPreference(path,
+ base::Value::CreateStringValue(default_value.value()));
+}
+
+void PrefRegistrySimple::RegisterListPref(const char* path) {
+ RegisterPreference(path, new base::ListValue());
+}
+
+void PrefRegistrySimple::RegisterListPref(const char* path,
+ base::ListValue* default_value) {
+ RegisterPreference(path, default_value);
+}
+
+void PrefRegistrySimple::RegisterDictionaryPref(const char* path) {
+ RegisterPreference(path, new base::DictionaryValue());
+}
+
+void PrefRegistrySimple::RegisterDictionaryPref(
+ const char* path,
+ base::DictionaryValue* default_value) {
+ RegisterPreference(path, default_value);
+}
+
+void PrefRegistrySimple::RegisterInt64Pref(const char* path,
+ int64 default_value) {
+ RegisterPreference(
+ path, base::Value::CreateStringValue(base::Int64ToString(default_value)));
+}
diff --git a/chrome/browser/prefs/pref_registry_simple.h b/chrome/browser/prefs/pref_registry_simple.h
new file mode 100644
index 0000000..d175f50
--- /dev/null
+++ b/chrome/browser/prefs/pref_registry_simple.h
@@ -0,0 +1,43 @@
+// Copyright (c) 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.
+
+#ifndef CHROME_BROWSER_PREFS_PREF_REGISTRY_SIMPLE_H_
+#define CHROME_BROWSER_PREFS_PREF_REGISTRY_SIMPLE_H_
+
+#include <string>
+
+#include "chrome/browser/prefs/pref_registry.h"
+
+namespace base {
+class DictionaryValue;
+class FilePath;
+class ListValue;
+}
+
+// A simple implementation of PrefRegistry.
+class PrefRegistrySimple : public PrefRegistry {
+ public:
+ PrefRegistrySimple();
+
+ void RegisterBooleanPref(const char* path, bool default_value);
+ void RegisterIntegerPref(const char* path, int default_value);
+ void RegisterDoublePref(const char* path, double default_value);
+ void RegisterStringPref(const char* path, const std::string& default_value);
+ void RegisterFilePathPref(const char* path,
+ const base::FilePath& default_value);
+ void RegisterListPref(const char* path);
+ void RegisterDictionaryPref(const char* path);
+ void RegisterListPref(const char* path, base::ListValue* default_value);
+ void RegisterDictionaryPref(const char* path,
+ base::DictionaryValue* default_value);
+ void RegisterInt64Pref(const char* path,
+ int64 default_value);
+
+ private:
+ virtual ~PrefRegistrySimple();
+
+ DISALLOW_COPY_AND_ASSIGN(PrefRegistrySimple);
+};
+
+#endif // CHROME_BROWSER_PREFS_PREF_REGISTRY_SIMPLE_H_
diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc
index 61f54f7..9950316 100644
--- a/chrome/browser/prefs/pref_service.cc
+++ b/chrome/browser/prefs/pref_service.cc
@@ -18,6 +18,7 @@
#include "base/value_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/prefs/pref_notifier_impl.h"
+#include "chrome/browser/prefs/pref_registry.h"
#include "chrome/browser/prefs/pref_value_store.h"
using content::BrowserContext;
@@ -43,26 +44,40 @@ PrefService::PrefService(
PrefNotifierImpl* pref_notifier,
PrefValueStore* pref_value_store,
PersistentPrefStore* user_prefs,
- DefaultPrefStore* default_store,
+ PrefRegistry* pref_registry,
base::Callback<void(PersistentPrefStore::PrefReadError)>
read_error_callback,
bool async)
: pref_notifier_(pref_notifier),
pref_value_store_(pref_value_store),
+ pref_registry_(pref_registry),
user_pref_store_(user_prefs),
- default_store_(default_store),
read_error_callback_(read_error_callback) {
pref_notifier_->SetPrefService(this);
+
+ pref_registry_->SetRegistrationCallback(
+ base::Bind(&PrefService::AddRegisteredPreference,
+ base::Unretained(this)));
+ pref_registry_->SetUnregistrationCallback(
+ base::Bind(&PrefService::RemoveRegisteredPreference,
+ base::Unretained(this)));
+ AddInitialPreferences();
+
InitFromStorage(async);
}
PrefService::~PrefService() {
DCHECK(CalledOnValidThread());
+ // Remove our callbacks, setting NULL ones.
+ pref_registry_->SetRegistrationCallback(PrefRegistry::RegistrationCallback());
+ pref_registry_->SetUnregistrationCallback(
+ PrefRegistry::UnregistrationCallback());
+
// Reset pointers so accesses after destruction reliably crash.
pref_value_store_.reset();
+ pref_registry_ = NULL;
user_pref_store_ = NULL;
- default_store_ = NULL;
pref_notifier_.reset();
}
@@ -172,8 +187,8 @@ bool PrefService::HasPrefPath(const char* path) const {
DictionaryValue* PrefService::GetPreferenceValues() const {
DCHECK(CalledOnValidThread());
DictionaryValue* out = new DictionaryValue;
- DefaultPrefStore::const_iterator i = default_store_->begin();
- for (; i != default_store_->end(); ++i) {
+ PrefRegistry::const_iterator i = pref_registry_->begin();
+ for (; i != pref_registry_->end(); ++i) {
const Value* value = GetPreferenceValue(i->first);
DCHECK(value);
out->Set(i->first, value->DeepCopy());
@@ -187,11 +202,12 @@ const PrefService::Preference* PrefService::FindPreference(
PreferenceMap::iterator it = prefs_map_.find(pref_name);
if (it != prefs_map_.end())
return &(it->second);
- const base::Value::Type type = default_store_->GetType(pref_name);
- if (type == Value::TYPE_NULL)
+ const base::Value* default_value = NULL;
+ if (!pref_registry_->defaults()->GetValue(pref_name, &default_value))
return NULL;
it = prefs_map_.insert(
- std::make_pair(pref_name, Preference(this, pref_name, type))).first;
+ std::make_pair(pref_name, Preference(
+ this, pref_name, default_value->GetType()))).first;
return &(it->second);
}
@@ -266,7 +282,7 @@ const base::Value* PrefService::GetDefaultPrefValue(const char* path) const {
DCHECK(CalledOnValidThread());
// Lookup the preference in the default store.
const base::Value* value = NULL;
- if (!default_store_->GetValue(path, &value)) {
+ if (!pref_registry_->defaults()->GetValue(path, &value)) {
NOTREACHED() << "Default value missing for pref: " << path;
return NULL;
}
@@ -300,24 +316,33 @@ void PrefService::AddPrefInitObserver(base::Callback<void(bool)> obs) {
pref_notifier_->AddInitObserver(obs);
}
-void PrefService::RegisterPreference(const char* path,
- Value* default_value) {
- DCHECK(CalledOnValidThread());
-
- // The main code path takes ownership, but most don't. We'll be safe.
- scoped_ptr<Value> scoped_value(default_value);
+PrefRegistry* PrefService::DeprecatedGetPrefRegistry() {
+ return pref_registry_.get();
+}
- CHECK(!FindPreference(path)) << "Tried to register duplicate pref " << path;
+void PrefService::AddInitialPreferences() {
+ for (PrefRegistry::const_iterator it = pref_registry_->begin();
+ it != pref_registry_->end();
+ ++it) {
+ AddRegisteredPreference(it->first.c_str(), it->second);
+ }
+}
- base::Value::Type orig_type = default_value->GetType();
- DCHECK(orig_type != Value::TYPE_NULL && orig_type != Value::TYPE_BINARY) <<
- "invalid preference type: " << orig_type;
+// TODO(joi): Once MarkNeedsEmptyValue is gone, we can probably
+// completely get rid of this method. There will be one difference in
+// semantics; currently all registered preferences are stored right
+// away in the prefs_map_, if we remove this they would be stored only
+// opportunistically.
+void PrefService::AddRegisteredPreference(const char* path,
+ Value* default_value) {
+ DCHECK(CalledOnValidThread());
// For ListValue and DictionaryValue with non empty default, empty value
// for |path| needs to be persisted in |user_pref_store_|. So that
// non empty default is not used when user sets an empty ListValue or
// DictionaryValue.
bool needs_empty_value = false;
+ base::Value::Type orig_type = default_value->GetType();
if (orig_type == base::Value::TYPE_LIST) {
const base::ListValue* list = NULL;
if (default_value->GetAsList(&list) && !list->empty())
@@ -329,20 +354,14 @@ void PrefService::RegisterPreference(const char* path,
}
if (needs_empty_value)
user_pref_store_->MarkNeedsEmptyValue(path);
-
- // Hand off ownership.
- default_store_->SetDefaultValue(path, scoped_value.release());
}
-void PrefService::UnregisterPreference(const char* path) {
+// TODO(joi): We can get rid of this once the ability to unregister
+// prefs has been removed.
+void PrefService::RemoveRegisteredPreference(const char* path) {
DCHECK(CalledOnValidThread());
- PreferenceMap::iterator it = prefs_map_.find(path);
- CHECK(it != prefs_map_.end()) << "Trying to unregister an unregistered pref: "
- << path;
-
- prefs_map_.erase(it);
- default_store_->RemoveDefaultValue(path);
+ prefs_map_.erase(path);
}
void PrefService::ClearPref(const char* path) {
@@ -561,16 +580,18 @@ bool PrefService::Preference::IsExtensionModifiable() const {
const base::Value* PrefService::GetPreferenceValue(
const std::string& path) const {
DCHECK(CalledOnValidThread());
- const base::Value::Type type = default_store_->GetType(path);
- if (type == Value::TYPE_NULL)
- return NULL;
- const Value* found_value = NULL;
- if (pref_value_store_->GetValue(path, type, &found_value)) {
- DCHECK(found_value->IsType(type));
- return found_value;
+ const Value* default_value = NULL;
+ if (pref_registry_->defaults()->GetValue(path, &default_value)) {
+ const Value* found_value = NULL;
+ base::Value::Type default_type = default_value->GetType();
+ if (pref_value_store_->GetValue(path, default_type, &found_value)) {
+ DCHECK(found_value->IsType(default_type));
+ return found_value;
+ } else {
+ // Every registered preference has at least a default value.
+ NOTREACHED() << "no valid value found for registered pref " << path;
+ }
}
- // Every registered preference has at least a default value.
- NOTREACHED() << "no valid value found for registered pref " << path;
return NULL;
}
diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h
index 0bc7f77..0d11873 100644
--- a/chrome/browser/prefs/pref_service.h
+++ b/chrome/browser/prefs/pref_service.h
@@ -15,20 +15,20 @@
#include <string>
#include "base/callback.h"
+#include "base/hash_tables.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "base/hash_tables.h"
#include "base/observer_list.h"
#include "base/prefs/persistent_pref_store.h"
#include "base/prefs/public/pref_service_base.h"
#include "base/threading/non_thread_safe.h"
-class DefaultPrefStore;
class PrefNotifier;
class PrefNotifierImpl;
class PrefObserver;
-class PrefStore;
+class PrefRegistry;
class PrefValueStore;
+class PrefStore;
namespace subtle {
class ScopedUserPrefUpdateBase;
@@ -36,7 +36,7 @@ class ScopedUserPrefUpdateBase;
// Base class for PrefServices. You can use the base class to read and
// interact with preferences, but not to register new preferences; for
-// that see subclasses like PrefServiceSimple.
+// that see e.g. PrefRegistrySimple.
class PrefService : public PrefServiceBase, public base::NonThreadSafe {
public:
enum PrefInitializationStatus {
@@ -94,7 +94,7 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
PrefNotifierImpl* pref_notifier,
PrefValueStore* pref_value_store,
PersistentPrefStore* user_prefs,
- DefaultPrefStore* default_store,
+ PrefRegistry* pref_registry,
base::Callback<void(PersistentPrefStore::PrefReadError)>
read_error_callback,
bool async);
@@ -112,7 +112,6 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
// PrefServiceBase implementation.
virtual bool IsManagedPreference(const char* pref_name) const OVERRIDE;
virtual bool IsUserModifiablePreference(const char* pref_name) const OVERRIDE;
- virtual void UnregisterPreference(const char* path) OVERRIDE;
virtual const PrefService::Preference* FindPreference(
const char* path) const OVERRIDE;
virtual bool GetBoolean(const char* path) const OVERRIDE;
@@ -167,12 +166,24 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
// false for unsuccessful.
void AddPrefInitObserver(base::Callback<void(bool)> callback);
+ // Returns the PrefRegistry object for this service. You should not
+ // use this; the intent is for no registrations to take place after
+ // PrefService has been constructed.
+ PrefRegistry* DeprecatedGetPrefRegistry();
+
protected:
- // Registers a new preference at |path|. The |default_value| must not be
- // NULL as it determines the preference value's type.
- // RegisterPreference must not be called twice for the same path.
- // This method takes ownership of |default_value|.
- void RegisterPreference(const char* path, base::Value* default_value);
+ // Adds the registered preferences from the PrefRegistry instance
+ // passed to us at construction time.
+ void AddInitialPreferences();
+
+ // Updates local caches for a preference registered at |path|. The
+ // |default_value| must not be NULL as it determines the preference
+ // value's type. AddRegisteredPreference must not be called twice
+ // for the same path.
+ void AddRegisteredPreference(const char* path,
+ base::Value* default_value);
+
+ void RemoveRegisteredPreference(const char* path);
// The PrefNotifier handles registering and notifying preference observers.
// It is created and owned by this PrefService. Subclasses may access it for
@@ -183,9 +194,10 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
// this PrefService. Subclasses may access it for unit testing.
scoped_ptr<PrefValueStore> pref_value_store_;
+ scoped_refptr<PrefRegistry> pref_registry_;
+
// Pref Stores and profile that we passed to the PrefValueStore.
scoped_refptr<PersistentPrefStore> user_pref_store_;
- scoped_refptr<DefaultPrefStore> default_store_;
// Callback to call when a read error occurs.
base::Callback<void(PersistentPrefStore::PrefReadError)> read_error_callback_;
@@ -197,9 +209,6 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
// vs. std::map, and by roughly 180ms vs. std::set of Preference pointers.
typedef base::hash_map<std::string, Preference> PreferenceMap;
- // Give access to Initialize().
- friend class PrefServiceBuilder;
-
// Give access to ReportUserPrefChanged() and GetMutableUserPref().
friend class subtle::ScopedUserPrefUpdateBase;
@@ -238,7 +247,7 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
// actually get the value.).
const base::Value* GetPreferenceValue(const std::string& path) const;
- // Local cache of registered Preference objects. The default_store_
+ // Local cache of registered Preference objects. The pref_registry_
// is authoritative with respect to what the types and default values
// of registered preferences are.
mutable PreferenceMap prefs_map_;
@@ -249,7 +258,6 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
// TODO(joi): Remove these forwards. They were placed here temporarily
// to limit the size of the initial change that split
// PrefServiceSimple and PrefServiceSyncable out of PrefService.
-#include "chrome/browser/prefs/pref_service_simple.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
#endif // CHROME_BROWSER_PREFS_PREF_SERVICE_H_
diff --git a/chrome/browser/prefs/pref_service_builder.cc b/chrome/browser/prefs/pref_service_builder.cc
index c1880b1..ff84b59 100644
--- a/chrome/browser/prefs/pref_service_builder.cc
+++ b/chrome/browser/prefs/pref_service_builder.cc
@@ -9,7 +9,7 @@
#include "base/prefs/json_pref_store.h"
#include "chrome/browser/prefs/pref_notifier_impl.h"
#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/prefs/pref_service_simple.h"
+
#include "chrome/browser/prefs/pref_value_store.h"
namespace {
@@ -72,10 +72,9 @@ PrefServiceBuilder& PrefServiceBuilder::WithAsync(bool async) {
return *this;
}
-PrefServiceSimple* PrefServiceBuilder::CreateSimple() {
- DefaultPrefStore* default_pref_store = new DefaultPrefStore();
+PrefService* PrefServiceBuilder::Create(PrefRegistry* pref_registry) {
PrefNotifierImpl* pref_notifier = new PrefNotifierImpl();
- PrefServiceSimple* pref_service = new PrefServiceSimple(
+ PrefService* pref_service = new PrefService(
pref_notifier,
new PrefValueStore(
managed_prefs_.get(),
@@ -83,10 +82,10 @@ PrefServiceSimple* PrefServiceBuilder::CreateSimple() {
command_line_prefs_.get(),
user_prefs_.get(),
recommended_prefs_.get(),
- default_pref_store,
+ pref_registry->defaults(),
pref_notifier),
user_prefs_.get(),
- default_pref_store,
+ pref_registry,
read_error_callback_,
async_);
ResetDefaultState();
diff --git a/chrome/browser/prefs/pref_service_builder.h b/chrome/browser/prefs/pref_service_builder.h
index 208e334..21489ae 100644
--- a/chrome/browser/prefs/pref_service_builder.h
+++ b/chrome/browser/prefs/pref_service_builder.h
@@ -10,8 +10,9 @@
#include "base/memory/ref_counted.h"
#include "base/prefs/persistent_pref_store.h"
#include "base/prefs/pref_store.h"
+#include "chrome/browser/prefs/pref_registry.h"
-class PrefServiceSimple;
+class PrefService;
namespace base {
class FilePath;
@@ -45,9 +46,9 @@ class PrefServiceBuilder {
PrefServiceBuilder& WithAsync(bool async);
- // Creates a PrefServiceSimple object initialized with the
- // parameters from this builder.
- virtual PrefServiceSimple* CreateSimple();
+ // Creates a PrefService object initialized with the parameters from
+ // this builder.
+ virtual PrefService* Create(PrefRegistry* registry);
protected:
virtual void ResetDefaultState();
diff --git a/chrome/browser/prefs/pref_service_mock_builder.cc b/chrome/browser/prefs/pref_service_mock_builder.cc
index fb8b721..dc2803c 100644
--- a/chrome/browser/prefs/pref_service_mock_builder.cc
+++ b/chrome/browser/prefs/pref_service_mock_builder.cc
@@ -12,8 +12,8 @@ PrefServiceMockBuilder::PrefServiceMockBuilder() {
PrefServiceMockBuilder::~PrefServiceMockBuilder() {}
-PrefServiceSimple* PrefServiceMockBuilder::CreateSimple() {
- PrefServiceSimple* service = PrefServiceBuilder::CreateSimple();
+PrefService* PrefServiceMockBuilder::Create(PrefRegistry* pref_registry) {
+ PrefService* service = PrefServiceBuilder::Create(pref_registry);
return service;
}
diff --git a/chrome/browser/prefs/pref_service_mock_builder.h b/chrome/browser/prefs/pref_service_mock_builder.h
index bfa0076..6105e49 100644
--- a/chrome/browser/prefs/pref_service_mock_builder.h
+++ b/chrome/browser/prefs/pref_service_mock_builder.h
@@ -7,7 +7,7 @@
#include "chrome/browser/prefs/pref_service_syncable_builder.h"
-class PrefServiceSimple;
+class PrefService;
class PrefServiceSyncable;
// A helper that allows convenient building of custom PrefServices in tests.
@@ -18,7 +18,7 @@ class PrefServiceMockBuilder : public PrefServiceSyncableBuilder {
// Creates a PrefService for testing, invalidating the entire
// builder configuration.
- virtual PrefServiceSimple* CreateSimple() OVERRIDE;
+ virtual PrefService* Create(PrefRegistry* pref_registry) OVERRIDE;
virtual PrefServiceSyncable* CreateSyncable() OVERRIDE;
private:
diff --git a/chrome/browser/prefs/pref_service_simple.cc b/chrome/browser/prefs/pref_service_simple.cc
deleted file mode 100644
index b19dfe7..0000000
--- a/chrome/browser/prefs/pref_service_simple.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 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/pref_service.h"
-
-#include "base/file_path.h"
-#include "base/string_number_conversions.h"
-#include "base/values.h"
-
-PrefServiceSimple::PrefServiceSimple(
- PrefNotifierImpl* pref_notifier,
- PrefValueStore* pref_value_store,
- PersistentPrefStore* user_prefs,
- DefaultPrefStore* default_store,
- base::Callback<void(PersistentPrefStore::PrefReadError)>
- read_error_callback,
- bool async)
- : PrefService(pref_notifier,
- pref_value_store,
- user_prefs,
- default_store,
- read_error_callback,
- async) {
-}
-
-PrefServiceSimple::~PrefServiceSimple() {}
-
-void PrefServiceSimple::RegisterBooleanPref(const char* path,
- bool default_value) {
- RegisterPreference(path, Value::CreateBooleanValue(default_value));
-}
-
-void PrefServiceSimple::RegisterIntegerPref(const char* path,
- int default_value) {
- RegisterPreference(path, Value::CreateIntegerValue(default_value));
-}
-
-void PrefServiceSimple::RegisterDoublePref(const char* path,
- double default_value) {
- RegisterPreference(path, Value::CreateDoubleValue(default_value));
-}
-
-void PrefServiceSimple::RegisterStringPref(const char* path,
- const std::string& default_value) {
- RegisterPreference(path, Value::CreateStringValue(default_value));
-}
-
-void PrefServiceSimple::RegisterFilePathPref(const char* path,
- const FilePath& default_value) {
- RegisterPreference(path, Value::CreateStringValue(default_value.value()));
-}
-
-void PrefServiceSimple::RegisterListPref(const char* path) {
- RegisterPreference(path, new ListValue());
-}
-
-void PrefServiceSimple::RegisterListPref(const char* path,
- ListValue* default_value) {
- RegisterPreference(path, default_value);
-}
-
-void PrefServiceSimple::RegisterDictionaryPref(const char* path) {
- RegisterPreference(path, new DictionaryValue());
-}
-
-void PrefServiceSimple::RegisterDictionaryPref(const char* path,
- DictionaryValue* default_value) {
- RegisterPreference(path, default_value);
-}
-
-void PrefServiceSimple::RegisterInt64Pref(const char* path,
- int64 default_value) {
- RegisterPreference(
- path, Value::CreateStringValue(base::Int64ToString(default_value)));
-}
diff --git a/chrome/browser/prefs/pref_service_simple.h b/chrome/browser/prefs/pref_service_simple.h
deleted file mode 100644
index fd1e612..0000000
--- a/chrome/browser/prefs/pref_service_simple.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 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.
-
-#ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_SIMPLE_H_
-#define CHROME_BROWSER_PREFS_PREF_SERVICE_SIMPLE_H_
-
-#include "chrome/browser/prefs/pref_service.h"
-
-// A simple PrefService implementation.
-class PrefServiceSimple : public PrefService {
- public:
- // You may wish to use PrefServiceBuilder or one of its subclasses
- // for simplified construction.
- PrefServiceSimple(
- PrefNotifierImpl* pref_notifier,
- PrefValueStore* pref_value_store,
- PersistentPrefStore* user_prefs,
- DefaultPrefStore* default_store,
- base::Callback<void(PersistentPrefStore::PrefReadError)>
- read_error_callback,
- bool async);
- virtual ~PrefServiceSimple();
-
- void RegisterBooleanPref(const char* path, bool default_value);
- void RegisterIntegerPref(const char* path, int default_value);
- void RegisterDoublePref(const char* path, double default_value);
- void RegisterStringPref(const char* path, const std::string& default_value);
- void RegisterFilePathPref(const char* path,
- const base::FilePath& default_value);
- void RegisterListPref(const char* path);
- void RegisterDictionaryPref(const char* path);
- void RegisterListPref(const char* path, base::ListValue* default_value);
- void RegisterDictionaryPref(
- const char* path, base::DictionaryValue* default_value);
- void RegisterInt64Pref(const char* path,
- int64 default_value);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PrefServiceSimple);
-};
-
-#endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SIMPLE_H_
diff --git a/chrome/browser/prefs/pref_service_syncable.cc b/chrome/browser/prefs/pref_service_syncable.cc
index 3ec590e..d92e68b 100644
--- a/chrome/browser/prefs/pref_service_syncable.cc
+++ b/chrome/browser/prefs/pref_service_syncable.cc
@@ -12,6 +12,8 @@
#include "base/value_conversions.h"
#include "chrome/browser/prefs/pref_model_associator.h"
#include "chrome/browser/prefs/pref_notifier_impl.h"
+#include "chrome/browser/prefs/pref_registry.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service_syncable_observer.h"
#include "chrome/browser/prefs/pref_value_store.h"
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
@@ -67,14 +69,14 @@ PrefServiceSyncable::PrefServiceSyncable(
PrefNotifierImpl* pref_notifier,
PrefValueStore* pref_value_store,
PersistentPrefStore* user_prefs,
- DefaultPrefStore* default_store,
+ PrefRegistry* pref_registry,
base::Callback<void(PersistentPrefStore::PrefReadError)>
read_error_callback,
bool async)
: PrefService(pref_notifier,
pref_value_store,
user_prefs,
- default_store,
+ pref_registry,
read_error_callback,
async) {
pref_sync_associator_.SetPrefService(this);
@@ -93,6 +95,18 @@ PrefServiceSyncable* PrefServiceSyncable::CreateIncognitoPrefService(
OverlayUserPrefStore* incognito_pref_store =
new OverlayUserPrefStore(user_pref_store_.get());
PrefsTabHelper::InitIncognitoUserPrefStore(incognito_pref_store);
+
+ // For the incognito service, we need a registry that shares the
+ // same default prefs, but does not interfere with callbacks on
+ // registration/unregistration made to the main service, or allow
+ // any registrations.
+ //
+ // TODO(joi): We can directly reuse the same PrefRegistry once
+ // PrefService no longer registers for callbacks on registration and
+ // unregistration.
+ scoped_refptr<PrefRegistry> incognito_registry = new PrefRegistry;
+ incognito_registry->defaults_ = pref_registry_->defaults_;
+
PrefServiceSyncable* incognito_service = new PrefServiceSyncable(
pref_notifier,
pref_value_store_->CloneAndSpecialize(
@@ -101,10 +115,10 @@ PrefServiceSyncable* PrefServiceSyncable::CreateIncognitoPrefService(
NULL, // command_line_prefs
incognito_pref_store,
NULL, // recommended
- default_store_.get(),
+ incognito_registry->defaults(),
pref_notifier),
incognito_pref_store,
- default_store_.get(),
+ incognito_registry,
read_error_callback_,
false);
return incognito_service;
@@ -124,7 +138,10 @@ void PrefServiceSyncable::RemoveObserver(
}
void PrefServiceSyncable::UnregisterPreference(const char* path) {
- PrefService::UnregisterPreference(path);
+ // TODO(joi): Temporary until we have PrefRegistrySyncable.
+ static_cast<PrefRegistrySimple*>(
+ DeprecatedGetPrefRegistry())->DeprecatedUnregisterPreference(path);
+
if (pref_sync_associator_.IsPrefRegistered(path)) {
pref_sync_associator_.UnregisterPref(path);
}
@@ -271,7 +288,9 @@ void PrefServiceSyncable::OnIsSyncingChanged() {
void PrefServiceSyncable::RegisterSyncablePreference(
const char* path, Value* default_value, PrefSyncStatus sync_status) {
- PrefService::RegisterPreference(path, default_value);
+ // TODO(joi): Temporary until we have PrefRegistrySyncable.
+ static_cast<PrefRegistrySimple*>(
+ DeprecatedGetPrefRegistry())->RegisterPreference(path, default_value);
// Register with sync if necessary.
if (sync_status == SYNCABLE_PREF)
pref_sync_associator_.RegisterPref(path);
diff --git a/chrome/browser/prefs/pref_service_syncable.h b/chrome/browser/prefs/pref_service_syncable.h
index f280d7c..3df6a0a 100644
--- a/chrome/browser/prefs/pref_service_syncable.h
+++ b/chrome/browser/prefs/pref_service_syncable.h
@@ -33,7 +33,7 @@ class PrefServiceSyncable : public PrefService {
PrefNotifierImpl* pref_notifier,
PrefValueStore* pref_value_store,
PersistentPrefStore* user_prefs,
- DefaultPrefStore* default_store,
+ PrefRegistry* pref_registry,
base::Callback<void(PersistentPrefStore::PrefReadError)>
read_error_callback,
bool async);
@@ -55,8 +55,6 @@ class PrefServiceSyncable : public PrefService {
void AddObserver(PrefServiceSyncableObserver* observer);
void RemoveObserver(PrefServiceSyncableObserver* observer);
- virtual void UnregisterPreference(const char* path) OVERRIDE;
-
void RegisterBooleanPref(const char* path,
bool default_value,
PrefSyncStatus sync_status);
@@ -101,6 +99,8 @@ class PrefServiceSyncable : public PrefService {
uint64 default_value,
PrefSyncStatus sync_status);
+ void UnregisterPreference(const char* path);
+
// TODO(zea): Have PrefServiceSyncable implement
// syncer::SyncableService directly.
syncer::SyncableService* GetSyncableService();
diff --git a/chrome/browser/prefs/pref_service_syncable_builder.cc b/chrome/browser/prefs/pref_service_syncable_builder.cc
index 4c13277..8a157dd 100644
--- a/chrome/browser/prefs/pref_service_syncable_builder.cc
+++ b/chrome/browser/prefs/pref_service_syncable_builder.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/policy/policy_service.h"
#include "chrome/browser/prefs/command_line_pref_store.h"
#include "chrome/browser/prefs/pref_notifier_impl.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/prefs/pref_value_store.h"
@@ -41,7 +42,8 @@ PrefServiceSyncableBuilder::WithCommandLine(CommandLine* command_line) {
}
PrefServiceSyncable* PrefServiceSyncableBuilder::CreateSyncable() {
- DefaultPrefStore* default_pref_store = new DefaultPrefStore();
+ // TODO(joi): Switch to accepting a PrefRegistrySyncable parameter.
+ scoped_refptr<PrefRegistry> pref_registry = new PrefRegistrySimple();
PrefNotifierImpl* pref_notifier = new PrefNotifierImpl();
PrefServiceSyncable* pref_service = new PrefServiceSyncable(
pref_notifier,
@@ -51,10 +53,10 @@ PrefServiceSyncable* PrefServiceSyncableBuilder::CreateSyncable() {
command_line_prefs_.get(),
user_prefs_.get(),
recommended_prefs_.get(),
- default_pref_store,
+ pref_registry->defaults(),
pref_notifier),
user_prefs_.get(),
- default_pref_store,
+ pref_registry.get(),
read_error_callback_,
async_);
ResetDefaultState();
diff --git a/chrome/browser/prefs/pref_service_unittest.cc b/chrome/browser/prefs/pref_service_unittest.cc
index 27dfa7d..f62cb6b 100644
--- a/chrome/browser/prefs/pref_service_unittest.cc
+++ b/chrome/browser/prefs/pref_service_unittest.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/prefs/command_line_pref_store.h"
#include "chrome/browser/prefs/mock_pref_change_callback.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service_mock_builder.h"
#include "chrome/browser/prefs/pref_value_store.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
@@ -44,7 +45,7 @@ TEST(PrefServiceTest, NoObserverFire) {
TestingPrefServiceSimple prefs;
const char pref_name[] = "homepage";
- prefs.RegisterStringPref(pref_name, std::string());
+ prefs.registry()->RegisterStringPref(pref_name, std::string());
const char new_pref_value[] = "http://www.google.com/";
MockPrefChangeCallback obs(&prefs);
@@ -86,7 +87,7 @@ TEST(PrefServiceTest, HasPrefPath) {
// Register the path. This doesn't set a value, so the path still shouldn't
// exist.
- prefs.RegisterStringPref(path, std::string());
+ prefs.registry()->RegisterStringPref(path, std::string());
EXPECT_FALSE(prefs.HasPrefPath(path));
// Set a value and make sure we have a path.
@@ -99,7 +100,7 @@ TEST(PrefServiceTest, Observers) {
TestingPrefServiceSimple prefs;
prefs.SetUserPref(pref_name, Value::CreateStringValue("http://www.cnn.com"));
- prefs.RegisterStringPref(pref_name, std::string());
+ prefs.registry()->RegisterStringPref(pref_name, std::string());
const char new_pref_value[] = "http://www.google.com/";
const StringValue expected_new_pref_value(new_pref_value);
@@ -153,7 +154,8 @@ TEST(PrefServiceTest, Observers) {
TEST(PrefServiceTest, GetValueChangedType) {
const int kTestValue = 10;
TestingPrefServiceSimple prefs;
- prefs.RegisterIntegerPref(prefs::kStabilityLaunchCount, kTestValue);
+ prefs.registry()->RegisterIntegerPref(
+ prefs::kStabilityLaunchCount, kTestValue);
// Check falling back to a recommended value.
prefs.SetUserPref(prefs::kStabilityLaunchCount,
@@ -171,7 +173,7 @@ TEST(PrefServiceTest, GetValueChangedType) {
TEST(PrefServiceTest, UpdateCommandLinePrefStore) {
TestingPrefServiceSimple prefs;
- prefs.RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, false);
+ prefs.registry()->RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, false);
// Check to make sure the value is as expected.
const PrefService::Preference* pref =
@@ -205,7 +207,8 @@ TEST(PrefServiceTest, GetValueAndGetRecommendedValue) {
const int kUserValue = 10;
const int kRecommendedValue = 15;
TestingPrefServiceSimple prefs;
- prefs.RegisterIntegerPref(prefs::kStabilityLaunchCount, kDefaultValue);
+ prefs.registry()->RegisterIntegerPref(
+ prefs::kStabilityLaunchCount, kDefaultValue);
// Create pref with a default value only.
const PrefService::Preference* pref =
@@ -373,7 +376,7 @@ const char PrefServiceSetValueTest::kValue[] = "value";
TEST_F(PrefServiceSetValueTest, SetStringValue) {
const char default_string[] = "default";
const StringValue default_value(default_string);
- prefs_.RegisterStringPref(kName, default_string);
+ prefs_.registry()->RegisterStringPref(kName, default_string);
PrefChangeRegistrar registrar;
registrar.Init(&prefs_);
@@ -395,7 +398,7 @@ TEST_F(PrefServiceSetValueTest, SetStringValue) {
}
TEST_F(PrefServiceSetValueTest, SetDictionaryValue) {
- prefs_.RegisterDictionaryPref(kName);
+ prefs_.registry()->RegisterDictionaryPref(kName);
PrefChangeRegistrar registrar;
registrar.Init(&prefs_);
registrar.Add(kName, observer_.GetCallback());
@@ -421,7 +424,7 @@ TEST_F(PrefServiceSetValueTest, SetDictionaryValue) {
}
TEST_F(PrefServiceSetValueTest, SetListValue) {
- prefs_.RegisterListPref(kName);
+ prefs_.registry()->RegisterListPref(kName);
PrefChangeRegistrar registrar;
registrar.Init(&prefs_);
registrar.Add(kName, observer_.GetCallback());
diff --git a/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc b/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
index 69e1104..b8572c5 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/net/ssl_config_service_manager.h"
#include "chrome/browser/prefs/browser_prefs.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile_dependency_manager.h"
@@ -86,7 +87,7 @@ class OffTheRecordProfileImplTest : public BrowserWithTestWindowTest {
virtual void SetUp() OVERRIDE {
prefs_.reset(new TestingPrefServiceSimple);
- chrome::RegisterLocalState(prefs_.get());
+ chrome::RegisterLocalState(prefs_->registry(), prefs_.get());
browser_process()->SetLocalState(prefs_.get());
@@ -105,7 +106,7 @@ class OffTheRecordProfileImplTest : public BrowserWithTestWindowTest {
return TestingBrowserProcess::GetGlobal();
}
- scoped_ptr<PrefServiceSimple> prefs_;
+ scoped_ptr<TestingPrefServiceSimple> prefs_;
DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImplTest);
};
diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc
index cb645ee..ce1f97d 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -18,6 +18,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/common/chrome_notification_types.h"
@@ -823,6 +824,6 @@ std::vector<string16> ProfileInfoCache::GetProfileNames() {
}
// static
-void ProfileInfoCache::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterDictionaryPref(prefs::kProfileInfoCache);
+void ProfileInfoCache::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterDictionaryPref(prefs::kProfileInfoCache);
}
diff --git a/chrome/browser/profiles/profile_info_cache.h b/chrome/browser/profiles/profile_info_cache.h
index 4b9f8ab..eed872d 100644
--- a/chrome/browser/profiles/profile_info_cache.h
+++ b/chrome/browser/profiles/profile_info_cache.h
@@ -27,7 +27,7 @@ class DictionaryValue;
}
class PrefService;
-class PrefServiceSimple;
+class PrefRegistrySimple;
// This class saves various information about profiles to local preferences.
// This cache can be used to display a list of profiles without having to
@@ -129,7 +129,7 @@ class ProfileInfoCache : public ProfileInfoInterface,
static std::vector<string16> GetProfileNames();
// Register cache related preferences in Local State.
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
void AddObserver(ProfileInfoCacheObserver* obs);
void RemoveObserver(ProfileInfoCacheObserver* obs);
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 811ddeb..d35f186 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -16,6 +16,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile_destroyer.h"
@@ -64,9 +65,9 @@
#endif
#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/login/user_manager.h"
#include "chromeos/dbus/cryptohome_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chrome/browser/chromeos/login/user_manager.h"
#endif
using content::BrowserThread;
@@ -848,10 +849,10 @@ void ProfileManager::CreateMultiProfileAsync(
}
// static
-void ProfileManager::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterStringPref(prefs::kProfileLastUsed, "");
- prefs->RegisterIntegerPref(prefs::kProfilesNumCreated, 1);
- prefs->RegisterListPref(prefs::kProfilesLastActive);
+void ProfileManager::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterStringPref(prefs::kProfileLastUsed, "");
+ registry->RegisterIntegerPref(prefs::kProfilesNumCreated, 1);
+ registry->RegisterListPref(prefs::kProfilesLastActive);
}
size_t ProfileManager::GetNumberOfProfiles() {
diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h
index 3c47bb8..cf27214 100644
--- a/chrome/browser/profiles/profile_manager.h
+++ b/chrome/browser/profiles/profile_manager.h
@@ -189,7 +189,7 @@ class ProfileManager : public base::NonThreadSafe,
bool is_managed);
// Register multi-profile related preferences in Local State.
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Returns a ProfileInfoCache object which can be used to get information
// about profiles without having to load them from disk.
diff --git a/chrome/browser/renderer_host/web_cache_manager.cc b/chrome/browser/renderer_host/web_cache_manager.cc
index 80f7f4c..75332be 100644
--- a/chrome/browser/renderer_host/web_cache_manager.cc
+++ b/chrome/browser/renderer_host/web_cache_manager.cc
@@ -14,6 +14,7 @@
#include "base/sys_info.h"
#include "base/time.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_notification_types.h"
@@ -53,8 +54,8 @@ int GetDefaultCacheSize() {
} // anonymous namespace
// static
-void WebCacheManager::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterIntegerPref(prefs::kMemoryCacheSize, GetDefaultCacheSize());
+void WebCacheManager::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterIntegerPref(prefs::kMemoryCacheSize, GetDefaultCacheSize());
}
// static
diff --git a/chrome/browser/renderer_host/web_cache_manager.h b/chrome/browser/renderer_host/web_cache_manager.h
index 56aaf5b..9731620 100644
--- a/chrome/browser/renderer_host/web_cache_manager.h
+++ b/chrome/browser/renderer_host/web_cache_manager.h
@@ -8,8 +8,8 @@
#ifndef CHROME_BROWSER_RENDERER_HOST_WEB_CACHE_MANAGER_H_
#define CHROME_BROWSER_RENDERER_HOST_WEB_CACHE_MANAGER_H_
-#include <map>
#include <list>
+#include <map>
#include <set>
#include "base/basictypes.h"
@@ -23,14 +23,14 @@
template<typename Type>
struct DefaultSingletonTraits;
-class PrefServiceSimple;
+class PrefRegistrySimple;
class WebCacheManager : public content::NotificationObserver {
friend class WebCacheManagerTest;
FRIEND_TEST_ALL_PREFIXES(WebCacheManagerBrowserTest, CrashOnceOnly);
public:
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Gets the singleton WebCacheManager object. The first time this method
// is called, a WebCacheManager object is constructed and returned.
diff --git a/chrome/browser/signin/signin_manager_factory.cc b/chrome/browser/signin/signin_manager_factory.cc
index e77b1a8..f372fb9 100644
--- a/chrome/browser/signin/signin_manager_factory.cc
+++ b/chrome/browser/signin/signin_manager_factory.cc
@@ -4,7 +4,8 @@
#include "chrome/browser/signin/signin_manager_factory.h"
-#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
+#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/profiles/profile_dependency_manager.h"
#include "chrome/browser/signin/signin_manager.h"
#include "chrome/browser/signin/token_service_factory.h"
@@ -52,8 +53,8 @@ void SigninManagerFactory::RegisterUserPrefs(PrefServiceSyncable* user_prefs) {
}
// static
-void SigninManagerFactory::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterStringPref(prefs::kGoogleServicesUsernamePattern, "");
+void SigninManagerFactory::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterStringPref(prefs::kGoogleServicesUsernamePattern, "");
}
ProfileKeyedService* SigninManagerFactory::BuildServiceInstanceFor(
diff --git a/chrome/browser/signin/signin_manager_factory.h b/chrome/browser/signin/signin_manager_factory.h
index c3c7602..969ed39 100644
--- a/chrome/browser/signin/signin_manager_factory.h
+++ b/chrome/browser/signin/signin_manager_factory.h
@@ -9,7 +9,7 @@
#include "chrome/browser/profiles/profile_keyed_service_factory.h"
class SigninManager;
-class PrefServiceSimple;
+class PrefRegistrySimple;
class PrefServiceSyncable;
class Profile;
@@ -35,7 +35,7 @@ class SigninManagerFactory : public ProfileKeyedServiceFactory {
virtual void RegisterUserPrefs(PrefServiceSyncable* user_prefs) OVERRIDE;
// Registers the browser-global prefs used by SigninManager.
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
private:
friend struct DefaultSingletonTraits<SigninManagerFactory>;
diff --git a/chrome/browser/signin/signin_manager_unittest.cc b/chrome/browser/signin/signin_manager_unittest.cc
index 224ebf4..505a66b 100644
--- a/chrome/browser/signin/signin_manager_unittest.cc
+++ b/chrome/browser/signin/signin_manager_unittest.cc
@@ -63,7 +63,7 @@ class SigninManagerTest : public TokenServiceTestHarness {
virtual void SetUp() OVERRIDE {
prefs_.reset(new TestingPrefServiceSimple);
- chrome::RegisterLocalState(prefs_.get());
+ chrome::RegisterLocalState(prefs_->registry(), prefs_.get());
TestingBrowserProcess::GetGlobal()->SetLocalState(
prefs_.get());
TokenServiceTestHarness::SetUp();
diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc
index f888dc0..ec9662e 100644
--- a/chrome/browser/task_manager/task_manager.cc
+++ b/chrome/browser/task_manager/task_manager.cc
@@ -21,7 +21,7 @@
#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/extensions/extension_process_manager.h"
#include "chrome/browser/extensions/extension_system.h"
-#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/task_manager/task_manager_resource_providers.h"
#include "chrome/browser/task_manager/task_manager_worker_resource_provider.h"
@@ -1388,8 +1388,8 @@ content::WebContents* TaskManager::Resource::GetWebContents() const {
bool TaskManager::Resource::IsBackground() const { return false; }
// static
-void TaskManager::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterDictionaryPref(prefs::kTaskManagerWindowPlacement);
+void TaskManager::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterDictionaryPref(prefs::kTaskManagerWindowPlacement);
}
bool TaskManager::IsBrowserProcess(int index) const {
diff --git a/chrome/browser/task_manager/task_manager.h b/chrome/browser/task_manager/task_manager.h
index 4197286..700cd38 100644
--- a/chrome/browser/task_manager/task_manager.h
+++ b/chrome/browser/task_manager/task_manager.h
@@ -22,7 +22,7 @@
#include "content/public/common/gpu_memory_stats.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
class TaskManagerModel;
class TaskManagerModelGpuDataManagerObserver;
@@ -186,7 +186,7 @@ class TaskManager {
virtual ~ResourceProvider() {}
};
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Returns true if the process at the specified index is the browser process.
bool IsBrowserProcess(int index) const;
diff --git a/chrome/browser/ui/app_list/app_list_controller_browsertest.cc b/chrome/browser/ui/app_list/app_list_controller_browsertest.cc
index 7949d06..9284163 100644
--- a/chrome/browser/ui/app_list/app_list_controller_browsertest.cc
+++ b/chrome/browser/ui/app_list/app_list_controller_browsertest.cc
@@ -6,7 +6,7 @@
#include "base/files/scoped_temp_dir.h"
#include "base/message_loop.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/prefs/pref_service_simple.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/app_list/app_list_util.h"
#include "chrome/browser/ui/browser.h"
diff --git a/chrome/browser/ui/app_list/app_list_util.cc b/chrome/browser/ui/app_list/app_list_util.cc
index de396d5..12d1b5b 100644
--- a/chrome/browser/ui/app_list/app_list_util.cc
+++ b/chrome/browser/ui/app_list/app_list_util.cc
@@ -8,6 +8,7 @@
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_prefs.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
@@ -41,8 +42,8 @@ FilePath GetAppListProfilePath(const FilePath& user_data_dir) {
return user_data_dir.AppendASCII(profile_path);
}
-void RegisterAppListPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterStringPref(prefs::kAppListProfile, "");
+void RegisterAppListPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterStringPref(prefs::kAppListProfile, "");
}
#endif // defined(ENABLE_APP_LIST)
diff --git a/chrome/browser/ui/app_list/app_list_util.h b/chrome/browser/ui/app_list/app_list_util.h
index 6d8f91d..63dc9b0 100644
--- a/chrome/browser/ui/app_list/app_list_util.h
+++ b/chrome/browser/ui/app_list/app_list_util.h
@@ -7,7 +7,7 @@
#include "base/file_path.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
class Profile;
namespace chrome {
@@ -22,7 +22,7 @@ void InitAppList(Profile* profile);
void ShowAppList(Profile* profile);
// Register local state preferences for the app list.
-void RegisterAppListPrefs(PrefServiceSimple* prefs);
+void RegisterAppListPrefs(PrefRegistrySimple* registry);
// Change the profile that the app list is showing.
void SetAppListProfile(const FilePath& profile_file_path);
diff --git a/chrome/browser/ui/browser_ui_prefs.cc b/chrome/browser/ui/browser_ui_prefs.cc
index 4091e6e..f89dc3a 100644
--- a/chrome/browser/ui/browser_ui_prefs.cc
+++ b/chrome/browser/ui/browser_ui_prefs.cc
@@ -5,16 +5,17 @@
#include "chrome/browser/ui/browser_ui_prefs.h"
#include "chrome/browser/first_run/first_run.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
namespace chrome {
-void RegisterBrowserPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterIntegerPref(prefs::kOptionsWindowLastTabIndex, 0);
- prefs->RegisterBooleanPref(prefs::kAllowFileSelectionDialogs, true);
- prefs->RegisterIntegerPref(prefs::kShowFirstRunBubbleOption,
+void RegisterBrowserPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterIntegerPref(prefs::kOptionsWindowLastTabIndex, 0);
+ registry->RegisterBooleanPref(prefs::kAllowFileSelectionDialogs, true);
+ registry->RegisterIntegerPref(prefs::kShowFirstRunBubbleOption,
first_run::FIRST_RUN_BUBBLE_DONT_SHOW);
}
diff --git a/chrome/browser/ui/browser_ui_prefs.h b/chrome/browser/ui/browser_ui_prefs.h
index 6cef126..ebadc10 100644
--- a/chrome/browser/ui/browser_ui_prefs.h
+++ b/chrome/browser/ui/browser_ui_prefs.h
@@ -7,13 +7,13 @@
#include <string>
-class PrefServiceSimple;
+class PrefRegistrySimple;
class PrefServiceSyncable;
class Profile;
namespace chrome {
-void RegisterBrowserPrefs(PrefServiceSimple* prefs);
+void RegisterBrowserPrefs(PrefRegistrySimple* registry);
void RegisterBrowserUserPrefs(PrefServiceSyncable* prefs);
// Create a preference dictionary for the provided application name, in the
diff --git a/chrome/browser/ui/browser_view_prefs.cc b/chrome/browser/ui/browser_view_prefs.cc
index 1872f9d..399f0a6 100644
--- a/chrome/browser/ui/browser_view_prefs.cc
+++ b/chrome/browser/ui/browser_view_prefs.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/ui/browser_view_prefs.h"
-#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/common/pref_names.h"
namespace {
@@ -19,11 +19,11 @@ const int kDefaultHungPluginDetectFrequency = 2000;
namespace chrome {
-void RegisterBrowserViewPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterIntegerPref(prefs::kPluginMessageResponseTimeout,
- kDefaultPluginMessageResponseTimeout);
- prefs->RegisterIntegerPref(prefs::kHungPluginDetectFrequency,
- kDefaultHungPluginDetectFrequency);
+void RegisterBrowserViewPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterIntegerPref(prefs::kPluginMessageResponseTimeout,
+ kDefaultPluginMessageResponseTimeout);
+ registry->RegisterIntegerPref(prefs::kHungPluginDetectFrequency,
+ kDefaultHungPluginDetectFrequency);
}
} // namespace chrome
diff --git a/chrome/browser/ui/browser_view_prefs.h b/chrome/browser/ui/browser_view_prefs.h
index 71905f5..24cf1ab 100644
--- a/chrome/browser/ui/browser_view_prefs.h
+++ b/chrome/browser/ui/browser_view_prefs.h
@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_UI_BROWSER_VIEW_PREFS_H_
#define CHROME_BROWSER_UI_BROWSER_VIEW_PREFS_H_
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace chrome {
// Register local state preferences specific to BrowserView.
-void RegisterBrowserViewPrefs(PrefServiceSimple* prefs);
+void RegisterBrowserViewPrefs(PrefRegistrySimple* registry);
} // namespace chrome
diff --git a/chrome/browser/ui/cocoa/confirm_quit.h b/chrome/browser/ui/cocoa/confirm_quit.h
index 4246155..36aa330 100644
--- a/chrome/browser/ui/cocoa/confirm_quit.h
+++ b/chrome/browser/ui/cocoa/confirm_quit.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_H_
#define CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_H_
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace confirm_quit {
@@ -26,7 +26,7 @@ enum ConfirmQuitMetric {
void RecordHistogram(ConfirmQuitMetric sample);
// Registers the preference in app-wide local state.
-void RegisterLocalState(PrefServiceSimple* local_state);
+void RegisterLocalState(PrefRegistrySimple* registry);
} // namespace confirm_quit
diff --git a/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm b/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm
index 051a04e..d994d539 100644
--- a/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm
+++ b/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm
@@ -12,7 +12,7 @@
#include "base/metrics/histogram.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/cocoa/confirm_quit.h"
@@ -45,8 +45,8 @@ void RecordHistogram(ConfirmQuitMetric sample) {
UMA_HISTOGRAM_ENUMERATION("OSX.ConfirmToQuit", sample, kSampleCount);
}
-void RegisterLocalState(PrefServiceSimple* local_state) {
- local_state->RegisterBooleanPref(prefs::kConfirmToQuitEnabled, false);
+void RegisterLocalState(PrefRegistrySimple* registry) {
+ registry->RegisterBooleanPref(prefs::kConfirmToQuitEnabled, false);
}
} // namespace confirm_quit
diff --git a/chrome/browser/ui/search_engines/keyword_editor_controller.cc b/chrome/browser/ui/search_engines/keyword_editor_controller.cc
index 592c125..30d91e9 100644
--- a/chrome/browser/ui/search_engines/keyword_editor_controller.cc
+++ b/chrome/browser/ui/search_engines/keyword_editor_controller.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/ui/search_engines/keyword_editor_controller.h"
#include "base/utf_string_conversions.h"
-#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_service.h"
@@ -28,8 +28,8 @@ KeywordEditorController::~KeywordEditorController() {
// static
// TODO(rsesek): Other platforms besides Mac should remember window
// placement. http://crbug.com/22269
-void KeywordEditorController::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterDictionaryPref(prefs::kKeywordEditorWindowPlacement);
+void KeywordEditorController::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterDictionaryPref(prefs::kKeywordEditorWindowPlacement);
}
int KeywordEditorController::AddTemplateURL(const string16& title,
diff --git a/chrome/browser/ui/search_engines/keyword_editor_controller.h b/chrome/browser/ui/search_engines/keyword_editor_controller.h
index 912b306..63240c1 100644
--- a/chrome/browser/ui/search_engines/keyword_editor_controller.h
+++ b/chrome/browser/ui/search_engines/keyword_editor_controller.h
@@ -11,7 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/string16.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
class Profile;
class TemplateURL;
class TemplateURLService;
@@ -22,7 +22,7 @@ class KeywordEditorController {
explicit KeywordEditorController(Profile* profile);
~KeywordEditorController();
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Invoked when the user succesfully fills out the add keyword dialog.
// Propagates the change to the TemplateURLService and updates the table
diff --git a/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc b/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc
index 9f300bc..c92f12d 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_shutdown.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_list_impl.h"
@@ -181,9 +182,11 @@ TEST_F(BrowserListTest, TabContentsIteratorVerifyBrowser) {
TEST_F(BrowserListTest, MAYBE_AttemptRestart) {
ASSERT_TRUE(g_browser_process);
TestingPrefServiceSimple testing_pref_service;
- testing_pref_service.RegisterBooleanPref(prefs::kWasRestarted, false);
- testing_pref_service.RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown,
- false);
+ testing_pref_service.registry()->RegisterBooleanPref(
+ prefs::kWasRestarted, false);
+ testing_pref_service.registry()->RegisterBooleanPref(
+ prefs::kRestartLastSessionOnShutdown,
+ false);
TestingBrowserProcess* testing_browser_process =
TestingBrowserProcess::GetGlobal();
diff --git a/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.cc b/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.cc
index ef380d5..da69e8d 100644
--- a/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.cc
+++ b/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.cc
@@ -4,17 +4,16 @@
#include "chrome/browser/ui/tabs/tab_strip_layout_type_prefs.h"
-#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/ui/tabs/tab_strip_layout_type.h"
#include "chrome/common/pref_names.h"
namespace chrome {
-void RegisterTabStripLayoutTypePrefs(PrefServiceSimple* local_state) {
+void RegisterTabStripLayoutTypePrefs(PrefRegistrySimple* registry) {
// This value is device dependant, so it goes in local state.
- local_state->RegisterIntegerPref(
- prefs::kTabStripLayoutType,
- static_cast<int>(TAB_STRIP_LAYOUT_SHRINK));
+ registry->RegisterIntegerPref(prefs::kTabStripLayoutType,
+ static_cast<int>(TAB_STRIP_LAYOUT_SHRINK));
}
} // namespace chrome
diff --git a/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.h b/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.h
index f2dc3f4..80d06b0 100644
--- a/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.h
+++ b/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.h
@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_UI_TABS_TAB_STRIP_LAYOUT_TYPE_PREFS_H_
#define CHROME_BROWSER_UI_TABS_TAB_STRIP_LAYOUT_TYPE_PREFS_H_
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace chrome {
// Register local state preferences specific to the TabStrip.
-void RegisterTabStripLayoutTypePrefs(PrefServiceSimple* local_state);
+void RegisterTabStripLayoutTypePrefs(PrefRegistrySimple* registry);
} // namespace chrome
diff --git a/chrome/browser/ui/webui/flags_ui.cc b/chrome/browser/ui/webui/flags_ui.cc
index 78cee4c..cb212ac 100644
--- a/chrome/browser/ui/webui/flags_ui.cc
+++ b/chrome/browser/ui/webui/flags_ui.cc
@@ -14,7 +14,7 @@
#include "chrome/browser/about_flags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/lifetime/application_lifetime.h"
-#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -173,6 +173,6 @@ base::RefCountedMemory* FlagsUI::GetFaviconResourceBytes(
}
// static
-void FlagsUI::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterListPref(prefs::kEnabledLabsExperiments);
+void FlagsUI::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterListPref(prefs::kEnabledLabsExperiments);
}
diff --git a/chrome/browser/ui/webui/flags_ui.h b/chrome/browser/ui/webui/flags_ui.h
index 68779894..0cac343 100644
--- a/chrome/browser/ui/webui/flags_ui.h
+++ b/chrome/browser/ui/webui/flags_ui.h
@@ -8,7 +8,7 @@
#include "content/public/browser/web_ui_controller.h"
#include "ui/base/layout.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace base {
class RefCountedMemory;
@@ -20,7 +20,7 @@ class FlagsUI : public content::WebUIController {
static base::RefCountedMemory* GetFaviconResourceBytes(
ui::ScaleFactor scale_factor);
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
private:
DISALLOW_COPY_AND_ASSIGN(FlagsUI);
diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_handler.h b/chrome/browser/ui/webui/ntp/new_tab_page_handler.h
index 34cc843..3e2d680 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_page_handler.h
+++ b/chrome/browser/ui/webui/ntp/new_tab_page_handler.h
@@ -10,7 +10,7 @@
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/web_ui_message_handler.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
class PrefServiceSyncable;
class Profile;
diff --git a/chrome/browser/ui/window_snapshot/window_snapshot.cc b/chrome/browser/ui/window_snapshot/window_snapshot.cc
index 9d440ba..b7206de 100644
--- a/chrome/browser/ui/window_snapshot/window_snapshot.cc
+++ b/chrome/browser/ui/window_snapshot/window_snapshot.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/window_snapshot/window_snapshot.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
#include "ui/snapshot/snapshot.h"
@@ -21,8 +22,8 @@ bool GrabWindowSnapshotForUser(
snapshot_bounds);
}
-void RegisterScreenshotPrefs(PrefServiceSimple* service) {
- service->RegisterBooleanPref(prefs::kDisableScreenshots, false);
+void RegisterScreenshotPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterBooleanPref(prefs::kDisableScreenshots, false);
}
} // namespace chrome
diff --git a/chrome/browser/ui/window_snapshot/window_snapshot.h b/chrome/browser/ui/window_snapshot/window_snapshot.h
index 4065770..cb681db 100644
--- a/chrome/browser/ui/window_snapshot/window_snapshot.h
+++ b/chrome/browser/ui/window_snapshot/window_snapshot.h
@@ -9,7 +9,7 @@
#include "ui/gfx/native_widget_types.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
namespace gfx {
class Rect;
@@ -17,7 +17,7 @@ class Rect;
namespace chrome {
-void RegisterScreenshotPrefs(PrefServiceSimple* service);
+void RegisterScreenshotPrefs(PrefRegistrySimple* registry);
// Grabs a snapshot of the rectangle area |snapshot_bounds| with respect to the
// top left corner of the designated window and stores a PNG representation
diff --git a/chrome/browser/upgrade_detector.cc b/chrome/browser/upgrade_detector.cc
index acb742f..0f6d8e1 100644
--- a/chrome/browser/upgrade_detector.cc
+++ b/chrome/browser/upgrade_detector.cc
@@ -6,8 +6,8 @@
#include "base/bind.h"
#include "base/command_line.h"
-#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/lifetime/application_lifetime.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/ui/browser_otr_state.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
@@ -32,9 +32,9 @@ bool UseTestingIntervals() {
}
// static
-void UpgradeDetector::RegisterPrefs(PrefServiceSimple* prefs) {
- prefs->RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown, false);
- prefs->RegisterBooleanPref(prefs::kWasRestarted, false);
+void UpgradeDetector::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown, false);
+ registry->RegisterBooleanPref(prefs::kWasRestarted, false);
}
int UpgradeDetector::GetIconResourceID(UpgradeNotificationIconType type) {
diff --git a/chrome/browser/upgrade_detector.h b/chrome/browser/upgrade_detector.h
index c05f88a..4f3f107 100644
--- a/chrome/browser/upgrade_detector.h
+++ b/chrome/browser/upgrade_detector.h
@@ -9,7 +9,7 @@
#include "chrome/browser/idle.h"
#include "ui/gfx/image/image.h"
-class PrefServiceSimple;
+class PrefRegistrySimple;
///////////////////////////////////////////////////////////////////////////////
// UpgradeDetector
@@ -44,7 +44,7 @@ class UpgradeDetector {
virtual ~UpgradeDetector();
- static void RegisterPrefs(PrefServiceSimple* prefs);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
// Whether the user should be notified about an upgrade.
bool notify_upgrade() const { return notify_upgrade_; }
diff --git a/chrome/browser/web_resource/notification_promo.cc b/chrome/browser/web_resource/notification_promo.cc
index 1c13333..71f9d0d 100644
--- a/chrome/browser/web_resource/notification_promo.cc
+++ b/chrome/browser/web_resource/notification_promo.cc
@@ -16,8 +16,8 @@
#include "base/time.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/prefs/pref_service_simple.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/web_resource/promo_resource_service.h"
#include "chrome/common/chrome_version_info.h"
@@ -310,8 +310,8 @@ void NotificationPromo::OnNewNotification() {
}
// static
-void NotificationPromo::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterDictionaryPref(kPrefPromoObject);
+void NotificationPromo::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterDictionaryPref(kPrefPromoObject);
}
// static
diff --git a/chrome/browser/web_resource/notification_promo.h b/chrome/browser/web_resource/notification_promo.h
index 84c5e2b..4d26a09 100644
--- a/chrome/browser/web_resource/notification_promo.h
+++ b/chrome/browser/web_resource/notification_promo.h
@@ -18,8 +18,8 @@ class DictionaryValue;
class ListValue;
}
+class PrefRegistrySimple;
class PrefService;
-class PrefServiceSimple;
class PrefServiceSyncable;
// Helper class for PromoResourceService that parses promo notification info
@@ -66,7 +66,7 @@ class NotificationPromo {
}
// Register preferences.
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
static void RegisterUserPrefs(PrefServiceSyncable* prefs);
private:
diff --git a/chrome/browser/web_resource/plugins_resource_service.cc b/chrome/browser/web_resource/plugins_resource_service.cc
index 77777d8..e6df0fd 100644
--- a/chrome/browser/web_resource/plugins_resource_service.cc
+++ b/chrome/browser/web_resource/plugins_resource_service.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "chrome/browser/plugins/plugin_finder.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
@@ -65,10 +66,10 @@ PluginsResourceService::~PluginsResourceService() {
}
// static
-void PluginsResourceService::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterDictionaryPref(
- prefs::kPluginsMetadata, new base::DictionaryValue());
- local_state->RegisterStringPref(prefs::kPluginsResourceCacheUpdate, "0");
+void PluginsResourceService::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterDictionaryPref(prefs::kPluginsMetadata,
+ new base::DictionaryValue());
+ registry->RegisterStringPref(prefs::kPluginsResourceCacheUpdate, "0");
}
void PluginsResourceService::Unpack(const DictionaryValue& parsed_json) {
diff --git a/chrome/browser/web_resource/plugins_resource_service.h b/chrome/browser/web_resource/plugins_resource_service.h
index d01597e..9a3b0d3 100644
--- a/chrome/browser/web_resource/plugins_resource_service.h
+++ b/chrome/browser/web_resource/plugins_resource_service.h
@@ -8,7 +8,7 @@
#include "chrome/browser/web_resource/web_resource_service.h"
class PrefService;
-class PrefServiceSimple;
+class PrefRegistrySimple;
// This resource service periodically fetches plug-in metadata
// from a remote server and updates local state and PluginFinder.
@@ -16,7 +16,7 @@ class PluginsResourceService : public WebResourceService {
public:
explicit PluginsResourceService(PrefService* local_state);
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
private:
virtual ~PluginsResourceService();
diff --git a/chrome/browser/web_resource/promo_resource_service.cc b/chrome/browser/web_resource/promo_resource_service.cc
index 1c7282c..12ede86 100644
--- a/chrome/browser/web_resource/promo_resource_service.cc
+++ b/chrome/browser/web_resource/promo_resource_service.cc
@@ -10,7 +10,7 @@
#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/prefs/pref_service_simple.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/web_resource/notification_promo.h"
#include "chrome/common/chrome_notification_types.h"
@@ -61,9 +61,9 @@ int GetCacheUpdateDelay() {
} // namespace
// static
-void PromoResourceService::RegisterPrefs(PrefServiceSimple* local_state) {
- local_state->RegisterStringPref(prefs::kNtpPromoResourceCacheUpdate, "0");
- NotificationPromo::RegisterPrefs(local_state);
+void PromoResourceService::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterStringPref(prefs::kNtpPromoResourceCacheUpdate, "0");
+ NotificationPromo::RegisterPrefs(registry);
}
// static
diff --git a/chrome/browser/web_resource/promo_resource_service.h b/chrome/browser/web_resource/promo_resource_service.h
index 22d1ba7..349dabf 100644
--- a/chrome/browser/web_resource/promo_resource_service.h
+++ b/chrome/browser/web_resource/promo_resource_service.h
@@ -15,7 +15,7 @@ class DictionaryValue;
}
class NotificationPromo;
-class PrefServiceSimple;
+class PrefRegistrySimple;
class PrefServiceSyncable;
// A PromoResourceService fetches data from a web resource server to be used to
@@ -24,7 +24,7 @@ class PrefServiceSyncable;
// promotional messages to certain groups of Chrome users.
class PromoResourceService : public WebResourceService {
public:
- static void RegisterPrefs(PrefServiceSimple* local_state);
+ static void RegisterPrefs(PrefRegistrySimple* registry);
static void RegisterUserPrefs(PrefServiceSyncable* prefs);
PromoResourceService();
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 422b256..ab74e6f 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1488,12 +1488,14 @@
'browser/prefs/pref_model_associator.h',
'browser/prefs/pref_notifier_impl.cc',
'browser/prefs/pref_notifier_impl.h',
+ 'browser/prefs/pref_registry.cc',
+ 'browser/prefs/pref_registry.h',
+ 'browser/prefs/pref_registry_simple.cc',
+ 'browser/prefs/pref_registry_simple.h',
'browser/prefs/pref_service.cc',
'browser/prefs/pref_service.h',
'browser/prefs/pref_service_builder.cc',
'browser/prefs/pref_service_builder.h',
- 'browser/prefs/pref_service_simple.cc',
- 'browser/prefs/pref_service_simple.h',
'browser/prefs/pref_service_syncable.cc',
'browser/prefs/pref_service_syncable.h',
'browser/prefs/pref_service_syncable_builder.cc',
diff --git a/chrome/test/base/testing_browser_process.cc b/chrome/test/base/testing_browser_process.cc
index b955d4b..7c97e93 100644
--- a/chrome/test/base/testing_browser_process.cc
+++ b/chrome/test/base/testing_browser_process.cc
@@ -96,7 +96,7 @@ void TestingBrowserProcess::SetProfileManager(ProfileManager* profile_manager) {
#endif
}
-PrefServiceSimple* TestingBrowserProcess::local_state() {
+PrefService* TestingBrowserProcess::local_state() {
return local_state_;
}
@@ -344,7 +344,7 @@ void TestingBrowserProcess::SetSystemRequestContext(
system_request_context_ = context_getter;
}
-void TestingBrowserProcess::SetLocalState(PrefServiceSimple* local_state) {
+void TestingBrowserProcess::SetLocalState(PrefService* local_state) {
if (!local_state) {
// The local_state_ PrefService is owned outside of TestingBrowserProcess,
// but some of the members of TestingBrowserProcess hold references to it
diff --git a/chrome/test/base/testing_browser_process.h b/chrome/test/base/testing_browser_process.h
index 3d2a677..76da2ca 100644
--- a/chrome/test/base/testing_browser_process.h
+++ b/chrome/test/base/testing_browser_process.h
@@ -22,7 +22,7 @@ class CRLSetFetcher;
class IOThread;
class MHTMLGenerationManager;
class NotificationUIManager;
-class PrefServiceSimple;
+class PrefService;
class WatchDogThread;
namespace content {
@@ -52,7 +52,7 @@ class TestingBrowserProcess : public BrowserProcess {
virtual IOThread* io_thread() OVERRIDE;
virtual WatchDogThread* watchdog_thread() OVERRIDE;
virtual ProfileManager* profile_manager() OVERRIDE;
- virtual PrefServiceSimple* local_state() OVERRIDE;
+ virtual PrefService* local_state() OVERRIDE;
virtual chrome_variations::VariationsService* variations_service() OVERRIDE;
virtual policy::BrowserPolicyConnector* browser_policy_connector() OVERRIDE;
virtual policy::PolicyService* policy_service() OVERRIDE;
@@ -112,7 +112,7 @@ class TestingBrowserProcess : public BrowserProcess {
// Set the local state for tests. Consumer is responsible for cleaning it up
// afterwards (using ScopedTestingLocalState, for example).
- void SetLocalState(PrefServiceSimple* local_state);
+ void SetLocalState(PrefService* local_state);
void SetProfileManager(ProfileManager* profile_manager);
void SetIOThread(IOThread* io_thread);
void SetBrowserPolicyConnector(policy::BrowserPolicyConnector* connector);
@@ -148,7 +148,7 @@ class TestingBrowserProcess : public BrowserProcess {
#endif // !defined(OS_IOS)
// The following objects are not owned by TestingBrowserProcess:
- PrefServiceSimple* local_state_;
+ PrefService* local_state_;
IOThread* io_thread_;
net::URLRequestContextGetter* system_request_context_;
diff --git a/chrome/test/base/testing_pref_service.cc b/chrome/test/base/testing_pref_service.cc
index ce15d09..a6801dd 100644
--- a/chrome/test/base/testing_pref_service.cc
+++ b/chrome/test/base/testing_pref_service.cc
@@ -5,9 +5,11 @@
#include "chrome/test/base/testing_pref_service.h"
#include "base/bind.h"
+#include "base/compiler_specific.h"
#include "base/prefs/default_pref_store.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/prefs/pref_notifier_impl.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_value_store.h"
#include "chrome/test/base/testing_browser_process.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -21,25 +23,25 @@ void HandleReadError(PersistentPrefStore::PrefReadError error) {
} // namespace
template<>
-TestingPrefServiceBase<PrefServiceSimple>::TestingPrefServiceBase(
+TestingPrefServiceBase<PrefService>::TestingPrefServiceBase(
TestingPrefStore* managed_prefs,
TestingPrefStore* user_prefs,
TestingPrefStore* recommended_prefs,
- DefaultPrefStore* default_store,
+ PrefRegistry* pref_registry,
PrefNotifierImpl* pref_notifier)
- : PrefServiceSimple(pref_notifier,
- new PrefValueStore(
- managed_prefs,
- NULL,
- NULL,
- user_prefs,
- recommended_prefs,
- default_store,
- pref_notifier),
- user_prefs,
- default_store,
- base::Bind(&HandleReadError),
- false),
+ : PrefService(pref_notifier,
+ new PrefValueStore(
+ managed_prefs,
+ NULL,
+ NULL,
+ user_prefs,
+ recommended_prefs,
+ pref_registry->defaults(),
+ pref_notifier),
+ user_prefs,
+ pref_registry,
+ base::Bind(&HandleReadError),
+ false),
managed_prefs_(managed_prefs),
user_prefs_(user_prefs),
recommended_prefs_(recommended_prefs) {
@@ -50,7 +52,7 @@ TestingPrefServiceBase<PrefServiceSyncable>::TestingPrefServiceBase(
TestingPrefStore* managed_prefs,
TestingPrefStore* user_prefs,
TestingPrefStore* recommended_prefs,
- DefaultPrefStore* default_store,
+ PrefRegistry* pref_registry,
PrefNotifierImpl* pref_notifier)
: PrefServiceSyncable(pref_notifier,
new PrefValueStore(
@@ -59,10 +61,10 @@ TestingPrefServiceBase<PrefServiceSyncable>::TestingPrefServiceBase(
NULL,
user_prefs,
recommended_prefs,
- default_store,
+ pref_registry->defaults(),
pref_notifier),
user_prefs,
- default_store,
+ pref_registry,
base::Bind(&HandleReadError),
false),
managed_prefs_(managed_prefs),
@@ -71,22 +73,29 @@ TestingPrefServiceBase<PrefServiceSyncable>::TestingPrefServiceBase(
}
TestingPrefServiceSimple::TestingPrefServiceSimple()
- : TestingPrefServiceBase<PrefServiceSimple>(new TestingPrefStore(),
- new TestingPrefStore(),
- new TestingPrefStore(),
- new DefaultPrefStore(),
- new PrefNotifierImpl()) {
+ : TestingPrefServiceBase<PrefService>(
+ new TestingPrefStore(),
+ new TestingPrefStore(),
+ new TestingPrefStore(),
+ new PrefRegistrySimple(),
+ new PrefNotifierImpl()) {
}
TestingPrefServiceSimple::~TestingPrefServiceSimple() {
}
+PrefRegistrySimple* TestingPrefServiceSimple::registry() {
+ return static_cast<PrefRegistrySimple*>(DeprecatedGetPrefRegistry());
+}
+
+// TODO(joi): Switch to PrefRegistrySyncable once available.
TestingPrefServiceSyncable::TestingPrefServiceSyncable()
- : TestingPrefServiceBase<PrefServiceSyncable>(new TestingPrefStore(),
- new TestingPrefStore(),
- new TestingPrefStore(),
- new DefaultPrefStore(),
- new PrefNotifierImpl()) {
+ : TestingPrefServiceBase<PrefServiceSyncable>(
+ new TestingPrefStore(),
+ new TestingPrefStore(),
+ new TestingPrefStore(),
+ new PrefRegistrySimple(),
+ new PrefNotifierImpl()) {
}
TestingPrefServiceSyncable::~TestingPrefServiceSyncable() {
@@ -95,7 +104,8 @@ TestingPrefServiceSyncable::~TestingPrefServiceSyncable() {
ScopedTestingLocalState::ScopedTestingLocalState(
TestingBrowserProcess* browser_process)
: browser_process_(browser_process) {
- chrome::RegisterLocalState(&local_state_);
+ chrome::RegisterLocalState(static_cast<PrefRegistrySimple*>(
+ local_state_.DeprecatedGetPrefRegistry()), &local_state_);
EXPECT_FALSE(browser_process->local_state());
browser_process->SetLocalState(&local_state_);
}
diff --git a/chrome/test/base/testing_pref_service.h b/chrome/test/base/testing_pref_service.h
index 5c921bf..fd72601 100644
--- a/chrome/test/base/testing_pref_service.h
+++ b/chrome/test/base/testing_pref_service.h
@@ -6,12 +6,14 @@
#define CHROME_TEST_BASE_TESTING_PREF_SERVICE_H_
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
#include "base/prefs/testing_pref_store.h"
+#include "chrome/browser/prefs/pref_registry.h"
#include "chrome/browser/prefs/pref_service.h"
-class DefaultPrefStore;
class PrefModelAssociator;
class PrefNotifierImpl;
+class PrefRegistrySimple;
class TestingBrowserProcess;
class TestingPrefStore;
@@ -53,7 +55,7 @@ class TestingPrefServiceBase : public SuperPrefService {
TestingPrefStore* managed_prefs,
TestingPrefStore* user_prefs,
TestingPrefStore* recommended_prefs,
- DefaultPrefStore* default_store,
+ PrefRegistry* pref_registry,
PrefNotifierImpl* pref_notifier);
private:
@@ -75,13 +77,20 @@ class TestingPrefServiceBase : public SuperPrefService {
DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceBase);
};
-// Test version of PrefServiceSimple.
+// Test version of PrefService.
class TestingPrefServiceSimple
- : public TestingPrefServiceBase<PrefServiceSimple> {
+ : public TestingPrefServiceBase<PrefService> {
public:
TestingPrefServiceSimple();
virtual ~TestingPrefServiceSimple();
+ // This is provided as a convenience for registering preferences on
+ // an existing TestingPrefServiceSimple instance. On a production
+ // PrefService you would do all registrations before constructing
+ // it, passing it a PrefRegistry via its constructor (or via
+ // e.g. PrefServiceBuilder).
+ PrefRegistrySimple* registry();
+
private:
DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceSimple);
};
@@ -116,11 +125,11 @@ class ScopedTestingLocalState {
};
template<>
-TestingPrefServiceBase<PrefServiceSimple>::TestingPrefServiceBase(
+TestingPrefServiceBase<PrefService>::TestingPrefServiceBase(
TestingPrefStore* managed_prefs,
TestingPrefStore* user_prefs,
TestingPrefStore* recommended_prefs,
- DefaultPrefStore* default_store,
+ PrefRegistry* pref_registry,
PrefNotifierImpl* pref_notifier);
template<>
@@ -128,7 +137,7 @@ TestingPrefServiceBase<PrefServiceSyncable>::TestingPrefServiceBase(
TestingPrefStore* managed_prefs,
TestingPrefStore* user_prefs,
TestingPrefStore* recommended_prefs,
- DefaultPrefStore* default_store,
+ PrefRegistry* pref_registry,
PrefNotifierImpl* pref_notifier);
template<class SuperPrefService>
diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc
index ce333e8..6835058 100644
--- a/chrome/test/reliability/page_load_test.cc
+++ b/chrome/test/reliability/page_load_test.cc
@@ -52,6 +52,7 @@
#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "chrome/browser/net/url_fixer_upper.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/pref_service_mock_builder.h"
#include "chrome/common/automation_messages.h"
@@ -745,25 +746,27 @@ class PageLoadTest : public UITest {
// Get a PrefService whose contents correspond to the Local State file
// that was saved by the app as it closed. The caller takes ownership of the
// returned PrefService object.
- PrefServiceSimple* GetLocalState() {
+ PrefService* GetLocalState(PrefRegistry* registry) {
FilePath path = user_data_dir().Append(chrome::kLocalStateFilename);
PrefServiceMockBuilder builder;
builder.WithUserFilePrefs(path,
MessageLoop::current()->message_loop_proxy());
- return builder.CreateSimple();
+ return builder.Create(registry);
}
void GetStabilityMetrics(NavigationMetrics* metrics) {
if (!metrics)
return;
- scoped_ptr<PrefServiceSimple> local_state(GetLocalState());
+ scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple();
+ registry->RegisterBooleanPref(prefs::kStabilityExitedCleanly, false);
+ registry->RegisterIntegerPref(prefs::kStabilityLaunchCount, -1);
+ registry->RegisterIntegerPref(prefs::kStabilityPageLoadCount, -1);
+ registry->RegisterIntegerPref(prefs::kStabilityCrashCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0);
+
+ scoped_ptr<PrefService> local_state(GetLocalState(registry));
if (!local_state.get())
return;
- local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, false);
- local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, -1);
- local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, -1);
- local_state->RegisterIntegerPref(prefs::kStabilityCrashCount, 0);
- local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0);
metrics->browser_clean_exit =
local_state->GetBoolean(prefs::kStabilityExitedCleanly);