From 1dc36b0297b9ead24edf000e9c96e74abdc277f4 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Tue, 26 Jun 2012 16:25:10 +0000 Subject: [PATCH] Update the DevTools URLs when a new RenderView is created (issue #639). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@712 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- libcef/browser/browser_host_impl.cc | 13 ++++++++++++- libcef/browser/browser_host_impl.h | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index 8c2c0d74e..56d8284eb 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -332,6 +332,7 @@ CefRefPtr CefBrowserHostImpl::GetClient() { } CefString CefBrowserHostImpl::GetDevToolsURL(bool http_scheme) { + base::AutoLock lock_scope(state_lock_); return (http_scheme ? devtools_url_http_ : devtools_url_chrome_); } @@ -1128,8 +1129,18 @@ void CefBrowserHostImpl::RequestMediaAccessPermission( void CefBrowserHostImpl::RenderViewCreated( content::RenderViewHost* render_view_host) { base::AutoLock lock_scope(state_lock_); + render_view_id_ = render_view_host->GetRoutingID(); render_process_id_ = render_view_host->GetProcess()->GetID(); + + // Update the DevTools URLs, if any. + CefDevToolsDelegate* devtools_delegate = _Context->devtools_delegate(); + if (devtools_delegate) { + devtools_url_http_ = devtools_delegate->GetDevToolsURL(render_view_host, + true); + devtools_url_chrome_ = devtools_delegate->GetDevToolsURL(render_view_host, + false); + } } void CefBrowserHostImpl::RenderViewReady() { @@ -1384,7 +1395,7 @@ CefBrowserHostImpl::CefBrowserHostImpl(const CefWindowInfo& window_info, placeholder_frame_ = new CefFrameHostImpl(this, CefFrameHostImpl::kInvalidFrameId, true); - // Retrieve the DevTools URL, if any. + // Retrieve the DevTools URLs, if any. CefDevToolsDelegate* devtools_delegate = _Context->devtools_delegate(); if (devtools_delegate) { devtools_url_http_ = devtools_delegate->GetDevToolsURL( diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index e5da02d74..d89d168bd 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -348,8 +348,6 @@ class CefBrowserHostImpl : public CefBrowserHost, CefRefPtr client_; scoped_ptr web_contents_; CefWindowHandle opener_; - CefString devtools_url_http_; - CefString devtools_url_chrome_; // Unique ids used for routing communication to/from the renderer. We keep a // copy of them as member variables so that we can locate matching browsers in @@ -375,6 +373,8 @@ class CefBrowserHostImpl : public CefBrowserHost, bool can_go_forward_; bool has_document_; GURL loading_url_; + CefString devtools_url_http_; + CefString devtools_url_chrome_; // Messages we queue while waiting for the RenderView to be ready. We queue // them here instead of in the RenderProcessHost to ensure that they're sent