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

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: Split global_keyboard_shortcuts_mac.mm into two platform-specific ones, simplified code. 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"
themblsha 2016/10/28 17:32:22 I get a strange presubmit warning here, even thoug
tapted 2016/10/31 10:16:57 Yeah - this one is a confusing message. The compla
themblsha 2016/10/31 16:56:29 Thanks :-)
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 KeyboardShortcutData* GetWindowKeyboardShortcutTable(
19 size_t* num_entries) {
20 static const KeyboardShortcutData keyboard_shortcuts[] = {
21 // cmd shift cntrl option
22 // --- ----- ----- ------
23 // '{' / '}' characters should be matched earlier than virtual key code
24 // (therefore we can match alt-8 as '{' on german keyboards).
25 {true, false, false, false, 0, '}', IDC_SELECT_NEXT_TAB},
26 {true, false, false, false, 0, '{', IDC_SELECT_PREVIOUS_TAB},
27 {false, false, true, false, kVK_PageDown, 0, IDC_SELECT_NEXT_TAB},
28 {false, false, true, false, kVK_Tab, 0, IDC_SELECT_NEXT_TAB},
29 {false, false, true, false, kVK_PageUp, 0, IDC_SELECT_PREVIOUS_TAB},
30 {false, true, true, false, kVK_Tab, 0, IDC_SELECT_PREVIOUS_TAB},
31 // Cmd-0..8 select the Nth tab, with cmd-9 being "last tab".
32 {true, false, false, false, kVK_ANSI_1, 0, IDC_SELECT_TAB_0},
33 {true, false, false, false, kVK_ANSI_Keypad1, 0, IDC_SELECT_TAB_0},
34 {true, false, false, false, kVK_ANSI_2, 0, IDC_SELECT_TAB_1},
35 {true, false, false, false, kVK_ANSI_Keypad2, 0, IDC_SELECT_TAB_1},
36 {true, false, false, false, kVK_ANSI_3, 0, IDC_SELECT_TAB_2},
37 {true, false, false, false, kVK_ANSI_Keypad3, 0, IDC_SELECT_TAB_2},
38 {true, false, false, false, kVK_ANSI_4, 0, IDC_SELECT_TAB_3},
39 {true, false, false, false, kVK_ANSI_Keypad4, 0, IDC_SELECT_TAB_3},
40 {true, false, false, false, kVK_ANSI_5, 0, IDC_SELECT_TAB_4},
41 {true, false, false, false, kVK_ANSI_Keypad5, 0, IDC_SELECT_TAB_4},
42 {true, false, false, false, kVK_ANSI_6, 0, IDC_SELECT_TAB_5},
43 {true, false, false, false, kVK_ANSI_Keypad6, 0, IDC_SELECT_TAB_5},
44 {true, false, false, false, kVK_ANSI_7, 0, IDC_SELECT_TAB_6},
45 {true, false, false, false, kVK_ANSI_Keypad7, 0, IDC_SELECT_TAB_6},
46 {true, false, false, false, kVK_ANSI_8, 0, IDC_SELECT_TAB_7},
47 {true, false, false, false, kVK_ANSI_Keypad8, 0, IDC_SELECT_TAB_7},
48 {true, false, false, false, kVK_ANSI_9, 0, IDC_SELECT_LAST_TAB},
49 {true, false, false, false, kVK_ANSI_Keypad9, 0, IDC_SELECT_LAST_TAB},
50 {true, true, false, false, kVK_ANSI_M, 0, IDC_SHOW_AVATAR_MENU},
51 {true, false, false, true, kVK_ANSI_L, 0, IDC_SHOW_DOWNLOADS},
52 };
53
54 *num_entries = arraysize(keyboard_shortcuts);
55
56 return keyboard_shortcuts;
57 }
58
59 const KeyboardShortcutData* GetDelayedWindowKeyboardShortcutTable(
60 size_t* num_entries) {
61 static const KeyboardShortcutData keyboard_shortcuts[] = {
62 //cmd shift cntrl option
63 //--- ----- ----- ------
64 {false, false, false, false, kVK_Escape, 0, IDC_STOP},
65 };
66
67 *num_entries = arraysize(keyboard_shortcuts);
68
69 return keyboard_shortcuts;
70 }
71
72 const KeyboardShortcutData* GetBrowserKeyboardShortcutTable(
73 size_t* num_entries) {
74 static const KeyboardShortcutData keyboard_shortcuts[] = {
75 //cmd shift cntrl option
76 //--- ----- ----- ------
77 {true, false, false, false, kVK_LeftArrow, 0, IDC_BACK},
78 {true, false, false, false, kVK_RightArrow, 0, IDC_FORWARD},
79 {false, false, false, false, kVK_Delete, 0, IDC_BACKSPACE_BACK},
80 {false, true, false, false, kVK_Delete, 0, IDC_BACKSPACE_FORWARD},
81 {true, true, false, false, 0, 'c', IDC_DEV_TOOLS_INSPECT},
82 };
83
84 *num_entries = arraysize(keyboard_shortcuts);
85
86 return keyboard_shortcuts;
87 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698