Setup devtools client for the correct contents.

This commit is contained in:
Cheng Zhao 2014-02-24 10:09:32 +08:00
parent 618040efc1
commit 1f57994e2a

View file

@ -207,16 +207,16 @@ void NativeWindow::DebugDevTools() {
devtools_web_contents->GetRenderViewHost()); devtools_web_contents->GetRenderViewHost());
content::DevToolsClientHost* frontend_host = content::DevToolsClientHost* frontend_host =
content::DevToolsClientHost::CreateDevToolsFrontendHost( content::DevToolsClientHost::CreateDevToolsFrontendHost(
devtools_web_contents, window); window->GetWebContents(), window);
content::DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor( content::DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor(
agent_host, frontend_host); agent_host, frontend_host);
window->InitFromOptions(&options); window->InitFromOptions(&options);
window->GetWebContents()->GetController().LoadURL( window->GetWebContents()->GetController().LoadURL(
GURL("chrome-devtools://devtools/devtools.html"), GURL("chrome-devtools://devtools/devtools.html"),
content::Referrer(), content::Referrer(),
content::PAGE_TRANSITION_AUTO_TOPLEVEL, content::PAGE_TRANSITION_AUTO_TOPLEVEL,
std::string()); std::string());
} }
void NativeWindow::FocusOnWebView() { void NativeWindow::FocusOnWebView() {
@ -487,8 +487,8 @@ void NativeWindow::DispatchOnEmbedder(const std::string& message) {
} }
void NativeWindow::InspectedContentsClosing() { void NativeWindow::InspectedContentsClosing() {
// We are acting as devtools debugger, safe to delete here. // We are acting as devtools debugger, safe to close here.
delete this; CloseImmediately();
} }
void NativeWindow::OnCapturePageDone(const CapturePageCallback& callback, void NativeWindow::OnCapturePageDone(const CapturePageCallback& callback,