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

Unified Diff: chrome/browser/extensions/app_notification_manager.cc

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 6 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/extensions/app_notification_manager.cc
diff --git a/chrome/browser/extensions/app_notification_manager.cc b/chrome/browser/extensions/app_notification_manager.cc
index 04d45c44c1e3b2a65241b523880316c0bf4ee739..cf598e6eeb58a563d65155f32f695632349c0c3e 100644
--- a/chrome/browser/extensions/app_notification_manager.cc
+++ b/chrome/browser/extensions/app_notification_manager.cc
@@ -22,7 +22,7 @@
using content::BrowserThread;
-typedef std::map<std::string, csync::SyncData> SyncDataMap;
+typedef std::map<std::string, syncer::SyncData> SyncDataMap;
namespace {
@@ -54,9 +54,9 @@ void RemoveByGuid(AppNotificationList* list, const std::string& guid) {
list->erase(iter);
}
-void PopulateGuidToSyncDataMap(const csync::SyncDataList& sync_data,
+void PopulateGuidToSyncDataMap(const syncer::SyncDataList& sync_data,
SyncDataMap* data_map) {
- for (csync::SyncDataList::const_iterator iter = sync_data.begin();
+ for (syncer::SyncDataList::const_iterator iter = sync_data.begin();
iter != sync_data.end(); ++iter) {
(*data_map)[iter->GetSpecifics().app_notification().guid()] = *iter;
}
@@ -178,12 +178,12 @@ void AppNotificationManager::Observe(
ClearAll(*content::Details<const std::string>(details).ptr());
}
-csync::SyncDataList AppNotificationManager::GetAllSyncData(
+syncer::SyncDataList AppNotificationManager::GetAllSyncData(
syncable::ModelType type) const {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(loaded());
DCHECK_EQ(syncable::APP_NOTIFICATIONS, type);
- csync::SyncDataList data;
+ syncer::SyncDataList data;
for (NotificationMap::const_iterator iter = notifications_->begin();
iter != notifications_->end(); ++iter) {
@@ -202,9 +202,9 @@ csync::SyncDataList AppNotificationManager::GetAllSyncData(
return data;
}
-csync::SyncError AppNotificationManager::ProcessSyncChanges(
+syncer::SyncError AppNotificationManager::ProcessSyncChanges(
const tracked_objects::Location& from_here,
- const csync::SyncChangeList& change_list) {
+ const syncer::SyncChangeList& change_list) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(loaded());
if (!models_associated_) {
@@ -215,12 +215,12 @@ csync::SyncError AppNotificationManager::ProcessSyncChanges(
AutoReset<bool> processing_changes(&processing_syncer_changes_, true);
- csync::SyncError error;
- for (csync::SyncChangeList::const_iterator iter = change_list.begin();
+ syncer::SyncError error;
+ for (syncer::SyncChangeList::const_iterator iter = change_list.begin();
iter != change_list.end(); ++iter) {
- csync::SyncData sync_data = iter->sync_data();
+ syncer::SyncData sync_data = iter->sync_data();
DCHECK_EQ(syncable::APP_NOTIFICATIONS, sync_data.GetDataType());
- csync::SyncChange::SyncChangeType change_type = iter->change_type();
+ syncer::SyncChange::SyncChangeType change_type = iter->change_type();
scoped_ptr<AppNotification> new_notif(CreateNotificationFromSyncData(
sync_data));
@@ -235,12 +235,12 @@ csync::SyncError AppNotificationManager::ProcessSyncChanges(
error = sync_error_factory_->CreateAndUploadError(
FROM_HERE,
"ProcessSyncChanges received a local only notification" +
- csync::SyncChange::ChangeTypeToString(change_type));
+ syncer::SyncChange::ChangeTypeToString(change_type));
continue;
}
switch (change_type) {
- case csync::SyncChange::ACTION_ADD:
+ case syncer::SyncChange::ACTION_ADD:
if (!existing_notif) {
Add(new_notif.release());
} else {
@@ -249,7 +249,7 @@ csync::SyncError AppNotificationManager::ProcessSyncChanges(
<< "\nItem in ADD change: " << new_notif->ToString();
}
break;
- case csync::SyncChange::ACTION_DELETE:
+ case syncer::SyncChange::ACTION_DELETE:
if (existing_notif) {
Remove(new_notif->extension_id(), new_notif->guid());
} else {
@@ -260,7 +260,7 @@ csync::SyncError AppNotificationManager::ProcessSyncChanges(
<< "Item in DELETE change: " << new_notif->ToString();
}
break;
- case csync::SyncChange::ACTION_UPDATE:
+ case syncer::SyncChange::ACTION_UPDATE:
// Although app notifications are immutable from the model perspective,
// sync can send UPDATE changes due to encryption / meta-data changes.
// So ignore UPDATE changes when the exitsing and new notification
@@ -283,11 +283,11 @@ csync::SyncError AppNotificationManager::ProcessSyncChanges(
return error;
}
-csync::SyncError AppNotificationManager::MergeDataAndStartSyncing(
+syncer::SyncError AppNotificationManager::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) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// AppNotificationDataTypeController ensures that modei is fully should before
// this method is called by waiting until the load notification is received
@@ -308,9 +308,9 @@ csync::SyncError AppNotificationManager::MergeDataAndStartSyncing(
PopulateGuidToSyncDataMap(GetAllSyncData(syncable::APP_NOTIFICATIONS),
&local_data_map);
- for (csync::SyncDataList::const_iterator iter = initial_sync_data.begin();
+ for (syncer::SyncDataList::const_iterator iter = initial_sync_data.begin();
iter != initial_sync_data.end(); ++iter) {
- const csync::SyncData& sync_data = *iter;
+ const syncer::SyncData& sync_data = *iter;
DCHECK_EQ(syncable::APP_NOTIFICATIONS, sync_data.GetDataType());
scoped_ptr<AppNotification> sync_notif(CreateNotificationFromSyncData(
sync_data));
@@ -334,14 +334,14 @@ csync::SyncError AppNotificationManager::MergeDataAndStartSyncing(
}
// TODO(munjal): crbug.com/10059. Work with Lingesh/Antony to resolve.
- csync::SyncChangeList new_changes;
+ syncer::SyncChangeList new_changes;
for (SyncDataMap::const_iterator iter = local_data_map.begin();
iter != local_data_map.end(); ++iter) {
new_changes.push_back(
- csync::SyncChange(csync::SyncChange::ACTION_ADD, iter->second));
+ syncer::SyncChange(syncer::SyncChange::ACTION_ADD, iter->second));
}
- csync::SyncError error;
+ syncer::SyncError error;
if (new_changes.size() > 0)
error = sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes);
models_associated_ = !error.IsSet();
@@ -491,10 +491,10 @@ void AppNotificationManager::SyncAddChange(const AppNotification& notif) {
// TODO(munjal): crbug.com/10059. Work with Lingesh/Antony to resolve.
- csync::SyncChangeList changes;
- csync::SyncData sync_data = CreateSyncDataFromNotification(notif);
+ syncer::SyncChangeList changes;
+ syncer::SyncData sync_data = CreateSyncDataFromNotification(notif);
changes.push_back(
- csync::SyncChange(csync::SyncChange::ACTION_ADD, sync_data));
+ syncer::SyncChange(syncer::SyncChange::ACTION_ADD, sync_data));
sync_processor_->ProcessSyncChanges(FROM_HERE, changes);
}
@@ -506,10 +506,10 @@ void AppNotificationManager::SyncRemoveChange(const AppNotification& notif) {
return;
}
- csync::SyncChangeList changes;
- csync::SyncData sync_data = CreateSyncDataFromNotification(notif);
+ syncer::SyncChangeList changes;
+ syncer::SyncData sync_data = CreateSyncDataFromNotification(notif);
changes.push_back(
- csync::SyncChange(csync::SyncChange::ACTION_DELETE, sync_data));
+ syncer::SyncChange(syncer::SyncChange::ACTION_DELETE, sync_data));
sync_processor_->ProcessSyncChanges(FROM_HERE, changes);
}
@@ -521,22 +521,22 @@ void AppNotificationManager::SyncClearAllChange(
if (!models_associated_ || processing_syncer_changes_)
return;
- csync::SyncChangeList changes;
+ syncer::SyncChangeList changes;
for (AppNotificationList::const_iterator iter = list.begin();
iter != list.end(); ++iter) {
const AppNotification& notif = *iter->get();
// Skip notifications marked as local.
if (notif.is_local())
continue;
- changes.push_back(csync::SyncChange(
- csync::SyncChange::ACTION_DELETE,
+ changes.push_back(syncer::SyncChange(
+ syncer::SyncChange::ACTION_DELETE,
CreateSyncDataFromNotification(notif)));
}
sync_processor_->ProcessSyncChanges(FROM_HERE, changes);
}
// static
-csync::SyncData AppNotificationManager::CreateSyncDataFromNotification(
+syncer::SyncData AppNotificationManager::CreateSyncDataFromNotification(
const AppNotification& notification) {
DCHECK(!notification.is_local());
sync_pb::EntitySpecifics specifics;
@@ -550,13 +550,13 @@ csync::SyncData AppNotificationManager::CreateSyncDataFromNotification(
notif_specifics->set_link_text(notification.link_text());
notif_specifics->set_link_url(notification.link_url().spec());
notif_specifics->set_title(notification.title());
- return csync::SyncData::CreateLocalData(
+ return syncer::SyncData::CreateLocalData(
notif_specifics->guid(), notif_specifics->app_id(), specifics);
}
// static
AppNotification* AppNotificationManager::CreateNotificationFromSyncData(
- const csync::SyncData& sync_data) {
+ const syncer::SyncData& sync_data) {
sync_pb::AppNotification specifics =
sync_data.GetSpecifics().app_notification();

Powered by Google App Engine
This is Rietveld 408576698