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

Unified Diff: chrome/browser/sync/invalidations/invalidator_storage.cc

Issue 12079097: Introduce PrefRegistrySyncable, simplifying PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add to PrefRegistrySyncable and PrefServiceSyncable to let sync know of pre-registered prefs. Created 7 years, 10 months 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/sync/invalidations/invalidator_storage.cc
diff --git a/chrome/browser/sync/invalidations/invalidator_storage.cc b/chrome/browser/sync/invalidations/invalidator_storage.cc
index b17ba509c05dab8b56cdb69c04799b4ee0e2fc6c..b51a538d49974060f41575cc9d930f5a7c76bcdc 100644
--- a/chrome/browser/sync/invalidations/invalidator_storage.cc
+++ b/chrome/browser/sync/invalidations/invalidator_storage.cc
@@ -13,6 +13,7 @@
#include "base/string_number_conversions.h"
#include "base/task_runner.h"
#include "base/values.h"
+#include "chrome/browser/prefs/pref_registry_syncable.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
#include "sync/internal_api/public/base/model_type.h"
@@ -93,19 +94,20 @@ DictionaryValue* ObjectIdAndStateToValue(
} // namespace
-InvalidatorStorage::InvalidatorStorage(PrefServiceSyncable* pref_service)
+InvalidatorStorage::InvalidatorStorage(PrefService* pref_service,
+ PrefRegistrySyncable* registry)
: pref_service_(pref_service) {
// TODO(tim): Create a Mock instead of maintaining the if(!pref_service_) case
// throughout this file. This is a problem now due to lack of injection at
// ProfileSyncService. Bug 130176.
- if (pref_service_) {
- pref_service_->RegisterListPref(prefs::kInvalidatorMaxInvalidationVersions,
- PrefServiceSyncable::UNSYNCABLE_PREF);
- pref_service_->RegisterStringPref(prefs::kInvalidatorInvalidationState,
- std::string(),
- PrefServiceSyncable::UNSYNCABLE_PREF);
-
- MigrateMaxInvalidationVersionsPref();
+ if (registry) {
Mattias Nissler (ping if slow) 2013/02/06 17:53:33 TODO: Move to registration function.
Jói 2013/02/07 14:52:32 Done.
+ registry->RegisterListPref(prefs::kInvalidatorMaxInvalidationVersions,
+ PrefRegistrySyncable::UNSYNCABLE_PREF);
+ registry->RegisterStringPref(prefs::kInvalidatorInvalidationState,
+ std::string(),
+ PrefRegistrySyncable::UNSYNCABLE_PREF);
+
+ MigrateMaxInvalidationVersionsPref(registry);
}
}
@@ -193,9 +195,10 @@ void InvalidatorStorage::SerializeToList(
}
// Legacy migration code.
-void InvalidatorStorage::MigrateMaxInvalidationVersionsPref() {
- pref_service_->RegisterDictionaryPref(prefs::kSyncMaxInvalidationVersions,
- PrefServiceSyncable::UNSYNCABLE_PREF);
+void InvalidatorStorage::MigrateMaxInvalidationVersionsPref(
+ PrefRegistrySyncable* registry) {
+ registry->RegisterDictionaryPref(prefs::kSyncMaxInvalidationVersions,
+ PrefRegistrySyncable::UNSYNCABLE_PREF);
const base::DictionaryValue* max_versions_dict =
pref_service_->GetDictionary(prefs::kSyncMaxInvalidationVersions);
CHECK(max_versions_dict);

Powered by Google App Engine
This is Rietveld 408576698