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

Unified Diff: ui/views/controls/button/custom_button.cc

Issue 1544803004: Fix accelerator handling for in-menu buttons in the app menu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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: ui/views/controls/button/custom_button.cc
diff --git a/ui/views/controls/button/custom_button.cc b/ui/views/controls/button/custom_button.cc
index e8ce4a003e394c3ff8f5ae260888f8806ddf8b1c..30ac579aebf39f3f3bd0ecb3363eab262f784481 100644
--- a/ui/views/controls/button/custom_button.cc
+++ b/ui/views/controls/button/custom_button.cc
@@ -265,8 +265,9 @@ bool CustomButton::AcceleratorPressed(const ui::Accelerator& accelerator) {
// Should only handle accelerators when active. However, only top level
// widgets can be active, so for child widgets check if they are focused
// instead.
- if ((IsChildWidget() && !FocusInChildWidget()) ||
- (!IsChildWidget() && !GetWidget()->IsActive())) {
+ if (!ShouldHandleAcceleratorWhenInactive() &&
+ ((IsChildWidget() && !FocusInChildWidget()) ||
+ (!IsChildWidget() && !GetWidget()->IsActive()))) {
return false;
}
SetState(STATE_NORMAL);
@@ -361,6 +362,10 @@ bool CustomButton::ShouldEnterPushedState(const ui::Event& event) {
return IsTriggerableEvent(event);
}
+bool CustomButton::ShouldHandleAcceleratorWhenInactive() {
+ return false;
+}
+
bool CustomButton::ShouldEnterHoveredState() {
if (!visible())
return false;
« ui/views/controls/button/custom_button.h ('K') | « ui/views/controls/button/custom_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698