Fixing Windows tray icon content menu - based on chrome/browser/ui/views/status_icons/status_icon_win.cc

This commit is contained in:
Catalin Fratila 2017-08-01 12:15:49 +02:00 committed by Aleksei Kuzmin
parent 90fbe5c06c
commit 60b363fa3b
2 changed files with 10 additions and 3 deletions

View file

@ -147,10 +147,10 @@ void NotifyIcon::PopUpContextMenu(const gfx::Point& pos,
if (pos.IsOrigin())
rect.set_origin(display::Screen::GetScreen()->GetCursorScreenPoint());
views::MenuRunner menu_runner(
menu_runner_.reset(new views::MenuRunner(
menu_model != nullptr ? menu_model : menu_model_,
views::MenuRunner::CONTEXT_MENU | views::MenuRunner::HAS_MNEMONICS);
ignore_result(menu_runner.RunMenuAt(
views::MenuRunner::CONTEXT_MENU | views::MenuRunner::HAS_MNEMONICS));
ignore_result(menu_runner_->RunMenuAt(
NULL, NULL, rect, views::MENU_ANCHOR_TOPLEFT, ui::MENU_SOURCE_MOUSE));
}

View file

@ -20,6 +20,10 @@ namespace gfx {
class Point;
}
namespace views {
class MenuRunner;
}
namespace atom {
class NotifyIconHost;
@ -77,6 +81,9 @@ class NotifyIcon : public TrayIcon {
// The context menu.
AtomMenuModel* menu_model_;
// Context menu associated with this icon (if any).
std::unique_ptr<views::MenuRunner> menu_runner_;
DISALLOW_COPY_AND_ASSIGN(NotifyIcon);
};