diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-28 22:43:58 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-28 22:43:58 +0000 |
commit | 65f173550226cb0dcf577183a462d48c47764ee3 (patch) | |
tree | 9d4451edfc037f39658b804f95a3fbdbc85a7bd5 /chrome/browser/prefs | |
parent | 7953ef8eea2001287dbd233421226ad3f0e16448 (diff) | |
download | chromium_src-65f173550226cb0dcf577183a462d48c47764ee3.zip chromium_src-65f173550226cb0dcf577183a462d48c47764ee3.tar.gz chromium_src-65f173550226cb0dcf577183a462d48c47764ee3.tar.bz2 |
[Sync] Rename csync namespace to syncer
Everyone was confused by 'csync'. 'syncer' seems more understandable.
(Note that we can't use the 'sync' namespace since sync() is a function
from unistd.h.)
BUG=10662035
TEST=
TBR=jhawkins@chromium.org,pkasting@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10698014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144820 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/prefs')
-rw-r--r-- | chrome/browser/prefs/pref_model_associator.cc | 64 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_model_associator.h | 32 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_service.cc | 2 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_service.h | 8 |
4 files changed, 53 insertions, 53 deletions
diff --git a/chrome/browser/prefs/pref_model_associator.cc b/chrome/browser/prefs/pref_model_associator.cc index acef08a..04bd97a 100644 --- a/chrome/browser/prefs/pref_model_associator.cc +++ b/chrome/browser/prefs/pref_model_associator.cc @@ -33,9 +33,9 @@ PrefModelAssociator::~PrefModelAssociator() { } void PrefModelAssociator::InitPrefAndAssociate( - const csync::SyncData& sync_pref, + const syncer::SyncData& sync_pref, const std::string& pref_name, - csync::SyncChangeList* sync_changes) { + syncer::SyncChangeList* sync_changes) { const PrefService::Preference* pref = pref_service_->FindPreference(pref_name.c_str()); DCHECK(pref); @@ -74,24 +74,24 @@ void PrefModelAssociator::InitPrefAndAssociate( // If the merge resulted in an updated value, inform the syncer. if (!value->Equals(new_value.get())) { - csync::SyncData sync_data; + syncer::SyncData sync_data; if (!CreatePrefSyncData(pref->name(), *new_value, &sync_data)) { LOG(ERROR) << "Failed to update preference."; return; } sync_changes->push_back( - csync::SyncChange(csync::SyncChange::ACTION_UPDATE, sync_data)); + syncer::SyncChange(syncer::SyncChange::ACTION_UPDATE, sync_data)); } } else if (pref->IsUserControlled()) { // The server does not know about this preference and should be added // to the syncer's database. - csync::SyncData sync_data; + syncer::SyncData sync_data; if (!CreatePrefSyncData(pref->name(), *pref->GetValue(), &sync_data)) { LOG(ERROR) << "Failed to update preference."; return; } sync_changes->push_back( - csync::SyncChange(csync::SyncChange::ACTION_ADD, sync_data)); + syncer::SyncChange(syncer::SyncChange::ACTION_ADD, sync_data)); } else { // This pref does not have a sync value but also does not have a user // controlled value (either it's a default value or it's policy controlled, @@ -106,11 +106,11 @@ void PrefModelAssociator::InitPrefAndAssociate( return; } -csync::SyncError PrefModelAssociator::MergeDataAndStartSyncing( +syncer::SyncError PrefModelAssociator::MergeDataAndStartSyncing( syncable::ModelType type, - const csync::SyncDataList& initial_sync_data, - scoped_ptr<csync::SyncChangeProcessor> sync_processor, - scoped_ptr<csync::SyncErrorFactory> sync_error_factory) { + const syncer::SyncDataList& initial_sync_data, + scoped_ptr<syncer::SyncChangeProcessor> sync_processor, + scoped_ptr<syncer::SyncErrorFactory> sync_error_factory) { DCHECK_EQ(type, PREFERENCES); DCHECK(CalledOnValidThread()); DCHECK(pref_service_); @@ -120,12 +120,12 @@ csync::SyncError PrefModelAssociator::MergeDataAndStartSyncing( sync_processor_ = sync_processor.Pass(); sync_error_factory_ = sync_error_factory.Pass(); - csync::SyncChangeList new_changes; + syncer::SyncChangeList new_changes; std::set<std::string> remaining_preferences = registered_preferences_; // Go through and check for all preferences we care about that sync already // knows about. - for (csync::SyncDataList::const_iterator sync_iter = + for (syncer::SyncDataList::const_iterator sync_iter = initial_sync_data.begin(); sync_iter != initial_sync_data.end(); ++sync_iter) { @@ -149,18 +149,18 @@ csync::SyncError PrefModelAssociator::MergeDataAndStartSyncing( remaining_preferences.begin(); pref_name_iter != remaining_preferences.end(); ++pref_name_iter) { - InitPrefAndAssociate(csync::SyncData(), *pref_name_iter, &new_changes); + InitPrefAndAssociate(syncer::SyncData(), *pref_name_iter, &new_changes); } // Push updates to sync. - csync::SyncError error = + syncer::SyncError error = sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes); if (error.IsSet()) { return error; } models_associated_ = true; - return csync::SyncError(); + return syncer::SyncError(); } void PrefModelAssociator::StopSyncing(syncable::ModelType type) { @@ -193,7 +193,7 @@ Value* PrefModelAssociator::MergePreference( bool PrefModelAssociator::CreatePrefSyncData( const std::string& name, const Value& value, - csync::SyncData* sync_data) { + syncer::SyncData* sync_data) { std::string serialized; // TODO(zea): consider JSONWriter::Write since you don't have to check // failures to deserialize. @@ -207,7 +207,7 @@ bool PrefModelAssociator::CreatePrefSyncData( sync_pb::PreferenceSpecifics* pref_specifics = specifics.mutable_preference(); pref_specifics->set_name(name); pref_specifics->set_value(serialized); - *sync_data = csync::SyncData::CreateLocalData(name, name, specifics); + *sync_data = syncer::SyncData::CreateLocalData(name, name, specifics); return true; } @@ -273,11 +273,11 @@ Value* PrefModelAssociator::MergeDictionaryValues( // with user controlled data. We do not track any information for preferences // not registered locally as syncable and do not inform the syncer of // non-user controlled preferences. -csync::SyncDataList PrefModelAssociator::GetAllSyncData( +syncer::SyncDataList PrefModelAssociator::GetAllSyncData( syncable::ModelType type) const { DCHECK_EQ(PREFERENCES, type); - csync::SyncDataList current_data; + syncer::SyncDataList current_data; for (PreferenceSet::const_iterator iter = synced_preferences_.begin(); iter != synced_preferences_.end(); ++iter) { @@ -288,7 +288,7 @@ csync::SyncDataList PrefModelAssociator::GetAllSyncData( if (!pref->IsUserControlled() || pref->IsDefaultValue()) continue; // This is not data we care about. // TODO(zea): plumb a way to read the user controlled value. - csync::SyncData sync_data; + syncer::SyncData sync_data; if (!CreatePrefSyncData(name, *pref->GetValue(), &sync_data)) continue; current_data.push_back(sync_data); @@ -296,17 +296,17 @@ csync::SyncDataList PrefModelAssociator::GetAllSyncData( return current_data; } -csync::SyncError PrefModelAssociator::ProcessSyncChanges( +syncer::SyncError PrefModelAssociator::ProcessSyncChanges( const tracked_objects::Location& from_here, - const csync::SyncChangeList& change_list) { + const syncer::SyncChangeList& change_list) { if (!models_associated_) { - csync::SyncError error(FROM_HERE, + syncer::SyncError error(FROM_HERE, "Models not yet associated.", PREFERENCES); return error; } AutoReset<bool> processing_changes(&processing_syncer_changes_, true); - csync::SyncChangeList::const_iterator iter; + syncer::SyncChangeList::const_iterator iter; for (iter = change_list.begin(); iter != change_list.end(); ++iter) { DCHECK_EQ(PREFERENCES, iter->sync_data().GetDataType()); @@ -316,7 +316,7 @@ csync::SyncError PrefModelAssociator::ProcessSyncChanges( scoped_ptr<Value> value(ReadPreferenceSpecifics(pref_specifics, &name)); - if (iter->change_type() == csync::SyncChange::ACTION_DELETE) { + if (iter->change_type() == syncer::SyncChange::ACTION_DELETE) { // We never delete preferences. NOTREACHED() << "Attempted to process sync delete change for " << name << ". Skipping."; @@ -347,11 +347,11 @@ csync::SyncError PrefModelAssociator::ProcessSyncChanges( pref_service_->Set(pref_name, *value); // Keep track of any newly synced preferences. - if (iter->change_type() == csync::SyncChange::ACTION_ADD) { + if (iter->change_type() == syncer::SyncChange::ACTION_ADD) { synced_preferences_.insert(name); } } - return csync::SyncError(); + return syncer::SyncError(); } Value* PrefModelAssociator::ReadPreferenceSpecifics( @@ -403,7 +403,7 @@ void PrefModelAssociator::ProcessPrefChange(const std::string& name) { if (!IsPrefRegistered(name.c_str())) return; // We are not syncing this preference. - csync::SyncChangeList changes; + syncer::SyncChangeList changes; if (!preference->IsUserModifiable()) { // If the preference is no longer user modifiable, it must now be controlled @@ -419,19 +419,19 @@ void PrefModelAssociator::ProcessPrefChange(const std::string& name) { // Not in synced_preferences_ means no synced data. InitPrefAndAssociate(..) // will determine if we care about its data (e.g. if it has a default value // and hasn't been changed yet we don't) and take care syncing any new data. - InitPrefAndAssociate(csync::SyncData(), name, &changes); + InitPrefAndAssociate(syncer::SyncData(), name, &changes); } else { // We are already syncing this preference, just update it's sync node. - csync::SyncData sync_data; + syncer::SyncData sync_data; if (!CreatePrefSyncData(name, *preference->GetValue(), &sync_data)) { LOG(ERROR) << "Failed to update preference."; return; } changes.push_back( - csync::SyncChange(csync::SyncChange::ACTION_UPDATE, sync_data)); + syncer::SyncChange(syncer::SyncChange::ACTION_UPDATE, sync_data)); } - csync::SyncError error = + syncer::SyncError error = sync_processor_->ProcessSyncChanges(FROM_HERE, changes); } diff --git a/chrome/browser/prefs/pref_model_associator.h b/chrome/browser/prefs/pref_model_associator.h index 21e3fdd..4588b92 100644 --- a/chrome/browser/prefs/pref_model_associator.h +++ b/chrome/browser/prefs/pref_model_associator.h @@ -29,23 +29,23 @@ class Value; // TODO(sync): Merge this into PrefService once we separate the profile // PrefService from the local state PrefService. class PrefModelAssociator - : public csync::SyncableService, + : public syncer::SyncableService, public base::NonThreadSafe { public: PrefModelAssociator(); virtual ~PrefModelAssociator(); - // csync::SyncableService implementation. - virtual csync::SyncDataList GetAllSyncData( + // syncer::SyncableService implementation. + virtual syncer::SyncDataList GetAllSyncData( syncable::ModelType type) const OVERRIDE; - virtual csync::SyncError ProcessSyncChanges( + virtual syncer::SyncError ProcessSyncChanges( const tracked_objects::Location& from_here, - const csync::SyncChangeList& change_list) OVERRIDE; - virtual csync::SyncError MergeDataAndStartSyncing( + const syncer::SyncChangeList& change_list) OVERRIDE; + virtual syncer::SyncError MergeDataAndStartSyncing( syncable::ModelType type, - const csync::SyncDataList& initial_sync_data, - scoped_ptr<csync::SyncChangeProcessor> sync_processor, - scoped_ptr<csync::SyncErrorFactory> sync_error_factory) OVERRIDE; + const syncer::SyncDataList& initial_sync_data, + scoped_ptr<syncer::SyncChangeProcessor> sync_processor, + scoped_ptr<syncer::SyncErrorFactory> sync_error_factory) OVERRIDE; virtual void StopSyncing(syncable::ModelType type) OVERRIDE; // Returns the list of preference names that are registered as syncable, and @@ -85,7 +85,7 @@ class PrefModelAssociator // provided. static bool CreatePrefSyncData(const std::string& name, const base::Value& value, - csync::SyncData* sync_data); + syncer::SyncData* sync_data); // Extract preference value and name from sync specifics. base::Value* ReadPreferenceSpecifics( @@ -95,7 +95,7 @@ class PrefModelAssociator protected: friend class ProfileSyncServicePreferenceTest; - typedef std::map<std::string, csync::SyncData> SyncDataMap; + typedef std::map<std::string, syncer::SyncData> SyncDataMap; // Create an association for a given preference. If |sync_pref| is valid, // signifying that sync has data for this preference, we reconcile their data @@ -105,9 +105,9 @@ class PrefModelAssociator // Note: We do not modify the sync data for preferences that are either // controlled by policy (are not user modifiable) or have their default value // (are not user controlled). - void InitPrefAndAssociate(const csync::SyncData& sync_pref, + void InitPrefAndAssociate(const syncer::SyncData& sync_pref, const std::string& pref_name, - csync::SyncChangeList* sync_changes); + syncer::SyncChangeList* sync_changes); static base::Value* MergeListValues( const base::Value& from_value, const base::Value& to_value); @@ -142,11 +142,11 @@ class PrefModelAssociator // The PrefService we are syncing to. PrefService* pref_service_; - // Sync's csync::SyncChange handler. We push all our changes through this. - scoped_ptr<csync::SyncChangeProcessor> sync_processor_; + // Sync's syncer::SyncChange handler. We push all our changes through this. + scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; // Sync's error handler. We use this to create sync errors. - scoped_ptr<csync::SyncErrorFactory> sync_error_factory_; + scoped_ptr<syncer::SyncErrorFactory> sync_error_factory_; DISALLOW_COPY_AND_ASSIGN(PrefModelAssociator); }; diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc index e39f928..fff62ff 100644 --- a/chrome/browser/prefs/pref_service.cc +++ b/chrome/browser/prefs/pref_service.cc @@ -920,7 +920,7 @@ void PrefService::SetUserPrefValue(const char* path, Value* new_value) { user_pref_store_->SetValue(path, owned_value.release()); } -csync::SyncableService* PrefService::GetSyncableService() { +syncer::SyncableService* PrefService::GetSyncableService() { return pref_sync_associator_.get(); } diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h index b76f32a..29b3e7e 100644 --- a/chrome/browser/prefs/pref_service.h +++ b/chrome/browser/prefs/pref_service.h @@ -34,7 +34,7 @@ namespace content { class NotificationObserver; } -namespace csync { +namespace syncer { class SyncableService; } @@ -321,9 +321,9 @@ class PrefService : public base::NonThreadSafe { PrefInitializationStatus GetInitializationStatus() const; - // csync::SyncableService getter. - // TODO(zea): Have PrefService implement csync::SyncableService directly. - csync::SyncableService* GetSyncableService(); + // syncer::SyncableService getter. + // TODO(zea): Have PrefService implement syncer::SyncableService directly. + syncer::SyncableService* GetSyncableService(); // Tell our PrefValueStore to update itself using |command_line|. // Do not call this after having derived an incognito or per tab pref service. |