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

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 compilation. 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
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/global_keyboard_shortcuts_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 std::vector<KeyboardShortcutData>& GetWindowKeyboardShortcutTable() {
18 CR_DEFINE_STATIC_LOCAL(std::vector<KeyboardShortcutData>, result, ({
19 // cmd shift cntrl option
20 // --- ----- ----- ------
21 // '{' / '}' characters should be matched earlier than virtual key code
22 // (therefore we can match alt-8 as '{' on german keyboards).
23 {true, false, false, false, 0, '}', IDC_SELECT_NEXT_TAB},
24 {true, false, false, false, 0, '{', IDC_SELECT_PREVIOUS_TAB},
25 {false, false, true, false, kVK_PageDown, 0, IDC_SELECT_NEXT_TAB},
26 {false, false, true, false, kVK_Tab, 0, IDC_SELECT_NEXT_TAB},
27 {false, false, true, false, kVK_PageUp, 0, IDC_SELECT_PREVIOUS_TAB},
28 {false, true, true, false, kVK_Tab, 0, IDC_SELECT_PREVIOUS_TAB},
29 // Cmd-0..8 select the Nth tab, with cmd-9 being "last tab".
30 {true, false, false, false, kVK_ANSI_1, 0, IDC_SELECT_TAB_0},
31 {true, false, false, false, kVK_ANSI_Keypad1, 0, IDC_SELECT_TAB_0},
32 {true, false, false, false, kVK_ANSI_2, 0, IDC_SELECT_TAB_1},
33 {true, false, false, false, kVK_ANSI_Keypad2, 0, IDC_SELECT_TAB_1},
34 {true, false, false, false, kVK_ANSI_3, 0, IDC_SELECT_TAB_2},
35 {true, false, false, false, kVK_ANSI_Keypad3, 0, IDC_SELECT_TAB_2},
36 {true, false, false, false, kVK_ANSI_4, 0, IDC_SELECT_TAB_3},
37 {true, false, false, false, kVK_ANSI_Keypad4, 0, IDC_SELECT_TAB_3},
38 {true, false, false, false, kVK_ANSI_5, 0, IDC_SELECT_TAB_4},
39 {true, false, false, false, kVK_ANSI_Keypad5, 0, IDC_SELECT_TAB_4},
40 {true, false, false, false, kVK_ANSI_6, 0, IDC_SELECT_TAB_5},
41 {true, false, false, false, kVK_ANSI_Keypad6, 0, IDC_SELECT_TAB_5},
42 {true, false, false, false, kVK_ANSI_7, 0, IDC_SELECT_TAB_6},
43 {true, false, false, false, kVK_ANSI_Keypad7, 0, IDC_SELECT_TAB_6},
44 {true, false, false, false, kVK_ANSI_8, 0, IDC_SELECT_TAB_7},
45 {true, false, false, false, kVK_ANSI_Keypad8, 0, IDC_SELECT_TAB_7},
46 {true, false, false, false, kVK_ANSI_9, 0, IDC_SELECT_LAST_TAB},
47 {true, false, false, false, kVK_ANSI_Keypad9, 0, IDC_SELECT_LAST_TAB},
48 {true, true, false, false, kVK_ANSI_M, 0, IDC_SHOW_AVATAR_MENU},
49 {true, false, false, true, kVK_ANSI_L, 0, IDC_SHOW_DOWNLOADS},
50 }));
51 return result;
52 }
53
54 const std::vector<KeyboardShortcutData>&
55 GetDelayedWindowKeyboardShortcutTable() {
56 CR_DEFINE_STATIC_LOCAL(std::vector<KeyboardShortcutData>, result, ({
57 //cmd shift cntrl option
58 //--- ----- ----- ------
59 {false, false, false, false, kVK_Escape, 0, IDC_STOP},
60 }));
61 return result;
62 }
63
64 const std::vector<KeyboardShortcutData>& GetBrowserKeyboardShortcutTable() {
65 CR_DEFINE_STATIC_LOCAL(std::vector<KeyboardShortcutData>, result, ({
66 //cmd shift cntrl option
67 //--- ----- ----- ------
68 {true, false, false, false, kVK_LeftArrow, 0, IDC_BACK},
69 {true, false, false, false, kVK_RightArrow, 0, IDC_FORWARD},
70 {false, false, false, false, kVK_Delete, 0, IDC_BACKSPACE_BACK},
71 {false, true, false, false, kVK_Delete, 0, IDC_BACKSPACE_FORWARD},
72 {true, true, false, false, 0, 'c', IDC_DEV_TOOLS_INSPECT},
73 }));
74 return result;
75 }
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/global_keyboard_shortcuts_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698