| Index: content/browser/devtools/devtools_frontend_host_impl.cc
|
| diff --git a/content/browser/devtools/devtools_frontend_host.cc b/content/browser/devtools/devtools_frontend_host_impl.cc
|
| similarity index 34%
|
| rename from content/browser/devtools/devtools_frontend_host.cc
|
| rename to content/browser/devtools/devtools_frontend_host_impl.cc
|
| index bfa623a140ea327a4f9ae13ff57bf31dd0d0b8f6..4e708463b97fa1e7f7816f330703c0b1f1684f2c 100644
|
| --- a/content/browser/devtools/devtools_frontend_host.cc
|
| +++ b/content/browser/devtools/devtools_frontend_host_impl.cc
|
| @@ -2,65 +2,48 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "content/browser/devtools/devtools_frontend_host.h"
|
| +#include "content/browser/devtools/devtools_frontend_host_impl.h"
|
|
|
| -#include "content/browser/devtools/devtools_manager_impl.h"
|
| -#include "content/browser/renderer_host/render_view_host_impl.h"
|
| -#include "content/browser/web_contents/web_contents_impl.h"
|
| #include "content/common/devtools_messages.h"
|
| -#include "content/public/browser/devtools_client_host.h"
|
| -#include "content/public/browser/devtools_frontend_host_delegate.h"
|
| +#include "content/public/browser/navigation_entry.h"
|
| +#include "content/public/browser/render_view_host.h"
|
| +#include "content/public/browser/web_contents.h"
|
|
|
| namespace content {
|
|
|
| // static
|
| -DevToolsClientHost* DevToolsClientHost::CreateDevToolsFrontendHost(
|
| - WebContents* client_web_contents,
|
| - DevToolsFrontendHostDelegate* delegate) {
|
| - return new DevToolsFrontendHost(
|
| - static_cast<WebContentsImpl*>(client_web_contents), delegate);
|
| +DevToolsFrontendHost* DevToolsFrontendHost::Create(
|
| + RenderViewHost* frontend_rvh,
|
| + DevToolsFrontendHost::Delegate* delegate) {
|
| + return new DevToolsFrontendHostImpl(frontend_rvh, delegate);
|
| }
|
|
|
| -// static
|
| -void DevToolsClientHost::SetupDevToolsFrontendClient(
|
| - RenderViewHost* frontend_rvh) {
|
| +DevToolsFrontendHostImpl::DevToolsFrontendHostImpl(
|
| + RenderViewHost* frontend_rvh,
|
| + DevToolsFrontendHost::Delegate* delegate)
|
| + : WebContentsObserver(WebContents::FromRenderViewHost(frontend_rvh)),
|
| + delegate_(delegate) {
|
| frontend_rvh->Send(new DevToolsMsg_SetupDevToolsClient(
|
| frontend_rvh->GetRoutingID()));
|
| }
|
|
|
| -DevToolsFrontendHost::DevToolsFrontendHost(
|
| - WebContentsImpl* web_contents,
|
| - DevToolsFrontendHostDelegate* delegate)
|
| - : WebContentsObserver(web_contents),
|
| - delegate_(delegate) {
|
| -}
|
| -
|
| -DevToolsFrontendHost::~DevToolsFrontendHost() {
|
| - DevToolsManager::GetInstance()->ClientHostClosing(this);
|
| +DevToolsFrontendHostImpl::~DevToolsFrontendHostImpl() {
|
| }
|
|
|
| -void DevToolsFrontendHost::DispatchOnInspectorFrontend(
|
| +void DevToolsFrontendHostImpl::DispatchOnDevToolsFrontend(
|
| const std::string& message) {
|
| if (!web_contents())
|
| return;
|
| - RenderViewHostImpl* target_host =
|
| - static_cast<RenderViewHostImpl*>(web_contents()->GetRenderViewHost());
|
| + RenderViewHost* target_host = web_contents()->GetRenderViewHost();
|
| target_host->Send(new DevToolsClientMsg_DispatchOnInspectorFrontend(
|
| target_host->GetRoutingID(),
|
| message));
|
| }
|
|
|
| -void DevToolsFrontendHost::InspectedContentsClosing() {
|
| - delegate_->InspectedContentsClosing();
|
| -}
|
| -
|
| -void DevToolsFrontendHost::ReplacedWithAnotherClient() {
|
| -}
|
| -
|
| -bool DevToolsFrontendHost::OnMessageReceived(
|
| +bool DevToolsFrontendHostImpl::OnMessageReceived(
|
| const IPC::Message& message) {
|
| bool handled = true;
|
| - IPC_BEGIN_MESSAGE_MAP(DevToolsFrontendHost, message)
|
| + IPC_BEGIN_MESSAGE_MAP(DevToolsFrontendHostImpl, message)
|
| IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend,
|
| OnDispatchOnInspectorBackend)
|
| IPC_MESSAGE_HANDLER(DevToolsHostMsg_DispatchOnEmbedder,
|
| @@ -70,27 +53,14 @@ bool DevToolsFrontendHost::OnMessageReceived(
|
| return handled;
|
| }
|
|
|
| -void DevToolsFrontendHost::RenderProcessGone(
|
| - base::TerminationStatus status) {
|
| - switch(status) {
|
| - case base::TERMINATION_STATUS_ABNORMAL_TERMINATION:
|
| - case base::TERMINATION_STATUS_PROCESS_WAS_KILLED:
|
| - case base::TERMINATION_STATUS_PROCESS_CRASHED:
|
| - DevToolsManager::GetInstance()->ClientHostClosing(this);
|
| - break;
|
| - default:
|
| - break;
|
| - }
|
| -}
|
| -
|
| -void DevToolsFrontendHost::OnDispatchOnInspectorBackend(
|
| +void DevToolsFrontendHostImpl::OnDispatchOnInspectorBackend(
|
| const std::string& message) {
|
| - DevToolsManagerImpl::GetInstance()->DispatchOnInspectorBackend(this, message);
|
| + delegate_->HandleMessageFromDevToolsFrontendToBackend(message);
|
| }
|
|
|
| -void DevToolsFrontendHost::OnDispatchOnEmbedder(
|
| +void DevToolsFrontendHostImpl::OnDispatchOnEmbedder(
|
| const std::string& message) {
|
| - delegate_->DispatchOnEmbedder(message);
|
| + delegate_->HandleMessageFromDevToolsFrontend(message);
|
| }
|
|
|
| } // namespace content
|
|
|