win: Fix context menu clicking in notify icon.

This commit is contained in:
Cheng Zhao 2014-06-03 14:11:12 +08:00
parent 9ef7ecbdaf
commit 53092cfb7c
2 changed files with 5 additions and 3 deletions

View file

@ -4,8 +4,8 @@
#include "atom/browser/ui/win/notify_icon.h"
#include "atom/browser/ui/win/menu_2.h"
#include "atom/browser/ui/win/notify_icon_host.h"
#include "atom/browser/ui/win/menu_2.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/windows_version.h"
@ -60,8 +60,8 @@ void NotifyIcon::HandleClickEvent(const gfx::Point& cursor_pos,
if (!SetForegroundWindow(window_))
return;
scoped_ptr<Menu2> menu(new Menu2(menu_model_));
menu->RunContextMenuAt(cursor_pos);
menu_.reset(new Menu2(menu_model_));
menu_->RunContextMenuAt(cursor_pos);
}
void NotifyIcon::ResetIcon() {

View file

@ -22,6 +22,7 @@ class Point;
namespace atom {
class Menu2;
class NotifyIconHost;
class NotifyIcon : public TrayIcon {
@ -68,6 +69,7 @@ class NotifyIcon : public TrayIcon {
// The context menu.
ui::SimpleMenuModel* menu_model_;
scoped_ptr<atom::Menu2> menu_;
DISALLOW_COPY_AND_ASSIGN(NotifyIcon);
};