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

Unified Diff: ui/views/focus/focus_manager.cc

Issue 727583002: Regression: Search+Key pops up app launcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « ui/base/ui_base.gyp ('k') | ui/wm/core/accelerator_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/focus/focus_manager.cc
diff --git a/ui/views/focus/focus_manager.cc b/ui/views/focus/focus_manager.cc
index 8dec8eaafb6097ed30e21e371689164b24dc7bb0..706b3182721dcafe37b86665445094ac5a4d283a 100644
--- a/ui/views/focus/focus_manager.cc
+++ b/ui/views/focus/focus_manager.cc
@@ -30,6 +30,18 @@ namespace views {
namespace {
+#if defined(OS_MACOSX) || defined(OS_CHROMEOS)
+static const int kEventFlagsMask = ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN |
+ ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN;
+#else
+static const int kEventFlagsMask = ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN |
+ ui::EF_ALT_DOWN;
+#endif
+
+static inline int CalculateModifiers(const ui::KeyEvent& event) {
+ return event.flags() & kEventFlagsMask;
+}
+
} // namespace
bool FocusManager::shortcut_handling_suspended_ = false;
@@ -59,17 +71,7 @@ bool FocusManager::OnKeyEvent(const ui::KeyEvent& event) {
if (shortcut_handling_suspended())
return true;
- int modifiers = ui::EF_NONE;
- if (event.IsShiftDown())
- modifiers |= ui::EF_SHIFT_DOWN;
- if (event.IsControlDown())
- modifiers |= ui::EF_CONTROL_DOWN;
- if (event.IsAltDown())
- modifiers |= ui::EF_ALT_DOWN;
-#if defined(OS_MACOSX) || defined(OS_CHROMEOS)
- if (event.IsCommandDown())
- modifiers |= ui::EF_COMMAND_DOWN;
-#endif
+ int modifiers = CalculateModifiers(event);
ui::Accelerator accelerator(event.key_code(), modifiers);
accelerator.set_type(event.type());
accelerator.set_is_repeat(event.IsRepeat());
« no previous file with comments | « ui/base/ui_base.gyp ('k') | ui/wm/core/accelerator_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698