OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 BASE_KEYBOARD_CODE_CONVERSION_MAC_H_ | 5 #ifndef APP_KEYBOARD_CODE_CONVERSION_MAC_H_ |
6 #define BASE_KEYBOARD_CODE_CONVERSION_MAC_H_ | 6 #define APP_KEYBOARD_CODE_CONVERSION_MAC_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #include "basictypes.h" | 9 #include "app/keyboard_codes_posix.h" |
10 #include "base/keyboard_codes_posix.h" | 10 #include "base/basictypes.h" |
11 | 11 |
12 namespace base { | 12 namespace app { |
13 | 13 |
14 // We use windows virtual keycodes throughout our keyboard event related code, | 14 // We use windows virtual keycodes throughout our keyboard event related code, |
15 // including unit tests. But Mac uses a different set of virtual keycodes. | 15 // including unit tests. But Mac uses a different set of virtual keycodes. |
16 // This function converts a windows virtual keycode into Mac's virtual key code | 16 // This function converts a windows virtual keycode into Mac's virtual key code |
17 // and corresponding unicode character. |flags| is the modifiers mask such | 17 // and corresponding unicode character. |flags| is the modifiers mask such |
18 // as NSControlKeyMask, NSShiftKeyMask, etc. | 18 // as NSControlKeyMask, NSShiftKeyMask, etc. |
19 // When success, the corresponding Mac's virtual key code will be returned. | 19 // When success, the corresponding Mac's virtual key code will be returned. |
20 // The corresponding unicode character will be stored in |character|, and the | 20 // The corresponding unicode character will be stored in |character|, and the |
21 // corresponding unicode character ignoring the modifiers will be stored in | 21 // corresponding unicode character ignoring the modifiers will be stored in |
22 // |characterIgnoringModifiers|. | 22 // |characterIgnoringModifiers|. |
23 // -1 will be returned if the keycode can't be converted. | 23 // -1 will be returned if the keycode can't be converted. |
24 // This function is mainly for simulating keyboard events in unit tests. | 24 // This function is mainly for simulating keyboard events in unit tests. |
25 // See third_party/WebKit/WebKit/chromium/src/mac/WebInputEventFactory.mm for | 25 // See third_party/WebKit/WebKit/chromium/src/mac/WebInputEventFactory.mm for |
26 // reverse conversion. | 26 // reverse conversion. |
27 int MacKeyCodeForWindowsKeyCode(KeyboardCode keycode, | 27 int MacKeyCodeForWindowsKeyCode(KeyboardCode keycode, |
28 NSUInteger flags, | 28 NSUInteger flags, |
29 unichar* character, | 29 unichar* character, |
30 unichar* characterIgnoringModifiers); | 30 unichar* characterIgnoringModifiers); |
31 | 31 |
32 } // namespace base | 32 } // namespace app |
33 | 33 |
34 #endif // BASE_KEYBOARD_CODE_CONVERSION_MAC_H_ | 34 #endif // APP_KEYBOARD_CODE_CONVERSION_MAC_H_ |
OLD | NEW |