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

Unified Diff: sync/syncable/model_type.cc

Issue 11961030: [Sync] Make SESSIONS an implicit type (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 11 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 edd5a0706415a5134b11cce32c339c23a897fce8..84dcd3961702f0905572c4a89f35290cba70aee6 100644
--- a/sync/syncable/model_type.cc
+++ b/sync/syncable/model_type.cc
@@ -88,6 +88,8 @@ void AddDefaultFieldValue(ModelType datatype,
case PRIORITY_PREFERENCES:
specifics->mutable_priority_preference();
break;
+ case TABS:
+ break;
default:
NOTREACHED() << "No known extension for model type.";
}
@@ -162,6 +164,8 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) {
case PRIORITY_PREFERENCES:
return sync_pb::EntitySpecifics::kPriorityPreferenceFieldNumber;
break;
+ case TABS:
+ return sync_pb::EntitySpecifics::kTabFieldNumber;
default:
NOTREACHED() << "No known extension for model type.";
return 0;
@@ -307,7 +311,7 @@ ModelTypeSet ControlTypes() {
ModelTypeSet VirtualTypes() {
ModelTypeSet set;
- // TODO(zea): add a TABS type here.
+ set.Put(TABS);
return set;
}
@@ -364,6 +368,8 @@ const char* ModelTypeToString(ModelType model_type) {
return "Experiments";
case PRIORITY_PREFERENCES:
return "Priority Preferences";
+ case TABS:
+ return "Tabs";
default:
break;
}
@@ -439,6 +445,8 @@ ModelType ModelTypeFromString(const std::string& model_type_string) {
return EXPERIMENTS;
else if (model_type_string == "Priority Preferences")
return PRIORITY_PREFERENCES;
+ else if (model_type_string == "Tabs")
+ return TABS;
else
NOTREACHED() << "No known model type corresponding to "
<< model_type_string << ".";
@@ -517,6 +525,8 @@ std::string ModelTypeToRootTag(ModelType type) {
return "google_chrome_experiments";
case PRIORITY_PREFERENCES:
return "google_chrome_priority_preferences";
+ case TABS:
+ return "";
default:
break;
}
@@ -548,6 +558,7 @@ const char kSyncedNotificationType[] = "SYNCED_NOTIFICATION";
const char kDeviceInfoNotificationType[] = "DEVICE_INFO";
const char kExperimentsNotificationType[] = "EXPERIMENTS";
const char kPriorityPreferenceNotificationType[] = "PRIORITY_PREFERENCE";
+const char kTabNotificationType[] = "TAB";
} // namespace
bool RealModelTypeToNotificationType(ModelType model_type,
@@ -610,6 +621,10 @@ bool RealModelTypeToNotificationType(ModelType model_type,
return true;
case PRIORITY_PREFERENCES:
*notification_type = kPriorityPreferenceNotificationType;
+ return true;
+ case TABS:
+ *notification_type = kTabNotificationType;
+ return true;
default:
break;
}
@@ -671,9 +686,15 @@ bool NotificationTypeToRealModelType(const std::string& notification_type,
} else if (notification_type == kDeviceInfoNotificationType) {
*model_type = DEVICE_INFO;;
return true;
+ } else if (notification_type == kExperimentsNotificationType) {
+ *model_type = EXPERIMENTS;
+ return true;
} else if (notification_type == kPriorityPreferenceNotificationType) {
*model_type = PRIORITY_PREFERENCES;
return true;
+ } else if (notification_type == kTabNotificationType) {
+ *model_type = TABS;
+ return true;
}
*model_type = UNSPECIFIED;
return false;

Powered by Google App Engine
This is Rietveld 408576698