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

Unified Diff: components/sync/device_info/device_info_sync_service.cc

Issue 2388163002: [Sync] Move //components/sync to the syncer namespace, take 2. (Closed)
Patch Set: Rebase. Created 4 years, 2 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: components/sync/device_info/device_info_sync_service.cc
diff --git a/components/sync/device_info/device_info_sync_service.cc b/components/sync/device_info/device_info_sync_service.cc
index 4dba9c990bcacb2a5827057cc88469ec5260d03a..c9fe8c4c847843d5ef6e5d014324e70b4df0e2bd 100644
--- a/components/sync/device_info/device_info_sync_service.cc
+++ b/components/sync/device_info/device_info_sync_service.cc
@@ -15,18 +15,10 @@
#include "components/sync/device_info/local_device_info_provider.h"
#include "components/sync/protocol/sync.pb.h"
-namespace sync_driver {
+namespace syncer {
using base::Time;
using base::TimeDelta;
-using syncer::ModelType;
-using syncer::SyncChange;
-using syncer::SyncChangeList;
-using syncer::SyncChangeProcessor;
-using syncer::SyncData;
-using syncer::SyncDataList;
-using syncer::SyncErrorFactory;
-using syncer::SyncMergeResult;
DeviceInfoSyncService::DeviceInfoSyncService(
LocalDeviceInfoProvider* local_device_info_provider)
@@ -43,7 +35,7 @@ SyncMergeResult DeviceInfoSyncService::MergeDataAndStartSyncing(
std::unique_ptr<SyncErrorFactory> error_handler) {
DCHECK(sync_processor.get());
DCHECK(error_handler.get());
- DCHECK_EQ(type, syncer::DEVICE_INFO);
+ DCHECK_EQ(type, DEVICE_INFO);
DCHECK(!IsSyncing());
@@ -68,7 +60,7 @@ SyncMergeResult DeviceInfoSyncService::MergeDataAndStartSyncing(
// Iterate over all initial sync data and copy it to the cache.
for (SyncDataList::const_iterator iter = initial_sync_data.begin();
iter != initial_sync_data.end(); ++iter) {
- DCHECK_EQ(syncer::DEVICE_INFO, iter->GetDataType());
+ DCHECK_EQ(DEVICE_INFO, iter->GetDataType());
const std::string& id = iter->GetSpecifics().device_info().cache_guid();
@@ -99,7 +91,7 @@ SyncMergeResult DeviceInfoSyncService::MergeDataAndStartSyncing(
StoreSyncData(id, *iter);
}
- syncer::SyncMergeResult result(type);
+ SyncMergeResult result(type);
// If the SyncData for the local device is new or different then send it
// immediately, otherwise wait until the pulse interval has elapsed from the
@@ -129,7 +121,7 @@ bool DeviceInfoSyncService::IsSyncing() const {
return !all_data_.empty();
}
-void DeviceInfoSyncService::StopSyncing(syncer::ModelType type) {
+void DeviceInfoSyncService::StopSyncing(ModelType type) {
bool was_syncing = IsSyncing();
pulse_timer_.Stop();
@@ -142,8 +134,7 @@ void DeviceInfoSyncService::StopSyncing(syncer::ModelType type) {
}
}
-SyncDataList DeviceInfoSyncService::GetAllSyncData(
- syncer::ModelType type) const {
+SyncDataList DeviceInfoSyncService::GetAllSyncData(ModelType type) const {
SyncDataList list;
for (SyncDataMap::const_iterator iter = all_data_.begin();
@@ -154,10 +145,10 @@ SyncDataList DeviceInfoSyncService::GetAllSyncData(
return list;
}
-syncer::SyncError DeviceInfoSyncService::ProcessSyncChanges(
+SyncError DeviceInfoSyncService::ProcessSyncChanges(
const tracked_objects::Location& from_here,
const SyncChangeList& change_list) {
- syncer::SyncError error;
+ SyncError error;
DCHECK(local_device_info_provider_->GetLocalDeviceInfo());
const std::string& local_device_id =
@@ -169,7 +160,7 @@ syncer::SyncError DeviceInfoSyncService::ProcessSyncChanges(
for (SyncChangeList::const_iterator iter = change_list.begin();
iter != change_list.end(); ++iter) {
const SyncData& sync_data = iter->sync_data();
- DCHECK_EQ(syncer::DEVICE_INFO, sync_data.GetDataType());
+ DCHECK_EQ(DEVICE_INFO, sync_data.GetDataType());
const std::string& client_id =
sync_data.GetSpecifics().device_info().cache_guid();
@@ -179,15 +170,15 @@ syncer::SyncError DeviceInfoSyncService::ProcessSyncChanges(
continue;
}
- if (iter->change_type() == syncer::SyncChange::ACTION_DELETE) {
+ if (iter->change_type() == SyncChange::ACTION_DELETE) {
has_changes = true;
DeleteSyncData(client_id);
- } else if (iter->change_type() == syncer::SyncChange::ACTION_UPDATE ||
- iter->change_type() == syncer::SyncChange::ACTION_ADD) {
+ } else if (iter->change_type() == SyncChange::ACTION_UPDATE ||
+ iter->change_type() == SyncChange::ACTION_ADD) {
has_changes = true;
StoreSyncData(client_id, sync_data);
} else {
- error.Reset(FROM_HERE, "Invalid action received.", syncer::DEVICE_INFO);
+ error.Reset(FROM_HERE, "Invalid action received.", DEVICE_INFO);
}
}
@@ -246,7 +237,7 @@ SyncData DeviceInfoSyncService::CreateLocalData(const DeviceInfo* info) {
specifics.set_sync_user_agent(info->sync_user_agent());
specifics.set_device_type(info->device_type());
specifics.set_signin_scoped_device_id(info->signin_scoped_device_id());
- specifics.set_last_updated_timestamp(syncer::TimeToProtoTime(Time::Now()));
+ specifics.set_last_updated_timestamp(TimeToProtoTime(Time::Now()));
return CreateLocalData(entity);
}
@@ -258,8 +249,7 @@ SyncData DeviceInfoSyncService::CreateLocalData(
specifics.client_name(), entity);
}
-DeviceInfo* DeviceInfoSyncService::CreateDeviceInfo(
- const syncer::SyncData& sync_data) {
+DeviceInfo* DeviceInfoSyncService::CreateDeviceInfo(const SyncData& sync_data) {
const sync_pb::DeviceInfoSpecifics& specifics =
sync_data.GetSpecifics().device_info();
@@ -318,11 +308,11 @@ int DeviceInfoSyncService::CountActiveDevices(const Time now) const {
// static
Time DeviceInfoSyncService::GetLastUpdateTime(const SyncData& device_info) {
if (device_info.GetSpecifics().device_info().has_last_updated_timestamp()) {
- return syncer::ProtoTimeToTime(
+ return ProtoTimeToTime(
device_info.GetSpecifics().device_info().last_updated_timestamp());
} else if (!device_info.IsLocal()) {
// If there is no |last_updated_timestamp| present, fallback to mod time.
- return syncer::SyncDataRemote(device_info).GetModifiedTime();
+ return SyncDataRemote(device_info).GetModifiedTime();
} else {
// We shouldn't reach this point for remote data, so this means we're likely
// looking at the local device info. Using a long ago time is perfect, since
@@ -331,4 +321,4 @@ Time DeviceInfoSyncService::GetLastUpdateTime(const SyncData& device_info) {
}
}
-} // namespace sync_driver
+} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698