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

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: Created 8 years, 4 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
Index: sync/syncable/model_type.cc
diff --git a/sync/syncable/model_type.cc b/sync/syncable/model_type.cc
index 83e803cdd58c451f6b8eae1efa8e35e56e156203..dcdb684ccfc84df2c2b77469f60f4577da69c607 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;
default:
NOTREACHED() << "No known extension for model type.";
}
@@ -135,6 +138,9 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) {
case APP_NOTIFICATIONS:
return sync_pb::EntitySpecifics::kAppNotificationFieldNumber;
break;
+ case HISTORY_DELETE_DIRECTIVES:
+ return sync_pb::EntitySpecifics::kHistoryDeleteDirectiveFieldNumber;
+ break;
default:
NOTREACHED() << "No known extension for model type.";
return 0;
@@ -144,7 +150,7 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) {
return 0;
}
-// 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.
@@ -219,6 +225,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;
+
return UNSPECIFIED;
}
@@ -265,6 +274,8 @@ const char* ModelTypeToString(ModelType model_type) {
return "Extension settings";
case APP_NOTIFICATIONS:
return "App Notifications";
+ case HISTORY_DELETE_DIRECTIVES:
+ return "History Delete Directives";
default:
break;
}
@@ -330,6 +341,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
NOTREACHED() << "No known model type corresponding to "
<< model_type_string << ".";
@@ -398,6 +411,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";
default:
break;
}
@@ -423,6 +438,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";
} // namespace
bool RealModelTypeToNotificationType(ModelType model_type,
@@ -473,6 +490,9 @@ bool RealModelTypeToNotificationType(ModelType model_type,
case APP_NOTIFICATIONS:
*notification_type = kAppNotificationNotificationType;
return true;
+ case HISTORY_DELETE_DIRECTIVES:
+ *notification_type = kHistoryDeleteDirectiveNotificationType;
+ return true;
default:
break;
}
@@ -527,6 +547,9 @@ 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;
+ return true;
} else {
*model_type = UNSPECIFIED;
return false;

Powered by Google App Engine
This is Rietveld 408576698