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

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: Merge to head again; base::File changes conflicted. 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 cb394bde322649cb2ea5a4e9631aa0a446afb936..207c61fc0ea8442235bb45e81112010fc21029ba 100644
--- a/chrome/browser/sync/invalidations/invalidator_storage.cc
+++ b/chrome/browser/sync/invalidations/invalidator_storage.cc
@@ -13,6 +13,7 @@
#include "base/strings/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,22 +94,24 @@ 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);
- pref_service_->RegisterStringPref(prefs::kInvalidatorClientId,
- std::string(),
- PrefServiceSyncable::UNSYNCABLE_PREF);
-
- MigrateMaxInvalidationVersionsPref();
+ if (registry) {
+ // TODO(joi): Move to registration function.
+ registry->RegisterListPref(prefs::kInvalidatorMaxInvalidationVersions,
+ PrefRegistrySyncable::UNSYNCABLE_PREF);
+ registry->RegisterStringPref(prefs::kInvalidatorInvalidationState,
+ std::string(),
+ PrefRegistrySyncable::UNSYNCABLE_PREF);
+ registry->RegisterStringPref(prefs::kInvalidatorClientId,
+ std::string(),
+ PrefRegistrySyncable::UNSYNCABLE_PREF);
+
+ MigrateMaxInvalidationVersionsPref(registry);
}
}
@@ -196,9 +199,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