| Index: content/shell/browser/shell_devtools_frontend.cc
|
| diff --git a/content/shell/browser/shell_devtools_frontend.cc b/content/shell/browser/shell_devtools_frontend.cc
|
| index fe30eddef0c8e94ebb52eb416e94017c8683a661..76e29365762156cb0697442c4a8cfa8a12583a30 100644
|
| --- a/content/shell/browser/shell_devtools_frontend.cc
|
| +++ b/content/shell/browser/shell_devtools_frontend.cc
|
| @@ -5,7 +5,9 @@
|
| #include "content/shell/browser/shell_devtools_frontend.h"
|
|
|
| #include "base/command_line.h"
|
| +#include "base/json/json_reader.h"
|
| #include "base/path_service.h"
|
| +#include "base/strings/string_number_conversions.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "content/public/browser/devtools_http_handler.h"
|
| @@ -135,6 +137,40 @@ void ShellDevToolsFrontend::RenderProcessGone(base::TerminationStatus status) {
|
| WebKitTestController::Get()->DevToolsProcessCrashed();
|
| }
|
|
|
| +void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
| + const std::string& message) {
|
| + std::string method;
|
| + std::string browser_message;
|
| + int id = 0;
|
| +
|
| + base::ListValue* params = NULL;
|
| + base::DictionaryValue* dict = NULL;
|
| + scoped_ptr<base::Value> parsed_message(base::JSONReader::Read(message));
|
| + if (!parsed_message ||
|
| + !parsed_message->GetAsDictionary(&dict) ||
|
| + !dict->GetString("method", &method) ||
|
| + !dict->GetList("params", ¶ms)) {
|
| + return;
|
| + }
|
| +
|
| + if (method != "sendMessageToBrowser" ||
|
| + params->GetSize() != 1 ||
|
| + !params->GetString(0, &browser_message)) {
|
| + return;
|
| + }
|
| + dict->GetInteger("id", &id);
|
| +
|
| + DevToolsManager::GetInstance()->DispatchOnInspectorBackend(
|
| + this, browser_message);
|
| +
|
| + if (id) {
|
| + std::string code = "InspectorFrontendAPI.embedderMessageAck(" +
|
| + base::IntToString(id) + ",\"\");";
|
| + base::string16 javascript = base::UTF8ToUTF16(code);
|
| + web_contents()->GetMainFrame()->ExecuteJavaScript(javascript);
|
| + }
|
| +}
|
| +
|
| void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontendToBackend(
|
| const std::string& message) {
|
| DevToolsManager::GetInstance()->DispatchOnInspectorBackend(
|
|
|