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 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest, | 126 FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest, |
127 DontRepeatToggleFullscreen); | 127 DontRepeatToggleFullscreen); |
128 | 128 |
129 // Initializes the accelerators this class handles as a target. | 129 // Initializes the accelerators this class handles as a target. |
130 void Init(); | 130 void Init(); |
131 | 131 |
132 // Registers the specified accelerators. | 132 // Registers the specified accelerators. |
133 void RegisterAccelerators(const AcceleratorData accelerators[], | 133 void RegisterAccelerators(const AcceleratorData accelerators[], |
134 size_t accelerators_length); | 134 size_t accelerators_length); |
135 | 135 |
| 136 // Registers the deprecated and their replacing accelerators. |
| 137 void RegisterDeprecatedAccelerators( |
| 138 const DeprecatedAcceleratorData deprecated_accelerators[], |
| 139 size_t length); |
| 140 |
136 // Returns whether |action| can be performed. The |accelerator| may provide | 141 // Returns whether |action| can be performed. The |accelerator| may provide |
137 // additional data the action needs. | 142 // additional data the action needs. |
138 bool CanPerformAction(AcceleratorAction action, | 143 bool CanPerformAction(AcceleratorAction action, |
139 const ui::Accelerator& accelerator); | 144 const ui::Accelerator& accelerator); |
140 | 145 |
141 // Performs the specified action. The |accelerator| may provide additional | 146 // Performs the specified action. The |accelerator| may provide additional |
142 // data the action needs. | 147 // data the action needs. |
143 void PerformAction(AcceleratorAction action, | 148 void PerformAction(AcceleratorAction action, |
144 const ui::Accelerator& accelerator); | 149 const ui::Accelerator& accelerator); |
145 | 150 |
(...skipping 23 matching lines...) Expand all Loading... |
169 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; | 174 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; |
170 | 175 |
171 // Handles the exit accelerator which requires a double press to exit and | 176 // Handles the exit accelerator which requires a double press to exit and |
172 // shows a popup with an explanation. | 177 // shows a popup with an explanation. |
173 ExitWarningHandler exit_warning_handler_; | 178 ExitWarningHandler exit_warning_handler_; |
174 | 179 |
175 // A map from accelerators to the AcceleratorAction values, which are used in | 180 // A map from accelerators to the AcceleratorAction values, which are used in |
176 // the implementation. | 181 // the implementation. |
177 std::map<ui::Accelerator, AcceleratorAction> accelerators_; | 182 std::map<ui::Accelerator, AcceleratorAction> accelerators_; |
178 | 183 |
| 184 std::map<AcceleratorAction, const DeprecatedAcceleratorData*> |
| 185 actions_with_deprecations_; |
| 186 std::set<ui::Accelerator> deprecated_accelerators_; |
| 187 |
179 // Actions allowed when the user is not signed in. | 188 // Actions allowed when the user is not signed in. |
180 std::set<int> actions_allowed_at_login_screen_; | 189 std::set<int> actions_allowed_at_login_screen_; |
181 // Actions allowed when the screen is locked. | 190 // Actions allowed when the screen is locked. |
182 std::set<int> actions_allowed_at_lock_screen_; | 191 std::set<int> actions_allowed_at_lock_screen_; |
183 // Actions allowed when a modal window is up. | 192 // Actions allowed when a modal window is up. |
184 std::set<int> actions_allowed_at_modal_window_; | 193 std::set<int> actions_allowed_at_modal_window_; |
185 // Preferred actions. See accelerator_table.h for details. | 194 // Preferred actions. See accelerator_table.h for details. |
186 std::set<int> preferred_actions_; | 195 std::set<int> preferred_actions_; |
187 // Reserved actions. See accelerator_table.h for details. | 196 // Reserved actions. See accelerator_table.h for details. |
188 std::set<int> reserved_actions_; | 197 std::set<int> reserved_actions_; |
189 // Actions which will not be repeated while holding the accelerator key. | 198 // Actions which will not be repeated while holding the accelerator key. |
190 std::set<int> nonrepeatable_actions_; | 199 std::set<int> nonrepeatable_actions_; |
191 // Actions allowed in app mode. | 200 // Actions allowed in app mode. |
192 std::set<int> actions_allowed_in_app_mode_; | 201 std::set<int> actions_allowed_in_app_mode_; |
193 // Actions disallowed if there are no windows. | 202 // Actions disallowed if there are no windows. |
194 std::set<int> actions_needing_window_; | 203 std::set<int> actions_needing_window_; |
195 | 204 |
196 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); | 205 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); |
197 }; | 206 }; |
198 | 207 |
199 } // namespace ash | 208 } // namespace ash |
200 | 209 |
201 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ | 210 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ |
OLD | NEW |