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" |
11 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
12 #include "content/public/common/url_constants.h" | 12 #include "content/public/common/url_constants.h" |
13 #include "content/renderer/render_thread_impl.h" | 13 #include "content/renderer/render_thread_impl.h" |
14 #include "content/renderer/render_view_impl.h" | 14 #include "content/renderer/render_view_impl.h" |
15 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 15 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
16 #include "third_party/WebKit/public/platform/WebString.h" | 16 #include "third_party/WebKit/public/platform/WebString.h" |
17 #include "third_party/WebKit/public/web/WebDevToolsFrontend.h" | 17 #include "third_party/WebKit/public/web/WebDevToolsFrontend.h" |
18 #include "ui/base/ui_base_switches.h" | 18 #include "ui/base/ui_base_switches.h" |
19 | 19 |
20 using blink::WebDevToolsFrontend; | 20 using blink::WebDevToolsFrontend; |
21 using blink::WebString; | 21 using blink::WebString; |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 | 24 |
25 DevToolsClient::DevToolsClient(RenderFrame* main_render_frame) | 25 DevToolsClient::DevToolsClient(RenderFrame* main_render_frame) |
26 : RenderFrameObserver(main_render_frame) { | 26 : RenderFrameObserver(main_render_frame) { |
27 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 27 const base::CommandLine& command_line = |
| 28 *base::CommandLine::ForCurrentProcess(); |
28 web_tools_frontend_.reset(WebDevToolsFrontend::create( | 29 web_tools_frontend_.reset(WebDevToolsFrontend::create( |
29 main_render_frame->GetRenderView()->GetWebView(), this, | 30 main_render_frame->GetRenderView()->GetWebView(), this, |
30 base::ASCIIToUTF16(command_line.GetSwitchValueASCII(switches::kLang)))); | 31 base::ASCIIToUTF16(command_line.GetSwitchValueASCII(switches::kLang)))); |
31 } | 32 } |
32 | 33 |
33 DevToolsClient::~DevToolsClient() { | 34 DevToolsClient::~DevToolsClient() { |
34 } | 35 } |
35 | 36 |
36 void DevToolsClient::sendMessageToBackend(const WebString& message) { | 37 void DevToolsClient::sendMessageToBackend(const WebString& message) { |
37 Send(new DevToolsAgentMsg_DispatchOnInspectorBackend(routing_id(), | 38 Send(new DevToolsAgentMsg_DispatchOnInspectorBackend(routing_id(), |
38 message.utf8())); | 39 message.utf8())); |
39 } | 40 } |
40 | 41 |
41 void DevToolsClient::sendMessageToEmbedder(const WebString& message) { | 42 void DevToolsClient::sendMessageToEmbedder(const WebString& message) { |
42 Send(new DevToolsHostMsg_DispatchOnEmbedder(routing_id(), | 43 Send(new DevToolsHostMsg_DispatchOnEmbedder(routing_id(), |
43 message.utf8())); | 44 message.utf8())); |
44 } | 45 } |
45 | 46 |
46 bool DevToolsClient::isUnderTest() { | 47 bool DevToolsClient::isUnderTest() { |
47 return RenderThreadImpl::current()->layout_test_mode(); | 48 return RenderThreadImpl::current()->layout_test_mode(); |
48 } | 49 } |
49 | 50 |
50 } // namespace content | 51 } // namespace content |
OLD | NEW |