OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_SESSIONS_SESSION_WINDOW_H_ |
| 6 #define IOS_CHROME_BROWSER_SESSIONS_SESSION_WINDOW_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 #include <memory> |
| 11 |
| 12 #import "ios/web/web_state/web_state_impl.h" |
| 13 |
| 14 // Encapsulates everything required to save a session "window". For iOS, there |
| 15 // will only be one window at a time. |
| 16 @interface SessionWindowIOS : NSObject<NSCoding> |
| 17 |
| 18 // So that ownership transfer of WebStateImpls is explicit, SessionWindows |
| 19 // are initialized "empty" (without any sessions) and sessions are added |
| 20 // one at a time. For example: |
| 21 // SessionWindowIOS* window = [[SessionWindow alloc] init]; |
| 22 // [window addSession:some_scoped_webstate_ptr.Pass()]; |
| 23 // ... |
| 24 // [window setSelectedInex:mySelectedIndex]; |
| 25 - (void)addSession:(std::unique_ptr<web::WebStateImpl>)session; |
| 26 |
| 27 - (void)clearSessions; |
| 28 |
| 29 // Takes the first session stored in the reciever, removes it and passes |
| 30 // ownership of it to the caller. |
| 31 - (std::unique_ptr<web::WebStateImpl>)nextSession; |
| 32 |
| 33 // The currently selected session. NSNotFound if the sessionWindow contains |
| 34 // no sessions; otherwise 0 <= |selectedIndex| < |unclaimedSessions|. |
| 35 @property(nonatomic) NSUInteger selectedIndex; |
| 36 // A count of the remaining sessions that haven't been claimed. |
| 37 @property(nonatomic, readonly) NSUInteger unclaimedSessions; |
| 38 |
| 39 @end |
| 40 |
| 41 #endif // IOS_CHROME_BROWSER_SESSIONS_SESSION_WINDOW_H_ |
OLD | NEW |