| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/devtools_agent_filter.h" | 5 #include "chrome/renderer/devtools_agent_filter.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "chrome/common/devtools_messages.h" | 8 #include "chrome/common/devtools_messages.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "chrome/renderer/devtools_agent.h" | 10 #include "chrome/renderer/devtools_agent.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 current_routing_id_ = message.routing_id(); | 68 current_routing_id_ = message.routing_id(); |
| 69 IPC_BEGIN_MESSAGE_MAP(DevToolsAgentFilter, message) | 69 IPC_BEGIN_MESSAGE_MAP(DevToolsAgentFilter, message) |
| 70 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerCommand, OnDebuggerCommand) | 70 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerCommand, OnDebuggerCommand) |
| 71 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend, | 71 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend, |
| 72 OnDispatchOnInspectorBackend) | 72 OnDispatchOnInspectorBackend) |
| 73 IPC_MESSAGE_UNHANDLED(message_handled_ = false) | 73 IPC_MESSAGE_UNHANDLED(message_handled_ = false) |
| 74 IPC_END_MESSAGE_MAP() | 74 IPC_END_MESSAGE_MAP() |
| 75 return message_handled_; | 75 return message_handled_; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void DevToolsAgentFilter::OnFilterAdded(IPC::Channel* channel) { |
| 79 channel_ = channel; |
| 80 } |
| 81 |
| 78 void DevToolsAgentFilter::OnDebuggerCommand(const std::string& command) { | 82 void DevToolsAgentFilter::OnDebuggerCommand(const std::string& command) { |
| 79 WebDevToolsAgent::executeDebuggerCommand( | 83 WebDevToolsAgent::executeDebuggerCommand( |
| 80 WebString::fromUTF8(command), current_routing_id_); | 84 WebString::fromUTF8(command), current_routing_id_); |
| 81 } | 85 } |
| 82 | 86 |
| 83 void DevToolsAgentFilter::OnDispatchOnInspectorBackend( | 87 void DevToolsAgentFilter::OnDispatchOnInspectorBackend( |
| 84 const std::string& message) { | 88 const std::string& message) { |
| 85 if (!WebDevToolsAgent::shouldInterruptForMessage( | 89 if (!WebDevToolsAgent::shouldInterruptForMessage( |
| 86 WebString::fromUTF8(message))) { | 90 WebString::fromUTF8(message))) { |
| 87 message_handled_ = false; | 91 message_handled_ = false; |
| 88 return; | 92 return; |
| 89 } | 93 } |
| 90 WebDevToolsAgent::interruptAndDispatch( | 94 WebDevToolsAgent::interruptAndDispatch( |
| 91 new MessageImpl(message, current_routing_id_)); | 95 new MessageImpl(message, current_routing_id_)); |
| 92 | 96 |
| 93 render_thread_loop_->PostTask( | 97 render_thread_loop_->PostTask( |
| 94 FROM_HERE, | 98 FROM_HERE, |
| 95 NewRunnableFunction(&WebDevToolsAgent::processPendingMessages)); | 99 NewRunnableFunction(&WebDevToolsAgent::processPendingMessages)); |
| 96 } | 100 } |
| OLD | NEW |