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

Side by Side Diff: ash/common/accelerators/accelerator_controller.cc

Issue 2434483003: Fix keyboard-activated context menus (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/accelerators/accelerator_controller.h" 5 #include "ash/common/accelerators/accelerator_controller.h"
6 6
7 #include "ash/common/accelerators/accelerator_commands.h" 7 #include "ash/common/accelerators/accelerator_commands.h"
8 #include "ash/common/accelerators/accelerator_controller_delegate.h" 8 #include "ash/common/accelerators/accelerator_controller_delegate.h"
9 #include "ash/common/accelerators/debug_commands.h" 9 #include "ash/common/accelerators/debug_commands.h"
10 #include "ash/common/accessibility_delegate.h" 10 #include "ash/common/accessibility_delegate.h"
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 return GetAcceleratorProcessingRestriction(-1); 580 return GetAcceleratorProcessingRestriction(-1);
581 } 581 }
582 582
583 void AcceleratorController::SetImeControlDelegate( 583 void AcceleratorController::SetImeControlDelegate(
584 std::unique_ptr<ImeControlDelegate> ime_control_delegate) { 584 std::unique_ptr<ImeControlDelegate> ime_control_delegate) {
585 ime_control_delegate_ = std::move(ime_control_delegate); 585 ime_control_delegate_ = std::move(ime_control_delegate);
586 } 586 }
587 587
588 bool AcceleratorController::ShouldCloseMenuAndRepostAccelerator( 588 bool AcceleratorController::ShouldCloseMenuAndRepostAccelerator(
589 const ui::Accelerator& accelerator) const { 589 const ui::Accelerator& accelerator) const {
590 // The context menu can be activated via Search+Shift+Volume up. When seeing
591 // any key up events involving these keys, don't ever close the menu as it was
592 // involved in opening the menu.
593 if (accelerator.type() == ui::ET_KEY_RELEASED &&
594 (accelerator.key_code() == ui::VKEY_LWIN || accelerator.IsShiftDown() ||
595 accelerator.key_code() == ui::VKEY_F10))
596 return false;
oshima 2016/10/21 18:10:42 Looks like this is caused by the TOGGLE_APP_LIST a
David Tseng 2016/10/21 20:29:25 Done. This appears to fix the issue; thanks for t
oshima 2016/10/24 18:53:04 This is because the menu runs nested message loop,
David Tseng 2016/10/24 19:03:56 The menu used to run a message loop: https://coder
597
590 auto itr = accelerators_.find(accelerator); 598 auto itr = accelerators_.find(accelerator);
591 if (itr == accelerators_.end()) 599 if (itr == accelerators_.end())
592 return false; // Menu shouldn't be closed for an invalid accelerator. 600 return false; // Menu shouldn't be closed for an invalid accelerator.
593 601
594 AcceleratorAction action = itr->second; 602 AcceleratorAction action = itr->second;
595 return actions_keeping_menu_open_.count(action) == 0; 603 return actions_keeping_menu_open_.count(action) == 0;
596 } 604 }
597 605
598 //////////////////////////////////////////////////////////////////////////////// 606 ////////////////////////////////////////////////////////////////////////////////
599 // AcceleratorController, ui::AcceleratorTarget implementation: 607 // AcceleratorController, ui::AcceleratorTarget implementation:
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() && 1131 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() &&
1124 actions_needing_window_.find(action) != actions_needing_window_.end()) { 1132 actions_needing_window_.find(action) != actions_needing_window_.end()) {
1125 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert( 1133 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert(
1126 A11Y_ALERT_WINDOW_NEEDED); 1134 A11Y_ALERT_WINDOW_NEEDED);
1127 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; 1135 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
1128 } 1136 }
1129 return RESTRICTION_NONE; 1137 return RESTRICTION_NONE;
1130 } 1138 }
1131 1139
1132 } // namespace ash 1140 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698