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

Side by Side Diff: chrome/browser/global_keyboard_shortcuts_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: Updated accelerator_table.cc, removed non-Cocoa shortcuts, added global_keyboard_shortcuts_mac.mm h… Created 4 years, 2 months 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 | « no previous file | chrome/browser/ui/BUILD.gn » ('j') | chrome/browser/ui/views/accelerator_table.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/global_keyboard_shortcuts_mac.h" 5 #include "chrome/browser/global_keyboard_shortcuts_mac.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 const KeyboardShortcutData* GetWindowKeyboardShortcutTable( 46 const KeyboardShortcutData* GetWindowKeyboardShortcutTable(
47 size_t* num_entries) { 47 size_t* num_entries) {
48 static const KeyboardShortcutData keyboard_shortcuts[] = { 48 static const KeyboardShortcutData keyboard_shortcuts[] = {
49 // cmd shift cntrl option 49 // cmd shift cntrl option
50 // --- ----- ----- ------ 50 // --- ----- ----- ------
51 // '{' / '}' characters should be matched earlier than virtual key code 51 // '{' / '}' characters should be matched earlier than virtual key code
52 // (therefore we can match alt-8 as '{' on german keyboards). 52 // (therefore we can match alt-8 as '{' on german keyboards).
53 {true, false, false, false, 0, '}', IDC_SELECT_NEXT_TAB}, 53 {true, false, false, false, 0, '}', IDC_SELECT_NEXT_TAB},
54 {true, false, false, false, 0, '{', IDC_SELECT_PREVIOUS_TAB}, 54 {true, false, false, false, 0, '{', IDC_SELECT_PREVIOUS_TAB},
55 {false, false, true, false, kVK_PageDown, 0, IDC_SELECT_NEXT_TAB}, 55 // {false, false, true, false, kVK_PageDown, 0, IDC_SELECT_NEXT_TAB},
tapted 2016/10/17 07:02:47 If removing these makes sense for the regular Chro
themblsha 2016/10/20 16:41:05 These tables are still required for Cocoa browser.
56 {false, false, true, false, kVK_Tab, 0, IDC_SELECT_NEXT_TAB}, 56 // {false, false, true, false, kVK_Tab, 0, IDC_SELECT_NEXT_TAB},
57 {false, false, true, false, kVK_PageUp, 0, IDC_SELECT_PREVIOUS_TAB}, 57 // {false, false, true, false, kVK_PageUp, 0, IDC_SELECT_PREVIOUS_TAB},
58 {false, true, true, false, kVK_Tab, 0, IDC_SELECT_PREVIOUS_TAB}, 58 // {false, true, true, false, kVK_Tab, 0, IDC_SELECT_PREVIOUS_TAB},
59 // Cmd-0..8 select the Nth tab, with cmd-9 being "last tab". 59 // Cmd-0..8 select the Nth tab, with cmd-9 being "last tab".
60 {true, false, false, false, kVK_ANSI_1, 0, IDC_SELECT_TAB_0}, 60 // {true, false, false, false, kVK_ANSI_1, 0, IDC_SELECT_TAB_0},
61 {true, false, false, false, kVK_ANSI_Keypad1, 0, IDC_SELECT_TAB_0}, 61 // {true, false, false, false, kVK_ANSI_Keypad1, 0, IDC_SELECT_TAB_0},
62 {true, false, false, false, kVK_ANSI_2, 0, IDC_SELECT_TAB_1}, 62 // {true, false, false, false, kVK_ANSI_2, 0, IDC_SELECT_TAB_1},
63 {true, false, false, false, kVK_ANSI_Keypad2, 0, IDC_SELECT_TAB_1}, 63 // {true, false, false, false, kVK_ANSI_Keypad2, 0, IDC_SELECT_TAB_1},
64 {true, false, false, false, kVK_ANSI_3, 0, IDC_SELECT_TAB_2}, 64 // {true, false, false, false, kVK_ANSI_3, 0, IDC_SELECT_TAB_2},
65 {true, false, false, false, kVK_ANSI_Keypad3, 0, IDC_SELECT_TAB_2}, 65 // {true, false, false, false, kVK_ANSI_Keypad3, 0, IDC_SELECT_TAB_2},
66 {true, false, false, false, kVK_ANSI_4, 0, IDC_SELECT_TAB_3}, 66 // {true, false, false, false, kVK_ANSI_4, 0, IDC_SELECT_TAB_3},
67 {true, false, false, false, kVK_ANSI_Keypad4, 0, IDC_SELECT_TAB_3}, 67 // {true, false, false, false, kVK_ANSI_Keypad4, 0, IDC_SELECT_TAB_3},
68 {true, false, false, false, kVK_ANSI_5, 0, IDC_SELECT_TAB_4}, 68 // {true, false, false, false, kVK_ANSI_5, 0, IDC_SELECT_TAB_4},
69 {true, false, false, false, kVK_ANSI_Keypad5, 0, IDC_SELECT_TAB_4}, 69 // {true, false, false, false, kVK_ANSI_Keypad5, 0, IDC_SELECT_TAB_4},
70 {true, false, false, false, kVK_ANSI_6, 0, IDC_SELECT_TAB_5}, 70 // {true, false, false, false, kVK_ANSI_6, 0, IDC_SELECT_TAB_5},
71 {true, false, false, false, kVK_ANSI_Keypad6, 0, IDC_SELECT_TAB_5}, 71 // {true, false, false, false, kVK_ANSI_Keypad6, 0, IDC_SELECT_TAB_5},
72 {true, false, false, false, kVK_ANSI_7, 0, IDC_SELECT_TAB_6}, 72 // {true, false, false, false, kVK_ANSI_7, 0, IDC_SELECT_TAB_6},
73 {true, false, false, false, kVK_ANSI_Keypad7, 0, IDC_SELECT_TAB_6}, 73 // {true, false, false, false, kVK_ANSI_Keypad7, 0, IDC_SELECT_TAB_6},
74 {true, false, false, false, kVK_ANSI_8, 0, IDC_SELECT_TAB_7}, 74 // {true, false, false, false, kVK_ANSI_8, 0, IDC_SELECT_TAB_7},
75 {true, false, false, false, kVK_ANSI_Keypad8, 0, IDC_SELECT_TAB_7}, 75 // {true, false, false, false, kVK_ANSI_Keypad8, 0, IDC_SELECT_TAB_7},
76 {true, false, false, false, kVK_ANSI_9, 0, IDC_SELECT_LAST_TAB}, 76 // {true, false, false, false, kVK_ANSI_9, 0, IDC_SELECT_LAST_TAB},
77 {true, false, false, false, kVK_ANSI_Keypad9, 0, IDC_SELECT_LAST_TAB}, 77 // {true, false, false, false, kVK_ANSI_Keypad9, 0, IDC_SELECT_LAST_TAB},
78 {true, true, false, false, kVK_ANSI_M, 0, IDC_SHOW_AVATAR_MENU}, 78 // {true, true, false, false, kVK_ANSI_M, 0, IDC_SHOW_AVATAR_MENU},
79 {true, false, false, true, kVK_ANSI_L, 0, IDC_SHOW_DOWNLOADS}, 79
80 // FIXME(mblsha): Hmm, I can't trigger downloads in Cocoa version on
tapted 2016/10/17 07:02:47 do you mean it doesn't work in the Chrome Canary?
themblsha 2016/10/20 16:41:05 Whoops, weren't testing on the Canary. Added it to
81 // Cmd+Opt+L
82 // {true, false, false, true, kVK_ANSI_L, 0, IDC_SHOW_DOWNLOADS},
80 }; 83 };
81 84
82 *num_entries = arraysize(keyboard_shortcuts); 85 *num_entries = arraysize(keyboard_shortcuts);
83 86
84 return keyboard_shortcuts; 87 return keyboard_shortcuts;
85 } 88 }
86 89
87 const KeyboardShortcutData* GetDelayedWindowKeyboardShortcutTable( 90 const KeyboardShortcutData* GetDelayedWindowKeyboardShortcutTable(
88 size_t* num_entries) { 91 size_t* num_entries) {
89 static const KeyboardShortcutData keyboard_shortcuts[] = { 92 static const KeyboardShortcutData keyboard_shortcuts[] = {
90 //cmd shift cntrl option 93 //cmd shift cntrl option
91 //--- ----- ----- ------ 94 //--- ----- ----- ------
92 {false, false, false, false, kVK_Escape, 0, IDC_STOP}, 95 // {false, false, false, false, kVK_Escape, 0, IDC_STOP},
93 }; 96 };
94 97
95 *num_entries = arraysize(keyboard_shortcuts); 98 // *num_entries = arraysize(keyboard_shortcuts);
99 *num_entries = 0;
96 100
97 return keyboard_shortcuts; 101 return keyboard_shortcuts;
98 } 102 }
99 103
100 const KeyboardShortcutData* GetBrowserKeyboardShortcutTable( 104 const KeyboardShortcutData* GetBrowserKeyboardShortcutTable(
101 size_t* num_entries) { 105 size_t* num_entries) {
102 static const KeyboardShortcutData keyboard_shortcuts[] = { 106 static const KeyboardShortcutData keyboard_shortcuts[] = {
103 //cmd shift cntrl option 107 //cmd shift cntrl option
104 //--- ----- ----- ------ 108 //--- ----- ----- ------
105 {true, false, false, false, kVK_LeftArrow, 0, IDC_BACK}, 109 // {true, false, false, false, kVK_LeftArrow, 0, IDC_BACK},
106 {true, false, false, false, kVK_RightArrow, 0, IDC_FORWARD}, 110 // {true, false, false, false, kVK_RightArrow, 0, IDC_FORWARD},
107 {false, false, false, false, kVK_Delete, 0, IDC_BACKSPACE_BACK}, 111 // {false, false, false, false, kVK_Delete, 0, IDC_BACKSPACE_BACK},
108 {false, true, false, false, kVK_Delete, 0, IDC_BACKSPACE_FORWARD}, 112 // {false, true, false, false, kVK_Delete, 0, IDC_BACKSPACE_FORWARD },
109 {true, true, false, false, 0, 'c', IDC_DEV_TOOLS_INSPECT}, 113 // {true, true, false, false, 0, 'c', IDC_DEV_TOOLS_INSPECT },
110 }; 114 };
111 115
112 *num_entries = arraysize(keyboard_shortcuts); 116 // *num_entries = arraysize(keyboard_shortcuts);
117 *num_entries = 0;
113 118
114 return keyboard_shortcuts; 119 return keyboard_shortcuts;
115 } 120 }
116 121
117 static bool MatchesEventForKeyboardShortcut( 122 static bool MatchesEventForKeyboardShortcut(
118 const KeyboardShortcutData& shortcut, 123 const KeyboardShortcutData& shortcut,
119 bool command_key, bool shift_key, bool cntrl_key, bool opt_key, 124 bool command_key, bool shift_key, bool cntrl_key, bool opt_key,
120 int vkey_code, unichar key_char) { 125 int vkey_code, unichar key_char) {
121 // Expects that one of |key_char| or |vkey_code| is 0. 126 // Expects that one of |key_char| or |vkey_code| is 0.
122 DCHECK((shortcut.key_char == 0) ^ (shortcut.vkey_code == 0)); 127 DCHECK((shortcut.key_char == 0) ^ (shortcut.vkey_code == 0));
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 299 }
295 } 300 }
296 301
297 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8). 302 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8).
298 if ([event modifierFlags] & NSAlternateKeyMask) 303 if ([event modifierFlags] & NSAlternateKeyMask)
299 return rawChar; 304 return rawChar;
300 } 305 }
301 306
302 return noModifiersChar; 307 return noModifiersChar;
303 } 308 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/BUILD.gn » ('j') | chrome/browser/ui/views/accelerator_table.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698