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

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

Issue 49003011: Handle should_replace_current_entry in prerender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: content::kAboutBlankURL Created 7 years 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_manager.h ('k') | chrome/browser/ui/browser_instant_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_manager.cc
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc
index deba1a9e095e3d9b3c9de9abacad01f91baeeae4..90696676ba35cce70acfa6deef708a0f73e7d4bd 100644
--- a/chrome/browser/prerender/prerender_manager.cc
+++ b/chrome/browser/prerender/prerender_manager.cc
@@ -494,7 +494,8 @@ bool PrerenderManager::MaybeUsePrerenderedPage(const GURL& url,
RecordEvent(prerender_data->contents(),
PRERENDER_EVENT_SWAPIN_ISSUING_MERGE);
prerender_data->set_pending_swap(new PendingSwap(
- this, web_contents, prerender_data, url));
+ this, web_contents, prerender_data, url,
+ params->should_replace_current_entry));
prerender_data->pending_swap()->BeginSwap();
// Although this returns false, creating a PendingSwap registers with
// PrerenderTracker to throttle MAIN_FRAME navigations while the swap is
@@ -503,8 +504,9 @@ bool PrerenderManager::MaybeUsePrerenderedPage(const GURL& url,
}
// No need to merge; swap synchronously.
- WebContents* new_web_contents = SwapInternal(url, web_contents,
- prerender_data);
+ WebContents* new_web_contents = SwapInternal(
+ url, web_contents, prerender_data,
+ params->should_replace_current_entry);
if (!new_web_contents)
return false;
@@ -516,7 +518,8 @@ bool PrerenderManager::MaybeUsePrerenderedPage(const GURL& url,
WebContents* PrerenderManager::SwapInternal(
const GURL& url,
WebContents* web_contents,
- PrerenderData* prerender_data) {
+ PrerenderData* prerender_data,
+ bool should_replace_current_entry) {
DCHECK(CalledOnValidThread());
DCHECK(!IsWebContentsPrerendering(web_contents, NULL));
@@ -648,7 +651,8 @@ WebContents* PrerenderManager::SwapInternal(
// Merge the browsing history.
new_web_contents->GetController().CopyStateFromAndPrune(
- &old_web_contents->GetController());
+ &old_web_contents->GetController(),
+ should_replace_current_entry);
CoreTabHelper::FromWebContents(old_web_contents)->delegate()->
SwapTabContents(old_web_contents, new_web_contents);
prerender_contents->CommitHistory(new_web_contents);
@@ -1158,12 +1162,14 @@ PrerenderManager::PendingSwap::PendingSwap(
PrerenderManager* manager,
content::WebContents* target_contents,
PrerenderData* prerender_data,
- const GURL& url)
+ const GURL& url,
+ bool should_replace_current_entry)
: content::WebContentsObserver(target_contents),
manager_(manager),
target_contents_(target_contents),
prerender_data_(prerender_data),
url_(url),
+ should_replace_current_entry_(should_replace_current_entry),
start_time_(base::TimeTicks::Now()),
swap_successful_(false),
weak_factory_(this) {
@@ -1300,7 +1306,8 @@ void PrerenderManager::PendingSwap::OnMergeCompleted(
// TODO(davidben): See about deleting PrerenderData asynchronously so this
// behavior is more reasonable.
WebContents* new_web_contents =
- manager_->SwapInternal(GURL(url_), target_contents_, prerender_data_);
+ manager_->SwapInternal(GURL(url_), target_contents_, prerender_data_,
+ should_replace_current_entry_);
if (!new_web_contents) {
RecordEvent(PRERENDER_EVENT_MERGE_RESULT_SWAPIN_FAILED);
prerender_data_->ClearPendingSwap();
« no previous file with comments | « chrome/browser/prerender/prerender_manager.h ('k') | chrome/browser/ui/browser_instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698