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_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 5 #ifndef ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
6 #define ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 6 #define ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
| 11 #include "ash/accelerators/accelerator_table.h" |
11 #include "ash/accelerators/exit_warning_handler.h" | 12 #include "ash/accelerators/exit_warning_handler.h" |
12 #include "ash/ash_export.h" | 13 #include "ash/ash_export.h" |
13 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
17 #include "ui/base/accelerators/accelerator.h" | 18 #include "ui/base/accelerators/accelerator.h" |
18 | 19 |
19 namespace ui { | 20 namespace ui { |
20 class AcceleratorManager; | 21 class AcceleratorManager; |
21 } | 22 } |
22 | 23 |
23 namespace ash { | 24 namespace ash { |
24 | 25 |
25 struct AcceleratorData; | |
26 class BrightnessControlDelegate; | 26 class BrightnessControlDelegate; |
27 class ExitWarningHandler; | 27 class ExitWarningHandler; |
28 class ImeControlDelegate; | 28 class ImeControlDelegate; |
29 class KeyboardBrightnessControlDelegate; | 29 class KeyboardBrightnessControlDelegate; |
30 class ScreenshotDelegate; | 30 class ScreenshotDelegate; |
31 class VolumeControlDelegate; | 31 class VolumeControlDelegate; |
32 | 32 |
33 // Stores information about accelerator context, eg. previous accelerator | 33 // Stores information about accelerator context, eg. previous accelerator |
34 // or if the current accelerator is repeated or not. | 34 // or if the current accelerator is repeated or not. |
35 class ASH_EXPORT AcceleratorControllerContext { | 35 class ASH_EXPORT AcceleratorControllerContext { |
(...skipping 22 matching lines...) Expand all Loading... |
58 }; | 58 }; |
59 | 59 |
60 // AcceleratorController provides functions for registering or unregistering | 60 // AcceleratorController provides functions for registering or unregistering |
61 // global keyboard accelerators, which are handled earlier than any windows. It | 61 // global keyboard accelerators, which are handled earlier than any windows. It |
62 // also implements several handlers as an accelerator target. | 62 // also implements several handlers as an accelerator target. |
63 class ASH_EXPORT AcceleratorController : public ui::AcceleratorTarget { | 63 class ASH_EXPORT AcceleratorController : public ui::AcceleratorTarget { |
64 public: | 64 public: |
65 AcceleratorController(); | 65 AcceleratorController(); |
66 virtual ~AcceleratorController(); | 66 virtual ~AcceleratorController(); |
67 | 67 |
| 68 // Installs/Uninstalls accelerators for the magnified screen. |
| 69 void InstallMagnifierAccelerators(); |
| 70 void UninstallMagnifierAccelerators(); |
| 71 |
68 // Registers a global keyboard accelerator for the specified target. If | 72 // Registers a global keyboard accelerator for the specified target. If |
69 // multiple targets are registered for an accelerator, a target registered | 73 // multiple targets are registered for an accelerator, a target registered |
70 // later has higher priority. | 74 // later has higher priority. |
71 void Register(const ui::Accelerator& accelerator, | 75 void Register(const ui::Accelerator& accelerator, |
72 ui::AcceleratorTarget* target); | 76 ui::AcceleratorTarget* target); |
73 | 77 |
74 // Unregisters the specified keyboard accelerator for the specified target. | 78 // Unregisters the specified keyboard accelerator for the specified target. |
75 void Unregister(const ui::Accelerator& accelerator, | 79 void Unregister(const ui::Accelerator& accelerator, |
76 ui::AcceleratorTarget* target); | 80 ui::AcceleratorTarget* target); |
77 | 81 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 ExitWarningHandler* GetExitWarningHandlerForTest() { | 128 ExitWarningHandler* GetExitWarningHandlerForTest() { |
125 return &exit_warning_handler_; | 129 return &exit_warning_handler_; |
126 } | 130 } |
127 | 131 |
128 private: | 132 private: |
129 FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest, GlobalAccelerators); | 133 FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest, GlobalAccelerators); |
130 | 134 |
131 // Initializes the accelerators this class handles as a target. | 135 // Initializes the accelerators this class handles as a target. |
132 void Init(); | 136 void Init(); |
133 | 137 |
134 // Registers the specified accelerators. | 138 // Registers/Unregisters the specified accelerators. |
135 void RegisterAccelerators(const AcceleratorData accelerators[], | 139 void RegisterAccelerators(const AcceleratorData accelerators[], |
136 size_t accelerators_length); | 140 size_t accelerators_length); |
| 141 void UnregisterAccelerators(const AcceleratorData accelerators[], |
| 142 size_t accelerators_length); |
| 143 |
| 144 void AddReservedAction(AcceleratorAction action); |
| 145 void RemoveReservedAction(AcceleratorAction action); |
137 | 146 |
138 void SetKeyboardBrightnessControlDelegate( | 147 void SetKeyboardBrightnessControlDelegate( |
139 scoped_ptr<KeyboardBrightnessControlDelegate> | 148 scoped_ptr<KeyboardBrightnessControlDelegate> |
140 keyboard_brightness_control_delegate); | 149 keyboard_brightness_control_delegate); |
141 | 150 |
142 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; | 151 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; |
143 | 152 |
144 // TODO(derat): BrightnessControlDelegate is also used by the system tray; | 153 // TODO(derat): BrightnessControlDelegate is also used by the system tray; |
145 // move it outside of this class. | 154 // move it outside of this class. |
146 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate_; | 155 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate_; |
(...skipping 27 matching lines...) Expand all Loading... |
174 std::set<int> actions_allowed_in_app_mode_; | 183 std::set<int> actions_allowed_in_app_mode_; |
175 // Actions disallowed if there are no windows. | 184 // Actions disallowed if there are no windows. |
176 std::set<int> actions_needing_window_; | 185 std::set<int> actions_needing_window_; |
177 | 186 |
178 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); | 187 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); |
179 }; | 188 }; |
180 | 189 |
181 } // namespace ash | 190 } // namespace ash |
182 | 191 |
183 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 192 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
OLD | NEW |