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

Unified Diff: sync/syncable/model_type.cc

Issue 10911073: NOT FOR COMMIT: Add DeviceInfo type and ChangeProcessor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix several issues Created 8 years, 3 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/sync.gyp ('k') | sync/test/engine/test_directory_setter_upper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/model_type.cc
diff --git a/sync/syncable/model_type.cc b/sync/syncable/model_type.cc
index 1674206c294344cf2a13bbfdb6d3ea1370721fa6..f4b58e92af9b509c8aed2932e44928384b0793c8 100644
--- a/sync/syncable/model_type.cc
+++ b/sync/syncable/model_type.cc
@@ -73,6 +73,9 @@ void AddDefaultFieldValue(ModelType datatype,
case APP_NOTIFICATIONS:
specifics->mutable_app_notification();
break;
+ case DEVICE_INFO:
+ specifics->mutable_device_info();
+ break;
default:
NOTREACHED() << "No known extension for model type.";
}
@@ -135,6 +138,9 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) {
case APP_NOTIFICATIONS:
return sync_pb::EntitySpecifics::kAppNotificationFieldNumber;
break;
+ case DEVICE_INFO:
+ return sync_pb::EntitySpecifics::kDeviceInfoFieldNumber;
+ break;
default:
NOTREACHED() << "No known extension for model type.";
return 0;
@@ -227,6 +233,9 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) {
if (specifics.has_app_notification())
return APP_NOTIFICATIONS;
+ if (specifics.has_device_info())
+ return DEVICE_INFO;
+
return UNSPECIFIED;
}
@@ -293,6 +302,8 @@ const char* ModelTypeToString(ModelType model_type) {
return "Extension settings";
case APP_NOTIFICATIONS:
return "App Notifications";
+ case DEVICE_INFO:
+ return "Device Info";
default:
break;
}
@@ -358,6 +369,8 @@ ModelType ModelTypeFromString(const std::string& model_type_string) {
return EXTENSION_SETTINGS;
else if (model_type_string == "App Notifications")
return APP_NOTIFICATIONS;
+ else if (model_type_string == "Device Info")
+ return DEVICE_INFO;
else
NOTREACHED() << "No known model type corresponding to "
<< model_type_string << ".";
@@ -426,6 +439,8 @@ std::string ModelTypeToRootTag(ModelType type) {
return "google_chrome_extension_settings";
case APP_NOTIFICATIONS:
return "google_chrome_app_notifications";
+ case DEVICE_INFO:
+ return "google_chrome_device_info";
default:
break;
}
@@ -451,6 +466,7 @@ const char kSearchEngineNotificationType[] = "SEARCH_ENGINE";
const char kSessionNotificationType[] = "SESSION";
const char kAutofillProfileNotificationType[] = "AUTOFILL_PROFILE";
const char kAppNotificationNotificationType[] = "APP_NOTIFICATION";
+const char kDeviceInfoNotificationType[] = "DEVICE_INFO";
} // namespace
bool RealModelTypeToNotificationType(ModelType model_type,
@@ -501,6 +517,9 @@ bool RealModelTypeToNotificationType(ModelType model_type,
case APP_NOTIFICATIONS:
*notification_type = kAppNotificationNotificationType;
return true;
+ case DEVICE_INFO:
+ *notification_type = kDeviceInfoNotificationType;
+ return true;
default:
break;
}
@@ -555,6 +574,9 @@ bool NotificationTypeToRealModelType(const std::string& notification_type,
} else if (notification_type == kAppNotificationNotificationType) {
*model_type = APP_NOTIFICATIONS;
return true;
+ } else if (notification_type == kDeviceInfoNotificationType) {
+ *model_type = DEVICE_INFO;;
+ return true;
} else {
*model_type = UNSPECIFIED;
return false;
« no previous file with comments | « sync/sync.gyp ('k') | sync/test/engine/test_directory_setter_upper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698