OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #import "chrome/browser/cocoa/browser_window_impl.h" | |
6 | |
7 #import "chrome/browser/cocoa/browser_window_controller.h" | |
8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | |
9 | |
10 @implementation ChromeBrowserWindowImpl | |
11 | |
12 - (BOOL)performKeyEquivalent:(NSEvent *)event { | |
pink (ping after 24hrs)
2009/07/08 13:48:17
* goes with the type, no space.
| |
13 | |
pink (ping after 24hrs)
2009/07/08 13:48:17
omit blank line
| |
14 // Extract info from event. | |
15 NSUInteger modifers = [event modifierFlags]; | |
16 bool cmd_key = modifers & NSCommandKeyMask; | |
pink (ping after 24hrs)
2009/07/08 13:48:17
use obj-c naming in obj-c code, eg |cmdKey|
pink (ping after 24hrs)
2009/07/08 13:48:17
make these const? *shrug* just a thought.
| |
17 bool shift_key = modifers & NSShiftKeyMask; | |
18 bool cntrl_key = modifers & NSControlKeyMask; | |
19 int keyCode = [event keyCode]; | |
20 | |
21 int cmd_num = CommandForKeyboardShortcut(cmd_key, shift_key, cntrl_key, | |
22 keyCode); | |
23 | |
24 BrowserWindowController* controller = | |
25 (BrowserWindowController*)[self delegate]; | |
26 // A bit of sanity. | |
27 DCHECK([controller isKindOfClass:[BrowserWindowController class]]); | |
28 DCHECK([controller respondsToSelector:@selector(executeCommand:)]); | |
29 | |
30 if (cmd_num != -1) { | |
31 [controller executeCommand:cmd_num]; | |
32 return YES; | |
33 } | |
34 | |
35 return [super performKeyEquivalent:event]; | |
36 } | |
37 | |
38 @end | |
OLD | NEW |