OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_ | 5 #ifndef CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_ |
6 #define CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_ | 6 #define CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 | 10 |
11 struct KeyboardShortcutData { | 11 struct KeyboardShortcutData { |
12 bool command_key; | 12 bool command_key; |
13 bool shift_key; | 13 bool shift_key; |
14 bool cntrl_key; | 14 bool cntrl_key; |
15 bool opt_key; | 15 bool opt_key; |
16 // Either one of vkey_code or key_char must be specified. For keys | 16 // Either one of vkey_code or key_char must be specified. For keys |
17 // whose virtual key code is hardware-dependent (kVK_ANSI_*) key_char | 17 // whose virtual key code is hardware-dependent (kVK_ANSI_*) key_char |
18 // should be specified instead. | 18 // should be specified instead. |
19 // Set 0 for the one you do not want to specify. | 19 // Set 0 for the one you do not want to specify. |
20 int vkey_code; // Virtual Key code for the command. | 20 int vkey_code; // Virtual Key code for the command. |
21 unichar key_char; // Key event characters for the command as reported by | 21 unichar key_char; // Key event characters for the command as reported by |
22 // [NSEvent charactersIgnoringModifiers]. | 22 // [NSEvent charactersIgnoringModifiers]. |
23 int chrome_command; // The chrome command # to execute for this shortcut. | 23 int chrome_command; // The chrome command # to execute for this shortcut. |
24 }; | 24 }; |
25 | 25 |
26 // Check if a given keycode + modifiers (or keychar + modifiers if the | 26 // Check if a given keycode + modifiers (or keychar + modifiers if the |
27 // |key_char| is specified) correspond to a given Chrome command. | 27 // |key_char| is specified) correspond to a given Chrome command. |
28 // returns: Command number (as passed to Browser::ExecuteCommand) or -1 if there | 28 // returns: Command number (as passed to |
29 // was no match. | 29 // BrowserCommandController::ExecuteCommand) or -1 if there was no match. |
30 // | 30 // |
31 // |performKeyEquivalent:| bubbles events up from the window to the views. If | 31 // |performKeyEquivalent:| bubbles events up from the window to the views. If |
32 // we let it bubble up to the Omnibox, then the Omnibox handles cmd-left/right | 32 // we let it bubble up to the Omnibox, then the Omnibox handles cmd-left/right |
33 // just fine, but it swallows cmd-1 and doesn't give us a chance to intercept | 33 // just fine, but it swallows cmd-1 and doesn't give us a chance to intercept |
34 // this. Hence, we need three types of keyboard shortcuts: shortcuts that are | 34 // this. Hence, we need three types of keyboard shortcuts: shortcuts that are |
35 // intercepted before the Omnibox handles events, shortcuts that are | 35 // intercepted before the Omnibox handles events, shortcuts that are |
36 // intercepted after the Omnibox had a chance but did not handle them, and | 36 // intercepted after the Omnibox had a chance but did not handle them, and |
37 // shortcuts that are only handled when tab contents is focused. | 37 // shortcuts that are only handled when tab contents is focused. |
38 // | 38 // |
39 // This means cmd-left doesn't work if you hit cmd-l tab, which focusses | 39 // This means cmd-left doesn't work if you hit cmd-l tab, which focusses |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 unichar KeyCharacterForEvent(NSEvent* event); | 73 unichar KeyCharacterForEvent(NSEvent* event); |
74 | 74 |
75 // For testing purposes. | 75 // For testing purposes. |
76 const KeyboardShortcutData* GetWindowKeyboardShortcutTable(size_t* num_entries); | 76 const KeyboardShortcutData* GetWindowKeyboardShortcutTable(size_t* num_entries); |
77 const KeyboardShortcutData* | 77 const KeyboardShortcutData* |
78 GetDelayedWindowKeyboardShortcutTable(size_t* num_entries); | 78 GetDelayedWindowKeyboardShortcutTable(size_t* num_entries); |
79 const KeyboardShortcutData* | 79 const KeyboardShortcutData* |
80 GetBrowserKeyboardShortcutTable(size_t* num_entries); | 80 GetBrowserKeyboardShortcutTable(size_t* num_entries); |
81 | 81 |
82 #endif // #ifndef CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_ | 82 #endif // #ifndef CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_ |
OLD | NEW |