| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // is just a temporary solution and we should remove these once we have a | 65 // is just a temporary solution and we should remove these once we have a |
| 66 // proper solution. | 66 // proper solution. |
| 67 void RegisterWindowCycleAccelerators(); | 67 void RegisterWindowCycleAccelerators(); |
| 68 bool HandleWindowCycleAccelerator(const ui::Accelerator& accelerator); | 68 bool HandleWindowCycleAccelerator(const ui::Accelerator& accelerator); |
| 69 | 69 |
| 70 // The flow of accelerators in ash is: | 70 // The flow of accelerators in ash is: |
| 71 // . 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. |
| 72 // . AcceleratorFilter forwards to its delegate, which indirectly is | 72 // . AcceleratorFilter forwards to its delegate, which indirectly is |
| 73 // implemented by AcceleratorRouter. | 73 // implemented by AcceleratorRouter. |
| 74 // . AcceleratorRouter may early out, if not it calls through to | 74 // . AcceleratorRouter may early out, if not it calls through to |
| 75 // AcceleratorController. This stop may stop propagation entirely. | 75 // AcceleratorController. This may stop propagation entirely. |
| 76 // . 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 |
| 77 // to Widget::OnKeyEvent(), which calls to FocusManager::OnKeyEvent(), which | 77 // to Widget::OnKeyEvent(), which calls to FocusManager::OnKeyEvent(), which |
| 78 // calls to AshFocusManagerFactory::Delegate::ProcessAccelerator() finally | 78 // calls to AshFocusManagerFactory::Delegate::ProcessAccelerator() finally |
| 79 // ending up in AcceleratorController::Process(). | 79 // ending up in AcceleratorController::Process(). |
| 80 // . OTOH if focus is on a content, then | 80 // . OTOH if focus is on a content, then |
| 81 // RenderWidgetHostViewAura::OnKeyEvent() is called and may end up consuming | 81 // RenderWidgetHostViewAura::OnKeyEvent() is called and may end up consuming |
| 82 // the event. | 82 // the event. |
| 83 // | 83 // |
| 84 // To get this behavior for mash we register accelerators for both pre and | 84 // To get this behavior for mash we register accelerators for both pre and |
| 85 // post. Pre gives the behavior of AcceleratorRouter and post that of | 85 // post. Pre gives the behavior of AcceleratorRouter and post that of |
| (...skipping 28 matching lines...) Expand all Loading... |
| 114 // Maps from accelerator to the two ids registered for it. | 114 // Maps from accelerator to the two ids registered for it. |
| 115 std::map<ui::Accelerator, Ids> accelerator_to_ids_; | 115 std::map<ui::Accelerator, Ids> accelerator_to_ids_; |
| 116 | 116 |
| 117 DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerRegistrar); | 117 DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerRegistrar); |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 } // namespace mus | 120 } // namespace mus |
| 121 } // namespace ash | 121 } // namespace ash |
| 122 | 122 |
| 123 #endif // ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_ | 123 #endif // ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_ |
| OLD | NEW |