Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(991)

Unified Diff: chrome/browser/ui/browser_navigator.cc

Issue 261623004: Hook prerender into non-CURRENT_TAB dispositions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_navigator.cc
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index 2d65644d9c921d2d1955c7308b7f605b96820010..8df9bb505404b4b3e3c39647a02d902ea777aff3 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -613,21 +613,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();
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698