| Index: sync/syncable/model_type.cc
|
| diff --git a/sync/syncable/model_type.cc b/sync/syncable/model_type.cc
|
| index ca9c3e7ccef7fbb0c789abc0426e80d3f66bfd8f..ccbc50ee71c7ee3c7de5563da9feaecb1cb8d191 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 CONTROL_PREFERENCES:
|
| + specifics->mutable_control_preference();
|
| + 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 CONTROL_PREFERENCES:
|
| + return sync_pb::EntitySpecifics::kControlPreferenceFieldNumber;
|
| + 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_control_preference())
|
| + return CONTROL_PREFERENCES;
|
| +
|
| return UNSPECIFIED;
|
| }
|
|
|
| @@ -280,6 +289,9 @@ ModelTypeSet ControlTypes() {
|
| set.Put(ModelTypeFromInt(i));
|
| }
|
|
|
| + // TODO(albertb): Re-enable this when the server supports it.
|
| + set.Remove(CONTROL_PREFERENCES);
|
| +
|
| return set;
|
| }
|
|
|
| @@ -332,6 +344,8 @@ const char* ModelTypeToString(ModelType model_type) {
|
| return "Device Info";
|
| case EXPERIMENTS:
|
| return "Experiments";
|
| + case CONTROL_PREFERENCES:
|
| + return "Control Preferences";
|
| default:
|
| break;
|
| }
|
| @@ -403,6 +417,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 == "Control Preferences")
|
| + return CONTROL_PREFERENCES;
|
| else
|
| NOTREACHED() << "No known model type corresponding to "
|
| << model_type_string << ".";
|
| @@ -477,6 +493,8 @@ std::string ModelTypeToRootTag(ModelType type) {
|
| return "google_chrome_device_info";
|
| case EXPERIMENTS:
|
| return "google_chrome_experiments";
|
| + case CONTROL_PREFERENCES:
|
| + return "google_chrome_control_preferences";
|
| default:
|
| break;
|
| }
|
| @@ -506,6 +524,7 @@ const char kHistoryDeleteDirectiveNotificationType[] =
|
| "HISTORY_DELETE_DIRECTIVE";
|
| const char kDeviceInfoNotificationType[] = "DEVICE_INFO";
|
| const char kExperimentsNotificationType[] = "EXPERIMENTS";
|
| +const char kControlPreferenceNotificationType[] = "CONTROL_PREFERENCE";
|
| } // namespace
|
|
|
| bool RealModelTypeToNotificationType(ModelType model_type,
|
| @@ -564,6 +583,8 @@ bool RealModelTypeToNotificationType(ModelType model_type,
|
| case EXPERIMENTS:
|
| *notification_type = kExperimentsNotificationType;
|
| return true;
|
| + case CONTROL_PREFERENCES:
|
| + *notification_type = kControlPreferenceNotificationType;
|
| default:
|
| break;
|
| }
|
| @@ -623,6 +644,9 @@ bool NotificationTypeToRealModelType(const std::string& notification_type,
|
| } else if (notification_type == kDeviceInfoNotificationType) {
|
| *model_type = DEVICE_INFO;;
|
| return true;
|
| + } else if (notification_type == kControlPreferenceNotificationType) {
|
| + *model_type = CONTROL_PREFERENCES;
|
| + return true;
|
| }
|
| *model_type = UNSPECIFIED;
|
| return false;
|
|
|