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

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

Issue 9416031: Prerendered pages are swapped in at browser::Navigate time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cleanup Created 8 years, 10 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
Index: chrome/browser/ui/browser_navigator.cc
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index 98b0395e954173af80c3a7be0e2c58f2ca943075..dfa2f0cac23653e67e2e4fd6dad5cc23d56c6519 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -16,6 +16,8 @@
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/prerender/prerender_manager.h"
+#include "chrome/browser/prerender/prerender_manager_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/rlz/rlz.h"
#include "chrome/browser/tab_contents/tab_util.h"
@@ -359,6 +361,17 @@ void InitializeExtraHeaders(browser::NavigateParams* params,
#endif
}
+bool SwapInPrerender(TabContentsWrapper* target_contents, const GURL& url) {
+ // See if there is a PrerenderManager and swap in then.
+ prerender::PrerenderManager* prerender_manager =
+ prerender::PrerenderManagerFactory::GetForProfile(
+ target_contents->profile());
+ if (!prerender_manager)
+ return false;
+ return prerender_manager->MaybeUsePrerenderedPage(
+ target_contents->web_contents(), url);
+}
+
} // namespace
namespace browser {
@@ -533,6 +546,10 @@ void Navigate(NavigateParams* params) {
InitializeExtraHeaders(params, params->target_contents->profile(),
&extra_headers);
+ if (SwapInPrerender(params->target_contents, url)) {
dominich 2012/02/28 16:21:00 nit: you don't need the {} here.
cbentzel 2012/02/29 18:16:13 Done.
+ return;
+ }
+
// Try to handle non-navigational URLs that popup dialogs and such, these
// should not actually navigate.
if (!HandleNonNavigationAboutURL(url)) {

Powered by Google App Engine
This is Rietveld 408576698