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

Side by Side Diff: content/browser/devtools/render_view_devtools_agent_host.cc

Issue 511873002: DevTools: use explicit IPC messages for enabling/disabling tracing instead of intercepting protocol… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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
OLDNEW
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/browser/devtools/render_view_devtools_agent_host.h" 5 #include "content/browser/devtools/render_view_devtools_agent_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/browser/child_process_security_policy_impl.h" 10 #include "content/browser/child_process_security_policy_impl.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 const IPC::Message& msg) { 434 const IPC::Message& msg) {
435 if (!render_view_host_) 435 if (!render_view_host_)
436 return false; 436 return false;
437 437
438 bool handled = true; 438 bool handled = true;
439 IPC_BEGIN_MESSAGE_MAP(RenderViewDevToolsAgentHost, msg) 439 IPC_BEGIN_MESSAGE_MAP(RenderViewDevToolsAgentHost, msg)
440 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, 440 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend,
441 OnDispatchOnInspectorFrontend) 441 OnDispatchOnInspectorFrontend)
442 IPC_MESSAGE_HANDLER(DevToolsHostMsg_SaveAgentRuntimeState, 442 IPC_MESSAGE_HANDLER(DevToolsHostMsg_SaveAgentRuntimeState,
443 OnSaveAgentRuntimeState) 443 OnSaveAgentRuntimeState)
444 IPC_MESSAGE_HANDLER(DevToolsHostMsg_EnableTracing, OnEnableTracing)
445 IPC_MESSAGE_HANDLER(DevToolsHostMsg_DisableTracing, OnDisableTracing)
444 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, 446 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame,
445 handled = false; OnSwapCompositorFrame(msg)) 447 handled = false; OnSwapCompositorFrame(msg))
446 IPC_MESSAGE_UNHANDLED(handled = false) 448 IPC_MESSAGE_UNHANDLED(handled = false)
447 IPC_END_MESSAGE_MAP() 449 IPC_END_MESSAGE_MAP()
448 return handled; 450 return handled;
449 } 451 }
450 452
451 void RenderViewDevToolsAgentHost::OnSwapCompositorFrame( 453 void RenderViewDevToolsAgentHost::OnSwapCompositorFrame(
452 const IPC::Message& message) { 454 const IPC::Message& message) {
453 ViewHostMsg_SwapCompositorFrame::Param param; 455 ViewHostMsg_SwapCompositorFrame::Param param;
(...skipping 13 matching lines...) Expand all
467 const std::string& state) { 469 const std::string& state) {
468 if (!render_view_host_) 470 if (!render_view_host_)
469 return; 471 return;
470 state_ = state; 472 state_ = state;
471 } 473 }
472 474
473 void RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend( 475 void RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend(
474 const std::string& message) { 476 const std::string& message) {
475 if (!render_view_host_) 477 if (!render_view_host_)
476 return; 478 return;
477
478 scoped_refptr<DevToolsProtocol::Notification> notification =
479 DevToolsProtocol::ParseNotification(message);
480
481 if (notification.get()) {
482 tracing_handler_->HandleNotification(notification);
483 }
484 SendMessageToClient(message); 479 SendMessageToClient(message);
485 } 480 }
486 481
482 void RenderViewDevToolsAgentHost::OnEnableTracing(
483 const std::string& category_filter) {
484 tracing_handler_->EnableTracing(category_filter);
485 }
486
487 void RenderViewDevToolsAgentHost::OnDisableTracing() {
488 tracing_handler_->DisableTracing();
489 }
490
487 } // namespace content 491 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/render_view_devtools_agent_host.h ('k') | content/common/devtools_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698