feat: add tray.closeContextMenu() (#21807)

This commit is contained in:
Shelley Vohr
2020-01-22 15:25:17 -08:00
committed by GitHub
parent 87af95be3e
commit b90537a629
10 changed files with 45 additions and 2 deletions

View File

@@ -239,6 +239,10 @@ void Tray::PopUpContextMenu(gin_helper::Arguments* args) {
tray_icon_->PopUpContextMenu(pos, menu.IsEmpty() ? nullptr : menu->model());
}
void Tray::CloseContextMenu() {
tray_icon_->CloseContextMenu();
}
void Tray::SetContextMenu(gin_helper::ErrorThrower thrower,
v8::Local<v8::Value> arg) {
gin::Handle<Menu> menu;
@@ -276,6 +280,7 @@ void Tray::BuildPrototype(v8::Isolate* isolate,
.SetMethod("removeBalloon", &Tray::RemoveBalloon)
.SetMethod("focus", &Tray::Focus)
.SetMethod("popUpContextMenu", &Tray::PopUpContextMenu)
.SetMethod("closeContextMenu", &Tray::CloseContextMenu)
.SetMethod("setContextMenu", &Tray::SetContextMenu)
.SetMethod("getBounds", &Tray::GetBounds);
}

View File

@@ -78,6 +78,7 @@ class Tray : public gin_helper::TrackableObject<Tray>, public TrayIconObserver {
void RemoveBalloon();
void Focus();
void PopUpContextMenu(gin_helper::Arguments* args);
void CloseContextMenu();
void SetContextMenu(gin_helper::ErrorThrower thrower,
v8::Local<v8::Value> arg);
gfx::Rect GetBounds();