OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "components/autofill/ios/browser/form_suggestion.h" | 5 #import "components/autofill/ios/browser/form_suggestion.h" |
6 | 6 |
7 #include "base/mac/objc_property_releaser.h" | 7 #if !defined(__has_feature) || !__has_feature(objc_arc) |
8 #error "This file requires ARC support." | |
9 #endif | |
8 | 10 |
9 @interface FormSuggestion () | 11 @interface FormSuggestion () |
10 // Local initializer for a FormSuggestion. | 12 // Local initializer for a FormSuggestion. |
11 - (id)initWithValue:(NSString*)value | 13 - (id)initWithValue:(NSString*)value |
12 displayDescription:(NSString*)displayDescription | 14 displayDescription:(NSString*)displayDescription |
13 icon:(NSString*)icon | 15 icon:(NSString*)icon |
14 identifier:(NSInteger)identifier; | 16 identifier:(NSInteger)identifier; |
15 @end | 17 @end |
16 | 18 |
17 @implementation FormSuggestion { | 19 @implementation FormSuggestion |
18 NSString* _value; | |
19 NSString* _displayDescription; | |
20 NSString* _icon; | |
21 NSInteger _identifier; | |
22 base::mac::ObjCPropertyReleaser _propertyReleaser_FormSuggestion; | |
23 } | |
24 | 20 |
25 @synthesize value = _value; | 21 @synthesize value = _value; |
26 @synthesize displayDescription = _displayDescription; | 22 @synthesize displayDescription = _displayDescription; |
27 @synthesize icon = _icon; | 23 @synthesize icon = _icon; |
28 @synthesize identifier = _identifier; | 24 @synthesize identifier = _identifier; |
29 | 25 |
30 - (id)initWithValue:(NSString*)value | 26 - (id)initWithValue:(NSString*)value |
sdefresne
2017/05/02 14:02:58
nit, followup: id → instancetype
| |
31 displayDescription:(NSString*)displayDescription | 27 displayDescription:(NSString*)displayDescription |
32 icon:(NSString*)icon | 28 icon:(NSString*)icon |
33 identifier:(NSInteger)identifier { | 29 identifier:(NSInteger)identifier { |
34 self = [super init]; | 30 self = [super init]; |
35 if (self) { | 31 if (self) { |
36 _propertyReleaser_FormSuggestion.Init(self, [FormSuggestion class]); | |
37 _value = [value copy]; | 32 _value = [value copy]; |
38 _displayDescription = [displayDescription copy]; | 33 _displayDescription = [displayDescription copy]; |
39 _icon = [icon copy]; | 34 _icon = [icon copy]; |
40 _identifier = identifier; | 35 _identifier = identifier; |
41 } | 36 } |
42 return self; | 37 return self; |
43 } | 38 } |
44 | 39 |
45 + (FormSuggestion*)suggestionWithValue:(NSString*)value | 40 + (FormSuggestion*)suggestionWithValue:(NSString*)value |
46 displayDescription:(NSString*)displayDescription | 41 displayDescription:(NSString*)displayDescription |
47 icon:(NSString*)icon | 42 icon:(NSString*)icon |
48 identifier:(NSInteger)identifier { | 43 identifier:(NSInteger)identifier { |
49 return [[[FormSuggestion alloc] initWithValue:value | 44 return [[FormSuggestion alloc] initWithValue:value |
50 displayDescription:displayDescription | 45 displayDescription:displayDescription |
51 icon:icon | 46 icon:icon |
52 identifier:identifier] autorelease]; | 47 identifier:identifier]; |
53 } | 48 } |
54 | 49 |
55 @end | 50 @end |
OLD | NEW |