| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "components/sessions/core/tab_restore_service_helper.h" | 5 #include "components/sessions/core/tab_restore_service_helper.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 NOTREACHED(); | 354 NOTREACHED(); |
| 355 return false; | 355 return false; |
| 356 } | 356 } |
| 357 | 357 |
| 358 void TabRestoreServiceHelper::PopulateTab(Tab* tab, | 358 void TabRestoreServiceHelper::PopulateTab(Tab* tab, |
| 359 int index, | 359 int index, |
| 360 LiveTabContext* context, | 360 LiveTabContext* context, |
| 361 LiveTab* live_tab) { | 361 LiveTab* live_tab) { |
| 362 const int pending_index = live_tab->GetPendingEntryIndex(); | 362 const int pending_index = live_tab->GetPendingEntryIndex(); |
| 363 int entry_count = | 363 int entry_count = |
| 364 live_tab->IsInitialNavigation() ? 0 : live_tab->GetEntryCount(); | 364 live_tab->IsInitialBlankNavigation() ? 0 : live_tab->GetEntryCount(); |
| 365 if (entry_count == 0 && pending_index == 0) | 365 if (entry_count == 0 && pending_index == 0) |
| 366 entry_count++; | 366 entry_count++; |
| 367 tab->navigations.resize(static_cast<int>(entry_count)); | 367 tab->navigations.resize(static_cast<int>(entry_count)); |
| 368 for (int i = 0; i < entry_count; ++i) { | 368 for (int i = 0; i < entry_count; ++i) { |
| 369 SerializedNavigationEntry entry = (i == pending_index) | 369 SerializedNavigationEntry entry = (i == pending_index) |
| 370 ? live_tab->GetPendingEntry() | 370 ? live_tab->GetPendingEntry() |
| 371 : live_tab->GetEntryAtIndex(i); | 371 : live_tab->GetEntryAtIndex(i); |
| 372 tab->navigations[i] = entry; | 372 tab->navigations[i] = entry; |
| 373 } | 373 } |
| 374 tab->timestamp = TimeNow(); | 374 tab->timestamp = TimeNow(); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 tab->browser_id = new_id; | 525 tab->browser_id = new_id; |
| 526 } | 526 } |
| 527 } | 527 } |
| 528 } | 528 } |
| 529 | 529 |
| 530 base::Time TabRestoreServiceHelper::TimeNow() const { | 530 base::Time TabRestoreServiceHelper::TimeNow() const { |
| 531 return time_factory_ ? time_factory_->TimeNow() : base::Time::Now(); | 531 return time_factory_ ? time_factory_->TimeNow() : base::Time::Now(); |
| 532 } | 532 } |
| 533 | 533 |
| 534 } // namespace sessions | 534 } // namespace sessions |
| OLD | NEW |