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; |
+} |