OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_COCOA_CHROME_EVENT_PROCESSING_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_CHROME_EVENT_PROCESSING_WINDOW_H_ |
6 #define CHROME_BROWSER_UI_COCOA_CHROME_EVENT_PROCESSING_WINDOW_H_ | 6 #define CHROME_BROWSER_UI_COCOA_CHROME_EVENT_PROCESSING_WINDOW_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #import "base/mac/scoped_nsobject.h" | |
10 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" | 11 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" |
11 | 12 |
13 @protocol CommandDispatchDelegate; | |
tapted
2015/07/31 03:06:50
with the commandDelegate accessor removed, this ca
jackhou1
2015/08/04 01:03:58
Done.
| |
14 | |
15 @class ChromeCommandDispatchDelegate; | |
16 | |
12 // Override NSWindow to access unhandled keyboard events (for command | 17 // Override NSWindow to access unhandled keyboard events (for command |
13 // processing); subclassing NSWindow is the only method to do | 18 // processing); subclassing NSWindow is the only method to do |
14 // this. | 19 // this. |
15 @interface ChromeEventProcessingWindow : UnderlayOpenGLHostingWindow { | 20 @interface ChromeEventProcessingWindow : UnderlayOpenGLHostingWindow { |
16 @private | 21 @private |
17 BOOL redispatchingEvent_; | 22 base::scoped_nsobject<ChromeCommandDispatchDelegate> commandDelegate_; |
18 BOOL eventHandled_; | |
19 } | 23 } |
20 | 24 |
25 - (id<CommandDispatchDelegate>)commandDelegate; | |
26 | |
21 // Sends a key event to |NSApp sendEvent:|, but also makes sure that it's not | 27 // Sends a key event to |NSApp sendEvent:|, but also makes sure that it's not |
22 // short-circuited to the RWHV. This is used to send keyboard events to the menu | 28 // short-circuited to the RWHV. This is used to send keyboard events to the menu |
23 // and the cmd-` handler if a keyboard event comes back unhandled from the | 29 // and the cmd-` handler if a keyboard event comes back unhandled from the |
24 // renderer. The event must be of type |NSKeyDown|, |NSKeyUp|, or | 30 // renderer. The event must be of type |NSKeyDown|, |NSKeyUp|, or |
25 // |NSFlagsChanged|. | 31 // |NSFlagsChanged|. |
26 // Returns |YES| if |event| has been handled. | 32 // Returns |YES| if |event| has been handled. |
27 - (BOOL)redispatchKeyEvent:(NSEvent*)event; | 33 - (BOOL)redispatchKeyEvent:(NSEvent*)event; |
28 | 34 |
29 // Checks if |event| is a window, delayed window, or browser keyboard shortcut. | 35 // NSWindow overrides: |
tapted
2015/07/31 03:06:50
These don't need to be redeclared in the header
jackhou1
2015/08/04 01:03:58
Done.
| |
30 // (See global_keyboard_shortcuts_mac.h for details). If so, execute the | 36 - (BOOL)performKeyEquivalent:(NSEvent*)event; |
31 // associated command. Returns YES if the event was handled. | 37 - (void)sendEvent:(NSEvent*)event; |
32 - (BOOL)handleExtraKeyboardShortcut:(NSEvent*)event; | |
33 | |
34 // Override, so we can handle global keyboard events. | |
35 - (BOOL)performKeyEquivalent:(NSEvent*)theEvent; | |
36 | 38 |
37 @end | 39 @end |
38 | 40 |
39 #endif // CHROME_BROWSER_UI_COCOA_CHROME_EVENT_PROCESSING_WINDOW_H_ | 41 #endif // CHROME_BROWSER_UI_COCOA_CHROME_EVENT_PROCESSING_WINDOW_H_ |
OLD | NEW |