Index: chrome/browser/sync/syncable/model_type.cc |
diff --git a/chrome/browser/sync/syncable/model_type.cc b/chrome/browser/sync/syncable/model_type.cc |
index 460985a3f5eaf46a000ac8f4e411660aa9dab66c..a77b63fcdea4b46fd75c1045ed6d7c714f60ba36 100644 |
--- a/chrome/browser/sync/syncable/model_type.cc |
+++ b/chrome/browser/sync/syncable/model_type.cc |
@@ -11,6 +11,7 @@ |
#include "chrome/browser/sync/protocol/app_specifics.pb.h" |
#include "chrome/browser/sync/protocol/autofill_specifics.pb.h" |
#include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" |
+#include "chrome/browser/sync/protocol/extension_setting_specifics.pb.h" |
#include "chrome/browser/sync/protocol/extension_specifics.pb.h" |
#include "chrome/browser/sync/protocol/nigori_specifics.pb.h" |
#include "chrome/browser/sync/protocol/password_specifics.pb.h" |
@@ -62,6 +63,9 @@ void AddDefaultExtensionValue(syncable::ModelType datatype, |
case APPS: |
specifics->MutableExtension(sync_pb::app); |
break; |
+ case EXTENSION_SETTINGS: |
+ specifics->MutableExtension(sync_pb::extension_setting); |
+ break; |
default: |
NOTREACHED() << "No known extension for model type."; |
} |
@@ -115,6 +119,9 @@ int GetExtensionFieldNumberFromModelType(ModelType model_type) { |
case APPS: |
return sync_pb::kAppFieldNumber; |
break; |
+ case EXTENSION_SETTINGS: |
+ return sync_pb::kExtensionSettingFieldNumber; |
+ break; |
default: |
NOTREACHED() << "No known extension for model type."; |
return 0; |
@@ -192,6 +199,9 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) { |
if (specifics.HasExtension(sync_pb::session)) |
return SESSIONS; |
+ if (specifics.HasExtension(sync_pb::extension_setting)) |
+ return EXTENSION_SETTINGS; |
+ |
return UNSPECIFIED; |
} |
@@ -225,6 +235,8 @@ std::string ModelTypeToString(ModelType model_type) { |
return "Apps"; |
case AUTOFILL_PROFILE: |
return "Autofill Profiles"; |
+ case EXTENSION_SETTINGS: |
+ return "Extension settings"; |
default: |
break; |
} |
@@ -295,6 +307,8 @@ ModelType ModelTypeFromString(const std::string& model_type_string) { |
return SESSIONS; |
else if (model_type_string == "Apps") |
return APPS; |
+ else if (model_type_string == "Extension settings") |
+ return EXTENSION_SETTINGS; |
else |
NOTREACHED() << "No known model type corresponding to " |
<< model_type_string << "."; |
@@ -403,6 +417,8 @@ std::string ModelTypeToRootTag(ModelType type) { |
return "google_chrome_apps"; |
case AUTOFILL_PROFILE: |
return "google_chrome_autofill_profiles"; |
+ case EXTENSION_SETTINGS: |
+ return "google_chrome_extension_settings"; |
default: |
break; |
} |
@@ -466,6 +482,10 @@ void PostTimeToTypeHistogram(ModelType model_type, base::TimeDelta time) { |
SYNC_FREQ_HISTOGRAM("Sync.FreqApps", time); |
return; |
} |
+ case EXTENSION_SETTINGS: { |
+ SYNC_FREQ_HISTOGRAM("Sync.FreqExtensionSettings", time); |
+ return; |
+ } |
default: |
LOG(ERROR) << "No known extension for model type."; |
} |
@@ -482,6 +502,7 @@ const char kPasswordint[] = "PASSWORD"; |
const char kAutofillint[] = "AUTOFILL"; |
const char kThemeint[] = "THEME"; |
const char kTypedUrlint[] = "TYPED_URL"; |
+const char kExtensionSettingint[] = "EXTENSION_SETTING"; |
const char kExtensionint[] = "EXTENSION"; |
const char kNigoriint[] = "NIGORI"; |
const char kAppint[] = "APP"; |
@@ -491,7 +512,7 @@ const char kAutofillProfileint[] = "AUTOFILL_PROFILE"; |
} // namespace |
bool RealModelTypeToint(ModelType model_type, |
- std::string* notification_type) { |
+ std::string* notification_type) { |
switch (model_type) { |
case BOOKMARKS: |
*notification_type = kBookmarkint; |
@@ -529,6 +550,9 @@ bool RealModelTypeToint(ModelType model_type, |
case AUTOFILL_PROFILE: |
*notification_type = kAutofillProfileint; |
return true; |
+ case EXTENSION_SETTINGS: |
+ *notification_type = kExtensionSettingint; |
+ return true; |
default: |
break; |
} |
@@ -574,6 +598,9 @@ bool intToRealModelType(const std::string& notification_type, |
} else if (notification_type == kAutofillProfileint) { |
*model_type = AUTOFILL_PROFILE; |
return true; |
+ } else if (notification_type == kExtensionSettingint) { |
+ *model_type = EXTENSION_SETTINGS; |
+ return true; |
} |
*model_type = UNSPECIFIED; |
return false; |