Use set context menu when param is not specified
authorKevin Sawicki <kevinsawicki@gmail.com>
Tue, 28 Jun 2016 22:10:32 +0000 (15:10 -0700)
committerKevin Sawicki <kevinsawicki@gmail.com>
Wed, 29 Jun 2016 18:52:58 +0000 (11:52 -0700)
atom/browser/ui/tray_icon_cocoa.mm
atom/browser/ui/win/notify_icon.cc

index 8b25aa3540ff7f57e699a0f121a825727f071294..2510d3160cc6597ce05e9cff6b34de5659003a33 100644 (file)
@@ -263,7 +263,7 @@ const CGFloat kVerticalTitleMargin = 2;
   }
 
   if (menuController_ && ![menuController_ isMenuOpen]) {
-    // Redraw the dray icon to show highlight if it is enabled.
+    // Redraw the tray icon to show highlight if it is enabled.
     [self setNeedsDisplay:YES];
     [statusItem_ popUpStatusItemMenu:[menuController_ menu]];
     // The popUpStatusItemMenu returns only after the showing menu is closed.
index 0ccf46b832124c24008472f62e0b4261940e0025..a360c92cc4b90e19588e0e87dd844dc6276a70fa 100644 (file)
@@ -134,8 +134,9 @@ void NotifyIcon::DisplayBalloon(HICON icon,
 void NotifyIcon::PopUpContextMenu(const gfx::Point& pos,
                                   ui::SimpleMenuModel* menu_model) {
   // Returns if context menu isn't set.
-  if (!menu_model)
+  if (!menu_model && !menu_model_)
     return;
+
   // Set our window as the foreground window, so the context menu closes when
   // we click away from it.
   if (!SetForegroundWindow(window_))
@@ -147,7 +148,7 @@ void NotifyIcon::PopUpContextMenu(const gfx::Point& pos,
     rect.set_origin(gfx::Screen::GetScreen()->GetCursorScreenPoint());
 
   views::MenuRunner menu_runner(
-      menu_model,
+      menu_model ? menu_model : menu_model_,
       views::MenuRunner::CONTEXT_MENU | views::MenuRunner::HAS_MNEMONICS);
   ignore_result(menu_runner.RunMenuAt(
       NULL, NULL, rect, views::MENU_ANCHOR_TOPLEFT, ui::MENU_SOURCE_MOUSE));