OLD | NEW |
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 <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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 const KeyboardShortcutData* GetBrowserKeyboardShortcutTable( | 74 const KeyboardShortcutData* GetBrowserKeyboardShortcutTable( |
75 size_t* num_entries) { | 75 size_t* num_entries) { |
76 static const KeyboardShortcutData keyboard_shortcuts[] = { | 76 static const KeyboardShortcutData keyboard_shortcuts[] = { |
77 //cmd shift cntrl option | 77 //cmd shift cntrl option |
78 //--- ----- ----- ------ | 78 //--- ----- ----- ------ |
79 {true, false, false, false, kVK_LeftArrow, 0, IDC_BACK}, | 79 {true, false, false, false, kVK_LeftArrow, 0, IDC_BACK}, |
80 {true, false, false, false, kVK_RightArrow, 0, IDC_FORWARD}, | 80 {true, false, false, false, kVK_RightArrow, 0, IDC_FORWARD}, |
81 {false, false, false, false, kVK_Delete, 0, IDC_BACK}, | 81 {false, false, false, false, kVK_Delete, 0, IDC_BACK}, |
82 {false, true, false, false, kVK_Delete, 0, IDC_FORWARD}, | 82 {false, true, false, false, kVK_Delete, 0, IDC_FORWARD}, |
83 {true, true, false, false, 0, 'c', IDC_DEV_TOOLS_INSPECT}, | 83 {true, true, false, false, 0, 'c', IDC_DEV_TOOLS_INSPECT}, |
| 84 {true, true, false, false, kVK_ANSI_Period, 0, |
| 85 IDC_TOGGLE_SPEECH_INPUT}, |
84 }; | 86 }; |
85 | 87 |
86 *num_entries = arraysize(keyboard_shortcuts); | 88 *num_entries = arraysize(keyboard_shortcuts); |
87 | 89 |
88 return keyboard_shortcuts; | 90 return keyboard_shortcuts; |
89 } | 91 } |
90 | 92 |
91 static bool MatchesEventForKeyboardShortcut( | 93 static bool MatchesEventForKeyboardShortcut( |
92 const KeyboardShortcutData& shortcut, | 94 const KeyboardShortcutData& shortcut, |
93 bool command_key, bool shift_key, bool cntrl_key, bool opt_key, | 95 bool command_key, bool shift_key, bool cntrl_key, bool opt_key, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 return rawChar; | 214 return rawChar; |
213 } | 215 } |
214 | 216 |
215 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8). | 217 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8). |
216 if ([event modifierFlags] & NSAlternateKeyMask) | 218 if ([event modifierFlags] & NSAlternateKeyMask) |
217 return [characters characterAtIndex:0]; | 219 return [characters characterAtIndex:0]; |
218 } | 220 } |
219 | 221 |
220 return [eventString characterAtIndex:0]; | 222 return [eventString characterAtIndex:0]; |
221 } | 223 } |
OLD | NEW |