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

Unified Diff: sync/syncable/model_type.cc

Issue 11445002: Sync user's custom spellcheck dictionary (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add server-side size limit tests Created 7 years, 12 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: sync/syncable/model_type.cc
diff --git a/sync/syncable/model_type.cc b/sync/syncable/model_type.cc
index a6ee40957e0b5bbc3bdf51838dc1d89d7e1f2abb..2fc42e6496e056a68590fc5f7d0e5e5974fd2349 100644
--- a/sync/syncable/model_type.cc
+++ b/sync/syncable/model_type.cc
@@ -85,6 +85,9 @@ void AddDefaultFieldValue(ModelType datatype,
case EXPERIMENTS:
specifics->mutable_experiments();
break;
+ case DICTIONARY:
+ specifics->mutable_dictionary();
+ break;
default:
NOTREACHED() << "No known extension for model type.";
}
@@ -156,6 +159,9 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) {
case EXPERIMENTS:
return sync_pb::EntitySpecifics::kExperimentsFieldNumber;
break;
+ case DICTIONARY:
+ return sync_pb::EntitySpecifics::kDictionaryFieldNumber;
+ break;
default:
NOTREACHED() << "No known extension for model type.";
return 0;
@@ -260,6 +266,9 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) {
if (specifics.has_experiments())
return EXPERIMENTS;
+ if (specifics.has_dictionary())
+ return DICTIONARY;
+
return UNSPECIFIED;
}
@@ -344,6 +353,8 @@ const char* ModelTypeToString(ModelType model_type) {
return "Device Info";
case EXPERIMENTS:
return "Experiments";
+ case DICTIONARY:
+ return "Dictionary";
default:
break;
}
@@ -417,6 +428,8 @@ ModelType ModelTypeFromString(const std::string& model_type_string) {
return DEVICE_INFO;
else if (model_type_string == "Experiments")
return EXPERIMENTS;
+ else if (model_type_string == "Dictionary")
+ return DICTIONARY;
else
NOTREACHED() << "No known model type corresponding to "
<< model_type_string << ".";
@@ -493,6 +506,8 @@ std::string ModelTypeToRootTag(ModelType type) {
return "google_chrome_device_info";
case EXPERIMENTS:
return "google_chrome_experiments";
+ case DICTIONARY:
+ return "google_chrome_dictionary";
default:
break;
}
@@ -523,6 +538,7 @@ const char kHistoryDeleteDirectiveNotificationType[] =
const char kSyncedNotificationType[] = "SYNCED_NOTIFICATION";
const char kDeviceInfoNotificationType[] = "DEVICE_INFO";
const char kExperimentsNotificationType[] = "EXPERIMENTS";
+const char kDictionaryNotificationType[] = "DICTIONARY";
} // namespace
bool RealModelTypeToNotificationType(ModelType model_type,
@@ -583,6 +599,9 @@ bool RealModelTypeToNotificationType(ModelType model_type,
case EXPERIMENTS:
*notification_type = kExperimentsNotificationType;
return true;
+ case DICTIONARY:
+ *notification_type = kDictionaryNotificationType;
+ return true;
default:
break;
}
@@ -644,6 +663,9 @@ bool NotificationTypeToRealModelType(const std::string& notification_type,
} else if (notification_type == kDeviceInfoNotificationType) {
*model_type = DEVICE_INFO;;
return true;
+ } else if (notification_type == kDictionaryNotificationType) {
+ *model_type = DICTIONARY;
+ return true;
}
*model_type = UNSPECIFIED;
return false;

Powered by Google App Engine
This is Rietveld 408576698