| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMMON_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 5 #ifndef ASH_COMMON_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
| 6 #define ASH_COMMON_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 6 #define ASH_COMMON_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <vector> |
| 13 | 14 |
| 14 #include "ash/ash_export.h" | 15 #include "ash/ash_export.h" |
| 15 #include "ash/common/accelerators/accelerator_table.h" | 16 #include "ash/common/accelerators/accelerator_table.h" |
| 16 #include "ash/common/accelerators/exit_warning_handler.h" | 17 #include "ash/common/accelerators/exit_warning_handler.h" |
| 17 #include "ash/public/interfaces/accelerator_controller.mojom.h" | 18 #include "ash/public/interfaces/accelerator_controller.mojom.h" |
| 18 #include "base/compiler_specific.h" | 19 #include "base/compiler_specific.h" |
| 19 #include "base/gtest_prod_util.h" | 20 #include "base/gtest_prod_util.h" |
| 20 #include "base/macros.h" | 21 #include "base/macros.h" |
| 21 #include "mojo/public/cpp/bindings/binding_set.h" | 22 #include "mojo/public/cpp/bindings/binding_set.h" |
| 22 #include "ui/base/accelerators/accelerator.h" | 23 #include "ui/base/accelerators/accelerator.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // Don't process the accelerator and prevent propagation to other targets. | 60 // Don't process the accelerator and prevent propagation to other targets. |
| 60 RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION | 61 RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 // Registers a global keyboard accelerator for the specified target. If | 64 // Registers a global keyboard accelerator for the specified target. If |
| 64 // multiple targets are registered for an accelerator, a target registered | 65 // multiple targets are registered for an accelerator, a target registered |
| 65 // later has higher priority. | 66 // later has higher priority. |
| 66 void Register(const ui::Accelerator& accelerator, | 67 void Register(const ui::Accelerator& accelerator, |
| 67 ui::AcceleratorTarget* target); | 68 ui::AcceleratorTarget* target); |
| 68 | 69 |
| 70 void Registers(std::vector<ui::Accelerator>& ui_accelerators); |
| 71 |
| 69 // Unregisters the specified keyboard accelerator for the specified target. | 72 // Unregisters the specified keyboard accelerator for the specified target. |
| 70 void Unregister(const ui::Accelerator& accelerator, | 73 void Unregister(const ui::Accelerator& accelerator, |
| 71 ui::AcceleratorTarget* target); | 74 ui::AcceleratorTarget* target); |
| 72 | 75 |
| 73 // Unregisters all keyboard accelerators for the specified target. | 76 // Unregisters all keyboard accelerators for the specified target. |
| 74 void UnregisterAll(ui::AcceleratorTarget* target); | 77 void UnregisterAll(ui::AcceleratorTarget* target); |
| 75 | 78 |
| 76 // Activates the target associated with the specified accelerator. | 79 // Activates the target associated with the specified accelerator. |
| 77 // First, AcceleratorPressed handler of the most recently registered target | 80 // First, AcceleratorPressed handler of the most recently registered target |
| 78 // is called, and if that handler processes the event (i.e. returns true), | 81 // is called, and if that handler processes the event (i.e. returns true), |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 std::set<int> actions_needing_window_; | 216 std::set<int> actions_needing_window_; |
| 214 // Actions that can be performed without closing the menu (if one is present). | 217 // Actions that can be performed without closing the menu (if one is present). |
| 215 std::set<int> actions_keeping_menu_open_; | 218 std::set<int> actions_keeping_menu_open_; |
| 216 | 219 |
| 217 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); | 220 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); |
| 218 }; | 221 }; |
| 219 | 222 |
| 220 } // namespace ash | 223 } // namespace ash |
| 221 | 224 |
| 222 #endif // ASH_COMMON_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 225 #endif // ASH_COMMON_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
| OLD | NEW |