OLD | NEW |
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 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 934 |
935 // Update the history in the RenderView. | 935 // Update the history in the RenderView. |
936 tab_contents_->SetHistoryLengthAndClear(max_source_index); | 936 // Note, I don't know if this makes sense if the active entry is transient. |
| 937 NavigationEntry* active_entry = GetActiveEntry(); |
| 938 if (!active_entry) { |
| 939 LOG(ERROR) << "!active_entry"; |
| 940 return; |
| 941 } |
| 942 tab_contents_->SetHistoryLengthAndClear(active_entry->site_instance(), |
| 943 max_source_index, |
| 944 active_entry->page_id()); |
937 } | 945 } |
938 | 946 |
939 void NavigationController::PruneAllButActive() { | 947 void NavigationController::PruneAllButActive() { |
940 if (transient_entry_index_ != -1) { | 948 if (transient_entry_index_ != -1) { |
941 // There is a transient entry. Prune up to it. | 949 // There is a transient entry. Prune up to it. |
942 DCHECK_EQ(entry_count() - 1, transient_entry_index_); | 950 DCHECK_EQ(entry_count() - 1, transient_entry_index_); |
943 entries_.erase(entries_.begin(), entries_.begin() + transient_entry_index_); | 951 entries_.erase(entries_.begin(), entries_.begin() + transient_entry_index_); |
944 transient_entry_index_ = 0; | 952 transient_entry_index_ = 0; |
945 last_committed_entry_index_ = -1; | 953 last_committed_entry_index_ = -1; |
946 pending_entry_index_ = -1; | 954 pending_entry_index_ = -1; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 size_t insert_index = 0; | 1179 size_t insert_index = 0; |
1172 for (int i = 0; i < max_index; i++) { | 1180 for (int i = 0; i < max_index; i++) { |
1173 // When cloning a tab, copy all entries except interstitial pages | 1181 // When cloning a tab, copy all entries except interstitial pages |
1174 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { | 1182 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { |
1175 entries_.insert(entries_.begin() + insert_index++, | 1183 entries_.insert(entries_.begin() + insert_index++, |
1176 linked_ptr<NavigationEntry>( | 1184 linked_ptr<NavigationEntry>( |
1177 new NavigationEntry(*source.entries_[i]))); | 1185 new NavigationEntry(*source.entries_[i]))); |
1178 } | 1186 } |
1179 } | 1187 } |
1180 } | 1188 } |
OLD | NEW |