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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 45 additions and 2 deletions

View file

@ -199,8 +199,7 @@ void NotifyIcon::PopUpContextMenu(const gfx::Point& pos,
return;
// Cancel current menu if there is one.
if (menu_runner_ && menu_runner_->IsRunning())
menu_runner_->Cancel();
CloseContextMenu();
// Show menu at mouse's position by default.
gfx::Rect rect(pos, gfx::Size());
@ -231,6 +230,12 @@ void NotifyIcon::PopUpContextMenu(const gfx::Point& pos,
ui::MENU_SOURCE_MOUSE);
}
void NotifyIcon::CloseContextMenu() {
if (menu_runner_ && menu_runner_->IsRunning()) {
menu_runner_->Cancel();
}
}
void NotifyIcon::SetContextMenu(AtomMenuModel* menu_model) {
menu_model_ = menu_model;
}