Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: chrome/browser/global_keyboard_shortcuts_cocoa_mac.mm

Issue 2074643003: MacViews: Views accelerators table should match the Cocoa one. (Closed) Base URL: ssh://bitbucket.browser.yandex-team.ru/chromium/src.git@master
Patch Set: #ifdef out Ctrl shortcuts on Mac. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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/global_keyboard_shortcuts_mac.h"
6
7 #include "base/macros.h"
8 #include "chrome/app/chrome_command_ids.h"
9
10 // Basically, there are two kinds of keyboard shortcuts: Ones that should work
11 // only if the tab contents is focused (BrowserKeyboardShortcut), and ones that
12 // should work in all other cases (WindowKeyboardShortcut). In the latter case,
13 // we differentiate between shortcuts that are checked before any other view
14 // gets the chance to handle them (WindowKeyboardShortcut) or after all views
15 // had a chance but did not handle the keypress event
16 // (DelayedWindowKeyboardShortcut).
17
18 const std::vector<KeyboardShortcutData>& GetWindowKeyboardShortcutTable() {
19 CR_DEFINE_STATIC_LOCAL(std::vector<KeyboardShortcutData>, result, ({
20 // cmd shift cntrl option
21 // --- ----- ----- ------
22 // '{' / '}' characters should be matched earlier than virtual key code
23 // (therefore we can match alt-8 as '{' on german keyboards).
24 {true, false, false, false, 0, '}', IDC_SELECT_NEXT_TAB},
25 {true, false, false, false, 0, '{', IDC_SELECT_PREVIOUS_TAB},
26 {false, false, true, false, kVK_PageDown, 0, IDC_SELECT_NEXT_TAB},
27 {false, false, true, false, kVK_Tab, 0, IDC_SELECT_NEXT_TAB},
28 {false, false, true, false, kVK_PageUp, 0, IDC_SELECT_PREVIOUS_TAB},
29 {false, true, true, false, kVK_Tab, 0, IDC_SELECT_PREVIOUS_TAB},
30 // Cmd-0..8 select the Nth tab, with cmd-9 being "last tab".
31 {true, false, false, false, kVK_ANSI_1, 0, IDC_SELECT_TAB_0},
32 {true, false, false, false, kVK_ANSI_Keypad1, 0, IDC_SELECT_TAB_0},
33 {true, false, false, false, kVK_ANSI_2, 0, IDC_SELECT_TAB_1},
34 {true, false, false, false, kVK_ANSI_Keypad2, 0, IDC_SELECT_TAB_1},
35 {true, false, false, false, kVK_ANSI_3, 0, IDC_SELECT_TAB_2},
36 {true, false, false, false, kVK_ANSI_Keypad3, 0, IDC_SELECT_TAB_2},
37 {true, false, false, false, kVK_ANSI_4, 0, IDC_SELECT_TAB_3},
38 {true, false, false, false, kVK_ANSI_Keypad4, 0, IDC_SELECT_TAB_3},
39 {true, false, false, false, kVK_ANSI_5, 0, IDC_SELECT_TAB_4},
40 {true, false, false, false, kVK_ANSI_Keypad5, 0, IDC_SELECT_TAB_4},
41 {true, false, false, false, kVK_ANSI_6, 0, IDC_SELECT_TAB_5},
42 {true, false, false, false, kVK_ANSI_Keypad6, 0, IDC_SELECT_TAB_5},
43 {true, false, false, false, kVK_ANSI_7, 0, IDC_SELECT_TAB_6},
44 {true, false, false, false, kVK_ANSI_Keypad7, 0, IDC_SELECT_TAB_6},
45 {true, false, false, false, kVK_ANSI_8, 0, IDC_SELECT_TAB_7},
46 {true, false, false, false, kVK_ANSI_Keypad8, 0, IDC_SELECT_TAB_7},
47 {true, false, false, false, kVK_ANSI_9, 0, IDC_SELECT_LAST_TAB},
48 {true, false, false, false, kVK_ANSI_Keypad9, 0, IDC_SELECT_LAST_TAB},
49 {true, true, false, false, kVK_ANSI_M, 0, IDC_SHOW_AVATAR_MENU},
50 {true, false, false, true, kVK_ANSI_L, 0, IDC_SHOW_DOWNLOADS},
51 }));
52 return result;
53 }
54
55 const std::vector<KeyboardShortcutData>&
56 GetDelayedWindowKeyboardShortcutTable() {
57 CR_DEFINE_STATIC_LOCAL(std::vector<KeyboardShortcutData>, result, ({
58 //cmd shift cntrl option
59 //--- ----- ----- ------
60 {false, false, false, false, kVK_Escape, 0, IDC_STOP},
61 }));
62 return result;
63 }
64
65 const std::vector<KeyboardShortcutData>& GetBrowserKeyboardShortcutTable() {
66 CR_DEFINE_STATIC_LOCAL(std::vector<KeyboardShortcutData>, result, ({
67 //cmd shift cntrl option
68 //--- ----- ----- ------
69 {true, false, false, false, kVK_LeftArrow, 0, IDC_BACK},
70 {true, false, false, false, kVK_RightArrow, 0, IDC_FORWARD},
71 {false, false, false, false, kVK_Delete, 0, IDC_BACKSPACE_BACK},
72 {false, true, false, false, kVK_Delete, 0, IDC_BACKSPACE_FORWARD},
73 {true, true, false, false, 0, 'c', IDC_DEV_TOOLS_INSPECT},
74 }));
75 return result;
76 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698