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_button_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 DialogButtonConfiguration () |
| 14 |
| 15 // Initializer used by the factory method. |
| 16 - (instancetype)initWithText:(NSString*)text |
| 17 style:(DialogButtonStyle)style |
| 18 identifier:(id)identifier NS_DESIGNATED_INITIALIZER; |
| 19 |
| 20 @end |
| 21 |
| 22 @implementation DialogButtonConfiguration |
| 23 |
| 24 @synthesize text = _text; |
| 25 @synthesize style = _style; |
| 26 @synthesize identifier = _identifier; |
| 27 |
| 28 - (instancetype)initWithText:(NSString*)text |
| 29 style:(DialogButtonStyle)style |
| 30 identifier:(id)identifier { |
| 31 DCHECK(text.length); |
| 32 DCHECK(identifier); |
| 33 if ((self = [super init])) { |
| 34 _text = [text copy]; |
| 35 _style = style; |
| 36 _identifier = identifier; |
| 37 } |
| 38 return self; |
| 39 } |
| 40 |
| 41 #pragma mark - Public |
| 42 |
| 43 + (instancetype)itemWithText:(NSString*)text |
| 44 style:(DialogButtonStyle)style |
| 45 identifier:(id)identifier { |
| 46 return [[[self class] alloc] initWithText:text |
| 47 style:style |
| 48 identifier:identifier]; |
| 49 } |
| 50 |
| 51 @end |
OLD | NEW |