Index: chrome/renderer/devtools_agent_filter.cc |
diff --git a/chrome/renderer/devtools_agent_filter.cc b/chrome/renderer/devtools_agent_filter.cc |
index 93b6c752faa27e2080a19d1b86a0c6bbd03549bb..375c74303e26fd994f2ffed0ac90c5cf491dba1e 100644 |
--- a/chrome/renderer/devtools_agent_filter.cc |
+++ b/chrome/renderer/devtools_agent_filter.cc |
@@ -6,6 +6,7 @@ |
#include "base/message_loop.h" |
#include "chrome/common/devtools_messages.h" |
+#include "chrome/common/render_messages.h" |
#include "chrome/renderer/devtools_agent.h" |
#include "chrome/renderer/plugin_channel_host.h" |
#include "chrome/renderer/render_view.h" |
@@ -24,8 +25,13 @@ void DevToolsAgentFilter::DispatchMessageLoop() { |
current->SetNestableTasksAllowed(old_state); |
} |
+// static |
+IPC::Channel* DevToolsAgentFilter::channel_ = NULL; |
+// static |
+int DevToolsAgentFilter::current_routing_id_ = 0; |
+ |
DevToolsAgentFilter::DevToolsAgentFilter() |
- : current_routing_id_(0) { |
+ : message_handled_(false) { |
WebDevToolsAgent::setMessageLoopDispatchHandler( |
&DevToolsAgentFilter::DispatchMessageLoop); |
} |
@@ -35,15 +41,16 @@ DevToolsAgentFilter::~DevToolsAgentFilter() { |
bool DevToolsAgentFilter::OnMessageReceived(const IPC::Message& message) { |
// Dispatch debugger commands directly from IO. |
- bool handled = true; |
+ message_handled_ = true; |
current_routing_id_ = message.routing_id(); |
IPC_BEGIN_MESSAGE_MAP(DevToolsAgentFilter, message) |
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerCommand, OnDebuggerCommand) |
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerPauseScript, |
OnDebuggerPauseScript) |
- IPC_MESSAGE_UNHANDLED(handled = false) |
+ IPC_MESSAGE_HANDLER(DevToolsAgentMsg_RpcMessage, OnRpcMessage) |
+ IPC_MESSAGE_UNHANDLED(message_handled_ = false) |
IPC_END_MESSAGE_MAP() |
- return handled; |
+ return message_handled_; |
} |
void DevToolsAgentFilter::OnDebuggerCommand(const std::string& command) { |
@@ -54,3 +61,33 @@ void DevToolsAgentFilter::OnDebuggerCommand(const std::string& command) { |
void DevToolsAgentFilter::OnDebuggerPauseScript() { |
WebDevToolsAgent::debuggerPauseScript(); |
} |
+ |
+void DevToolsAgentFilter::OnRpcMessage(const std::string& class_name, |
+ const std::string& method_name, |
+ const std::string& param1, |
+ const std::string& param2, |
+ const std::string& param3) { |
+ message_handled_ = WebDevToolsAgent::dispatchMessageFromFrontendOnIOThread( |
+ WebString::fromUTF8(class_name), |
+ WebString::fromUTF8(method_name), |
+ WebString::fromUTF8(param1), |
+ WebString::fromUTF8(param2), |
+ WebString::fromUTF8(param3)); |
+} |
+ |
+// static |
+void DevToolsAgentFilter::SendRpcMessage(const std::string& class_name, |
+ const std::string& method_name, |
+ const std::string& param1, |
+ const std::string& param2, |
+ const std::string& param3) { |
+ IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient( |
+ current_routing_id_, |
+ DevToolsClientMsg_RpcMessage( |
+ class_name, |
+ method_name, |
+ param1, |
+ param2, |
+ param3)); |
+ channel_->Send(m); |
+} |