diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index c195c63dd424..b2af61d8f108 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -165,8 +165,9 @@ void InspectableWebContentsImpl::ShowDevTools() { devtools_web_contents_->SetDelegate(this); agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(web_contents_.get()); - content::DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor( - agent_host_, this); + frontend_host_.reset(content::DevToolsFrontendHost::Create( + web_contents_->GetRenderViewHost(), this)); + content::DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor(agent_host_, this); GURL devtools_url(kChromeUIDevToolsURL); devtools_web_contents_->GetController().LoadURL( @@ -323,6 +324,12 @@ void InspectableWebContentsImpl::InspectedContentsClosing() { void InspectableWebContentsImpl::ReplacedWithAnotherClient() { } +void InspectableWebContentsImpl::AboutToNavigateRenderView( + content::RenderViewHost* render_view_host) { + frontend_host_.reset(content::DevToolsFrontendHost::Create( + render_view_host, this)); +} + void InspectableWebContentsImpl::DidFinishLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url) { if (render_frame_host->GetParent()) diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index f0f40e872279..1e4ad995e445 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -102,8 +102,8 @@ class InspectableWebContentsImpl : virtual void HandleMessageFromDevToolsFrontend(const std::string& message) override; virtual void HandleMessageFromDevToolsFrontendToBackend(const std::string& message) override; - // content::WebContentsObserver - + // content::WebContentsObserver: + virtual void AboutToNavigateRenderView(content::RenderViewHost* render_view_host) override; virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url) OVERRIDE; virtual void WebContentsDestroyed() OVERRIDE; @@ -120,10 +120,10 @@ class InspectableWebContentsImpl : virtual void CloseContents(content::WebContents* source) OVERRIDE; scoped_ptr web_contents_; - scoped_ptr frontend_host_; scoped_ptr devtools_web_contents_; scoped_ptr view_; scoped_refptr agent_host_; + scoped_ptr frontend_host_; DevToolsContentsResizingStrategy contents_resizing_strategy_; gfx::Rect devtools_bounds_;