Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Unified Diff: ios/chrome/browser/sessions/session_window.h

Issue 2585233003: Upstream Chrome on iOS source code [2/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/sessions/session_util.mm ('k') | ios/chrome/browser/sessions/session_window.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/sessions/session_window.h
diff --git a/ios/chrome/browser/sessions/session_window.h b/ios/chrome/browser/sessions/session_window.h
new file mode 100644
index 0000000000000000000000000000000000000000..ebcc2e3b47bf94b248d5e394e05fbfc44143cd0f
--- /dev/null
+++ b/ios/chrome/browser/sessions/session_window.h
@@ -0,0 +1,41 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_SESSIONS_SESSION_WINDOW_H_
+#define IOS_CHROME_BROWSER_SESSIONS_SESSION_WINDOW_H_
+
+#import <Foundation/Foundation.h>
+
+#include <memory>
+
+#import "ios/web/web_state/web_state_impl.h"
+
+// Encapsulates everything required to save a session "window". For iOS, there
+// will only be one window at a time.
+@interface SessionWindowIOS : NSObject<NSCoding>
+
+// So that ownership transfer of WebStateImpls is explicit, SessionWindows
+// are initialized "empty" (without any sessions) and sessions are added
+// one at a time. For example:
+// SessionWindowIOS* window = [[SessionWindow alloc] init];
+// [window addSession:some_scoped_webstate_ptr.Pass()];
+// ...
+// [window setSelectedInex:mySelectedIndex];
+- (void)addSession:(std::unique_ptr<web::WebStateImpl>)session;
+
+- (void)clearSessions;
+
+// Takes the first session stored in the reciever, removes it and passes
+// ownership of it to the caller.
+- (std::unique_ptr<web::WebStateImpl>)nextSession;
+
+// The currently selected session. NSNotFound if the sessionWindow contains
+// no sessions; otherwise 0 <= |selectedIndex| < |unclaimedSessions|.
+@property(nonatomic) NSUInteger selectedIndex;
+// A count of the remaining sessions that haven't been claimed.
+@property(nonatomic, readonly) NSUInteger unclaimedSessions;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_SESSIONS_SESSION_WINDOW_H_
« no previous file with comments | « ios/chrome/browser/sessions/session_util.mm ('k') | ios/chrome/browser/sessions/session_window.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698