Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(953)

Unified Diff: ui/events/keycodes/keyboard_code_conversion.h

Issue 841263005: Use DOM- rather than Windows-based key code for non-layout cases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/events/keycodes/keyboard_code_conversion.h
diff --git a/ui/events/keycodes/keyboard_code_conversion.h b/ui/events/keycodes/keyboard_code_conversion.h
index 0c14ed74cee248798e11f3abfeb90cc9251c1548..a2958199de363df77c5520650d04edec5ecba79c 100644
--- a/ui/events/keycodes/keyboard_code_conversion.h
+++ b/ui/events/keycodes/keyboard_code_conversion.h
@@ -40,6 +40,36 @@ EVENTS_BASE_EXPORT bool GetMeaningFromKeyCode(KeyboardCode key_code,
int flags,
DomKey* dom_key,
base::char16* character);
+EVENTS_BASE_EXPORT bool DomCodeToMeaning(DomCode dom_code,
+ int flags,
+ DomKey* dom_key,
+ base::char16* character,
+ KeyboardCode* key_code);
Wez 2015/01/17 02:06:47 Provide a brief comment documenting the in & out p
kpschoedel 2015/02/18 17:14:01 Done.
+
+// Obtains the control character corresponding to a physical key.
Wez 2015/01/17 02:06:48 Need to clarify what you mean by "control characte
kpschoedel 2015/02/18 17:14:01 Yes, see below.
+// In some contexts this is used instead of the key layout.
Wez 2015/01/17 02:06:48 Why? What is the layout that this function applies
kpschoedel 2015/02/18 17:14:01 As far as I can tell from searching commits, this
Wez 2015/02/19 23:16:08 :( That sounds like something Gary may know more
+// Returns true and sets the output parameters if the (dom_code, flags) pair
+// is interpreted as a control character.
Wez 2015/01/17 02:06:48 So this parameter _only_ succeeds if the supplied
kpschoedel 2015/02/18 17:14:01 Yes, commented.
+EVENTS_BASE_EXPORT bool DomCodeToControlCharacter(
+ DomCode dom_code,
+ int flags,
+ DomKey* dom_key,
+ base::char16* character,
+ KeyboardCode* key_code);
+
+// Returns a Windows-based VKEY for a non-printable DOM Level 3 |key|.
+// The returned VKEY is non-located (e.g. VKEY_SHIFT).
+EVENTS_BASE_EXPORT KeyboardCode
+NonPrintableDomKeyToKeyboardCode(DomKey dom_key);
+
+// Returns the Windows-based VKEY value corresponding to a DOM Level 3 |code|.
+// The returned VKEY is located (e.g. VKEY_LSHIFT).
+EVENTS_BASE_EXPORT KeyboardCode DomCodeToKeyboardCode(DomCode dom_code);
Wez 2015/01/17 02:06:48 How does this behave for Numeric Keypad keys, whic
kpschoedel 2015/02/18 17:14:01 Does the modified comment help? This is currently
+
+// Returns the Windows-based VKEY value corresponding to a DOM Level 3 |code|.
+// The returned VKEY is non-located (e.g. VKEY_SHIFT).
+EVENTS_BASE_EXPORT KeyboardCode
+DomCodeToNonLocatedKeyboardCode(DomCode dom_code);
Wez 2015/01/17 02:06:47 nit: Do you need this or could you just let the ca
kpschoedel 2015/02/18 17:14:01 Right, removed this.
// Determine the non-located VKEY corresponding to a located VKEY.
// Most modifier keys have two kinds of KeyboardCode: located (e.g.
@@ -53,6 +83,11 @@ LocatedToNonLocatedKeyboardCode(KeyboardCode key_code);
EVENTS_BASE_EXPORT KeyboardCode
NonLocatedToLocatedKeyboardCode(KeyboardCode key_code, DomCode dom_code);
+// Returns a DOM Level 3 |code| from a Windows-based VKEY value.
+// This assumes a US layout and should only be used when |code| cannot be
+// determined from a physical scan code.
Wez 2015/01/17 02:06:48 Do you mean "when a key event has no |code| value
kpschoedel 2015/02/18 17:14:01 At the moment this is used for the old constructor
Wez 2015/02/19 23:16:08 OK, cool. Would it cause a lot of churn to rename
kpschoedel 2015/04/10 18:32:33 Done.
+EVENTS_BASE_EXPORT DomCode KeyboardCodeToDomCode(KeyboardCode key_code);
+
} // namespace ui
#endif // UI_EVENTS_KEYCODES_KEYBOARD_CODE_CONVERSION_H_

Powered by Google App Engine
This is Rietveld 408576698