| 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 30 matching lines...) Expand all Loading... |
| 53 // Process the accelerator normally. | 54 // Process the accelerator normally. |
| 54 RESTRICTION_NONE, | 55 RESTRICTION_NONE, |
| 55 | 56 |
| 56 // Don't process the accelerator. | 57 // Don't process the accelerator. |
| 57 RESTRICTION_PREVENT_PROCESSING, | 58 RESTRICTION_PREVENT_PROCESSING, |
| 58 | 59 |
| 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 global keyboard accelerators for the specified target. If |
| 64 // multiple targets are registered for an accelerator, a target registered | 65 // multiple targets are registered for any given accelerator, a target |
| 65 // later has higher priority. | 66 // registered later has higher priority. |
| 66 void Register(const ui::Accelerator& accelerator, | 67 void Register(const std::vector<ui::Accelerator>& accelerators, |
| 67 ui::AcceleratorTarget* target); | 68 ui::AcceleratorTarget* target); |
| 68 | 69 |
| 69 // Unregisters the specified keyboard accelerator for the specified target. | 70 // Unregisters the specified keyboard accelerator for the specified target. |
| 70 void Unregister(const ui::Accelerator& accelerator, | 71 void Unregister(const ui::Accelerator& accelerator, |
| 71 ui::AcceleratorTarget* target); | 72 ui::AcceleratorTarget* target); |
| 72 | 73 |
| 73 // Unregisters all keyboard accelerators for the specified target. | 74 // Unregisters all keyboard accelerators for the specified target. |
| 74 void UnregisterAll(ui::AcceleratorTarget* target); | 75 void UnregisterAll(ui::AcceleratorTarget* target); |
| 75 | 76 |
| 76 // Activates the target associated with the specified accelerator. | 77 // Activates the target associated with the specified accelerator. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 std::set<int> actions_needing_window_; | 214 std::set<int> actions_needing_window_; |
| 214 // Actions that can be performed without closing the menu (if one is present). | 215 // Actions that can be performed without closing the menu (if one is present). |
| 215 std::set<int> actions_keeping_menu_open_; | 216 std::set<int> actions_keeping_menu_open_; |
| 216 | 217 |
| 217 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); | 218 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); |
| 218 }; | 219 }; |
| 219 | 220 |
| 220 } // namespace ash | 221 } // namespace ash |
| 221 | 222 |
| 222 #endif // ASH_COMMON_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 223 #endif // ASH_COMMON_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
| OLD | NEW |