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

Unified Diff: chrome/browser/prerender/prerender_contents.cc

Issue 7618016: Additional fixes for prerender/instant + browsing history. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Wrong signature Created 9 years, 4 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/prerender/prerender_contents.cc
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc
index 23be43dba3771000af4cd146efa123f44ea0fb19..c659c64895330e04fd9fc632244734b26a1ca89d 100644
--- a/chrome/browser/prerender/prerender_contents.cc
+++ b/chrome/browser/prerender/prerender_contents.cc
@@ -88,17 +88,27 @@ class PrerenderContents::TabContentsDelegateImpl
return false;
}
- bool CanDownload(TabContents* source, int request_id) OVERRIDE {
+ virtual bool CanDownload(TabContents* source, int request_id) OVERRIDE {
prerender_contents_->Destroy(FINAL_STATUS_DOWNLOAD);
// Cancel the download.
return false;
}
- void OnStartDownload(TabContents* source, DownloadItem* download) OVERRIDE {
+ virtual void OnStartDownload(TabContents* source,
+ DownloadItem* download) OVERRIDE {
// Prerendered pages should never be able to download files.
NOTREACHED();
}
+ virtual bool OnGoToEntryOffset(int offset) OVERRIDE {
+ // This isn't allowed because the history merge operation
+ // does not work if there are renderer issued challenges.
+ // TODO(cbentzel): Cancel in this case? May not need to do
+ // since render-issued offset navigations are not guaranteed,
+ // but indicates that the page cares about the history.
+ return false;
+ }
+
// Commits the History of Pages to the given TabContents.
void CommitHistory(TabContentsWrapper* tab) {
for (size_t i = 0; i < add_page_vector_.size(); ++i)
@@ -602,4 +612,13 @@ Value* PrerenderContents::GetAsValue() const {
return dict_value;
}
+bool PrerenderContents::IsCrossSiteNavigationPending() const {
+ if (!prerender_contents_.get() || !prerender_contents_->tab_contents())
+ return false;
+ const TabContents* tab_contents = prerender_contents_->tab_contents();
+ return (tab_contents->GetSiteInstance() !=
+ tab_contents->GetPendingSiteInstance());
+}
+
+
} // namespace prerender

Powered by Google App Engine
This is Rietveld 408576698