| 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 "content/browser/child_process_security_policy_impl.h" | 9 #include "content/browser/child_process_security_policy_impl.h" |
| 10 #include "content/browser/devtools/devtools_manager_impl.h" | 10 #include "content/browser/devtools/devtools_manager_impl.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 return false; | 395 return false; |
| 396 | 396 |
| 397 bool handled = true; | 397 bool handled = true; |
| 398 IPC_BEGIN_MESSAGE_MAP(RenderViewDevToolsAgentHost, msg) | 398 IPC_BEGIN_MESSAGE_MAP(RenderViewDevToolsAgentHost, msg) |
| 399 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, | 399 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, |
| 400 OnDispatchOnInspectorFrontend) | 400 OnDispatchOnInspectorFrontend) |
| 401 IPC_MESSAGE_HANDLER(DevToolsHostMsg_SaveAgentRuntimeState, | 401 IPC_MESSAGE_HANDLER(DevToolsHostMsg_SaveAgentRuntimeState, |
| 402 OnSaveAgentRuntimeState) | 402 OnSaveAgentRuntimeState) |
| 403 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, | 403 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, |
| 404 handled = false; OnSwapCompositorFrame(msg)) | 404 handled = false; OnSwapCompositorFrame(msg)) |
| 405 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SetTouchEventEmulationEnabled, | |
| 406 handled = OnSetTouchEventEmulationEnabled(msg)) | |
| 407 IPC_MESSAGE_UNHANDLED(handled = false) | 405 IPC_MESSAGE_UNHANDLED(handled = false) |
| 408 IPC_END_MESSAGE_MAP() | 406 IPC_END_MESSAGE_MAP() |
| 409 return handled; | 407 return handled; |
| 410 } | 408 } |
| 411 | 409 |
| 412 void RenderViewDevToolsAgentHost::OnSwapCompositorFrame( | 410 void RenderViewDevToolsAgentHost::OnSwapCompositorFrame( |
| 413 const IPC::Message& message) { | 411 const IPC::Message& message) { |
| 414 ViewHostMsg_SwapCompositorFrame::Param param; | 412 ViewHostMsg_SwapCompositorFrame::Param param; |
| 415 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) | 413 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) |
| 416 return; | 414 return; |
| 417 overrides_handler_->OnSwapCompositorFrame(param.b.metadata); | 415 overrides_handler_->OnSwapCompositorFrame(param.b.metadata); |
| 418 } | 416 } |
| 419 | 417 |
| 420 bool RenderViewDevToolsAgentHost::OnSetTouchEventEmulationEnabled( | |
| 421 const IPC::Message& message) { | |
| 422 return overrides_handler_->OnSetTouchEventEmulationEnabled(); | |
| 423 } | |
| 424 | |
| 425 void RenderViewDevToolsAgentHost::SynchronousSwapCompositorFrame( | 418 void RenderViewDevToolsAgentHost::SynchronousSwapCompositorFrame( |
| 426 const cc::CompositorFrameMetadata& frame_metadata) { | 419 const cc::CompositorFrameMetadata& frame_metadata) { |
| 427 if (!render_view_host_) | 420 if (!render_view_host_) |
| 428 return; | 421 return; |
| 429 overrides_handler_->OnSwapCompositorFrame(frame_metadata); | 422 overrides_handler_->OnSwapCompositorFrame(frame_metadata); |
| 430 } | 423 } |
| 431 | 424 |
| 432 void RenderViewDevToolsAgentHost::OnSaveAgentRuntimeState( | 425 void RenderViewDevToolsAgentHost::OnSaveAgentRuntimeState( |
| 433 const std::string& state) { | 426 const std::string& state) { |
| 434 if (!render_view_host_) | 427 if (!render_view_host_) |
| 435 return; | 428 return; |
| 436 state_ = state; | 429 state_ = state; |
| 437 } | 430 } |
| 438 | 431 |
| 439 void RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend( | 432 void RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend( |
| 440 const std::string& message) { | 433 const std::string& message) { |
| 441 if (!render_view_host_) | 434 if (!render_view_host_) |
| 442 return; | 435 return; |
| 443 | 436 |
| 444 scoped_refptr<DevToolsProtocol::Notification> notification = | 437 scoped_refptr<DevToolsProtocol::Notification> notification = |
| 445 DevToolsProtocol::ParseNotification(message); | 438 DevToolsProtocol::ParseNotification(message); |
| 446 | 439 |
| 447 if (notification) { | 440 if (notification) { |
| 448 tracing_handler_->HandleNotification(notification); | 441 tracing_handler_->HandleNotification(notification); |
| 449 } | 442 } |
| 450 SendMessageToClient(message); | 443 SendMessageToClient(message); |
| 451 } | 444 } |
| 452 | 445 |
| 453 } // namespace content | 446 } // namespace content |
| OLD | NEW |