| OLD | NEW |
| 1 // Copyright (c) 2011 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/debugger/devtools_frontend_host.h" | 5 #include "content/browser/debugger/devtools_frontend_host.h" |
| 6 | 6 |
| 7 #include "content/browser/debugger/devtools_manager_impl.h" | 7 #include "content/browser/debugger/devtools_manager_impl.h" |
| 8 #include "content/browser/renderer_host/render_view_host.h" | 8 #include "content/browser/renderer_host/render_view_host.h" |
| 9 #include "content/browser/tab_contents/tab_contents.h" | 9 #include "content/browser/tab_contents/tab_contents.h" |
| 10 #include "content/common/devtools_messages.h" | 10 #include "content/common/devtools_messages.h" |
| 11 #include "content/public/browser/devtools_client_host.h" | 11 #include "content/public/browser/devtools_client_host.h" |
| 12 #include "content/public/browser/devtools_frontend_host_delegate.h" | 12 #include "content/public/browser/devtools_frontend_host_delegate.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 // static | 16 // static |
| 17 DevToolsClientHost* DevToolsClientHost::CreateDevToolsFrontendHost( | 17 DevToolsClientHost* DevToolsClientHost::CreateDevToolsFrontendHost( |
| 18 WebContents* client_web_contents, | 18 WebContents* client_web_contents, |
| 19 DevToolsFrontendHostDelegate* delegate) { | 19 DevToolsFrontendHostDelegate* delegate) { |
| 20 return new DevToolsFrontendHost( | 20 return new DevToolsFrontendHost( |
| 21 static_cast<TabContents*>(client_web_contents), delegate); | 21 static_cast<TabContents*>(client_web_contents), delegate); |
| 22 } | 22 } |
| 23 | 23 |
| 24 // static | 24 // static |
| 25 void DevToolsClientHost::SetupDevToolsFrontendClient( | 25 void DevToolsClientHost::SetupDevToolsFrontendClient( |
| 26 RenderViewHost* frontend_rvh) { | 26 RenderViewHost* frontend_rvh) { |
| 27 frontend_rvh->Send(new DevToolsMsg_SetupDevToolsClient( | 27 frontend_rvh->Send(new DevToolsMsg_SetupDevToolsClient( |
| 28 frontend_rvh->routing_id())); | 28 frontend_rvh->GetRoutingID())); |
| 29 } | 29 } |
| 30 | 30 |
| 31 DevToolsFrontendHost::DevToolsFrontendHost( | 31 DevToolsFrontendHost::DevToolsFrontendHost( |
| 32 TabContents* tab_contents, | 32 TabContents* tab_contents, |
| 33 DevToolsFrontendHostDelegate* delegate) | 33 DevToolsFrontendHostDelegate* delegate) |
| 34 : RenderViewHostObserver(tab_contents->GetRenderViewHost()), | 34 : RenderViewHostObserver(tab_contents->GetRenderViewHost()), |
| 35 tab_contents_(tab_contents), | 35 tab_contents_(tab_contents), |
| 36 delegate_(delegate) { | 36 delegate_(delegate) { |
| 37 } | 37 } |
| 38 | 38 |
| 39 DevToolsFrontendHost::~DevToolsFrontendHost() { | 39 DevToolsFrontendHost::~DevToolsFrontendHost() { |
| 40 } | 40 } |
| 41 | 41 |
| 42 void DevToolsFrontendHost::DispatchOnInspectorFrontend( | 42 void DevToolsFrontendHost::DispatchOnInspectorFrontend( |
| 43 const std::string& message) { | 43 const std::string& message) { |
| 44 RenderViewHost* target_host = tab_contents_->GetRenderViewHost(); | 44 RenderViewHostImpl* target_host = |
| 45 static_cast<RenderViewHostImpl*>(tab_contents_->GetRenderViewHost()); |
| 45 target_host->Send(new DevToolsClientMsg_DispatchOnInspectorFrontend( | 46 target_host->Send(new DevToolsClientMsg_DispatchOnInspectorFrontend( |
| 46 target_host->routing_id(), | 47 target_host->GetRoutingID(), |
| 47 message)); | 48 message)); |
| 48 } | 49 } |
| 49 | 50 |
| 50 void DevToolsFrontendHost::InspectedTabClosing() { | 51 void DevToolsFrontendHost::InspectedTabClosing() { |
| 51 delegate_->InspectedTabClosing(); | 52 delegate_->InspectedTabClosing(); |
| 52 } | 53 } |
| 53 | 54 |
| 54 void DevToolsFrontendHost::FrameNavigating(const std::string& url) { | 55 void DevToolsFrontendHost::FrameNavigating(const std::string& url) { |
| 55 delegate_->FrameNavigating(url); | 56 delegate_->FrameNavigating(url); |
| 56 } | 57 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 117 |
| 117 void DevToolsFrontendHost::OnRequestUndockWindow() { | 118 void DevToolsFrontendHost::OnRequestUndockWindow() { |
| 118 delegate_->UndockWindow(); | 119 delegate_->UndockWindow(); |
| 119 } | 120 } |
| 120 | 121 |
| 121 void DevToolsFrontendHost::OnRequestSetDockSide(const std::string& side) { | 122 void DevToolsFrontendHost::OnRequestSetDockSide(const std::string& side) { |
| 122 delegate_->SetDockSide(side); | 123 delegate_->SetDockSide(side); |
| 123 } | 124 } |
| 124 | 125 |
| 125 } // namespace content | 126 } // namespace content |
| OLD | NEW |