Index: chrome/browser/cocoa/browser_window_impl.mm |
diff --git a/chrome/browser/cocoa/browser_window_impl.mm b/chrome/browser/cocoa/browser_window_impl.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bf4d2020b613ddede58d3bd7a6b79ee4e38dbff7 |
--- /dev/null |
+++ b/chrome/browser/cocoa/browser_window_impl.mm |
@@ -0,0 +1,38 @@ |
+// Copyright (c) 2009 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#import "chrome/browser/cocoa/browser_window_impl.h" |
+ |
+#import "chrome/browser/cocoa/browser_window_controller.h" |
+#include "chrome/browser/global_keyboard_shortcuts_mac.h" |
+ |
+@implementation ChromeBrowserWindowImpl |
+ |
+- (BOOL)performKeyEquivalent:(NSEvent *)event { |
pink (ping after 24hrs)
2009/07/08 13:48:17
* goes with the type, no space.
|
+ |
pink (ping after 24hrs)
2009/07/08 13:48:17
omit blank line
|
+ // Extract info from event. |
+ NSUInteger modifers = [event modifierFlags]; |
+ 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.
|
+ bool shift_key = modifers & NSShiftKeyMask; |
+ bool cntrl_key = modifers & NSControlKeyMask; |
+ int keyCode = [event keyCode]; |
+ |
+ int cmd_num = CommandForKeyboardShortcut(cmd_key, shift_key, cntrl_key, |
+ keyCode); |
+ |
+ BrowserWindowController* controller = |
+ (BrowserWindowController*)[self delegate]; |
+ // A bit of sanity. |
+ DCHECK([controller isKindOfClass:[BrowserWindowController class]]); |
+ DCHECK([controller respondsToSelector:@selector(executeCommand:)]); |
+ |
+ if (cmd_num != -1) { |
+ [controller executeCommand:cmd_num]; |
+ return YES; |
+ } |
+ |
+ return [super performKeyEquivalent:event]; |
+} |
+ |
+@end |