Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: webkit/glue/webdevtoolsclient_impl.cc

Issue 149086: Use upstream V8Proxy and V8Utilities (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webdevtoolsagent_impl.cc ('k') | webkit/port/bindings/scripts/CodeGeneratorV8.pm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "InspectorController.h" 12 #include "InspectorController.h"
13 #include "Node.h" 13 #include "Node.h"
14 #include "Page.h" 14 #include "Page.h"
15 #include "PlatformString.h" 15 #include "PlatformString.h"
16 #include "SecurityOrigin.h" 16 #include "SecurityOrigin.h"
17 #include "V8Binding.h"
18 #include "V8CustomBinding.h"
19 #include "V8Proxy.h"
20 #include "V8Utilities.h"
17 #include <wtf/OwnPtr.h> 21 #include <wtf/OwnPtr.h>
18 #include <wtf/Vector.h> 22 #include <wtf/Vector.h>
19 #undef LOG 23 #undef LOG
20 24
21 #include "V8Binding.h"
22 #include "V8CustomBinding.h"
23 #include "v8_proxy.h"
24 #include "v8_utility.h"
25 #include "base/string_util.h" 25 #include "base/string_util.h"
26 #include "base/values.h" 26 #include "base/values.h"
27 #include "webkit/api/public/WebScriptSource.h" 27 #include "webkit/api/public/WebScriptSource.h"
28 #include "webkit/glue/devtools/bound_object.h" 28 #include "webkit/glue/devtools/bound_object.h"
29 #include "webkit/glue/devtools/debugger_agent.h" 29 #include "webkit/glue/devtools/debugger_agent.h"
30 #include "webkit/glue/devtools/devtools_rpc_js.h" 30 #include "webkit/glue/devtools/devtools_rpc_js.h"
31 #include "webkit/glue/devtools/dom_agent.h" 31 #include "webkit/glue/devtools/dom_agent.h"
32 #include "webkit/glue/devtools/tools_agent.h" 32 #include "webkit/glue/devtools/tools_agent.h"
33 #include "webkit/glue/glue_util.h" 33 #include "webkit/glue/glue_util.h"
34 #include "webkit/glue/webdevtoolsclient_delegate.h" 34 #include "webkit/glue/webdevtoolsclient_delegate.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // Debugger commands should be sent using special method. 142 // Debugger commands should be sent using special method.
143 debugger_command_executor_obj_.set(new RemoteDebuggerCommandExecutor( 143 debugger_command_executor_obj_.set(new RemoteDebuggerCommandExecutor(
144 delegate, frame, L"RemoteDebuggerCommandExecutor")); 144 delegate, frame, L"RemoteDebuggerCommandExecutor"));
145 debugger_agent_obj_.set(new JsDebuggerAgentBoundObj( 145 debugger_agent_obj_.set(new JsDebuggerAgentBoundObj(
146 this, frame, L"RemoteDebuggerAgent")); 146 this, frame, L"RemoteDebuggerAgent"));
147 dom_agent_obj_.set(new JsDomAgentBoundObj(this, frame, L"RemoteDomAgent")); 147 dom_agent_obj_.set(new JsDomAgentBoundObj(this, frame, L"RemoteDomAgent"));
148 tools_agent_obj_.set( 148 tools_agent_obj_.set(
149 new JsToolsAgentBoundObj(this, frame, L"RemoteToolsAgent")); 149 new JsToolsAgentBoundObj(this, frame, L"RemoteToolsAgent"));
150 150
151 v8::HandleScope scope; 151 v8::HandleScope scope;
152 v8::Handle<v8::Context> frame_context = V8Proxy::GetContext(frame->frame()); 152 v8::Handle<v8::Context> frame_context = V8Proxy::context(frame->frame());
153 dev_tools_host_.set(new BoundObject(frame_context, this, "DevToolsHost")); 153 dev_tools_host_.set(new BoundObject(frame_context, this, "DevToolsHost"));
154 dev_tools_host_->AddProtoFunction( 154 dev_tools_host_->AddProtoFunction(
155 "reset", 155 "reset",
156 WebDevToolsClientImpl::JsReset); 156 WebDevToolsClientImpl::JsReset);
157 dev_tools_host_->AddProtoFunction( 157 dev_tools_host_->AddProtoFunction(
158 "addSourceToFrame", 158 "addSourceToFrame",
159 WebDevToolsClientImpl::JsAddSourceToFrame); 159 WebDevToolsClientImpl::JsAddSourceToFrame);
160 dev_tools_host_->AddProtoFunction( 160 dev_tools_host_->AddProtoFunction(
161 "addResourceSourceToFrame", 161 "addResourceSourceToFrame",
162 WebDevToolsClientImpl::JsAddResourceSourceToFrame); 162 WebDevToolsClientImpl::JsAddResourceSourceToFrame);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 v8::TryCatch exception_catcher; 246 v8::TryCatch exception_catcher;
247 247
248 String mime_type = WebCore::toWebCoreStringWithNullCheck(args[0]); 248 String mime_type = WebCore::toWebCoreStringWithNullCheck(args[0]);
249 if (mime_type.isEmpty() || exception_catcher.HasCaught()) { 249 if (mime_type.isEmpty() || exception_catcher.HasCaught()) {
250 return v8::Undefined(); 250 return v8::Undefined();
251 } 251 }
252 String source_string = WebCore::toWebCoreStringWithNullCheck(args[1]); 252 String source_string = WebCore::toWebCoreStringWithNullCheck(args[1]);
253 if (source_string.isEmpty() || exception_catcher.HasCaught()) { 253 if (source_string.isEmpty() || exception_catcher.HasCaught()) {
254 return v8::Undefined(); 254 return v8::Undefined();
255 } 255 }
256 Node* node = V8Proxy::DOMWrapperToNode<Node>(args[2]); 256 Node* node = V8Proxy::convertDOMWrapperToNode<Node>(args[2]);
257 if (!node || !node->attached()) { 257 if (!node || !node->attached()) {
258 return v8::Undefined(); 258 return v8::Undefined();
259 } 259 }
260 260
261 Page* page = V8Proxy::retrieveFrameForEnteredContext()->page(); 261 Page* page = V8Proxy::retrieveFrameForEnteredContext()->page();
262 InspectorController* inspectorController = page->inspectorController(); 262 InspectorController* inspectorController = page->inspectorController();
263 return WebCore::v8Boolean(inspectorController-> 263 return WebCore::v8Boolean(inspectorController->
264 addSourceToFrame(mime_type, source_string, node)); 264 addSourceToFrame(mime_type, source_string, node));
265 } 265 }
266 266
267 // static 267 // static
268 v8::Handle<v8::Value> WebDevToolsClientImpl::JsAddResourceSourceToFrame( 268 v8::Handle<v8::Value> WebDevToolsClientImpl::JsAddResourceSourceToFrame(
269 const v8::Arguments& args) { 269 const v8::Arguments& args) {
270 int resource_id = static_cast<int>(args[0]->NumberValue()); 270 int resource_id = static_cast<int>(args[0]->NumberValue());
271 String mime_type = WebCore::toWebCoreStringWithNullCheck(args[1]); 271 String mime_type = WebCore::toWebCoreStringWithNullCheck(args[1]);
272 if (mime_type.isEmpty()) { 272 if (mime_type.isEmpty()) {
273 return v8::Undefined(); 273 return v8::Undefined();
274 } 274 }
275 Node* node = V8Proxy::DOMWrapperToNode<Node>(args[2]); 275 Node* node = V8Proxy::convertDOMWrapperToNode<Node>(args[2]);
276 WebDevToolsClientImpl* client = static_cast<WebDevToolsClientImpl*>( 276 WebDevToolsClientImpl* client = static_cast<WebDevToolsClientImpl*>(
277 v8::External::Cast(*args.Data())->Value()); 277 v8::External::Cast(*args.Data())->Value());
278 client->AddResourceSourceToFrame(resource_id, mime_type, node); 278 client->AddResourceSourceToFrame(resource_id, mime_type, node);
279 return v8::Undefined(); 279 return v8::Undefined();
280 } 280 }
281 281
282 // static 282 // static
283 v8::Handle<v8::Value> WebDevToolsClientImpl::JsLoaded( 283 v8::Handle<v8::Value> WebDevToolsClientImpl::JsLoaded(
284 const v8::Arguments& args) { 284 const v8::Arguments& args) {
285 WebDevToolsClientImpl* client = static_cast<WebDevToolsClientImpl*>( 285 WebDevToolsClientImpl* client = static_cast<WebDevToolsClientImpl*>(
(...skipping 28 matching lines...) Expand all
314 v8::Handle<v8::Value> WebDevToolsClientImpl::JsGetPlatform( 314 v8::Handle<v8::Value> WebDevToolsClientImpl::JsGetPlatform(
315 const v8::Arguments& args) { 315 const v8::Arguments& args) {
316 #if defined OS_MACOSX 316 #if defined OS_MACOSX
317 return v8String("mac-leopard"); 317 return v8String("mac-leopard");
318 #elif defined OS_LINUX 318 #elif defined OS_LINUX
319 return v8String("linux"); 319 return v8String("linux");
320 #else 320 #else
321 return v8String("windows"); 321 return v8String("windows");
322 #endif 322 #endif
323 } 323 }
OLDNEW
« no previous file with comments | « webkit/glue/webdevtoolsagent_impl.cc ('k') | webkit/port/bindings/scripts/CodeGeneratorV8.pm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698