| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/sessions/tab_restore_service_helper.h" | 5 #include "chrome/browser/sessions/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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 NavigationController* controller) { | 385 NavigationController* controller) { |
| 386 const int pending_index = controller->GetPendingEntryIndex(); | 386 const int pending_index = controller->GetPendingEntryIndex(); |
| 387 int entry_count = controller->GetEntryCount(); | 387 int entry_count = controller->GetEntryCount(); |
| 388 if (entry_count == 0 && pending_index == 0) | 388 if (entry_count == 0 && pending_index == 0) |
| 389 entry_count++; | 389 entry_count++; |
| 390 tab->navigations.resize(static_cast<int>(entry_count)); | 390 tab->navigations.resize(static_cast<int>(entry_count)); |
| 391 for (int i = 0; i < entry_count; ++i) { | 391 for (int i = 0; i < entry_count; ++i) { |
| 392 NavigationEntry* entry = (i == pending_index) ? | 392 NavigationEntry* entry = (i == pending_index) ? |
| 393 controller->GetPendingEntry() : controller->GetEntryAtIndex(i); | 393 controller->GetPendingEntry() : controller->GetEntryAtIndex(i); |
| 394 tab->navigations[i] = | 394 tab->navigations[i] = |
| 395 TabNavigation::FromNavigationEntry(i, *entry); | 395 components::SerializedNavigationEntry::FromNavigationEntry(i, *entry); |
| 396 } | 396 } |
| 397 tab->timestamp = TimeNow(); | 397 tab->timestamp = TimeNow(); |
| 398 tab->current_navigation_index = controller->GetCurrentEntryIndex(); | 398 tab->current_navigation_index = controller->GetCurrentEntryIndex(); |
| 399 if (tab->current_navigation_index == -1 && entry_count > 0) | 399 if (tab->current_navigation_index == -1 && entry_count > 0) |
| 400 tab->current_navigation_index = 0; | 400 tab->current_navigation_index = 0; |
| 401 tab->tabstrip_index = index; | 401 tab->tabstrip_index = index; |
| 402 | 402 |
| 403 extensions::TabHelper* extensions_tab_helper = | 403 extensions::TabHelper* extensions_tab_helper = |
| 404 extensions::TabHelper::FromWebContents(controller->GetWebContents()); | 404 extensions::TabHelper::FromWebContents(controller->GetWebContents()); |
| 405 // extensions_tab_helper is NULL in some browser tests. | 405 // extensions_tab_helper is NULL in some browser tests. |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 Tab* tab = static_cast<Tab*>(entry); | 561 Tab* tab = static_cast<Tab*>(entry); |
| 562 if (tab->browser_id == old_id) | 562 if (tab->browser_id == old_id) |
| 563 tab->browser_id = new_id; | 563 tab->browser_id = new_id; |
| 564 } | 564 } |
| 565 } | 565 } |
| 566 } | 566 } |
| 567 | 567 |
| 568 base::Time TabRestoreServiceHelper::TimeNow() const { | 568 base::Time TabRestoreServiceHelper::TimeNow() const { |
| 569 return time_factory_ ? time_factory_->TimeNow() : base::Time::Now(); | 569 return time_factory_ ? time_factory_->TimeNow() : base::Time::Now(); |
| 570 } | 570 } |
| OLD | NEW |