diff options
Diffstat (limited to 'chrome/browser/sync/sync_prefs.cc')
-rw-r--r-- | chrome/browser/sync/sync_prefs.cc | 123 |
1 files changed, 61 insertions, 62 deletions
diff --git a/chrome/browser/sync/sync_prefs.cc b/chrome/browser/sync/sync_prefs.cc index 5966ea0..519cb0e 100644 --- a/chrome/browser/sync/sync_prefs.cc +++ b/chrome/browser/sync/sync_prefs.cc @@ -119,26 +119,26 @@ void SyncPrefs::SetKeepEverythingSynced(bool keep_everything_synced) { keep_everything_synced); } -syncable::ModelTypeSet SyncPrefs::GetPreferredDataTypes( - syncable::ModelTypeSet registered_types) const { +syncer::ModelTypeSet SyncPrefs::GetPreferredDataTypes( + syncer::ModelTypeSet registered_types) const { DCHECK(CalledOnValidThread()); if (!pref_service_) { - return syncable::ModelTypeSet(); + return syncer::ModelTypeSet(); } // First remove any datatypes that are inconsistent with the current policies // on the client (so that "keep everything synced" doesn't include them). if (pref_service_->HasPrefPath(prefs::kSavingBrowserHistoryDisabled) && pref_service_->GetBoolean(prefs::kSavingBrowserHistoryDisabled)) { - registered_types.Remove(syncable::TYPED_URLS); + registered_types.Remove(syncer::TYPED_URLS); } if (pref_service_->GetBoolean(prefs::kSyncKeepEverythingSynced)) { return registered_types; } - syncable::ModelTypeSet preferred_types; - for (syncable::ModelTypeSet::Iterator it = registered_types.First(); + syncer::ModelTypeSet preferred_types; + for (syncer::ModelTypeSet::Iterator it = registered_types.First(); it.Good(); it.Inc()) { if (GetDataTypePreferred(it.Get())) { preferred_types.Put(it.Get()); @@ -148,13 +148,13 @@ syncable::ModelTypeSet SyncPrefs::GetPreferredDataTypes( } void SyncPrefs::SetPreferredDataTypes( - syncable::ModelTypeSet registered_types, - syncable::ModelTypeSet preferred_types) { + syncer::ModelTypeSet registered_types, + syncer::ModelTypeSet preferred_types) { DCHECK(CalledOnValidThread()); CHECK(pref_service_); DCHECK(registered_types.HasAll(preferred_types)); preferred_types = ResolvePrefGroups(registered_types, preferred_types); - for (syncable::ModelTypeSet::Iterator i = registered_types.First(); + for (syncer::ModelTypeSet::Iterator i = registered_types.First(); i.Good(); i.Inc()) { SetDataTypePreferred(i.Get(), preferred_types.Has(i.Get())); } @@ -190,19 +190,18 @@ void SyncPrefs::SetSpareBootstrapToken(const std::string& token) { } #endif -void SyncPrefs::AcknowledgeSyncedTypes( - syncable::ModelTypeSet types) { +void SyncPrefs::AcknowledgeSyncedTypes(syncer::ModelTypeSet types) { DCHECK(CalledOnValidThread()); CHECK(pref_service_); // Add the types to the current set of acknowledged // types, and then store the resulting set in prefs. - const syncable::ModelTypeSet acknowledged_types = + const syncer::ModelTypeSet acknowledged_types = Union(types, - syncable::ModelTypeSetFromValue( + syncer::ModelTypeSetFromValue( *pref_service_->GetList(prefs::kSyncAcknowledgedSyncTypes))); scoped_ptr<ListValue> value( - syncable::ModelTypeSetToValue(acknowledged_types)); + syncer::ModelTypeSetToValue(acknowledged_types)); pref_service_->Set(prefs::kSyncAcknowledgedSyncTypes, *value); } @@ -233,46 +232,46 @@ void SyncPrefs::SetManagedForTest(bool is_managed) { pref_service_->SetBoolean(prefs::kSyncManaged, is_managed); } -syncable::ModelTypeSet SyncPrefs::GetAcknowledgeSyncedTypesForTest() const { +syncer::ModelTypeSet SyncPrefs::GetAcknowledgeSyncedTypesForTest() const { DCHECK(CalledOnValidThread()); if (!pref_service_) { - return syncable::ModelTypeSet(); + return syncer::ModelTypeSet(); } - return syncable::ModelTypeSetFromValue( + return syncer::ModelTypeSetFromValue( *pref_service_->GetList(prefs::kSyncAcknowledgedSyncTypes)); } namespace { -const char* GetPrefNameForDataType(syncable::ModelType data_type) { +const char* GetPrefNameForDataType(syncer::ModelType data_type) { switch (data_type) { - case syncable::BOOKMARKS: + case syncer::BOOKMARKS: return prefs::kSyncBookmarks; - case syncable::PASSWORDS: + case syncer::PASSWORDS: return prefs::kSyncPasswords; - case syncable::PREFERENCES: + case syncer::PREFERENCES: return prefs::kSyncPreferences; - case syncable::AUTOFILL: + case syncer::AUTOFILL: return prefs::kSyncAutofill; - case syncable::AUTOFILL_PROFILE: + case syncer::AUTOFILL_PROFILE: return prefs::kSyncAutofillProfile; - case syncable::THEMES: + case syncer::THEMES: return prefs::kSyncThemes; - case syncable::TYPED_URLS: + case syncer::TYPED_URLS: return prefs::kSyncTypedUrls; - case syncable::EXTENSION_SETTINGS: + case syncer::EXTENSION_SETTINGS: return prefs::kSyncExtensionSettings; - case syncable::EXTENSIONS: + case syncer::EXTENSIONS: return prefs::kSyncExtensions; - case syncable::APP_SETTINGS: + case syncer::APP_SETTINGS: return prefs::kSyncAppSettings; - case syncable::APPS: + case syncer::APPS: return prefs::kSyncApps; - case syncable::SEARCH_ENGINES: + case syncer::SEARCH_ENGINES: return prefs::kSyncSearchEngines; - case syncable::SESSIONS: + case syncer::SESSIONS: return prefs::kSyncSessions; - case syncable::APP_NOTIFICATIONS: + case syncer::APP_NOTIFICATIONS: return prefs::kSyncAppNotifications; default: break; @@ -284,14 +283,14 @@ const char* GetPrefNameForDataType(syncable::ModelType data_type) { } // namespace void SyncPrefs::RegisterPrefGroups() { - pref_groups_[syncable::APPS].Put(syncable::APP_NOTIFICATIONS); - pref_groups_[syncable::APPS].Put(syncable::APP_SETTINGS); + pref_groups_[syncer::APPS].Put(syncer::APP_NOTIFICATIONS); + pref_groups_[syncer::APPS].Put(syncer::APP_SETTINGS); - pref_groups_[syncable::AUTOFILL].Put(syncable::AUTOFILL_PROFILE); + pref_groups_[syncer::AUTOFILL].Put(syncer::AUTOFILL_PROFILE); - pref_groups_[syncable::EXTENSIONS].Put(syncable::EXTENSION_SETTINGS); + pref_groups_[syncer::EXTENSIONS].Put(syncer::EXTENSION_SETTINGS); - pref_groups_[syncable::PREFERENCES].Put(syncable::SEARCH_ENGINES); + pref_groups_[syncer::PREFERENCES].Put(syncer::SEARCH_ENGINES); } void SyncPrefs::RegisterPreferences() { @@ -327,11 +326,11 @@ void SyncPrefs::RegisterPreferences() { PrefService::UNSYNCABLE_PREF); // Treat bookmarks specially. - RegisterDataTypePreferredPref(syncable::BOOKMARKS, true); - for (int i = syncable::PREFERENCES; i < syncable::MODEL_TYPE_COUNT; ++i) { - const syncable::ModelType type = syncable::ModelTypeFromInt(i); + RegisterDataTypePreferredPref(syncer::BOOKMARKS, true); + for (int i = syncer::PREFERENCES; i < syncer::MODEL_TYPE_COUNT; ++i) { + const syncer::ModelType type = syncer::ModelTypeFromInt(i); // Also treat nigori specially. - if (type == syncable::NIGORI) { + if (type == syncer::NIGORI) { continue; } RegisterDataTypePreferredPref(type, enable_by_default); @@ -352,25 +351,25 @@ void SyncPrefs::RegisterPreferences() { // We will start prompting people about new data types after the launch of // SESSIONS - all previously launched data types are treated as if they are // already acknowledged. - syncable::ModelTypeSet model_set; - model_set.Put(syncable::BOOKMARKS); - model_set.Put(syncable::PREFERENCES); - model_set.Put(syncable::PASSWORDS); - model_set.Put(syncable::AUTOFILL_PROFILE); - model_set.Put(syncable::AUTOFILL); - model_set.Put(syncable::THEMES); - model_set.Put(syncable::EXTENSIONS); - model_set.Put(syncable::NIGORI); - model_set.Put(syncable::SEARCH_ENGINES); - model_set.Put(syncable::APPS); - model_set.Put(syncable::TYPED_URLS); - model_set.Put(syncable::SESSIONS); + syncer::ModelTypeSet model_set; + model_set.Put(syncer::BOOKMARKS); + model_set.Put(syncer::PREFERENCES); + model_set.Put(syncer::PASSWORDS); + model_set.Put(syncer::AUTOFILL_PROFILE); + model_set.Put(syncer::AUTOFILL); + model_set.Put(syncer::THEMES); + model_set.Put(syncer::EXTENSIONS); + model_set.Put(syncer::NIGORI); + model_set.Put(syncer::SEARCH_ENGINES); + model_set.Put(syncer::APPS); + model_set.Put(syncer::TYPED_URLS); + model_set.Put(syncer::SESSIONS); pref_service_->RegisterListPref(prefs::kSyncAcknowledgedSyncTypes, - syncable::ModelTypeSetToValue(model_set), + syncer::ModelTypeSetToValue(model_set), PrefService::UNSYNCABLE_PREF); } -void SyncPrefs::RegisterDataTypePreferredPref(syncable::ModelType type, +void SyncPrefs::RegisterDataTypePreferredPref(syncer::ModelType type, bool is_preferred) { DCHECK(CalledOnValidThread()); CHECK(pref_service_); @@ -383,7 +382,7 @@ void SyncPrefs::RegisterDataTypePreferredPref(syncable::ModelType type, PrefService::UNSYNCABLE_PREF); } -bool SyncPrefs::GetDataTypePreferred(syncable::ModelType type) const { +bool SyncPrefs::GetDataTypePreferred(syncer::ModelType type) const { DCHECK(CalledOnValidThread()); if (!pref_service_) { return false; @@ -398,7 +397,7 @@ bool SyncPrefs::GetDataTypePreferred(syncable::ModelType type) const { } void SyncPrefs::SetDataTypePreferred( - syncable::ModelType type, bool is_preferred) { + syncer::ModelType type, bool is_preferred) { DCHECK(CalledOnValidThread()); CHECK(pref_service_); const char* pref_name = GetPrefNameForDataType(type); @@ -409,11 +408,11 @@ void SyncPrefs::SetDataTypePreferred( pref_service_->SetBoolean(pref_name, is_preferred); } -syncable::ModelTypeSet SyncPrefs::ResolvePrefGroups( - syncable::ModelTypeSet registered_types, - syncable::ModelTypeSet types) const { +syncer::ModelTypeSet SyncPrefs::ResolvePrefGroups( + syncer::ModelTypeSet registered_types, + syncer::ModelTypeSet types) const { DCHECK(registered_types.HasAll(types)); - syncable::ModelTypeSet types_with_groups = types; + syncer::ModelTypeSet types_with_groups = types; for (PrefGroupsMap::const_iterator i = pref_groups_.begin(); i != pref_groups_.end(); ++i) { if (types.Has(i->first)) |