OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_COMMAND_DISPATCHER_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_CHROME_COMMAND_DISPATCHER_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_COCOA_CHROME_COMMAND_DISPATCHER_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_COCOA_CHROME_COMMAND_DISPATCHER_DELEGATE_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #import "ui/base/cocoa/command_dispatcher.h" | 10 #import "ui/base/cocoa/command_dispatcher.h" |
11 | 11 |
12 // Implement CommandDispatcherDelegate by intercepting browser window keyboard | 12 // Implement CommandDispatcherDelegate by intercepting browser window keyboard |
13 // shortcuts and executing them with chrome::ExecuteCommand. | 13 // shortcuts and executing them with chrome::ExecuteCommand. |
14 @interface ChromeCommandDispatcherDelegate : NSObject<CommandDispatcherDelegate> | 14 @interface ChromeCommandDispatcherDelegate : NSObject<CommandDispatcherDelegate> |
15 | 15 |
16 // Checks if |event| is a keyboard shortcut listed in | 16 // Checks if |event| is a keyboard shortcut listed in |
17 // global_keyboard_shortcuts_mac.h. If so, execute the associated command. | 17 // global_keyboard_shortcuts_mac.h. If so, execute the associated command. |
18 // Returns YES if the event was handled. | 18 // Returns YES if the event was handled. |
19 - (BOOL)handleExtraKeyboardShortcut:(NSEvent*)event window:(NSWindow*)window; | 19 - (BOOL)handleExtraKeyboardShortcut:(NSEvent*)event window:(NSWindow*)window; |
20 | 20 |
21 @end | 21 @end |
22 | 22 |
| 23 namespace command_dispatcher { |
| 24 |
| 25 // Type of functions listed in global_keyboard_shortcuts_mac.h. |
| 26 typedef int (*KeyToCommandMapper)(bool, bool, bool, bool, int, unichar); |
| 27 |
| 28 // If the event is for a Browser window, and the key combination has an |
| 29 // associated command, execute the command. |
| 30 bool HandleExtraKeyboardShortcut( |
| 31 NSEvent* event, |
| 32 NSWindow* window, |
| 33 KeyToCommandMapper command_for_keyboard_shortcut); |
| 34 |
| 35 } // namespace command_dispatcher |
| 36 |
23 #endif // CHROME_BROWSER_UI_COCOA_CHROME_COMMAND_DISPATCHER_DELEGATE_H_ | 37 #endif // CHROME_BROWSER_UI_COCOA_CHROME_COMMAND_DISPATCHER_DELEGATE_H_ |
OLD | NEW |