| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_CLEAN_CHROME_BROWSER_UI_CONTEXT_MENU_CONTEXT_MENU_ITEM_H_ | 5 #ifndef IOS_CLEAN_CHROME_BROWSER_UI_CONTEXT_MENU_CONTEXT_MENU_ITEM_H_ |
| 6 #define IOS_CLEAN_CHROME_BROWSER_UI_CONTEXT_MENU_CONTEXT_MENU_ITEM_H_ | 6 #define IOS_CLEAN_CHROME_BROWSER_UI_CONTEXT_MENU_CONTEXT_MENU_ITEM_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 // Object encapsulating configuration information for an item in a context menu. | 11 // Object encapsulating configuration information for an item in a context menu. |
| 12 @interface ContextMenuItem : NSObject | 12 @interface ContextMenuItem : NSObject |
| 13 | 13 |
| 14 // ContextMenuItems should be created through the factory method. |
| 15 - (instancetype)init NS_UNAVAILABLE; |
| 16 |
| 14 // Create a new item with |title| and |commands|. | 17 // Create a new item with |title| and |commands|. |
| 15 + (instancetype)itemWithTitle:(NSString*)title | 18 + (instancetype)itemWithTitle:(NSString*)title |
| 16 commands:(const std::vector<SEL>&)commands; | 19 command:(SEL)command |
| 20 commandOpensTab:(BOOL)commandOpensTab; |
| 17 | 21 |
| 18 // The title associated with the item. This is usually the text the user will | 22 // The title associated with the item. This is usually the text the user will |
| 19 // see. | 23 // see. |
| 20 @property(nonatomic, readonly, copy) NSString* title; | 24 @property(nonatomic, readonly, copy) NSString* title; |
| 21 | 25 |
| 22 // The ContextMenuCommands to be dispatched with menu's ContextMenuContext. | 26 // The ContextMenuCommand to be dispatched with menu's ContextMenuContext. |
| 23 // They will be dispatched in the order in which they appear in the vector. | 27 @property(nonatomic, readonly, assign) SEL command; |
| 24 @property(nonatomic, readonly, assign) const std::vector<SEL>& commands; | 28 |
| 29 // Returns whether dispatching |command| will open a new tab. |
| 30 @property(nonatomic, readonly, assign) BOOL commandOpensTab; |
| 25 | 31 |
| 26 @end | 32 @end |
| 27 | 33 |
| 28 #endif // IOS_CLEAN_CHROME_BROWSER_UI_CONTEXT_MENU_CONTEXT_MENU_ITEM_H_ | 34 #endif // IOS_CLEAN_CHROME_BROWSER_UI_CONTEXT_MENU_CONTEXT_MENU_ITEM_H_ |
| OLD | NEW |