OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/accelerators/nested_accelerator_delegate.h" | 5 #include "ash/accelerators/nested_accelerator_delegate.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ui/aura/window_event_dispatcher.h" | 9 #include "ui/aura/window_event_dispatcher.h" |
10 #include "ui/base/accelerators/accelerator.h" | 10 #include "ui/base/accelerators/accelerator.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 bool NestedAcceleratorDelegate::ProcessEvent(const ui::KeyEvent& key_event) { | 57 bool NestedAcceleratorDelegate::ProcessEvent(const ui::KeyEvent& key_event) { |
58 ash::AcceleratorController* accelerator_controller = | 58 ash::AcceleratorController* accelerator_controller = |
59 ash::Shell::GetInstance()->accelerator_controller(); | 59 ash::Shell::GetInstance()->accelerator_controller(); |
60 if (!accelerator_controller) | 60 if (!accelerator_controller) |
61 return false; | 61 return false; |
62 const int kModifierMask = | 62 const int kModifierMask = |
63 (ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN); | 63 (ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN); |
64 ui::Accelerator accelerator(key_event.key_code(), | 64 ui::Accelerator accelerator(key_event.key_code(), |
65 key_event.flags() & kModifierMask); | 65 key_event.flags() & kModifierMask); |
| 66 accelerator.set_is_repeat(key_event.IsRepeat()); |
66 if (key_event.type() == ui::ET_KEY_RELEASED) | 67 if (key_event.type() == ui::ET_KEY_RELEASED) |
67 accelerator.set_type(ui::ET_KEY_RELEASED); | 68 accelerator.set_type(ui::ET_KEY_RELEASED); |
68 // Fill out context object so AcceleratorController will know what | |
69 // was the previous accelerator or if the current accelerator is repeated. | |
70 Shell::GetInstance()->accelerator_controller()->context()->UpdateContext( | |
71 accelerator); | |
72 return accelerator_controller->Process(accelerator); | 69 return accelerator_controller->Process(accelerator); |
73 } | 70 } |
74 | 71 |
75 } // namespace ash | 72 } // namespace ash |
OLD | NEW |