summaryrefslogtreecommitdiffstats
path: root/chrome/browser/instant
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-21 14:10:31 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-21 14:10:31 +0000
commit43032341d6eef556c3bb0001c9e859e635a5c0ee (patch)
tree60ea8cd3eb84bc0f5f5140d743b27742cb70ccfe /chrome/browser/instant
parentf1d16d4ab48f8457d2d4c69476e28499c860c488 (diff)
downloadchromium_src-43032341d6eef556c3bb0001c9e859e635a5c0ee.zip
chromium_src-43032341d6eef556c3bb0001c9e859e635a5c0ee.tar.gz
chromium_src-43032341d6eef556c3bb0001c9e859e635a5c0ee.tar.bz2
Makes instant throw out the first navigation when merging navigation
stacks. This is because the first navigation is for the home page, and generally we don't want that in the navigation stack. I kept the remove first entry functionality in CopyStateFromAndPrune as its easy to use wrong and I don't want to open up a general API. BUG=74945 TEST=see bug R=brettw@chromium.org Review URL: http://codereview.chromium.org/6709039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78880 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/instant')
-rw-r--r--chrome/browser/instant/instant_controller.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index c7b7494..4949783 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -234,7 +234,18 @@ bool InstantController::IsCurrent() {
void InstantController::CommitCurrentPreview(InstantCommitType type) {
DCHECK(loader_manager_.get());
DCHECK(loader_manager_->current_loader());
+ bool showing_instant =
+ loader_manager_->current_loader()->is_showing_instant();
TabContentsWrapper* tab = ReleasePreviewContents(type);
+ // If the loader was showing an instant page then it's navigation stack is
+ // something like: search-engine-home-page (eg google.com) search-term1
+ // search-term2 .... Each search-term navigation corresponds to the page
+ // deciding enough time has passed to commit a navigation. We don't want the
+ // searche-engine-home-page navigation in this case so we pass true to
+ // CopyStateFromAndPrune to have the search-engine-home-page navigation
+ // removed.
+ tab->controller().CopyStateFromAndPrune(
+ &tab_contents_->controller(), showing_instant);
delegate_->CommitInstant(tab);
CompleteRelease(tab->tab_contents());
}