| 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> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // AcceleratorHandler: | 38 // AcceleratorHandler: |
| 39 ui::mojom::EventResult OnAccelerator( | 39 ui::mojom::EventResult OnAccelerator( |
| 40 uint32_t id, | 40 uint32_t id, |
| 41 const ui::Event& event, | 41 const ui::Event& event, |
| 42 std::unordered_map<std::string, std::vector<uint8_t>>* properties) | 42 std::unordered_map<std::string, std::vector<uint8_t>>* properties) |
| 43 override; | 43 override; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 friend class AcceleratorControllerRegistrarTestApi; | 46 friend class AcceleratorControllerRegistrarTestApi; |
| 47 | 47 |
| 48 // Accelerators for window cycle. |
| 49 const ui::Accelerator window_cycle_complete_accelerator_; |
| 50 const ui::Accelerator window_cycle_cancel_accelerator_; |
| 51 |
| 48 // ui::AcceleratorManagerDelegate: | 52 // ui::AcceleratorManagerDelegate: |
| 49 void OnAcceleratorsRegistered( | 53 void OnAcceleratorsRegistered( |
| 50 const std::vector<ui::Accelerator>& accelerators) override; | 54 const std::vector<ui::Accelerator>& accelerators) override; |
| 51 void OnAcceleratorUnregistered(const ui::Accelerator& accelerator) override; | 55 void OnAcceleratorUnregistered(const ui::Accelerator& accelerator) override; |
| 52 | 56 |
| 53 // Generate id and add the corresponding accelerator to accelerator vector. | 57 // Generate id and add the corresponding accelerator to accelerator vector. |
| 54 // Creates a PRE_TARGET and POST_TARGET mojom accelerators for the provided | 58 // Creates a PRE_TARGET and POST_TARGET mojom accelerators for the provided |
| 55 // |accelerator| and adds them to the provided |accelerator_vector|. | 59 // |accelerator| and adds them to the provided |accelerator_vector|. |
| 56 void AddAcceleratorToVector( | 60 void AddAcceleratorToVector( |
| 57 const ui::Accelerator& accelerator, | 61 const ui::Accelerator& accelerator, |
| 58 std::vector<ui::mojom::WmAcceleratorPtr>& accelerator_vector); | 62 std::vector<ui::mojom::WmAcceleratorPtr>& accelerator_vector); |
| 59 | 63 |
| 64 // TODO(moshayedi): crbug.com/629191. Handling window cycle accelerators here |
| 65 // is just a temporary solution and we should remove these once we have a |
| 66 // proper solution. |
| 67 void RegisterWindowCycleAccelerators(); |
| 68 bool HandleWindowCycleAccelerator(const ui::Accelerator& accelerator); |
| 69 |
| 60 // The flow of accelerators in ash is: | 70 // The flow of accelerators in ash is: |
| 61 // . wm::AcceleratorFilter() sees events first as it's a pre-target handler. | 71 // . wm::AcceleratorFilter() sees events first as it's a pre-target handler. |
| 62 // . AcceleratorFilter forwards to its delegate, which indirectly is | 72 // . AcceleratorFilter forwards to its delegate, which indirectly is |
| 63 // implemented by AcceleratorRouter. | 73 // implemented by AcceleratorRouter. |
| 64 // . AcceleratorRouter may early out, if not it calls through to | 74 // . AcceleratorRouter may early out, if not it calls through to |
| 65 // AcceleratorController. This stop may stop propagation entirely. | 75 // AcceleratorController. This stop may stop propagation entirely. |
| 66 // . If focus is on a Widget, then NativeWidgetAura gets the key event, calls | 76 // . If focus is on a Widget, then NativeWidgetAura gets the key event, calls |
| 67 // to Widget::OnKeyEvent(), which calls to FocusManager::OnKeyEvent(), which | 77 // to Widget::OnKeyEvent(), which calls to FocusManager::OnKeyEvent(), which |
| 68 // calls to AshFocusManagerFactory::Delegate::ProcessAccelerator() finally | 78 // calls to AshFocusManagerFactory::Delegate::ProcessAccelerator() finally |
| 69 // ending up in AcceleratorController::Process(). | 79 // ending up in AcceleratorController::Process(). |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // Maps from accelerator to the two ids registered for it. | 114 // Maps from accelerator to the two ids registered for it. |
| 105 std::map<ui::Accelerator, Ids> accelerator_to_ids_; | 115 std::map<ui::Accelerator, Ids> accelerator_to_ids_; |
| 106 | 116 |
| 107 DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerRegistrar); | 117 DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerRegistrar); |
| 108 }; | 118 }; |
| 109 | 119 |
| 110 } // namespace mus | 120 } // namespace mus |
| 111 } // namespace ash | 121 } // namespace ash |
| 112 | 122 |
| 113 #endif // ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_ | 123 #endif // ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_ |
| OLD | NEW |