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

Unified Diff: chrome/browser/sync/notifier/invalidation_util.cc

Issue 2861034: Decomped registration logic into its own class. (Closed)
Patch Set: synced to head Created 10 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/sync/notifier/invalidation_util.cc
diff --git a/chrome/browser/sync/notifier/invalidation_util.cc b/chrome/browser/sync/notifier/invalidation_util.cc
index 2683fae0de5988280f524b73483a1dd0b220af0d..f61a0db5727ed90fc23ddaaaf6b223251fdd4a0c 100644
--- a/chrome/browser/sync/notifier/invalidation_util.cc
+++ b/chrome/browser/sync/notifier/invalidation_util.cc
@@ -13,8 +13,24 @@ void RunAndDeleteClosure(invalidation::Closure* task) {
delete task;
}
-// We need to write our own protobuf to string functions because we
-// use LITE_RUNTIME, which doesn't support DebugString().
+bool RealModelTypeToObjectId(syncable::ModelType model_type,
+ invalidation::ObjectId* object_id) {
+ std::string notification_type;
+ if (!syncable::RealModelTypeToNotificationType(
+ model_type, &notification_type)) {
+ return false;
+ }
+ object_id->mutable_name()->set_string_value(notification_type);
+ object_id->set_source(invalidation::ObjectId::CHROME_SYNC);
+ return true;
+}
+
+bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id,
+ syncable::ModelType* model_type) {
+ return
+ syncable::NotificationTypeToRealModelType(
+ object_id.name().string_value(), model_type);
+}
std::string ObjectIdToString(
const invalidation::ObjectId& object_id) {
« no previous file with comments | « chrome/browser/sync/notifier/invalidation_util.h ('k') | chrome/browser/sync/notifier/registration_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698