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 #ifndef ASH_ACCELERATORS_ACCELERATOR_TABLE_H_
6 #define ASH_ACCELERATORS_ACCELERATOR_TABLE_H_
8 #include "ash/ash_export.h"
9 #include "base/basictypes.h"
10 #include "ui/events/event_constants.h"
11 #include "ui/events/keycodes/keyboard_codes.h"
15 // There are four classes of accelerators in Ash:
18 // * Neither packaged apps nor web pages can cancel.
19 // * For example, Alt-Tab window cycling.
20 // * See kReservedActions below.
22 // Chrome OS system keys:
23 // * For legacy reasons, v1 apps can process and cancel. Otherwise handled
25 // * Brightness, volume control, etc.
26 // * See IsSystemKey() in ash/accelerators/accelerator_filter.cc.
29 // * Packaged apps can cancel but web pages cannot.
30 // * For example, browser back and forward from first-row function keys.
31 // * See IsReservedCommandOrKey() in
32 // chrome/browser/ui/browser_command_controller.cc.
34 // Browser non-reserved:
35 // * Both packaged apps and web pages can cancel.
36 // * For example, selecting tabs by number with Ctrl-1 to Ctrl-9.
37 // * See kAcceleratorMap in chrome/browser/ui/views/accelerator_table.cc.
39 // In particular, there is not an accelerator processing pass for Ash after
40 // the browser gets the accelerator. See crbug.com/285308 for details.
42 // There are also various restrictions on accelerators allowed at the login
43 // screen, when running in "forced app mode" (like a kiosk), etc. See the
44 // various kActionsAllowed* below.
46 // Please put if/def sections at the end of the bare section and keep the list
47 // within each section in alphabetical order.
48 enum AcceleratorAction
{
49 ACCESSIBLE_FOCUS_NEXT
,
50 ACCESSIBLE_FOCUS_PREVIOUS
,
55 DEBUG_TOGGLE_DEVICE_SCALE_FACTOR
,
56 DEBUG_TOGGLE_SHOW_DEBUG_BORDERS
,
57 DEBUG_TOGGLE_SHOW_FPS_COUNTER
,
58 DEBUG_TOGGLE_SHOW_PAINT_RECTS
,
64 KEYBOARD_BRIGHTNESS_DOWN
,
65 KEYBOARD_BRIGHTNESS_UP
,
77 MAGNIFY_SCREEN_ZOOM_IN
,
78 MAGNIFY_SCREEN_ZOOM_OUT
,
90 PRINT_LAYER_HIERARCHY
,
93 PRINT_WINDOW_HIERARCHY
,
100 SHOW_KEYBOARD_OVERLAY
,
101 SHOW_MESSAGE_CENTER_BUBBLE
,
102 SHOW_SYSTEM_TRAY_BUBBLE
,
104 SILENCE_SPOKEN_FEEDBACK
,
105 SWAP_PRIMARY_DISPLAY
,
106 SWITCH_IME
, // Switch to another IME depending on the accelerator.
107 TAKE_PARTIAL_SCREENSHOT
,
111 TOGGLE_CAPS_LOCK_BY_ALT_LWIN
,
112 TOGGLE_DESKTOP_BACKGROUND_MODE
,
116 TOGGLE_ROOT_WINDOW_FULL_SCREEN
,
117 TOGGLE_SPOKEN_FEEDBACK
,
118 TOGGLE_TOUCH_VIEW_TESTING
,
121 TOUCH_HUD_MODE_CHANGE
,
122 TOUCH_HUD_PROJECTION_TOGGLE
,
127 WINDOW_POSITION_CENTER
,
130 #if defined(OS_CHROMEOS)
133 DISABLE_GPU_WATCHDOG
,
138 SWITCH_TO_PREVIOUS_USER
,
142 struct AcceleratorData
{
143 bool trigger_on_press
;
144 ui::KeyboardCode keycode
;
146 AcceleratorAction action
;
149 // Accelerators handled by AcceleratorController.
150 ASH_EXPORT
extern const AcceleratorData kAcceleratorData
[];
151 ASH_EXPORT
extern const size_t kAcceleratorDataLength
;
154 // Accelerators useful when running on desktop. Debug build only.
155 ASH_EXPORT
extern const AcceleratorData kDesktopAcceleratorData
[];
156 ASH_EXPORT
extern const size_t kDesktopAcceleratorDataLength
;
159 // Debug accelerators enabled only when "Debugging keyboard shortcuts" flag
160 // (--ash-debug-shortcuts) is enabled.
161 ASH_EXPORT
extern const AcceleratorData kDebugAcceleratorData
[];
162 ASH_EXPORT
extern const size_t kDebugAcceleratorDataLength
;
164 // Actions that should be handled very early in Ash unless the current target
165 // window is full-screen.
166 ASH_EXPORT
extern const AcceleratorAction kReservedActions
[];
167 ASH_EXPORT
extern const size_t kReservedActionsLength
;
169 // Actions that should be handled very early in Ash unless the current target
170 // window is full-screen, these actions are only handled if
171 // DebugShortcutsEnabled is true (command line switch 'ash-debug-shortcuts').
172 ASH_EXPORT
extern const AcceleratorAction kReservedDebugActions
[];
173 ASH_EXPORT
extern const size_t kReservedDebugActionsLength
;
175 // Actions allowed while user is not signed in or screen is locked.
176 ASH_EXPORT
extern const AcceleratorAction kActionsAllowedAtLoginOrLockScreen
[];
177 ASH_EXPORT
extern const size_t kActionsAllowedAtLoginOrLockScreenLength
;
179 // Actions allowed while screen is locked (in addition to
180 // kActionsAllowedAtLoginOrLockScreen).
181 ASH_EXPORT
extern const AcceleratorAction kActionsAllowedAtLockScreen
[];
182 ASH_EXPORT
extern const size_t kActionsAllowedAtLockScreenLength
;
184 // Actions allowed while a modal window is up.
185 ASH_EXPORT
extern const AcceleratorAction kActionsAllowedAtModalWindow
[];
186 ASH_EXPORT
extern const size_t kActionsAllowedAtModalWindowLength
;
188 // Actions which will not be repeated while holding an accelerator key.
189 ASH_EXPORT
extern const AcceleratorAction kNonrepeatableActions
[];
190 ASH_EXPORT
extern const size_t kNonrepeatableActionsLength
;
192 // Actions allowed in app mode.
193 ASH_EXPORT
extern const AcceleratorAction kActionsAllowedInAppMode
[];
194 ASH_EXPORT
extern const size_t kActionsAllowedInAppModeLength
;
196 // Actions that require at least 1 window.
197 ASH_EXPORT
extern const AcceleratorAction kActionsNeedingWindow
[];
198 ASH_EXPORT
extern const size_t kActionsNeedingWindowLength
;
202 #endif // ASH_ACCELERATORS_ACCELERATOR_TABLE_H_