OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 UI_EVENTS_KEYCODES_KEYBOARD_CODE_CONVERSION_H_ | 5 #ifndef UI_EVENTS_KEYCODES_KEYBOARD_CODE_CONVERSION_H_ |
6 #define UI_EVENTS_KEYCODES_KEYBOARD_CODE_CONVERSION_H_ | 6 #define UI_EVENTS_KEYCODES_KEYBOARD_CODE_CONVERSION_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "ui/events/events_base_export.h" | 10 #include "ui/events/events_base_export.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 // Returns true and sets the output parameters if the (dom_code, flags) pair | 63 // Returns true and sets the output parameters if the (dom_code, flags) pair |
64 // is interpreted as a control character; otherwise the output parameters | 64 // is interpreted as a control character; otherwise the output parameters |
65 // are untouched. | 65 // are untouched. |
66 EVENTS_BASE_EXPORT bool DomCodeToControlCharacter(DomCode dom_code, | 66 EVENTS_BASE_EXPORT bool DomCodeToControlCharacter(DomCode dom_code, |
67 int flags, | 67 int flags, |
68 DomKey* dom_key, | 68 DomKey* dom_key, |
69 base::char16* character, | 69 base::char16* character, |
70 KeyboardCode* key_code) | 70 KeyboardCode* key_code) |
71 WARN_UNUSED_RESULT; | 71 WARN_UNUSED_RESULT; |
72 | 72 |
73 // Returns the DomKey value associated with an ASCII/Unicode character. | |
74 // All printable characters and most other character codes use | |
75 // DomKey::CHARACTER, but a few ASCII C0 codes have their own DomKey. | |
76 EVENTS_BASE_EXPORT DomKey CharacterToDomKey(base::char16 character); | |
Wez
2015/05/06 23:51:53
nit: Using char16 here means we're limited to UCS2
kpschoedel
2015/05/07 16:21:33
Done.
| |
77 | |
73 // Returns a Windows-based VKEY for a non-printable DOM Level 3 |key|. | 78 // Returns a Windows-based VKEY for a non-printable DOM Level 3 |key|. |
74 // The returned VKEY is non-located (e.g. VKEY_SHIFT). | 79 // The returned VKEY is non-located (e.g. VKEY_SHIFT). |
75 EVENTS_BASE_EXPORT KeyboardCode | 80 EVENTS_BASE_EXPORT KeyboardCode |
76 NonPrintableDomKeyToKeyboardCode(DomKey dom_key); | 81 NonPrintableDomKeyToKeyboardCode(DomKey dom_key); |
77 | 82 |
78 // Determine the non-located VKEY corresponding to a located VKEY. | 83 // Determine the non-located VKEY corresponding to a located VKEY. |
79 // Most modifier keys have two kinds of KeyboardCode: located (e.g. | 84 // Most modifier keys have two kinds of KeyboardCode: located (e.g. |
80 // VKEY_LSHIFT and VKEY_RSHIFT), that indentify one of two specific | 85 // VKEY_LSHIFT and VKEY_RSHIFT), that indentify one of two specific |
81 // physical keys, and non-located (e.g. VKEY_SHIFT) that identify | 86 // physical keys, and non-located (e.g. VKEY_SHIFT) that identify |
82 // only the operation. | 87 // only the operation. |
83 EVENTS_BASE_EXPORT KeyboardCode | 88 EVENTS_BASE_EXPORT KeyboardCode |
84 LocatedToNonLocatedKeyboardCode(KeyboardCode key_code); | 89 LocatedToNonLocatedKeyboardCode(KeyboardCode key_code); |
85 | 90 |
86 // Determine the located VKEY corresponding to a non-located VKEY. | 91 // Determine the located VKEY corresponding to a non-located VKEY. |
87 EVENTS_BASE_EXPORT KeyboardCode | 92 EVENTS_BASE_EXPORT KeyboardCode |
88 NonLocatedToLocatedKeyboardCode(KeyboardCode key_code, DomCode dom_code); | 93 NonLocatedToLocatedKeyboardCode(KeyboardCode key_code, DomCode dom_code); |
89 | 94 |
90 // Returns a DOM Level 3 |code| from a Windows-based VKEY value. | 95 // Returns a DOM Level 3 |code| from a Windows-based VKEY value. |
91 // This assumes a US layout and should only be used when |code| cannot be | 96 // This assumes a US layout and should only be used when |code| cannot be |
92 // determined from a physical scan code, for example when a key event was | 97 // determined from a physical scan code, for example when a key event was |
93 // generated synthetically by JavaScript with only a VKEY value supplied. | 98 // generated synthetically by JavaScript with only a VKEY value supplied. |
94 EVENTS_BASE_EXPORT DomCode UsLayoutKeyboardCodeToDomCode(KeyboardCode key_code); | 99 EVENTS_BASE_EXPORT DomCode UsLayoutKeyboardCodeToDomCode(KeyboardCode key_code); |
95 | 100 |
96 } // namespace ui | 101 } // namespace ui |
97 | 102 |
98 #endif // UI_EVENTS_KEYCODES_KEYBOARD_CODE_CONVERSION_H_ | 103 #endif // UI_EVENTS_KEYCODES_KEYBOARD_CODE_CONVERSION_H_ |
OLD | NEW |