| 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 #import "ios/chrome/browser/crash_report/crash_restore_helper.h" | 5 #import "ios/chrome/browser/crash_report/crash_restore_helper.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 forBrowserState:[_tabModel browserState]]; | 289 forBrowserState:[_tabModel browserState]]; |
| 290 DCHECK(window); | 290 DCHECK(window); |
| 291 NSArray* sessions = window.sessions; | 291 NSArray* sessions = window.sessions; |
| 292 if (!sessions.count) | 292 if (!sessions.count) |
| 293 return; | 293 return; |
| 294 sessions::TabRestoreService* const tabRestoreService = | 294 sessions::TabRestoreService* const tabRestoreService = |
| 295 IOSChromeTabRestoreServiceFactory::GetForBrowserState(_browserState); | 295 IOSChromeTabRestoreServiceFactory::GetForBrowserState(_browserState); |
| 296 tabRestoreService->LoadTabsFromLastSession(); | 296 tabRestoreService->LoadTabsFromLastSession(); |
| 297 | 297 |
| 298 web::WebState::CreateParams params(_browserState); | 298 web::WebState::CreateParams params(_browserState); |
| 299 for (CRWNavigationManagerStorage* session in sessions) { | 299 for (CRWSessionStorage* session in sessions) { |
| 300 std::unique_ptr<web::WebState> webState = | 300 std::unique_ptr<web::WebState> webState = |
| 301 web::WebState::Create(params, session); | 301 web::WebState::Create(params, session); |
| 302 // Add all tabs at the 0 position as the position is relative to an old | 302 // Add all tabs at the 0 position as the position is relative to an old |
| 303 // tabModel. | 303 // tabModel. |
| 304 tabRestoreService->CreateHistoricalTab( | 304 tabRestoreService->CreateHistoricalTab( |
| 305 sessions::IOSLiveTab::GetForWebState(webState.get()), 0); | 305 sessions::IOSLiveTab::GetForWebState(webState.get()), 0); |
| 306 } | 306 } |
| 307 return; | 307 return; |
| 308 } | 308 } |
| 309 | 309 |
| 310 @end | 310 @end |
| OLD | NEW |