Index: ash/accelerators/accelerator_controller.cc |
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc |
index 6eb68a3921409ddb09a7388551f83661ff71e866..b14b3c8ee52b1cd106333951eb3d0617293dbb1b 100644 |
--- a/ash/accelerators/accelerator_controller.cc |
+++ b/ash/accelerators/accelerator_controller.cc |
@@ -786,6 +786,19 @@ void AcceleratorController::SetScreenshotDelegate( |
screenshot_delegate_ = screenshot_delegate.Pass(); |
} |
+bool AcceleratorController::ShouldMenuBeKeptOpenForAccelerator( |
+ const ui::Accelerator& accelerator) const { |
+ auto itr = accelerators_.find(accelerator); |
+ if (itr == accelerators_.end()) |
+ return true; // Menu shouldn't be closed for an invalid accelerator. |
+ |
+ AcceleratorAction action = itr->second; |
+ if (actions_keeping_menu_open_.count(action)) |
+ return true; |
+ |
+ return false; |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// AcceleratorController, ui::AcceleratorTarget implementation: |
@@ -830,6 +843,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); |