Browse Source

Map async option to MenuRunner::ASYNC flag

Kevin Sawicki 8 years ago
parent
commit
66b6b4f1cb
1 changed files with 7 additions and 2 deletions
  1. 7 2
      atom/browser/api/atom_api_menu_views.cc

+ 7 - 2
atom/browser/api/atom_api_menu_views.cc

@@ -20,7 +20,8 @@ MenuViews::MenuViews(v8::Isolate* isolate, v8::Local<v8::Object> wrapper)
       weak_factory_(this) {
 }
 
-void MenuViews::PopupAt(Window* window, int x, int y, int positioning_item) {
+void MenuViews::PopupAt(
+    Window* window, int x, int y, int positioning_item, bool async) {
   NativeWindow* native_window = static_cast<NativeWindow*>(window->window());
   if (!native_window)
     return;
@@ -40,13 +41,17 @@ void MenuViews::PopupAt(Window* window, int x, int y, int positioning_item) {
     location = gfx::Point(origin.x() + x, origin.y() + y);
   }
 
+  int flags = MenuRunner::CONTEXT_MENU | MenuRunner::HAS_MNEMONICS;
+  if (async)
+    flags |= MenuRunner::ASYNC;
+
   // Don't emit unresponsive event when showing menu.
   atom::UnresponsiveSuppressor suppressor;
 
   // Show the menu.
   menu_runner_.reset(new MenuRunner(
       model(),
-      MenuRunner::CONTEXT_MENU | MenuRunner::HAS_MNEMONICS | MenuRunner::ASYNC,
+      flags,
       base::Bind(&MenuViews::OnMenuClosed, weak_factory_.GetWeakPtr())));
   ignore_result(menu_runner_->RunMenuAt(
       static_cast<NativeWindowViews*>(window->window())->widget(),