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

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

Issue 115862: DevTools: pass class and method name as arguments to RPC messages (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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.h ('k') | webkit/glue/webdevtoolsclient.h » ('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 "EventListener.h" 10 #include "EventListener.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 } 224 }
225 RefPtr<InspectorResource> resource = 225 RefPtr<InspectorResource> resource =
226 page->inspectorController()->resources().get(identifier); 226 page->inspectorController()->resources().get(identifier);
227 if (resource.get()) { 227 if (resource.get()) {
228 tools_agent_delegate_stub_->DidGetResourceContent(call_id, 228 tools_agent_delegate_stub_->DidGetResourceContent(call_id,
229 resource->sourceString()); 229 resource->sourceString());
230 } 230 }
231 } 231 }
232 232
233 void WebDevToolsAgentImpl::DispatchMessageFromClient( 233 void WebDevToolsAgentImpl::DispatchMessageFromClient(
234 const std::string& class_name,
235 const std::string& method_name,
234 const std::string& raw_msg) { 236 const std::string& raw_msg) {
235 OwnPtr<ListValue> message( 237 OwnPtr<ListValue> message(
236 static_cast<ListValue*>(DevToolsRpc::ParseMessage(raw_msg))); 238 static_cast<ListValue*>(DevToolsRpc::ParseMessage(raw_msg)));
237 if (ToolsAgentDispatch::Dispatch(this, *message.get())) { 239 if (ToolsAgentDispatch::Dispatch(
240 this, class_name, method_name, *message.get())) {
238 return; 241 return;
239 } 242 }
240 243
241 if (!attached_) { 244 if (!attached_) {
242 return; 245 return;
243 } 246 }
244 247
245 if (debugger_agent_impl_.get() && 248 if (debugger_agent_impl_.get() &&
246 DebuggerAgentDispatch::Dispatch( 249 DebuggerAgentDispatch::Dispatch(
247 debugger_agent_impl_.get(), 250 debugger_agent_impl_.get(), class_name, method_name,
248 *message.get())) { 251 *message.get())) {
249 return; 252 return;
250 } 253 }
251 254
252 if (DomAgentDispatch::Dispatch(dom_agent_impl_.get(), *message.get())) { 255 if (DomAgentDispatch::Dispatch(
256 dom_agent_impl_.get(), class_name, method_name, *message.get())) {
253 return; 257 return;
254 } 258 }
255 } 259 }
256 260
257 void WebDevToolsAgentImpl::InspectElement(int x, int y) { 261 void WebDevToolsAgentImpl::InspectElement(int x, int y) {
258 Node* node = web_view_impl_->GetNodeForWindowPos(x, y); 262 Node* node = web_view_impl_->GetNodeForWindowPos(x, y);
259 if (!node) { 263 if (!node) {
260 return; 264 return;
261 } 265 }
262 266
263 int node_id = dom_agent_impl_->PushNodePathToClient(node); 267 int node_id = dom_agent_impl_->PushNodePathToClient(node);
264 tools_agent_delegate_stub_->UpdateFocusedNode(node_id); 268 tools_agent_delegate_stub_->UpdateFocusedNode(node_id);
265 } 269 }
266 270
267 void WebDevToolsAgentImpl::SendRpcMessage(const std::string& raw_msg) { 271 void WebDevToolsAgentImpl::SendRpcMessage(
268 delegate_->SendMessageToClient(raw_msg); 272 const std::string& class_name,
273 const std::string& method_name,
274 const std::string& raw_msg) {
275 delegate_->SendMessageToClient(class_name, method_name, raw_msg);
269 } 276 }
270 277
271 // static 278 // static
272 v8::Handle<v8::Value> WebDevToolsAgentImpl::JsDispatchOnClient( 279 v8::Handle<v8::Value> WebDevToolsAgentImpl::JsDispatchOnClient(
273 const v8::Arguments& args) { 280 const v8::Arguments& args) {
274 v8::TryCatch exception_catcher; 281 v8::TryCatch exception_catcher;
275 String message = WebCore::toWebCoreStringWithNullCheck(args[0]); 282 String message = WebCore::toWebCoreStringWithNullCheck(args[0]);
276 if (message.isEmpty() || exception_catcher.HasCaught()) { 283 if (message.isEmpty() || exception_catcher.HasCaught()) {
277 return v8::Undefined(); 284 return v8::Undefined();
278 } 285 }
279 WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>( 286 WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>(
280 v8::External::Cast(*args.Data())->Value()); 287 v8::External::Cast(*args.Data())->Value());
281 agent->tools_agent_delegate_stub_->DispatchOnClient(message); 288 agent->tools_agent_delegate_stub_->DispatchOnClient(message);
282 return v8::Undefined(); 289 return v8::Undefined();
283 } 290 }
284 291
285 // static 292 // static
286 void WebDevToolsAgent::ExecuteDebuggerCommand( 293 void WebDevToolsAgent::ExecuteDebuggerCommand(
287 const std::string& command, 294 const std::string& command,
288 int caller_id) { 295 int caller_id) {
289 DebuggerAgentManager::ExecuteDebuggerCommand(command, caller_id); 296 DebuggerAgentManager::ExecuteDebuggerCommand(command, caller_id);
290 } 297 }
291 298
292 // static 299 // static
293 void WebDevToolsAgent::SetMessageLoopDispatchHandler( 300 void WebDevToolsAgent::SetMessageLoopDispatchHandler(
294 MessageLoopDispatchHandler handler) { 301 MessageLoopDispatchHandler handler) {
295 DebuggerAgentManager::SetMessageLoopDispatchHandler(handler); 302 DebuggerAgentManager::SetMessageLoopDispatchHandler(handler);
296 } 303 }
OLDNEW
« no previous file with comments | « webkit/glue/webdevtoolsagent_impl.h ('k') | webkit/glue/webdevtoolsclient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698