| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 } | 278 } |
| 279 | 279 |
| 280 NavigationEntry* NavigationController::GetActiveEntry() const { | 280 NavigationEntry* NavigationController::GetActiveEntry() const { |
| 281 if (transient_entry_index_ != -1) | 281 if (transient_entry_index_ != -1) |
| 282 return entries_[transient_entry_index_].get(); | 282 return entries_[transient_entry_index_].get(); |
| 283 if (pending_entry_) | 283 if (pending_entry_) |
| 284 return pending_entry_; | 284 return pending_entry_; |
| 285 return GetLastCommittedEntry(); | 285 return GetLastCommittedEntry(); |
| 286 } | 286 } |
| 287 | 287 |
| 288 NavigationEntry* NavigationController::GetVisibleEntry() const { |
| 289 if (transient_entry_index_ != -1) |
| 290 return entries_[transient_entry_index_].get(); |
| 291 // Only return pending_entry for new navigations. |
| 292 if (pending_entry_ && pending_entry_->page_id() == -1) |
| 293 return pending_entry_; |
| 294 return GetLastCommittedEntry(); |
| 295 } |
| 296 |
| 288 int NavigationController::GetCurrentEntryIndex() const { | 297 int NavigationController::GetCurrentEntryIndex() const { |
| 289 if (transient_entry_index_ != -1) | 298 if (transient_entry_index_ != -1) |
| 290 return transient_entry_index_; | 299 return transient_entry_index_; |
| 291 if (pending_entry_index_ != -1) | 300 if (pending_entry_index_ != -1) |
| 292 return pending_entry_index_; | 301 return pending_entry_index_; |
| 293 return last_committed_entry_index_; | 302 return last_committed_entry_index_; |
| 294 } | 303 } |
| 295 | 304 |
| 296 NavigationEntry* NavigationController::GetLastCommittedEntry() const { | 305 NavigationEntry* NavigationController::GetLastCommittedEntry() const { |
| 297 if (last_committed_entry_index_ == -1) | 306 if (last_committed_entry_index_ == -1) |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 size_t insert_index = 0; | 1199 size_t insert_index = 0; |
| 1191 for (int i = 0; i < max_index; i++) { | 1200 for (int i = 0; i < max_index; i++) { |
| 1192 // When cloning a tab, copy all entries except interstitial pages | 1201 // When cloning a tab, copy all entries except interstitial pages |
| 1193 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { | 1202 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { |
| 1194 entries_.insert(entries_.begin() + insert_index++, | 1203 entries_.insert(entries_.begin() + insert_index++, |
| 1195 linked_ptr<NavigationEntry>( | 1204 linked_ptr<NavigationEntry>( |
| 1196 new NavigationEntry(*source.entries_[i]))); | 1205 new NavigationEntry(*source.entries_[i]))); |
| 1197 } | 1206 } |
| 1198 } | 1207 } |
| 1199 } | 1208 } |
| OLD | NEW |