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

Unified Diff: ui/events/keycodes/dom4/keycode_converter.h

Issue 641753003: DOM Level 3 .code and .key value enumerations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « ui/events/keycodes/dom4/generate_dom_values.py ('k') | ui/events/keycodes/dom4/keycode_converter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/keycodes/dom4/keycode_converter.h
diff --git a/ui/events/keycodes/dom4/keycode_converter.h b/ui/events/keycodes/dom4/keycode_converter.h
index a52d086e8de53ce156eb78b21cec5b37b8fbdba7..e455c43fd9c741b0b4f67e881a7f3f0450ae97f9 100644
--- a/ui/events/keycodes/dom4/keycode_converter.h
+++ b/ui/events/keycodes/dom4/keycode_converter.h
@@ -7,6 +7,8 @@
#include <stdint.h>
#include "base/basictypes.h"
+#include "ui/events/keycodes/dom4/domcode.h"
+#include "ui/events/keycodes/dom4/domkey.h"
// For reference, the W3C UI Event spec is located at:
// http://www.w3.org/TR/uievents/
@@ -29,7 +31,7 @@ typedef struct {
// The UIEvents (aka: DOM4Events) |code| value as defined in:
// https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm
garykac 2014/10/14 00:25:20 // The DOM3 Events |code| values as defined in: //
kpschoedel 2014/10/20 17:54:05 Done.
- const char* code;
+ DomCode code;
} KeycodeMapEntry;
// A class to convert between the current platform's native keycode (scancode)
@@ -44,6 +46,18 @@ class KeycodeConverter {
// The returned pointer references a static global string.
static const char* InvalidKeyboardEventCode();
+ // Convert a DomCode enum value to its corresponding UI Event |code| string.
+ static const char* DomCodeToCodeString(DomCode code);
+
+ // Convert a UI Event |code| string to its corresponding ui::DomCode.
+ static DomCode CodeStringToDomCode(const char *code);
+
+ // Convert a native (Mac/Win/Linux) keycode into the DomCode enum value.
+ static DomCode NativeKeycodeToDomCode(uint16_t native_keycode);
+
+ // Convert a DomCode enum value to a native keycode.
+ static uint16_t DomCodeToNativeKeycode(DomCode code);
+
// Convert a native (Mac/Win/Linux) keycode into the |code| string.
// The returned pointer references a static global string.
static const char* NativeKeycodeToCode(uint16_t native_keycode);
@@ -71,9 +85,19 @@ class KeycodeConverter {
// Convert a DOM3 Event |code| string into a USB keycode value.
static uint32_t CodeToUsbKeycode(const char* code);
+ // Convert a ui::DomKey to its corresponding UI Event |key| string.
+ static const char* DomKeyToKeyString(DomKey key);
+
+ // Convert a UI Event |key| string to its corresponding ui::DomKey.
+ static DomKey KeyStringToDomKey(const char *key);
+
// Static methods to support testing.
static size_t NumKeycodeMapEntriesForTest();
static const KeycodeMapEntry* GetKeycodeMapForTest();
+ static size_t NumDomCodeStringEntriesForTest();
+ static const char* const* DomCodeStringTableForTest();
+ static size_t NumDomKeyStringEntriesForTest();
+ static const char* const* DomKeyStringTableForTest();
private:
DISALLOW_COPY_AND_ASSIGN(KeycodeConverter);
« no previous file with comments | « ui/events/keycodes/dom4/generate_dom_values.py ('k') | ui/events/keycodes/dom4/keycode_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698