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
This commit is contained in:
Marshall Greenblatt 2012-06-26 16:25:10 +00:00
parent d13cc9de1c
commit 1dc36b0297
2 changed files with 14 additions and 3 deletions

View File

@ -332,6 +332,7 @@ CefRefPtr<CefClient> CefBrowserHostImpl::GetClient() {
} }
CefString CefBrowserHostImpl::GetDevToolsURL(bool http_scheme) { CefString CefBrowserHostImpl::GetDevToolsURL(bool http_scheme) {
base::AutoLock lock_scope(state_lock_);
return (http_scheme ? devtools_url_http_ : devtools_url_chrome_); return (http_scheme ? devtools_url_http_ : devtools_url_chrome_);
} }
@ -1128,8 +1129,18 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
void CefBrowserHostImpl::RenderViewCreated( void CefBrowserHostImpl::RenderViewCreated(
content::RenderViewHost* render_view_host) { content::RenderViewHost* render_view_host) {
base::AutoLock lock_scope(state_lock_); base::AutoLock lock_scope(state_lock_);
render_view_id_ = render_view_host->GetRoutingID(); render_view_id_ = render_view_host->GetRoutingID();
render_process_id_ = render_view_host->GetProcess()->GetID(); 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() { void CefBrowserHostImpl::RenderViewReady() {
@ -1384,7 +1395,7 @@ CefBrowserHostImpl::CefBrowserHostImpl(const CefWindowInfo& window_info,
placeholder_frame_ = placeholder_frame_ =
new CefFrameHostImpl(this, CefFrameHostImpl::kInvalidFrameId, true); new CefFrameHostImpl(this, CefFrameHostImpl::kInvalidFrameId, true);
// Retrieve the DevTools URL, if any. // Retrieve the DevTools URLs, if any.
CefDevToolsDelegate* devtools_delegate = _Context->devtools_delegate(); CefDevToolsDelegate* devtools_delegate = _Context->devtools_delegate();
if (devtools_delegate) { if (devtools_delegate) {
devtools_url_http_ = devtools_delegate->GetDevToolsURL( devtools_url_http_ = devtools_delegate->GetDevToolsURL(

View File

@ -348,8 +348,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefRefPtr<CefClient> client_; CefRefPtr<CefClient> client_;
scoped_ptr<content::WebContents> web_contents_; scoped_ptr<content::WebContents> web_contents_;
CefWindowHandle opener_; CefWindowHandle opener_;
CefString devtools_url_http_;
CefString devtools_url_chrome_;
// Unique ids used for routing communication to/from the renderer. We keep a // 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 // 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 can_go_forward_;
bool has_document_; bool has_document_;
GURL loading_url_; GURL loading_url_;
CefString devtools_url_http_;
CefString devtools_url_chrome_;
// Messages we queue while waiting for the RenderView to be ready. We queue // 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 // them here instead of in the RenderProcessHost to ensure that they're sent