Map async option to MenuRunner::ASYNC flag
This commit is contained in:
parent
4430927f98
commit
66b6b4f1cb
1 changed files with 7 additions and 2 deletions
|
@ -20,7 +20,8 @@ MenuViews::MenuViews(v8::Isolate* isolate, v8::Local<v8::Object> wrapper)
|
||||||
weak_factory_(this) {
|
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());
|
NativeWindow* native_window = static_cast<NativeWindow*>(window->window());
|
||||||
if (!native_window)
|
if (!native_window)
|
||||||
return;
|
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);
|
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.
|
// Don't emit unresponsive event when showing menu.
|
||||||
atom::UnresponsiveSuppressor suppressor;
|
atom::UnresponsiveSuppressor suppressor;
|
||||||
|
|
||||||
// Show the menu.
|
// Show the menu.
|
||||||
menu_runner_.reset(new MenuRunner(
|
menu_runner_.reset(new MenuRunner(
|
||||||
model(),
|
model(),
|
||||||
MenuRunner::CONTEXT_MENU | MenuRunner::HAS_MNEMONICS | MenuRunner::ASYNC,
|
flags,
|
||||||
base::Bind(&MenuViews::OnMenuClosed, weak_factory_.GetWeakPtr())));
|
base::Bind(&MenuViews::OnMenuClosed, weak_factory_.GetWeakPtr())));
|
||||||
ignore_result(menu_runner_->RunMenuAt(
|
ignore_result(menu_runner_->RunMenuAt(
|
||||||
static_cast<NativeWindowViews*>(window->window())->widget(),
|
static_cast<NativeWindowViews*>(window->window())->widget(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue