| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef APP_KEYBOARD_CODE_CONVERSION_MAC_H_ | |
| 6 #define APP_KEYBOARD_CODE_CONVERSION_MAC_H_ | |
| 7 | |
| 8 #import <Cocoa/Cocoa.h> | |
| 9 #include "app/keyboard_codes_posix.h" | |
| 10 #include "base/basictypes.h" | |
| 11 | |
| 12 namespace app { | |
| 13 | |
| 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. | |
| 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 | |
| 18 // as NSControlKeyMask, NSShiftKeyMask, etc. | |
| 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 | |
| 21 // corresponding unicode character ignoring the modifiers will be stored in | |
| 22 // |characterIgnoringModifiers|. | |
| 23 // -1 will be returned if the keycode can't be converted. | |
| 24 // This function is mainly for simulating keyboard events in unit tests. | |
| 25 // See third_party/WebKit/WebKit/chromium/src/mac/WebInputEventFactory.mm for | |
| 26 // reverse conversion. | |
| 27 int MacKeyCodeForWindowsKeyCode(KeyboardCode keycode, | |
| 28 NSUInteger flags, | |
| 29 unichar* character, | |
| 30 unichar* characterIgnoringModifiers); | |
| 31 | |
| 32 } // namespace app | |
| 33 | |
| 34 #endif // APP_KEYBOARD_CODE_CONVERSION_MAC_H_ | |
| OLD | NEW |