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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 355 |
356 - (BOOL)restoreSessionWindow:(SessionWindowIOS*)window { | 356 - (BOOL)restoreSessionWindow:(SessionWindowIOS*)window { |
357 return [self restoreSessionWindow:window persistState:YES]; | 357 return [self restoreSessionWindow:window persistState:YES]; |
358 } | 358 } |
359 | 359 |
360 - (void)saveSessionImmediately:(BOOL)immediately { | 360 - (void)saveSessionImmediately:(BOOL)immediately { |
361 // Do nothing if there are tabs in the model but no selected tab. This is | 361 // Do nothing if there are tabs in the model but no selected tab. This is |
362 // a transitional state. | 362 // a transitional state. |
363 if ((!self.currentTab && _webStateList->count()) || !_browserState) | 363 if ((!self.currentTab && _webStateList->count()) || !_browserState) |
364 return; | 364 return; |
365 [_sessionService saveWindow:self.windowForSavingSession | 365 NSString* statePath = |
366 forBrowserState:_browserState | 366 base::SysUTF8ToNSString(_browserState->GetStatePath().AsUTF8Unsafe()); |
367 immediately:immediately]; | 367 [_sessionService saveSessionWindow:self.windowForSavingSession |
| 368 directory:statePath |
| 369 immediately:immediately]; |
368 } | 370 } |
369 | 371 |
370 - (Tab*)tabAtIndex:(NSUInteger)index { | 372 - (Tab*)tabAtIndex:(NSUInteger)index { |
371 DCHECK_LE(index, static_cast<NSUInteger>(INT_MAX)); | 373 DCHECK_LE(index, static_cast<NSUInteger>(INT_MAX)); |
372 return LegacyTabHelper::GetTabForWebState( | 374 return LegacyTabHelper::GetTabForWebState( |
373 _webStateList->GetWebStateAt(static_cast<int>(index))); | 375 _webStateList->GetWebStateAt(static_cast<int>(index))); |
374 } | 376 } |
375 | 377 |
376 - (NSUInteger)indexOfTab:(Tab*)tab { | 378 - (NSUInteger)indexOfTab:(Tab*)tab { |
377 int index = _webStateList->GetIndexOfWebState(tab.webState); | 379 int index = _webStateList->GetIndexOfWebState(tab.webState); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 } | 792 } |
791 | 793 |
792 // Called when UIApplicationWillEnterForegroundNotification is received. | 794 // Called when UIApplicationWillEnterForegroundNotification is received. |
793 - (void)applicationWillEnterForeground:(NSNotification*)notify { | 795 - (void)applicationWillEnterForeground:(NSNotification*)notify { |
794 if (_tabUsageRecorder) { | 796 if (_tabUsageRecorder) { |
795 _tabUsageRecorder->AppWillEnterForeground(); | 797 _tabUsageRecorder->AppWillEnterForeground(); |
796 } | 798 } |
797 } | 799 } |
798 | 800 |
799 @end | 801 @end |
OLD | NEW |