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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "Document.h" | 9 #include "Document.h" |
10 #include "DOMWindow.h" | 10 #include "DOMWindow.h" |
11 #include "Frame.h" | 11 #include "Frame.h" |
12 #include "InspectorBackend.h" | 12 #include "InspectorBackend.h" |
13 #include "InspectorController.h" | 13 #include "InspectorController.h" |
14 #include "Node.h" | 14 #include "Node.h" |
15 #include "Page.h" | 15 #include "Page.h" |
16 #include "PlatformString.h" | 16 #include "PlatformString.h" |
17 #include "SecurityOrigin.h" | 17 #include "SecurityOrigin.h" |
18 #include "Settings.h" | 18 #include "Settings.h" |
19 #include "V8Binding.h" | 19 #include "V8Binding.h" |
20 #include "V8CustomBinding.h" | 20 #include "V8CustomBinding.h" |
21 #include "V8Proxy.h" | 21 #include "V8Proxy.h" |
22 #include "V8Utilities.h" | 22 #include "V8Utilities.h" |
23 #include <wtf/OwnPtr.h> | 23 #include <wtf/OwnPtr.h> |
24 #include <wtf/Vector.h> | 24 #include <wtf/Vector.h> |
25 #undef LOG | 25 #undef LOG |
26 | 26 |
27 #include "webkit/api/public/WebDevToolsFrontendClient.h" | 27 #include "webkit/api/public/WebDevToolsFrontendClient.h" |
28 #include "webkit/api/public/WebFrame.h" | 28 #include "webkit/api/public/WebFrame.h" |
29 #include "webkit/api/public/WebScriptSource.h" | 29 #include "webkit/api/public/WebScriptSource.h" |
| 30 #include "webkit/api/src/WebFrameImpl.h" |
| 31 #include "webkit/api/src/WebViewImpl.h" |
30 #include "webkit/glue/devtools/bound_object.h" | 32 #include "webkit/glue/devtools/bound_object.h" |
31 #include "webkit/glue/devtools/debugger_agent.h" | 33 #include "webkit/glue/devtools/debugger_agent.h" |
32 #include "webkit/glue/devtools/devtools_rpc_js.h" | 34 #include "webkit/glue/devtools/devtools_rpc_js.h" |
33 #include "webkit/glue/devtools/tools_agent.h" | 35 #include "webkit/glue/devtools/tools_agent.h" |
34 #include "webkit/glue/glue_util.h" | 36 #include "webkit/glue/glue_util.h" |
35 #include "webkit/glue/webdevtoolsfrontend_impl.h" | 37 #include "webkit/glue/webdevtoolsfrontend_impl.h" |
36 #include "webkit/glue/webview_impl.h" | |
37 | 38 |
38 using namespace WebCore; | 39 using namespace WebCore; |
39 using WebKit::WebDevToolsFrontend; | 40 using WebKit::WebDevToolsFrontend; |
40 using WebKit::WebDevToolsFrontendClient; | 41 using WebKit::WebDevToolsFrontendClient; |
41 using WebKit::WebFrame; | 42 using WebKit::WebFrame; |
| 43 using WebKit::WebFrameImpl; |
42 using WebKit::WebScriptSource; | 44 using WebKit::WebScriptSource; |
43 using WebKit::WebString; | 45 using WebKit::WebString; |
44 using WebKit::WebView; | 46 using WebKit::WebView; |
| 47 using WebKit::WebViewImpl; |
45 | 48 |
46 static v8::Local<v8::String> ToV8String(const String& s) { | 49 static v8::Local<v8::String> ToV8String(const String& s) { |
47 if (s.isNull()) | 50 if (s.isNull()) |
48 return v8::Local<v8::String>(); | 51 return v8::Local<v8::String>(); |
49 | 52 |
50 return v8::String::New(reinterpret_cast<const uint16_t*>(s.characters()), | 53 return v8::String::New(reinterpret_cast<const uint16_t*>(s.characters()), |
51 s.length()); | 54 s.length()); |
52 } | 55 } |
53 | 56 |
54 DEFINE_RPC_JS_BOUND_OBJ(DebuggerAgent, DEBUGGER_AGENT_STRUCT, | 57 DEFINE_RPC_JS_BOUND_OBJ(DebuggerAgent, DEBUGGER_AGENT_STRUCT, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 120 } |
118 | 121 |
119 WebDevToolsFrontendImpl::WebDevToolsFrontendImpl( | 122 WebDevToolsFrontendImpl::WebDevToolsFrontendImpl( |
120 WebViewImpl* web_view_impl, | 123 WebViewImpl* web_view_impl, |
121 WebDevToolsFrontendClient* client, | 124 WebDevToolsFrontendClient* client, |
122 const String& application_locale) | 125 const String& application_locale) |
123 : web_view_impl_(web_view_impl), | 126 : web_view_impl_(web_view_impl), |
124 client_(client), | 127 client_(client), |
125 application_locale_(application_locale), | 128 application_locale_(application_locale), |
126 loaded_(false) { | 129 loaded_(false) { |
127 WebFrameImpl* frame = web_view_impl_->main_frame(); | 130 WebFrameImpl* frame = web_view_impl_->mainFrameImpl(); |
128 v8::HandleScope scope; | 131 v8::HandleScope scope; |
129 v8::Handle<v8::Context> frame_context = V8Proxy::context(frame->frame()); | 132 v8::Handle<v8::Context> frame_context = V8Proxy::context(frame->frame()); |
130 | 133 |
131 debugger_agent_obj_.set(new JsDebuggerAgentBoundObj( | 134 debugger_agent_obj_.set(new JsDebuggerAgentBoundObj( |
132 this, frame_context, "RemoteDebuggerAgent")); | 135 this, frame_context, "RemoteDebuggerAgent")); |
133 tools_agent_obj_.set( | 136 tools_agent_obj_.set( |
134 new JsToolsAgentBoundObj(this, frame_context, "RemoteToolsAgent")); | 137 new JsToolsAgentBoundObj(this, frame_context, "RemoteToolsAgent")); |
135 | 138 |
136 // Debugger commands should be sent using special method. | 139 // Debugger commands should be sent using special method. |
137 debugger_command_executor_obj_.set( | 140 debugger_command_executor_obj_.set( |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 Node* frame) { | 224 Node* frame) { |
222 if (tools_agent_native_delegate_impl_->WaitingForResponse(resource_id, | 225 if (tools_agent_native_delegate_impl_->WaitingForResponse(resource_id, |
223 frame)) { | 226 frame)) { |
224 return; | 227 return; |
225 } | 228 } |
226 tools_agent_obj_->GetResourceContent(resource_id, resource_id); | 229 tools_agent_obj_->GetResourceContent(resource_id, resource_id); |
227 tools_agent_native_delegate_impl_->RequestSent(resource_id, mime_type, frame); | 230 tools_agent_native_delegate_impl_->RequestSent(resource_id, mime_type, frame); |
228 } | 231 } |
229 | 232 |
230 void WebDevToolsFrontendImpl::ExecuteScript(const Vector<String>& v) { | 233 void WebDevToolsFrontendImpl::ExecuteScript(const Vector<String>& v) { |
231 WebFrameImpl* frame = web_view_impl_->main_frame(); | 234 WebFrameImpl* frame = web_view_impl_->mainFrameImpl(); |
232 v8::HandleScope scope; | 235 v8::HandleScope scope; |
233 v8::Handle<v8::Context> frame_context = V8Proxy::context(frame->frame()); | 236 v8::Handle<v8::Context> frame_context = V8Proxy::context(frame->frame()); |
234 v8::Context::Scope context_scope(frame_context); | 237 v8::Context::Scope context_scope(frame_context); |
235 v8::Handle<v8::Value> dispatch_function = | 238 v8::Handle<v8::Value> dispatch_function = |
236 frame_context->Global()->Get(v8::String::New("devtools$$dispatch")); | 239 frame_context->Global()->Get(v8::String::New("devtools$$dispatch")); |
237 ASSERT(dispatch_function->IsFunction()); | 240 ASSERT(dispatch_function->IsFunction()); |
238 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(dispatch_fu
nction); | 241 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(dispatch_fu
nction); |
239 v8::Handle<v8::Value> args[] = { | 242 v8::Handle<v8::Value> args[] = { |
240 ToV8String(v.at(0)), | 243 ToV8String(v.at(0)), |
241 ToV8String(v.at(1)), | 244 ToV8String(v.at(1)), |
(...skipping 15 matching lines...) Expand all Loading... |
257 webkit_glue::StringToWebString(param1), | 260 webkit_glue::StringToWebString(param1), |
258 webkit_glue::StringToWebString(param2), | 261 webkit_glue::StringToWebString(param2), |
259 webkit_glue::StringToWebString(param3)); | 262 webkit_glue::StringToWebString(param3)); |
260 } | 263 } |
261 | 264 |
262 // static | 265 // static |
263 v8::Handle<v8::Value> WebDevToolsFrontendImpl::JsReset( | 266 v8::Handle<v8::Value> WebDevToolsFrontendImpl::JsReset( |
264 const v8::Arguments& args) { | 267 const v8::Arguments& args) { |
265 WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>( | 268 WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>( |
266 v8::External::Cast(*args.Data())->Value()); | 269 v8::External::Cast(*args.Data())->Value()); |
267 WebFrameImpl* frame = frontend->web_view_impl_->main_frame(); | 270 WebFrameImpl* frame = frontend->web_view_impl_->mainFrameImpl(); |
268 frontend->tools_agent_native_delegate_impl_.set( | 271 frontend->tools_agent_native_delegate_impl_.set( |
269 new ToolsAgentNativeDelegateImpl(frame)); | 272 new ToolsAgentNativeDelegateImpl(frame)); |
270 return v8::Undefined(); | 273 return v8::Undefined(); |
271 } | 274 } |
272 | 275 |
273 // static | 276 // static |
274 v8::Handle<v8::Value> WebDevToolsFrontendImpl::JsAddSourceToFrame( | 277 v8::Handle<v8::Value> WebDevToolsFrontendImpl::JsAddSourceToFrame( |
275 const v8::Arguments& args) { | 278 const v8::Arguments& args) { |
276 if (args.Length() < 2) { | 279 if (args.Length() < 2) { |
277 return v8::Undefined(); | 280 return v8::Undefined(); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 // static | 416 // static |
414 v8::Handle<v8::Value> WebDevToolsFrontendImpl::JsDebuggerCommand( | 417 v8::Handle<v8::Value> WebDevToolsFrontendImpl::JsDebuggerCommand( |
415 const v8::Arguments& args) { | 418 const v8::Arguments& args) { |
416 WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>( | 419 WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>( |
417 v8::External::Cast(*args.Data())->Value()); | 420 v8::External::Cast(*args.Data())->Value()); |
418 String command = WebCore::toWebCoreStringWithNullCheck(args[0]); | 421 String command = WebCore::toWebCoreStringWithNullCheck(args[0]); |
419 WebString std_command = webkit_glue::StringToWebString(command); | 422 WebString std_command = webkit_glue::StringToWebString(command); |
420 frontend->client_->sendDebuggerCommandToAgent(std_command); | 423 frontend->client_->sendDebuggerCommandToAgent(std_command); |
421 return v8::Undefined(); | 424 return v8::Undefined(); |
422 } | 425 } |
OLD | NEW |