From ead0bb0cfc1ce7c2a10c598840408c65e41e3045 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 9 Mar 2016 14:55:46 +0900 Subject: [PATCH] Fix devtools not working --- brightray/browser/devtools_manager_delegate.cc | 1 - brightray/browser/inspectable_web_contents_impl.cc | 14 ++++++++++---- brightray/browser/inspectable_web_contents_impl.h | 3 +++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/brightray/browser/devtools_manager_delegate.cc b/brightray/browser/devtools_manager_delegate.cc index cf266f0181..155f35728d 100644 --- a/brightray/browser/devtools_manager_delegate.cc +++ b/brightray/browser/devtools_manager_delegate.cc @@ -109,7 +109,6 @@ DevToolsDelegate::~DevToolsDelegate() { } std::string DevToolsDelegate::GetDiscoveryPageHTML() { - LOG(WARNING) << IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE; return ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string(); } diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 5afff01ff6..4065053b1a 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -251,10 +251,6 @@ void InspectableWebContentsImpl::ShowDevTools() { devtools_web_contents_->SetDelegate(this); agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(web_contents_.get()); - frontend_host_.reset(content::DevToolsFrontendHost::Create( - web_contents_->GetMainFrame(), - base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend, - base::Unretained(this)))); agent_host_->AttachClient(this); GURL devtools_url(base::StringPrintf(kChromeUIDevToolsURL, @@ -634,6 +630,16 @@ void InspectableWebContentsImpl::OnWebContentsFocused() { #endif } +void InspectableWebContentsImpl::DidStartNavigationToPendingEntry( + const GURL& url, + content::NavigationController::ReloadType reload_type) { + frontend_host_.reset( + content::DevToolsFrontendHost::Create( + web_contents()->GetMainFrame(), + base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend, + base::Unretained(this)))); +} + void InspectableWebContentsImpl::OnURLFetchComplete(const net::URLFetcher* source) { DCHECK(source); PendingRequestsMap::iterator it = pending_requests_.find(source); diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index e4a964adf0..1e2bab8a26 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -130,6 +130,9 @@ class InspectableWebContentsImpl : content::RenderFrameHost* new_host) override; void WebContentsDestroyed() override; void OnWebContentsFocused() override; + void DidStartNavigationToPendingEntry( + const GURL& url, + content::NavigationController::ReloadType reload_type) override; // content::WebContentsDelegate: bool AddMessageToConsole(content::WebContents* source,