Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Unified Diff: chrome/browser/prefs/pref_service_builder.cc

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prefs/pref_service_builder.cc
diff --git a/chrome/browser/prefs/pref_service_builder.cc b/chrome/browser/prefs/pref_service_builder.cc
index f73f2f1580a65bae2bc8511d086e805dda540054..a254c7e9fc72295ce25e87528c29ef88e4649816 100644
--- a/chrome/browser/prefs/pref_service_builder.cc
+++ b/chrome/browser/prefs/pref_service_builder.cc
@@ -19,8 +19,7 @@ void DoNothingHandleReadError(PersistentPrefStore::PrefReadError error) {
} // namespace
-PrefServiceBuilder::PrefServiceBuilder()
- : sync_associator_(NULL) {
+PrefServiceBuilder::PrefServiceBuilder() {
ResetDefaultState();
}
@@ -53,12 +52,6 @@ PrefServiceBuilder& PrefServiceBuilder::WithRecommendedPrefs(PrefStore* store) {
return *this;
}
-PrefServiceBuilder& PrefServiceBuilder::WithSyncAssociator(
- PrefModelAssociator* associator) {
- sync_associator_ = associator;
- return *this;
-}
-
PrefServiceBuilder& PrefServiceBuilder::WithReadErrorCallback(
const base::Callback<void(PersistentPrefStore::PrefReadError)>&
read_error_callback) {
@@ -78,38 +71,33 @@ PrefServiceBuilder& PrefServiceBuilder::WithAsync(bool async) {
return *this;
}
-PrefService* PrefServiceBuilder::Create() {
+PrefService* PrefServiceBuilder::Build(PrefService* pref_service) {
DefaultPrefStore* default_pref_store = new DefaultPrefStore();
PrefNotifierImpl* pref_notifier = new PrefNotifierImpl();
- PrefService* pref_service =
- new PrefService(
- pref_notifier,
- new PrefValueStore(
- managed_prefs_.get(),
- extension_prefs_.get(),
- command_line_prefs_.get(),
- user_prefs_.get(),
- recommended_prefs_.get(),
- default_pref_store,
- sync_associator_,
- pref_notifier),
+ pref_service->Initialize(
+ pref_notifier,
+ new PrefValueStore(
+ managed_prefs_.get(),
+ extension_prefs_.get(),
+ command_line_prefs_.get(),
user_prefs_.get(),
+ recommended_prefs_.get(),
default_pref_store,
- sync_associator_,
- read_error_callback_,
- async_);
- managed_prefs_ = NULL;
- extension_prefs_ = NULL;
- command_line_prefs_ = NULL;
- user_prefs_ = NULL;
- recommended_prefs_ = NULL;
- sync_associator_ = NULL;
+ pref_notifier),
+ user_prefs_.get(),
+ default_pref_store,
+ read_error_callback_,
+ async_);
ResetDefaultState();
-
return pref_service;
}
void PrefServiceBuilder::ResetDefaultState() {
+ managed_prefs_ = NULL;
+ extension_prefs_ = NULL;
+ command_line_prefs_ = NULL;
+ user_prefs_ = NULL;
+ recommended_prefs_ = NULL;
read_error_callback_ = base::Bind(&DoNothingHandleReadError);
async_ = false;
}

Powered by Google App Engine
This is Rietveld 408576698