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.h" | 5 #include "chrome/renderer/devtools_agent.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/common/devtools_messages.h" | 9 #include "chrome/common/devtools_messages.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 using WebKit::WebPoint; | 23 using WebKit::WebPoint; |
24 using WebKit::WebString; | 24 using WebKit::WebString; |
25 using WebKit::WebCString; | 25 using WebKit::WebCString; |
26 using WebKit::WebVector; | 26 using WebKit::WebVector; |
27 using WebKit::WebView; | 27 using WebKit::WebView; |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 class WebKitClientMessageLoopImpl | 31 class WebKitClientMessageLoopImpl |
32 : public WebDevToolsAgentClient::WebKitClientMessageLoop { | 32 : public WebDevToolsAgentClient::WebKitClientMessageLoop { |
33 public: | 33 public: |
34 WebKitClientMessageLoopImpl() : message_loop_(MessageLoop::current()) { } | 34 WebKitClientMessageLoopImpl() : message_loop_(MessageLoop::current()) { } |
35 virtual ~WebKitClientMessageLoopImpl() { | 35 virtual ~WebKitClientMessageLoopImpl() { |
36 message_loop_ = NULL; | 36 message_loop_ = NULL; |
37 } | 37 } |
38 virtual void run() { | 38 virtual void run() { |
39 bool old_state = message_loop_->NestableTasksAllowed(); | 39 bool old_state = message_loop_->NestableTasksAllowed(); |
40 message_loop_->SetNestableTasksAllowed(true); | 40 message_loop_->SetNestableTasksAllowed(true); |
41 message_loop_->Run(); | 41 message_loop_->Run(); |
42 message_loop_->SetNestableTasksAllowed(old_state); | 42 message_loop_->SetNestableTasksAllowed(old_state); |
43 } | 43 } |
44 virtual void quitNow() { | 44 virtual void quitNow() { |
45 message_loop_->QuitNow(); | 45 message_loop_->QuitNow(); |
46 } | 46 } |
47 private: | 47 private: |
48 MessageLoop* message_loop_; | 48 MessageLoop* message_loop_; |
49 }; | 49 }; |
50 | 50 |
51 } // namespace | 51 } // namespace |
52 | 52 |
53 // static | 53 // static |
54 std::map<int, DevToolsAgent*> DevToolsAgent::agent_for_routing_id_; | 54 std::map<int, DevToolsAgent*> DevToolsAgent::agent_for_routing_id_; |
55 | 55 |
56 DevToolsAgent::DevToolsAgent(int routing_id, RenderView* render_view) | 56 DevToolsAgent::DevToolsAgent(int routing_id, RenderView* render_view) |
57 : routing_id_(routing_id), | 57 : routing_id_(routing_id), |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 webkit_glue::GetDataResource(IDR_DEVTOOLS_INJECT_WEBKIT_JS); | 117 webkit_glue::GetDataResource(IDR_DEVTOOLS_INJECT_WEBKIT_JS); |
118 return WebCString(injectjsWebkit.as_string().c_str()); | 118 return WebCString(injectjsWebkit.as_string().c_str()); |
119 } | 119 } |
120 | 120 |
121 WebCString DevToolsAgent::injectedScriptDispatcherSource() { | 121 WebCString DevToolsAgent::injectedScriptDispatcherSource() { |
122 base::StringPiece injectDispatchjs = | 122 base::StringPiece injectDispatchjs = |
123 webkit_glue::GetDataResource(IDR_DEVTOOLS_INJECT_DISPATCH_JS); | 123 webkit_glue::GetDataResource(IDR_DEVTOOLS_INJECT_DISPATCH_JS); |
124 return WebCString(injectDispatchjs.as_string().c_str()); | 124 return WebCString(injectDispatchjs.as_string().c_str()); |
125 } | 125 } |
126 | 126 |
| 127 WebCString DevToolsAgent::debuggerScriptSource() { |
| 128 base::StringPiece debuggerScriptjs = |
| 129 webkit_glue::GetDataResource(IDR_DEVTOOLS_DEBUGGER_SCRIPT_JS); |
| 130 return WebCString(debuggerScriptjs.as_string().c_str()); |
| 131 } |
| 132 |
127 WebKit::WebDevToolsAgentClient::WebKitClientMessageLoop* | 133 WebKit::WebDevToolsAgentClient::WebKitClientMessageLoop* |
128 DevToolsAgent::createClientMessageLoop() { | 134 DevToolsAgent::createClientMessageLoop() { |
129 return new WebKitClientMessageLoopImpl(); | 135 return new WebKitClientMessageLoopImpl(); |
130 } | 136 } |
131 | 137 |
132 bool DevToolsAgent::exposeV8DebuggerProtocol() { | 138 bool DevToolsAgent::exposeV8DebuggerProtocol() { |
133 return expose_v8_debugger_protocol_; | 139 return expose_v8_debugger_protocol_; |
134 } | 140 } |
135 | 141 |
136 | 142 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 if (!web_view) | 194 if (!web_view) |
189 return NULL; | 195 return NULL; |
190 return web_view->devToolsAgent(); | 196 return web_view->devToolsAgent(); |
191 } | 197 } |
192 | 198 |
193 // static | 199 // static |
194 void WebKit::WebDevToolsAgentClient::sendMessageToFrontendOnIOThread( | 200 void WebKit::WebDevToolsAgentClient::sendMessageToFrontendOnIOThread( |
195 const WebDevToolsMessageData& data) { | 201 const WebDevToolsMessageData& data) { |
196 DevToolsAgentFilter::SendRpcMessage(DevToolsMessageData(data)); | 202 DevToolsAgentFilter::SendRpcMessage(DevToolsMessageData(data)); |
197 } | 203 } |
OLD | NEW |