| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/tab_contents/navigation_controller.h" | 5 #include "chrome/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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 last_committed_entry_index_ = entry_count() - 1; | 968 last_committed_entry_index_ = entry_count() - 1; |
| 969 if (pending_entry_index_ != -1) | 969 if (pending_entry_index_ != -1) |
| 970 pending_entry_index_ = entry_count() - 1; | 970 pending_entry_index_ = entry_count() - 1; |
| 971 if (transient_entry_index_ != -1) { | 971 if (transient_entry_index_ != -1) { |
| 972 // There's a transient entry. In this case we want the last committed to | 972 // There's a transient entry. In this case we want the last committed to |
| 973 // point to the previous entry. | 973 // point to the previous entry. |
| 974 transient_entry_index_ = entry_count() - 1; | 974 transient_entry_index_ = entry_count() - 1; |
| 975 if (last_committed_entry_index_ != -1) | 975 if (last_committed_entry_index_ != -1) |
| 976 last_committed_entry_index_--; | 976 last_committed_entry_index_--; |
| 977 } | 977 } |
| 978 | |
| 979 // Take over the session id from source. | |
| 980 session_id_ = source->session_id_; | |
| 981 | |
| 982 // Reset source's session id as we're taking it over. We give it a new id in | |
| 983 // case source is added later on, which can happen with instant enabled if the | |
| 984 // tab has a before unload handler. | |
| 985 source->session_id_ = SessionID(); | |
| 986 } | 978 } |
| 987 | 979 |
| 988 void NavigationController::PruneAllButActive() { | 980 void NavigationController::PruneAllButActive() { |
| 989 if (transient_entry_index_ != -1) { | 981 if (transient_entry_index_ != -1) { |
| 990 // There is a transient entry. Prune up to it. | 982 // There is a transient entry. Prune up to it. |
| 991 DCHECK_EQ(entry_count() - 1, transient_entry_index_); | 983 DCHECK_EQ(entry_count() - 1, transient_entry_index_); |
| 992 entries_.erase(entries_.begin(), entries_.begin() + transient_entry_index_); | 984 entries_.erase(entries_.begin(), entries_.begin() + transient_entry_index_); |
| 993 transient_entry_index_ = 0; | 985 transient_entry_index_ = 0; |
| 994 last_committed_entry_index_ = -1; | 986 last_committed_entry_index_ = -1; |
| 995 pending_entry_index_ = -1; | 987 pending_entry_index_ = -1; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 size_t insert_index = 0; | 1194 size_t insert_index = 0; |
| 1203 for (int i = 0; i < max_index; i++) { | 1195 for (int i = 0; i < max_index; i++) { |
| 1204 // When cloning a tab, copy all entries except interstitial pages | 1196 // When cloning a tab, copy all entries except interstitial pages |
| 1205 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { | 1197 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { |
| 1206 entries_.insert(entries_.begin() + insert_index++, | 1198 entries_.insert(entries_.begin() + insert_index++, |
| 1207 linked_ptr<NavigationEntry>( | 1199 linked_ptr<NavigationEntry>( |
| 1208 new NavigationEntry(*source.entries_[i]))); | 1200 new NavigationEntry(*source.entries_[i]))); |
| 1209 } | 1201 } |
| 1210 } | 1202 } |
| 1211 } | 1203 } |
| OLD | NEW |