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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 if (observer_) | 127 if (observer_) |
128 observer_->OnClearEntries(); | 128 observer_->OnClearEntries(); |
129 STLDeleteElements(&entries_); | 129 STLDeleteElements(&entries_); |
130 NotifyTabsChanged(); | 130 NotifyTabsChanged(); |
131 } | 131 } |
132 | 132 |
133 const TabRestoreService::Entries& TabRestoreServiceHelper::entries() const { | 133 const TabRestoreService::Entries& TabRestoreServiceHelper::entries() const { |
134 return entries_; | 134 return entries_; |
135 } | 135 } |
136 | 136 |
| 137 TabRestoreService::Entry* TabRestoreServiceHelper::GetMostRecentEntry() { |
| 138 return entries_.front(); |
| 139 } |
| 140 |
137 std::vector<LiveTab*> TabRestoreServiceHelper::RestoreMostRecentEntry( | 141 std::vector<LiveTab*> TabRestoreServiceHelper::RestoreMostRecentEntry( |
138 LiveTabContext* context) { | 142 LiveTabContext* context) { |
139 if (entries_.empty()) | 143 if (entries_.empty()) |
140 return std::vector<LiveTab*>(); | 144 return std::vector<LiveTab*>(); |
141 | 145 |
142 return RestoreEntryById(context, entries_.front()->id, UNKNOWN); | 146 return RestoreEntryById(context, entries_.front()->id, UNKNOWN); |
143 } | 147 } |
144 | 148 |
145 TabRestoreService::Tab* TabRestoreServiceHelper::RemoveTabEntryById( | 149 TabRestoreService::Tab* TabRestoreServiceHelper::RemoveTabEntryById( |
146 SessionID::id_type id) { | 150 SessionID::id_type id) { |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 tab->browser_id = new_id; | 523 tab->browser_id = new_id; |
520 } | 524 } |
521 } | 525 } |
522 } | 526 } |
523 | 527 |
524 base::Time TabRestoreServiceHelper::TimeNow() const { | 528 base::Time TabRestoreServiceHelper::TimeNow() const { |
525 return time_factory_ ? time_factory_->TimeNow() : base::Time::Now(); | 529 return time_factory_ ? time_factory_->TimeNow() : base::Time::Now(); |
526 } | 530 } |
527 | 531 |
528 } // namespace sessions | 532 } // namespace sessions |
OLD | NEW |