| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_client.h" | 5 #include "content/renderer/devtools_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "content/common/content_switches.h" | 10 #include "content/common/content_switches.h" |
| 11 #include "content/common/devtools_messages.h" | 11 #include "content/common/devtools_messages.h" |
| 12 #include "content/renderer/render_thread.h" | 12 #include "content/renderer/render_thread_impl.h" |
| 13 #include "content/renderer/render_view.h" | 13 #include "content/renderer/render_view.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontend.h
" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontend.h
" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 16 #include "ui/base/ui_base_switches.h" | 16 #include "ui/base/ui_base_switches.h" |
| 17 | 17 |
| 18 using WebKit::WebDevToolsFrontend; | 18 using WebKit::WebDevToolsFrontend; |
| 19 using WebKit::WebString; | 19 using WebKit::WebString; |
| 20 | 20 |
| 21 DevToolsClient::DevToolsClient(RenderView* render_view) | 21 DevToolsClient::DevToolsClient(RenderView* render_view) |
| 22 : content::RenderViewObserver(render_view) { | 22 : content::RenderViewObserver(render_view) { |
| 23 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 23 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 24 web_tools_frontend_.reset( | 24 web_tools_frontend_.reset( |
| 25 WebDevToolsFrontend::create( | 25 WebDevToolsFrontend::create( |
| 26 render_view->webview(), | 26 render_view->webview(), |
| 27 this, | 27 this, |
| 28 ASCIIToUTF16(command_line.GetSwitchValueASCII(switches::kLang)))); | 28 ASCIIToUTF16(command_line.GetSwitchValueASCII(switches::kLang)))); |
| 29 } | 29 } |
| 30 | 30 |
| 31 DevToolsClient::~DevToolsClient() { | 31 DevToolsClient::~DevToolsClient() { |
| 32 } | 32 } |
| 33 | 33 |
| 34 void DevToolsClient::SendToAgent(const IPC::Message& tools_agent_message) { | 34 void DevToolsClient::SendToAgent(const IPC::Message& tools_agent_message) { |
| 35 Send(new DevToolsHostMsg_ForwardToAgent(routing_id(), tools_agent_message)); | 35 Send(new DevToolsHostMsg_ForwardToAgent(routing_id(), tools_agent_message)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool DevToolsClient::OnMessageReceived(const IPC::Message& message) { | 38 bool DevToolsClient::OnMessageReceived(const IPC::Message& message) { |
| 39 DCHECK(RenderThread::current()->message_loop() == MessageLoop::current()); | 39 DCHECK(RenderThreadImpl::current()); |
| 40 | 40 |
| 41 bool handled = true; | 41 bool handled = true; |
| 42 IPC_BEGIN_MESSAGE_MAP(DevToolsClient, message) | 42 IPC_BEGIN_MESSAGE_MAP(DevToolsClient, message) |
| 43 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, | 43 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, |
| 44 OnDispatchOnInspectorFrontend) | 44 OnDispatchOnInspectorFrontend) |
| 45 IPC_MESSAGE_UNHANDLED(handled = false); | 45 IPC_MESSAGE_UNHANDLED(handled = false); |
| 46 IPC_END_MESSAGE_MAP() | 46 IPC_END_MESSAGE_MAP() |
| 47 | 47 |
| 48 return handled; | 48 return handled; |
| 49 } | 49 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 void DevToolsClient::OnDispatchOnInspectorFrontend(const std::string& message) { | 88 void DevToolsClient::OnDispatchOnInspectorFrontend(const std::string& message) { |
| 89 web_tools_frontend_->dispatchOnInspectorFrontend( | 89 web_tools_frontend_->dispatchOnInspectorFrontend( |
| 90 WebString::fromUTF8(message)); | 90 WebString::fromUTF8(message)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 bool DevToolsClient::shouldHideScriptsPanel() { | 93 bool DevToolsClient::shouldHideScriptsPanel() { |
| 94 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 94 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 95 return cmd->HasSwitch(switches::kRemoteShellPort); | 95 return cmd->HasSwitch(switches::kRemoteShellPort); |
| 96 } | 96 } |
| OLD | NEW |