| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/devtools/devtools_client.h" | 5 #include "content/renderer/devtools/devtools_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/common/devtools_messages.h" | 10 #include "content/common/devtools_messages.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 WebDevToolsFrontend::create( | 29 WebDevToolsFrontend::create( |
| 30 render_view->webview(), | 30 render_view->webview(), |
| 31 this, | 31 this, |
| 32 base::ASCIIToUTF16( | 32 base::ASCIIToUTF16( |
| 33 command_line.GetSwitchValueASCII(switches::kLang)))); | 33 command_line.GetSwitchValueASCII(switches::kLang)))); |
| 34 } | 34 } |
| 35 | 35 |
| 36 DevToolsClient::~DevToolsClient() { | 36 DevToolsClient::~DevToolsClient() { |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool DevToolsClient::OnMessageReceived(const IPC::Message& message) { | |
| 40 DCHECK(RenderThreadImpl::current()); | |
| 41 | |
| 42 bool handled = true; | |
| 43 IPC_BEGIN_MESSAGE_MAP(DevToolsClient, message) | |
| 44 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, | |
| 45 OnDispatchOnInspectorFrontend) | |
| 46 IPC_MESSAGE_UNHANDLED(handled = false); | |
| 47 IPC_END_MESSAGE_MAP() | |
| 48 | |
| 49 return handled; | |
| 50 } | |
| 51 | |
| 52 void DevToolsClient::sendMessageToBackend(const WebString& message) { | 39 void DevToolsClient::sendMessageToBackend(const WebString& message) { |
| 53 Send(new DevToolsAgentMsg_DispatchOnInspectorBackend(routing_id(), | 40 Send(new DevToolsAgentMsg_DispatchOnInspectorBackend(routing_id(), |
| 54 message.utf8())); | 41 message.utf8())); |
| 55 } | 42 } |
| 56 | 43 |
| 57 void DevToolsClient::sendMessageToEmbedder(const WebString& message) { | 44 void DevToolsClient::sendMessageToEmbedder(const WebString& message) { |
| 58 Send(new DevToolsHostMsg_DispatchOnEmbedder(routing_id(), | 45 Send(new DevToolsHostMsg_DispatchOnEmbedder(routing_id(), |
| 59 message.utf8())); | 46 message.utf8())); |
| 60 } | 47 } |
| 61 | 48 |
| 62 bool DevToolsClient::isUnderTest() { | 49 bool DevToolsClient::isUnderTest() { |
| 63 return RenderThreadImpl::current()->layout_test_mode(); | 50 return RenderThreadImpl::current()->layout_test_mode(); |
| 64 } | 51 } |
| 65 | 52 |
| 66 void DevToolsClient::OnDispatchOnInspectorFrontend(const std::string& message) { | |
| 67 web_tools_frontend_->dispatchOnInspectorFrontend( | |
| 68 WebString::fromUTF8(message)); | |
| 69 } | |
| 70 | |
| 71 } // namespace content | 53 } // namespace content |
| OLD | NEW |