Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(970)

Unified Diff: ash/accelerators/accelerator_controller.cc

Issue 1138523006: Enable keyboard accelerators while a menu is open (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed a bug in restoring the delegate of the parent nested runloop. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/accelerators/accelerator_controller.cc
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 51417661cfb5cee0c6204a0b246ff28421c8ba96..f790595256e6bb34a3600cb83049dc344b68943e 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -720,6 +720,19 @@ void AcceleratorController::SetScreenshotDelegate(
screenshot_delegate_ = screenshot_delegate.Pass();
}
+bool AcceleratorController::ShouldCloseMenuAndRepostAccelerator(
+ const ui::Accelerator& accelerator) const {
+ auto itr = accelerators_.find(accelerator);
+ if (itr == accelerators_.end())
+ return false; // Menu shouldn't be closed for an invalid accelerator.
+
+ AcceleratorAction action = itr->second;
+ if (actions_keeping_menu_open_.count(action))
pkotwicz 2015/08/27 17:19:55 How about: return actions_keeping_menu_open_.count
afakhry 2015/08/28 01:24:41 Much better! Done. Thanks! :)
+ return false;
+
+ return true;
+}
+
////////////////////////////////////////////////////////////////////////////////
// AcceleratorController, ui::AcceleratorTarget implementation:
@@ -764,6 +777,8 @@ void AcceleratorController::Init() {
actions_allowed_in_app_mode_.insert(kActionsAllowedInAppMode[i]);
for (size_t i = 0; i < kActionsNeedingWindowLength; ++i)
actions_needing_window_.insert(kActionsNeedingWindow[i]);
+ for (size_t i = 0; i < kActionsKeepingMenuOpenLength; ++i)
+ actions_keeping_menu_open_.insert(kActionsKeepingMenuOpen[i]);
RegisterAccelerators(kAcceleratorData, kAcceleratorDataLength);

Powered by Google App Engine
This is Rietveld 408576698