Commit a4971c13 authored by mariakhomenko's avatar mariakhomenko Committed by Commit bot

Allow asynchronous tab creation when opener_suppressed is true.

On Android, when merge tabs and apps is enabled, we need to ensure a new
activity has been started before loading URL in web contents since the
web contents delegate is not ready until then.

We already have a code path to handle this for window.open() scenario.
This completes the code path for when a link with noreferrer is clicked
by saving OpenURLParams of the pending load and resuming the load when
the activity is ready.

BUG=508366

Review URL: https://codereview.chromium.org/1233453003

Cr-Commit-Position: refs/heads/master@{#339711}
parent 8fa468ef
...@@ -1767,7 +1767,15 @@ void WebContentsImpl::CreateNewWindow( ...@@ -1767,7 +1767,15 @@ void WebContentsImpl::CreateNewWindow(
ui::PAGE_TRANSITION_LINK, ui::PAGE_TRANSITION_LINK,
true /* is_renderer_initiated */); true /* is_renderer_initiated */);
open_params.user_gesture = params.user_gesture; open_params.user_gesture = params.user_gesture;
new_contents->OpenURL(open_params);
if (delegate_ && !is_guest &&
!delegate_->ShouldResumeRequestsForCreatedWindow()) {
// We are in asynchronous add new contents path, delay opening url
new_contents->delayed_open_url_params_.reset(
new OpenURLParams(open_params));
} else {
new_contents->OpenURL(open_params);
}
} }
} }
} }
...@@ -2691,6 +2699,12 @@ void WebContentsImpl::ExitFullscreen() { ...@@ -2691,6 +2699,12 @@ void WebContentsImpl::ExitFullscreen() {
} }
void WebContentsImpl::ResumeLoadingCreatedWebContents() { void WebContentsImpl::ResumeLoadingCreatedWebContents() {
if (delayed_open_url_params_.get()) {
OpenURL(*delayed_open_url_params_.get());
delayed_open_url_params_.reset(nullptr);
return;
}
// Resume blocked requests for both the RenderViewHost and RenderFrameHost. // Resume blocked requests for both the RenderViewHost and RenderFrameHost.
// TODO(brettw): It seems bogus to reach into here and initialize the host. // TODO(brettw): It seems bogus to reach into here and initialize the host.
if (is_resume_pending_) { if (is_resume_pending_) {
......
...@@ -1254,6 +1254,10 @@ class CONTENT_EXPORT WebContentsImpl ...@@ -1254,6 +1254,10 @@ class CONTENT_EXPORT WebContentsImpl
// different process from its parent page. // different process from its parent page.
bool is_subframe_; bool is_subframe_;
// When a new tab is created asynchronously, stores the OpenURLParams needed
// to continue loading the page once the tab is ready.
scoped_ptr<OpenURLParams> delayed_open_url_params_;
// Whether overscroll should be unconditionally disabled. // Whether overscroll should be unconditionally disabled.
bool force_disable_overscroll_content_; bool force_disable_overscroll_content_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment