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 #include <AppKit/NSEvent.h> | 5 #include <AppKit/NSEvent.h> |
6 #include <Carbon/Carbon.h> | 6 #include <Carbon/Carbon.h> |
7 | 7 |
8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 }; | 54 }; |
55 | 55 |
56 *num_entries = arraysize(keyboard_shortcuts); | 56 *num_entries = arraysize(keyboard_shortcuts); |
57 | 57 |
58 return keyboard_shortcuts; | 58 return keyboard_shortcuts; |
59 } | 59 } |
60 | 60 |
61 const KeyboardShortcutData* GetBrowserKeyboardShortcutTable | 61 const KeyboardShortcutData* GetBrowserKeyboardShortcutTable |
62 (size_t* num_entries) { | 62 (size_t* num_entries) { |
63 static const KeyboardShortcutData keyboard_shortcuts[] = { | 63 static const KeyboardShortcutData keyboard_shortcuts[] = { |
64 {true, false, false, false, kVK_LeftArrow, 0, IDC_BACK}, | 64 {true, false, false, false, kVK_LeftArrow, 0, IDC_BACK}, |
65 {true, false, false, false, kVK_RightArrow, 0, IDC_FORWARD}, | 65 {true, false, false, false, kVK_RightArrow, 0, IDC_FORWARD}, |
66 {false, false, false, false, kVK_Delete, 0, IDC_BACK}, | 66 {false, false, false, false, kVK_Delete, 0, IDC_BACK}, |
67 {false, true, false, false, kVK_Delete, 0, IDC_FORWARD}, | 67 {false, true, false, false, kVK_Delete, 0, IDC_FORWARD}, |
| 68 {true, true, false, false, 0, 'c', IDC_DEV_TOOLS_INSPECT}, |
68 }; | 69 }; |
69 | 70 |
70 *num_entries = arraysize(keyboard_shortcuts); | 71 *num_entries = arraysize(keyboard_shortcuts); |
71 | 72 |
72 return keyboard_shortcuts; | 73 return keyboard_shortcuts; |
73 } | 74 } |
74 | 75 |
75 static bool MatchesEventForKeyboardShortcut( | 76 static bool MatchesEventForKeyboardShortcut( |
76 const KeyboardShortcutData& shortcut, | 77 const KeyboardShortcutData& shortcut, |
77 bool command_key, bool shift_key, bool cntrl_key, bool opt_key, | 78 bool command_key, bool shift_key, bool cntrl_key, bool opt_key, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // |characters| is an alphabet (mainly for dvorak-qwerty layout), or | 168 // |characters| is an alphabet (mainly for dvorak-qwerty layout), or |
168 if (isalpha([characters characterAtIndex:0])) | 169 if (isalpha([characters characterAtIndex:0])) |
169 return [characters characterAtIndex:0]; | 170 return [characters characterAtIndex:0]; |
170 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8). | 171 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8). |
171 if ([event modifierFlags] & NSAlternateKeyMask) | 172 if ([event modifierFlags] & NSAlternateKeyMask) |
172 return [characters characterAtIndex:0]; | 173 return [characters characterAtIndex:0]; |
173 } | 174 } |
174 | 175 |
175 return [eventString characterAtIndex:0]; | 176 return [eventString characterAtIndex:0]; |
176 } | 177 } |
OLD | NEW |