diff options
author | davidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-14 01:09:22 +0000 |
---|---|---|
committer | davidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-14 01:09:22 +0000 |
commit | a5f730d5b6728c63c6ec81aeaa81e482bddea834 (patch) | |
tree | 56f4ec253c4abeb9811793cc99c85b842d655d98 | |
parent | 50ec6b2327b4e43fed158adc63d905990a0e040b (diff) | |
download | chromium_src-a5f730d5b6728c63c6ec81aeaa81e482bddea834.zip chromium_src-a5f730d5b6728c63c6ec81aeaa81e482bddea834.tar.gz chromium_src-a5f730d5b6728c63c6ec81aeaa81e482bddea834.tar.bz2 |
Hook prerender into non-CURRENT_TAB dispositions.
SwapInternal checks if CoreTabHelper::delegate is NULL now, and a
non-CURRENT_TAB disposition would require the asynchronous codepath anyway, so
it's fine that the WebContents is still to be attached.
BUG=345474
Review URL: https://codereview.chromium.org/261623004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270278 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/prerender/prerender_browsertest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/browser_navigator.cc | 21 |
2 files changed, 11 insertions, 16 deletions
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index 20b9df5..d6ab807 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc @@ -3254,7 +3254,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNewWindow) { // Prerender currently doesn't interpose on this navigation. // http://crbug.com/345474. PrerenderTestURL("files/prerender/prerender_page_with_link.html", - FINAL_STATUS_APP_TERMINATING, + FINAL_STATUS_USED, 1); OpenDestURLViaClickNewWindow(); } @@ -3263,7 +3263,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNewForegroundTab) { // Prerender currently doesn't interpose on this navigation. // http://crbug.com/345474. PrerenderTestURL("files/prerender/prerender_page_with_link.html", - FINAL_STATUS_APP_TERMINATING, + FINAL_STATUS_USED, 1); OpenDestURLViaClickNewForegroundTab(); } @@ -3273,7 +3273,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNewBackgroundTab) { // http://crbug.com/345474. scoped_ptr<TestPrerender> prerender = PrerenderTestURL("files/prerender/prerender_page_with_link.html", - FINAL_STATUS_APP_TERMINATING, + FINAL_STATUS_USED, 1); ASSERT_TRUE(prerender->contents()); prerender->contents()->set_should_be_shown(false); diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index 39cf2b5..24eaed8 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc @@ -612,21 +612,16 @@ void Navigate(NavigateParams* params) { // same as the source. DCHECK(params->source_contents); params->target_contents = params->source_contents; - DCHECK(params->target_contents); - // Prerender expects |params->target_contents| to be attached to a browser - // window, so only call for CURRENT_TAB navigations. (Others are currently - // unsupported because of session storage namespaces anyway.) - // Notice that this includes middle-clicking, since middle clicking - // translates into a chrome::Navigate call with no URL followed by a - // CURRENT_TAB navigation. - // TODO(tburkard): We can actually swap in in non-CURRENT_TAB cases, as - // long as the WebContents we swap into is part of a TabStrip model. - // Therefore, we should swap in regardless of CURRENT_TAB, and instead, - // check in the swapin function whether the WebContents is not in a - // TabStrip model, in which case we must not swap in. - swapped_in_prerender = SwapInPrerender(url, params); } + // Note: at this point, if |params->disposition| is not CURRENT_TAB, + // |params->target_contents| has not been attached to a Browser yet. (That + // happens later in this function.) However, in that case, the + // sessionStorage namespace could not match, so prerender will use the + // asynchronous codepath and still swap. + DCHECK(params->target_contents); + swapped_in_prerender = SwapInPrerender(url, params); + if (user_initiated) params->target_contents->UserGestureDone(); |