Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_ | 5 #ifndef ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_ |
| 6 #define ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_ | 6 #define ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <vector> | |
| 11 | 12 |
| 12 #include "ash/mus/accelerators/accelerator_handler.h" | 13 #include "ash/mus/accelerators/accelerator_handler.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "ui/base/accelerators/accelerator.h" | 15 #include "ui/base/accelerators/accelerator.h" |
| 15 #include "ui/base/accelerators/accelerator_manager_delegate.h" | 16 #include "ui/base/accelerators/accelerator_manager_delegate.h" |
| 16 #include "ui/events/mojo/event_constants.mojom.h" | 17 #include "ui/events/mojo/event_constants.mojom.h" |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 | 20 |
| 20 class AcceleratorRouter; | 21 class AcceleratorRouter; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 31 public ui::AcceleratorManagerDelegate { | 32 public ui::AcceleratorManagerDelegate { |
| 32 public: | 33 public: |
| 33 AcceleratorControllerRegistrar(WindowManager* window_manager, | 34 AcceleratorControllerRegistrar(WindowManager* window_manager, |
| 34 uint16_t id_namespace); | 35 uint16_t id_namespace); |
| 35 ~AcceleratorControllerRegistrar() override; | 36 ~AcceleratorControllerRegistrar() override; |
| 36 | 37 |
| 37 // AcceleratorHandler: | 38 // AcceleratorHandler: |
| 38 ui::mojom::EventResult OnAccelerator(uint32_t id, | 39 ui::mojom::EventResult OnAccelerator(uint32_t id, |
| 39 const ui::Event& event) override; | 40 const ui::Event& event) override; |
| 40 | 41 |
| 42 private: | |
| 41 // ui::AcceleratorManagerDelegate: | 43 // ui::AcceleratorManagerDelegate: |
| 42 void OnAcceleratorRegistered(const ui::Accelerator& accelerator) override; | 44 void OnAcceleratorRegistered(const ui::Accelerator& accelerator) override; |
| 43 void OnAcceleratorUnregistered(const ui::Accelerator& accelerator) override; | 45 void OnAcceleratorUnregistered(const ui::Accelerator& accelerator) override; |
| 44 | 46 |
|
mfomitchev
2017/01/24 22:56:02
Remove whitespace since OnAcceleratorVectorRegiste
thanhph1
2017/01/25 20:12:37
Done.
| |
| 45 private: | 47 void OnAcceleratorVectorRegistered( |
| 48 const std::vector<ui::Accelerator>& accelerators) override; | |
| 49 | |
| 50 // Generate id and add the corresponding accelerator to accelerator vector. | |
| 51 // Creates a PRE_TARGET and POST_TARGET mojom accelerators for the provided | |
| 52 // |accelerator| and adds them to the provided |accelerator_vector|. | |
| 53 void AddAcceleratorToVector( | |
| 54 const ui::Accelerator& accelerator, | |
| 55 std::vector<ui::mojom::AcceleratorPtr>& accelerator_vector); | |
| 56 | |
| 46 friend class AcceleratorControllerRegistrarTestApi; | 57 friend class AcceleratorControllerRegistrarTestApi; |
|
mfomitchev
2017/01/24 22:56:02
Friend declaration should be in the beginning of t
thanhph1
2017/01/25 20:12:37
Done.
| |
| 47 | 58 |
| 48 // The flow of accelerators in ash is: | 59 // The flow of accelerators in ash is: |
| 49 // . wm::AcceleratorFilter() sees events first as it's a pre-target handler. | 60 // . wm::AcceleratorFilter() sees events first as it's a pre-target handler. |
| 50 // . AcceleratorFilter forwards to its delegate, which indirectly is | 61 // . AcceleratorFilter forwards to its delegate, which indirectly is |
| 51 // implemented by AcceleratorRouter. | 62 // implemented by AcceleratorRouter. |
| 52 // . AcceleratorRouter may early out, if not it calls through to | 63 // . AcceleratorRouter may early out, if not it calls through to |
| 53 // AcceleratorController. This stop may stop propagation entirely. | 64 // AcceleratorController. This stop may stop propagation entirely. |
| 54 // . If focus is on a Widget, then NativeWidgetAura gets the key event, calls | 65 // . If focus is on a Widget, then NativeWidgetAura gets the key event, calls |
| 55 // to Widget::OnKeyEvent(), which calls to FocusManager::OnKeyEvent(), which | 66 // to Widget::OnKeyEvent(), which calls to FocusManager::OnKeyEvent(), which |
| 56 // calls to AshFocusManagerFactory::Delegate::ProcessAccelerator() finally | 67 // calls to AshFocusManagerFactory::Delegate::ProcessAccelerator() finally |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 // Maps from accelerator to the two ids registered for it. | 103 // Maps from accelerator to the two ids registered for it. |
| 93 std::map<ui::Accelerator, Ids> accelerator_to_ids_; | 104 std::map<ui::Accelerator, Ids> accelerator_to_ids_; |
| 94 | 105 |
| 95 DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerRegistrar); | 106 DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerRegistrar); |
| 96 }; | 107 }; |
| 97 | 108 |
| 98 } // namespace mus | 109 } // namespace mus |
| 99 } // namespace ash | 110 } // namespace ash |
| 100 | 111 |
| 101 #endif // ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_ | 112 #endif // ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_ |
| OLD | NEW |