mac: Pass useDefaultAccelerator to getAcceleratorForCommandId

This commit is contained in:
Cheng Zhao 2016-07-02 11:47:40 +09:00 committed by Kevin Sawicki
parent 77cdc2c4a7
commit 6381f44f26
17 changed files with 102 additions and 76 deletions

View file

@ -249,11 +249,12 @@ const CGFloat kVerticalTitleMargin = 2;
[self setNeedsDisplay:YES];
}
- (void)popUpContextMenu:(ui::SimpleMenuModel*)menu_model {
- (void)popUpContextMenu:(atom::AtomMenuModel*)menu_model {
// Show a custom menu.
if (menu_model) {
base::scoped_nsobject<AtomMenuController> menuController(
[[AtomMenuController alloc] initWithModel:menu_model]);
[[AtomMenuController alloc] initWithModel:menu_model
useDefaultAccelerator:NO]);
forceHighlight_ = YES; // Should highlight when showing menu.
[self setNeedsDisplay:YES];
[statusItem_ popUpStatusItemMenu:[menuController menu]];
@ -365,18 +366,19 @@ void TrayIconCocoa::SetHighlightMode(bool highlight) {
}
void TrayIconCocoa::PopUpContextMenu(const gfx::Point& pos,
ui::SimpleMenuModel* menu_model) {
AtomMenuModel* menu_model) {
[status_item_view_ popUpContextMenu:menu_model];
}
void TrayIconCocoa::SetContextMenu(ui::SimpleMenuModel* menu_model) {
void TrayIconCocoa::SetContextMenu(AtomMenuModel* menu_model) {
// Substribe to MenuClosed event.
if (menu_model_)
menu_model_->RemoveObserver(this);
static_cast<AtomMenuModel*>(menu_model)->AddObserver(this);
menu_model->AddObserver(this);
// Create native menu.
menu_.reset([[AtomMenuController alloc] initWithModel:menu_model]);
menu_.reset([[AtomMenuController alloc] initWithModel:menu_model
useDefaultAccelerator:NO]);
[status_item_view_ setMenuController:menu_.get()];
}