summaryrefslogtreecommitdiffstats
path: root/sync/syncable
diff options
context:
space:
mode:
authorMike Wittman <wittman@chromium.org>2014-10-01 14:56:57 -0700
committerMike Wittman <wittman@chromium.org>2014-10-01 21:59:55 +0000
commit72520cfbda25e457da26113b568c76171d716a3f (patch)
treeada572d1f49255980811a20eb452a7f7e6423d6b /sync/syncable
parent438a0d63964342acd2b50f12cb69fa4ae93254c0 (diff)
downloadchromium_src-72520cfbda25e457da26113b568c76171d716a3f.zip
chromium_src-72520cfbda25e457da26113b568c76171d716a3f.tar.gz
chromium_src-72520cfbda25e457da26113b568c76171d716a3f.tar.bz2
Add enhanced bookmarks sync datatype
Adds a new sync datatype to handle the enhanced bookmarks representation. BUG=415822 R=mpearson@chromium.org, sky@chromium.org, zea@chromium.org Review URL: https://codereview.chromium.org/583863002 Cr-Commit-Position: refs/heads/master@{#297718}
Diffstat (limited to 'sync/syncable')
-rw-r--r--sync/syncable/model_type.cc25
-rw-r--r--sync/syncable/nigori_util.cc4
2 files changed, 27 insertions, 2 deletions
diff --git a/sync/syncable/model_type.cc b/sync/syncable/model_type.cc
index 59be6f2..ddde204 100644
--- a/sync/syncable/model_type.cc
+++ b/sync/syncable/model_type.cc
@@ -119,6 +119,9 @@ void AddDefaultFieldValue(ModelType datatype,
case ARTICLES:
specifics->mutable_article();
break;
+ case ENHANCED_BOOKMARKS:
+ specifics->mutable_enhanced_bookmark();
+ break;
default:
NOTREACHED() << "No known extension for model type.";
}
@@ -196,6 +199,8 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) {
return sync_pb::EntitySpecifics::kManagedUserSharedSettingFieldNumber;
case ARTICLES:
return sync_pb::EntitySpecifics::kArticleFieldNumber;
+ case ENHANCED_BOOKMARKS:
+ return sync_pb::EntitySpecifics::kEnhancedBookmarkFieldNumber;
default:
NOTREACHED() << "No known extension for model type.";
return 0;
@@ -324,6 +329,9 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) {
if (specifics.has_article())
return ARTICLES;
+ if (specifics.has_enhanced_bookmark())
+ return ENHANCED_BOOKMARKS;
+
return UNSPECIFIED;
}
@@ -366,6 +374,8 @@ bool IsUserSelectableType(ModelType model_type) {
ModelTypeSet EncryptableUserTypes() {
ModelTypeSet encryptable_user_types = UserTypes();
+ // Encrypted bookmarks are handled through standard bookmark sync.
+ encryptable_user_types.Remove(ENHANCED_BOOKMARKS);
// We never encrypt history delete directives.
encryptable_user_types.Remove(HISTORY_DELETE_DIRECTIVES);
// Synced notifications are not encrypted since the server must see changes.
@@ -524,6 +534,8 @@ const char* ModelTypeToString(ModelType model_type) {
return "Managed User Shared Settings";
case ARTICLES:
return "Articles";
+ case ENHANCED_BOOKMARKS:
+ return "Enhanced Bookmarks";
case PROXY_TABS:
return "Tabs";
default:
@@ -603,6 +615,8 @@ int ModelTypeToHistogramInt(ModelType model_type) {
return 30;
case SYNCED_NOTIFICATION_APP_INFO:
return 31;
+ case ENHANCED_BOOKMARKS:
+ return 32;
// Silence a compiler warning.
case MODEL_TYPE_COUNT:
return 0;
@@ -698,6 +712,8 @@ ModelType ModelTypeFromString(const std::string& model_type_string) {
return ARTICLES;
else if (model_type_string == "Tabs")
return PROXY_TABS;
+ else if (model_type_string == "Enhanced Bookmarks")
+ return ENHANCED_BOOKMARKS;
else
NOTREACHED() << "No known model type corresponding to "
<< model_type_string << ".";
@@ -822,6 +838,8 @@ std::string ModelTypeToRootTag(ModelType type) {
return "google_chrome_articles";
case PROXY_TABS:
return std::string();
+ case ENHANCED_BOOKMARKS:
+ return "google_chrome_enhanced_bookmarks";
default:
break;
}
@@ -864,6 +882,7 @@ const char kSupervisedUserNotificationType[] = "MANAGED_USER";
const char kSupervisedUserSharedSettingNotificationType[] =
"MANAGED_USER_SHARED_SETTING";
const char kArticleNotificationType[] = "ARTICLE";
+const char kEnhancedBookmarkNotificationType[] = "ENHANCED_BOOKMARK";
} // namespace
bool RealModelTypeToNotificationType(ModelType model_type,
@@ -956,6 +975,9 @@ bool RealModelTypeToNotificationType(ModelType model_type,
case ARTICLES:
*notification_type = kArticleNotificationType;
return true;
+ case ENHANCED_BOOKMARKS:
+ *notification_type = kEnhancedBookmarkNotificationType;
+ return true;
default:
break;
}
@@ -1053,6 +1075,9 @@ bool NotificationTypeToRealModelType(const std::string& notification_type,
} else if (notification_type == kArticleNotificationType) {
*model_type = ARTICLES;
return true;
+ } else if (notification_type == kEnhancedBookmarkNotificationType) {
+ *model_type = ENHANCED_BOOKMARKS;
+ return true;
}
*model_type = UNSPECIFIED;
return false;
diff --git a/sync/syncable/nigori_util.cc b/sync/syncable/nigori_util.cc
index 63dbcac..eaf9eca 100644
--- a/sync/syncable/nigori_util.cc
+++ b/sync/syncable/nigori_util.cc
@@ -243,7 +243,7 @@ void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types,
bool encrypt_everything,
sync_pb::NigoriSpecifics* nigori) {
nigori->set_encrypt_everything(encrypt_everything);
- COMPILE_ASSERT(32 == MODEL_TYPE_COUNT, UpdateEncryptedTypes);
+ COMPILE_ASSERT(33 == MODEL_TYPE_COUNT, UpdateEncryptedTypes);
nigori->set_encrypt_bookmarks(
encrypted_types.Has(BOOKMARKS));
nigori->set_encrypt_preferences(
@@ -279,7 +279,7 @@ ModelTypeSet GetEncryptedTypesFromNigori(
return ModelTypeSet::All();
ModelTypeSet encrypted_types;
- COMPILE_ASSERT(32 == MODEL_TYPE_COUNT, UpdateEncryptedTypes);
+ COMPILE_ASSERT(33 == MODEL_TYPE_COUNT, UpdateEncryptedTypes);
if (nigori.encrypt_bookmarks())
encrypted_types.Put(BOOKMARKS);
if (nigori.encrypt_preferences())