Add Menu.closePopup API on macOS

This commit is contained in:
Kevin Sawicki 2017-02-16 10:58:02 -08:00
parent 947556a23f
commit 6a023dc4fe
8 changed files with 48 additions and 11 deletions

View file

@ -8,6 +8,7 @@
#import <Cocoa/Cocoa.h>
#include "base/callback.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/string16.h"
@ -27,6 +28,7 @@ class AtomMenuModel;
base::scoped_nsobject<NSMenu> menu_;
BOOL isMenuOpen_;
BOOL useDefaultAccelerator_;
base::Callback<void()> closeCallback;
}
@property(nonatomic, assign) atom::AtomMenuModel* model;
@ -35,6 +37,8 @@ class AtomMenuModel;
// to the contents of the model after calling this will not be noticed.
- (id)initWithModel:(atom::AtomMenuModel*)model useDefaultAccelerator:(BOOL)use;
- (void)setCloseCallback:(const base::Callback<void()>&)callback;
// Populate current NSMenu with |model|.
- (void)populateWithModel:(atom::AtomMenuModel*)model;