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