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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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 #import "ios/chrome/browser/sessions/session_ios.h"
6
7 #import "base/mac/foundation_util.h"
8
9 #if !defined(__has_feature) || !__has_feature(objc_arc)
10 #error "This file requires ARC support."
11 #endif
12
13 namespace {
14 // Serialization keys
15 NSString* const kSessionWindowsKey = @"sessionWindows";
16 } // namespace
17
18 @implementation SessionIOS
19
20 @synthesize sessionWindows = _sessionWindows;
21
22 #pragma mark - Public interface.
23
24 - (instancetype)initWithWindows:(NSArray<SessionWindowIOS*>*)sessionWindows {
25 DCHECK(sessionWindows);
26 if ((self = [super init])) {
27 _sessionWindows = sessionWindows;
28 }
29 return self;
30 }
31
32 #pragma mark - NSObject
33
34 - (instancetype)init {
35 return [self initWithWindows:@[]];
36 }
37
38 #pragma mark - NSCoding
39
40 - (instancetype)initWithCoder:(NSCoder*)aDecoder {
41 NSArray<SessionWindowIOS*>* sessionWindows =
42 base::mac::ObjCCast<NSArray<SessionWindowIOS*>>(
43 [aDecoder decodeObjectForKey:kSessionWindowsKey]);
44
45 return [self initWithWindows:(sessionWindows ? sessionWindows : @[])];
46 }
47
48 - (void)encodeWithCoder:(NSCoder*)aCoder {
49 [aCoder encodeObject:_sessionWindows forKey:kSessionWindowsKey];
50 }
51
52 @end
OLDNEW
« 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