Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / components / autofill / ios / browser / form_suggestion.mm
blob4f5b85a795904defb76f353bd3c6c9c123b99a55
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
3 // found in the LICENSE file.
5 #import "components/autofill/ios/browser/form_suggestion.h"
7 @interface FormSuggestion ()
8 // TODO(rohitrao): These properties must be redefined readwrite to work around a
9 // clang bug.  crbug.com/228650
10 @property(copy, readwrite) NSString* value;
11 @property(copy, readwrite) NSString* icon;
13 // Local initializer for a FormSuggestion.
14 - (id)initWithValue:(NSString*)value
15     displayDescription:(NSString*)displayDescription
16                   icon:(NSString*)icon
17             identifier:(NSInteger)identifier;
19 @end
21 @implementation FormSuggestion {
22   NSString* _value;
23   NSString* _displayDescription;
24   NSString* _icon;
25   NSInteger _identifier;
26   base::mac::ObjCPropertyReleaser _propertyReleaser_FormSuggestion;
29 @synthesize value = _value;
30 @synthesize displayDescription = _displayDescription;
31 @synthesize icon = _icon;
32 @synthesize identifier = _identifier;
34 - (id)initWithValue:(NSString*)value
35     displayDescription:(NSString*)displayDescription
36                   icon:(NSString*)icon
37             identifier:(NSInteger)identifier {
38   self = [super init];
39   if (self) {
40     _propertyReleaser_FormSuggestion.Init(self, [FormSuggestion class]);
41     _value = [value copy];
42     _displayDescription = [displayDescription copy];
43     _icon = [icon copy];
44     _identifier = identifier;
45   }
46   return self;
49 + (FormSuggestion*)suggestionWithValue:(NSString*)value
50                     displayDescription:(NSString*)displayDescription
51                                   icon:(NSString*)icon
52                             identifier:(NSInteger)identifier {
53   return [[[FormSuggestion alloc] initWithValue:value
54                              displayDescription:displayDescription
55                                            icon:icon
56                                      identifier:identifier] autorelease];
59 @end