| Index: chrome/browser/sync/sync_prefs.cc
|
| diff --git a/chrome/browser/sync/sync_prefs.cc b/chrome/browser/sync/sync_prefs.cc
|
| index 1ba1c9a9ecaefbbcc57275990eab86069c12758d..4239208d64e8b97d9ade81fa6445c5fe3eccb73c 100644
|
| --- a/chrome/browser/sync/sync_prefs.cc
|
| +++ b/chrome/browser/sync/sync_prefs.cc
|
| @@ -21,6 +21,9 @@ SyncPrefObserver::~SyncPrefObserver() {}
|
| SyncPrefs::SyncPrefs(PrefService* pref_service)
|
| : pref_service_(pref_service) {
|
| RegisterPrefGroups();
|
| + // 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_) {
|
| RegisterPreferences();
|
| // Watch the preference that indicates sync is managed so we can take
|
| @@ -52,8 +55,6 @@ void SyncPrefs::ClearPreferences() {
|
|
|
| // TODO(nick): The current behavior does not clear
|
| // e.g. prefs::kSyncBookmarks. Is that really what we want?
|
| -
|
| - pref_service_->ClearPref(prefs::kSyncMaxInvalidationVersions);
|
| }
|
|
|
| bool SyncPrefs::HasSyncSetupCompleted() const {
|
| @@ -189,73 +190,6 @@ void SyncPrefs::SetSpareBootstrapToken(const std::string& token) {
|
| }
|
| #endif
|
|
|
| -sync_notifier::InvalidationVersionMap SyncPrefs::GetAllMaxVersions() const {
|
| - DCHECK(non_thread_safe_.CalledOnValidThread());
|
| - if (!pref_service_) {
|
| - return sync_notifier::InvalidationVersionMap();
|
| - }
|
| - // Complicated gross code to convert from a string -> string
|
| - // DictionaryValue to a ModelType -> int64 map.
|
| - const base::DictionaryValue* max_versions_dict =
|
| - pref_service_->GetDictionary(prefs::kSyncMaxInvalidationVersions);
|
| - CHECK(max_versions_dict);
|
| - sync_notifier::InvalidationVersionMap max_versions;
|
| - for (base::DictionaryValue::key_iterator it =
|
| - max_versions_dict->begin_keys();
|
| - it != max_versions_dict->end_keys(); ++it) {
|
| - int model_type_int = 0;
|
| - if (!base::StringToInt(*it, &model_type_int)) {
|
| - LOG(WARNING) << "Invalid model type key: " << *it;
|
| - continue;
|
| - }
|
| - if ((model_type_int < syncable::FIRST_REAL_MODEL_TYPE) ||
|
| - (model_type_int >= syncable::MODEL_TYPE_COUNT)) {
|
| - LOG(WARNING) << "Out-of-range model type key: " << model_type_int;
|
| - continue;
|
| - }
|
| - const syncable::ModelType model_type =
|
| - syncable::ModelTypeFromInt(model_type_int);
|
| - std::string max_version_str;
|
| - CHECK(max_versions_dict->GetString(*it, &max_version_str));
|
| - int64 max_version = 0;
|
| - if (!base::StringToInt64(max_version_str, &max_version)) {
|
| - LOG(WARNING) << "Invalid max invalidation version for "
|
| - << syncable::ModelTypeToString(model_type) << ": "
|
| - << max_version_str;
|
| - continue;
|
| - }
|
| - max_versions[model_type] = max_version;
|
| - }
|
| - return max_versions;
|
| -}
|
| -
|
| -void SyncPrefs::SetMaxVersion(syncable::ModelType model_type,
|
| - int64 max_version) {
|
| - DCHECK(non_thread_safe_.CalledOnValidThread());
|
| - DCHECK(syncable::IsRealDataType(model_type));
|
| - CHECK(pref_service_);
|
| - sync_notifier::InvalidationVersionMap max_versions =
|
| - GetAllMaxVersions();
|
| - sync_notifier::InvalidationVersionMap::iterator it =
|
| - max_versions.find(model_type);
|
| - if ((it != max_versions.end()) && (max_version <= it->second)) {
|
| - NOTREACHED();
|
| - return;
|
| - }
|
| - max_versions[model_type] = max_version;
|
| -
|
| - // Gross code to convert from a ModelType -> int64 map to a string
|
| - // -> string DictionaryValue.
|
| - base::DictionaryValue max_versions_dict;
|
| - for (sync_notifier::InvalidationVersionMap::const_iterator it =
|
| - max_versions.begin();
|
| - it != max_versions.end(); ++it) {
|
| - max_versions_dict.SetString(
|
| - base::IntToString(it->first),
|
| - base::Int64ToString(it->second));
|
| - }
|
| - pref_service_->Set(prefs::kSyncMaxInvalidationVersions, max_versions_dict);
|
| -}
|
|
|
| void SyncPrefs::AcknowledgeSyncedTypes(
|
| syncable::ModelTypeSet types) {
|
| @@ -435,9 +369,6 @@ void SyncPrefs::RegisterPreferences() {
|
| pref_service_->RegisterListPref(prefs::kSyncAcknowledgedSyncTypes,
|
| syncable::ModelTypeSetToValue(model_set),
|
| PrefService::UNSYNCABLE_PREF);
|
| -
|
| - pref_service_->RegisterDictionaryPref(prefs::kSyncMaxInvalidationVersions,
|
| - PrefService::UNSYNCABLE_PREF);
|
| }
|
|
|
| void SyncPrefs::RegisterDataTypePreferredPref(syncable::ModelType type,
|
|
|