| 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());
|
|
|