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 #ifndef IOS_CHROME_BROWSER_SESSIONS_SESSION_WINDOW_H_ | 5 #ifndef IOS_CHROME_BROWSER_SESSIONS_SESSION_WINDOW_H_ |
6 #define IOS_CHROME_BROWSER_SESSIONS_SESSION_WINDOW_H_ | 6 #define IOS_CHROME_BROWSER_SESSIONS_SESSION_WINDOW_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #import "ios/web/web_state/web_state_impl.h" | |
13 | |
14 @class CRWSessionStorage; | 12 @class CRWSessionStorage; |
15 | 13 |
16 // Encapsulates everything required to save a session "window". For iOS, there | 14 // Encapsulates everything required to save a session "window". For iOS, there |
17 // will only be one window at a time. | 15 // will only be one window at a time. |
18 @interface SessionWindowIOS : NSObject<NSCoding> | 16 @interface SessionWindowIOS : NSObject<NSCoding> |
19 | 17 |
20 // Adds a serialized session to be written to disk. SessionWindows are | 18 // Adds a serialized session to be written to disk. SessionWindows are |
21 // initialized "empty" (without any sessions) and sessions are added one at a | 19 // initialized "empty" (without any sessions) and sessions are added one at a |
22 // time. For example: | 20 // time. For example: |
23 // SessionWindowIOS* window = [[SessionWindow alloc] init]; | 21 // SessionWindowIOS* window = [[SessionWindow alloc] init]; |
24 // [window addSerializedSessionStorage:session_storage]; | 22 // [window addSerializedSessionStorage:session_storage]; |
25 // ... | 23 // ... |
26 // [window setSelectedIndex:mySelectedIndex]; | 24 // [window setSelectedIndex:mySelectedIndex]; |
27 - (void)addSerializedSessionStorage:(CRWSessionStorage*)session; | 25 - (void)addSerializedSessionStorage:(CRWSessionStorage*)session; |
28 | 26 |
29 // Clears all added sessions. | 27 // Clears all added sessions. |
30 - (void)clearSessions; | 28 - (void)clearSessions; |
31 | 29 |
32 // The serialized session objects. | 30 // The serialized session objects. |
33 @property(nonatomic, readonly) NSArray* sessions; | 31 @property(nonatomic, readonly) NSArray* sessions; |
34 | 32 |
35 // The currently selected session. NSNotFound if the sessionWindow contains | 33 // The currently selected session. NSNotFound if the sessionWindow contains |
36 // no sessions; otherwise 0 <= |selectedIndex| < |unclaimedSessions|. | 34 // no sessions; otherwise 0 <= |selectedIndex| < |unclaimedSessions|. |
37 @property(nonatomic) NSUInteger selectedIndex; | 35 @property(nonatomic) NSUInteger selectedIndex; |
38 | 36 |
39 @end | 37 @end |
40 | 38 |
41 #endif // IOS_CHROME_BROWSER_SESSIONS_SESSION_WINDOW_H_ | 39 #endif // IOS_CHROME_BROWSER_SESSIONS_SESSION_WINDOW_H_ |
OLD | NEW |