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.h" | 5 #include "chrome/browser/sessions/tab_restore_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } | 212 } |
213 | 213 |
214 void TabRestoreService::AddObserver(TabRestoreServiceObserver* observer) { | 214 void TabRestoreService::AddObserver(TabRestoreServiceObserver* observer) { |
215 observer_list_.AddObserver(observer); | 215 observer_list_.AddObserver(observer); |
216 } | 216 } |
217 | 217 |
218 void TabRestoreService::RemoveObserver(TabRestoreServiceObserver* observer) { | 218 void TabRestoreService::RemoveObserver(TabRestoreServiceObserver* observer) { |
219 observer_list_.RemoveObserver(observer); | 219 observer_list_.RemoveObserver(observer); |
220 } | 220 } |
221 | 221 |
222 void TabRestoreService::CreateHistoricalTab(content::WebContents* contents, | 222 void TabRestoreService::CreateHistoricalTab(NavigationController* tab, |
223 int index) { | 223 int index) { |
224 if (restoring_) | 224 if (restoring_) |
225 return; | 225 return; |
226 | 226 |
227 TabRestoreServiceDelegate* delegate = | 227 TabRestoreServiceDelegate* delegate = |
228 TabRestoreServiceDelegate::FindDelegateForWebContents(contents); | 228 TabRestoreServiceDelegate::FindDelegateForController(tab, NULL); |
229 if (closing_delegates_.find(delegate) != closing_delegates_.end()) | 229 if (closing_delegates_.find(delegate) != closing_delegates_.end()) |
230 return; | 230 return; |
231 | 231 |
232 scoped_ptr<Tab> local_tab(new Tab()); | 232 scoped_ptr<Tab> local_tab(new Tab()); |
233 PopulateTab(local_tab.get(), index, delegate, &contents->GetController()); | 233 PopulateTab(local_tab.get(), index, delegate, tab); |
234 if (local_tab->navigations.empty()) | 234 if (local_tab->navigations.empty()) |
235 return; | 235 return; |
236 | 236 |
237 AddEntry(local_tab.release(), true, true); | 237 AddEntry(local_tab.release(), true, true); |
238 } | 238 } |
239 | 239 |
240 void TabRestoreService::BrowserClosing(TabRestoreServiceDelegate* delegate) { | 240 void TabRestoreService::BrowserClosing(TabRestoreServiceDelegate* delegate) { |
241 closing_delegates_.insert(delegate); | 241 closing_delegates_.insert(delegate); |
242 | 242 |
243 scoped_ptr<Window> window(new Window()); | 243 scoped_ptr<Window> window(new Window()); |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 // the front, not the end and we just added the entries to the end). | 1244 // the front, not the end and we just added the entries to the end). |
1245 entries_to_write_ = staging_entries_.size(); | 1245 entries_to_write_ = staging_entries_.size(); |
1246 | 1246 |
1247 PruneEntries(); | 1247 PruneEntries(); |
1248 NotifyTabsChanged(); | 1248 NotifyTabsChanged(); |
1249 } | 1249 } |
1250 | 1250 |
1251 Time TabRestoreService::TimeNow() const { | 1251 Time TabRestoreService::TimeNow() const { |
1252 return time_factory_ ? time_factory_->TimeNow() : Time::Now(); | 1252 return time_factory_ ? time_factory_->TimeNow() : Time::Now(); |
1253 } | 1253 } |
OLD | NEW |