Fix devtools not working

This commit is contained in:
Cheng Zhao 2016-03-09 14:55:46 +09:00
parent d3a39540b5
commit ead0bb0cfc
3 changed files with 13 additions and 5 deletions

View file

@ -109,7 +109,6 @@ DevToolsDelegate::~DevToolsDelegate() {
} }
std::string DevToolsDelegate::GetDiscoveryPageHTML() { std::string DevToolsDelegate::GetDiscoveryPageHTML() {
LOG(WARNING) << IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE;
return ResourceBundle::GetSharedInstance().GetRawDataResource( return ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string(); IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string();
} }

View file

@ -251,10 +251,6 @@ void InspectableWebContentsImpl::ShowDevTools() {
devtools_web_contents_->SetDelegate(this); devtools_web_contents_->SetDelegate(this);
agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(web_contents_.get()); 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); agent_host_->AttachClient(this);
GURL devtools_url(base::StringPrintf(kChromeUIDevToolsURL, GURL devtools_url(base::StringPrintf(kChromeUIDevToolsURL,
@ -634,6 +630,16 @@ void InspectableWebContentsImpl::OnWebContentsFocused() {
#endif #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) { void InspectableWebContentsImpl::OnURLFetchComplete(const net::URLFetcher* source) {
DCHECK(source); DCHECK(source);
PendingRequestsMap::iterator it = pending_requests_.find(source); PendingRequestsMap::iterator it = pending_requests_.find(source);

View file

@ -130,6 +130,9 @@ class InspectableWebContentsImpl :
content::RenderFrameHost* new_host) override; content::RenderFrameHost* new_host) override;
void WebContentsDestroyed() override; void WebContentsDestroyed() override;
void OnWebContentsFocused() override; void OnWebContentsFocused() override;
void DidStartNavigationToPendingEntry(
const GURL& url,
content::NavigationController::ReloadType reload_type) override;
// content::WebContentsDelegate: // content::WebContentsDelegate:
bool AddMessageToConsole(content::WebContents* source, bool AddMessageToConsole(content::WebContents* source,