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

Unified Diff: sync/syncable/model_type.cc

Issue 10855037: [Sync] Add history delete directive type (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 8 years, 2 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/protocol/sync_proto.gyp ('k') | sync/util/cryptographer_unittest.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 e4993a47017f3a739a07d1a522438e1bea6be43f..f4e23612227752077388b068cc4e3dfd633a70f7 100644
--- a/sync/syncable/model_type.cc
+++ b/sync/syncable/model_type.cc
@@ -73,6 +73,9 @@ void AddDefaultFieldValue(ModelType datatype,
case APP_NOTIFICATIONS:
specifics->mutable_app_notification();
break;
+ case HISTORY_DELETE_DIRECTIVES:
+ specifics->mutable_history_delete_directive();
+ break;
case DEVICE_INFO:
specifics->mutable_device_info();
break;
@@ -138,6 +141,8 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) {
case APP_NOTIFICATIONS:
return sync_pb::EntitySpecifics::kAppNotificationFieldNumber;
break;
+ case HISTORY_DELETE_DIRECTIVES:
+ return sync_pb::EntitySpecifics::kHistoryDeleteDirectiveFieldNumber;
case DEVICE_INFO:
return sync_pb::EntitySpecifics::kDeviceInfoFieldNumber;
break;
@@ -158,7 +163,7 @@ FullModelTypeSet ToFullModelTypeSet(ModelTypeSet in) {
return out;
}
-// Note: keep this consistent with GetModelType in syncable.cc!
+// Note: keep this consistent with GetModelType in entry.cc!
ModelType GetModelType(const sync_pb::SyncEntity& sync_entity) {
DCHECK(!IsRoot(sync_entity)); // Root shouldn't ever go over the wire.
@@ -233,6 +238,9 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) {
if (specifics.has_app_notification())
return APP_NOTIFICATIONS;
+ if (specifics.has_history_delete_directive())
+ return HISTORY_DELETE_DIRECTIVES;
+
if (specifics.has_device_info())
return DEVICE_INFO;
@@ -251,6 +259,13 @@ ModelTypeSet UserTypes() {
return set;
}
+ModelTypeSet EncryptableUserTypes() {
+ ModelTypeSet encryptable_user_types = UserTypes();
+ // We never encrypt history delete directives.
+ encryptable_user_types.Remove(HISTORY_DELETE_DIRECTIVES);
+ return encryptable_user_types;
+}
+
ModelTypeSet ControlTypes() {
ModelTypeSet set;
for (int i = FIRST_CONTROL_MODEL_TYPE; i <= LAST_CONTROL_MODEL_TYPE; ++i) {
@@ -306,6 +321,8 @@ const char* ModelTypeToString(ModelType model_type) {
return "Extension settings";
case APP_NOTIFICATIONS:
return "App Notifications";
+ case HISTORY_DELETE_DIRECTIVES:
+ return "History Delete Directives";
case DEVICE_INFO:
return "Device Info";
default:
@@ -373,6 +390,8 @@ ModelType ModelTypeFromString(const std::string& model_type_string) {
return EXTENSION_SETTINGS;
else if (model_type_string == "App Notifications")
return APP_NOTIFICATIONS;
+ else if (model_type_string == "History Delete Directives")
+ return HISTORY_DELETE_DIRECTIVES;
else if (model_type_string == "Device Info")
return DEVICE_INFO;
else
@@ -443,6 +462,8 @@ std::string ModelTypeToRootTag(ModelType type) {
return "google_chrome_extension_settings";
case APP_NOTIFICATIONS:
return "google_chrome_app_notifications";
+ case HISTORY_DELETE_DIRECTIVES:
+ return "google_chrome_history_delete_directives";
case DEVICE_INFO:
return "google_chrome_device_info";
default:
@@ -470,6 +491,8 @@ const char kSearchEngineNotificationType[] = "SEARCH_ENGINE";
const char kSessionNotificationType[] = "SESSION";
const char kAutofillProfileNotificationType[] = "AUTOFILL_PROFILE";
const char kAppNotificationNotificationType[] = "APP_NOTIFICATION";
+const char kHistoryDeleteDirectiveNotificationType[] =
+ "HISTORY_DELETE_DIRECTIVE";
const char kDeviceInfoNotificationType[] = "DEVICE_INFO";
} // namespace
@@ -521,6 +544,8 @@ bool RealModelTypeToNotificationType(ModelType model_type,
case APP_NOTIFICATIONS:
*notification_type = kAppNotificationNotificationType;
return true;
+ case HISTORY_DELETE_DIRECTIVES:
+ *notification_type = kHistoryDeleteDirectiveNotificationType;
case DEVICE_INFO:
*notification_type = kDeviceInfoNotificationType;
return true;
@@ -578,13 +603,14 @@ bool NotificationTypeToRealModelType(const std::string& notification_type,
} else if (notification_type == kAppNotificationNotificationType) {
*model_type = APP_NOTIFICATIONS;
return true;
+ } else if (notification_type == kHistoryDeleteDirectiveNotificationType) {
+ *model_type = HISTORY_DELETE_DIRECTIVES;
} else if (notification_type == kDeviceInfoNotificationType) {
*model_type = DEVICE_INFO;;
return true;
- } else {
- *model_type = UNSPECIFIED;
- return false;
}
+ *model_type = UNSPECIFIED;
+ return false;
}
bool IsRealDataType(ModelType model_type) {
« no previous file with comments | « sync/protocol/sync_proto.gyp ('k') | sync/util/cryptographer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698