OLD | NEW |
(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/clean/chrome/browser/ui/dialogs/dialog_text_field_configuration.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." |
| 11 #endif |
| 12 |
| 13 @interface DialogTextFieldConfiguration () |
| 14 |
| 15 // Initializer used by the factory method. |
| 16 - (instancetype)initWithDefaultText:(NSString*)defaultText |
| 17 placeholderText:(NSString*)placeholderText |
| 18 secure:(BOOL)secure |
| 19 idenfifier:(id)identifier NS_DESIGNATED_INITIALIZER; |
| 20 |
| 21 @end |
| 22 |
| 23 @implementation DialogTextFieldConfiguration |
| 24 |
| 25 @synthesize defaultText = _defaultText; |
| 26 @synthesize placeholderText = _placeholderText; |
| 27 @synthesize secure = _secure; |
| 28 @synthesize identifier = _identifier; |
| 29 |
| 30 - (instancetype)initWithDefaultText:(NSString*)defaultText |
| 31 placeholderText:(NSString*)placeholderText |
| 32 secure:(BOOL)secure |
| 33 idenfifier:(id)identifier { |
| 34 DCHECK(identifier); |
| 35 if ((self = [super init])) { |
| 36 _defaultText = [defaultText copy]; |
| 37 _placeholderText = [placeholderText copy]; |
| 38 _secure = secure; |
| 39 _identifier = identifier; |
| 40 } |
| 41 return self; |
| 42 } |
| 43 |
| 44 #pragma mark - Public |
| 45 |
| 46 + (instancetype)itemWithDefaultText:(NSString*)defaultText |
| 47 placeholderText:(NSString*)placeholderText |
| 48 secure:(BOOL)secure |
| 49 identifier:(id)identifier { |
| 50 return [[[self class] alloc] initWithDefaultText:defaultText |
| 51 placeholderText:placeholderText |
| 52 secure:secure |
| 53 idenfifier:identifier]; |
| 54 } |
| 55 |
| 56 @end |
OLD | NEW |