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

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

Issue 12256040: Second batch of fixing prefs registrations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit. 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 b75d4ffc0c1d7d1f3286c6b03d47c86a45de3563..052aff1da11e179a6428cbc721963728b287d413 100644
--- a/chrome/browser/sync/invalidations/invalidator_storage.cc
+++ b/chrome/browser/sync/invalidations/invalidator_storage.cc
@@ -94,25 +94,27 @@ DictionaryValue* ObjectIdAndStateToValue(
} // namespace
-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 (registry) {
- // TODO(joi): Move to registration function.
- registry->RegisterListPref(prefs::kInvalidatorMaxInvalidationVersions,
+// static
+void InvalidatorStorage::RegisterUserPrefs(PrefRegistrySyncable* registry) {
+ registry->RegisterListPref(prefs::kInvalidatorMaxInvalidationVersions,
+ PrefRegistrySyncable::UNSYNCABLE_PREF);
+ registry->RegisterStringPref(prefs::kInvalidatorInvalidationState,
+ std::string(),
PrefRegistrySyncable::UNSYNCABLE_PREF);
- registry->RegisterStringPref(prefs::kInvalidatorInvalidationState,
- std::string(),
- PrefRegistrySyncable::UNSYNCABLE_PREF);
- registry->RegisterStringPref(prefs::kInvalidatorClientId,
+ registry->RegisterStringPref(prefs::kInvalidatorClientId,
std::string(),
PrefRegistrySyncable::UNSYNCABLE_PREF);
+ registry->RegisterDictionaryPref(prefs::kSyncMaxInvalidationVersions,
+ PrefRegistrySyncable::UNSYNCABLE_PREF);
+}
- MigrateMaxInvalidationVersionsPref(registry);
- }
+InvalidatorStorage::InvalidatorStorage(PrefService* pref_service)
+ : 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_)
+ MigrateMaxInvalidationVersionsPref();
}
InvalidatorStorage::~InvalidatorStorage() {
@@ -199,10 +201,7 @@ void InvalidatorStorage::SerializeToList(
}
// Legacy migration code.
-void InvalidatorStorage::MigrateMaxInvalidationVersionsPref(
- PrefRegistrySyncable* registry) {
- registry->RegisterDictionaryPref(prefs::kSyncMaxInvalidationVersions,
- PrefRegistrySyncable::UNSYNCABLE_PREF);
+void InvalidatorStorage::MigrateMaxInvalidationVersionsPref() {
const base::DictionaryValue* max_versions_dict =
pref_service_->GetDictionary(prefs::kSyncMaxInvalidationVersions);
CHECK(max_versions_dict);

Powered by Google App Engine
This is Rietveld 408576698