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

Side by Side Diff: content/browser/tab_contents/navigation_controller.cc

Issue 7491096: Fix regression with back-button not working on prerendered and instant pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A few fixes for multiple history entries at swap in 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/tab_contents/navigation_controller.h" 5 #include "content/browser/tab_contents/navigation_controller.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 last_committed_entry_index_ = entry_count() - 1; 924 last_committed_entry_index_ = entry_count() - 1;
925 if (pending_entry_index_ != -1) 925 if (pending_entry_index_ != -1)
926 pending_entry_index_ = entry_count() - 1; 926 pending_entry_index_ = entry_count() - 1;
927 if (transient_entry_index_ != -1) { 927 if (transient_entry_index_ != -1) {
928 // There's a transient entry. In this case we want the last committed to 928 // There's a transient entry. In this case we want the last committed to
929 // point to the previous entry. 929 // point to the previous entry.
930 transient_entry_index_ = entry_count() - 1; 930 transient_entry_index_ = entry_count() - 1;
931 if (last_committed_entry_index_ != -1) 931 if (last_committed_entry_index_ != -1)
932 last_committed_entry_index_--; 932 last_committed_entry_index_--;
933 } 933 }
934
935 // Update the history in the RenderView.
936 tab_contents_->SetHistoryLengthAndClear(max_source_index);
934 } 937 }
935 938
936 void NavigationController::PruneAllButActive() { 939 void NavigationController::PruneAllButActive() {
937 if (transient_entry_index_ != -1) { 940 if (transient_entry_index_ != -1) {
938 // There is a transient entry. Prune up to it. 941 // There is a transient entry. Prune up to it.
939 DCHECK_EQ(entry_count() - 1, transient_entry_index_); 942 DCHECK_EQ(entry_count() - 1, transient_entry_index_);
940 entries_.erase(entries_.begin(), entries_.begin() + transient_entry_index_); 943 entries_.erase(entries_.begin(), entries_.begin() + transient_entry_index_);
941 transient_entry_index_ = 0; 944 transient_entry_index_ = 0;
942 last_committed_entry_index_ = -1; 945 last_committed_entry_index_ = -1;
943 pending_entry_index_ = -1; 946 pending_entry_index_ = -1;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 size_t insert_index = 0; 1171 size_t insert_index = 0;
1169 for (int i = 0; i < max_index; i++) { 1172 for (int i = 0; i < max_index; i++) {
1170 // When cloning a tab, copy all entries except interstitial pages 1173 // When cloning a tab, copy all entries except interstitial pages
1171 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { 1174 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) {
1172 entries_.insert(entries_.begin() + insert_index++, 1175 entries_.insert(entries_.begin() + insert_index++,
1173 linked_ptr<NavigationEntry>( 1176 linked_ptr<NavigationEntry>(
1174 new NavigationEntry(*source.entries_[i]))); 1177 new NavigationEntry(*source.entries_[i])));
1175 } 1178 }
1176 } 1179 }
1177 } 1180 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698