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 | 16 @private |
17 BOOL redispatchingEvent_; | 17 BOOL redispatchingEvent_; |
| 18 BOOL eventHandled_; |
18 } | 19 } |
19 | 20 |
20 // Returns |YES| if |event| has been shortcircuited and should not be processed | 21 // Returns |YES| if |event| has been shortcircuited and should not be processed |
21 // further. | 22 // further. |
22 - (BOOL)shortcircuitEvent:(NSEvent*)event; | 23 - (BOOL)shortcircuitEvent:(NSEvent*)event; |
23 | 24 |
24 // Sends an event to |NSApp sendEvent:|, but also makes sure that it's not | 25 // 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 // 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 // and the cmd-` handler if a keyboard event comes back unhandled from the |
27 // renderer. | 28 // renderer. |
28 - (void)redispatchEvent:(NSEvent*)event; | 29 // Returns |YES| if |event| has been handled. |
| 30 - (BOOL)redispatchEvent:(NSEvent*)event; |
29 | 31 |
30 // See global_keyboard_shortcuts_mac.h for details on the next two functions. | 32 // See global_keyboard_shortcuts_mac.h for details on the next two functions. |
31 | 33 |
32 // Checks if |event| is a window keyboard shortcut. If so, dispatches it to the | 34 // Checks if |event| is a window keyboard shortcut. If so, dispatches it to the |
33 // window controller's |executeCommand:| and returns |YES|. | 35 // window controller's |executeCommand:| and returns |YES|. |
34 - (BOOL)handleExtraWindowKeyboardShortcut:(NSEvent*)event; | 36 - (BOOL)handleExtraWindowKeyboardShortcut:(NSEvent*)event; |
35 | 37 |
36 // Checks if |event| is a browser keyboard shortcut. If so, dispatches it to the | 38 // Checks if |event| is a browser keyboard shortcut. If so, dispatches it to the |
37 // window controller's |executeCommand:| and returns |YES|. | 39 // window controller's |executeCommand:| and returns |YES|. |
38 - (BOOL)handleExtraBrowserKeyboardShortcut:(NSEvent*)event; | 40 - (BOOL)handleExtraBrowserKeyboardShortcut:(NSEvent*)event; |
39 | 41 |
40 // Override, so we can handle global keyboard events. | 42 // Override, so we can handle global keyboard events. |
41 - (BOOL)performKeyEquivalent:(NSEvent*)theEvent; | 43 - (BOOL)performKeyEquivalent:(NSEvent*)theEvent; |
42 | 44 |
43 @end | 45 @end |
44 | 46 |
45 #endif // CHROME_BROWSER_COCOA_CHROME_EVENT_PROCESSING_WINDOW_H_ | 47 #endif // CHROME_BROWSER_COCOA_CHROME_EVENT_PROCESSING_WINDOW_H_ |
OLD | NEW |