| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 | 9 |
| 10 struct KeyboardShortcutData { | 10 struct KeyboardShortcutData { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 bool command_key, bool shift_key, bool cntrl_key, bool opt_key, | 55 bool command_key, bool shift_key, bool cntrl_key, bool opt_key, |
| 56 int vkey_code, unichar key_char); | 56 int vkey_code, unichar key_char); |
| 57 | 57 |
| 58 // This returns shortcuts that should work only if the tab contents have focus | 58 // This returns shortcuts that should work only if the tab contents have focus |
| 59 // (e.g. cmd-left, which shouldn't do history navigation if e.g. the omnibox has | 59 // (e.g. cmd-left, which shouldn't do history navigation if e.g. the omnibox has |
| 60 // focus). | 60 // focus). |
| 61 int CommandForBrowserKeyboardShortcut( | 61 int CommandForBrowserKeyboardShortcut( |
| 62 bool command_key, bool shift_key, bool cntrl_key, bool opt_key, | 62 bool command_key, bool shift_key, bool cntrl_key, bool opt_key, |
| 63 int vkey_code, unichar key_char); | 63 int vkey_code, unichar key_char); |
| 64 | 64 |
| 65 // Returns the Chrome command associated with |event|, or -1 if not found. |
| 66 int CommandForKeyEvent(NSEvent* event); |
| 67 |
| 65 // Returns a keyboard event character for the given |event|. In most cases | 68 // Returns a keyboard event character for the given |event|. In most cases |
| 66 // this returns the first character of [NSEvent charactersIgnoringModifiers], | 69 // this returns the first character of [NSEvent charactersIgnoringModifiers], |
| 67 // but when [NSEvent character] has different printable ascii character | 70 // but when [NSEvent character] has different printable ascii character |
| 68 // we may return the first character of [NSEvent characters] instead. | 71 // we may return the first character of [NSEvent characters] instead. |
| 69 // (E.g. for dvorak-qwerty layout we want [NSEvent characters] rather than | 72 // (E.g. for dvorak-qwerty layout we want [NSEvent characters] rather than |
| 70 // [charactersIgnoringModifiers] for command keys. Similarly, on german | 73 // [charactersIgnoringModifiers] for command keys. Similarly, on german |
| 71 // layout we want '{' character rather than '8' for opt-8.) | 74 // layout we want '{' character rather than '8' for opt-8.) |
| 72 unichar KeyCharacterForEvent(NSEvent* event); | 75 unichar KeyCharacterForEvent(NSEvent* event); |
| 73 | 76 |
| 74 // For testing purposes. | 77 // For testing purposes. |
| 75 const KeyboardShortcutData* GetWindowKeyboardShortcutTable(size_t* num_entries); | 78 const KeyboardShortcutData* GetWindowKeyboardShortcutTable(size_t* num_entries); |
| 76 const KeyboardShortcutData* | 79 const KeyboardShortcutData* |
| 77 GetDelayedWindowKeyboardShortcutTable(size_t* num_entries); | 80 GetDelayedWindowKeyboardShortcutTable(size_t* num_entries); |
| 78 const KeyboardShortcutData* | 81 const KeyboardShortcutData* |
| 79 GetBrowserKeyboardShortcutTable(size_t* num_entries); | 82 GetBrowserKeyboardShortcutTable(size_t* num_entries); |
| 80 | 83 |
| 81 #endif // #ifndef CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_ | 84 #endif // #ifndef CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_ |
| OLD | NEW |