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, 0, 'p', IDC_ADVANCED_PRINT}, | |
85 }; | 84 }; |
86 | 85 |
87 *num_entries = arraysize(keyboard_shortcuts); | 86 *num_entries = arraysize(keyboard_shortcuts); |
88 | 87 |
89 return keyboard_shortcuts; | 88 return keyboard_shortcuts; |
90 } | 89 } |
91 | 90 |
92 static bool MatchesEventForKeyboardShortcut( | 91 static bool MatchesEventForKeyboardShortcut( |
93 const KeyboardShortcutData& shortcut, | 92 const KeyboardShortcutData& shortcut, |
94 bool command_key, bool shift_key, bool cntrl_key, bool opt_key, | 93 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... |
213 return rawChar; | 212 return rawChar; |
214 } | 213 } |
215 | 214 |
216 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8). | 215 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8). |
217 if ([event modifierFlags] & NSAlternateKeyMask) | 216 if ([event modifierFlags] & NSAlternateKeyMask) |
218 return [characters characterAtIndex:0]; | 217 return [characters characterAtIndex:0]; |
219 } | 218 } |
220 | 219 |
221 return [eventString characterAtIndex:0]; | 220 return [eventString characterAtIndex:0]; |
222 } | 221 } |
OLD | NEW |