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

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

Issue 1284433002: Revise ui::DomKey to unify character and non-character codes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IsDead Created 5 years, 4 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/dom/dom_key_data.inc ('k') | ui/events/keycodes/dom/keycode_converter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/keycodes/dom/keycode_converter.h
diff --git a/ui/events/keycodes/dom/keycode_converter.h b/ui/events/keycodes/dom/keycode_converter.h
index 71c3fd3031eee8f09651831344e7ee2ba959c479..6a2547c6f49698d27cf4eb2698cdd74da08a2c4e 100644
--- a/ui/events/keycodes/dom/keycode_converter.h
+++ b/ui/events/keycodes/dom/keycode_converter.h
@@ -6,7 +6,10 @@
#define UI_EVENTS_KEYCODES_DOM4_KEYCODE_CONVERTER_H_
#include <stdint.h>
+#include <string>
+
#include "base/basictypes.h"
+#include "ui/events/keycodes/dom/dom_key.h"
// For reference, the W3C UI Event spec is located at:
// http://www.w3.org/TR/uievents/
@@ -14,7 +17,6 @@
namespace ui {
enum class DomCode;
-enum class DomKey;
enum class DomKeyLocation { STANDARD, LEFT, RIGHT, NUMPAD };
@@ -64,10 +66,15 @@ class KeycodeConverter {
static DomKeyLocation DomCodeToLocation(DomCode dom_code);
// Convert a UI Events |key| string value into a DomKey.
+ // Accepts a character string containing either
+ // - a key name from http://www.w3.org/TR/DOM-Level-3-Events-key/, or
+ // - a single Unicode character (represented in UTF-8).
+ // Returns DomKey::NONE for other inputs, including |nullptr|.
static DomKey KeyStringToDomKey(const char* key);
// Convert a DomKey into a UI Events |key| string value.
- static const char* DomKeyToKeyString(DomKey dom_key);
+ // For an invalid DomKey, returns an empty string.
+ static std::string DomKeyToKeyString(DomKey dom_key);
// Returns true if the DomKey is a modifier.
static bool IsDomKeyForModifier(DomKey dom_key);
« no previous file with comments | « ui/events/keycodes/dom/dom_key_data.inc ('k') | ui/events/keycodes/dom/keycode_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698