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

Unified Diff: sync/notifier/invalidation_util.cc

Issue 10702074: Refactor sync-specific parts out of SyncNotifier/SyncNotifierObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to HEAD Created 8 years, 5 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
« no previous file with comments | « sync/notifier/invalidation_util.h ('k') | sync/notifier/mock_sync_notifier_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/notifier/invalidation_util.cc
diff --git a/sync/notifier/invalidation_util.cc b/sync/notifier/invalidation_util.cc
index 0065b50e2b99d1a990eb042d588b84c1e7726806..5b18d66f3ae8ed207ca5eb4a4f02f5f90c34c632 100644
--- a/sync/notifier/invalidation_util.cc
+++ b/sync/notifier/invalidation_util.cc
@@ -33,6 +33,32 @@ bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id,
return NotificationTypeToRealModelType(object_id.name(), model_type);
}
+ObjectIdSet ModelTypeSetToObjectIdSet(const ModelTypeSet& model_types) {
+ ObjectIdSet ids;
+ for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) {
+ invalidation::ObjectId model_type_as_id;
+ if (!RealModelTypeToObjectId(it.Get(), &model_type_as_id)) {
+ DLOG(WARNING) << "Invalid model type " << it.Get();
+ continue;
+ }
+ ids.insert(model_type_as_id);
+ }
+ return ids;
+}
+
+ModelTypeSet ObjectIdSetToModelTypeSet(const ObjectIdSet& ids) {
+ ModelTypeSet model_types;
+ for (ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); ++it) {
+ ModelType model_type;
+ if (!ObjectIdToRealModelType(*it, &model_type)) {
+ DLOG(WARNING) << "Invalid object ID " << ObjectIdToString(*it);
+ continue;
+ }
+ model_types.Put(model_type);
+ }
+ return model_types;
+}
+
std::string ObjectIdToString(
const invalidation::ObjectId& object_id) {
std::stringstream ss;
« no previous file with comments | « sync/notifier/invalidation_util.h ('k') | sync/notifier/mock_sync_notifier_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698