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