 Chromium Code Reviews
 Chromium Code Reviews Issue 2862783002:
  [iOS Clean] Wired up ContextMenuCommands.  (Closed)
    
  
    Issue 2862783002:
  [iOS Clean] Wired up ContextMenuCommands.  (Closed) 
  | 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 @end | |
| 17 | |
| 18 @implementation ContextMenuItem | |
| 19 | |
| 20 @synthesize title = _title; | |
| 21 | |
| 22 + (instancetype)itemWithTitle:(NSString*)title | |
| 23 commands:(const std::vector<SEL>&)commands { | |
| 24 ContextMenuItem* item = [[self alloc] init]; | |
| 25 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.
 | |
| 26 item->_commands = commands; | |
| 27 return item; | |
| 28 } | |
| 29 | |
| 30 #pragma mark - Accessors | |
| 31 | |
| 32 - (const std::vector<SEL>&)commands { | |
| 33 return _commands; | |
| 34 } | |
| 35 | |
| 36 @end | |
| OLD | NEW |