Home | History | Annotate | Download | only in accelerators
      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/accelerators/accelerator_table.h"
      6 
      7 #include "base/basictypes.h"
      8 
      9 namespace ash {
     10 
     11 const AcceleratorData kAcceleratorData[] = {
     12   // We have to define 3 entries for Shift+Alt. VKEY_[LR]MENU might be sent to
     13   // the accelerator controller when RenderWidgetHostViewAura is focused, and
     14   // VKEY_MENU might be when it's not (e.g. when NativeWidgetAura is focused).
     15   { false, ui::VKEY_LMENU, ui::EF_SHIFT_DOWN, NEXT_IME },
     16   { false, ui::VKEY_MENU, ui::EF_SHIFT_DOWN, NEXT_IME },
     17   { false, ui::VKEY_RMENU, ui::EF_SHIFT_DOWN, NEXT_IME },
     18   // The same is true for Alt+Shift.
     19   { false, ui::VKEY_LSHIFT, ui::EF_ALT_DOWN, NEXT_IME },
     20   { false, ui::VKEY_SHIFT, ui::EF_ALT_DOWN, NEXT_IME },
     21   { false, ui::VKEY_RSHIFT, ui::EF_ALT_DOWN, NEXT_IME },
     22   { true, ui::VKEY_SPACE, ui::EF_CONTROL_DOWN, PREVIOUS_IME },
     23   { false, ui::VKEY_SPACE, ui::EF_CONTROL_DOWN, PREVIOUS_IME },
     24   // Shortcuts for Japanese IME.
     25   { true, ui::VKEY_CONVERT, ui::EF_NONE, SWITCH_IME },
     26   { true, ui::VKEY_NONCONVERT, ui::EF_NONE, SWITCH_IME },
     27   { true, ui::VKEY_DBE_SBCSCHAR, ui::EF_NONE, SWITCH_IME },
     28   { true, ui::VKEY_DBE_DBCSCHAR, ui::EF_NONE, SWITCH_IME },
     29   // Shortcut for Koren IME.
     30   { true, ui::VKEY_HANGUL, ui::EF_NONE, SWITCH_IME },
     31 
     32   { true, ui::VKEY_TAB, ui::EF_ALT_DOWN, CYCLE_FORWARD_MRU },
     33   { true, ui::VKEY_TAB, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN,
     34     CYCLE_BACKWARD_MRU },
     35   { true, ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_NONE, TOGGLE_OVERVIEW },
     36 #if defined(OS_CHROMEOS)
     37   { true, ui::VKEY_BROWSER_SEARCH, ui::EF_NONE, TOGGLE_APP_LIST },
     38   { true, ui::VKEY_WLAN, ui::EF_NONE, TOGGLE_WIFI },
     39   { true, ui::VKEY_KBD_BRIGHTNESS_DOWN, ui::EF_NONE, KEYBOARD_BRIGHTNESS_DOWN },
     40   { true, ui::VKEY_KBD_BRIGHTNESS_UP, ui::EF_NONE, KEYBOARD_BRIGHTNESS_UP },
     41   // Maximize button.
     42   { true, ui::VKEY_MEDIA_LAUNCH_APP2, ui::EF_CONTROL_DOWN, TOGGLE_MIRROR_MODE },
     43   { true, ui::VKEY_MEDIA_LAUNCH_APP2, ui::EF_ALT_DOWN, SWAP_PRIMARY_DISPLAY },
     44   // Cycle windows button.
     45   { true, ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_CONTROL_DOWN, TAKE_SCREENSHOT },
     46   { true, ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
     47     TAKE_PARTIAL_SCREENSHOT },
     48   { true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_NONE, BRIGHTNESS_DOWN },
     49   { true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_ALT_DOWN, KEYBOARD_BRIGHTNESS_DOWN },
     50   { true, ui::VKEY_BRIGHTNESS_UP, ui::EF_NONE, BRIGHTNESS_UP },
     51   { true, ui::VKEY_BRIGHTNESS_UP, ui::EF_ALT_DOWN, KEYBOARD_BRIGHTNESS_UP },
     52   { true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
     53     MAGNIFY_SCREEN_ZOOM_OUT},
     54   { true, ui::VKEY_BRIGHTNESS_UP, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
     55     MAGNIFY_SCREEN_ZOOM_IN},
     56   { true, ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, LOCK_SCREEN },
     57   // The lock key on Chrome OS keyboards produces F13 scancodes.
     58   { true, ui::VKEY_F13, ui::EF_NONE, LOCK_PRESSED },
     59   { false, ui::VKEY_F13, ui::EF_NONE, LOCK_RELEASED },
     60   // Generic keyboards can use VKEY_SLEEP to mimic ChromeOS keyboard's lock key.
     61   { true, ui::VKEY_SLEEP, ui::EF_NONE, LOCK_PRESSED },
     62   { false, ui::VKEY_SLEEP, ui::EF_NONE, LOCK_RELEASED },
     63   { true, ui::VKEY_POWER, ui::EF_NONE, POWER_PRESSED },
     64   { false, ui::VKEY_POWER, ui::EF_NONE, POWER_RELEASED },
     65   { true, ui::VKEY_M, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN,
     66     OPEN_FILE_MANAGER },
     67   { true, ui::VKEY_T, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, OPEN_CROSH },
     68   { true, ui::VKEY_G, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
     69     DISABLE_GPU_WATCHDOG },
     70   { true, ui::VKEY_I, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
     71     TOUCH_HUD_MODE_CHANGE },
     72   { true, ui::VKEY_I, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN,
     73     TOUCH_HUD_CLEAR },
     74   { true, ui::VKEY_P, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
     75     TOUCH_HUD_PROJECTION_TOGGLE },
     76   // Accessibility: Spoken feedback shortcuts. The first one is to toggle
     77   // spoken feedback on or off. The others are only valid when
     78   // spoken feedback is enabled.
     79   { true, ui::VKEY_Z, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
     80     TOGGLE_SPOKEN_FEEDBACK },
     81   { true, ui::VKEY_CONTROL, ui::EF_CONTROL_DOWN, SILENCE_SPOKEN_FEEDBACK},
     82   { true, ui::VKEY_OEM_COMMA, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
     83     SWITCH_TO_PREVIOUS_USER },
     84   { true, ui::VKEY_OEM_PERIOD, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
     85     SWITCH_TO_NEXT_USER },
     86   // Turning the TouchView maximizing mode on via hotkey for the time being.
     87   // TODO(skuhne): Remove once the test isn't needed anymore.
     88   { true, ui::VKEY_8, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN,
     89     TOGGLE_TOUCH_VIEW_TESTING },
     90   // Single shift release turns off caps lock.
     91   { false, ui::VKEY_LSHIFT, ui::EF_NONE, DISABLE_CAPS_LOCK },
     92   { false, ui::VKEY_SHIFT, ui::EF_NONE, DISABLE_CAPS_LOCK },
     93   { false, ui::VKEY_RSHIFT, ui::EF_NONE, DISABLE_CAPS_LOCK },
     94   { false, ui::VKEY_LWIN, ui::EF_ALT_DOWN, TOGGLE_CAPS_LOCK },
     95 #endif  // defined(OS_CHROMEOS)
     96   { true, ui::VKEY_I, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, OPEN_FEEDBACK_PAGE },
     97 #if !defined(OS_WIN)
     98   { true, ui::VKEY_Q, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, EXIT },
     99 #endif
    100   { true, ui::VKEY_N, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
    101     NEW_INCOGNITO_WINDOW },
    102   { true, ui::VKEY_N, ui::EF_CONTROL_DOWN, NEW_WINDOW },
    103   { true, ui::VKEY_T, ui::EF_CONTROL_DOWN, NEW_TAB },
    104   { true, ui::VKEY_OEM_MINUS,
    105     ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, SCALE_UI_UP },
    106   { true, ui::VKEY_OEM_PLUS,
    107     ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, SCALE_UI_DOWN },
    108   { true, ui::VKEY_0,
    109     ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, SCALE_UI_RESET },
    110   { true, ui::VKEY_BROWSER_REFRESH,
    111     ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, ROTATE_SCREEN },
    112   { true, ui::VKEY_BROWSER_REFRESH,
    113     ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
    114     ROTATE_WINDOW },
    115   { true, ui::VKEY_T, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, RESTORE_TAB },
    116   { true, ui::VKEY_PRINT, ui::EF_NONE, TAKE_SCREENSHOT },
    117   // On Chrome OS, Search key is mapped to LWIN. The Search key binding should
    118   // act on release instead of press when using Search as a modifier key for
    119   // extended keyboard shortcuts.
    120   { false, ui::VKEY_LWIN, ui::EF_NONE, TOGGLE_APP_LIST },
    121   { true, ui::VKEY_MEDIA_LAUNCH_APP2, ui::EF_NONE, TOGGLE_FULLSCREEN },
    122   { true, ui::VKEY_MEDIA_LAUNCH_APP2, ui::EF_SHIFT_DOWN, TOGGLE_FULLSCREEN },
    123   { true, ui::VKEY_VOLUME_MUTE, ui::EF_NONE, VOLUME_MUTE },
    124   { true, ui::VKEY_VOLUME_DOWN, ui::EF_NONE, VOLUME_DOWN },
    125   { true, ui::VKEY_VOLUME_UP, ui::EF_NONE, VOLUME_UP },
    126   { true, ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, FOCUS_SHELF },
    127   { true, ui::VKEY_HELP, ui::EF_NONE, SHOW_KEYBOARD_OVERLAY },
    128   { true, ui::VKEY_OEM_2, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
    129     SHOW_KEYBOARD_OVERLAY },
    130   { true, ui::VKEY_OEM_2,
    131     ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
    132     SHOW_KEYBOARD_OVERLAY },
    133   { true, ui::VKEY_F14, ui::EF_NONE, SHOW_KEYBOARD_OVERLAY },
    134   { true, ui::VKEY_N, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN,
    135     SHOW_MESSAGE_CENTER_BUBBLE },
    136   { true, ui::VKEY_S, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN,
    137     SHOW_SYSTEM_TRAY_BUBBLE },
    138   { true, ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN, SHOW_TASK_MANAGER },
    139   { true, ui::VKEY_1, ui::EF_ALT_DOWN, LAUNCH_APP_0 },
    140   { true, ui::VKEY_2, ui::EF_ALT_DOWN, LAUNCH_APP_1 },
    141   { true, ui::VKEY_3, ui::EF_ALT_DOWN, LAUNCH_APP_2 },
    142   { true, ui::VKEY_4, ui::EF_ALT_DOWN, LAUNCH_APP_3 },
    143   { true, ui::VKEY_5, ui::EF_ALT_DOWN, LAUNCH_APP_4 },
    144   { true, ui::VKEY_6, ui::EF_ALT_DOWN, LAUNCH_APP_5 },
    145   { true, ui::VKEY_7, ui::EF_ALT_DOWN, LAUNCH_APP_6 },
    146   { true, ui::VKEY_8, ui::EF_ALT_DOWN, LAUNCH_APP_7 },
    147   { true, ui::VKEY_9, ui::EF_ALT_DOWN, LAUNCH_LAST_APP },
    148 
    149   // Window management shortcuts.
    150   { true, ui::VKEY_OEM_4, ui::EF_ALT_DOWN, WINDOW_SNAP_LEFT },
    151   { true, ui::VKEY_OEM_6, ui::EF_ALT_DOWN, WINDOW_SNAP_RIGHT },
    152   { true, ui::VKEY_OEM_MINUS, ui::EF_ALT_DOWN, WINDOW_MINIMIZE },
    153   { true, ui::VKEY_OEM_PLUS, ui::EF_ALT_DOWN, TOGGLE_MAXIMIZED },
    154   { true, ui::VKEY_OEM_PLUS, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN,
    155     WINDOW_POSITION_CENTER },
    156   { true, ui::VKEY_BROWSER_FORWARD, ui::EF_CONTROL_DOWN, FOCUS_NEXT_PANE },
    157   { true, ui::VKEY_BROWSER_BACK, ui::EF_CONTROL_DOWN, FOCUS_PREVIOUS_PANE },
    158 
    159   // Media Player shortcuts.
    160   { true, ui::VKEY_MEDIA_NEXT_TRACK, ui::EF_NONE, MEDIA_NEXT_TRACK},
    161   { true, ui::VKEY_MEDIA_PLAY_PAUSE, ui::EF_NONE, MEDIA_PLAY_PAUSE},
    162   { true, ui::VKEY_MEDIA_PREV_TRACK, ui::EF_NONE, MEDIA_PREV_TRACK},
    163 
    164   // Debugging shortcuts that need to be available to end-users in
    165   // release builds.
    166   { true, ui::VKEY_U, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN,
    167     PRINT_UI_HIERARCHIES },
    168 
    169   { false, ui::VKEY_HOME, ui::EF_SHIFT_DOWN, ACCESSIBLE_FOCUS_PREVIOUS},
    170   { false, ui::VKEY_PRIOR, ui::EF_SHIFT_DOWN, ACCESSIBLE_FOCUS_PREVIOUS},
    171   { false, ui::VKEY_END, ui::EF_SHIFT_DOWN, ACCESSIBLE_FOCUS_NEXT},
    172   { false, ui::VKEY_NEXT, ui::EF_SHIFT_DOWN, ACCESSIBLE_FOCUS_NEXT},
    173 
    174   // TODO(yusukes): Handle VKEY_MEDIA_STOP, and
    175   // VKEY_MEDIA_LAUNCH_MAIL.
    176 };
    177 
    178 const size_t kAcceleratorDataLength = arraysize(kAcceleratorData);
    179 
    180 #if !defined(NDEBUG)
    181 const AcceleratorData kDesktopAcceleratorData[] = {
    182 #if defined(OS_CHROMEOS)
    183   // Extra shortcut for debug build to control magnifier on linux desktop.
    184   { true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_CONTROL_DOWN,
    185     MAGNIFY_SCREEN_ZOOM_OUT},
    186   { true, ui::VKEY_BRIGHTNESS_UP, ui::EF_CONTROL_DOWN, MAGNIFY_SCREEN_ZOOM_IN},
    187   // Extra shortcuts to lock the screen on linux desktop.
    188   { true, ui::VKEY_L, ui::EF_ALT_DOWN, LOCK_SCREEN },
    189   { true, ui::VKEY_POWER, ui::EF_SHIFT_DOWN, LOCK_PRESSED },
    190   { false, ui::VKEY_POWER, ui::EF_SHIFT_DOWN, LOCK_RELEASED },
    191   { true, ui::VKEY_D, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN,
    192     ADD_REMOVE_DISPLAY },
    193   { true, ui::VKEY_M, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN,
    194     TOGGLE_MIRROR_MODE },
    195   { true, ui::VKEY_W, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, TOGGLE_WIFI },
    196   // Extra shortcut for display swaping as alt-f4 is taken on linux desktop.
    197   { true, ui::VKEY_S, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
    198     SWAP_PRIMARY_DISPLAY },
    199 #endif
    200   // Extra shortcut to rotate/scale up/down the screen on linux desktop.
    201   { true, ui::VKEY_R,
    202     ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, ROTATE_SCREEN },
    203   // For testing on systems where Alt-Tab is already mapped.
    204   { true, ui::VKEY_W, ui::EF_ALT_DOWN, CYCLE_FORWARD_MRU },
    205 
    206   { true, ui::VKEY_F11, ui::EF_CONTROL_DOWN, TOGGLE_ROOT_WINDOW_FULL_SCREEN },
    207   { true, ui::VKEY_W, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN,
    208       CYCLE_BACKWARD_MRU },
    209   { true, ui::VKEY_B, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
    210     TOGGLE_DESKTOP_BACKGROUND_MODE },
    211   { true, ui::VKEY_F, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
    212     TOGGLE_FULLSCREEN },
    213 };
    214 
    215 const size_t kDesktopAcceleratorDataLength = arraysize(kDesktopAcceleratorData);
    216 #endif
    217 
    218 const AcceleratorData kDebugAcceleratorData[] = {
    219   { true, ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
    220     PRINT_LAYER_HIERARCHY },
    221   { true, ui::VKEY_V, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
    222     PRINT_VIEW_HIERARCHY },
    223   { true, ui::VKEY_W, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
    224     PRINT_WINDOW_HIERARCHY },
    225   { true, ui::VKEY_S, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
    226     DEBUG_TOGGLE_DEVICE_SCALE_FACTOR },
    227   { true, ui::VKEY_B, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
    228     DEBUG_TOGGLE_SHOW_DEBUG_BORDERS },
    229   { true, ui::VKEY_F, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
    230     DEBUG_TOGGLE_SHOW_FPS_COUNTER },
    231   { true, ui::VKEY_P, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
    232     DEBUG_TOGGLE_SHOW_PAINT_RECTS },
    233 };
    234 
    235 const size_t kDebugAcceleratorDataLength = arraysize(kDebugAcceleratorData);
    236 
    237 const AcceleratorAction kPreferredActions[] = {
    238   // Window cycling accelerators.
    239   CYCLE_BACKWARD_MRU,  // Shift+Alt+Tab
    240   CYCLE_FORWARD_MRU,  // Alt+Tab
    241 };
    242 
    243 const size_t kPreferredActionsLength = arraysize(kPreferredActions);
    244 
    245 const AcceleratorAction kReservedActions[] = {
    246 #if defined(OS_CHROMEOS)
    247   POWER_PRESSED,
    248   POWER_RELEASED,
    249 #else
    250   DUMMY_FOR_RESERVED,
    251 #endif
    252 };
    253 
    254 const size_t kReservedActionsLength = arraysize(kReservedActions);
    255 
    256 const AcceleratorAction kReservedDebugActions[] = {
    257   PRINT_LAYER_HIERARCHY,
    258   PRINT_VIEW_HIERARCHY,
    259   PRINT_WINDOW_HIERARCHY,
    260   DEBUG_TOGGLE_DEVICE_SCALE_FACTOR,
    261   DEBUG_TOGGLE_SHOW_DEBUG_BORDERS,
    262   DEBUG_TOGGLE_SHOW_FPS_COUNTER,
    263   DEBUG_TOGGLE_SHOW_PAINT_RECTS,
    264 };
    265 
    266 const size_t kReservedDebugActionsLength = arraysize(kReservedDebugActions);
    267 
    268 const AcceleratorAction kActionsAllowedAtLoginOrLockScreen[] = {
    269   BRIGHTNESS_DOWN,
    270   BRIGHTNESS_UP,
    271   DISABLE_CAPS_LOCK,
    272   KEYBOARD_BRIGHTNESS_DOWN,
    273   KEYBOARD_BRIGHTNESS_UP,
    274   MAGNIFY_SCREEN_ZOOM_IN,  // Control+F7
    275   MAGNIFY_SCREEN_ZOOM_OUT,  // Control+F6
    276   NEXT_IME,
    277   PREVIOUS_IME,
    278   PRINT_LAYER_HIERARCHY,
    279   PRINT_UI_HIERARCHIES,
    280   PRINT_VIEW_HIERARCHY,
    281   PRINT_WINDOW_HIERARCHY,
    282   ROTATE_WINDOW,
    283   SHOW_SYSTEM_TRAY_BUBBLE,
    284   SWITCH_IME,  // Switch to another IME depending on the accelerator.
    285   TAKE_PARTIAL_SCREENSHOT,
    286   TAKE_SCREENSHOT,
    287   TOGGLE_CAPS_LOCK,
    288   TOGGLE_WIFI,
    289   TOUCH_HUD_CLEAR,
    290   VOLUME_DOWN,
    291   VOLUME_MUTE,
    292   VOLUME_UP,
    293 #if defined(OS_CHROMEOS)
    294   TOGGLE_TOUCH_VIEW_TESTING,
    295   TOGGLE_SPOKEN_FEEDBACK,
    296   ADD_REMOVE_DISPLAY,
    297   DISABLE_GPU_WATCHDOG,
    298   TOGGLE_MIRROR_MODE,
    299 #endif
    300 #if defined(OS_CHROMEOS) && !defined(NDEBUG)
    301   POWER_PRESSED,
    302   POWER_RELEASED,
    303 #endif  // defined(OS_CHROMEOS)
    304 };
    305 
    306 const size_t kActionsAllowedAtLoginOrLockScreenLength =
    307     arraysize(kActionsAllowedAtLoginOrLockScreen);
    308 
    309 const AcceleratorAction kActionsAllowedAtLockScreen[] = {
    310   EXIT,
    311 };
    312 
    313 const size_t kActionsAllowedAtLockScreenLength =
    314     arraysize(kActionsAllowedAtLockScreen);
    315 
    316 const AcceleratorAction kActionsAllowedAtModalWindow[] = {
    317   BRIGHTNESS_DOWN,
    318   BRIGHTNESS_UP,
    319   DISABLE_CAPS_LOCK,
    320   EXIT,
    321   KEYBOARD_BRIGHTNESS_DOWN,
    322   KEYBOARD_BRIGHTNESS_UP,
    323   MAGNIFY_SCREEN_ZOOM_IN,
    324   MAGNIFY_SCREEN_ZOOM_OUT,
    325   MEDIA_NEXT_TRACK,
    326   MEDIA_PLAY_PAUSE,
    327   MEDIA_PREV_TRACK,
    328   NEXT_IME,
    329   OPEN_FEEDBACK_PAGE,
    330   POWER_PRESSED,
    331   POWER_RELEASED,
    332   PREVIOUS_IME,
    333   PRINT_UI_HIERARCHIES,
    334   ROTATE_SCREEN,
    335   SCALE_UI_UP,
    336   SCALE_UI_DOWN,
    337   SCALE_UI_RESET,
    338   SHOW_KEYBOARD_OVERLAY,
    339   SWITCH_IME,
    340   TAKE_PARTIAL_SCREENSHOT,
    341   TAKE_SCREENSHOT,
    342   TOGGLE_CAPS_LOCK,
    343   TOGGLE_WIFI,
    344   VOLUME_DOWN,
    345   VOLUME_MUTE,
    346   VOLUME_UP,
    347 #if defined(OS_CHROMEOS)
    348   SWAP_PRIMARY_DISPLAY,
    349   TOGGLE_SPOKEN_FEEDBACK,
    350 #if !defined(NDEBUG)
    351   ADD_REMOVE_DISPLAY,
    352 #endif
    353   LOCK_SCREEN,
    354   TOGGLE_MIRROR_MODE,
    355 #endif
    356 };
    357 
    358 const size_t kActionsAllowedAtModalWindowLength =
    359     arraysize(kActionsAllowedAtModalWindow);
    360 
    361 const AcceleratorAction kNonrepeatableActions[] = {
    362   // TODO(mazda): Add other actions which should not be repeated.
    363   CYCLE_BACKWARD_MRU,
    364   CYCLE_FORWARD_MRU,
    365   TOGGLE_OVERVIEW,
    366   EXIT,
    367   PRINT_UI_HIERARCHIES,  // Don't fill the logs if the key is held down.
    368   ROTATE_SCREEN,
    369   ROTATE_WINDOW,
    370   SCALE_UI_UP,
    371   SCALE_UI_DOWN,
    372   SCALE_UI_RESET,
    373   TOGGLE_FULLSCREEN,
    374   TOGGLE_MAXIMIZED,
    375   WINDOW_MINIMIZE,
    376 };
    377 
    378 const size_t kNonrepeatableActionsLength =
    379     arraysize(kNonrepeatableActions);
    380 
    381 const AcceleratorAction kActionsAllowedInAppMode[] = {
    382   BRIGHTNESS_DOWN,
    383   BRIGHTNESS_UP,
    384   DISABLE_CAPS_LOCK,
    385   KEYBOARD_BRIGHTNESS_DOWN,
    386   KEYBOARD_BRIGHTNESS_UP,
    387   MAGNIFY_SCREEN_ZOOM_IN,  // Control+F7
    388   MAGNIFY_SCREEN_ZOOM_OUT,  // Control+F6
    389   MEDIA_NEXT_TRACK,
    390   MEDIA_PLAY_PAUSE,
    391   MEDIA_PREV_TRACK,
    392   NEXT_IME,
    393   POWER_PRESSED,
    394   POWER_RELEASED,
    395   PREVIOUS_IME,
    396   PRINT_LAYER_HIERARCHY,
    397   PRINT_UI_HIERARCHIES,
    398   PRINT_VIEW_HIERARCHY,
    399   PRINT_WINDOW_HIERARCHY,
    400   ROTATE_SCREEN,
    401   SCALE_UI_DOWN,
    402   SCALE_UI_RESET,
    403   SCALE_UI_UP,
    404   SWITCH_IME,  // Switch to another IME depending on the accelerator.
    405   TOGGLE_CAPS_LOCK,
    406   TOGGLE_WIFI,
    407   TOUCH_HUD_CLEAR,
    408   VOLUME_DOWN,
    409   VOLUME_MUTE,
    410   VOLUME_UP,
    411 #if defined(OS_CHROMEOS)
    412   SWAP_PRIMARY_DISPLAY,
    413   TOGGLE_SPOKEN_FEEDBACK,
    414   ADD_REMOVE_DISPLAY,
    415   DISABLE_GPU_WATCHDOG,
    416   TOGGLE_MIRROR_MODE,
    417 #endif  // defined(OS_CHROMEOS)
    418 };
    419 
    420 const size_t kActionsAllowedInAppModeLength =
    421     arraysize(kActionsAllowedInAppMode);
    422 
    423 const AcceleratorAction kActionsNeedingWindow[] = {
    424     ACCESSIBLE_FOCUS_NEXT,
    425     ACCESSIBLE_FOCUS_PREVIOUS,
    426     CYCLE_BACKWARD_MRU,
    427     CYCLE_FORWARD_MRU,
    428     TOGGLE_OVERVIEW,
    429     WINDOW_SNAP_LEFT,
    430     WINDOW_SNAP_RIGHT,
    431     WINDOW_MINIMIZE,
    432     TOGGLE_FULLSCREEN,
    433     TOGGLE_MAXIMIZED,
    434     WINDOW_POSITION_CENTER,
    435     ROTATE_WINDOW,
    436 };
    437 
    438 const size_t kActionsNeedingWindowLength = arraysize(kActionsNeedingWindow);
    439 
    440 }  // namespace ash
    441