summaryrefslogtreecommitdiffstats
path: root/sync/syncable
diff options
context:
space:
mode:
authorstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-11 20:04:58 +0000
committerstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-11 20:04:58 +0000
commit3bc627156b7c1594df0ae95407e6b9d18f5b7343 (patch)
treeb7261fda0637408bd3d404b048227310dd6f2f02 /sync/syncable
parentbcbb9b4e583a1e068871ef591ae7f8590707eca7 (diff)
downloadchromium_src-3bc627156b7c1594df0ae95407e6b9d18f5b7343.zip
chromium_src-3bc627156b7c1594df0ae95407e6b9d18f5b7343.tar.gz
chromium_src-3bc627156b7c1594df0ae95407e6b9d18f5b7343.tar.bz2
Add AppListSpecifics .proto definition and support code
This CL introduces the AppList sync type. As of patchset #7 this CL depends on https://codereview.chromium.org/106033003/ BUG=313376 Review URL: https://codereview.chromium.org/78773004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240162 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/syncable')
-rw-r--r--sync/syncable/model_type.cc24
-rw-r--r--sync/syncable/nigori_util.cc7
2 files changed, 29 insertions, 2 deletions
diff --git a/sync/syncable/model_type.cc b/sync/syncable/model_type.cc
index aac057fd..fa33118 100644
--- a/sync/syncable/model_type.cc
+++ b/sync/syncable/model_type.cc
@@ -68,6 +68,9 @@ void AddDefaultFieldValue(ModelType datatype,
case APPS:
specifics->mutable_app();
break;
+ case APP_LIST:
+ specifics->mutable_app_list();
+ break;
case APP_SETTINGS:
specifics->mutable_app_setting();
break;
@@ -167,6 +170,9 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) {
case APPS:
return sync_pb::EntitySpecifics::kAppFieldNumber;
break;
+ case APP_LIST:
+ return sync_pb::EntitySpecifics::kAppListFieldNumber;
+ break;
case APP_SETTINGS:
return sync_pb::EntitySpecifics::kAppSettingFieldNumber;
break;
@@ -276,6 +282,9 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) {
if (specifics.has_app())
return APPS;
+ if (specifics.has_app_list())
+ return APP_LIST;
+
if (specifics.has_search_engine())
return SEARCH_ENGINES;
@@ -461,6 +470,8 @@ const char* ModelTypeToString(ModelType model_type) {
return "Sessions";
case APPS:
return "Apps";
+ case APP_LIST:
+ return "App List";
case AUTOFILL_PROFILE:
return "Autofill Profiles";
case APP_SETTINGS:
@@ -564,6 +575,8 @@ int ModelTypeToHistogramInt(ModelType model_type) {
return 27;
case ARTICLES:
return 28;
+ case APP_LIST:
+ return 29;
// Silence a compiler warning.
case MODEL_TYPE_COUNT:
return 0;
@@ -623,6 +636,8 @@ ModelType ModelTypeFromString(const std::string& model_type_string) {
return SESSIONS;
else if (model_type_string == "Apps")
return APPS;
+ else if (model_type_string == "App List")
+ return APP_LIST;
else if (model_type_string == "App settings")
return APP_SETTINGS;
else if (model_type_string == "Extension settings")
@@ -715,6 +730,8 @@ std::string ModelTypeToRootTag(ModelType type) {
return "google_chrome_sessions";
case APPS:
return "google_chrome_apps";
+ case APP_LIST:
+ return "google_chrome_app_list";
case AUTOFILL_PROFILE:
return "google_chrome_autofill_profiles";
case APP_SETTINGS:
@@ -769,6 +786,7 @@ const char kExtensionSettingNotificationType[] = "EXTENSION_SETTING";
const char kNigoriNotificationType[] = "NIGORI";
const char kAppSettingNotificationType[] = "APP_SETTING";
const char kAppNotificationType[] = "APP";
+const char kAppListNotificationType[] = "APP_LIST";
const char kSearchEngineNotificationType[] = "SEARCH_ENGINE";
const char kSessionNotificationType[] = "SESSION";
const char kAutofillProfileNotificationType[] = "AUTOFILL_PROFILE";
@@ -820,6 +838,9 @@ bool RealModelTypeToNotificationType(ModelType model_type,
case APPS:
*notification_type = kAppNotificationType;
return true;
+ case APP_LIST:
+ *notification_type = kAppListNotificationType;
+ return true;
case SEARCH_ENGINES:
*notification_type = kSearchEngineNotificationType;
return true;
@@ -904,6 +925,9 @@ bool NotificationTypeToRealModelType(const std::string& notification_type,
} else if (notification_type == kAppNotificationType) {
*model_type = APPS;
return true;
+ } else if (notification_type == kAppListNotificationType) {
+ *model_type = APP_LIST;
+ return true;
} else if (notification_type == kSearchEngineNotificationType) {
*model_type = SEARCH_ENGINES;
return true;
diff --git a/sync/syncable/nigori_util.cc b/sync/syncable/nigori_util.cc
index fbdd9a5..107a68f 100644
--- a/sync/syncable/nigori_util.cc
+++ b/sync/syncable/nigori_util.cc
@@ -242,7 +242,7 @@ void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types,
bool encrypt_everything,
sync_pb::NigoriSpecifics* nigori) {
nigori->set_encrypt_everything(encrypt_everything);
- COMPILE_ASSERT(29 == MODEL_TYPE_COUNT, UpdateEncryptedTypes);
+ COMPILE_ASSERT(30 == MODEL_TYPE_COUNT, UpdateEncryptedTypes);
nigori->set_encrypt_bookmarks(
encrypted_types.Has(BOOKMARKS));
nigori->set_encrypt_preferences(
@@ -269,6 +269,7 @@ void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types,
nigori->set_encrypt_favicon_images(encrypted_types.Has(FAVICON_IMAGES));
nigori->set_encrypt_favicon_tracking(encrypted_types.Has(FAVICON_TRACKING));
nigori->set_encrypt_articles(encrypted_types.Has(ARTICLES));
+ nigori->set_encrypt_app_list(encrypted_types.Has(APP_LIST));
}
ModelTypeSet GetEncryptedTypesFromNigori(
@@ -277,7 +278,7 @@ ModelTypeSet GetEncryptedTypesFromNigori(
return ModelTypeSet::All();
ModelTypeSet encrypted_types;
- COMPILE_ASSERT(29 == MODEL_TYPE_COUNT, UpdateEncryptedTypes);
+ COMPILE_ASSERT(30 == MODEL_TYPE_COUNT, UpdateEncryptedTypes);
if (nigori.encrypt_bookmarks())
encrypted_types.Put(BOOKMARKS);
if (nigori.encrypt_preferences())
@@ -312,6 +313,8 @@ ModelTypeSet GetEncryptedTypesFromNigori(
encrypted_types.Put(FAVICON_TRACKING);
if (nigori.encrypt_articles())
encrypted_types.Put(ARTICLES);
+ if (nigori.encrypt_app_list())
+ encrypted_types.Put(APP_LIST);
return encrypted_types;
}