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 #ifndef ASH_ACCELERATORS_ACCELERATOR_TABLE_H_
      6 #define ASH_ACCELERATORS_ACCELERATOR_TABLE_H_
      7 
      8 #include "ash/ash_export.h"
      9 #include "base/basictypes.h"
     10 #include "ui/base/events/event_constants.h"
     11 #include "ui/base/keycodes/keyboard_codes.h"
     12 
     13 namespace ash {
     14 
     15 // Please put if/def sections at the end of the bare section and keep the list
     16 // within each section in alphabetical order.
     17 enum AcceleratorAction {
     18   ACCESSIBLE_FOCUS_NEXT,
     19   ACCESSIBLE_FOCUS_PREVIOUS,
     20   BRIGHTNESS_DOWN,
     21   BRIGHTNESS_UP,
     22   CYCLE_BACKWARD_LINEAR,
     23   CYCLE_BACKWARD_MRU,
     24   CYCLE_FORWARD_LINEAR,
     25   CYCLE_FORWARD_MRU,
     26   DEBUG_TOGGLE_DEVICE_SCALE_FACTOR,
     27   DEBUG_TOGGLE_SHOW_DEBUG_BORDERS,
     28   DEBUG_TOGGLE_SHOW_FPS_COUNTER,
     29   DEBUG_TOGGLE_SHOW_PAINT_RECTS,
     30   DISABLE_CAPS_LOCK,
     31   EXIT,
     32   FOCUS_LAUNCHER,
     33   FOCUS_NEXT_PANE,
     34   FOCUS_PREVIOUS_PANE,
     35   KEYBOARD_BRIGHTNESS_DOWN,
     36   KEYBOARD_BRIGHTNESS_UP,
     37   LAUNCH_APP_0,
     38   LAUNCH_APP_1,
     39   LAUNCH_APP_2,
     40   LAUNCH_APP_3,
     41   LAUNCH_APP_4,
     42   LAUNCH_APP_5,
     43   LAUNCH_APP_6,
     44   LAUNCH_APP_7,
     45   LAUNCH_LAST_APP,
     46   LOCK_PRESSED,
     47   LOCK_RELEASED,
     48   MAGNIFY_SCREEN_ZOOM_IN,
     49   MAGNIFY_SCREEN_ZOOM_OUT,
     50   MEDIA_NEXT_TRACK,
     51   MEDIA_PLAY_PAUSE,
     52   MEDIA_PREV_TRACK,
     53   NEW_INCOGNITO_WINDOW,
     54   NEW_TAB,
     55   NEW_WINDOW,
     56   NEXT_IME,
     57   OPEN_FEEDBACK_PAGE,
     58   POWER_PRESSED,
     59   POWER_RELEASED,
     60   PREVIOUS_IME,
     61   PRINT_LAYER_HIERARCHY,
     62   PRINT_UI_HIERARCHIES,
     63   PRINT_VIEW_HIERARCHY,
     64   PRINT_WINDOW_HIERARCHY,
     65   RESTORE_TAB,
     66   ROTATE_SCREEN,
     67   ROTATE_WINDOW,
     68   SCALE_UI_DOWN,
     69   SCALE_UI_RESET,
     70   SCALE_UI_UP,
     71   SHOW_KEYBOARD_OVERLAY,
     72   SHOW_MESSAGE_CENTER_BUBBLE,
     73   SHOW_OAK,
     74   SHOW_SYSTEM_TRAY_BUBBLE,
     75   SHOW_TASK_MANAGER,
     76   SILENCE_SPOKEN_FEEDBACK,
     77   SWAP_PRIMARY_DISPLAY,
     78   SWITCH_IME,  // Switch to another IME depending on the accelerator.
     79   TAKE_PARTIAL_SCREENSHOT,
     80   TAKE_SCREENSHOT,
     81   TOGGLE_APP_LIST,
     82   TOGGLE_CAPS_LOCK,
     83   TOGGLE_CAPS_LOCK_BY_ALT_LWIN,
     84   TOGGLE_DESKTOP_BACKGROUND_MODE,
     85   TOGGLE_FULLSCREEN,
     86   TOGGLE_MAXIMIZED,
     87   TOGGLE_ROOT_WINDOW_FULL_SCREEN,
     88   TOGGLE_SPOKEN_FEEDBACK,
     89   TOGGLE_WIFI,
     90   TOUCH_HUD_CLEAR,
     91   TOUCH_HUD_MODE_CHANGE,
     92   TOUCH_HUD_PROJECTION_TOGGLE,
     93   VOLUME_DOWN,
     94   VOLUME_MUTE,
     95   VOLUME_UP,
     96   WINDOW_MINIMIZE,
     97   WINDOW_POSITION_CENTER,
     98   WINDOW_SNAP_LEFT,
     99   WINDOW_SNAP_RIGHT,
    100 #if defined(OS_CHROMEOS)
    101   ADD_REMOVE_DISPLAY,
    102   TOGGLE_MIRROR_MODE,
    103   DISABLE_GPU_WATCHDOG,
    104   LOCK_SCREEN,
    105   OPEN_CROSH,
    106   OPEN_FILE_DIALOG,  // Open 'Open file' dialog.
    107   OPEN_FILE_MANAGER,
    108 #endif
    109 };
    110 
    111 struct AcceleratorData {
    112   bool trigger_on_press;
    113   ui::KeyboardCode keycode;
    114   int modifiers;
    115   AcceleratorAction action;
    116 };
    117 
    118 // Accelerators handled by AcceleratorController.
    119 ASH_EXPORT extern const AcceleratorData kAcceleratorData[];
    120 
    121 // The number of elements in kAcceleratorData.
    122 ASH_EXPORT extern const size_t kAcceleratorDataLength;
    123 
    124 #if !defined(NDEBUG)
    125 // Accelerators useful when running on desktop. Debug build only.
    126 ASH_EXPORT extern const AcceleratorData kDesktopAcceleratorData[];
    127 
    128 // The number of elements in kDesktopAcceleratorData.
    129 ASH_EXPORT extern const size_t kDesktopAcceleratorDataLength;
    130 #endif
    131 
    132 // Debug accelerators enabled only when "Debugging keyboard shortcuts" flag
    133 // (--ash-debug-shortcuts) is enabled.
    134 ASH_EXPORT extern const AcceleratorData kDebugAcceleratorData[];
    135 
    136 // The number of elements in kDebugAcceleratorData.
    137 ASH_EXPORT extern const size_t kDebugAcceleratorDataLength;
    138 
    139 // Actions that should be handled very early in Ash unless the current target
    140 // window is full-screen.
    141 ASH_EXPORT extern const AcceleratorAction kReservedActions[];
    142 
    143 // The number of elements in kReservedActions.
    144 ASH_EXPORT extern const size_t kReservedActionsLength;
    145 
    146 // Actions that should be handled very early in Ash unless the current target
    147 // window is full-screen, these actions are only handled if
    148 // DebugShortcutsEnabled is true (command line switch 'ash-debug-shortcuts').
    149 ASH_EXPORT extern const AcceleratorAction kReservedDebugActions[];
    150 
    151 // The number of elements in kReservedDebugActions.
    152 ASH_EXPORT extern const size_t kReservedDebugActionsLength;
    153 
    154 // Actions allowed while user is not signed in or screen is locked.
    155 ASH_EXPORT extern const AcceleratorAction kActionsAllowedAtLoginOrLockScreen[];
    156 
    157 // The number of elements in kActionsAllowedAtLoginOrLockScreen.
    158 ASH_EXPORT extern const size_t kActionsAllowedAtLoginOrLockScreenLength;
    159 
    160 // Actions allowed while screen is locked (in addition to
    161 // kActionsAllowedAtLoginOrLockScreen).
    162 ASH_EXPORT extern const AcceleratorAction kActionsAllowedAtLockScreen[];
    163 
    164 // The number of elements in kActionsAllowedAtLockScreen.
    165 ASH_EXPORT extern const size_t kActionsAllowedAtLockScreenLength;
    166 
    167 // Actions allowed while a modal window is up.
    168 ASH_EXPORT extern const AcceleratorAction kActionsAllowedAtModalWindow[];
    169 
    170 // The number of elements in kActionsAllowedAtModalWindow.
    171 ASH_EXPORT extern const size_t kActionsAllowedAtModalWindowLength;
    172 
    173 // Actions which will not be repeated while holding an accelerator key.
    174 ASH_EXPORT extern const AcceleratorAction kNonrepeatableActions[];
    175 
    176 // The number of elements in kNonrepeatableActions.
    177 ASH_EXPORT extern const size_t kNonrepeatableActionsLength;
    178 
    179 // Actions allowed in app mode.
    180 ASH_EXPORT extern const AcceleratorAction kActionsAllowedInAppMode[];
    181 
    182 // The number of elements in kActionsAllowedInAppMode.
    183 ASH_EXPORT extern const size_t kActionsAllowedInAppModeLength;
    184 
    185 }  // namespace ash
    186 
    187 #endif  // ASH_ACCELERATORS_ACCELERATOR_TABLE_H_
    188