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

Unified Diff: sync/syncable/model_type.cc

Issue 76333002: Add Sync datatype for shared managed user settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 1 month 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 aac057fdf284756226121d758136ccbaab772499..686251fe5e0deeb40ef6ee7084d0fb0e84ff970d 100644
--- a/sync/syncable/model_type.cc
+++ b/sync/syncable/model_type.cc
@@ -107,6 +107,9 @@ void AddDefaultFieldValue(ModelType datatype,
case MANAGED_USERS:
specifics->mutable_managed_user();
break;
+ case MANAGED_USER_SHARED_SETTINGS:
+ specifics->mutable_managed_user_shared_setting();
+ break;
case ARTICLES:
specifics->mutable_article();
break;
@@ -200,6 +203,8 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) {
return sync_pb::EntitySpecifics::kManagedUserSettingFieldNumber;
case MANAGED_USERS:
return sync_pb::EntitySpecifics::kManagedUserFieldNumber;
+ case MANAGED_USER_SHARED_SETTINGS:
+ return sync_pb::EntitySpecifics::kManagedUserSharedSettingFieldNumber;
case ARTICLES:
return sync_pb::EntitySpecifics::kArticleFieldNumber;
default:
@@ -321,6 +326,9 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) {
if (specifics.has_managed_user())
return MANAGED_USERS;
+ if (specifics.has_managed_user_shared_setting())
+ return MANAGED_USER_SHARED_SETTINGS;
+
if (specifics.has_article())
return ARTICLES;
@@ -377,6 +385,9 @@ ModelTypeSet EncryptableUserTypes() {
encryptable_user_types.Remove(MANAGED_USER_SETTINGS);
// Managed users are not encrypted since they are managed server-side.
encryptable_user_types.Remove(MANAGED_USERS);
+ // Managed user shared settings are not encrypted since they are managed
+ // server-side and shared between manager and supervised user.
+ encryptable_user_types.Remove(MANAGED_USER_SHARED_SETTINGS);
// 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.
@@ -489,6 +500,8 @@ const char* ModelTypeToString(ModelType model_type) {
return "Managed User Settings";
case MANAGED_USERS:
return "Managed Users";
+ case MANAGED_USER_SHARED_SETTINGS:
+ return "Managed User Shared Settings";
case ARTICLES:
return "Articles";
case PROXY_TABS:
@@ -564,6 +577,8 @@ int ModelTypeToHistogramInt(ModelType model_type) {
return 27;
case ARTICLES:
return 28;
+ case MANAGED_USER_SHARED_SETTINGS:
+ return 29;
// Silence a compiler warning.
case MODEL_TYPE_COUNT:
return 0;
@@ -649,6 +664,8 @@ ModelType ModelTypeFromString(const std::string& model_type_string) {
return MANAGED_USER_SETTINGS;
else if (model_type_string == "Managed Users")
return MANAGED_USERS;
+ else if (model_type_string == "Managed User Shared Settings")
+ return MANAGED_USER_SHARED_SETTINGS;
else if (model_type_string == "Articles")
return ARTICLES;
else if (model_type_string == "Tabs")
@@ -743,6 +760,8 @@ std::string ModelTypeToRootTag(ModelType type) {
return "google_chrome_managed_user_settings";
case MANAGED_USERS:
return "google_chrome_managed_users";
+ case MANAGED_USER_SHARED_SETTINGS:
+ return "google_chrome_managed_user_shared_settings";
case ARTICLES:
return "google_chrome_articles";
case PROXY_TABS:
@@ -784,6 +803,8 @@ const char kFaviconImageNotificationType[] = "FAVICON_IMAGE";
const char kFaviconTrackingNotificationType[] = "FAVICON_TRACKING";
const char kManagedUserSettingNotificationType[] = "MANAGED_USER_SETTING";
const char kManagedUserNotificationType[] = "MANAGED_USER";
+const char kManagedUserSharedSettingNotificationType[] =
+ "MANAGED_USER_SHARED_SETTING";
const char kArticleNotificationType[] = "ARTICLE";
} // namespace
@@ -865,6 +886,9 @@ bool RealModelTypeToNotificationType(ModelType model_type,
case MANAGED_USERS:
*notification_type = kManagedUserNotificationType;
return true;
+ case MANAGED_USER_SHARED_SETTINGS:
+ *notification_type = kManagedUserSharedSettingNotificationType;
+ return true;
case ARTICLES:
*notification_type = kArticleNotificationType;
return true;
@@ -952,6 +976,9 @@ bool NotificationTypeToRealModelType(const std::string& notification_type,
} else if (notification_type == kManagedUserNotificationType) {
*model_type = MANAGED_USERS;
return true;
+ } else if (notification_type == kManagedUserSharedSettingNotificationType) {
+ *model_type = MANAGED_USER_SHARED_SETTINGS;
+ return true;
} else if (notification_type == kArticleNotificationType) {
*model_type = ARTICLES;
return true;

Powered by Google App Engine
This is Rietveld 408576698