| OLD | NEW |
| 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 Loading... |
| 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) | |
| 446 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, | 444 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, |
| 447 handled = false; OnSwapCompositorFrame(msg)) | 445 handled = false; OnSwapCompositorFrame(msg)) |
| 448 IPC_MESSAGE_UNHANDLED(handled = false) | 446 IPC_MESSAGE_UNHANDLED(handled = false) |
| 449 IPC_END_MESSAGE_MAP() | 447 IPC_END_MESSAGE_MAP() |
| 450 return handled; | 448 return handled; |
| 451 } | 449 } |
| 452 | 450 |
| 453 void RenderViewDevToolsAgentHost::OnSwapCompositorFrame( | 451 void RenderViewDevToolsAgentHost::OnSwapCompositorFrame( |
| 454 const IPC::Message& message) { | 452 const IPC::Message& message) { |
| 455 ViewHostMsg_SwapCompositorFrame::Param param; | 453 ViewHostMsg_SwapCompositorFrame::Param param; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 469 const std::string& state) { | 467 const std::string& state) { |
| 470 if (!render_view_host_) | 468 if (!render_view_host_) |
| 471 return; | 469 return; |
| 472 state_ = state; | 470 state_ = state; |
| 473 } | 471 } |
| 474 | 472 |
| 475 void RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend( | 473 void RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend( |
| 476 const std::string& message) { | 474 const std::string& message) { |
| 477 if (!render_view_host_) | 475 if (!render_view_host_) |
| 478 return; | 476 return; |
| 477 |
| 478 scoped_refptr<DevToolsProtocol::Notification> notification = |
| 479 DevToolsProtocol::ParseNotification(message); |
| 480 |
| 481 if (notification.get()) { |
| 482 tracing_handler_->HandleNotification(notification); |
| 483 } |
| 479 SendMessageToClient(message); | 484 SendMessageToClient(message); |
| 480 } | 485 } |
| 481 | 486 |
| 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 | |
| 491 } // namespace content | 487 } // namespace content |
| OLD | NEW |