OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ash/common/accelerators/accelerator_table.h" | |
6 | |
7 #include "ash/strings/grit/ash_strings.h" | |
8 #include "base/macros.h" | |
9 | |
10 namespace ash { | |
11 | |
12 const int kDebugModifier = | |
13 ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN; | |
14 | |
15 const AcceleratorData kAcceleratorData[] = { | |
16 {true, ui::VKEY_SPACE, ui::EF_CONTROL_DOWN, PREVIOUS_IME}, | |
17 {false, ui::VKEY_SPACE, ui::EF_CONTROL_DOWN, PREVIOUS_IME}, | |
18 // Shortcuts for Japanese IME. | |
19 {true, ui::VKEY_CONVERT, ui::EF_NONE, SWITCH_IME}, | |
20 {true, ui::VKEY_NONCONVERT, ui::EF_NONE, SWITCH_IME}, | |
21 {true, ui::VKEY_DBE_SBCSCHAR, ui::EF_NONE, SWITCH_IME}, | |
22 {true, ui::VKEY_DBE_DBCSCHAR, ui::EF_NONE, SWITCH_IME}, | |
23 // Shortcut for Koren IME. | |
24 {true, ui::VKEY_HANGUL, ui::EF_NONE, SWITCH_IME}, | |
25 | |
26 {true, ui::VKEY_TAB, ui::EF_ALT_DOWN, CYCLE_FORWARD_MRU}, | |
27 {true, ui::VKEY_TAB, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, | |
28 CYCLE_BACKWARD_MRU}, | |
29 {true, ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_NONE, TOGGLE_OVERVIEW}, | |
30 {true, ui::VKEY_BROWSER_SEARCH, ui::EF_NONE, TOGGLE_APP_LIST}, | |
31 {true, ui::VKEY_WLAN, ui::EF_NONE, TOGGLE_WIFI}, | |
32 {true, ui::VKEY_KBD_BRIGHTNESS_DOWN, ui::EF_NONE, KEYBOARD_BRIGHTNESS_DOWN}, | |
33 {true, ui::VKEY_KBD_BRIGHTNESS_UP, ui::EF_NONE, KEYBOARD_BRIGHTNESS_UP}, | |
34 // Maximize button. | |
35 {true, ui::VKEY_MEDIA_LAUNCH_APP2, ui::EF_CONTROL_DOWN, TOGGLE_MIRROR_MODE}, | |
36 {true, ui::VKEY_MEDIA_LAUNCH_APP2, ui::EF_ALT_DOWN, SWAP_PRIMARY_DISPLAY}, | |
37 // Cycle windows button. | |
38 {true, ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_CONTROL_DOWN, TAKE_SCREENSHOT}, | |
39 {true, ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, | |
40 TAKE_PARTIAL_SCREENSHOT}, | |
41 {true, ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_ALT_DOWN | ui::EF_CONTROL_DOWN, | |
42 TAKE_WINDOW_SCREENSHOT}, | |
43 {true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_NONE, BRIGHTNESS_DOWN}, | |
44 {true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_ALT_DOWN, KEYBOARD_BRIGHTNESS_DOWN}, | |
45 {true, ui::VKEY_BRIGHTNESS_UP, ui::EF_NONE, BRIGHTNESS_UP}, | |
46 {true, ui::VKEY_BRIGHTNESS_UP, ui::EF_ALT_DOWN, KEYBOARD_BRIGHTNESS_UP}, | |
47 {true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | |
48 MAGNIFY_SCREEN_ZOOM_OUT}, | |
49 {true, ui::VKEY_BRIGHTNESS_UP, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | |
50 MAGNIFY_SCREEN_ZOOM_IN}, | |
51 {true, ui::VKEY_L, ui::EF_COMMAND_DOWN, LOCK_SCREEN}, | |
52 {true, ui::VKEY_L, ui::EF_COMMAND_DOWN | ui::EF_SHIFT_DOWN, SUSPEND}, | |
53 // The lock key on Chrome OS keyboards produces F13 scancodes. | |
54 {true, ui::VKEY_F13, ui::EF_NONE, LOCK_PRESSED}, | |
55 {false, ui::VKEY_F13, ui::EF_NONE, LOCK_RELEASED}, | |
56 // Generic keyboards can use VKEY_SLEEP to mimic ChromeOS keyboard's lock | |
57 // key. | |
58 {true, ui::VKEY_SLEEP, ui::EF_NONE, LOCK_PRESSED}, | |
59 {false, ui::VKEY_SLEEP, ui::EF_NONE, LOCK_RELEASED}, | |
60 {true, ui::VKEY_POWER, ui::EF_NONE, POWER_PRESSED}, | |
61 {false, ui::VKEY_POWER, ui::EF_NONE, POWER_RELEASED}, | |
62 {true, ui::VKEY_M, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, OPEN_FILE_MANAGER}, | |
63 {true, ui::VKEY_OEM_2, ui::EF_CONTROL_DOWN, OPEN_GET_HELP}, | |
64 {true, ui::VKEY_OEM_2, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, | |
65 OPEN_GET_HELP}, | |
66 {true, ui::VKEY_T, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, OPEN_CROSH}, | |
67 {true, ui::VKEY_I, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | |
68 TOUCH_HUD_MODE_CHANGE}, | |
69 {true, ui::VKEY_I, | |
70 ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN, | |
71 TOUCH_HUD_CLEAR}, | |
72 {true, ui::VKEY_P, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | |
73 TOUCH_HUD_PROJECTION_TOGGLE}, | |
74 {true, ui::VKEY_H, ui::EF_COMMAND_DOWN | ui::EF_SHIFT_DOWN, | |
75 TOGGLE_HIGH_CONTRAST}, | |
76 {true, ui::VKEY_Z, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | |
77 TOGGLE_SPOKEN_FEEDBACK}, | |
78 {true, ui::VKEY_OEM_COMMA, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | |
79 SWITCH_TO_PREVIOUS_USER}, | |
80 {true, ui::VKEY_OEM_PERIOD, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | |
81 SWITCH_TO_NEXT_USER}, | |
82 // Single shift release turns off caps lock. | |
83 {false, ui::VKEY_LSHIFT, ui::EF_NONE, DISABLE_CAPS_LOCK}, | |
84 {false, ui::VKEY_SHIFT, ui::EF_NONE, DISABLE_CAPS_LOCK}, | |
85 {false, ui::VKEY_RSHIFT, ui::EF_NONE, DISABLE_CAPS_LOCK}, | |
86 // Accelerators to toggle Caps Lock. | |
87 // The following is triggered when Search is released while Alt is still | |
88 // down. The key_code here is LWIN (for search) and Alt is a modifier. | |
89 {false, ui::VKEY_LWIN, ui::EF_ALT_DOWN, TOGGLE_CAPS_LOCK}, | |
90 // The following is triggered when Alt is released while search is still | |
91 // down. The key_code here is MENU (for Alt) and Search is a modifier | |
92 // (EF_COMMAND_DOWN is used for Search as a modifier). | |
93 {false, ui::VKEY_MENU, ui::EF_COMMAND_DOWN, TOGGLE_CAPS_LOCK}, | |
94 {true, ui::VKEY_VOLUME_MUTE, ui::EF_NONE, VOLUME_MUTE}, | |
95 {true, ui::VKEY_VOLUME_DOWN, ui::EF_NONE, VOLUME_DOWN}, | |
96 {true, ui::VKEY_VOLUME_UP, ui::EF_NONE, VOLUME_UP}, | |
97 {true, ui::VKEY_ESCAPE, ui::EF_COMMAND_DOWN, SHOW_TASK_MANAGER}, | |
98 {true, ui::VKEY_SPACE, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, NEXT_IME}, | |
99 {true, ui::VKEY_I, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, OPEN_FEEDBACK_PAGE}, | |
100 {true, ui::VKEY_Q, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, EXIT}, | |
101 {true, ui::VKEY_N, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, | |
102 NEW_INCOGNITO_WINDOW}, | |
103 {true, ui::VKEY_N, ui::EF_CONTROL_DOWN, NEW_WINDOW}, | |
104 {true, ui::VKEY_T, ui::EF_CONTROL_DOWN, NEW_TAB}, | |
105 {true, ui::VKEY_OEM_MINUS, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, | |
106 SCALE_UI_UP}, | |
107 {true, ui::VKEY_OEM_PLUS, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, | |
108 SCALE_UI_DOWN}, | |
109 {true, ui::VKEY_0, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, SCALE_UI_RESET}, | |
110 {true, ui::VKEY_BROWSER_REFRESH, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, | |
111 ROTATE_SCREEN}, | |
112 {true, ui::VKEY_BROWSER_REFRESH, | |
113 ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, ROTATE_WINDOW}, | |
114 {true, ui::VKEY_T, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, RESTORE_TAB}, | |
115 {true, ui::VKEY_PRINT, ui::EF_NONE, TAKE_SCREENSHOT}, | |
116 // On Chrome OS, Search key is mapped to LWIN. The Search key binding should | |
117 // act on release instead of press when using Search as a modifier key for | |
118 // extended keyboard shortcuts. | |
119 {false, ui::VKEY_LWIN, ui::EF_NONE, TOGGLE_APP_LIST}, | |
120 {true, ui::VKEY_MEDIA_LAUNCH_APP2, ui::EF_NONE, TOGGLE_FULLSCREEN}, | |
121 {true, ui::VKEY_MEDIA_LAUNCH_APP2, ui::EF_SHIFT_DOWN, TOGGLE_FULLSCREEN}, | |
122 {true, ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN | ui::EF_COMMAND_DOWN, UNPIN}, | |
123 {true, ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, FOCUS_SHELF}, | |
124 {true, ui::VKEY_HELP, ui::EF_NONE, SHOW_KEYBOARD_OVERLAY}, | |
125 {true, ui::VKEY_OEM_2, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | |
126 SHOW_KEYBOARD_OVERLAY}, | |
127 {true, ui::VKEY_OEM_2, | |
128 ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | |
129 SHOW_KEYBOARD_OVERLAY}, | |
130 {true, ui::VKEY_F14, ui::EF_NONE, SHOW_KEYBOARD_OVERLAY}, | |
131 {true, ui::VKEY_N, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, | |
132 SHOW_MESSAGE_CENTER_BUBBLE}, | |
133 {true, ui::VKEY_P, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, SHOW_STYLUS_TOOLS}, | |
134 {true, ui::VKEY_S, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, | |
135 SHOW_SYSTEM_TRAY_BUBBLE}, | |
136 {true, ui::VKEY_K, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, | |
137 SHOW_IME_MENU_BUBBLE}, | |
138 {true, ui::VKEY_1, ui::EF_ALT_DOWN, LAUNCH_APP_0}, | |
139 {true, ui::VKEY_2, ui::EF_ALT_DOWN, LAUNCH_APP_1}, | |
140 {true, ui::VKEY_3, ui::EF_ALT_DOWN, LAUNCH_APP_2}, | |
141 {true, ui::VKEY_4, ui::EF_ALT_DOWN, LAUNCH_APP_3}, | |
142 {true, ui::VKEY_5, ui::EF_ALT_DOWN, LAUNCH_APP_4}, | |
143 {true, ui::VKEY_6, ui::EF_ALT_DOWN, LAUNCH_APP_5}, | |
144 {true, ui::VKEY_7, ui::EF_ALT_DOWN, LAUNCH_APP_6}, | |
145 {true, ui::VKEY_8, ui::EF_ALT_DOWN, LAUNCH_APP_7}, | |
146 {true, ui::VKEY_9, ui::EF_ALT_DOWN, LAUNCH_LAST_APP}, | |
147 | |
148 // Window management shortcuts. | |
149 {true, ui::VKEY_OEM_4, ui::EF_ALT_DOWN, WINDOW_CYCLE_SNAP_DOCK_LEFT}, | |
150 {true, ui::VKEY_OEM_6, ui::EF_ALT_DOWN, WINDOW_CYCLE_SNAP_DOCK_RIGHT}, | |
151 {true, ui::VKEY_OEM_MINUS, ui::EF_ALT_DOWN, WINDOW_MINIMIZE}, | |
152 {true, ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN, TOGGLE_MAXIMIZED}, | |
153 {true, ui::VKEY_OEM_PLUS, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, | |
154 WINDOW_POSITION_CENTER}, | |
155 {true, ui::VKEY_BROWSER_FORWARD, ui::EF_CONTROL_DOWN, FOCUS_NEXT_PANE}, | |
156 {true, ui::VKEY_BROWSER_BACK, ui::EF_CONTROL_DOWN, FOCUS_PREVIOUS_PANE}, | |
157 | |
158 // Media Player shortcuts. | |
159 {true, ui::VKEY_MEDIA_NEXT_TRACK, ui::EF_NONE, MEDIA_NEXT_TRACK}, | |
160 {true, ui::VKEY_MEDIA_PLAY_PAUSE, ui::EF_NONE, MEDIA_PLAY_PAUSE}, | |
161 {true, ui::VKEY_MEDIA_PREV_TRACK, ui::EF_NONE, MEDIA_PREV_TRACK}, | |
162 | |
163 // Debugging shortcuts that need to be available to end-users in | |
164 // release builds. | |
165 {true, ui::VKEY_U, kDebugModifier, PRINT_UI_HIERARCHIES}, | |
166 | |
167 // TODO(yusukes): Handle VKEY_MEDIA_STOP, and | |
168 // VKEY_MEDIA_LAUNCH_MAIL. | |
169 }; | |
170 | |
171 const size_t kAcceleratorDataLength = arraysize(kAcceleratorData); | |
172 | |
173 // Instructions for how to deprecate and replace an Accelerator: | |
174 // | |
175 // 1- Replace the old deprecated accelerator from the above list with the new | |
176 // accelerator that will take its place. | |
177 // 2- Add an entry for it in the following |kDeprecatedAccelerators| list. | |
178 // 3- Add another entry in the |kDeprecatedAcceleratorsData|. | |
179 // 4- That entry should contain the following: | |
180 // - The action that the deprecated accelerator maps to. | |
181 // - Define a histogram for this action in |histograms.xml| in the form | |
182 // "Ash.Accelerators.Deprecated.{ActionName}" and include the name of this | |
183 // histogram in this entry. This name will be used as the ID of the | |
184 // notification to be shown to the user. This is to prevent duplication of | |
185 // same notification. | |
186 // - The ID of the localized notification message to give the users telling | |
187 // them about the deprecation (Add one in |ash_strings.grd|. Search for | |
188 // the comment <!-- Deprecated Accelerators Messages -->). | |
189 // - The IDs of the localized old and new shortcut text to be used to fill | |
190 // the notification text. Also found in |ash_strings.grd|. | |
191 // - {true or false} whether the deprecated accelerator is still enabled (we | |
192 // don't disable a deprecated accelerator abruptly). | |
193 // 5- Don't forget to update the keyboard overlay. Find 'shortcut' in the file | |
194 // keyboard_overlay_data.js. | |
195 const AcceleratorData kDeprecatedAccelerators[] = { | |
196 {true, ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, LOCK_SCREEN}, | |
197 {true, ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN, SHOW_TASK_MANAGER}}; | |
198 | |
199 const size_t kDeprecatedAcceleratorsLength = arraysize(kDeprecatedAccelerators); | |
200 | |
201 const DeprecatedAcceleratorData kDeprecatedAcceleratorsData[] = { | |
202 { | |
203 LOCK_SCREEN, "Ash.Accelerators.Deprecated.LockScreen", | |
204 IDS_DEPRECATED_LOCK_SCREEN_MSG, IDS_SHORTCUT_LOCK_SCREEN_OLD, | |
205 IDS_SHORTCUT_LOCK_SCREEN_NEW, | |
206 false // Old accelerator was disabled in M56. | |
207 }, | |
208 {SHOW_TASK_MANAGER, "Ash.Accelerators.Deprecated.ShowTaskManager", | |
209 IDS_DEPRECATED_SHOW_TASK_MANAGER_MSG, IDS_SHORTCUT_TASK_MANAGER_OLD, | |
210 IDS_SHORTCUT_TASK_MANAGER_NEW, true}}; | |
211 | |
212 const size_t kDeprecatedAcceleratorsDataLength = | |
213 arraysize(kDeprecatedAcceleratorsData); | |
214 | |
215 const AcceleratorData kDebugAcceleratorData[] = { | |
216 {true, ui::VKEY_N, kDebugModifier, TOGGLE_WIFI}, | |
217 {true, ui::VKEY_O, kDebugModifier, DEBUG_SHOW_TOAST}, | |
218 {true, ui::VKEY_P, ui::EF_COMMAND_DOWN | ui::EF_SHIFT_DOWN, | |
219 DEBUG_TOGGLE_TOUCH_PAD}, | |
220 {true, ui::VKEY_T, ui::EF_COMMAND_DOWN | ui::EF_SHIFT_DOWN, | |
221 DEBUG_TOGGLE_TOUCH_SCREEN}, | |
222 {true, ui::VKEY_T, kDebugModifier, DEBUG_TOGGLE_TOUCH_VIEW}, | |
223 {true, ui::VKEY_B, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | |
224 DEBUG_TOGGLE_WALLPAPER_MODE}, | |
225 {true, ui::VKEY_L, kDebugModifier, DEBUG_PRINT_LAYER_HIERARCHY}, | |
226 {true, ui::VKEY_V, kDebugModifier, DEBUG_PRINT_VIEW_HIERARCHY}, | |
227 {true, ui::VKEY_W, kDebugModifier, DEBUG_PRINT_WINDOW_HIERARCHY}, | |
228 {true, ui::VKEY_D, kDebugModifier, DEBUG_TOGGLE_DEVICE_SCALE_FACTOR}, | |
229 {true, ui::VKEY_B, kDebugModifier, DEBUG_TOGGLE_SHOW_DEBUG_BORDERS}, | |
230 {true, ui::VKEY_F, kDebugModifier, DEBUG_TOGGLE_SHOW_FPS_COUNTER}, | |
231 {true, ui::VKEY_P, kDebugModifier, DEBUG_TOGGLE_SHOW_PAINT_RECTS}, | |
232 {true, ui::VKEY_K, kDebugModifier, DEBUG_TRIGGER_CRASH}, | |
233 }; | |
234 | |
235 const size_t kDebugAcceleratorDataLength = arraysize(kDebugAcceleratorData); | |
236 | |
237 const AcceleratorData kDeveloperAcceleratorData[] = { | |
238 // Extra shortcut for debug build to control magnifier on Linux desktop. | |
239 {true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_CONTROL_DOWN, | |
240 MAGNIFY_SCREEN_ZOOM_OUT}, | |
241 {true, ui::VKEY_BRIGHTNESS_UP, ui::EF_CONTROL_DOWN, MAGNIFY_SCREEN_ZOOM_IN}, | |
242 // Extra shortcuts to lock the screen on Linux desktop. | |
243 {true, ui::VKEY_L, ui::EF_ALT_DOWN, LOCK_PRESSED}, | |
244 {false, ui::VKEY_L, ui::EF_ALT_DOWN, LOCK_RELEASED}, | |
245 {true, ui::VKEY_P, ui::EF_ALT_DOWN, POWER_PRESSED}, | |
246 {false, ui::VKEY_P, ui::EF_ALT_DOWN, POWER_RELEASED}, | |
247 {true, ui::VKEY_POWER, ui::EF_SHIFT_DOWN, LOCK_PRESSED}, | |
248 {false, ui::VKEY_POWER, ui::EF_SHIFT_DOWN, LOCK_RELEASED}, | |
249 {true, ui::VKEY_D, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, | |
250 DEV_ADD_REMOVE_DISPLAY}, | |
251 {true, ui::VKEY_J, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, | |
252 DEV_TOGGLE_UNIFIED_DESKTOP}, | |
253 {true, ui::VKEY_M, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, | |
254 TOGGLE_MIRROR_MODE}, | |
255 {true, ui::VKEY_W, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, TOGGLE_WIFI}, | |
256 // Extra shortcut for display swapping as Alt-F4 is taken on Linux desktop. | |
257 {true, ui::VKEY_S, kDebugModifier, SWAP_PRIMARY_DISPLAY}, | |
258 // Extra shortcut to rotate/scale up/down the screen on Linux desktop. | |
259 {true, ui::VKEY_R, kDebugModifier, ROTATE_SCREEN}, | |
260 // For testing on systems where Alt-Tab is already mapped. | |
261 {true, ui::VKEY_W, ui::EF_ALT_DOWN, CYCLE_FORWARD_MRU}, | |
262 {true, ui::VKEY_F11, ui::EF_CONTROL_DOWN, | |
263 DEV_TOGGLE_ROOT_WINDOW_FULL_SCREEN}, | |
264 {true, ui::VKEY_W, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, CYCLE_BACKWARD_MRU}, | |
265 {true, ui::VKEY_F, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, | |
266 TOGGLE_FULLSCREEN}, | |
267 }; | |
268 | |
269 const size_t kDeveloperAcceleratorDataLength = | |
270 arraysize(kDeveloperAcceleratorData); | |
271 | |
272 const AcceleratorAction kPreferredActions[] = { | |
273 // Window cycling accelerators. | |
274 CYCLE_BACKWARD_MRU, // Shift+Alt+Tab | |
275 CYCLE_FORWARD_MRU, // Alt+Tab | |
276 }; | |
277 | |
278 const size_t kPreferredActionsLength = arraysize(kPreferredActions); | |
279 | |
280 const AcceleratorAction kReservedActions[] = { | |
281 POWER_PRESSED, POWER_RELEASED, SUSPEND, | |
282 }; | |
283 | |
284 const size_t kReservedActionsLength = arraysize(kReservedActions); | |
285 | |
286 const AcceleratorAction kActionsAllowedAtLoginOrLockScreen[] = { | |
287 BRIGHTNESS_DOWN, | |
288 BRIGHTNESS_UP, | |
289 DEBUG_PRINT_LAYER_HIERARCHY, | |
290 DEBUG_PRINT_VIEW_HIERARCHY, | |
291 DEBUG_PRINT_WINDOW_HIERARCHY, | |
292 DEBUG_TOGGLE_TOUCH_PAD, | |
293 DEBUG_TOGGLE_TOUCH_SCREEN, | |
294 DEBUG_TOGGLE_TOUCH_VIEW, | |
295 DEV_ADD_REMOVE_DISPLAY, | |
296 DISABLE_CAPS_LOCK, | |
297 KEYBOARD_BRIGHTNESS_DOWN, | |
298 KEYBOARD_BRIGHTNESS_UP, | |
299 MAGNIFY_SCREEN_ZOOM_IN, // Control+F7 | |
300 MAGNIFY_SCREEN_ZOOM_OUT, // Control+F6 | |
301 NEXT_IME, | |
302 PREVIOUS_IME, | |
303 PRINT_UI_HIERARCHIES, | |
304 ROTATE_SCREEN, | |
305 SCALE_UI_DOWN, | |
306 SCALE_UI_RESET, | |
307 SCALE_UI_UP, | |
308 SHOW_IME_MENU_BUBBLE, | |
309 SHOW_SYSTEM_TRAY_BUBBLE, | |
310 SWITCH_IME, // Switch to another IME depending on the accelerator. | |
311 TAKE_PARTIAL_SCREENSHOT, | |
312 TAKE_SCREENSHOT, | |
313 TAKE_WINDOW_SCREENSHOT, | |
314 TOGGLE_CAPS_LOCK, | |
315 TOGGLE_HIGH_CONTRAST, | |
316 TOGGLE_MIRROR_MODE, | |
317 TOGGLE_SPOKEN_FEEDBACK, | |
318 TOGGLE_WIFI, | |
319 TOUCH_HUD_CLEAR, | |
320 VOLUME_DOWN, | |
321 VOLUME_MUTE, | |
322 VOLUME_UP, | |
323 #if !defined(NDEBUG) | |
324 POWER_PRESSED, | |
325 POWER_RELEASED, | |
326 #endif // !defined(NDEBUG) | |
327 }; | |
328 | |
329 const size_t kActionsAllowedAtLoginOrLockScreenLength = | |
330 arraysize(kActionsAllowedAtLoginOrLockScreen); | |
331 | |
332 const AcceleratorAction kActionsAllowedAtLockScreen[] = { | |
333 EXIT, SUSPEND, | |
334 }; | |
335 | |
336 const size_t kActionsAllowedAtLockScreenLength = | |
337 arraysize(kActionsAllowedAtLockScreen); | |
338 | |
339 const AcceleratorAction kActionsAllowedAtModalWindow[] = { | |
340 BRIGHTNESS_DOWN, | |
341 BRIGHTNESS_UP, | |
342 DEBUG_TOGGLE_TOUCH_PAD, | |
343 DEBUG_TOGGLE_TOUCH_SCREEN, | |
344 DEV_ADD_REMOVE_DISPLAY, | |
345 DISABLE_CAPS_LOCK, | |
346 EXIT, | |
347 KEYBOARD_BRIGHTNESS_DOWN, | |
348 KEYBOARD_BRIGHTNESS_UP, | |
349 LOCK_SCREEN, | |
350 MAGNIFY_SCREEN_ZOOM_IN, | |
351 MAGNIFY_SCREEN_ZOOM_OUT, | |
352 MEDIA_NEXT_TRACK, | |
353 MEDIA_PLAY_PAUSE, | |
354 MEDIA_PREV_TRACK, | |
355 NEXT_IME, | |
356 OPEN_FEEDBACK_PAGE, | |
357 POWER_PRESSED, | |
358 POWER_RELEASED, | |
359 PREVIOUS_IME, | |
360 PRINT_UI_HIERARCHIES, | |
361 ROTATE_SCREEN, | |
362 SCALE_UI_DOWN, | |
363 SCALE_UI_RESET, | |
364 SCALE_UI_UP, | |
365 SHOW_IME_MENU_BUBBLE, | |
366 SHOW_KEYBOARD_OVERLAY, | |
367 SUSPEND, | |
368 SWAP_PRIMARY_DISPLAY, | |
369 SWITCH_IME, | |
370 TAKE_PARTIAL_SCREENSHOT, | |
371 TAKE_SCREENSHOT, | |
372 TAKE_WINDOW_SCREENSHOT, | |
373 TOGGLE_CAPS_LOCK, | |
374 TOGGLE_HIGH_CONTRAST, | |
375 TOGGLE_MIRROR_MODE, | |
376 TOGGLE_SPOKEN_FEEDBACK, | |
377 TOGGLE_WIFI, | |
378 VOLUME_DOWN, | |
379 VOLUME_MUTE, | |
380 VOLUME_UP, | |
381 }; | |
382 | |
383 const size_t kActionsAllowedAtModalWindowLength = | |
384 arraysize(kActionsAllowedAtModalWindow); | |
385 | |
386 const AcceleratorAction kRepeatableActions[] = { | |
387 BRIGHTNESS_DOWN, | |
388 BRIGHTNESS_UP, | |
389 FOCUS_NEXT_PANE, | |
390 FOCUS_PREVIOUS_PANE, | |
391 KEYBOARD_BRIGHTNESS_DOWN, | |
392 KEYBOARD_BRIGHTNESS_UP, | |
393 MAGNIFY_SCREEN_ZOOM_IN, | |
394 MAGNIFY_SCREEN_ZOOM_OUT, | |
395 MEDIA_NEXT_TRACK, | |
396 MEDIA_PREV_TRACK, | |
397 RESTORE_TAB, | |
398 VOLUME_DOWN, | |
399 VOLUME_UP, | |
400 }; | |
401 | |
402 const size_t kRepeatableActionsLength = arraysize(kRepeatableActions); | |
403 | |
404 const AcceleratorAction kActionsAllowedInAppModeOrPinnedMode[] = { | |
405 BRIGHTNESS_DOWN, | |
406 BRIGHTNESS_UP, | |
407 DEBUG_PRINT_LAYER_HIERARCHY, | |
408 DEBUG_PRINT_VIEW_HIERARCHY, | |
409 DEBUG_PRINT_WINDOW_HIERARCHY, | |
410 DEBUG_TOGGLE_TOUCH_PAD, | |
411 DEBUG_TOGGLE_TOUCH_SCREEN, | |
412 DEV_ADD_REMOVE_DISPLAY, | |
413 DISABLE_CAPS_LOCK, | |
414 KEYBOARD_BRIGHTNESS_DOWN, | |
415 KEYBOARD_BRIGHTNESS_UP, | |
416 MAGNIFY_SCREEN_ZOOM_IN, // Control+F7 | |
417 MAGNIFY_SCREEN_ZOOM_OUT, // Control+F6 | |
418 MEDIA_NEXT_TRACK, | |
419 MEDIA_PLAY_PAUSE, | |
420 MEDIA_PREV_TRACK, | |
421 NEXT_IME, | |
422 POWER_PRESSED, | |
423 POWER_RELEASED, | |
424 PREVIOUS_IME, | |
425 PRINT_UI_HIERARCHIES, | |
426 ROTATE_SCREEN, | |
427 SCALE_UI_DOWN, | |
428 SCALE_UI_RESET, | |
429 SCALE_UI_UP, | |
430 SWAP_PRIMARY_DISPLAY, | |
431 SWITCH_IME, // Switch to another IME depending on the accelerator. | |
432 TOGGLE_CAPS_LOCK, | |
433 TOGGLE_HIGH_CONTRAST, | |
434 TOGGLE_MIRROR_MODE, | |
435 TOGGLE_SPOKEN_FEEDBACK, | |
436 TOGGLE_WIFI, | |
437 TOUCH_HUD_CLEAR, | |
438 VOLUME_DOWN, | |
439 VOLUME_MUTE, | |
440 VOLUME_UP, | |
441 }; | |
442 | |
443 const size_t kActionsAllowedInAppModeOrPinnedModeLength = | |
444 arraysize(kActionsAllowedInAppModeOrPinnedMode); | |
445 | |
446 const AcceleratorAction kActionsAllowedInPinnedMode[] = { | |
447 LOCK_SCREEN, | |
448 SUSPEND, | |
449 TAKE_PARTIAL_SCREENSHOT, | |
450 TAKE_SCREENSHOT, | |
451 TAKE_WINDOW_SCREENSHOT, | |
452 UNPIN, | |
453 }; | |
454 | |
455 const size_t kActionsAllowedInPinnedModeLength = | |
456 arraysize(kActionsAllowedInPinnedMode); | |
457 | |
458 const AcceleratorAction kActionsNeedingWindow[] = { | |
459 CYCLE_BACKWARD_MRU, | |
460 CYCLE_FORWARD_MRU, | |
461 TOGGLE_OVERVIEW, | |
462 WINDOW_CYCLE_SNAP_DOCK_LEFT, | |
463 WINDOW_CYCLE_SNAP_DOCK_RIGHT, | |
464 WINDOW_MINIMIZE, | |
465 TOGGLE_FULLSCREEN, | |
466 TOGGLE_MAXIMIZED, | |
467 WINDOW_POSITION_CENTER, | |
468 ROTATE_WINDOW, | |
469 }; | |
470 | |
471 const size_t kActionsNeedingWindowLength = arraysize(kActionsNeedingWindow); | |
472 | |
473 const AcceleratorAction kActionsKeepingMenuOpen[] = { | |
474 BRIGHTNESS_DOWN, | |
475 BRIGHTNESS_UP, | |
476 DEBUG_TOGGLE_TOUCH_PAD, | |
477 DEBUG_TOGGLE_TOUCH_SCREEN, | |
478 DISABLE_CAPS_LOCK, | |
479 KEYBOARD_BRIGHTNESS_DOWN, | |
480 KEYBOARD_BRIGHTNESS_UP, | |
481 MEDIA_NEXT_TRACK, | |
482 MEDIA_PLAY_PAUSE, | |
483 MEDIA_PREV_TRACK, | |
484 NEXT_IME, | |
485 PREVIOUS_IME, | |
486 PRINT_UI_HIERARCHIES, | |
487 SWITCH_IME, | |
488 TAKE_PARTIAL_SCREENSHOT, | |
489 TAKE_SCREENSHOT, | |
490 TAKE_WINDOW_SCREENSHOT, | |
491 TOGGLE_APP_LIST, | |
492 TOGGLE_CAPS_LOCK, | |
493 TOGGLE_HIGH_CONTRAST, | |
494 TOGGLE_SPOKEN_FEEDBACK, | |
495 TOGGLE_WIFI, | |
496 VOLUME_DOWN, | |
497 VOLUME_MUTE, | |
498 VOLUME_UP, | |
499 }; | |
500 | |
501 const size_t kActionsKeepingMenuOpenLength = arraysize(kActionsKeepingMenuOpen); | |
502 | |
503 } // namespace ash | |
OLD | NEW |