| 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/devtools_frontend_host_impl.h" | 5 #include "content/browser/devtools/devtools_frontend_host_impl.h" |
| 6 | 6 |
| 7 #include "content/common/devtools_messages.h" | 7 #include "content/common/devtools_messages.h" |
| 8 #include "content/public/browser/navigation_entry.h" | 8 #include "content/public/browser/navigation_entry.h" |
| 9 #include "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 DevToolsFrontendHost::Delegate* delegate) | 23 DevToolsFrontendHost::Delegate* delegate) |
| 24 : WebContentsObserver(WebContents::FromRenderViewHost(frontend_rvh)), | 24 : WebContentsObserver(WebContents::FromRenderViewHost(frontend_rvh)), |
| 25 delegate_(delegate) { | 25 delegate_(delegate) { |
| 26 frontend_rvh->Send(new DevToolsMsg_SetupDevToolsClient( | 26 frontend_rvh->Send(new DevToolsMsg_SetupDevToolsClient( |
| 27 frontend_rvh->GetRoutingID())); | 27 frontend_rvh->GetRoutingID())); |
| 28 } | 28 } |
| 29 | 29 |
| 30 DevToolsFrontendHostImpl::~DevToolsFrontendHostImpl() { | 30 DevToolsFrontendHostImpl::~DevToolsFrontendHostImpl() { |
| 31 } | 31 } |
| 32 | 32 |
| 33 void DevToolsFrontendHostImpl::DispatchOnDevToolsFrontend( | |
| 34 const std::string& message) { | |
| 35 if (!web_contents()) | |
| 36 return; | |
| 37 RenderViewHost* target_host = web_contents()->GetRenderViewHost(); | |
| 38 target_host->Send(new DevToolsClientMsg_DispatchOnInspectorFrontend( | |
| 39 target_host->GetRoutingID(), | |
| 40 message)); | |
| 41 } | |
| 42 | |
| 43 bool DevToolsFrontendHostImpl::OnMessageReceived( | 33 bool DevToolsFrontendHostImpl::OnMessageReceived( |
| 44 const IPC::Message& message) { | 34 const IPC::Message& message) { |
| 45 bool handled = true; | 35 bool handled = true; |
| 46 IPC_BEGIN_MESSAGE_MAP(DevToolsFrontendHostImpl, message) | 36 IPC_BEGIN_MESSAGE_MAP(DevToolsFrontendHostImpl, message) |
| 47 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend, | 37 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend, |
| 48 OnDispatchOnInspectorBackend) | 38 OnDispatchOnInspectorBackend) |
| 49 IPC_MESSAGE_HANDLER(DevToolsHostMsg_DispatchOnEmbedder, | 39 IPC_MESSAGE_HANDLER(DevToolsHostMsg_DispatchOnEmbedder, |
| 50 OnDispatchOnEmbedder) | 40 OnDispatchOnEmbedder) |
| 51 IPC_MESSAGE_UNHANDLED(handled = false) | 41 IPC_MESSAGE_UNHANDLED(handled = false) |
| 52 IPC_END_MESSAGE_MAP() | 42 IPC_END_MESSAGE_MAP() |
| 53 return handled; | 43 return handled; |
| 54 } | 44 } |
| 55 | 45 |
| 56 void DevToolsFrontendHostImpl::OnDispatchOnInspectorBackend( | 46 void DevToolsFrontendHostImpl::OnDispatchOnInspectorBackend( |
| 57 const std::string& message) { | 47 const std::string& message) { |
| 58 delegate_->HandleMessageFromDevToolsFrontendToBackend(message); | 48 delegate_->HandleMessageFromDevToolsFrontendToBackend(message); |
| 59 } | 49 } |
| 60 | 50 |
| 61 void DevToolsFrontendHostImpl::OnDispatchOnEmbedder( | 51 void DevToolsFrontendHostImpl::OnDispatchOnEmbedder( |
| 62 const std::string& message) { | 52 const std::string& message) { |
| 63 delegate_->HandleMessageFromDevToolsFrontend(message); | 53 delegate_->HandleMessageFromDevToolsFrontend(message); |
| 64 } | 54 } |
| 65 | 55 |
| 66 } // namespace content | 56 } // namespace content |
| OLD | NEW |