Index: chrome/browser/ui/webui/sync_internals_message_handler.cc |
diff --git a/chrome/browser/ui/webui/sync_internals_message_handler.cc b/chrome/browser/ui/webui/sync_internals_message_handler.cc |
index 88d7e2904ad1125f7aefa6219a4bf299087ac344..1f03b59c174757e44dc1d1b6a2c0351710329238 100644 |
--- a/chrome/browser/ui/webui/sync_internals_message_handler.cc |
+++ b/chrome/browser/ui/webui/sync_internals_message_handler.cc |
@@ -19,6 +19,7 @@ |
using syncer::JsArgList; |
using syncer::JsEventDetails; |
using syncer::JsReplyHandler; |
+using syncer::ModelTypeSet; |
using syncer::WeakHandle; |
SyncInternalsMessageHandler::SyncInternalsMessageHandler() |
@@ -44,18 +45,19 @@ void SyncInternalsMessageHandler::RegisterMessages() { |
base::Bind(&SyncInternalsMessageHandler::OnGetAboutInfo, |
base::Unretained(this))); |
+ web_ui()->RegisterMessageCallback( |
+ "getListOfTypes", |
+ base::Bind(&SyncInternalsMessageHandler::OnGetListOfTypes, |
+ base::Unretained(this))); |
+ |
RegisterJsControllerCallback("getNotificationState"); |
RegisterJsControllerCallback("getNotificationInfo"); |
- RegisterJsControllerCallback("getRootNodeDetails"); |
- RegisterJsControllerCallback("getNodeSummariesById"); |
- RegisterJsControllerCallback("getNodeDetailsById"); |
RegisterJsControllerCallback("getAllNodes"); |
- RegisterJsControllerCallback("getChildNodeIds"); |
RegisterJsControllerCallback("getClientServerTraffic"); |
} |
void SyncInternalsMessageHandler::OnGetAboutInfo(const base::ListValue* args) { |
- // TODO(rlarocque): We should DCHECK(!args) here. |
+ // TODO(rlarocque): We should DCHECK(!args) here. See crbug.com/334431. |
scoped_ptr<base::DictionaryValue> value = |
sync_ui_util::ConstructAboutInformation(GetProfileSyncService()); |
web_ui()->CallJavascriptFunction( |
@@ -63,6 +65,20 @@ void SyncInternalsMessageHandler::OnGetAboutInfo(const base::ListValue* args) { |
*value); |
} |
+void SyncInternalsMessageHandler::OnGetListOfTypes( |
+ const base::ListValue* args) { |
+ // TODO(rlarocque): We should DCHECK(!args) here. See crbug.com/334431. |
+ base::ListValue type_list; |
+ ModelTypeSet protocol_types = syncer::ProtocolTypes(); |
+ for (ModelTypeSet::Iterator it = protocol_types.First(); |
+ it.Good(); it.Inc()) { |
+ type_list.Append(new base::StringValue(ModelTypeToString(it.Get()))); |
+ } |
+ web_ui()->CallJavascriptFunction( |
+ "chrome.sync.getListOfTypes.handleReply", |
+ type_list); |
+} |
+ |
void SyncInternalsMessageHandler::HandleJsReply( |
const std::string& name, const JsArgList& args) { |
DVLOG(1) << "Handling reply for " << name << " message" |