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 #import "ios/chrome/browser/xcallback_parameters.h" | |
6 | |
7 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
8 #error "This file requires ARC support." | |
9 #endif | |
10 | |
11 namespace { | |
12 NSString* const kSourceAppIdKey = @"sourceAppId"; | |
13 } | |
14 | |
15 @implementation XCallbackParameters | |
16 @synthesize sourceAppId = _sourceAppId; | |
17 | |
18 - (instancetype)initWithSourceAppId:(NSString*)sourceAppId { | |
19 self = [super init]; | |
20 if (self) { | |
21 _sourceAppId = [sourceAppId copy]; | |
22 } | |
23 return self; | |
24 } | |
25 | |
26 - (NSString*)description { | |
27 return [NSString stringWithFormat:@"SourceApp: %@\n", _sourceAppId]; | |
28 } | |
29 | |
30 #pragma mark - NSCoding Methods | |
31 | |
32 - (instancetype)initWithCoder:(NSCoder*)aDecoder { | |
33 return | |
34 [self initWithSourceAppId:[aDecoder decodeObjectForKey:kSourceAppIdKey]]; | |
35 } | |
36 | |
37 - (void)encodeWithCoder:(NSCoder*)aCoder { | |
38 [aCoder encodeObject:_sourceAppId forKey:kSourceAppIdKey]; | |
39 } | |
40 | |
41 #pragma mark - NSCopying Methods | |
42 | |
43 - (instancetype)copyWithZone:(NSZone*)zone { | |
44 return [[[self class] allocWithZone:zone] initWithSourceAppId:_sourceAppId]; | |
45 } | |
46 | |
47 @end | |
OLD | NEW |