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

Unified Diff: ios/chrome/browser/sessions/session_ios.mm

Issue 2811593004: [ios] Allow having multiple session windows in a session. (Closed)
Patch Set: Address comments. Created 3 years, 8 months 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_ios.h ('k') | ios/chrome/browser/sessions/session_service_ios.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/sessions/session_ios.mm
diff --git a/ios/chrome/browser/sessions/session_ios.mm b/ios/chrome/browser/sessions/session_ios.mm
new file mode 100644
index 0000000000000000000000000000000000000000..3620c73124d43b7155c9bdaaf2fe7e35d0924cfd
--- /dev/null
+++ b/ios/chrome/browser/sessions/session_ios.mm
@@ -0,0 +1,52 @@
+// Copyright 2017 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.
+
+#import "ios/chrome/browser/sessions/session_ios.h"
+
+#import "base/mac/foundation_util.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+namespace {
+// Serialization keys
+NSString* const kSessionWindowsKey = @"sessionWindows";
+} // namespace
+
+@implementation SessionIOS
+
+@synthesize sessionWindows = _sessionWindows;
+
+#pragma mark - Public interface.
+
+- (instancetype)initWithWindows:(NSArray<SessionWindowIOS*>*)sessionWindows {
+ DCHECK(sessionWindows);
+ if ((self = [super init])) {
+ _sessionWindows = sessionWindows;
+ }
+ return self;
+}
+
+#pragma mark - NSObject
+
+- (instancetype)init {
+ return [self initWithWindows:@[]];
+}
+
+#pragma mark - NSCoding
+
+- (instancetype)initWithCoder:(NSCoder*)aDecoder {
+ NSArray<SessionWindowIOS*>* sessionWindows =
+ base::mac::ObjCCast<NSArray<SessionWindowIOS*>>(
+ [aDecoder decodeObjectForKey:kSessionWindowsKey]);
+
+ return [self initWithWindows:(sessionWindows ? sessionWindows : @[])];
+}
+
+- (void)encodeWithCoder:(NSCoder*)aCoder {
+ [aCoder encodeObject:_sessionWindows forKey:kSessionWindowsKey];
+}
+
+@end
« no previous file with comments | « ios/chrome/browser/sessions/session_ios.h ('k') | ios/chrome/browser/sessions/session_service_ios.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698