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

Unified Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 6288007: Prerendering for redirects -- part 2.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents.cc
===================================================================
--- chrome/browser/tab_contents/tab_contents.cc (revision 71841)
+++ chrome/browser/tab_contents/tab_contents.cc (working copy)
@@ -1635,6 +1635,10 @@
if (!is_error_page)
content_settings_delegate_->ClearCookieSpecificContentSettings();
content_settings_delegate_->ClearGeolocationContentSettings();
+
+ // Check if the URL we are about to load has been prerendered by any chance,
+ // and use it if possible.
+ MaybeUsePreloadedPage(url);
}
}
@@ -1649,6 +1653,10 @@
if (!entry || entry->url() != source_url)
return;
entry->set_url(target_url);
+
+ // Check if the URL we are about to load has been prerendered by any chance,
+ // and use it if possible.
+ MaybeUsePreloadedPage(target_url);
}
void TabContents::OnDidFailProvisionalLoadWithError(
@@ -2563,14 +2571,8 @@
int extra_invalidate_flags = 0;
if (PageTransition::IsMainFrame(params.transition)) {
- PrerenderManager* pm = profile()->GetPrerenderManager();
- if (pm != NULL) {
- if (pm->MaybeUsePreloadedPage(this, params.url)) {
- // TODO(tburkard): If the preloaded page has not finished preloading
- // yet, we should not do this.
- DidStopLoading();
- return;
- }
+ if (MaybeUsePreloadedPage(params.url)) {
+ return;
}
bool was_bookmark_bar_visible = ShouldShowBookmarkBar();
@@ -3378,3 +3380,16 @@
RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
rwh_view->SetSize(view()->GetContainerSize());
}
+
+bool TabContents::MaybeUsePreloadedPage(const GURL& url) {
+ PrerenderManager* pm = profile()->GetPrerenderManager();
+ if (pm != NULL) {
+ if (pm->MaybeUsePreloadedPage(this, url)) {
+ // TODO(tburkard): If the preloaded page has not finished preloading
+ // yet, we should not do this.
+ DidStopLoading();
+ return true;
+ }
+ }
+ return false;
+}
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698