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.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/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/Source/Platform/chromium/public/WebFloatPoint.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" |
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontend.h
" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontend.h
" |
18 #include "ui/base/ui_base_switches.h" | 18 #include "ui/base/ui_base_switches.h" |
19 #include "webkit/appcache/appcache_interfaces.h" | 19 #include "webkit/appcache/appcache_interfaces.h" |
20 | 20 |
21 using WebKit::WebDevToolsFrontend; | 21 using WebKit::WebDevToolsFrontend; |
22 using WebKit::WebString; | 22 using WebKit::WebString; |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 namespace { | |
27 | |
28 bool g_devtools_frontend_testing_enabled = false; | |
29 | |
30 } // namespace | |
31 | |
32 DevToolsClient::DevToolsClient(RenderViewImpl* render_view) | 26 DevToolsClient::DevToolsClient(RenderViewImpl* render_view) |
33 : RenderViewObserver(render_view) { | 27 : RenderViewObserver(render_view) { |
34 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 28 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
35 web_tools_frontend_.reset( | 29 web_tools_frontend_.reset( |
36 WebDevToolsFrontend::create( | 30 WebDevToolsFrontend::create( |
37 render_view->webview(), | 31 render_view->webview(), |
38 this, | 32 this, |
39 ASCIIToUTF16(command_line.GetSwitchValueASCII(switches::kLang)))); | 33 ASCIIToUTF16(command_line.GetSwitchValueASCII(switches::kLang)))); |
40 appcache::AddSupportedScheme(chrome::kChromeDevToolsScheme); | 34 appcache::AddSupportedScheme(chrome::kChromeDevToolsScheme); |
41 } | 35 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 void DevToolsClient::addFileSystem() { | 103 void DevToolsClient::addFileSystem() { |
110 Send(new DevToolsHostMsg_AddFileSystem(routing_id())); | 104 Send(new DevToolsHostMsg_AddFileSystem(routing_id())); |
111 } | 105 } |
112 | 106 |
113 void DevToolsClient::removeFileSystem(const WebString& fileSystemPath) { | 107 void DevToolsClient::removeFileSystem(const WebString& fileSystemPath) { |
114 Send(new DevToolsHostMsg_RemoveFileSystem(routing_id(), | 108 Send(new DevToolsHostMsg_RemoveFileSystem(routing_id(), |
115 fileSystemPath.utf8())); | 109 fileSystemPath.utf8())); |
116 } | 110 } |
117 | 111 |
118 bool DevToolsClient::isUnderTest() { | 112 bool DevToolsClient::isUnderTest() { |
119 return g_devtools_frontend_testing_enabled; | 113 return RenderThreadImpl::current()->layout_test_mode(); |
120 } | 114 } |
121 | 115 |
122 void DevToolsClient::OnDispatchOnInspectorFrontend(const std::string& message) { | 116 void DevToolsClient::OnDispatchOnInspectorFrontend(const std::string& message) { |
123 web_tools_frontend_->dispatchOnInspectorFrontend( | 117 web_tools_frontend_->dispatchOnInspectorFrontend( |
124 WebString::fromUTF8(message)); | 118 WebString::fromUTF8(message)); |
125 } | 119 } |
126 | 120 |
127 // static | |
128 void DevToolsClient::EnableDevToolsFrontendTesting() { | |
129 g_devtools_frontend_testing_enabled = true; | |
130 } | |
131 | |
132 } // namespace content | 121 } // namespace content |
OLD | NEW |