Home | History | Annotate | Download | only in views
      1 // Copyright (c) 2011 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 "chrome/browser/ui/views/accelerator_table_gtk.h"
      6 
      7 #include "base/basictypes.h"
      8 #include "chrome/app/chrome_command_ids.h"
      9 #include "ui/base/keycodes/keyboard_codes.h"
     10 
     11 namespace browser {
     12 
     13 // NOTE: Keep this list in the same (mostly-alphabetical) order as
     14 // the Windows accelerators in ../../app/chrome_dll.rc.
     15 const AcceleratorMapping kAcceleratorMap[] = {
     16   // Keycode                  Shift  Ctrl   Alt    Command ID
     17   { ui::VKEY_A,              true,  true,  false, IDC_AUTOFILL_DEFAULT },
     18   { ui::VKEY_LEFT,           false, false, true,  IDC_BACK },
     19   { ui::VKEY_BACK,           false, false, false, IDC_BACK },
     20 #if defined(OS_CHROMEOS)
     21   { ui::VKEY_F1,             false, false, false, IDC_BACK },
     22   { ui::VKEY_OEM_2,          false, true,  true,  IDC_SHOW_KEYBOARD_OVERLAY },
     23   { ui::VKEY_OEM_2,          true,  true,  true,  IDC_SHOW_KEYBOARD_OVERLAY },
     24 #endif
     25   { ui::VKEY_D,              false, true,  false, IDC_BOOKMARK_PAGE },
     26   { ui::VKEY_D,              true,  true,  false, IDC_BOOKMARK_ALL_TABS },
     27 #if !defined(OS_CHROMEOS)
     28   { ui::VKEY_DELETE,         true,  true,  false, IDC_CLEAR_BROWSING_DATA },
     29 #else
     30   { ui::VKEY_BACK,           true,  true,  false, IDC_CLEAR_BROWSING_DATA },
     31 #endif
     32 #if !defined(OS_CHROMEOS)
     33   { ui::VKEY_F4,             false, true,  false, IDC_CLOSE_TAB },
     34 #endif
     35   { ui::VKEY_W,              false, true,  false, IDC_CLOSE_TAB },
     36   { ui::VKEY_W,              true,  true,  false, IDC_CLOSE_WINDOW },
     37 #if !defined(OS_CHROMEOS)
     38   { ui::VKEY_F4,             false, false, true,  IDC_CLOSE_WINDOW },
     39 #endif
     40   { ui::VKEY_Q,              true,  true,  false, IDC_EXIT },
     41   { ui::VKEY_F,              false, true,  false, IDC_FIND },
     42   { ui::VKEY_G,              false, true,  false, IDC_FIND_NEXT },
     43 #if !defined(OS_CHROMEOS)
     44   { ui::VKEY_F3,             false, false, false, IDC_FIND_NEXT },
     45 #endif
     46   { ui::VKEY_G,              true,  true,  false, IDC_FIND_PREVIOUS },
     47 #if !defined(OS_CHROMEOS)
     48   { ui::VKEY_F3,             true,  false, false, IDC_FIND_PREVIOUS },
     49 #endif
     50 #if defined(OS_CHROMEOS)
     51   { ui::VKEY_S,              true,  false, true,  IDC_FOCUS_CHROMEOS_STATUS },
     52 #endif
     53   { ui::VKEY_D,              false, false, true,  IDC_FOCUS_LOCATION },
     54   { ui::VKEY_L,              false, true,  false, IDC_FOCUS_LOCATION },
     55 #if !defined(OS_CHROMEOS)
     56   { ui::VKEY_F10,            false, false, false, IDC_FOCUS_MENU_BAR },
     57 #endif
     58   { ui::VKEY_MENU,           false, false, false, IDC_FOCUS_MENU_BAR },
     59 #if !defined(OS_CHROMEOS)
     60   { ui::VKEY_F6,             false, false, false, IDC_FOCUS_NEXT_PANE },
     61 #else
     62   { ui::VKEY_F2,             false, true,  false, IDC_FOCUS_NEXT_PANE },
     63 #endif
     64 #if !defined(OS_CHROMEOS)
     65   { ui::VKEY_F6,             true,  false, false, IDC_FOCUS_PREVIOUS_PANE },
     66 #else
     67   { ui::VKEY_F1,             false, true,  false, IDC_FOCUS_PREVIOUS_PANE },
     68 #endif
     69   { ui::VKEY_K,              false, true,  false, IDC_FOCUS_SEARCH },
     70   { ui::VKEY_E,              false, true,  false, IDC_FOCUS_SEARCH },
     71   { ui::VKEY_BROWSER_SEARCH, false, false, false, IDC_FOCUS_SEARCH },
     72   { ui::VKEY_T,              true,  false, true,  IDC_FOCUS_TOOLBAR },
     73   { ui::VKEY_B,              true,  false, true,  IDC_FOCUS_BOOKMARKS },
     74   { ui::VKEY_RIGHT,          false, false, true,  IDC_FORWARD },
     75   { ui::VKEY_BACK,           true,  false, false, IDC_FORWARD },
     76 #if defined(OS_CHROMEOS)
     77   { ui::VKEY_F2,             false, false, false, IDC_FORWARD },
     78 #endif
     79 #if !defined(OS_CHROMEOS)
     80   { ui::VKEY_F11,            false, false, false, IDC_FULLSCREEN },
     81 #else
     82   { ui::VKEY_F4,             false, false, false, IDC_FULLSCREEN },
     83 #endif
     84 #if !defined(OS_CHROMEOS)
     85   { ui::VKEY_F1,             false, false, false, IDC_HELP_PAGE },
     86 #else
     87   { ui::VKEY_OEM_2,          false, true,  false, IDC_HELP_PAGE },
     88   { ui::VKEY_OEM_2,          true,  true,  false, IDC_HELP_PAGE },
     89 #endif
     90   { ui::VKEY_I,              true,  true,  false, IDC_DEV_TOOLS },
     91   { ui::VKEY_F12,            false, false, false, IDC_DEV_TOOLS },
     92   { ui::VKEY_J,              true,  true,  false, IDC_DEV_TOOLS_CONSOLE },
     93   { ui::VKEY_C,              true,  true,  false, IDC_DEV_TOOLS_INSPECT },
     94   { ui::VKEY_N,              true,  true,  false, IDC_NEW_INCOGNITO_WINDOW },
     95   { ui::VKEY_T,              false, true,  false, IDC_NEW_TAB },
     96   { ui::VKEY_N,              false, true,  false, IDC_NEW_WINDOW },
     97   { ui::VKEY_O,              false, true,  false, IDC_OPEN_FILE },
     98   { ui::VKEY_P,              false, true,  false, IDC_PRINT},
     99   { ui::VKEY_R,              false, true,  false, IDC_RELOAD },
    100   { ui::VKEY_R,              true,  true,  false, IDC_RELOAD_IGNORING_CACHE },
    101 #if !defined(OS_CHROMEOS)
    102   { ui::VKEY_F5,             false, false, false, IDC_RELOAD },
    103   { ui::VKEY_F5,             false, true,  false, IDC_RELOAD_IGNORING_CACHE },
    104   { ui::VKEY_F5,             true,  false, false, IDC_RELOAD_IGNORING_CACHE },
    105 #else
    106   { ui::VKEY_F3,             false, false, false, IDC_RELOAD },
    107   { ui::VKEY_F3,             false, true,  false, IDC_RELOAD_IGNORING_CACHE },
    108   { ui::VKEY_F3,             true,  false, false, IDC_RELOAD_IGNORING_CACHE },
    109 #endif
    110   { ui::VKEY_HOME,           false, false, true,  IDC_HOME },
    111   { ui::VKEY_T,              true,  true,  false, IDC_RESTORE_TAB },
    112   { ui::VKEY_S,              false, true,  false, IDC_SAVE_PAGE },
    113 #if defined(OS_CHROMEOS)
    114   { ui::VKEY_M,              false, true,  false, IDC_FILE_MANAGER },
    115   { ui::VKEY_LWIN,           false, false, false, IDC_SEARCH },
    116 #endif
    117   { ui::VKEY_9,              false, true,  false, IDC_SELECT_LAST_TAB },
    118   { ui::VKEY_NUMPAD9,        false, true,  false, IDC_SELECT_LAST_TAB },
    119   { ui::VKEY_TAB,            false, true,  false, IDC_SELECT_NEXT_TAB },
    120   { ui::VKEY_NEXT,           false, true,  false, IDC_SELECT_NEXT_TAB },
    121   { ui::VKEY_TAB,            true,  true,  false, IDC_SELECT_PREVIOUS_TAB },
    122   { ui::VKEY_PRIOR,          false, true,  false, IDC_SELECT_PREVIOUS_TAB },
    123   { ui::VKEY_1,              false, true,  false, IDC_SELECT_TAB_0 },
    124   { ui::VKEY_NUMPAD1,        false, true,  false, IDC_SELECT_TAB_0 },
    125   { ui::VKEY_2,              false, true,  false, IDC_SELECT_TAB_1 },
    126   { ui::VKEY_NUMPAD2,        false, true,  false, IDC_SELECT_TAB_1 },
    127   { ui::VKEY_3,              false, true,  false, IDC_SELECT_TAB_2 },
    128   { ui::VKEY_NUMPAD3,        false, true,  false, IDC_SELECT_TAB_2 },
    129   { ui::VKEY_4,              false, true,  false, IDC_SELECT_TAB_3 },
    130   { ui::VKEY_NUMPAD4,        false, true,  false, IDC_SELECT_TAB_3 },
    131   { ui::VKEY_5,              false, true,  false, IDC_SELECT_TAB_4 },
    132   { ui::VKEY_NUMPAD5,        false, true,  false, IDC_SELECT_TAB_4 },
    133   { ui::VKEY_6,              false, true,  false, IDC_SELECT_TAB_5 },
    134   { ui::VKEY_NUMPAD6,        false, true,  false, IDC_SELECT_TAB_5 },
    135   { ui::VKEY_7,              false, true,  false, IDC_SELECT_TAB_6 },
    136   { ui::VKEY_NUMPAD7,        false, true,  false, IDC_SELECT_TAB_6 },
    137   { ui::VKEY_8,              false, true,  false, IDC_SELECT_TAB_7 },
    138   { ui::VKEY_NUMPAD8,        false, true,  false, IDC_SELECT_TAB_7 },
    139   { ui::VKEY_B,              true,  true,  false, IDC_SHOW_BOOKMARK_BAR },
    140   { ui::VKEY_J,              false, true,  false, IDC_SHOW_DOWNLOADS },
    141   { ui::VKEY_H,              false, true,  false, IDC_SHOW_HISTORY },
    142   { ui::VKEY_F,              false, false, true,  IDC_SHOW_APP_MENU},
    143   { ui::VKEY_E,              false, false, true,  IDC_SHOW_APP_MENU},
    144   { ui::VKEY_ESCAPE,         false, false, false, IDC_STOP },
    145   { ui::VKEY_ESCAPE,         true,  false, false, IDC_TASK_MANAGER },
    146   { ui::VKEY_U,              false, true,  false, IDC_VIEW_SOURCE },
    147   { ui::VKEY_OEM_MINUS,      false, true,  false, IDC_ZOOM_MINUS },
    148   { ui::VKEY_OEM_MINUS,      true,  true,  false, IDC_ZOOM_MINUS },
    149   { ui::VKEY_SUBTRACT,       false, true,  false, IDC_ZOOM_MINUS },
    150   { ui::VKEY_0,              false, true,  false, IDC_ZOOM_NORMAL },
    151   { ui::VKEY_NUMPAD0,        false, true,  false, IDC_ZOOM_NORMAL },
    152   { ui::VKEY_OEM_PLUS,       false, true,  false, IDC_ZOOM_PLUS },
    153   { ui::VKEY_OEM_PLUS,       true,  true,  false, IDC_ZOOM_PLUS },
    154   { ui::VKEY_ADD,            false, true,  false, IDC_ZOOM_PLUS },
    155 };
    156 
    157 const size_t kAcceleratorMapLength = arraysize(kAcceleratorMap);
    158 
    159 }  // namespace browser
    160