Chromium Code Reviews| Index: ui/base/cocoa/menu_controller.h |
| diff --git a/ui/base/cocoa/menu_controller.h b/ui/base/cocoa/menu_controller.h |
| index 7e8e4acfcd8c7d27643ed0d1616f4472a10350d2..dcf871bf615d3f9a0a17987701356219f3bb10c7 100644 |
| --- a/ui/base/cocoa/menu_controller.h |
| +++ b/ui/base/cocoa/menu_controller.h |
| @@ -27,13 +27,18 @@ UI_BASE_EXPORT extern NSString* const kMenuControllerMenuDidCloseNotification; |
| UI_BASE_EXPORT |
| @interface MenuController : NSObject<NSMenuDelegate> { |
| @protected |
| - ui::MenuModel* model_; // weak |
| + ui::MenuModel* model_; // Weak. |
| base::scoped_nsobject<NSMenu> menu_; |
| - BOOL useWithPopUpButtonCell_; // If YES, 0th item is blank |
| - BOOL isMenuOpen_; |
| } |
| @property(nonatomic, assign) ui::MenuModel* model; |
| + |
| +// Whether to activate selected menu items via a posted task. This may allow the |
| +// selection to be handled earlier, whilst the menu is fading out. If the posted |
| +// task wasn't processed by the time the action is normally sent, it will be |
| +// sent synchronously at that stage. |
| +@property(nonatomic, assign) BOOL postItemSelectedAsTask; |
| + |
| // Note that changing this will have no effect if you use |
| // |-initWithModel:useWithPopUpButtonCell:| or after the first call to |-menu|. |
| @property(nonatomic) BOOL useWithPopUpButtonCell; |
| @@ -71,19 +76,26 @@ UI_BASE_EXPORT |
| @end |
| -// Exposed only for unit testing, do not call directly. |
| -@interface MenuController (PrivateExposedForTesting) |
| +// Protected methods that subclassers can override and/or invoke. |
| +@interface MenuController (Protected) |
| + |
| +// Called before the menu is to be displayed to update the state (enabled, |
| +// radio, etc) of each item in the menu. Also will update the title if the item |
| +// is marked as "dynamic". |
| - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item; |
|
tapted
2017/05/10 03:49:06
(This is called outside of testcode, so I merged t
|
| -@end |
| -// Protected methods that subclassers can override. |
| -@interface MenuController (Protected) |
| +// Adds an item or a hierarchical menu to the item at the |index|, associated |
| +// with the entry in the model identified by |modelIndex|. |
|
Robert Sesek
2017/05/10 13:37:27
nit: no modelIndex in the args
tapted
2017/05/11 00:24:06
Updated:
// Adds the item at |index| in |model| a
|
| - (void)addItemToMenu:(NSMenu*)menu |
| atIndex:(NSInteger)index |
| fromModel:(ui::MenuModel*)model; |
| + |
| +// Creates a NSMenu from the given model. If the model has submenus, this can |
| +// be invoked recursively. |
| - (NSMenu*)menuFromModel:(ui::MenuModel*)model; |
| -// Returns the maximum width for the menu item. Returns -1 to indicate |
| -// that there's no maximum width. |
| + |
| +// Returns the maximum width for the menu item. Returns -1 to indicate that |
| +// there's no maximum width. |
| - (int)maxWidthForMenuModel:(ui::MenuModel*)model |
| modelIndex:(int)modelIndex; |
| @end |