| 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/tabs/tab_model.h" | 5 #import "ios/chrome/browser/tabs/tab_model.h" |
| 6 | 6 |
| 7 #include <cstdint> | 7 #include <cstdint> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 _browserState = browserState; | 282 _browserState = browserState; |
| 283 DCHECK(_browserState); | 283 DCHECK(_browserState); |
| 284 | 284 |
| 285 // Normal browser states are the only ones to get tab restore. Tab sync | 285 // Normal browser states are the only ones to get tab restore. Tab sync |
| 286 // handles incognito browser states by filtering on profile, so it's | 286 // handles incognito browser states by filtering on profile, so it's |
| 287 // important to the backend code to always have a sync window delegate. | 287 // important to the backend code to always have a sync window delegate. |
| 288 if (!_browserState->IsOffTheRecord()) { | 288 if (!_browserState->IsOffTheRecord()) { |
| 289 // Set up the usage recorder before tabs are created. | 289 // Set up the usage recorder before tabs are created. |
| 290 _tabUsageRecorder = base::MakeUnique<TabUsageRecorder>(self); | 290 _tabUsageRecorder = base::MakeUnique<TabUsageRecorder>(self); |
| 291 } | 291 } |
| 292 _syncedWindowDelegate = | 292 _syncedWindowDelegate = base::MakeUnique<TabModelSyncedWindowDelegate>( |
| 293 base::MakeUnique<TabModelSyncedWindowDelegate>(self); | 293 _webStateList.get(), _sessionID); |
| 294 | 294 |
| 295 // There must be a valid session service defined to consume session windows. | 295 // There must be a valid session service defined to consume session windows. |
| 296 DCHECK(service); | 296 DCHECK(service); |
| 297 _sessionService.reset([service retain]); | 297 _sessionService.reset([service retain]); |
| 298 | 298 |
| 299 base::scoped_nsobject<NSMutableArray<id<WebStateListObserving>>> | 299 base::scoped_nsobject<NSMutableArray<id<WebStateListObserving>>> |
| 300 retainedWebStateListObservers([[NSMutableArray alloc] init]); | 300 retainedWebStateListObservers([[NSMutableArray alloc] init]); |
| 301 | 301 |
| 302 base::scoped_nsobject<TabModelClosingWebStateObserver> | 302 base::scoped_nsobject<TabModelClosingWebStateObserver> |
| 303 tabModelClosingWebStateObserver([[TabModelClosingWebStateObserver alloc] | 303 tabModelClosingWebStateObserver([[TabModelClosingWebStateObserver alloc] |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 } | 805 } |
| 806 | 806 |
| 807 // Called when UIApplicationWillEnterForegroundNotification is received. | 807 // Called when UIApplicationWillEnterForegroundNotification is received. |
| 808 - (void)applicationWillEnterForeground:(NSNotification*)notify { | 808 - (void)applicationWillEnterForeground:(NSNotification*)notify { |
| 809 if (_tabUsageRecorder) { | 809 if (_tabUsageRecorder) { |
| 810 _tabUsageRecorder->AppWillEnterForeground(); | 810 _tabUsageRecorder->AppWillEnterForeground(); |
| 811 } | 811 } |
| 812 } | 812 } |
| 813 | 813 |
| 814 @end | 814 @end |
| OLD | NEW |