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

Side by Side Diff: ui/events/keycodes/dom4/keycode_converter.h

Issue 1120813002: Remove EF_FUNCTION_KEY and EF_NUMPAD_KEY. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add and fix tests Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_DOM4_KEYCODE_CONVERTER_H_ 5 #ifndef UI_EVENTS_KEYCODES_DOM4_KEYCODE_CONVERTER_H_
6 #define UI_EVENTS_KEYCODES_DOM4_KEYCODE_CONVERTER_H_ 6 #define UI_EVENTS_KEYCODES_DOM4_KEYCODE_CONVERTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 10
11 // For reference, the W3C UI Event spec is located at: 11 // For reference, the W3C UI Event spec is located at:
12 // http://www.w3.org/TR/uievents/ 12 // http://www.w3.org/TR/uievents/
13 13
14 namespace ui { 14 namespace ui {
15 15
16 enum class DomCode; 16 enum class DomCode;
17 enum class DomKey; 17 enum class DomKey;
18 18
19 enum class DomCodeLocation { STANDARD, LEFT, RIGHT, NUMPAD };
kpschoedel 2015/05/01 16:13:18 I know the spec calls these DOM_KEY_LOCATION_STAND
Wez 2015/05/05 00:29:09 I'd argue that DomKeyLocation is the better name,
kpschoedel 2015/05/05 16:30:08 Done.
20
19 // This structure is used to define the keycode mapping table. 21 // This structure is used to define the keycode mapping table.
20 // It is defined here because the unittests need access to it. 22 // It is defined here because the unittests need access to it.
21 typedef struct { 23 typedef struct {
22 // USB keycode: 24 // USB keycode:
23 // Upper 16-bits: USB Usage Page. 25 // Upper 16-bits: USB Usage Page.
24 // Lower 16-bits: USB Usage Id: Assigned ID within this usage page. 26 // Lower 16-bits: USB Usage Id: Assigned ID within this usage page.
25 uint32_t usb_keycode; 27 uint32_t usb_keycode;
26 28
27 // Contains one of the following: 29 // Contains one of the following:
28 // On Linux: XKB scancode 30 // On Linux: XKB scancode
(...skipping 26 matching lines...) Expand all
55 57
56 // Convert a DomCode into a native keycode. 58 // Convert a DomCode into a native keycode.
57 static int DomCodeToNativeKeycode(DomCode code); 59 static int DomCodeToNativeKeycode(DomCode code);
58 60
59 // Convert a UI Events |code| string value into a DomCode. 61 // Convert a UI Events |code| string value into a DomCode.
60 static DomCode CodeStringToDomCode(const char* code); 62 static DomCode CodeStringToDomCode(const char* code);
61 63
62 // Convert a DomCode into a UI Events |code| string value. 64 // Convert a DomCode into a UI Events |code| string value.
63 static const char* DomCodeToCodeString(DomCode dom_code); 65 static const char* DomCodeToCodeString(DomCode dom_code);
64 66
67 // Return the DomCodeLocation of a DomCode.
Wez 2015/05/05 00:29:09 Suggest stating explicitly that this is used to di
kpschoedel 2015/05/05 16:30:08 Done.
68 static DomCodeLocation DomCodeToLocation(DomCode dom_code);
69
65 // Convert a UI Events |key| string value into a DomKey. 70 // Convert a UI Events |key| string value into a DomKey.
66 static DomKey KeyStringToDomKey(const char* key); 71 static DomKey KeyStringToDomKey(const char* key);
67 72
68 // Convert a DomKey into a UI Events |key| string value. 73 // Convert a DomKey into a UI Events |key| string value.
69 static const char* DomKeyToKeyString(DomKey dom_key); 74 static const char* DomKeyToKeyString(DomKey dom_key);
70 75
71 // The following methods relate to USB keycodes. 76 // The following methods relate to USB keycodes.
72 // Note that USB keycodes are not part of any web standard. 77 // Note that USB keycodes are not part of any web standard.
73 // Please don't use USB keycodes in new code. 78 // Please don't use USB keycodes in new code.
74 79
(...skipping 21 matching lines...) Expand all
96 static const KeycodeMapEntry* GetKeycodeMapForTest(); 101 static const KeycodeMapEntry* GetKeycodeMapForTest();
97 static const char* DomKeyStringForTest(size_t index); 102 static const char* DomKeyStringForTest(size_t index);
98 103
99 private: 104 private:
100 DISALLOW_COPY_AND_ASSIGN(KeycodeConverter); 105 DISALLOW_COPY_AND_ASSIGN(KeycodeConverter);
101 }; 106 };
102 107
103 } // namespace ui 108 } // namespace ui
104 109
105 #endif // UI_EVENTS_KEYCODES_DOM4_KEYCODE_CONVERTER_H_ 110 #endif // UI_EVENTS_KEYCODES_DOM4_KEYCODE_CONVERTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698