| 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 #include "base/mac/objc_release_properties.h" |
| 8 | 8 |
| 9 @interface FormSuggestion () | 9 @interface FormSuggestion () |
| 10 // Local initializer for a FormSuggestion. | 10 // Local initializer for a FormSuggestion. |
| 11 - (id)initWithValue:(NSString*)value | 11 - (id)initWithValue:(NSString*)value |
| 12 displayDescription:(NSString*)displayDescription | 12 displayDescription:(NSString*)displayDescription |
| 13 icon:(NSString*)icon | 13 icon:(NSString*)icon |
| 14 identifier:(NSInteger)identifier; | 14 identifier:(NSInteger)identifier; |
| 15 @end | 15 @end |
| 16 | 16 |
| 17 @implementation FormSuggestion { | 17 @implementation FormSuggestion { |
| 18 NSString* _value; | 18 NSString* _value; |
| 19 NSString* _displayDescription; | 19 NSString* _displayDescription; |
| 20 NSString* _icon; | 20 NSString* _icon; |
| 21 NSInteger _identifier; | 21 NSInteger _identifier; |
| 22 base::mac::ObjCPropertyReleaser _propertyReleaser_FormSuggestion; | |
| 23 } | 22 } |
| 24 | 23 |
| 25 @synthesize value = _value; | 24 @synthesize value = _value; |
| 26 @synthesize displayDescription = _displayDescription; | 25 @synthesize displayDescription = _displayDescription; |
| 27 @synthesize icon = _icon; | 26 @synthesize icon = _icon; |
| 28 @synthesize identifier = _identifier; | 27 @synthesize identifier = _identifier; |
| 29 | 28 |
| 30 - (id)initWithValue:(NSString*)value | 29 - (id)initWithValue:(NSString*)value |
| 31 displayDescription:(NSString*)displayDescription | 30 displayDescription:(NSString*)displayDescription |
| 32 icon:(NSString*)icon | 31 icon:(NSString*)icon |
| 33 identifier:(NSInteger)identifier { | 32 identifier:(NSInteger)identifier { |
| 34 self = [super init]; | 33 self = [super init]; |
| 35 if (self) { | 34 if (self) { |
| 36 _propertyReleaser_FormSuggestion.Init(self, [FormSuggestion class]); | |
| 37 _value = [value copy]; | 35 _value = [value copy]; |
| 38 _displayDescription = [displayDescription copy]; | 36 _displayDescription = [displayDescription copy]; |
| 39 _icon = [icon copy]; | 37 _icon = [icon copy]; |
| 40 _identifier = identifier; | 38 _identifier = identifier; |
| 41 } | 39 } |
| 42 return self; | 40 return self; |
| 43 } | 41 } |
| 44 | 42 |
| 43 - (void)dealloc { |
| 44 base::mac::ReleaseProperties(self); |
| 45 [super dealloc]; |
| 46 } |
| 47 |
| 45 + (FormSuggestion*)suggestionWithValue:(NSString*)value | 48 + (FormSuggestion*)suggestionWithValue:(NSString*)value |
| 46 displayDescription:(NSString*)displayDescription | 49 displayDescription:(NSString*)displayDescription |
| 47 icon:(NSString*)icon | 50 icon:(NSString*)icon |
| 48 identifier:(NSInteger)identifier { | 51 identifier:(NSInteger)identifier { |
| 49 return [[[FormSuggestion alloc] initWithValue:value | 52 return [[[FormSuggestion alloc] initWithValue:value |
| 50 displayDescription:displayDescription | 53 displayDescription:displayDescription |
| 51 icon:icon | 54 icon:icon |
| 52 identifier:identifier] autorelease]; | 55 identifier:identifier] autorelease]; |
| 53 } | 56 } |
| 54 | 57 |
| 55 @end | 58 @end |
| OLD | NEW |