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

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: Fix spelling in a comment. 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 "base/macros.h"
6 #include "chrome/app/chrome_command_ids.h"
7 #include "chrome/browser/global_keyboard_shortcuts_mac.h"
8
9 // Basically, there are two kinds of keyboard shortcuts: Ones that should work
10 // only if the tab contents is focused (BrowserKeyboardShortcut), and ones that
11 // should work in all other cases (WindowKeyboardShortcut). In the latter case,
12 // we differentiate between shortcuts that are checked before any other view
13 // gets the chance to handle them (WindowKeyboardShortcut) or after all views
14 // had a chance but did not handle the keypress event
15 // (DelayedWindowKeyboardShortcut).
16
17 const KeyboardShortcutData* GetWindowKeyboardShortcutTable(
18 size_t* num_entries) {
19 static const KeyboardShortcutData keyboard_shortcuts[] = {
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
53 *num_entries = arraysize(keyboard_shortcuts);
54
55 return keyboard_shortcuts;
56 }
57
58 const KeyboardShortcutData* GetDelayedWindowKeyboardShortcutTable(
59 size_t* num_entries) {
60 static const KeyboardShortcutData keyboard_shortcuts[] = {
61 //cmd shift cntrl option
62 //--- ----- ----- ------
63 {false, false, false, false, kVK_Escape, 0, IDC_STOP},
64 };
65
66 *num_entries = arraysize(keyboard_shortcuts);
67
68 return keyboard_shortcuts;
69 }
70
71 const KeyboardShortcutData* GetBrowserKeyboardShortcutTable(
72 size_t* num_entries) {
73 static const KeyboardShortcutData keyboard_shortcuts[] = {
74 //cmd shift cntrl option
75 //--- ----- ----- ------
76 {true, false, false, false, kVK_LeftArrow, 0, IDC_BACK},
77 {true, false, false, false, kVK_RightArrow, 0, IDC_FORWARD},
78 {false, false, false, false, kVK_Delete, 0, IDC_BACKSPACE_BACK},
79 {false, true, false, false, kVK_Delete, 0, IDC_BACKSPACE_FORWARD},
80 {true, true, false, false, 0, 'c', IDC_DEV_TOOLS_INSPECT},
81 };
82
83 *num_entries = arraysize(keyboard_shortcuts);
84
85 return keyboard_shortcuts;
86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698