Chromium Code Reviews| 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_item.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 DialogButtonItem () | |
| 14 | |
| 15 // Initializer used by the factory method. | |
| 16 - (instancetype)initWithText:(NSString*)text | |
| 17 style:(DialogButtonStyle)style | |
| 18 tag:(id)tag NS_DESIGNATED_INITIALIZER; | |
| 19 | |
| 20 @end | |
| 21 | |
| 22 @implementation DialogButtonItem | |
| 23 | |
| 24 @synthesize text = _text; | |
| 25 @synthesize style = _style; | |
| 26 @synthesize tag = _tag; | |
| 27 | |
| 28 - (instancetype)initWithText:(NSString*)text | |
| 29 style:(DialogButtonStyle)style | |
| 30 tag:(id)tag { | |
| 31 DCHECK(text.length); | |
| 32 DCHECK(tag); | |
| 33 if ((self = [super init])) { | |
| 34 _text = text; | |
|
marq (ping after 24h)
2017/06/14 10:52:15
[text copy]
kkhorimoto
2017/06/23 06:24:18
Done.
| |
| 35 _style = style; | |
| 36 _tag = tag; | |
|
marq (ping after 24h)
2017/06/14 10:52:15
using a totally opaque type is slightly tricky her
kkhorimoto
2017/06/23 06:24:17
The identifier is supplied by and sent back to the
| |
| 37 } | |
| 38 return self; | |
| 39 } | |
| 40 | |
| 41 #pragma mark - Public | |
| 42 | |
| 43 + (instancetype)itemWithText:(NSString*)text | |
| 44 style:(DialogButtonStyle)style | |
| 45 tag:(id)tag { | |
| 46 return [[[self class] alloc] initWithText:text style:style tag:tag]; | |
| 47 } | |
| 48 | |
| 49 @end | |
| OLD | NEW |