| OLD | NEW |
| (Empty) |
| 1 // Copyright 2012 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 #ifndef IOS_CHROME_BROWSER_UI_CONTEXT_MENU_CONTEXT_MENU_HOLDER_H_ | |
| 6 #define IOS_CHROME_BROWSER_UI_CONTEXT_MENU_CONTEXT_MENU_HOLDER_H_ | |
| 7 | |
| 8 #import <Foundation/Foundation.h> | |
| 9 | |
| 10 #include "base/ios/block_types.h" | |
| 11 | |
| 12 // This class simply stores the information necessary to build a menu: | |
| 13 // a menu title, a list of item titles and associated actions (blocks). | |
| 14 @interface ContextMenuHolder : NSObject | |
| 15 | |
| 16 // Designated initializer. | |
| 17 - (instancetype)init; | |
| 18 | |
| 19 // Menu title; can be nil. | |
| 20 @property(nonatomic, copy) NSString* menuTitle; | |
| 21 | |
| 22 // A list of menu item titles in the order they will appear in the menu. | |
| 23 @property(nonatomic, readonly, copy) NSArray* itemTitles; | |
| 24 | |
| 25 // A number of menu items. | |
| 26 @property(nonatomic, readonly) NSUInteger itemCount; | |
| 27 | |
| 28 // Adds an item at the end of the menu. | |
| 29 - (void)appendItemWithTitle:(NSString*)title action:(ProceduralBlock)action; | |
| 30 | |
| 31 // Adds an item at the end of the menu. If |dismissImmediately| is YES, | |
| 32 // then tapping this item will cause the context menu to be dismissed without | |
| 33 // any animation. | |
| 34 - (void)appendItemWithTitle:(NSString*)title | |
| 35 action:(ProceduralBlock)action | |
| 36 dismissImmediately:(BOOL)dismissImmediately; | |
| 37 | |
| 38 // Performs the action for the item at the given index. | |
| 39 - (void)performActionAtIndex:(NSUInteger)index; | |
| 40 | |
| 41 // Returns YES if the action at |index| should cause the context menu to | |
| 42 // dismiss without any animation. | |
| 43 - (BOOL)shouldDismissImmediatelyOnClickedAtIndex:(NSUInteger)index; | |
| 44 | |
| 45 @end | |
| 46 | |
| 47 #endif // IOS_CHROME_BROWSER_UI_CONTEXT_MENU_CONTEXT_MENU_HOLDER_H_ | |
| OLD | NEW |