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/context_menu/context_menu_item.h" |
| 6 |
| 7 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 8 #error "This file requires ARC support." |
| 9 #endif |
| 10 |
| 11 @interface ContextMenuItem () { |
| 12 // Backing object for |commands|. |
| 13 std::vector<SEL> _commands; |
| 14 } |
| 15 |
| 16 // Convenience initializer for use by the factory method. |
| 17 - (instancetype)initWithTitle:(NSString*)title |
| 18 commands:(const std::vector<SEL>&)commands; |
| 19 |
| 20 @end |
| 21 |
| 22 @implementation ContextMenuItem |
| 23 |
| 24 @synthesize title = _title; |
| 25 |
| 26 - (instancetype)initWithTitle:(NSString*)title |
| 27 commands:(const std::vector<SEL>&)commands { |
| 28 if ((self = [super init])) { |
| 29 _title = [title copy]; |
| 30 _commands = commands; |
| 31 } |
| 32 return self; |
| 33 } |
| 34 |
| 35 #pragma mark - Accessors |
| 36 |
| 37 - (const std::vector<SEL>&)commands { |
| 38 return _commands; |
| 39 } |
| 40 |
| 41 #pragma mark - Public |
| 42 |
| 43 + (instancetype)itemWithTitle:(NSString*)title |
| 44 commands:(const std::vector<SEL>&)commands { |
| 45 return [[ContextMenuItem alloc] initWithTitle:title commands:commands]; |
| 46 } |
| 47 |
| 48 @end |
OLD | NEW |