Index: ios/clean/chrome/browser/ui/dialogs/dialog_button_item.mm |
diff --git a/ios/clean/chrome/browser/ui/dialogs/dialog_button_item.mm b/ios/clean/chrome/browser/ui/dialogs/dialog_button_item.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..94529f6048215e8ae957ead3a1fc563d0f34cde0 |
--- /dev/null |
+++ b/ios/clean/chrome/browser/ui/dialogs/dialog_button_item.mm |
@@ -0,0 +1,49 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#import "ios/clean/chrome/browser/ui/dialogs/dialog_button_item.h" |
+ |
+#include "base/logging.h" |
+ |
+#if !defined(__has_feature) || !__has_feature(objc_arc) |
+#error "This file requires ARC support." |
+#endif |
+ |
+@interface DialogButtonItem () |
+ |
+// Initializer used by the factory method. |
+- (instancetype)initWithText:(NSString*)text |
+ style:(DialogButtonStyle)style |
+ tag:(id)tag NS_DESIGNATED_INITIALIZER; |
+ |
+@end |
+ |
+@implementation DialogButtonItem |
+ |
+@synthesize text = _text; |
+@synthesize style = _style; |
+@synthesize tag = _tag; |
+ |
+- (instancetype)initWithText:(NSString*)text |
+ style:(DialogButtonStyle)style |
+ tag:(id)tag { |
+ DCHECK(text.length); |
+ DCHECK(tag); |
+ if ((self = [super init])) { |
+ _text = text; |
marq (ping after 24h)
2017/06/14 10:52:15
[text copy]
kkhorimoto
2017/06/23 06:24:18
Done.
|
+ _style = style; |
+ _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
|
+ } |
+ return self; |
+} |
+ |
+#pragma mark - Public |
+ |
++ (instancetype)itemWithText:(NSString*)text |
+ style:(DialogButtonStyle)style |
+ tag:(id)tag { |
+ return [[[self class] alloc] initWithText:text style:style tag:tag]; |
+} |
+ |
+@end |