| 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
|
|
|