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

Unified Diff: sync/syncable/model_type.cc

Issue 15177003: Add Sync data type for managed users. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 7 years, 7 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_proto.gypi ('k') | sync/syncable/nigori_util.cc » ('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 140d7ab5237456fe1ce438709565772bf426ba07..22ea71ec83b7bcfde6600c988c85f22f2164d13e 100644
--- a/sync/syncable/model_type.cc
+++ b/sync/syncable/model_type.cc
@@ -104,6 +104,9 @@ void AddDefaultFieldValue(ModelType datatype,
case MANAGED_USER_SETTINGS:
specifics->mutable_managed_user_setting();
break;
+ case MANAGED_USERS:
+ specifics->mutable_managed_user();
+ break;
default:
NOTREACHED() << "No known extension for model type.";
}
@@ -192,6 +195,8 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) {
return sync_pb::EntitySpecifics::kFaviconTrackingFieldNumber;
case MANAGED_USER_SETTINGS:
return sync_pb::EntitySpecifics::kManagedUserSettingFieldNumber;
+ case MANAGED_USERS:
+ return sync_pb::EntitySpecifics::kManagedUserFieldNumber;
default:
NOTREACHED() << "No known extension for model type.";
return 0;
@@ -311,6 +316,9 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) {
if (specifics.has_managed_user_setting())
return MANAGED_USER_SETTINGS;
+ if (specifics.has_managed_user())
+ return MANAGED_USERS;
+
return UNSPECIFIED;
}
@@ -362,6 +370,8 @@ ModelTypeSet EncryptableUserTypes() {
encryptable_user_types.RemoveAll(PriorityUserTypes());
// Managed user settings are not encrypted since they are set server-side.
encryptable_user_types.Remove(MANAGED_USER_SETTINGS);
+ // Managed users are not encrypted since they are managed server-side.
+ encryptable_user_types.Remove(MANAGED_USERS);
// Proxy types have no sync representation and are therefore not encrypted.
// Note however that proxy types map to one or more protocol types, which
// may or may not be encrypted themselves.
@@ -452,6 +462,8 @@ const char* ModelTypeToString(ModelType model_type) {
return "Favicon Tracking";
case MANAGED_USER_SETTINGS:
return "Managed User Settings";
+ case MANAGED_USERS:
+ return "Managed Users";
case PROXY_TABS:
return "Tabs";
default:
@@ -521,6 +533,8 @@ int ModelTypeToHistogramInt(ModelType model_type) {
return 25;
case MANAGED_USER_SETTINGS:
return 26;
+ case MANAGED_USERS:
+ return 27;
// Silence a compiler warning.
case MODEL_TYPE_COUNT:
return 0;
@@ -604,6 +618,8 @@ ModelType ModelTypeFromString(const std::string& model_type_string) {
return FAVICON_TRACKING;
else if (model_type_string == "Managed User Settings")
return MANAGED_USER_SETTINGS;
+ else if (model_type_string == "Managed Users")
+ return MANAGED_USERS;
else if (model_type_string == "Tabs")
return PROXY_TABS;
else
@@ -694,6 +710,8 @@ std::string ModelTypeToRootTag(ModelType type) {
return "google_chrome_favicon_tracking";
case MANAGED_USER_SETTINGS:
return "google_chrome_managed_user_settings";
+ case MANAGED_USERS:
+ return "google_chrome_managed_users";
case PROXY_TABS:
return std::string();
default:
@@ -732,6 +750,7 @@ const char kDictionaryNotificationType[] = "DICTIONARY";
const char kFaviconImageNotificationType[] = "FAVICON_IMAGE";
const char kFaviconTrackingNotificationType[] = "FAVICON_TRACKING";
const char kManagedUserSettingNotificationType[] = "MANAGED_USER_SETTING";
+const char kManagedUserNotificationType[] = "MANAGED_USER";
} // namespace
bool RealModelTypeToNotificationType(ModelType model_type,
@@ -809,6 +828,9 @@ bool RealModelTypeToNotificationType(ModelType model_type,
case MANAGED_USER_SETTINGS:
*notification_type = kManagedUserSettingNotificationType;
return true;
+ case MANAGED_USERS:
+ *notification_type = kManagedUserNotificationType;
+ return true;
default:
break;
}
@@ -890,6 +912,9 @@ bool NotificationTypeToRealModelType(const std::string& notification_type,
} else if (notification_type == kManagedUserSettingNotificationType) {
*model_type = MANAGED_USER_SETTINGS;
return true;
+ } else if (notification_type == kManagedUserNotificationType) {
+ *model_type = MANAGED_USERS;
+ return true;
}
*model_type = UNSPECIFIED;
return false;
« no previous file with comments | « sync/sync_proto.gypi ('k') | sync/syncable/nigori_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698