| 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 #ifndef CHROME_BROWSER_COCOA_CHROME_EVENT_PROCESSING_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_COCOA_CHROME_EVENT_PROCESSING_WINDOW_H_ |
| 6 #define CHROME_BROWSER_COCOA_CHROME_EVENT_PROCESSING_WINDOW_H_ | 6 #define CHROME_BROWSER_COCOA_CHROME_EVENT_PROCESSING_WINDOW_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/scoped_nsobject.h" | 10 #include "base/scoped_nsobject.h" |
| 11 | 11 |
| 12 // Override NSWindow to access unhandled keyboard events (for command | 12 // Override NSWindow to access unhandled keyboard events (for command |
| 13 // processing); subclassing NSWindow is the only method to do | 13 // processing); subclassing NSWindow is the only method to do |
| 14 // this. | 14 // this. |
| 15 @interface ChromeEventProcessingWindow : NSWindow | 15 @interface ChromeEventProcessingWindow : NSWindow { |
| 16 @private |
| 17 BOOL redispatchingEvent_; |
| 18 } |
| 19 |
| 20 // Returns |YES| if |event| has been shortcircuited and should not be processed |
| 21 // further. |
| 22 - (BOOL)shortcircuitEvent:(NSEvent*)event; |
| 23 |
| 24 // Sends an event to |NSApp sendEvent:|, but also makes sure that it's not |
| 25 // short-circuited to the RWHV. This is used to send keyboard events to the menu |
| 26 // and the cmd-` handler if a keyboard event comes back unhandled from the |
| 27 // renderer. |
| 28 - (void)redispatchEvent:(NSEvent*)event; |
| 16 | 29 |
| 17 // See global_keyboard_shortcuts_mac.h for details on the next two functions. | 30 // See global_keyboard_shortcuts_mac.h for details on the next two functions. |
| 18 | 31 |
| 19 // Checks if |event| is a window keyboard shortcut. If so, dispatches it to the | 32 // Checks if |event| is a window keyboard shortcut. If so, dispatches it to the |
| 20 // window controller's |executeCommand:| and returns |YES|. | 33 // window controller's |executeCommand:| and returns |YES|. |
| 21 - (BOOL)handleExtraWindowKeyboardShortcut:(NSEvent*)event; | 34 - (BOOL)handleExtraWindowKeyboardShortcut:(NSEvent*)event; |
| 22 | 35 |
| 23 // Checks if |event| is a browser keyboard shortcut. If so, dispatches it to the | 36 // Checks if |event| is a browser keyboard shortcut. If so, dispatches it to the |
| 24 // window controller's |executeCommand:| and returns |YES|. | 37 // window controller's |executeCommand:| and returns |YES|. |
| 25 - (BOOL)handleExtraBrowserKeyboardShortcut:(NSEvent*)event; | 38 - (BOOL)handleExtraBrowserKeyboardShortcut:(NSEvent*)event; |
| 26 | 39 |
| 27 // Override, so we can handle global keyboard events. | 40 // Override, so we can handle global keyboard events. |
| 28 - (BOOL)performKeyEquivalent:(NSEvent*)theEvent; | 41 - (BOOL)performKeyEquivalent:(NSEvent*)theEvent; |
| 29 | 42 |
| 30 @end | 43 @end |
| 31 | 44 |
| 32 #endif // CHROME_BROWSER_COCOA_CHROME_EVENT_PROCESSING_WINDOW_H_ | 45 #endif // CHROME_BROWSER_COCOA_CHROME_EVENT_PROCESSING_WINDOW_H_ |
| OLD | NEW |