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

Unified Diff: sync/syncable/model_type.cc

Issue 11734009: sync: Add ControlPreference protobuf and supporting code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Daily rebase Created 7 years, 11 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/protocol/sync_proto.gyp ('k') | sync/util/data_type_histogram.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 a6ee40957e0b5bbc3bdf51838dc1d89d7e1f2abb..1b0bee44cc32ecc7731da35ca4b6b8444b71661a 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 PRIORITY_PREFERENCES:
+ specifics->mutable_priority_preference();
+ 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 PRIORITY_PREFERENCES:
+ return sync_pb::EntitySpecifics::kPriorityPreferenceFieldNumber;
+ 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_priority_preference())
+ return PRIORITY_PREFERENCES;
+
return UNSPECIFIED;
}
@@ -290,6 +299,9 @@ ModelTypeSet ControlTypes() {
set.Put(ModelTypeFromInt(i));
}
+ // TODO(albertb): Re-enable this when the server supports it.
+ set.Remove(PRIORITY_PREFERENCES);
+
return set;
}
@@ -344,6 +356,8 @@ const char* ModelTypeToString(ModelType model_type) {
return "Device Info";
case EXPERIMENTS:
return "Experiments";
+ case PRIORITY_PREFERENCES:
+ return "Priority Preferences";
default:
break;
}
@@ -417,6 +431,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 == "Priority Preferences")
+ return PRIORITY_PREFERENCES;
else
NOTREACHED() << "No known model type corresponding to "
<< model_type_string << ".";
@@ -493,6 +509,8 @@ std::string ModelTypeToRootTag(ModelType type) {
return "google_chrome_device_info";
case EXPERIMENTS:
return "google_chrome_experiments";
+ case PRIORITY_PREFERENCES:
+ return "google_chrome_priority_preferences";
default:
break;
}
@@ -523,6 +541,7 @@ const char kHistoryDeleteDirectiveNotificationType[] =
const char kSyncedNotificationType[] = "SYNCED_NOTIFICATION";
const char kDeviceInfoNotificationType[] = "DEVICE_INFO";
const char kExperimentsNotificationType[] = "EXPERIMENTS";
+const char kPriorityPreferenceNotificationType[] = "PRIORITY_PREFERENCE";
} // namespace
bool RealModelTypeToNotificationType(ModelType model_type,
@@ -583,6 +602,8 @@ bool RealModelTypeToNotificationType(ModelType model_type,
case EXPERIMENTS:
*notification_type = kExperimentsNotificationType;
return true;
+ case PRIORITY_PREFERENCES:
+ *notification_type = kPriorityPreferenceNotificationType;
default:
break;
}
@@ -644,6 +665,9 @@ bool NotificationTypeToRealModelType(const std::string& notification_type,
} else if (notification_type == kDeviceInfoNotificationType) {
*model_type = DEVICE_INFO;;
return true;
+ } else if (notification_type == kPriorityPreferenceNotificationType) {
+ *model_type = PRIORITY_PREFERENCES;
+ return true;
}
*model_type = UNSPECIFIED;
return false;
« no previous file with comments | « sync/protocol/sync_proto.gyp ('k') | sync/util/data_type_histogram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698