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 | 7 |
8 #include <Carbon/Carbon.h> // For unichar. | 8 #include <Carbon/Carbon.h> // For unichar. |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 // this. Hence, we need three types of keyboard shortcuts: shortcuts that are | 38 // this. Hence, we need three types of keyboard shortcuts: shortcuts that are |
39 // intercepted before the Omnibox handles events, shortcuts that are | 39 // intercepted before the Omnibox handles events, shortcuts that are |
40 // intercepted after the Omnibox had a chance but did not handle them, and | 40 // intercepted after the Omnibox had a chance but did not handle them, and |
41 // shortcuts that are only handled when tab contents is focused. | 41 // shortcuts that are only handled when tab contents is focused. |
42 // | 42 // |
43 // This means cmd-left doesn't work if you hit cmd-l tab, which focusses | 43 // This means cmd-left doesn't work if you hit cmd-l tab, which focusses |
44 // something that's neither omnibox nor tab contents. This behavior is | 44 // something that's neither omnibox nor tab contents. This behavior is |
45 // consistent with safari and camino, and I think it's the best we can do | 45 // consistent with safari and camino, and I think it's the best we can do |
46 // without rewriting event dispatching ( http://crbug.com/251069 ). | 46 // without rewriting event dispatching ( http://crbug.com/251069 ). |
47 | 47 |
| 48 // Generic function used by CommandForWindowKeyboardShortcut, |
| 49 // CommandForDelayedWindowKeyboardShortcut and |
| 50 // CommandForBrowserKeyboardShortcut. |
| 51 int CommandForKeyboardShortcut(const std::vector<KeyboardShortcutData>& table, |
| 52 bool command_key, |
| 53 bool shift_key, |
| 54 bool cntrl_key, |
| 55 bool opt_key, |
| 56 int vkey_code, |
| 57 unichar key_char); |
| 58 |
48 // This returns shortcuts that should work no matter what component of the | 59 // This returns shortcuts that should work no matter what component of the |
49 // browser is focused. They are executed by the window, before any view has the | 60 // browser is focused. They are executed by the window, before any view has the |
50 // opportunity to override the shortcut (with the exception of the tab contents, | 61 // opportunity to override the shortcut (with the exception of the tab contents, |
51 // which first checks if the current web page wants to handle the shortcut). | 62 // which first checks if the current web page wants to handle the shortcut). |
52 int CommandForWindowKeyboardShortcut( | 63 int CommandForWindowKeyboardShortcut( |
53 bool command_key, bool shift_key, bool cntrl_key, bool opt_key, | 64 bool command_key, bool shift_key, bool cntrl_key, bool opt_key, |
54 int vkey_code, unichar key_char); | 65 int vkey_code, unichar key_char); |
55 | 66 |
56 // This returns shortcuts that should work no matter what component of the | 67 // This returns shortcuts that should work no matter what component of the |
57 // browser is focused. They are executed by the window, after any view has the | 68 // browser is focused. They are executed by the window, after any view has the |
(...skipping 21 matching lines...) Expand all Loading... |
79 // layout we want '{' character rather than '8' for opt-8.) | 90 // layout we want '{' character rather than '8' for opt-8.) |
80 unichar KeyCharacterForEvent(NSEvent* event); | 91 unichar KeyCharacterForEvent(NSEvent* event); |
81 | 92 |
82 // For testing purposes. | 93 // For testing purposes. |
83 const std::vector<KeyboardShortcutData>& GetWindowKeyboardShortcutTable(); | 94 const std::vector<KeyboardShortcutData>& GetWindowKeyboardShortcutTable(); |
84 const std::vector<KeyboardShortcutData>& | 95 const std::vector<KeyboardShortcutData>& |
85 GetDelayedWindowKeyboardShortcutTable(); | 96 GetDelayedWindowKeyboardShortcutTable(); |
86 const std::vector<KeyboardShortcutData>& GetBrowserKeyboardShortcutTable(); | 97 const std::vector<KeyboardShortcutData>& GetBrowserKeyboardShortcutTable(); |
87 | 98 |
88 #endif // #ifndef CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_ | 99 #endif // #ifndef CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_ |
OLD | NEW |