OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/mus/accelerators/accelerator_controller_registrar_test_api.h" |
| 6 |
| 7 #include "ash/mus/accelerators/accelerator_controller_registrar.h" |
| 8 #include "ash/mus/accelerators/accelerator_ids.h" |
| 9 #include "ash/mus/bridge/wm_shell_mus_test_api.h" |
| 10 #include "ui/base/accelerators/accelerator.h" |
| 11 #include "ui/events/event.h" |
| 12 |
| 13 namespace ash { |
| 14 namespace mus { |
| 15 |
| 16 AcceleratorControllerRegistrarTestApi::AcceleratorControllerRegistrarTestApi() { |
| 17 } |
| 18 |
| 19 AcceleratorControllerRegistrarTestApi:: |
| 20 ~AcceleratorControllerRegistrarTestApi() {} |
| 21 |
| 22 void AcceleratorControllerRegistrarTestApi::ProcessAccelerator( |
| 23 const ui::Accelerator& accelerator) { |
| 24 const ui::KeyEvent key_event(accelerator.type(), accelerator.key_code(), |
| 25 accelerator.modifiers()); |
| 26 AcceleratorControllerRegistrar* registrar = |
| 27 WmShellMusTestApi().accelerator_controller_registrar(); |
| 28 const AcceleratorControllerRegistrar::Ids& ids = |
| 29 registrar->accelerator_to_ids_[accelerator]; |
| 30 const uint32_t pre_id = |
| 31 ComputeAcceleratorId(registrar->id_namespace_, ids.pre_id); |
| 32 if (registrar->OnAccelerator(pre_id, key_event) == |
| 33 ui::mojom::EventResult::HANDLED) { |
| 34 return; |
| 35 } |
| 36 |
| 37 const uint32_t post_id = |
| 38 ComputeAcceleratorId(registrar->id_namespace_, ids.post_id); |
| 39 registrar->OnAccelerator(post_id, key_event); |
| 40 } |
| 41 |
| 42 } // namespace mus |
| 43 } // namespace ash |
OLD | NEW |