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

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 browser tests for dictionary change notifications in settings Created 8 years 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 ca9c3e7ccef7fbb0c789abc0426e80d3f66bfd8f..9ef021a6f541bf329c8987d118954877cccab2a8 100644
--- a/sync/syncable/model_type.cc
+++ b/sync/syncable/model_type.cc
@@ -82,6 +82,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.";
}
@@ -151,6 +154,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;
@@ -252,6 +258,9 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) {
if (specifics.has_experiments())
return EXPERIMENTS;
+ if (specifics.has_dictionary())
+ return DICTIONARY;
+
return UNSPECIFIED;
}
@@ -332,6 +341,8 @@ const char* ModelTypeToString(ModelType model_type) {
return "Device Info";
case EXPERIMENTS:
return "Experiments";
+ case DICTIONARY:
+ return "Dictionary";
default:
break;
}
@@ -403,6 +414,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 << ".";
@@ -477,6 +490,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;
}
@@ -506,6 +521,7 @@ const char kHistoryDeleteDirectiveNotificationType[] =
"HISTORY_DELETE_DIRECTIVE";
const char kDeviceInfoNotificationType[] = "DEVICE_INFO";
const char kExperimentsNotificationType[] = "EXPERIMENTS";
+const char kDictionaryNotificationType[] = "DICTIONARY";
} // namespace
bool RealModelTypeToNotificationType(ModelType model_type,
@@ -564,6 +580,9 @@ bool RealModelTypeToNotificationType(ModelType model_type,
case EXPERIMENTS:
*notification_type = kExperimentsNotificationType;
return true;
+ case DICTIONARY:
+ *notification_type = kDictionaryNotificationType;
+ return true;
default:
break;
}
@@ -623,6 +642,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