Chromium Code Reviews| Index: ios/clean/chrome/browser/ui/context_menu/context_menu_item.mm |
| diff --git a/ios/clean/chrome/browser/ui/context_menu/context_menu_item.mm b/ios/clean/chrome/browser/ui/context_menu/context_menu_item.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..77b25c9967295cd1fec28be8c02c3b0387e5c997 |
| --- /dev/null |
| +++ b/ios/clean/chrome/browser/ui/context_menu/context_menu_item.mm |
| @@ -0,0 +1,36 @@ |
| +// 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/context_menu/context_menu_item.h" |
| + |
| +#if !defined(__has_feature) || !__has_feature(objc_arc) |
| +#error "This file requires ARC support." |
| +#endif |
| + |
| +@interface ContextMenuItem () { |
| + // Backing object for |commands|. |
| + std::vector<SEL> _commands; |
| +} |
| + |
| +@end |
| + |
| +@implementation ContextMenuItem |
| + |
| +@synthesize title = _title; |
| + |
| ++ (instancetype)itemWithTitle:(NSString*)title |
| + commands:(const std::vector<SEL>&)commands { |
| + ContextMenuItem* item = [[self alloc] init]; |
| + item->_title = [title copy]; |
|
edchin
2017/05/25 21:41:53
Could you incorporate the dot notation over pointe
kkhorimoto
2017/05/26 23:20:09
That would require redefining the property as read
edchin
2017/05/27 15:59:03
Yup. This looks more ObjC-y.
|
| + item->_commands = commands; |
| + return item; |
| +} |
| + |
| +#pragma mark - Accessors |
| + |
| +- (const std::vector<SEL>&)commands { |
| + return _commands; |
| +} |
| + |
| +@end |