Merge revision 1413 changes:

- Fix loading of popup windows with a newly created render process (issue #1057).

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1547@1414 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2013-08-27 18:20:05 +00:00
parent 30f6f3bf09
commit 1ac1250005
3 changed files with 36 additions and 26 deletions

View File

@ -305,8 +305,10 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
CefRefPtr<CefBrowserHostImpl> browser = CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::Create(windowInfo, new_settings, client, NULL, info, CefBrowserHostImpl::Create(windowInfo, new_settings, client, NULL, info,
NULL); NULL);
if (!url.empty()) if (!url.empty()) {
browser->LoadURL(CefFrameHostImpl::kMainFrameId, url); browser->LoadURL(CefFrameHostImpl::kMainFrameId, url, content::Referrer(),
content::PAGE_TRANSITION_TYPED, std::string());
}
return browser.get(); return browser.get();
} }
@ -1193,7 +1195,12 @@ void CefBrowserHostImpl::LoadRequest(int64 frame_id,
Navigate(params); Navigate(params);
} }
void CefBrowserHostImpl::LoadURL(int64 frame_id, const std::string& url) { void CefBrowserHostImpl::LoadURL(
int64 frame_id,
const std::string& url,
const content::Referrer& referrer,
content::PageTransition transition,
const std::string& extra_headers) {
if (frame_id == CefFrameHostImpl::kMainFrameId) { if (frame_id == CefFrameHostImpl::kMainFrameId) {
// Go through the navigation controller. // Go through the navigation controller.
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {
@ -1217,18 +1224,21 @@ void CefBrowserHostImpl::LoadURL(int64 frame_id, const std::string& url) {
web_contents_->GetController().LoadURL( web_contents_->GetController().LoadURL(
gurl, gurl,
content::Referrer(), referrer,
content::PAGE_TRANSITION_TYPED, transition,
std::string()); extra_headers);
OnSetFocus(FOCUS_SOURCE_NAVIGATION); OnSetFocus(FOCUS_SOURCE_NAVIGATION);
} }
} else { } else {
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::LoadURL, this, frame_id, url)); base::Bind(&CefBrowserHostImpl::LoadURL, this, frame_id, url,
referrer, transition, extra_headers));
} }
} else { } else {
CefNavigateParams params(GURL(url), content::PAGE_TRANSITION_TYPED); CefNavigateParams params(GURL(url), transition);
params.frame_id = frame_id; params.frame_id = frame_id;
params.referrer = referrer;
params.headers = extra_headers;
Navigate(params); Navigate(params);
} }
} }
@ -1437,17 +1447,10 @@ void CefBrowserHostImpl::HandleKeyEventAfterTextInputClient(
content::WebContents* CefBrowserHostImpl::OpenURLFromTab( content::WebContents* CefBrowserHostImpl::OpenURLFromTab(
content::WebContents* source, content::WebContents* source,
const content::OpenURLParams& params) { const content::OpenURLParams& params) {
// Start the new navigation. // Start a navigation that will result in the creation of a new render
CefNavigateParams nav_params(params.url, params.transition); // process.
nav_params.referrer = params.referrer; LoadURL(CefFrameHostImpl::kMainFrameId, params.url.spec(), params.referrer,
nav_params.frame_id = params.source_frame_id; params.transition, params.extra_headers);
nav_params.disposition = params.disposition;
nav_params.user_gesture = true;
nav_params.override_encoding = params.override_encoding;
nav_params.is_renderer_initiated = params.is_renderer_initiated;
nav_params.transferred_global_request_id =
params.transferred_global_request_id;
Navigate(nav_params);
return source; return source;
} }
@ -1650,9 +1653,10 @@ bool CefBrowserHostImpl::ShouldCreateWebContents(
WindowContainerType window_container_type, WindowContainerType window_container_type,
const string16& frame_name, const string16& frame_name,
const GURL& target_url) { const GURL& target_url) {
CefContentBrowserClient::Get()->GetOrCreateBrowserInfo( // In cases where the navigation will occur in a new render process the
web_contents->GetRenderProcessHost()->GetID(), route_id); // |route_id| value will be MSG_ROUTING_NONE here (because the existing
// renderer will not be able to communicate with the new renderer) and
// OpenURLFromTab will be called after WebContentsCreated.
base::AutoLock lock_scope(pending_popup_info_lock_); base::AutoLock lock_scope(pending_popup_info_lock_);
DCHECK(pending_popup_info_.get()); DCHECK(pending_popup_info_.get());
_Context->browser_context()->set_use_osr_next_contents_view( _Context->browser_context()->set_use_osr_next_contents_view(
@ -1676,7 +1680,7 @@ void CefBrowserHostImpl::WebContentsCreated(
CefWindowHandle opener = NULL; CefWindowHandle opener = NULL;
scoped_refptr<CefBrowserInfo> info = scoped_refptr<CefBrowserInfo> info =
CefContentBrowserClient::Get()->GetBrowserInfo( CefContentBrowserClient::Get()->GetOrCreateBrowserInfo(
new_contents->GetRenderProcessHost()->GetID(), new_contents->GetRenderProcessHost()->GetID(),
new_contents->GetRoutingID()); new_contents->GetRoutingID());

View File

@ -202,7 +202,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
void LoadRequest(int64 frame_id, CefRefPtr<CefRequest> request); void LoadRequest(int64 frame_id, CefRefPtr<CefRequest> request);
// Load the specified URL. // Load the specified URL.
void LoadURL(int64 frame_id, const std::string& url); void LoadURL(int64 frame_id,
const std::string& url,
const content::Referrer& referrer,
content::PageTransition transition,
const std::string& extra_headers);
// Load the specified string. // Load the specified string.
void LoadString(int64 frame_id, const std::string& string, void LoadString(int64 frame_id, const std::string& string,

View File

@ -135,8 +135,10 @@ void CefFrameHostImpl::LoadURL(const CefString& url) {
frame_id = (is_main_frame_ ? kMainFrameId : frame_id_); frame_id = (is_main_frame_ ? kMainFrameId : frame_id_);
} }
if (browser) if (browser) {
browser->LoadURL(frame_id, url); browser->LoadURL(frame_id, url, content::Referrer(),
content::PAGE_TRANSITION_TYPED, std::string());
}
} }
void CefFrameHostImpl::LoadString(const CefString& string, void CefFrameHostImpl::LoadString(const CefString& string,